Compare commits

..

No commits in common. 'main' and 'v0.2.0' have entirely different histories.
main ... v0.2.0

@ -1,6 +1,6 @@
{ {
"name": "@tiny-components/datepicker", "name": "@tiny-components/datepicker",
"version": "0.3.2", "version": "0.2.0",
"description": "Datepicker for Desktop and Mobile", "description": "Datepicker for Desktop and Mobile",
"repository": { "repository": {
"type": "git", "type": "git",

@ -66,14 +66,19 @@ export default {
this.state.date = dayjs(data.date) this.state.date = dayjs(data.date)
}) })
store.on('update-props', (data) => {
this.state.date = dayjs(this.props.date)
this.update()
})
this.createWeeksAndDays() this.createWeeksAndDays()
}, },
/**
*
*
*/
onBeforeUpdate() {
store.trigger(this.state.namespace + 'change', {
date: this.state.date
})
},
/** /**
* create weeks and days * create weeks and days
* *
@ -133,11 +138,6 @@ export default {
} }
this.state.date = day this.state.date = day
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -151,10 +151,6 @@ export default {
this.state.date = this.state.date.month(event.target.value) this.state.date = this.state.date.month(event.target.value)
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -168,10 +164,6 @@ export default {
this.state.date = this.state.date.year(event.target.value) this.state.date = this.state.date.year(event.target.value)
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -186,10 +178,6 @@ export default {
this.state.date = this.state.date.subtract(1, 'month') this.state.date = this.state.date.subtract(1, 'month')
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -204,10 +192,6 @@ export default {
this.state.date = this.state.date.add(1, 'month') this.state.date = this.state.date.add(1, 'month')
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -221,10 +205,6 @@ export default {
this.state.date = this.state.date.subtract(1, 'year') this.state.date = this.state.date.subtract(1, 'year')
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },
@ -238,10 +218,6 @@ export default {
this.state.date = this.state.date.add(1, 'year') this.state.date = this.state.date.add(1, 'year')
this.createWeeksAndDays() this.createWeeksAndDays()
store.trigger(this.state.namespace + 'change', {
date: this.state.date.clone()
})
this.update() this.update()
}, },

Loading…
Cancel
Save