@volverjs/ui-vue 0.0.4 → 0.0.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/auto-imports.d.ts +12 -3
- package/bin/icons.cjs +1 -73
- package/dist/Volver.d.ts +19 -11
- package/dist/components/VvAccordion/VvAccordion.es.js +165 -106
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +4 -1
- package/dist/components/VvAccordion/index.d.ts +8 -3
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +264 -164
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +15 -12
- package/dist/components/VvAccordionGroup/index.d.ts +8 -0
- package/dist/components/VvAction/VvAction.es.js +276 -98
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAction/VvAction.vue.d.ts +12 -12
- package/dist/components/VvAction/index.d.ts +2 -2
- package/dist/components/VvBadge/VvBadge.es.js +213 -44
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
- package/dist/components/VvBadge/index.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +247 -75
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +11 -11
- package/dist/components/VvBreadcrumb/index.d.ts +1 -1
- package/dist/components/VvButton/VvButton.es.js +646 -360
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +18 -18
- package/dist/components/VvButton/index.d.ts +13 -13
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +261 -79
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +2 -2
- package/dist/components/VvButtonGroup/index.d.ts +1 -1
- package/dist/components/VvCard/VvCard.es.js +57 -38
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +562 -274
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +2 -2
- package/dist/components/VvCheckbox/index.d.ts +5 -5
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +661 -340
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +7 -7
- package/dist/components/VvCheckboxGroup/index.d.ts +3 -3
- package/dist/components/VvCombobox/VvCombobox.es.js +1546 -983
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +138 -51
- package/dist/components/VvCombobox/index.d.ts +41 -10
- package/dist/components/VvDialog/VvDialog.es.js +387 -141
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDialog/VvDialog.vue.d.ts +12 -3
- package/dist/components/VvDialog/index.d.ts +4 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +452 -244
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +130 -42
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +13 -13
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
- package/dist/components/VvDropdown/index.d.ts +40 -11
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +373 -160
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.es.js +43 -28
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +285 -90
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +113 -65
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +7 -7
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputPasswordAction.d.ts +2 -2
- package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +986 -462
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +100 -20
- package/dist/components/VvInputText/VvInputTextActions.d.ts +1 -1
- package/dist/components/VvInputText/index.d.ts +66 -13
- package/dist/components/VvProgress/VvProgress.es.js +216 -45
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
- package/dist/components/VvProgress/index.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +499 -238
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +2 -2
- package/dist/components/VvRadio/index.d.ts +5 -5
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +598 -304
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +7 -7
- package/dist/components/VvRadioGroup/index.d.ts +3 -3
- package/dist/components/VvSelect/VvSelect.es.js +631 -324
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +13 -13
- package/dist/components/VvSelect/index.d.ts +3 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +676 -355
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +20 -20
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/VvTooltip/VvTooltip.es.js +215 -47
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +7 -7
- package/dist/components/VvTooltip/index.d.ts +2 -2
- package/dist/components/index.es.js +3522 -2231
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/dropdown/useInjectDropdown.d.ts +1 -1
- package/dist/composables/dropdown/useProvideDropdown.d.ts +3 -3
- package/dist/composables/group/useInjectedGroupState.d.ts +2 -2
- package/dist/composables/group/useProvideGroupState.d.ts +1 -1
- package/dist/composables/useComponentFocus.d.ts +1 -1
- package/dist/composables/useComponentIcon.d.ts +7 -7
- package/dist/composables/useDebouncedInput.d.ts +4 -1
- package/dist/composables/useDefaults.d.ts +2 -0
- package/dist/composables/useModifiers.d.ts +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/composables/useTextCount.d.ts +3 -3
- package/dist/composables/useUniqueId.d.ts +1 -1
- package/dist/composables/useVolver.d.ts +1 -1
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +264 -55
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +222 -53
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +40 -23
- package/dist/icons.umd.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.es.js +112 -3607
- package/dist/index.umd.js +1 -1
- package/dist/props/index.d.ts +50 -18
- package/dist/resolvers/unplugin.d.ts +7 -1
- package/dist/resolvers/unplugin.es.js +77 -37
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/InputText/InputText.settings.d.ts +53 -0
- package/dist/stories/argTypes.d.ts +13 -1
- package/package.json +126 -40
- package/src/Volver.ts +49 -22
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvAccordion/VvAccordion.vue +19 -22
- package/src/components/VvAccordion/index.ts +12 -4
- package/src/components/VvAccordionGroup/VvAccordionGroup.vue +19 -10
- package/src/components/VvAccordionGroup/index.ts +8 -0
- package/src/components/VvAction/VvAction.vue +7 -7
- package/src/components/VvAction/index.ts +1 -1
- package/src/components/VvBadge/VvBadge.vue +2 -2
- package/src/components/VvBadge/index.ts +1 -1
- package/src/components/VvBreadcrumb/VvBreadcrumb.vue +3 -3
- package/src/components/VvButton/VvButton.vue +11 -11
- package/src/components/VvButton/index.ts +10 -9
- package/src/components/VvButtonGroup/VvButtonGroup.vue +4 -7
- package/src/components/VvButtonGroup/index.ts +1 -1
- package/src/components/VvCard/VvCard.vue +2 -2
- package/src/components/VvCheckbox/VvCheckbox.vue +3 -7
- package/src/components/VvCheckbox/index.ts +11 -7
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +7 -10
- package/src/components/VvCheckboxGroup/index.ts +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +44 -26
- package/src/components/VvCombobox/index.ts +1 -1
- package/src/components/VvDialog/VvDialog.vue +28 -11
- package/src/components/VvDialog/index.ts +5 -2
- package/src/components/VvDropdown/VvDropdown.vue +7 -5
- package/src/components/VvDropdown/VvDropdownAction.vue +7 -5
- package/src/components/VvDropdown/VvDropdownOption.vue +17 -10
- package/src/components/VvDropdown/index.ts +3 -3
- package/src/components/VvIcon/VvIcon.vue +3 -3
- package/src/components/VvIcon/index.ts +3 -3
- package/src/components/VvInputText/VvInputClearAction.ts +2 -2
- package/src/components/VvInputText/VvInputPasswordAction.ts +3 -4
- package/src/components/VvInputText/VvInputStepAction.ts +3 -2
- package/src/components/VvInputText/VvInputText.vue +130 -37
- package/src/components/VvInputText/VvInputTextActions.ts +5 -8
- package/src/components/VvInputText/index.ts +62 -1
- package/src/components/VvProgress/VvProgress.vue +2 -2
- package/src/components/VvProgress/index.ts +1 -1
- package/src/components/VvRadio/VvRadio.vue +3 -7
- package/src/components/VvRadio/index.ts +11 -7
- package/src/components/VvRadioGroup/VvRadioGroup.vue +7 -10
- package/src/components/VvRadioGroup/index.ts +1 -1
- package/src/components/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvSelect/index.ts +1 -1
- package/src/components/VvTextarea/VvTextarea.vue +6 -6
- package/src/components/VvTextarea/index.ts +1 -1
- package/src/components/VvTooltip/VvTooltip.vue +2 -2
- package/src/components/VvTooltip/index.ts +3 -3
- package/src/composables/dropdown/useInjectDropdown.ts +2 -2
- package/src/composables/dropdown/useProvideDropdown.ts +2 -2
- package/src/composables/group/useInjectedGroupState.ts +1 -1
- package/src/composables/group/useProvideGroupState.ts +1 -1
- package/src/composables/useComponentIcon.ts +1 -1
- package/src/composables/useDebouncedInput.ts +10 -3
- package/src/composables/useDefaults.ts +89 -0
- package/src/composables/useModifiers.ts +4 -2
- package/src/composables/useOptions.ts +1 -1
- package/src/composables/useVolver.ts +2 -2
- package/src/directives/index.ts +3 -1
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/directives/v-tooltip.ts +2 -2
- package/src/icons.ts +1 -1
- package/src/index.ts +0 -2
- package/src/props/index.ts +20 -10
- package/src/resolvers/unplugin.ts +15 -1
- package/src/stories/Accordion/Accordion.stories.mdx +8 -2
- package/src/stories/Accordion/Accordion.test.ts +21 -15
- package/src/stories/Accordion/AccordionSlots.stories.mdx +8 -8
- package/src/stories/AccordionGroup/AccordionGroup.stories.mdx +17 -1
- package/src/stories/AccordionGroup/AccordionGroup.test.ts +18 -12
- package/src/stories/AccordionGroup/AccordionGroupSlots.stories.mdx +1 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/InputText/InputText.settings.ts +53 -0
- package/src/stories/InputText/InputText.stories.mdx +40 -0
- package/src/stories/InputText/InputText.test.ts +5 -2
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +12 -2
- package/src/types/group.d.ts +5 -0
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
import { unref
|
|
2
|
-
import { toReactive
|
|
3
|
-
import { nanoid
|
|
4
|
-
var
|
|
5
|
-
|
|
1
|
+
import { unref, inject, computed, toRef, toRefs, h, defineComponent, useSlots, ref, watchEffect, watch, onMounted, openBlock, createElementBlock, normalizeClass, withDirectives, createElementVNode, isRef, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createVNode } from "vue";
|
|
2
|
+
import { toReactive } 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_CHECK_GROUP = Symbol.for("checkGroup");
|
|
41
|
+
const LinkProps = {
|
|
6
42
|
/**
|
|
7
43
|
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
8
44
|
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
@@ -19,7 +55,7 @@ const de = Symbol.for("checkGroup"), pe = {
|
|
|
19
55
|
*/
|
|
20
56
|
target: {
|
|
21
57
|
type: String,
|
|
22
|
-
validator: (
|
|
58
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
23
59
|
},
|
|
24
60
|
/**
|
|
25
61
|
* Anchor rel
|
|
@@ -28,7 +64,8 @@ const de = Symbol.for("checkGroup"), pe = {
|
|
|
28
64
|
type: String,
|
|
29
65
|
default: "noopener noreferrer"
|
|
30
66
|
}
|
|
31
|
-
}
|
|
67
|
+
};
|
|
68
|
+
const ValidProps = {
|
|
32
69
|
/**
|
|
33
70
|
* Valid status
|
|
34
71
|
*/
|
|
@@ -37,7 +74,8 @@ const de = Symbol.for("checkGroup"), pe = {
|
|
|
37
74
|
* Valid label
|
|
38
75
|
*/
|
|
39
76
|
validLabel: [String, Array]
|
|
40
|
-
}
|
|
77
|
+
};
|
|
78
|
+
const InvalidProps = {
|
|
41
79
|
/**
|
|
42
80
|
* Invalid status
|
|
43
81
|
*/
|
|
@@ -46,72 +84,190 @@ const de = Symbol.for("checkGroup"), pe = {
|
|
|
46
84
|
* Invalid label
|
|
47
85
|
*/
|
|
48
86
|
invalidLabel: [String, Array]
|
|
49
|
-
}
|
|
87
|
+
};
|
|
88
|
+
const DisabledProps = {
|
|
50
89
|
/**
|
|
51
90
|
* Whether the form control is disabled
|
|
52
91
|
*/
|
|
53
92
|
disabled: Boolean
|
|
54
|
-
}
|
|
93
|
+
};
|
|
94
|
+
const ActiveProps = {
|
|
55
95
|
/**
|
|
56
96
|
* Whether the item is active
|
|
57
97
|
*/
|
|
58
98
|
active: Boolean
|
|
59
|
-
}
|
|
99
|
+
};
|
|
100
|
+
const PressedProps = {
|
|
60
101
|
/**
|
|
61
102
|
* Whether the item is pressed
|
|
62
103
|
*/
|
|
63
104
|
pressed: Boolean
|
|
64
|
-
}
|
|
105
|
+
};
|
|
106
|
+
const LabelProps = {
|
|
65
107
|
/**
|
|
66
108
|
* The item label
|
|
67
109
|
*/
|
|
68
110
|
label: [String, Number]
|
|
69
|
-
}
|
|
111
|
+
};
|
|
112
|
+
const ReadonlyProps = {
|
|
70
113
|
/**
|
|
71
114
|
* The value is not editable
|
|
72
115
|
*/
|
|
73
116
|
readonly: Boolean
|
|
74
|
-
}
|
|
117
|
+
};
|
|
118
|
+
const ModifiersProps = {
|
|
75
119
|
/**
|
|
76
120
|
* Component BEM modifiers
|
|
77
121
|
*/
|
|
78
122
|
modifiers: [String, Array]
|
|
79
|
-
}
|
|
123
|
+
};
|
|
124
|
+
const HintProps = {
|
|
80
125
|
hintLabel: { type: String, default: "" }
|
|
81
126
|
};
|
|
82
|
-
|
|
83
|
-
|
|
127
|
+
({
|
|
128
|
+
/**
|
|
129
|
+
* VvIcon name or props
|
|
130
|
+
* @see VVIcon
|
|
131
|
+
*/
|
|
132
|
+
icon: { type: [String, Object] },
|
|
133
|
+
/**
|
|
134
|
+
* VvIcon position
|
|
135
|
+
*/
|
|
136
|
+
iconPosition: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: Position.before,
|
|
139
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const TabindexProps = {
|
|
84
143
|
/**
|
|
85
144
|
* Global attribute tabindex
|
|
86
145
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
|
|
87
146
|
*/
|
|
88
147
|
tabindex: { type: [String, Number], default: 0 }
|
|
89
|
-
}
|
|
148
|
+
};
|
|
149
|
+
const IdProps = {
|
|
90
150
|
/**
|
|
91
151
|
* Global attribute id
|
|
92
152
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
93
153
|
*/
|
|
94
154
|
id: [String, Number]
|
|
95
155
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
156
|
+
({
|
|
157
|
+
/**
|
|
158
|
+
* Dropdown placement
|
|
159
|
+
*/
|
|
160
|
+
placement: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: Side.bottom,
|
|
163
|
+
validator: (value) => {
|
|
164
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Dropdown strategy
|
|
169
|
+
*/
|
|
170
|
+
strategy: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: "absolute",
|
|
173
|
+
validator: (value) => {
|
|
174
|
+
return ["fixed", "absolute"].includes(value);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* Dropdown show / hide transition name
|
|
179
|
+
*/
|
|
180
|
+
transitionName: {
|
|
181
|
+
type: String
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* Offset of the dropdown from the trigger
|
|
185
|
+
* @see https://floating-ui.com/docs/offset
|
|
186
|
+
*/
|
|
187
|
+
offset: {
|
|
188
|
+
type: [Number, String, Object],
|
|
189
|
+
default: 0
|
|
190
|
+
},
|
|
191
|
+
/**
|
|
192
|
+
* Move dropdown to the side if there is no space in the default position
|
|
193
|
+
* @see https://floating-ui.com/docs/shift
|
|
194
|
+
*/
|
|
195
|
+
shift: {
|
|
196
|
+
type: [Boolean, Object],
|
|
197
|
+
default: false
|
|
198
|
+
},
|
|
199
|
+
/**
|
|
200
|
+
* Flip dropdown position if there is no space in the default position
|
|
201
|
+
* @see https://floating-ui.com/docs/flip
|
|
202
|
+
*/
|
|
203
|
+
flip: {
|
|
204
|
+
type: [Boolean, Object],
|
|
205
|
+
default: true
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Size of the dropdown
|
|
209
|
+
* @see https://floating-ui.com/docs/size
|
|
210
|
+
*/
|
|
211
|
+
size: {
|
|
212
|
+
type: [Boolean, Object],
|
|
213
|
+
default: () => ({ padding: 10 })
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
* Automatically change the position of the dropdown
|
|
217
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
218
|
+
*/
|
|
219
|
+
autoPlacement: {
|
|
220
|
+
type: [Boolean, Object],
|
|
221
|
+
default: false
|
|
222
|
+
},
|
|
223
|
+
/**
|
|
224
|
+
* Add arrow to the dropdown
|
|
225
|
+
* @see https://floating-ui.com/docs/arrow
|
|
226
|
+
*/
|
|
227
|
+
arrow: {
|
|
228
|
+
type: Boolean,
|
|
229
|
+
default: false
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Close dropdown on click outside
|
|
233
|
+
*/
|
|
234
|
+
autoClose: {
|
|
235
|
+
type: Boolean,
|
|
236
|
+
default: true
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Autofocus first item on dropdown open
|
|
240
|
+
*/
|
|
241
|
+
autofocusFirst: {
|
|
242
|
+
type: Boolean,
|
|
243
|
+
default: true
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* Set dropdown width to the same as the trigger
|
|
247
|
+
*/
|
|
248
|
+
triggerWidth: {
|
|
249
|
+
type: Boolean
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const IdNameProps = {
|
|
253
|
+
...IdProps,
|
|
99
254
|
/**
|
|
100
255
|
* Input / Textarea name
|
|
101
256
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
102
257
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
103
258
|
*/
|
|
104
|
-
name: { type: String, required:
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
...
|
|
108
|
-
...
|
|
109
|
-
...
|
|
110
|
-
...
|
|
111
|
-
...
|
|
112
|
-
...
|
|
113
|
-
...
|
|
114
|
-
...
|
|
259
|
+
name: { type: String, required: true }
|
|
260
|
+
};
|
|
261
|
+
const CheckboxRadioProps = {
|
|
262
|
+
...IdNameProps,
|
|
263
|
+
...TabindexProps,
|
|
264
|
+
...ValidProps,
|
|
265
|
+
...InvalidProps,
|
|
266
|
+
...HintProps,
|
|
267
|
+
...DisabledProps,
|
|
268
|
+
...ReadonlyProps,
|
|
269
|
+
...ModifiersProps,
|
|
270
|
+
...LabelProps,
|
|
115
271
|
/**
|
|
116
272
|
* Input value
|
|
117
273
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
@@ -123,122 +279,140 @@ const je = {
|
|
|
123
279
|
modelValue: [Object, Number, Boolean, String]
|
|
124
280
|
};
|
|
125
281
|
({
|
|
126
|
-
...
|
|
127
|
-
...
|
|
128
|
-
...
|
|
129
|
-
...
|
|
130
|
-
...
|
|
282
|
+
...DisabledProps,
|
|
283
|
+
...LabelProps,
|
|
284
|
+
...PressedProps,
|
|
285
|
+
...ActiveProps,
|
|
286
|
+
...LinkProps,
|
|
131
287
|
/**
|
|
132
288
|
* Button type
|
|
133
289
|
*/
|
|
134
|
-
type:
|
|
290
|
+
type: {
|
|
291
|
+
type: String,
|
|
292
|
+
default: ButtonType.button,
|
|
293
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
294
|
+
}
|
|
135
295
|
});
|
|
136
|
-
function
|
|
137
|
-
|
|
296
|
+
function equals(obj1, obj2, field) {
|
|
297
|
+
if (field)
|
|
298
|
+
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
299
|
+
else
|
|
300
|
+
return deepEquals(obj1, obj2);
|
|
138
301
|
}
|
|
139
|
-
function
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
142
|
-
if (
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
302
|
+
function deepEquals(a, b) {
|
|
303
|
+
if (a === b)
|
|
304
|
+
return true;
|
|
305
|
+
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
306
|
+
const arrA = Array.isArray(a);
|
|
307
|
+
const arrB = Array.isArray(b);
|
|
308
|
+
let i, length, key;
|
|
309
|
+
if (arrA && arrB) {
|
|
310
|
+
length = a.length;
|
|
311
|
+
if (length != b.length)
|
|
312
|
+
return false;
|
|
313
|
+
for (i = length; i-- !== 0; )
|
|
314
|
+
if (!deepEquals(a[i], b[i]))
|
|
315
|
+
return false;
|
|
316
|
+
return true;
|
|
152
317
|
}
|
|
153
|
-
if (
|
|
154
|
-
return
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
158
|
-
if (
|
|
159
|
-
return
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
return
|
|
163
|
-
if (
|
|
164
|
-
return
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
318
|
+
if (arrA != arrB)
|
|
319
|
+
return false;
|
|
320
|
+
const dateA = a instanceof Date, dateB = b instanceof Date;
|
|
321
|
+
if (dateA != dateB)
|
|
322
|
+
return false;
|
|
323
|
+
if (dateA && dateB)
|
|
324
|
+
return a.getTime() == b.getTime();
|
|
325
|
+
const regexpA = a instanceof RegExp, regexpB = b instanceof RegExp;
|
|
326
|
+
if (regexpA != regexpB)
|
|
327
|
+
return false;
|
|
328
|
+
if (regexpA && regexpB)
|
|
329
|
+
return a.toString() == b.toString();
|
|
330
|
+
const keys = Object.keys(a);
|
|
331
|
+
length = keys.length;
|
|
332
|
+
if (length !== Object.keys(b).length)
|
|
333
|
+
return false;
|
|
334
|
+
for (i = length; i-- !== 0; )
|
|
335
|
+
if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
|
|
336
|
+
return false;
|
|
337
|
+
for (i = length; i-- !== 0; ) {
|
|
338
|
+
key = keys[i];
|
|
339
|
+
if (!deepEquals(a[key], b[key]))
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
return true;
|
|
175
343
|
}
|
|
176
|
-
return
|
|
344
|
+
return a !== a && b !== b;
|
|
177
345
|
}
|
|
178
|
-
function
|
|
179
|
-
if (
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
{
|
|
183
|
-
const
|
|
184
|
-
let
|
|
185
|
-
for (let
|
|
186
|
-
if (
|
|
346
|
+
function resolveFieldData(data, field) {
|
|
347
|
+
if (data && Object.keys(data).length && field) {
|
|
348
|
+
if (field.indexOf(".") === -1) {
|
|
349
|
+
return data[field];
|
|
350
|
+
} else {
|
|
351
|
+
const fields = field.split(".");
|
|
352
|
+
let value = data;
|
|
353
|
+
for (let i = 0, len = fields.length; i < len; ++i) {
|
|
354
|
+
if (data == null) {
|
|
187
355
|
return null;
|
|
188
|
-
|
|
356
|
+
}
|
|
357
|
+
value = value[fields[i]];
|
|
189
358
|
}
|
|
190
|
-
return
|
|
359
|
+
return value;
|
|
191
360
|
}
|
|
192
|
-
} else
|
|
361
|
+
} else {
|
|
193
362
|
return null;
|
|
363
|
+
}
|
|
194
364
|
}
|
|
195
|
-
function
|
|
196
|
-
if (
|
|
197
|
-
for (const
|
|
198
|
-
if (
|
|
199
|
-
return
|
|
365
|
+
function contains(value, list) {
|
|
366
|
+
if (value != null && list && list.length) {
|
|
367
|
+
for (const val of list) {
|
|
368
|
+
if (equals(value, val)) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
200
372
|
}
|
|
201
|
-
return
|
|
373
|
+
return false;
|
|
202
374
|
}
|
|
203
|
-
function
|
|
204
|
-
return ((
|
|
375
|
+
function isEmpty(value) {
|
|
376
|
+
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));
|
|
205
377
|
}
|
|
206
|
-
function
|
|
207
|
-
return typeof
|
|
378
|
+
function isString(value) {
|
|
379
|
+
return typeof value === "string" || value instanceof String;
|
|
208
380
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
381
|
+
function useInjectedGroupState(groupKey) {
|
|
382
|
+
const group = inject(groupKey, void 0);
|
|
383
|
+
const isInGroup = computed(() => !isEmpty(group));
|
|
384
|
+
function getGroupOrLocalRef(propName, props, emit) {
|
|
385
|
+
if (group == null ? void 0 : group.value) {
|
|
386
|
+
const groupPropValue = unref(group.value)[propName];
|
|
387
|
+
return computed({
|
|
215
388
|
get() {
|
|
216
|
-
return
|
|
389
|
+
return groupPropValue == null ? void 0 : groupPropValue.value;
|
|
217
390
|
},
|
|
218
|
-
set(
|
|
219
|
-
|
|
391
|
+
set(value) {
|
|
392
|
+
groupPropValue.value = value;
|
|
220
393
|
}
|
|
221
394
|
});
|
|
222
395
|
}
|
|
223
|
-
const
|
|
224
|
-
return
|
|
396
|
+
const propRef = toRef(props, propName);
|
|
397
|
+
return computed({
|
|
225
398
|
get() {
|
|
226
|
-
return
|
|
399
|
+
return propRef.value;
|
|
227
400
|
},
|
|
228
|
-
set(
|
|
229
|
-
|
|
401
|
+
set(value) {
|
|
402
|
+
if (emit)
|
|
403
|
+
emit(`update:${propName}`, value);
|
|
230
404
|
}
|
|
231
405
|
});
|
|
232
406
|
}
|
|
233
407
|
return {
|
|
234
|
-
group
|
|
235
|
-
isInGroup
|
|
236
|
-
getGroupOrLocalRef
|
|
408
|
+
group,
|
|
409
|
+
isInGroup,
|
|
410
|
+
getGroupOrLocalRef
|
|
237
411
|
};
|
|
238
412
|
}
|
|
239
|
-
const
|
|
240
|
-
...
|
|
241
|
-
...
|
|
413
|
+
const VvCheckboxProps = {
|
|
414
|
+
...CheckboxRadioProps,
|
|
415
|
+
...ModifiersProps,
|
|
242
416
|
/**
|
|
243
417
|
* If true, the input will be indeterminated
|
|
244
418
|
*/
|
|
@@ -251,55 +425,97 @@ const xe = {
|
|
|
251
425
|
* If true, the input will be displayed as a switch
|
|
252
426
|
*/
|
|
253
427
|
switch: Boolean
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
428
|
+
};
|
|
429
|
+
const VvCheckboxEvents = ["click", "update:modelValue", "change", "blur"];
|
|
430
|
+
function useGroupProps(props, emit) {
|
|
431
|
+
const { group, isInGroup, getGroupOrLocalRef } = useInjectedGroupState(INJECTION_KEY_CHECK_GROUP);
|
|
432
|
+
const { id, switch: propsSwitch, indeterminate } = toRefs(props);
|
|
433
|
+
const modelValue = getGroupOrLocalRef("modelValue", props, emit);
|
|
434
|
+
const valid = getGroupOrLocalRef("valid", props);
|
|
435
|
+
const invalid = getGroupOrLocalRef("invalid", props);
|
|
436
|
+
const readonly = computed(
|
|
437
|
+
() => {
|
|
438
|
+
var _a;
|
|
439
|
+
return Boolean(props.readonly || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
const disabled = computed(
|
|
443
|
+
() => {
|
|
444
|
+
var _a;
|
|
445
|
+
return Boolean(props.disabled || ((_a = group == null ? void 0 : group.value) == null ? void 0 : _a.disabled.value));
|
|
446
|
+
}
|
|
447
|
+
);
|
|
257
448
|
return {
|
|
258
449
|
// local props
|
|
259
|
-
id
|
|
260
|
-
propsSwitch
|
|
261
|
-
indeterminate
|
|
450
|
+
id,
|
|
451
|
+
propsSwitch,
|
|
452
|
+
indeterminate,
|
|
262
453
|
// global props
|
|
263
|
-
group
|
|
264
|
-
isInGroup
|
|
265
|
-
modelValue
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
454
|
+
group,
|
|
455
|
+
isInGroup,
|
|
456
|
+
modelValue,
|
|
457
|
+
valid,
|
|
458
|
+
invalid,
|
|
459
|
+
readonly,
|
|
460
|
+
disabled
|
|
270
461
|
};
|
|
271
462
|
}
|
|
272
|
-
function
|
|
273
|
-
|
|
463
|
+
function joinLines(errors) {
|
|
464
|
+
if (Array.isArray(errors)) {
|
|
465
|
+
return errors.filter((e) => isString(e)).join(" ");
|
|
466
|
+
}
|
|
467
|
+
return errors;
|
|
274
468
|
}
|
|
275
|
-
function
|
|
469
|
+
function HintSlotFactory(parentProps, parentSlots) {
|
|
470
|
+
const {
|
|
471
|
+
invalid: invalidSlot,
|
|
472
|
+
valid: validSlot,
|
|
473
|
+
hint: hintSlot,
|
|
474
|
+
loading: loadingSlot
|
|
475
|
+
} = parentSlots;
|
|
276
476
|
const {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
477
|
+
hintLabel,
|
|
478
|
+
modelValue,
|
|
479
|
+
valid,
|
|
480
|
+
validLabel,
|
|
481
|
+
invalid,
|
|
482
|
+
invalidLabel,
|
|
483
|
+
...otherProps
|
|
484
|
+
} = toRefs(parentProps);
|
|
485
|
+
const loading = resolveFieldData(otherProps, "loading");
|
|
486
|
+
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
487
|
+
const hasInvalid = computed(() => {
|
|
488
|
+
if (!invalid.value) {
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
491
|
+
if (invalid.value && invalidSlot) {
|
|
492
|
+
return true;
|
|
493
|
+
}
|
|
494
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
return false;
|
|
501
|
+
});
|
|
502
|
+
const hasHint = computed(
|
|
503
|
+
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
504
|
+
);
|
|
505
|
+
const hasValid = computed(
|
|
506
|
+
() => !!(validLabel && validLabel.value || validSlot)
|
|
507
|
+
);
|
|
508
|
+
const hasLoading = computed(
|
|
509
|
+
() => !!((loading == null ? void 0 : loading.value) && loadingSlot || (loading == null ? void 0 : loading.value) && (loadingLabel == null ? void 0 : loadingLabel.value))
|
|
510
|
+
);
|
|
511
|
+
const isVisible = computed(
|
|
512
|
+
() => hasHint.value || hasValid.value || hasInvalid.value || hasLoading.value
|
|
297
513
|
);
|
|
298
514
|
return {
|
|
299
|
-
hasInvalid
|
|
300
|
-
hasHint
|
|
301
|
-
hasValid
|
|
302
|
-
hasLoading
|
|
515
|
+
hasInvalid,
|
|
516
|
+
hasHint,
|
|
517
|
+
hasValid,
|
|
518
|
+
hasLoading,
|
|
303
519
|
HintSlot: {
|
|
304
520
|
name: "HintSlot",
|
|
305
521
|
props: {
|
|
@@ -308,151 +524,223 @@ function Ie(e, t) {
|
|
|
308
524
|
default: () => ({})
|
|
309
525
|
}
|
|
310
526
|
},
|
|
311
|
-
setup(
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
hintLabel
|
|
315
|
-
modelValue
|
|
316
|
-
valid
|
|
317
|
-
validLabel
|
|
318
|
-
invalid
|
|
319
|
-
invalidLabel
|
|
320
|
-
loading
|
|
321
|
-
loadingLabel
|
|
322
|
-
...
|
|
527
|
+
setup(props) {
|
|
528
|
+
const hintContent = computed(() => {
|
|
529
|
+
const slotProps = toReactive({
|
|
530
|
+
hintLabel,
|
|
531
|
+
modelValue,
|
|
532
|
+
valid,
|
|
533
|
+
validLabel,
|
|
534
|
+
invalid,
|
|
535
|
+
invalidLabel,
|
|
536
|
+
loading,
|
|
537
|
+
loadingLabel,
|
|
538
|
+
...props.params
|
|
323
539
|
});
|
|
324
|
-
|
|
540
|
+
if (invalid == null ? void 0 : invalid.value) {
|
|
541
|
+
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
542
|
+
}
|
|
543
|
+
if (valid == null ? void 0 : valid.value)
|
|
544
|
+
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
545
|
+
if (loading == null ? void 0 : loading.value)
|
|
546
|
+
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
547
|
+
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
325
548
|
});
|
|
326
549
|
return {
|
|
327
|
-
isVisible
|
|
328
|
-
hasInvalid
|
|
329
|
-
hasValid
|
|
330
|
-
hintContent
|
|
550
|
+
isVisible,
|
|
551
|
+
hasInvalid,
|
|
552
|
+
hasValid,
|
|
553
|
+
hintContent
|
|
331
554
|
};
|
|
332
555
|
},
|
|
333
556
|
render() {
|
|
334
|
-
if (this.isVisible)
|
|
335
|
-
return
|
|
557
|
+
if (this.isVisible) {
|
|
558
|
+
return h(
|
|
336
559
|
"small",
|
|
337
560
|
{
|
|
338
561
|
role: this.hasInvalid ? "alert" : this.hasValid ? "status" : void 0
|
|
339
562
|
},
|
|
340
563
|
this.hintContent
|
|
341
564
|
);
|
|
565
|
+
}
|
|
342
566
|
}
|
|
343
567
|
}
|
|
344
568
|
};
|
|
345
569
|
}
|
|
346
|
-
const
|
|
347
|
-
function
|
|
348
|
-
return
|
|
349
|
-
const
|
|
350
|
-
[
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
570
|
+
const useUniqueId = (id) => computed(() => String((id == null ? void 0 : id.value) || nanoid()));
|
|
571
|
+
function useModifiers(prefix, modifiers, others) {
|
|
572
|
+
return computed(() => {
|
|
573
|
+
const toReturn = {
|
|
574
|
+
[prefix]: true
|
|
575
|
+
};
|
|
576
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
577
|
+
if (modifiersArray) {
|
|
578
|
+
if (Array.isArray(modifiersArray)) {
|
|
579
|
+
modifiersArray.forEach((modifier) => {
|
|
580
|
+
if (modifier) {
|
|
581
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (others) {
|
|
587
|
+
Object.keys(others.value).forEach((key) => {
|
|
588
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
return toReturn;
|
|
357
592
|
});
|
|
358
593
|
}
|
|
359
|
-
const
|
|
594
|
+
const _hoisted_1 = ["for"];
|
|
595
|
+
const _hoisted_2 = ["id", "name", "disabled", "value", "tabindex", "aria-invalid"];
|
|
596
|
+
const __default__ = {
|
|
360
597
|
name: "VvCheckbox"
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
598
|
+
};
|
|
599
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
600
|
+
...__default__,
|
|
601
|
+
props: VvCheckboxProps,
|
|
602
|
+
emits: VvCheckboxEvents,
|
|
603
|
+
setup(__props, { emit }) {
|
|
604
|
+
const props = __props;
|
|
605
|
+
const slots = useSlots();
|
|
606
|
+
const {
|
|
607
|
+
id,
|
|
608
|
+
disabled,
|
|
609
|
+
readonly,
|
|
610
|
+
valid,
|
|
611
|
+
invalid,
|
|
612
|
+
propsSwitch,
|
|
613
|
+
modelValue,
|
|
614
|
+
indeterminate,
|
|
615
|
+
isInGroup
|
|
616
|
+
} = useGroupProps(props, emit);
|
|
617
|
+
const hasId = useUniqueId(id);
|
|
618
|
+
const tabindex = computed(() => isDisabled.value ? -1 : props.tabindex);
|
|
619
|
+
const input = ref();
|
|
620
|
+
const isBinary = computed(
|
|
621
|
+
() => props.uncheckedValue !== void 0 && !isInGroup.value
|
|
622
|
+
);
|
|
623
|
+
const isDisabled = computed(() => disabled.value || readonly.value);
|
|
624
|
+
const isInvalid = computed(() => {
|
|
625
|
+
if (invalid.value === true) {
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
if (valid.value === true) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
return void 0;
|
|
632
|
+
});
|
|
633
|
+
const isChecked = computed(() => {
|
|
634
|
+
if (isBinary.value) {
|
|
635
|
+
return modelValue.value === props.value;
|
|
636
|
+
}
|
|
637
|
+
return Array.isArray(modelValue.value) ? contains(props.value, modelValue.value) : equals(props.value, modelValue.value);
|
|
638
|
+
});
|
|
639
|
+
const isIndeterminated = computed(() => {
|
|
640
|
+
if (indeterminate.value) {
|
|
641
|
+
return true;
|
|
642
|
+
}
|
|
643
|
+
if (!isChecked.value && isBinary.value && props.uncheckedValue !== modelValue.value) {
|
|
644
|
+
return true;
|
|
645
|
+
}
|
|
646
|
+
return false;
|
|
647
|
+
});
|
|
648
|
+
const hasValue = computed(() => {
|
|
649
|
+
if (isBinary.value) {
|
|
650
|
+
return void 0;
|
|
651
|
+
}
|
|
652
|
+
return ["string", "number", "boolean"].includes(typeof props.value) ? props.value : true;
|
|
653
|
+
});
|
|
654
|
+
const localModelValue = computed({
|
|
387
655
|
get() {
|
|
388
|
-
return
|
|
656
|
+
return isChecked.value;
|
|
389
657
|
},
|
|
390
|
-
set(
|
|
391
|
-
if (
|
|
392
|
-
|
|
393
|
-
else if (Array.isArray(
|
|
394
|
-
const
|
|
395
|
-
Array.isArray(
|
|
658
|
+
set(newValue) {
|
|
659
|
+
if (isBinary.value) {
|
|
660
|
+
modelValue.value = newValue ? props.value : props.uncheckedValue;
|
|
661
|
+
} else if (Array.isArray(modelValue.value) || isInGroup.value) {
|
|
662
|
+
const toReturn = new Set(
|
|
663
|
+
Array.isArray(modelValue.value) ? modelValue.value : modelValue.value !== void 0 ? [modelValue.value] : []
|
|
396
664
|
);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
665
|
+
if (newValue) {
|
|
666
|
+
toReturn.add(props.value);
|
|
667
|
+
} else {
|
|
668
|
+
toReturn.delete(props.value);
|
|
669
|
+
}
|
|
670
|
+
modelValue.value = [...toReturn];
|
|
671
|
+
} else {
|
|
672
|
+
modelValue.value = newValue ? props.value : void 0;
|
|
673
|
+
}
|
|
674
|
+
emit("change", newValue);
|
|
401
675
|
}
|
|
402
|
-
})
|
|
676
|
+
});
|
|
677
|
+
const { modifiers } = toRefs(props);
|
|
678
|
+
const bemCssClasses = useModifiers(
|
|
403
679
|
"vv-checkbox",
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
switch:
|
|
407
|
-
valid:
|
|
408
|
-
invalid:
|
|
409
|
-
disabled:
|
|
410
|
-
readonly:
|
|
411
|
-
indeterminate:
|
|
680
|
+
modifiers,
|
|
681
|
+
computed(() => ({
|
|
682
|
+
switch: propsSwitch.value,
|
|
683
|
+
valid: valid.value,
|
|
684
|
+
invalid: invalid.value,
|
|
685
|
+
disabled: disabled.value,
|
|
686
|
+
readonly: readonly.value,
|
|
687
|
+
indeterminate: indeterminate.value
|
|
412
688
|
}))
|
|
413
689
|
);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
690
|
+
watchEffect(() => {
|
|
691
|
+
if (isBinary.value && Array.isArray(modelValue.value)) {
|
|
692
|
+
console.warn(
|
|
693
|
+
`[VvCheckbox] The model value is an array but the component is in binary mode.`
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
watch(
|
|
698
|
+
() => isIndeterminated.value,
|
|
699
|
+
(newValue) => {
|
|
700
|
+
if (newValue) {
|
|
701
|
+
input.value.indeterminate = true;
|
|
702
|
+
} else {
|
|
703
|
+
input.value.indeterminate = false;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
onMounted(() => {
|
|
708
|
+
if (isIndeterminated.value) {
|
|
709
|
+
input.value.indeterminate = true;
|
|
422
710
|
}
|
|
423
|
-
), L(() => {
|
|
424
|
-
B.value && (b.value.indeterminate = !0);
|
|
425
711
|
});
|
|
426
|
-
const { HintSlot
|
|
427
|
-
return (
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
712
|
+
const { HintSlot } = HintSlotFactory(props, slots);
|
|
713
|
+
return (_ctx, _cache) => {
|
|
714
|
+
return openBlock(), createElementBlock("label", {
|
|
715
|
+
class: normalizeClass(unref(bemCssClasses)),
|
|
716
|
+
for: unref(hasId)
|
|
717
|
+
}, [
|
|
718
|
+
withDirectives(createElementVNode("input", {
|
|
719
|
+
id: unref(hasId),
|
|
720
|
+
ref_key: "input",
|
|
721
|
+
ref: input,
|
|
722
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null),
|
|
723
|
+
type: "checkbox",
|
|
724
|
+
class: "vv-checkbox__input",
|
|
725
|
+
name: _ctx.name,
|
|
726
|
+
disabled: unref(isDisabled),
|
|
727
|
+
value: unref(hasValue),
|
|
728
|
+
tabindex: unref(tabindex),
|
|
729
|
+
"aria-invalid": unref(isInvalid)
|
|
730
|
+
}, null, 8, _hoisted_2), [
|
|
731
|
+
[vModelCheckbox, unref(localModelValue)]
|
|
732
|
+
]),
|
|
733
|
+
renderSlot(_ctx.$slots, "default", { value: unref(modelValue) }, () => [
|
|
734
|
+
createTextVNode(toDisplayString(_ctx.label), 1)
|
|
735
|
+
]),
|
|
736
|
+
createVNode(unref(HintSlot), {
|
|
737
|
+
class: "vv-checkbox__hint",
|
|
738
|
+
params: { value: unref(modelValue) }
|
|
739
|
+
}, null, 8, ["params"])
|
|
740
|
+
], 10, _hoisted_1);
|
|
741
|
+
};
|
|
454
742
|
}
|
|
455
743
|
});
|
|
456
744
|
export {
|
|
457
|
-
|
|
745
|
+
_sfc_main as default
|
|
458
746
|
};
|