@coreui/vue-pro 4.3.0-beta.0 → 4.3.1

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 (78) hide show
  1. package/README.md +113 -5
  2. package/dist/components/accordion/index.d.ts +1 -2
  3. package/dist/components/calendar/CCalendar.d.ts +15 -2
  4. package/dist/components/carousel/CCarousel.d.ts +1 -1
  5. package/dist/components/date-picker/CDatePicker.d.ts +24 -2
  6. package/dist/components/date-range-picker/CDateRangePicker.d.ts +102 -3
  7. package/dist/components/form/CFormCheck.d.ts +88 -39
  8. package/dist/components/form/CFormControlValidation.d.ts +98 -0
  9. package/dist/components/form/CFormControlWrapper.d.ts +6 -0
  10. package/dist/components/form/CFormFeedback.d.ts +2 -2
  11. package/dist/components/form/CFormInput.d.ts +133 -27
  12. package/dist/components/form/CFormRange.d.ts +18 -16
  13. package/dist/components/form/CFormSelect.d.ts +125 -16
  14. package/dist/components/form/CFormSwitch.d.ts +0 -23
  15. package/dist/components/form/CFormTextarea.d.ts +125 -24
  16. package/dist/components/modal/CModal.d.ts +1 -1
  17. package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
  18. package/dist/components/smart-table/CSmartTable.d.ts +34 -98
  19. package/dist/components/smart-table/CSmartTableInterface.d.ts +3 -3
  20. package/dist/components/time-picker/CTimePicker.d.ts +1 -1
  21. package/dist/components/toast/CToast.d.ts +7 -1
  22. package/dist/components/widgets/CWidgetStatsB.d.ts +3 -8
  23. package/dist/components/widgets/CWidgetStatsC.d.ts +3 -8
  24. package/dist/directives/v-c-popover.d.ts +1 -1
  25. package/dist/directives/v-c-tooltip.d.ts +1 -1
  26. package/dist/index.es.js +5523 -644
  27. package/dist/index.es.js.map +1 -1
  28. package/dist/index.js +5522 -644
  29. package/dist/index.js.map +1 -1
  30. package/dist/utils/calendar.d.ts +4 -2
  31. package/dist/utils/time.d.ts +6 -2
  32. package/dist/utils/transition.d.ts +3 -0
  33. package/package.json +12 -11
  34. package/src/components/accordion/index.ts +0 -3
  35. package/src/components/backdrop/CBackdrop.ts +8 -6
  36. package/src/components/button/CButton.ts +2 -2
  37. package/src/components/calendar/CCalendar.ts +132 -62
  38. package/src/components/close-button/CCloseButton.ts +1 -0
  39. package/src/components/close-button/__tests__/__snapshots__/CCloseButton.spec.ts.snap +2 -2
  40. package/src/components/collapse/CCollapse.ts +5 -6
  41. package/src/components/date-picker/CDatePicker.ts +14 -10
  42. package/src/components/date-range-picker/CDateRangePicker.ts +209 -100
  43. package/src/components/form/CFormCheck.ts +118 -95
  44. package/src/components/form/CFormControlValidation.ts +97 -0
  45. package/src/components/form/CFormControlWrapper.ts +106 -0
  46. package/src/components/form/CFormInput.ts +115 -30
  47. package/src/components/form/CFormRange.ts +25 -11
  48. package/src/components/form/CFormSelect.ts +127 -41
  49. package/src/components/form/CFormSwitch.ts +2 -21
  50. package/src/components/form/CFormTextarea.ts +113 -25
  51. package/src/components/form/__tests__/CFormInput.spec.ts +11 -11
  52. package/src/components/form/__tests__/CFormRange.spec.ts +9 -9
  53. package/src/components/form/__tests__/CFormSelect.spec.ts +4 -4
  54. package/src/components/form/__tests__/CFormTextarea.spec.ts +4 -4
  55. package/src/components/form/__tests__/__snapshots__/CFormCheck.spec.ts.snap +8 -2
  56. package/src/components/form/__tests__/__snapshots__/CFormRange.spec.ts.snap +1 -1
  57. package/src/components/modal/CModal.ts +14 -6
  58. package/src/components/modal/__tests__/__snapshots__/CModal.spec.ts.snap +1 -2
  59. package/src/components/modal/__tests__/__snapshots__/CModalHeader.spec.ts.snap +2 -2
  60. package/src/components/nav/CNavGroup.ts +4 -6
  61. package/src/components/offcanvas/COffcanvas.ts +5 -7
  62. package/src/components/pagination/CSmartPagination.ts +4 -4
  63. package/src/components/picker/CPicker.ts +1 -0
  64. package/src/components/popover/CPopover.ts +5 -5
  65. package/src/components/sidebar/__tests__/__snapshots__/CSidebar.spec.ts.snap +2 -8
  66. package/src/components/smart-table/CSmartTable.ts +17 -49
  67. package/src/components/smart-table/CSmartTableInterface.ts +5 -3
  68. package/src/components/tabs/CTabPane.ts +4 -6
  69. package/src/components/time-picker/CTimePicker.ts +12 -17
  70. package/src/components/toast/CToast.ts +17 -12
  71. package/src/components/toast/__tests__/__snapshots__/CToastClose.spec.ts.snap +1 -1
  72. package/src/components/toast/__tests__/__snapshots__/CToastHeader.spec.ts.snap +1 -1
  73. package/src/components/tooltip/CTooltip.ts +5 -5
  74. package/src/directives/v-c-popover.ts +1 -1
  75. package/src/directives/v-c-tooltip.ts +1 -1
  76. package/src/utils/calendar.ts +86 -9
  77. package/src/utils/time.ts +29 -3
  78. package/src/utils/transition.ts +65 -0
