Skip to content

Commit 185e1ec

Browse files
committed
fix: set period value to period.id
BREAKING CHANGE: CronState changed
1 parent 9d199ad commit 185e1ec

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

core/src/core.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ export default {
7878
return acc
7979
}, {})
8080
},
81+
periodIndex(){
82+
return this.periods.reduce((acc, p, i) => {
83+
acc[p.id] = i
84+
return acc
85+
})
86+
},
8187
computedFields(){
8288
return this.fields.map((f) => new Field(f.id, f.items))
8389
},
@@ -151,11 +157,12 @@ export default {
151157
152158
period:{
153159
attrs:{
154-
value: this.selectedPeriod.value
160+
value: this.selectedPeriod.id
155161
},
156162
events:{
157-
input: (evt) => {
158-
this.selectedPeriod = evt
163+
input: (periodId) => {
164+
let i = this.periodIndex[periodId] || 0
165+
this.selectedPeriod = this.periods[i]
159166
}
160167
},
161168
items: this.periods,

docs/src/api/types/cronState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type CronState = {
1515
}>,
1616
period: {
1717
attrs: {
18-
value: Array<string> //array of period ids
18+
value: string //selected period id
1919
},
2020
events: {
21-
input: (arg1: Period) => void
21+
input: (periodId: string) => void
2222
},
2323
items: Array<Period>,
2424
prefix: string,

vuetify/src/CronEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<v-row align="baseline" dense>
66
<v-col v-if="period.prefix" class="flex-grow-0">{{period.prefix}}</v-col>
77
<v-col cols="auto">
8-
<v-select class="fit" v-bind="period.attrs" :items="period.items" @input="period.events.input" return-object dense></v-select>
8+
<v-select class="fit" v-bind="period.attrs" :items="period.items" @input="period.events.input" item-value="id" dense></v-select>
99
</v-col>
1010
<v-col v-if="period.suffix" class="flex-grow-0">{{period.suffix}}</v-col>
1111

0 commit comments

Comments
 (0)