@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/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 te, renderSlot as he, toDisplayString as be, openBlock as ke, createElementBlock as ye, createCommentVNode as we, unref as Te, withModifiers as xe, createBlock as Se, createVNode as Ve, normalizeClass as ge, createElementVNode as Ce, renderList as $e, createTextVNode as Ne, withCtx as Be, createSlots as Le, normalizeStyle as _e } from "vue";
2
- import { tree2list as ze } from "@solar-kit/core";
3
- import { SUN_ITEM as Ie, SUN_FIELD as Me, SunIcon as g, SunLazyRender as Ee, SunSearchbar as qe, SunItem as D, SunListPlaceholder as Ue } from "@solar-taro/ui-sun";
4
- import { SunModal as De } from "@solar-taro/ui-vant";
5
- import { linkedRef as le, untracked as Fe } from "@solar-vue/core";
6
- import { nextTick as je, getCurrentInstance as Pe } from "@tarojs/taro";
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
- }, Ge = {
9
+ }, He = {
11
10
  key: 1,
12
11
  class: "sun-cascader-placeholder"
13
- }, He = ["id", "active"], Je = ["name", "title"], Ke = ["name"], et = /* @__PURE__ */ ve({
12
+ }, Je = ["id", "active"], Ke = ["name", "title"], Oe = ["name"], el = /* @__PURE__ */ ve({
14
13
  __name: "index",
15
- props: /* @__PURE__ */ te({
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__ */ te(["select", "clear", "close"], ["update:modelValue"]),
29
- setup(i, { expose: ne, emit: se }) {
30
- const h = Z(Ie, void 0), N = Z(Me, void 0), B = se, s = i, v = me(i, "modelValue"), b = U(""), A = fe(), G = o(() => v.value && s.clearable && !s.disabled), T = U(!1), H = U(0), oe = o(() => ze(s.options)), J = o(() => s.options.flatMap((e) => ie(e))), K = o(() => {
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((t) => t.label.toLowerCase().includes(e));
34
- }), L = o(() => oe.value.find((e) => e.parent && !e.children && e.value === v.value)), re = o(() => {
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 t = L.value;
37
- for (; t; )
38
- e.unshift(t), t = t.parent;
35
+ let l = z.value;
36
+ for (; l; )
37
+ e.unshift(l), l = l.parent;
39
38
  return e;
40
- }), x = le(() => L.value), _ = o(() => {
39
+ }), S = te(() => z.value), L = o(() => {
41
40
  const e = [];
42
- let t = x.value;
43
- for (; t; )
44
- e.unshift(t), t = t.parent;
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 = x.value;
46
+ const e = S.value;
48
47
  return e ? !e.children : !1;
49
- }), z = o(() => re.value.map((e) => e.label).join(` ${s.delimiter} `)), I = le(
48
+ }), I = o(() => re.value.map((e) => e.label).join(` ${s.delimiter} `)), M = te(
50
49
  () => (
51
50
  // 如果有值,则取 currentNodes 的最后索引,否则为 0
52
- L.value ? Fe(() => _.value.length - 1) : 0
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 = x.value;
54
+ const e = S.value;
56
55
  return e ? e.children : Q.value;
57
56
  }), W = o(() => ({ height: `calc(${s.height} - 44px)` }));
58
- function S() {
59
- s.disabled || (T.value = !0, H.value++, setTimeout(() => {
57
+ function T() {
58
+ s.disabled || (x.value = !0, H.value++, setTimeout(() => {
60
59
  Y();
61
- }, 300));
60
+ }, 500));
62
61
  }
63
62
  function X() {
64
- T.value = !1, B("close");
63
+ x.value = !1, N("close");
65
64
  }
66
- function M() {
67
- B("clear", v.value), v.value = null;
65
+ function _() {
66
+ N("clear", v.value), v.value = null;
68
67
  }
69
68
  function E(e) {
70
- x.value = e, B("select", e), O.value ? (v.value = e.value, setTimeout(X, 100)) : I.value++, je(Y);
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, t = "") {
73
- const l = [];
74
- function u(c, m) {
71
+ function ie(e, l = "") {
72
+ const t = [];
73
+ function u(d, m) {
75
74
  var q;
76
- const V = m + c.label;
77
- if ((q = c.children) != null && q.length) {
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 c.children)
78
+ for (const de of d.children)
80
79
  u(de, ce);
81
80
  return;
82
81
  }
83
- l.push({ ...c, label: V });
82
+ t.push({ ...d, label: V });
84
83
  }
85
- return u(e, t), l;
84
+ return u(e, l), t;
86
85
  }
87
86
  function Y() {
88
- var t, l, u;
89
- const { page: e } = Pe();
90
- (u = (l = (t = e == null ? void 0 : e.selectComponent) == null ? void 0 : t.call(e, `#${A}`)) == null ? void 0 : l.resize) == null || u.call(l);
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: S,
94
- clear: M
92
+ present: T,
93
+ clear: _
95
94
  }), ee(() => {
96
- N && (N.required.value = s.required, N.disabled.value = s.disabled);
95
+ B && (B.required.value = s.required, B.disabled.value = s.disabled);
97
96
  }), ee(() => {
98
- h && (h.clickable.value = !s.disabled);
99
- }), h == null || h.onTap(S), (e, t) => (a(), r(p, null, [
100
- Re(e.$slots, "default", {
101
- present: S,
102
- label: z.value
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
- C("view", {
103
+ j("view", {
105
104
  class: F(["sun-cascader", {
106
- "sun-cascader-required": i.required,
107
- "sun-cascader-disabled": i.disabled
105
+ "sun-cascader-required": c.required,
106
+ "sun-cascader-disabled": c.disabled
108
107
  }]),
109
- onTap: t[1] || (t[1] = (l) => S())
108
+ onTap: l[1] || (l[1] = (t) => T())
110
109
  }, [
111
- z.value ? (a(), r("view", Ae, k(z.value), 1)) : (a(), r("view", Ge, k(i.placeholder), 1)),
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: t[0] || (t[0] = ae((l) => M(), ["stop"]))
117
- })) : y("", !0),
118
- w(n(g), {
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
- w(n(Ee), { hook: "created" }, {
125
- default: d(() => [
126
- w(n(De), {
127
- show: T.value,
128
- "onUpdate:show": t[5] || (t[5] = (l) => T.value = l),
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: i.placeholder,
131
- "show-buttons": !1,
132
- onClose: t[6] || (t[6] = (l) => X()),
133
- onTap: t[7] || (t[7] = ae(() => {
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: d(() => [
137
- i.searchable ? (a(), f(n(qe), {
135
+ default: i(() => [
136
+ c.searchable ? (a(), f(n(Ue), {
138
137
  key: 0,
139
138
  modelValue: b.value,
140
- "onUpdate:modelValue": t[3] || (t[3] = (l) => b.value = l),
139
+ "onUpdate:modelValue": l[3] || (l[3] = (t) => b.value = t),
141
140
  placeholder: "输入关键字搜索"
142
- }, null, 8, ["modelValue"])) : y("", !0),
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: i.height })
145
+ style: R({ height: c.height })
147
146
  }, [
148
- (a(!0), r(p, null, $(K.value, (l, u) => (a(), f(n(D), {
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": l.value === v.value }]),
149
+ class: F(["sun-cascader-option", { "sun-cascader-option-active": t.value === v.value }]),
151
150
  clickable: !0,
152
- onTap: (c) => E(l)
151
+ onTap: (d) => E(t)
153
152
  }, P({
154
- default: d(() => [
155
- j(k(l.label) + " ", 1)
153
+ default: i(() => [
154
+ C(y(t.label) + " ", 1)
156
155
  ]),
157
156
  _: 2
158
157
  }, [
159
- l.value === v.value ? {
158
+ t.value === v.value ? {
160
159
  name: "end",
161
- fn: d(() => [
162
- w(n(g), {
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 ? y("", !0) : (a(), f(n(Ue), { key: 0 }))
171
- ], 4)) : (a(), r(p, { key: 2 }, [
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(I),
175
+ active: n(M),
177
176
  "line-width": "30px",
178
177
  "line-height": "4px",
179
178
  animated: "true",
180
- onChange: t[4] || (t[4] = (l) => I.value = l.detail.index)
179
+ onChange: l[4] || (l[4] = (t) => M.value = t.detail.index)
181
180
  }, [
182
- (a(!0), r(p, null, $(_.value, (l, u) => {
183
- var c;
181
+ (a(!0), r(h, null, $(L.value, (t, u) => {
182
+ var d;
184
183
  return a(), r("van-tab", {
185
- key: l.value,
184
+ key: t.value,
186
185
  name: u,
187
186
  class: "sun-cascader-tab",
188
- title: l.label
187
+ title: t.label
189
188
  }, [
190
- C("view", {
189
+ j("view", {
191
190
  class: "sun-cascader-options",
192
191
  style: R(W.value)
193
192
  }, [
194
- (a(!0), r(p, null, $(((c = l.parent) == null ? void 0 : c.children) || Q.value, (m, V) => (a(), f(n(D), {
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": l.value === m.value }]),
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: d(() => [
201
- j(k(m.label) + " ", 1)
199
+ default: i(() => [
200
+ C(y(m.label) + " ", 1)
202
201
  ]),
203
202
  _: 2
204
203
  }, [
205
- l.value === m.value ? {
204
+ t.value === m.value ? {
206
205
  name: "end",
207
- fn: d(() => [
208
- w(n(g), {
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, Je);
216
+ ], 8, Ke);
218
217
  }), 128)),
219
- O.value ? y("", !0) : (a(), r("van-tab", {
218
+ O.value ? w("", !0) : (a(), r("van-tab", {
220
219
  key: 0,
221
- name: _.value.length,
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
- C("view", {
225
+ j("view", {
227
226
  class: "sun-cascader-list",
228
227
  style: R(W.value)
229
228
  }, [
230
- (a(!0), r(p, null, $(ue.value, (l) => (a(), f(n(D), {
231
- key: l.value,
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(l)
233
+ onTap: (u) => E(t)
235
234
  }, {
236
- default: d(() => [
237
- j(k(l.label), 1)
235
+ default: i(() => [
236
+ C(y(t.label), 1)
238
237
  ]),
239
238
  _: 2
240
239
  }, 1032, ["onTap"]))), 128))
241
240
  ], 4)
242
- ], 8, Ke))
243
- ], 40, He)) : y("", !0)
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: d(() => [
251
- C("view", {
252
- class: "sun-cascader-clear-btn",
253
- onTap: t[2] || (t[2] = (l) => M())
254
- }, "清除", 32)
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
- et as default
273
+ el as default
267
274
  };