@@ -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) => 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
  }[][];
13
- export declare const isDateDisabled: (date: Date, min?: Date | null | undefined, max?: Date | null | undefined, dates?: Date[] | Date[][] | undefined) => boolean | undefined;
14
+ export declare const isDisableDateInRange: (startDate?: Date | null, endDate?: Date | null, dates?: Date[] | Date[][]) => boolean;
15
+ export declare const isDateDisabled: (date: Date, min?: Date | null, max?: Date | null, dates?: Date[] | Date[][]) => 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;
@@ -6,8 +6,12 @@ export declare const getListOfHours: (locale: string) => {
6
6
  value: number;
7
7
  label: string;
8
8
  }[];
9
- export declare const getMinutesOrSeconds: (locale: string) => {
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-beta.0",
3
+ "version": "4.3.1",
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.4",
42
- "@rollup/plugin-commonjs": "^21.0.2",
43
- "@rollup/plugin-node-resolve": "^13.1.3",
44
- "@rollup/plugin-typescript": "^8.3.1",
45
- "@vue/test-utils": "^2.0.0-rc.17",
46
- "rollup": "^2.70.1",
41
+ "@popperjs/core": "^2.11.5",
42
+ "@rollup/plugin-commonjs": "^22.0.1",
43
+ "@rollup/plugin-node-resolve": "^13.3.0",
44
+ "@rollup/plugin-typescript": "^8.3.3",
45
+ "@vue/test-utils": "^2.0.2",
46
+ "date-fns": "^2.29.1",
47
+ "rollup": "^2.77.2",
47
48
  "rollup-plugin-vue": "^6.0.0",
48
- "typescript": "^4.6.2",
49
- "vue": "^3.2.31",
50
- "vue-types": "^4.1.1"
49
+ "typescript": "^4.7.4",
50
+ "vue": "^3.2.37",
51
+ "vue-types": "^4.2.0"
51
52
  },
52
53
  "peerDependencies": {
53
- "@coreui/coreui-pro": "^4.1.0",
54
+ "@coreui/coreui-pro": "^4.3.2",
54
55
  "vue": "^3.2.21"
55
56
  },
