diff --git a/public/js/components/Calendar/Abstract.js b/public/js/components/Calendar/Abstract.js index 07eb03933..94af02091 100644 --- a/public/js/components/Calendar/Abstract.js +++ b/public/js/components/Calendar/Abstract.js @@ -1,4 +1,4 @@ -import CalendarHeader from './Header'; +import CalendarHeader from './Header.js'; export default { components: { diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index 73e11fa20..7ade4df60 100644 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -27,11 +27,16 @@ export default { showWeeks: this.showWeeks, noMonthView: this.noMonthView, noWeekView: this.noWeekView, - eventsAreNull: Vue.computed(() => this.events === null) + eventsAreNull: Vue.computed(() => this.events === null), + classHeader: this.classHeader }; }, props: { events: Array, + initialDate: { + type: [Date, String], + default: new Date() + }, showWeeks: { type: Boolean, default: true @@ -40,6 +45,10 @@ export default { type: String, default: 'month' }, + classHeader: { + type: [String,Object,Array], + default: '' + }, minimized: Boolean, noWeekView: Boolean, noMonthView: Boolean @@ -103,7 +112,7 @@ export default { if (!this.noMonthView) allowedInitialModes.push('month'); this.mode = allowedInitialModes[allowedInitialModes.indexOf(this.initialMode)] || allowedInitialModes.pop(); - this.date.set(new Date(2023,0,1)); + this.date.set(new Date(this.initialDate)); this.focusDate.set(this.date); }, mounted() { diff --git a/public/js/components/Calendar/Header.js b/public/js/components/Calendar/Header.js index 0ead55215..17882aa81 100644 --- a/public/js/components/Calendar/Header.js +++ b/public/js/components/Calendar/Header.js @@ -1,7 +1,8 @@ export default { inject: [ 'eventsAreNull', - 'size' + 'size', + 'classHeader' ], props: { title: String @@ -11,9 +12,26 @@ export default { 'next', 'click' ], + computed: { + myClassHeader() { + // TODO(chris): + {'btn-sm': !this.size} + let c = this.classHeader; + if (Array.isArray(c)) { + if (!this.size) + c.push('btn-sm'); + } else if (typeof c === 'string' || c instanceof String) { + if (!this.size) + c += ' btn-sm'; + } else { + c['btn-sm'] = !this.size; + } + + return c; + } + }, template: ` -