|
7 | 7 | <span |
8 | 8 | :class="{active: view === 'month'}" |
9 | 9 | class="q-datetime-link small col-auto col-md-12" |
10 | | - @click="view = 'month'" |
| 10 | + @click="!disable && (view = 'month')" |
11 | 11 | > |
12 | 12 | {{ monthString }} |
13 | 13 | </span> |
14 | 14 | <span |
15 | 15 | :class="{active: view === 'day'}" |
16 | 16 | class="q-datetime-link col-auto col-md-12" |
17 | | - @click="view = 'day'" |
| 17 | + @click="!disable && (view = 'day')" |
18 | 18 | > |
19 | 19 | {{ day }} |
20 | 20 | </span> |
21 | 21 | <span |
22 | 22 | :class="{active: view === 'year'}" |
23 | 23 | class="q-datetime-link small col-auto col-md-12" |
24 | | - @click="view = 'year'" |
| 24 | + @click="!disable && (view = 'year')" |
25 | 25 | > |
26 | 26 | {{ year }} |
27 | 27 | </span> |
|
35 | 35 | <span |
36 | 36 | :class="{active: view === 'hour'}" |
37 | 37 | class="q-datetime-link col-auto col-md-12" |
38 | | - @click="view = 'hour'" |
| 38 | + @click="!disable && (view = 'hour')" |
39 | 39 | > |
40 | 40 | {{ __pad(hour, ' ') }} |
41 | 41 | </span> |
42 | 42 | <span style="opacity: 0.6">:</span> |
43 | 43 | <span |
44 | 44 | :class="{active: view === 'minute'}" |
45 | 45 | class="q-datetime-link col-auto col-md-12" |
46 | | - @click="view = 'minute'" |
| 46 | + @click="!disable && (view = 'minute')" |
47 | 47 | > |
48 | 48 | {{ __pad(minute) }} |
49 | 49 | </span> |
|
74 | 74 | flat |
75 | 75 | class="q-datetime-btn full-width" |
76 | 76 | :class="{active: n + yearMin === year}" |
| 77 | + :color="dark ? 'light' : 'dark'" |
| 78 | + :disable="!editable" |
77 | 79 | @click="setYear(n + yearMin)" |
78 | 80 | > |
79 | 81 | {{ n + yearMin }} |
|
90 | 92 | flat |
91 | 93 | class="q-datetime-btn full-width" |
92 | 94 | :class="{active: month === index + monthMin}" |
| 95 | + :color="dark ? 'light' : 'dark'" |
| 96 | + :disable="!editable" |
93 | 97 | @click="setMonth(index + monthMin, true)" |
94 | 98 | > |
95 | 99 | {{ $q.i18n.date.months[index + monthMin - 1] }} |
|
106 | 110 | dense |
107 | 111 | flat |
108 | 112 | :color="color" |
109 | | - @click="setMonth(month - 1)" |
110 | | - :disabled="beforeMinDays" |
111 | 113 | :icon="$q.icon.datetime.arrowLeft" |
112 | 114 | :repeatTimeout="__getRepeatEasing()" |
| 115 | + :disable="beforeMinDays || disable || readonly" |
| 116 | + @click="setMonth(month - 1)" |
113 | 117 | ></q-btn> |
114 | | - <div class="col q-datetime-dark"> |
| 118 | + <div class="col" :class="classDark"> |
115 | 119 | {{ monthStamp }} |
116 | 120 | </div> |
117 | 121 | <q-btn |
118 | 122 | round |
119 | 123 | dense |
120 | 124 | flat |
121 | 125 | :color="color" |
122 | | - @click="setMonth(month + 1)" |
123 | | - :disabled="afterMaxDays" |
124 | 126 | :icon="$q.icon.datetime.arrowRight" |
125 | 127 | :repeatTimeout="__getRepeatEasing()" |
| 128 | + :disable="afterMaxDays || disable || readonly" |
| 129 | + @click="setMonth(month + 1)" |
126 | 130 | ></q-btn> |
127 | 131 | </div> |
128 | | - <div class="q-datetime-weekdays row items-center justify-start"> |
| 132 | + <div class="q-datetime-weekdays row items-center justify-start" :class="classDark"> |
129 | 133 | <div v-for="day in headerDayNames" :key="`dh${day}`">{{day}}</div> |
130 | 134 | </div> |
131 | | - <div class="q-datetime-days row wrap items-center justify-start content-center"> |
| 135 | + <div class="q-datetime-days row wrap items-center justify-start content-center" :class="classDark"> |
132 | 136 | <div v-for="fillerDay in fillerDays" :key="`fd${fillerDay}`" class="q-datetime-fillerday"></div> |
133 | 137 | <template v-if="min"> |
134 | 138 | <div v-for="fillerDay in beforeMinDays" :key="`fb${fillerDay}`" class="row items-center content-center justify-center disabled"> |
|
139 | 143 | v-for="monthDay in daysInterval" |
140 | 144 | :key="`md${monthDay}`" |
141 | 145 | class="row items-center content-center justify-center cursor-pointer" |
142 | | - :class="{ |
| 146 | + :class="[color && monthDay === day ? `text-${color}` : null, { |
143 | 147 | 'q-datetime-day-active': monthDay === day, |
144 | | - 'q-datetime-day-today': monthDay === today |
145 | | - }" |
| 148 | + 'q-datetime-day-today': monthDay === today, |
| 149 | + 'disabled': !editable |
| 150 | + }]" |
146 | 151 | @click="setDay(monthDay)" |
147 | 152 | > |
148 | 153 | <span>{{ monthDay }}</span> |
@@ -276,6 +281,9 @@ export default { |
276 | 281 | } |
277 | 282 | }, |
278 | 283 | computed: { |
| 284 | + classDark () { |
| 285 | + return this.dark ? 'q-datetime-light' : 'q-datetime-dark' |
| 286 | + }, |
279 | 287 | classes () { |
280 | 288 | const cls = [] |
281 | 289 | if (this.disable) { |
|
0 commit comments