@coreui/vue-pro 4.2.0 → 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.
Files changed (77) hide show
  1. package/README.md +1 -1
  2. package/dist/components/calendar/CCalendar.d.ts +198 -0
  3. package/dist/components/calendar/index.d.ts +6 -0
  4. package/dist/components/carousel/CCarousel.d.ts +1 -1
  5. package/dist/components/date-picker/CDatePicker.d.ts +414 -0
  6. package/dist/components/date-picker/index.d.ts +6 -0
  7. package/dist/components/date-range-picker/CDateRangePicker.d.ts +563 -0
  8. package/dist/components/date-range-picker/index.d.ts +6 -0
  9. package/dist/components/form/CFormCheck.d.ts +88 -39
  10. package/dist/components/form/CFormControlValidation.d.ts +98 -0
  11. package/dist/components/form/CFormControlWrapper.d.ts +6 -0
  12. package/dist/components/form/CFormFeedback.d.ts +2 -2
  13. package/dist/components/form/CFormInput.d.ts +125 -25
  14. package/dist/components/form/CFormRange.d.ts +18 -16
  15. package/dist/components/form/CFormSelect.d.ts +125 -16
  16. package/dist/components/form/CFormSwitch.d.ts +0 -23
  17. package/dist/components/form/CFormTextarea.d.ts +125 -24
  18. package/dist/components/index.d.ts +5 -0
  19. package/dist/components/modal/CModal.d.ts +1 -1
  20. package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
  21. package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
  22. package/dist/components/picker/CPicker.d.ts +11 -0
  23. package/dist/components/picker/index.d.ts +6 -0
  24. package/dist/components/popover/CPopover.d.ts +1 -1
  25. package/dist/components/sidebar/CSidebar.d.ts +1 -1
  26. package/dist/components/smart-table/CSmartTable.d.ts +35 -99
  27. package/dist/components/smart-table/CSmartTableInterface.d.ts +3 -3
  28. package/dist/components/time-picker/CTimePicker.d.ts +10 -0
  29. package/dist/components/time-picker/CTimePickerRollCol.d.ts +27 -0
  30. package/dist/components/time-picker/index.d.ts +6 -0
  31. package/dist/components/toast/CToast.d.ts +8 -2
  32. package/dist/index.es.js +6249 -1276
  33. package/dist/index.es.js.map +1 -1
  34. package/dist/index.js +6256 -1273
  35. package/dist/index.js.map +1 -1
  36. package/dist/utils/calendar.d.ts +23 -0
  37. package/dist/utils/time.d.ts +21 -0
  38. package/dist/utils/transition.d.ts +3 -0
  39. package/package.json +11 -10
  40. package/src/components/backdrop/CBackdrop.ts +8 -6
  41. package/src/components/button/CButton.ts +2 -2
  42. package/src/components/calendar/CCalendar.ts +616 -0
  43. package/src/components/calendar/index.ts +10 -0
  44. package/src/components/collapse/CCollapse.ts +5 -6
  45. package/src/components/date-picker/CDatePicker.ts +240 -0
  46. package/src/components/date-picker/index.ts +10 -0
  47. package/src/components/date-range-picker/CDateRangePicker.ts +733 -0
  48. package/src/components/date-range-picker/index.ts +10 -0
  49. package/src/components/dropdown/CDropdownMenu.ts +4 -2
  50. package/src/components/dropdown/CDropdownToggle.ts +24 -9
  51. package/src/components/form/CFormCheck.ts +119 -94
  52. package/src/components/form/CFormControlValidation.ts +97 -0
  53. package/src/components/form/CFormControlWrapper.ts +106 -0
  54. package/src/components/form/CFormInput.ts +113 -29
  55. package/src/components/form/CFormRange.ts +25 -11
  56. package/src/components/form/CFormSelect.ts +126 -41
  57. package/src/components/form/CFormSwitch.ts +2 -21
  58. package/src/components/form/CFormTextarea.ts +105 -25
  59. package/src/components/index.ts +5 -0
  60. package/src/components/modal/CModal.ts +14 -6
  61. package/src/components/nav/CNavGroup.ts +4 -6
  62. package/src/components/offcanvas/COffcanvas.ts +5 -7
  63. package/src/components/pagination/CSmartPagination.ts +4 -4
  64. package/src/components/picker/CPicker.ts +221 -0
  65. package/src/components/picker/index.ts +10 -0
  66. package/src/components/popover/CPopover.ts +5 -5
  67. package/src/components/smart-table/CSmartTable.ts +17 -49
  68. package/src/components/smart-table/CSmartTableInterface.ts +5 -3
  69. package/src/components/tabs/CTabPane.ts +4 -6
  70. package/src/components/time-picker/CTimePicker.ts +405 -0
  71. package/src/components/time-picker/CTimePickerRollCol.ts +58 -0
  72. package/src/components/time-picker/index.ts +10 -0
  73. package/src/components/toast/CToast.ts +17 -12
  74. package/src/components/tooltip/CTooltip.ts +5 -5
  75. package/src/utils/calendar.ts +270 -0
  76. package/src/utils/time.ts +84 -0
  77. package/src/utils/transition.ts +65 -0
