@coreui/vue-pro 4.7.0-alpha.1 → 4.7.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/element-cover/CElementCover.d.ts +14 -11
- package/dist/components/smart-table/CSmartTable.d.ts +19 -8
- package/dist/components/smart-table/CSmartTableHead.d.ts +3 -3
- package/dist/components/smart-table/CSmartTableInterface.d.ts +4 -0
- package/dist/components/table/CTable.d.ts +4 -10
- package/dist/index.es.js +285 -3553
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +286 -3554
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/isInViewport.d.ts +2 -0
- package/package.json +10 -14
- package/src/components/carousel/CCarousel.ts +3 -3
- package/src/components/element-cover/CElementCover.ts +55 -40
- package/src/components/form/CFormControlWrapper.ts +36 -22
- package/src/components/sidebar/CSidebar.ts +5 -5
- package/src/components/smart-table/CSmartTable.ts +46 -6
- package/src/components/smart-table/CSmartTableHead.ts +1 -1
- package/src/components/smart-table/CSmartTableInterface.ts +6 -0
- package/src/components/table/CTable.ts +45 -42
- package/src/components/time-picker/CTimePicker.ts +4 -3
- package/src/utils/calendar.ts +2 -2
- package/src/utils/index.ts +2 -2
- package/src/utils/isInViewport.ts +11 -0
- package/src/utils/time.ts +8 -10
- package/src/utils/isVisible.ts +0 -11
package/dist/utils/calendar.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ export declare const getMonthDetails: (year: number, month: number, firstDayOfWe
|
|
|
11
11
|
date: Date;
|
|
12
12
|
month: string;
|
|
13
13
|
}[][];
|
|
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
|
+
export declare const isDisableDateInRange: (startDate?: Date | null, endDate?: Date | null, dates?: Date[] | Date[][] | (Date | Date[])[]) => boolean;
|
|
15
|
+
export declare const isDateDisabled: (date: Date, min?: Date | null, max?: Date | null, dates?: Date[] | Date[][] | (Date | Date[])[]) => boolean | undefined;
|
|
16
16
|
export declare const isDateInRange: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
17
17
|
export declare const isDateSelected: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
|
18
18
|
export declare const isEndDate: (date: Date, start: Date | null, end: Date | null) => boolean | null;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import getNextSibling from './getNextSibling';
|
|
2
2
|
import getPreviousSibling from './getPreviousSibling';
|
|
3
|
-
import
|
|
4
|
-
export { getNextSibling, getPreviousSibling,
|
|
3
|
+
import isInViewport from './isInViewport';
|
|
4
|
+
export { getNextSibling, getPreviousSibling, isInViewport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/vue-pro",
|
|
3
|
-
"version": "4.7.0
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "UI Components Library for Vue.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -31,24 +31,20 @@
|
|
|
31
31
|
"src/"
|
|
32
32
|
],
|
|
33
33
|
"scripts": {
|
|
34
|
-
"build": "rollup -c"
|
|
35
|
-
"watch": "rollup -c -w"
|
|
36
|
-
},
|
|
37
|
-
"config": {
|
|
38
|
-
"version_short": "4.6"
|
|
34
|
+
"build": "rollup -c --bundleConfigAsCjs"
|
|
39
35
|
},
|
|
40
36
|
"devDependencies": {
|
|
41
37
|
"@popperjs/core": "^2.11.6",
|
|
42
|
-
"@rollup/plugin-commonjs": "^
|
|
43
|
-
"@rollup/plugin-node-resolve": "^
|
|
44
|
-
"@rollup/plugin-typescript": "^
|
|
45
|
-
"@vue/test-utils": "^2.
|
|
38
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
39
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
40
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
41
|
+
"@vue/test-utils": "^2.2.7",
|
|
46
42
|
"date-fns": "^2.29.3",
|
|
47
|
-
"rollup": "^
|
|
43
|
+
"rollup": "^3.10.0",
|
|
48
44
|
"rollup-plugin-vue": "^6.0.0",
|
|
49
|
-
"typescript": "^4.
|
|
50
|
-
"vue": "^3.2.
|
|
51
|
-
"vue-types": "^
|
|
45
|
+
"typescript": "^4.9.4",
|
|
46
|
+
"vue": "^3.2.45",
|
|
47
|
+
"vue-types": "^5.0.2"
|
|
52
48
|
},
|
|
53
49
|
"peerDependencies": {
|
|
54
50
|
"@coreui/coreui-pro": "^4.3.4",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
watch,
|
|
12
12
|
} from 'vue'
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import { isInViewport } from './../../utils'
|
|
15
15
|
|
|
16
16
|
const CCarousel = defineComponent({
|
|
17
17
|
name: 'CCarousel',
|
|
@@ -133,7 +133,7 @@ const CCarousel = defineComponent({
|
|
|
133
133
|
const nextItemWhenVisible = () => {
|
|
134
134
|
// Don't call next when the page isn't visible
|
|
135
135
|
// or the carousel or its parent isn't visible
|
|
136
|
-
if (!document.hidden &&
|
|
136
|
+
if (!document.hidden && isInViewport(carouselRef.value)) {
|
|
137
137
|
handleControlClick('next')
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -156,7 +156,7 @@ const CCarousel = defineComponent({
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
const handleScroll = () => {
|
|
159
|
-
if (!document.hidden &&
|
|
159
|
+
if (!document.hidden && isInViewport(carouselRef.value)) {
|
|
160
160
|
visible.value = true
|
|
161
161
|
} else {
|
|
162
162
|
visible.value = false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, onMounted, nextTick, ref, Ref } from 'vue'
|
|
1
|
+
import { defineComponent, h, onMounted, nextTick, ref, PropType, Ref } from 'vue'
|
|
2
2
|
import { CSpinner } from '../spinner'
|
|
3
3
|
|
|
4
4
|
const CElementCover = defineComponent({
|
|
@@ -11,11 +11,7 @@ const CElementCover = defineComponent({
|
|
|
11
11
|
*
|
|
12
12
|
* @type {sides: string[], query: string}[]
|
|
13
13
|
*/
|
|
14
|
-
boundaries: {
|
|
15
|
-
// TODO: check if this is correct, TJ
|
|
16
|
-
type: Array,
|
|
17
|
-
require: true,
|
|
18
|
-
},
|
|
14
|
+
boundaries: Array as PropType<{ sides: string[]; query: string }[]>,
|
|
19
15
|
/**
|
|
20
16
|
* Opacity of the cover. [docs]
|
|
21
17
|
*
|
|
@@ -23,30 +19,38 @@ const CElementCover = defineComponent({
|
|
|
23
19
|
*/
|
|
24
20
|
opacity: {
|
|
25
21
|
type: Number,
|
|
26
|
-
|
|
22
|
+
default: 0.4,
|
|
27
23
|
},
|
|
28
24
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Location for custom content.
|
|
27
|
+
*
|
|
28
|
+
* @slot default
|
|
29
|
+
*/
|
|
30
|
+
setup(props, { slots }) {
|
|
31
|
+
const elementCoverRef = ref() as Ref<HTMLElement>
|
|
32
|
+
const customBoundaries = ref({})
|
|
32
33
|
|
|
33
34
|
const getCustomBoundaries = () => {
|
|
34
|
-
if (!props.boundaries ||
|
|
35
|
+
if (!props.boundaries || elementCoverRef === null) {
|
|
35
36
|
return {}
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
+
|
|
39
|
+
const parent = elementCoverRef.value.parentElement
|
|
38
40
|
if (!parent) {
|
|
39
41
|
return {}
|
|
40
42
|
}
|
|
43
|
+
|
|
41
44
|
const parentCoords = parent.getBoundingClientRect()
|
|
42
45
|
const customBoundaries = {}
|
|
43
|
-
props.boundaries.forEach((
|
|
44
|
-
const element = parent.querySelector(
|
|
45
|
-
if (!element || !
|
|
46
|
+
props.boundaries.forEach(({ sides, query }) => {
|
|
47
|
+
const element = parent.querySelector(query)
|
|
48
|
+
if (!element || !sides) {
|
|
46
49
|
return
|
|
47
50
|
}
|
|
51
|
+
|
|
48
52
|
const coords = element.getBoundingClientRect()
|
|
49
|
-
|
|
53
|
+
sides.forEach((side) => {
|
|
50
54
|
const sideMargin = Math.abs(coords[side] - parentCoords[side])
|
|
51
55
|
customBoundaries[side] = `${sideMargin}px`
|
|
52
56
|
})
|
|
@@ -54,9 +58,22 @@ const CElementCover = defineComponent({
|
|
|
54
58
|
return customBoundaries
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
const containerCoords = {
|
|
62
|
+
top: 0,
|
|
63
|
+
left: 0,
|
|
64
|
+
right: 0,
|
|
65
|
+
bottom: 0,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const coverStyles = {
|
|
69
|
+
...containerCoords,
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
'background-color': `rgba(255,255,255,${props.opacity})`,
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
nextTick(() => {
|
|
76
|
+
customBoundaries.value = getCustomBoundaries()
|
|
60
77
|
})
|
|
61
78
|
})
|
|
62
79
|
|
|
@@ -64,28 +81,26 @@ const CElementCover = defineComponent({
|
|
|
64
81
|
h(
|
|
65
82
|
'div',
|
|
66
83
|
{
|
|
67
|
-
style: {
|
|
68
|
-
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
'background-color': `rgb(255,255,255,${props.opacity})`,
|
|
71
|
-
},
|
|
72
|
-
ref: elementRef,
|
|
84
|
+
style: { ...coverStyles, ...customBoundaries.value },
|
|
85
|
+
ref: elementCoverRef,
|
|
73
86
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
slots.default
|
|
88
|
+
? slots.default()
|
|
89
|
+
: h(
|
|
90
|
+
'div',
|
|
91
|
+
{
|
|
92
|
+
style: {
|
|
93
|
+
position: 'absolute',
|
|
94
|
+
top: '50%',
|
|
95
|
+
left: '50%',
|
|
96
|
+
transform: 'translateX(-50%) translateY(-50%)',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
h(CSpinner, {
|
|
100
|
+
variant: 'grow',
|
|
101
|
+
color: 'primary',
|
|
102
|
+
}),
|
|
103
|
+
),
|
|
89
104
|
)
|
|
90
105
|
},
|
|
91
106
|
})
|
|
@@ -41,6 +41,30 @@ const CFormControlWrapper = defineComponent({
|
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
setup(props, { slots }) {
|
|
44
|
+
const formControlValidation = () =>
|
|
45
|
+
h(
|
|
46
|
+
CFormControlValidation,
|
|
47
|
+
{
|
|
48
|
+
describedby: props.describedby,
|
|
49
|
+
feedback: props.feedback,
|
|
50
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
51
|
+
feedbackValid: props.feedbackValid,
|
|
52
|
+
floatingLabel: props.floatingLabel,
|
|
53
|
+
invalid: props.invalid,
|
|
54
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
55
|
+
valid: props.valid,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
|
|
59
|
+
...(slots.feedbackInvalid && {
|
|
60
|
+
feedbackInvalid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
61
|
+
}),
|
|
62
|
+
...(slots.feedbackValid && {
|
|
63
|
+
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
64
|
+
}),
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
|
|
44
68
|
return () =>
|
|
45
69
|
props.floatingLabel
|
|
46
70
|
? h(CFormFloating, () => [
|
|
@@ -54,6 +78,17 @@ const CFormControlWrapper = defineComponent({
|
|
|
54
78
|
default: () => (slots.label && slots.label()) || props.label || props.floatingLabel,
|
|
55
79
|
},
|
|
56
80
|
),
|
|
81
|
+
(props.text || slots.text) &&
|
|
82
|
+
h(
|
|
83
|
+
CFormText,
|
|
84
|
+
{
|
|
85
|
+
id: props.describedby,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
default: () => (slots.text && slots.text()) || props.text,
|
|
89
|
+
},
|
|
90
|
+
),
|
|
91
|
+
formControlValidation(),
|
|
57
92
|
])
|
|
58
93
|
: [
|
|
59
94
|
(props.label || slots.label) &&
|
|
@@ -77,28 +112,7 @@ const CFormControlWrapper = defineComponent({
|
|
|
77
112
|
default: () => (slots.text && slots.text()) || props.text,
|
|
78
113
|
},
|
|
79
114
|
),
|
|
80
|
-
|
|
81
|
-
CFormControlValidation,
|
|
82
|
-
{
|
|
83
|
-
describedby: props.describedby,
|
|
84
|
-
feedback: props.feedback,
|
|
85
|
-
feedbackInvalid: props.feedbackInvalid,
|
|
86
|
-
feedbackValid: props.feedbackValid,
|
|
87
|
-
floatingLabel: props.floatingLabel,
|
|
88
|
-
invalid: props.invalid,
|
|
89
|
-
tooltipFeedback: props.tooltipFeedback,
|
|
90
|
-
valid: props.valid,
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
...(slots.feedback && { feedback: () => slots.feedback && slots.feedback() }),
|
|
94
|
-
...(slots.feedbackInvalid && {
|
|
95
|
-
feedbackInvalid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
96
|
-
}),
|
|
97
|
-
...(slots.feedbackValid && {
|
|
98
|
-
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
99
|
-
}),
|
|
100
|
-
},
|
|
101
|
-
),
|
|
115
|
+
formControlValidation(),
|
|
102
116
|
]
|
|
103
117
|
},
|
|
104
118
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
2
2
|
import { CBackdrop } from '../backdrop'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { isInViewport } from './../../utils'
|
|
5
5
|
|
|
6
6
|
const isOnMobile = (element: HTMLDivElement) =>
|
|
7
7
|
Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'))
|
|
@@ -111,7 +111,7 @@ const CSidebar = defineComponent({
|
|
|
111
111
|
|
|
112
112
|
onMounted(() => {
|
|
113
113
|
mobile.value = isOnMobile(sidebarRef.value)
|
|
114
|
-
inViewport.value =
|
|
114
|
+
inViewport.value = isInViewport(sidebarRef.value)
|
|
115
115
|
|
|
116
116
|
window.addEventListener('resize', () => handleResize())
|
|
117
117
|
window.addEventListener('mouseup', handleClickOutside)
|
|
@@ -119,7 +119,7 @@ const CSidebar = defineComponent({
|
|
|
119
119
|
|
|
120
120
|
sidebarRef.value.addEventListener('mouseup', handleOnClick)
|
|
121
121
|
sidebarRef.value.addEventListener('transitionend', () => {
|
|
122
|
-
inViewport.value =
|
|
122
|
+
inViewport.value = isInViewport(sidebarRef.value)
|
|
123
123
|
})
|
|
124
124
|
})
|
|
125
125
|
|
|
@@ -130,7 +130,7 @@ const CSidebar = defineComponent({
|
|
|
130
130
|
|
|
131
131
|
sidebarRef.value.removeEventListener('mouseup', handleOnClick)
|
|
132
132
|
sidebarRef.value.removeEventListener('transitionend', () => {
|
|
133
|
-
inViewport.value =
|
|
133
|
+
inViewport.value = isInViewport(sidebarRef.value)
|
|
134
134
|
})
|
|
135
135
|
})
|
|
136
136
|
|
|
@@ -141,7 +141,7 @@ const CSidebar = defineComponent({
|
|
|
141
141
|
|
|
142
142
|
const handleResize = () => {
|
|
143
143
|
mobile.value = isOnMobile(sidebarRef.value)
|
|
144
|
-
inViewport.value =
|
|
144
|
+
inViewport.value = isInViewport(sidebarRef.value)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
const handleKeyup = (event: Event) => {
|
|
@@ -3,7 +3,7 @@ import { computed, defineComponent, h, reactive, ref, PropType, watch, onMounted
|
|
|
3
3
|
import { CElementCover } from '../element-cover/CElementCover'
|
|
4
4
|
import { CSmartPagination } from '../smart-pagination/CSmartPagination'
|
|
5
5
|
|
|
6
|
-
import { CTable } from '../table/
|
|
6
|
+
import { CTable, CTableDataCell, CTableFoot, CTableRow } from '../table/'
|
|
7
7
|
|
|
8
8
|
import { CSmartTableBody } from './CSmartTableBody'
|
|
9
9
|
import { CSmartTableHead } from './CSmartTableHead'
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
ColumnFilterValue,
|
|
22
22
|
Item,
|
|
23
23
|
ItemsPerPageSelect,
|
|
24
|
+
FooterItem,
|
|
24
25
|
Pagination,
|
|
25
26
|
Sorter,
|
|
26
27
|
SorterValue,
|
|
@@ -87,7 +88,7 @@ const CSmartTable = defineComponent({
|
|
|
87
88
|
* - _style (String/Array/Object) - adds styles to the column header (useful for defining widths)
|
|
88
89
|
*/
|
|
89
90
|
columns: {
|
|
90
|
-
type: Array as PropType<Column
|
|
91
|
+
type: Array as PropType<(Column | string)[]>,
|
|
91
92
|
required: false,
|
|
92
93
|
},
|
|
93
94
|
/**
|
|
@@ -103,10 +104,16 @@ const CSmartTable = defineComponent({
|
|
|
103
104
|
required: false,
|
|
104
105
|
},
|
|
105
106
|
/**
|
|
106
|
-
* Displays table footer, which mirrors table header. (without column filter).
|
|
107
|
+
* If `true` Displays table footer, which mirrors table header. (without column filter).
|
|
108
|
+
* Or Array of objects or strings, where each element represents one cell in the table footer.
|
|
109
|
+
*
|
|
110
|
+
* Example items:
|
|
111
|
+
* `['FooterCell', 'FooterCell', 'FooterCell']`
|
|
112
|
+
* or
|
|
113
|
+
* `[{ label: 'FooterCell', _props: { color: 'success' }, ...]`
|
|
107
114
|
*/
|
|
108
115
|
footer: {
|
|
109
|
-
type: Boolean,
|
|
116
|
+
type: [Boolean, Array] as PropType<boolean | (FooterItem | string)[]>,
|
|
110
117
|
required: false,
|
|
111
118
|
},
|
|
112
119
|
/**
|
|
@@ -755,7 +762,8 @@ const CSmartTable = defineComponent({
|
|
|
755
762
|
clickableRows: props.clickableRows,
|
|
756
763
|
...props.tableBodyProps,
|
|
757
764
|
}),
|
|
758
|
-
props.footer &&
|
|
765
|
+
typeof props.footer === 'boolean' &&
|
|
766
|
+
props.footer &&
|
|
759
767
|
h(CSmartTableHead, {
|
|
760
768
|
component: 'footer',
|
|
761
769
|
...props.tableFootProps,
|
|
@@ -766,13 +774,45 @@ const CSmartTable = defineComponent({
|
|
|
766
774
|
selectAll: selectedAll.value,
|
|
767
775
|
onSelectAllChecked: () => handleSelectAllChecked(),
|
|
768
776
|
}),
|
|
777
|
+
Array.isArray(props.footer) &&
|
|
778
|
+
h(
|
|
779
|
+
CTableFoot,
|
|
780
|
+
{
|
|
781
|
+
...props.tableFootProps,
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
default: () =>
|
|
785
|
+
h(
|
|
786
|
+
CTableRow,
|
|
787
|
+
{},
|
|
788
|
+
{
|
|
789
|
+
default: () => [
|
|
790
|
+
Array.isArray(props.footer) &&
|
|
791
|
+
props.footer.map((item: FooterItem | string) =>
|
|
792
|
+
h(
|
|
793
|
+
CTableDataCell,
|
|
794
|
+
{
|
|
795
|
+
...(typeof item === 'object' &&
|
|
796
|
+
item._props && { ...item._props }),
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
default: () =>
|
|
800
|
+
typeof item === 'object' ? item.label : item,
|
|
801
|
+
},
|
|
802
|
+
),
|
|
803
|
+
),
|
|
804
|
+
],
|
|
805
|
+
},
|
|
806
|
+
),
|
|
807
|
+
},
|
|
808
|
+
),
|
|
769
809
|
],
|
|
770
810
|
},
|
|
771
811
|
),
|
|
772
812
|
props.loading &&
|
|
773
813
|
h(CElementCover, {
|
|
774
814
|
boundaries: [
|
|
775
|
-
{ sides: ['top'], query: '
|
|
815
|
+
{ sides: ['top'], query: 'tbody' },
|
|
776
816
|
{ sides: ['bottom'], query: 'tbody' },
|
|
777
817
|
],
|
|
778
818
|
}),
|
|
@@ -25,6 +25,12 @@ export interface ColumnFilterValue {
|
|
|
25
25
|
[key: string]: number | string | any
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export type FooterItem = {
|
|
29
|
+
label?: string
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
_props?: any
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
export type Item = {
|
|
29
35
|
[key: string]: number | string | any
|
|
30
36
|
_id: number
|
|
@@ -117,7 +117,7 @@ const CTable = defineComponent({
|
|
|
117
117
|
* @since 4.5.0
|
|
118
118
|
*/
|
|
119
119
|
columns: {
|
|
120
|
-
type: Array as PropType<Column
|
|
120
|
+
type: Array as PropType<(Column | string)[]>,
|
|
121
121
|
required: false,
|
|
122
122
|
},
|
|
123
123
|
/**
|
|
@@ -137,8 +137,7 @@ const CTable = defineComponent({
|
|
|
137
137
|
* @since 4.5.0
|
|
138
138
|
*/
|
|
139
139
|
footer: {
|
|
140
|
-
type: Array as PropType<FooterItem[]>,
|
|
141
|
-
default: () => [],
|
|
140
|
+
type: Array as PropType<(FooterItem | string)[]>,
|
|
142
141
|
required: false,
|
|
143
142
|
},
|
|
144
143
|
/**
|
|
@@ -158,7 +157,6 @@ const CTable = defineComponent({
|
|
|
158
157
|
*/
|
|
159
158
|
items: {
|
|
160
159
|
type: Array as PropType<Item[]>,
|
|
161
|
-
default: () => [],
|
|
162
160
|
required: false,
|
|
163
161
|
},
|
|
164
162
|
responsive: {
|
|
@@ -228,7 +226,7 @@ const CTable = defineComponent({
|
|
|
228
226
|
if (typeof column === 'object') return column.key
|
|
229
227
|
else return column
|
|
230
228
|
})
|
|
231
|
-
: Object.keys(props.items[0] || {}).filter((el) => el.charAt(0) !== '_'),
|
|
229
|
+
: Object.keys((props.items && props.items[0]) || {}).filter((el) => el.charAt(0) !== '_'),
|
|
232
230
|
)
|
|
233
231
|
|
|
234
232
|
const table = () =>
|
|
@@ -301,34 +299,37 @@ const CTable = defineComponent({
|
|
|
301
299
|
{},
|
|
302
300
|
{
|
|
303
301
|
default: () => [
|
|
304
|
-
props.items
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
item._cellProps
|
|
320
|
-
|
|
321
|
-
item._cellProps
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
302
|
+
props.items &&
|
|
303
|
+
props.items.map((item: Item) =>
|
|
304
|
+
h(
|
|
305
|
+
CTableRow,
|
|
306
|
+
{
|
|
307
|
+
...(item._props && { ...item._props }),
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
default: () => [
|
|
311
|
+
rawColumnNames.value.map(
|
|
312
|
+
(colName: string) =>
|
|
313
|
+
item[colName] &&
|
|
314
|
+
h(
|
|
315
|
+
CTableDataCell,
|
|
316
|
+
{
|
|
317
|
+
...(item._cellProps &&
|
|
318
|
+
item._cellProps['all'] && { ...item._cellProps['all'] }),
|
|
319
|
+
...(item._cellProps &&
|
|
320
|
+
item._cellProps[colName] && {
|
|
321
|
+
...item._cellProps[colName],
|
|
322
|
+
}),
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
default: () => item[colName],
|
|
326
|
+
},
|
|
327
|
+
),
|
|
328
|
+
),
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
),
|
|
330
332
|
),
|
|
331
|
-
),
|
|
332
333
|
],
|
|
333
334
|
},
|
|
334
335
|
),
|
|
@@ -346,17 +347,19 @@ const CTable = defineComponent({
|
|
|
346
347
|
{},
|
|
347
348
|
{
|
|
348
349
|
default: () => [
|
|
349
|
-
props.footer
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
350
|
+
props.footer &&
|
|
351
|
+
props.footer.map((item: FooterItem | string) =>
|
|
352
|
+
h(
|
|
353
|
+
CTableDataCell,
|
|
354
|
+
{
|
|
355
|
+
...(typeof item === 'object' &&
|
|
356
|
+
item._props && { ...item._props }),
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
default: () => (typeof item === 'object' ? item.label : item),
|
|
360
|
+
},
|
|
361
|
+
),
|
|
358
362
|
),
|
|
359
|
-
),
|
|
360
363
|
],
|
|
361
364
|
},
|
|
362
365
|
),
|
|
@@ -319,7 +319,7 @@ const CTimePicker = defineComponent({
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
if (set === 'hours') {
|
|
322
|
-
if ((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm) {
|
|
322
|
+
if ((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm === true) {
|
|
323
323
|
_date.setHours(convert12hTo24h(ampm.value, parseInt(value)))
|
|
324
324
|
} else {
|
|
325
325
|
_date.setHours(parseInt(value))
|
|
@@ -354,7 +354,8 @@ const CTimePicker = defineComponent({
|
|
|
354
354
|
value: date.value
|
|
355
355
|
? date.value.toLocaleTimeString(props.locale, {
|
|
356
356
|
hour12:
|
|
357
|
-
(props.ampm === 'auto' && isAmPm(props.locale)) ||
|
|
357
|
+
(props.ampm === 'auto' && isAmPm(props.locale)) ||
|
|
358
|
+
(props.ampm === 'boolean' && props.ampm),
|
|
358
359
|
...(!props.seconds && { timeStyle: 'short' }),
|
|
359
360
|
})
|
|
360
361
|
: '',
|
|
@@ -447,7 +448,7 @@ const CTimePicker = defineComponent({
|
|
|
447
448
|
onClick: (index: number) => handleTimeChange('seconds', index.toString()),
|
|
448
449
|
selected: getSelectedSeconds(date.value),
|
|
449
450
|
}),
|
|
450
|
-
((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm) &&
|
|
451
|
+
((props.ampm === 'auto' && isAmPm(props.locale)) || props.ampm === true) &&
|
|
451
452
|
h(CTimePickerRollCol, {
|
|
452
453
|
elements: [
|
|
453
454
|
{ value: 'am', label: 'AM' },
|
package/src/utils/calendar.ts
CHANGED
|
@@ -164,7 +164,7 @@ export const getMonthDetails = (year: number, month: number, firstDayOfWeek: num
|
|
|
164
164
|
export const isDisableDateInRange = (
|
|
165
165
|
startDate?: Date | null,
|
|
166
166
|
endDate?: Date | null,
|
|
167
|
-
dates?: Date[] | Date[][],
|
|
167
|
+
dates?: Date[] | Date[][] | (Date | Date[])[],
|
|
168
168
|
) => {
|
|
169
169
|
if (startDate && endDate) {
|
|
170
170
|
const date = new Date(startDate)
|
|
@@ -188,7 +188,7 @@ export const isDateDisabled = (
|
|
|
188
188
|
date: Date,
|
|
189
189
|
min?: Date | null,
|
|
190
190
|
max?: Date | null,
|
|
191
|
-
dates?: Date[] | Date[][],
|
|
191
|
+
dates?: Date[] | Date[][] | (Date | Date[])[],
|
|
192
192
|
) => {
|
|
193
193
|
let disabled
|
|
194
194
|
if (dates) {
|
package/src/utils/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import getNextSibling from './getNextSibling'
|
|
2
2
|
import getPreviousSibling from './getPreviousSibling'
|
|
3
|
-
import
|
|
3
|
+
import isInViewport from './isInViewport'
|
|
4
4
|
|
|
5
|
-
export { getNextSibling, getPreviousSibling,
|
|
5
|
+
export { getNextSibling, getPreviousSibling, isInViewport }
|