@solar-taro/ui-vant 4.0.1 → 4.2.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 +15 -0
- package/cascader/index.scss +0 -5
- package/date-range-picker/index.scss +0 -5
- package/index.d.ts +0 -1
- package/index.js +19 -21
- package/index.scss +2 -0
- package/index10.js +16 -61
- package/index11.js +3 -18
- package/index12.js +28 -3
- package/index13.js +4 -28
- package/index14.js +2 -5
- package/index15.js +1 -1
- package/index16.js +1 -1
- package/index17.js +1 -1
- package/index19.js +1 -1
- package/index2.js +1 -1
- package/index20.js +7 -2
- package/index21.js +40 -2
- package/index22.js +25 -7
- package/index3.js +122 -115
- package/index5.js +91 -84
- package/index6.js +276 -47
- package/index7.js +54 -263
- package/index8.js +370 -54
- package/index9.js +63 -382
- package/opper-controller/index.vue.d.ts +8 -8
- package/overlay/overlay.d.ts +2 -0
- package/package.json +1 -1
- package/selector/index.scss +0 -5
- package/selector/index.vue.d.ts +3 -6
- package/index23.js +0 -42
- package/index24.js +0 -27
- package/modal/index.d.ts +0 -1
- package/modal/index.vue.d.ts +0 -37
package/index3.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { defineComponent as ve, inject as Z, useModel as me, ref as U, useId as fe, computed as o, effect as ee, Fragment as pe, mergeModels as
|
|
2
|
-
import { tree2list as
|
|
3
|
-
import { SUN_ITEM as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const Re = he, k = be, a = ke, r = ye, y = we, n = Te, ae = xe, f = Se, w = Ve, F = ge, C = Ce, $ = $e, p = pe, j = Ne, d = Be, P = Le, R = _e, Ae = {
|
|
1
|
+
import { defineComponent as ve, inject as Z, useModel as me, ref as U, useId as fe, computed as o, effect as ee, Fragment as pe, mergeModels as le, renderSlot as he, toDisplayString as ke, openBlock as be, createElementBlock as ye, createCommentVNode as we, unref as xe, withModifiers as Se, createBlock as Te, createVNode as Ve, normalizeClass as ge, createElementVNode as Ce, createTextVNode as $e, withCtx as Be, renderList as Ne, createSlots as ze, normalizeStyle as Le } from "vue";
|
|
2
|
+
import { tree2list as Ie } from "@solar-kit/core";
|
|
3
|
+
import { SUN_ITEM as Me, SUN_FIELD as _e, SunIcon as g, SunLazyRender as Ee, SunModal as qe, SunSearchbar as Ue, SunItem as D, SunListPlaceholder as De, SunButton as Fe } from "@solar-taro/ui-sun";
|
|
4
|
+
import { linkedRef as te, untracked as je } from "@solar-vue/core";
|
|
5
|
+
import { nextTick as Pe, getCurrentInstance as Re } from "@tarojs/taro";
|
|
6
|
+
const Ae = he, y = ke, a = be, r = ye, w = we, n = xe, ae = Se, f = Te, p = Ve, F = ge, j = Ce, C = $e, i = Be, $ = Ne, h = pe, P = ze, R = Le, Ge = {
|
|
8
7
|
key: 0,
|
|
9
8
|
class: "sun-cascader-inner"
|
|
10
|
-
},
|
|
9
|
+
}, He = {
|
|
11
10
|
key: 1,
|
|
12
11
|
class: "sun-cascader-placeholder"
|
|
13
|
-
},
|
|
12
|
+
}, Je = ["id", "active"], Ke = ["name", "title"], Oe = ["name"], el = /* @__PURE__ */ ve({
|
|
14
13
|
__name: "index",
|
|
15
|
-
props: /* @__PURE__ */
|
|
14
|
+
props: /* @__PURE__ */ le({
|
|
16
15
|
placeholder: { default: "请选择" },
|
|
17
16
|
options: {},
|
|
18
17
|
required: { type: Boolean },
|
|
@@ -25,141 +24,141 @@ const Re = he, k = be, a = ke, r = ye, y = we, n = Te, ae = xe, f = Se, w = Ve,
|
|
|
25
24
|
modelValue: {},
|
|
26
25
|
modelModifiers: {}
|
|
27
26
|
}),
|
|
28
|
-
emits: /* @__PURE__ */
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
27
|
+
emits: /* @__PURE__ */ le(["select", "clear", "close"], ["update:modelValue"]),
|
|
28
|
+
setup(c, { expose: ne, emit: se }) {
|
|
29
|
+
const k = Z(Me, void 0), B = Z(_e, void 0), N = se, s = c, v = me(c, "modelValue"), b = U(""), A = fe(), G = o(() => v.value && s.clearable && !s.disabled), x = U(!1), H = U(0), oe = o(() => Ie(s.options)), J = o(() => s.options.flatMap((e) => ie(e))), K = o(() => {
|
|
31
30
|
if (!b.value) return J.value;
|
|
32
31
|
const e = b.value.toLowerCase();
|
|
33
|
-
return J.value.filter((
|
|
34
|
-
}),
|
|
32
|
+
return J.value.filter((l) => l.label.toLowerCase().includes(e));
|
|
33
|
+
}), z = o(() => oe.value.find((e) => e.parent && !e.children && e.value === v.value)), re = o(() => {
|
|
35
34
|
const e = [];
|
|
36
|
-
let
|
|
37
|
-
for (;
|
|
38
|
-
e.unshift(
|
|
35
|
+
let l = z.value;
|
|
36
|
+
for (; l; )
|
|
37
|
+
e.unshift(l), l = l.parent;
|
|
39
38
|
return e;
|
|
40
|
-
}),
|
|
39
|
+
}), S = te(() => z.value), L = o(() => {
|
|
41
40
|
const e = [];
|
|
42
|
-
let
|
|
43
|
-
for (;
|
|
44
|
-
e.unshift(
|
|
41
|
+
let l = S.value;
|
|
42
|
+
for (; l; )
|
|
43
|
+
e.unshift(l), l = l.parent;
|
|
45
44
|
return e;
|
|
46
45
|
}), O = o(() => {
|
|
47
|
-
const e =
|
|
46
|
+
const e = S.value;
|
|
48
47
|
return e ? !e.children : !1;
|
|
49
|
-
}),
|
|
48
|
+
}), I = o(() => re.value.map((e) => e.label).join(` ${s.delimiter} `)), M = te(
|
|
50
49
|
() => (
|
|
51
50
|
// 如果有值,则取 currentNodes 的最后索引,否则为 0
|
|
52
|
-
|
|
51
|
+
z.value ? je(() => L.value.length - 1) : 0
|
|
53
52
|
)
|
|
54
53
|
), Q = o(() => s.options.filter((e) => !e.parent)), ue = o(() => {
|
|
55
|
-
const e =
|
|
54
|
+
const e = S.value;
|
|
56
55
|
return e ? e.children : Q.value;
|
|
57
56
|
}), W = o(() => ({ height: `calc(${s.height} - 44px)` }));
|
|
58
|
-
function
|
|
59
|
-
s.disabled || (
|
|
57
|
+
function T() {
|
|
58
|
+
s.disabled || (x.value = !0, H.value++, setTimeout(() => {
|
|
60
59
|
Y();
|
|
61
|
-
},
|
|
60
|
+
}, 500));
|
|
62
61
|
}
|
|
63
62
|
function X() {
|
|
64
|
-
|
|
63
|
+
x.value = !1, N("close");
|
|
65
64
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
65
|
+
function _() {
|
|
66
|
+
N("clear", v.value), v.value = null;
|
|
68
67
|
}
|
|
69
68
|
function E(e) {
|
|
70
|
-
|
|
69
|
+
S.value = e, N("select", e), O.value ? (v.value = e.value, setTimeout(X, 100)) : M.value++, Pe(Y);
|
|
71
70
|
}
|
|
72
|
-
function ie(e,
|
|
73
|
-
const
|
|
74
|
-
function u(
|
|
71
|
+
function ie(e, l = "") {
|
|
72
|
+
const t = [];
|
|
73
|
+
function u(d, m) {
|
|
75
74
|
var q;
|
|
76
|
-
const V = m +
|
|
77
|
-
if ((q =
|
|
75
|
+
const V = m + d.label;
|
|
76
|
+
if ((q = d.children) != null && q.length) {
|
|
78
77
|
const ce = `${V} ${s.delimiter} `;
|
|
79
|
-
for (const de of
|
|
78
|
+
for (const de of d.children)
|
|
80
79
|
u(de, ce);
|
|
81
80
|
return;
|
|
82
81
|
}
|
|
83
|
-
|
|
82
|
+
t.push({ ...d, label: V });
|
|
84
83
|
}
|
|
85
|
-
return u(e,
|
|
84
|
+
return u(e, l), t;
|
|
86
85
|
}
|
|
87
86
|
function Y() {
|
|
88
|
-
var
|
|
89
|
-
const { page: e } =
|
|
90
|
-
(u = (
|
|
87
|
+
var l, t, u;
|
|
88
|
+
const { page: e } = Re();
|
|
89
|
+
(u = (t = (l = e == null ? void 0 : e.selectComponent) == null ? void 0 : l.call(e, `#${A}`)) == null ? void 0 : t.resize) == null || u.call(t);
|
|
91
90
|
}
|
|
92
91
|
return ne({
|
|
93
|
-
present:
|
|
94
|
-
clear:
|
|
92
|
+
present: T,
|
|
93
|
+
clear: _
|
|
95
94
|
}), ee(() => {
|
|
96
|
-
|
|
95
|
+
B && (B.required.value = s.required, B.disabled.value = s.disabled);
|
|
97
96
|
}), ee(() => {
|
|
98
|
-
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
-
present:
|
|
102
|
-
label:
|
|
97
|
+
k && (k.clickable.value = !s.disabled);
|
|
98
|
+
}), k == null || k.onTap(T), (e, l) => (a(), r(h, null, [
|
|
99
|
+
Ae(e.$slots, "default", {
|
|
100
|
+
present: T,
|
|
101
|
+
label: I.value
|
|
103
102
|
}, () => [
|
|
104
|
-
|
|
103
|
+
j("view", {
|
|
105
104
|
class: F(["sun-cascader", {
|
|
106
|
-
"sun-cascader-required":
|
|
107
|
-
"sun-cascader-disabled":
|
|
105
|
+
"sun-cascader-required": c.required,
|
|
106
|
+
"sun-cascader-disabled": c.disabled
|
|
108
107
|
}]),
|
|
109
|
-
onTap:
|
|
108
|
+
onTap: l[1] || (l[1] = (t) => T())
|
|
110
109
|
}, [
|
|
111
|
-
|
|
110
|
+
I.value ? (a(), r("view", Ge, y(I.value), 1)) : (a(), r("view", He, y(c.placeholder), 1)),
|
|
112
111
|
G.value ? (a(), f(n(g), {
|
|
113
112
|
key: 2,
|
|
114
113
|
class: "sun-cascader-clear-icon",
|
|
115
114
|
name: "close-circle",
|
|
116
|
-
onTap:
|
|
117
|
-
})) :
|
|
118
|
-
|
|
115
|
+
onTap: l[0] || (l[0] = ae((t) => _(), ["stop"]))
|
|
116
|
+
})) : w("", !0),
|
|
117
|
+
p(n(g), {
|
|
119
118
|
class: "sun-cascader-icon",
|
|
120
119
|
name: "chevron-expand-outline"
|
|
121
120
|
})
|
|
122
121
|
], 34)
|
|
123
122
|
]),
|
|
124
|
-
|
|
125
|
-
default:
|
|
126
|
-
|
|
127
|
-
show:
|
|
128
|
-
"onUpdate:show":
|
|
123
|
+
p(n(Ee), { hook: "created" }, {
|
|
124
|
+
default: i(() => [
|
|
125
|
+
p(n(qe), {
|
|
126
|
+
show: x.value,
|
|
127
|
+
"onUpdate:show": l[5] || (l[5] = (t) => x.value = t),
|
|
129
128
|
class: "sun-cascader-modal",
|
|
130
|
-
title:
|
|
131
|
-
"
|
|
132
|
-
onClose:
|
|
133
|
-
onTap:
|
|
129
|
+
title: c.placeholder,
|
|
130
|
+
"with-actions": !1,
|
|
131
|
+
onClose: l[6] || (l[6] = (t) => X()),
|
|
132
|
+
onTap: l[7] || (l[7] = ae(() => {
|
|
134
133
|
}, ["stop"]))
|
|
135
134
|
}, P({
|
|
136
|
-
default:
|
|
137
|
-
|
|
135
|
+
default: i(() => [
|
|
136
|
+
c.searchable ? (a(), f(n(Ue), {
|
|
138
137
|
key: 0,
|
|
139
138
|
modelValue: b.value,
|
|
140
|
-
"onUpdate:modelValue":
|
|
139
|
+
"onUpdate:modelValue": l[3] || (l[3] = (t) => b.value = t),
|
|
141
140
|
placeholder: "输入关键字搜索"
|
|
142
|
-
}, null, 8, ["modelValue"])) :
|
|
141
|
+
}, null, 8, ["modelValue"])) : w("", !0),
|
|
143
142
|
b.value ? (a(), r("view", {
|
|
144
143
|
key: 1,
|
|
145
144
|
class: "sun-cascader-options",
|
|
146
|
-
style: R({ height:
|
|
145
|
+
style: R({ height: c.height })
|
|
147
146
|
}, [
|
|
148
|
-
(a(!0), r(
|
|
147
|
+
(a(!0), r(h, null, $(K.value, (t, u) => (a(), f(n(D), {
|
|
149
148
|
key: u,
|
|
150
|
-
class: F(["sun-cascader-option", { "sun-cascader-option-active":
|
|
149
|
+
class: F(["sun-cascader-option", { "sun-cascader-option-active": t.value === v.value }]),
|
|
151
150
|
clickable: !0,
|
|
152
|
-
onTap: (
|
|
151
|
+
onTap: (d) => E(t)
|
|
153
152
|
}, P({
|
|
154
|
-
default:
|
|
155
|
-
|
|
153
|
+
default: i(() => [
|
|
154
|
+
C(y(t.label) + " ", 1)
|
|
156
155
|
]),
|
|
157
156
|
_: 2
|
|
158
157
|
}, [
|
|
159
|
-
|
|
158
|
+
t.value === v.value ? {
|
|
160
159
|
name: "end",
|
|
161
|
-
fn:
|
|
162
|
-
|
|
160
|
+
fn: i(() => [
|
|
161
|
+
p(n(g), {
|
|
163
162
|
class: "sun-cascader-option-icon",
|
|
164
163
|
name: "checkmark"
|
|
165
164
|
})
|
|
@@ -167,45 +166,45 @@ const Re = he, k = be, a = ke, r = ye, y = we, n = Te, ae = xe, f = Se, w = Ve,
|
|
|
167
166
|
key: "0"
|
|
168
167
|
} : void 0
|
|
169
168
|
]), 1032, ["class", "onTap"]))), 128)),
|
|
170
|
-
K.value.length ?
|
|
171
|
-
], 4)) : (a(), r(
|
|
169
|
+
K.value.length ? w("", !0) : (a(), f(n(De), { key: 0 }))
|
|
170
|
+
], 4)) : (a(), r(h, { key: 2 }, [
|
|
172
171
|
H.value ? (a(), r("van-tabs", {
|
|
173
172
|
key: 0,
|
|
174
173
|
id: n(A),
|
|
175
174
|
class: "sun-cascader-tabs",
|
|
176
|
-
active: n(
|
|
175
|
+
active: n(M),
|
|
177
176
|
"line-width": "30px",
|
|
178
177
|
"line-height": "4px",
|
|
179
178
|
animated: "true",
|
|
180
|
-
onChange:
|
|
179
|
+
onChange: l[4] || (l[4] = (t) => M.value = t.detail.index)
|
|
181
180
|
}, [
|
|
182
|
-
(a(!0), r(
|
|
183
|
-
var
|
|
181
|
+
(a(!0), r(h, null, $(L.value, (t, u) => {
|
|
182
|
+
var d;
|
|
184
183
|
return a(), r("van-tab", {
|
|
185
|
-
key:
|
|
184
|
+
key: t.value,
|
|
186
185
|
name: u,
|
|
187
186
|
class: "sun-cascader-tab",
|
|
188
|
-
title:
|
|
187
|
+
title: t.label
|
|
189
188
|
}, [
|
|
190
|
-
|
|
189
|
+
j("view", {
|
|
191
190
|
class: "sun-cascader-options",
|
|
192
191
|
style: R(W.value)
|
|
193
192
|
}, [
|
|
194
|
-
(a(!0), r(
|
|
193
|
+
(a(!0), r(h, null, $(((d = t.parent) == null ? void 0 : d.children) || Q.value, (m, V) => (a(), f(n(D), {
|
|
195
194
|
key: V,
|
|
196
|
-
class: F(["sun-cascader-option", { "sun-cascader-option-active":
|
|
195
|
+
class: F(["sun-cascader-option", { "sun-cascader-option-active": t.value === m.value }]),
|
|
197
196
|
clickable: !0,
|
|
198
197
|
onTap: (q) => E(m)
|
|
199
198
|
}, P({
|
|
200
|
-
default:
|
|
201
|
-
|
|
199
|
+
default: i(() => [
|
|
200
|
+
C(y(m.label) + " ", 1)
|
|
202
201
|
]),
|
|
203
202
|
_: 2
|
|
204
203
|
}, [
|
|
205
|
-
|
|
204
|
+
t.value === m.value ? {
|
|
206
205
|
name: "end",
|
|
207
|
-
fn:
|
|
208
|
-
|
|
206
|
+
fn: i(() => [
|
|
207
|
+
p(n(g), {
|
|
209
208
|
class: "sun-cascader-option-icon",
|
|
210
209
|
name: "checkmark"
|
|
211
210
|
})
|
|
@@ -214,44 +213,52 @@ const Re = he, k = be, a = ke, r = ye, y = we, n = Te, ae = xe, f = Se, w = Ve,
|
|
|
214
213
|
} : void 0
|
|
215
214
|
]), 1032, ["class", "onTap"]))), 128))
|
|
216
215
|
], 4)
|
|
217
|
-
], 8,
|
|
216
|
+
], 8, Ke);
|
|
218
217
|
}), 128)),
|
|
219
|
-
O.value ?
|
|
218
|
+
O.value ? w("", !0) : (a(), r("van-tab", {
|
|
220
219
|
key: 0,
|
|
221
|
-
name:
|
|
220
|
+
name: L.value.length,
|
|
222
221
|
class: "sun-cascader-tab",
|
|
223
222
|
title: "请选择",
|
|
224
223
|
"title-style": "color:var(--color-medium-tint);font-weight:normal;font-size:14px"
|
|
225
224
|
}, [
|
|
226
|
-
|
|
225
|
+
j("view", {
|
|
227
226
|
class: "sun-cascader-list",
|
|
228
227
|
style: R(W.value)
|
|
229
228
|
}, [
|
|
230
|
-
(a(!0), r(
|
|
231
|
-
key:
|
|
229
|
+
(a(!0), r(h, null, $(ue.value, (t) => (a(), f(n(D), {
|
|
230
|
+
key: t.value,
|
|
232
231
|
class: "sun-cascader-option",
|
|
233
232
|
clickable: !0,
|
|
234
|
-
onTap: (u) => E(
|
|
233
|
+
onTap: (u) => E(t)
|
|
235
234
|
}, {
|
|
236
|
-
default:
|
|
237
|
-
|
|
235
|
+
default: i(() => [
|
|
236
|
+
C(y(t.label), 1)
|
|
238
237
|
]),
|
|
239
238
|
_: 2
|
|
240
239
|
}, 1032, ["onTap"]))), 128))
|
|
241
240
|
], 4)
|
|
242
|
-
], 8,
|
|
243
|
-
], 40,
|
|
241
|
+
], 8, Oe))
|
|
242
|
+
], 40, Je)) : w("", !0)
|
|
244
243
|
], 64))
|
|
245
244
|
]),
|
|
246
245
|
_: 2
|
|
247
246
|
}, [
|
|
248
247
|
G.value ? {
|
|
249
248
|
name: "extra",
|
|
250
|
-
fn:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
249
|
+
fn: i(() => [
|
|
250
|
+
p(n(Fe), {
|
|
251
|
+
size: "xsmall",
|
|
252
|
+
fill: "clear",
|
|
253
|
+
color: "medium",
|
|
254
|
+
shape: "round",
|
|
255
|
+
onTap: l[2] || (l[2] = (t) => _())
|
|
256
|
+
}, {
|
|
257
|
+
default: i(() => [...l[8] || (l[8] = [
|
|
258
|
+
C("清除", -1)
|
|
259
|
+
])]),
|
|
260
|
+
_: 1
|
|
261
|
+
})
|
|
255
262
|
]),
|
|
256
263
|
key: "0"
|
|
257
264
|
} : void 0
|
|
@@ -263,5 +270,5 @@ const Re = he, k = be, a = ke, r = ye, y = we, n = Te, ae = xe, f = Se, w = Ve,
|
|
|
263
270
|
}
|
|
264
271
|
});
|
|
265
272
|
export {
|
|
266
|
-
|
|
273
|
+
el as default
|
|
267
274
|
};
|