From 23c7428b89017935142c4704b24edeb5c97e39cc Mon Sep 17 00:00:00 2001 From: Max Hauser Date: Mon, 5 Feb 2024 11:49:33 +0100 Subject: [PATCH] fixed issue, that Basic Image 8 is not configurable for 0 value (#355) * fixed issue, that Basic Image 8 is not configurable for 0 value - closes #354 * rm log --- README.md | 3 +++ src/public/widgets/basic.html | 2 +- src/src/Vis/Widgets/Basic/BasicImage8.tsx | 4 ++-- src/src/Vis/visWidgetsCatalog.jsx | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3b0853533..d6760e832 100644 --- a/README.md +++ b/README.md @@ -263,6 +263,9 @@ E.g., if it was used in a menu and the menu is red, the circle would be red. ### **WORK IN PROGRESS** --> ## Changelog +### **WORK IN PROGRESS** +* (foxriver76) fixed issue, that Basic Image 8 is not configurable for 0 value + ### 2.9.28 (2024-02-03) * (foxriver76) correctly determine the vis instance in all cases diff --git a/src/public/widgets/basic.html b/src/public/widgets/basic.html index 1d732f6ed..a1a837f9c 100644 --- a/src/public/widgets/basic.html +++ b/src/public/widgets/basic.html @@ -163,7 +163,7 @@ "en": "Write here css style, like: 'color:red;background:white'", "de": "Hier muss CSS Stil stehen, wie 'color:red;background:white'", "ru": "CSS Стиль, например: 'color:red;background:white'"}, - "count": {"en": "Values number to", "de": "Wertsanzahl bis", "ru": "Количество значений до"}, + "count": {"en": "Values number to", "de": "Werteanzahl bis", "ru": "Количество значений до"}, "test_list": {"en": "Test value", "de": "Testwert", "ru": "Тестовое значение"}, "urlValue": {"en": "Call URL on click", "de": "Rufe URL bei click", "ru": "Вызвать URL при нажатии"}, "group_ccontrol": {"en": "Advanced control", "de": "Extrasteuerung", "ru": "Продвинутое управление"}, diff --git a/src/src/Vis/Widgets/Basic/BasicImage8.tsx b/src/src/Vis/Widgets/Basic/BasicImage8.tsx index 70e446822..c80691d00 100644 --- a/src/src/Vis/Widgets/Basic/BasicImage8.tsx +++ b/src/src/Vis/Widgets/Basic/BasicImage8.tsx @@ -30,7 +30,7 @@ export default class BasicImage8 extends VisRxWidget { { name: 'count', type: 'number', - default: 1, + default: 0, onChange: async (_field: unknown, data: Record, changeData: (data: Record) => void) => { const { count } = data; @@ -46,7 +46,7 @@ export default class BasicImage8 extends VisRxWidget { }, { name: 'images', label: 'Image', - indexFrom: 1, + indexFrom: 0, indexTo: 'count', fields: [ { diff --git a/src/src/Vis/visWidgetsCatalog.jsx b/src/src/Vis/visWidgetsCatalog.jsx index 99ee3f8c2..a627f2c50 100644 --- a/src/src/Vis/visWidgetsCatalog.jsx +++ b/src/src/Vis/visWidgetsCatalog.jsx @@ -495,7 +495,8 @@ export const parseAttributes = (widgetParams, widgetIndex, commonGroups, commonF commonGroups = commonGroups || { common: 1 }; commonFields = commonFields || {}; const fields = deepClone(widgetParams); - let groupIndex = fields.findIndex(group => group.indexFrom); + let groupIndex = fields.findIndex(group => typeof group.indexFrom === 'number'); + while (groupIndex > -1) { const group = fields[groupIndex]; group.singleName = group.name; @@ -518,6 +519,7 @@ export const parseAttributes = (widgetParams, widgetIndex, commonGroups, commonF delete group.indexFrom; delete group.indexTo; const indexedGroups = []; + for (let i = from; i <= to; i++) { const indexedGroup = { ...deepClone(group),