@varlet/ui 3.3.2 → 3.3.4
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/es/dialog/Dialog.mjs +60 -54
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/option/Option.mjs +26 -9
- package/es/option/props.mjs +3 -1
- package/es/ripple/style/index.mjs +1 -1
- package/es/select/Select.mjs +58 -20
- package/es/select/props.mjs +9 -0
- package/es/select/style/index.mjs +1 -0
- package/es/utils/components.mjs +1 -1
- package/es/varlet.esm.js +4228 -4164
- package/highlight/web-types.en-US.json +32 -1
- package/highlight/web-types.zh-CN.json +33 -2
- package/lib/varlet.cjs.js +179 -108
- package/package.json +7 -7
- package/types/dialog.d.ts +7 -0
- package/types/select.d.ts +15 -0
- package/umd/varlet.js +7 -7
package/es/dialog/Dialog.mjs
CHANGED
|
@@ -93,60 +93,66 @@ function __render__(_ctx, _cache) {
|
|
|
93
93
|
6
|
|
94
94
|
/* CLASS, STYLE */
|
|
95
95
|
),
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
class: _normalizeClass(_ctx.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
text: "",
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
96
|
+
_renderSlot(_ctx.$slots, "actions", {
|
|
97
|
+
slotClass: _ctx.n("actions"),
|
|
98
|
+
cancel: _ctx.cancel,
|
|
99
|
+
confirm: _ctx.confirm
|
|
100
|
+
}, () => [
|
|
101
|
+
_createElementVNode(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
class: _normalizeClass(_ctx.n("actions"))
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
_ctx.cancelButton ? (_openBlock(), _createBlock(_component_var_button, {
|
|
108
|
+
key: 0,
|
|
109
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("button"), _ctx.n("cancel-button"))),
|
|
110
|
+
"var-dialog-cover": "",
|
|
111
|
+
text: "",
|
|
112
|
+
"text-color": _ctx.cancelButtonTextColor,
|
|
113
|
+
color: _ctx.cancelButtonColor,
|
|
114
|
+
onClick: _ctx.cancel
|
|
115
|
+
}, {
|
|
116
|
+
default: _withCtx(() => {
|
|
117
|
+
var _a;
|
|
118
|
+
return [
|
|
119
|
+
_createTextVNode(
|
|
120
|
+
_toDisplayString((_a = _ctx.cancelButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("dialogCancelButtonText")),
|
|
121
|
+
1
|
|
122
|
+
/* TEXT */
|
|
123
|
+
)
|
|
124
|
+
];
|
|
125
|
+
}),
|
|
126
|
+
_: 1
|
|
127
|
+
/* STABLE */
|
|
128
|
+
}, 8, ["class", "text-color", "color", "onClick"])) : _createCommentVNode("v-if", true),
|
|
129
|
+
_ctx.confirmButton ? (_openBlock(), _createBlock(_component_var_button, {
|
|
130
|
+
key: 1,
|
|
131
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("button"), _ctx.n("confirm-button"))),
|
|
132
|
+
"var-dialog-cover": "",
|
|
133
|
+
text: "",
|
|
134
|
+
"text-color": _ctx.confirmButtonTextColor,
|
|
135
|
+
color: _ctx.confirmButtonColor,
|
|
136
|
+
onClick: _ctx.confirm
|
|
137
|
+
}, {
|
|
138
|
+
default: _withCtx(() => {
|
|
139
|
+
var _a;
|
|
140
|
+
return [
|
|
141
|
+
_createTextVNode(
|
|
142
|
+
_toDisplayString((_a = _ctx.confirmButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("dialogConfirmButtonText")),
|
|
143
|
+
1
|
|
144
|
+
/* TEXT */
|
|
145
|
+
)
|
|
146
|
+
];
|
|
147
|
+
}),
|
|
148
|
+
_: 1
|
|
149
|
+
/* STABLE */
|
|
150
|
+
}, 8, ["class", "text-color", "color", "onClick"])) : _createCommentVNode("v-if", true)
|
|
151
|
+
],
|
|
152
|
+
2
|
|
153
|
+
/* CLASS */
|
|
154
|
+
)
|
|
155
|
+
])
|
|
150
156
|
],
|
|
151
157
|
16
|
|
152
158
|
/* FULL_PROPS */
|
package/es/index.bundle.mjs
CHANGED
|
@@ -265,7 +265,7 @@ import './tooltip/style/index.mjs'
|
|
|
265
265
|
import './uploader/style/index.mjs'
|
|
266
266
|
import './watermark/style/index.mjs'
|
|
267
267
|
|
|
268
|
-
const version = '3.3.
|
|
268
|
+
const version = '3.3.4'
|
|
269
269
|
|
|
270
270
|
function install(app) {
|
|
271
271
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -176,7 +176,7 @@ export * from './tooltip/index.mjs'
|
|
|
176
176
|
export * from './uploader/index.mjs'
|
|
177
177
|
export * from './watermark/index.mjs'
|
|
178
178
|
|
|
179
|
-
const version = '3.3.
|
|
179
|
+
const version = '3.3.4'
|
|
180
180
|
|
|
181
181
|
function install(app) {
|
|
182
182
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/option/Option.mjs
CHANGED
|
@@ -4,16 +4,17 @@ import Hover from "../hover/index.mjs";
|
|
|
4
4
|
import VarHoverOverlay, { useHoverOverlay } from "../hover-overlay/index.mjs";
|
|
5
5
|
import { defineComponent, computed, ref, watch } from "vue";
|
|
6
6
|
import { useSelect } from "./provide.mjs";
|
|
7
|
-
import { createNamespace } from "../utils/components.mjs";
|
|
7
|
+
import { createNamespace, MaybeVNode } from "../utils/components.mjs";
|
|
8
8
|
import { props } from "./props.mjs";
|
|
9
|
-
import { preventDefault } from "@varlet/shared";
|
|
9
|
+
import { preventDefault, isFunction } from "@varlet/shared";
|
|
10
10
|
import { useEventListener } from "@varlet/use";
|
|
11
11
|
const { name, n, classes } = createNamespace("option");
|
|
12
|
-
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot,
|
|
12
|
+
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createVNode as _createVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
13
13
|
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
14
14
|
const _hoisted_1 = ["tabindex"];
|
|
15
15
|
function __render__(_ctx, _cache) {
|
|
16
16
|
const _component_var_checkbox = _resolveComponent("var-checkbox");
|
|
17
|
+
const _component_maybe_v_node = _resolveComponent("maybe-v-node");
|
|
17
18
|
const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
18
19
|
const _directive_ripple = _resolveDirective("ripple");
|
|
19
20
|
const _directive_hover = _resolveDirective("hover");
|
|
@@ -57,9 +58,11 @@ function __render__(_ctx, _cache) {
|
|
|
57
58
|
{
|
|
58
59
|
class: _normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
|
|
59
60
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
[
|
|
62
|
+
_createVNode(_component_maybe_v_node, { is: _ctx.labelVNode }, null, 8, ["is"])
|
|
63
|
+
],
|
|
64
|
+
2
|
|
65
|
+
/* CLASS */
|
|
63
66
|
)
|
|
64
67
|
]),
|
|
65
68
|
_createVNode(_component_var_hover_overlay, {
|
|
@@ -76,7 +79,8 @@ const __sfc__ = defineComponent({
|
|
|
76
79
|
directives: { Ripple, Hover },
|
|
77
80
|
components: {
|
|
78
81
|
VarCheckbox,
|
|
79
|
-
VarHoverOverlay
|
|
82
|
+
VarHoverOverlay,
|
|
83
|
+
MaybeVNode
|
|
80
84
|
},
|
|
81
85
|
props,
|
|
82
86
|
setup(props2) {
|
|
@@ -84,13 +88,25 @@ const __sfc__ = defineComponent({
|
|
|
84
88
|
const isFocusing = ref(false);
|
|
85
89
|
const optionSelected = ref(false);
|
|
86
90
|
const selected = computed(() => optionSelected.value);
|
|
87
|
-
const
|
|
91
|
+
const labelVNode = computed(
|
|
92
|
+
() => {
|
|
93
|
+
var _a;
|
|
94
|
+
return isFunction(props2.label) ? props2.label(
|
|
95
|
+
(_a = props2.option) != null ? _a : {
|
|
96
|
+
label: props2.label,
|
|
97
|
+
value: props2.value,
|
|
98
|
+
disabled: props2.disabled
|
|
99
|
+
},
|
|
100
|
+
optionSelected.value
|
|
101
|
+
) : props2.label;
|
|
102
|
+
}
|
|
103
|
+
);
|
|
88
104
|
const value = computed(() => props2.value);
|
|
89
105
|
const { select, bindSelect } = useSelect();
|
|
90
106
|
const { multiple, focusColor, onSelect, computeLabel } = select;
|
|
91
107
|
const { hovering, handleHovering } = useHoverOverlay();
|
|
92
108
|
const optionProvider = {
|
|
93
|
-
label,
|
|
109
|
+
label: labelVNode,
|
|
94
110
|
value,
|
|
95
111
|
selected,
|
|
96
112
|
sync
|
|
@@ -141,6 +157,7 @@ const __sfc__ = defineComponent({
|
|
|
141
157
|
focusColor,
|
|
142
158
|
hovering,
|
|
143
159
|
isFocusing,
|
|
160
|
+
labelVNode,
|
|
144
161
|
n,
|
|
145
162
|
classes,
|
|
146
163
|
handleHovering,
|
package/es/option/props.mjs
CHANGED
package/es/select/Select.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import VarIcon from "../icon/index.mjs";
|
|
2
2
|
import VarMenu from "../menu/index.mjs";
|
|
3
3
|
import VarChip from "../chip/index.mjs";
|
|
4
|
+
import VarOption from "../option/index.mjs";
|
|
4
5
|
import VarFieldDecorator from "../field-decorator/index.mjs";
|
|
5
6
|
import VarFormDetails from "../form-details/index.mjs";
|
|
6
7
|
import { computed, defineComponent, ref, watch, nextTick } from "vue";
|
|
7
|
-
import { isArray, isEmpty, call, preventDefault, doubleRaf } from "@varlet/shared";
|
|
8
|
+
import { isArray, isEmpty, call, preventDefault, doubleRaf, isFunction } from "@varlet/shared";
|
|
8
9
|
import { props } from "./props.mjs";
|
|
9
|
-
import { useValidation, createNamespace } from "../utils/components.mjs";
|
|
10
|
+
import { useValidation, createNamespace, MaybeVNode } from "../utils/components.mjs";
|
|
10
11
|
import { useOptions } from "./provide.mjs";
|
|
11
12
|
import { useForm } from "../form/provide.mjs";
|
|
12
13
|
import { focusChildElementByKey, toPxNum } from "../utils/elements.mjs";
|
|
@@ -14,14 +15,15 @@ import { error } from "../utils/logger.mjs";
|
|
|
14
15
|
import { useSelectController } from "./useSelectController.mjs";
|
|
15
16
|
import { useEventListener } from "@varlet/use";
|
|
16
17
|
const { name, n, classes } = createNamespace("select");
|
|
17
|
-
import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock,
|
|
18
|
+
import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, normalizeClass as _normalizeClass, withCtx as _withCtx, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, createSlots as _createSlots, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
18
19
|
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
19
20
|
const _hoisted_1 = ["tabindex"];
|
|
20
|
-
const _hoisted_2 = { key: 1 };
|
|
21
21
|
function __render__(_ctx, _cache) {
|
|
22
|
+
const _component_maybe_v_node = _resolveComponent("maybe-v-node");
|
|
22
23
|
const _component_var_chip = _resolveComponent("var-chip");
|
|
23
24
|
const _component_var_icon = _resolveComponent("var-icon");
|
|
24
25
|
const _component_var_field_decorator = _resolveComponent("var-field-decorator");
|
|
26
|
+
const _component_var_option = _resolveComponent("var-option");
|
|
25
27
|
const _component_var_menu = _resolveComponent("var-menu");
|
|
26
28
|
const _component_var_form_details = _resolveComponent("var-form-details");
|
|
27
29
|
return _openBlock(), _createElementBlock("div", {
|
|
@@ -54,6 +56,21 @@ function __render__(_ctx, _cache) {
|
|
|
54
56
|
class: _normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("$-elevation--3")))
|
|
55
57
|
},
|
|
56
58
|
[
|
|
59
|
+
_ctx.selectOptions.length ? (_openBlock(true), _createElementBlock(
|
|
60
|
+
_Fragment,
|
|
61
|
+
{ key: 0 },
|
|
62
|
+
_renderList(_ctx.selectOptions, (option) => {
|
|
63
|
+
return _openBlock(), _createBlock(_component_var_option, {
|
|
64
|
+
key: option[_ctx.valueKey],
|
|
65
|
+
label: option[_ctx.labelKey],
|
|
66
|
+
value: option[_ctx.valueKey],
|
|
67
|
+
option,
|
|
68
|
+
disabled: option.disabled
|
|
69
|
+
}, null, 8, ["label", "value", "option", "disabled"]);
|
|
70
|
+
}),
|
|
71
|
+
128
|
|
72
|
+
/* KEYED_FRAGMENT */
|
|
73
|
+
)) : _createCommentVNode("v-if", true),
|
|
57
74
|
_renderSlot(_ctx.$slots, "default")
|
|
58
75
|
],
|
|
59
76
|
2
|
|
@@ -134,11 +151,7 @@ function __render__(_ctx, _cache) {
|
|
|
134
151
|
onClose: () => _ctx.handleClose(l)
|
|
135
152
|
}, {
|
|
136
153
|
default: _withCtx(() => [
|
|
137
|
-
|
|
138
|
-
_toDisplayString(l),
|
|
139
|
-
1
|
|
140
|
-
/* TEXT */
|
|
141
|
-
)
|
|
154
|
+
_createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"])
|
|
142
155
|
]),
|
|
143
156
|
_: 2
|
|
144
157
|
/* DYNAMIC */
|
|
@@ -156,20 +169,40 @@ function __render__(_ctx, _cache) {
|
|
|
156
169
|
key: 1,
|
|
157
170
|
class: _normalizeClass(_ctx.n("values"))
|
|
158
171
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
[
|
|
173
|
+
(_openBlock(true), _createElementBlock(
|
|
174
|
+
_Fragment,
|
|
175
|
+
null,
|
|
176
|
+
_renderList(_ctx.labels, (l, labelIndex) => {
|
|
177
|
+
return _openBlock(), _createElementBlock(
|
|
178
|
+
_Fragment,
|
|
179
|
+
{ key: l },
|
|
180
|
+
[
|
|
181
|
+
_createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"]),
|
|
182
|
+
_createTextVNode(
|
|
183
|
+
_toDisplayString(labelIndex !== _ctx.labels.length - 1 ? _ctx.separator : ""),
|
|
184
|
+
1
|
|
185
|
+
/* TEXT */
|
|
186
|
+
)
|
|
187
|
+
],
|
|
188
|
+
64
|
|
189
|
+
/* STABLE_FRAGMENT */
|
|
190
|
+
);
|
|
191
|
+
}),
|
|
192
|
+
128
|
|
193
|
+
/* KEYED_FRAGMENT */
|
|
194
|
+
))
|
|
195
|
+
],
|
|
196
|
+
2
|
|
197
|
+
/* CLASS */
|
|
162
198
|
))
|
|
163
199
|
],
|
|
164
200
|
64
|
|
165
201
|
/* STABLE_FRAGMENT */
|
|
166
|
-
)) : (_openBlock(),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
1
|
|
171
|
-
/* TEXT */
|
|
172
|
-
))
|
|
202
|
+
)) : (_openBlock(), _createBlock(_component_maybe_v_node, {
|
|
203
|
+
key: 1,
|
|
204
|
+
is: _ctx.label
|
|
205
|
+
}, null, 8, ["is"]))
|
|
173
206
|
]) : _createCommentVNode("v-if", true)
|
|
174
207
|
],
|
|
175
208
|
2
|
|
@@ -235,8 +268,10 @@ const __sfc__ = defineComponent({
|
|
|
235
268
|
VarIcon,
|
|
236
269
|
VarMenu,
|
|
237
270
|
VarChip,
|
|
271
|
+
VarOption,
|
|
238
272
|
VarFieldDecorator,
|
|
239
|
-
VarFormDetails
|
|
273
|
+
VarFormDetails,
|
|
274
|
+
MaybeVNode
|
|
240
275
|
},
|
|
241
276
|
props,
|
|
242
277
|
setup(props2) {
|
|
@@ -247,6 +282,7 @@ const __sfc__ = defineComponent({
|
|
|
247
282
|
const focusColor = computed(() => props2.focusColor);
|
|
248
283
|
const isEmptyModelValue = computed(() => isEmpty(props2.modelValue));
|
|
249
284
|
const cursor = computed(() => props2.disabled || props2.readonly ? "" : "pointer");
|
|
285
|
+
const selectOptions = computed(() => isArray(props2.options) ? props2.options : []);
|
|
250
286
|
const offsetY = ref(0);
|
|
251
287
|
const { bindForm, form } = useForm();
|
|
252
288
|
const { length, options, bindOptions } = useOptions();
|
|
@@ -462,6 +498,8 @@ const __sfc__ = defineComponent({
|
|
|
462
498
|
cursor,
|
|
463
499
|
placeholderColor,
|
|
464
500
|
enableCustomPlaceholder,
|
|
501
|
+
selectOptions,
|
|
502
|
+
isFunction,
|
|
465
503
|
n,
|
|
466
504
|
classes,
|
|
467
505
|
handleFocus,
|
package/es/select/props.mjs
CHANGED
|
@@ -21,6 +21,15 @@ const props = __spreadValues({
|
|
|
21
21
|
type: [String, Number, Boolean, Array],
|
|
22
22
|
default: void 0
|
|
23
23
|
},
|
|
24
|
+
options: Array,
|
|
25
|
+
labelKey: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "label"
|
|
28
|
+
},
|
|
29
|
+
valueKey: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "value"
|
|
32
|
+
},
|
|
24
33
|
multiple: Boolean,
|
|
25
34
|
offsetY: {
|
|
26
35
|
type: [String, Number],
|
package/es/utils/components.mjs
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from "vue";
|
|
51
51
|
import { createNamespaceFn, isArray, isPlainObject, isString } from "@varlet/shared";
|
|
52
52
|
function pickProps(props, propsKey) {
|
|
53
|
-
return
|
|
53
|
+
return isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
|
|
54
54
|
pickedProps[key] = props[key];
|
|
55
55
|
return pickedProps;
|
|
56
56
|
}, {}) : props[propsKey];
|