@solar-taro/ui-vant 2.6.1 → 2.6.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/CHANGELOG.md +4 -0
- package/cascader/index.vue.d.ts +1 -0
- package/index.scss +1 -0
- package/index10.js +107 -116
- package/index16.js +1 -1
- package/index17.js +1 -1
- package/index20.js +1 -1
- package/index21.js +1 -1
- package/index22.js +1 -1
- package/index3.js +61 -59
- package/package.json +1 -1
- package/selector/index.vue.d.ts +0 -1
package/CHANGELOG.md
CHANGED
package/cascader/index.vue.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
25
25
|
present: () => void;
|
|
26
26
|
label: string;
|
|
27
27
|
}): any;
|
|
28
|
+
end?(_: {}): any;
|
|
28
29
|
};
|
|
29
30
|
emit: (((evt: "close") => void) & ((evt: "select", args_0: TreeNode<T>) => void) & ((evt: "clear", args_0: unknown) => void)) & ((evt: "update:modelValue", value: unknown) => void);
|
|
30
31
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
package/index.scss
CHANGED
package/index10.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
import { defineComponent as J, ref as F, computed as m, renderSlot as Q, openBlock as X, createElementBlock as Y, createCommentVNode as Z,
|
|
1
|
+
import { defineComponent as J, ref as F, computed as m, renderSlot as Q, openBlock as X, createElementBlock as Y, createCommentVNode as Z, createElementVNode as _, mergeProps as x, resolveDirective as ee, withDirectives as le, unref as te, toDisplayString as oe, createTextVNode as ne, normalizeClass as re, withCtx as se, createSlots as ae, createVNode as ie, normalizeStyle as ue, createBlock as de, Fragment as pe, renderList as ce } from "vue";
|
|
2
2
|
import { useFilterList as fe } from "@solar-taro/core";
|
|
3
3
|
import { SunLazyRender as ve, SunVirtualScroll as me, SunItem as O } from "@solar-taro/ui-sun";
|
|
4
4
|
import B from "./index25.js";
|
|
5
5
|
import he from "./index7.js";
|
|
6
6
|
import ye from "./index6.js";
|
|
7
|
-
const
|
|
8
|
-
key: 1,
|
|
9
|
-
name: "right-icon"
|
|
10
|
-
}, we = ["label", "value", "placeholder", "use-right-icon-slot", "disabled"], Se = {
|
|
11
|
-
key: 1,
|
|
12
|
-
name: "right-icon"
|
|
13
|
-
}, Ke = ["value"], Be = { class: "sun-selector-option-label" }, De = /* @__PURE__ */ J({
|
|
7
|
+
const u = Q, s = X, d = Y, h = Z, v = _, R = x, be = ee, I = le, p = te, M = oe, ge = ne, P = re, r = se, C = ae, z = ie, T = ue, N = de, q = pe, Ve = ce, ke = ["label", "value", "placeholder", "required", "disabled"], $e = { name: "right-icon" }, we = ["label", "value", "placeholder", "use-right-icon-slot", "disabled"], Se = { name: "right-icon" }, Ke = ["value"], Be = { class: "sun-selector-option-label" }, De = /* @__PURE__ */ J({
|
|
14
8
|
__name: "index",
|
|
15
9
|
props: {
|
|
16
10
|
type: { default: "field" },
|
|
@@ -27,7 +21,6 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
27
21
|
disabled: { type: Boolean },
|
|
28
22
|
delimiter: { default: ", " },
|
|
29
23
|
searchable: { type: Boolean, default: !0 },
|
|
30
|
-
clearable: { type: Boolean, default: !0 },
|
|
31
24
|
searcher: {},
|
|
32
25
|
virtual: { type: [Boolean, Object] },
|
|
33
26
|
refresher: { type: Boolean },
|
|
@@ -36,129 +29,127 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
36
29
|
},
|
|
37
30
|
emits: ["update:modelValue", "select", "unselect", "clear", "close", "confirm", "refresh"],
|
|
38
31
|
setup($, { expose: w, emit: j }) {
|
|
39
|
-
const o = $,
|
|
32
|
+
const o = $, i = j, y = F(!1), b = F(!1), A = m(() => o.searcher || ((e, l) => e[o.labelKey].toLowerCase().includes(l))), { keyword: W, filteredList: S } = fe(() => o.options, A.value), K = m(() => {
|
|
40
33
|
var e;
|
|
41
34
|
if (c.value) {
|
|
42
35
|
const l = B(o.modelValue) ? null : o.options.find(
|
|
43
|
-
(
|
|
36
|
+
(n) => o.compareWith(n[o.valueKey], o.modelValue)
|
|
44
37
|
);
|
|
45
38
|
return (l == null ? void 0 : l[o.labelKey]) || "";
|
|
46
39
|
}
|
|
47
40
|
return (e = o.modelValue) == null ? void 0 : e.map(
|
|
48
41
|
(l) => {
|
|
49
|
-
var
|
|
50
|
-
return ((
|
|
42
|
+
var n;
|
|
43
|
+
return ((n = o.options.find((t) => o.compareWith(t[o.valueKey], l))) == null ? void 0 : n[o.labelKey]) || "";
|
|
51
44
|
}
|
|
52
45
|
).join(o.delimiter);
|
|
53
|
-
}),
|
|
54
|
-
var
|
|
46
|
+
}), g = m(() => !G(o.modelValue) && !o.required), c = m(() => o.mode === "single"), U = m(() => {
|
|
47
|
+
var n, t;
|
|
55
48
|
let e, l = 47;
|
|
56
|
-
return typeof o.virtual != "boolean" && (
|
|
49
|
+
return typeof o.virtual != "boolean" && (n = o.virtual) != null && n.itemSize && (l = (t = o.virtual) == null ? void 0 : t.itemSize), { id: e, itemSize: l };
|
|
57
50
|
});
|
|
58
51
|
function G(e) {
|
|
59
52
|
return B(e) ? !0 : c.value ? !1 : e.length < 1;
|
|
60
53
|
}
|
|
61
|
-
function
|
|
62
|
-
var
|
|
54
|
+
function a(e) {
|
|
55
|
+
var n;
|
|
63
56
|
const l = e[o.valueKey];
|
|
64
|
-
return c.value ? B(o.modelValue) ? !1 : o.compareWith(o.modelValue, l) : ((
|
|
57
|
+
return c.value ? B(o.modelValue) ? !1 : o.compareWith(o.modelValue, l) : ((n = o.modelValue) == null ? void 0 : n.some((t) => o.compareWith(t, l))) || !1;
|
|
65
58
|
}
|
|
66
|
-
function
|
|
67
|
-
o.disabled || (
|
|
68
|
-
|
|
59
|
+
function V() {
|
|
60
|
+
o.disabled || (y.value = !0, b.value || setTimeout(() => {
|
|
61
|
+
b.value = !0;
|
|
69
62
|
}, 300));
|
|
70
63
|
}
|
|
71
64
|
function D() {
|
|
72
|
-
|
|
65
|
+
y.value = !1, i("close");
|
|
73
66
|
}
|
|
74
67
|
function L() {
|
|
75
68
|
var l;
|
|
76
69
|
const e = ((l = o.modelValue) == null ? void 0 : l.map(
|
|
77
|
-
(
|
|
78
|
-
(t) => o.compareWith(t[o.valueKey],
|
|
70
|
+
(n) => o.options.find(
|
|
71
|
+
(t) => o.compareWith(t[o.valueKey], n)
|
|
79
72
|
)
|
|
80
73
|
)) || [];
|
|
81
|
-
|
|
74
|
+
i("confirm", e), D();
|
|
82
75
|
}
|
|
83
76
|
function E(e) {
|
|
84
77
|
const l = e[o.valueKey];
|
|
85
|
-
let
|
|
86
|
-
c.value ? (
|
|
78
|
+
let n = o.modelValue;
|
|
79
|
+
c.value ? (a(e) ? o.required || (i("unselect", e), n = null) : (i("select", e), n = l), D()) : a(e) ? (i("unselect", e), n = o.modelValue.filter(
|
|
87
80
|
(t) => !o.compareWith(t, l)
|
|
88
|
-
)) : (
|
|
81
|
+
)) : (i("select", e), n = (o.modelValue || []).concat(
|
|
89
82
|
e[o.valueKey]
|
|
90
|
-
)),
|
|
83
|
+
)), i("update:modelValue", n);
|
|
91
84
|
}
|
|
92
85
|
function k() {
|
|
93
|
-
|
|
86
|
+
i("clear", o.modelValue), i("update:modelValue", o.required && !c.value ? [] : null);
|
|
94
87
|
}
|
|
95
88
|
return w({
|
|
96
|
-
present:
|
|
89
|
+
present: V,
|
|
97
90
|
clear: k
|
|
98
91
|
}), (e, l) => {
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
present:
|
|
92
|
+
const n = be("readonly");
|
|
93
|
+
return s(), d(q, null, [
|
|
94
|
+
u(e.$slots, "default", {
|
|
95
|
+
present: V,
|
|
103
96
|
label: K.value
|
|
104
97
|
}, () => [
|
|
105
|
-
e.type === "field" ? I((
|
|
98
|
+
e.type === "field" ? I((s(), d("van-field", R({ key: 0 }, e.$attrs, {
|
|
106
99
|
class: "sun-selector",
|
|
107
100
|
label: e.label,
|
|
108
101
|
value: K.value,
|
|
109
102
|
placeholder: e.placeholder,
|
|
110
103
|
required: e.required,
|
|
111
104
|
disabled: e.disabled,
|
|
112
|
-
onClickInput: l[1] || (l[1] = (t) =>
|
|
105
|
+
onClickInput: l[1] || (l[1] = (t) => V())
|
|
113
106
|
}), [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]) : e.type === "search" ? I((a(), i("van-search", R({ key: 1 }, e.$attrs, {
|
|
107
|
+
v("slot-view", $e, [
|
|
108
|
+
g.value ? (s(), d("van-icon", {
|
|
109
|
+
key: 0,
|
|
110
|
+
class: "sun-selector-clear-icon",
|
|
111
|
+
name: "clear",
|
|
112
|
+
onTap: l[0] || (l[0] = (t) => k())
|
|
113
|
+
}, null, 32)) : h("", !0),
|
|
114
|
+
u(e.$slots, "end")
|
|
115
|
+
])
|
|
116
|
+
], 16, ke)), [
|
|
117
|
+
[n]
|
|
118
|
+
]) : e.type === "search" ? I((s(), d("van-search", R({ key: 1 }, e.$attrs, {
|
|
127
119
|
class: "sun-selector",
|
|
128
120
|
label: e.label,
|
|
129
121
|
value: K.value,
|
|
130
122
|
placeholder: e.placeholder,
|
|
131
|
-
"use-right-icon-slot":
|
|
123
|
+
"use-right-icon-slot": g.value,
|
|
132
124
|
shape: "round",
|
|
133
125
|
clearable: !1,
|
|
134
126
|
disabled: e.disabled,
|
|
135
|
-
onClickInput: l[3] || (l[3] = (t) =>
|
|
127
|
+
onClickInput: l[3] || (l[3] = (t) => V())
|
|
136
128
|
}), [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
])) : v("", !0)
|
|
129
|
+
v("slot-view", Se, [
|
|
130
|
+
g.value ? (s(), d("van-icon", {
|
|
131
|
+
key: 0,
|
|
132
|
+
class: "sun-selector-clear-icon",
|
|
133
|
+
name: "clear",
|
|
134
|
+
onTap: l[2] || (l[2] = (t) => k())
|
|
135
|
+
}, null, 32)) : h("", !0),
|
|
136
|
+
u(e.$slots, "end")
|
|
137
|
+
])
|
|
147
138
|
], 16, we)), [
|
|
148
|
-
[
|
|
149
|
-
]) :
|
|
139
|
+
[n]
|
|
140
|
+
]) : h("", !0)
|
|
150
141
|
]),
|
|
151
142
|
z(p(ve), { hook: "created" }, {
|
|
152
|
-
default:
|
|
143
|
+
default: r(() => [
|
|
153
144
|
z(p(he), {
|
|
154
|
-
show:
|
|
155
|
-
"onUpdate:show": l[9] || (l[9] = (t) =>
|
|
145
|
+
show: y.value,
|
|
146
|
+
"onUpdate:show": l[9] || (l[9] = (t) => y.value = t),
|
|
156
147
|
title: e.placeholder,
|
|
157
148
|
"show-buttons": !c.value
|
|
158
149
|
}, C({
|
|
159
|
-
buttons:
|
|
160
|
-
|
|
161
|
-
c.value ?
|
|
150
|
+
buttons: r(() => [
|
|
151
|
+
u(e.$slots, "buttons", { confirm: L }, () => [
|
|
152
|
+
c.value ? h("", !0) : (s(), d("van-button", {
|
|
162
153
|
key: 0,
|
|
163
154
|
type: "primary",
|
|
164
155
|
round: "true",
|
|
@@ -167,19 +158,19 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
167
158
|
}, "确定", 32))
|
|
168
159
|
])
|
|
169
160
|
]),
|
|
170
|
-
default:
|
|
171
|
-
|
|
172
|
-
e.searchable ? (
|
|
161
|
+
default: r(() => [
|
|
162
|
+
u(e.$slots, "filter", { rendered: b.value }, () => [
|
|
163
|
+
e.searchable ? (s(), d("van-search", {
|
|
173
164
|
key: 0,
|
|
174
165
|
shape: "round",
|
|
175
166
|
"input-align": "center",
|
|
176
|
-
value: p(
|
|
167
|
+
value: p(W),
|
|
177
168
|
placeholder: "输入关键字搜索",
|
|
178
|
-
onChange: l[5] || (l[5] = (t) =>
|
|
179
|
-
}, null, 40, Ke)) :
|
|
169
|
+
onChange: l[5] || (l[5] = (t) => W.value = t.detail.trim())
|
|
170
|
+
}, null, 40, Ke)) : h("", !0)
|
|
180
171
|
]),
|
|
181
|
-
e.virtual ? (
|
|
182
|
-
|
|
172
|
+
e.virtual ? (s(), d(q, { key: 0 }, [
|
|
173
|
+
b.value ? (s(), N(p(me), {
|
|
183
174
|
key: 0,
|
|
184
175
|
class: "sun-selector-options",
|
|
185
176
|
refresher: e.refresher,
|
|
@@ -188,43 +179,43 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
188
179
|
"item-size": U.value.itemSize,
|
|
189
180
|
"item-key": e.valueKey,
|
|
190
181
|
style: T({ height: e.height }),
|
|
191
|
-
onRefresh: l[6] || (l[6] = (t) =>
|
|
182
|
+
onRefresh: l[6] || (l[6] = (t) => i("refresh"))
|
|
192
183
|
}, {
|
|
193
|
-
default:
|
|
184
|
+
default: r(({ item: t, index: f }) => [
|
|
194
185
|
z(p(O), {
|
|
195
|
-
class: P(["sun-selector-option", { "sun-selector-option-active":
|
|
186
|
+
class: P(["sun-selector-option", { "sun-selector-option-active": a(t) }]),
|
|
196
187
|
clickable: !0,
|
|
197
188
|
onTap: (H) => E(t)
|
|
198
189
|
}, C({
|
|
199
|
-
start:
|
|
200
|
-
|
|
190
|
+
start: r(() => [
|
|
191
|
+
u(e.$slots, "option-start", {
|
|
201
192
|
option: t,
|
|
202
193
|
index: f,
|
|
203
|
-
active:
|
|
194
|
+
active: a(t)
|
|
204
195
|
})
|
|
205
196
|
]),
|
|
206
|
-
end:
|
|
207
|
-
|
|
197
|
+
end: r(() => [
|
|
198
|
+
u(e.$slots, "option-end", {
|
|
208
199
|
option: t,
|
|
209
200
|
index: f,
|
|
210
|
-
active:
|
|
201
|
+
active: a(t)
|
|
211
202
|
})
|
|
212
203
|
]),
|
|
213
|
-
default:
|
|
214
|
-
|
|
204
|
+
default: r(() => [
|
|
205
|
+
u(e.$slots, "option", {
|
|
215
206
|
option: t,
|
|
216
207
|
index: f,
|
|
217
|
-
active:
|
|
208
|
+
active: a(t)
|
|
218
209
|
}, () => [
|
|
219
210
|
ge(M(t[e.labelKey]), 1)
|
|
220
211
|
])
|
|
221
212
|
]),
|
|
222
213
|
_: 2
|
|
223
214
|
}, [
|
|
224
|
-
|
|
215
|
+
a(t) ? {
|
|
225
216
|
name: "end",
|
|
226
|
-
fn:
|
|
227
|
-
l[10] || (l[10] =
|
|
217
|
+
fn: r(() => [
|
|
218
|
+
l[10] || (l[10] = v("van-icon", {
|
|
228
219
|
class: "sun-selector-option-icon",
|
|
229
220
|
name: "success"
|
|
230
221
|
}, null, -1))
|
|
@@ -234,11 +225,11 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
234
225
|
]), 1032, ["class", "onTap"])
|
|
235
226
|
]),
|
|
236
227
|
_: 3
|
|
237
|
-
}, 8, ["refresher", "refreshing", "items", "item-size", "item-key", "style"])) : (
|
|
228
|
+
}, 8, ["refresher", "refreshing", "items", "item-size", "item-key", "style"])) : (s(), d("view", {
|
|
238
229
|
key: 1,
|
|
239
230
|
style: T({ height: e.height })
|
|
240
231
|
}, null, 4))
|
|
241
|
-
], 64)) : (
|
|
232
|
+
], 64)) : (s(), N(p(ye), {
|
|
242
233
|
key: 1,
|
|
243
234
|
class: "sun-selector-options",
|
|
244
235
|
refresher: e.refresher,
|
|
@@ -247,44 +238,44 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
247
238
|
loading: e.loading,
|
|
248
239
|
"empty-type": "search",
|
|
249
240
|
style: T({ height: e.height }),
|
|
250
|
-
onRefresh: l[7] || (l[7] = (t) =>
|
|
241
|
+
onRefresh: l[7] || (l[7] = (t) => i("refresh"))
|
|
251
242
|
}, {
|
|
252
|
-
default:
|
|
253
|
-
(
|
|
243
|
+
default: r(() => [
|
|
244
|
+
(s(!0), d(q, null, Ve(p(S), (t, f) => (s(), N(p(O), {
|
|
254
245
|
key: t[e.valueKey],
|
|
255
|
-
class: P(["sun-selector-option", { "sun-selector-option-active":
|
|
246
|
+
class: P(["sun-selector-option", { "sun-selector-option-active": a(t) }]),
|
|
256
247
|
clickable: !0,
|
|
257
248
|
onTap: (H) => E(t)
|
|
258
249
|
}, C({
|
|
259
|
-
start:
|
|
260
|
-
|
|
250
|
+
start: r(() => [
|
|
251
|
+
u(e.$slots, "option-start", {
|
|
261
252
|
option: t,
|
|
262
253
|
index: f,
|
|
263
|
-
active:
|
|
254
|
+
active: a(t)
|
|
264
255
|
})
|
|
265
256
|
]),
|
|
266
|
-
end:
|
|
267
|
-
|
|
257
|
+
end: r(() => [
|
|
258
|
+
u(e.$slots, "option-end", {
|
|
268
259
|
option: t,
|
|
269
260
|
index: f,
|
|
270
|
-
active:
|
|
261
|
+
active: a(t)
|
|
271
262
|
})
|
|
272
263
|
]),
|
|
273
|
-
default:
|
|
274
|
-
|
|
264
|
+
default: r(() => [
|
|
265
|
+
u(e.$slots, "option", {
|
|
275
266
|
option: t,
|
|
276
267
|
index: f,
|
|
277
|
-
active:
|
|
268
|
+
active: a(t)
|
|
278
269
|
}, () => [
|
|
279
|
-
|
|
270
|
+
v("view", Be, M(t[e.labelKey]), 1)
|
|
280
271
|
])
|
|
281
272
|
]),
|
|
282
273
|
_: 2
|
|
283
274
|
}, [
|
|
284
|
-
|
|
275
|
+
a(t) ? {
|
|
285
276
|
name: "end",
|
|
286
|
-
fn:
|
|
287
|
-
l[11] || (l[11] =
|
|
277
|
+
fn: r(() => [
|
|
278
|
+
l[11] || (l[11] = v("van-icon", {
|
|
288
279
|
class: "sun-selector-option-icon",
|
|
289
280
|
slot: "right-icon",
|
|
290
281
|
name: "success"
|
|
@@ -299,10 +290,10 @@ const d = Q, a = X, i = Y, v = Z, R = _, be = x, I = ee, V = le, p = te, M = oe,
|
|
|
299
290
|
]),
|
|
300
291
|
_: 2
|
|
301
292
|
}, [
|
|
302
|
-
|
|
293
|
+
g.value ? {
|
|
303
294
|
name: "extra",
|
|
304
|
-
fn:
|
|
305
|
-
|
|
295
|
+
fn: r(() => [
|
|
296
|
+
v("view", {
|
|
306
297
|
class: "sun-selector-clear-btn",
|
|
307
298
|
onTap: l[4] || (l[4] = (t) => k())
|
|
308
299
|
}, "清除", 32)
|
package/index16.js
CHANGED
package/index17.js
CHANGED
package/index20.js
CHANGED
package/index21.js
CHANGED
package/index22.js
CHANGED
package/index3.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { tree2list as
|
|
3
|
-
import { SunLazyRender as
|
|
4
|
-
import { SunModal as
|
|
5
|
-
import { linkedRef as z, untracked as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as Q, mergeModels as _, useModel as W, computed as n, ref as D, renderSlot as X, openBlock as Y, createElementBlock as Z, createCommentVNode as x, createElementVNode as ee, mergeProps as le, resolveDirective as ae, withDirectives as te, unref as ne, renderList as se, Fragment as oe, toDisplayString as re, createTextVNode as ue, normalizeClass as ie, withCtx as de, createSlots as ce, createBlock as ve, normalizeStyle as me, createVNode as pe } from "vue";
|
|
2
|
+
import { tree2list as fe } from "@solar-kit/core";
|
|
3
|
+
import { SunLazyRender as he, SunItem as q } from "@solar-taro/ui-sun";
|
|
4
|
+
import { SunModal as ye } from "@solar-taro/ui-vant";
|
|
5
|
+
import { linkedRef as z, untracked as be } from "@solar-vue/core";
|
|
6
|
+
const E = X, t = Y, s = Z, k = x, m = ee, ke = le, ge = ae, we = te, d = ne, g = se, p = oe, M = re, I = ue, Ke = ie, c = de, Ne = ce, L = ve, F = me, P = pe, Ve = ["label", "value", "placeholder", "required", "disabled"], Ce = { name: "right-icon" }, Se = ["active"], $e = ["name", "title"], Be = ["name"], Me = /* @__PURE__ */ Q({
|
|
7
7
|
__name: "index",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ _({
|
|
9
9
|
label: {},
|
|
10
10
|
placeholder: { default: "请选择" },
|
|
11
11
|
options: {},
|
|
@@ -19,15 +19,15 @@ const be = W, t = X, o = Y, b = Z, ke = x, ge = ee, we = le, d = ae, k = te, m =
|
|
|
19
19
|
modelValue: {},
|
|
20
20
|
modelModifiers: {}
|
|
21
21
|
}),
|
|
22
|
-
emits: /* @__PURE__ */
|
|
23
|
-
setup(w, { emit:
|
|
24
|
-
const
|
|
22
|
+
emits: /* @__PURE__ */ _(["select", "clear", "close"], ["update:modelValue"]),
|
|
23
|
+
setup(w, { emit: R }) {
|
|
24
|
+
const f = R, o = w, r = W(w, "modelValue"), j = n(() => r.value && !o.required), u = D(!1), K = D(0), U = n(() => fe(o.options)), h = n(() => U.value.find((e) => e.parent && !e.children && e[o.valueKey] === r.value)), A = n(() => {
|
|
25
25
|
const e = [];
|
|
26
|
-
let l =
|
|
26
|
+
let l = h.value;
|
|
27
27
|
for (; l; )
|
|
28
28
|
e.unshift(l), l = l.parent;
|
|
29
29
|
return e;
|
|
30
|
-
}), v = z(() =>
|
|
30
|
+
}), v = z(() => h.value), y = n(() => {
|
|
31
31
|
const e = [];
|
|
32
32
|
let l = v.value;
|
|
33
33
|
for (; l; )
|
|
@@ -36,35 +36,35 @@ const be = W, t = X, o = Y, b = Z, ke = x, ge = ee, we = le, d = ae, k = te, m =
|
|
|
36
36
|
}), N = n(() => {
|
|
37
37
|
const e = v.value;
|
|
38
38
|
return e ? !e.children : !1;
|
|
39
|
-
}), V = n(() =>
|
|
39
|
+
}), V = n(() => A.value.map((e) => e[o.labelKey]).join(` ${o.delimiter} `)), b = z(
|
|
40
40
|
() => (
|
|
41
41
|
// 如果有值,则取 currentNodes 的最后索引,否则为 0
|
|
42
|
-
|
|
42
|
+
h.value ? be(() => y.value.length - 1) : 0
|
|
43
43
|
)
|
|
44
|
-
), C = n(() =>
|
|
44
|
+
), C = n(() => o.options.filter((e) => !e.parent)), G = n(() => {
|
|
45
45
|
const e = v.value;
|
|
46
46
|
return e ? e.children : C.value;
|
|
47
47
|
});
|
|
48
48
|
function S() {
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
function G() {
|
|
52
|
-
u.value = !1, p("close");
|
|
49
|
+
o.disabled || (u.value = !0, K.value++);
|
|
53
50
|
}
|
|
54
51
|
function H() {
|
|
55
|
-
|
|
52
|
+
u.value = !1, f("close");
|
|
53
|
+
}
|
|
54
|
+
function J() {
|
|
55
|
+
f("clear", r.value), r.value = null;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
v.value = e,
|
|
57
|
+
function $(e) {
|
|
58
|
+
v.value = e, f("select", e), N.value ? (r.value = e[o.valueKey], u.value = !1) : b.value++;
|
|
59
59
|
}
|
|
60
60
|
return (e, l) => {
|
|
61
|
-
const
|
|
62
|
-
return t(),
|
|
63
|
-
|
|
61
|
+
const O = ge("readonly");
|
|
62
|
+
return t(), s(p, null, [
|
|
63
|
+
E(e.$slots, "default", {
|
|
64
64
|
present: S,
|
|
65
65
|
label: V.value
|
|
66
66
|
}, () => [
|
|
67
|
-
we((t(),
|
|
67
|
+
we((t(), s("van-field", ke(e.$attrs, {
|
|
68
68
|
class: "sun-cascader",
|
|
69
69
|
label: e.label,
|
|
70
70
|
value: V.value,
|
|
@@ -73,64 +73,66 @@ const be = W, t = X, o = Y, b = Z, ke = x, ge = ee, we = le, d = ae, k = te, m =
|
|
|
73
73
|
disabled: e.disabled,
|
|
74
74
|
onClickInput: l[1] || (l[1] = (a) => S())
|
|
75
75
|
}), [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
m("slot-view", Ce, [
|
|
77
|
+
j.value ? (t(), s("van-icon", {
|
|
78
|
+
key: 0,
|
|
79
|
+
class: "sun-cascader-clear-icon",
|
|
80
|
+
name: "clear",
|
|
81
|
+
onTap: l[0] || (l[0] = (a) => J())
|
|
82
|
+
}, null, 32)) : k("", !0),
|
|
83
|
+
E(e.$slots, "end")
|
|
84
|
+
])
|
|
83
85
|
], 16, Ve)), [
|
|
84
|
-
[
|
|
86
|
+
[O]
|
|
85
87
|
])
|
|
86
88
|
]),
|
|
87
|
-
|
|
89
|
+
P(d(he), { hook: "created" }, {
|
|
88
90
|
default: c(() => [
|
|
89
|
-
|
|
91
|
+
P(d(ye), {
|
|
90
92
|
show: u.value,
|
|
91
93
|
"onUpdate:show": l[3] || (l[3] = (a) => u.value = a),
|
|
92
94
|
class: "sun-cascader-modal",
|
|
93
95
|
title: e.placeholder,
|
|
94
96
|
"show-buttons": !1,
|
|
95
|
-
onClose: l[4] || (l[4] = (a) =>
|
|
97
|
+
onClose: l[4] || (l[4] = (a) => H())
|
|
96
98
|
}, {
|
|
97
99
|
default: c(() => [
|
|
98
|
-
K.value ? (t(),
|
|
100
|
+
K.value ? (t(), s("van-tabs", {
|
|
99
101
|
key: 0,
|
|
100
102
|
class: "sun-cascader-tabs",
|
|
101
|
-
active: d(
|
|
103
|
+
active: d(b),
|
|
102
104
|
"line-width": "30px",
|
|
103
105
|
"line-height": "4px",
|
|
104
106
|
animated: "true",
|
|
105
|
-
onChange: l[2] || (l[2] = (a) =>
|
|
107
|
+
onChange: l[2] || (l[2] = (a) => b.value = a.detail.index)
|
|
106
108
|
}, [
|
|
107
|
-
(t(!0),
|
|
109
|
+
(t(!0), s(p, null, g(y.value, (a, B) => {
|
|
108
110
|
var T;
|
|
109
|
-
return t(),
|
|
111
|
+
return t(), s("van-tab", {
|
|
110
112
|
key: a[e.valueKey],
|
|
111
|
-
name:
|
|
113
|
+
name: B,
|
|
112
114
|
class: "sun-cascader-tab",
|
|
113
115
|
title: a[e.labelKey]
|
|
114
116
|
}, [
|
|
115
|
-
|
|
117
|
+
m("view", {
|
|
116
118
|
class: "sun-cascader-list",
|
|
117
|
-
style:
|
|
119
|
+
style: F({ height: e.height })
|
|
118
120
|
}, [
|
|
119
|
-
(t(!0),
|
|
121
|
+
(t(!0), s(p, null, g(((T = a.parent) == null ? void 0 : T.children) || C.value, (i) => (t(), L(d(q), {
|
|
120
122
|
key: i[e.valueKey],
|
|
121
123
|
class: Ke(["sun-cascader-option", { "sun-cascader-option-active": a[e.valueKey] === i[e.valueKey] }]),
|
|
122
124
|
clickable: !0,
|
|
123
|
-
onTap: (
|
|
125
|
+
onTap: (Te) => $(i)
|
|
124
126
|
}, Ne({
|
|
125
127
|
default: c(() => [
|
|
126
|
-
M(
|
|
128
|
+
I(M(i[e.labelKey]) + " ", 1)
|
|
127
129
|
]),
|
|
128
130
|
_: 2
|
|
129
131
|
}, [
|
|
130
132
|
a[e.valueKey] === i[e.valueKey] ? {
|
|
131
133
|
name: "end",
|
|
132
134
|
fn: c(() => [
|
|
133
|
-
l[5] || (l[5] =
|
|
135
|
+
l[5] || (l[5] = m("van-icon", {
|
|
134
136
|
class: "sun-cascader-option-icon",
|
|
135
137
|
name: "success"
|
|
136
138
|
}, null, -1))
|
|
@@ -139,33 +141,33 @@ const be = W, t = X, o = Y, b = Z, ke = x, ge = ee, we = le, d = ae, k = te, m =
|
|
|
139
141
|
} : void 0
|
|
140
142
|
]), 1032, ["class", "onTap"]))), 128))
|
|
141
143
|
], 4)
|
|
142
|
-
], 8,
|
|
144
|
+
], 8, $e);
|
|
143
145
|
}), 128)),
|
|
144
|
-
N.value ?
|
|
146
|
+
N.value ? k("", !0) : (t(), s("van-tab", {
|
|
145
147
|
key: 0,
|
|
146
|
-
name:
|
|
148
|
+
name: y.value.length,
|
|
147
149
|
class: "sun-cascader-tab",
|
|
148
150
|
title: "请选择",
|
|
149
151
|
"title-style": "color:#94a3b8"
|
|
150
152
|
}, [
|
|
151
|
-
|
|
153
|
+
m("view", {
|
|
152
154
|
class: "sun-cascader-list",
|
|
153
|
-
style:
|
|
155
|
+
style: F({ height: e.height })
|
|
154
156
|
}, [
|
|
155
|
-
(t(!0),
|
|
157
|
+
(t(!0), s(p, null, g(G.value, (a) => (t(), L(d(q), {
|
|
156
158
|
key: a[e.valueKey],
|
|
157
159
|
class: "sun-cascader-option",
|
|
158
160
|
clickable: !0,
|
|
159
|
-
onTap: (
|
|
161
|
+
onTap: (B) => $(a)
|
|
160
162
|
}, {
|
|
161
163
|
default: c(() => [
|
|
162
|
-
M(
|
|
164
|
+
I(M(a[e.labelKey]), 1)
|
|
163
165
|
]),
|
|
164
166
|
_: 2
|
|
165
167
|
}, 1032, ["onTap"]))), 128))
|
|
166
168
|
], 4)
|
|
167
169
|
], 8, Be))
|
|
168
|
-
], 40,
|
|
170
|
+
], 40, Se)) : k("", !0)
|
|
169
171
|
]),
|
|
170
172
|
_: 1
|
|
171
173
|
}, 8, ["show", "title"])
|
|
@@ -177,5 +179,5 @@ const be = W, t = X, o = Y, b = Z, ke = x, ge = ee, we = le, d = ae, k = te, m =
|
|
|
177
179
|
}
|
|
178
180
|
});
|
|
179
181
|
export {
|
|
180
|
-
|
|
182
|
+
Me as default
|
|
181
183
|
};
|
package/package.json
CHANGED
package/selector/index.vue.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
|
|
|
23
23
|
/** 多选模式下,分割符 */
|
|
24
24
|
delimiter?: string;
|
|
25
25
|
searchable?: boolean;
|
|
26
|
-
clearable?: boolean;
|
|
27
26
|
searcher?: (option: T, keyword: string) => boolean;
|
|
28
27
|
virtual?: boolean | {
|
|
29
28
|
itemSize?: number;
|