56
57
  "standard": {
@@ -2,7 +2,6 @@ import { App } from 'vue'
2
2
  import { CAccordion } from './CAccordion'
3
3
  import { CAccordionBody } from './CAccordionBody'
4
4
  import { CAccordionButton } from './CAccordionButton'
5
- import { CAccordionCollapse } from './CAccordionCollapse'
6
5
  import { CAccordionHeader } from './CAccordionHeader'
7
6
  import { CAccordionItem } from './CAccordionItem'
8
7
 
@@ -11,7 +10,6 @@ const CAccordionPlugin = {
11
10
  app.component(CAccordion.name, CAccordion)
12
11
  app.component(CAccordionBody.name, CAccordionBody)
13
12
  app.component(CAccordionButton.name, CAccordionButton)
14
- app.component(CAccordionCollapse.name, CAccordionCollapse)
15
13
  app.component(CAccordionHeader.name, CAccordionHeader)
16
14
  app.component(CAccordionItem.name, CAccordionItem)
17
15
  },
@@ -22,7 +20,6 @@ export {
22
20
  CAccordion,
23
21
  CAccordionBody,
24
22
  CAccordionButton,
25
- CAccordionCollapse,
26
23
  CAccordionHeader,
27
24
  CAccordionItem,
28
25
  }
@@ -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
- el.addEventListener('transitionend', () => {
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
- el.addEventListener('transitionend', () => {
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(props.calendarDate ? new Date(props.calendarDate) : new Date())
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) calendarDate.value = new Date(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
- if (props.startDate === null) {
162
- startDate.value = null
163
- return
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
- if (props.endDate === null) {
184
- endDate.value = null
185
- return
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
- if (props.endDate) {
189
- const d = new Date(props.endDate)
190
- if (endDate.value === null) {
191
- endDate.value = d
192
- return
193
- }
193
+ watch(
194
+ () => props.maxDate,
195
+ () => {
196
+ if (props.maxDate) {
197
+ maxDate.value = new Date(props.maxDate)
198
+ }
199
+ },
200
+ )
194
201
 
195
- if (endDate.value && !isSameDateAs(d, endDate.value)) {
196
- endDate.value = d
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
- // If endDate > date
246
+ selectEndDate.value = false
247
+
238
248
  if (startDate.value && startDate.value > date) {
239
- endDate.value = startDate.value
240
- startDate.value = date
241
- } else {
242
- endDate.value = date
249
+ startDate.value = null
250
+ endDate.value = null
251
+ return
243
252
  }
244
- selectEndDate.value = false
245
- } else {
246
- startDate.value = date
247
- selectEndDate.value = true
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
- } else {
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
- calendarDate.value.getFullYear(),
295
- calendarDate.value.getMonth(),
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(calendarDate.value.getFullYear()), 4)
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(date, minDate, maxDate, props.disabledDates),
344
- next: month === 'next',
345
- previous: month === 'previous',
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
- onClick: () => handleCellOnClick(date),
357
- onmouseenter: () => handleCellMouseEnter(date),
358
- onmouseleave: () => handleCellMouseLeave(),
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
- calendarDate.value.getMonth(),
405
- calendarDate.value.getDate(),
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
- () => calendarDate.value.toLocaleDateString(props.locale, { month: 'long' }),
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
- () => calendarDate.value.toLocaleDateString(props.locale, { year: 'numeric' }),
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
- return () => h('div', { class: ['calendar', view.value] }, [h(Navigation), h(Calendar)])
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
 
@@ -34,6 +34,7 @@ export const CCloseButton = defineComponent({
34
34
  }
35
35
  return () =>
36
36
  h('button', {
37
+ type: 'button',
37
38
  class: [
38
39
  'btn',
39
40
  'btn-close',
@@ -1,5 +1,5 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Customize CCloseButton component renders correctly 1`] = `"<button class=\\"btn btn-close btn-close-white\\" aria-label=\\"Close\\" disabled=\\"\\"></button>"`;
3
+ exports[`Customize CCloseButton component renders correctly 1`] = `"<button type=\\"button\\" class=\\"btn btn-close btn-close-white\\" aria-label=\\"Close\\" disabled=\\"\\"></button>"`;
4
4
 
5
- exports[`Loads and display CCloseButton component renders correctly 1`] = `"<button class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;
5
+ exports[`Loads and display CCloseButton component renders correctly 1`] = `"<button type=\\"button\\" class=\\"btn btn-close\\" aria-label=\\"Close\\"></button>"`;
@@ -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
- el.addEventListener('transitionend', () => {
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,16 +125,27 @@ 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
  */
137
141
  footer: Boolean,
142
+ /**
143
+ * The id global attribute defines an identifier (ID) that must be unique in the whole document.
144
+ *
145
+ * The name attribute for the input element is generated based on the `id` property:
146
+ * - {id}-date
147
+ */
148
+ id: String,
138
149
  /**
139
150
  * Toggle visibility or set the content of the input indicator.
140
151
  */
@@ -224,18 +235,11 @@ const CDatePicker = defineComponent({
224
235
  return () =>
225
236
  h(CDateRangePicker, {
226
237
  calendars: 1,
227
- onStartDateChange: (date: Date) => emit('date-change', date),
238
+ onStartDateChange: (date: Date, formatedDate: String) =>
239
+ emit('date-change', date, formatedDate),
228
240
  range: false,
229
241
  startDate: props.date,
230
242
  ...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
243
  })
240
244
  },
241
245
  })