Skip to content

Commit

Permalink
Merge ab68579 into 48b54b3
Browse files Browse the repository at this point in the history
  • Loading branch information
mherwege authored Apr 5, 2023
2 parents 48b54b3 + ab68579 commit 591137e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
label: 'label=',
item: 'item=',
icon: 'icon=',
widgetattr: ['url=', 'refresh=', 'service=', 'period=', 'height=', 'mappings=', 'minValue=', 'maxValue=', 'step=', 'encoding=', 'yAxisDecimalPattern='],
widgetattr: ['url=', 'refresh=', 'service=', 'period=', 'height=', 'mappings=', 'minValue=', 'maxValue=', 'step=', 'encoding=', 'yAxisDecimalPattern=', 'inputHint='],
widgetboolattr: ['legend='],
widgetfreqattr: 'sendFrequency=',
widgetfrcitmattr: 'forceasitem=',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@
<f7-list-item v-if="supports('forceAsItem')" title="Force as item">
<f7-toggle slot="after" :checked="widget.config.forceAsItem" @toggle:change="widget.config.forceAsItem = $event" />
</f7-list-item>
<f7-list-item v-if="supports('inputHint')" title="Hint" smart-select :smart-select-params="{openIn: 'popover', closeOnSelect: true}">
<select name="inputHints" required :value="widget.config.inputHint" @change="updateParameter('inputHint', $event)">
<option v-for="def in inputHintDefs" :key="def.key" :value="def.key">
{{ def.value }}
</option>
</select>
</f7-list-item>
</ul>
</f7-list>
</f7-card-content>
Expand Down Expand Up @@ -84,6 +91,7 @@ export default {
Slider: ['sendFrequency', 'switchEnabled', 'minValue', 'maxValue', 'step'],
Setpoint: ['minValue', 'maxValue', 'step'],
Colorpicker: ['sendFrequency'],
Input: ['inputHint'],
Default: ['height']
},
periodDefs: [
Expand All @@ -100,6 +108,13 @@ export default {
{ key: '2M', value: '2 Months' },
{ key: '3M', value: '3 Months' },
{ key: 'Y', value: 'Year' }
],
inputHintDefs: [
{ key: 'text', value: 'Text' },
{ key: 'number', value: 'Number' },
{ key: 'date', value: 'Date' },
{ key: 'time', value: 'Time' },
{ key: 'datetime', value: 'Date and Time' }
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ export default {
validationWarnings.push(widget.component + ' widget ' + label + ', no period configured')
}
})
widgetList.filter(widget => widget.component === 'Input').forEach(widget => {
if (!(widget.config && widget.config.inputHint && ['text', 'number', 'date', 'time', 'datetime'].includes(widget.config.inputHint))) {
let label = widget.config && widget.config.label ? widget.config.label : 'without label'
validationWarnings.push(widget.component + ' widget ' + label + ', invalid inputHint configured: ' + widget.config.inputHint)
}
})
widgetList.forEach(widget => {
if (widget.config) {
Object.keys(widget.config).filter(attr => ['mappings', 'visibility', 'valuecolor', 'labelcolor', 'iconcolor'].includes(attr)).forEach(attr => {
Expand Down

0 comments on commit 591137e

Please sign in to comment.