From e80b2219401ae821e6fc389ac126e313afb6f998 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Thu, 13 Jun 2024 16:01:19 +0200 Subject: [PATCH] Sitemap editor: Fix issues with AND, buttongrid and numeric commands (#2609) Fixes https://github.com/openhab/openhab-webui/issues/2605 Also fixes issue with Buttongrid and non-numeric commands --------- Signed-off-by: Mark Herwege --- .../web/src/assets/sitemap-lexer.nearley | 8 ++++---- .../pagedesigner/sitemap/attribute-details.vue | 10 +++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley b/bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley index d57c53eea..0bb3ee282 100644 --- a/bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley +++ b/bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley @@ -162,15 +162,15 @@ Mapping -> Command _ %colon _ Command _ %equals _ Label Buttons -> Button {% (d) => [d[0]] %} | Buttons _ %comma _ Button {% (d) => d[0].concat([d[4]]) %} Button -> %number _ %colon _ %number _ %colon _ ButtonValue {% (d) => { return { 'row': parseInt(d[0].value), 'column': parseInt(d[4].value), 'command': d[8] } } %} -ButtonValue -> Command _ %equals _ Label {% (d) => d[0][0].value + '=' + d[4] %} - | Command _ %equals _ Label _ %equals _ WidgetIconAttrValue {% (d) => d[0][0].value + '=' + d[4] + '=' + d[8].join("") %} +ButtonValue -> Command _ %equals _ Label {% (d) => d[0] + '=' + d[4] %} + | Command _ %equals _ Label _ %equals _ WidgetIconAttrValue {% (d) => d[0] + '=' + d[4] + '=' + d[8].join("") %} Command -> %number | %identifier {% (d) => d[0].value %} | %string {% (d) => '"' + d[0].value + '"' %} Label -> %number | %identifier {% (d) => d[0].value %} | %string {% (d) => '"' + d[0].value + '"' %} -Visibilities -> Conditions {% (d) => d[0] %} +Visibilities -> Conditions {% (d) => [d[0]] %} | Visibilities _ %comma _ Conditions {% (d) => d[0].concat(d[4]) %} Colors -> Color {% (d) => [d[0]] %} @@ -184,7 +184,7 @@ IconRules -> IconRule IconRule -> Conditions _ %equals _ WidgetIconAttrValue {% (d) => d[0] + '=' + d[4].join("") %} | WidgetIconAttrValue {% (d) => d[0].join("") %} -Conditions -> Condition +Conditions -> Condition {% (d) => d[0] %} | Conditions _ %and _ Condition {% (d) => d[0] + ' AND ' + d[4] %} Condition -> ConditionCommand _ ConditionComparator _ ConditionValue {% (d) => d[0][0].value + d[2][0].value + d[4][0].value %} | ConditionComparator _ ConditionValue {% (d) => d[0][0].value + d[2][0].value %} diff --git a/bundles/org.openhab.ui/web/src/components/pagedesigner/sitemap/attribute-details.vue b/bundles/org.openhab.ui/web/src/components/pagedesigner/sitemap/attribute-details.vue index 536234d00..d0b97bd8c 100644 --- a/bundles/org.openhab.ui/web/src/components/pagedesigner/sitemap/attribute-details.vue +++ b/bundles/org.openhab.ui/web/src/components/pagedesigner/sitemap/attribute-details.vue @@ -3,7 +3,7 @@ - + - + @@ -60,7 +60,11 @@ export default { fieldStyle (field, fieldidx) { let style = {} if (this.fieldProp(field, 'width') !== undefined) { - style.width = this.fieldProp(field, 'width') + style.flexGrow = '0' + style.flexShrink = '0' + style.flexBasis = this.fieldProp(field, 'width') + } else { + style.flex = 1 } if (fieldidx > 0) { style.paddingLeft = '5px'