@coreui/vue-pro 4.10.4 → 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/CFormInput.d.ts +6 -18
- 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 +3 -1
- package/dist/composables/useDebouncedCallback.d.ts +1 -0
- package/dist/index.es.js +1142 -2823
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1143 -2821
- 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 +140 -126
- 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 +1 -1
- package/src/components/modal/CModal.ts +15 -1
- package/src/components/multi-select/CMultiSelect.ts +68 -62
- package/src/components/multi-select/CMultiSelectOptions.ts +1 -1
- package/src/components/multi-select/CMultiSelectSelection.ts +14 -13
- 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 +7 -22
- 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-table/CSmartTable.ts +17 -12
- package/src/components/smart-table/CSmartTableBody.ts +30 -31
- package/src/components/smart-table/CSmartTableHead.ts +34 -11
- 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 +34 -63
- 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 +3 -1
- package/src/composables/useColorModes.ts +63 -0
- package/src/composables/useDebouncedCallback.ts +16 -0
- package/src/utils/getRTLPlacement.ts +1 -1
- package/src/utils/isObjectInArray.ts +1 -1
|
@@ -393,72 +393,42 @@ const CTimePicker = defineComponent({
|
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
const InputGroup = () =>
|
|
396
|
-
h(
|
|
397
|
-
'
|
|
398
|
-
|
|
399
|
-
class:
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
{
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
hour12: localizedTimePartials.value && localizedTimePartials.value.hour12,
|
|
424
|
-
...(!props.seconds && { timeStyle: 'short' }),
|
|
425
|
-
})
|
|
426
|
-
: '',
|
|
396
|
+
h('div', { class: 'time-picker-input-group' }, [
|
|
397
|
+
h('input', {
|
|
398
|
+
autocomplete: 'off',
|
|
399
|
+
class: 'time-picker-input',
|
|
400
|
+
disabled: props.disabled,
|
|
401
|
+
onInput: (event: Event) => {
|
|
402
|
+
if (isValidTime((event.target as HTMLInputElement).value)) {
|
|
403
|
+
date.value = convertTimeToDate((event.target as HTMLInputElement).value)
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
placeholder: props.placeholder,
|
|
407
|
+
readonly: props.inputReadOnly,
|
|
408
|
+
ref: inputRef,
|
|
409
|
+
required: props.required,
|
|
410
|
+
value: date.value
|
|
411
|
+
? date.value.toLocaleTimeString(props.locale, {
|
|
412
|
+
hour12: localizedTimePartials.value && localizedTimePartials.value.hour12,
|
|
413
|
+
...(!props.seconds && { timeStyle: 'short' }),
|
|
414
|
+
})
|
|
415
|
+
: '',
|
|
416
|
+
}),
|
|
417
|
+
props.indicator && h('div', { class: 'time-picker-indicator' }),
|
|
418
|
+
props.cleaner &&
|
|
419
|
+
date.value &&
|
|
420
|
+
h('div', {
|
|
421
|
+
class: 'time-picker-cleaner',
|
|
422
|
+
onClick: (event: Event) => handleClear(event),
|
|
427
423
|
}),
|
|
428
|
-
|
|
429
|
-
h('div', { class: 'input-group-text' }, [
|
|
430
|
-
props.indicator &&
|
|
431
|
-
h(
|
|
432
|
-
'span',
|
|
433
|
-
{
|
|
434
|
-
class: 'picker-input-group-indicator',
|
|
435
|
-
},
|
|
436
|
-
slots.indicator
|
|
437
|
-
? slots.indicator()
|
|
438
|
-
: h('span', { class: 'picker-input-group-icon time-picker-input-icon' }),
|
|
439
|
-
),
|
|
440
|
-
props.cleaner &&
|
|
441
|
-
h(
|
|
442
|
-
'span',
|
|
443
|
-
{
|
|
444
|
-
class: 'picker-input-group-cleaner',
|
|
445
|
-
onClick: (event: Event) => handleClear(event),
|
|
446
|
-
role: 'button',
|
|
447
|
-
},
|
|
448
|
-
slots.cleaner
|
|
449
|
-
? slots.cleaner()
|
|
450
|
-
: h('span', { class: 'picker-input-group-icon time-picker-cleaner-icon' }),
|
|
451
|
-
),
|
|
452
|
-
]),
|
|
453
|
-
],
|
|
454
|
-
)
|
|
424
|
+
])
|
|
455
425
|
|
|
456
426
|
const TimePickerSelect = () => [
|
|
457
427
|
h('span', { class: 'time-picker-inline-icon' }),
|
|
458
428
|
h(
|
|
459
429
|
'select',
|
|
460
430
|
{
|
|
461
|
-
class: '
|
|
431
|
+
class: 'time-picker-inline-select',
|
|
462
432
|
disabled: props.disabled,
|
|
463
433
|
onChange: (event: Event) =>
|
|
464
434
|
handleTimeChange('hours', (event.target as HTMLSelectElement).value),
|
|
@@ -479,7 +449,7 @@ const CTimePicker = defineComponent({
|
|
|
479
449
|
h(
|
|
480
450
|
'select',
|
|
481
451
|
{
|
|
482
|
-
class: '
|
|
452
|
+
class: 'time-picker-inline-select',
|
|
483
453
|
disabled: props.disabled,
|
|
484
454
|
onChange: (event: Event) =>
|
|
485
455
|
handleTimeChange('minutes', (event.target as HTMLSelectElement).value),
|
|
@@ -501,7 +471,7 @@ const CTimePicker = defineComponent({
|
|
|
501
471
|
h(
|
|
502
472
|
'select',
|
|
503
473
|
{
|
|
504
|
-
class: '
|
|
474
|
+
class: 'time-picker-inline-select',
|
|
505
475
|
disabled: props.disabled,
|
|
506
476
|
onChange: (event: Event) =>
|
|
507
477
|
handleTimeChange('seconds', (event.target as HTMLSelectElement).value),
|
|
@@ -523,7 +493,7 @@ const CTimePicker = defineComponent({
|
|
|
523
493
|
h(
|
|
524
494
|
'select',
|
|
525
495
|
{
|
|
526
|
-
class: '
|
|
496
|
+
class: 'time-picker-inline-select',
|
|
527
497
|
disabled: props.disabled,
|
|
528
498
|
onChange: (event: Event) =>
|
|
529
499
|
handleTimeChange('toggle', (event.target as HTMLSelectElement).value),
|
|
@@ -600,6 +570,7 @@ const CTimePicker = defineComponent({
|
|
|
600
570
|
class: [
|
|
601
571
|
'time-picker',
|
|
602
572
|
{
|
|
573
|
+
[`time-picker-${props.size}`]: props.size,
|
|
603
574
|
disabled: props.disabled,
|
|
604
575
|
'is-invalid': isValid.value === false ? true : false,
|
|
605
576
|
'is-valid': isValid.value,
|
|
@@ -645,7 +616,7 @@ const CTimePicker = defineComponent({
|
|
|
645
616
|
props.variant === 'select' ? TimePickerSelect() : TimePickerRoll(),
|
|
646
617
|
),
|
|
647
618
|
footer: () =>
|
|
648
|
-
h('div', { class: 'picker-footer' }, [
|
|
619
|
+
h('div', { class: 'time-picker-footer' }, [
|
|
649
620
|
props.cancelButton &&
|
|
650
621
|
h(
|
|
651
622
|
CButton,
|
|
@@ -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,63 @@
|
|
|
1
|
+
import { onBeforeMount, ref, watch } from 'vue'
|
|
2
|
+
|
|
3
|
+
const getStoredTheme = (localStorageItemName: string) =>
|
|
4
|
+
typeof window !== 'undefined' && localStorage.getItem(localStorageItemName)
|
|
5
|
+
|
|
6
|
+
const setStoredTheme = (localStorageItemName: string, colorMode: string) =>
|
|
7
|
+
localStorage.setItem(localStorageItemName, colorMode)
|
|
8
|
+
|
|
9
|
+
const getPreferredColorScheme = (localStorageItemName: string) => {
|
|
10
|
+
if (typeof window === 'undefined') {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const storedTheme = getStoredTheme(localStorageItemName)
|
|
15
|
+
|
|
16
|
+
if (storedTheme) {
|
|
17
|
+
return storedTheme
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const setTheme = (colorMode: string) => {
|
|
24
|
+
document.documentElement.dataset.coreuiTheme =
|
|
25
|
+
colorMode === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
26
|
+
? 'dark'
|
|
27
|
+
: colorMode
|
|
28
|
+
|
|
29
|
+
const event = new Event('ColorSchemeChange')
|
|
30
|
+
document.documentElement.dispatchEvent(event)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
|
|
34
|
+
const colorMode = ref(getPreferredColorScheme(localStorageItemName))
|
|
35
|
+
|
|
36
|
+
watch(colorMode, () => {
|
|
37
|
+
if (colorMode.value) {
|
|
38
|
+
setStoredTheme(localStorageItemName, colorMode.value)
|
|
39
|
+
setTheme(colorMode.value)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
onBeforeMount(() => {
|
|
44
|
+
if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
|
|
45
|
+
setTheme(colorMode.value)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
49
|
+
const storedTheme = getStoredTheme(localStorageItemName)
|
|
50
|
+
if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
|
|
51
|
+
setTheme(colorMode.value)
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
colorMode,
|
|
58
|
+
isColorModeSet: () => Boolean(getStoredTheme(localStorageItemName)),
|
|
59
|
+
setColorMode: (mode: string) => {
|
|
60
|
+
colorMode.value = mode
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -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
|
+
}
|