Skip to content

Commit

Permalink
support staticIcon parameter in sitemaps
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <[email protected]>
  • Loading branch information
mherwege committed Jul 31, 2023
1 parent edc124e commit ed736bd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
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 @@ -9,6 +9,7 @@
label: 'label=',
item: 'item=',
icon: 'icon=',
widgetstaticattr: 'staticIcon',
widgetattr: ['url=', 'refresh=', 'service=', 'period=', 'height=', 'mappings=', 'minValue=', 'maxValue=', 'step=', 'encoding=', 'yAxisDecimalPattern=', 'inputHint='],
widgetboolattr: ['legend='],
widgetfreqattr: 'sendFrequency=',
Expand Down Expand Up @@ -97,6 +98,7 @@ Widget -> %nlwidget _ WidgetAttrs:*
WidgetAttrs -> WidgetAttr {% (d) => [d[0]] %}
| WidgetAttrs _ WidgetAttr {% (d) => d[0].concat([d[2]]) %}
WidgetAttr -> %widgetswitchattr {% (d) => ['switchEnabled', true] %}
| %widgetstaticattr {% (d) => ['staticIcon', true] %}
| %widgetfrcitmattr WidgetBooleanAttrValue {% (d) => ['forceAsItem', d[1]] %}
| %widgetboolattr WidgetBooleanAttrValue {% (d) => [d[0].value, d[1]] %}
| %widgetfreqattr WidgetAttrValue {% (d) => ['frequency', d[1]] %}
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 === 'staticIcon') {
dsl += ' staticIcon'
} 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 @@ -13,6 +13,9 @@
<oh-icon :icon="widget.config.icon" height="32" width="32" />
</div>
</f7-list-input>
<f7-list-item title="Static icon">
<f7-toggle slot="after" :checked="widget.config.staticIcon" @toggle:change="widget.config.staticIcon = $event" />
</f7-list-item>
</ul>
<ul>
<!-- additional controls -->
Expand Down

0 comments on commit ed736bd

Please sign in to comment.