@antify/ui 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -10,10 +10,12 @@ import {
|
|
|
10
10
|
watch,
|
|
11
11
|
computed,
|
|
12
12
|
defineEmits,
|
|
13
|
+
onMounted,
|
|
13
14
|
} from 'vue';
|
|
14
15
|
import AntDateSwitcher from './AntDateSwitcher.vue';
|
|
15
16
|
import AntButton from '../AntButton.vue';
|
|
16
17
|
import AntSkeleton from '../AntSkeleton.vue';
|
|
18
|
+
import AntTooltip from '../AntTooltip.vue';
|
|
17
19
|
|
|
18
20
|
const props = withDefaults(defineProps<{
|
|
19
21
|
/**
|
|
@@ -39,9 +41,10 @@ const props = withDefaults(defineProps<{
|
|
|
39
41
|
skeleton: false,
|
|
40
42
|
specialDays: () => [],
|
|
41
43
|
});
|
|
42
|
-
defineEmits([
|
|
44
|
+
const emit = defineEmits([
|
|
43
45
|
'select',
|
|
44
46
|
'update:modelValue',
|
|
47
|
+
'changeCurrentVisibleMonth',
|
|
45
48
|
]);
|
|
46
49
|
|
|
47
50
|
const COUNT_ROWS = 6;
|
|
@@ -125,6 +128,26 @@ watch(() => props.modelValue, (val) => {
|
|
|
125
128
|
currentMonthIndex.value = date.getMonth();
|
|
126
129
|
currentYear.value = date.getFullYear();
|
|
127
130
|
});
|
|
131
|
+
|
|
132
|
+
watch(() => [
|
|
133
|
+
currentMonthIndex.value,
|
|
134
|
+
currentYear.value,
|
|
135
|
+
], ([
|
|
136
|
+
currentMonthIndex,
|
|
137
|
+
currentYear,
|
|
138
|
+
]) => {
|
|
139
|
+
emit('changeCurrentVisibleMonth', {
|
|
140
|
+
month: currentMonthIndex,
|
|
141
|
+
year: currentYear,
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
onMounted(() => {
|
|
146
|
+
emit('changeCurrentVisibleMonth', {
|
|
147
|
+
month: currentMonthIndex.value,
|
|
148
|
+
year: currentYear.value,
|
|
149
|
+
});
|
|
150
|
+
});
|
|
128
151
|
</script>
|
|
129
152
|
|
|
130
153
|
<template>
|
|
@@ -167,27 +190,36 @@ watch(() => props.modelValue, (val) => {
|
|
|
167
190
|
:visible="skeleton"
|
|
168
191
|
rounded
|
|
169
192
|
>
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
?
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
193
|
+
<AntTooltip :delay="300">
|
|
194
|
+
<div
|
|
195
|
+
class="rounded-md flex items-center justify-center p-2 font-semibold cursor-pointer transition-colors grow"
|
|
196
|
+
:class="{
|
|
197
|
+
'text-base-400': !day.isCurrentMonth,
|
|
198
|
+
'text-for-white-bg-font': day.isCurrentMonth,
|
|
199
|
+
'outline outline-primary-500': day.isToday,
|
|
200
|
+
'hover:bg-base-200 hover:text-base-200-font': day.date !== format(modelValue, 'yyyy-MM-dd'),
|
|
201
|
+
'!bg-primary-500 !text-primary-500-font hover:bg-primary-300 hover:text-primary-300-font': day.date === format(modelValue, 'yyyy-MM-dd'),
|
|
202
|
+
}"
|
|
203
|
+
:style="{
|
|
204
|
+
backgroundColor: day.isSpecialDay ? `var(--color-${day.specialDayColor})` : 'none',
|
|
205
|
+
color: day.isSpecialDay
|
|
206
|
+
? getColorNumber(day.specialDayColor) < 500
|
|
207
|
+
? 'var(--color-for-white-bg-font)'
|
|
208
|
+
: '#fff'
|
|
209
|
+
: 'none'
|
|
210
|
+
}"
|
|
211
|
+
@click="() => $emit('update:modelValue', new Date(day.date).getTime())"
|
|
212
|
+
>
|
|
213
|
+
{{ day.label }}
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<template
|
|
217
|
+
v-if="day.isSpecialDay && specialDays.find(specialDay => specialDay.date === day.date)?.name"
|
|
218
|
+
#content
|
|
219
|
+
>
|
|
220
|
+
{{ specialDays.find(specialDay => specialDay.date === day.date)?.name }}
|
|
221
|
+
</template>
|
|
222
|
+
</AntTooltip>
|
|
191
223
|
</AntSkeleton>
|
|
192
224
|
</template>
|
|
193
225
|
</template>
|