@volverjs/ui-vue 0.0.10-beta.5 → 0.0.10-beta.50
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 +148 -51
- package/auto-imports.d.ts +25 -12
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +28 -20
- package/dist/Volver.d.ts +11 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +192 -104
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +29 -10
- package/dist/components/VvAccordion/index.d.ts +8 -9
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +485 -206
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +61 -18
- package/dist/components/VvAccordionGroup/index.d.ts +16 -8
- package/dist/components/VvAction/VvAction.es.js +84 -33
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +61 -28
- package/dist/components/VvAction/index.d.ts +26 -10
- package/dist/components/VvAlert/VvAlert.es.js +350 -318
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +25 -17
- package/dist/components/VvAlert/index.d.ts +20 -11
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +388 -327
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +22 -17
- package/dist/components/VvAlertGroup/index.d.ts +10 -18
- package/dist/components/VvAvatar/VvAvatar.es.js +66 -28
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +13 -5
- package/dist/components/VvAvatar/index.d.ts +4 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +147 -74
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +17 -10
- package/dist/components/VvAvatarGroup/index.d.ts +6 -3
- package/dist/components/VvBadge/VvBadge.es.js +78 -34
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +13 -5
- package/dist/components/VvBadge/index.d.ts +4 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +294 -83
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +28 -8
- package/dist/components/VvBreadcrumb/index.d.ts +6 -10
- package/dist/components/VvButton/VvButton.es.js +510 -488
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +97 -45
- package/dist/components/VvButton/index.d.ts +52 -30
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +95 -45
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +35 -17
- package/dist/components/VvButtonGroup/index.d.ts +13 -4
- package/dist/components/VvCard/VvCard.es.js +87 -42
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCard/VvCard.vue.d.ts +13 -5
- package/dist/components/VvCard/index.d.ts +4 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +177 -136
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +105 -35
- package/dist/components/VvCheckbox/index.d.ts +52 -19
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +408 -322
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +103 -34
- package/dist/components/VvCheckboxGroup/index.d.ts +45 -12
- package/dist/components/VvCombobox/VvCombobox.es.js +2304 -1992
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +258 -672
- package/dist/components/VvCombobox/index.d.ts +377 -135
- package/dist/components/VvDialog/VvDialog.es.js +177 -297
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +23 -7
- package/dist/components/VvDialog/index.d.ts +12 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +172 -102
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +110 -315
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +77 -28
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +13 -1
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +13 -5
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +38 -10
- package/dist/components/VvDropdown/index.d.ts +52 -118
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +165 -60
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +337 -10
- 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 +24 -102
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +4 -68
- 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 +317 -0
- package/dist/components/VvInputFile/index.d.ts +193 -0
- package/dist/components/VvInputText/VvInputClearAction.d.ts +16 -10
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +20 -14
- package/dist/components/VvInputText/VvInputStepAction.d.ts +11 -7
- package/dist/components/VvInputText/VvInputText.es.js +1491 -551
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +216 -68
- package/dist/components/VvInputText/index.d.ts +101 -31
- package/dist/components/VvNav/VvNav.es.js +155 -75
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNav/VvNav.vue.d.ts +32 -11
- 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 +100 -39
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +73 -27
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +13 -6
- package/dist/components/VvProgress/index.d.ts +4 -1
- package/dist/components/VvRadio/VvRadio.es.js +175 -135
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +103 -33
- package/dist/components/VvRadio/index.d.ts +50 -17
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +406 -321
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +103 -34
- package/dist/components/VvRadioGroup/index.d.ts +45 -12
- package/dist/components/VvSelect/VvSelect.es.js +677 -611
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +107 -199
- package/dist/components/VvSelect/index.d.ts +196 -16
- package/dist/components/VvTab/VvTab.es.js +230 -110
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTab/VvTab.vue.d.ts +34 -12
- package/dist/components/VvTab/index.d.ts +6 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +606 -597
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +159 -54
- package/dist/components/VvTextarea/index.d.ts +69 -20
- package/dist/components/VvTooltip/VvTooltip.es.js +83 -30
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +16 -9
- package/dist/components/VvTooltip/index.d.ts +5 -2
- package/dist/components/common/HintSlot.d.ts +8 -9
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.es.js +4086 -2029
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlerInject.d.ts +4 -0
- package/dist/composables/alert/useAlert.d.ts +71 -6
- package/dist/composables/alert/{useProvideAlert.d.ts → useAlertProvide.d.ts} +1 -1
- package/dist/composables/dropdown/useDropdownContextmenu.d.ts +18 -0
- package/dist/composables/dropdown/useDropdownInject.d.ts +12 -0
- package/dist/composables/dropdown/{useProvideDropdown.d.ts → useDropdownProvide.d.ts} +6 -7
- package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +17 -0
- package/dist/composables/group/useGroupStateInject.d.ts +9 -0
- package/dist/composables/group/useGroupStateProvide.d.ts +6 -0
- package/dist/composables/index.d.ts +3 -0
- package/dist/composables/index.es.js +178 -6
- package/dist/composables/index.umd.js +1 -1
- package/dist/composables/useBlurhash.d.ts +7 -0
- package/dist/composables/useComponentFocus.d.ts +2 -2
- package/dist/composables/useComponentIcon.d.ts +9 -8
- package/dist/composables/useOptions.d.ts +5 -5
- package/dist/composables/usePersistence.d.ts +3 -0
- package/dist/composables/useUniqueId.d.ts +2 -2
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +35 -33
- package/dist/directives/index.d.ts +3 -5
- package/dist/directives/index.es.js +247 -82
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +137 -31
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +101 -39
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +17 -17
- package/dist/icons.es.js +516 -516
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.es.js +74 -6
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +277 -193
- 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/Accordion/Accordion.settings.d.ts +2 -57
- package/dist/stories/AccordionGroup/AccordionGroup.settings.d.ts +2 -66
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -127
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +1304 -538
- package/dist/stories/Alert/Alert.settings.d.ts +2 -109
- package/dist/stories/AlertGroup/AlertGroup.settings.d.ts +2 -85
- package/dist/stories/AlertGroup/AlertGroupWithComposable.stories.d.ts +1 -1
- package/dist/stories/AvatarGroup/AvatarGroup.settings.d.ts +2 -38
- package/dist/stories/Badge/Badge.settings.d.ts +2 -26
- package/dist/stories/Badge/Badge.test.d.ts +1 -1
- package/dist/stories/Blurhash/BlurhashComposable.stories.d.ts +4 -0
- package/dist/stories/Breadcrumb/Breadcrumb.settings.d.ts +2 -18
- package/dist/stories/Breadcrumb/Breadcrumb.test.d.ts +1 -1
- package/dist/stories/Button/Button.settings.d.ts +2 -194
- package/dist/stories/ButtonGroup/ButtonGroup.settings.d.ts +2 -40
- package/dist/stories/Card/Card.settings.d.ts +2 -63
- package/dist/stories/Checkbox/Checkbox.settings.d.ts +2 -132
- package/dist/stories/CheckboxGroup/CheckboxGroup.settings.d.ts +1 -141
- package/dist/stories/Combobox/Combobox.settings.d.ts +2 -609
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/dist/stories/Combobox/ComboboxMultiple.stories.d.ts +1 -0
- package/dist/stories/Dialog/Dialog.settings.d.ts +2 -47
- package/dist/stories/Dialog/DialogModifiers.stories.d.ts +8 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +2 -205
- package/dist/stories/Icon/Icon.settings.d.ts +3 -68
- package/dist/stories/InputFile/InputFile.settings.d.ts +6 -0
- package/dist/stories/InputFile/InputFile.stories.d.ts +13 -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/InputText/InputText.settings.d.ts +2 -438
- package/dist/stories/Nav/Nav.settings.d.ts +2 -10
- package/dist/stories/Progress/Progress.settings.d.ts +2 -27
- package/dist/stories/Radio/Radio.settings.d.ts +1 -110
- package/dist/stories/RadioGroup/RadioGroup.settings.d.ts +1 -141
- package/dist/stories/Select/Select.settings.d.ts +2 -246
- package/dist/stories/Select/Select.stories.d.ts +1 -0
- package/dist/stories/Tab/Tab.settings.d.ts +2 -15
- package/dist/stories/Textarea/Textarea.settings.d.ts +2 -287
- package/dist/stories/argTypes.d.ts +27 -866
- package/dist/test/expect.d.ts +1 -2
- package/dist/test/options.d.ts +1 -1
- package/dist/test/sleep.d.ts +1 -1
- package/dist/types/alert.d.ts +9 -7
- package/dist/types/blurhash.d.ts +12 -0
- package/dist/types/floating-ui.d.ts +1 -1
- 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 +9 -0
- package/dist/types/nav.d.ts +2 -2
- package/dist/utils/DomUtilities.d.ts +1 -0
- package/dist/utils/ObjectUtilities.d.ts +8 -9
- package/dist/workers/blurhash.d.ts +1 -0
- package/package.json +238 -246
- package/src/Volver.ts +251 -246
- 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 +163 -100
- package/src/components/VvAccordion/index.ts +65 -80
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +224 -106
- package/src/components/VvAccordionGroup/index.ts +42 -42
- package/src/components/VvAction/VvAction.vue +144 -130
- package/src/components/VvAlert/VvAlert.vue +72 -70
- package/src/components/VvAlert/index.ts +149 -147
- package/src/components/VvAlertGroup/VvAlertGroup.vue +57 -56
- package/src/components/VvAlertGroup/index.ts +102 -118
- package/src/components/VvAvatar/VvAvatar.vue +20 -14
- package/src/components/VvAvatar/index.ts +5 -5
- package/src/components/VvAvatarGroup/VvAvatarGroup.vue +58 -53
- package/src/components/VvAvatarGroup/index.ts +21 -21
- package/src/components/VvBadge/VvBadge.vue +15 -14
- package/src/components/VvBadge/index.ts +2 -2
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +50 -48
- package/src/components/VvBreadcrumb/index.ts +3 -9
- package/src/components/VvButton/VvButton.vue +163 -152
- package/src/components/VvButton/index.ts +104 -111
- package/src/components/VvButtonGroup/VvButtonGroup.vue +73 -65
- package/src/components/VvButtonGroup/index.ts +23 -22
- package/src/components/VvCard/VvCard.vue +30 -30
- package/src/components/VvCard/index.ts +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +186 -184
- package/src/components/VvCheckbox/index.ts +45 -45
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +88 -87
- package/src/components/VvCombobox/VvCombobox.vue +655 -619
- package/src/components/VvCombobox/index.ts +210 -168
- package/src/components/VvDialog/VvDialog.vue +139 -129
- package/src/components/VvDialog/index.ts +42 -36
- package/src/components/VvDropdown/VvDropdown.vue +466 -445
- package/src/components/VvDropdown/VvDropdownAction.vue +37 -39
- package/src/components/VvDropdown/VvDropdownItem.vue +30 -26
- package/src/components/VvDropdown/VvDropdownOptgroup.vue +13 -12
- package/src/components/VvDropdown/VvDropdownOption.vue +47 -64
- package/src/components/VvDropdown/index.ts +61 -27
- package/src/components/VvIcon/README.md +1 -1
- package/src/components/VvIcon/VvIcon.vue +133 -133
- package/src/components/VvIcon/index.ts +84 -97
- package/src/components/VvInputFile/VvInputFile.vue +413 -0
- package/src/components/VvInputFile/index.ts +143 -0
- package/src/components/VvInputText/VvInputClearAction.ts +51 -47
- package/src/components/VvInputText/VvInputPasswordAction.ts +66 -62
- package/src/components/VvInputText/VvInputStepAction.ts +43 -43
- package/src/components/VvInputText/VvInputText.vue +652 -516
- package/src/components/VvInputText/VvInputTextActions.ts +87 -87
- package/src/components/VvInputText/index.ts +201 -186
- package/src/components/VvNav/VvNav.vue +40 -36
- package/src/components/VvNav/VvNavItem.vue +12 -12
- package/src/components/VvNav/VvNavSeparator.vue +6 -6
- package/src/components/VvNav/index.ts +2 -2
- package/src/components/VvProgress/VvProgress.vue +27 -27
- package/src/components/VvProgress/index.ts +28 -28
- package/src/components/VvRadio/VvRadio.vue +115 -112
- package/src/components/VvRadio/index.ts +29 -29
- package/src/components/VvRadioGroup/VvRadioGroup.vue +91 -90
- package/src/components/VvSelect/VvSelect.vue +262 -241
- package/src/components/VvSelect/index.ts +88 -63
- package/src/components/VvTab/VvTab.vue +79 -69
- package/src/components/VvTab/index.ts +13 -13
- package/src/components/VvTextarea/VvTextarea.vue +218 -219
- package/src/components/VvTextarea/index.ts +35 -35
- package/src/components/VvTooltip/VvTooltip.vue +22 -16
- package/src/components/VvTooltip/index.ts +12 -12
- package/src/components/common/HintSlot.ts +151 -152
- package/src/components/index.ts +10 -0
- package/src/composables/alert/{useInjectAlert.ts → useAlerInject.ts} +1 -1
- package/src/composables/alert/useAlert.ts +76 -73
- package/src/composables/alert/{useProvideAlert.ts → useAlertProvide.ts} +12 -12
- package/src/composables/dropdown/useDropdownContextmenu.ts +22 -0
- package/src/composables/dropdown/{useInjectDropdown.ts → useDropdownInject.ts} +6 -6
- package/src/composables/dropdown/useDropdownProvide.ts +94 -0
- package/src/composables/dropdown/useDropdownVirtualElement.ts +53 -0
- package/src/composables/group/useGroupStateInject.ts +55 -0
- package/src/composables/group/useGroupStateProvide.ts +14 -0
- package/src/composables/index.ts +3 -0
- package/src/composables/useBlurhash.ts +68 -0
- package/src/composables/useComponentFocus.ts +9 -9
- package/src/composables/useComponentIcon.ts +36 -35
- package/src/composables/useDebouncedInput.ts +25 -25
- package/src/composables/useDefaults.ts +81 -80
- package/src/composables/useModifiers.ts +29 -29
- package/src/composables/useOptions.ts +51 -42
- package/src/composables/usePersistence.ts +74 -0
- package/src/composables/useTextCount.ts +46 -46
- package/src/composables/useUniqueId.ts +4 -4
- package/src/composables/useVolver.ts +1 -1
- package/src/constants.ts +98 -83
- package/src/directives/index.ts +3 -6
- package/src/directives/v-contextmenu.ts +26 -34
- package/src/directives/v-tooltip.ts +20 -11
- package/src/icons.ts +2 -2
- package/src/index.ts +6 -4
- package/src/props/index.ts +461 -384
- package/src/resolvers/unplugin.ts +154 -144
- package/src/shims.d.ts +4 -5
- package/src/stories/Accordion/Accordion.settings.ts +51 -50
- package/src/stories/Accordion/Accordion.stories.ts +21 -21
- package/src/stories/Accordion/Accordion.test.ts +56 -54
- package/src/stories/Accordion/AccordionSlots.stories.ts +13 -13
- package/src/stories/AccordionGroup/AccordionGroup.settings.ts +70 -67
- package/src/stories/AccordionGroup/AccordionGroup.stories.ts +41 -39
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +49 -45
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +36 -36
- package/src/stories/Alert/Alert.settings.ts +117 -116
- package/src/stories/Alert/Alert.stories.ts +30 -30
- package/src/stories/Alert/Alert.test.ts +78 -80
- package/src/stories/Alert/AlertModifiers.stories.ts +45 -45
- package/src/stories/Alert/AlertSlots.stories.ts +35 -35
- package/src/stories/AlertGroup/AlertGroup.settings.ts +107 -105
- package/src/stories/AlertGroup/AlertGroup.stories.ts +25 -25
- package/src/stories/AlertGroup/AlertGroup.test.ts +69 -71
- package/src/stories/AlertGroup/AlertGroupPosition.stories.ts +68 -68
- package/src/stories/AlertGroup/AlertGroupSlots.stories.ts +23 -23
- package/src/stories/AlertGroup/AlertGroupWithComposable.stories.ts +58 -58
- package/src/stories/Avatar/Avatar.settings.ts +29 -29
- package/src/stories/Avatar/Avatar.stories.ts +22 -22
- package/src/stories/Avatar/Avatar.test.ts +22 -24
- package/src/stories/Avatar/AvatarBadge.stories.ts +15 -15
- package/src/stories/Avatar/AvatarModifiers.stories.ts +60 -60
- package/src/stories/Avatar/AvatarSlots.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.settings.ts +54 -53
- package/src/stories/AvatarGroup/AvatarGroup.stories.ts +17 -17
- package/src/stories/AvatarGroup/AvatarGroup.test.ts +24 -26
- package/src/stories/AvatarGroup/AvatarGroupModifiers.stories.ts +15 -15
- package/src/stories/AvatarGroup/AvatarGroupSlotDefault.stories.ts +17 -17
- package/src/stories/Badge/Badge.settings.ts +21 -20
- package/src/stories/Badge/Badge.stories.ts +24 -24
- package/src/stories/Badge/Badge.test.ts +8 -8
- package/src/stories/Badge/BadgeSlots.stories.ts +10 -10
- package/src/stories/Blurhash/BlurhashComposable.stories.ts +116 -0
- package/src/stories/Breadcrumb/Breadcrumb.settings.ts +35 -34
- package/src/stories/Breadcrumb/Breadcrumb.stories.ts +23 -23
- package/src/stories/Breadcrumb/Breadcrumb.test.ts +44 -43
- package/src/stories/Breadcrumb/BreadcrumbSlots.stories.ts +19 -19
- package/src/stories/Button/Button.settings.ts +147 -151
- package/src/stories/Button/Button.stories.ts +19 -19
- package/src/stories/Button/Button.test.ts +41 -42
- package/src/stories/Button/ButtonIcon.stories.ts +42 -42
- package/src/stories/Button/ButtonLink.stories.ts +24 -24
- package/src/stories/Button/ButtonLoading.stories.ts +22 -22
- package/src/stories/Button/ButtonModifiers.stories.ts +91 -91
- package/src/stories/Button/ButtonSlots.stories.ts +47 -47
- package/src/stories/Button/ButtonState.stories.ts +23 -23
- package/src/stories/Button/ButtonToggle.stories.ts +30 -30
- package/src/stories/ButtonGroup/ButtonGroup.settings.ts +33 -24
- package/src/stories/ButtonGroup/ButtonGroup.stories.ts +19 -19
- package/src/stories/ButtonGroup/ButtonGroup.test.ts +23 -26
- package/src/stories/ButtonGroup/ButtonGroupModifiers.stories.ts +20 -20
- package/src/stories/ButtonGroup/ButtonGroupSlots.stories.ts +17 -17
- package/src/stories/ButtonGroup/ButtonGroupToggle.stories.ts +22 -22
- package/src/stories/Card/Card.settings.ts +49 -48
- package/src/stories/Card/Card.stories.ts +22 -22
- package/src/stories/Card/Card.test.ts +14 -16
- package/src/stories/Card/CardSlots.stories.ts +42 -42
- package/src/stories/Checkbox/Checkbox.settings.ts +36 -35
- package/src/stories/Checkbox/Checkbox.stories.ts +57 -57
- package/src/stories/Checkbox/Checkbox.test.ts +63 -66
- package/src/stories/Checkbox/CheckboxBinary.stories.ts +18 -18
- package/src/stories/Checkbox/CheckboxSlots.stories.ts +15 -15
- package/src/stories/CheckboxGroup/CheckboxGroup.settings.ts +9 -9
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.ts +50 -50
- package/src/stories/CheckboxGroup/CheckboxGroup.test.ts +64 -68
- package/src/stories/CheckboxGroup/CheckboxGroupOptions.stories.ts +34 -34
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.ts +23 -23
- package/src/stories/Combobox/Combobox.settings.ts +408 -385
- package/src/stories/Combobox/Combobox.stories.ts +116 -107
- package/src/stories/Combobox/Combobox.test.ts +92 -92
- package/src/stories/Combobox/ComboboxIconPosition.stories.ts +25 -24
- package/src/stories/Combobox/ComboboxMultiple.stories.ts +32 -22
- package/src/stories/Combobox/ComboboxOptions.stories.ts +81 -84
- package/src/stories/Combobox/ComboboxSlots.stories.ts +55 -54
- package/src/stories/Dialog/Dialog.settings.ts +49 -40
- package/src/stories/Dialog/Dialog.stories.ts +28 -28
- package/src/stories/Dialog/Dialog.test.ts +49 -54
- package/src/stories/Dialog/DialogModifiers.stories.ts +42 -0
- package/src/stories/Dialog/DialogSlots.stories.ts +20 -20
- package/src/stories/Dropdown/Dropdown.settings.ts +62 -61
- package/src/stories/Dropdown/Dropdown.stories.ts +60 -60
- package/src/stories/Dropdown/Dropdown.test.ts +9 -13
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.ts +18 -19
- package/src/stories/Dropdown/DropdownMultilevel.stories.ts +19 -19
- package/src/stories/Dropdown/DropdownSlots.stories.ts +51 -51
- package/src/stories/Icon/Icon.settings.ts +66 -65
- package/src/stories/Icon/Icon.stories.ts +29 -30
- package/src/stories/Icon/IconsCollection.stories.ts +24 -24
- package/src/stories/InputFile/InputFile.settings.ts +37 -0
- package/src/stories/InputFile/InputFile.stories.ts +97 -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.settings.ts +248 -246
- package/src/stories/InputText/InputText.stories.ts +68 -68
- package/src/stories/InputText/InputText.test.ts +119 -122
- package/src/stories/InputText/InputTextIconPosition.stories.ts +24 -24
- package/src/stories/InputText/InputTextLength.stories.ts +33 -33
- package/src/stories/InputText/InputTextMask.stories.ts +91 -91
- package/src/stories/InputText/InputTextMinMax.stories.ts +30 -30
- package/src/stories/InputText/InputTextSlots.stories.ts +20 -20
- package/src/stories/InputText/InputTextType.stories.ts +70 -70
- package/src/stories/Nav/Nav.settings.ts +27 -27
- package/src/stories/Nav/Nav.stories.ts +18 -18
- package/src/stories/Nav/Nav.test.ts +10 -12
- package/src/stories/Nav/NavModifiers.stories.ts +25 -25
- package/src/stories/Progress/Progress.settings.ts +24 -23
- package/src/stories/Progress/Progress.stories.ts +23 -23
- package/src/stories/Progress/Progress.test.ts +5 -5
- package/src/stories/Radio/Radio.settings.ts +9 -9
- package/src/stories/Radio/Radio.stories.ts +47 -47
- package/src/stories/Radio/Radio.test.ts +54 -57
- package/src/stories/Radio/RadioSlots.stories.ts +15 -15
- package/src/stories/RadioGroup/RadioGroup.settings.ts +9 -9
- package/src/stories/RadioGroup/RadioGroup.stories.ts +51 -52
- package/src/stories/RadioGroup/RadioGroup.test.ts +64 -68
- package/src/stories/RadioGroup/RadioGroupOptions.stories.ts +35 -35
- package/src/stories/RadioGroup/RadioGroupSlots.stories.ts +23 -23
- package/src/stories/Select/Select.settings.ts +72 -71
- package/src/stories/Select/Select.stories.ts +75 -66
- package/src/stories/Select/Select.test.ts +67 -70
- package/src/stories/Select/SelectIconPosition.stories.ts +27 -26
- package/src/stories/Select/SelectOptions.stories.ts +55 -55
- package/src/stories/Select/SelectSlots.stories.ts +21 -20
- package/src/stories/Tab/Tab.settings.ts +34 -34
- package/src/stories/Tab/Tab.stories.ts +16 -16
- package/src/stories/Tab/Tab.test.ts +17 -19
- package/src/stories/Textarea/Textarea.settings.ts +80 -78
- package/src/stories/Textarea/Textarea.stories.ts +63 -63
- package/src/stories/Textarea/Textarea.test.ts +70 -73
- package/src/stories/Textarea/TextareaLength.stories.ts +33 -33
- package/src/stories/Textarea/TextareaSlots.stories.ts +20 -20
- package/src/stories/Textarea/TextareatIconPosition.stories.ts +24 -24
- package/src/stories/Tooltip/Tooltip.settings.ts +16 -17
- package/src/stories/Tooltip/Tooltip.stories.ts +18 -18
- package/src/stories/Tooltip/Tooltip.test.ts +53 -54
- package/src/stories/Tooltip/TooltipDirective.stories.ts +37 -37
- package/src/stories/argTypes.ts +506 -505
- package/src/test/expect.ts +74 -79
- package/src/test/options.ts +17 -16
- package/src/test/sleep.ts +3 -2
- package/src/test/types.d.ts +12 -12
- package/src/types/alert.ts +21 -17
- package/src/types/blurhash.ts +21 -0
- package/src/types/floating-ui.ts +1 -1
- package/src/types/generic.ts +2 -3
- package/src/types/group.ts +35 -27
- package/src/types/index.ts +7 -0
- package/src/types/input-file.ts +10 -0
- package/src/types/nav.ts +13 -14
- package/src/utils/DomUtilities.ts +15 -0
- package/src/utils/ObjectUtilities.ts +192 -188
- package/src/workers/blurhash.ts +9 -0
- package/dist/composables/alert/useInjectAlert.d.ts +0 -9
- package/dist/composables/dropdown/useInjectDropdown.d.ts +0 -32
- package/dist/composables/group/useInjectedGroupState.d.ts +0 -10
- package/dist/composables/group/useProvideGroupState.d.ts +0 -6
- package/src/composables/dropdown/useProvideDropdown.ts +0 -94
- package/src/composables/group/useInjectedGroupState.ts +0 -51
- package/src/composables/group/useProvideGroupState.ts +0 -20
- /package/src/assets/icons/normal/{dulicate.svg → duplicate.svg} +0 -0
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, isRef, defineComponent, h, unref, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, inject, toRef, getCurrentInstance, ref, watch, createBlock, resolveDynamicComponent, mergeProps, withCtx, mergeDefaults, createCommentVNode, useId, useAttrs, useSlots, Fragment, provide, onMounted, nextTick, createVNode, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, vShow, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
|
-
import {
|
|
5
|
-
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
4
|
+
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
6
5
|
import mitt from "mitt";
|
|
7
6
|
import { get } from "ts-dot-prop";
|
|
7
|
+
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
8
|
+
StorageType2["local"] = "local";
|
|
9
|
+
StorageType2["session"] = "session";
|
|
10
|
+
return StorageType2;
|
|
11
|
+
})(StorageType || {});
|
|
8
12
|
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
9
13
|
Strategy2["absolute"] = "absolute";
|
|
10
14
|
Strategy2["fixed"] = "fixed";
|
|
@@ -62,15 +66,10 @@ var DropdownItemRole = /* @__PURE__ */ ((DropdownItemRole2) => {
|
|
|
62
66
|
DropdownItemRole2["presentation"] = "presentation";
|
|
63
67
|
return DropdownItemRole2;
|
|
64
68
|
})(DropdownItemRole || {});
|
|
65
|
-
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
66
|
-
AnchorTarget2["_blank"] = "_blank";
|
|
67
|
-
AnchorTarget2["_self"] = "_self";
|
|
68
|
-
AnchorTarget2["_parent"] = "_parent";
|
|
69
|
-
AnchorTarget2["_top"] = "_top";
|
|
70
|
-
return AnchorTarget2;
|
|
71
|
-
})(AnchorTarget || {});
|
|
72
69
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
73
|
-
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
70
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
|
|
71
|
+
"buttonGroup"
|
|
72
|
+
);
|
|
74
73
|
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
|
|
75
74
|
"dropdownTrigger"
|
|
76
75
|
);
|
|
@@ -95,10 +94,7 @@ const LinkProps = {
|
|
|
95
94
|
/**
|
|
96
95
|
* Anchor target
|
|
97
96
|
*/
|
|
98
|
-
target:
|
|
99
|
-
type: String,
|
|
100
|
-
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
101
|
-
},
|
|
97
|
+
target: String,
|
|
102
98
|
/**
|
|
103
99
|
* Anchor rel
|
|
104
100
|
*/
|
|
@@ -111,27 +107,33 @@ const ValidProps = {
|
|
|
111
107
|
/**
|
|
112
108
|
* Valid status
|
|
113
109
|
*/
|
|
114
|
-
valid: Boolean,
|
|
110
|
+
valid: { type: Boolean, default: false },
|
|
115
111
|
/**
|
|
116
112
|
* Valid label
|
|
117
113
|
*/
|
|
118
|
-
validLabel: [String, Array]
|
|
114
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
119
115
|
};
|
|
120
116
|
const InvalidProps = {
|
|
121
117
|
/**
|
|
122
118
|
* Invalid status
|
|
123
119
|
*/
|
|
124
|
-
invalid:
|
|
120
|
+
invalid: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false
|
|
123
|
+
},
|
|
125
124
|
/**
|
|
126
125
|
* Invalid label
|
|
127
126
|
*/
|
|
128
|
-
invalidLabel: [String, Array]
|
|
127
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
129
128
|
};
|
|
130
129
|
const LoadingProps = {
|
|
131
130
|
/**
|
|
132
131
|
* Loading status
|
|
133
132
|
*/
|
|
134
|
-
loading:
|
|
133
|
+
loading: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false
|
|
136
|
+
},
|
|
135
137
|
/**
|
|
136
138
|
* Loading label
|
|
137
139
|
*/
|
|
@@ -144,49 +146,73 @@ const DisabledProps = {
|
|
|
144
146
|
/**
|
|
145
147
|
* Whether the form control is disabled
|
|
146
148
|
*/
|
|
147
|
-
disabled:
|
|
149
|
+
disabled: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
default: false
|
|
152
|
+
}
|
|
148
153
|
};
|
|
149
154
|
const SelectedProps = {
|
|
150
155
|
/**
|
|
151
156
|
* Whether the item is selected
|
|
152
157
|
*/
|
|
153
|
-
selected:
|
|
158
|
+
selected: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
default: false
|
|
161
|
+
}
|
|
154
162
|
};
|
|
155
163
|
const ActiveProps = {
|
|
156
164
|
/**
|
|
157
165
|
* Whether the item is active
|
|
158
166
|
*/
|
|
159
|
-
active:
|
|
167
|
+
active: {
|
|
168
|
+
type: Boolean,
|
|
169
|
+
default: false
|
|
170
|
+
}
|
|
160
171
|
};
|
|
161
172
|
const CurrentProps = {
|
|
162
173
|
/**
|
|
163
174
|
* Whether the item is current
|
|
164
175
|
*/
|
|
165
|
-
current:
|
|
176
|
+
current: {
|
|
177
|
+
type: Boolean,
|
|
178
|
+
default: false
|
|
179
|
+
}
|
|
166
180
|
};
|
|
167
181
|
const PressedProps = {
|
|
168
182
|
/**
|
|
169
183
|
* Whether the item is pressed
|
|
170
184
|
*/
|
|
171
|
-
pressed:
|
|
185
|
+
pressed: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: false
|
|
188
|
+
}
|
|
172
189
|
};
|
|
173
190
|
const LabelProps = {
|
|
174
191
|
/**
|
|
175
192
|
* The item label
|
|
176
193
|
*/
|
|
177
|
-
label:
|
|
194
|
+
label: {
|
|
195
|
+
type: [String, Number],
|
|
196
|
+
default: void 0
|
|
197
|
+
}
|
|
178
198
|
};
|
|
179
199
|
const ReadonlyProps = {
|
|
180
200
|
/**
|
|
181
201
|
* The value is not editable
|
|
182
202
|
*/
|
|
183
|
-
readonly:
|
|
203
|
+
readonly: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
default: false
|
|
206
|
+
}
|
|
184
207
|
};
|
|
185
208
|
const ModifiersProps = {
|
|
186
209
|
/**
|
|
187
210
|
* Component BEM modifiers
|
|
188
211
|
*/
|
|
189
|
-
modifiers:
|
|
212
|
+
modifiers: {
|
|
213
|
+
type: [String, Array],
|
|
214
|
+
default: void 0
|
|
215
|
+
}
|
|
190
216
|
};
|
|
191
217
|
const HintProps = {
|
|
192
218
|
hintLabel: { type: String, default: "" }
|
|
@@ -217,7 +243,10 @@ const IconProps = {
|
|
|
217
243
|
* VvIcon name or props
|
|
218
244
|
* @see VVIcon
|
|
219
245
|
*/
|
|
220
|
-
icon: {
|
|
246
|
+
icon: {
|
|
247
|
+
type: [String, Object],
|
|
248
|
+
default: void 0
|
|
249
|
+
},
|
|
221
250
|
/**
|
|
222
251
|
* VvIcon position
|
|
223
252
|
*/
|
|
@@ -238,7 +267,10 @@ const FloatingLabelProps = {
|
|
|
238
267
|
/**
|
|
239
268
|
* If true the label will be floating
|
|
240
269
|
*/
|
|
241
|
-
floating:
|
|
270
|
+
floating: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: false
|
|
273
|
+
}
|
|
242
274
|
};
|
|
243
275
|
const UnselectableProps = {
|
|
244
276
|
/**
|
|
@@ -274,7 +306,8 @@ const DropdownProps = {
|
|
|
274
306
|
* Dropdown show / hide transition name
|
|
275
307
|
*/
|
|
276
308
|
transitionName: {
|
|
277
|
-
type: String
|
|
309
|
+
type: String,
|
|
310
|
+
default: void 0
|
|
278
311
|
},
|
|
279
312
|
/**
|
|
280
313
|
* Offset of the dropdown from the trigger
|
|
@@ -342,7 +375,8 @@ const DropdownProps = {
|
|
|
342
375
|
* Set dropdown width to the same as the trigger
|
|
343
376
|
*/
|
|
344
377
|
triggerWidth: {
|
|
345
|
-
type: Boolean
|
|
378
|
+
type: Boolean,
|
|
379
|
+
default: false
|
|
346
380
|
}
|
|
347
381
|
};
|
|
348
382
|
const IdNameProps = {
|
|
@@ -359,7 +393,10 @@ const AutofocusProps = {
|
|
|
359
393
|
* Global attribute autofocus
|
|
360
394
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
361
395
|
*/
|
|
362
|
-
autofocus:
|
|
396
|
+
autofocus: {
|
|
397
|
+
type: Boolean,
|
|
398
|
+
default: false
|
|
399
|
+
}
|
|
363
400
|
};
|
|
364
401
|
const AutocompleteProps = {
|
|
365
402
|
/**
|
|
@@ -389,14 +426,23 @@ const ActionProps = {
|
|
|
389
426
|
ariaLabel: {
|
|
390
427
|
type: String,
|
|
391
428
|
default: void 0
|
|
429
|
+
},
|
|
430
|
+
/**
|
|
431
|
+
* Default tag for the action
|
|
432
|
+
*/
|
|
433
|
+
defaultTag: {
|
|
434
|
+
type: String,
|
|
435
|
+
default: ActionTag.button
|
|
392
436
|
}
|
|
393
437
|
};
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
438
|
+
({
|
|
439
|
+
storageType: {
|
|
440
|
+
type: String,
|
|
441
|
+
default: StorageType.local,
|
|
442
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
443
|
+
},
|
|
444
|
+
storageKey: String
|
|
445
|
+
});
|
|
400
446
|
const VvComboboxProps = {
|
|
401
447
|
...IdNameProps,
|
|
402
448
|
...TabindexProps,
|
|
@@ -410,7 +456,6 @@ const VvComboboxProps = {
|
|
|
410
456
|
...OptionsProps,
|
|
411
457
|
...IconProps,
|
|
412
458
|
...FloatingLabelProps,
|
|
413
|
-
...UnselectableProps,
|
|
414
459
|
...DropdownProps,
|
|
415
460
|
...LabelProps,
|
|
416
461
|
/**
|
|
@@ -488,10 +533,22 @@ const VvComboboxProps = {
|
|
|
488
533
|
* Manage modelValue as string[] or object[]
|
|
489
534
|
*/
|
|
490
535
|
multiple: Boolean,
|
|
536
|
+
/**
|
|
537
|
+
* The min number of selected values
|
|
538
|
+
*/
|
|
539
|
+
minValues: {
|
|
540
|
+
type: [Number, String],
|
|
541
|
+
default: 0
|
|
542
|
+
},
|
|
491
543
|
/**
|
|
492
544
|
* The max number of selected values
|
|
493
545
|
*/
|
|
494
546
|
maxValues: [Number, String],
|
|
547
|
+
/**
|
|
548
|
+
* If true the input will be unselectable
|
|
549
|
+
* @deprecated use minValues instead
|
|
550
|
+
*/
|
|
551
|
+
unselectable: { type: Boolean, default: true },
|
|
495
552
|
/**
|
|
496
553
|
* The select label separator visible to the user
|
|
497
554
|
*/
|
|
@@ -533,1879 +590,1985 @@ const VvComboboxProps = {
|
|
|
533
590
|
default: false
|
|
534
591
|
},
|
|
535
592
|
/**
|
|
536
|
-
*
|
|
593
|
+
* Select first option automatically
|
|
537
594
|
*/
|
|
538
|
-
|
|
595
|
+
autoselectFirst: {
|
|
539
596
|
type: Boolean,
|
|
540
597
|
default: false
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
const VvIconProps = {
|
|
544
|
-
/**
|
|
545
|
-
* Color
|
|
546
|
-
*/
|
|
547
|
-
color: String,
|
|
548
|
-
/**
|
|
549
|
-
* Width
|
|
550
|
-
*/
|
|
551
|
-
width: {
|
|
552
|
-
type: [String, Number]
|
|
553
|
-
},
|
|
554
|
-
/**
|
|
555
|
-
* Height
|
|
556
|
-
*/
|
|
557
|
-
height: {
|
|
558
|
-
type: [String, Number]
|
|
559
|
-
},
|
|
560
|
-
/**
|
|
561
|
-
* Icon name
|
|
562
|
-
* Can be the full composition of iconify name "@{provider}:{prefix}:{name}" or "{prefix}:{name}" or "{name}"
|
|
563
|
-
* https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
564
|
-
*/
|
|
565
|
-
name: {
|
|
566
|
-
type: String,
|
|
567
|
-
required: true
|
|
568
|
-
},
|
|
569
|
-
/**
|
|
570
|
-
* By default 'vv'
|
|
571
|
-
* If custom collection is not added with "addCollection" DS class method, this prop could not be used
|
|
572
|
-
* Icon provider: https://docs.iconify.design/api/providers.html#provider-in-icon-name
|
|
573
|
-
*/
|
|
574
|
-
provider: {
|
|
575
|
-
type: String
|
|
576
|
-
},
|
|
577
|
-
/**
|
|
578
|
-
* The name of icon set.
|
|
579
|
-
* Icon default options prefix: simple | normal | detailed
|
|
580
|
-
*/
|
|
581
|
-
prefix: {
|
|
582
|
-
type: String,
|
|
583
|
-
default: "normal"
|
|
584
598
|
},
|
|
585
599
|
/**
|
|
586
|
-
*
|
|
587
|
-
*/
|
|
588
|
-
src: String,
|
|
589
|
-
/**
|
|
590
|
-
* Horizontal flip
|
|
591
|
-
*/
|
|
592
|
-
horizontalFlip: Boolean,
|
|
593
|
-
/**
|
|
594
|
-
* Vertical flip
|
|
595
|
-
*/
|
|
596
|
-
verticalFlip: Boolean,
|
|
597
|
-
/**
|
|
598
|
-
* String alternative to "horizontalFlip" and "verticalFlip".
|
|
599
|
-
* Example: https://docs.iconify.design/icon-components/vue/transform.html
|
|
600
|
-
*/
|
|
601
|
-
flip: String,
|
|
602
|
-
/**
|
|
603
|
-
* Icon render mode
|
|
604
|
-
* 'style' = 'bg' or 'mask', depending on icon content
|
|
605
|
-
* 'bg' = span with style using `background`
|
|
606
|
-
* 'mask' = span with style using `mask`
|
|
607
|
-
* 'svg' = svg
|
|
608
|
-
* Iconify doc: https://docs.iconify.design/iconify-icon/modes.html
|
|
609
|
-
*/
|
|
610
|
-
mode: String,
|
|
611
|
-
/**
|
|
612
|
-
* Toggles inline or block mode
|
|
613
|
-
* Example https://docs.iconify.design/icon-components/vue/inline.html
|
|
614
|
-
*/
|
|
615
|
-
inline: Boolean,
|
|
616
|
-
/**
|
|
617
|
-
* rotates icon
|
|
618
|
-
* Example https://docs.iconify.design/icon-components/vue/transform.html
|
|
619
|
-
*/
|
|
620
|
-
rotate: [Number, String],
|
|
621
|
-
/**
|
|
622
|
-
* A callback that is called when icon data has been loaded
|
|
623
|
-
*/
|
|
624
|
-
onLoad: Function,
|
|
625
|
-
/**
|
|
626
|
-
* SVG icon string
|
|
627
|
-
*/
|
|
628
|
-
svg: String,
|
|
629
|
-
/**
|
|
630
|
-
* Icon modifiers: vv-icon css helper classes, value/s are concatened with prefix 'vv-icon--'
|
|
631
|
-
* @values string | string[]
|
|
600
|
+
* Keep open dropdown on single select
|
|
632
601
|
*/
|
|
633
|
-
|
|
634
|
-
type:
|
|
602
|
+
keepOpen: {
|
|
603
|
+
type: Boolean,
|
|
604
|
+
default: false
|
|
635
605
|
}
|
|
636
606
|
};
|
|
637
|
-
function
|
|
638
|
-
return
|
|
607
|
+
function useVvComboboxProps() {
|
|
608
|
+
return {
|
|
609
|
+
...VvComboboxProps,
|
|
610
|
+
options: {
|
|
611
|
+
...VvComboboxProps.options,
|
|
612
|
+
type: Array
|
|
613
|
+
},
|
|
614
|
+
searchFunction: {
|
|
615
|
+
...VvComboboxProps.searchFunction,
|
|
616
|
+
type: Function
|
|
617
|
+
}
|
|
618
|
+
};
|
|
639
619
|
}
|
|
640
|
-
function
|
|
641
|
-
return
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
620
|
+
function equals(obj1, obj2, field) {
|
|
621
|
+
return deepEquals(obj1, obj2);
|
|
622
|
+
}
|
|
623
|
+
function deepEquals(a, b) {
|
|
624
|
+
if (a === b)
|
|
625
|
+
return true;
|
|
626
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
627
|
+
const arrA = Array.isArray(a);
|
|
628
|
+
const arrB = Array.isArray(b);
|
|
629
|
+
let i, length, key;
|
|
630
|
+
if (arrA && arrB) {
|
|
631
|
+
length = a.length;
|
|
632
|
+
if (length !== b.length)
|
|
633
|
+
return false;
|
|
634
|
+
for (i = length; i-- !== 0; ) {
|
|
635
|
+
if (!deepEquals(a[i], b[i]))
|
|
636
|
+
return false;
|
|
653
637
|
}
|
|
638
|
+
return true;
|
|
654
639
|
}
|
|
655
|
-
if (
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
640
|
+
if (arrA !== arrB)
|
|
641
|
+
return false;
|
|
642
|
+
const dateA = a instanceof Date;
|
|
643
|
+
const dateB = b instanceof Date;
|
|
644
|
+
if (dateA !== dateB)
|
|
645
|
+
return false;
|
|
646
|
+
if (dateA && dateB)
|
|
647
|
+
return a.getTime() === b.getTime();
|
|
648
|
+
const regexpA = a instanceof RegExp;
|
|
649
|
+
const regexpB = b instanceof RegExp;
|
|
650
|
+
if (regexpA !== regexpB)
|
|
651
|
+
return false;
|
|
652
|
+
if (regexpA && regexpB)
|
|
653
|
+
return a.toString() === b.toString();
|
|
654
|
+
const keys = Object.keys(a);
|
|
655
|
+
length = keys.length;
|
|
656
|
+
if (length !== Object.keys(b).length)
|
|
657
|
+
return false;
|
|
658
|
+
for (i = length; i-- !== 0; ) {
|
|
659
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
660
|
+
return false;
|
|
659
661
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
+
for (i = length; i-- !== 0; ) {
|
|
663
|
+
key = keys[i];
|
|
664
|
+
if (!deepEquals(a[key], b[key]))
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
return Number.isNaN(a) && Number.isNaN(b);
|
|
662
670
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
props: VvIconProps,
|
|
669
|
-
setup(__props) {
|
|
670
|
-
const props = __props;
|
|
671
|
-
const hasRotate = computed(() => {
|
|
672
|
-
if (typeof props.rotate === "string") {
|
|
673
|
-
return parseFloat(props.rotate);
|
|
674
|
-
}
|
|
675
|
-
return props.rotate;
|
|
676
|
-
});
|
|
677
|
-
const show = ref(true);
|
|
678
|
-
const volver = useVolver();
|
|
679
|
-
const { modifiers } = toRefs(props);
|
|
680
|
-
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
681
|
-
const provider = computed(() => {
|
|
682
|
-
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
683
|
-
});
|
|
684
|
-
const icon = computed(() => {
|
|
685
|
-
const name = props.name ?? "";
|
|
686
|
-
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
687
|
-
if (iconExists(iconName)) {
|
|
688
|
-
return iconName;
|
|
689
|
-
}
|
|
690
|
-
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
691
|
-
(iconsCollection2) => {
|
|
692
|
-
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
693
|
-
return iconExists(icon2);
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
if (iconsCollection) {
|
|
697
|
-
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
698
|
-
}
|
|
699
|
-
return name;
|
|
700
|
-
});
|
|
701
|
-
function getSvgContent(svg) {
|
|
702
|
-
let dom;
|
|
703
|
-
if (typeof window === "undefined") {
|
|
704
|
-
const { JSDOM } = require("jsdom");
|
|
705
|
-
dom = new JSDOM().window;
|
|
671
|
+
function contains(value, list) {
|
|
672
|
+
if (value != null && list && list.length) {
|
|
673
|
+
for (const val of list) {
|
|
674
|
+
if (equals(value, val)) {
|
|
675
|
+
return true;
|
|
706
676
|
}
|
|
707
|
-
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
708
|
-
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
709
|
-
const svgEl = svgDomString.querySelector("svg");
|
|
710
|
-
return svgEl;
|
|
711
677
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
678
|
+
}
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
function isString(value) {
|
|
682
|
+
return typeof value === "string" || value instanceof String;
|
|
683
|
+
}
|
|
684
|
+
function joinLines(items) {
|
|
685
|
+
if (Array.isArray(items)) {
|
|
686
|
+
return items.filter((item) => isString(item)).join(" ");
|
|
687
|
+
}
|
|
688
|
+
return items;
|
|
689
|
+
}
|
|
690
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
691
|
+
const props = computed(() => {
|
|
692
|
+
if (isRef(propsOrRef)) {
|
|
693
|
+
return propsOrRef.value;
|
|
723
694
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
695
|
+
return propsOrRef;
|
|
696
|
+
});
|
|
697
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
698
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
699
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
700
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
701
|
+
const hasLoadingLabelOrSlot = computed(
|
|
702
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
703
|
+
);
|
|
704
|
+
const hasInvalidLabelOrSlot = computed(
|
|
705
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
706
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
707
|
+
)
|
|
708
|
+
);
|
|
709
|
+
const hasValidLabelOrSlot = computed(
|
|
710
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
711
|
+
);
|
|
712
|
+
const hasHintLabelOrSlot = computed(
|
|
713
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
714
|
+
);
|
|
715
|
+
const isVisible = computed(
|
|
716
|
+
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
717
|
+
);
|
|
718
|
+
const hintSlotScope = computed(() => ({
|
|
719
|
+
modelValue: props.value.modelValue,
|
|
720
|
+
valid: props.value.valid,
|
|
721
|
+
invalid: props.value.invalid,
|
|
722
|
+
loading: props.value.loading
|
|
723
|
+
}));
|
|
724
|
+
const HintSlot = defineComponent({
|
|
725
|
+
name: "HintSlot",
|
|
726
|
+
props: {
|
|
727
|
+
tag: {
|
|
728
|
+
type: String,
|
|
729
|
+
default: "small"
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
setup() {
|
|
733
|
+
return {
|
|
734
|
+
isVisible,
|
|
735
|
+
invalidLabel,
|
|
736
|
+
validLabel,
|
|
737
|
+
loadingLabel,
|
|
738
|
+
hintLabel,
|
|
739
|
+
hasInvalidLabelOrSlot,
|
|
740
|
+
hasValidLabelOrSlot,
|
|
741
|
+
hasLoadingLabelOrSlot,
|
|
742
|
+
hasHintLabelOrSlot
|
|
743
|
+
};
|
|
744
|
+
},
|
|
745
|
+
render() {
|
|
746
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
747
|
+
if (this.isVisible) {
|
|
748
|
+
let role;
|
|
749
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
750
|
+
role = "alert";
|
|
751
|
+
}
|
|
752
|
+
if (this.hasValidLabelOrSlot) {
|
|
753
|
+
role = "status";
|
|
754
|
+
}
|
|
755
|
+
if (this.hasLoadingLabelOrSlot) {
|
|
756
|
+
return h(
|
|
757
|
+
this.tag,
|
|
758
|
+
{
|
|
759
|
+
role
|
|
760
|
+
},
|
|
761
|
+
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
765
|
+
return h(
|
|
766
|
+
this.tag,
|
|
767
|
+
{
|
|
768
|
+
role
|
|
769
|
+
},
|
|
770
|
+
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
771
|
+
);
|
|
772
|
+
}
|
|
773
|
+
if (this.hasValidLabelOrSlot) {
|
|
774
|
+
return h(
|
|
775
|
+
this.tag,
|
|
776
|
+
{
|
|
777
|
+
role
|
|
778
|
+
},
|
|
779
|
+
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
return h(
|
|
783
|
+
this.tag,
|
|
784
|
+
{
|
|
785
|
+
role
|
|
786
|
+
},
|
|
787
|
+
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
788
|
+
);
|
|
735
789
|
}
|
|
790
|
+
return null;
|
|
736
791
|
}
|
|
737
|
-
|
|
738
|
-
|
|
792
|
+
});
|
|
793
|
+
return {
|
|
794
|
+
hasInvalidLabelOrSlot,
|
|
795
|
+
hasHintLabelOrSlot,
|
|
796
|
+
hasValidLabelOrSlot,
|
|
797
|
+
hasLoadingLabelOrSlot,
|
|
798
|
+
hintSlotScope,
|
|
799
|
+
HintSlot
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
const VvBadgeProps = {
|
|
803
|
+
...ModifiersProps,
|
|
804
|
+
value: [String, Number]
|
|
805
|
+
};
|
|
806
|
+
function useModifiers(prefix, modifiers, others) {
|
|
807
|
+
return computed(() => {
|
|
808
|
+
const toReturn = {
|
|
809
|
+
[prefix]: true
|
|
810
|
+
};
|
|
811
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
812
|
+
if (modifiersArray) {
|
|
813
|
+
if (Array.isArray(modifiersArray)) {
|
|
814
|
+
modifiersArray.forEach((modifier) => {
|
|
815
|
+
if (modifier) {
|
|
816
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
817
|
+
}
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (others) {
|
|
822
|
+
Object.keys(others.value).forEach((key) => {
|
|
823
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
824
|
+
});
|
|
739
825
|
}
|
|
826
|
+
return toReturn;
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
const __default__$9 = {
|
|
830
|
+
name: "VvBadge"
|
|
831
|
+
};
|
|
832
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
833
|
+
...__default__$9,
|
|
834
|
+
props: VvBadgeProps,
|
|
835
|
+
setup(__props) {
|
|
836
|
+
const props = __props;
|
|
837
|
+
const { modifiers } = toRefs(props);
|
|
838
|
+
const bemCssClasses = useModifiers("vv-badge", modifiers);
|
|
740
839
|
return (_ctx, _cache) => {
|
|
741
|
-
return
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
840
|
+
return openBlock(), createElementBlock(
|
|
841
|
+
"span",
|
|
842
|
+
{
|
|
843
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
844
|
+
},
|
|
845
|
+
[
|
|
846
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
847
|
+
createTextVNode(
|
|
848
|
+
toDisplayString(_ctx.value),
|
|
849
|
+
1
|
|
850
|
+
/* TEXT */
|
|
851
|
+
)
|
|
852
|
+
])
|
|
853
|
+
],
|
|
854
|
+
2
|
|
855
|
+
/* CLASS */
|
|
856
|
+
);
|
|
756
857
|
};
|
|
757
858
|
}
|
|
758
859
|
});
|
|
759
|
-
|
|
860
|
+
function useGroupStateInject(groupKey) {
|
|
861
|
+
const group = inject(groupKey, void 0);
|
|
862
|
+
const isInGroup = computed(() => group !== void 0);
|
|
863
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
864
|
+
const groupPropValue = group == null ? void 0 : group[propName];
|
|
865
|
+
if (groupPropValue) {
|
|
866
|
+
return computed({
|
|
867
|
+
get() {
|
|
868
|
+
return groupPropValue.value;
|
|
869
|
+
},
|
|
870
|
+
set(value) {
|
|
871
|
+
groupPropValue.value = value;
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
const propRef = toRef(props, propName);
|
|
876
|
+
return computed({
|
|
877
|
+
get() {
|
|
878
|
+
return propRef.value;
|
|
879
|
+
},
|
|
880
|
+
set(value) {
|
|
881
|
+
if (emit) {
|
|
882
|
+
emit(`update:${propName}`, value);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
return {
|
|
888
|
+
group,
|
|
889
|
+
isInGroup,
|
|
890
|
+
getGroupOrLocalRef
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
const VvButtonEvents = ["update:modelValue"];
|
|
894
|
+
const VvButtonProps = {
|
|
895
|
+
...ActionProps,
|
|
760
896
|
...IdProps,
|
|
761
|
-
...DropdownProps,
|
|
762
897
|
...ModifiersProps,
|
|
898
|
+
...UnselectableProps,
|
|
899
|
+
...LoadingProps,
|
|
900
|
+
...IconProps,
|
|
763
901
|
/**
|
|
764
|
-
*
|
|
902
|
+
* Button icon position
|
|
765
903
|
*/
|
|
766
|
-
|
|
904
|
+
iconPosition: {
|
|
905
|
+
type: String,
|
|
906
|
+
default: Side.left,
|
|
907
|
+
validator: (value) => Object.values(Side).includes(value)
|
|
908
|
+
},
|
|
909
|
+
/**
|
|
910
|
+
* Loading icon
|
|
911
|
+
*/
|
|
912
|
+
loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
|
|
913
|
+
/**
|
|
914
|
+
* Enable button toggle
|
|
915
|
+
*/
|
|
916
|
+
toggle: {
|
|
767
917
|
type: Boolean,
|
|
918
|
+
default: false
|
|
919
|
+
},
|
|
920
|
+
/**
|
|
921
|
+
* Button toggle value
|
|
922
|
+
*/
|
|
923
|
+
value: {
|
|
924
|
+
type: [String, Number, Boolean],
|
|
768
925
|
default: void 0
|
|
769
926
|
},
|
|
770
927
|
/**
|
|
771
|
-
*
|
|
928
|
+
* Value associated with the unchecked state
|
|
772
929
|
*/
|
|
773
|
-
|
|
774
|
-
type:
|
|
775
|
-
default:
|
|
930
|
+
uncheckedValue: {
|
|
931
|
+
type: [String, Number, Boolean],
|
|
932
|
+
default: void 0
|
|
776
933
|
},
|
|
777
934
|
/**
|
|
778
|
-
*
|
|
935
|
+
* Button toggle model value
|
|
779
936
|
*/
|
|
780
|
-
|
|
781
|
-
type: String,
|
|
782
|
-
default:
|
|
783
|
-
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
937
|
+
modelValue: {
|
|
938
|
+
type: [String, Number, Boolean],
|
|
939
|
+
default: void 0
|
|
784
940
|
}
|
|
785
941
|
};
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
942
|
+
function useGroupProps(props, emit) {
|
|
943
|
+
const { group, isInGroup, getGroupOrLocalRef } = useGroupStateInject(INJECTION_KEY_BUTTON_GROUP);
|
|
944
|
+
const { id, iconPosition, icon, label, pressed } = toRefs(props);
|
|
945
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
946
|
+
const toggle = getGroupOrLocalRef("toggle", props);
|
|
947
|
+
const unselectable = getGroupOrLocalRef("unselectable", props);
|
|
948
|
+
const multiple = computed(() => (group == null ? void 0 : group.multiple.value) ?? false);
|
|
949
|
+
const modifiers = computed(() => {
|
|
950
|
+
let localModifiers = props.modifiers;
|
|
951
|
+
let groupModifiers = group == null ? void 0 : group.modifiers.value;
|
|
952
|
+
const toReturn = /* @__PURE__ */ new Set();
|
|
953
|
+
if (localModifiers) {
|
|
954
|
+
if (!Array.isArray(localModifiers)) {
|
|
955
|
+
localModifiers = localModifiers.split(" ");
|
|
956
|
+
}
|
|
957
|
+
localModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
958
|
+
}
|
|
959
|
+
if (groupModifiers) {
|
|
960
|
+
if (!Array.isArray(groupModifiers)) {
|
|
961
|
+
groupModifiers = groupModifiers.split(" ");
|
|
962
|
+
}
|
|
963
|
+
groupModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
808
964
|
}
|
|
965
|
+
return Array.from(toReturn);
|
|
809
966
|
});
|
|
967
|
+
const disabled = computed(
|
|
968
|
+
() => Boolean(props.disabled || (group == null ? void 0 : group.disabled.value))
|
|
969
|
+
);
|
|
810
970
|
return {
|
|
811
|
-
|
|
812
|
-
|
|
971
|
+
// group props
|
|
972
|
+
group,
|
|
973
|
+
isInGroup,
|
|
974
|
+
modelValue,
|
|
975
|
+
toggle,
|
|
976
|
+
unselectable,
|
|
977
|
+
multiple,
|
|
978
|
+
modifiers,
|
|
979
|
+
disabled,
|
|
980
|
+
// local props
|
|
981
|
+
id,
|
|
982
|
+
pressed,
|
|
983
|
+
iconPosition,
|
|
984
|
+
icon,
|
|
985
|
+
label
|
|
813
986
|
};
|
|
814
987
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
const itemRole = computed(
|
|
820
|
-
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
821
|
-
);
|
|
822
|
-
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
823
|
-
role: itemRole,
|
|
824
|
-
expanded
|
|
825
|
-
});
|
|
826
|
-
return { itemRole };
|
|
988
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
989
|
+
const VvActionProps = ActionProps;
|
|
990
|
+
function useVolver() {
|
|
991
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
827
992
|
}
|
|
828
|
-
function
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
993
|
+
function useInjectedDropdownTrigger() {
|
|
994
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
995
|
+
}
|
|
996
|
+
function useInjectedDropdownItem() {
|
|
997
|
+
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
998
|
+
}
|
|
999
|
+
function useInjectedDropdownAction() {
|
|
1000
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
835
1001
|
}
|
|
836
|
-
const _hoisted_1$5 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
837
1002
|
const __default__$8 = {
|
|
838
|
-
name: "
|
|
839
|
-
inheritAttrs: false
|
|
1003
|
+
name: "VvAction"
|
|
840
1004
|
};
|
|
841
1005
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
842
1006
|
...__default__$8,
|
|
843
|
-
props:
|
|
844
|
-
emits:
|
|
845
|
-
|
|
846
|
-
"beforeExpand",
|
|
847
|
-
"beforeCollapse",
|
|
848
|
-
"afterExpand",
|
|
849
|
-
"afterCollapse",
|
|
850
|
-
"before-enter",
|
|
851
|
-
"after-leave",
|
|
852
|
-
"enter",
|
|
853
|
-
"after-enter",
|
|
854
|
-
"enter-cancelled",
|
|
855
|
-
"before-leave",
|
|
856
|
-
"leave",
|
|
857
|
-
"leave-cancelled"
|
|
858
|
-
],
|
|
859
|
-
setup(__props, { expose: __expose, emit }) {
|
|
1007
|
+
props: VvActionProps,
|
|
1008
|
+
emits: VvActionEvents,
|
|
1009
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
860
1010
|
const props = __props;
|
|
861
|
-
const
|
|
862
|
-
const
|
|
863
|
-
const
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
onMounted(() => {
|
|
878
|
-
useMutationObserver(
|
|
879
|
-
floatingEl.value,
|
|
880
|
-
() => {
|
|
881
|
-
var _a;
|
|
882
|
-
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
883
|
-
},
|
|
884
|
-
{
|
|
885
|
-
attributeFilter: ["style"],
|
|
886
|
-
window
|
|
887
|
-
}
|
|
888
|
-
);
|
|
889
|
-
});
|
|
890
|
-
const middleware = computed(() => {
|
|
891
|
-
const toReturn = [];
|
|
892
|
-
if (props.autoPlacement) {
|
|
893
|
-
if (typeof props.autoPlacement === "boolean") {
|
|
894
|
-
toReturn.push(autoPlacement());
|
|
895
|
-
} else {
|
|
896
|
-
toReturn.push(
|
|
897
|
-
autoPlacement(props.autoPlacement)
|
|
898
|
-
);
|
|
899
|
-
}
|
|
900
|
-
} else if (props.flip) {
|
|
901
|
-
if (typeof props.flip === "boolean") {
|
|
902
|
-
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
903
|
-
} else {
|
|
904
|
-
toReturn.push(flip(props.flip));
|
|
1011
|
+
const emit = __emit;
|
|
1012
|
+
const instance = getCurrentInstance();
|
|
1013
|
+
const volver = useVolver();
|
|
1014
|
+
const element = ref(null);
|
|
1015
|
+
__expose({ $el: element });
|
|
1016
|
+
const {
|
|
1017
|
+
reference: dropdownTriggerReference,
|
|
1018
|
+
bus: dropdownEventBus,
|
|
1019
|
+
aria: dropdownAria,
|
|
1020
|
+
expanded: dropdownExpanded
|
|
1021
|
+
} = useInjectedDropdownTrigger();
|
|
1022
|
+
watch(
|
|
1023
|
+
() => element.value,
|
|
1024
|
+
(newValue) => {
|
|
1025
|
+
if (dropdownTriggerReference) {
|
|
1026
|
+
dropdownTriggerReference.value = newValue;
|
|
905
1027
|
}
|
|
906
1028
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1029
|
+
);
|
|
1030
|
+
const pressed = computed(() => {
|
|
1031
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
1032
|
+
});
|
|
1033
|
+
const { role } = useInjectedDropdownAction();
|
|
1034
|
+
const hasTag = computed(() => {
|
|
1035
|
+
switch (true) {
|
|
1036
|
+
case props.disabled:
|
|
1037
|
+
return ActionTag.button;
|
|
1038
|
+
case props.to !== void 0:
|
|
1039
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
1040
|
+
case props.href !== void 0:
|
|
1041
|
+
return ActionTag.a;
|
|
1042
|
+
default:
|
|
1043
|
+
return props.defaultTag;
|
|
913
1044
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1045
|
+
});
|
|
1046
|
+
const hasProps = computed(() => {
|
|
1047
|
+
const toReturn = {
|
|
1048
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
1049
|
+
ariaPressed: pressed.value ? true : void 0,
|
|
1050
|
+
ariaLabel: props.ariaLabel,
|
|
1051
|
+
role: role == null ? void 0 : role.value
|
|
1052
|
+
};
|
|
1053
|
+
switch (hasTag.value) {
|
|
1054
|
+
case ActionTag.a:
|
|
1055
|
+
return {
|
|
1056
|
+
...toReturn,
|
|
1057
|
+
href: props.href,
|
|
1058
|
+
target: props.target,
|
|
1059
|
+
rel: props.rel
|
|
1060
|
+
};
|
|
1061
|
+
case ActionTag.routerLink:
|
|
1062
|
+
case ActionTag.nuxtLink:
|
|
1063
|
+
return {
|
|
1064
|
+
...toReturn,
|
|
1065
|
+
to: props.to,
|
|
1066
|
+
target: props.target
|
|
1067
|
+
};
|
|
1068
|
+
case ActionTag.button:
|
|
1069
|
+
return {
|
|
1070
|
+
...toReturn,
|
|
1071
|
+
type: props.type,
|
|
1072
|
+
disabled: props.disabled
|
|
1073
|
+
};
|
|
1074
|
+
default:
|
|
1075
|
+
return toReturn;
|
|
936
1076
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
1077
|
+
});
|
|
1078
|
+
function onClick(e) {
|
|
1079
|
+
var _a;
|
|
1080
|
+
if (props.disabled) {
|
|
1081
|
+
e.preventDefault();
|
|
1082
|
+
return;
|
|
944
1083
|
}
|
|
945
|
-
if (props.
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
element: arrowEl
|
|
949
|
-
})
|
|
950
|
-
);
|
|
1084
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onClick) {
|
|
1085
|
+
emit("click", e);
|
|
1086
|
+
return;
|
|
951
1087
|
}
|
|
952
|
-
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
return autoUpdate(...args, {
|
|
960
|
-
animationFrame: props.strategy === Strategy.fixed
|
|
961
|
-
});
|
|
962
|
-
},
|
|
963
|
-
placement: computed(() => props.placement),
|
|
964
|
-
strategy: computed(() => props.strategy),
|
|
965
|
-
middleware
|
|
1088
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
1089
|
+
}
|
|
1090
|
+
function onMouseover(e) {
|
|
1091
|
+
var _a;
|
|
1092
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseover) {
|
|
1093
|
+
emit("mouseover", e);
|
|
1094
|
+
return;
|
|
966
1095
|
}
|
|
967
|
-
|
|
968
|
-
|
|
1096
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
1097
|
+
}
|
|
1098
|
+
function onMouseleave(e) {
|
|
969
1099
|
var _a;
|
|
970
|
-
if (
|
|
971
|
-
|
|
1100
|
+
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseleave) {
|
|
1101
|
+
emit("mouseleave", e);
|
|
1102
|
+
return;
|
|
972
1103
|
}
|
|
973
|
-
|
|
974
|
-
return {
|
|
975
|
-
position: strategy.value,
|
|
976
|
-
top: `${y.value ?? 0}px`,
|
|
977
|
-
left: `${x.value ?? 0}px`,
|
|
978
|
-
maxWidth: width ? void 0 : maxWidth.value,
|
|
979
|
-
maxHeight: maxHeight.value,
|
|
980
|
-
width
|
|
981
|
-
};
|
|
982
|
-
});
|
|
983
|
-
const side = computed(
|
|
984
|
-
() => placement.value.split("-")[0]
|
|
985
|
-
);
|
|
986
|
-
const arrowPlacement = computed(() => {
|
|
987
|
-
var _a, _b, _c, _d, _e;
|
|
988
|
-
if (hasCustomPosition.value) {
|
|
989
|
-
return void 0;
|
|
990
|
-
}
|
|
991
|
-
const staticSide = {
|
|
992
|
-
[Side.top]: Side.bottom,
|
|
993
|
-
[Side.right]: Side.left,
|
|
994
|
-
[Side.bottom]: Side.top,
|
|
995
|
-
[Side.left]: Side.right
|
|
996
|
-
}[side.value];
|
|
997
|
-
return {
|
|
998
|
-
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
999
|
-
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
1000
|
-
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
1001
|
-
};
|
|
1002
|
-
});
|
|
1003
|
-
const modelValue = useVModel(props, "modelValue", emit);
|
|
1004
|
-
const localModelValue = ref(false);
|
|
1005
|
-
const expanded = computed({
|
|
1006
|
-
get: () => modelValue.value ?? localModelValue.value,
|
|
1007
|
-
set: (newValue) => {
|
|
1008
|
-
if (modelValue.value === void 0) {
|
|
1009
|
-
localModelValue.value = newValue;
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
modelValue.value = newValue;
|
|
1013
|
-
}
|
|
1014
|
-
});
|
|
1015
|
-
const show = () => {
|
|
1016
|
-
expanded.value = true;
|
|
1017
|
-
};
|
|
1018
|
-
const hide = () => {
|
|
1019
|
-
expanded.value = false;
|
|
1020
|
-
};
|
|
1021
|
-
const toggle = () => {
|
|
1022
|
-
expanded.value = !expanded.value;
|
|
1023
|
-
};
|
|
1024
|
-
const init = (el) => {
|
|
1025
|
-
referenceEl.value = el;
|
|
1026
|
-
};
|
|
1027
|
-
__expose({
|
|
1028
|
-
toggle,
|
|
1029
|
-
show,
|
|
1030
|
-
hide,
|
|
1031
|
-
init,
|
|
1032
|
-
customPosition: hasCustomPosition
|
|
1033
|
-
});
|
|
1034
|
-
watch(expanded, (newValue) => {
|
|
1035
|
-
if (newValue && props.autofocusFirst) {
|
|
1036
|
-
nextTick(() => {
|
|
1037
|
-
const focusableElements = getKeyboardFocusableElements(
|
|
1038
|
-
floatingEl.value
|
|
1039
|
-
);
|
|
1040
|
-
if (focusableElements.length > 0) {
|
|
1041
|
-
focusableElements[0].focus({
|
|
1042
|
-
preventScroll: true
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
onClickOutside(
|
|
1049
|
-
floatingEl,
|
|
1050
|
-
() => {
|
|
1051
|
-
if (!props.keepOpen && expanded.value) {
|
|
1052
|
-
expanded.value = false;
|
|
1053
|
-
}
|
|
1054
|
-
},
|
|
1055
|
-
{ ignore: [referenceEl] }
|
|
1056
|
-
);
|
|
1057
|
-
const hasAriaLabelledby = computed(() => {
|
|
1058
|
-
var _a, _b;
|
|
1059
|
-
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
1060
|
-
});
|
|
1061
|
-
const referenceAria = computed(() => ({
|
|
1062
|
-
"aria-controls": hasId.value,
|
|
1063
|
-
"aria-haspopup": true,
|
|
1064
|
-
"aria-expanded": expanded.value
|
|
1065
|
-
}));
|
|
1066
|
-
const { component: VvDropdownTriggerProvider, bus } = useProvideDropdownTrigger({
|
|
1067
|
-
reference: referenceEl,
|
|
1068
|
-
id: hasId,
|
|
1069
|
-
expanded,
|
|
1070
|
-
aria: referenceAria
|
|
1071
|
-
});
|
|
1072
|
-
bus.on("click", toggle);
|
|
1073
|
-
const { role, modifiers } = toRefs(props);
|
|
1074
|
-
const { itemRole } = useProvideDropdownItem({ role, expanded });
|
|
1075
|
-
const bemCssClasses = useModifiers(
|
|
1076
|
-
"vv-dropdown",
|
|
1077
|
-
modifiers,
|
|
1078
|
-
computed(() => ({
|
|
1079
|
-
arrow: props.arrow
|
|
1080
|
-
}))
|
|
1081
|
-
);
|
|
1082
|
-
const { focused } = useFocusWithin(floatingEl);
|
|
1083
|
-
function getKeyboardFocusableElements(element) {
|
|
1084
|
-
if (!element) {
|
|
1085
|
-
return [];
|
|
1086
|
-
}
|
|
1087
|
-
return [
|
|
1088
|
-
...element.querySelectorAll(
|
|
1089
|
-
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
1090
|
-
)
|
|
1091
|
-
].filter(
|
|
1092
|
-
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
1093
|
-
);
|
|
1104
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
1094
1105
|
}
|
|
1095
|
-
const focusNext = () => {
|
|
1096
|
-
nextTick(() => {
|
|
1097
|
-
if (focused.value) {
|
|
1098
|
-
const focusableElements = getKeyboardFocusableElements(
|
|
1099
|
-
floatingEl.value
|
|
1100
|
-
);
|
|
1101
|
-
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
const activeElementIndex = focusableElements.indexOf(
|
|
1105
|
-
document.activeElement
|
|
1106
|
-
);
|
|
1107
|
-
if (activeElementIndex < focusableElements.length - 1) {
|
|
1108
|
-
focusableElements[activeElementIndex + 1].focus({
|
|
1109
|
-
preventScroll: true
|
|
1110
|
-
});
|
|
1111
|
-
} else {
|
|
1112
|
-
focusableElements[0].focus({
|
|
1113
|
-
preventScroll: true
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1118
|
-
};
|
|
1119
|
-
const focusPrev = () => {
|
|
1120
|
-
nextTick(() => {
|
|
1121
|
-
if (focused.value) {
|
|
1122
|
-
const focusableElements = getKeyboardFocusableElements(
|
|
1123
|
-
floatingEl.value
|
|
1124
|
-
);
|
|
1125
|
-
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1126
|
-
return;
|
|
1127
|
-
}
|
|
1128
|
-
const activeElementIndex = focusableElements.indexOf(
|
|
1129
|
-
document.activeElement
|
|
1130
|
-
);
|
|
1131
|
-
if (activeElementIndex > 0) {
|
|
1132
|
-
focusableElements[activeElementIndex - 1].focus({
|
|
1133
|
-
preventScroll: true
|
|
1134
|
-
});
|
|
1135
|
-
} else {
|
|
1136
|
-
focusableElements[focusableElements.length - 1].focus({
|
|
1137
|
-
preventScroll: true
|
|
1138
|
-
});
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
});
|
|
1142
|
-
};
|
|
1143
|
-
onKeyStroke("Escape", (e) => {
|
|
1144
|
-
if (expanded.value) {
|
|
1145
|
-
e.preventDefault();
|
|
1146
|
-
hide();
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
onKeyStroke("ArrowDown", (e) => {
|
|
1150
|
-
if (expanded.value && focused.value) {
|
|
1151
|
-
e.preventDefault();
|
|
1152
|
-
focusNext();
|
|
1153
|
-
}
|
|
1154
|
-
});
|
|
1155
|
-
onKeyStroke("ArrowUp", (e) => {
|
|
1156
|
-
if (expanded.value && focused.value) {
|
|
1157
|
-
e.preventDefault();
|
|
1158
|
-
focusPrev();
|
|
1159
|
-
}
|
|
1160
|
-
});
|
|
1161
|
-
onKeyStroke([" ", "Enter"], (e) => {
|
|
1162
|
-
const htmlEl = e.target;
|
|
1163
|
-
if (expanded.value && focused.value && htmlEl) {
|
|
1164
|
-
htmlEl == null ? void 0 : htmlEl.click();
|
|
1165
|
-
}
|
|
1166
|
-
});
|
|
1167
|
-
const dropdownTransitionHandlers = {
|
|
1168
|
-
"before-enter": () => {
|
|
1169
|
-
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1170
|
-
emit("before-enter");
|
|
1171
|
-
},
|
|
1172
|
-
"after-leave": () => {
|
|
1173
|
-
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1174
|
-
emit("after-leave");
|
|
1175
|
-
},
|
|
1176
|
-
enter: () => {
|
|
1177
|
-
emit("enter");
|
|
1178
|
-
},
|
|
1179
|
-
"after-enter": () => {
|
|
1180
|
-
emit("after-enter");
|
|
1181
|
-
},
|
|
1182
|
-
"enter-cancelled": () => {
|
|
1183
|
-
emit("enter-cancelled");
|
|
1184
|
-
},
|
|
1185
|
-
"before-leave": () => {
|
|
1186
|
-
emit("before-leave");
|
|
1187
|
-
},
|
|
1188
|
-
leave: () => {
|
|
1189
|
-
emit("leave");
|
|
1190
|
-
},
|
|
1191
|
-
"leave-cancelled": () => {
|
|
1192
|
-
emit("leave-cancelled");
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
1106
|
return (_ctx, _cache) => {
|
|
1196
|
-
return openBlock(),
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
ref_key: "listEl",
|
|
1222
|
-
ref: listEl,
|
|
1223
|
-
tabindex: !unref(expanded) ? -1 : void 0,
|
|
1224
|
-
role: unref(role),
|
|
1225
|
-
"aria-labelledby": unref(hasAriaLabelledby),
|
|
1226
|
-
class: "vv-dropdown__list"
|
|
1227
|
-
}), [
|
|
1228
|
-
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1229
|
-
role: unref(itemRole)
|
|
1230
|
-
})))
|
|
1231
|
-
], 16, _hoisted_1$5),
|
|
1232
|
-
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1233
|
-
], 6), [
|
|
1234
|
-
[vShow, unref(expanded)]
|
|
1235
|
-
])
|
|
1236
|
-
]),
|
|
1237
|
-
_: 3
|
|
1238
|
-
}, 16, ["name"])
|
|
1239
|
-
], 64);
|
|
1107
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
1108
|
+
ref_key: "element",
|
|
1109
|
+
ref: element,
|
|
1110
|
+
class: {
|
|
1111
|
+
active: _ctx.active,
|
|
1112
|
+
pressed: unref(pressed),
|
|
1113
|
+
disabled: _ctx.disabled,
|
|
1114
|
+
current: _ctx.current
|
|
1115
|
+
},
|
|
1116
|
+
onClickPassive: onClick,
|
|
1117
|
+
onMouseoverPassive: onMouseover,
|
|
1118
|
+
onMouseleavePassive: onMouseleave
|
|
1119
|
+
}), {
|
|
1120
|
+
default: withCtx(() => [
|
|
1121
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1122
|
+
createTextVNode(
|
|
1123
|
+
toDisplayString(_ctx.label),
|
|
1124
|
+
1
|
|
1125
|
+
/* TEXT */
|
|
1126
|
+
)
|
|
1127
|
+
])
|
|
1128
|
+
]),
|
|
1129
|
+
_: 3
|
|
1130
|
+
/* FORWARDED */
|
|
1131
|
+
}, 16, ["class"]);
|
|
1240
1132
|
};
|
|
1241
1133
|
}
|
|
1242
1134
|
});
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
return inject(INJECTION_KEY_DROPDOWN_ITEM, {});
|
|
1248
|
-
}
|
|
1249
|
-
function useInjectedDropdownAction() {
|
|
1250
|
-
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
1251
|
-
}
|
|
1135
|
+
const VvIconPropsDefaults = {
|
|
1136
|
+
prefix: "normal"
|
|
1137
|
+
/* normal */
|
|
1138
|
+
};
|
|
1252
1139
|
const __default__$7 = {
|
|
1253
|
-
name: "
|
|
1140
|
+
name: "VvIcon"
|
|
1254
1141
|
};
|
|
1255
1142
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1256
1143
|
...__default__$7,
|
|
1144
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
1145
|
+
name: {},
|
|
1146
|
+
color: {},
|
|
1147
|
+
width: {},
|
|
1148
|
+
height: {},
|
|
1149
|
+
provider: {},
|
|
1150
|
+
prefix: {},
|
|
1151
|
+
src: {},
|
|
1152
|
+
horizontalFlip: { type: Boolean },
|
|
1153
|
+
verticalFlip: { type: Boolean },
|
|
1154
|
+
flip: {},
|
|
1155
|
+
mode: {},
|
|
1156
|
+
inline: { type: Boolean },
|
|
1157
|
+
rotate: {},
|
|
1158
|
+
onLoad: { type: Function },
|
|
1159
|
+
svg: {},
|
|
1160
|
+
modifiers: {}
|
|
1161
|
+
}, VvIconPropsDefaults),
|
|
1257
1162
|
setup(__props) {
|
|
1258
|
-
const
|
|
1259
|
-
const
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
const { focused } = useFocus(element);
|
|
1263
|
-
const { focused: focusedWithin } = useFocusWithin(element);
|
|
1264
|
-
watch(hovered, (newValue) => {
|
|
1265
|
-
if (newValue) {
|
|
1266
|
-
focused.value = true;
|
|
1163
|
+
const props = __props;
|
|
1164
|
+
const hasRotate = computed(() => {
|
|
1165
|
+
if (typeof props.rotate === "string") {
|
|
1166
|
+
return Number.parseFloat(props.rotate);
|
|
1267
1167
|
}
|
|
1168
|
+
return props.rotate;
|
|
1268
1169
|
});
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
ref_key: "element",
|
|
1272
|
-
ref: element,
|
|
1273
|
-
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
1274
|
-
}), [
|
|
1275
|
-
renderSlot(_ctx.$slots, "default")
|
|
1276
|
-
], 16);
|
|
1277
|
-
};
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
const _hoisted_1$4 = ["title"];
|
|
1281
|
-
const __default__$6 = {
|
|
1282
|
-
name: "VvDropdownOption"
|
|
1283
|
-
};
|
|
1284
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1285
|
-
...__default__$6,
|
|
1286
|
-
props: {
|
|
1287
|
-
...DisabledProps,
|
|
1288
|
-
...SelectedProps,
|
|
1289
|
-
...UnselectableProps,
|
|
1290
|
-
...ModifiersProps,
|
|
1291
|
-
deselectHintLabel: {
|
|
1292
|
-
type: String
|
|
1293
|
-
},
|
|
1294
|
-
selectHintLabel: {
|
|
1295
|
-
type: String
|
|
1296
|
-
},
|
|
1297
|
-
selectedHintLabel: {
|
|
1298
|
-
type: String
|
|
1299
|
-
}
|
|
1300
|
-
},
|
|
1301
|
-
setup(__props) {
|
|
1302
|
-
const props = __props;
|
|
1170
|
+
const show = ref(true);
|
|
1171
|
+
const volver = useVolver();
|
|
1303
1172
|
const { modifiers } = toRefs(props);
|
|
1304
|
-
const bemCssClasses = useModifiers(
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
const hintLabel = computed(() => {
|
|
1314
|
-
if (props.selected) {
|
|
1315
|
-
return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
|
|
1173
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1174
|
+
const provider = computed(() => {
|
|
1175
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
1176
|
+
});
|
|
1177
|
+
const icon = computed(() => {
|
|
1178
|
+
const name = props.name ?? "";
|
|
1179
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
1180
|
+
if (iconExists(iconName)) {
|
|
1181
|
+
return iconName;
|
|
1316
1182
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1183
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
1184
|
+
(iconsCollection2) => {
|
|
1185
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1186
|
+
return iconExists(icon2);
|
|
1187
|
+
}
|
|
1188
|
+
);
|
|
1189
|
+
if (iconsCollection) {
|
|
1190
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
1319
1191
|
}
|
|
1192
|
+
return name;
|
|
1320
1193
|
});
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
"aria-disabled": _ctx.disabled
|
|
1327
|
-
}, {
|
|
1328
|
-
default: withCtx(() => [
|
|
1329
|
-
renderSlot(_ctx.$slots, "default"),
|
|
1330
|
-
createElementVNode("span", {
|
|
1331
|
-
class: "vv-dropdown-option__hint",
|
|
1332
|
-
title: unref(hintLabel)
|
|
1333
|
-
}, [
|
|
1334
|
-
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
1335
|
-
createTextVNode(toDisplayString(unref(hintLabel)), 1)
|
|
1336
|
-
])
|
|
1337
|
-
], 8, _hoisted_1$4)
|
|
1338
|
-
]),
|
|
1339
|
-
_: 3
|
|
1340
|
-
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled"]);
|
|
1341
|
-
};
|
|
1342
|
-
}
|
|
1343
|
-
});
|
|
1344
|
-
const _hoisted_1$3 = {
|
|
1345
|
-
class: "vv-dropdown-optgroup",
|
|
1346
|
-
role: "presentation",
|
|
1347
|
-
tabindex: "-1"
|
|
1348
|
-
};
|
|
1349
|
-
const __default__$5 = {
|
|
1350
|
-
name: "VvDropdownOptgroup"
|
|
1351
|
-
};
|
|
1352
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1353
|
-
...__default__$5,
|
|
1354
|
-
props: {
|
|
1355
|
-
...LabelProps
|
|
1356
|
-
},
|
|
1357
|
-
setup(__props) {
|
|
1358
|
-
const props = __props;
|
|
1359
|
-
return (_ctx, _cache) => {
|
|
1360
|
-
return openBlock(), createElementBlock("li", _hoisted_1$3, toDisplayString(props.label), 1);
|
|
1361
|
-
};
|
|
1362
|
-
}
|
|
1363
|
-
});
|
|
1364
|
-
function equals(obj1, obj2, field) {
|
|
1365
|
-
if (field) {
|
|
1366
|
-
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
1367
|
-
}
|
|
1368
|
-
return deepEquals(obj1, obj2);
|
|
1369
|
-
}
|
|
1370
|
-
function deepEquals(a, b) {
|
|
1371
|
-
if (a === b)
|
|
1372
|
-
return true;
|
|
1373
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
1374
|
-
const arrA = Array.isArray(a);
|
|
1375
|
-
const arrB = Array.isArray(b);
|
|
1376
|
-
let i, length, key;
|
|
1377
|
-
if (arrA && arrB) {
|
|
1378
|
-
length = a.length;
|
|
1379
|
-
if (length != b.length)
|
|
1380
|
-
return false;
|
|
1381
|
-
for (i = length; i-- !== 0; )
|
|
1382
|
-
if (!deepEquals(a[i], b[i]))
|
|
1383
|
-
return false;
|
|
1384
|
-
return true;
|
|
1385
|
-
}
|
|
1386
|
-
if (arrA != arrB)
|
|
1387
|
-
return false;
|
|
1388
|
-
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
1389
|
-
if (dateA != dateB)
|
|
1390
|
-
return false;
|
|
1391
|
-
if (dateA && dateB)
|
|
1392
|
-
return a.getTime() == b.getTime();
|
|
1393
|
-
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
1394
|
-
if (regexpA != regexpB)
|
|
1395
|
-
return false;
|
|
1396
|
-
if (regexpA && regexpB)
|
|
1397
|
-
return a.toString() == b.toString();
|
|
1398
|
-
const keys = Object.keys(a);
|
|
1399
|
-
length = keys.length;
|
|
1400
|
-
if (length !== Object.keys(b).length)
|
|
1401
|
-
return false;
|
|
1402
|
-
for (i = length; i-- !== 0; )
|
|
1403
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
1404
|
-
return false;
|
|
1405
|
-
for (i = length; i-- !== 0; ) {
|
|
1406
|
-
key = keys[i];
|
|
1407
|
-
if (!deepEquals(a[key], b[key]))
|
|
1408
|
-
return false;
|
|
1409
|
-
}
|
|
1410
|
-
return true;
|
|
1411
|
-
}
|
|
1412
|
-
return a !== a && b !== b;
|
|
1413
|
-
}
|
|
1414
|
-
function resolveFieldData(data, field) {
|
|
1415
|
-
if (data && Object.keys(data).length && field) {
|
|
1416
|
-
if (field.indexOf(".") === -1) {
|
|
1417
|
-
return data[field];
|
|
1418
|
-
} else {
|
|
1419
|
-
const fields = field.split(".");
|
|
1420
|
-
let value = data;
|
|
1421
|
-
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
1422
|
-
if (data == null) {
|
|
1423
|
-
return null;
|
|
1424
|
-
}
|
|
1425
|
-
value = value[fields[i]];
|
|
1194
|
+
function getSvgContent(svg) {
|
|
1195
|
+
let dom;
|
|
1196
|
+
if (typeof window === "undefined") {
|
|
1197
|
+
const { JSDOM } = require("jsdom");
|
|
1198
|
+
dom = new JSDOM().window;
|
|
1426
1199
|
}
|
|
1427
|
-
|
|
1200
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
1201
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
1202
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
1203
|
+
return svgEl;
|
|
1428
1204
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
break;
|
|
1205
|
+
function addIconFromSvg(svg) {
|
|
1206
|
+
const svgContentEl = getSvgContent(svg);
|
|
1207
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
1208
|
+
if (svgContentEl && svgContent) {
|
|
1209
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1210
|
+
body: svgContent,
|
|
1211
|
+
// Set height and width from svg content
|
|
1212
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
1213
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
1214
|
+
});
|
|
1440
1215
|
}
|
|
1441
1216
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1217
|
+
if (volver) {
|
|
1218
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
1219
|
+
show.value = false;
|
|
1220
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
1221
|
+
if (svg) {
|
|
1222
|
+
addIconFromSvg(svg);
|
|
1223
|
+
show.value = true;
|
|
1224
|
+
}
|
|
1225
|
+
}).catch((e) => {
|
|
1226
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
1227
|
+
});
|
|
1450
1228
|
}
|
|
1451
1229
|
}
|
|
1230
|
+
if (props.svg) {
|
|
1231
|
+
addIconFromSvg(props.svg);
|
|
1232
|
+
}
|
|
1233
|
+
return (_ctx, _cache) => {
|
|
1234
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
1235
|
+
key: 0,
|
|
1236
|
+
class: unref(bemCssClasses)
|
|
1237
|
+
}, {
|
|
1238
|
+
inline: _ctx.inline,
|
|
1239
|
+
width: _ctx.width,
|
|
1240
|
+
height: _ctx.height,
|
|
1241
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
1242
|
+
verticalFlip: _ctx.verticalFlip,
|
|
1243
|
+
flip: _ctx.flip,
|
|
1244
|
+
rotate: unref(hasRotate),
|
|
1245
|
+
color: _ctx.color,
|
|
1246
|
+
onLoad: _ctx.onLoad,
|
|
1247
|
+
icon: unref(icon)
|
|
1248
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
1249
|
+
};
|
|
1452
1250
|
}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
1457
|
-
}
|
|
1458
|
-
function removeFromList(value, list) {
|
|
1459
|
-
const indexElToRemove = findIndexInList(value, list);
|
|
1460
|
-
if (indexElToRemove > -1) {
|
|
1461
|
-
return list.filter((el, elIndex) => elIndex !== indexElToRemove);
|
|
1462
|
-
} else {
|
|
1463
|
-
return list;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
function isString(value) {
|
|
1467
|
-
return typeof value === "string" || value instanceof String;
|
|
1468
|
-
}
|
|
1469
|
-
function joinLines(items) {
|
|
1470
|
-
if (Array.isArray(items)) {
|
|
1471
|
-
return items.filter((item) => isString(item)).join(" ");
|
|
1472
|
-
}
|
|
1473
|
-
return items;
|
|
1251
|
+
});
|
|
1252
|
+
function useUniqueId(id) {
|
|
1253
|
+
return computed(() => String((id == null ? void 0 : id.value) || useId()));
|
|
1474
1254
|
}
|
|
1475
|
-
function
|
|
1476
|
-
const
|
|
1477
|
-
if (
|
|
1478
|
-
return
|
|
1255
|
+
function useComponentIcon(icon, iconPosition) {
|
|
1256
|
+
const hasIcon = computed(() => {
|
|
1257
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1258
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
1479
1259
|
}
|
|
1480
|
-
return
|
|
1260
|
+
return icon == null ? void 0 : icon.value;
|
|
1481
1261
|
});
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
1485
|
-
const hintLabel = computed(() => props.value.hintLabel);
|
|
1486
|
-
const hasLoadingLabelOrSlot = computed(
|
|
1487
|
-
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
1262
|
+
const hasIconBefore = computed(
|
|
1263
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
1488
1264
|
);
|
|
1489
|
-
const
|
|
1490
|
-
() =>
|
|
1491
|
-
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
1492
|
-
)
|
|
1265
|
+
const hasIconAfter = computed(
|
|
1266
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
1493
1267
|
);
|
|
1494
|
-
const
|
|
1495
|
-
() =>
|
|
1268
|
+
const hasIconLeft = computed(
|
|
1269
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
1496
1270
|
);
|
|
1497
|
-
const
|
|
1498
|
-
() =>
|
|
1271
|
+
const hasIconRight = computed(
|
|
1272
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
1499
1273
|
);
|
|
1500
|
-
const
|
|
1501
|
-
() =>
|
|
1274
|
+
const hasIconTop = computed(
|
|
1275
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
1276
|
+
);
|
|
1277
|
+
const hasIconBottom = computed(
|
|
1278
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1502
1279
|
);
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1280
|
+
return {
|
|
1281
|
+
hasIcon,
|
|
1282
|
+
hasIconLeft,
|
|
1283
|
+
hasIconRight,
|
|
1284
|
+
hasIconTop,
|
|
1285
|
+
hasIconBottom,
|
|
1286
|
+
hasIconBefore,
|
|
1287
|
+
hasIconAfter
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
const _hoisted_1$5 = {
|
|
1291
|
+
key: 1,
|
|
1292
|
+
class: "vv-button__label"
|
|
1293
|
+
};
|
|
1294
|
+
const _hoisted_2$2 = {
|
|
1295
|
+
key: 1,
|
|
1296
|
+
class: "vv-button__label"
|
|
1297
|
+
};
|
|
1298
|
+
const __default__$6 = {
|
|
1299
|
+
name: "VvButton",
|
|
1300
|
+
inheritAttrs: false
|
|
1301
|
+
};
|
|
1302
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1303
|
+
...__default__$6,
|
|
1304
|
+
props: VvButtonProps,
|
|
1305
|
+
emits: VvButtonEvents,
|
|
1306
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1307
|
+
const props = __props;
|
|
1308
|
+
const emit = __emit;
|
|
1309
|
+
const attrs = useAttrs();
|
|
1310
|
+
const slots = useSlots();
|
|
1311
|
+
const {
|
|
1312
|
+
id,
|
|
1313
|
+
modifiers,
|
|
1314
|
+
iconPosition,
|
|
1315
|
+
icon,
|
|
1316
|
+
label,
|
|
1317
|
+
modelValue,
|
|
1318
|
+
disabled,
|
|
1319
|
+
toggle,
|
|
1320
|
+
unselectable
|
|
1321
|
+
} = useGroupProps(props, emit);
|
|
1322
|
+
const hasId = useUniqueId(id);
|
|
1323
|
+
const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
|
|
1324
|
+
const element = ref(null);
|
|
1325
|
+
const $el = computed(() => {
|
|
1326
|
+
var _a;
|
|
1327
|
+
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
1328
|
+
});
|
|
1329
|
+
__expose({ $el });
|
|
1330
|
+
const pressed = computed(() => {
|
|
1331
|
+
if (!toggle.value) {
|
|
1332
|
+
return props.pressed;
|
|
1333
|
+
}
|
|
1334
|
+
if (Array.isArray(modelValue.value)) {
|
|
1335
|
+
return contains(name.value, modelValue.value);
|
|
1336
|
+
}
|
|
1337
|
+
return equals(name.value, modelValue.value);
|
|
1338
|
+
});
|
|
1339
|
+
const bemCssClasses = useModifiers(
|
|
1340
|
+
"vv-button",
|
|
1341
|
+
modifiers,
|
|
1342
|
+
computed(() => ({
|
|
1343
|
+
"reverse": [Side.right, Side.bottom].includes(
|
|
1344
|
+
iconPosition.value
|
|
1345
|
+
),
|
|
1346
|
+
"column": [Side.top, Side.bottom].includes(
|
|
1347
|
+
iconPosition.value
|
|
1348
|
+
),
|
|
1349
|
+
"icon-only": Boolean(
|
|
1350
|
+
(icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
|
|
1351
|
+
)
|
|
1352
|
+
}))
|
|
1353
|
+
);
|
|
1354
|
+
const { hasIcon } = useComponentIcon(icon);
|
|
1355
|
+
const toggleValue = computed(() => {
|
|
1356
|
+
return props.value !== void 0 ? props.value : name.value;
|
|
1357
|
+
});
|
|
1358
|
+
const hasListeners = computed(() => {
|
|
1359
|
+
if (!toggle.value) {
|
|
1360
|
+
return void 0;
|
|
1515
1361
|
}
|
|
1516
|
-
},
|
|
1517
|
-
setup() {
|
|
1518
1362
|
return {
|
|
1519
|
-
|
|
1520
|
-
invalidLabel,
|
|
1521
|
-
validLabel,
|
|
1522
|
-
loadingLabel,
|
|
1523
|
-
hintLabel,
|
|
1524
|
-
hasInvalidLabelOrSlot,
|
|
1525
|
-
hasValidLabelOrSlot,
|
|
1526
|
-
hasLoadingLabelOrSlot,
|
|
1527
|
-
hasHintLabelOrSlot
|
|
1363
|
+
onClick
|
|
1528
1364
|
};
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
{
|
|
1544
|
-
role
|
|
1545
|
-
},
|
|
1546
|
-
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
1547
|
-
);
|
|
1548
|
-
}
|
|
1549
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
1550
|
-
return h(
|
|
1551
|
-
this.tag,
|
|
1552
|
-
{
|
|
1553
|
-
role
|
|
1554
|
-
},
|
|
1555
|
-
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
1556
|
-
);
|
|
1365
|
+
});
|
|
1366
|
+
function onClick() {
|
|
1367
|
+
if (toggle.value) {
|
|
1368
|
+
if (Array.isArray(modelValue.value)) {
|
|
1369
|
+
if (contains(toggleValue.value, modelValue.value)) {
|
|
1370
|
+
if (unselectable.value) {
|
|
1371
|
+
modelValue.value = modelValue.value.filter(
|
|
1372
|
+
(n) => n !== toggleValue.value
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
modelValue.value.push(toggleValue.value);
|
|
1378
|
+
return;
|
|
1557
1379
|
}
|
|
1558
|
-
if (
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
{
|
|
1562
|
-
role
|
|
1563
|
-
},
|
|
1564
|
-
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
1565
|
-
);
|
|
1380
|
+
if (toggleValue.value === modelValue.value && unselectable.value) {
|
|
1381
|
+
modelValue.value = props.uncheckedValue;
|
|
1382
|
+
return;
|
|
1566
1383
|
}
|
|
1567
|
-
|
|
1568
|
-
this.tag,
|
|
1569
|
-
{
|
|
1570
|
-
role
|
|
1571
|
-
},
|
|
1572
|
-
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
1573
|
-
);
|
|
1384
|
+
modelValue.value = toggleValue.value;
|
|
1574
1385
|
}
|
|
1575
|
-
return null;
|
|
1576
1386
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1387
|
+
return (_ctx, _cache) => {
|
|
1388
|
+
return openBlock(), createBlock(_sfc_main$8, mergeProps({
|
|
1389
|
+
...unref(attrs),
|
|
1390
|
+
...unref(hasListeners),
|
|
1391
|
+
disabled: unref(disabled),
|
|
1392
|
+
pressed: unref(pressed),
|
|
1393
|
+
active: _ctx.active,
|
|
1394
|
+
type: _ctx.type,
|
|
1395
|
+
to: _ctx.to,
|
|
1396
|
+
href: _ctx.href,
|
|
1397
|
+
target: _ctx.target,
|
|
1398
|
+
rel: _ctx.rel,
|
|
1399
|
+
ariaLabel: _ctx.ariaLabel
|
|
1400
|
+
}, {
|
|
1401
|
+
id: unref(hasId),
|
|
1402
|
+
ref_key: "element",
|
|
1403
|
+
ref: element,
|
|
1404
|
+
class: unref(bemCssClasses)
|
|
1405
|
+
}), {
|
|
1406
|
+
default: withCtx(() => [
|
|
1407
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1408
|
+
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
1409
|
+
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$7, {
|
|
1410
|
+
key: 0,
|
|
1411
|
+
class: "vv-button__loading-icon",
|
|
1412
|
+
name: _ctx.loadingIcon
|
|
1413
|
+
}, null, 8, ["name"])) : createCommentVNode("v-if", true),
|
|
1414
|
+
_ctx.loadingLabel ? (openBlock(), createElementBlock(
|
|
1415
|
+
"span",
|
|
1416
|
+
_hoisted_1$5,
|
|
1417
|
+
toDisplayString(_ctx.loadingLabel),
|
|
1418
|
+
1
|
|
1419
|
+
/* TEXT */
|
|
1420
|
+
)) : createCommentVNode("v-if", true)
|
|
1421
|
+
]) : (openBlock(), createElementBlock(
|
|
1422
|
+
Fragment,
|
|
1423
|
+
{ key: 1 },
|
|
1424
|
+
[
|
|
1425
|
+
renderSlot(_ctx.$slots, "before"),
|
|
1426
|
+
unref(hasIcon) ? (openBlock(), createBlock(
|
|
1427
|
+
_sfc_main$7,
|
|
1428
|
+
mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
|
|
1429
|
+
null,
|
|
1430
|
+
16
|
|
1431
|
+
/* FULL_PROPS */
|
|
1432
|
+
)) : createCommentVNode("v-if", true),
|
|
1433
|
+
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2$2, [
|
|
1434
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
1435
|
+
createTextVNode(
|
|
1436
|
+
toDisplayString(unref(label)),
|
|
1437
|
+
1
|
|
1438
|
+
/* TEXT */
|
|
1439
|
+
)
|
|
1440
|
+
])
|
|
1441
|
+
])) : createCommentVNode("v-if", true),
|
|
1442
|
+
renderSlot(_ctx.$slots, "after")
|
|
1443
|
+
],
|
|
1444
|
+
64
|
|
1445
|
+
/* STABLE_FRAGMENT */
|
|
1446
|
+
))
|
|
1447
|
+
])
|
|
1448
|
+
]),
|
|
1449
|
+
_: 3
|
|
1450
|
+
/* FORWARDED */
|
|
1451
|
+
}, 16, ["id", "class"]);
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
const VvDropdownProps = {
|
|
1456
|
+
...IdProps,
|
|
1457
|
+
...DropdownProps,
|
|
1598
1458
|
...ModifiersProps,
|
|
1599
|
-
...OptionsProps,
|
|
1600
|
-
...IconProps,
|
|
1601
|
-
...FloatingLabelProps,
|
|
1602
|
-
...UnselectableProps,
|
|
1603
|
-
...LabelProps,
|
|
1604
|
-
/**
|
|
1605
|
-
* This Boolean attribute indicates that multiple options can be selected in the list.
|
|
1606
|
-
* If it is not specified, then only one option can be selected at a time.
|
|
1607
|
-
* When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
|
|
1608
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple
|
|
1609
|
-
*/
|
|
1610
|
-
multiple: Boolean,
|
|
1611
1459
|
/**
|
|
1612
|
-
*
|
|
1613
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-required
|
|
1460
|
+
* Show / hide dropdown programmatically
|
|
1614
1461
|
*/
|
|
1615
|
-
|
|
1462
|
+
modelValue: {
|
|
1463
|
+
type: Boolean,
|
|
1464
|
+
default: void 0
|
|
1465
|
+
},
|
|
1616
1466
|
/**
|
|
1617
|
-
*
|
|
1618
|
-
* this attribute represents the number of rows in the list that should be visible at one time.
|
|
1619
|
-
* Browsers are not required to present a select element as a scrolled list box. The default value is 0.
|
|
1620
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-size
|
|
1467
|
+
* Dropdown trigger element
|
|
1621
1468
|
*/
|
|
1622
|
-
|
|
1469
|
+
reference: {
|
|
1470
|
+
type: Object,
|
|
1471
|
+
default: null
|
|
1472
|
+
},
|
|
1623
1473
|
/**
|
|
1624
|
-
*
|
|
1474
|
+
* Dropdown role
|
|
1625
1475
|
*/
|
|
1626
|
-
|
|
1627
|
-
type:
|
|
1628
|
-
default:
|
|
1476
|
+
role: {
|
|
1477
|
+
type: String,
|
|
1478
|
+
default: DropdownRole.menu,
|
|
1479
|
+
validator: (value) => Object.values(DropdownRole).includes(value)
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
const VvDropdownItemProps = {
|
|
1483
|
+
focusOnHover: {
|
|
1484
|
+
type: Boolean,
|
|
1485
|
+
default: false
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
const VvDropdownOptionProps = {
|
|
1489
|
+
...DisabledProps,
|
|
1490
|
+
...SelectedProps,
|
|
1491
|
+
...UnselectableProps,
|
|
1492
|
+
...ModifiersProps,
|
|
1493
|
+
deselectHintLabel: {
|
|
1494
|
+
type: String
|
|
1629
1495
|
},
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1496
|
+
selectHintLabel: {
|
|
1497
|
+
type: String
|
|
1498
|
+
},
|
|
1499
|
+
selectedHintLabel: {
|
|
1500
|
+
type: String
|
|
1501
|
+
},
|
|
1502
|
+
focusOnHover: {
|
|
1503
|
+
type: Boolean,
|
|
1504
|
+
default: false
|
|
1505
|
+
}
|
|
1634
1506
|
};
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1507
|
+
function useDropdownProvideTrigger({
|
|
1508
|
+
reference,
|
|
1509
|
+
id,
|
|
1510
|
+
expanded,
|
|
1511
|
+
aria
|
|
1512
|
+
}) {
|
|
1513
|
+
const bus = mitt();
|
|
1514
|
+
const component = defineComponent({
|
|
1515
|
+
name: "VvDropdownTriggerProvider",
|
|
1516
|
+
setup() {
|
|
1517
|
+
provide(INJECTION_KEY_DROPDOWN_TRIGGER, {
|
|
1518
|
+
reference,
|
|
1519
|
+
id,
|
|
1520
|
+
expanded,
|
|
1521
|
+
aria,
|
|
1522
|
+
bus
|
|
1523
|
+
});
|
|
1524
|
+
},
|
|
1525
|
+
render() {
|
|
1526
|
+
var _a, _b;
|
|
1527
|
+
return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
|
|
1648
1528
|
}
|
|
1649
|
-
const componentDefaults = volverComponentDefaults.value;
|
|
1650
|
-
const simplifiedPropsDefinition = propsDefinition;
|
|
1651
|
-
const simplifiedProps = props;
|
|
1652
|
-
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
1653
|
-
const propValue = simplifiedProps[key];
|
|
1654
|
-
acc[key] = propValue;
|
|
1655
|
-
if (key in componentDefaults) {
|
|
1656
|
-
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
1657
|
-
const typeArray = simplifiedPropsDefinition[key];
|
|
1658
|
-
if (typeArray.length) {
|
|
1659
|
-
const typeFunction = typeArray[0];
|
|
1660
|
-
if (typeFunction === propValue) {
|
|
1661
|
-
acc[key] = componentDefaults[key];
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
1666
|
-
const typeFunction = simplifiedPropsDefinition[key];
|
|
1667
|
-
if (typeFunction() === propValue) {
|
|
1668
|
-
acc[key] = componentDefaults[key];
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
1672
|
-
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
1673
|
-
if (typeof defaultValue === "function") {
|
|
1674
|
-
defaultValue = defaultValue();
|
|
1675
|
-
}
|
|
1676
|
-
if (typeof defaultValue === "object") {
|
|
1677
|
-
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
1678
|
-
acc[key] = componentDefaults[key];
|
|
1679
|
-
}
|
|
1680
|
-
} else if (defaultValue === propValue) {
|
|
1681
|
-
acc[key] = componentDefaults[key];
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
return acc;
|
|
1686
|
-
}, {});
|
|
1687
|
-
});
|
|
1688
|
-
}
|
|
1689
|
-
function useComponentFocus(inputTemplateRef, emit) {
|
|
1690
|
-
const { focused } = useFocus(inputTemplateRef);
|
|
1691
|
-
watch(focused, (newValue) => {
|
|
1692
|
-
emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
|
|
1693
1529
|
});
|
|
1694
1530
|
return {
|
|
1695
|
-
|
|
1531
|
+
bus,
|
|
1532
|
+
component
|
|
1696
1533
|
};
|
|
1697
1534
|
}
|
|
1698
|
-
function
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
const
|
|
1703
|
-
() =>
|
|
1704
|
-
);
|
|
1705
|
-
const hasIconLeft = computed(
|
|
1706
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
|
|
1707
|
-
);
|
|
1708
|
-
const hasIconRight = computed(
|
|
1709
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
|
|
1710
|
-
);
|
|
1711
|
-
const hasIconTop = computed(
|
|
1712
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
|
|
1713
|
-
);
|
|
1714
|
-
const hasIconBottom = computed(
|
|
1715
|
-
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
|
|
1535
|
+
function useDropdownProvideItem({
|
|
1536
|
+
role,
|
|
1537
|
+
...others
|
|
1538
|
+
}) {
|
|
1539
|
+
const itemRole = computed(
|
|
1540
|
+
() => role.value === DropdownRole.listbox ? DropdownItemRole.option : DropdownItemRole.presentation
|
|
1716
1541
|
);
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
}
|
|
1721
|
-
return icon == null ? void 0 : icon.value;
|
|
1542
|
+
provide(INJECTION_KEY_DROPDOWN_ITEM, {
|
|
1543
|
+
role: itemRole,
|
|
1544
|
+
...others
|
|
1722
1545
|
});
|
|
1723
|
-
return {
|
|
1724
|
-
hasIcon,
|
|
1725
|
-
hasIconLeft,
|
|
1726
|
-
hasIconRight,
|
|
1727
|
-
hasIconTop,
|
|
1728
|
-
hasIconBottom,
|
|
1729
|
-
hasIconBefore,
|
|
1730
|
-
hasIconAfter
|
|
1731
|
-
};
|
|
1546
|
+
return { itemRole };
|
|
1732
1547
|
}
|
|
1733
|
-
function
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
);
|
|
1741
|
-
};
|
|
1742
|
-
const getOptionValue = (option) => {
|
|
1743
|
-
if (typeof option !== "object" && option !== null)
|
|
1744
|
-
return option;
|
|
1745
|
-
return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
|
|
1746
|
-
};
|
|
1747
|
-
const isOptionDisabled = (option) => {
|
|
1748
|
-
if (typeof option !== "object" && option !== null)
|
|
1749
|
-
return false;
|
|
1750
|
-
return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
|
|
1751
|
-
};
|
|
1752
|
-
const getOptionGrouped = (option) => {
|
|
1753
|
-
if (typeof option !== "object" && option !== null)
|
|
1754
|
-
return [];
|
|
1755
|
-
return option.options || [];
|
|
1756
|
-
};
|
|
1757
|
-
return {
|
|
1758
|
-
options,
|
|
1759
|
-
getOptionLabel,
|
|
1760
|
-
getOptionValue,
|
|
1761
|
-
isOptionDisabled,
|
|
1762
|
-
getOptionGrouped
|
|
1763
|
-
};
|
|
1548
|
+
function useDropdownProvideAction({
|
|
1549
|
+
expanded
|
|
1550
|
+
}) {
|
|
1551
|
+
provide(INJECTION_KEY_DROPDOWN_ACTION, {
|
|
1552
|
+
role: ref(ActionRoles.menuitem),
|
|
1553
|
+
expanded
|
|
1554
|
+
});
|
|
1764
1555
|
}
|
|
1765
|
-
const _hoisted_1$
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
class: "vv-select__input-before"
|
|
1770
|
-
};
|
|
1771
|
-
const _hoisted_4$1 = { class: "vv-select__inner" };
|
|
1772
|
-
const _hoisted_5$1 = ["id"];
|
|
1773
|
-
const _hoisted_6$1 = ["disabled", "hidden"];
|
|
1774
|
-
const _hoisted_7$1 = ["disabled", "value"];
|
|
1775
|
-
const _hoisted_8$1 = ["disabled", "label"];
|
|
1776
|
-
const _hoisted_9$1 = ["disabled", "value"];
|
|
1777
|
-
const _hoisted_10 = {
|
|
1778
|
-
key: 1,
|
|
1779
|
-
class: "vv-select__input-after"
|
|
1780
|
-
};
|
|
1781
|
-
const __default__$4 = {
|
|
1782
|
-
name: "VvSelect"
|
|
1556
|
+
const _hoisted_1$4 = ["id", "tabindex", "role", "aria-labelledby"];
|
|
1557
|
+
const __default__$5 = {
|
|
1558
|
+
name: "VvDropdown",
|
|
1559
|
+
inheritAttrs: false
|
|
1783
1560
|
};
|
|
1784
|
-
const _sfc_main$
|
|
1785
|
-
...__default__$
|
|
1786
|
-
props:
|
|
1787
|
-
emits:
|
|
1788
|
-
|
|
1561
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1562
|
+
...__default__$5,
|
|
1563
|
+
props: VvDropdownProps,
|
|
1564
|
+
emits: [
|
|
1565
|
+
"update:modelValue",
|
|
1566
|
+
"beforeEnter",
|
|
1567
|
+
"afterLeave",
|
|
1568
|
+
"beforeExpand",
|
|
1569
|
+
"beforeCollapse",
|
|
1570
|
+
"afterExpand",
|
|
1571
|
+
"afterCollapse",
|
|
1572
|
+
"before-enter",
|
|
1573
|
+
"after-leave",
|
|
1574
|
+
"enter",
|
|
1575
|
+
"afterEnter",
|
|
1576
|
+
"enterCancelled",
|
|
1577
|
+
"beforeLeave",
|
|
1578
|
+
"leave",
|
|
1579
|
+
"leaveCancelled"
|
|
1580
|
+
],
|
|
1581
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1789
1582
|
const props = __props;
|
|
1790
|
-
const
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1583
|
+
const emit = __emit;
|
|
1584
|
+
const { id } = toRefs(props);
|
|
1585
|
+
const hasId = useUniqueId(id);
|
|
1586
|
+
const attrs = useAttrs();
|
|
1587
|
+
const maxWidth = ref("auto");
|
|
1588
|
+
const maxHeight = ref("auto");
|
|
1589
|
+
const localReferenceEl = ref();
|
|
1590
|
+
const floatingEl = ref();
|
|
1591
|
+
const arrowEl = ref();
|
|
1592
|
+
const listEl = ref();
|
|
1593
|
+
const referenceEl = computed({
|
|
1594
|
+
get: () => props.reference ?? localReferenceEl.value,
|
|
1595
|
+
set: (newValue) => {
|
|
1596
|
+
localReferenceEl.value = newValue;
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
const hasCustomPosition = ref(false);
|
|
1600
|
+
onMounted(() => {
|
|
1601
|
+
useMutationObserver(
|
|
1602
|
+
floatingEl.value,
|
|
1603
|
+
() => {
|
|
1604
|
+
var _a;
|
|
1605
|
+
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
1606
|
+
},
|
|
1607
|
+
{
|
|
1608
|
+
attributeFilter: ["style"],
|
|
1609
|
+
window
|
|
1610
|
+
}
|
|
1611
|
+
);
|
|
1612
|
+
});
|
|
1613
|
+
const middleware = computed(() => {
|
|
1614
|
+
const toReturn = [];
|
|
1615
|
+
if (props.autoPlacement) {
|
|
1616
|
+
if (typeof props.autoPlacement === "boolean") {
|
|
1617
|
+
toReturn.push(autoPlacement());
|
|
1618
|
+
} else {
|
|
1619
|
+
toReturn.push(
|
|
1620
|
+
autoPlacement(props.autoPlacement)
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
} else if (props.flip) {
|
|
1624
|
+
if (typeof props.flip === "boolean") {
|
|
1625
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
1626
|
+
} else {
|
|
1627
|
+
toReturn.push(flip(props.flip));
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
if (props.shift) {
|
|
1631
|
+
if (typeof props.shift === "boolean") {
|
|
1632
|
+
toReturn.push(shift());
|
|
1633
|
+
} else {
|
|
1634
|
+
toReturn.push(shift(props.shift));
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
if (props.size) {
|
|
1638
|
+
const apply = ({
|
|
1639
|
+
availableWidth,
|
|
1640
|
+
availableHeight
|
|
1641
|
+
}) => {
|
|
1642
|
+
maxWidth.value = `${availableWidth}px`;
|
|
1643
|
+
maxHeight.value = `${availableHeight}px`;
|
|
1644
|
+
};
|
|
1645
|
+
if (typeof props.size === "boolean") {
|
|
1646
|
+
toReturn.push(
|
|
1647
|
+
size({
|
|
1648
|
+
apply
|
|
1649
|
+
})
|
|
1650
|
+
);
|
|
1651
|
+
} else {
|
|
1652
|
+
toReturn.push(
|
|
1653
|
+
size({
|
|
1654
|
+
...props.size,
|
|
1655
|
+
apply
|
|
1656
|
+
})
|
|
1657
|
+
);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
if (props.offset) {
|
|
1661
|
+
toReturn.push(offset(Number(props.offset)));
|
|
1662
|
+
if (["string", "number"].includes(typeof props.offset)) {
|
|
1663
|
+
toReturn.push(offset(Number(props.offset)));
|
|
1664
|
+
} else {
|
|
1665
|
+
toReturn.push(offset(props.offset));
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
if (props.arrow) {
|
|
1669
|
+
toReturn.push(
|
|
1670
|
+
arrow({
|
|
1671
|
+
element: arrowEl
|
|
1672
|
+
})
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
return toReturn;
|
|
1676
|
+
});
|
|
1677
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
1678
|
+
referenceEl,
|
|
1679
|
+
floatingEl,
|
|
1680
|
+
{
|
|
1681
|
+
whileElementsMounted: (...args) => {
|
|
1682
|
+
return autoUpdate(...args, {
|
|
1683
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
1684
|
+
});
|
|
1685
|
+
},
|
|
1686
|
+
placement: computed(() => props.placement),
|
|
1687
|
+
strategy: computed(() => props.strategy),
|
|
1688
|
+
middleware
|
|
1689
|
+
}
|
|
1795
1690
|
);
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
hasInvalidLabelOrSlot,
|
|
1801
|
-
hintSlotScope
|
|
1802
|
-
} = HintSlotFactory(propsDefaults, slots);
|
|
1803
|
-
const {
|
|
1804
|
-
id,
|
|
1805
|
-
modifiers,
|
|
1806
|
-
disabled,
|
|
1807
|
-
readonly,
|
|
1808
|
-
loading,
|
|
1809
|
-
icon,
|
|
1810
|
-
iconPosition,
|
|
1811
|
-
invalid,
|
|
1812
|
-
valid,
|
|
1813
|
-
floating,
|
|
1814
|
-
multiple
|
|
1815
|
-
} = toRefs(props);
|
|
1816
|
-
const hasId = useUniqueId(id);
|
|
1817
|
-
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
1818
|
-
const { focused } = useComponentFocus(select, emit);
|
|
1819
|
-
const isVisible = useElementVisibility(select);
|
|
1820
|
-
watch(isVisible, (newValue) => {
|
|
1821
|
-
if (newValue && props.autofocus) {
|
|
1822
|
-
focused.value = true;
|
|
1691
|
+
const dropdownPlacement = computed(() => {
|
|
1692
|
+
var _a;
|
|
1693
|
+
if (hasCustomPosition.value) {
|
|
1694
|
+
return void 0;
|
|
1823
1695
|
}
|
|
1696
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
1697
|
+
return {
|
|
1698
|
+
position: strategy.value,
|
|
1699
|
+
top: `${y.value ?? 0}px`,
|
|
1700
|
+
left: `${x.value ?? 0}px`,
|
|
1701
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
1702
|
+
maxHeight: maxHeight.value,
|
|
1703
|
+
width
|
|
1704
|
+
};
|
|
1824
1705
|
});
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
iconPosition
|
|
1706
|
+
const side = computed(
|
|
1707
|
+
() => placement.value.split("-")[0]
|
|
1828
1708
|
);
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1709
|
+
const arrowPlacement = computed(() => {
|
|
1710
|
+
var _a, _b, _c, _d, _e;
|
|
1711
|
+
if (hasCustomPosition.value) {
|
|
1712
|
+
return void 0;
|
|
1713
|
+
}
|
|
1714
|
+
const staticSide = {
|
|
1715
|
+
[Side.top]: Side.bottom,
|
|
1716
|
+
[Side.right]: Side.left,
|
|
1717
|
+
[Side.bottom]: Side.top,
|
|
1718
|
+
[Side.left]: Side.right
|
|
1719
|
+
}[side.value];
|
|
1720
|
+
return {
|
|
1721
|
+
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
1722
|
+
top: ((_c = middlewareData.value.arrow) == null ? void 0 : _c.y) !== void 0 ? `${(_d = middlewareData.value.arrow) == null ? void 0 : _d.y}px` : void 0,
|
|
1723
|
+
[staticSide]: `${-(((_e = arrowEl.value) == null ? void 0 : _e.offsetWidth) ?? 0) / 2}px`
|
|
1724
|
+
};
|
|
1833
1725
|
});
|
|
1834
|
-
const
|
|
1835
|
-
|
|
1836
|
-
|
|
1726
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
1727
|
+
const localModelValue = ref(false);
|
|
1728
|
+
const expanded = computed({
|
|
1729
|
+
get: () => modelValue.value ?? localModelValue.value,
|
|
1730
|
+
set: (newValue) => {
|
|
1731
|
+
if (modelValue.value === void 0) {
|
|
1732
|
+
localModelValue.value = newValue;
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
modelValue.value = newValue;
|
|
1837
1736
|
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1737
|
+
});
|
|
1738
|
+
function show() {
|
|
1739
|
+
expanded.value = true;
|
|
1740
|
+
}
|
|
1741
|
+
function hide() {
|
|
1742
|
+
expanded.value = false;
|
|
1743
|
+
}
|
|
1744
|
+
function toggle() {
|
|
1745
|
+
expanded.value = !expanded.value;
|
|
1746
|
+
}
|
|
1747
|
+
function init(el) {
|
|
1748
|
+
referenceEl.value = el;
|
|
1749
|
+
}
|
|
1750
|
+
__expose({
|
|
1751
|
+
toggle,
|
|
1752
|
+
show,
|
|
1753
|
+
hide,
|
|
1754
|
+
init,
|
|
1755
|
+
customPosition: hasCustomPosition
|
|
1756
|
+
});
|
|
1757
|
+
watch(expanded, (newValue) => {
|
|
1758
|
+
if (newValue && props.autofocusFirst) {
|
|
1759
|
+
nextTick(() => {
|
|
1760
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1761
|
+
floatingEl.value
|
|
1762
|
+
);
|
|
1763
|
+
if (focusableElements.length > 0) {
|
|
1764
|
+
focusableElements[0].focus({
|
|
1765
|
+
preventScroll: true
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
});
|
|
1840
1769
|
}
|
|
1841
|
-
return void 0;
|
|
1842
1770
|
});
|
|
1771
|
+
onClickOutside(
|
|
1772
|
+
floatingEl,
|
|
1773
|
+
() => {
|
|
1774
|
+
if (!props.keepOpen && expanded.value) {
|
|
1775
|
+
expanded.value = false;
|
|
1776
|
+
}
|
|
1777
|
+
},
|
|
1778
|
+
{ ignore: [referenceEl] }
|
|
1779
|
+
);
|
|
1780
|
+
const hasAriaLabelledby = computed(() => {
|
|
1781
|
+
var _a, _b;
|
|
1782
|
+
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
1783
|
+
});
|
|
1784
|
+
const referenceAria = computed(() => ({
|
|
1785
|
+
"aria-controls": hasId.value,
|
|
1786
|
+
"aria-haspopup": true,
|
|
1787
|
+
"aria-expanded": expanded.value
|
|
1788
|
+
}));
|
|
1789
|
+
const { component: VvDropdownTriggerProvider, bus } = useDropdownProvideTrigger({
|
|
1790
|
+
reference: referenceEl,
|
|
1791
|
+
id: hasId,
|
|
1792
|
+
expanded,
|
|
1793
|
+
aria: referenceAria
|
|
1794
|
+
});
|
|
1795
|
+
bus.on("click", toggle);
|
|
1796
|
+
const { role, modifiers } = toRefs(props);
|
|
1843
1797
|
const bemCssClasses = useModifiers(
|
|
1844
|
-
"vv-
|
|
1798
|
+
"vv-dropdown",
|
|
1845
1799
|
modifiers,
|
|
1846
1800
|
computed(() => ({
|
|
1847
|
-
|
|
1848
|
-
invalid: invalid.value,
|
|
1849
|
-
loading: loading.value,
|
|
1850
|
-
disabled: disabled.value,
|
|
1851
|
-
readonly: readonly.value,
|
|
1852
|
-
"icon-before": hasIconBefore.value,
|
|
1853
|
-
"icon-after": hasIconAfter.value,
|
|
1854
|
-
dirty: isDirty.value,
|
|
1855
|
-
focus: focused.value,
|
|
1856
|
-
floating: floating.value,
|
|
1857
|
-
multiple: multiple.value
|
|
1801
|
+
arrow: props.arrow
|
|
1858
1802
|
}))
|
|
1859
1803
|
);
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
"
|
|
1871
|
-
|
|
1872
|
-
|
|
1804
|
+
const { focused } = useFocusWithin(floatingEl);
|
|
1805
|
+
function getKeyboardFocusableElements(element) {
|
|
1806
|
+
if (!element) {
|
|
1807
|
+
return [];
|
|
1808
|
+
}
|
|
1809
|
+
return [
|
|
1810
|
+
...element.querySelectorAll(
|
|
1811
|
+
'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])'
|
|
1812
|
+
)
|
|
1813
|
+
].filter(
|
|
1814
|
+
(el) => !el.hasAttribute("disabled") && !el.getAttribute("aria-hidden")
|
|
1815
|
+
);
|
|
1816
|
+
}
|
|
1817
|
+
function focusNext() {
|
|
1818
|
+
nextTick(() => {
|
|
1819
|
+
if (focused.value) {
|
|
1820
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1821
|
+
floatingEl.value
|
|
1822
|
+
);
|
|
1823
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1827
|
+
document.activeElement
|
|
1828
|
+
);
|
|
1829
|
+
if (activeElementIndex < focusableElements.length - 1) {
|
|
1830
|
+
focusableElements[activeElementIndex + 1].focus({
|
|
1831
|
+
preventScroll: true
|
|
1832
|
+
});
|
|
1833
|
+
} else {
|
|
1834
|
+
focusableElements[0].focus({
|
|
1835
|
+
preventScroll: true
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
function focusPrev() {
|
|
1842
|
+
nextTick(() => {
|
|
1843
|
+
if (focused.value) {
|
|
1844
|
+
const focusableElements = getKeyboardFocusableElements(
|
|
1845
|
+
floatingEl.value
|
|
1846
|
+
);
|
|
1847
|
+
if (focusableElements.length === 0 || !document.activeElement) {
|
|
1848
|
+
return;
|
|
1849
|
+
}
|
|
1850
|
+
const activeElementIndex = focusableElements.indexOf(
|
|
1851
|
+
document.activeElement
|
|
1852
|
+
);
|
|
1853
|
+
if (activeElementIndex > 0) {
|
|
1854
|
+
focusableElements[activeElementIndex - 1].focus({
|
|
1855
|
+
preventScroll: true
|
|
1856
|
+
});
|
|
1857
|
+
} else {
|
|
1858
|
+
focusableElements[focusableElements.length - 1].focus({
|
|
1859
|
+
preventScroll: true
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
const hovered = useElementHover(floatingEl);
|
|
1866
|
+
const { itemRole } = useDropdownProvideItem({
|
|
1867
|
+
role,
|
|
1868
|
+
expanded,
|
|
1869
|
+
focused,
|
|
1870
|
+
hovered
|
|
1871
|
+
});
|
|
1872
|
+
onKeyStroke("Escape", (e) => {
|
|
1873
|
+
if (expanded.value) {
|
|
1874
|
+
e.preventDefault();
|
|
1875
|
+
hide();
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
onKeyStroke("ArrowDown", (e) => {
|
|
1879
|
+
if (expanded.value && focused.value) {
|
|
1880
|
+
e.preventDefault();
|
|
1881
|
+
focusNext();
|
|
1882
|
+
}
|
|
1883
|
+
});
|
|
1884
|
+
onKeyStroke("ArrowUp", (e) => {
|
|
1885
|
+
if (expanded.value && focused.value) {
|
|
1886
|
+
e.preventDefault();
|
|
1887
|
+
focusPrev();
|
|
1888
|
+
}
|
|
1873
1889
|
});
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
}));
|
|
1879
|
-
const {
|
|
1880
|
-
getOptionLabel,
|
|
1881
|
-
getOptionValue,
|
|
1882
|
-
isOptionDisabled,
|
|
1883
|
-
getOptionGrouped
|
|
1884
|
-
} = useOptions(props);
|
|
1885
|
-
const localModelValue = computed({
|
|
1886
|
-
get: () => {
|
|
1887
|
-
return props.modelValue;
|
|
1888
|
-
},
|
|
1889
|
-
set: (newValue) => {
|
|
1890
|
-
if (Array.isArray(newValue)) {
|
|
1891
|
-
newValue = newValue.filter((item) => item !== void 0);
|
|
1892
|
-
}
|
|
1893
|
-
emit("update:modelValue", newValue);
|
|
1890
|
+
onKeyStroke([" ", "Enter"], (e) => {
|
|
1891
|
+
const htmlEl = e.target;
|
|
1892
|
+
if (expanded.value && focused.value && htmlEl) {
|
|
1893
|
+
htmlEl == null ? void 0 : htmlEl.click();
|
|
1894
1894
|
}
|
|
1895
1895
|
});
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1896
|
+
const dropdownTransitionHandlers = {
|
|
1897
|
+
"before-enter": () => {
|
|
1898
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1899
|
+
emit("beforeEnter");
|
|
1900
|
+
},
|
|
1901
|
+
"after-leave": () => {
|
|
1902
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1903
|
+
emit("afterLeave");
|
|
1904
|
+
},
|
|
1905
|
+
"enter": () => {
|
|
1906
|
+
emit("enter");
|
|
1907
|
+
},
|
|
1908
|
+
"after-enter": () => {
|
|
1909
|
+
emit("afterEnter");
|
|
1910
|
+
},
|
|
1911
|
+
"enter-cancelled": () => {
|
|
1912
|
+
emit("enterCancelled");
|
|
1913
|
+
},
|
|
1914
|
+
"before-leave": () => {
|
|
1915
|
+
emit("beforeLeave");
|
|
1916
|
+
},
|
|
1917
|
+
"leave": () => {
|
|
1918
|
+
emit("leave");
|
|
1919
|
+
},
|
|
1920
|
+
"leave-cancelled": () => {
|
|
1921
|
+
emit("leaveCancelled");
|
|
1922
|
+
}
|
|
1900
1923
|
};
|
|
1901
1924
|
return (_ctx, _cache) => {
|
|
1902
|
-
return openBlock(), createElementBlock(
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
1910
|
-
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
1911
|
-
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1912
|
-
])) : createCommentVNode("", true),
|
|
1913
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
1914
|
-
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$9, mergeProps({
|
|
1915
|
-
key: 0,
|
|
1916
|
-
class: "vv-select__icon"
|
|
1917
|
-
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
1918
|
-
withDirectives(createElementVNode("select", mergeProps({
|
|
1919
|
-
id: unref(hasId),
|
|
1920
|
-
ref_key: "select",
|
|
1921
|
-
ref: select,
|
|
1922
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
1923
|
-
}, unref(hasAttrs)), [
|
|
1924
|
-
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
1925
|
-
key: 0,
|
|
1926
|
-
value: void 0,
|
|
1927
|
-
disabled: !_ctx.unselectable,
|
|
1928
|
-
hidden: !_ctx.unselectable
|
|
1929
|
-
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("", true),
|
|
1930
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
1931
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
1932
|
-
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
1933
|
-
key: index,
|
|
1934
|
-
disabled: unref(isOptionDisabled)(option),
|
|
1935
|
-
value: unref(getOptionValue)(option)
|
|
1936
|
-
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
|
|
1937
|
-
key: `group-${index}`,
|
|
1938
|
-
disabled: unref(isOptionDisabled)(option),
|
|
1939
|
-
label: unref(getOptionLabel)(option)
|
|
1940
|
-
}, [
|
|
1941
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
1942
|
-
return openBlock(), createElementBlock("option", {
|
|
1943
|
-
key: `group-${index}-item-${i}`,
|
|
1944
|
-
disabled: unref(isOptionDisabled)(item),
|
|
1945
|
-
value: unref(getOptionValue)(item)
|
|
1946
|
-
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
|
|
1947
|
-
}), 128))
|
|
1948
|
-
], 8, _hoisted_8$1))
|
|
1949
|
-
], 64);
|
|
1950
|
-
}), 256))
|
|
1951
|
-
], 16, _hoisted_5$1), [
|
|
1952
|
-
[vModelSelect, unref(localModelValue)]
|
|
1953
|
-
]),
|
|
1954
|
-
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$9, mergeProps({
|
|
1955
|
-
key: 1,
|
|
1956
|
-
class: "vv-select__icon vv-select__icon-after"
|
|
1957
|
-
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
1958
|
-
]),
|
|
1959
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
1960
|
-
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1961
|
-
])) : createCommentVNode("", true)
|
|
1962
|
-
]),
|
|
1963
|
-
createVNode(unref(HintSlot), {
|
|
1964
|
-
id: unref(hasHintId),
|
|
1965
|
-
class: "vv-select__hint"
|
|
1966
|
-
}, createSlots({ _: 2 }, [
|
|
1967
|
-
_ctx.$slots.hint ? {
|
|
1968
|
-
name: "hint",
|
|
1969
|
-
fn: withCtx(() => [
|
|
1970
|
-
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1971
|
-
]),
|
|
1972
|
-
key: "0"
|
|
1973
|
-
} : void 0,
|
|
1974
|
-
_ctx.$slots.loading ? {
|
|
1975
|
-
name: "loading",
|
|
1976
|
-
fn: withCtx(() => [
|
|
1977
|
-
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1978
|
-
]),
|
|
1979
|
-
key: "1"
|
|
1980
|
-
} : void 0,
|
|
1981
|
-
_ctx.$slots.valid ? {
|
|
1982
|
-
name: "valid",
|
|
1983
|
-
fn: withCtx(() => [
|
|
1984
|
-
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1925
|
+
return openBlock(), createElementBlock(
|
|
1926
|
+
Fragment,
|
|
1927
|
+
null,
|
|
1928
|
+
[
|
|
1929
|
+
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
1930
|
+
default: withCtx(() => [
|
|
1931
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ init, show, hide, toggle, expanded: unref(expanded), aria: unref(referenceAria) })))
|
|
1985
1932
|
]),
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1933
|
+
_: 3
|
|
1934
|
+
/* FORWARDED */
|
|
1935
|
+
}),
|
|
1936
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers(dropdownTransitionHandlers), { persisted: "" }), {
|
|
1937
|
+
default: withCtx(() => [
|
|
1938
|
+
withDirectives(createElementVNode(
|
|
1939
|
+
"div",
|
|
1940
|
+
{
|
|
1941
|
+
ref_key: "floatingEl",
|
|
1942
|
+
ref: floatingEl,
|
|
1943
|
+
style: normalizeStyle(unref(dropdownPlacement)),
|
|
1944
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
1945
|
+
},
|
|
1946
|
+
[
|
|
1947
|
+
props.arrow ? (openBlock(), createElementBlock(
|
|
1948
|
+
"div",
|
|
1949
|
+
{
|
|
1950
|
+
key: 0,
|
|
1951
|
+
ref_key: "arrowEl",
|
|
1952
|
+
ref: arrowEl,
|
|
1953
|
+
style: normalizeStyle(unref(arrowPlacement)),
|
|
1954
|
+
class: "vv-dropdown__arrow"
|
|
1955
|
+
},
|
|
1956
|
+
null,
|
|
1957
|
+
4
|
|
1958
|
+
/* STYLE */
|
|
1959
|
+
)) : createCommentVNode("v-if", true),
|
|
1960
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps({ expanded: unref(expanded) }))),
|
|
1961
|
+
createElementVNode("div", mergeProps(unref(attrs), {
|
|
1962
|
+
id: unref(hasId),
|
|
1963
|
+
ref_key: "listEl",
|
|
1964
|
+
ref: listEl,
|
|
1965
|
+
tabindex: !unref(expanded) ? -1 : void 0,
|
|
1966
|
+
role: unref(role),
|
|
1967
|
+
"aria-labelledby": unref(hasAriaLabelledby),
|
|
1968
|
+
class: "vv-dropdown__list"
|
|
1969
|
+
}), [
|
|
1970
|
+
renderSlot(_ctx.$slots, "items", normalizeProps(guardReactiveProps({
|
|
1971
|
+
role: unref(itemRole)
|
|
1972
|
+
})))
|
|
1973
|
+
], 16, _hoisted_1$4),
|
|
1974
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps({ expanded: unref(expanded) })))
|
|
1975
|
+
],
|
|
1976
|
+
6
|
|
1977
|
+
/* CLASS, STYLE */
|
|
1978
|
+
), [
|
|
1979
|
+
[vShow, unref(expanded)]
|
|
1980
|
+
])
|
|
1992
1981
|
]),
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1982
|
+
_: 3
|
|
1983
|
+
/* FORWARDED */
|
|
1984
|
+
}, 16, ["name"])
|
|
1985
|
+
],
|
|
1986
|
+
64
|
|
1987
|
+
/* STABLE_FRAGMENT */
|
|
1988
|
+
);
|
|
1997
1989
|
};
|
|
1998
1990
|
}
|
|
1999
1991
|
});
|
|
2000
|
-
const
|
|
2001
|
-
|
|
2002
|
-
|
|
1992
|
+
const _hoisted_1$3 = {
|
|
1993
|
+
class: "vv-dropdown-optgroup",
|
|
1994
|
+
role: "presentation",
|
|
1995
|
+
tabindex: "-1"
|
|
1996
|
+
};
|
|
1997
|
+
const __default__$4 = {
|
|
1998
|
+
name: "VvDropdownOptgroup"
|
|
2003
1999
|
};
|
|
2000
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2001
|
+
...__default__$4,
|
|
2002
|
+
props: {
|
|
2003
|
+
...LabelProps
|
|
2004
|
+
},
|
|
2005
|
+
setup(__props) {
|
|
2006
|
+
const props = __props;
|
|
2007
|
+
return (_ctx, _cache) => {
|
|
2008
|
+
return openBlock(), createElementBlock(
|
|
2009
|
+
"li",
|
|
2010
|
+
_hoisted_1$3,
|
|
2011
|
+
toDisplayString(props.label),
|
|
2012
|
+
1
|
|
2013
|
+
/* TEXT */
|
|
2014
|
+
);
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
});
|
|
2004
2018
|
const __default__$3 = {
|
|
2005
|
-
name: "
|
|
2019
|
+
name: "VvDropdownItem"
|
|
2006
2020
|
};
|
|
2007
2021
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2008
2022
|
...__default__$3,
|
|
2009
|
-
props:
|
|
2023
|
+
props: VvDropdownItemProps,
|
|
2010
2024
|
setup(__props) {
|
|
2011
2025
|
const props = __props;
|
|
2012
|
-
const {
|
|
2013
|
-
const
|
|
2026
|
+
const { role, expanded } = useInjectedDropdownItem();
|
|
2027
|
+
const element = ref(null);
|
|
2028
|
+
useDropdownProvideAction({ expanded });
|
|
2029
|
+
const hovered = useElementHover(element);
|
|
2030
|
+
const { focused } = useFocus(element);
|
|
2031
|
+
const { focused: focusedWithin } = useFocusWithin(element);
|
|
2032
|
+
watch(hovered, (newValue) => {
|
|
2033
|
+
if (newValue && props.focusOnHover) {
|
|
2034
|
+
focused.value = true;
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2014
2037
|
return (_ctx, _cache) => {
|
|
2015
|
-
return openBlock(), createElementBlock(
|
|
2016
|
-
|
|
2017
|
-
role:
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2038
|
+
return openBlock(), createElementBlock(
|
|
2039
|
+
"div",
|
|
2040
|
+
mergeProps({ role: unref(role) }, {
|
|
2041
|
+
ref_key: "element",
|
|
2042
|
+
ref: element,
|
|
2043
|
+
class: ["vv-dropdown__item", { "focus-visible": unref(focused) || unref(focusedWithin) }]
|
|
2044
|
+
}),
|
|
2045
|
+
[
|
|
2046
|
+
renderSlot(_ctx.$slots, "default")
|
|
2047
|
+
],
|
|
2048
|
+
16
|
|
2049
|
+
/* FULL_PROPS */
|
|
2050
|
+
);
|
|
2023
2051
|
};
|
|
2024
2052
|
}
|
|
2025
2053
|
});
|
|
2026
|
-
const
|
|
2027
|
-
const VvActionProps = ActionProps;
|
|
2054
|
+
const _hoisted_1$2 = ["title"];
|
|
2028
2055
|
const __default__$2 = {
|
|
2029
|
-
name: "
|
|
2056
|
+
name: "VvDropdownOption"
|
|
2030
2057
|
};
|
|
2031
2058
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2032
2059
|
...__default__$2,
|
|
2033
|
-
props:
|
|
2034
|
-
|
|
2035
|
-
setup(__props, { expose: __expose, emit }) {
|
|
2060
|
+
props: VvDropdownOptionProps,
|
|
2061
|
+
setup(__props) {
|
|
2036
2062
|
const props = __props;
|
|
2037
|
-
const
|
|
2038
|
-
const
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
watch(
|
|
2047
|
-
() => element.value,
|
|
2048
|
-
(newValue) => {
|
|
2049
|
-
if (dropdownTriggerReference) {
|
|
2050
|
-
dropdownTriggerReference.value = newValue;
|
|
2051
|
-
}
|
|
2052
|
-
}
|
|
2063
|
+
const { modifiers } = toRefs(props);
|
|
2064
|
+
const bemCssClasses = useModifiers(
|
|
2065
|
+
"vv-dropdown-option",
|
|
2066
|
+
modifiers,
|
|
2067
|
+
computed(() => ({
|
|
2068
|
+
disabled: props.disabled,
|
|
2069
|
+
selected: props.selected,
|
|
2070
|
+
unselectable: props.unselectable && props.selected
|
|
2071
|
+
}))
|
|
2053
2072
|
);
|
|
2054
|
-
const
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
const { role } = useInjectedDropdownAction();
|
|
2058
|
-
const hasTag = computed(() => {
|
|
2059
|
-
switch (true) {
|
|
2060
|
-
case props.disabled:
|
|
2061
|
-
return ActionTag.button;
|
|
2062
|
-
case props.to !== void 0:
|
|
2063
|
-
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
2064
|
-
case props.href !== void 0:
|
|
2065
|
-
return ActionTag.a;
|
|
2066
|
-
default:
|
|
2067
|
-
return ActionTag.button;
|
|
2073
|
+
const hintLabel = computed(() => {
|
|
2074
|
+
if (props.selected) {
|
|
2075
|
+
return props.unselectable ? props.deselectHintLabel : props.selectedHintLabel;
|
|
2068
2076
|
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
const toReturn = {
|
|
2072
|
-
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
2073
|
-
ariaPressed: pressed.value ? true : void 0,
|
|
2074
|
-
ariaLabel: props.ariaLabel,
|
|
2075
|
-
role: role == null ? void 0 : role.value
|
|
2076
|
-
};
|
|
2077
|
-
switch (hasTag.value) {
|
|
2078
|
-
case ActionTag.a:
|
|
2079
|
-
return {
|
|
2080
|
-
...toReturn,
|
|
2081
|
-
href: props.href,
|
|
2082
|
-
target: props.target,
|
|
2083
|
-
rel: props.rel
|
|
2084
|
-
};
|
|
2085
|
-
case ActionTag.routerLink:
|
|
2086
|
-
case ActionTag.nuxtLink:
|
|
2087
|
-
return {
|
|
2088
|
-
...toReturn,
|
|
2089
|
-
to: props.to,
|
|
2090
|
-
target: props.target
|
|
2091
|
-
};
|
|
2092
|
-
default:
|
|
2093
|
-
return {
|
|
2094
|
-
...toReturn,
|
|
2095
|
-
type: props.type,
|
|
2096
|
-
disabled: props.disabled
|
|
2097
|
-
};
|
|
2077
|
+
if (!props.disabled) {
|
|
2078
|
+
return props.selectHintLabel;
|
|
2098
2079
|
}
|
|
2080
|
+
return "";
|
|
2099
2081
|
});
|
|
2100
|
-
const onClick = (e) => {
|
|
2101
|
-
if (props.disabled) {
|
|
2102
|
-
e.preventDefault();
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
2106
|
-
emit("click", e);
|
|
2107
|
-
};
|
|
2108
|
-
const onMouseover = (e) => {
|
|
2109
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
2110
|
-
emit("mouseover", e);
|
|
2111
|
-
};
|
|
2112
|
-
const onMouseleave = (e) => {
|
|
2113
|
-
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
2114
|
-
emit("mouseleave", e);
|
|
2115
|
-
};
|
|
2116
2082
|
return (_ctx, _cache) => {
|
|
2117
|
-
return openBlock(), createBlock(
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
function getGroupOrLocalRef(propName, props, emit) {
|
|
2144
|
-
if (group == null ? void 0 : group.value) {
|
|
2145
|
-
const groupPropValue = unref(group.value)[propName];
|
|
2146
|
-
return computed({
|
|
2147
|
-
get() {
|
|
2148
|
-
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
2149
|
-
},
|
|
2150
|
-
set(value) {
|
|
2151
|
-
groupPropValue.value = value;
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
}
|
|
2155
|
-
const propRef = toRef(props, propName);
|
|
2156
|
-
return computed({
|
|
2157
|
-
get() {
|
|
2158
|
-
return propRef.value;
|
|
2159
|
-
},
|
|
2160
|
-
set(value) {
|
|
2161
|
-
if (emit)
|
|
2162
|
-
emit(`update:${propName}`, value);
|
|
2163
|
-
}
|
|
2164
|
-
});
|
|
2083
|
+
return openBlock(), createBlock(_sfc_main$3, {
|
|
2084
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
2085
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
2086
|
+
"aria-selected": _ctx.selected,
|
|
2087
|
+
"aria-disabled": _ctx.disabled,
|
|
2088
|
+
"focus-on-hover": _ctx.focusOnHover
|
|
2089
|
+
}, {
|
|
2090
|
+
default: withCtx(() => [
|
|
2091
|
+
renderSlot(_ctx.$slots, "default"),
|
|
2092
|
+
createElementVNode("span", {
|
|
2093
|
+
class: "vv-dropdown-option__hint",
|
|
2094
|
+
title: unref(hintLabel)
|
|
2095
|
+
}, [
|
|
2096
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps({ disabled: _ctx.disabled, selected: _ctx.selected, unselectable: _ctx.unselectable })), () => [
|
|
2097
|
+
createTextVNode(
|
|
2098
|
+
toDisplayString(unref(hintLabel)),
|
|
2099
|
+
1
|
|
2100
|
+
/* TEXT */
|
|
2101
|
+
)
|
|
2102
|
+
])
|
|
2103
|
+
], 8, _hoisted_1$2)
|
|
2104
|
+
]),
|
|
2105
|
+
_: 3
|
|
2106
|
+
/* FORWARDED */
|
|
2107
|
+
}, 8, ["class", "tabindex", "aria-selected", "aria-disabled", "focus-on-hover"]);
|
|
2108
|
+
};
|
|
2165
2109
|
}
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
...
|
|
2175
|
-
...
|
|
2110
|
+
});
|
|
2111
|
+
const VvSelectProps = {
|
|
2112
|
+
...IdNameProps,
|
|
2113
|
+
...AutofocusProps,
|
|
2114
|
+
...AutocompleteProps,
|
|
2115
|
+
...TabindexProps,
|
|
2116
|
+
...ValidProps,
|
|
2117
|
+
...InvalidProps,
|
|
2118
|
+
...HintProps,
|
|
2119
|
+
...LoadingProps,
|
|
2120
|
+
...DisabledProps,
|
|
2121
|
+
...ReadonlyProps,
|
|
2176
2122
|
...ModifiersProps,
|
|
2123
|
+
...OptionsProps,
|
|
2124
|
+
...IconProps,
|
|
2125
|
+
...FloatingLabelProps,
|
|
2177
2126
|
...UnselectableProps,
|
|
2178
|
-
...
|
|
2179
|
-
/**
|
|
2180
|
-
* Button icon
|
|
2181
|
-
*/
|
|
2182
|
-
icon: [String, Object],
|
|
2127
|
+
...LabelProps,
|
|
2183
2128
|
/**
|
|
2184
|
-
*
|
|
2129
|
+
* This Boolean attribute indicates that multiple options can be selected in the list.
|
|
2130
|
+
* If it is not specified, then only one option can be selected at a time.
|
|
2131
|
+
* When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.
|
|
2132
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple
|
|
2185
2133
|
*/
|
|
2186
|
-
|
|
2187
|
-
type: String,
|
|
2188
|
-
default: Side.left,
|
|
2189
|
-
validator: (value) => Object.values(Side).includes(value)
|
|
2190
|
-
},
|
|
2134
|
+
multiple: Boolean,
|
|
2191
2135
|
/**
|
|
2192
|
-
*
|
|
2136
|
+
* A Boolean attribute indicating that an option with a non-empty string value must be selected.
|
|
2137
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-required
|
|
2193
2138
|
*/
|
|
2194
|
-
|
|
2139
|
+
required: Boolean,
|
|
2195
2140
|
/**
|
|
2196
|
-
*
|
|
2141
|
+
* If the control is presented as a scrolling list box (e.g. when multiple is specified),
|
|
2142
|
+
* this attribute represents the number of rows in the list that should be visible at one time.
|
|
2143
|
+
* Browsers are not required to present a select element as a scrolled list box. The default value is 0.
|
|
2144
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-size
|
|
2197
2145
|
*/
|
|
2198
|
-
|
|
2199
|
-
type: Boolean,
|
|
2200
|
-
default: false
|
|
2201
|
-
},
|
|
2146
|
+
size: [String, Number],
|
|
2202
2147
|
/**
|
|
2203
|
-
*
|
|
2148
|
+
* modelValue can be a string, number, boolean, object or array of string, number, boolean, object
|
|
2204
2149
|
*/
|
|
2205
|
-
|
|
2206
|
-
type: [String, Number, Boolean],
|
|
2150
|
+
modelValue: {
|
|
2151
|
+
type: [String, Number, Boolean, Object, Array],
|
|
2207
2152
|
default: void 0
|
|
2208
2153
|
},
|
|
2209
2154
|
/**
|
|
2210
|
-
*
|
|
2155
|
+
* Select first option automatically
|
|
2211
2156
|
*/
|
|
2212
|
-
|
|
2213
|
-
type:
|
|
2214
|
-
default:
|
|
2157
|
+
autoselectFirst: {
|
|
2158
|
+
type: Boolean,
|
|
2159
|
+
default: false
|
|
2215
2160
|
},
|
|
2216
2161
|
/**
|
|
2217
|
-
*
|
|
2162
|
+
* Select placeholder
|
|
2218
2163
|
*/
|
|
2219
|
-
|
|
2220
|
-
type: [String, Number, Boolean],
|
|
2221
|
-
default: void 0
|
|
2222
|
-
}
|
|
2164
|
+
placeholder: String
|
|
2223
2165
|
};
|
|
2224
|
-
function
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
props
|
|
2232
|
-
);
|
|
2233
|
-
const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
|
|
2234
|
-
const modifiers = computed(() => {
|
|
2235
|
-
let localModifiers = props.modifiers;
|
|
2236
|
-
let groupModifiers = group == null ? void 0 : group.value.modifiers.value;
|
|
2237
|
-
const toReturn = /* @__PURE__ */ new Set();
|
|
2238
|
-
if (localModifiers) {
|
|
2239
|
-
if (!Array.isArray(localModifiers)) {
|
|
2240
|
-
localModifiers = localModifiers.split(" ");
|
|
2241
|
-
}
|
|
2242
|
-
localModifiers.forEach((modifier) => toReturn.add(modifier));
|
|
2166
|
+
function useVvSelectProps() {
|
|
2167
|
+
return {
|
|
2168
|
+
...VvSelectProps,
|
|
2169
|
+
options: {
|
|
2170
|
+
...VvSelectProps.options,
|
|
2171
|
+
type: Array,
|
|
2172
|
+
default: () => []
|
|
2243
2173
|
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2174
|
+
};
|
|
2175
|
+
}
|
|
2176
|
+
function useDefaults(componentName, propsDefinition, props) {
|
|
2177
|
+
const volver = useVolver();
|
|
2178
|
+
const volverComponentDefaults = computed(() => {
|
|
2179
|
+
var _a;
|
|
2180
|
+
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
2181
|
+
return void 0;
|
|
2249
2182
|
}
|
|
2250
|
-
return
|
|
2183
|
+
return volver.defaults.value[componentName];
|
|
2251
2184
|
});
|
|
2252
|
-
|
|
2253
|
-
()
|
|
2254
|
-
|
|
2255
|
-
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
2185
|
+
return computed(() => {
|
|
2186
|
+
if (volverComponentDefaults.value === void 0) {
|
|
2187
|
+
return props;
|
|
2256
2188
|
}
|
|
2257
|
-
|
|
2189
|
+
const componentDefaults = volverComponentDefaults.value;
|
|
2190
|
+
const simplifiedPropsDefinition = propsDefinition;
|
|
2191
|
+
const simplifiedProps = props;
|
|
2192
|
+
return Object.keys(simplifiedPropsDefinition).reduce((acc, key) => {
|
|
2193
|
+
const propValue = simplifiedProps[key];
|
|
2194
|
+
acc[key] = propValue;
|
|
2195
|
+
if (key in componentDefaults) {
|
|
2196
|
+
if (Array.isArray(simplifiedPropsDefinition[key])) {
|
|
2197
|
+
const typeArray = simplifiedPropsDefinition[key];
|
|
2198
|
+
if (typeArray.length) {
|
|
2199
|
+
const typeFunction = typeArray[0];
|
|
2200
|
+
if (typeFunction === propValue) {
|
|
2201
|
+
acc[key] = componentDefaults[key];
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
if (typeof simplifiedPropsDefinition[key] === "function") {
|
|
2206
|
+
const typeFunction = simplifiedPropsDefinition[key];
|
|
2207
|
+
if (typeFunction() === propValue) {
|
|
2208
|
+
acc[key] = componentDefaults[key];
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
if (typeof simplifiedPropsDefinition[key] === "object") {
|
|
2212
|
+
let defaultValue = simplifiedPropsDefinition[key].default;
|
|
2213
|
+
if (typeof defaultValue === "function") {
|
|
2214
|
+
defaultValue = defaultValue();
|
|
2215
|
+
}
|
|
2216
|
+
if (typeof defaultValue === "object") {
|
|
2217
|
+
if (JSON.stringify(defaultValue) === JSON.stringify(propValue)) {
|
|
2218
|
+
acc[key] = componentDefaults[key];
|
|
2219
|
+
}
|
|
2220
|
+
} else if (defaultValue === propValue) {
|
|
2221
|
+
acc[key] = componentDefaults[key];
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return acc;
|
|
2226
|
+
}, {});
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2229
|
+
function useComponentFocus(inputTemplateRef, emit) {
|
|
2230
|
+
const { focused } = useFocus(inputTemplateRef);
|
|
2231
|
+
watch(focused, (newValue) => {
|
|
2232
|
+
emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
|
|
2233
|
+
});
|
|
2258
2234
|
return {
|
|
2259
|
-
|
|
2260
|
-
group,
|
|
2261
|
-
isInGroup,
|
|
2262
|
-
modelValue,
|
|
2263
|
-
toggle,
|
|
2264
|
-
unselectable,
|
|
2265
|
-
multiple,
|
|
2266
|
-
modifiers,
|
|
2267
|
-
disabled,
|
|
2268
|
-
// local props
|
|
2269
|
-
id,
|
|
2270
|
-
pressed,
|
|
2271
|
-
iconPosition,
|
|
2272
|
-
icon,
|
|
2273
|
-
label
|
|
2235
|
+
focused
|
|
2274
2236
|
};
|
|
2275
2237
|
}
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2238
|
+
function useOptions(props) {
|
|
2239
|
+
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
2240
|
+
const getOptionLabel = (option) => {
|
|
2241
|
+
if (typeof option === "string") {
|
|
2242
|
+
return option;
|
|
2243
|
+
}
|
|
2244
|
+
if (typeof labelKey.value === "function") {
|
|
2245
|
+
return labelKey.value(option);
|
|
2246
|
+
}
|
|
2247
|
+
return String(
|
|
2248
|
+
labelKey.value ? get(option, labelKey.value) : option
|
|
2249
|
+
);
|
|
2250
|
+
};
|
|
2251
|
+
const getOptionValue = (option) => {
|
|
2252
|
+
if (typeof option === "string") {
|
|
2253
|
+
return option;
|
|
2254
|
+
}
|
|
2255
|
+
if (typeof valueKey.value === "function") {
|
|
2256
|
+
return valueKey.value(option);
|
|
2257
|
+
}
|
|
2258
|
+
return valueKey.value ? get(option, valueKey.value) : option;
|
|
2259
|
+
};
|
|
2260
|
+
const isOptionDisabled = (option) => {
|
|
2261
|
+
if (typeof option === "string") {
|
|
2262
|
+
return false;
|
|
2263
|
+
}
|
|
2264
|
+
if (typeof disabledKey.value === "function") {
|
|
2265
|
+
return disabledKey.value(option);
|
|
2266
|
+
}
|
|
2267
|
+
return disabledKey.value ? get(option, disabledKey.value) : false;
|
|
2268
|
+
};
|
|
2269
|
+
const getOptionGrouped = (option) => {
|
|
2270
|
+
if (typeof option == "string") {
|
|
2271
|
+
return [];
|
|
2272
|
+
}
|
|
2273
|
+
if (typeof option === "object" && option && "options" in option) {
|
|
2274
|
+
return option.options;
|
|
2275
|
+
}
|
|
2276
|
+
return [];
|
|
2277
|
+
};
|
|
2278
|
+
return {
|
|
2279
|
+
options,
|
|
2280
|
+
getOptionLabel,
|
|
2281
|
+
getOptionValue,
|
|
2282
|
+
isOptionDisabled,
|
|
2283
|
+
getOptionGrouped
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
const _hoisted_1$1 = ["for"];
|
|
2287
|
+
const _hoisted_2$1 = { class: "vv-select__wrapper" };
|
|
2288
|
+
const _hoisted_3$1 = {
|
|
2289
|
+
key: 0,
|
|
2290
|
+
class: "vv-select__input-before"
|
|
2279
2291
|
};
|
|
2280
|
-
const
|
|
2292
|
+
const _hoisted_4$1 = { class: "vv-select__inner" };
|
|
2293
|
+
const _hoisted_5$1 = ["id"];
|
|
2294
|
+
const _hoisted_6$1 = ["disabled", "hidden"];
|
|
2295
|
+
const _hoisted_7$1 = ["disabled", "value"];
|
|
2296
|
+
const _hoisted_8$1 = ["disabled", "label"];
|
|
2297
|
+
const _hoisted_9$1 = ["disabled", "value"];
|
|
2298
|
+
const _hoisted_10 = {
|
|
2281
2299
|
key: 1,
|
|
2282
|
-
class: "vv-
|
|
2300
|
+
class: "vv-select__input-after"
|
|
2283
2301
|
};
|
|
2284
2302
|
const __default__$1 = {
|
|
2285
|
-
name: "
|
|
2303
|
+
name: "VvSelect"
|
|
2286
2304
|
};
|
|
2287
2305
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2288
2306
|
...__default__$1,
|
|
2289
|
-
props:
|
|
2290
|
-
emits:
|
|
2291
|
-
setup(__props, {
|
|
2307
|
+
props: useVvSelectProps(),
|
|
2308
|
+
emits: ["update:modelValue", "focus", "blur"],
|
|
2309
|
+
setup(__props, { emit: __emit }) {
|
|
2292
2310
|
const props = __props;
|
|
2293
|
-
const
|
|
2311
|
+
const emit = __emit;
|
|
2294
2312
|
const slots = useSlots();
|
|
2313
|
+
const VvSelectProps2 = useVvSelectProps();
|
|
2314
|
+
const propsDefaults = useDefaults(
|
|
2315
|
+
"VvSelect",
|
|
2316
|
+
VvSelectProps2,
|
|
2317
|
+
props
|
|
2318
|
+
);
|
|
2319
|
+
const selectEl = ref();
|
|
2320
|
+
const {
|
|
2321
|
+
HintSlot,
|
|
2322
|
+
hasHintLabelOrSlot,
|
|
2323
|
+
hasInvalidLabelOrSlot,
|
|
2324
|
+
hintSlotScope
|
|
2325
|
+
} = HintSlotFactory(propsDefaults, slots);
|
|
2326
|
+
const { focused } = useComponentFocus(selectEl, emit);
|
|
2327
|
+
function isGroup(option) {
|
|
2328
|
+
var _a;
|
|
2329
|
+
if (typeof option === "string") {
|
|
2330
|
+
return false;
|
|
2331
|
+
}
|
|
2332
|
+
return (_a = option.options) == null ? void 0 : _a.length;
|
|
2333
|
+
}
|
|
2295
2334
|
const {
|
|
2296
2335
|
id,
|
|
2297
2336
|
modifiers,
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2337
|
+
disabled,
|
|
2338
|
+
readonly,
|
|
2339
|
+
loading,
|
|
2340
|
+
icon,
|
|
2341
|
+
iconPosition,
|
|
2342
|
+
invalid,
|
|
2343
|
+
valid,
|
|
2344
|
+
floating,
|
|
2345
|
+
multiple
|
|
2346
|
+
} = toRefs(props);
|
|
2306
2347
|
const hasId = useUniqueId(id);
|
|
2307
|
-
const
|
|
2308
|
-
const
|
|
2309
|
-
const
|
|
2310
|
-
|
|
2311
|
-
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
2348
|
+
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
2349
|
+
const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
|
|
2350
|
+
const hasTabindex = computed(() => {
|
|
2351
|
+
return isDisabledOrReadonly.value ? -1 : props.tabindex;
|
|
2312
2352
|
});
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2353
|
+
const localModelValue = computed({
|
|
2354
|
+
get: () => {
|
|
2355
|
+
return props.modelValue;
|
|
2356
|
+
},
|
|
2357
|
+
set: (newValue) => {
|
|
2358
|
+
if (Array.isArray(newValue)) {
|
|
2359
|
+
newValue = newValue.filter((item) => item !== void 0);
|
|
2360
|
+
if (newValue.length === 0 && !props.unselectable && selectEl.value) {
|
|
2361
|
+
selectEl.value.value = String(props.modelValue);
|
|
2362
|
+
return;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
emit("update:modelValue", newValue);
|
|
2317
2366
|
}
|
|
2318
|
-
|
|
2319
|
-
|
|
2367
|
+
});
|
|
2368
|
+
const isDirty = computed(() => {
|
|
2369
|
+
if (Array.isArray(localModelValue.value)) {
|
|
2370
|
+
return localModelValue.value.length > 0;
|
|
2320
2371
|
}
|
|
2321
|
-
return
|
|
2372
|
+
return localModelValue.value !== void 0 && localModelValue.value !== null;
|
|
2373
|
+
});
|
|
2374
|
+
const isVisible = useElementVisibility(selectEl);
|
|
2375
|
+
watch(isVisible, (newValue) => {
|
|
2376
|
+
if (newValue && props.autofocus) {
|
|
2377
|
+
focused.value = true;
|
|
2378
|
+
}
|
|
2379
|
+
});
|
|
2380
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
2381
|
+
const isInvalid = computed(() => {
|
|
2382
|
+
if (props.invalid === true) {
|
|
2383
|
+
return true;
|
|
2384
|
+
}
|
|
2385
|
+
if (props.valid === true) {
|
|
2386
|
+
return false;
|
|
2387
|
+
}
|
|
2388
|
+
return void 0;
|
|
2322
2389
|
});
|
|
2323
2390
|
const bemCssClasses = useModifiers(
|
|
2324
|
-
"vv-
|
|
2391
|
+
"vv-select",
|
|
2325
2392
|
modifiers,
|
|
2326
2393
|
computed(() => ({
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
"icon-
|
|
2334
|
-
|
|
2335
|
-
|
|
2394
|
+
"valid": valid.value,
|
|
2395
|
+
"invalid": invalid.value,
|
|
2396
|
+
"loading": loading.value,
|
|
2397
|
+
"disabled": disabled.value,
|
|
2398
|
+
"readonly": readonly.value,
|
|
2399
|
+
"icon-before": hasIconBefore.value !== void 0,
|
|
2400
|
+
"icon-after": hasIconAfter.value !== void 0,
|
|
2401
|
+
"dirty": isDirty.value,
|
|
2402
|
+
"focus": focused.value,
|
|
2403
|
+
"floating": floating.value,
|
|
2404
|
+
"multiple": multiple.value
|
|
2336
2405
|
}))
|
|
2337
2406
|
);
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2407
|
+
const {
|
|
2408
|
+
getOptionLabel,
|
|
2409
|
+
getOptionValue,
|
|
2410
|
+
isOptionDisabled,
|
|
2411
|
+
getOptionGrouped
|
|
2412
|
+
} = useOptions(props);
|
|
2413
|
+
watch(
|
|
2414
|
+
() => props.options,
|
|
2415
|
+
(newValue) => {
|
|
2416
|
+
if ((newValue == null ? void 0 : newValue.length) && props.autoselectFirst && !isDirty.value) {
|
|
2417
|
+
const firstOptionValue = getOptionValue(newValue[0]);
|
|
2418
|
+
localModelValue.value = props.multiple ? [firstOptionValue] : firstOptionValue;
|
|
2419
|
+
}
|
|
2420
|
+
},
|
|
2421
|
+
{ immediate: true }
|
|
2340
2422
|
);
|
|
2341
|
-
const
|
|
2342
|
-
return
|
|
2423
|
+
const hasAttrs = computed(() => {
|
|
2424
|
+
return {
|
|
2425
|
+
"name": props.name,
|
|
2426
|
+
"tabindex": hasTabindex.value,
|
|
2427
|
+
"disabled": isDisabledOrReadonly.value,
|
|
2428
|
+
"required": props.required,
|
|
2429
|
+
"size": props.size,
|
|
2430
|
+
"autocomplete": props.autocomplete,
|
|
2431
|
+
"multiple": props.multiple,
|
|
2432
|
+
"aria-invalid": isInvalid.value,
|
|
2433
|
+
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
2434
|
+
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
2435
|
+
};
|
|
2343
2436
|
});
|
|
2344
|
-
const
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
modelValue.value = modelValue.value.filter(
|
|
2350
|
-
(n) => n !== toggleValue.value
|
|
2351
|
-
);
|
|
2352
|
-
}
|
|
2353
|
-
return;
|
|
2354
|
-
}
|
|
2355
|
-
modelValue.value.push(toggleValue.value);
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
if (toggleValue.value === modelValue.value && unselectable.value) {
|
|
2359
|
-
modelValue.value = props.uncheckedValue;
|
|
2360
|
-
return;
|
|
2361
|
-
}
|
|
2362
|
-
modelValue.value = toggleValue.value;
|
|
2363
|
-
}
|
|
2364
|
-
};
|
|
2437
|
+
const slotProps = computed(() => ({
|
|
2438
|
+
valid: props.valid,
|
|
2439
|
+
invalid: props.invalid,
|
|
2440
|
+
modelValue: props.modelValue
|
|
2441
|
+
}));
|
|
2365
2442
|
return (_ctx, _cache) => {
|
|
2366
|
-
return openBlock(),
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2443
|
+
return openBlock(), createElementBlock(
|
|
2444
|
+
"div",
|
|
2445
|
+
{
|
|
2446
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
2447
|
+
},
|
|
2448
|
+
[
|
|
2449
|
+
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
2450
|
+
key: 0,
|
|
2451
|
+
for: unref(hasId)
|
|
2452
|
+
}, toDisplayString(_ctx.label), 9, _hoisted_1$1)) : createCommentVNode("v-if", true),
|
|
2453
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
2454
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
|
|
2455
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2456
|
+
])) : createCommentVNode("v-if", true),
|
|
2457
|
+
createElementVNode("div", _hoisted_4$1, [
|
|
2458
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2459
|
+
_sfc_main$7,
|
|
2460
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2461
|
+
null,
|
|
2462
|
+
16
|
|
2463
|
+
/* FULL_PROPS */
|
|
2464
|
+
)) : createCommentVNode("v-if", true),
|
|
2465
|
+
withDirectives(createElementVNode("select", mergeProps({
|
|
2466
|
+
id: unref(hasId),
|
|
2467
|
+
ref_key: "selectEl",
|
|
2468
|
+
ref: selectEl
|
|
2469
|
+
}, unref(hasAttrs), {
|
|
2470
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
2471
|
+
}), [
|
|
2472
|
+
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
2473
|
+
key: 0,
|
|
2474
|
+
value: void 0,
|
|
2475
|
+
disabled: !_ctx.unselectable,
|
|
2476
|
+
hidden: !_ctx.unselectable
|
|
2477
|
+
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("v-if", true),
|
|
2478
|
+
(openBlock(true), createElementBlock(
|
|
2479
|
+
Fragment,
|
|
2480
|
+
null,
|
|
2481
|
+
renderList(_ctx.options, (option, index) => {
|
|
2482
|
+
return openBlock(), createElementBlock(
|
|
2483
|
+
Fragment,
|
|
2484
|
+
null,
|
|
2485
|
+
[
|
|
2486
|
+
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
2487
|
+
key: index,
|
|
2488
|
+
disabled: unref(isOptionDisabled)(option),
|
|
2489
|
+
value: unref(getOptionValue)(option)
|
|
2490
|
+
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$1)) : (openBlock(), createElementBlock("optgroup", {
|
|
2491
|
+
key: `group-${index}`,
|
|
2492
|
+
disabled: unref(isOptionDisabled)(option),
|
|
2493
|
+
label: unref(getOptionLabel)(option)
|
|
2494
|
+
}, [
|
|
2495
|
+
(openBlock(true), createElementBlock(
|
|
2496
|
+
Fragment,
|
|
2497
|
+
null,
|
|
2498
|
+
renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
2499
|
+
return openBlock(), createElementBlock("option", {
|
|
2500
|
+
key: `group-${index}-item-${i}`,
|
|
2501
|
+
disabled: unref(isOptionDisabled)(item),
|
|
2502
|
+
value: unref(getOptionValue)(item)
|
|
2503
|
+
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
|
|
2504
|
+
}),
|
|
2505
|
+
128
|
|
2506
|
+
/* KEYED_FRAGMENT */
|
|
2507
|
+
))
|
|
2508
|
+
], 8, _hoisted_8$1))
|
|
2509
|
+
],
|
|
2510
|
+
64
|
|
2511
|
+
/* STABLE_FRAGMENT */
|
|
2512
|
+
);
|
|
2513
|
+
}),
|
|
2514
|
+
256
|
|
2515
|
+
/* UNKEYED_FRAGMENT */
|
|
2516
|
+
))
|
|
2517
|
+
], 16, _hoisted_5$1), [
|
|
2518
|
+
[vModelSelect, unref(localModelValue)]
|
|
2519
|
+
]),
|
|
2520
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
2521
|
+
_sfc_main$7,
|
|
2522
|
+
mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
2523
|
+
null,
|
|
2524
|
+
16
|
|
2525
|
+
/* FULL_PROPS */
|
|
2526
|
+
)) : createCommentVNode("v-if", true)
|
|
2527
|
+
]),
|
|
2528
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
2529
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2530
|
+
])) : createCommentVNode("v-if", true)
|
|
2531
|
+
]),
|
|
2532
|
+
createVNode(unref(HintSlot), {
|
|
2533
|
+
id: unref(hasHintId),
|
|
2534
|
+
class: "vv-select__hint"
|
|
2535
|
+
}, createSlots({
|
|
2536
|
+
_: 2
|
|
2537
|
+
/* DYNAMIC */
|
|
2538
|
+
}, [
|
|
2539
|
+
_ctx.$slots.hint ? {
|
|
2540
|
+
name: "hint",
|
|
2541
|
+
fn: withCtx(() => [
|
|
2542
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2543
|
+
]),
|
|
2544
|
+
key: "0"
|
|
2545
|
+
} : void 0,
|
|
2546
|
+
_ctx.$slots.loading ? {
|
|
2547
|
+
name: "loading",
|
|
2548
|
+
fn: withCtx(() => [
|
|
2549
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2550
|
+
]),
|
|
2551
|
+
key: "1"
|
|
2552
|
+
} : void 0,
|
|
2553
|
+
_ctx.$slots.valid ? {
|
|
2554
|
+
name: "valid",
|
|
2555
|
+
fn: withCtx(() => [
|
|
2556
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2557
|
+
]),
|
|
2558
|
+
key: "2"
|
|
2559
|
+
} : void 0,
|
|
2560
|
+
_ctx.$slots.invalid ? {
|
|
2561
|
+
name: "invalid",
|
|
2562
|
+
fn: withCtx(() => [
|
|
2563
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2564
|
+
]),
|
|
2565
|
+
key: "3"
|
|
2566
|
+
} : void 0
|
|
2567
|
+
]), 1032, ["id"])
|
|
2568
|
+
],
|
|
2569
|
+
2
|
|
2570
|
+
/* CLASS */
|
|
2571
|
+
);
|
|
2409
2572
|
};
|
|
2410
2573
|
}
|
|
2411
2574
|
});
|
|
@@ -2417,7 +2580,7 @@ const _hoisted_4 = {
|
|
|
2417
2580
|
class: "vv-select__input-before"
|
|
2418
2581
|
};
|
|
2419
2582
|
const _hoisted_5 = { class: "vv-select__inner" };
|
|
2420
|
-
const _hoisted_6 = ["aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
|
|
2583
|
+
const _hoisted_6 = ["aria-controls", "aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
|
|
2421
2584
|
const _hoisted_7 = {
|
|
2422
2585
|
key: 0,
|
|
2423
2586
|
class: "vv-select__value"
|
|
@@ -2430,39 +2593,36 @@ const _hoisted_9 = {
|
|
|
2430
2593
|
const __default__ = {
|
|
2431
2594
|
name: "VvCombobox",
|
|
2432
2595
|
components: {
|
|
2433
|
-
VvDropdown: _sfc_main$
|
|
2434
|
-
VvDropdownOption: _sfc_main$
|
|
2435
|
-
VvDropdownOptgroup: _sfc_main$
|
|
2436
|
-
VvButton: _sfc_main$
|
|
2596
|
+
VvDropdown: _sfc_main$5,
|
|
2597
|
+
VvDropdownOption: _sfc_main$2,
|
|
2598
|
+
VvDropdownOptgroup: _sfc_main$4,
|
|
2599
|
+
VvButton: _sfc_main$6
|
|
2437
2600
|
}
|
|
2438
2601
|
};
|
|
2439
2602
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2440
2603
|
...__default__,
|
|
2441
|
-
props:
|
|
2442
|
-
emits:
|
|
2443
|
-
setup(__props, { emit }) {
|
|
2604
|
+
props: useVvComboboxProps(),
|
|
2605
|
+
emits: ["update:modelValue", "update:search", "change:search", "focus", "blur"],
|
|
2606
|
+
setup(__props, { emit: __emit }) {
|
|
2444
2607
|
const props = __props;
|
|
2608
|
+
const emit = __emit;
|
|
2445
2609
|
const slots = useSlots();
|
|
2610
|
+
const VvComboboxProps2 = useVvComboboxProps();
|
|
2446
2611
|
const propsDefaults = useDefaults(
|
|
2447
2612
|
"VvCombobox",
|
|
2448
|
-
|
|
2613
|
+
VvComboboxProps2,
|
|
2449
2614
|
props
|
|
2450
2615
|
);
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
return option.options && option.options.length > 0;
|
|
2456
|
-
};
|
|
2616
|
+
const inputEl = ref(null);
|
|
2617
|
+
const inputSearchEl = ref(null);
|
|
2618
|
+
const wrapperEl = ref(null);
|
|
2619
|
+
const dropdownEl = ref();
|
|
2457
2620
|
const {
|
|
2458
2621
|
HintSlot,
|
|
2459
2622
|
hasHintLabelOrSlot,
|
|
2460
2623
|
hasInvalidLabelOrSlot,
|
|
2461
2624
|
hintSlotScope
|
|
2462
2625
|
} = HintSlotFactory(propsDefaults, slots);
|
|
2463
|
-
const inputEl = ref(null);
|
|
2464
|
-
const inputSearchEl = ref(null);
|
|
2465
|
-
const wrapperEl = ref(null);
|
|
2466
2626
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
2467
2627
|
const { focused: focusedWithin } = useFocusWithin(wrapperEl);
|
|
2468
2628
|
watch(focused, (newValue) => {
|
|
@@ -2487,27 +2647,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2487
2647
|
searchText,
|
|
2488
2648
|
computed(() => Number(props.debounceSearch))
|
|
2489
2649
|
);
|
|
2490
|
-
watch(
|
|
2491
|
-
debouncedSearchText
|
|
2492
|
-
|
|
2493
|
-
);
|
|
2650
|
+
watch(debouncedSearchText, () => {
|
|
2651
|
+
emit("update:search", debouncedSearchText.value);
|
|
2652
|
+
emit("change:search", debouncedSearchText.value);
|
|
2653
|
+
});
|
|
2494
2654
|
const expanded = ref(false);
|
|
2495
|
-
|
|
2496
|
-
if (
|
|
2655
|
+
function toggleExpanded() {
|
|
2656
|
+
if (isDisabledOrReadonly.value)
|
|
2497
2657
|
return;
|
|
2498
2658
|
expanded.value = !expanded.value;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
if (
|
|
2659
|
+
}
|
|
2660
|
+
function expand() {
|
|
2661
|
+
if (isDisabledOrReadonly.value || expanded.value)
|
|
2502
2662
|
return;
|
|
2503
2663
|
expanded.value = true;
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
if (
|
|
2664
|
+
}
|
|
2665
|
+
function collapse() {
|
|
2666
|
+
if (isDisabledOrReadonly.value || !expanded.value)
|
|
2507
2667
|
return;
|
|
2508
2668
|
expanded.value = false;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2669
|
+
}
|
|
2670
|
+
function onAfterExpand() {
|
|
2511
2671
|
if (propsDefaults.value.searchable) {
|
|
2512
2672
|
if (inputSearchEl.value) {
|
|
2513
2673
|
inputSearchEl.value.focus({
|
|
@@ -2515,12 +2675,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2515
2675
|
});
|
|
2516
2676
|
}
|
|
2517
2677
|
}
|
|
2518
|
-
}
|
|
2519
|
-
|
|
2678
|
+
}
|
|
2679
|
+
function onAfterCollapse() {
|
|
2520
2680
|
if (propsDefaults.value.searchable) {
|
|
2521
2681
|
searchText.value = "";
|
|
2522
2682
|
}
|
|
2523
|
-
}
|
|
2683
|
+
}
|
|
2684
|
+
function isGroup(option) {
|
|
2685
|
+
var _a;
|
|
2686
|
+
if (typeof option === "string") {
|
|
2687
|
+
return false;
|
|
2688
|
+
}
|
|
2689
|
+
return (_a = option.options) == null ? void 0 : _a.length;
|
|
2690
|
+
}
|
|
2524
2691
|
const {
|
|
2525
2692
|
id,
|
|
2526
2693
|
icon,
|
|
@@ -2538,32 +2705,68 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2538
2705
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
2539
2706
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
2540
2707
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
2541
|
-
const
|
|
2542
|
-
const isLoading = computed(() => localLoading.value || loading.value);
|
|
2543
|
-
const dropdownEl = ref();
|
|
2544
|
-
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
2545
|
-
icon,
|
|
2546
|
-
iconPosition
|
|
2547
|
-
);
|
|
2548
|
-
const isDirty = computed(() => !isEmpty(props.modelValue));
|
|
2708
|
+
const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
|
|
2549
2709
|
const hasTabindex = computed(() => {
|
|
2550
|
-
return
|
|
2710
|
+
return isDisabledOrReadonly.value ? -1 : props.tabindex;
|
|
2711
|
+
});
|
|
2712
|
+
const localModelValue = computed({
|
|
2713
|
+
get: () => {
|
|
2714
|
+
if (Array.isArray(props.modelValue)) {
|
|
2715
|
+
return props.modelValue;
|
|
2716
|
+
}
|
|
2717
|
+
return props.modelValue !== void 0 && props.modelValue !== null ? [props.modelValue] : [];
|
|
2718
|
+
},
|
|
2719
|
+
set: (value) => {
|
|
2720
|
+
emit("update:modelValue", props.multiple || Array.isArray(props.modelValue) ? value : value.pop());
|
|
2721
|
+
}
|
|
2722
|
+
});
|
|
2723
|
+
const sizeOfModelValue = computed(() => localModelValue.value.length);
|
|
2724
|
+
const isDirty = computed(() => sizeOfModelValue.value > 0);
|
|
2725
|
+
const hasMaxValues = computed(() => {
|
|
2726
|
+
if (!props.multiple) {
|
|
2727
|
+
return 1;
|
|
2728
|
+
}
|
|
2729
|
+
if (props.maxValues === void 0) {
|
|
2730
|
+
return Infinity;
|
|
2731
|
+
}
|
|
2732
|
+
return Number(props.maxValues);
|
|
2733
|
+
});
|
|
2734
|
+
const isUnselectable = computed(() => {
|
|
2735
|
+
if (isDisabledOrReadonly.value) {
|
|
2736
|
+
return false;
|
|
2737
|
+
}
|
|
2738
|
+
if (!props.unselectable) {
|
|
2739
|
+
return false;
|
|
2740
|
+
}
|
|
2741
|
+
return Number(props.minValues) === 0 || sizeOfModelValue.value > Number(props.minValues);
|
|
2742
|
+
});
|
|
2743
|
+
const isSelectable = computed(() => {
|
|
2744
|
+
if (isDisabledOrReadonly.value) {
|
|
2745
|
+
return false;
|
|
2746
|
+
}
|
|
2747
|
+
if (!props.multiple) {
|
|
2748
|
+
return true;
|
|
2749
|
+
}
|
|
2750
|
+
return sizeOfModelValue.value < hasMaxValues.value;
|
|
2551
2751
|
});
|
|
2752
|
+
const localLoading = ref(false);
|
|
2753
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
2754
|
+
const { hasIconBefore, hasIconAfter } = useComponentIcon(icon, iconPosition);
|
|
2552
2755
|
const bemCssClasses = useModifiers(
|
|
2553
2756
|
"vv-select",
|
|
2554
2757
|
modifiers,
|
|
2555
2758
|
computed(() => ({
|
|
2556
|
-
disabled: disabled.value,
|
|
2557
|
-
loading: isLoading.value,
|
|
2558
|
-
readonly: readonly.value,
|
|
2559
|
-
"icon-before":
|
|
2560
|
-
"icon-after":
|
|
2561
|
-
valid: valid.value,
|
|
2562
|
-
invalid: invalid.value,
|
|
2563
|
-
dirty: isDirty.value,
|
|
2564
|
-
focus: focused.value,
|
|
2565
|
-
floating: floating.value,
|
|
2566
|
-
badges: props.badges
|
|
2759
|
+
"disabled": disabled.value,
|
|
2760
|
+
"loading": isLoading.value,
|
|
2761
|
+
"readonly": readonly.value,
|
|
2762
|
+
"icon-before": hasIconBefore.value !== void 0,
|
|
2763
|
+
"icon-after": hasIconAfter.value !== void 0,
|
|
2764
|
+
"valid": valid.value,
|
|
2765
|
+
"invalid": invalid.value,
|
|
2766
|
+
"dirty": isDirty.value,
|
|
2767
|
+
"focus": focused.value || focusedWithin.value || expanded.value,
|
|
2768
|
+
"floating": floating.value,
|
|
2769
|
+
"badges": props.badges
|
|
2567
2770
|
}))
|
|
2568
2771
|
);
|
|
2569
2772
|
const {
|
|
@@ -2572,6 +2775,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2572
2775
|
getOptionGrouped,
|
|
2573
2776
|
isOptionDisabled
|
|
2574
2777
|
} = useOptions(props);
|
|
2778
|
+
function isOptionDisabledOrNotSelectable(option) {
|
|
2779
|
+
return isOptionDisabled(option) || !isSelectable.value && !isOptionSelected(option);
|
|
2780
|
+
}
|
|
2575
2781
|
const filteredOptions = computedAsync(async () => {
|
|
2576
2782
|
var _a;
|
|
2577
2783
|
if (propsDefaults.value.searchFunction) {
|
|
@@ -2590,10 +2796,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2590
2796
|
});
|
|
2591
2797
|
});
|
|
2592
2798
|
function isOptionSelected(option) {
|
|
2593
|
-
|
|
2594
|
-
|
|
2799
|
+
const optionValue = getOptionValue(option);
|
|
2800
|
+
if (typeof optionValue === "object") {
|
|
2801
|
+
return localModelValue.value.some((item) => {
|
|
2802
|
+
if (typeof item === "object") {
|
|
2803
|
+
return JSON.stringify(item) === JSON.stringify(optionValue);
|
|
2804
|
+
}
|
|
2805
|
+
return false;
|
|
2806
|
+
});
|
|
2595
2807
|
}
|
|
2596
|
-
return
|
|
2808
|
+
return localModelValue.value.includes(optionValue);
|
|
2597
2809
|
}
|
|
2598
2810
|
const selectedOptions = computed(() => {
|
|
2599
2811
|
const options = props.options.reduce(
|
|
@@ -2612,44 +2824,38 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2612
2824
|
const hasValue = computed(() => {
|
|
2613
2825
|
return selectedOptions.value.map((option) => getOptionLabel(option)).join(props.separator);
|
|
2614
2826
|
});
|
|
2615
|
-
|
|
2827
|
+
function onClickInput() {
|
|
2616
2828
|
props.autoOpen ? expand() : toggleExpanded();
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
if (props.multiple) {
|
|
2626
|
-
if (Array.isArray(props.modelValue)) {
|
|
2627
|
-
const maxValues = Number(props.maxValues);
|
|
2628
|
-
if (props.maxValues !== void 0 && maxValues >= 0 && ((_a = props.modelValue) == null ? void 0 : _a.length) >= maxValues) {
|
|
2629
|
-
if (!contains(value, props.modelValue)) {
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
toReturn = contains(value, props.modelValue) ? removeFromList(value, props.modelValue) : [...props.modelValue, value];
|
|
2634
|
-
} else {
|
|
2635
|
-
toReturn = [value];
|
|
2636
|
-
}
|
|
2637
|
-
} else {
|
|
2638
|
-
if (!props.keepOpen) {
|
|
2639
|
-
collapse();
|
|
2640
|
-
}
|
|
2641
|
-
if (Array.isArray(props.modelValue)) {
|
|
2642
|
-
if (props.unselectable && props.modelValue.includes(value)) {
|
|
2643
|
-
toReturn = [];
|
|
2644
|
-
} else {
|
|
2645
|
-
toReturn = [value];
|
|
2829
|
+
}
|
|
2830
|
+
function onInput(option) {
|
|
2831
|
+
const isSelected = isOptionSelected(option);
|
|
2832
|
+
const optionValue = getOptionValue(option);
|
|
2833
|
+
if (isSelected && isUnselectable.value) {
|
|
2834
|
+
localModelValue.value = localModelValue.value.filter((item) => {
|
|
2835
|
+
if (typeof optionValue === "object" && typeof item === "object") {
|
|
2836
|
+
return JSON.stringify(item) !== JSON.stringify(optionValue);
|
|
2646
2837
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2838
|
+
return item !== optionValue;
|
|
2839
|
+
});
|
|
2840
|
+
} else if (!isSelected && isSelectable.value) {
|
|
2841
|
+
if (!props.multiple) {
|
|
2842
|
+
localModelValue.value = [];
|
|
2649
2843
|
}
|
|
2844
|
+
localModelValue.value = [...localModelValue.value, optionValue];
|
|
2650
2845
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2846
|
+
if (!props.multiple && !props.keepOpen) {
|
|
2847
|
+
collapse();
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
watch(
|
|
2851
|
+
() => props.options,
|
|
2852
|
+
(newValue) => {
|
|
2853
|
+
if ((newValue == null ? void 0 : newValue.length) && props.autoselectFirst && !isDirty.value) {
|
|
2854
|
+
onInput(newValue[0]);
|
|
2855
|
+
}
|
|
2856
|
+
},
|
|
2857
|
+
{ immediate: true }
|
|
2858
|
+
);
|
|
2653
2859
|
const selectProps = computed(() => ({
|
|
2654
2860
|
id: hasId.value,
|
|
2655
2861
|
name: props.name,
|
|
@@ -2670,7 +2876,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2670
2876
|
icon: propsDefaults.value.icon,
|
|
2671
2877
|
iconPosition: propsDefaults.value.iconPosition,
|
|
2672
2878
|
floating: propsDefaults.value.floating,
|
|
2673
|
-
unselectable:
|
|
2879
|
+
unselectable: isUnselectable.value,
|
|
2880
|
+
autoselectFirst: propsDefaults.value.autoselectFirst,
|
|
2674
2881
|
multiple: propsDefaults.value.multiple,
|
|
2675
2882
|
label: propsDefaults.value.label,
|
|
2676
2883
|
placeholder: propsDefaults.value.placeholder,
|
|
@@ -2720,208 +2927,307 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2720
2927
|
key: 0,
|
|
2721
2928
|
id: unref(hasLabelId),
|
|
2722
2929
|
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
2723
|
-
}, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("", true),
|
|
2724
|
-
createElementVNode(
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
"
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
unref(
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
disabled: unref(isOptionDisabled)(item)
|
|
2827
|
-
})), () => [
|
|
2828
|
-
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
2829
|
-
])
|
|
2830
|
-
]),
|
|
2831
|
-
_: 2
|
|
2832
|
-
}, 1040, ["onClickPassive"]);
|
|
2833
|
-
}), 128))
|
|
2834
|
-
], 64)) : (openBlock(), createBlock(_sfc_main$6, mergeProps({ key: 1 }, {
|
|
2835
|
-
selected: isOptionSelected(option),
|
|
2836
|
-
disabled: unref(isOptionDisabled)(option),
|
|
2837
|
-
unselectable: _ctx.unselectable,
|
|
2838
|
-
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
2839
|
-
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
2840
|
-
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
2841
|
-
}, {
|
|
2842
|
-
class: "vv-dropdown-option",
|
|
2843
|
-
onClickPassive: ($event) => onInput(option)
|
|
2844
|
-
}), {
|
|
2845
|
-
default: withCtx(() => [
|
|
2846
|
-
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
2847
|
-
option,
|
|
2848
|
-
selectedOptions: unref(selectedOptions),
|
|
2849
|
-
selected: isOptionSelected(option),
|
|
2850
|
-
disabled: unref(isOptionDisabled)(option)
|
|
2851
|
-
})), () => [
|
|
2852
|
-
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
2853
|
-
])
|
|
2854
|
-
]),
|
|
2855
|
-
_: 2
|
|
2856
|
-
}, 1040, ["onClickPassive"]))
|
|
2857
|
-
], 64);
|
|
2858
|
-
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2859
|
-
key: 1,
|
|
2860
|
-
modifiers: "inert"
|
|
2861
|
-
}, {
|
|
2862
|
-
default: withCtx(() => [
|
|
2863
|
-
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
2864
|
-
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
2865
|
-
])
|
|
2866
|
-
]),
|
|
2867
|
-
_: 3
|
|
2868
|
-
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2869
|
-
key: 2,
|
|
2870
|
-
modifiers: "inert"
|
|
2871
|
-
}, {
|
|
2872
|
-
default: withCtx(() => [
|
|
2873
|
-
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
2874
|
-
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
2930
|
+
}, toDisplayString(_ctx.label), 9, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
2931
|
+
createElementVNode(
|
|
2932
|
+
"div",
|
|
2933
|
+
{
|
|
2934
|
+
ref_key: "wrapperEl",
|
|
2935
|
+
ref: wrapperEl,
|
|
2936
|
+
class: "vv-select__wrapper"
|
|
2937
|
+
},
|
|
2938
|
+
[
|
|
2939
|
+
createVNode(_sfc_main$5, mergeProps({
|
|
2940
|
+
ref_key: "dropdownEl",
|
|
2941
|
+
ref: dropdownEl,
|
|
2942
|
+
modelValue: unref(expanded),
|
|
2943
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(expanded) ? expanded.value = $event : null)
|
|
2944
|
+
}, unref(dropdownProps), {
|
|
2945
|
+
role: unref(DropdownRole).listbox,
|
|
2946
|
+
onAfterExpand,
|
|
2947
|
+
onAfterCollapse
|
|
2948
|
+
}), createSlots({
|
|
2949
|
+
default: withCtx(({ aria }) => [
|
|
2950
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
2951
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
2952
|
+
])) : createCommentVNode("v-if", true),
|
|
2953
|
+
createElementVNode("div", _hoisted_5, [
|
|
2954
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2955
|
+
_sfc_main$7,
|
|
2956
|
+
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2957
|
+
null,
|
|
2958
|
+
16
|
|
2959
|
+
/* FULL_PROPS */
|
|
2960
|
+
)) : createCommentVNode("v-if", true),
|
|
2961
|
+
createElementVNode("div", mergeProps({
|
|
2962
|
+
ref_key: "inputEl",
|
|
2963
|
+
ref: inputEl
|
|
2964
|
+
}, aria, {
|
|
2965
|
+
class: "vv-select__input",
|
|
2966
|
+
role: "combobox",
|
|
2967
|
+
"aria-controls": unref(hasDropdownId),
|
|
2968
|
+
"aria-expanded": unref(expanded),
|
|
2969
|
+
"aria-labelledby": unref(hasLabelId),
|
|
2970
|
+
"aria-describedby": unref(hasHintLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2971
|
+
"aria-errormessage": unref(hasInvalidLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2972
|
+
tabindex: unref(hasTabindex),
|
|
2973
|
+
onClickPassive: onClickInput
|
|
2974
|
+
}), [
|
|
2975
|
+
renderSlot(_ctx.$slots, "value", normalizeProps(guardReactiveProps({ selectedOptions: unref(selectedOptions), onInput })), () => [
|
|
2976
|
+
unref(hasValue) ? (openBlock(), createElementBlock(
|
|
2977
|
+
Fragment,
|
|
2978
|
+
{ key: 0 },
|
|
2979
|
+
[
|
|
2980
|
+
!_ctx.badges ? (openBlock(), createElementBlock(
|
|
2981
|
+
"div",
|
|
2982
|
+
_hoisted_7,
|
|
2983
|
+
toDisplayString(unref(hasValue)),
|
|
2984
|
+
1
|
|
2985
|
+
/* TEXT */
|
|
2986
|
+
)) : (openBlock(true), createElementBlock(
|
|
2987
|
+
Fragment,
|
|
2988
|
+
{ key: 1 },
|
|
2989
|
+
renderList(unref(selectedOptions), (option, index) => {
|
|
2990
|
+
return openBlock(), createBlock(_sfc_main$9, {
|
|
2991
|
+
key: index,
|
|
2992
|
+
modifiers: _ctx.badgeModifiers,
|
|
2993
|
+
class: "vv-select__badge"
|
|
2994
|
+
}, {
|
|
2995
|
+
default: withCtx(() => [
|
|
2996
|
+
createTextVNode(
|
|
2997
|
+
toDisplayString(unref(getOptionLabel)(option)) + " ",
|
|
2998
|
+
1
|
|
2999
|
+
/* TEXT */
|
|
3000
|
+
),
|
|
3001
|
+
unref(isUnselectable) ? (openBlock(), createElementBlock("button", {
|
|
3002
|
+
key: 0,
|
|
3003
|
+
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
3004
|
+
type: "button",
|
|
3005
|
+
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3006
|
+
}, [
|
|
3007
|
+
createVNode(_sfc_main$7, { name: "close" })
|
|
3008
|
+
], 8, _hoisted_8)) : createCommentVNode("v-if", true)
|
|
3009
|
+
]),
|
|
3010
|
+
_: 2
|
|
3011
|
+
/* DYNAMIC */
|
|
3012
|
+
}, 1032, ["modifiers"]);
|
|
3013
|
+
}),
|
|
3014
|
+
128
|
|
3015
|
+
/* KEYED_FRAGMENT */
|
|
3016
|
+
))
|
|
3017
|
+
],
|
|
3018
|
+
64
|
|
3019
|
+
/* STABLE_FRAGMENT */
|
|
3020
|
+
)) : (openBlock(), createElementBlock(
|
|
3021
|
+
Fragment,
|
|
3022
|
+
{ key: 1 },
|
|
3023
|
+
[
|
|
3024
|
+
createTextVNode(
|
|
3025
|
+
toDisplayString(_ctx.placeholder),
|
|
3026
|
+
1
|
|
3027
|
+
/* TEXT */
|
|
3028
|
+
)
|
|
3029
|
+
],
|
|
3030
|
+
64
|
|
3031
|
+
/* STABLE_FRAGMENT */
|
|
3032
|
+
))
|
|
2875
3033
|
])
|
|
2876
|
-
]),
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
3034
|
+
], 16, _hoisted_6),
|
|
3035
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
3036
|
+
_sfc_main$7,
|
|
3037
|
+
mergeProps({ key: 1 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
3038
|
+
null,
|
|
3039
|
+
16
|
|
3040
|
+
/* FULL_PROPS */
|
|
3041
|
+
)) : createCommentVNode("v-if", true)
|
|
3042
|
+
]),
|
|
3043
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_9, [
|
|
3044
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3045
|
+
])) : createCommentVNode("v-if", true)
|
|
3046
|
+
]),
|
|
3047
|
+
items: withCtx(() => {
|
|
2883
3048
|
var _a;
|
|
2884
3049
|
return [
|
|
2885
|
-
((_a = unref(
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
3050
|
+
!unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(
|
|
3051
|
+
Fragment,
|
|
3052
|
+
{ key: 0 },
|
|
3053
|
+
renderList(unref(filteredOptions), (option, index) => {
|
|
3054
|
+
return openBlock(), createElementBlock(
|
|
3055
|
+
Fragment,
|
|
3056
|
+
{ key: index },
|
|
3057
|
+
[
|
|
3058
|
+
isGroup(option) ? (openBlock(), createElementBlock(
|
|
3059
|
+
Fragment,
|
|
3060
|
+
{ key: 0 },
|
|
3061
|
+
[
|
|
3062
|
+
createVNode(_sfc_main$4, {
|
|
3063
|
+
label: unref(getOptionLabel)(option)
|
|
3064
|
+
}, null, 8, ["label"]),
|
|
3065
|
+
(openBlock(true), createElementBlock(
|
|
3066
|
+
Fragment,
|
|
3067
|
+
null,
|
|
3068
|
+
renderList(unref(getOptionGrouped)(
|
|
3069
|
+
option
|
|
3070
|
+
), (item, i) => {
|
|
3071
|
+
return openBlock(), createBlock(_sfc_main$2, mergeProps({ ref_for: true }, {
|
|
3072
|
+
selected: isOptionSelected(item),
|
|
3073
|
+
disabled: isOptionDisabledOrNotSelectable(item),
|
|
3074
|
+
unselectable: unref(isUnselectable),
|
|
3075
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3076
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3077
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3078
|
+
}, {
|
|
3079
|
+
key: i,
|
|
3080
|
+
class: "vv-dropdown-option",
|
|
3081
|
+
"focus-on-hover": "",
|
|
3082
|
+
onClickPassive: ($event) => onInput(item)
|
|
3083
|
+
}), {
|
|
3084
|
+
default: withCtx(() => [
|
|
3085
|
+
renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
|
|
3086
|
+
option,
|
|
3087
|
+
selectedOptions: unref(selectedOptions),
|
|
3088
|
+
selected: isOptionSelected(item),
|
|
3089
|
+
disabled: isOptionDisabledOrNotSelectable(item)
|
|
3090
|
+
}), () => [
|
|
3091
|
+
createTextVNode(
|
|
3092
|
+
toDisplayString(unref(getOptionLabel)(item)),
|
|
3093
|
+
1
|
|
3094
|
+
/* TEXT */
|
|
3095
|
+
)
|
|
3096
|
+
])
|
|
3097
|
+
]),
|
|
3098
|
+
_: 2
|
|
3099
|
+
/* DYNAMIC */
|
|
3100
|
+
}, 1040, ["onClickPassive"]);
|
|
3101
|
+
}),
|
|
3102
|
+
128
|
|
3103
|
+
/* KEYED_FRAGMENT */
|
|
3104
|
+
))
|
|
3105
|
+
],
|
|
3106
|
+
64
|
|
3107
|
+
/* STABLE_FRAGMENT */
|
|
3108
|
+
)) : (openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
3109
|
+
key: 1,
|
|
3110
|
+
ref_for: true
|
|
3111
|
+
}, {
|
|
3112
|
+
selected: isOptionSelected(option),
|
|
3113
|
+
disabled: isOptionDisabledOrNotSelectable(option),
|
|
3114
|
+
unselectable: unref(isUnselectable),
|
|
3115
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3116
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3117
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3118
|
+
}, {
|
|
3119
|
+
class: "vv-dropdown-option",
|
|
3120
|
+
"focus-on-hover": "",
|
|
3121
|
+
onClickPassive: ($event) => onInput(option)
|
|
3122
|
+
}), {
|
|
3123
|
+
default: withCtx(() => [
|
|
3124
|
+
renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, {
|
|
3125
|
+
option,
|
|
3126
|
+
selectedOptions: unref(selectedOptions),
|
|
3127
|
+
selected: isOptionSelected(option),
|
|
3128
|
+
disabled: isOptionDisabledOrNotSelectable(option)
|
|
3129
|
+
}), () => [
|
|
3130
|
+
createTextVNode(
|
|
3131
|
+
toDisplayString(unref(getOptionLabel)(option)),
|
|
3132
|
+
1
|
|
3133
|
+
/* TEXT */
|
|
3134
|
+
)
|
|
3135
|
+
])
|
|
3136
|
+
]),
|
|
3137
|
+
_: 2
|
|
3138
|
+
/* DYNAMIC */
|
|
3139
|
+
}, 1040, ["onClickPassive"]))
|
|
3140
|
+
],
|
|
3141
|
+
64
|
|
3142
|
+
/* STABLE_FRAGMENT */
|
|
3143
|
+
);
|
|
3144
|
+
}),
|
|
3145
|
+
128
|
|
3146
|
+
/* KEYED_FRAGMENT */
|
|
3147
|
+
)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3148
|
+
key: 1,
|
|
3149
|
+
modifiers: "inert"
|
|
3150
|
+
}, {
|
|
3151
|
+
default: withCtx(() => [
|
|
3152
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
3153
|
+
createTextVNode(
|
|
3154
|
+
toDisplayString(unref(propsDefaults).noOptionsLabel),
|
|
3155
|
+
1
|
|
3156
|
+
/* TEXT */
|
|
3157
|
+
)
|
|
3158
|
+
])
|
|
3159
|
+
]),
|
|
3160
|
+
_: 3
|
|
3161
|
+
/* FORWARDED */
|
|
3162
|
+
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3163
|
+
key: 2,
|
|
3164
|
+
modifiers: "inert"
|
|
3165
|
+
}, {
|
|
3166
|
+
default: withCtx(() => [
|
|
3167
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
3168
|
+
createTextVNode(
|
|
3169
|
+
toDisplayString(unref(propsDefaults).noResultsLabel),
|
|
3170
|
+
1
|
|
3171
|
+
/* TEXT */
|
|
3172
|
+
)
|
|
3173
|
+
])
|
|
3174
|
+
]),
|
|
3175
|
+
_: 3
|
|
3176
|
+
/* FORWARDED */
|
|
3177
|
+
})) : createCommentVNode("v-if", true)
|
|
2891
3178
|
];
|
|
2892
|
-
})
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
|
|
2906
|
-
"aria-autocomplete": "list",
|
|
2907
|
-
"aria-controls": unref(hasDropdownId),
|
|
2908
|
-
autocomplete: "off",
|
|
2909
|
-
spellcheck: "false",
|
|
2910
|
-
type: "search",
|
|
2911
|
-
class: "vv-dropdown__search",
|
|
2912
|
-
placeholder: unref(propsDefaults).searchPlaceholder
|
|
2913
|
-
}, null, 8, _hoisted_3)), [
|
|
2914
|
-
[vModelText, unref(searchText)]
|
|
2915
|
-
]) : createCommentVNode("", true)
|
|
3179
|
+
}),
|
|
3180
|
+
after: withCtx(() => [
|
|
3181
|
+
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
3182
|
+
var _a;
|
|
3183
|
+
return [
|
|
3184
|
+
((_a = unref(dropdownEl)) == null ? void 0 : _a.customPosition) ? (openBlock(), createBlock(_sfc_main$6, {
|
|
3185
|
+
key: 0,
|
|
3186
|
+
label: unref(propsDefaults).closeLabel,
|
|
3187
|
+
modifiers: "secondary",
|
|
3188
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(dropdownEl).hide())
|
|
3189
|
+
}, null, 8, ["label"])) : createCommentVNode("v-if", true)
|
|
3190
|
+
];
|
|
3191
|
+
})
|
|
2916
3192
|
]),
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3193
|
+
_: 2
|
|
3194
|
+
/* DYNAMIC */
|
|
3195
|
+
}, [
|
|
3196
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
3197
|
+
name: "before",
|
|
3198
|
+
fn: withCtx(() => [
|
|
3199
|
+
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
3200
|
+
unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
3201
|
+
key: 0,
|
|
3202
|
+
id: unref(hasSearchId),
|
|
3203
|
+
ref_key: "inputSearchEl",
|
|
3204
|
+
ref: inputSearchEl,
|
|
3205
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
|
|
3206
|
+
"aria-autocomplete": "list",
|
|
3207
|
+
"aria-controls": unref(hasDropdownId),
|
|
3208
|
+
autocomplete: "off",
|
|
3209
|
+
spellcheck: "false",
|
|
3210
|
+
type: "search",
|
|
3211
|
+
class: "vv-dropdown__search",
|
|
3212
|
+
placeholder: unref(propsDefaults).searchPlaceholder
|
|
3213
|
+
}, null, 8, _hoisted_3)), [
|
|
3214
|
+
[vModelText, unref(searchText)]
|
|
3215
|
+
]) : createCommentVNode("v-if", true)
|
|
3216
|
+
]),
|
|
3217
|
+
key: "0"
|
|
3218
|
+
} : void 0
|
|
3219
|
+
]), 1040, ["modelValue", "role"])
|
|
3220
|
+
],
|
|
3221
|
+
512
|
|
3222
|
+
/* NEED_PATCH */
|
|
3223
|
+
),
|
|
2921
3224
|
createVNode(unref(HintSlot), {
|
|
2922
3225
|
id: unref(hasHintId),
|
|
2923
3226
|
class: "vv-select__hint"
|
|
2924
|
-
}, createSlots({
|
|
3227
|
+
}, createSlots({
|
|
3228
|
+
_: 2
|
|
3229
|
+
/* DYNAMIC */
|
|
3230
|
+
}, [
|
|
2925
3231
|
_ctx.$slots.hint ? {
|
|
2926
3232
|
name: "hint",
|
|
2927
3233
|
fn: withCtx(() => [
|
|
@@ -2951,9 +3257,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2951
3257
|
key: "3"
|
|
2952
3258
|
} : void 0
|
|
2953
3259
|
]), 1032, ["id"])
|
|
2954
|
-
], 10, _hoisted_1)) : (openBlock(), createBlock(
|
|
2955
|
-
|
|
2956
|
-
|
|
3260
|
+
], 10, _hoisted_1)) : (openBlock(), createBlock(
|
|
3261
|
+
_sfc_main$1,
|
|
3262
|
+
mergeProps({ key: 1 }, unref(selectProps), {
|
|
3263
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => emit("update:modelValue", $event))
|
|
3264
|
+
}),
|
|
3265
|
+
null,
|
|
3266
|
+
16
|
|
3267
|
+
/* FULL_PROPS */
|
|
3268
|
+
));
|
|
2957
3269
|
};
|
|
2958
3270
|
}
|
|
2959
3271
|
});
|