@coreui/vue-pro 5.0.0-alpha.0 → 5.0.0-alpha.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/calendar/CCalendar.d.ts +58 -32
- package/dist/components/calendar/utils.d.ts +11 -4
- package/dist/components/close-button/CCloseButton.d.ts +9 -0
- package/dist/components/date-picker/CDatePicker.d.ts +89 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -0
- package/dist/components/dropdown/CDropdown.d.ts +13 -28
- package/dist/components/dropdown/CDropdownToggle.d.ts +19 -9
- package/dist/components/dropdown/types.d.ts +15 -0
- package/dist/components/dropdown/utils.d.ts +6 -0
- package/dist/components/form/CFormCheck.d.ts +4 -4
- package/dist/components/modal/CModal.d.ts +19 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +1 -1
- package/dist/components/multi-select/types.d.ts +2 -2
- package/dist/components/multi-select/utils.d.ts +2 -2
- package/dist/components/offcanvas/COffcanvas.d.ts +9 -0
- package/dist/components/progress/CProgress.d.ts +102 -3
- package/dist/components/progress/CProgressStacked.d.ts +10 -0
- package/dist/components/progress/index.d.ts +2 -1
- package/dist/components/smart-table/CSmartTable.d.ts +0 -4
- package/dist/components/smart-table/CSmartTableBody.d.ts +12 -1
- package/dist/components/smart-table/types.d.ts +2 -2
- package/dist/components/smart-table/utils.d.ts +4 -2
- package/dist/composables/index.d.ts +2 -1
- package/dist/composables/useDebouncedCallback.d.ts +1 -0
- package/dist/index.es.js +1035 -2716
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1035 -2714
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/components/breadcrumb/CBreadcrumb.ts +1 -0
- package/src/components/button/CButton.ts +5 -5
- package/src/components/calendar/CCalendar.ts +444 -179
- package/src/components/calendar/utils.ts +93 -55
- package/src/components/carousel/CCarousel.ts +2 -5
- package/src/components/close-button/CCloseButton.ts +5 -0
- package/src/components/date-picker/CDatePicker.ts +43 -0
- package/src/components/date-range-picker/CDateRangePicker.ts +130 -83
- package/src/components/date-range-picker/utils.ts +2 -2
- package/src/components/dropdown/CDropdown.ts +23 -43
- package/src/components/dropdown/CDropdownMenu.ts +4 -19
- package/src/components/dropdown/CDropdownToggle.ts +44 -38
- package/src/components/dropdown/types.ts +11 -0
- package/src/components/dropdown/utils.ts +71 -0
- package/src/components/form/CFormCheck.ts +4 -4
- package/src/components/modal/CModal.ts +15 -1
- package/src/components/multi-select/CMultiSelect.ts +5 -8
- package/src/components/multi-select/CMultiSelectOptions.ts +1 -1
- package/src/components/multi-select/CMultiSelectSelection.ts +3 -3
- package/src/components/multi-select/types.ts +2 -2
- package/src/components/multi-select/utils.ts +5 -5
- package/src/components/navbar/CNavbar.ts +1 -1
- package/src/components/offcanvas/COffcanvas.ts +6 -0
- package/src/components/picker/CPicker.ts +1 -1
- package/src/components/progress/CProgress.ts +67 -9
- package/src/components/progress/CProgressBar.ts +4 -6
- package/src/components/progress/CProgressStacked.ts +19 -0
- package/src/components/progress/index.ts +3 -1
- package/src/components/sidebar/CSidebar.ts +1 -1
- package/src/components/smart-pagination/CSmartPagination.ts +20 -5
- package/src/components/smart-table/CSmartTable.ts +21 -12
- package/src/components/smart-table/CSmartTableBody.ts +30 -31
- package/src/components/smart-table/CSmartTableHead.ts +39 -12
- package/src/components/smart-table/types.ts +2 -2
- package/src/components/smart-table/utils.ts +41 -5
- package/src/components/time-picker/CTimePicker.ts +4 -2
- package/src/components/tooltip/CTooltip.ts +1 -1
- package/src/components/widgets/CWidgetStatsA.ts +1 -3
- package/src/components/widgets/CWidgetStatsB.ts +2 -4
- package/src/components/widgets/CWidgetStatsC.ts +2 -2
- package/src/components/widgets/CWidgetStatsD.ts +1 -1
- package/src/components/widgets/CWidgetStatsE.ts +1 -1
- package/src/components/widgets/CWidgetStatsF.ts +1 -1
- package/src/components/widgets/__tests__/__snapshots__/CWidgetStatsE.spec.ts.snap +1 -1
- package/src/composables/index.ts +2 -1
- package/src/composables/useDebouncedCallback.ts +16 -0
- package/src/utils/isObjectInArray.ts +1 -1
|
@@ -156,8 +156,6 @@ const CSmartTable = defineComponent({
|
|
|
156
156
|
},
|
|
157
157
|
/**
|
|
158
158
|
* Adds select element over table, which is used for control items per page in pagination. If you want to customize this element, pass object with optional values:
|
|
159
|
-
* - label (String) - replaces default label text
|
|
160
|
-
* - values (Array) - custom array of pagination values
|
|
161
159
|
* - external (Boolean) - disables automatic 'itemsPerPage' change (use to change pages externaly by 'pagination-change' event).
|
|
162
160
|
*/
|
|
163
161
|
itemsPerPageSelect: {
|
|
@@ -330,7 +328,6 @@ const CSmartTable = defineComponent({
|
|
|
330
328
|
}),
|
|
331
329
|
)
|
|
332
330
|
const itemsNumber = ref(props.itemsNumber)
|
|
333
|
-
// eslint-disable-next-line unicorn/explicit-length-check
|
|
334
331
|
const itemsPerPage = ref<number>(props.itemsPerPage || items.value.length)
|
|
335
332
|
const selected = ref<Item[]>([])
|
|
336
333
|
const selectedAll = ref<boolean | string>()
|
|
@@ -375,8 +372,9 @@ const CSmartTable = defineComponent({
|
|
|
375
372
|
})
|
|
376
373
|
|
|
377
374
|
if (Array.isArray(props.items)) {
|
|
378
|
-
items.value = props.items
|
|
379
|
-
|
|
375
|
+
items.value = props.items.map((item: Item, index: number) => {
|
|
376
|
+
return { ...item, _id: index }
|
|
377
|
+
})
|
|
380
378
|
itemsNumber.value = props.itemsNumber || props.items.length
|
|
381
379
|
}
|
|
382
380
|
},
|
|
@@ -458,7 +456,7 @@ const CSmartTable = defineComponent({
|
|
|
458
456
|
}
|
|
459
457
|
})
|
|
460
458
|
|
|
461
|
-
const handleSorterChange = (column: string, index: number) => {
|
|
459
|
+
const handleSorterChange = (column: string, index: number, order?: 'asc' | 'desc') => {
|
|
462
460
|
if (
|
|
463
461
|
!isSortable(
|
|
464
462
|
index,
|
|
@@ -474,8 +472,14 @@ const CSmartTable = defineComponent({
|
|
|
474
472
|
//if column changed or sort was descending change asc to true
|
|
475
473
|
const state = sorterState.value
|
|
476
474
|
|
|
475
|
+
if (order) {
|
|
476
|
+
state.state = order
|
|
477
|
+
}
|
|
478
|
+
|
|
477
479
|
if (state.column === column) {
|
|
478
|
-
if (
|
|
480
|
+
if (order) {
|
|
481
|
+
state.state = order
|
|
482
|
+
} else if (state.state === 0) {
|
|
479
483
|
state.state = 'asc'
|
|
480
484
|
} else if (state.state === 'asc') {
|
|
481
485
|
state.state = 'desc'
|
|
@@ -488,7 +492,7 @@ const CSmartTable = defineComponent({
|
|
|
488
492
|
}
|
|
489
493
|
} else {
|
|
490
494
|
state.column = column
|
|
491
|
-
state.state = 'asc'
|
|
495
|
+
state.state = order || 'asc'
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
sorterState.value.column = state.column
|
|
@@ -605,6 +609,10 @@ const CSmartTable = defineComponent({
|
|
|
605
609
|
sortItems(props.columnSorter, filteredTable.value, itemsDataColumns.value, sorterState.value),
|
|
606
610
|
)
|
|
607
611
|
|
|
612
|
+
watch(sortedItems, () => {
|
|
613
|
+
emit('filteredItemsChange', sortedItems.value)
|
|
614
|
+
})
|
|
615
|
+
|
|
608
616
|
const numberOfPages = computed(() =>
|
|
609
617
|
itemsPerPage.value ? Math.ceil(sortedItems.value.length / itemsPerPage.value) : 1,
|
|
610
618
|
)
|
|
@@ -744,8 +752,8 @@ const CSmartTable = defineComponent({
|
|
|
744
752
|
onFilterChange: (key: string, value: string) =>
|
|
745
753
|
handleColumnFilterChange(key, value, 'change'),
|
|
746
754
|
onSelectAllChecked: () => handleSelectAllChecked(),
|
|
747
|
-
onSortClick: (key: string, index: number) =>
|
|
748
|
-
handleSorterChange(key, index),
|
|
755
|
+
onSortClick: (key: string, index: number, order: 'asc' | 'desc') =>
|
|
756
|
+
handleSorterChange(key, index, order),
|
|
749
757
|
},
|
|
750
758
|
{
|
|
751
759
|
// @slot Sorter icon when items are unsorted.
|
|
@@ -768,7 +776,7 @@ const CSmartTable = defineComponent({
|
|
|
768
776
|
class: 'icon',
|
|
769
777
|
viewBox: '0 0 512 512',
|
|
770
778
|
role: 'img',
|
|
771
|
-
innerHTML:
|
|
779
|
+
innerHTML: cilArrowTop[1],
|
|
772
780
|
}),
|
|
773
781
|
// @slot Sorter icon when items are sorted descending.
|
|
774
782
|
sortingIconDescending: () =>
|
|
@@ -779,13 +787,14 @@ const CSmartTable = defineComponent({
|
|
|
779
787
|
class: 'icon',
|
|
780
788
|
viewBox: '0 0 512 512',
|
|
781
789
|
role: 'img',
|
|
782
|
-
innerHTML:
|
|
790
|
+
innerHTML: cilArrowBottom[1],
|
|
783
791
|
}),
|
|
784
792
|
},
|
|
785
793
|
),
|
|
786
794
|
h(CSmartTableBody, {
|
|
787
795
|
clickableRows: props.clickableRows,
|
|
788
796
|
columnNames: columnNames.value,
|
|
797
|
+
columns: props.columns ?? columnNames.value,
|
|
789
798
|
currentItems: currentItems.value,
|
|
790
799
|
firstItemOnActivePageIndex: firstItemOnActivePageIndex.value,
|
|
791
800
|
noItemsLabel: props.noItemsLabel,
|
|
@@ -5,8 +5,13 @@ import { CTableBody, CTableDataCell, CTableRow } from '../table/'
|
|
|
5
5
|
|
|
6
6
|
import { isObjectInArray } from '../../utils'
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
getClickedColumnName,
|
|
10
|
+
getColumnName,
|
|
11
|
+
getTableDataCellProps,
|
|
12
|
+
getTableDataCellStyles,
|
|
13
|
+
} from './utils'
|
|
14
|
+
import type { Column, Item } from './types'
|
|
10
15
|
|
|
11
16
|
const CSmartTableBody = defineComponent({
|
|
12
17
|
name: 'CSmartTableBody',
|
|
@@ -17,6 +22,11 @@ const CSmartTableBody = defineComponent({
|
|
|
17
22
|
default: () => [],
|
|
18
23
|
require: true,
|
|
19
24
|
},
|
|
25
|
+
columns: {
|
|
26
|
+
type: Array as PropType<(Column | string)[]>,
|
|
27
|
+
default: () => [],
|
|
28
|
+
require: true,
|
|
29
|
+
},
|
|
20
30
|
currentItems: {
|
|
21
31
|
type: Array as PropType<Item[]>,
|
|
22
32
|
default: () => [],
|
|
@@ -33,9 +43,7 @@ const CSmartTableBody = defineComponent({
|
|
|
33
43
|
},
|
|
34
44
|
emits: ['rowChecked', 'rowClick'],
|
|
35
45
|
setup(props, { emit }) {
|
|
36
|
-
const colspan: number = props.selectable
|
|
37
|
-
? props.columnNames.length + 1
|
|
38
|
-
: props.columnNames.length
|
|
46
|
+
const colspan: number = props.selectable ? props.columns.length + 1 : props.columns.length
|
|
39
47
|
return () =>
|
|
40
48
|
h(
|
|
41
49
|
CTableBody,
|
|
@@ -59,6 +67,7 @@ const CSmartTableBody = defineComponent({
|
|
|
59
67
|
getClickedColumnName(
|
|
60
68
|
event.target as HTMLTextAreaElement,
|
|
61
69
|
props.columnNames,
|
|
70
|
+
props.selectable,
|
|
62
71
|
),
|
|
63
72
|
event,
|
|
64
73
|
)
|
|
@@ -81,22 +90,24 @@ const CSmartTableBody = defineComponent({
|
|
|
81
90
|
},
|
|
82
91
|
}),
|
|
83
92
|
),
|
|
84
|
-
props.
|
|
85
|
-
|
|
86
|
-
props.scopedSlots
|
|
87
|
-
|
|
93
|
+
props.columns.map((column) => {
|
|
94
|
+
const colName = getColumnName(column)
|
|
95
|
+
return props.scopedSlots &&
|
|
96
|
+
props.scopedSlots[colName] &&
|
|
97
|
+
typeof props.scopedSlots[colName] === 'function'
|
|
88
98
|
? h(props.scopedSlots[colName], { item: item })
|
|
89
99
|
: typeof item[colName] !== 'undefined' &&
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
h(
|
|
101
|
+
CTableDataCell,
|
|
102
|
+
{
|
|
103
|
+
...getTableDataCellProps(column, item, colName),
|
|
104
|
+
style: getTableDataCellStyles(column, item, colName),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
default: () => String(item[colName]),
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
}),
|
|
100
111
|
],
|
|
101
112
|
},
|
|
102
113
|
),
|
|
@@ -115,18 +126,6 @@ const CSmartTableBody = defineComponent({
|
|
|
115
126
|
{
|
|
116
127
|
class: 'p-0',
|
|
117
128
|
key: `details${trIndex}`,
|
|
118
|
-
onClick: (event: MouseEvent) => {
|
|
119
|
-
emit(
|
|
120
|
-
'rowClick',
|
|
121
|
-
item,
|
|
122
|
-
trIndex + props.firstItemOnActivePageIndex,
|
|
123
|
-
getClickedColumnName(
|
|
124
|
-
event.target as HTMLTextAreaElement,
|
|
125
|
-
props.columnNames,
|
|
126
|
-
),
|
|
127
|
-
true,
|
|
128
|
-
)
|
|
129
|
-
},
|
|
130
129
|
},
|
|
131
130
|
{
|
|
132
131
|
default: () =>
|
|
@@ -115,15 +115,38 @@ const CSmartTableHead = defineComponent({
|
|
|
115
115
|
},
|
|
116
116
|
}),
|
|
117
117
|
),
|
|
118
|
-
columns.value.map((column, index: number) =>
|
|
119
|
-
|
|
118
|
+
columns.value.map((column, index: number) => {
|
|
119
|
+
const isSortable =
|
|
120
|
+
props.columnSorter &&
|
|
121
|
+
(typeof column === 'object'
|
|
122
|
+
? column.sorter === undefined
|
|
123
|
+
? true
|
|
124
|
+
: column.sorter
|
|
125
|
+
: true)
|
|
126
|
+
return h(
|
|
120
127
|
CTableHeaderCell,
|
|
121
128
|
{
|
|
122
129
|
...getTableHeaderCellProps(column),
|
|
123
|
-
onClick: () => {
|
|
124
|
-
emit('sortClick', getColumnKey(column), index)
|
|
125
|
-
},
|
|
126
130
|
style: getTableHeaderCellStyles(column, props.columnSorter),
|
|
131
|
+
...isSortable && {
|
|
132
|
+
tabindex: 0,
|
|
133
|
+
onClick: () => emit('sortClick', getColumnKey(column), index),
|
|
134
|
+
onKeydown: (event: KeyboardEvent) => {
|
|
135
|
+
if (event.key === 'Enter') {
|
|
136
|
+
emit('sortClick', getColumnKey(column), index)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (event.key === 'ArrowUp') {
|
|
140
|
+
event.preventDefault()
|
|
141
|
+
emit('sortClick', getColumnKey(column), index, 'asc')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (event.key === 'ArrowDown') {
|
|
145
|
+
event.preventDefault()
|
|
146
|
+
emit('sortClick', getColumnKey(column), index, 'desc')
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
}
|
|
127
150
|
},
|
|
128
151
|
{
|
|
129
152
|
default: () => [
|
|
@@ -143,8 +166,8 @@ const CSmartTableHead = defineComponent({
|
|
|
143
166
|
columnSorterIcon(column),
|
|
144
167
|
],
|
|
145
168
|
},
|
|
146
|
-
)
|
|
147
|
-
),
|
|
169
|
+
)
|
|
170
|
+
}),
|
|
148
171
|
],
|
|
149
172
|
},
|
|
150
173
|
),
|
|
@@ -155,8 +178,8 @@ const CSmartTableHead = defineComponent({
|
|
|
155
178
|
{
|
|
156
179
|
default: () => [
|
|
157
180
|
props.selectable && h(CTableHeaderCell),
|
|
158
|
-
columns.value.map((column: Column | string) =>
|
|
159
|
-
h(
|
|
181
|
+
columns.value.map((column: Column | string) => {
|
|
182
|
+
return h(
|
|
160
183
|
CTableHeaderCell,
|
|
161
184
|
{
|
|
162
185
|
...getTableHeaderCellProps(column),
|
|
@@ -187,7 +210,11 @@ const CSmartTableHead = defineComponent({
|
|
|
187
210
|
)
|
|
188
211
|
},
|
|
189
212
|
onChange: (event: Event) => {
|
|
190
|
-
emit(
|
|
213
|
+
emit(
|
|
214
|
+
'filterChange',
|
|
215
|
+
getColumnKey(column),
|
|
216
|
+
(event.target as HTMLInputElement).value,
|
|
217
|
+
)
|
|
191
218
|
},
|
|
192
219
|
'aria-label': `column name: '${getColumnLabel(
|
|
193
220
|
column,
|
|
@@ -199,8 +226,8 @@ const CSmartTableHead = defineComponent({
|
|
|
199
226
|
})
|
|
200
227
|
: '',
|
|
201
228
|
},
|
|
202
|
-
)
|
|
203
|
-
),
|
|
229
|
+
)
|
|
230
|
+
}),
|
|
204
231
|
],
|
|
205
232
|
},
|
|
206
233
|
),
|
|
@@ -9,6 +9,8 @@ export type Column = {
|
|
|
9
9
|
sorter?: boolean
|
|
10
10
|
_style?: any
|
|
11
11
|
_props?: any
|
|
12
|
+
_colStyle?: any
|
|
13
|
+
_colProps?: any
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export type ColumnFilter = {
|
|
@@ -45,8 +47,6 @@ export type Item = {
|
|
|
45
47
|
|
|
46
48
|
export type ItemsPerPageSelect = {
|
|
47
49
|
external?: boolean
|
|
48
|
-
label?: string
|
|
49
|
-
values?: Array<number>
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export type Pagination = {
|
|
@@ -61,11 +61,12 @@ export const filterTable = (
|
|
|
61
61
|
export const getClickedColumnName = (
|
|
62
62
|
target: HTMLTextAreaElement,
|
|
63
63
|
columnNames: string[],
|
|
64
|
+
selectable: boolean | undefined
|
|
64
65
|
): string => {
|
|
65
66
|
const closest = target.closest('tr')
|
|
66
67
|
const children = closest ? Array.from(closest.children) : []
|
|
67
68
|
const clickedCell = children.filter((child) => child.contains(target))[0]
|
|
68
|
-
return columnNames[children.indexOf(clickedCell)]
|
|
69
|
+
return selectable ? columnNames[children.indexOf(clickedCell) - 1] : columnNames[children.indexOf(clickedCell)]
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
export const getColumnKey = (column: Column | string) =>
|
|
@@ -78,6 +79,14 @@ export const getColumnLabel = (column: Column | string) =>
|
|
|
78
79
|
: pretifyName(column.key)
|
|
79
80
|
: pretifyName(column)
|
|
80
81
|
|
|
82
|
+
export const getColumnName = (column: string | Column) => {
|
|
83
|
+
if (typeof column === 'object') {
|
|
84
|
+
return column.key
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return column
|
|
88
|
+
}
|
|
89
|
+
|
|
81
90
|
export const getColumnNames = (
|
|
82
91
|
columns: (string | Column)[] | undefined,
|
|
83
92
|
items: Item[],
|
|
@@ -217,15 +226,42 @@ export const getColumnValues = (items: Item[], key: string) => {
|
|
|
217
226
|
return items.map((item) => item[key])
|
|
218
227
|
}
|
|
219
228
|
|
|
220
|
-
export const getTableDataCellProps = (item: Item, colName: string) => {
|
|
221
|
-
const props =
|
|
222
|
-
|
|
223
|
-
|
|
229
|
+
export const getTableDataCellProps = (column: Column | string, item: Item, colName: string) => {
|
|
230
|
+
const props = {}
|
|
231
|
+
|
|
232
|
+
if (typeof column === 'object' && column._colProps) {
|
|
233
|
+
Object.assign(props, column._colProps)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (item._cellProps && item._cellProps['all']) {
|
|
237
|
+
Object.assign(props, item._cellProps['all'])
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (item._cellProps && item._cellProps[colName]) {
|
|
241
|
+
Object.assign(props, item._cellProps[colName])
|
|
224
242
|
}
|
|
225
243
|
|
|
226
244
|
return props
|
|
227
245
|
}
|
|
228
246
|
|
|
247
|
+
export const getTableDataCellStyles = (column: Column | string, item: Item, colName: string) => {
|
|
248
|
+
const styles = {}
|
|
249
|
+
|
|
250
|
+
if (typeof column === 'object' && column._colStyle) {
|
|
251
|
+
Object.assign(styles, column._colStyle)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (item._cellStyle && item._cellStyle['all']) {
|
|
255
|
+
Object.assign(styles, item._cellStyle['all'])
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (item._cellStyle && item._cellStyle[colName]) {
|
|
259
|
+
Object.assign(styles, item._cellStyle[colName])
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return styles
|
|
263
|
+
}
|
|
264
|
+
|
|
229
265
|
export const getTableHeaderCellProps = (column: Column | string) => {
|
|
230
266
|
if (typeof column === 'object' && column._props) {
|
|
231
267
|
return column._props
|
|
@@ -293,7 +293,9 @@ const CTimePicker = defineComponent({
|
|
|
293
293
|
listOfSeconds: [],
|
|
294
294
|
hour12: false,
|
|
295
295
|
})
|
|
296
|
-
const isValid = ref
|
|
296
|
+
const isValid = ref<boolean | undefined>(
|
|
297
|
+
props.valid ?? (props.invalid === true ? false : undefined),
|
|
298
|
+
)
|
|
297
299
|
|
|
298
300
|
watch(
|
|
299
301
|
() => props.time,
|
|
@@ -305,7 +307,7 @@ const CTimePicker = defineComponent({
|
|
|
305
307
|
watch(
|
|
306
308
|
() => [props.valid, props.invalid],
|
|
307
309
|
() => {
|
|
308
|
-
isValid.value = props.valid
|
|
310
|
+
isValid.value = props.valid ?? (props.invalid === true ? false : undefined)
|
|
309
311
|
},
|
|
310
312
|
)
|
|
311
313
|
|
|
@@ -104,7 +104,7 @@ const CTooltip = defineComponent({
|
|
|
104
104
|
const tooltipRef = ref()
|
|
105
105
|
const visible = ref(props.visible)
|
|
106
106
|
const { initPopper, destroyPopper } = usePopper()
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
const delay =
|
|
109
109
|
typeof props.delay === 'number' ? { show: props.delay, hide: props.delay } : props.delay
|
|
110
110
|
|
|
@@ -33,9 +33,7 @@ const CWidgetStatsA = defineComponent({
|
|
|
33
33
|
h(
|
|
34
34
|
CCard,
|
|
35
35
|
{
|
|
36
|
-
class: [
|
|
37
|
-
{ [`bg-${props.color}`]: props.color, 'text-high-emphasis-inverse': props.color },
|
|
38
|
-
],
|
|
36
|
+
class: [{ [`bg-${props.color}`]: props.color, 'text-white': props.color }],
|
|
39
37
|
},
|
|
40
38
|
() => [
|
|
41
39
|
h(
|
|
@@ -57,7 +57,7 @@ const CWidgetStatsB = defineComponent({
|
|
|
57
57
|
{
|
|
58
58
|
class: [
|
|
59
59
|
{
|
|
60
|
-
'text-
|
|
60
|
+
'text-white': props.inverse,
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
63
|
color: props.color,
|
|
@@ -98,9 +98,7 @@ const CWidgetStatsB = defineComponent({
|
|
|
98
98
|
h(
|
|
99
99
|
'small',
|
|
100
100
|
{
|
|
101
|
-
class: [
|
|
102
|
-
props.inverse ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis',
|
|
103
|
-
],
|
|
101
|
+
class: [props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary'],
|
|
104
102
|
},
|
|
105
103
|
{
|
|
106
104
|
default: () => (slots.text && slots.text()) || props.text,
|
|
@@ -75,7 +75,7 @@ const CWidgetStatsC = defineComponent({
|
|
|
75
75
|
{
|
|
76
76
|
class: [
|
|
77
77
|
'text-end mb-4',
|
|
78
|
-
props.inverse ? 'text-
|
|
78
|
+
props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
|
|
79
79
|
],
|
|
80
80
|
},
|
|
81
81
|
slots.icon && slots.icon(),
|
|
@@ -96,7 +96,7 @@ const CWidgetStatsC = defineComponent({
|
|
|
96
96
|
{
|
|
97
97
|
class: [
|
|
98
98
|
'text-uppercase fw-semibold small',
|
|
99
|
-
props.inverse ? 'text-
|
|
99
|
+
props.inverse ? 'text-white text-opacity-75' : 'text-body-secondary',
|
|
100
100
|
],
|
|
101
101
|
},
|
|
102
102
|
{
|
|
@@ -74,7 +74,7 @@ const CWidgetStatsD = defineComponent({
|
|
|
74
74
|
h(CCol, { class: 'fs-5 fw-semibold' }, () => value.value),
|
|
75
75
|
h(
|
|
76
76
|
CCol,
|
|
77
|
-
{ class: 'text-uppercase text-
|
|
77
|
+
{ class: 'text-uppercase text-body-secondary small' },
|
|
78
78
|
() => value.title,
|
|
79
79
|
),
|
|
80
80
|
],
|
|
@@ -35,7 +35,7 @@ const CWidgetStatsE = defineComponent({
|
|
|
35
35
|
h(
|
|
36
36
|
'div',
|
|
37
37
|
{
|
|
38
|
-
class: 'text-
|
|
38
|
+
class: 'text-body-secondary small text-uppercase font-weight-bold',
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
default: () => (slots.title && slots.title()) || props.title,
|
|
@@ -81,7 +81,7 @@ const CWidgetStatsF = defineComponent({
|
|
|
81
81
|
h(
|
|
82
82
|
'div',
|
|
83
83
|
{
|
|
84
|
-
class: 'text-
|
|
84
|
+
class: 'text-body-secondary text-uppercase fw-semibold small',
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
default: () => (slots.title && slots.title()) || props.title,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports[`Loads and display CWidgetStatsE component renders correctly 1`] = `
|
|
4
4
|
"<div class="card">
|
|
5
5
|
<div class="card-body text-center">
|
|
6
|
-
<div class="text-
|
|
6
|
+
<div class="text-body-secondary small text-uppercase font-weight-bold">title</div>
|
|
7
7
|
<div class="h2 py-3">value</div>chartdefault
|
|
8
8
|
</div>
|
|
9
9
|
</div>"
|
package/src/composables/index.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export const useDebouncedCallback = <F extends Function>(callback: F, delay: number) => {
|
|
4
|
+
const timeout = ref<ReturnType<typeof setTimeout>>()
|
|
5
|
+
const debouncedFn = (...args: any[]) => {
|
|
6
|
+
const handler = () => {
|
|
7
|
+
clearTimeout(timeout.value)
|
|
8
|
+
callback(...args)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
clearTimeout(timeout.value)
|
|
12
|
+
timeout.value = setTimeout(handler, delay)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return debouncedFn()
|
|
16
|
+
}
|