Skip to content

Commit

Permalink
Config parameter: Implement date and datetime contexts (#2838)
Browse files Browse the repository at this point in the history
Closes #2816.
Depends on openhab/openhab-core#4428.

---------

Signed-off-by: Florian Hotze <dev@florianhotze.com>
  • Loading branch information
florian-h05 authored Oct 26, 2024
1 parent c6dda3c commit acb464a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import ParameterLocation from './controls/parameter-location.vue'
import ParameterCronExpression from './controls/parameter-cronexpression.vue'
import ParameterDayOfWeek from './controls/parameter-dayofweek.vue'
import ParameterTime from './controls/parameter-time.vue'
import ParameterDate from '@/components/config/controls/parameter-date.vue'
import ParameterDatetime from '@/components/config/controls/parameter-datetime.vue'
import ParameterPageWidget from './controls/parameter-pagewidget.vue'
import ParameterRule from './controls/parameter-rule.vue'
import ParameterPersistenceService from './controls/parameter-persistenceservice.vue'
Expand Down Expand Up @@ -74,6 +76,10 @@ export default {
return ParameterDayOfWeek
} else if (configDescription.type === 'TEXT' && configDescription.context === 'time') {
return ParameterTime
} else if (configDescription.type === 'TEXT' && configDescription.context === 'date') {
return ParameterDate
} else if (configDescription.type === 'TEXT' && configDescription.context === 'datetime') {
return ParameterDatetime
} else if (configDescription.type === 'TEXT' && configDescription.context && configDescription.context.indexOf('page') >= 0) {
return ParameterPageWidget
} else if (configDescription.type === 'TEXT' && configDescription.context && configDescription.context.indexOf('widget') >= 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<ul>
<f7-list-input
ref="input"
type="date"
:floating-label="$theme.md"
:label="configDescription.label"
:name="configDescription.name"
:value="value"
:required="configDescription.required" validate
@input="updateValue" />
</ul>
</template>

<script>
export default {
props: ['configDescription', 'value'],
methods: {
updateValue (event) {
this.$emit('input', event.target.value)
}
}
}
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<ul>
<f7-list-input
class="parameter-datetime"
ref="input"
type="datetime-local"
:floating-label="$theme.md"
:label="configDescription.label"
:name="configDescription.name"
:value="value"
:required="configDescription.required" validate
@input="updateValue" />
</ul>
</template>

<style lang="stylus">
.parameter-datetime
input[type="datetime-local"]
max-width 100% !important
</style>

<script>
export default {
props: ['configDescription', 'value'],
methods: {
updateValue (event) {
this.$emit('input', event.target.value)
}
}
}
</script>

0 comments on commit acb464a

Please sign in to comment.