|
1 | 1 | <template>
|
2 |
| - <div class="dp__month_year_row"> |
| 2 | + <div class="dp--header-wrap"> |
3 | 3 | <template v-if="$slots['month-year']">
|
4 |
| - <slot |
5 |
| - name="month-year" |
6 |
| - v-bind="{ month, year, months, years, updateMonthYear, handleMonthYearChange, instance }" |
7 |
| - /> |
| 4 | + <div class="dp__month_year_wrap"> |
| 5 | + <slot |
| 6 | + name="month-year" |
| 7 | + v-bind="{ month, year, months, years, updateMonthYear, handleMonthYearChange, instance }" |
| 8 | + /> |
| 9 | + </div> |
8 | 10 | </template>
|
9 | 11 | <template v-else>
|
10 |
| - <ArrowBtn |
11 |
| - v-if="showLeftIcon(defaultedMultiCalendars, instance) && !vertical" |
12 |
| - :aria-label="defaultedAriaLabels?.prevMonth" |
13 |
| - :disabled="isDisabled(false)" |
14 |
| - @activate="handleMonthYearChange(false, true)" |
15 |
| - @set-ref="setElRefs($event, 0)" |
16 |
| - > |
17 |
| - <slot v-if="$slots['arrow-left']" name="arrow-left" /> |
18 |
| - <ChevronLeftIcon v-if="!$slots['arrow-left']" /> |
19 |
| - </ArrowBtn> |
20 |
| - <div |
21 |
| - class="dp__month_year_wrap" |
22 |
| - :class="{ |
23 |
| - dp__year_disable_select: disableYearSelect, |
24 |
| - }" |
25 |
| - > |
26 |
| - <template v-for="(type, i) in selectionButtonsDisplay" :key="type.type"> |
27 |
| - <button |
28 |
| - :ref="(el) => setElRefs(el, i + 1)" |
29 |
| - type="button" |
30 |
| - class="dp__btn dp__month_year_select" |
31 |
| - tabindex="0" |
32 |
| - :aria-label="type.ariaLabel" |
33 |
| - :data-test="`${type.type}-toggle-overlay-${instance}`" |
34 |
| - @click="type.toggle" |
35 |
| - @keydown.enter.prevent="type.toggle" |
36 |
| - @keydown.space.prevent="type.toggle" |
37 |
| - > |
38 |
| - <slot v-if="$slots[type.type]" :name="type.type" :text="type.text" :value="props[type.type]" /> |
39 |
| - <template v-if="!$slots[type.type]">{{ type.text }}</template> |
40 |
| - </button> |
41 |
| - <transition :name="transitionName(type.showSelectionGrid)" :css="showTransition"> |
42 |
| - <SelectionOverlay |
43 |
| - v-if="type.showSelectionGrid" |
44 |
| - :items="type.items" |
45 |
| - :arrow-navigation="arrowNavigation" |
46 |
| - :hide-navigation="hideNavigation" |
47 |
| - :is-last="autoApply && !defaultedConfig.keepActionRow" |
48 |
| - :skip-button-ref="false" |
49 |
| - :config="config" |
50 |
| - :type="type.type" |
51 |
| - :header-refs="[]" |
52 |
| - :esc-close="escClose" |
53 |
| - :menu-wrap-ref="menuWrapRef" |
54 |
| - :text-input="textInput" |
55 |
| - :aria-labels="ariaLabels" |
56 |
| - @selected="type.updateModelValue" |
57 |
| - @toggle="type.toggle" |
| 12 | + <div v-if="$slots['top-extra']"> |
| 13 | + <slot name="top-extra" :value="internalModelValue" /> |
| 14 | + </div> |
| 15 | + <div class="dp__month_year_wrap"> |
| 16 | + <ArrowBtn |
| 17 | + v-if="showLeftIcon(defaultedMultiCalendars, instance) && !vertical" |
| 18 | + :aria-label="defaultedAriaLabels?.prevMonth" |
| 19 | + :disabled="isDisabled(false)" |
| 20 | + @activate="handleMonthYearChange(false, true)" |
| 21 | + @set-ref="setElRefs($event, 0)" |
| 22 | + > |
| 23 | + <slot v-if="$slots['arrow-left']" name="arrow-left" /> |
| 24 | + <ChevronLeftIcon v-if="!$slots['arrow-left']" /> |
| 25 | + </ArrowBtn> |
| 26 | + <div |
| 27 | + class="dp__month_year_wrap" |
| 28 | + :class="{ |
| 29 | + dp__year_disable_select: disableYearSelect, |
| 30 | + }" |
| 31 | + > |
| 32 | + <template v-for="(type, i) in selectionButtonsDisplay" :key="type.type"> |
| 33 | + <button |
| 34 | + :ref="(el) => setElRefs(el, i + 1)" |
| 35 | + type="button" |
| 36 | + class="dp__btn dp__month_year_select" |
| 37 | + tabindex="0" |
| 38 | + :aria-label="type.ariaLabel" |
| 39 | + :data-test="`${type.type}-toggle-overlay-${instance}`" |
| 40 | + @click="type.toggle" |
| 41 | + @keydown.enter.prevent="type.toggle" |
| 42 | + @keydown.space.prevent="type.toggle" |
58 | 43 | >
|
59 |
| - <template #button-icon> |
60 |
| - <slot v-if="$slots['calendar-icon']" name="calendar-icon" /> |
61 |
| - <CalendarIcon v-if="!$slots['calendar-icon']" /> |
62 |
| - </template> |
63 |
| - <template v-if="$slots[`${type.type}-overlay-value`]" #item="{ item }"> |
64 |
| - <slot :name="`${type.type}-overlay-value`" :text="item.text" :value="item.value" /> |
65 |
| - </template> |
66 |
| - <template v-if="$slots[`${type.type}-overlay`]" #overlay> |
67 |
| - <slot :name="`${type.type}-overlay`" v-bind="overlaySlotProps(type.type)" /> |
68 |
| - </template> |
69 |
| - <template v-if="$slots[`${type.type}-overlay-header`]" #header> |
70 |
| - <slot :name="`${type.type}-overlay-header`" :toggle="type.toggle" /> |
71 |
| - </template> |
72 |
| - </SelectionOverlay> |
73 |
| - </transition> |
74 |
| - </template> |
| 44 | + <slot |
| 45 | + v-if="$slots[type.type]" |
| 46 | + :name="type.type" |
| 47 | + :text="type.text" |
| 48 | + :value="props[type.type]" |
| 49 | + /> |
| 50 | + <template v-if="!$slots[type.type]">{{ type.text }}</template> |
| 51 | + </button> |
| 52 | + <transition :name="transitionName(type.showSelectionGrid)" :css="showTransition"> |
| 53 | + <SelectionOverlay |
| 54 | + v-if="type.showSelectionGrid" |
| 55 | + :items="type.items" |
| 56 | + :arrow-navigation="arrowNavigation" |
| 57 | + :hide-navigation="hideNavigation" |
| 58 | + :is-last="autoApply && !defaultedConfig.keepActionRow" |
| 59 | + :skip-button-ref="false" |
| 60 | + :config="config" |
| 61 | + :type="type.type" |
| 62 | + :header-refs="[]" |
| 63 | + :esc-close="escClose" |
| 64 | + :menu-wrap-ref="menuWrapRef" |
| 65 | + :text-input="textInput" |
| 66 | + :aria-labels="ariaLabels" |
| 67 | + @selected="type.updateModelValue" |
| 68 | + @toggle="type.toggle" |
| 69 | + > |
| 70 | + <template #button-icon> |
| 71 | + <slot v-if="$slots['calendar-icon']" name="calendar-icon" /> |
| 72 | + <CalendarIcon v-if="!$slots['calendar-icon']" /> |
| 73 | + </template> |
| 74 | + <template v-if="$slots[`${type.type}-overlay-value`]" #item="{ item }"> |
| 75 | + <slot :name="`${type.type}-overlay-value`" :text="item.text" :value="item.value" /> |
| 76 | + </template> |
| 77 | + <template v-if="$slots[`${type.type}-overlay`]" #overlay> |
| 78 | + <slot :name="`${type.type}-overlay`" v-bind="overlaySlotProps(type.type)" /> |
| 79 | + </template> |
| 80 | + <template v-if="$slots[`${type.type}-overlay-header`]" #header> |
| 81 | + <slot :name="`${type.type}-overlay-header`" :toggle="type.toggle" /> |
| 82 | + </template> |
| 83 | + </SelectionOverlay> |
| 84 | + </transition> |
| 85 | + </template> |
| 86 | + </div> |
| 87 | + <ArrowBtn |
| 88 | + v-if="showLeftIcon(defaultedMultiCalendars, instance) && vertical" |
| 89 | + :aria-label="defaultedAriaLabels?.prevMonth" |
| 90 | + :disabled="isDisabled(false)" |
| 91 | + @activate="handleMonthYearChange(false, true)" |
| 92 | + > |
| 93 | + <slot v-if="$slots['arrow-up']" name="arrow-up" /> |
| 94 | + <ChevronUpIcon v-if="!$slots['arrow-up']" /> |
| 95 | + </ArrowBtn> |
| 96 | + <ArrowBtn |
| 97 | + v-if="showRightIcon(defaultedMultiCalendars, instance)" |
| 98 | + ref="rightIcon" |
| 99 | + :disabled="isDisabled(true)" |
| 100 | + :aria-label="defaultedAriaLabels?.nextMonth" |
| 101 | + @activate="handleMonthYearChange(true, true)" |
| 102 | + @set-ref="setElRefs($event, disableYearSelect ? 2 : 3)" |
| 103 | + > |
| 104 | + <slot |
| 105 | + v-if="$slots[vertical ? 'arrow-down' : 'arrow-right']" |
| 106 | + :name="vertical ? 'arrow-down' : 'arrow-right'" |
| 107 | + /> |
| 108 | + <component |
| 109 | + :is="vertical ? ChevronDownIcon : ChevronRightIcon" |
| 110 | + v-if="!$slots[vertical ? 'arrow-down' : 'arrow-right']" |
| 111 | + /> |
| 112 | + </ArrowBtn> |
75 | 113 | </div>
|
76 |
| - <ArrowBtn |
77 |
| - v-if="showLeftIcon(defaultedMultiCalendars, instance) && vertical" |
78 |
| - :aria-label="defaultedAriaLabels?.prevMonth" |
79 |
| - :disabled="isDisabled(false)" |
80 |
| - @activate="handleMonthYearChange(false, true)" |
81 |
| - > |
82 |
| - <slot v-if="$slots['arrow-up']" name="arrow-up" /> |
83 |
| - <ChevronUpIcon v-if="!$slots['arrow-up']" /> |
84 |
| - </ArrowBtn> |
85 |
| - <ArrowBtn |
86 |
| - v-if="showRightIcon(defaultedMultiCalendars, instance)" |
87 |
| - ref="rightIcon" |
88 |
| - :disabled="isDisabled(true)" |
89 |
| - :aria-label="defaultedAriaLabels?.nextMonth" |
90 |
| - @activate="handleMonthYearChange(true, true)" |
91 |
| - @set-ref="setElRefs($event, disableYearSelect ? 2 : 3)" |
92 |
| - > |
93 |
| - <slot |
94 |
| - v-if="$slots[vertical ? 'arrow-down' : 'arrow-right']" |
95 |
| - :name="vertical ? 'arrow-down' : 'arrow-right'" |
96 |
| - /> |
97 |
| - <component |
98 |
| - :is="vertical ? ChevronDownIcon : ChevronRightIcon" |
99 |
| - v-if="!$slots[vertical ? 'arrow-down' : 'arrow-right']" |
100 |
| - /> |
101 |
| - </ArrowBtn> |
102 | 114 | </template>
|
103 | 115 | </div>
|
104 | 116 | </template>
|
|
0 commit comments