@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
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 +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- 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 +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { iconExists
|
|
3
|
-
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, h, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, isRef, Fragment, renderList, vModelSelect, createVNode } from "vue";
|
|
2
|
+
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
|
+
import { toReactive, useFocus, useElementVisibility } from "@vueuse/core";
|
|
4
|
+
import { nanoid } from "nanoid";
|
|
5
|
+
const VvIconProps = {
|
|
4
6
|
/**
|
|
5
7
|
* Color
|
|
6
8
|
*/
|
|
@@ -24,7 +26,7 @@ const me = {
|
|
|
24
26
|
*/
|
|
25
27
|
name: {
|
|
26
28
|
type: String,
|
|
27
|
-
required:
|
|
29
|
+
required: true
|
|
28
30
|
},
|
|
29
31
|
/**
|
|
30
32
|
* By default 'vv'
|
|
@@ -93,91 +95,241 @@ const me = {
|
|
|
93
95
|
modifiers: {
|
|
94
96
|
type: [String, Array]
|
|
95
97
|
}
|
|
96
|
-
}
|
|
98
|
+
};
|
|
99
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
100
|
+
Side2["left"] = "left";
|
|
101
|
+
Side2["right"] = "right";
|
|
102
|
+
Side2["top"] = "top";
|
|
103
|
+
Side2["bottom"] = "bottom";
|
|
104
|
+
return Side2;
|
|
105
|
+
})(Side || {});
|
|
106
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
107
|
+
Placement2["topStart"] = "top-start";
|
|
108
|
+
Placement2["topEnd"] = "top-end";
|
|
109
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
110
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
111
|
+
Placement2["leftStart"] = "left-start";
|
|
112
|
+
Placement2["leftEnd"] = "left-end";
|
|
113
|
+
Placement2["rightStart"] = "right-start";
|
|
114
|
+
Placement2["rightEnd"] = "right-end";
|
|
115
|
+
return Placement2;
|
|
116
|
+
})(Placement || {});
|
|
117
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
118
|
+
Position2["before"] = "before";
|
|
119
|
+
Position2["after"] = "after";
|
|
120
|
+
return Position2;
|
|
121
|
+
})(Position || {});
|
|
122
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
123
|
+
ButtonType2["button"] = "button";
|
|
124
|
+
ButtonType2["submit"] = "submit";
|
|
125
|
+
ButtonType2["reset"] = "reset";
|
|
126
|
+
return ButtonType2;
|
|
127
|
+
})(ButtonType || {});
|
|
128
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
129
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
130
|
+
AnchorTarget2["_self"] = "_self";
|
|
131
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
132
|
+
AnchorTarget2["_top"] = "_top";
|
|
133
|
+
return AnchorTarget2;
|
|
134
|
+
})(AnchorTarget || {});
|
|
135
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
136
|
+
function useVolver() {
|
|
137
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
138
|
+
}
|
|
139
|
+
function useModifiers(prefix, modifiers, others) {
|
|
140
|
+
return computed(() => {
|
|
141
|
+
const toReturn = {
|
|
142
|
+
[prefix]: true
|
|
143
|
+
};
|
|
144
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
145
|
+
if (modifiersArray) {
|
|
146
|
+
if (Array.isArray(modifiersArray)) {
|
|
147
|
+
modifiersArray.forEach((modifier) => {
|
|
148
|
+
if (modifier) {
|
|
149
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (others) {
|
|
155
|
+
Object.keys(others.value).forEach((key) => {
|
|
156
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
return toReturn;
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const __default__$1 = {
|
|
97
163
|
name: "VvIcon"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
)) || t;
|
|
164
|
+
};
|
|
165
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
166
|
+
...__default__$1,
|
|
167
|
+
props: VvIconProps,
|
|
168
|
+
setup(__props) {
|
|
169
|
+
const props = __props;
|
|
170
|
+
const show = ref(true);
|
|
171
|
+
const volver = useVolver();
|
|
172
|
+
const { modifiers } = toRefs(props);
|
|
173
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
174
|
+
const provider = computed(() => {
|
|
175
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
111
176
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
177
|
+
const icon = computed(() => {
|
|
178
|
+
const _name = props.name ?? "";
|
|
179
|
+
const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
|
|
180
|
+
if (iconExists(_name)) {
|
|
181
|
+
return _name;
|
|
182
|
+
} else if (iconExists(iconName)) {
|
|
183
|
+
return iconName;
|
|
184
|
+
} else {
|
|
185
|
+
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
186
|
+
(iconsCollection) => {
|
|
187
|
+
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
188
|
+
if (iconExists(icon2)) {
|
|
189
|
+
return icon2;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
)) || _name;
|
|
117
193
|
}
|
|
118
|
-
|
|
194
|
+
});
|
|
195
|
+
function getSvgContent(svg) {
|
|
196
|
+
let dom = null;
|
|
197
|
+
if (typeof window === "undefined") {
|
|
198
|
+
const { JSDOM } = require("jsdom");
|
|
199
|
+
dom = new JSDOM().window;
|
|
200
|
+
}
|
|
201
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
202
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
203
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
204
|
+
return svgEl;
|
|
119
205
|
}
|
|
120
|
-
function
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
206
|
+
function addIconFromSvg(svg) {
|
|
207
|
+
const svgContentEl = getSvgContent(svg);
|
|
208
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
209
|
+
if (svgContentEl && svgContent) {
|
|
210
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
211
|
+
body: svgContent,
|
|
212
|
+
// Set height and width from svg content
|
|
213
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
214
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (volver) {
|
|
219
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
220
|
+
show.value = false;
|
|
221
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
222
|
+
if (svg) {
|
|
223
|
+
addIconFromSvg(svg);
|
|
224
|
+
show.value = true;
|
|
225
|
+
}
|
|
226
|
+
}).catch((e) => {
|
|
227
|
+
throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
|
|
228
|
+
});
|
|
229
|
+
} else if (props.svg) {
|
|
230
|
+
addIconFromSvg(props.svg);
|
|
231
|
+
}
|
|
128
232
|
}
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
icon: i(B)
|
|
147
|
-
}), null, 16, ["class"])) : S("", !0);
|
|
233
|
+
return (_ctx, _cache) => {
|
|
234
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
235
|
+
key: 0,
|
|
236
|
+
class: unref(bemCssClasses)
|
|
237
|
+
}, {
|
|
238
|
+
inline: _ctx.inline,
|
|
239
|
+
width: _ctx.width,
|
|
240
|
+
height: _ctx.height,
|
|
241
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
242
|
+
verticalFlip: _ctx.verticalFlip,
|
|
243
|
+
flip: _ctx.flip,
|
|
244
|
+
rotate: _ctx.rotate,
|
|
245
|
+
color: _ctx.color,
|
|
246
|
+
onLoad: _ctx.onLoad,
|
|
247
|
+
icon: unref(icon)
|
|
248
|
+
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
249
|
+
};
|
|
148
250
|
}
|
|
149
251
|
});
|
|
150
|
-
function
|
|
151
|
-
|
|
252
|
+
function resolveFieldData(data, field) {
|
|
253
|
+
if (data && Object.keys(data).length && field) {
|
|
254
|
+
if (field.indexOf(".") === -1) {
|
|
255
|
+
return data[field];
|
|
256
|
+
} else {
|
|
257
|
+
const fields = field.split(".");
|
|
258
|
+
let value = data;
|
|
259
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
260
|
+
if (data == null) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
value = value[fields[i]];
|
|
264
|
+
}
|
|
265
|
+
return value;
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function isEmpty(value) {
|
|
272
|
+
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));
|
|
273
|
+
}
|
|
274
|
+
function isString(value) {
|
|
275
|
+
return typeof value === "string" || value instanceof String;
|
|
276
|
+
}
|
|
277
|
+
function joinLines(errors) {
|
|
278
|
+
if (Array.isArray(errors)) {
|
|
279
|
+
return errors.filter((e) => isString(e)).join(" ");
|
|
280
|
+
}
|
|
281
|
+
return errors;
|
|
152
282
|
}
|
|
153
|
-
function
|
|
283
|
+
function HintSlotFactory(parentProps, parentSlots) {
|
|
284
|
+
const {
|
|
285
|
+
invalid: invalidSlot,
|
|
286
|
+
valid: validSlot,
|
|
287
|
+
hint: hintSlot,
|
|
288
|
+
loading: loadingSlot
|
|
289
|
+
} = parentSlots;
|
|
154
290
|
const {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
291
|
+
hintLabel,
|
|
292
|
+
modelValue,
|
|
293
|
+
valid,
|
|
294
|
+
validLabel,
|
|
295
|
+
invalid,
|
|
296
|
+
invalidLabel,
|
|
297
|
+
...otherProps
|
|
298
|
+
} = toRefs(parentProps);
|
|
299
|
+
const loading = resolveFieldData(otherProps, "loading");
|
|
300
|
+
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
301
|
+
const hasInvalid = computed(() => {
|
|
302
|
+
if (!invalid.value) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
if (invalid.value && invalidSlot) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
return false;
|
|
315
|
+
});
|
|
316
|
+
const hasHint = computed(
|
|
317
|
+
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
318
|
+
);
|
|
319
|
+
const hasValid = computed(
|
|
320
|
+
() => !!(validLabel && validLabel.value || validSlot)
|
|
321
|
+
);
|
|
322
|
+
const hasLoading = computed(
|
|
323
|
+
() => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
|
|
324
|
+
);
|
|
325
|
+
const isVisible = computed(
|
|
326
|
+
() => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
|
|
175
327
|
);
|
|
176
328
|
return {
|
|
177
|
-
hasInvalid
|
|
178
|
-
hasHint
|
|
179
|
-
hasValid
|
|
180
|
-
hasLoading
|
|
329
|
+
hasInvalid,
|
|
330
|
+
hasHint,
|
|
331
|
+
hasValid,
|
|
332
|
+
hasLoading,
|
|
181
333
|
HintSlot: {
|
|
182
334
|
name: "HintSlot",
|
|
183
335
|
props: {
|
|
@@ -186,30 +338,37 @@ function ye(e, s) {
|
|
|
186
338
|
default: () => ({})
|
|
187
339
|
}
|
|
188
340
|
},
|
|
189
|
-
setup(
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
hintLabel
|
|
193
|
-
modelValue
|
|
194
|
-
valid
|
|
195
|
-
validLabel
|
|
196
|
-
invalid
|
|
197
|
-
invalidLabel
|
|
198
|
-
loading
|
|
199
|
-
loadingLabel
|
|
200
|
-
...
|
|
341
|
+
setup(props) {
|
|
342
|
+
const hintContent = computed(() => {
|
|
343
|
+
const slotProps = toReactive({
|
|
344
|
+
hintLabel,
|
|
345
|
+
modelValue,
|
|
346
|
+
valid,
|
|
347
|
+
validLabel,
|
|
348
|
+
invalid,
|
|
349
|
+
invalidLabel,
|
|
350
|
+
loading,
|
|
351
|
+
loadingLabel,
|
|
352
|
+
...props.params
|
|
201
353
|
});
|
|
202
|
-
|
|
354
|
+
if (invalid == null ? void 0 : invalid.value) {
|
|
355
|
+
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
356
|
+
}
|
|
357
|
+
if (valid == null ? void 0 : valid.value)
|
|
358
|
+
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
359
|
+
if (loading == null ? void 0 : loading.value)
|
|
360
|
+
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
361
|
+
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
203
362
|
});
|
|
204
363
|
return {
|
|
205
|
-
isVisible
|
|
206
|
-
hasInvalid
|
|
207
|
-
hasValid
|
|
208
|
-
hintContent
|
|
364
|
+
isVisible,
|
|
365
|
+
hasInvalid,
|
|
366
|
+
hasValid,
|
|
367
|
+
hintContent
|
|
209
368
|
};
|
|
210
369
|
},
|
|
211
370
|
render() {
|
|
212
|
-
if (this.isVisible)
|
|
371
|
+
if (this.isVisible) {
|
|
213
372
|
return h(
|
|
214
373
|
"small",
|
|
215
374
|
{
|
|
@@ -217,38 +376,111 @@ function ye(e, s) {
|
|
|
217
376
|
},
|
|
218
377
|
this.hintContent
|
|
219
378
|
);
|
|
379
|
+
}
|
|
220
380
|
}
|
|
221
381
|
}
|
|
222
382
|
};
|
|
223
383
|
}
|
|
224
|
-
|
|
225
|
-
|
|
384
|
+
const LinkProps = {
|
|
385
|
+
/**
|
|
386
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
387
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
388
|
+
*/
|
|
389
|
+
to: {
|
|
390
|
+
type: [String, Object]
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* Anchor href
|
|
394
|
+
*/
|
|
395
|
+
href: String,
|
|
396
|
+
/**
|
|
397
|
+
* Anchor target
|
|
398
|
+
*/
|
|
399
|
+
target: {
|
|
400
|
+
type: String,
|
|
401
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
402
|
+
},
|
|
403
|
+
/**
|
|
404
|
+
* Anchor rel
|
|
405
|
+
*/
|
|
406
|
+
rel: {
|
|
407
|
+
type: String,
|
|
408
|
+
default: "noopener noreferrer"
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const ValidProps = {
|
|
412
|
+
/**
|
|
413
|
+
* Valid status
|
|
414
|
+
*/
|
|
226
415
|
valid: Boolean,
|
|
416
|
+
/**
|
|
417
|
+
* Valid label
|
|
418
|
+
*/
|
|
227
419
|
validLabel: [String, Array]
|
|
228
|
-
}
|
|
420
|
+
};
|
|
421
|
+
const InvalidProps = {
|
|
422
|
+
/**
|
|
423
|
+
* Invalid status
|
|
424
|
+
*/
|
|
229
425
|
invalid: Boolean,
|
|
426
|
+
/**
|
|
427
|
+
* Invalid label
|
|
428
|
+
*/
|
|
230
429
|
invalidLabel: [String, Array]
|
|
231
|
-
}
|
|
430
|
+
};
|
|
431
|
+
const LoadingProps = {
|
|
432
|
+
/**
|
|
433
|
+
* Loading status
|
|
434
|
+
*/
|
|
232
435
|
loading: Boolean,
|
|
233
|
-
|
|
234
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Loading label
|
|
438
|
+
*/
|
|
439
|
+
loadingLabel: {
|
|
440
|
+
type: String,
|
|
441
|
+
default: "Loading..."
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
const DisabledProps = {
|
|
235
445
|
/**
|
|
236
446
|
* Whether the form control is disabled
|
|
237
447
|
*/
|
|
238
448
|
disabled: Boolean
|
|
239
|
-
}
|
|
449
|
+
};
|
|
450
|
+
const ActiveProps = {
|
|
451
|
+
/**
|
|
452
|
+
* Whether the item is active
|
|
453
|
+
*/
|
|
454
|
+
active: Boolean
|
|
455
|
+
};
|
|
456
|
+
const PressedProps = {
|
|
457
|
+
/**
|
|
458
|
+
* Whether the item is pressed
|
|
459
|
+
*/
|
|
460
|
+
pressed: Boolean
|
|
461
|
+
};
|
|
462
|
+
const LabelProps = {
|
|
463
|
+
/**
|
|
464
|
+
* The item label
|
|
465
|
+
*/
|
|
466
|
+
label: [String, Number]
|
|
467
|
+
};
|
|
468
|
+
const ReadonlyProps = {
|
|
240
469
|
/**
|
|
241
470
|
* The value is not editable
|
|
242
471
|
*/
|
|
243
472
|
readonly: Boolean
|
|
244
|
-
}
|
|
473
|
+
};
|
|
474
|
+
const ModifiersProps = {
|
|
245
475
|
/**
|
|
246
476
|
* Component BEM modifiers
|
|
247
477
|
*/
|
|
248
478
|
modifiers: [String, Array]
|
|
249
|
-
}
|
|
479
|
+
};
|
|
480
|
+
const HintProps = {
|
|
250
481
|
hintLabel: { type: String, default: "" }
|
|
251
|
-
}
|
|
482
|
+
};
|
|
483
|
+
const OptionsProps = {
|
|
252
484
|
/**
|
|
253
485
|
* List of options, can be string[] or object[]
|
|
254
486
|
*/
|
|
@@ -268,7 +500,8 @@ const he = {
|
|
|
268
500
|
* Used when options are objects: key to use for option disabled
|
|
269
501
|
*/
|
|
270
502
|
disabledKey: { type: [String, Function], default: "disabled" }
|
|
271
|
-
}
|
|
503
|
+
};
|
|
504
|
+
const IconProps = {
|
|
272
505
|
/**
|
|
273
506
|
* VvIcon name or props
|
|
274
507
|
* @see VVIcon
|
|
@@ -279,69 +512,177 @@ const he = {
|
|
|
279
512
|
*/
|
|
280
513
|
iconPosition: {
|
|
281
514
|
type: String,
|
|
282
|
-
default:
|
|
283
|
-
validation: (
|
|
515
|
+
default: Position.before,
|
|
516
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
284
517
|
}
|
|
285
|
-
}
|
|
518
|
+
};
|
|
519
|
+
const TabindexProps = {
|
|
286
520
|
/**
|
|
287
521
|
* Global attribute tabindex
|
|
288
522
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
289
523
|
*/
|
|
290
524
|
tabindex: { type: [String, Number], default: 0 }
|
|
291
|
-
}
|
|
525
|
+
};
|
|
526
|
+
const FloatingLabelProps = {
|
|
292
527
|
/**
|
|
293
528
|
* If true the label will be floating
|
|
294
529
|
*/
|
|
295
530
|
floating: Boolean
|
|
296
|
-
}
|
|
531
|
+
};
|
|
532
|
+
const UnselectableProps = {
|
|
297
533
|
/**
|
|
298
534
|
* If true the input will be unselectable
|
|
299
535
|
*/
|
|
300
|
-
unselectable: { type: Boolean, default:
|
|
301
|
-
}
|
|
536
|
+
unselectable: { type: Boolean, default: true }
|
|
537
|
+
};
|
|
538
|
+
const IdProps = {
|
|
302
539
|
/**
|
|
303
540
|
* Global attribute id
|
|
304
541
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
305
542
|
*/
|
|
306
543
|
id: [String, Number]
|
|
307
544
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
545
|
+
({
|
|
546
|
+
/**
|
|
547
|
+
* Dropdown placement
|
|
548
|
+
*/
|
|
549
|
+
placement: {
|
|
550
|
+
type: String,
|
|
551
|
+
default: Side.bottom,
|
|
552
|
+
validator: (value) => {
|
|
553
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
/**
|
|
557
|
+
* Dropdown show / hide transition name
|
|
558
|
+
*/
|
|
559
|
+
transitionName: {
|
|
560
|
+
type: String
|
|
561
|
+
},
|
|
562
|
+
/**
|
|
563
|
+
* Offset of the dropdown from the trigger
|
|
564
|
+
* @see https://floating-ui.com/docs/offset
|
|
565
|
+
*/
|
|
566
|
+
offset: {
|
|
567
|
+
type: [Number, String, Object],
|
|
568
|
+
default: 0
|
|
569
|
+
},
|
|
570
|
+
/**
|
|
571
|
+
* Move dropdown to the side if there is no space in the default position
|
|
572
|
+
* @see https://floating-ui.com/docs/shift
|
|
573
|
+
*/
|
|
574
|
+
shift: {
|
|
575
|
+
type: [Boolean, Object],
|
|
576
|
+
default: false
|
|
577
|
+
},
|
|
578
|
+
/**
|
|
579
|
+
* Flip dropdown position if there is no space in the default position
|
|
580
|
+
* @see https://floating-ui.com/docs/flip
|
|
581
|
+
*/
|
|
582
|
+
flip: {
|
|
583
|
+
type: [Boolean, Object],
|
|
584
|
+
default: true
|
|
585
|
+
},
|
|
586
|
+
/**
|
|
587
|
+
* Size of the dropdown
|
|
588
|
+
* @see https://floating-ui.com/docs/size
|
|
589
|
+
*/
|
|
590
|
+
size: {
|
|
591
|
+
type: [Boolean, Object],
|
|
592
|
+
default: () => ({ padding: 10 })
|
|
593
|
+
},
|
|
594
|
+
/**
|
|
595
|
+
* Automatically change the position of the dropdown
|
|
596
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
597
|
+
*/
|
|
598
|
+
autoPlacement: {
|
|
599
|
+
type: [Boolean, Object],
|
|
600
|
+
default: false
|
|
601
|
+
},
|
|
602
|
+
/**
|
|
603
|
+
* Add arrow to the dropdown
|
|
604
|
+
* @see https://floating-ui.com/docs/arrow
|
|
605
|
+
*/
|
|
606
|
+
arrow: {
|
|
607
|
+
type: Boolean,
|
|
608
|
+
default: false
|
|
609
|
+
},
|
|
610
|
+
/**
|
|
611
|
+
* Close dropdown on click outside
|
|
612
|
+
*/
|
|
613
|
+
autoClose: {
|
|
614
|
+
type: Boolean,
|
|
615
|
+
default: true
|
|
616
|
+
},
|
|
617
|
+
/**
|
|
618
|
+
* Autofocus first item on dropdown open
|
|
619
|
+
*/
|
|
620
|
+
autofocusFirst: {
|
|
621
|
+
type: Boolean,
|
|
622
|
+
default: true
|
|
623
|
+
},
|
|
624
|
+
/**
|
|
625
|
+
* Set dropdown width to the same as the trigger
|
|
626
|
+
*/
|
|
627
|
+
triggerWidth: {
|
|
628
|
+
type: Boolean
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
const IdNameProps = {
|
|
632
|
+
...IdProps,
|
|
311
633
|
/**
|
|
312
634
|
* Input / Textarea name
|
|
313
635
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
314
636
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
315
637
|
*/
|
|
316
|
-
name: { type: String, required:
|
|
317
|
-
}
|
|
638
|
+
name: { type: String, required: true }
|
|
639
|
+
};
|
|
640
|
+
const AutofocusProps = {
|
|
318
641
|
/**
|
|
319
642
|
* Global attribute autofocus
|
|
320
643
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
321
644
|
*/
|
|
322
645
|
autofocus: Boolean
|
|
323
|
-
}
|
|
646
|
+
};
|
|
647
|
+
const AutocompleteProps = {
|
|
324
648
|
/**
|
|
325
649
|
* Global attribute autocomplete
|
|
326
650
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
327
651
|
*/
|
|
328
652
|
autocomplete: { type: String, default: "off" }
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
...
|
|
332
|
-
...
|
|
333
|
-
|
|
334
|
-
...
|
|
335
|
-
...
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
653
|
+
};
|
|
654
|
+
({
|
|
655
|
+
...DisabledProps,
|
|
656
|
+
...LabelProps,
|
|
657
|
+
...PressedProps,
|
|
658
|
+
...ActiveProps,
|
|
659
|
+
...LinkProps,
|
|
660
|
+
/**
|
|
661
|
+
* Button type
|
|
662
|
+
*/
|
|
663
|
+
type: {
|
|
664
|
+
type: String,
|
|
665
|
+
default: ButtonType.button,
|
|
666
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
const VvSelectProps = {
|
|
670
|
+
...IdNameProps,
|
|
671
|
+
...AutofocusProps,
|
|
672
|
+
...AutocompleteProps,
|
|
673
|
+
...TabindexProps,
|
|
674
|
+
...ValidProps,
|
|
675
|
+
...InvalidProps,
|
|
676
|
+
...HintProps,
|
|
677
|
+
...LoadingProps,
|
|
678
|
+
...DisabledProps,
|
|
679
|
+
...ReadonlyProps,
|
|
680
|
+
...ModifiersProps,
|
|
681
|
+
...OptionsProps,
|
|
682
|
+
...IconProps,
|
|
683
|
+
...FloatingLabelProps,
|
|
684
|
+
...UnselectableProps,
|
|
685
|
+
...LabelProps,
|
|
345
686
|
/**
|
|
346
687
|
* This Boolean attribute indicates that multiple options can be selected in the list.
|
|
347
688
|
* If it is not specified, then only one option can be selected at a time.
|
|
@@ -368,140 +709,251 @@ const De = {
|
|
|
368
709
|
type: [String, Number, Boolean, Object, Array],
|
|
369
710
|
default: void 0
|
|
370
711
|
},
|
|
371
|
-
/**
|
|
372
|
-
* <label> value for the select
|
|
373
|
-
*/
|
|
374
|
-
label: String,
|
|
375
712
|
/**
|
|
376
713
|
* Select placeholder
|
|
377
714
|
*/
|
|
378
715
|
placeholder: String
|
|
379
|
-
}
|
|
716
|
+
};
|
|
717
|
+
const VvSelectEmits = ["update:modelValue", "focus", "blur"];
|
|
718
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
719
|
+
function useComponentFocus(inputTemplateRef, emit) {
|
|
720
|
+
const { focused } = useFocus(inputTemplateRef);
|
|
721
|
+
watch(focused, (newValue) => {
|
|
722
|
+
emit(newValue ? "focus" : "blur", unref(inputTemplateRef));
|
|
723
|
+
});
|
|
724
|
+
return {
|
|
725
|
+
focused
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function useComponentIcon(icon, iconPosition) {
|
|
729
|
+
const hasIconBefore = computed(
|
|
730
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.before)
|
|
731
|
+
);
|
|
732
|
+
const hasIconAfter = computed(
|
|
733
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Position.after)
|
|
734
|
+
);
|
|
735
|
+
const hasIconLeft = computed(
|
|
736
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.left)
|
|
737
|
+
);
|
|
738
|
+
const hasIconRight = computed(
|
|
739
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.right)
|
|
740
|
+
);
|
|
741
|
+
const hasIconTop = computed(
|
|
742
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.top)
|
|
743
|
+
);
|
|
744
|
+
const hasIconBottom = computed(
|
|
745
|
+
() => Boolean((icon == null ? void 0 : icon.value) && iconPosition.value === Side.bottom)
|
|
746
|
+
);
|
|
747
|
+
const hasIcon = computed(() => {
|
|
748
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
749
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
750
|
+
}
|
|
751
|
+
return icon == null ? void 0 : icon.value;
|
|
752
|
+
});
|
|
753
|
+
return {
|
|
754
|
+
hasIcon,
|
|
755
|
+
hasIconLeft,
|
|
756
|
+
hasIconRight,
|
|
757
|
+
hasIconTop,
|
|
758
|
+
hasIconBottom,
|
|
759
|
+
hasIconBefore,
|
|
760
|
+
hasIconAfter
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function useOptions(props) {
|
|
764
|
+
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
765
|
+
const getOptionLabel = (option) => {
|
|
766
|
+
if (typeof option !== "object" && option !== null)
|
|
767
|
+
return option;
|
|
768
|
+
return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
|
|
769
|
+
};
|
|
770
|
+
const getOptionValue = (option) => {
|
|
771
|
+
if (typeof option !== "object" && option !== null)
|
|
772
|
+
return option;
|
|
773
|
+
return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
|
|
774
|
+
};
|
|
775
|
+
const getOptionDisabled = (option) => {
|
|
776
|
+
if (typeof option !== "object" && option !== null)
|
|
777
|
+
return false;
|
|
778
|
+
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
779
|
+
};
|
|
780
|
+
return {
|
|
781
|
+
options,
|
|
782
|
+
getOptionLabel,
|
|
783
|
+
getOptionValue,
|
|
784
|
+
getOptionDisabled
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
const _hoisted_1 = ["for"];
|
|
788
|
+
const _hoisted_2 = { class: "vv-select__wrapper" };
|
|
789
|
+
const _hoisted_3 = {
|
|
380
790
|
key: 0,
|
|
381
791
|
class: "vv-select__input-before"
|
|
382
|
-
}
|
|
792
|
+
};
|
|
793
|
+
const _hoisted_4 = { class: "vv-select__inner" };
|
|
794
|
+
const _hoisted_5 = ["id"];
|
|
795
|
+
const _hoisted_6 = ["disabled", "hidden"];
|
|
796
|
+
const _hoisted_7 = ["disabled", "value"];
|
|
797
|
+
const _hoisted_8 = {
|
|
383
798
|
key: 1,
|
|
384
799
|
class: "vv-select__input-after"
|
|
385
|
-
}
|
|
800
|
+
};
|
|
801
|
+
const __default__ = {
|
|
386
802
|
name: "VvSelect"
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
803
|
+
};
|
|
804
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
805
|
+
...__default__,
|
|
806
|
+
props: VvSelectProps,
|
|
807
|
+
emits: VvSelectEmits,
|
|
808
|
+
setup(__props, { emit }) {
|
|
809
|
+
const props = __props;
|
|
810
|
+
const slots = useSlots();
|
|
811
|
+
const select = ref();
|
|
812
|
+
const { HintSlot, hasHint, hasInvalid } = HintSlotFactory(props, slots);
|
|
813
|
+
const {
|
|
814
|
+
id,
|
|
815
|
+
modifiers,
|
|
816
|
+
disabled,
|
|
817
|
+
readonly,
|
|
818
|
+
loading,
|
|
819
|
+
icon,
|
|
820
|
+
iconPosition,
|
|
821
|
+
invalid,
|
|
822
|
+
valid,
|
|
823
|
+
floating,
|
|
824
|
+
multiple
|
|
825
|
+
} = toRefs(props);
|
|
826
|
+
const hasId = useUniqueId(id);
|
|
827
|
+
const hasDescribedBy = computed(() => `${hasId.value}-hint`);
|
|
828
|
+
const { focused } = useComponentFocus(select, emit);
|
|
829
|
+
const isVisible = useElementVisibility(select);
|
|
830
|
+
watch(isVisible, (newValue) => {
|
|
831
|
+
if (newValue && props.autofocus) {
|
|
832
|
+
focused.value = true;
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
836
|
+
icon,
|
|
837
|
+
iconPosition
|
|
838
|
+
);
|
|
839
|
+
const isDirty = computed(() => !isEmpty(props.modelValue));
|
|
840
|
+
const isDisabled = computed(() => props.disabled || props.readonly);
|
|
841
|
+
const hasTabindex = computed(() => {
|
|
842
|
+
return isDisabled.value ? -1 : props.tabindex;
|
|
843
|
+
});
|
|
844
|
+
const isInvalid = computed(() => {
|
|
845
|
+
if (props.invalid === true) {
|
|
846
|
+
return true;
|
|
847
|
+
}
|
|
848
|
+
if (props.valid === true) {
|
|
849
|
+
return false;
|
|
850
|
+
}
|
|
851
|
+
return void 0;
|
|
407
852
|
});
|
|
408
|
-
const
|
|
409
|
-
l,
|
|
410
|
-
v
|
|
411
|
-
), Z = computed(() => !isEmpty(r.modelValue)), T = computed(() => r.disabled || r.readonly), x = computed(() => T.value ? -1 : r.tabindex), L = computed(() => {
|
|
412
|
-
if (r.invalid === !0)
|
|
413
|
-
return !0;
|
|
414
|
-
if (r.valid === !0)
|
|
415
|
-
return !1;
|
|
416
|
-
}), ee = useBemModifiers(
|
|
853
|
+
const bemCssClasses = useModifiers(
|
|
417
854
|
"vv-select",
|
|
418
|
-
|
|
855
|
+
modifiers,
|
|
419
856
|
computed(() => ({
|
|
420
|
-
valid:
|
|
421
|
-
invalid:
|
|
422
|
-
loading:
|
|
423
|
-
disabled:
|
|
424
|
-
readonly:
|
|
425
|
-
"icon-before":
|
|
426
|
-
"icon-after":
|
|
427
|
-
dirty:
|
|
428
|
-
focus:
|
|
429
|
-
floating:
|
|
430
|
-
multiple:
|
|
857
|
+
valid: valid.value,
|
|
858
|
+
invalid: invalid.value,
|
|
859
|
+
loading: loading.value,
|
|
860
|
+
disabled: disabled.value,
|
|
861
|
+
readonly: readonly.value,
|
|
862
|
+
"icon-before": hasIconBefore.value,
|
|
863
|
+
"icon-after": hasIconAfter.value,
|
|
864
|
+
dirty: isDirty.value,
|
|
865
|
+
focus: focused.value,
|
|
866
|
+
floating: floating.value,
|
|
867
|
+
multiple: multiple.value
|
|
431
868
|
}))
|
|
432
|
-
)
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
869
|
+
);
|
|
870
|
+
const hasAttrs = computed(() => {
|
|
871
|
+
return {
|
|
872
|
+
name: props.name,
|
|
873
|
+
tabindex: hasTabindex.value,
|
|
874
|
+
disabled: isDisabled.value,
|
|
875
|
+
required: props.required,
|
|
876
|
+
size: props.size,
|
|
877
|
+
autocomplete: props.autocomplete,
|
|
878
|
+
multiple: props.multiple,
|
|
879
|
+
"aria-invalid": isInvalid.value,
|
|
880
|
+
"aria-describedby": !hasInvalid.value && hasHint.value ? hasDescribedBy.value : void 0,
|
|
881
|
+
"aria-errormessage": hasInvalid.value ? hasDescribedBy.value : void 0
|
|
882
|
+
};
|
|
883
|
+
});
|
|
884
|
+
const slotProps = computed(() => ({
|
|
885
|
+
valid: props.valid,
|
|
886
|
+
invalid: props.invalid,
|
|
887
|
+
modelValue: props.modelValue
|
|
888
|
+
}));
|
|
889
|
+
const { getOptionLabel, getOptionValue, getOptionDisabled } = useOptions(props);
|
|
890
|
+
const localModelValue = computed({
|
|
891
|
+
get: () => {
|
|
892
|
+
return props.modelValue;
|
|
893
|
+
},
|
|
894
|
+
set: (newValue) => {
|
|
895
|
+
if (Array.isArray(newValue)) {
|
|
896
|
+
newValue = newValue.filter((item) => item !== void 0);
|
|
897
|
+
}
|
|
898
|
+
emit("update:modelValue", newValue);
|
|
451
899
|
}
|
|
452
900
|
});
|
|
453
|
-
return (
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
class: "vv-select__icon"
|
|
468
|
-
}, i(H)), null, 16)) : S("", !0),
|
|
469
|
-
ae(k("select", N({
|
|
470
|
-
id: i(P),
|
|
471
|
-
ref_key: "select",
|
|
472
|
-
ref: c,
|
|
473
|
-
"onUpdate:modelValue": A[0] || (A[0] = (I) => le(j) ? j.value = I : null)
|
|
474
|
-
}, i(te)), [
|
|
475
|
-
a.placeholder ? (f(), b("option", {
|
|
901
|
+
return (_ctx, _cache) => {
|
|
902
|
+
return openBlock(), createElementBlock("div", {
|
|
903
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
904
|
+
}, [
|
|
905
|
+
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
906
|
+
key: 0,
|
|
907
|
+
for: unref(hasId)
|
|
908
|
+
}, toDisplayString(_ctx.label), 9, _hoisted_1)) : createCommentVNode("", true),
|
|
909
|
+
createElementVNode("div", _hoisted_2, [
|
|
910
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
911
|
+
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
912
|
+
])) : createCommentVNode("", true),
|
|
913
|
+
createElementVNode("div", _hoisted_4, [
|
|
914
|
+
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
476
915
|
key: 0,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
916
|
+
class: "vv-select__icon"
|
|
917
|
+
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
918
|
+
withDirectives(createElementVNode("select", mergeProps({
|
|
919
|
+
id: unref(hasId),
|
|
920
|
+
ref_key: "select",
|
|
921
|
+
ref: select,
|
|
922
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
923
|
+
}, unref(hasAttrs)), [
|
|
924
|
+
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
925
|
+
key: 0,
|
|
926
|
+
value: void 0,
|
|
927
|
+
disabled: !_ctx.unselectable,
|
|
928
|
+
hidden: !_ctx.unselectable
|
|
929
|
+
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6)) : createCommentVNode("", true),
|
|
930
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
931
|
+
return openBlock(), createElementBlock("option", {
|
|
932
|
+
key: index,
|
|
933
|
+
disabled: unref(getOptionDisabled)(option),
|
|
934
|
+
value: unref(getOptionValue)(option)
|
|
935
|
+
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7);
|
|
936
|
+
}), 128))
|
|
937
|
+
], 16, _hoisted_5), [
|
|
938
|
+
[vModelSelect, unref(localModelValue)]
|
|
939
|
+
]),
|
|
940
|
+
unref(hasIconAfter) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
941
|
+
key: 1,
|
|
942
|
+
class: "vv-select__icon vv-select__icon-after"
|
|
943
|
+
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
488
944
|
]),
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}, i(H)), null, 16)) : S("", !0)
|
|
945
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
946
|
+
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
947
|
+
])) : createCommentVNode("", true)
|
|
493
948
|
]),
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
class: "vv-select__hint"
|
|
501
|
-
}, null, 8, ["id"])
|
|
502
|
-
], 2));
|
|
949
|
+
createVNode(unref(HintSlot), {
|
|
950
|
+
id: unref(hasDescribedBy),
|
|
951
|
+
class: "vv-select__hint"
|
|
952
|
+
}, null, 8, ["id"])
|
|
953
|
+
], 2);
|
|
954
|
+
};
|
|
503
955
|
}
|
|
504
956
|
});
|
|
505
957
|
export {
|
|
506
|
-
|
|
958
|
+
_sfc_main as default
|
|
507
959
|
};
|