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