@volverjs/ui-vue 0.0.3 → 0.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +54 -15
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +23 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +180 -74
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +280 -122
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +338 -0
- package/dist/components/VvAction/VvAction.umd.js +1 -0
- package/dist/components/VvAction/VvAction.vue.d.ts +63 -0
- package/dist/components/VvAction/index.d.ts +24 -0
- package/dist/components/VvBadge/VvBadge.es.js +251 -22
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +280 -62
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +720 -261
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +54 -54
- package/dist/components/VvButton/index.d.ts +30 -75
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +296 -49
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +60 -28
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +630 -172
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +4 -4
- package/dist/components/VvCheckbox/index.d.ts +6 -6
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +736 -228
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +9 -9
- package/dist/components/VvCheckboxGroup/index.d.ts +4 -4
- package/dist/components/VvCombobox/VvCombobox.es.js +1673 -768
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +159 -61
- package/dist/components/VvCombobox/index.d.ts +54 -23
- package/dist/components/VvDialog/VvDialog.es.js +426 -115
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +504 -190
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +114 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +61 -0
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +52 -0
- package/dist/components/VvDropdown/index.d.ts +35 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +454 -0
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -0
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +48 -18
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +361 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -0
- package/dist/components/VvIcon/VvIcon.es.js +116 -52
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +1054 -376
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +107 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +67 -3
- package/dist/components/VvProgress/VvProgress.es.js +254 -23
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +568 -137
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +4 -4
- package/dist/components/VvRadio/index.d.ts +6 -6
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +674 -193
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +9 -9
- package/dist/components/VvRadioGroup/index.d.ts +4 -4
- package/dist/components/VvSelect/VvSelect.es.js +703 -251
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -17
- package/dist/components/VvSelect/index.d.ts +8 -8
- package/dist/components/VvTextarea/VvTextarea.es.js +747 -272
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +21 -14
- package/dist/components/VvTextarea/index.d.ts +7 -7
- package/dist/components/VvTooltip/VvTooltip.es.js +252 -24
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3676 -2007
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/constants.d.ts +30 -0
- package/dist/directives/index.es.js +288 -0
- package/dist/directives/index.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +285 -0
- package/dist/directives/v-tooltip.umd.js +1 -0
- package/dist/icons.es.js +38 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +115 -3269
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +215 -23
- package/dist/resolvers/unplugin.d.ts +14 -8
- package/dist/resolvers/unplugin.es.js +94 -33
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +44 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +3 -2
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +1 -1
- package/package.json +167 -63
- package/src/Volver.ts +60 -26
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +144 -0
- package/src/components/VvAction/index.ts +5 -0
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +41 -124
- package/src/components/VvButton/index.ts +16 -88
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +85 -57
- package/src/components/VvCombobox/index.ts +12 -10
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +6 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +46 -0
- package/src/components/VvDropdown/VvDropdownOption.vue +72 -0
- package/src/components/VvDropdown/index.ts +6 -11
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +128 -35
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +3 -5
- package/src/components/VvTextarea/VvTextarea.vue +4 -4
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +9 -11
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +8 -9
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/constants.ts +36 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-tooltip.ts +2 -2
- package/src/index.ts +0 -2
- package/src/props/index.ts +111 -19
- package/src/resolvers/unplugin.ts +96 -49
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +3 -2
- package/src/stories/Breadcrumb/Breadcrumb.stories.mdx +2 -1
- package/src/stories/Button/Button.stories.mdx +4 -2
- package/src/stories/Button/Button.test.ts +3 -1
- package/src/stories/Button/ButtonModifiers.stories.mdx +2 -2
- package/src/stories/Button/ButtonSlots.stories.mdx +8 -7
- package/src/stories/Button/ButtonState.stories.mdx +2 -11
- package/src/stories/Card/Card.stories.mdx +2 -1
- package/src/stories/Checkbox/Checkbox.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroup.stories.mdx +2 -1
- package/src/stories/CheckboxGroup/CheckboxGroupSlots.stories.mdx +2 -1
- package/src/stories/Combobox/Combobox.settings.ts +44 -0
- package/src/stories/Combobox/Combobox.stories.mdx +40 -1
- package/src/stories/Dialog/Dialog.stories.mdx +2 -1
- package/src/stories/Dropdown/Dropdown.settings.ts +3 -2
- package/src/stories/Dropdown/Dropdown.stories.mdx +14 -12
- package/src/stories/Dropdown/DropdownMultilevel.stories.mdx +56 -0
- package/src/stories/Dropdown/DropdownSlots.stories.mdx +14 -13
- package/src/stories/Icon/Icon.stories.mdx +2 -1
- package/src/stories/Icon/IconsCollection.stories.mdx +2 -1
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +42 -1
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Progress/Progress.stories.mdx +2 -1
- package/src/stories/Radio/Radio.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroup.stories.mdx +2 -1
- package/src/stories/RadioGroup/RadioGroupSlots.stories.mdx +2 -1
- package/src/stories/Select/Select.stories.mdx +2 -1
- package/src/stories/Textarea/Textarea.stories.mdx +2 -1
- package/src/stories/Tooltip/Tooltip.stories.mdx +2 -1
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +2 -1
- package/src/stories/argTypes.ts +2 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,37 +1,184 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { unref, toRefs, computed, h, inject, toRef, defineComponent, useSlots, ref, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelRadio, renderSlot, createTextVNode, toDisplayString, createVNode, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
|
|
2
|
+
import { toReactive, useVModel } from "@vueuse/core";
|
|
3
|
+
import { nanoid } from "nanoid";
|
|
4
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
5
|
+
Side2["left"] = "left";
|
|
6
|
+
Side2["right"] = "right";
|
|
7
|
+
Side2["top"] = "top";
|
|
8
|
+
Side2["bottom"] = "bottom";
|
|
9
|
+
return Side2;
|
|
10
|
+
})(Side || {});
|
|
11
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
12
|
+
Placement2["topStart"] = "top-start";
|
|
13
|
+
Placement2["topEnd"] = "top-end";
|
|
14
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
15
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
16
|
+
Placement2["leftStart"] = "left-start";
|
|
17
|
+
Placement2["leftEnd"] = "left-end";
|
|
18
|
+
Placement2["rightStart"] = "right-start";
|
|
19
|
+
Placement2["rightEnd"] = "right-end";
|
|
20
|
+
return Placement2;
|
|
21
|
+
})(Placement || {});
|
|
22
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
23
|
+
Position2["before"] = "before";
|
|
24
|
+
Position2["after"] = "after";
|
|
25
|
+
return Position2;
|
|
26
|
+
})(Position || {});
|
|
27
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
28
|
+
ButtonType2["button"] = "button";
|
|
29
|
+
ButtonType2["submit"] = "submit";
|
|
30
|
+
ButtonType2["reset"] = "reset";
|
|
31
|
+
return ButtonType2;
|
|
32
|
+
})(ButtonType || {});
|
|
33
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
34
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
35
|
+
AnchorTarget2["_self"] = "_self";
|
|
36
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
37
|
+
AnchorTarget2["_top"] = "_top";
|
|
38
|
+
return AnchorTarget2;
|
|
39
|
+
})(AnchorTarget || {});
|
|
40
|
+
const INJECTION_KEY_RADIO_GROUP = Symbol.for("radioGroup");
|
|
41
|
+
function equals(obj1, obj2, field) {
|
|
42
|
+
if (field)
|
|
43
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
44
|
+
else
|
|
45
|
+
return deepEquals(obj1, obj2);
|
|
6
46
|
}
|
|
7
|
-
function
|
|
47
|
+
function deepEquals(a, b) {
|
|
48
|
+
if (a === b)
|
|
49
|
+
return true;
|
|
50
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
51
|
+
const arrA = Array.isArray(a);
|
|
52
|
+
const arrB = Array.isArray(b);
|
|
53
|
+
let i, length, key;
|
|
54
|
+
if (arrA && arrB) {
|
|
55
|
+
length = a.length;
|
|
56
|
+
if (length != b.length)
|
|
57
|
+
return false;
|
|
58
|
+
for (i = length; i-- !== 0; )
|
|
59
|
+
if (!deepEquals(a[i], b[i]))
|
|
60
|
+
return false;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (arrA != arrB)
|
|
64
|
+
return false;
|
|
65
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
66
|
+
if (dateA != dateB)
|
|
67
|
+
return false;
|
|
68
|
+
if (dateA && dateB)
|
|
69
|
+
return a.getTime() == b.getTime();
|
|
70
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
71
|
+
if (regexpA != regexpB)
|
|
72
|
+
return false;
|
|
73
|
+
if (regexpA && regexpB)
|
|
74
|
+
return a.toString() == b.toString();
|
|
75
|
+
const keys = Object.keys(a);
|
|
76
|
+
length = keys.length;
|
|
77
|
+
if (length !== Object.keys(b).length)
|
|
78
|
+
return false;
|
|
79
|
+
for (i = length; i-- !== 0; )
|
|
80
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
81
|
+
return false;
|
|
82
|
+
for (i = length; i-- !== 0; ) {
|
|
83
|
+
key = keys[i];
|
|
84
|
+
if (!deepEquals(a[key], b[key]))
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return a !== a && b !== b;
|
|
90
|
+
}
|
|
91
|
+
function resolveFieldData(data, field) {
|
|
92
|
+
if (data && Object.keys(data).length && field) {
|
|
93
|
+
if (field.indexOf(".") === -1) {
|
|
94
|
+
return data[field];
|
|
95
|
+
} else {
|
|
96
|
+
const fields = field.split(".");
|
|
97
|
+
let value = data;
|
|
98
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
99
|
+
if (data == null) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
value = value[fields[i]];
|
|
103
|
+
}
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function contains(value, list) {
|
|
111
|
+
if (value != null && list && list.length) {
|
|
112
|
+
for (const val of list) {
|
|
113
|
+
if (equals(value, val)) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
function isEmpty(value) {
|
|
121
|
+
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));
|
|
122
|
+
}
|
|
123
|
+
function isString(value) {
|
|
124
|
+
return typeof value === "string" || value instanceof String;
|
|
125
|
+
}
|
|
126
|
+
function joinLines(errors) {
|
|
127
|
+
if (Array.isArray(errors)) {
|
|
128
|
+
return errors.filter((e) => isString(e)).join(" ");
|
|
129
|
+
}
|
|
130
|
+
return errors;
|
|
131
|
+
}
|
|
132
|
+
function HintSlotFactory(parentProps, parentSlots) {
|
|
8
133
|
const {
|
|
9
|
-
invalid:
|
|
10
|
-
valid:
|
|
11
|
-
hint:
|
|
12
|
-
loading:
|
|
13
|
-
} =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
134
|
+
invalid: invalidSlot,
|
|
135
|
+
valid: validSlot,
|
|
136
|
+
hint: hintSlot,
|
|
137
|
+
loading: loadingSlot
|
|
138
|
+
} = parentSlots;
|
|
139
|
+
const {
|
|
140
|
+
hintLabel,
|
|
141
|
+
modelValue,
|
|
142
|
+
valid,
|
|
143
|
+
validLabel,
|
|
144
|
+
invalid,
|
|
145
|
+
invalidLabel,
|
|
146
|
+
...otherProps
|
|
147
|
+
} = toRefs(parentProps);
|
|
148
|
+
const loading = resolveFieldData(otherProps, "loading");
|
|
149
|
+
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
150
|
+
const hasInvalid = computed(() => {
|
|
151
|
+
if (!invalid.value) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
if (invalid.value && invalidSlot) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
});
|
|
165
|
+
const hasHint = computed(
|
|
166
|
+
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
167
|
+
);
|
|
168
|
+
const hasValid = computed(
|
|
169
|
+
() => !!(validLabel && validLabel.value || validSlot)
|
|
170
|
+
);
|
|
171
|
+
const hasLoading = computed(
|
|
172
|
+
() => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
|
|
173
|
+
);
|
|
174
|
+
const isVisible = computed(
|
|
175
|
+
() => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
|
|
29
176
|
);
|
|
30
177
|
return {
|
|
31
|
-
hasInvalid
|
|
32
|
-
hasHint
|
|
33
|
-
hasValid
|
|
34
|
-
hasLoading
|
|
178
|
+
hasInvalid,
|
|
179
|
+
hasHint,
|
|
180
|
+
hasValid,
|
|
181
|
+
hasLoading,
|
|
35
182
|
HintSlot: {
|
|
36
183
|
name: "HintSlot",
|
|
37
184
|
props: {
|
|
@@ -40,30 +187,37 @@ function H(e, p) {
|
|
|
40
187
|
default: () => ({})
|
|
41
188
|
}
|
|
42
189
|
},
|
|
43
|
-
setup(
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
hintLabel
|
|
47
|
-
modelValue
|
|
48
|
-
valid
|
|
49
|
-
validLabel
|
|
50
|
-
invalid
|
|
51
|
-
invalidLabel
|
|
52
|
-
loading
|
|
53
|
-
loadingLabel
|
|
54
|
-
...
|
|
190
|
+
setup(props) {
|
|
191
|
+
const hintContent = computed(() => {
|
|
192
|
+
const slotProps = toReactive({
|
|
193
|
+
hintLabel,
|
|
194
|
+
modelValue,
|
|
195
|
+
valid,
|
|
196
|
+
validLabel,
|
|
197
|
+
invalid,
|
|
198
|
+
invalidLabel,
|
|
199
|
+
loading,
|
|
200
|
+
loadingLabel,
|
|
201
|
+
...props.params
|
|
55
202
|
});
|
|
56
|
-
|
|
203
|
+
if (invalid == null ? void 0 : invalid.value) {
|
|
204
|
+
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
205
|
+
}
|
|
206
|
+
if (valid == null ? void 0 : valid.value)
|
|
207
|
+
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
208
|
+
if (loading == null ? void 0 : loading.value)
|
|
209
|
+
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
210
|
+
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
57
211
|
});
|
|
58
212
|
return {
|
|
59
|
-
isVisible
|
|
60
|
-
hasInvalid
|
|
61
|
-
hasValid
|
|
62
|
-
hintContent
|
|
213
|
+
isVisible,
|
|
214
|
+
hasInvalid,
|
|
215
|
+
hasValid,
|
|
216
|
+
hintContent
|
|
63
217
|
};
|
|
64
218
|
},
|
|
65
219
|
render() {
|
|
66
|
-
if (this.isVisible)
|
|
220
|
+
if (this.isVisible) {
|
|
67
221
|
return h(
|
|
68
222
|
"small",
|
|
69
223
|
{
|
|
@@ -71,34 +225,98 @@ function H(e, p) {
|
|
|
71
225
|
},
|
|
72
226
|
this.hintContent
|
|
73
227
|
);
|
|
228
|
+
}
|
|
74
229
|
}
|
|
75
230
|
}
|
|
76
231
|
};
|
|
77
232
|
}
|
|
78
|
-
const
|
|
233
|
+
const LinkProps = {
|
|
234
|
+
/**
|
|
235
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
236
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
237
|
+
*/
|
|
238
|
+
to: {
|
|
239
|
+
type: [String, Object]
|
|
240
|
+
},
|
|
241
|
+
/**
|
|
242
|
+
* Anchor href
|
|
243
|
+
*/
|
|
244
|
+
href: String,
|
|
245
|
+
/**
|
|
246
|
+
* Anchor target
|
|
247
|
+
*/
|
|
248
|
+
target: {
|
|
249
|
+
type: String,
|
|
250
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Anchor rel
|
|
254
|
+
*/
|
|
255
|
+
rel: {
|
|
256
|
+
type: String,
|
|
257
|
+
default: "noopener noreferrer"
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const ValidProps = {
|
|
261
|
+
/**
|
|
262
|
+
* Valid status
|
|
263
|
+
*/
|
|
79
264
|
valid: Boolean,
|
|
265
|
+
/**
|
|
266
|
+
* Valid label
|
|
267
|
+
*/
|
|
80
268
|
validLabel: [String, Array]
|
|
81
|
-
}
|
|
269
|
+
};
|
|
270
|
+
const InvalidProps = {
|
|
271
|
+
/**
|
|
272
|
+
* Invalid status
|
|
273
|
+
*/
|
|
82
274
|
invalid: Boolean,
|
|
275
|
+
/**
|
|
276
|
+
* Invalid label
|
|
277
|
+
*/
|
|
83
278
|
invalidLabel: [String, Array]
|
|
84
|
-
}
|
|
279
|
+
};
|
|
280
|
+
const DisabledProps = {
|
|
85
281
|
/**
|
|
86
282
|
* Whether the form control is disabled
|
|
87
283
|
*/
|
|
88
284
|
disabled: Boolean
|
|
89
|
-
}
|
|
285
|
+
};
|
|
286
|
+
const ActiveProps = {
|
|
287
|
+
/**
|
|
288
|
+
* Whether the item is active
|
|
289
|
+
*/
|
|
290
|
+
active: Boolean
|
|
291
|
+
};
|
|
292
|
+
const PressedProps = {
|
|
293
|
+
/**
|
|
294
|
+
* Whether the item is pressed
|
|
295
|
+
*/
|
|
296
|
+
pressed: Boolean
|
|
297
|
+
};
|
|
298
|
+
const LabelProps = {
|
|
299
|
+
/**
|
|
300
|
+
* The item label
|
|
301
|
+
*/
|
|
302
|
+
label: [String, Number]
|
|
303
|
+
};
|
|
304
|
+
const ReadonlyProps = {
|
|
90
305
|
/**
|
|
91
306
|
* The value is not editable
|
|
92
307
|
*/
|
|
93
308
|
readonly: Boolean
|
|
94
|
-
}
|
|
309
|
+
};
|
|
310
|
+
const ModifiersProps = {
|
|
95
311
|
/**
|
|
96
312
|
* Component BEM modifiers
|
|
97
313
|
*/
|
|
98
314
|
modifiers: [String, Array]
|
|
99
|
-
}
|
|
315
|
+
};
|
|
316
|
+
const HintProps = {
|
|
100
317
|
hintLabel: { type: String, default: "" }
|
|
101
|
-
}
|
|
318
|
+
};
|
|
319
|
+
const OptionsProps = {
|
|
102
320
|
/**
|
|
103
321
|
* List of options, can be string[] or object[]
|
|
104
322
|
*/
|
|
@@ -119,38 +337,140 @@ const M = {
|
|
|
119
337
|
*/
|
|
120
338
|
disabledKey: { type: [String, Function], default: "disabled" }
|
|
121
339
|
};
|
|
122
|
-
|
|
123
|
-
|
|
340
|
+
({
|
|
341
|
+
/**
|
|
342
|
+
* VvIcon name or props
|
|
343
|
+
* @see VVIcon
|
|
344
|
+
*/
|
|
345
|
+
icon: { type: [String, Object] },
|
|
346
|
+
/**
|
|
347
|
+
* VvIcon position
|
|
348
|
+
*/
|
|
349
|
+
iconPosition: {
|
|
350
|
+
type: String,
|
|
351
|
+
default: Position.before,
|
|
352
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
const TabindexProps = {
|
|
124
356
|
/**
|
|
125
357
|
* Global attribute tabindex
|
|
126
358
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
127
359
|
*/
|
|
128
360
|
tabindex: { type: [String, Number], default: 0 }
|
|
129
|
-
}
|
|
361
|
+
};
|
|
362
|
+
const IdProps = {
|
|
130
363
|
/**
|
|
131
364
|
* Global attribute id
|
|
132
365
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
133
366
|
*/
|
|
134
367
|
id: [String, Number]
|
|
135
368
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
369
|
+
({
|
|
370
|
+
/**
|
|
371
|
+
* Dropdown placement
|
|
372
|
+
*/
|
|
373
|
+
placement: {
|
|
374
|
+
type: String,
|
|
375
|
+
default: Side.bottom,
|
|
376
|
+
validator: (value) => {
|
|
377
|
+
return Object.values(Side).includes(value) || Object.values(Placement).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 IdNameProps = {
|
|
456
|
+
...IdProps,
|
|
139
457
|
/**
|
|
140
458
|
* Input / Textarea name
|
|
141
459
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
142
460
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
143
461
|
*/
|
|
144
|
-
name: { type: String, required:
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
...
|
|
148
|
-
...
|
|
149
|
-
...
|
|
150
|
-
...
|
|
151
|
-
...
|
|
152
|
-
...
|
|
153
|
-
...
|
|
462
|
+
name: { type: String, required: true }
|
|
463
|
+
};
|
|
464
|
+
const CheckboxRadioProps = {
|
|
465
|
+
...IdNameProps,
|
|
466
|
+
...TabindexProps,
|
|
467
|
+
...ValidProps,
|
|
468
|
+
...InvalidProps,
|
|
469
|
+
...HintProps,
|
|
470
|
+
...DisabledProps,
|
|
471
|
+
...ReadonlyProps,
|
|
472
|
+
...ModifiersProps,
|
|
473
|
+
...LabelProps,
|
|
154
474
|
/**
|
|
155
475
|
* Input value
|
|
156
476
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -159,158 +479,319 @@ const re = {
|
|
|
159
479
|
/**
|
|
160
480
|
* Input value
|
|
161
481
|
*/
|
|
162
|
-
modelValue: [Object, Number, Boolean, String]
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
...
|
|
169
|
-
...
|
|
170
|
-
...
|
|
171
|
-
...
|
|
172
|
-
...
|
|
173
|
-
...K,
|
|
174
|
-
...w,
|
|
482
|
+
modelValue: [Object, Number, Boolean, String]
|
|
483
|
+
};
|
|
484
|
+
const CheckboxRadioGroupProps = {
|
|
485
|
+
...ValidProps,
|
|
486
|
+
...InvalidProps,
|
|
487
|
+
...OptionsProps,
|
|
488
|
+
...HintProps,
|
|
489
|
+
...DisabledProps,
|
|
490
|
+
...ReadonlyProps,
|
|
491
|
+
...ModifiersProps,
|
|
492
|
+
...LabelProps,
|
|
175
493
|
/**
|
|
176
494
|
* Input value
|
|
177
495
|
*/
|
|
178
|
-
modelValue: [String, Array],
|
|
179
|
-
/**
|
|
180
|
-
* Input label
|
|
181
|
-
*/
|
|
182
|
-
label: String,
|
|
496
|
+
modelValue: [String, Array, Boolean, Number, Symbol],
|
|
183
497
|
/**
|
|
184
498
|
* Input name
|
|
185
499
|
*/
|
|
186
|
-
name: { type: String, required:
|
|
500
|
+
name: { type: String, required: true },
|
|
187
501
|
/**
|
|
188
502
|
* If true, the group will be displayed in a vertical column
|
|
189
503
|
*/
|
|
190
504
|
vertical: Boolean
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
505
|
+
};
|
|
506
|
+
({
|
|
507
|
+
...DisabledProps,
|
|
508
|
+
...LabelProps,
|
|
509
|
+
...PressedProps,
|
|
510
|
+
...ActiveProps,
|
|
511
|
+
...LinkProps,
|
|
512
|
+
/**
|
|
513
|
+
* Button type
|
|
514
|
+
*/
|
|
515
|
+
type: {
|
|
516
|
+
type: String,
|
|
517
|
+
default: ButtonType.button,
|
|
518
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
function useInjectedGroupState(groupKey) {
|
|
522
|
+
const group = inject(groupKey, void 0);
|
|
523
|
+
const isInGroup = computed(() => !isEmpty(group));
|
|
524
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
525
|
+
if (group == null ? void 0 : group.value) {
|
|
526
|
+
const groupPropValue = unref(group.value)[propName];
|
|
527
|
+
return computed({
|
|
528
|
+
get() {
|
|
529
|
+
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
530
|
+
},
|
|
531
|
+
set(value) {
|
|
532
|
+
groupPropValue.value = value;
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
const propRef = toRef(props, propName);
|
|
537
|
+
return computed({
|
|
538
|
+
get() {
|
|
539
|
+
return propRef.value;
|
|
540
|
+
},
|
|
541
|
+
set(value) {
|
|
542
|
+
if (emit)
|
|
543
|
+
emit(`update:${propName}`, value);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
return {
|
|
548
|
+
group,
|
|
549
|
+
isInGroup,
|
|
550
|
+
getGroupOrLocalRef
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
const VvRadioProps = CheckboxRadioProps;
|
|
554
|
+
const VvRadioEvents = ["click", "update:modelValue", "change", "blur"];
|
|
555
|
+
function useGroupProps(props, emit) {
|
|
556
|
+
const { id } = toRefs(props);
|
|
557
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_RADIO_GROUP);
|
|
558
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
559
|
+
const valid = getGroupOrLocalRef("valid", props);
|
|
560
|
+
const invalid = getGroupOrLocalRef("invalid", props);
|
|
561
|
+
const readonly = computed(
|
|
562
|
+
() => {
|
|
563
|
+
var _a;
|
|
564
|
+
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
const disabled = computed(
|
|
568
|
+
() => {
|
|
569
|
+
var _a;
|
|
570
|
+
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
571
|
+
}
|
|
572
|
+
);
|
|
194
573
|
return {
|
|
195
574
|
// local props
|
|
196
|
-
id
|
|
575
|
+
id,
|
|
197
576
|
// global props
|
|
198
|
-
group
|
|
199
|
-
isInGroup
|
|
200
|
-
modelValue
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
577
|
+
group,
|
|
578
|
+
isInGroup,
|
|
579
|
+
modelValue,
|
|
580
|
+
valid,
|
|
581
|
+
invalid,
|
|
582
|
+
readonly,
|
|
583
|
+
disabled
|
|
205
584
|
};
|
|
206
585
|
}
|
|
207
|
-
const
|
|
586
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
587
|
+
function useModifiers(prefix, modifiers, others) {
|
|
588
|
+
return computed(() => {
|
|
589
|
+
const toReturn = {
|
|
590
|
+
[prefix]: true
|
|
591
|
+
};
|
|
592
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
593
|
+
if (modifiersArray) {
|
|
594
|
+
if (Array.isArray(modifiersArray)) {
|
|
595
|
+
modifiersArray.forEach((modifier) => {
|
|
596
|
+
if (modifier) {
|
|
597
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if (others) {
|
|
603
|
+
Object.keys(others.value).forEach((key) => {
|
|
604
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
return toReturn;
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
const _hoisted_1$1 = ["for"];
|
|
611
|
+
const _hoisted_2$1 = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"];
|
|
612
|
+
const __default__$1 = {
|
|
208
613
|
name: "VvRadio"
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
614
|
+
};
|
|
615
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
616
|
+
...__default__$1,
|
|
617
|
+
props: VvRadioProps,
|
|
618
|
+
emits: VvRadioEvents,
|
|
619
|
+
setup(__props, { emit }) {
|
|
620
|
+
const props = __props;
|
|
621
|
+
const slots = useSlots();
|
|
622
|
+
const { id, disabled, readonly, modelValue, valid, invalid } = useGroupProps(props, emit);
|
|
623
|
+
const hasId = useUniqueId(id);
|
|
624
|
+
const tabindex = computed(() => isDisabled.value ? -1 : props.tabindex);
|
|
625
|
+
const input = ref();
|
|
626
|
+
const isDisabled = computed(() => disabled.value || readonly.value);
|
|
627
|
+
const isInvalid = computed(() => {
|
|
628
|
+
if (invalid.value === true) {
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
if (valid.value === true) {
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
return void 0;
|
|
635
|
+
});
|
|
636
|
+
const isChecked = computed(
|
|
637
|
+
() => Array.isArray(modelValue.value) ? contains(props.value, modelValue.value) : equals(props.value, modelValue.value)
|
|
638
|
+
);
|
|
639
|
+
const hasValue = computed(
|
|
640
|
+
() => ["string", "number", "boolean"].includes(typeof props.value) ? props.value : true
|
|
641
|
+
);
|
|
642
|
+
const localModelValue = computed({
|
|
224
643
|
get() {
|
|
225
|
-
return
|
|
644
|
+
return isChecked.value ? hasValue.value : null;
|
|
226
645
|
},
|
|
227
|
-
set(
|
|
228
|
-
Array.isArray(
|
|
646
|
+
set(newValue) {
|
|
647
|
+
if (Array.isArray(modelValue.value)) {
|
|
648
|
+
modelValue.value = [props.value];
|
|
649
|
+
} else {
|
|
650
|
+
modelValue.value = props.value;
|
|
651
|
+
}
|
|
652
|
+
emit("change", newValue);
|
|
229
653
|
}
|
|
230
|
-
})
|
|
654
|
+
});
|
|
655
|
+
const { modifiers } = toRefs(props);
|
|
656
|
+
const bemCssClasses = useModifiers(
|
|
231
657
|
"vv-radio",
|
|
232
|
-
|
|
658
|
+
modifiers,
|
|
233
659
|
computed(() => ({
|
|
234
|
-
valid:
|
|
235
|
-
invalid:
|
|
236
|
-
disabled:
|
|
237
|
-
readonly:
|
|
660
|
+
valid: valid.value,
|
|
661
|
+
invalid: invalid.value,
|
|
662
|
+
disabled: disabled.value,
|
|
663
|
+
readonly: readonly.value
|
|
238
664
|
}))
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
665
|
+
);
|
|
666
|
+
const { HintSlot } = HintSlotFactory(props, slots);
|
|
667
|
+
return (_ctx, _cache) => {
|
|
668
|
+
return openBlock(), createElementBlock("label", {
|
|
669
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
670
|
+
for: unref(hasId)
|
|
671
|
+
}, [
|
|
672
|
+
withDirectives(createElementVNode("input", {
|
|
673
|
+
id: unref(hasId),
|
|
674
|
+
ref_key: "input",
|
|
675
|
+
ref: input,
|
|
676
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null),
|
|
677
|
+
type: "radio",
|
|
678
|
+
class: "vv-radio__input",
|
|
679
|
+
name: _ctx.name,
|
|
680
|
+
disabled: unref(isDisabled),
|
|
681
|
+
value: unref(hasValue),
|
|
682
|
+
tabindex: unref(tabindex),
|
|
683
|
+
"aria-invalid": unref(isInvalid)
|
|
684
|
+
}, null, 8, _hoisted_2$1), [
|
|
685
|
+
[vModelRadio, unref(localModelValue)]
|
|
686
|
+
]),
|
|
687
|
+
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
688
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
689
|
+
]),
|
|
690
|
+
createVNode(unref(HintSlot), {
|
|
691
|
+
class: "vv-radio__hint",
|
|
692
|
+
params: { value: unref(modelValue) }
|
|
693
|
+
}, null, 8, ["params"])
|
|
694
|
+
], 10, _hoisted_1$1);
|
|
695
|
+
};
|
|
267
696
|
}
|
|
268
|
-
})
|
|
697
|
+
});
|
|
698
|
+
const VvRadioGroupProps = CheckboxRadioGroupProps;
|
|
699
|
+
const VvRadioGroupEvents = ["update:modelValue", "change"];
|
|
700
|
+
function useProvideGroupState(groupState) {
|
|
701
|
+
if (Object.keys(groupState).some(
|
|
702
|
+
(k) => k !== "key" && !isRef(groupState[k])
|
|
703
|
+
))
|
|
704
|
+
throw Error("One or more groupState props aren't ref.");
|
|
705
|
+
provide(
|
|
706
|
+
groupState.key,
|
|
707
|
+
computed(() => groupState)
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
function useOptions(props) {
|
|
711
|
+
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
712
|
+
const getOptionLabel = (option) => {
|
|
713
|
+
if (typeof option !== "object" && option !== null)
|
|
714
|
+
return option;
|
|
715
|
+
return typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value];
|
|
716
|
+
};
|
|
717
|
+
const getOptionValue = (option) => {
|
|
718
|
+
if (typeof option !== "object" && option !== null)
|
|
719
|
+
return option;
|
|
720
|
+
return typeof valueKey.value === "function" ? valueKey.value(option) : option[valueKey.value];
|
|
721
|
+
};
|
|
722
|
+
const getOptionDisabled = (option) => {
|
|
723
|
+
if (typeof option !== "object" && option !== null)
|
|
724
|
+
return false;
|
|
725
|
+
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
726
|
+
};
|
|
727
|
+
return {
|
|
728
|
+
options,
|
|
729
|
+
getOptionLabel,
|
|
730
|
+
getOptionValue,
|
|
731
|
+
getOptionDisabled
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
const _hoisted_1 = ["textContent"];
|
|
735
|
+
const _hoisted_2 = { class: "vv-radio-group__wrapper" };
|
|
736
|
+
const __default__ = {
|
|
269
737
|
name: "VvRadioGroup"
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
738
|
+
};
|
|
739
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
740
|
+
...__default__,
|
|
741
|
+
props: VvRadioGroupProps,
|
|
742
|
+
emits: VvRadioGroupEvents,
|
|
743
|
+
setup(__props, { emit }) {
|
|
744
|
+
const props = __props;
|
|
745
|
+
const slots = useSlots();
|
|
746
|
+
const modelValue = useVModel(props, "modelValue", emit);
|
|
747
|
+
const { disabled, readonly, vertical, valid, invalid, modifiers } = toRefs(props);
|
|
276
748
|
useProvideGroupState({
|
|
277
|
-
key:
|
|
278
|
-
modelValue
|
|
279
|
-
disabled
|
|
280
|
-
readonly
|
|
281
|
-
valid
|
|
282
|
-
invalid
|
|
749
|
+
key: INJECTION_KEY_RADIO_GROUP,
|
|
750
|
+
modelValue,
|
|
751
|
+
disabled,
|
|
752
|
+
readonly,
|
|
753
|
+
valid,
|
|
754
|
+
invalid
|
|
283
755
|
});
|
|
284
|
-
const { getOptionLabel
|
|
756
|
+
const { getOptionLabel, getOptionValue } = useOptions(props);
|
|
757
|
+
const bemCssClasses = useModifiers(
|
|
285
758
|
"vv-radio-group",
|
|
286
|
-
|
|
759
|
+
modifiers,
|
|
287
760
|
computed(() => ({
|
|
288
|
-
disabled:
|
|
289
|
-
readonly:
|
|
290
|
-
horizontal: !
|
|
291
|
-
valid:
|
|
292
|
-
invalid:
|
|
761
|
+
disabled: disabled.value,
|
|
762
|
+
readonly: readonly.value,
|
|
763
|
+
horizontal: !vertical.value,
|
|
764
|
+
valid: valid.value,
|
|
765
|
+
invalid: invalid.value
|
|
293
766
|
}))
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
767
|
+
);
|
|
768
|
+
const getOptionProps = (option, index) => {
|
|
769
|
+
return {
|
|
770
|
+
id: `${props.name}_opt${index}`,
|
|
771
|
+
name: props.name,
|
|
772
|
+
label: getOptionLabel(option),
|
|
773
|
+
value: getOptionValue(option)
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
const { HintSlot } = HintSlotFactory(props, slots);
|
|
777
|
+
return (_ctx, _cache) => {
|
|
778
|
+
return openBlock(), createElementBlock("fieldset", {
|
|
779
|
+
class: normalizeClass(unref(bemCssClasses))
|
|
780
|
+
}, [
|
|
781
|
+
_ctx.label ? (openBlock(), createElementBlock("legend", {
|
|
782
|
+
key: 0,
|
|
783
|
+
textContent: toDisplayString(_ctx.label)
|
|
784
|
+
}, null, 8, _hoisted_1)) : createCommentVNode("", true),
|
|
785
|
+
createElementVNode("div", _hoisted_2, [
|
|
786
|
+
_ctx.options.length > 0 ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.options, (option, index) => {
|
|
787
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({ key: index }, getOptionProps(option, index)), null, 16);
|
|
788
|
+
}), 128)) : renderSlot(_ctx.$slots, "default", { key: 1 })
|
|
789
|
+
]),
|
|
790
|
+
createVNode(unref(HintSlot), { class: "vv-radio-group__hint" })
|
|
791
|
+
], 2);
|
|
792
|
+
};
|
|
312
793
|
}
|
|
313
794
|
});
|
|
314
795
|
export {
|
|
315
|
-
|
|
796
|
+
_sfc_main as default
|
|
316
797
|
};
|