@coreui/vue-pro 4.8.2 → 4.9.0-beta.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.
- package/README.md +1 -1
- package/dist/components/accordion/CAccordion.d.ts +1 -1
- package/dist/components/accordion/CAccordionBody.d.ts +1 -1
- package/dist/components/accordion/CAccordionButton.d.ts +1 -1
- package/dist/components/accordion/CAccordionHeader.d.ts +1 -1
- package/dist/components/accordion/CAccordionItem.d.ts +1 -1
- package/dist/components/alert/CAlert.d.ts +1 -1
- package/dist/components/alert/CAlertHeading.d.ts +1 -1
- package/dist/components/alert/CAlertLink.d.ts +1 -1
- package/dist/components/avatar/CAvatar.d.ts +1 -1
- package/dist/components/backdrop/CBackdrop.d.ts +1 -1
- package/dist/components/badge/CBadge.d.ts +1 -1
- package/dist/components/breadcrumb/CBreadcrumb.d.ts +1 -1
- package/dist/components/breadcrumb/CBreadcrumbItem.d.ts +1 -1
- package/dist/components/button/CButton.d.ts +1 -1
- package/dist/components/button-group/CButtonGroup.d.ts +1 -1
- package/dist/components/button-group/CButtonToolbar.d.ts +1 -1
- package/dist/components/calendar/CCalendar.d.ts +33 -1
- package/dist/components/callout/CCallout.d.ts +1 -1
- package/dist/components/card/CCard.d.ts +1 -1
- package/dist/components/card/CCardBody.d.ts +1 -1
- package/dist/components/card/CCardFooter.d.ts +1 -1
- package/dist/components/card/CCardGroup.d.ts +1 -1
- package/dist/components/card/CCardHeader.d.ts +1 -1
- package/dist/components/card/CCardImage.d.ts +1 -1
- package/dist/components/card/CCardImageOverlay.d.ts +1 -1
- package/dist/components/card/CCardLink.d.ts +1 -1
- package/dist/components/card/CCardSubtitle.d.ts +1 -1
- package/dist/components/card/CCardText.d.ts +1 -1
- package/dist/components/card/CCardTitle.d.ts +1 -1
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/carousel/CCarouselCaption.d.ts +1 -1
- package/dist/components/carousel/CCarouselItem.d.ts +1 -1
- package/dist/components/close-button/CCloseButton.d.ts +1 -1
- package/dist/components/collapse/CCollapse.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +35 -3
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -78
- package/dist/components/date-range-picker/utils.d.ts +1 -0
- package/dist/components/dropdown/CDropdown.d.ts +2 -2
- package/dist/components/dropdown/CDropdownDivider.d.ts +1 -1
- package/dist/components/dropdown/CDropdownHeader.d.ts +1 -1
- package/dist/components/dropdown/CDropdownItem.d.ts +1 -1
- package/dist/components/dropdown/CDropdownMenu.d.ts +1 -1
- package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
- package/dist/components/element-cover/CElementCover.d.ts +1 -1
- package/dist/components/footer/CFooter.d.ts +1 -1
- package/dist/components/form/CForm.d.ts +1 -1
- package/dist/components/form/CFormCheck.d.ts +10 -2
- package/dist/components/form/CFormControl.d.ts +2 -2
- package/dist/components/form/CFormControlValidation.d.ts +1 -1
- package/dist/components/form/CFormControlWrapper.d.ts +1 -1
- package/dist/components/form/CFormFeedback.d.ts +1 -1
- package/dist/components/form/CFormFloating.d.ts +1 -1
- package/dist/components/form/CFormInput.d.ts +12 -12
- package/dist/components/form/CFormLabel.d.ts +1 -1
- package/dist/components/form/CFormRange.d.ts +1 -1
- package/dist/components/form/CFormSelect.d.ts +1 -1
- package/dist/components/form/CFormSwitch.d.ts +1 -1
- package/dist/components/form/CFormText.d.ts +1 -1
- package/dist/components/form/CFormTextarea.d.ts +3 -3
- package/dist/components/form/CInputGroup.d.ts +1 -1
- package/dist/components/form/CInputGroupText.d.ts +1 -1
- package/dist/components/grid/CCol.d.ts +1 -1
- package/dist/components/grid/CContainer.d.ts +1 -1
- package/dist/components/grid/CRow.d.ts +1 -1
- package/dist/components/header/CHeader.d.ts +1 -1
- package/dist/components/header/CHeaderBrand.d.ts +1 -1
- package/dist/components/header/CHeaderDivider.d.ts +1 -1
- package/dist/components/header/CHeaderNav.d.ts +1 -1
- package/dist/components/header/CHeaderText.d.ts +1 -1
- package/dist/components/header/CHeaderToggler.d.ts +1 -1
- package/dist/components/image/CImage.d.ts +1 -1
- package/dist/components/link/CLink.d.ts +1 -1
- package/dist/components/list-group/CListGroup.d.ts +1 -1
- package/dist/components/list-group/CListGroupItem.d.ts +1 -1
- package/dist/components/loading-button/CLoadingButton.d.ts +1 -1
- package/dist/components/modal/CModal.d.ts +1 -1
- package/dist/components/modal/CModalBody.d.ts +1 -1
- package/dist/components/modal/CModalFooter.d.ts +1 -1
- package/dist/components/modal/CModalHeader.d.ts +1 -1
- package/dist/components/modal/CModalTitle.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelect.d.ts +73 -59
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +9 -33
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +12 -41
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +6 -59
- package/dist/components/multi-select/types.d.ts +8 -3
- package/dist/components/multi-select/utils.d.ts +9 -4
- package/dist/components/nav/CNav.d.ts +1 -1
- package/dist/components/nav/CNavGroup.d.ts +1 -1
- package/dist/components/nav/CNavGroupItems.d.ts +1 -1
- package/dist/components/nav/CNavItem.d.ts +1 -1
- package/dist/components/nav/CNavLink.d.ts +1 -1
- package/dist/components/nav/CNavTitle.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/navbar/CNavbarBrand.d.ts +1 -1
- package/dist/components/navbar/CNavbarNav.d.ts +1 -1
- package/dist/components/navbar/CNavbarText.d.ts +1 -1
- package/dist/components/navbar/CNavbarToggler.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasBody.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasHeader.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasTitle.d.ts +1 -1
- package/dist/components/pagination/CPagination.d.ts +1 -1
- package/dist/components/pagination/CPaginationItem.d.ts +1 -1
- package/dist/components/picker/CPicker.d.ts +57 -7
- package/dist/components/placeholder/CPlaceholder.d.ts +1 -1
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/progress/CProgress.d.ts +1 -1
- package/dist/components/progress/CProgressBar.d.ts +1 -1
- package/dist/components/sidebar/CSidebar.d.ts +1 -1
- package/dist/components/sidebar/CSidebarBrand.d.ts +1 -1
- package/dist/components/sidebar/CSidebarFooter.d.ts +1 -1
- package/dist/components/sidebar/CSidebarHeader.d.ts +1 -1
- package/dist/components/sidebar/CSidebarNav.d.ts +1 -1
- package/dist/components/sidebar/CSidebarToggler.d.ts +1 -1
- package/dist/components/smart-pagination/CSmartPagination.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +20 -56
- package/dist/components/smart-table/CSmartTableBody.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableFilter.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableHead.d.ts +10 -1
- package/dist/components/smart-table/CSmartTableItemsPerPageSelector.d.ts +1 -1
- package/dist/components/smart-table/types.d.ts +12 -0
- package/dist/components/smart-table/utils.d.ts +12 -2
- package/dist/components/spinner/CSpinner.d.ts +1 -1
- package/dist/components/table/CTable.d.ts +1 -1
- package/dist/components/table/CTableBody.d.ts +1 -1
- package/dist/components/table/CTableCaption.d.ts +1 -1
- package/dist/components/table/CTableDataCell.d.ts +1 -1
- package/dist/components/table/CTableFoot.d.ts +1 -1
- package/dist/components/table/CTableHead.d.ts +1 -1
- package/dist/components/table/CTableHeaderCell.d.ts +1 -1
- package/dist/components/table/CTableRow.d.ts +1 -1
- package/dist/components/tabs/CTabContent.d.ts +1 -1
- package/dist/components/tabs/CTabPane.d.ts +1 -1
- package/dist/components/time-picker/CTimePicker.d.ts +1 -1
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +1 -1
- package/dist/components/toast/CToast.d.ts +1 -1
- package/dist/components/toast/CToastBody.d.ts +1 -1
- package/dist/components/toast/CToastClose.d.ts +1 -1
- package/dist/components/toast/CToastHeader.d.ts +1 -1
- package/dist/components/toast/CToaster.d.ts +1 -1
- package/dist/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/components/virtual-scroller/CVirtualScroller.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsA.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsB.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsC.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsE.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsF.d.ts +1 -1
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/useColorModes.d.ts +5 -0
- package/dist/directives/index.d.ts +1 -1
- package/dist/directives/v-c-visible.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +4224 -4159
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4226 -4160
- package/dist/index.js.map +1 -1
- package/dist/utils/getUID.d.ts +2 -0
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/isObjectInArray.d.ts +2 -0
- package/dist/utils/isRTL.d.ts +2 -0
- package/package.json +11 -11
- package/src/components/accordion/CAccordionItem.ts +2 -2
- package/src/components/backdrop/CBackdrop.ts +1 -1
- package/src/components/calendar/CCalendar.ts +111 -49
- package/src/components/carousel/CCarousel.ts +7 -7
- package/src/components/date-picker/CDatePicker.ts +16 -1
- package/src/components/date-range-picker/CDateRangePicker.ts +179 -128
- package/src/components/date-range-picker/utils.ts +49 -0
- package/src/components/dropdown/CDropdown.ts +34 -31
- package/src/components/dropdown/CDropdownMenu.ts +1 -1
- package/src/components/dropdown/CDropdownToggle.ts +1 -1
- package/src/components/element-cover/CElementCover.ts +1 -0
- package/src/components/form/CFormCheck.ts +10 -4
- package/src/components/form/CFormInput.ts +2 -2
- package/src/components/form/CFormLabel.ts +1 -1
- package/src/components/form/CFormSelect.ts +1 -1
- package/src/components/grid/CCol.ts +1 -1
- package/src/components/grid/CContainer.ts +1 -1
- package/src/components/header/CHeader.ts +1 -1
- package/src/components/modal/CModal.ts +1 -0
- package/src/components/multi-select/CMultiSelect.ts +337 -144
- package/src/components/multi-select/CMultiSelectNativeSelect.ts +8 -15
- package/src/components/multi-select/CMultiSelectOptions.ts +32 -39
- package/src/components/multi-select/CMultiSelectSelection.ts +24 -40
- package/src/components/multi-select/types.ts +10 -4
- package/src/components/multi-select/utils.ts +71 -37
- package/src/components/nav/CNavGroup.ts +4 -0
- package/src/components/navbar/CNavbar.ts +1 -1
- package/src/components/navbar/CNavbarBrand.ts +1 -1
- package/src/components/offcanvas/COffcanvas.ts +3 -2
- package/src/components/pagination/CPaginationItem.ts +1 -1
- package/src/components/picker/CPicker.ts +106 -157
- package/src/components/popover/CPopover.ts +18 -2
- package/src/components/props.ts +2 -6
- package/src/components/sidebar/CSidebar.ts +3 -2
- package/src/components/smart-table/CSmartTable.ts +45 -52
- package/src/components/smart-table/CSmartTableBody.ts +5 -3
- package/src/components/smart-table/CSmartTableHead.ts +41 -14
- package/src/components/smart-table/types.ts +13 -0
- package/src/components/smart-table/utils.ts +119 -21
- package/src/components/spinner/CSpinner.ts +4 -2
- package/src/components/table/CTable.ts +19 -18
- package/src/components/table/types.ts +19 -19
- package/src/components/time-picker/CTimePicker.ts +216 -125
- package/src/components/toast/CToast.ts +1 -1
- package/src/components/tooltip/CTooltip.ts +19 -3
- package/src/components/virtual-scroller/CVirtualScroller.ts +10 -8
- package/src/components/widgets/CWidgetStatsA.ts +1 -1
- package/src/components/widgets/CWidgetStatsB.ts +1 -1
- package/src/components/widgets/CWidgetStatsC.ts +1 -1
- package/src/components/widgets/CWidgetStatsE.ts +1 -1
- package/src/components/widgets/CWidgetStatsF.ts +1 -1
- package/src/composables/index.ts +3 -0
- package/src/composables/useColorModes.ts +57 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-c-popover.ts +9 -13
- package/src/directives/v-c-tooltip.ts +8 -12
- package/src/directives/v-c-visible.ts +1 -1
- package/src/index.ts +8 -29
- package/src/utils/getUID.ts +9 -0
- package/src/utils/index.ts +4 -1
- package/src/utils/isObjectInArray.ts +14 -0
- package/src/utils/isRTL.ts +13 -0
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0-beta.1",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"test:update": "jest --coverage --updateSnapshot"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@popperjs/core": "^2.11.
|
|
41
|
-
"@rollup/plugin-commonjs": "^
|
|
42
|
-
"@rollup/plugin-node-resolve": "^15.0
|
|
43
|
-
"@rollup/plugin-typescript": "^11.
|
|
44
|
-
"@types/jest": "^29.5.
|
|
40
|
+
"@popperjs/core": "^2.11.8",
|
|
41
|
+
"@rollup/plugin-commonjs": "^25.0.1",
|
|
42
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
43
|
+
"@rollup/plugin-typescript": "^11.1.1",
|
|
44
|
+
"@types/jest": "^29.5.2",
|
|
45
45
|
"@vue/test-utils": "^2.3.2",
|
|
46
|
-
"@vue/vue3-jest": "29.2.
|
|
46
|
+
"@vue/vue3-jest": "29.2.4",
|
|
47
47
|
"date-fns": "^2.29.3",
|
|
48
48
|
"jest": "^29.5.0",
|
|
49
49
|
"jest-environment-jsdom": "^29.5.0",
|
|
50
|
-
"rollup": "^3.
|
|
50
|
+
"rollup": "^3.25.0",
|
|
51
51
|
"rollup-plugin-vue": "^6.0.0",
|
|
52
|
-
"ts-jest": "^29.0
|
|
52
|
+
"ts-jest": "^29.1.0",
|
|
53
53
|
"typescript": "^4.9.5",
|
|
54
|
-
"vue": "^3.
|
|
55
|
-
"vue-types": "^5.0.
|
|
54
|
+
"vue": "^3.3.4",
|
|
55
|
+
"vue-types": "^5.0.3"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@coreui/coreui-pro": "^4.3.4",
|
|
@@ -6,14 +6,14 @@ const CAccordionItem = defineComponent({
|
|
|
6
6
|
/**
|
|
7
7
|
* The item key.
|
|
8
8
|
*/
|
|
9
|
-
itemKey: [Number, String]
|
|
9
|
+
itemKey: [Number, String],
|
|
10
10
|
},
|
|
11
11
|
setup(props, { slots }) {
|
|
12
12
|
const activeItemKey = inject('activeItemKey') as Ref<number | string>
|
|
13
13
|
const alwaysOpen = inject('alwaysOpen') as boolean
|
|
14
14
|
const setActiveItemKey = inject('setActiveItemKey') as (key: number | string) => void
|
|
15
15
|
|
|
16
|
-
const itemKey = ref(props.itemKey
|
|
16
|
+
const itemKey = ref(props.itemKey ?? Math.random().toString(36).slice(2, 11))
|
|
17
17
|
const visible = ref(Boolean(activeItemKey.value === itemKey.value))
|
|
18
18
|
|
|
19
19
|
watch(activeItemKey, () => (visible.value = Boolean(activeItemKey.value === itemKey.value)))
|
|
@@ -123,6 +123,21 @@ const CCalendar = defineComponent({
|
|
|
123
123
|
* Toggle select mode between start and end date.
|
|
124
124
|
*/
|
|
125
125
|
selectEndDate: Boolean,
|
|
126
|
+
/**
|
|
127
|
+
* Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacementDays` option is set to true.
|
|
128
|
+
*
|
|
129
|
+
* @since 4.9.0
|
|
130
|
+
*/
|
|
131
|
+
selectAdjacementDays: Boolean,
|
|
132
|
+
/**
|
|
133
|
+
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
134
|
+
*
|
|
135
|
+
* @since 4.9.0
|
|
136
|
+
*/
|
|
137
|
+
showAdjacementDays: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: true,
|
|
140
|
+
},
|
|
126
141
|
/**
|
|
127
142
|
* Initial selected date.
|
|
128
143
|
*/
|
|
@@ -255,13 +270,14 @@ const CCalendar = defineComponent({
|
|
|
255
270
|
emit('end-date-change', endDate.value)
|
|
256
271
|
})
|
|
257
272
|
|
|
258
|
-
const setCalendarPage = (years: number, months = 0) => {
|
|
273
|
+
const setCalendarPage = (years: number, months = 0, setMonth?: number) => {
|
|
259
274
|
const year = calendarDate.value.getFullYear()
|
|
260
275
|
const month = calendarDate.value.getMonth()
|
|
261
276
|
const d = new Date(year, month, 1)
|
|
262
277
|
|
|
263
278
|
years && d.setFullYear(d.getFullYear() + years)
|
|
264
279
|
months && d.setMonth(d.getMonth() + months)
|
|
280
|
+
typeof setMonth === 'number' && d.setMonth(setMonth)
|
|
265
281
|
|
|
266
282
|
calendarDate.value = d
|
|
267
283
|
|
|
@@ -313,6 +329,14 @@ const CCalendar = defineComponent({
|
|
|
313
329
|
startDate.value = date
|
|
314
330
|
}
|
|
315
331
|
|
|
332
|
+
const handleCellKeyDown = (event: KeyboardEvent, date: Date) => {
|
|
333
|
+
if (event.code === 'Space' || event.key === 'Enter') {
|
|
334
|
+
event.preventDefault()
|
|
335
|
+
handleCellOnClick && handleCellOnClick(date)
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
316
340
|
const handleCellMouseEnter = (date: Date) => {
|
|
317
341
|
if (isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)) {
|
|
318
342
|
return
|
|
@@ -327,10 +351,24 @@ const CCalendar = defineComponent({
|
|
|
327
351
|
emit('calendar-cell-hover', null)
|
|
328
352
|
}
|
|
329
353
|
|
|
354
|
+
const handleMonthKeyDown = (event: KeyboardEvent, month: number) => {
|
|
355
|
+
if (event.code === 'Space' || event.key === 'Enter') {
|
|
356
|
+
setCalendarPage(0, month)
|
|
357
|
+
view.value = 'days'
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const handleYearKeyDown = (event: KeyboardEvent, date: Date) => {
|
|
362
|
+
if (event.code === 'Space' || event.key === 'Enter') {
|
|
363
|
+
calendarDate.value = date
|
|
364
|
+
view.value = 'months'
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
330
368
|
const handleNavigationOnClick = (direction: string, double = false) => {
|
|
331
369
|
if (direction === 'prev') {
|
|
332
370
|
if (double) {
|
|
333
|
-
setCalendarPage(view.value
|
|
371
|
+
setCalendarPage(view.value === 'days' ? -1 : -10)
|
|
334
372
|
return
|
|
335
373
|
}
|
|
336
374
|
if (view.value !== 'days') {
|
|
@@ -342,7 +380,7 @@ const CCalendar = defineComponent({
|
|
|
342
380
|
}
|
|
343
381
|
if (direction === 'next') {
|
|
344
382
|
if (double) {
|
|
345
|
-
setCalendarPage(view.value
|
|
383
|
+
setCalendarPage(view.value === 'days' ? 1 : 10)
|
|
346
384
|
return
|
|
347
385
|
}
|
|
348
386
|
if (view.value !== 'days') {
|
|
@@ -412,53 +450,68 @@ const CCalendar = defineComponent({
|
|
|
412
450
|
'tr',
|
|
413
451
|
{},
|
|
414
452
|
week.map(({ date, month }: { date: Date; month: string }) => {
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
class: [
|
|
419
|
-
'calendar-cell',
|
|
453
|
+
return month === 'current' || props.showAdjacementDays
|
|
454
|
+
? h(
|
|
455
|
+
'td',
|
|
420
456
|
{
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
:
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
class: [
|
|
458
|
+
'calendar-cell',
|
|
459
|
+
{
|
|
460
|
+
today: isToday(date),
|
|
461
|
+
disabled: isDateDisabled(
|
|
462
|
+
date,
|
|
463
|
+
minDate.value,
|
|
464
|
+
maxDate.value,
|
|
465
|
+
props.disabledDates,
|
|
466
|
+
),
|
|
467
|
+
[month]: true,
|
|
468
|
+
clickable: month !== 'current' && props.selectAdjacementDays,
|
|
469
|
+
last: isLastDayOfMonth(date),
|
|
470
|
+
range:
|
|
471
|
+
month === 'current' &&
|
|
472
|
+
isDateInRange(date, startDate.value, endDate.value),
|
|
473
|
+
'range-hover':
|
|
474
|
+
month === 'current' &&
|
|
475
|
+
(hoverDate.value && selectEndDate.value
|
|
476
|
+
? isDateInRange(date, startDate.value, hoverDate.value)
|
|
477
|
+
: isDateInRange(date, hoverDate.value, endDate.value)),
|
|
478
|
+
selected: isDateSelected(date, startDate.value, endDate.value),
|
|
479
|
+
start: isStartDate(date, startDate.value, endDate.value),
|
|
480
|
+
end: isEndDate(date, startDate.value, endDate.value),
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
tabindex:
|
|
484
|
+
(month === 'current' || props.selectAdjacementDays) &&
|
|
485
|
+
!isDateDisabled(date, minDate.value, maxDate.value, props.disabledDates)
|
|
486
|
+
? 0
|
|
487
|
+
: -1,
|
|
488
|
+
title: date.toLocaleDateString(props.locale),
|
|
489
|
+
...((month === 'current' || props.selectAdjacementDays) && {
|
|
490
|
+
onBlur: () => handleCellMouseLeave(),
|
|
491
|
+
onClick: () => handleCellOnClick(date),
|
|
492
|
+
onFocus: () => handleCellMouseEnter(date),
|
|
493
|
+
onKeydown: (event: KeyboardEvent) => handleCellKeyDown(event, date),
|
|
494
|
+
onmouseenter: () => handleCellMouseEnter(date),
|
|
495
|
+
onmouseleave: () => handleCellMouseLeave(),
|
|
459
496
|
}),
|
|
460
|
-
|
|
461
|
-
|
|
497
|
+
...(month !== 'current' &&
|
|
498
|
+
!props.selectAdjacementDays && {
|
|
499
|
+
onMouseEnter: () => handleCellMouseLeave(),
|
|
500
|
+
}),
|
|
501
|
+
},
|
|
502
|
+
h(
|
|
503
|
+
'div',
|
|
504
|
+
{
|
|
505
|
+
class: 'calendar-cell-inner',
|
|
506
|
+
},
|
|
507
|
+
typeof props.dayFormat === 'function'
|
|
508
|
+
? props.dayFormat(date)
|
|
509
|
+
: date.toLocaleDateString(props.locale, {
|
|
510
|
+
day: <'numeric' | '2-digit'>props.dayFormat,
|
|
511
|
+
}),
|
|
512
|
+
),
|
|
513
|
+
)
|
|
514
|
+
: h('td')
|
|
462
515
|
}),
|
|
463
516
|
)
|
|
464
517
|
}),
|
|
@@ -473,9 +526,12 @@ const CCalendar = defineComponent({
|
|
|
473
526
|
{
|
|
474
527
|
class: 'calendar-cell month',
|
|
475
528
|
onClick: () => {
|
|
476
|
-
setCalendarPage(0, index * 3 + idx - addMonths)
|
|
529
|
+
setCalendarPage(0, 0, index * 3 + idx - addMonths)
|
|
477
530
|
view.value = 'days'
|
|
478
531
|
},
|
|
532
|
+
onKeydown: (event: KeyboardEvent) =>
|
|
533
|
+
handleMonthKeyDown(event, index * 3 + idx - addMonths),
|
|
534
|
+
tabindex: 0,
|
|
479
535
|
},
|
|
480
536
|
h('div', { class: 'calendar-cell-inner' }, month),
|
|
481
537
|
)
|
|
@@ -500,6 +556,12 @@ const CCalendar = defineComponent({
|
|
|
500
556
|
)
|
|
501
557
|
view.value = 'months'
|
|
502
558
|
},
|
|
559
|
+
onKeydown: (event: KeyboardEvent) =>
|
|
560
|
+
handleYearKeyDown(
|
|
561
|
+
event,
|
|
562
|
+
new Date(year, date.getMonth() - addMonths, date.getDate()),
|
|
563
|
+
),
|
|
564
|
+
tabindex: 0,
|
|
503
565
|
},
|
|
504
566
|
h('div', { class: 'calendar-cell-inner' }, year),
|
|
505
567
|
)
|
|
@@ -81,7 +81,7 @@ const CCarousel = defineComponent({
|
|
|
81
81
|
const items = ref<VNode[]>([])
|
|
82
82
|
const timeout = ref()
|
|
83
83
|
const visible = ref()
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
const setAnimating = (value: boolean) => {
|
|
86
86
|
animating.value = value
|
|
87
87
|
}
|
|
@@ -142,16 +142,16 @@ const CCarousel = defineComponent({
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
const handleScroll = () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} else {
|
|
148
|
-
visible.value = false
|
|
149
|
-
}
|
|
145
|
+
visible.value =
|
|
146
|
+
!document.hidden && carouselRef.value && isInViewport(carouselRef.value) ? true : false
|
|
150
147
|
}
|
|
151
148
|
|
|
152
149
|
onBeforeMount(() => {
|
|
153
150
|
if (slots.default) {
|
|
154
|
-
const children =
|
|
151
|
+
const children =
|
|
152
|
+
typeof slots.default()[0].type === 'symbol'
|
|
153
|
+
? slots.default()[0].children
|
|
154
|
+
: slots.default()
|
|
155
155
|
|
|
156
156
|
if (children && Array.isArray(children)) {
|
|
157
157
|
// @ts-expect-error TODO: fix types
|
|
@@ -219,6 +219,21 @@ const CDatePicker = defineComponent({
|
|
|
219
219
|
type: String,
|
|
220
220
|
default: 'Select date',
|
|
221
221
|
},
|
|
222
|
+
/**
|
|
223
|
+
* Set whether days in adjacent months shown before or after the current month are selectable. This only applies if the `showAdjacementDays` option is set to true.
|
|
224
|
+
*
|
|
225
|
+
* @since 4.9.0
|
|
226
|
+
*/
|
|
227
|
+
selectAdjacementDays: Boolean,
|
|
228
|
+
/**
|
|
229
|
+
* Set whether to display dates in adjacent months (non-selectable) at the start and end of the current month.
|
|
230
|
+
*
|
|
231
|
+
* @since 4.9.0
|
|
232
|
+
*/
|
|
233
|
+
showAdjacementDays: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
default: true,
|
|
236
|
+
},
|
|
222
237
|
/**
|
|
223
238
|
* Size the component small or large.
|
|
224
239
|
*
|
|
@@ -277,7 +292,7 @@ const CDatePicker = defineComponent({
|
|
|
277
292
|
return () =>
|
|
278
293
|
h(CDateRangePicker, {
|
|
279
294
|
calendars: 1,
|
|
280
|
-
onStartDateChange: (date: Date, formatedDate:
|
|
295
|
+
onStartDateChange: (date: Date, formatedDate: string) => {
|
|
281
296
|
emit('date-change', date, formatedDate)
|
|
282
297
|
emit('update:date', date)
|
|
283
298
|
},
|