@coreui/vue-pro 4.3.0-beta.1 → 4.3.0
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.
- package/README.md +1 -1
- package/dist/components/calendar/CCalendar.d.ts +15 -2
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +10 -2
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +86 -3
- package/dist/components/form/CFormCheck.d.ts +88 -39
- package/dist/components/form/CFormControlValidation.d.ts +98 -0
- package/dist/components/form/CFormControlWrapper.d.ts +6 -0
- package/dist/components/form/CFormFeedback.d.ts +2 -2
- package/dist/components/form/CFormInput.d.ts +125 -25
- package/dist/components/form/CFormRange.d.ts +18 -16
- package/dist/components/form/CFormSelect.d.ts +125 -16
- package/dist/components/form/CFormSwitch.d.ts +0 -23
- package/dist/components/form/CFormTextarea.d.ts +125 -24
- package/dist/components/modal/CModal.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/time-picker/CTimePicker.d.ts +1 -1
- package/dist/components/toast/CToast.d.ts +7 -1
- package/dist/index.es.js +3583 -577
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3582 -576
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +3 -1
- package/dist/utils/time.d.ts +6 -2
- package/dist/utils/transition.d.ts +3 -0
- package/package.json +11 -10
- package/src/components/backdrop/CBackdrop.ts +8 -6
- package/src/components/button/CButton.ts +2 -2
- package/src/components/calendar/CCalendar.ts +132 -62
- package/src/components/collapse/CCollapse.ts +5 -6
- package/src/components/date-picker/CDatePicker.ts +7 -10
- package/src/components/date-range-picker/CDateRangePicker.ts +198 -100
- package/src/components/form/CFormCheck.ts +119 -94
- package/src/components/form/CFormControlValidation.ts +97 -0
- package/src/components/form/CFormControlWrapper.ts +106 -0
- package/src/components/form/CFormInput.ts +113 -29
- package/src/components/form/CFormRange.ts +25 -11
- package/src/components/form/CFormSelect.ts +126 -41
- package/src/components/form/CFormSwitch.ts +2 -21
- package/src/components/form/CFormTextarea.ts +105 -25
- package/src/components/modal/CModal.ts +14 -6
- package/src/components/nav/CNavGroup.ts +4 -6
- package/src/components/offcanvas/COffcanvas.ts +5 -7
- package/src/components/picker/CPicker.ts +1 -0
- package/src/components/popover/CPopover.ts +5 -5
- package/src/components/tabs/CTabPane.ts +4 -6
- package/src/components/time-picker/CTimePicker.ts +12 -17
- package/src/components/toast/CToast.ts +17 -12
- package/src/components/tooltip/CTooltip.ts +5 -5
- package/src/utils/calendar.ts +86 -9
- package/src/utils/time.ts +29 -3
- package/src/utils/transition.ts +65 -0
package/dist/utils/calendar.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const convertToLocalTime: (d: Date, locale: string, options?: {})
|
|
|
3
3
|
export declare const createGroupsInArray: (arr: any[], numberOfGroups: number) => any[][];
|
|
4
4
|
export declare const getCurrentYear: () => number;
|
|
5
5
|
export declare const getCurrentMonth: () => number;
|
|
6
|
+
export declare const getLocalDateFromString: (string: string, locale: string, time?: boolean | undefined) => Date | undefined;
|
|
6
7
|
export declare const getMonthName: (month: number, locale: string) => string;
|
|
7
8
|
export declare const getMonthsNames: (locale: string) => string[];
|
|
8
9
|
export declare const getYears: (year: number) => number[];
|
|
@@ -10,12 +11,13 @@ export declare const getMonthDetails: (year: number, month: number, firstDayOfWe
|
|
|
10
11
|
date: Date;
|
|
11
12
|
month: string;
|
|
12
13
|
}[][];
|
|
14
|
+
export declare const isDisableDateInRange: (startDate?: Date | null | undefined, endDate?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean;
|
|
13
15
|
export declare const isDateDisabled: (date: Date, min?: Date | null | undefined, max?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean | undefined;
|
|
14
16
|
export declare const isDateInRange: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
15
17
|
export declare const isDateSelected: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
16
18
|
export declare const isEndDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
17
19
|
export declare const isLastDayOfMonth: (date: Date) => boolean;
|
|
18
|
-
export declare const isSameDateAs: (date: Date, date2: Date) => boolean;
|
|
20
|
+
export declare const isSameDateAs: (date: Date | null, date2: Date | null) => boolean;
|
|
19
21
|
export declare const isStartDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
20
22
|
export declare const isToday: (date: Date) => boolean;
|
|
21
23
|
export declare const isValidDate: (date: string) => number | false;
|
package/dist/utils/time.d.ts
CHANGED
|
@@ -6,8 +6,12 @@ export declare const getListOfHours: (locale: string) => {
|
|
|
6
6
|
value: number;
|
|
7
7
|
label: string;
|
|
8
8
|
}[];
|
|
9
|
-
export declare const
|
|
10
|
-
value: number;
|
|
9
|
+
export declare const getListOfMinutes: (locale: string, valueAsString?: boolean) => {
|
|
10
|
+
value: string | number;
|
|
11
|
+
label: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const getListOfSeconds: (locale: string, valueAsString?: boolean) => {
|
|
14
|
+
value: string | number;
|
|
11
15
|
label: string;
|
|
12
16
|
}[];
|
|
13
17
|
export declare const getSelectedHour: (date: Date | null, locale: string) => number | "";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const executeAfterTransition: (callback: () => void, transitionElement: HTMLElement, waitForTransition?: boolean) => void;
|
|
2
|
+
export declare const getTransitionDurationFromElement: (element: HTMLElement) => number;
|
|
3
|
+
export declare const triggerTransitionEnd: (element: HTMLElement) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "4.3.0
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -38,19 +38,20 @@
|
|
|
38
38
|
"version_short": "4.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@popperjs/core": "^2.11.
|
|
42
|
-
"@rollup/plugin-commonjs": "^21.0
|
|
43
|
-
"@rollup/plugin-node-resolve": "^13.1
|
|
44
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
45
|
-
"@vue/test-utils": "^2.0.0-rc.
|
|
46
|
-
"
|
|
41
|
+
"@popperjs/core": "^2.11.5",
|
|
42
|
+
"@rollup/plugin-commonjs": "^21.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
44
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
45
|
+
"@vue/test-utils": "^2.0.0-rc.20",
|
|
46
|
+
"date-fns": "^2.28.0",
|
|
47
|
+
"rollup": "^2.70.2",
|
|
47
48
|
"rollup-plugin-vue": "^6.0.0",
|
|
48
|
-
"typescript": "^4.6.
|
|
49
|
-
"vue": "^3.2.
|
|
49
|
+
"typescript": "^4.6.3",
|
|
50
|
+
"vue": "^3.2.33",
|
|
50
51
|
"vue-types": "^4.1.1"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"@coreui/coreui-pro": "^4.
|
|
54
|
+
"@coreui/coreui-pro": "^4.2.0",
|
|
54
55
|
"vue": "^3.2.21"
|
|
55
56
|
},
|
|
56
57
|
"standard": {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, RendererElement, Transition } from 'vue'
|
|
2
2
|
|
|
3
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
4
|
+
|
|
3
5
|
const CBackdrop = defineComponent({
|
|
4
6
|
name: 'CBackdrop',
|
|
5
7
|
props: {
|
|
@@ -16,24 +18,24 @@ const CBackdrop = defineComponent({
|
|
|
16
18
|
const handleBeforeEnter = (el: RendererElement) => {
|
|
17
19
|
el.classList.remove('d-none')
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
20
|
-
|
|
21
|
-
done()
|
|
22
|
-
})
|
|
23
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
23
24
|
setTimeout(() => {
|
|
24
25
|
el.style.visibility = 'visible'
|
|
25
26
|
el.classList.add('show')
|
|
26
27
|
}, 1)
|
|
27
28
|
}
|
|
29
|
+
|
|
28
30
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
29
|
-
|
|
30
|
-
done()
|
|
31
|
-
})
|
|
31
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
32
32
|
el.classList.remove('show')
|
|
33
33
|
}
|
|
34
|
+
|
|
34
35
|
const handleAfterLeave = (el: RendererElement) => {
|
|
35
36
|
el.classList.add('d-none')
|
|
36
37
|
}
|
|
38
|
+
|
|
37
39
|
return () =>
|
|
38
40
|
h(
|
|
39
41
|
Transition,
|
|
@@ -95,12 +95,12 @@ export const CButton = defineComponent({
|
|
|
95
95
|
'click',
|
|
96
96
|
],
|
|
97
97
|
setup(props, { emit, slots }) {
|
|
98
|
-
const handleClick = () => {
|
|
98
|
+
const handleClick = (event: Event) => {
|
|
99
99
|
if (props.disabled) {
|
|
100
100
|
return
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
emit('click')
|
|
103
|
+
emit('click', event)
|
|
104
104
|
}
|
|
105
105
|
return () =>
|
|
106
106
|
h(
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
isDateDisabled,
|
|
11
11
|
isDateInRange,
|
|
12
12
|
isDateSelected,
|
|
13
|
+
isDisableDateInRange,
|
|
13
14
|
isLastDayOfMonth,
|
|
14
15
|
isSameDateAs,
|
|
15
16
|
isToday,
|
|
@@ -26,6 +27,13 @@ const CCalendar = defineComponent({
|
|
|
26
27
|
calendarDate: {
|
|
27
28
|
type: [Date, String],
|
|
28
29
|
},
|
|
30
|
+
/**
|
|
31
|
+
* The number of calendars that render on desktop devices.
|
|
32
|
+
*/
|
|
33
|
+
calendars: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 1,
|
|
36
|
+
},
|
|
29
37
|
/**
|
|
30
38
|
* Specify the list of dates that cannot be selected.
|
|
31
39
|
*/
|
|
@@ -47,7 +55,6 @@ const CCalendar = defineComponent({
|
|
|
47
55
|
* - 4 - Thursday,
|
|
48
56
|
* - 5 - Friday,
|
|
49
57
|
* - 6 - Saturday,
|
|
50
|
-
* - 7 - Sunday
|
|
51
58
|
*/
|
|
52
59
|
firstDayOfWeek: {
|
|
53
60
|
type: Number,
|
|
@@ -139,40 +146,36 @@ const CCalendar = defineComponent({
|
|
|
139
146
|
'end-date-change',
|
|
140
147
|
],
|
|
141
148
|
setup(props, { slots, emit }) {
|
|
142
|
-
const calendarDate = ref(
|
|
149
|
+
const calendarDate = ref(
|
|
150
|
+
props.calendarDate
|
|
151
|
+
? new Date(props.calendarDate)
|
|
152
|
+
: props.startDate
|
|
153
|
+
? new Date(props.startDate)
|
|
154
|
+
: new Date(),
|
|
155
|
+
)
|
|
143
156
|
const startDate = ref(props.startDate ? new Date(props.startDate) : null)
|
|
144
157
|
const endDate = ref(props.endDate ? new Date(props.endDate) : null)
|
|
158
|
+
const hoverDate = ref<Date | null>(null)
|
|
159
|
+
const maxDate = ref(props.maxDate ? new Date(props.maxDate) : null)
|
|
160
|
+
const minDate = ref(props.minDate ? new Date(props.minDate) : null)
|
|
145
161
|
const selectEndDate = ref(props.selectEndDate)
|
|
146
162
|
const view = ref('days')
|
|
147
163
|
|
|
148
|
-
const maxDate = props.maxDate ? new Date(props.maxDate) : null
|
|
149
|
-
const minDate = props.minDate ? new Date(props.minDate) : null
|
|
150
|
-
|
|
151
164
|
watch(
|
|
152
165
|
() => props.calendarDate,
|
|
153
166
|
() => {
|
|
154
|
-
if (props.calendarDate)
|
|
167
|
+
if (props.calendarDate) {
|
|
168
|
+
calendarDate.value = new Date(props.calendarDate)
|
|
169
|
+
}
|
|
155
170
|
},
|
|
156
171
|
)
|
|
157
172
|
|
|
158
173
|
watch(
|
|
159
174
|
() => props.startDate,
|
|
160
175
|
() => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (props.startDate) {
|
|
167
|
-
const d = new Date(props.startDate)
|
|
168
|
-
if (startDate.value === null) {
|
|
169
|
-
startDate.value = d
|
|
170
|
-
return
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (startDate.value && !isSameDateAs(d, startDate.value)) {
|
|
174
|
-
startDate.value = d
|
|
175
|
-
}
|
|
176
|
+
const date = props.startDate ? new Date(props.startDate) : null
|
|
177
|
+
if (!isSameDateAs(date, startDate.value)) {
|
|
178
|
+
startDate.value = date
|
|
176
179
|
}
|
|
177
180
|
},
|
|
178
181
|
)
|
|
@@ -180,21 +183,27 @@ const CCalendar = defineComponent({
|
|
|
180
183
|
watch(
|
|
181
184
|
() => props.endDate,
|
|
182
185
|
() => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
const date = props.endDate ? new Date(props.endDate) : null
|
|
187
|
+
if (!isSameDateAs(date, endDate.value)) {
|
|
188
|
+
endDate.value = date
|
|
186
189
|
}
|
|
190
|
+
},
|
|
191
|
+
)
|
|
187
192
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
watch(
|
|
194
|
+
() => props.maxDate,
|
|
195
|
+
() => {
|
|
196
|
+
if (props.maxDate) {
|
|
197
|
+
maxDate.value = new Date(props.maxDate)
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
)
|
|
194
201
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
watch(
|
|
203
|
+
() => props.minDate,
|
|
204
|
+
() => {
|
|
205
|
+
if (props.minDate) {
|
|
206
|
+
minDate.value = new Date(props.minDate)
|
|
198
207
|
}
|
|
199
208
|
},
|
|
200
209
|
)
|
|
@@ -228,37 +237,61 @@ const CCalendar = defineComponent({
|
|
|
228
237
|
}
|
|
229
238
|
|
|
230
239
|
const handleCellOnClick = (date: Date) => {
|
|
231
|
-
if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
|
|
240
|
+
if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
|
|
232
241
|
return
|
|
233
242
|
}
|
|
234
243
|
|
|
235
244
|
if (props.range) {
|
|
236
245
|
if (selectEndDate.value) {
|
|
237
|
-
|
|
246
|
+
selectEndDate.value = false
|
|
247
|
+
|
|
238
248
|
if (startDate.value && startDate.value > date) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
endDate.value = date
|
|
249
|
+
startDate.value = null
|
|
250
|
+
endDate.value = null
|
|
251
|
+
return
|
|
243
252
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
253
|
+
|
|
254
|
+
if (isDisableDateInRange(startDate.value, date, props.disabledDates)) {
|
|
255
|
+
startDate.value = null
|
|
256
|
+
endDate.value = null
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
endDate.value = date
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (endDate.value && endDate.value < date) {
|
|
265
|
+
startDate.value = null
|
|
266
|
+
endDate.value = null
|
|
267
|
+
return
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (isDisableDateInRange(date, endDate.value, props.disabledDates)) {
|
|
271
|
+
startDate.value = null
|
|
272
|
+
endDate.value = null
|
|
273
|
+
return
|
|
248
274
|
}
|
|
249
|
-
|
|
275
|
+
|
|
276
|
+
selectEndDate.value = true
|
|
250
277
|
startDate.value = date
|
|
278
|
+
return
|
|
251
279
|
}
|
|
280
|
+
|
|
281
|
+
startDate.value = date
|
|
252
282
|
}
|
|
253
283
|
|
|
254
284
|
const handleCellMouseEnter = (date: Date) => {
|
|
255
|
-
if (isDateDisabled(date, minDate, maxDate, props.disabledDates)) {
|
|
285
|
+
if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
|
|
256
286
|
return
|
|
257
287
|
}
|
|
288
|
+
|
|
289
|
+
hoverDate.value = date
|
|
258
290
|
emit('calendar-cell-hover', date)
|
|
259
291
|
}
|
|
260
292
|
|
|
261
293
|
const handleCellMouseLeave = () => {
|
|
294
|
+
hoverDate.value = null
|
|
262
295
|
emit('calendar-cell-hover', null)
|
|
263
296
|
}
|
|
264
297
|
|
|
@@ -289,14 +322,24 @@ const CCalendar = defineComponent({
|
|
|
289
322
|
}
|
|
290
323
|
}
|
|
291
324
|
|
|
292
|
-
const Calendar = () => {
|
|
325
|
+
const Calendar = (addMonths: number) => {
|
|
326
|
+
let date = calendarDate.value
|
|
327
|
+
|
|
328
|
+
if (addMonths !== 0) {
|
|
329
|
+
date = new Date(
|
|
330
|
+
calendarDate.value.getFullYear(),
|
|
331
|
+
calendarDate.value.getMonth() + addMonths,
|
|
332
|
+
1,
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
|
|
293
336
|
const monthDetails = getMonthDetails(
|
|
294
|
-
|
|
295
|
-
|
|
337
|
+
date.getFullYear(),
|
|
338
|
+
date.getMonth(),
|
|
296
339
|
props.firstDayOfWeek,
|
|
297
340
|
)
|
|
298
341
|
const listOfMonths = createGroupsInArray(getMonthsNames(props.locale), 4)
|
|
299
|
-
const listOfYears = createGroupsInArray(getYears(
|
|
342
|
+
const listOfYears = createGroupsInArray(getYears(date.getFullYear()), 4)
|
|
300
343
|
const weekDays = monthDetails[0]
|
|
301
344
|
|
|
302
345
|
return h('table', {}, [
|
|
@@ -340,22 +383,33 @@ const CCalendar = defineComponent({
|
|
|
340
383
|
'calendar-cell',
|
|
341
384
|
{
|
|
342
385
|
today: isToday(date),
|
|
343
|
-
disabled: isDateDisabled(
|
|
344
|
-
|
|
345
|
-
|
|
386
|
+
disabled: isDateDisabled(
|
|
387
|
+
date,
|
|
388
|
+
minDate.value,
|
|
389
|
+
maxDate.value,
|
|
390
|
+
props.disabledDates,
|
|
391
|
+
),
|
|
392
|
+
[month]: true,
|
|
346
393
|
last: isLastDayOfMonth(date),
|
|
347
394
|
range:
|
|
348
395
|
month === 'current' &&
|
|
349
396
|
isDateInRange(date, startDate.value, endDate.value),
|
|
397
|
+
'range-hover':
|
|
398
|
+
month === 'current' &&
|
|
399
|
+
(hoverDate.value && selectEndDate.value
|
|
400
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
401
|
+
: isDateInRange(date, hoverDate.value, endDate.value)),
|
|
350
402
|
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
351
403
|
start: isStartDate(date, startDate.value, endDate.value),
|
|
352
404
|
end: isEndDate(date, startDate.value, endDate.value),
|
|
353
405
|
},
|
|
354
406
|
],
|
|
355
407
|
title: date.toLocaleDateString(props.locale),
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
408
|
+
...(month === 'current' && {
|
|
409
|
+
onClick: () => handleCellOnClick(date),
|
|
410
|
+
onmouseenter: () => handleCellMouseEnter(date),
|
|
411
|
+
onmouseleave: () => handleCellMouseLeave(),
|
|
412
|
+
}),
|
|
359
413
|
},
|
|
360
414
|
h(
|
|
361
415
|
'div',
|
|
@@ -379,7 +433,7 @@ const CCalendar = defineComponent({
|
|
|
379
433
|
{
|
|
380
434
|
class: 'calendar-cell month',
|
|
381
435
|
onClick: () => {
|
|
382
|
-
setCalendarPage(0, index * 3 + idx)
|
|
436
|
+
setCalendarPage(0, index * 3 + idx - addMonths)
|
|
383
437
|
view.value = 'days'
|
|
384
438
|
},
|
|
385
439
|
},
|
|
@@ -401,8 +455,8 @@ const CCalendar = defineComponent({
|
|
|
401
455
|
onClick: () => {
|
|
402
456
|
calendarDate.value = new Date(
|
|
403
457
|
year,
|
|
404
|
-
|
|
405
|
-
|
|
458
|
+
date.getMonth() - addMonths,
|
|
459
|
+
date.getDate(),
|
|
406
460
|
)
|
|
407
461
|
view.value = 'months'
|
|
408
462
|
},
|
|
@@ -416,7 +470,17 @@ const CCalendar = defineComponent({
|
|
|
416
470
|
])
|
|
417
471
|
}
|
|
418
472
|
|
|
419
|
-
const Navigation = () => {
|
|
473
|
+
const Navigation = (addMonths: number) => {
|
|
474
|
+
let date = calendarDate.value
|
|
475
|
+
|
|
476
|
+
if (addMonths !== 0) {
|
|
477
|
+
date = new Date(
|
|
478
|
+
calendarDate.value.getFullYear(),
|
|
479
|
+
calendarDate.value.getMonth() + addMonths,
|
|
480
|
+
1,
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
|
|
420
484
|
return h('div', { class: 'calendar-nav' }, [
|
|
421
485
|
props.navigation &&
|
|
422
486
|
h(
|
|
@@ -478,7 +542,7 @@ const CCalendar = defineComponent({
|
|
|
478
542
|
if (props.navigation) view.value = 'months'
|
|
479
543
|
},
|
|
480
544
|
},
|
|
481
|
-
() =>
|
|
545
|
+
() => date.toLocaleDateString(props.locale, { month: 'long' }),
|
|
482
546
|
),
|
|
483
547
|
h(
|
|
484
548
|
CButton,
|
|
@@ -489,7 +553,7 @@ const CCalendar = defineComponent({
|
|
|
489
553
|
if (props.navigation) view.value = 'years'
|
|
490
554
|
},
|
|
491
555
|
},
|
|
492
|
-
() =>
|
|
556
|
+
() => date.toLocaleDateString(props.locale, { year: 'numeric' }),
|
|
493
557
|
),
|
|
494
558
|
],
|
|
495
559
|
),
|
|
@@ -539,7 +603,13 @@ const CCalendar = defineComponent({
|
|
|
539
603
|
),
|
|
540
604
|
])
|
|
541
605
|
}
|
|
542
|
-
|
|
606
|
+
|
|
607
|
+
return () =>
|
|
608
|
+
h('div', { class: 'calendars' }, [
|
|
609
|
+
Array.from({ length: props.calendars }, (_, index) =>
|
|
610
|
+
h('div', { class: ['calendar', view.value] }, [Navigation(index), Calendar(index)]),
|
|
611
|
+
),
|
|
612
|
+
])
|
|
543
613
|
},
|
|
544
614
|
})
|
|
545
615
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, Transition, ref, RendererElement, withDirectives } from 'vue'
|
|
2
|
+
|
|
2
3
|
import { vVisible } from '../../directives/v-c-visible'
|
|
4
|
+
import { executeAfterTransition } from './../../utils/transition'
|
|
3
5
|
|
|
4
6
|
const CCollapse = defineComponent({
|
|
5
7
|
name: 'CCollapse',
|
|
@@ -39,10 +41,9 @@ const CCollapse = defineComponent({
|
|
|
39
41
|
|
|
40
42
|
const handleEnter = (el: RendererElement, done: () => void) => {
|
|
41
43
|
emit('show')
|
|
42
|
-
|
|
43
|
-
done()
|
|
44
|
-
})
|
|
44
|
+
// collapsing.value = true
|
|
45
45
|
setTimeout(() => {
|
|
46
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
46
47
|
if (props.horizontal) {
|
|
47
48
|
el.style.width = `${el.scrollWidth}px`
|
|
48
49
|
return
|
|
@@ -69,10 +70,8 @@ const CCollapse = defineComponent({
|
|
|
69
70
|
|
|
70
71
|
const handleLeave = (el: RendererElement, done: () => void) => {
|
|
71
72
|
emit('hide')
|
|
72
|
-
el.addEventListener('transitionend', () => {
|
|
73
|
-
done()
|
|
74
|
-
})
|
|
75
73
|
setTimeout(() => {
|
|
74
|
+
executeAfterTransition(() => done(), el as HTMLElement)
|
|
76
75
|
if (props.horizontal) {
|
|
77
76
|
el.style.width = '0px'
|
|
78
77
|
return
|
|
@@ -125,12 +125,16 @@ const CDatePicker = defineComponent({
|
|
|
125
125
|
* - 4 - Thursday,
|
|
126
126
|
* - 5 - Friday,
|
|
127
127
|
* - 6 - Saturday,
|
|
128
|
-
* - 7 - Sunday
|
|
129
128
|
*/
|
|
130
129
|
firstDayOfWeek: {
|
|
131
130
|
type: Number,
|
|
132
131
|
default: 1,
|
|
133
132
|
},
|
|
133
|
+
/**
|
|
134
|
+
* Set date format.
|
|
135
|
+
* We use date-fns to format dates. Visit https://date-fns.org/v2.28.0/docs/format to check accepted patterns.
|
|
136
|
+
*/
|
|
137
|
+
format: String,
|
|
134
138
|
/**
|
|
135
139
|
* Toggle visibility of footer element or set the content of footer.
|
|
136
140
|
*/
|
|
@@ -224,18 +228,11 @@ const CDatePicker = defineComponent({
|
|
|
224
228
|
return () =>
|
|
225
229
|
h(CDateRangePicker, {
|
|
226
230
|
calendars: 1,
|
|
227
|
-
onStartDateChange: (date: Date) =>
|
|
231
|
+
onStartDateChange: (date: Date, formatedDate: String) =>
|
|
232
|
+
emit('date-change', date, formatedDate),
|
|
228
233
|
range: false,
|
|
229
234
|
startDate: props.date,
|
|
230
235
|
...props,
|
|
231
|
-
// cleaner: props.cleaner,
|
|
232
|
-
// disabled: props.disabled,
|
|
233
|
-
// indicator: props.indicator,
|
|
234
|
-
// inputReadOnly: props.inputReadOnly,
|
|
235
|
-
// locale: props.locale,
|
|
236
|
-
// placeholder: props.placeholder,
|
|
237
|
-
// size: props.size,
|
|
238
|
-
// timepicker: props.timepicker,
|
|
239
236
|
})
|
|
240
237
|
},
|
|
241
238
|
})
|