@coreui/vue-pro 5.9.0 → 5.11.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/button/CButton.js +1 -1
- package/dist/cjs/components/button/CButton.js.map +1 -1
- package/dist/cjs/components/calendar/CCalendar.d.ts +6 -6
- package/dist/cjs/components/calendar/CCalendar.js +44 -39
- 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 +183 -18
- package/dist/cjs/components/calendar/utils.js +327 -43
- package/dist/cjs/components/calendar/utils.js.map +1 -1
- package/dist/cjs/components/date-picker/CDatePicker.d.ts +1 -1
- package/dist/cjs/components/date-range-picker/CDateRangePicker.d.ts +1 -1
- package/dist/cjs/components/form/CFormControlWrapper.d.ts +2 -0
- package/dist/cjs/components/form/CFormControlWrapper.js +9 -1
- package/dist/cjs/components/form/CFormControlWrapper.js.map +1 -1
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/index.js +44 -36
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/link/CLink.js.map +1 -1
- package/dist/cjs/components/loading-button/CLoadingButton.d.ts +2 -2
- package/dist/cjs/components/multi-select/CMultiSelect.d.ts +12 -0
- package/dist/cjs/components/multi-select/CMultiSelect.js +28 -2
- package/dist/cjs/components/multi-select/CMultiSelect.js.map +1 -1
- package/dist/cjs/components/nav/CNav.d.ts +2 -2
- package/dist/cjs/components/nav/CNav.js +3 -2
- package/dist/cjs/components/nav/CNav.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/offcanvas/COffcanvas.js.map +1 -1
- package/dist/cjs/components/password-input/CPasswordInput.d.ts +190 -0
- package/dist/cjs/components/password-input/CPasswordInput.js +178 -0
- package/dist/cjs/components/password-input/CPasswordInput.js.map +1 -0
- package/dist/cjs/components/password-input/index.d.ts +6 -0
- package/dist/cjs/components/password-input/index.js +13 -0
- package/dist/cjs/components/password-input/index.js.map +1 -0
- package/dist/cjs/components/popover/CPopover.d.ts +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/components/rating/CRating.d.ts +1 -1
- package/dist/cjs/components/smart-table/CSmartTable.js +2 -2
- package/dist/cjs/components/smart-table/CSmartTable.js.map +1 -1
- package/dist/cjs/components/smart-table/utils.js.map +1 -1
- package/dist/cjs/components/stepper/CStepper.d.ts +168 -0
- package/dist/cjs/components/stepper/CStepper.js +305 -0
- package/dist/cjs/components/stepper/CStepper.js.map +1 -0
- package/dist/cjs/components/stepper/index.d.ts +6 -0
- package/dist/cjs/components/stepper/index.js +13 -0
- package/dist/cjs/components/stepper/index.js.map +1 -0
- package/dist/cjs/components/stepper/types.d.ts +15 -0
- package/dist/cjs/components/tabs/CTab.js.map +1 -1
- package/dist/cjs/components/tabs/CTabList.d.ts +2 -2
- package/dist/cjs/components/tabs/CTabList.js +3 -2
- package/dist/cjs/components/tabs/CTabList.js.map +1 -1
- package/dist/cjs/components/time-picker/utils.d.ts +10 -0
- package/dist/cjs/components/time-picker/utils.js +25 -9
- package/dist/cjs/components/time-picker/utils.js.map +1 -1
- package/dist/cjs/components/tooltip/CTooltip.d.ts +1 -1
- package/dist/cjs/components/widgets/CWidgetStatsB.js +2 -2
- package/dist/cjs/components/widgets/CWidgetStatsB.js.map +1 -1
- package/dist/cjs/components/widgets/CWidgetStatsC.js +2 -2
- package/dist/cjs/components/widgets/CWidgetStatsC.js.map +1 -1
- package/dist/cjs/index.js +50 -42
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/node_modules/vue-types/dist/index.js +567 -0
- package/dist/cjs/node_modules/vue-types/dist/index.js.map +1 -0
- package/dist/cjs/node_modules/vue-types/dist/shared/vue-types.8139b772.js +29 -0
- package/dist/cjs/node_modules/vue-types/dist/shared/vue-types.8139b772.js.map +1 -0
- package/dist/cjs/utils/getNextActiveElement.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/avatar/CAvatar.js +1 -1
- package/dist/esm/components/badge/CBadge.js +1 -1
- package/dist/esm/components/button/CButton.js +2 -2
- package/dist/esm/components/button/CButton.js.map +1 -1
- package/dist/esm/components/calendar/CCalendar.d.ts +6 -6
- package/dist/esm/components/calendar/CCalendar.js +46 -41
- 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 +183 -18
- package/dist/esm/components/calendar/utils.js +320 -44
- package/dist/esm/components/calendar/utils.js.map +1 -1
- package/dist/esm/components/card/CCard.js +1 -1
- package/dist/esm/components/date-picker/CDatePicker.d.ts +1 -1
- package/dist/esm/components/date-range-picker/CDateRangePicker.d.ts +1 -1
- package/dist/esm/components/dropdown/CDropdownToggle.js +2 -2
- package/dist/esm/components/form/CFormControlWrapper.d.ts +2 -0
- package/dist/esm/components/form/CFormControlWrapper.js +9 -1
- package/dist/esm/components/form/CFormControlWrapper.js.map +1 -1
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/link/CLink.js.map +1 -1
- package/dist/esm/components/loading-button/CLoadingButton.d.ts +2 -2
- package/dist/esm/components/multi-select/CMultiSelect.d.ts +12 -0
- package/dist/esm/components/multi-select/CMultiSelect.js +29 -3
- package/dist/esm/components/multi-select/CMultiSelect.js.map +1 -1
- package/dist/esm/components/nav/CNav.d.ts +2 -2
- package/dist/esm/components/nav/CNav.js +3 -2
- package/dist/esm/components/nav/CNav.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/offcanvas/COffcanvas.js.map +1 -1
- package/dist/esm/components/password-input/CPasswordInput.d.ts +190 -0
- package/dist/esm/components/password-input/CPasswordInput.js +176 -0
- package/dist/esm/components/password-input/CPasswordInput.js.map +1 -0
- package/dist/esm/components/password-input/index.d.ts +6 -0
- package/dist/esm/components/password-input/index.js +10 -0
- package/dist/esm/components/password-input/index.js.map +1 -0
- package/dist/esm/components/popover/CPopover.d.ts +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/components/rating/CRating.d.ts +1 -1
- package/dist/esm/components/smart-table/CSmartTable.js +2 -2
- package/dist/esm/components/smart-table/CSmartTable.js.map +1 -1
- package/dist/esm/components/smart-table/CSmartTableBody.js +1 -1
- package/dist/esm/components/smart-table/utils.js.map +1 -1
- package/dist/esm/components/stepper/CStepper.d.ts +168 -0
- package/dist/esm/components/stepper/CStepper.js +303 -0
- package/dist/esm/components/stepper/CStepper.js.map +1 -0
- package/dist/esm/components/stepper/index.d.ts +6 -0
- package/dist/esm/components/stepper/index.js +10 -0
- package/dist/esm/components/stepper/index.js.map +1 -0
- package/dist/esm/components/stepper/types.d.ts +15 -0
- package/dist/esm/components/tabs/CTab.js.map +1 -1
- package/dist/esm/components/tabs/CTabList.d.ts +2 -2
- package/dist/esm/components/tabs/CTabList.js +3 -2
- package/dist/esm/components/tabs/CTabList.js.map +1 -1
- package/dist/esm/components/time-picker/utils.d.ts +10 -0
- package/dist/esm/components/time-picker/utils.js +25 -10
- package/dist/esm/components/time-picker/utils.js.map +1 -1
- package/dist/esm/components/tooltip/CTooltip.d.ts +1 -1
- package/dist/esm/components/widgets/CWidgetStatsB.js +2 -2
- package/dist/esm/components/widgets/CWidgetStatsB.js.map +1 -1
- package/dist/esm/components/widgets/CWidgetStatsC.js +2 -2
- package/dist/esm/components/widgets/CWidgetStatsC.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node_modules/vue-types/dist/index.js +541 -0
- package/dist/esm/node_modules/vue-types/dist/index.js.map +1 -0
- package/dist/esm/node_modules/vue-types/dist/shared/vue-types.8139b772.js +25 -0
- package/dist/esm/node_modules/vue-types/dist/shared/vue-types.8139b772.js.map +1 -0
- package/dist/esm/utils/getNextActiveElement.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 +10 -10
- 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/button/CButton.ts +1 -1
- package/src/components/calendar/CCalendar.ts +108 -95
- package/src/components/calendar/types.ts +5 -0
- package/src/components/calendar/utils.ts +439 -111
- package/src/components/date-picker/CDatePicker.ts +1 -1
- package/src/components/date-range-picker/CDateRangePicker.ts +1 -1
- package/src/components/form/CFormControlWrapper.ts +35 -21
- package/src/components/index.ts +2 -0
- package/src/components/multi-select/CMultiSelect.ts +57 -26
- package/src/components/nav/CNav.ts +3 -2
- package/src/components/nav/CNavGroup.ts +7 -2
- package/src/components/password-input/CPasswordInput.ts +214 -0
- package/src/components/password-input/index.ts +10 -0
- package/src/components/range-slider/CRangeSlider.ts +7 -2
- package/src/components/stepper/CStepper.ts +384 -0
- package/src/components/stepper/__tests__/CStepper.spec.ts +175 -0
- package/src/components/stepper/index.ts +10 -0
- package/src/components/stepper/types.ts +18 -0
- package/src/components/tabs/CTabList.ts +3 -2
- package/src/components/time-picker/CTimePicker.ts +22 -22
- package/src/components/time-picker/CTimePickerRollCol.ts +3 -3
- package/src/components/time-picker/utils.ts +30 -13
- package/src/utils/index.ts +10 -1
- package/src/utils/isEqual.ts +75 -0
- package/dist/cjs/node_modules/is-plain-object/dist/is-plain-object.js +0 -37
- package/dist/cjs/node_modules/is-plain-object/dist/is-plain-object.js.map +0 -1
- package/dist/cjs/node_modules/vue-types/dist/vue-types.modern.js +0 -33
- package/dist/cjs/node_modules/vue-types/dist/vue-types.modern.js.map +0 -1
- package/dist/esm/node_modules/is-plain-object/dist/is-plain-object.js +0 -35
- package/dist/esm/node_modules/is-plain-object/dist/is-plain-object.js.map +0 -1
- package/dist/esm/node_modules/vue-types/dist/vue-types.modern.js +0 -6
- package/dist/esm/node_modules/vue-types/dist/vue-types.modern.js.map +0 -1
|
@@ -7,6 +7,7 @@ import { CFormText } from './CFormText'
|
|
|
7
7
|
import type { ComponentProps } from '../../utils/ComponentProps'
|
|
8
8
|
|
|
9
9
|
interface CFormControlWrapperProps extends ComponentProps<typeof CFormControlValidation> {
|
|
10
|
+
floatingClassName?: string
|
|
10
11
|
floatingLabel?: string
|
|
11
12
|
id?: string
|
|
12
13
|
label?: string
|
|
@@ -18,6 +19,12 @@ const CFormControlWrapper = defineComponent({
|
|
|
18
19
|
inheritAttrs: false,
|
|
19
20
|
props: {
|
|
20
21
|
...CFormControlValidation.props,
|
|
22
|
+
/**
|
|
23
|
+
* A string of all className you want applied to the floating label wrapper.
|
|
24
|
+
*
|
|
25
|
+
* @since 5.5.0
|
|
26
|
+
*/
|
|
27
|
+
floatingClassName: String,
|
|
21
28
|
/**
|
|
22
29
|
* Provide valuable, actionable valid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
23
30
|
*
|
|
@@ -64,34 +71,41 @@ const CFormControlWrapper = defineComponent({
|
|
|
64
71
|
...(slots.feedbackValid && {
|
|
65
72
|
feedbackValid: () => slots.feedbackInvalid && slots.feedbackInvalid(),
|
|
66
73
|
}),
|
|
67
|
-
}
|
|
74
|
+
}
|
|
68
75
|
)
|
|
69
76
|
|
|
70
77
|
return () =>
|
|
71
78
|
props.floatingLabel
|
|
72
|
-
? h(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
default: () => (slots.label && slots.label()) || props.label || props.floatingLabel,
|
|
81
|
-
},
|
|
82
|
-
),
|
|
83
|
-
(props.text || slots.text) &&
|
|
79
|
+
? h(
|
|
80
|
+
CFormFloating,
|
|
81
|
+
{
|
|
82
|
+
class: props.floatingClassName,
|
|
83
|
+
},
|
|
84
|
+
() => [
|
|
85
|
+
slots.default && slots.default(),
|
|
84
86
|
h(
|
|
85
|
-
|
|
87
|
+
CFormLabel,
|
|
86
88
|
{
|
|
87
|
-
|
|
89
|
+
for: props.id,
|
|
88
90
|
},
|
|
89
91
|
{
|
|
90
|
-
default: () =>
|
|
91
|
-
|
|
92
|
+
default: () =>
|
|
93
|
+
(slots.label && slots.label()) || props.label || props.floatingLabel,
|
|
94
|
+
}
|
|
92
95
|
),
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
(props.text || slots.text) &&
|
|
97
|
+
h(
|
|
98
|
+
CFormText,
|
|
99
|
+
{
|
|
100
|
+
id: props.describedby,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
default: () => (slots.text && slots.text()) || props.text,
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
formControlValidation(),
|
|
107
|
+
]
|
|
108
|
+
)
|
|
95
109
|
: [
|
|
96
110
|
(props.label || slots.label) &&
|
|
97
111
|
h(
|
|
@@ -101,7 +115,7 @@ const CFormControlWrapper = defineComponent({
|
|
|
101
115
|
},
|
|
102
116
|
{
|
|
103
117
|
default: () => (slots.label && slots.label()) || props.label,
|
|
104
|
-
}
|
|
118
|
+
}
|
|
105
119
|
),
|
|
106
120
|
slots.default && slots.default(),
|
|
107
121
|
(props.text || slots.text) &&
|
|
@@ -112,7 +126,7 @@ const CFormControlWrapper = defineComponent({
|
|
|
112
126
|
},
|
|
113
127
|
{
|
|
114
128
|
default: () => (slots.text && slots.text()) || props.text,
|
|
115
|
-
}
|
|
129
|
+
}
|
|
116
130
|
),
|
|
117
131
|
formControlValidation(),
|
|
118
132
|
]
|
package/src/components/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from './multi-select'
|
|
|
30
30
|
export * from './nav'
|
|
31
31
|
export * from './navbar'
|
|
32
32
|
export * from './offcanvas'
|
|
33
|
+
export * from './password-input'
|
|
33
34
|
export * from './pagination'
|
|
34
35
|
export * from './picker'
|
|
35
36
|
export * from './placeholder'
|
|
@@ -41,6 +42,7 @@ export * from './sidebar'
|
|
|
41
42
|
export * from './smart-pagination'
|
|
42
43
|
export * from './smart-table'
|
|
43
44
|
export * from './spinner'
|
|
45
|
+
export * from './stepper'
|
|
44
46
|
export * from './table'
|
|
45
47
|
export * from './tabs'
|
|
46
48
|
export * from './time-picker'
|
|
@@ -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,
|
|
@@ -203,7 +203,7 @@ const CMultiSelect = defineComponent({
|
|
|
203
203
|
|
|
204
204
|
// Ensure that all values corresponding to the keys are boolean
|
|
205
205
|
const allValuesBoolean = keys.every(
|
|
206
|
-
(key) => typeof value[key as keyof typeof value] === 'boolean'
|
|
206
|
+
(key) => typeof value[key as keyof typeof value] === 'boolean'
|
|
207
207
|
)
|
|
208
208
|
|
|
209
209
|
return allValuesBoolean
|
|
@@ -296,6 +296,12 @@ const CMultiSelect = defineComponent({
|
|
|
296
296
|
* @since 4.6.0
|
|
297
297
|
*/
|
|
298
298
|
valid: Boolean,
|
|
299
|
+
/**
|
|
300
|
+
* Sets the initially selected values for the multi-select component.
|
|
301
|
+
*
|
|
302
|
+
* @since 5.11.0
|
|
303
|
+
*/
|
|
304
|
+
value: [String, Number, Array] as PropType<string | number | (string | number)[]>,
|
|
299
305
|
/**
|
|
300
306
|
* Enable virtual scroller for the options list.
|
|
301
307
|
*
|
|
@@ -365,18 +371,35 @@ const CMultiSelect = defineComponent({
|
|
|
365
371
|
isExternalSearch(props.search)
|
|
366
372
|
? [...props.options, ...filterOptionsList(searchValue.value, userOptions.value)]
|
|
367
373
|
: filterOptionsList(searchValue.value, [...props.options, ...userOptions.value]),
|
|
368
|
-
true
|
|
369
|
-
)
|
|
374
|
+
true
|
|
375
|
+
)
|
|
370
376
|
)
|
|
371
377
|
|
|
372
|
-
const flattenedOptions = computed(() =>
|
|
378
|
+
const flattenedOptions = computed(() => {
|
|
379
|
+
return flattenOptionsArray(props.options).map((option) => {
|
|
380
|
+
if (props.value && Array.isArray(props.value)) {
|
|
381
|
+
return {
|
|
382
|
+
...option,
|
|
383
|
+
selected: props.value.includes(option.value),
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (props.value === option.value) {
|
|
388
|
+
return {
|
|
389
|
+
...option,
|
|
390
|
+
selected: true,
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return option
|
|
395
|
+
})
|
|
396
|
+
})
|
|
373
397
|
|
|
374
398
|
const userOption = computed(() => {
|
|
375
399
|
if (
|
|
376
400
|
props.allowCreateOptions &&
|
|
377
401
|
filteredOptions.value.some(
|
|
378
|
-
(option) =>
|
|
379
|
-
option.label && option.label.toLowerCase() === searchValue.value.toLowerCase(),
|
|
402
|
+
(option) => option.label && option.label.toLowerCase() === searchValue.value.toLowerCase()
|
|
380
403
|
)
|
|
381
404
|
) {
|
|
382
405
|
return false
|
|
@@ -394,17 +417,25 @@ const CMultiSelect = defineComponent({
|
|
|
394
417
|
}
|
|
395
418
|
|
|
396
419
|
const _selected = flattenedOptions.value.filter(
|
|
397
|
-
(option: Option | OptionsGroup) => option.selected === true
|
|
420
|
+
(option: Option | OptionsGroup) => option.selected === true
|
|
398
421
|
)
|
|
399
422
|
const deselected = flattenedOptions.value.filter(
|
|
400
|
-
(option: Option | OptionsGroup) => option.selected === false
|
|
423
|
+
(option: Option | OptionsGroup) => option.selected === false
|
|
401
424
|
) as Option[]
|
|
402
425
|
|
|
403
426
|
if (_selected.length > 0) {
|
|
404
|
-
|
|
427
|
+
const newSelectedValue = selectOptions(
|
|
428
|
+
props.multiple,
|
|
429
|
+
_selected,
|
|
430
|
+
selected.value,
|
|
431
|
+
deselected
|
|
432
|
+
)
|
|
433
|
+
if (!isEqual(newSelectedValue, selected.value)) {
|
|
434
|
+
selected.value = newSelectedValue
|
|
435
|
+
}
|
|
405
436
|
}
|
|
406
437
|
},
|
|
407
|
-
{ immediate: true }
|
|
438
|
+
{ immediate: true }
|
|
408
439
|
)
|
|
409
440
|
|
|
410
441
|
watch(selected, () => {
|
|
@@ -424,7 +455,7 @@ const CMultiSelect = defineComponent({
|
|
|
424
455
|
},
|
|
425
456
|
{
|
|
426
457
|
immediate: true,
|
|
427
|
-
}
|
|
458
|
+
}
|
|
428
459
|
)
|
|
429
460
|
|
|
430
461
|
watch(isOpen, () => {
|
|
@@ -473,7 +504,7 @@ const CMultiSelect = defineComponent({
|
|
|
473
504
|
items,
|
|
474
505
|
target,
|
|
475
506
|
event.key === 'ArrowDown',
|
|
476
|
-
!items.includes(target)
|
|
507
|
+
!items.includes(target)
|
|
477
508
|
).focus()
|
|
478
509
|
return
|
|
479
510
|
}
|
|
@@ -485,7 +516,7 @@ const CMultiSelect = defineComponent({
|
|
|
485
516
|
selected.value = [
|
|
486
517
|
...selected.value,
|
|
487
518
|
filteredOptions.value.find(
|
|
488
|
-
(option) => String(option.label).toLowerCase() === searchValue.value.toLowerCase()
|
|
519
|
+
(option) => String(option.label).toLowerCase() === searchValue.value.toLowerCase()
|
|
489
520
|
) as Option,
|
|
490
521
|
]
|
|
491
522
|
}
|
|
@@ -533,7 +564,7 @@ const CMultiSelect = defineComponent({
|
|
|
533
564
|
items,
|
|
534
565
|
target,
|
|
535
566
|
event.key === 'ArrowDown',
|
|
536
|
-
!items.includes(target)
|
|
567
|
+
!items.includes(target)
|
|
537
568
|
).focus()
|
|
538
569
|
}
|
|
539
570
|
}
|
|
@@ -586,7 +617,7 @@ const CMultiSelect = defineComponent({
|
|
|
586
617
|
...flattenedOptions.value.filter((option: Option | OptionsGroup) => !option.disabled),
|
|
587
618
|
...userOptions.value,
|
|
588
619
|
],
|
|
589
|
-
selected.value
|
|
620
|
+
selected.value
|
|
590
621
|
)
|
|
591
622
|
}
|
|
592
623
|
|
|
@@ -691,7 +722,7 @@ const CMultiSelect = defineComponent({
|
|
|
691
722
|
...(selected.value.length > 0 &&
|
|
692
723
|
!props.multiple && {
|
|
693
724
|
placeholder: selected.value.map(
|
|
694
|
-
(option) => option.label
|
|
725
|
+
(option) => option.label
|
|
695
726
|
)[0],
|
|
696
727
|
}),
|
|
697
728
|
...(props.multiple &&
|
|
@@ -709,9 +740,9 @@ const CMultiSelect = defineComponent({
|
|
|
709
740
|
},
|
|
710
741
|
{
|
|
711
742
|
default: () => props.placeholder,
|
|
712
|
-
}
|
|
743
|
+
}
|
|
713
744
|
),
|
|
714
|
-
}
|
|
745
|
+
}
|
|
715
746
|
),
|
|
716
747
|
h(
|
|
717
748
|
'div',
|
|
@@ -741,10 +772,10 @@ const CMultiSelect = defineComponent({
|
|
|
741
772
|
...(props.disabled && { tabIndex: -1 }),
|
|
742
773
|
}),
|
|
743
774
|
],
|
|
744
|
-
}
|
|
775
|
+
}
|
|
745
776
|
),
|
|
746
777
|
],
|
|
747
|
-
}
|
|
778
|
+
}
|
|
748
779
|
),
|
|
749
780
|
h(
|
|
750
781
|
CConditionalTeleport,
|
|
@@ -778,7 +809,7 @@ const CMultiSelect = defineComponent({
|
|
|
778
809
|
onClick: () => handleSelectAll(),
|
|
779
810
|
type: 'button',
|
|
780
811
|
},
|
|
781
|
-
props.selectAllLabel
|
|
812
|
+
props.selectAllLabel
|
|
782
813
|
),
|
|
783
814
|
h(CMultiSelectOptions, {
|
|
784
815
|
loading: props.loading,
|
|
@@ -796,14 +827,14 @@ const CMultiSelect = defineComponent({
|
|
|
796
827
|
visibleItems: props.visibleItems,
|
|
797
828
|
}),
|
|
798
829
|
],
|
|
799
|
-
}
|
|
830
|
+
}
|
|
800
831
|
),
|
|
801
|
-
}
|
|
832
|
+
}
|
|
802
833
|
),
|
|
803
834
|
],
|
|
804
|
-
}
|
|
835
|
+
}
|
|
805
836
|
),
|
|
806
|
-
}
|
|
837
|
+
}
|
|
807
838
|
),
|
|
808
839
|
]
|
|
809
840
|
},
|
|
@@ -24,12 +24,12 @@ const CNav = defineComponent({
|
|
|
24
24
|
/**
|
|
25
25
|
* Set the nav variant to tabs or pills.
|
|
26
26
|
*
|
|
27
|
-
* @values 'pills', 'tabs', 'underline', 'underline-border'
|
|
27
|
+
* @values 'enclosed', 'enclosed-pills', 'pills', 'tabs', 'underline', 'underline-border'
|
|
28
28
|
*/
|
|
29
29
|
variant: {
|
|
30
30
|
type: String,
|
|
31
31
|
validator: (value: string) => {
|
|
32
|
-
return ['pills', 'tabs', 'underline', 'underline-border'].includes(value)
|
|
32
|
+
return ['enclosed', 'enclosed-pills', 'pills', 'tabs', 'underline', 'underline-border'].includes(value)
|
|
33
33
|
},
|
|
34
34
|
},
|
|
35
35
|
},
|
|
@@ -40,6 +40,7 @@ const CNav = defineComponent({
|
|
|
40
40
|
{
|
|
41
41
|
class: [
|
|
42
42
|
'nav',
|
|
43
|
+
props.variant === 'enclosed-pills' && 'nav-enclosed',
|
|
43
44
|
{
|
|
44
45
|
[`nav-${props.layout}`]: props.layout,
|
|
45
46
|
[`nav-${props.variant}`]: props.variant,
|
|
@@ -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(),
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// CPasswordInput.ts
|
|
2
|
+
import { defineComponent, h, ref, toRefs, watch, computed } from 'vue'
|
|
3
|
+
import { CFormControlWrapper } from '../form/CFormControlWrapper'
|
|
4
|
+
|
|
5
|
+
export const CPasswordInput = defineComponent({
|
|
6
|
+
name: 'CPasswordInput',
|
|
7
|
+
inheritAttrs: false,
|
|
8
|
+
props: {
|
|
9
|
+
/**
|
|
10
|
+
* Accessible label for the toggle visibility button.
|
|
11
|
+
*/
|
|
12
|
+
ariaLabelToggler: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'Toggle password visibility',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Delay emitting `change` and `update:modelValue` events.
|
|
19
|
+
* `true` = 500ms delay, or specify custom delay in ms.
|
|
20
|
+
*/
|
|
21
|
+
delay: {
|
|
22
|
+
type: [Boolean, Number],
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Disables the password input field. When `true`, the user cannot interact with the field.
|
|
28
|
+
*/
|
|
29
|
+
disabled: Boolean,
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* General feedback text shown below the input.
|
|
33
|
+
*/
|
|
34
|
+
feedback: String,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Feedback text shown when input is invalid.
|
|
38
|
+
*/
|
|
39
|
+
feedbackInvalid: String,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Feedback text shown when input is valid.
|
|
43
|
+
*/
|
|
44
|
+
feedbackValid: String,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Class for the floating label wrapper.
|
|
48
|
+
*/
|
|
49
|
+
floatingClassName: String,
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Floating label text.
|
|
53
|
+
*/
|
|
54
|
+
floatingLabel: String,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* ID of the input element.
|
|
58
|
+
*/
|
|
59
|
+
id: String,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Marks the input as invalid.
|
|
63
|
+
*/
|
|
64
|
+
invalid: Boolean,
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Main label for the input.
|
|
68
|
+
*/
|
|
69
|
+
label: String,
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The current value of the password input, used with v-model.
|
|
73
|
+
*/
|
|
74
|
+
modelValue: String,
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Makes the input read-only, allowing text selection only.
|
|
78
|
+
*/
|
|
79
|
+
readOnly: Boolean,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Controls the initial visibility of the password.
|
|
83
|
+
*/
|
|
84
|
+
showPassword: Boolean,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the visual size of the input. Accepts `'sm'`, `'lg'`, or undefined.
|
|
88
|
+
*/
|
|
89
|
+
size: {
|
|
90
|
+
type: String as () => 'sm' | 'lg' | undefined,
|
|
91
|
+
default: undefined,
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Helper or hint text displayed below the input.
|
|
96
|
+
*/
|
|
97
|
+
text: String,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Enables tooltip-style validation feedback messages.
|
|
101
|
+
*/
|
|
102
|
+
tooltipFeedback: Boolean,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Marks the input as valid.
|
|
106
|
+
*/
|
|
107
|
+
valid: Boolean,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Alternative to `modelValue`, mostly for manual `:value` binding.
|
|
111
|
+
*/
|
|
112
|
+
value: String,
|
|
113
|
+
},
|
|
114
|
+
emits: ['update:modelValue', 'change'],
|
|
115
|
+
setup(props, { emit, attrs }) {
|
|
116
|
+
const { delay, showPassword, size, invalid, valid } = toRefs(props)
|
|
117
|
+
|
|
118
|
+
const localValue = ref(props.modelValue ?? props.value ?? '')
|
|
119
|
+
const visible = ref(showPassword.value ?? false)
|
|
120
|
+
|
|
121
|
+
const inputType = computed(() => (visible.value ? 'text' : 'password'))
|
|
122
|
+
|
|
123
|
+
watch(
|
|
124
|
+
() => props.modelValue ?? props.value,
|
|
125
|
+
(val) => {
|
|
126
|
+
if (val !== localValue.value) {
|
|
127
|
+
localValue.value = val as string
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
let timeout: ReturnType<typeof setTimeout>
|
|
133
|
+
watch(localValue, (val) => {
|
|
134
|
+
if (delay.value) {
|
|
135
|
+
clearTimeout(timeout)
|
|
136
|
+
timeout = setTimeout(
|
|
137
|
+
() => {
|
|
138
|
+
emit('update:modelValue', val)
|
|
139
|
+
emit('change', val)
|
|
140
|
+
},
|
|
141
|
+
typeof delay.value === 'number' ? delay.value : 500
|
|
142
|
+
)
|
|
143
|
+
} else {
|
|
144
|
+
emit('update:modelValue', val)
|
|
145
|
+
emit('change', val)
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
const togglePassword = () => {
|
|
150
|
+
visible.value = !visible.value
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return () =>
|
|
154
|
+
h(
|
|
155
|
+
CFormControlWrapper,
|
|
156
|
+
{
|
|
157
|
+
describedby: attrs['aria-describedby'] as string,
|
|
158
|
+
feedback: props.feedback,
|
|
159
|
+
feedbackInvalid: props.feedbackInvalid,
|
|
160
|
+
feedbackValid: props.feedbackValid,
|
|
161
|
+
floatingClassName: props.floatingLabel
|
|
162
|
+
? ['form-password', props.floatingClassName].join(' ')
|
|
163
|
+
: props.floatingClassName,
|
|
164
|
+
floatingLabel: props.floatingLabel,
|
|
165
|
+
id: props.id,
|
|
166
|
+
invalid: props.invalid,
|
|
167
|
+
label: props.label,
|
|
168
|
+
text: props.text,
|
|
169
|
+
tooltipFeedback: props.tooltipFeedback,
|
|
170
|
+
valid: props.valid,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
default: () => {
|
|
174
|
+
const inputEl = h('input', {
|
|
175
|
+
...attrs,
|
|
176
|
+
id: props.id,
|
|
177
|
+
type: inputType.value,
|
|
178
|
+
class: [
|
|
179
|
+
'form-control',
|
|
180
|
+
{
|
|
181
|
+
[`form-control-${size.value}`]: size.value,
|
|
182
|
+
'is-invalid': invalid.value,
|
|
183
|
+
'is-valid': valid.value,
|
|
184
|
+
},
|
|
185
|
+
attrs.class,
|
|
186
|
+
],
|
|
187
|
+
value: localValue.value,
|
|
188
|
+
onInput: (e: Event) => {
|
|
189
|
+
localValue.value = (e.target as HTMLInputElement).value
|
|
190
|
+
},
|
|
191
|
+
disabled: props.disabled,
|
|
192
|
+
readOnly: props.readOnly,
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
const buttonEl = h(
|
|
196
|
+
'button',
|
|
197
|
+
{
|
|
198
|
+
type: 'button',
|
|
199
|
+
class: 'form-password-action',
|
|
200
|
+
'data-coreui-toggle': 'password',
|
|
201
|
+
'aria-label': props.ariaLabelToggler,
|
|
202
|
+
onClick: togglePassword,
|
|
203
|
+
},
|
|
204
|
+
[h('span', { class: 'form-password-action-icon' })]
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
const content = [inputEl, buttonEl]
|
|
208
|
+
|
|
209
|
+
return props.floatingLabel ? content : h('div', { class: 'form-password' }, content)
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { App } from 'vue'
|
|
2
|
+
import { CPasswordInput } from './CPasswordInput'
|
|
3
|
+
|
|
4
|
+
const CPasswordInputPlugin = {
|
|
5
|
+
install: (app: App): void => {
|
|
6
|
+
app.component(CPasswordInput.name as string, CPasswordInput)
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { CPasswordInput, CPasswordInputPlugin }
|
|
@@ -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,
|