@volverjs/ui-vue 0.0.10-beta.3 → 0.0.10-beta.31
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/LICENSE +1 -1
- package/README.md +106 -10
- package/auto-imports.d.ts +7 -2
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +22 -15
- package/dist/Volver.d.ts +1 -1
- package/dist/components/VvAccordion/VvAccordion.es.js +192 -103
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +160 -8
- package/dist/components/VvAccordion/index.d.ts +8 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +451 -172
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +58 -13
- package/dist/components/VvAccordionGroup/index.d.ts +14 -6
- package/dist/components/VvAction/VvAction.es.js +78 -27
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +57 -22
- package/dist/components/VvAction/index.d.ts +25 -9
- package/dist/components/VvAlert/VvAlert.es.js +204 -171
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +24 -14
- package/dist/components/VvAlert/index.d.ts +17 -9
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +250 -188
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +16 -9
- package/dist/components/VvAlertGroup/index.d.ts +6 -14
- package/dist/components/VvAvatar/VvAvatar.es.js +61 -21
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +12 -4
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +118 -48
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +10 -3
- package/dist/components/VvAvatarGroup/index.d.ts +4 -1
- package/dist/components/VvBadge/VvBadge.es.js +78 -28
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +12 -4
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +276 -60
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +27 -7
- package/dist/components/VvBreadcrumb/index.d.ts +6 -10
- package/dist/components/VvButton/VvButton.es.js +291 -252
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +94 -40
- package/dist/components/VvButton/index.d.ts +51 -29
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +81 -40
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +24 -11
- package/dist/components/VvButtonGroup/index.d.ts +8 -2
- package/dist/components/VvCard/VvCard.es.js +86 -36
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +12 -4
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +177 -120
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +105 -33
- package/dist/components/VvCheckbox/index.d.ts +47 -14
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +190 -107
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +101 -30
- package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
- package/dist/components/VvCombobox/VvCombobox.es.js +806 -581
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +171 -104
- package/dist/components/VvCombobox/index.d.ts +62 -26
- package/dist/components/VvDialog/VvDialog.es.js +140 -153
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +4 -4
- package/dist/components/VvDropdown/VvDropdown.es.js +138 -71
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +101 -75
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +66 -25
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +12 -4
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +35 -7
- package/dist/components/VvDropdown/index.d.ts +52 -10
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +152 -39
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +335 -8
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +63 -20
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +188 -80
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +23 -96
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +23 -66
- package/dist/components/VvIcon/index.d.ts +33 -48
- package/dist/components/VvInputFile/VvInputFile.es.js +1777 -0
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -0
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +359 -0
- package/dist/components/VvInputFile/index.d.ts +200 -0
- package/dist/components/VvInputText/VvInputClearAction.d.ts +7 -5
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +10 -8
- package/dist/components/VvInputText/VvInputStepAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputText.es.js +1237 -324
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +207 -57
- package/dist/components/VvInputText/index.d.ts +99 -29
- package/dist/components/VvNav/VvNav.es.js +135 -56
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +32 -9
- package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNavSeparator.vue.d.ts +1 -1
- package/dist/components/VvNav/index.d.ts +5 -2
- package/dist/components/VvNavItem/VvNavItem.es.js +91 -33
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +72 -26
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +10 -3
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +160 -103
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +103 -31
- package/dist/components/VvRadio/index.d.ts +50 -17
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +190 -107
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +101 -30
- package/dist/components/VvRadioGroup/index.d.ts +45 -12
- package/dist/components/VvSelect/VvSelect.es.js +251 -238
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +117 -44
- package/dist/components/VvSelect/index.d.ts +48 -14
- package/dist/components/VvTab/VvTab.es.js +191 -75
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +31 -7
- package/dist/components/VvTab/index.d.ts +4 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +232 -224
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +156 -49
- package/dist/components/VvTextarea/index.d.ts +68 -19
- package/dist/components/VvTooltip/VvTooltip.es.js +79 -29
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +13 -6
- package/dist/components/VvTooltip/index.d.ts +5 -2
- package/dist/components/common/HintSlot.d.ts +1 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.es.js +3534 -1650
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +99 -4
- package/dist/composables/alert/useInjectAlert.d.ts +1 -6
- package/dist/composables/dropdown/useInjectDropdown.d.ts +3 -23
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -4
- package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
- package/dist/composables/group/useProvideGroupState.d.ts +3 -3
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.es.js +92 -3
- package/dist/composables/index.umd.js +1 -1
- package/dist/composables/useBlurhash.d.ts +7 -0
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/composables/usePersistence.d.ts +2 -0
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +34 -32
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +99 -43
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +97 -38
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +267 -267
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +90 -16
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +272 -81
- package/dist/resolvers/unplugin.d.ts +6 -1
- package/dist/resolvers/unplugin.es.js +87 -10
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +143 -89
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +1075 -492
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
- package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
- package/dist/stories/Button/Button.settings.d.ts +0 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/Icon/Icon.settings.d.ts +1 -0
- package/dist/stories/InputFile/InputFile.settings.d.ts +56 -0
- package/dist/stories/InputFile/InputFile.stories.d.ts +12 -0
- package/dist/stories/InputFile/InputFileDropArea.stories.d.ts +9 -0
- package/dist/stories/InputFile/InputFileIconPosition.stories.d.ts +8 -0
- package/dist/stories/InputFile/InputFileSlots.stories.d.ts +7 -0
- package/dist/stories/Tab/Tab.settings.d.ts +2 -15
- package/dist/test/expect.d.ts +1 -1
- package/dist/types/alert.d.ts +9 -7
- package/dist/types/blurhash.d.ts +12 -0
- package/dist/types/generic.d.ts +1 -2
- package/dist/types/group.d.ts +37 -15
- package/dist/types/index.d.ts +7 -0
- package/dist/types/input-file.d.ts +16 -0
- package/dist/types/nav.d.ts +2 -2
- package/dist/utils/ObjectUtilities.d.ts +0 -1
- package/dist/workers/blurhash.d.ts +1 -0
- package/package.json +78 -78
- package/src/Volver.ts +31 -20
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +121 -58
- package/src/components/VvAccordion/index.ts +8 -23
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +164 -47
- package/src/components/VvAccordionGroup/index.ts +6 -6
- package/src/components/VvAction/VvAction.vue +17 -5
- package/src/components/VvAlert/index.ts +14 -9
- package/src/components/VvAlertGroup/index.ts +3 -15
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +20 -19
- package/src/components/VvBreadcrumb/index.ts +2 -8
- package/src/components/VvButton/VvButton.vue +17 -7
- package/src/components/VvButton/index.ts +9 -16
- package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
- package/src/components/VvCheckbox/index.ts +2 -2
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
- package/src/components/VvCombobox/VvCombobox.vue +15 -12
- package/src/components/VvCombobox/index.ts +4 -0
- package/src/components/VvDropdown/VvDropdown.vue +11 -2
- package/src/components/VvDropdown/VvDropdownItem.vue +4 -1
- package/src/components/VvDropdown/VvDropdownOption.vue +4 -21
- package/src/components/VvDropdown/index.ts +35 -1
- package/src/components/VvIcon/VvIcon.vue +2 -2
- package/src/components/VvIcon/index.ts +35 -48
- package/src/components/VvInputFile/VvInputFile.vue +395 -0
- package/src/components/VvInputFile/index.ts +135 -0
- package/src/components/VvInputText/VvInputClearAction.ts +10 -6
- package/src/components/VvInputText/VvInputPasswordAction.ts +13 -9
- package/src/components/VvInputText/VvInputText.vue +141 -33
- package/src/components/VvInputText/index.ts +31 -16
- package/src/components/VvNav/VvNav.vue +4 -2
- package/src/components/VvRadio/index.ts +5 -5
- package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
- package/src/components/VvSelect/VvSelect.vue +5 -8
- package/src/components/VvTab/VvTab.vue +5 -1
- package/src/components/VvTextarea/VvTextarea.vue +6 -9
- package/src/components/index.ts +10 -0
- package/src/composables/alert/useAlert.ts +12 -9
- package/src/composables/dropdown/useProvideDropdown.ts +4 -4
- package/src/composables/group/useInjectedGroupState.ts +20 -16
- package/src/composables/group/useProvideGroupState.ts +10 -15
- package/src/composables/index.ts +1 -0
- package/src/composables/useBlurhash.ts +76 -0
- package/src/composables/useComponentIcon.ts +15 -14
- package/src/composables/usePersistence.ts +76 -0
- package/src/composables/useUniqueId.ts +2 -2
- package/src/constants.ts +47 -32
- package/src/directives/index.ts +3 -6
- package/src/directives/v-tooltip.ts +19 -10
- package/src/index.ts +3 -1
- package/src/props/index.ts +108 -31
- package/src/resolvers/unplugin.ts +24 -14
- package/src/stories/Accordion/Accordion.test.ts +1 -1
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +2 -2
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +17 -11
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
- package/src/stories/Alert/Alert.test.ts +1 -1
- package/src/stories/AlertGroup/AlertGroup.test.ts +1 -1
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +2 -2
- package/src/stories/Avatar/Avatar.test.ts +1 -1
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +1 -1
- package/src/stories/Badge/Badge.test.ts +1 -1
- package/src/stories/Blurhash/BlurhashComposable.stories.ts +195 -0
- package/src/stories/Button/Button.settings.ts +1 -4
- package/src/stories/Button/Button.test.ts +1 -1
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +1 -1
- package/src/stories/Card/Card.test.ts +1 -1
- package/src/stories/Checkbox/Checkbox.test.ts +1 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +1 -1
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/Dialog/Dialog.test.ts +2 -2
- package/src/stories/Dropdown/Dropdown.test.ts +1 -1
- package/src/stories/Icon/Icon.settings.ts +3 -3
- package/src/stories/InputFile/InputFile.settings.ts +36 -0
- package/src/stories/InputFile/InputFile.stories.ts +89 -0
- package/src/stories/InputFile/InputFileDropArea.stories.ts +56 -0
- package/src/stories/InputFile/InputFileIconPosition.stories.ts +43 -0
- package/src/stories/InputFile/InputFileSlots.stories.ts +33 -0
- package/src/stories/InputText/InputText.test.ts +1 -1
- package/src/stories/Nav/Nav.test.ts +1 -1
- package/src/stories/Progress/Progress.test.ts +1 -1
- package/src/stories/Radio/Radio.test.ts +1 -1
- package/src/stories/RadioGroup/RadioGroup.test.ts +1 -1
- package/src/stories/Select/Select.test.ts +1 -1
- package/src/stories/Tab/Tab.settings.ts +2 -2
- package/src/stories/Tab/Tab.test.ts +1 -1
- package/src/stories/Textarea/Textarea.test.ts +1 -1
- package/src/stories/Tooltip/Tooltip.test.ts +1 -1
- package/src/stories/argTypes.ts +1 -1
- package/src/test/expect.ts +2 -4
- package/src/types/alert.ts +11 -7
- package/src/types/blurhash.ts +21 -0
- package/src/types/generic.ts +3 -3
- package/src/types/group.ts +22 -14
- package/src/types/index.ts +7 -0
- package/src/types/input-file.ts +18 -0
- package/src/types/nav.ts +2 -3
- package/src/utils/ObjectUtilities.ts +0 -11
- package/src/workers/blurhash.ts +9 -0
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
import { useIMask } from 'vue-imask'
|
|
10
10
|
import HintSlotFactory from '../common/HintSlot'
|
|
11
11
|
import VvIcon from '../VvIcon/VvIcon.vue'
|
|
12
|
+
import { ACTION_ICONS } from '../VvIcon'
|
|
12
13
|
import VvInputTextActionsFactory from '../VvInputText/VvInputTextActions'
|
|
14
|
+
import VvDropdown from '../VvDropdown/VvDropdown.vue'
|
|
15
|
+
import VvDropdownOption from '../VvDropdown/VvDropdownOption.vue'
|
|
13
16
|
import {
|
|
14
17
|
VvInputTextEvents,
|
|
15
18
|
VvInputTextProps,
|
|
16
19
|
INPUT_TYPES,
|
|
17
|
-
TYPES_ICON,
|
|
18
20
|
} from '../VvInputText'
|
|
19
21
|
|
|
20
22
|
// props, emit, slots and attrs
|
|
@@ -34,6 +36,7 @@
|
|
|
34
36
|
id,
|
|
35
37
|
icon,
|
|
36
38
|
iconPosition,
|
|
39
|
+
iconRemoveSuggestion,
|
|
37
40
|
label,
|
|
38
41
|
modelValue,
|
|
39
42
|
count,
|
|
@@ -46,6 +49,8 @@
|
|
|
46
49
|
type,
|
|
47
50
|
iMask,
|
|
48
51
|
step,
|
|
52
|
+
storageKey,
|
|
53
|
+
storageType,
|
|
49
54
|
} = toRefs(props)
|
|
50
55
|
const hasId = useUniqueId(id)
|
|
51
56
|
const hasHintId = computed(() => `${hasId.value}-hint`)
|
|
@@ -54,7 +59,14 @@
|
|
|
54
59
|
props.floating && isEmpty(props.placeholder) ? ' ' : props.placeholder,
|
|
55
60
|
)
|
|
56
61
|
|
|
57
|
-
//
|
|
62
|
+
// debounce
|
|
63
|
+
const localModelValue = useDebouncedInput(
|
|
64
|
+
modelValue,
|
|
65
|
+
emit,
|
|
66
|
+
debounce?.value ?? 0,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
// mask
|
|
58
70
|
const maskReady = ref(false)
|
|
59
71
|
const { el, mask, typed, masked, unmasked } = useIMask(
|
|
60
72
|
computed(
|
|
@@ -147,20 +159,32 @@
|
|
|
147
159
|
},
|
|
148
160
|
},
|
|
149
161
|
)
|
|
162
|
+
const updateMaskValue = (newValue: string | number | undefined) => {
|
|
163
|
+
if (iMask) {
|
|
164
|
+
if (newValue === undefined) {
|
|
165
|
+
typed.value = ''
|
|
166
|
+
unmasked.value = ''
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
if (iMask.value?.mask === Date) {
|
|
170
|
+
typed.value = new Date(newValue)
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
typed.value = newValue
|
|
174
|
+
unmasked.value = `${typed.value}`
|
|
175
|
+
}
|
|
176
|
+
}
|
|
150
177
|
onMounted(() => {
|
|
151
178
|
if (mask.value) {
|
|
152
179
|
maskReady.value = true
|
|
153
|
-
|
|
180
|
+
updateMaskValue(props.modelValue)
|
|
154
181
|
}
|
|
155
182
|
})
|
|
156
183
|
watch(
|
|
157
184
|
() => props.modelValue,
|
|
158
185
|
(newValue) => {
|
|
159
186
|
if (mask.value) {
|
|
160
|
-
|
|
161
|
-
newValue && iMask?.value?.mask === Date
|
|
162
|
-
? new Date(newValue)
|
|
163
|
-
: newValue ?? ''
|
|
187
|
+
updateMaskValue(newValue)
|
|
164
188
|
}
|
|
165
189
|
},
|
|
166
190
|
)
|
|
@@ -170,18 +194,15 @@
|
|
|
170
194
|
masked.value = newValue ?? ''
|
|
171
195
|
},
|
|
172
196
|
)
|
|
197
|
+
|
|
198
|
+
// template refs
|
|
173
199
|
const inputEl = el as Ref<HTMLInputElement>
|
|
174
|
-
const innerEl = ref()
|
|
200
|
+
const innerEl = ref<HTMLInputElement>()
|
|
201
|
+
const wrapperEl = ref<HTMLDivElement>()
|
|
202
|
+
const dropdownEl = ref<typeof VvDropdown>()
|
|
175
203
|
|
|
176
204
|
defineExpose({ $inner: innerEl })
|
|
177
205
|
|
|
178
|
-
// debounce
|
|
179
|
-
const localModelValue = useDebouncedInput(
|
|
180
|
-
modelValue,
|
|
181
|
-
emit,
|
|
182
|
-
debounce?.value ?? 0,
|
|
183
|
-
)
|
|
184
|
-
|
|
185
206
|
// focus
|
|
186
207
|
const { focused } = useComponentFocus(inputEl, emit)
|
|
187
208
|
const isFocused = computed(
|
|
@@ -191,6 +212,26 @@
|
|
|
191
212
|
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
192
213
|
inputEl.value.select()
|
|
193
214
|
}
|
|
215
|
+
if (newValue) {
|
|
216
|
+
dropdownEl.value?.show()
|
|
217
|
+
return
|
|
218
|
+
}
|
|
219
|
+
setTimeout(() => {
|
|
220
|
+
if (isDirty.value && suggestions.value) {
|
|
221
|
+
const suggestionsLimit = props.maxSuggestions - 1
|
|
222
|
+
if (
|
|
223
|
+
suggestions.value.size > suggestionsLimit &&
|
|
224
|
+
!suggestions.value.has(localModelValue.value)
|
|
225
|
+
) {
|
|
226
|
+
suggestions.value = new Set(
|
|
227
|
+
[...suggestions.value].slice(
|
|
228
|
+
suggestions.value.size - suggestionsLimit,
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
suggestions.value.add(localModelValue.value)
|
|
233
|
+
}
|
|
234
|
+
}, 300)
|
|
194
235
|
})
|
|
195
236
|
|
|
196
237
|
// visibility
|
|
@@ -227,7 +268,7 @@
|
|
|
227
268
|
return
|
|
228
269
|
}
|
|
229
270
|
inputEl.value.stepUp()
|
|
230
|
-
localModelValue.value = unref(inputEl).value
|
|
271
|
+
localModelValue.value = Number(unref(inputEl).value)
|
|
231
272
|
}
|
|
232
273
|
}
|
|
233
274
|
const onStepDown = () => {
|
|
@@ -238,7 +279,7 @@
|
|
|
238
279
|
return
|
|
239
280
|
}
|
|
240
281
|
inputEl.value.stepDown()
|
|
241
|
-
localModelValue.value = unref(inputEl).value
|
|
282
|
+
localModelValue.value = Number(unref(inputEl).value)
|
|
242
283
|
}
|
|
243
284
|
}
|
|
244
285
|
|
|
@@ -249,25 +290,26 @@
|
|
|
249
290
|
}
|
|
250
291
|
|
|
251
292
|
// icons
|
|
252
|
-
const {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
293
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
294
|
+
const iconAfter = computed(() => {
|
|
295
|
+
if (hasIconAfter.value !== undefined) {
|
|
296
|
+
return hasIconAfter.value
|
|
297
|
+
}
|
|
257
298
|
switch (props.type) {
|
|
258
299
|
case INPUT_TYPES.COLOR:
|
|
259
|
-
return { name:
|
|
300
|
+
return { name: ACTION_ICONS.showColorPicker }
|
|
260
301
|
case INPUT_TYPES.DATE:
|
|
261
302
|
case INPUT_TYPES.DATETIME_LOCAL:
|
|
262
303
|
case INPUT_TYPES.WEEK:
|
|
263
304
|
case INPUT_TYPES.MONTH:
|
|
264
|
-
return { name:
|
|
305
|
+
return { name: ACTION_ICONS.showDatePicker }
|
|
265
306
|
case INPUT_TYPES.TIME:
|
|
266
|
-
return { name:
|
|
267
|
-
default:
|
|
268
|
-
return ''
|
|
307
|
+
return { name: ACTION_ICONS.showTimePicker }
|
|
269
308
|
}
|
|
309
|
+
return undefined
|
|
270
310
|
})
|
|
311
|
+
const { hasIcon: hasIconRemoveSuggestion } =
|
|
312
|
+
useComponentIcon(iconRemoveSuggestion)
|
|
271
313
|
|
|
272
314
|
// count
|
|
273
315
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
@@ -296,6 +338,41 @@
|
|
|
296
338
|
return undefined
|
|
297
339
|
})
|
|
298
340
|
|
|
341
|
+
// suggestions
|
|
342
|
+
const suggestions = usePersistence<Set<string>>(
|
|
343
|
+
storageKey,
|
|
344
|
+
storageType,
|
|
345
|
+
new Set(),
|
|
346
|
+
)
|
|
347
|
+
const filteredSuggestions = computed(() => {
|
|
348
|
+
if (!suggestions.value) {
|
|
349
|
+
return []
|
|
350
|
+
}
|
|
351
|
+
return [...suggestions.value]
|
|
352
|
+
.filter(
|
|
353
|
+
(suggestion) =>
|
|
354
|
+
isEmpty(localModelValue.value) ||
|
|
355
|
+
(`${suggestion}`
|
|
356
|
+
.toLowerCase()
|
|
357
|
+
.includes(`${localModelValue.value}`.toLowerCase()) &&
|
|
358
|
+
suggestion !== localModelValue.value),
|
|
359
|
+
)
|
|
360
|
+
.reverse()
|
|
361
|
+
})
|
|
362
|
+
const hasSuggestions = computed(
|
|
363
|
+
() =>
|
|
364
|
+
storageKey?.value &&
|
|
365
|
+
suggestions.value &&
|
|
366
|
+
suggestions.value.size > 0,
|
|
367
|
+
)
|
|
368
|
+
const onSuggestionSelect = (suggestion: string) => {
|
|
369
|
+
localModelValue.value = suggestion
|
|
370
|
+
dropdownEl.value?.hide()
|
|
371
|
+
}
|
|
372
|
+
const onSuggestionRemove = (suggestion: string) => {
|
|
373
|
+
suggestions.value?.delete(suggestion)
|
|
374
|
+
}
|
|
375
|
+
|
|
299
376
|
// styles
|
|
300
377
|
const { modifiers } = toRefs(props)
|
|
301
378
|
const bemCssClasses = useModifiers(
|
|
@@ -307,8 +384,8 @@
|
|
|
307
384
|
loading: loading.value,
|
|
308
385
|
disabled: props.disabled,
|
|
309
386
|
readonly: props.readonly,
|
|
310
|
-
'icon-before': hasIconBefore.value,
|
|
311
|
-
'icon-after':
|
|
387
|
+
'icon-before': !!hasIconBefore.value,
|
|
388
|
+
'icon-after': !!iconAfter.value,
|
|
312
389
|
floating: props.floating && !isEmpty(props.label),
|
|
313
390
|
dirty: isDirty.value,
|
|
314
391
|
focus: isFocused.value,
|
|
@@ -464,7 +541,7 @@
|
|
|
464
541
|
<label v-if="label" :for="hasId" class="vv-input-text__label">
|
|
465
542
|
{{ label }}
|
|
466
543
|
</label>
|
|
467
|
-
<div class="vv-input-text__wrapper">
|
|
544
|
+
<div ref="wrapperEl" class="vv-input-text__wrapper">
|
|
468
545
|
<div v-if="$slots.before" class="vv-input-text__input-before">
|
|
469
546
|
<!-- @slot Slot before input icon -->
|
|
470
547
|
<slot name="before" v-bind="slotProps" />
|
|
@@ -476,8 +553,8 @@
|
|
|
476
553
|
>
|
|
477
554
|
<VvIcon
|
|
478
555
|
v-if="hasIconBefore"
|
|
556
|
+
v-bind="hasIconBefore"
|
|
479
557
|
class="vv-input-text__icon"
|
|
480
|
-
v-bind="hasIcon"
|
|
481
558
|
/>
|
|
482
559
|
<input
|
|
483
560
|
:id="hasId"
|
|
@@ -500,9 +577,9 @@
|
|
|
500
577
|
</div>
|
|
501
578
|
<!-- @slot Slot to replace right icon -->
|
|
502
579
|
<VvIcon
|
|
503
|
-
v-if="
|
|
580
|
+
v-if="iconAfter"
|
|
581
|
+
v-bind="iconAfter"
|
|
504
582
|
class="vv-input-text__icon vv-input-text__icon-after"
|
|
505
|
-
v-bind="hasIconAfter ? hasIcon : defaultAfterIcon"
|
|
506
583
|
/>
|
|
507
584
|
<PasswordInputActions
|
|
508
585
|
v-else-if="isPassword && !hideActions && isClickable"
|
|
@@ -543,5 +620,36 @@
|
|
|
543
620
|
<slot name="invalid" v-bind="hintSlotScope" />
|
|
544
621
|
</template>
|
|
545
622
|
</HintSlot>
|
|
623
|
+
<VvDropdown
|
|
624
|
+
v-if="hasSuggestions"
|
|
625
|
+
ref="dropdownEl"
|
|
626
|
+
:reference="wrapperEl"
|
|
627
|
+
:autofocus-first="false"
|
|
628
|
+
:trigger-width="true"
|
|
629
|
+
>
|
|
630
|
+
<template #items>
|
|
631
|
+
<VvDropdownOption
|
|
632
|
+
v-for="value in filteredSuggestions"
|
|
633
|
+
:key="value"
|
|
634
|
+
@click.stop="onSuggestionSelect(value)"
|
|
635
|
+
>
|
|
636
|
+
<div class="flex-1">
|
|
637
|
+
<slot name="suggestion" v-bind="{ value }">
|
|
638
|
+
{{ value }}
|
|
639
|
+
</slot>
|
|
640
|
+
</div>
|
|
641
|
+
<button
|
|
642
|
+
v-if="suggestions && hasIconRemoveSuggestion"
|
|
643
|
+
type="button"
|
|
644
|
+
tabindex="-1"
|
|
645
|
+
class="cursor-pointer"
|
|
646
|
+
:title="labelRemoveSuggestion"
|
|
647
|
+
@click.stop="onSuggestionRemove(value)"
|
|
648
|
+
>
|
|
649
|
+
<VvIcon v-bind="hasIconRemoveSuggestion" />
|
|
650
|
+
</button>
|
|
651
|
+
</VvDropdownOption>
|
|
652
|
+
</template>
|
|
653
|
+
</VvDropdown>
|
|
546
654
|
</div>
|
|
547
655
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
2
|
import type { FactoryOpts } from 'imask'
|
|
3
|
-
import { InputTextareaProps } from '../../props'
|
|
3
|
+
import { InputTextareaProps, StorageProps } from '../../props'
|
|
4
|
+
import { type VvIconProps, ACTION_ICONS } from '../VvIcon'
|
|
4
5
|
|
|
5
6
|
export const INPUT_TYPES = {
|
|
6
7
|
TEXT: 'text',
|
|
@@ -19,15 +20,6 @@ export const INPUT_TYPES = {
|
|
|
19
20
|
} as const
|
|
20
21
|
export type InputType = ValueOf<typeof INPUT_TYPES>
|
|
21
22
|
|
|
22
|
-
export const TYPES_ICON = {
|
|
23
|
-
PASSWORD_SHOW: 'eye-on',
|
|
24
|
-
PASSWORD_HIDE: 'eye-off',
|
|
25
|
-
DATE: 'calendar',
|
|
26
|
-
TIME: 'time',
|
|
27
|
-
COLOR: 'color',
|
|
28
|
-
SEARCH: 'close',
|
|
29
|
-
} as const
|
|
30
|
-
|
|
31
23
|
export const VvInputTextEvents = [
|
|
32
24
|
'update:modelValue',
|
|
33
25
|
'update:masked',
|
|
@@ -48,6 +40,7 @@ export const VvInputTextEvents = [
|
|
|
48
40
|
|
|
49
41
|
export const VvInputTextProps = {
|
|
50
42
|
...InputTextareaProps,
|
|
43
|
+
...StorageProps,
|
|
51
44
|
/**
|
|
52
45
|
* Input value
|
|
53
46
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -98,24 +91,32 @@ export const VvInputTextProps = {
|
|
|
98
91
|
* @see VVIcon
|
|
99
92
|
*/
|
|
100
93
|
iconShowPassword: {
|
|
101
|
-
type: String,
|
|
102
|
-
default:
|
|
94
|
+
type: [String, Object] as PropType<string | VvIconProps>,
|
|
95
|
+
default: ACTION_ICONS.showPassword,
|
|
103
96
|
},
|
|
104
97
|
/**
|
|
105
98
|
* VvIcon name for hide password button
|
|
106
99
|
* @see VVIcon
|
|
107
100
|
*/
|
|
108
101
|
iconHidePassword: {
|
|
109
|
-
type: String,
|
|
110
|
-
default:
|
|
102
|
+
type: [String, Object] as PropType<string | VvIconProps>,
|
|
103
|
+
default: ACTION_ICONS.hidePassword,
|
|
111
104
|
},
|
|
112
105
|
/**
|
|
113
106
|
* VvIcon name for clear button
|
|
114
107
|
* @see VVIcon
|
|
115
108
|
*/
|
|
116
109
|
iconClear: {
|
|
117
|
-
type: String,
|
|
118
|
-
default:
|
|
110
|
+
type: [String, Object] as PropType<string | VvIconProps>,
|
|
111
|
+
default: ACTION_ICONS.clear,
|
|
112
|
+
},
|
|
113
|
+
/**
|
|
114
|
+
* VvIcon name for remove suggestion button
|
|
115
|
+
* @see VVIcon
|
|
116
|
+
*/
|
|
117
|
+
iconRemoveSuggestion: {
|
|
118
|
+
type: [String, Object] as PropType<string | VvIconProps>,
|
|
119
|
+
default: ACTION_ICONS.remove,
|
|
119
120
|
},
|
|
120
121
|
/**
|
|
121
122
|
* Label for step up button
|
|
@@ -152,6 +153,13 @@ export const VvInputTextProps = {
|
|
|
152
153
|
type: String,
|
|
153
154
|
default: 'Clear',
|
|
154
155
|
},
|
|
156
|
+
/**
|
|
157
|
+
* Label for remove suggestion button
|
|
158
|
+
*/
|
|
159
|
+
labelRemoveSuggestion: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: 'Remove suggestion',
|
|
162
|
+
},
|
|
155
163
|
/**
|
|
156
164
|
* iMask options
|
|
157
165
|
* @see https://imask.js.org/guide.html
|
|
@@ -194,6 +202,13 @@ export const VvInputTextProps = {
|
|
|
194
202
|
type: Boolean,
|
|
195
203
|
default: false,
|
|
196
204
|
},
|
|
205
|
+
/**
|
|
206
|
+
* Maximum number of suggestions
|
|
207
|
+
*/
|
|
208
|
+
maxSuggestions: {
|
|
209
|
+
type: Number,
|
|
210
|
+
default: 5,
|
|
211
|
+
},
|
|
197
212
|
}
|
|
198
213
|
|
|
199
214
|
export type VvInputTextPropsTypes = ExtractPropTypes<typeof VvInputTextProps>
|
|
@@ -32,12 +32,14 @@
|
|
|
32
32
|
>
|
|
33
33
|
<slot>
|
|
34
34
|
<VvNavItem
|
|
35
|
-
v-for="({ on = {}, ...item }, index) in items"
|
|
35
|
+
v-for="({ on = {}, data, ...item }, index) in items"
|
|
36
36
|
:key="index"
|
|
37
37
|
:data-index="index"
|
|
38
38
|
v-bind="item"
|
|
39
39
|
v-on="on"
|
|
40
|
-
|
|
40
|
+
>
|
|
41
|
+
<slot name="item" v-bind="{ item, data, index }" />
|
|
42
|
+
</VvNavItem>
|
|
41
43
|
</slot>
|
|
42
44
|
</ul>
|
|
43
45
|
</nav>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractPropTypes
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
2
|
import type { InputGroupState } from '../../types/group'
|
|
3
3
|
import { CheckboxRadioProps } from '../../props'
|
|
4
4
|
import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
|
|
@@ -22,13 +22,13 @@ export function useGroupProps(
|
|
|
22
22
|
|
|
23
23
|
// global props
|
|
24
24
|
const modelValue = getGroupOrLocalRef('modelValue', props, emit)
|
|
25
|
-
const valid = getGroupOrLocalRef('valid', props)
|
|
26
|
-
const invalid = getGroupOrLocalRef('invalid', props)
|
|
25
|
+
const valid = getGroupOrLocalRef('valid', props)
|
|
26
|
+
const invalid = getGroupOrLocalRef('invalid', props)
|
|
27
27
|
const readonly = computed(() =>
|
|
28
|
-
Boolean(props.readonly || group?.
|
|
28
|
+
Boolean(props.readonly || group?.readonly.value),
|
|
29
29
|
)
|
|
30
30
|
const disabled = computed(() =>
|
|
31
|
-
Boolean(props.disabled || group?.
|
|
31
|
+
Boolean(props.disabled || group?.disabled.value),
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
return {
|
|
@@ -29,8 +29,7 @@
|
|
|
29
29
|
const { disabled, readonly, vertical, valid, invalid, modifiers } =
|
|
30
30
|
toRefs(props)
|
|
31
31
|
|
|
32
|
-
useProvideGroupState<InputGroupState>({
|
|
33
|
-
key: INJECTION_KEY_RADIO_GROUP,
|
|
32
|
+
useProvideGroupState<InputGroupState>(INJECTION_KEY_RADIO_GROUP, {
|
|
34
33
|
modelValue,
|
|
35
34
|
disabled,
|
|
36
35
|
readonly,
|
|
@@ -65,10 +65,7 @@
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
// icons
|
|
68
|
-
const {
|
|
69
|
-
icon,
|
|
70
|
-
iconPosition,
|
|
71
|
-
)
|
|
68
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
72
69
|
|
|
73
70
|
// dirty
|
|
74
71
|
const isDirty = computed(() => !isEmpty(props.modelValue))
|
|
@@ -100,8 +97,8 @@
|
|
|
100
97
|
loading: loading.value,
|
|
101
98
|
disabled: disabled.value,
|
|
102
99
|
readonly: readonly.value,
|
|
103
|
-
'icon-before': hasIconBefore.value,
|
|
104
|
-
'icon-after': hasIconAfter.value,
|
|
100
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
101
|
+
'icon-after': hasIconAfter.value !== undefined,
|
|
105
102
|
dirty: isDirty.value,
|
|
106
103
|
focus: focused.value,
|
|
107
104
|
floating: floating.value,
|
|
@@ -174,8 +171,8 @@
|
|
|
174
171
|
<div class="vv-select__inner">
|
|
175
172
|
<VvIcon
|
|
176
173
|
v-if="hasIconBefore"
|
|
174
|
+
v-bind="hasIconBefore"
|
|
177
175
|
class="vv-select__icon"
|
|
178
|
-
v-bind="hasIcon"
|
|
179
176
|
/>
|
|
180
177
|
<select
|
|
181
178
|
:id="hasId"
|
|
@@ -219,8 +216,8 @@
|
|
|
219
216
|
</select>
|
|
220
217
|
<VvIcon
|
|
221
218
|
v-if="hasIconAfter"
|
|
219
|
+
v-bind="hasIconAfter"
|
|
222
220
|
class="vv-select__icon vv-select__icon-after"
|
|
223
|
-
v-bind="hasIcon"
|
|
224
221
|
/>
|
|
225
222
|
</div>
|
|
226
223
|
<div v-if="$slots.after" class="vv-select__input-after">
|
|
@@ -59,7 +59,11 @@
|
|
|
59
59
|
modifiers: hasNavModifiers,
|
|
60
60
|
}"
|
|
61
61
|
@click="onNavClick"
|
|
62
|
-
|
|
62
|
+
>
|
|
63
|
+
<template #item="{ item, data, index }">
|
|
64
|
+
<slot name="nav-item" v-bind="{ item, data, index }" />
|
|
65
|
+
</template>
|
|
66
|
+
</VvNav>
|
|
63
67
|
<!-- #endregion -->
|
|
64
68
|
|
|
65
69
|
<!-- #region panels -->
|
|
@@ -52,10 +52,7 @@
|
|
|
52
52
|
const localModelValue = useDebouncedInput(modelValue, emit, debounce?.value)
|
|
53
53
|
|
|
54
54
|
// icons
|
|
55
|
-
const {
|
|
56
|
-
icon,
|
|
57
|
-
iconPosition,
|
|
58
|
-
)
|
|
55
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition)
|
|
59
56
|
|
|
60
57
|
// focus
|
|
61
58
|
const { focused } = useComponentFocus(textarea, emit)
|
|
@@ -113,11 +110,11 @@
|
|
|
113
110
|
loading: loading.value,
|
|
114
111
|
disabled: props.disabled,
|
|
115
112
|
readonly: props.readonly,
|
|
116
|
-
'icon-before': hasIconBefore.value,
|
|
117
|
-
'icon-after': hasIconAfter.value,
|
|
113
|
+
'icon-before': hasIconBefore.value !== undefined,
|
|
114
|
+
'icon-after': hasIconAfter.value !== undefined,
|
|
118
115
|
floating: props.floating && !isEmpty(props.label),
|
|
119
116
|
dirty: isDirty.value,
|
|
120
|
-
|
|
117
|
+
focus: focused.value,
|
|
121
118
|
resizable: props.resizable,
|
|
122
119
|
})),
|
|
123
120
|
)
|
|
@@ -180,8 +177,8 @@
|
|
|
180
177
|
<div class="vv-textarea__inner">
|
|
181
178
|
<VvIcon
|
|
182
179
|
v-if="hasIconBefore"
|
|
180
|
+
v-bind="hasIconBefore"
|
|
183
181
|
class="vv-textarea__icon"
|
|
184
|
-
v-bind="hasIcon"
|
|
185
182
|
/>
|
|
186
183
|
<textarea
|
|
187
184
|
:id="hasId"
|
|
@@ -192,8 +189,8 @@
|
|
|
192
189
|
/>
|
|
193
190
|
<VvIcon
|
|
194
191
|
v-if="hasIconAfter"
|
|
192
|
+
v-bind="hasIconAfter"
|
|
195
193
|
class="vv-textarea__icon vv-textarea__icon-after"
|
|
196
|
-
v-bind="hasIcon"
|
|
197
194
|
/>
|
|
198
195
|
</div>
|
|
199
196
|
<div v-if="$slots.after" class="vv-textarea__input-after">
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,9 @@ export { default as VvAccordion } from './VvAccordion/VvAccordion.vue'
|
|
|
2
2
|
export { default as VvAccordionGroup } from './VvAccordionGroup/VvAccordionGroup.vue'
|
|
3
3
|
export { default as VvAction } from './VvAction/VvAction.vue'
|
|
4
4
|
export { default as VvAlert } from './VvAlert/VvAlert.vue'
|
|
5
|
+
export { default as VvAlertGroup } from './VvAlertGroup/VvAlertGroup.vue'
|
|
6
|
+
export { default as VvAvatar } from './VvAvatar/VvAvatar.vue'
|
|
7
|
+
export { default as VvAvatarGroup } from './VvAvatarGroup/VvAvatarGroup.vue'
|
|
5
8
|
export { default as VvBadge } from './VvBadge/VvBadge.vue'
|
|
6
9
|
export { default as VvBreadcrumb } from './VvBreadcrumb/VvBreadcrumb.vue'
|
|
7
10
|
export { default as VvButton } from './VvButton/VvButton.vue'
|
|
@@ -12,9 +15,15 @@ export { default as VvCheckboxGroup } from './VvCheckboxGroup/VvCheckboxGroup.vu
|
|
|
12
15
|
export { default as VvCombobox } from './VvCombobox/VvCombobox.vue'
|
|
13
16
|
export { default as VvDialog } from './VvDialog/VvDialog.vue'
|
|
14
17
|
export { default as VvDropdown } from './VvDropdown/VvDropdown.vue'
|
|
18
|
+
export { default as VvDropdownAction } from './VvDropdown/VvDropdownAction.vue'
|
|
19
|
+
export { default as VvDropdownItem } from './VvDropdown/VvDropdownItem.vue'
|
|
20
|
+
export { default as VvDropdownOptgroup } from './VvDropdown/VvDropdownOptgroup.vue'
|
|
21
|
+
export { default as VvDropdownOption } from './VvDropdown/VvDropdownOption.vue'
|
|
15
22
|
export { default as VvIcon } from './VvIcon/VvIcon.vue'
|
|
16
23
|
export { default as VvInputText } from './VvInputText/VvInputText.vue'
|
|
17
24
|
export { default as VvNav } from './VvNav/VvNav.vue'
|
|
25
|
+
export { default as VvNavItem } from './VvNav/VvNavItem.vue'
|
|
26
|
+
export { default as VvNavSeparator } from './VvNav/VvNavSeparator.vue'
|
|
18
27
|
export { default as VvProgress } from './VvProgress/VvProgress.vue'
|
|
19
28
|
export { default as VvRadio } from './VvRadio/VvRadio.vue'
|
|
20
29
|
export { default as VvRadioGroup } from './VvRadioGroup/VvRadioGroup.vue'
|
|
@@ -22,3 +31,4 @@ export { default as VvSelect } from './VvSelect/VvSelect.vue'
|
|
|
22
31
|
export { default as VvTab } from './VvTab/VvTab.vue'
|
|
23
32
|
export { default as VvTextarea } from './VvTextarea/VvTextarea.vue'
|
|
24
33
|
export { default as VvTooltip } from './VvTooltip/VvTooltip.vue'
|
|
34
|
+
export { default as VvInputFile } from './VvInputFile/VvInputFile.vue'
|
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
DEFAULT_ALERT_INFO_ICON,
|
|
7
7
|
DefaultAlertIconMap,
|
|
8
8
|
} from '@/constants'
|
|
9
|
-
import type { Alert,
|
|
9
|
+
import type { Alert, AlertModifier } from '@/types/alert'
|
|
10
|
+
|
|
11
|
+
type AlertInGroup = Alert & { timestamp: number; group: string }
|
|
10
12
|
|
|
11
13
|
const groups = reactive(
|
|
12
|
-
new Map<string, Map<string,
|
|
13
|
-
[DEFAULT_ALERT_GROUP, new Map<string,
|
|
14
|
+
new Map<string, Map<string, AlertInGroup>>([
|
|
15
|
+
[DEFAULT_ALERT_GROUP, new Map<string, AlertInGroup>()],
|
|
14
16
|
]),
|
|
15
17
|
)
|
|
16
18
|
|
|
@@ -45,10 +47,11 @@ export const useAlert = () => {
|
|
|
45
47
|
modifiers = DEFAULT_ALERT_MODIFIERS,
|
|
46
48
|
dismissable = DEFAULT_ALERT_DISMISSABLE,
|
|
47
49
|
autoClose = DEFAULT_ALERT_AUTO_CLOSE,
|
|
48
|
-
|
|
50
|
+
timestamp = Date.now(),
|
|
51
|
+
} = {} as Partial<AlertInGroup>,
|
|
49
52
|
) => {
|
|
50
53
|
if (!groups.has(group)) {
|
|
51
|
-
groups.set(group, new Map<string,
|
|
54
|
+
groups.set(group, new Map<string, AlertInGroup>())
|
|
52
55
|
}
|
|
53
56
|
const groupMap = groups.get(group)
|
|
54
57
|
const normalizedModifiers =
|
|
@@ -56,8 +59,8 @@ export const useAlert = () => {
|
|
|
56
59
|
|
|
57
60
|
if (!icon) {
|
|
58
61
|
const alertModifier = normalizedModifiers.find((modifier) =>
|
|
59
|
-
DefaultAlertIconMap.has(modifier as
|
|
60
|
-
) as
|
|
62
|
+
DefaultAlertIconMap.has(modifier as AlertModifier),
|
|
63
|
+
) as AlertModifier | undefined
|
|
61
64
|
|
|
62
65
|
if (alertModifier) {
|
|
63
66
|
icon = DefaultAlertIconMap.get(alertModifier) as string
|
|
@@ -73,7 +76,7 @@ export const useAlert = () => {
|
|
|
73
76
|
modifiers,
|
|
74
77
|
dismissable,
|
|
75
78
|
autoClose,
|
|
76
|
-
timestamp
|
|
79
|
+
timestamp,
|
|
77
80
|
})
|
|
78
81
|
}
|
|
79
82
|
|
|
@@ -88,7 +91,7 @@ export const useAlert = () => {
|
|
|
88
91
|
return groupMap && groupMap instanceof Map
|
|
89
92
|
? Array.from(groupMap?.values()).sort(
|
|
90
93
|
(a, b) => a.timestamp - b.timestamp,
|
|
91
|
-
|
|
94
|
+
)
|
|
92
95
|
: []
|
|
93
96
|
})
|
|
94
97
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Ref, Fragment } from 'vue'
|
|
2
2
|
import mitt from 'mitt'
|
|
3
3
|
import {
|
|
4
|
+
type DropdownItemState,
|
|
4
5
|
INJECTION_KEY_DROPDOWN_TRIGGER,
|
|
5
6
|
INJECTION_KEY_DROPDOWN_ACTION,
|
|
6
7
|
INJECTION_KEY_DROPDOWN_ITEM,
|
|
@@ -61,10 +62,9 @@ export function useProvideDropdownTrigger({
|
|
|
61
62
|
*/
|
|
62
63
|
export function useProvideDropdownItem({
|
|
63
64
|
role,
|
|
64
|
-
|
|
65
|
-
}: {
|
|
65
|
+
...others
|
|
66
|
+
}: Omit<DropdownItemState, 'role'> & {
|
|
66
67
|
role: Ref<`${DropdownRole}`>
|
|
67
|
-
expanded: Ref<boolean>
|
|
68
68
|
}) {
|
|
69
69
|
const itemRole = computed(() =>
|
|
70
70
|
role.value === DropdownRole.listbox
|
|
@@ -73,7 +73,7 @@ export function useProvideDropdownItem({
|
|
|
73
73
|
)
|
|
74
74
|
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
75
75
|
role: itemRole,
|
|
76
|
-
|
|
76
|
+
...others,
|
|
77
77
|
})
|
|
78
78
|
return { itemRole }
|
|
79
79
|
}
|