From 208def74652be7668905db3d4a9e6a9b496d8f71 Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Tue, 26 Sep 2023 19:40:32 +0200 Subject: [PATCH] Allow configuration of oh- components in modals Fixes #927. Signed-off-by: Florian Hotze --- .../web/src/components/widgets/modals/modal-mixin.js | 3 ++- .../web/src/components/widgets/widget-mixin.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js index 1b723f5310..912e6e246e 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/modals/modal-mixin.js @@ -23,7 +23,8 @@ export default { root: component, store: this.$store.getters.trackedItems, props: this.modalConfig, - vars: this.vars + vars: this.vars, + modalConfig: this.modalConfig // For configuration of oh- components } }, modalStyle () { diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js index 7aa459e7ce..c528e008ef 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-mixin.js @@ -59,8 +59,9 @@ export default { config () { if (!this.context || !this.context.component) return null let evalConfig = {} - if (this.context.component.config) { - const sourceConfig = this.context.component.config + // Fallback to modelConfig for oh- components to allow configuring them in modals + const sourceConfig = this.context.component.config || (this.componentType.startsWith('oh-') ? this.context.modalConfig : {}) + if (sourceConfig) { if (typeof sourceConfig !== 'object') return {} for (const key in sourceConfig) { if (key === 'visible' || key === 'visibleTo' || key === 'stylesheet') continue