Skip to content

Commit

Permalink
Sitemap editor: Add slider releaseOnly parameter support (#2390)
Browse files Browse the repository at this point in the history
Closes #2345.

Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
  • Loading branch information
mherwege authored Feb 22, 2024
1 parent 94ccd31 commit 9704404
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bundles/org.openhab.ui/web/src/assets/sitemap-lexer.nearley
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
widgetvisiattr: 'visibility=',
widgetcolorattr: ['labelcolor=', 'valuecolor=', 'iconcolor='],
widgetswitchattr: 'switchSupport',
widgetronlyattr: 'releaseOnly',
nlwidget: ['Switch ', 'Selection ', 'Slider ', 'Setpoint ', 'Input ', 'Video ', 'Chart ', 'Webview ', 'Colorpicker ', 'Mapview ', 'Buttongrid ', 'Default '],
lwidget: ['Text ', 'Group ', 'Image ', 'Frame '],
lparen: '(',
Expand Down Expand Up @@ -111,6 +112,7 @@ Widget -> %nlwidget _ WidgetAttrs:*
WidgetAttrs -> WidgetAttr {% (d) => [d[0]] %}
| WidgetAttrs _ WidgetAttr {% (d) => d[0].concat([d[2]]) %}
WidgetAttr -> %widgetswitchattr {% (d) => ['switchEnabled', true] %}
| %widgetronlyattr {% (d) => ['releaseOnly', true] %}
| %widgetfrcitmattr _ WidgetBooleanAttrValue {% (d) => ['forceAsItem', d[2]] %}
| %widgetboolattr _ WidgetBooleanAttrValue {% (d) => [d[0].value, d[2]] %}
| %widgetfreqattr _ WidgetAttrValue {% (d) => ['frequency', d[2]] %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function writeWidget (widget, indent) {
if ((Array.isArray(widget.config[key]) && widget.config[key].filter(Boolean).length <= 0)) continue
if (key === 'switchEnabled') {
dsl += ' switchSupport'
} else if (key === 'releaseOnly') {
dsl += ' releaseOnly'
} else if (key === 'frequency') {
dsl += ' sendFrequency=' + widget.config[key]
} else if (key === 'forceAsItem') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<f7-list-item v-if="supports('switchEnabled')" title="Switch enabled">
<f7-toggle slot="after" :checked="widget.config.switchEnabled" @toggle:change="widget.config.switchEnabled = $event" />
</f7-list-item>
<f7-list-item v-if="supports('releaseOnly')" title="Release only">
<f7-toggle slot="after" :checked="widget.config.releaseOnly" @toggle:change="widget.config.releaseOnly = $event" />
</f7-list-item>
<f7-list-item v-if="supports('legend')" title="Legend">
<f7-toggle slot="after" :checked="widget.config.legend" @toggle:change="widget.config.legend = $event" />
</f7-list-item>
Expand Down Expand Up @@ -87,7 +90,7 @@ export default {
Chart: ['service', 'period', 'refresh', 'legend', 'forceAsItem', 'yAxisDecimalPattern'],
Webview: ['url', 'height'],
Mapview: ['height'],
Slider: ['sendFrequency', 'switchEnabled', 'minValue', 'maxValue', 'step'],
Slider: ['sendFrequency', 'switchEnabled', 'releaseOnly', 'minValue', 'maxValue', 'step'],
Setpoint: ['minValue', 'maxValue', 'step'],
Colorpicker: ['sendFrequency'],
Input: ['inputHint'],
Expand Down

0 comments on commit 9704404

Please sign in to comment.