@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,7 +1,7 @@
|
|
|
1
|
-
import { inject
|
|
2
|
-
import { iconExists
|
|
3
|
-
import { nanoid
|
|
4
|
-
const
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, watch, resolveDynamicComponent, withCtx, renderSlot, createTextVNode, toDisplayString, toRef, useAttrs, useSlots, createElementBlock, Fragment } from "vue";
|
|
2
|
+
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
const VvIconProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Color
|
|
7
7
|
*/
|
|
@@ -25,7 +25,7 @@ const ue = {
|
|
|
25
25
|
*/
|
|
26
26
|
name: {
|
|
27
27
|
type: String,
|
|
28
|
-
required:
|
|
28
|
+
required: true
|
|
29
29
|
},
|
|
30
30
|
/**
|
|
31
31
|
* By default 'vv'
|
|
@@ -95,77 +95,170 @@ const ue = {
|
|
|
95
95
|
type: [String, Array]
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
99
|
+
Side2["left"] = "left";
|
|
100
|
+
Side2["right"] = "right";
|
|
101
|
+
Side2["top"] = "top";
|
|
102
|
+
Side2["bottom"] = "bottom";
|
|
103
|
+
return Side2;
|
|
104
|
+
})(Side || {});
|
|
105
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
106
|
+
Placement2["topStart"] = "top-start";
|
|
107
|
+
Placement2["topEnd"] = "top-end";
|
|
108
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
109
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
110
|
+
Placement2["leftStart"] = "left-start";
|
|
111
|
+
Placement2["leftEnd"] = "left-end";
|
|
112
|
+
Placement2["rightStart"] = "right-start";
|
|
113
|
+
Placement2["rightEnd"] = "right-end";
|
|
114
|
+
return Placement2;
|
|
115
|
+
})(Placement || {});
|
|
116
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
117
|
+
Position2["before"] = "before";
|
|
118
|
+
Position2["after"] = "after";
|
|
119
|
+
return Position2;
|
|
120
|
+
})(Position || {});
|
|
121
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
122
|
+
ButtonType2["button"] = "button";
|
|
123
|
+
ButtonType2["submit"] = "submit";
|
|
124
|
+
ButtonType2["reset"] = "reset";
|
|
125
|
+
return ButtonType2;
|
|
126
|
+
})(ButtonType || {});
|
|
127
|
+
var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
128
|
+
ActionTag2["nuxtLink"] = "nuxt-link";
|
|
129
|
+
ActionTag2["routerLink"] = "router-link";
|
|
130
|
+
ActionTag2["a"] = "a";
|
|
131
|
+
ActionTag2["button"] = "button";
|
|
132
|
+
return ActionTag2;
|
|
133
|
+
})(ActionTag || {});
|
|
134
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
135
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
136
|
+
AnchorTarget2["_self"] = "_self";
|
|
137
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
138
|
+
AnchorTarget2["_top"] = "_top";
|
|
139
|
+
return AnchorTarget2;
|
|
140
|
+
})(AnchorTarget || {});
|
|
141
|
+
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
142
|
+
const INJECTION_KEY_BUTTON_GROUP = Symbol.for("buttonGroup");
|
|
143
|
+
const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for("dropdownTrigger");
|
|
144
|
+
const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for("dropdownAction");
|
|
145
|
+
function useVolver() {
|
|
146
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
102
147
|
}
|
|
103
|
-
function
|
|
104
|
-
return
|
|
105
|
-
const
|
|
106
|
-
[
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
148
|
+
function useModifiers(prefix, modifiers, others) {
|
|
149
|
+
return computed(() => {
|
|
150
|
+
const toReturn = {
|
|
151
|
+
[prefix]: true
|
|
152
|
+
};
|
|
153
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
154
|
+
if (modifiersArray) {
|
|
155
|
+
if (Array.isArray(modifiersArray)) {
|
|
156
|
+
modifiersArray.forEach((modifier) => {
|
|
157
|
+
if (modifier) {
|
|
158
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (others) {
|
|
164
|
+
Object.keys(others.value).forEach((key) => {
|
|
165
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return toReturn;
|
|
113
169
|
});
|
|
114
170
|
}
|
|
115
|
-
const
|
|
171
|
+
const __default__$2 = {
|
|
116
172
|
name: "VvIcon"
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
173
|
+
};
|
|
174
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
175
|
+
...__default__$2,
|
|
176
|
+
props: VvIconProps,
|
|
177
|
+
setup(__props) {
|
|
178
|
+
const props = __props;
|
|
179
|
+
const show = ref(true);
|
|
180
|
+
const volver = useVolver();
|
|
181
|
+
const { modifiers } = toRefs(props);
|
|
182
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
183
|
+
const provider = computed(() => {
|
|
184
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
185
|
+
});
|
|
186
|
+
const icon = computed(() => {
|
|
187
|
+
const _name = props.name ?? "";
|
|
188
|
+
const iconName = `@${provider.value}:${props.prefix}:${props.name}`;
|
|
189
|
+
if (iconExists(_name)) {
|
|
190
|
+
return _name;
|
|
191
|
+
} else if (iconExists(iconName)) {
|
|
192
|
+
return iconName;
|
|
193
|
+
} else {
|
|
194
|
+
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
195
|
+
(iconsCollection) => {
|
|
196
|
+
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
197
|
+
if (iconExists(icon2)) {
|
|
198
|
+
return icon2;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
)) || _name;
|
|
202
|
+
}
|
|
130
203
|
});
|
|
131
|
-
function
|
|
132
|
-
let
|
|
133
|
-
if (typeof window
|
|
134
|
-
const { JSDOM
|
|
135
|
-
|
|
204
|
+
function getSvgContent(svg) {
|
|
205
|
+
let dom = null;
|
|
206
|
+
if (typeof window === "undefined") {
|
|
207
|
+
const { JSDOM } = require("jsdom");
|
|
208
|
+
dom = new JSDOM().window;
|
|
136
209
|
}
|
|
137
|
-
|
|
210
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
211
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
212
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
213
|
+
return svgEl;
|
|
138
214
|
}
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
215
|
+
function addIconFromSvg(svg) {
|
|
216
|
+
const svgContentEl = getSvgContent(svg);
|
|
217
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
218
|
+
if (svgContentEl && svgContent) {
|
|
219
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
220
|
+
body: svgContent,
|
|
221
|
+
// Set height and width from svg content
|
|
222
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
223
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
224
|
+
});
|
|
225
|
+
}
|
|
147
226
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
227
|
+
if (volver) {
|
|
228
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
229
|
+
show.value = false;
|
|
230
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
231
|
+
if (svg) {
|
|
232
|
+
addIconFromSvg(svg);
|
|
233
|
+
show.value = true;
|
|
234
|
+
}
|
|
235
|
+
}).catch((e) => {
|
|
236
|
+
throw new Error(`During fetch icon: ${e == null ? void 0 : e.message}`);
|
|
237
|
+
});
|
|
238
|
+
} else if (props.svg) {
|
|
239
|
+
addIconFromSvg(props.svg);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return (_ctx, _cache) => {
|
|
243
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
244
|
+
key: 0,
|
|
245
|
+
class: unref(bemCssClasses)
|
|
246
|
+
}, {
|
|
247
|
+
inline: _ctx.inline,
|
|
248
|
+
width: _ctx.width,
|
|
249
|
+
height: _ctx.height,
|
|
250
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
251
|
+
verticalFlip: _ctx.verticalFlip,
|
|
252
|
+
flip: _ctx.flip,
|
|
253
|
+
rotate: _ctx.rotate,
|
|
254
|
+
color: _ctx.color,
|
|
255
|
+
onLoad: _ctx.onLoad,
|
|
256
|
+
icon: unref(icon)
|
|
257
|
+
}), null, 16, ["class"])) : createCommentVNode("", true);
|
|
258
|
+
};
|
|
167
259
|
}
|
|
168
|
-
})
|
|
260
|
+
});
|
|
261
|
+
const LinkProps = {
|
|
169
262
|
/**
|
|
170
263
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
171
264
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -182,7 +275,7 @@ const pe = {
|
|
|
182
275
|
*/
|
|
183
276
|
target: {
|
|
184
277
|
type: String,
|
|
185
|
-
validator: (
|
|
278
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
186
279
|
},
|
|
187
280
|
/**
|
|
188
281
|
* Anchor rel
|
|
@@ -191,7 +284,8 @@ const pe = {
|
|
|
191
284
|
type: String,
|
|
192
285
|
default: "noopener noreferrer"
|
|
193
286
|
}
|
|
194
|
-
}
|
|
287
|
+
};
|
|
288
|
+
const LoadingProps = {
|
|
195
289
|
/**
|
|
196
290
|
* Loading status
|
|
197
291
|
*/
|
|
@@ -203,265 +297,415 @@ const pe = {
|
|
|
203
297
|
type: String,
|
|
204
298
|
default: "Loading..."
|
|
205
299
|
}
|
|
206
|
-
}
|
|
300
|
+
};
|
|
301
|
+
const DisabledProps = {
|
|
207
302
|
/**
|
|
208
303
|
* Whether the form control is disabled
|
|
209
304
|
*/
|
|
210
305
|
disabled: Boolean
|
|
211
|
-
}
|
|
306
|
+
};
|
|
307
|
+
const ActiveProps = {
|
|
212
308
|
/**
|
|
213
309
|
* Whether the item is active
|
|
214
310
|
*/
|
|
215
311
|
active: Boolean
|
|
216
|
-
}
|
|
312
|
+
};
|
|
313
|
+
const PressedProps = {
|
|
217
314
|
/**
|
|
218
315
|
* Whether the item is pressed
|
|
219
316
|
*/
|
|
220
317
|
pressed: Boolean
|
|
221
|
-
}
|
|
318
|
+
};
|
|
319
|
+
const LabelProps = {
|
|
222
320
|
/**
|
|
223
321
|
* The item label
|
|
224
322
|
*/
|
|
225
323
|
label: [String, Number]
|
|
226
|
-
}
|
|
324
|
+
};
|
|
325
|
+
const ModifiersProps = {
|
|
227
326
|
/**
|
|
228
327
|
* Component BEM modifiers
|
|
229
328
|
*/
|
|
230
329
|
modifiers: [String, Array]
|
|
231
330
|
};
|
|
232
|
-
|
|
233
|
-
|
|
331
|
+
({
|
|
332
|
+
/**
|
|
333
|
+
* VvIcon name or props
|
|
334
|
+
* @see VVIcon
|
|
335
|
+
*/
|
|
336
|
+
icon: { type: [String, Object] },
|
|
337
|
+
/**
|
|
338
|
+
* VvIcon position
|
|
339
|
+
*/
|
|
340
|
+
iconPosition: {
|
|
341
|
+
type: String,
|
|
342
|
+
default: Position.before,
|
|
343
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
const UnselectableProps = {
|
|
234
347
|
/**
|
|
235
348
|
* If true the input will be unselectable
|
|
236
349
|
*/
|
|
237
|
-
unselectable: { type: Boolean, default:
|
|
238
|
-
}
|
|
350
|
+
unselectable: { type: Boolean, default: true }
|
|
351
|
+
};
|
|
352
|
+
const IdProps = {
|
|
239
353
|
/**
|
|
240
354
|
* Global attribute id
|
|
241
355
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
242
356
|
*/
|
|
243
357
|
id: [String, Number]
|
|
244
358
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
359
|
+
({
|
|
360
|
+
/**
|
|
361
|
+
* Dropdown placement
|
|
362
|
+
*/
|
|
363
|
+
placement: {
|
|
364
|
+
type: String,
|
|
365
|
+
default: Side.bottom,
|
|
366
|
+
validator: (value) => {
|
|
367
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
/**
|
|
371
|
+
* Dropdown strategy
|
|
372
|
+
*/
|
|
373
|
+
strategy: {
|
|
374
|
+
type: String,
|
|
375
|
+
default: "absolute",
|
|
376
|
+
validator: (value) => {
|
|
377
|
+
return ["fixed", "absolute"].includes(value);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
/**
|
|
381
|
+
* Dropdown show / hide transition name
|
|
382
|
+
*/
|
|
383
|
+
transitionName: {
|
|
384
|
+
type: String
|
|
385
|
+
},
|
|
386
|
+
/**
|
|
387
|
+
* Offset of the dropdown from the trigger
|
|
388
|
+
* @see https://floating-ui.com/docs/offset
|
|
389
|
+
*/
|
|
390
|
+
offset: {
|
|
391
|
+
type: [Number, String, Object],
|
|
392
|
+
default: 0
|
|
393
|
+
},
|
|
394
|
+
/**
|
|
395
|
+
* Move dropdown to the side if there is no space in the default position
|
|
396
|
+
* @see https://floating-ui.com/docs/shift
|
|
397
|
+
*/
|
|
398
|
+
shift: {
|
|
399
|
+
type: [Boolean, Object],
|
|
400
|
+
default: false
|
|
401
|
+
},
|
|
402
|
+
/**
|
|
403
|
+
* Flip dropdown position if there is no space in the default position
|
|
404
|
+
* @see https://floating-ui.com/docs/flip
|
|
405
|
+
*/
|
|
406
|
+
flip: {
|
|
407
|
+
type: [Boolean, Object],
|
|
408
|
+
default: true
|
|
409
|
+
},
|
|
410
|
+
/**
|
|
411
|
+
* Size of the dropdown
|
|
412
|
+
* @see https://floating-ui.com/docs/size
|
|
413
|
+
*/
|
|
414
|
+
size: {
|
|
415
|
+
type: [Boolean, Object],
|
|
416
|
+
default: () => ({ padding: 10 })
|
|
417
|
+
},
|
|
418
|
+
/**
|
|
419
|
+
* Automatically change the position of the dropdown
|
|
420
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
421
|
+
*/
|
|
422
|
+
autoPlacement: {
|
|
423
|
+
type: [Boolean, Object],
|
|
424
|
+
default: false
|
|
425
|
+
},
|
|
426
|
+
/**
|
|
427
|
+
* Add arrow to the dropdown
|
|
428
|
+
* @see https://floating-ui.com/docs/arrow
|
|
429
|
+
*/
|
|
430
|
+
arrow: {
|
|
431
|
+
type: Boolean,
|
|
432
|
+
default: false
|
|
433
|
+
},
|
|
434
|
+
/**
|
|
435
|
+
* Close dropdown on click outside
|
|
436
|
+
*/
|
|
437
|
+
autoClose: {
|
|
438
|
+
type: Boolean,
|
|
439
|
+
default: true
|
|
440
|
+
},
|
|
441
|
+
/**
|
|
442
|
+
* Autofocus first item on dropdown open
|
|
443
|
+
*/
|
|
444
|
+
autofocusFirst: {
|
|
445
|
+
type: Boolean,
|
|
446
|
+
default: true
|
|
447
|
+
},
|
|
448
|
+
/**
|
|
449
|
+
* Set dropdown width to the same as the trigger
|
|
450
|
+
*/
|
|
451
|
+
triggerWidth: {
|
|
452
|
+
type: Boolean
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
const ActionProps = {
|
|
456
|
+
...DisabledProps,
|
|
457
|
+
...LabelProps,
|
|
458
|
+
...PressedProps,
|
|
459
|
+
...ActiveProps,
|
|
460
|
+
...LinkProps,
|
|
252
461
|
/**
|
|
253
462
|
* Button type
|
|
254
463
|
*/
|
|
255
464
|
type: {
|
|
256
465
|
type: String,
|
|
257
|
-
default:
|
|
258
|
-
validator: (
|
|
466
|
+
default: ButtonType.button,
|
|
467
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
259
468
|
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
469
|
+
};
|
|
470
|
+
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
471
|
+
const VvActionProps = ActionProps;
|
|
472
|
+
function useInjectedDropdownTrigger() {
|
|
473
|
+
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
263
474
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
475
|
+
function useInjectedDropdownAction() {
|
|
476
|
+
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
266
477
|
}
|
|
267
|
-
const
|
|
478
|
+
const __default__$1 = {
|
|
268
479
|
name: "VvAction"
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
480
|
+
};
|
|
481
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
482
|
+
...__default__$1,
|
|
483
|
+
props: VvActionProps,
|
|
484
|
+
emits: VvActionEvents,
|
|
485
|
+
setup(__props, { expose, emit }) {
|
|
486
|
+
const props = __props;
|
|
487
|
+
const volver = useVolver();
|
|
488
|
+
const element = ref(null);
|
|
489
|
+
expose({ $el: element });
|
|
276
490
|
const {
|
|
277
|
-
reference:
|
|
278
|
-
bus:
|
|
279
|
-
aria:
|
|
280
|
-
expanded:
|
|
281
|
-
} =
|
|
282
|
-
|
|
283
|
-
() =>
|
|
284
|
-
(
|
|
285
|
-
|
|
491
|
+
reference: dropdownTriggerReference,
|
|
492
|
+
bus: dropdownEventBus,
|
|
493
|
+
aria: dropdownAria,
|
|
494
|
+
expanded: dropdownExpanded
|
|
495
|
+
} = useInjectedDropdownTrigger();
|
|
496
|
+
watch(
|
|
497
|
+
() => element.value,
|
|
498
|
+
(newValue) => {
|
|
499
|
+
if (dropdownTriggerReference) {
|
|
500
|
+
dropdownTriggerReference.value = newValue;
|
|
501
|
+
}
|
|
286
502
|
}
|
|
287
503
|
);
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
case
|
|
295
|
-
return
|
|
504
|
+
const pressed = computed(() => {
|
|
505
|
+
return props.pressed || (dropdownExpanded == null ? void 0 : dropdownExpanded.value);
|
|
506
|
+
});
|
|
507
|
+
const { role } = useInjectedDropdownAction();
|
|
508
|
+
const hasTag = computed(() => {
|
|
509
|
+
switch (true) {
|
|
510
|
+
case props.disabled:
|
|
511
|
+
return ActionTag.button;
|
|
512
|
+
case props.to !== void 0:
|
|
513
|
+
return (volver == null ? void 0 : volver.nuxt) ? ActionTag.nuxtLink : ActionTag.routerLink;
|
|
514
|
+
case props.href !== void 0:
|
|
515
|
+
return ActionTag.a;
|
|
296
516
|
default:
|
|
297
|
-
return
|
|
517
|
+
return ActionTag.button;
|
|
298
518
|
}
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
519
|
+
});
|
|
520
|
+
const hasProps = computed(() => {
|
|
521
|
+
const toReturn = {
|
|
522
|
+
...dropdownAria == null ? void 0 : dropdownAria.value,
|
|
523
|
+
"aria-pressed": pressed.value ? true : void 0,
|
|
524
|
+
role
|
|
304
525
|
};
|
|
305
|
-
switch (
|
|
306
|
-
case
|
|
526
|
+
switch (hasTag.value) {
|
|
527
|
+
case ActionTag.a:
|
|
307
528
|
return {
|
|
308
|
-
...
|
|
309
|
-
href:
|
|
310
|
-
target:
|
|
311
|
-
rel:
|
|
529
|
+
...toReturn,
|
|
530
|
+
href: props.href,
|
|
531
|
+
target: props.target,
|
|
532
|
+
rel: props.rel
|
|
312
533
|
};
|
|
313
|
-
case
|
|
314
|
-
case
|
|
534
|
+
case ActionTag.routerLink:
|
|
535
|
+
case ActionTag.nuxtLink:
|
|
315
536
|
return {
|
|
316
|
-
...
|
|
317
|
-
to:
|
|
318
|
-
target:
|
|
537
|
+
...toReturn,
|
|
538
|
+
to: props.to,
|
|
539
|
+
target: props.target
|
|
319
540
|
};
|
|
320
541
|
default:
|
|
321
542
|
return {
|
|
322
|
-
...
|
|
323
|
-
type:
|
|
324
|
-
disabled:
|
|
543
|
+
...toReturn,
|
|
544
|
+
type: props.type,
|
|
545
|
+
disabled: props.disabled
|
|
325
546
|
};
|
|
326
547
|
}
|
|
327
|
-
})
|
|
328
|
-
|
|
329
|
-
|
|
548
|
+
});
|
|
549
|
+
const onClick = (e) => {
|
|
550
|
+
if (props.disabled) {
|
|
551
|
+
e.preventDefault();
|
|
330
552
|
return;
|
|
331
553
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
554
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("click", e);
|
|
555
|
+
emit("click", e);
|
|
556
|
+
};
|
|
557
|
+
const onMouseover = (e) => {
|
|
558
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseover", e);
|
|
559
|
+
emit("mouseover", e);
|
|
560
|
+
};
|
|
561
|
+
const onMouseleave = (e) => {
|
|
562
|
+
dropdownEventBus == null ? void 0 : dropdownEventBus.emit("mouseleave", e);
|
|
563
|
+
emit("mouseleave", e);
|
|
564
|
+
};
|
|
565
|
+
return (_ctx, _cache) => {
|
|
566
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
567
|
+
ref_key: "element",
|
|
568
|
+
ref: element,
|
|
569
|
+
class: {
|
|
570
|
+
active: _ctx.active,
|
|
571
|
+
pressed: unref(pressed),
|
|
572
|
+
disabled: _ctx.disabled
|
|
573
|
+
},
|
|
574
|
+
onClickPassive: onClick,
|
|
575
|
+
onMouseoverPassive: onMouseover,
|
|
576
|
+
onMouseleavePassive: onMouseleave
|
|
577
|
+
}), {
|
|
578
|
+
default: withCtx(() => [
|
|
579
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
580
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
581
|
+
])
|
|
582
|
+
]),
|
|
583
|
+
_: 3
|
|
584
|
+
}, 16, ["class"]);
|
|
337
585
|
};
|
|
338
|
-
return (u, P) => (k(), j(te(p(m)), w(p(b), {
|
|
339
|
-
ref_key: "element",
|
|
340
|
-
ref: i,
|
|
341
|
-
class: {
|
|
342
|
-
active: u.active,
|
|
343
|
-
pressed: p(n),
|
|
344
|
-
disabled: u.disabled
|
|
345
|
-
},
|
|
346
|
-
onClickPassive: _,
|
|
347
|
-
onMouseoverPassive: O,
|
|
348
|
-
onMouseleavePassive: y
|
|
349
|
-
}), {
|
|
350
|
-
default: K(() => [
|
|
351
|
-
$(u.$slots, "default", {}, () => [
|
|
352
|
-
U(N(u.label), 1)
|
|
353
|
-
])
|
|
354
|
-
]),
|
|
355
|
-
_: 3
|
|
356
|
-
}, 16, ["class"]));
|
|
357
586
|
}
|
|
358
587
|
});
|
|
359
|
-
function
|
|
360
|
-
|
|
588
|
+
function equals(obj1, obj2, field) {
|
|
589
|
+
if (field)
|
|
590
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
591
|
+
else
|
|
592
|
+
return deepEquals(obj1, obj2);
|
|
361
593
|
}
|
|
362
|
-
function
|
|
363
|
-
if (
|
|
364
|
-
return
|
|
365
|
-
if (
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
594
|
+
function deepEquals(a, b) {
|
|
595
|
+
if (a === b)
|
|
596
|
+
return true;
|
|
597
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
598
|
+
const arrA = Array.isArray(a);
|
|
599
|
+
const arrB = Array.isArray(b);
|
|
600
|
+
let i, length, key;
|
|
601
|
+
if (arrA && arrB) {
|
|
602
|
+
length = a.length;
|
|
603
|
+
if (length != b.length)
|
|
604
|
+
return false;
|
|
605
|
+
for (i = length; i-- !== 0; )
|
|
606
|
+
if (!deepEquals(a[i], b[i]))
|
|
607
|
+
return false;
|
|
608
|
+
return true;
|
|
375
609
|
}
|
|
376
|
-
if (
|
|
377
|
-
return
|
|
378
|
-
const
|
|
379
|
-
if (
|
|
380
|
-
return
|
|
381
|
-
if (
|
|
382
|
-
return
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
return
|
|
386
|
-
if (
|
|
387
|
-
return
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
610
|
+
if (arrA != arrB)
|
|
611
|
+
return false;
|
|
612
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
613
|
+
if (dateA != dateB)
|
|
614
|
+
return false;
|
|
615
|
+
if (dateA && dateB)
|
|
616
|
+
return a.getTime() == b.getTime();
|
|
617
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
618
|
+
if (regexpA != regexpB)
|
|
619
|
+
return false;
|
|
620
|
+
if (regexpA && regexpB)
|
|
621
|
+
return a.toString() == b.toString();
|
|
622
|
+
const keys = Object.keys(a);
|
|
623
|
+
length = keys.length;
|
|
624
|
+
if (length !== Object.keys(b).length)
|
|
625
|
+
return false;
|
|
626
|
+
for (i = length; i-- !== 0; )
|
|
627
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
628
|
+
return false;
|
|
629
|
+
for (i = length; i-- !== 0; ) {
|
|
630
|
+
key = keys[i];
|
|
631
|
+
if (!deepEquals(a[key], b[key]))
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
return true;
|
|
398
635
|
}
|
|
399
|
-
return
|
|
636
|
+
return a !== a && b !== b;
|
|
400
637
|
}
|
|
401
|
-
function
|
|
402
|
-
if (
|
|
403
|
-
if (
|
|
404
|
-
return
|
|
405
|
-
{
|
|
406
|
-
const
|
|
407
|
-
let
|
|
408
|
-
for (let
|
|
409
|
-
if (
|
|
638
|
+
function resolveFieldData(data, field) {
|
|
639
|
+
if (data && Object.keys(data).length && field) {
|
|
640
|
+
if (field.indexOf(".") === -1) {
|
|
641
|
+
return data[field];
|
|
642
|
+
} else {
|
|
643
|
+
const fields = field.split(".");
|
|
644
|
+
let value = data;
|
|
645
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
646
|
+
if (data == null) {
|
|
410
647
|
return null;
|
|
411
|
-
|
|
648
|
+
}
|
|
649
|
+
value = value[fields[i]];
|
|
412
650
|
}
|
|
413
|
-
return
|
|
651
|
+
return value;
|
|
414
652
|
}
|
|
415
|
-
} else
|
|
653
|
+
} else {
|
|
416
654
|
return null;
|
|
655
|
+
}
|
|
417
656
|
}
|
|
418
|
-
function
|
|
419
|
-
if (
|
|
420
|
-
for (const
|
|
421
|
-
if (
|
|
422
|
-
return
|
|
657
|
+
function contains(value, list) {
|
|
658
|
+
if (value != null && list && list.length) {
|
|
659
|
+
for (const val of list) {
|
|
660
|
+
if (equals(value, val)) {
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
423
664
|
}
|
|
424
|
-
return
|
|
665
|
+
return false;
|
|
425
666
|
}
|
|
426
|
-
function
|
|
427
|
-
return ((
|
|
667
|
+
function isEmpty(value) {
|
|
668
|
+
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));
|
|
428
669
|
}
|
|
429
|
-
function
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
670
|
+
function useInjectedGroupState(groupKey) {
|
|
671
|
+
const group = inject(groupKey, void 0);
|
|
672
|
+
const isInGroup = computed(() => !isEmpty(group));
|
|
673
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
674
|
+
if (group == null ? void 0 : group.value) {
|
|
675
|
+
const groupPropValue = unref(group.value)[propName];
|
|
676
|
+
return computed({
|
|
435
677
|
get() {
|
|
436
|
-
return
|
|
678
|
+
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
437
679
|
},
|
|
438
|
-
set(
|
|
439
|
-
|
|
680
|
+
set(value) {
|
|
681
|
+
groupPropValue.value = value;
|
|
440
682
|
}
|
|
441
683
|
});
|
|
442
684
|
}
|
|
443
|
-
const
|
|
444
|
-
return
|
|
685
|
+
const propRef = toRef(props, propName);
|
|
686
|
+
return computed({
|
|
445
687
|
get() {
|
|
446
|
-
return
|
|
688
|
+
return propRef.value;
|
|
447
689
|
},
|
|
448
|
-
set(
|
|
449
|
-
|
|
690
|
+
set(value) {
|
|
691
|
+
if (emit)
|
|
692
|
+
emit(`update:${propName}`, value);
|
|
450
693
|
}
|
|
451
694
|
});
|
|
452
695
|
}
|
|
453
696
|
return {
|
|
454
|
-
group
|
|
455
|
-
isInGroup
|
|
456
|
-
getGroupOrLocalRef
|
|
697
|
+
group,
|
|
698
|
+
isInGroup,
|
|
699
|
+
getGroupOrLocalRef
|
|
457
700
|
};
|
|
458
701
|
}
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
...
|
|
462
|
-
...
|
|
463
|
-
...
|
|
464
|
-
...
|
|
702
|
+
const VvButtonEvents = ["update:modelValue"];
|
|
703
|
+
const VvButtonProps = {
|
|
704
|
+
...ActionProps,
|
|
705
|
+
...IdProps,
|
|
706
|
+
...ModifiersProps,
|
|
707
|
+
...UnselectableProps,
|
|
708
|
+
...LoadingProps,
|
|
465
709
|
/**
|
|
466
710
|
* Button icon
|
|
467
711
|
*/
|
|
@@ -471,8 +715,8 @@ const De = ["update:modelValue"], Ee = {
|
|
|
471
715
|
*/
|
|
472
716
|
iconPosition: {
|
|
473
717
|
type: String,
|
|
474
|
-
default:
|
|
475
|
-
validator: (
|
|
718
|
+
default: Side.left,
|
|
719
|
+
validator: (value) => Object.values(Side).includes(value)
|
|
476
720
|
},
|
|
477
721
|
/**
|
|
478
722
|
* Loading icon
|
|
@@ -480,148 +724,190 @@ const De = ["update:modelValue"], Ee = {
|
|
|
480
724
|
loadingIcon: { type: String, default: "eos-icons:bubble-loading" },
|
|
481
725
|
toggle: {
|
|
482
726
|
type: Boolean,
|
|
483
|
-
default:
|
|
727
|
+
default: false
|
|
484
728
|
},
|
|
485
729
|
modelValue: String
|
|
486
730
|
};
|
|
487
|
-
function
|
|
488
|
-
|
|
489
|
-
const {
|
|
490
|
-
id
|
|
491
|
-
iconPosition
|
|
492
|
-
icon
|
|
493
|
-
label
|
|
494
|
-
pressed
|
|
495
|
-
modifiers:
|
|
496
|
-
} =
|
|
731
|
+
function useGroupProps(props, emit) {
|
|
732
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_BUTTON_GROUP);
|
|
733
|
+
const {
|
|
734
|
+
id,
|
|
735
|
+
iconPosition,
|
|
736
|
+
icon,
|
|
737
|
+
label,
|
|
738
|
+
pressed,
|
|
739
|
+
modifiers: localModifiers
|
|
740
|
+
} = toRefs(props);
|
|
741
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
742
|
+
const toggle = getGroupOrLocalRef("toggle", props);
|
|
743
|
+
const unselectable = getGroupOrLocalRef(
|
|
497
744
|
"unselectable",
|
|
498
|
-
|
|
499
|
-
)
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
745
|
+
props
|
|
746
|
+
);
|
|
747
|
+
const multiple = computed(() => (group == null ? void 0 : group.value.multiple.value) ?? false);
|
|
748
|
+
const modifiers = computed(() => {
|
|
749
|
+
var _a;
|
|
750
|
+
const localValue = (localModifiers == null ? void 0 : localModifiers.value) ? Array.isArray(localModifiers.value) ? localModifiers.value : localModifiers.value.split(" ") : [];
|
|
751
|
+
const groupValue = ((_a = group == null ? void 0 : group.value.itemModifiers) == null ? void 0 : _a.value) ? Array.isArray(group.value.itemModifiers.value) ? group.value.itemModifiers.value : group.value.itemModifiers.value.split(" ") : [];
|
|
752
|
+
return [...localValue, ...groupValue];
|
|
503
753
|
});
|
|
754
|
+
const disabled = computed(
|
|
755
|
+
() => {
|
|
756
|
+
var _a;
|
|
757
|
+
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
758
|
+
}
|
|
759
|
+
);
|
|
504
760
|
return {
|
|
505
761
|
// group props
|
|
506
|
-
group
|
|
507
|
-
isInGroup
|
|
508
|
-
modelValue
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
762
|
+
group,
|
|
763
|
+
isInGroup,
|
|
764
|
+
modelValue,
|
|
765
|
+
toggle,
|
|
766
|
+
unselectable,
|
|
767
|
+
multiple,
|
|
768
|
+
modifiers,
|
|
769
|
+
disabled,
|
|
513
770
|
// local props
|
|
514
|
-
id
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
label: d
|
|
771
|
+
id,
|
|
772
|
+
pressed,
|
|
773
|
+
iconPosition,
|
|
774
|
+
icon,
|
|
775
|
+
label
|
|
520
776
|
};
|
|
521
777
|
}
|
|
522
|
-
const
|
|
778
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
779
|
+
const _hoisted_1 = {
|
|
523
780
|
key: 1,
|
|
524
781
|
class: "vv-button__label"
|
|
525
|
-
}
|
|
782
|
+
};
|
|
783
|
+
const _hoisted_2 = {
|
|
526
784
|
key: 1,
|
|
527
785
|
class: "vv-button__label"
|
|
528
|
-
}
|
|
786
|
+
};
|
|
787
|
+
const __default__ = {
|
|
529
788
|
name: "VvButton"
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
789
|
+
};
|
|
790
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
791
|
+
...__default__,
|
|
792
|
+
props: VvButtonProps,
|
|
793
|
+
emits: VvButtonEvents,
|
|
794
|
+
setup(__props, { expose, emit }) {
|
|
795
|
+
const props = __props;
|
|
796
|
+
const attrs = useAttrs();
|
|
797
|
+
const slots = useSlots();
|
|
798
|
+
const {
|
|
799
|
+
id,
|
|
800
|
+
modifiers,
|
|
801
|
+
iconPosition,
|
|
802
|
+
icon,
|
|
803
|
+
label,
|
|
804
|
+
modelValue,
|
|
805
|
+
disabled,
|
|
806
|
+
toggle,
|
|
807
|
+
unselectable
|
|
808
|
+
} = useGroupProps(props, emit);
|
|
809
|
+
const hasId = useUniqueId(id);
|
|
810
|
+
const name = computed(() => (attrs == null ? void 0 : attrs.name) || hasId.value);
|
|
811
|
+
const element = ref(null);
|
|
812
|
+
const $el = computed(() => {
|
|
813
|
+
var _a;
|
|
814
|
+
return (_a = element.value) == null ? void 0 : _a.$el;
|
|
548
815
|
});
|
|
549
|
-
|
|
550
|
-
const
|
|
816
|
+
expose({ $el });
|
|
817
|
+
const pressed = computed(() => {
|
|
818
|
+
if (!toggle.value) {
|
|
819
|
+
return props.pressed;
|
|
820
|
+
}
|
|
821
|
+
if (Array.isArray(modelValue.value)) {
|
|
822
|
+
return contains(name.value, modelValue.value);
|
|
823
|
+
}
|
|
824
|
+
return equals(name.value, modelValue.value);
|
|
825
|
+
});
|
|
826
|
+
const bemCssClasses = useModifiers(
|
|
551
827
|
"vv-button",
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
reverse: [
|
|
555
|
-
|
|
828
|
+
modifiers,
|
|
829
|
+
computed(() => ({
|
|
830
|
+
reverse: [Side.right, Side.bottom].includes(
|
|
831
|
+
iconPosition.value
|
|
832
|
+
),
|
|
833
|
+
column: [Side.top, Side.bottom].includes(
|
|
834
|
+
iconPosition.value
|
|
835
|
+
),
|
|
556
836
|
"icon-only": Boolean(
|
|
557
|
-
(
|
|
837
|
+
(icon == null ? void 0 : icon.value) && !(label == null ? void 0 : label.value) && !slots.default
|
|
558
838
|
)
|
|
559
839
|
}))
|
|
560
|
-
)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
)
|
|
840
|
+
);
|
|
841
|
+
const hasIconProps = computed(
|
|
842
|
+
() => typeof (icon == null ? void 0 : icon.value) === "string" ? { name: icon == null ? void 0 : icon.value } : icon == null ? void 0 : icon.value
|
|
843
|
+
);
|
|
844
|
+
const onClick = () => {
|
|
845
|
+
if (toggle.value) {
|
|
846
|
+
if (Array.isArray(modelValue.value)) {
|
|
847
|
+
if (contains(name.value, modelValue.value)) {
|
|
848
|
+
if (unselectable.value) {
|
|
849
|
+
modelValue.value = modelValue.value.filter(
|
|
850
|
+
(n) => n !== name.value
|
|
851
|
+
);
|
|
852
|
+
}
|
|
569
853
|
return;
|
|
570
854
|
}
|
|
571
|
-
|
|
855
|
+
modelValue.value.push(name.value);
|
|
572
856
|
return;
|
|
573
857
|
}
|
|
574
|
-
if (
|
|
575
|
-
|
|
858
|
+
if (equals(name.value, modelValue.value) && unselectable.value) {
|
|
859
|
+
modelValue.value = void 0;
|
|
576
860
|
return;
|
|
577
861
|
}
|
|
578
|
-
|
|
862
|
+
modelValue.value = name.value;
|
|
579
863
|
}
|
|
580
864
|
};
|
|
581
|
-
return (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
865
|
+
return (_ctx, _cache) => {
|
|
866
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
|
867
|
+
disabled: unref(disabled),
|
|
868
|
+
pressed: unref(pressed),
|
|
869
|
+
active: _ctx.active,
|
|
870
|
+
type: _ctx.type,
|
|
871
|
+
to: _ctx.to,
|
|
872
|
+
href: _ctx.href,
|
|
873
|
+
target: _ctx.target,
|
|
874
|
+
rel: _ctx.rel
|
|
875
|
+
}, {
|
|
876
|
+
id: unref(hasId),
|
|
877
|
+
ref_key: "element",
|
|
878
|
+
ref: element,
|
|
879
|
+
class: unref(bemCssClasses),
|
|
880
|
+
onClick
|
|
881
|
+
}), {
|
|
882
|
+
default: withCtx(() => [
|
|
883
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
884
|
+
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
885
|
+
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$2, {
|
|
886
|
+
key: 0,
|
|
887
|
+
class: "vv-button__loading-icon",
|
|
888
|
+
name: _ctx.loadingIcon
|
|
889
|
+
}, null, 8, ["name"])) : createCommentVNode("", true),
|
|
890
|
+
_ctx.loadingLabel ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(_ctx.loadingLabel), 1)) : createCommentVNode("", true)
|
|
891
|
+
]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
892
|
+
renderSlot(_ctx.$slots, "before"),
|
|
893
|
+
unref(icon) ? (openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
894
|
+
key: 0,
|
|
895
|
+
class: "vv-button__icon"
|
|
896
|
+
}, unref(hasIconProps)), null, 16)) : createCommentVNode("", true),
|
|
897
|
+
unref(label) ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
|
898
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
899
|
+
createTextVNode(toDisplayString(unref(label)), 1)
|
|
900
|
+
])
|
|
901
|
+
])) : createCommentVNode("", true),
|
|
902
|
+
renderSlot(_ctx.$slots, "after")
|
|
903
|
+
], 64))
|
|
904
|
+
])
|
|
905
|
+
]),
|
|
906
|
+
_: 3
|
|
907
|
+
}, 16, ["id", "class"]);
|
|
908
|
+
};
|
|
623
909
|
}
|
|
624
910
|
});
|
|
625
911
|
export {
|
|
626
|
-
|
|
912
|
+
_sfc_main as default
|
|
627
913
|
};
|