@@ -0,0 +1,733 @@
1
+ import { defineComponent, h, onMounted, PropType, ref, watch } from 'vue'
2
+
3
+ import { format as dateFormat } from 'date-fns'
4
+
5
+ import { CButton } from '../button'
6
+ import { CCalendar } from '../calendar'
7
+ import { CFormInput, CInputGroup, CInputGroupText } from '../form'
8
+ import { CPicker } from '../picker'
9
+ import { CTimePicker } from '../time-picker'
10
+
11
+ import { getLocalDateFromString } from '../../utils/calendar'
12
+
13
+ import { Color } from '../props'
14
+
15
+ const CDateRangePicker = defineComponent({
16
+ name: 'CDateRangePicker',
17
+ props: {
18
+ /**
19
+ * The number of calendars that render on desktop devices.
20
+ */
21
+ calendars: {
22
+ type: Number,
23
+ default: 2,
24
+ },
25
+ /**
26
+ * Default date of the component
27
+ */
28
+ calendarDate: {
29
+ type: [Date, String],
30
+ },
31
+ /**
32
+ * Toggle visibility or set the content of cancel button.
33
+ */
34
+ cancelButton: {
35
+ type: [Boolean, String],
36
+ default: 'Cancel',
37
+ },
38
+ /**
39
+ * Sets the color context of the cancel button to one of CoreUI’s themed colors.
40
+ *
41
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
42
+ */
43
+ cancelButtonColor: {
44
+ ...Color,
45
+ default: 'primary',
46
+ },
47
+ /**
48
+ * Size the cancel button small or large.
49
+ *
50
+ * @values 'sm', 'lg'
51
+ */
52
+ cancelButtonSize: {
53
+ type: String,
54
+ default: 'sm',
55
+ validator: (value: string) => {
56
+ return ['sm', 'lg'].includes(value)
57
+ },
58
+ },
59
+ /**
60
+ * Set the cancel button variant to an outlined button or a ghost button.
61
+ *
62
+ * @values 'ghost', 'outline'
63
+ */
64
+ cancelButtonVariant: {
65
+ type: String,
66
+ default: 'ghost',
67
+ validator: (value: string) => {
68
+ return ['ghost', 'outline'].includes(value)
69
+ },
70
+ },
71
+ /**
72
+ * Toggle visibility of the cleaner button.
73
+ */
74
+ cleaner: {
75
+ type: Boolean,
76
+ default: true,
77
+ },
78
+ /**
79
+ * Toggle visibility or set the content of confirm button.
80
+ */
81
+ confirmButton: {
82
+ type: [Boolean, String],
83
+ default: 'OK',
84
+ },
85
+ /**
86
+ * Sets the color context of the confirm button to one of CoreUI’s themed colors.
87
+ *
88
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
89
+ */
90
+ confirmButtonColor: {
91
+ ...Color,
92
+ default: 'primary',
93
+ },
94
+ /**
95
+ * Size the confirm button small or large.
96
+ *
97
+ * @values 'sm', 'lg'
98
+ */
99
+ confirmButtonSize: {
100
+ type: String,
101
+ default: 'sm',
102
+ validator: (value: string) => {
103
+ return ['sm', 'lg'].includes(value)
104
+ },
105
+ },
106
+ /**
107
+ * Set the confirm button variant to an outlined button or a ghost button.
108
+ *
109
+ * @values 'ghost', 'outline'
110
+ */
111
+ confirmButtonVariant: {
112
+ type: String,
113
+ validator: (value: string) => {
114
+ return ['ghost', 'outline'].includes(value)
115
+ },
116
+ },
117
+ /**
118
+ * Toggle the disabled state for the component.
119
+ */
120
+ disabled: Boolean,
121
+ /**
122
+ * Specify the list of dates that cannot be selected.
123
+ */
124
+ disabledDates: {
125
+ type: Array as PropType<Date[] | Date[][]>,
126
+ },
127
+ /**
128
+ * Initial selected to date (range).
129
+ */
130
+ endDate: {
131
+ type: [Date, String],
132
+ required: false,
133
+ },
134
+ /**
135
+ * Sets the day of start week.
136
+ * - 0 - Sunday,
137
+ * - 1 - Monday,
138
+ * - 2 - Tuesday,
139
+ * - 3 - Wednesday,
140
+ * - 4 - Thursday,
141
+ * - 5 - Friday,
142
+ * - 6 - Saturday,
143
+ */
144
+ firstDayOfWeek: {
145
+ type: Number,
146
+ default: 1,
147
+ },
148
+ /**
149
+ * Set date format.
150
+ * We use date-fns to format dates. Visit https://date-fns.org/v2.28.0/docs/format to check accepted patterns.
151
+ */
152
+ format: String,
153
+ /**
154
+ * Toggle visibility of footer element or set the content of footer.
155
+ */
156
+ footer: Boolean,
157
+ /**
158
+ * Toggle visibility or set the content of the input indicator.
159
+ */
160
+ indicator: {
161
+ type: Boolean,
162
+ default: true,
163
+ },
164
+ /**
165
+ * Toggle the readonly state for the component.
166
+ */
167
+ inputReadOnly: Boolean,
168
+ /**
169
+ * Sets the default locale for components. If not set, it is inherited from the navigator.language.
170
+ */
171
+ locale: {
172
+ type: String,
173
+ default: 'default',
174
+ },
175
+ /**
176
+ * Max selectable date.
177
+ */
178
+ maxDate: {
179
+ type: [Date, String],
180
+ },
181
+ /**
182
+ * Min selectable date.
183
+ */
184
+ minDate: {
185
+ type: [Date, String],
186
+ },
187
+ /**
188
+ * Show arrows navigation.
189
+ */
190
+ navigation: {
191
+ type: Boolean,
192
+ default: true,
193
+ },
194
+ /**
195
+ * Specifies a short hint that is visible in the input.
196
+ */
197
+ placeholder: {
198
+ type: [String, Array] as PropType<String | String[]>,
199
+ default: () => ['Start date', 'End date'],
200
+ },
201
+ /**
202
+ * @ignore
203
+ */
204
+ range: {
205
+ type: Boolean,
206
+ default: true,
207
+ },
208
+ /**
209
+ * Predefined date ranges the user can select from.
210
+ */
211
+ ranges: Object,
212
+ /**
213
+ * Toggle select mode between start and end date.
214
+ */
215
+ selectEndDate: Boolean,
216
+ /**
217
+ * Default icon or character character that separates two dates.
218
+ */
219
+ separator: {
220
+ type: Boolean,
221
+ default: true,
222
+ },
223
+ /**
224
+ * Size the component small or large.
225
+ *
226
+ * @values 'sm', 'lg'
227
+ */
228
+ size: {
229
+ type: String,
230
+ required: false,
231
+ validator: (value: string) => {
232
+ return ['sm', 'lg'].includes(value)
233
+ },
234
+ },
235
+ /**
236
+ * Initial selected date.
237
+ */
238
+ startDate: {
239
+ type: [Date, String],
240
+ },
241
+ /**
242
+ * Provide an additional time selection by adding select boxes to choose times.
243
+ */
244
+ timepicker: Boolean,
245
+ /**
246
+ * Toggle visibility or set the content of today button.
247
+ */
248
+ todayButton: {
249
+ type: [Boolean, String],
250
+ default: 'Today',
251
+ },
252
+ /**
253
+ * Sets the color context of the today button to one of CoreUI’s themed colors.
254
+ *
255
+ * @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
256
+ */
257
+ todayButtonColor: {
258
+ ...Color,
259
+ default: 'primary',
260
+ },
261
+ /**
262
+ * Size the today button small or large.
263
+ *
264
+ * @values 'sm', 'lg'
265
+ */
266
+ todayButtonSize: {
267
+ type: String,
268
+ default: 'sm',
269
+ validator: (value: string) => {
270
+ return ['sm', 'lg'].includes(value)
271
+ },
272
+ },
273
+ /**
274
+ * Set the today button variant to an outlined button or a ghost button.
275
+ *
276
+ * @values 'ghost', 'outline'
277
+ */
278
+ todayButtonVariant: {
279
+ type: String,
280
+ validator: (value: string) => {
281
+ return ['ghost', 'outline'].includes(value)
282
+ },
283
+ },
284
+ /**
285
+ * Set length or format of day name.
286
+ *
287
+ * @type number | 'long' | 'narrow' | 'short'
288
+ */
289
+ weekdayFormat: {
290
+ type: [Number, String],
291
+ default: 2,
292
+ validator: (value: string | number) => {
293
+ if (typeof value === 'string') {
294
+ return ['long', 'narrow', 'short'].includes(value)
295
+ }
296
+ if (typeof value === 'number') {
297
+ return true
298
+ }
299
+ return false
300
+ },
301
+ },
302
+ },
303
+ emit: [
304
+ /**
305
+ * Callback fired when the end date changed.
306
+ */
307
+ 'end-date-change',
308
+ /**
309
+ * Callback fired when the component requests to be hidden.
310
+ */
311
+ 'hide',
312
+ /**
313
+ * Callback fired when the component requests to be shown.
314
+ */
315
+ 'show',
316
+ /**
317
+ * Callback fired when the start date changed.
318
+ */
319
+ 'start-date-change',
320
+ ],
321
+ setup(props, { slots, emit }) {
322
+ const calendarDate = ref<Date>(
323
+ props.calendarDate
324
+ ? new Date(props.calendarDate)
325
+ : props.startDate
326
+ ? new Date(props.startDate)
327
+ : props.endDate
328
+ ? new Date(props.endDate)
329
+ : new Date(),
330
+ )
331
+ const inputStartHoverValue = ref<Date | null>(null)
332
+ const inputEndHoverValue = ref<Date | null>(null)
333
+ const startDate = ref<Date | null>(props.startDate ? new Date(props.startDate) : null)
334
+ const endDate = ref<Date | null>(props.endDate ? new Date(props.endDate) : null)
335
+ const initialStartDate = ref<Date | null>(startDate.value ? new Date(startDate.value) : null)
336
+ const initialEndDate = ref<Date | null>(endDate.value ? new Date(endDate.value) : null)
337
+ const maxDate = ref(props.maxDate && new Date(props.maxDate))
338
+ const minDate = ref(props.minDate && new Date(props.minDate))
339
+ const selectEndDate = ref(false)
340
+
341
+ const isMobile = ref(false)
342
+
343
+ onMounted(() => {
344
+ isMobile.value = window.innerWidth < 768
345
+ })
346
+
347
+ watch(
348
+ () => props.startDate,
349
+ () => {
350
+ if (props.startDate) {
351
+ calendarDate.value = new Date(props.startDate)
352
+ }
353
+ },
354
+ )
355
+
356
+ watch(
357
+ () => props.endDate,
358
+ () => {
359
+ if (props.endDate) {
360
+ calendarDate.value = new Date(props.endDate)
361
+ }
362
+ },
363
+ )
364
+
365
+ watch(
366
+ () => props.maxDate,
367
+ () => {
368
+ if (props.maxDate) {
369
+ maxDate.value = new Date(props.maxDate)
370
+ }
371
+ },
372
+ )
373
+
374
+ watch(
375
+ () => props.minDate,
376
+ () => {
377
+ if (props.minDate) {
378
+ minDate.value = new Date(props.minDate)
379
+ }
380
+ },
381
+ )
382
+
383
+ const formatDate = (date: Date) => {
384
+ return props.format
385
+ ? dateFormat(date, props.format)
386
+ : props.timepicker
387
+ ? date.toLocaleString(props.format)
388
+ : date.toLocaleDateString(props.format)
389
+ }
390
+
391
+ const setInputValue = (date: Date | null) => {
392
+ if (date) {
393
+ return formatDate(date)
394
+ }
395
+
396
+ return ''
397
+ }
398
+
399
+ const handleCalendarCellHover = (date: Date | null) => {
400
+ if (selectEndDate.value) {
401
+ inputEndHoverValue.value = date
402
+ return
403
+ }
404
+ inputStartHoverValue.value = date
405
+ }
406
+
407
+ const handleCalendarDateChange = (date: Date, difference?: number) => {
408
+ if (difference) {
409
+ calendarDate.value = new Date(date.getFullYear(), date.getMonth() - difference, 1)
410
+ return
411
+ }
412
+
413
+ calendarDate.value = date
414
+ }
415
+
416
+ const handleStartDateChange = (date: Date) => {
417
+ startDate.value = date
418
+ inputStartHoverValue.value = null
419
+ if (props.range) {
420
+ selectEndDate.value = true
421
+ }
422
+
423
+ emit('start-date-change', date, date ? formatDate(date) : undefined)
424
+ }
425
+
426
+ const handleEndDateChange = (date: Date) => {
427
+ endDate.value = date
428
+ inputEndHoverValue.value = null
429
+ if (props.range) {
430
+ selectEndDate.value = false
431
+ }
432
+
433
+ emit('end-date-change', date, date ? formatDate(date) : undefined)
434
+ }
435
+
436
+ const handleClear = (event: Event) => {
437
+ event.stopPropagation()
438
+ startDate.value = null
439
+ endDate.value = null
440
+ inputStartHoverValue.value = null
441
+ inputEndHoverValue.value = null
442
+ }
443
+
444
+ const InputGroup = () =>
445
+ h(
446
+ CInputGroup,
447
+ {
448
+ class: 'picker-input-group',
449
+ size: props.size,
450
+ },
451
+ () => [
452
+ h(CFormInput, {
453
+ class: {
454
+ hover: inputStartHoverValue.value,
455
+ },
456
+ disabled: props.disabled,
457
+ onClick: () => {
458
+ selectEndDate.value = false
459
+ },
460
+ onInput: (event) => {
461
+ const date = getLocalDateFromString(
462
+ event.target.value,
463
+ props.locale,
464
+ props.timepicker,
465
+ )
466
+ if (date instanceof Date && date.getTime()) {
467
+ calendarDate.value = date
468
+ startDate.value = date
469
+ }
470
+ },
471
+ placeholder: Array.isArray(props.placeholder)
472
+ ? props.placeholder[0]
473
+ : props.placeholder,
474
+ readonly: props.inputReadOnly || typeof props.format === 'string',
475
+ value: inputStartHoverValue.value
476
+ ? setInputValue(inputStartHoverValue.value)
477
+ : setInputValue(startDate.value),
478
+ }),
479
+ props.range &&
480
+ props.separator !== false &&
481
+ h(CInputGroupText, {}, () =>
482
+ slots.separator
483
+ ? slots.separator()
484
+ : h('span', { class: 'picker-input-group-icon date-picker-arrow-icon' }),
485
+ ),
486
+ props.range &&
487
+ h(CFormInput, {
488
+ class: {
489
+ hover: inputEndHoverValue.value,
490
+ },
491
+ disabled: props.disabled,
492
+ onClick: () => {
493
+ selectEndDate.value = true
494
+ },
495
+ onInput: (event) => {
496
+ const date = getLocalDateFromString(
497
+ event.target.value,
498
+ props.locale,
499
+ props.timepicker,
500
+ )
501
+ if (date instanceof Date && date.getTime()) {
502
+ calendarDate.value = date
503
+ endDate.value = date
504
+ }
505
+ },
506
+ placeholder: props.placeholder[1],
507
+ readonly: props.inputReadOnly || typeof props.format === 'string',
508
+ value: inputEndHoverValue.value
509
+ ? setInputValue(inputEndHoverValue.value)
510
+ : setInputValue(endDate.value),
511
+ }),
512
+ (props.indicator || props.cleaner) &&
513
+ h(CInputGroupText, {}, () => [
514
+ props.indicator &&
515
+ h(
516
+ 'span',
517
+ {
518
+ class: 'picker-input-group-indicator',
519
+ },
520
+ slots.indicator
521
+ ? slots.indicator()
522
+ : h('span', { class: 'picker-input-group-icon date-picker-input-icon' }),
523
+ ),
524
+ props.cleaner &&
525
+ h(
526
+ 'span',
527
+ {
528
+ class: 'picker-input-group-cleaner',
529
+ onClick: (event: Event) => handleClear(event),
530
+ role: 'button',
531
+ },
532
+ slots.cleaner
533
+ ? slots.cleaner()
534
+ : h('span', { class: 'picker-input-group-icon date-picker-cleaner-icon' }),
535
+ ),
536
+ ]),
537
+ ],
538
+ )
539
+
540
+ return () =>
541
+ h(
542
+ CPicker,
543
+ {
544
+ cancelButton: props.cancelButton,
545
+ cancelButtonColor: props.cancelButtonColor,
546
+ cancelButtonSize: props.cancelButtonSize,
547
+ cancelButtonVariant: props.cancelButtonVariant,
548
+ class: 'date-picker',
549
+ confirmButton: props.confirmButton,
550
+ confirmButtonColor: props.confirmButtonColor,
551
+ confirmButtonSize: props.confirmButtonSize,
552
+ confirmButtonVariant: props.confirmButtonVariant,
553
+ disabled: props.disabled,
554
+ footer: props.footer || props.timepicker,
555
+ onCancel: () => {
556
+ startDate.value = initialStartDate.value
557
+ endDate.value = initialEndDate.value
558
+ },
559
+ onHide: () => {
560
+ emit('hide')
561
+ },
562
+ onShow: () => {
563
+ if (startDate.value) {
564
+ initialStartDate.value = new Date(startDate.value)
565
+ }
566
+
567
+ if (endDate.value) {
568
+ initialEndDate.value = new Date(endDate.value)
569
+ }
570
+
571
+ emit('show')
572
+ },
573
+ },
574
+ {
575
+ ...(slots.cancelButton && {
576
+ cancelButton: () => slots.cancelButton && slots.cancelButton(),
577
+ }),
578
+ ...(slots.confirmButton && {
579
+ confirmButton: () => slots.confirmButton && slots.confirmButton(),
580
+ }),
581
+ toggler: () => InputGroup(),
582
+ footer: () =>
583
+ h(
584
+ CButton,
585
+ {
586
+ class: 'me-auto',
587
+ color: props.todayButtonColor,
588
+ size: props.todayButtonSize,
589
+ variant: props.todayButtonVariant,
590
+ onClick: () => {
591
+ const date = new Date()
592
+ startDate.value = date
593
+ endDate.value = date
594
+ calendarDate.value = date
595
+ },
596
+ },
597
+ () => props.todayButton,
598
+ ),
599
+ default: () =>
600
+ h(
601
+ 'div',
602
+ {
603
+ class: 'date-picker-body',
604
+ },
605
+ [
606
+ props.ranges &&
607
+ h(
608
+ 'div',
609
+ { class: 'date-picker-ranges' },
610
+ Object.keys(props.ranges).map((key: string) =>
611
+ h(
612
+ CButton,
613
+ {
614
+ color: 'secondary',
615
+ onClick: () => {
616
+ if (props.ranges) {
617
+ startDate.value = props.ranges[key][0]
618
+ endDate.value = props.ranges[key][1]
619
+ }
620
+ },
621
+ variant: 'ghost',
622
+ },
623
+ () => key,
624
+ ),
625
+ ),
626
+ ),
627
+ h(
628
+ 'div',
629
+ { class: 'date-picker-calendars' },
630
+ h(
631
+ CCalendar,
632
+ {
633
+ calendarDate: new Date(
634
+ calendarDate.value.getFullYear(),
635
+ calendarDate.value.getMonth(),
636
+ 1,
637
+ ),
638
+ calendars: props.calendars,
639
+ disabledDates: props.disabledDates,
640
+ ...(endDate.value && { endDate: endDate.value }),
641
+ firstDayOfWeek: props.firstDayOfWeek,
642
+ locale: props.locale,
643
+ maxDate: maxDate.value,
644
+ minDate: minDate.value,
645
+ navigation: props.navigation,
646
+ range: true,
647
+ selectEndDate: selectEndDate.value,
648
+ ...(startDate.value && { startDate: startDate.value }),
649
+ onCalendarCellHover: (date: Date | null) => handleCalendarCellHover(date),
650
+ onCalendarDateChange: (date: Date) => handleCalendarDateChange(date),
651
+ onStartDateChange: (date: Date) => handleStartDateChange(date),
652
+ onEndDateChange: (date: Date) => handleEndDateChange(date),
653
+ },
654
+ {
655
+ /**
656
+ * @slot Location for next icon.
657
+ */
658
+ ...(slots.navNextIcon && {
659
+ navNextIcon: () => slots.navNextIcon && slots.navNextIcon(),
660
+ }),
661
+ /**
662
+ * @slot Location for next double icon.
663
+ */
664
+ ...(slots.navNextDoubleIcon && {
665
+ navNextDoubleIcon: () =>
666
+ slots.navNextDoubleIcon && slots.navNextDoubleIcon(),
667
+ }),
668
+ /**
669
+ * @slot Location for previous icon.
670
+ */
671
+ ...(slots.navPrevIcon && {
672
+ navPrevIcon: () => slots.navPrevIcon && slots.navPrevIcon(),
673
+ }),
674
+ /**
675
+ * @slot Location for double previous icon.
676
+ */
677
+ ...(slots.navPrevDoubleIcon && {
678
+ navPrevDoubleIcon: () =>
679
+ slots.navPrevDoubleIcon && slots.navPrevDoubleIcon(),
680
+ }),
681
+ },
682
+ ),
683
+ ),
684
+ props.timepicker &&
685
+ h(
686
+ 'div',
687
+ { class: 'date-picker-timepickers' },
688
+ isMobile.value || (props.range && props.calendars === 1)
689
+ ? [
690
+ h(CTimePicker, {
691
+ container: 'inline',
692
+ disabled: startDate.value === null ? true : false,
693
+ locale: props.locale,
694
+ onChange: (_: any, __: any, date: Date) => handleStartDateChange(date),
695
+ time: startDate.value,
696
+ variant: 'select',
697
+ }),
698
+ h(CTimePicker, {
699
+ container: 'inline',
700
+ disabled: endDate.value === null ? true : false,
701
+ locale: props.locale,
702
+ onChange: (_: any, __: any, date: Date) => handleEndDateChange(date),
703
+ time: endDate.value,
704
+ variant: 'select',
705
+ }),
706
+ ]
707
+ : [...Array(props.calendars)].map((_, index) =>
708
+ h(CTimePicker, {
709
+ container: 'inline',
710
+ disabled:
711
+ index === 0
712
+ ? startDate.value === null
713
+ ? true
714
+ : false
715
+ : endDate.value === null
716
+ ? true
717
+ : false,
718
+ locale: props.locale,
719
+ onChange: (_: any, __: any, date: Date) =>
720
+ index === 0 ? handleStartDateChange(date) : handleEndDateChange(date),
721
+ time: index === 0 ? startDate.value : endDate.value,
722
+ variant: 'select',
723
+ }),
724
+ ),
725
+ ),
726
+ ],
727
+ ),
728
+ },
729
+ )
730
+ },
731
+ })
732
+
733
+ export { CDateRangePicker }