@coreui/vue-pro 5.8.1 → 5.10.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/cjs/components/accordion/CAccordionBody.js +2 -1
- package/dist/cjs/components/accordion/CAccordionBody.js.map +1 -1
- package/dist/cjs/components/accordion/CAccordionButton.js +3 -1
- package/dist/cjs/components/accordion/CAccordionButton.js.map +1 -1
- package/dist/cjs/components/accordion/CAccordionItem.d.ts +8 -0
- package/dist/cjs/components/accordion/CAccordionItem.js +10 -2
- package/dist/cjs/components/accordion/CAccordionItem.js.map +1 -1
- package/dist/cjs/components/calendar/CCalendar.d.ts +8 -7
- package/dist/cjs/components/calendar/CCalendar.js +41 -37
- package/dist/cjs/components/calendar/CCalendar.js.map +1 -1
- package/dist/cjs/components/calendar/types.d.ts +3 -0
- package/dist/cjs/components/calendar/utils.d.ts +176 -18
- package/dist/cjs/components/calendar/utils.js +327 -51
- package/dist/cjs/components/calendar/utils.js.map +1 -1
- package/dist/cjs/components/date-picker/CDatePicker.d.ts +3 -6
- package/dist/cjs/components/date-picker/CDatePicker.js +1 -3
- package/dist/cjs/components/date-picker/CDatePicker.js.map +1 -1
- package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +3 -2
- package/dist/cjs/components/date-range-picker/CDateRangePicker.js +1 -1
- package/dist/cjs/components/date-range-picker/CDateRangePicker.js.map +1 -1
- package/dist/cjs/components/multi-select/CMultiSelect.js +5 -1
- package/dist/cjs/components/multi-select/CMultiSelect.js.map +1 -1
- package/dist/cjs/components/nav/CNavGroup.js +6 -2
- package/dist/cjs/components/nav/CNavGroup.js.map +1 -1
- package/dist/cjs/components/range-slider/CRangeSlider.js +6 -2
- package/dist/cjs/components/range-slider/CRangeSlider.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +2 -1
- package/dist/cjs/utils/isEqual.d.ts +2 -0
- package/dist/cjs/utils/isEqual.js +78 -0
- package/dist/cjs/utils/isEqual.js.map +1 -0
- package/dist/esm/components/accordion/CAccordionBody.js +2 -1
- package/dist/esm/components/accordion/CAccordionBody.js.map +1 -1
- package/dist/esm/components/accordion/CAccordionButton.js +3 -1
- package/dist/esm/components/accordion/CAccordionButton.js.map +1 -1
- package/dist/esm/components/accordion/CAccordionItem.d.ts +8 -0
- package/dist/esm/components/accordion/CAccordionItem.js +11 -3
- package/dist/esm/components/accordion/CAccordionItem.js.map +1 -1
- package/dist/esm/components/calendar/CCalendar.d.ts +8 -7
- package/dist/esm/components/calendar/CCalendar.js +43 -39
- package/dist/esm/components/calendar/CCalendar.js.map +1 -1
- package/dist/esm/components/calendar/types.d.ts +3 -0
- package/dist/esm/components/calendar/utils.d.ts +176 -18
- package/dist/esm/components/calendar/utils.js +321 -52
- package/dist/esm/components/calendar/utils.js.map +1 -1
- package/dist/esm/components/date-picker/CDatePicker.d.ts +3 -6
- package/dist/esm/components/date-picker/CDatePicker.js +1 -3
- package/dist/esm/components/date-picker/CDatePicker.js.map +1 -1
- package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +3 -2
- package/dist/esm/components/date-range-picker/CDateRangePicker.js +1 -1
- package/dist/esm/components/date-range-picker/CDateRangePicker.js.map +1 -1
- package/dist/esm/components/multi-select/CMultiSelect.js +5 -1
- package/dist/esm/components/multi-select/CMultiSelect.js.map +1 -1
- package/dist/esm/components/nav/CNavGroup.js +6 -2
- package/dist/esm/components/nav/CNavGroup.js.map +1 -1
- package/dist/esm/components/range-slider/CRangeSlider.js +6 -2
- package/dist/esm/components/range-slider/CRangeSlider.js.map +1 -1
- package/dist/esm/utils/index.d.ts +2 -1
- package/dist/esm/utils/isEqual.d.ts +2 -0
- package/dist/esm/utils/isEqual.js +74 -0
- package/dist/esm/utils/isEqual.js.map +1 -0
- package/package.json +8 -8
- package/src/components/accordion/CAccordionBody.ts +2 -1
- package/src/components/accordion/CAccordionButton.ts +3 -1
- package/src/components/accordion/CAccordionItem.ts +11 -3
- package/src/components/calendar/CCalendar.ts +64 -52
- package/src/components/calendar/types.ts +5 -0
- package/src/components/calendar/utils.ts +428 -110
- package/src/components/date-picker/CDatePicker.ts +2 -3
- package/src/components/date-range-picker/CDateRangePicker.ts +3 -1
- package/src/components/multi-select/CMultiSelect.ts +10 -2
- package/src/components/nav/CNavGroup.ts +7 -2
- package/src/components/range-slider/CRangeSlider.ts +7 -2
- package/src/utils/index.ts +10 -1
- package/src/utils/isEqual.ts +75 -0
|
@@ -12,6 +12,8 @@ import { getInputIdOrName, getLocalDateFromString } from './utils'
|
|
|
12
12
|
import { useDebouncedCallback } from '../../composables'
|
|
13
13
|
import { Color } from '../props'
|
|
14
14
|
|
|
15
|
+
import type { DisabledDate } from '../calendar/types'
|
|
16
|
+
|
|
15
17
|
const CDateRangePicker = defineComponent({
|
|
16
18
|
name: 'CDateRangePicker',
|
|
17
19
|
props: {
|
|
@@ -187,7 +189,7 @@ const CDateRangePicker = defineComponent({
|
|
|
187
189
|
/**
|
|
188
190
|
* Specify the list of dates that cannot be selected.
|
|
189
191
|
*/
|
|
190
|
-
disabledDates: Array as PropType<
|
|
192
|
+
disabledDates: [Array, Date, Function] as PropType<DisabledDate | DisabledDate[]>,
|
|
191
193
|
/**
|
|
192
194
|
* Initial selected to date (range).
|
|
193
195
|
*/
|
|
@@ -8,7 +8,7 @@ import { CMultiSelectOptions } from './CMultiSelectOptions'
|
|
|
8
8
|
import { CMultiSelectSelection } from './CMultiSelectSelection'
|
|
9
9
|
|
|
10
10
|
import { useDropdownWithPopper } from '../../composables'
|
|
11
|
-
import { getNextActiveElement } from '../../utils'
|
|
11
|
+
import { getNextActiveElement, isEqual } from '../../utils'
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
createOption,
|
|
@@ -401,7 +401,15 @@ const CMultiSelect = defineComponent({
|
|
|
401
401
|
) as Option[]
|
|
402
402
|
|
|
403
403
|
if (_selected.length > 0) {
|
|
404
|
-
|
|
404
|
+
const newSelectedValue = selectOptions(
|
|
405
|
+
props.multiple,
|
|
406
|
+
_selected,
|
|
407
|
+
selected.value,
|
|
408
|
+
deselected,
|
|
409
|
+
)
|
|
410
|
+
if (!isEqual(newSelectedValue, selected.value)) {
|
|
411
|
+
selected.value = newSelectedValue
|
|
412
|
+
}
|
|
405
413
|
}
|
|
406
414
|
},
|
|
407
415
|
{ immediate: true },
|
|
@@ -41,7 +41,10 @@ const CNavGroup = defineComponent({
|
|
|
41
41
|
|
|
42
42
|
onMounted(() => {
|
|
43
43
|
visible.value = props.visible
|
|
44
|
-
props.visible
|
|
44
|
+
if (props.visible) {
|
|
45
|
+
navGroupRef.value.classList.add('show')
|
|
46
|
+
}
|
|
47
|
+
|
|
45
48
|
emit('visible-change', visible.value)
|
|
46
49
|
})
|
|
47
50
|
|
|
@@ -60,7 +63,8 @@ const CNavGroup = defineComponent({
|
|
|
60
63
|
emit('visible-change', visible.value)
|
|
61
64
|
})
|
|
62
65
|
|
|
63
|
-
const handleTogglerClick = () => {
|
|
66
|
+
const handleTogglerClick = (event: Event) => {
|
|
67
|
+
event.preventDefault()
|
|
64
68
|
visible.value = !visible.value
|
|
65
69
|
emit('visible-change', visible.value)
|
|
66
70
|
}
|
|
@@ -111,6 +115,7 @@ const CNavGroup = defineComponent({
|
|
|
111
115
|
'a',
|
|
112
116
|
{
|
|
113
117
|
class: ['nav-link', 'nav-group-toggle'],
|
|
118
|
+
href: '#',
|
|
114
119
|
onClick: handleTogglerClick,
|
|
115
120
|
},
|
|
116
121
|
slots.togglerContent && slots.togglerContent(),
|
|
@@ -240,7 +240,12 @@ const CRangeSlider = defineComponent({
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
const handleInputsContainerMouseDown = (event: MouseEvent) => {
|
|
243
|
-
if (!trackRef.value || event.button !== 0) return
|
|
243
|
+
if (!trackRef.value || event.button !== 0 || props.disabled) return
|
|
244
|
+
|
|
245
|
+
const target = event.target as HTMLDivElement | HTMLInputElement
|
|
246
|
+
if (!(target instanceof HTMLInputElement) && target !== trackRef.value) {
|
|
247
|
+
return
|
|
248
|
+
}
|
|
244
249
|
|
|
245
250
|
const clickValue = calculateClickValue(
|
|
246
251
|
event,
|
|
@@ -266,7 +271,7 @@ const CRangeSlider = defineComponent({
|
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
const handleMouseMove = (event: MouseEvent) => {
|
|
269
|
-
if (!isDragging.value || !trackRef.value) return
|
|
274
|
+
if (!isDragging.value || !trackRef.value || props.disabled) return
|
|
270
275
|
|
|
271
276
|
const moveValue = calculateMoveValue(
|
|
272
277
|
event,
|
package/src/utils/index.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import getNextActiveElement from './getNextActiveElement'
|
|
2
2
|
import getRTLPlacement from './getRTLPlacement'
|
|
3
3
|
import getUID from './getUID'
|
|
4
|
+
import isEqual from './isEqual'
|
|
4
5
|
import isInViewport from './isInViewport'
|
|
5
6
|
import isObjectInArray from './isObjectInArray'
|
|
6
7
|
import isRTL from './isRTL'
|
|
7
8
|
|
|
8
|
-
export {
|
|
9
|
+
export {
|
|
10
|
+
getNextActiveElement,
|
|
11
|
+
getRTLPlacement,
|
|
12
|
+
getUID,
|
|
13
|
+
isEqual,
|
|
14
|
+
isInViewport,
|
|
15
|
+
isObjectInArray,
|
|
16
|
+
isRTL,
|
|
17
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const isEqual = (a: unknown, b: unknown): boolean => {
|
|
2
|
+
if (a === b) return true
|
|
3
|
+
|
|
4
|
+
// Handle cases where either a or b is null or not an object
|
|
5
|
+
if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') {
|
|
6
|
+
// Handle NaN case
|
|
7
|
+
return a !== a && b !== b
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Different constructors mean objects are not equal
|
|
11
|
+
if (a.constructor !== b.constructor) return false
|
|
12
|
+
|
|
13
|
+
// Handle Arrays
|
|
14
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
15
|
+
if (a.length !== b.length) return false
|
|
16
|
+
for (const [i, element] of a.entries()) {
|
|
17
|
+
const element2 = typeof b[i] === 'object' ? { ...b[i] } : b[i]
|
|
18
|
+
if (!isEqual(element, element2)) return false
|
|
19
|
+
}
|
|
20
|
+
return true
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Handle Maps
|
|
24
|
+
if (a instanceof Map && b instanceof Map) {
|
|
25
|
+
if (a.size !== b.size) return false
|
|
26
|
+
for (const [key, value] of a) {
|
|
27
|
+
if (!b.has(key) || !isEqual(value, b.get(key))) return false
|
|
28
|
+
}
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Handle Sets
|
|
33
|
+
if (a instanceof Set && b instanceof Set) {
|
|
34
|
+
if (a.size !== b.size) return false
|
|
35
|
+
for (const value of a) {
|
|
36
|
+
if (!b.has(value)) return false
|
|
37
|
+
}
|
|
38
|
+
return true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Handle RegExp
|
|
42
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
|
43
|
+
return a.source === b.source && a.flags === b.flags
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Handle objects with custom valueOf or toString
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
if (a.valueOf !== Object.prototype.valueOf && a.valueOf() !== (b as any).valueOf()) return false
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
if (a.toString !== Object.prototype.toString && a.toString() !== (b as any).toString())
|
|
52
|
+
return false
|
|
53
|
+
|
|
54
|
+
// Compare object keys
|
|
55
|
+
const aKeys = Object.keys(a)
|
|
56
|
+
const bKeys = Object.keys(b)
|
|
57
|
+
|
|
58
|
+
if (aKeys.length !== bKeys.length) return false
|
|
59
|
+
|
|
60
|
+
// Ensure all keys in a are present in b
|
|
61
|
+
for (const key of aKeys) {
|
|
62
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Deep compare each property
|
|
66
|
+
for (const key of aKeys) {
|
|
67
|
+
if (!isEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])) {
|
|
68
|
+
return false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default isEqual
|