@coreui/vue-pro 5.9.0 → 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.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/accordion/CAccordionBody.js +2 -1
  3. package/dist/cjs/components/accordion/CAccordionBody.js.map +1 -1
  4. package/dist/cjs/components/accordion/CAccordionButton.js +3 -1
  5. package/dist/cjs/components/accordion/CAccordionButton.js.map +1 -1
  6. package/dist/cjs/components/accordion/CAccordionItem.d.ts +8 -0
  7. package/dist/cjs/components/accordion/CAccordionItem.js +10 -2
  8. package/dist/cjs/components/accordion/CAccordionItem.js.map +1 -1
  9. package/dist/cjs/components/calendar/CCalendar.d.ts +6 -6
  10. package/dist/cjs/components/calendar/CCalendar.js +40 -36
  11. package/dist/cjs/components/calendar/CCalendar.js.map +1 -1
  12. package/dist/cjs/components/calendar/types.d.ts +3 -0
  13. package/dist/cjs/components/calendar/utils.d.ts +175 -18
  14. package/dist/cjs/components/calendar/utils.js +311 -43
  15. package/dist/cjs/components/calendar/utils.js.map +1 -1
  16. package/dist/cjs/components/date-picker/CDatePicker.d.ts +1 -1
  17. package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +1 -1
  18. package/dist/cjs/components/multi-select/CMultiSelect.js +5 -1
  19. package/dist/cjs/components/multi-select/CMultiSelect.js.map +1 -1
  20. package/dist/cjs/components/nav/CNavGroup.js +6 -2
  21. package/dist/cjs/components/nav/CNavGroup.js.map +1 -1
  22. package/dist/cjs/components/range-slider/CRangeSlider.js +6 -2
  23. package/dist/cjs/components/range-slider/CRangeSlider.js.map +1 -1
  24. package/dist/cjs/utils/index.d.ts +2 -1
  25. package/dist/cjs/utils/isEqual.d.ts +2 -0
  26. package/dist/cjs/utils/isEqual.js +78 -0
  27. package/dist/cjs/utils/isEqual.js.map +1 -0
  28. package/dist/esm/components/accordion/CAccordionBody.js +2 -1
  29. package/dist/esm/components/accordion/CAccordionBody.js.map +1 -1
  30. package/dist/esm/components/accordion/CAccordionButton.js +3 -1
  31. package/dist/esm/components/accordion/CAccordionButton.js.map +1 -1
  32. package/dist/esm/components/accordion/CAccordionItem.d.ts +8 -0
  33. package/dist/esm/components/accordion/CAccordionItem.js +11 -3
  34. package/dist/esm/components/accordion/CAccordionItem.js.map +1 -1
  35. package/dist/esm/components/calendar/CCalendar.d.ts +6 -6
  36. package/dist/esm/components/calendar/CCalendar.js +42 -38
  37. package/dist/esm/components/calendar/CCalendar.js.map +1 -1
  38. package/dist/esm/components/calendar/types.d.ts +3 -0
  39. package/dist/esm/components/calendar/utils.d.ts +175 -18
  40. package/dist/esm/components/calendar/utils.js +305 -44
  41. package/dist/esm/components/calendar/utils.js.map +1 -1
  42. package/dist/esm/components/date-picker/CDatePicker.d.ts +1 -1
  43. package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +1 -1
  44. package/dist/esm/components/multi-select/CMultiSelect.js +5 -1
  45. package/dist/esm/components/multi-select/CMultiSelect.js.map +1 -1
  46. package/dist/esm/components/nav/CNavGroup.js +6 -2
  47. package/dist/esm/components/nav/CNavGroup.js.map +1 -1
  48. package/dist/esm/components/range-slider/CRangeSlider.js +6 -2
  49. package/dist/esm/components/range-slider/CRangeSlider.js.map +1 -1
  50. package/dist/esm/utils/index.d.ts +2 -1
  51. package/dist/esm/utils/isEqual.d.ts +2 -0
  52. package/dist/esm/utils/isEqual.js +74 -0
  53. package/dist/esm/utils/isEqual.js.map +1 -0
  54. package/package.json +6 -6
  55. package/src/components/accordion/CAccordionBody.ts +2 -1
  56. package/src/components/accordion/CAccordionButton.ts +3 -1
  57. package/src/components/accordion/CAccordionItem.ts +11 -3
  58. package/src/components/calendar/CCalendar.ts +62 -52
  59. package/src/components/calendar/types.ts +5 -0
  60. package/src/components/calendar/utils.ts +414 -109
  61. package/src/components/date-picker/CDatePicker.ts +1 -1
  62. package/src/components/date-range-picker/CDateRangePicker.ts +1 -1
  63. package/src/components/multi-select/CMultiSelect.ts +10 -2
  64. package/src/components/nav/CNavGroup.ts +7 -2
  65. package/src/components/range-slider/CRangeSlider.ts +7 -2
  66. package/src/utils/index.ts +10 -1
  67. package/src/utils/isEqual.ts +75 -0
@@ -41,7 +41,10 @@ const CNavGroup = defineComponent({
41
41
 
42
42
  onMounted(() => {
43
43
  visible.value = props.visible
44
- props.visible && navGroupRef.value.classList.add('show')
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,
@@ -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 { getNextActiveElement, getRTLPlacement, getUID, isInViewport, isObjectInArray, isRTL }
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