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