Compare commits

...

4 Commits
v0.2.0 ... main

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

@ -66,17 +66,12 @@ export default {
this.state.date = dayjs(data.date) this.state.date = dayjs(data.date)
}) })
this.createWeeksAndDays() store.on('update-props', (data) => {
}, this.state.date = dayjs(this.props.date)
this.update()
/**
*
*
*/
onBeforeUpdate() {
store.trigger(this.state.namespace + 'change', {
date: this.state.date
}) })
this.createWeeksAndDays()
}, },
/** /**
@ -138,6 +133,11 @@ 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,6 +151,10 @@ 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()
}, },
@ -164,6 +168,10 @@ 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()
}, },
@ -178,6 +186,10 @@ 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()
}, },
@ -192,6 +204,10 @@ 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()
}, },
@ -205,6 +221,10 @@ 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()
}, },
@ -218,6 +238,10 @@ 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