h5-tdsign-for-vue 0.1.0 → 0.1.1
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/README.md +155 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +106 -0
- package/dist/index.js +539 -410
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { Input as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
1
|
+
import { ref as M, computed as S, defineComponent as F, toRef as z, createElementBlock as $, openBlock as v, createVNode as T, unref as m, mergeProps as w, h as Y, createSlots as K, renderList as j, withCtx as x, renderSlot as A, normalizeProps as D, guardReactiveProps as W, isRef as oe, watch as G, createElementVNode as ne, createBlock as C, createCommentVNode as E, nextTick as ee, Fragment as H, resolveDynamicComponent as N, createTextVNode as J, toDisplayString as Q, toRaw as ie } from "vue";
|
|
2
|
+
import { Input as R, Icon as Z, Popup as X, Picker as ue, DateTimePicker as de, Cascader as ce, TreeSelect as fe, Upload as te, Message as q, Form as pe, FormItem as me, Button as ae, Stepper as ye, CheckboxGroup as be, RadioGroup as ve, Switch as he, Textarea as Be, Navbar as ge, TabBar as xe, TabBarItem as Ve } from "tdesign-mobile-vue";
|
|
3
|
+
function re(a) {
|
|
4
|
+
const g = M(!1), r = S(() => {
|
|
5
|
+
const y = a.modelValue.value;
|
|
6
|
+
if (y == null || y === "")
|
|
7
7
|
return "";
|
|
8
|
-
const
|
|
9
|
-
return
|
|
8
|
+
const p = a.findLabel(a.options.value, y);
|
|
9
|
+
return p !== null ? p : a.displayLabel?.value ? a.displayLabel.value : String(y);
|
|
10
10
|
});
|
|
11
11
|
return {
|
|
12
|
-
visible:
|
|
13
|
-
displayValue:
|
|
12
|
+
visible: g,
|
|
13
|
+
displayValue: r,
|
|
14
14
|
openPopup: () => {
|
|
15
|
-
|
|
15
|
+
g.value = !0;
|
|
16
16
|
},
|
|
17
17
|
closePopup: () => {
|
|
18
|
-
|
|
18
|
+
g.value = !1;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
const
|
|
22
|
+
const Se = { class: "smart-select" }, ke = {
|
|
23
23
|
name: "SmartSelect"
|
|
24
|
-
},
|
|
25
|
-
...
|
|
24
|
+
}, Pe = /* @__PURE__ */ F({
|
|
25
|
+
...ke,
|
|
26
26
|
props: {
|
|
27
27
|
modelValue: { type: [String, Number, Boolean], default: "" },
|
|
28
28
|
columns: { type: [Array, Function], default: () => [] },
|
|
@@ -87,64 +87,64 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
87
87
|
onOpened: {}
|
|
88
88
|
},
|
|
89
89
|
emits: ["update:modelValue", "change", "confirm", "cancel"],
|
|
90
|
-
setup(
|
|
91
|
-
const
|
|
90
|
+
setup(a, { emit: g }) {
|
|
91
|
+
const r = a, c = g, f = (s, t) => {
|
|
92
92
|
let o = [];
|
|
93
|
-
Array.isArray(
|
|
93
|
+
Array.isArray(s) && (s.length > 0 && Array.isArray(s[0]) ? o = s.flat() : o = s);
|
|
94
94
|
const e = o.find((l) => l.value === t);
|
|
95
95
|
return e ? e.label : null;
|
|
96
|
-
}, { visible:
|
|
97
|
-
modelValue:
|
|
98
|
-
options:
|
|
99
|
-
findLabel: (
|
|
100
|
-
displayLabel:
|
|
101
|
-
}),
|
|
102
|
-
const
|
|
103
|
-
return
|
|
104
|
-
t[o] !== void 0 && (
|
|
105
|
-
}),
|
|
106
|
-
}),
|
|
107
|
-
const
|
|
108
|
-
return
|
|
109
|
-
t[o] !== void 0 && (
|
|
110
|
-
}),
|
|
111
|
-
}),
|
|
112
|
-
const o =
|
|
113
|
-
o !== void 0 && typeof o != "object" &&
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
}, d = (
|
|
117
|
-
|
|
96
|
+
}, { visible: y, displayValue: p, openPopup: h, closePopup: B } = re({
|
|
97
|
+
modelValue: z(() => r.modelValue),
|
|
98
|
+
options: z(() => r.columns),
|
|
99
|
+
findLabel: (s, t) => f(s, t),
|
|
100
|
+
displayLabel: z(() => r.displayLabel)
|
|
101
|
+
}), I = ["attach", "closeBtn", "closeOnOverlayClick", "destroyOnClose", "duration", "overlayProps", "placement", "preventScrollThrough", "showOverlay", "transitionName", "zIndex"], k = S(() => {
|
|
102
|
+
const s = {}, t = r;
|
|
103
|
+
return I.forEach((o) => {
|
|
104
|
+
t[o] !== void 0 && (s[o] = t[o]);
|
|
105
|
+
}), s;
|
|
106
|
+
}), O = ["align", "autofocus", "borderless", "clearable", "clearTrigger", "disabled", "label", "layout", "maxcharacter", "maxlength", "name", "placeholder", "prefixIcon", "readonly", "size", "status", "suffix", "suffixIcon", "tips", "type"], P = S(() => {
|
|
107
|
+
const s = {}, t = r;
|
|
108
|
+
return O.forEach((o) => {
|
|
109
|
+
t[o] !== void 0 && (s[o] = t[o]);
|
|
110
|
+
}), s;
|
|
111
|
+
}), i = (s, t) => {
|
|
112
|
+
const o = s[0];
|
|
113
|
+
o !== void 0 && typeof o != "object" && c("update:modelValue", o), c("confirm", s, t), B();
|
|
114
|
+
}, b = (s) => {
|
|
115
|
+
c("cancel", s), B();
|
|
116
|
+
}, d = (s, t) => {
|
|
117
|
+
c("change", s, t);
|
|
118
118
|
};
|
|
119
|
-
return (
|
|
120
|
-
|
|
121
|
-
value: m(
|
|
119
|
+
return (s, t) => (v(), $("div", Se, [
|
|
120
|
+
T(m(R), w({
|
|
121
|
+
value: m(p),
|
|
122
122
|
onClick: m(h)
|
|
123
|
-
}, { ...
|
|
123
|
+
}, { ...s.$attrs, ...P.value }, {
|
|
124
124
|
readonly: "",
|
|
125
|
-
"suffix-icon": () =>
|
|
126
|
-
}),
|
|
127
|
-
|
|
125
|
+
"suffix-icon": () => Y(m(Z), { name: "chevron-right" })
|
|
126
|
+
}), K({ _: 2 }, [
|
|
127
|
+
j(s.$slots, (o, e) => ({
|
|
128
128
|
name: e,
|
|
129
|
-
fn:
|
|
130
|
-
|
|
129
|
+
fn: x((l) => [
|
|
130
|
+
A(s.$slots, e, D(W(l || {})), void 0, !0)
|
|
131
131
|
])
|
|
132
132
|
}))
|
|
133
133
|
]), 1040, ["value", "onClick", "suffix-icon"]),
|
|
134
|
-
|
|
135
|
-
modelValue: m(
|
|
136
|
-
"onUpdate:modelValue": t[0] || (t[0] = (o) => oe(
|
|
134
|
+
T(m(X), w({
|
|
135
|
+
modelValue: m(y),
|
|
136
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => oe(y) ? y.value = o : null),
|
|
137
137
|
placement: "bottom"
|
|
138
|
-
},
|
|
139
|
-
default:
|
|
140
|
-
|
|
141
|
-
value: [
|
|
142
|
-
columns:
|
|
143
|
-
title:
|
|
144
|
-
"cancel-btn":
|
|
145
|
-
"confirm-btn":
|
|
146
|
-
onConfirm:
|
|
147
|
-
onCancel:
|
|
138
|
+
}, k.value), {
|
|
139
|
+
default: x(() => [
|
|
140
|
+
T(m(ue), {
|
|
141
|
+
value: [a.modelValue],
|
|
142
|
+
columns: a.columns,
|
|
143
|
+
title: a.title,
|
|
144
|
+
"cancel-btn": a.cancelBtn,
|
|
145
|
+
"confirm-btn": a.confirmBtn,
|
|
146
|
+
onConfirm: i,
|
|
147
|
+
onCancel: b,
|
|
148
148
|
onChange: d
|
|
149
149
|
}, null, 8, ["value", "columns", "title", "cancel-btn", "confirm-btn"])
|
|
150
150
|
]),
|
|
@@ -152,15 +152,15 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
152
152
|
}, 16, ["modelValue"])
|
|
153
153
|
]));
|
|
154
154
|
}
|
|
155
|
-
}), U = (
|
|
156
|
-
const
|
|
157
|
-
for (const [
|
|
158
|
-
|
|
159
|
-
return
|
|
160
|
-
},
|
|
155
|
+
}), U = (a, g) => {
|
|
156
|
+
const r = a.__vccOpts || a;
|
|
157
|
+
for (const [c, f] of g)
|
|
158
|
+
r[c] = f;
|
|
159
|
+
return r;
|
|
160
|
+
}, Ce = /* @__PURE__ */ U(Pe, [["__scopeId", "data-v-af49dba1"]]), Ie = { class: "smart-time-picker" }, Oe = {
|
|
161
161
|
name: "SmartTimePicker"
|
|
162
|
-
},
|
|
163
|
-
...
|
|
162
|
+
}, Te = /* @__PURE__ */ F({
|
|
163
|
+
...Oe,
|
|
164
164
|
props: {
|
|
165
165
|
modelValue: { default: "" },
|
|
166
166
|
rules: { default: () => [] },
|
|
@@ -226,8 +226,8 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
226
226
|
onOpened: {}
|
|
227
227
|
},
|
|
228
228
|
emits: ["update:modelValue", "change", "confirm", "cancel", "pick"],
|
|
229
|
-
setup(
|
|
230
|
-
const
|
|
229
|
+
setup(a, { emit: g }) {
|
|
230
|
+
const r = a, c = g, f = M(!1), y = [
|
|
231
231
|
"attach",
|
|
232
232
|
"closeBtn",
|
|
233
233
|
"closeOnOverlayClick",
|
|
@@ -243,15 +243,15 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
243
243
|
"onClosed",
|
|
244
244
|
"onOpen",
|
|
245
245
|
"onOpened"
|
|
246
|
-
],
|
|
247
|
-
const
|
|
248
|
-
return
|
|
249
|
-
|
|
250
|
-
}),
|
|
251
|
-
}),
|
|
252
|
-
const { modelValue:
|
|
253
|
-
return
|
|
254
|
-
delete l[
|
|
246
|
+
], p = r, h = S(() => {
|
|
247
|
+
const s = {};
|
|
248
|
+
return y.forEach((t) => {
|
|
249
|
+
p[t] !== void 0 && (s[t] = p[t]);
|
|
250
|
+
}), s;
|
|
251
|
+
}), B = S(() => {
|
|
252
|
+
const { modelValue: s, title: t, inputFormat: o, ...e } = r, l = { ...e };
|
|
253
|
+
return y.forEach((u) => {
|
|
254
|
+
delete l[u];
|
|
255
255
|
}), [
|
|
256
256
|
"cancelBtn",
|
|
257
257
|
"confirmBtn",
|
|
@@ -264,48 +264,48 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
264
264
|
"start",
|
|
265
265
|
"steps",
|
|
266
266
|
"format"
|
|
267
|
-
].forEach((
|
|
268
|
-
}),
|
|
269
|
-
const { label:
|
|
270
|
-
return
|
|
271
|
-
delete
|
|
272
|
-
}),
|
|
273
|
-
}),
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
}, d = (
|
|
282
|
-
|
|
267
|
+
].forEach((u) => delete l[u]), o && (l.format = o), l;
|
|
268
|
+
}), I = S(() => {
|
|
269
|
+
const { label: s, placeholder: t, rules: o, required: e, modelValue: l, ...n } = r, u = { ...n };
|
|
270
|
+
return y.forEach((V) => {
|
|
271
|
+
delete u[V];
|
|
272
|
+
}), u;
|
|
273
|
+
}), k = S(() => String(r.modelValue || "")), O = () => {
|
|
274
|
+
f.value = !0;
|
|
275
|
+
}, P = (s) => {
|
|
276
|
+
c("update:modelValue", s), c("confirm", s), f.value = !1;
|
|
277
|
+
}, i = (s) => {
|
|
278
|
+
c("cancel", s), f.value = !1;
|
|
279
|
+
}, b = (s) => {
|
|
280
|
+
c("change", s);
|
|
281
|
+
}, d = (s) => {
|
|
282
|
+
c("pick", s);
|
|
283
283
|
};
|
|
284
|
-
return (
|
|
285
|
-
|
|
286
|
-
value:
|
|
287
|
-
onClick:
|
|
288
|
-
}, { ...
|
|
284
|
+
return (s, t) => (v(), $("div", Ie, [
|
|
285
|
+
T(m(R), w({
|
|
286
|
+
value: k.value,
|
|
287
|
+
onClick: O
|
|
288
|
+
}, { ...s.$attrs, ...B.value }, {
|
|
289
289
|
readonly: "",
|
|
290
|
-
"suffix-icon": () =>
|
|
291
|
-
}),
|
|
292
|
-
|
|
290
|
+
"suffix-icon": () => Y(m(Z), { name: "chevron-right" })
|
|
291
|
+
}), K({ _: 2 }, [
|
|
292
|
+
j(s.$slots, (o, e) => ({
|
|
293
293
|
name: e,
|
|
294
|
-
fn:
|
|
295
|
-
|
|
294
|
+
fn: x((l) => [
|
|
295
|
+
A(s.$slots, e, D(W(l || {})), void 0, !0)
|
|
296
296
|
])
|
|
297
297
|
}))
|
|
298
298
|
]), 1040, ["value", "suffix-icon"]),
|
|
299
|
-
|
|
300
|
-
modelValue:
|
|
301
|
-
"onUpdate:modelValue": t[0] || (t[0] = (o) =>
|
|
299
|
+
T(m(X), w({
|
|
300
|
+
modelValue: f.value,
|
|
301
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => f.value = o),
|
|
302
302
|
placement: "bottom"
|
|
303
303
|
}, h.value), {
|
|
304
|
-
default:
|
|
305
|
-
|
|
306
|
-
onConfirm:
|
|
307
|
-
onCancel:
|
|
308
|
-
onChange:
|
|
304
|
+
default: x(() => [
|
|
305
|
+
T(m(de), w({ value: a.modelValue }, I.value, {
|
|
306
|
+
onConfirm: P,
|
|
307
|
+
onCancel: i,
|
|
308
|
+
onChange: b,
|
|
309
309
|
onPick: d
|
|
310
310
|
}), null, 16, ["value"])
|
|
311
311
|
]),
|
|
@@ -313,10 +313,10 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
313
313
|
}, 16, ["modelValue"])
|
|
314
314
|
]));
|
|
315
315
|
}
|
|
316
|
-
}), le = /* @__PURE__ */ U(
|
|
316
|
+
}), le = /* @__PURE__ */ U(Te, [["__scopeId", "data-v-cf6cd38e"]]), $e = { class: "smart-cascader" }, we = {
|
|
317
317
|
name: "SmartCascader"
|
|
318
|
-
},
|
|
319
|
-
...
|
|
318
|
+
}, Ae = /* @__PURE__ */ F({
|
|
319
|
+
...we,
|
|
320
320
|
props: {
|
|
321
321
|
modelValue: { default: "" },
|
|
322
322
|
placeholder: { default: "请选择" },
|
|
@@ -366,73 +366,73 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
366
366
|
defaultValue: {}
|
|
367
367
|
},
|
|
368
368
|
emits: ["update:modelValue", "change", "pick", "close"],
|
|
369
|
-
setup(
|
|
370
|
-
const
|
|
369
|
+
setup(a, { emit: g }) {
|
|
370
|
+
const r = a, c = g, f = (t, o, e = []) => {
|
|
371
371
|
for (const l of t) {
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
return [...e, String(
|
|
372
|
+
const n = l.value ?? l.id, u = l.label ?? l.name;
|
|
373
|
+
if (n === o)
|
|
374
|
+
return [...e, String(u)];
|
|
375
375
|
if (l.children && l.children.length > 0) {
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
376
|
+
const V = f(l.children, o, [...e, String(u)]);
|
|
377
|
+
if (V) return V;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
return null;
|
|
381
|
-
},
|
|
382
|
-
const e =
|
|
381
|
+
}, y = (t, o) => {
|
|
382
|
+
const e = f(t, o);
|
|
383
383
|
return e ? e.join(" / ") : null;
|
|
384
|
-
}, { visible:
|
|
385
|
-
modelValue:
|
|
386
|
-
options:
|
|
387
|
-
findLabel:
|
|
388
|
-
displayLabel:
|
|
389
|
-
}),
|
|
390
|
-
const t = {}, o =
|
|
391
|
-
return
|
|
384
|
+
}, { visible: p, displayValue: h, openPopup: B, closePopup: I } = re({
|
|
385
|
+
modelValue: z(() => r.modelValue),
|
|
386
|
+
options: z(() => r.options || []),
|
|
387
|
+
findLabel: y,
|
|
388
|
+
displayLabel: z(() => r.displayLabel)
|
|
389
|
+
}), k = ["align", "autofocus", "borderless", "clearable", "clearTrigger", "disabled", "label", "layout", "maxcharacter", "maxlength", "name", "placeholder", "prefixIcon", "readonly", "size", "status", "suffix", "suffixIcon", "tips", "type"], O = S(() => {
|
|
390
|
+
const t = {}, o = r;
|
|
391
|
+
return k.forEach((e) => {
|
|
392
392
|
o[e] !== void 0 && (t[e] = o[e]);
|
|
393
393
|
}), t;
|
|
394
|
-
}),
|
|
395
|
-
const t = {}, o =
|
|
396
|
-
return
|
|
394
|
+
}), P = ["checkStrictly", "closeBtn", "header", "keys", "load", "middleContent", "options", "overlayProps", "subTitles", "theme", "title"], i = S(() => {
|
|
395
|
+
const t = {}, o = r;
|
|
396
|
+
return P.forEach((e) => {
|
|
397
397
|
o[e] !== void 0 && (t[e] = o[e]);
|
|
398
398
|
}), t;
|
|
399
|
-
}),
|
|
400
|
-
|
|
399
|
+
}), b = (t, o) => {
|
|
400
|
+
c("update:modelValue", t), c("change", t, o), I();
|
|
401
401
|
}, d = (t) => {
|
|
402
|
-
|
|
403
|
-
},
|
|
404
|
-
|
|
402
|
+
c("pick", t.value, t);
|
|
403
|
+
}, s = (t) => {
|
|
404
|
+
c("close", t), I();
|
|
405
405
|
};
|
|
406
|
-
return (t, o) => (
|
|
407
|
-
|
|
406
|
+
return (t, o) => (v(), $("div", $e, [
|
|
407
|
+
T(m(R), w({
|
|
408
408
|
value: m(h),
|
|
409
|
-
onClick: m(
|
|
410
|
-
}, { ...t.$attrs, ...
|
|
409
|
+
onClick: m(B)
|
|
410
|
+
}, { ...t.$attrs, ...O.value }, {
|
|
411
411
|
readonly: "",
|
|
412
|
-
"suffix-icon": () =>
|
|
413
|
-
}),
|
|
414
|
-
|
|
412
|
+
"suffix-icon": () => Y(m(Z), { name: "chevron-right" })
|
|
413
|
+
}), K({ _: 2 }, [
|
|
414
|
+
j(t.$slots, (e, l) => ({
|
|
415
415
|
name: l,
|
|
416
|
-
fn:
|
|
417
|
-
|
|
416
|
+
fn: x((n) => [
|
|
417
|
+
A(t.$slots, l, D(W(n || {})), void 0, !0)
|
|
418
418
|
])
|
|
419
419
|
}))
|
|
420
420
|
]), 1040, ["value", "onClick", "suffix-icon"]),
|
|
421
|
-
|
|
422
|
-
visible: m(
|
|
423
|
-
"onUpdate:visible": o[0] || (o[0] = (e) => oe(
|
|
424
|
-
value:
|
|
425
|
-
},
|
|
426
|
-
onChange:
|
|
421
|
+
T(m(ce), w({
|
|
422
|
+
visible: m(p),
|
|
423
|
+
"onUpdate:visible": o[0] || (o[0] = (e) => oe(p) ? p.value = e : null),
|
|
424
|
+
value: a.modelValue
|
|
425
|
+
}, i.value, {
|
|
426
|
+
onChange: b,
|
|
427
427
|
onPick: d,
|
|
428
|
-
onClose:
|
|
428
|
+
onClose: s
|
|
429
429
|
}), null, 16, ["visible", "value"])
|
|
430
430
|
]));
|
|
431
431
|
}
|
|
432
|
-
}),
|
|
432
|
+
}), Ee = /* @__PURE__ */ U(Ae, [["__scopeId", "data-v-f420c3ed"]]), Le = { class: "smart-tree-select" }, Re = { class: "tree-select-wrapper" }, Fe = {
|
|
433
433
|
name: "SmartTreeSelect"
|
|
434
|
-
},
|
|
435
|
-
...
|
|
434
|
+
}, Ue = /* @__PURE__ */ F({
|
|
435
|
+
...Fe,
|
|
436
436
|
props: {
|
|
437
437
|
modelValue: {},
|
|
438
438
|
options: { default: () => [] },
|
|
@@ -491,8 +491,8 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
491
491
|
onOpened: {}
|
|
492
492
|
},
|
|
493
493
|
emits: ["update:modelValue", "change", "close"],
|
|
494
|
-
setup(
|
|
495
|
-
const
|
|
494
|
+
setup(a, { emit: g }) {
|
|
495
|
+
const r = a, c = g, f = M(!1), y = [
|
|
496
496
|
"attach",
|
|
497
497
|
"closeBtn",
|
|
498
498
|
"closeOnOverlayClick",
|
|
@@ -508,144 +508,144 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
508
508
|
"onClosed",
|
|
509
509
|
"onOpen",
|
|
510
510
|
"onOpened"
|
|
511
|
-
],
|
|
511
|
+
], p = [
|
|
512
512
|
"customStyle",
|
|
513
513
|
"filterable",
|
|
514
514
|
"height",
|
|
515
515
|
"keys",
|
|
516
516
|
"multiple",
|
|
517
517
|
"options"
|
|
518
|
-
], h =
|
|
518
|
+
], h = r, B = S(() => {
|
|
519
519
|
const e = {};
|
|
520
|
-
return
|
|
520
|
+
return y.forEach((l) => {
|
|
521
521
|
h[l] !== void 0 && (e[l] = h[l]);
|
|
522
522
|
}), e;
|
|
523
|
-
}),
|
|
524
|
-
const { modelValue: e, ...l } =
|
|
525
|
-
return
|
|
526
|
-
delete
|
|
527
|
-
}),
|
|
528
|
-
delete
|
|
529
|
-
}), delete
|
|
530
|
-
}),
|
|
523
|
+
}), I = S(() => {
|
|
524
|
+
const { modelValue: e, ...l } = r, n = { ...l };
|
|
525
|
+
return y.forEach((u) => {
|
|
526
|
+
delete n[u];
|
|
527
|
+
}), p.forEach((u) => {
|
|
528
|
+
delete n[u];
|
|
529
|
+
}), delete n.rules, delete n.required, delete n.title, n;
|
|
530
|
+
}), k = S(() => {
|
|
531
531
|
const e = {};
|
|
532
|
-
return
|
|
532
|
+
return p.forEach((l) => {
|
|
533
533
|
l !== "options" && h[l] !== void 0 && (e[l] = h[l]);
|
|
534
534
|
}), h.keys !== void 0 && (e.keys = h.keys), e;
|
|
535
|
-
}),
|
|
536
|
-
for (const
|
|
537
|
-
if (
|
|
538
|
-
return !
|
|
539
|
-
if (
|
|
540
|
-
const
|
|
541
|
-
if (
|
|
535
|
+
}), O = (e, l) => {
|
|
536
|
+
for (const n of e) {
|
|
537
|
+
if (n.value === l)
|
|
538
|
+
return !n.children || n.children.length === 0;
|
|
539
|
+
if (n.children && n.children.length > 0) {
|
|
540
|
+
const u = O(n.children, l);
|
|
541
|
+
if (u !== !1) return u;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
return !1;
|
|
545
|
-
},
|
|
546
|
-
for (const
|
|
547
|
-
if (
|
|
548
|
-
return [...
|
|
549
|
-
if (
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
545
|
+
}, P = (e, l, n = []) => {
|
|
546
|
+
for (const u of e) {
|
|
547
|
+
if (u.value === l)
|
|
548
|
+
return [...n, u.value];
|
|
549
|
+
if (u.children && u.children.length > 0) {
|
|
550
|
+
const V = P(u.children, l, [...n, u.value]);
|
|
551
|
+
if (V) return V;
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
return null;
|
|
555
|
-
},
|
|
555
|
+
}, i = M([]), b = (e) => Array.isArray(e) ? e.flatMap((l) => Array.isArray(l) ? l : [l]).filter(
|
|
556
556
|
(l) => typeof l == "string" || typeof l == "number"
|
|
557
557
|
) : e == null || e === "" ? [] : [e];
|
|
558
|
-
|
|
559
|
-
() =>
|
|
558
|
+
G(
|
|
559
|
+
() => r.modelValue,
|
|
560
560
|
(e) => {
|
|
561
561
|
if (Array.isArray(e))
|
|
562
|
-
|
|
562
|
+
i.value = b(e);
|
|
563
563
|
else if (e !== void 0 && e !== "" && e !== null) {
|
|
564
|
-
const l =
|
|
565
|
-
|
|
564
|
+
const l = r.options || [], n = P(l, e);
|
|
565
|
+
i.value = n || [];
|
|
566
566
|
} else
|
|
567
|
-
|
|
567
|
+
i.value = [];
|
|
568
568
|
},
|
|
569
569
|
{ immediate: !0 }
|
|
570
|
-
),
|
|
571
|
-
() =>
|
|
570
|
+
), G(
|
|
571
|
+
() => r.options,
|
|
572
572
|
() => {
|
|
573
|
-
const e =
|
|
573
|
+
const e = r.modelValue;
|
|
574
574
|
if (!Array.isArray(e) && e !== void 0 && e !== "" && e !== null) {
|
|
575
|
-
const l =
|
|
576
|
-
|
|
575
|
+
const l = r.options || [], n = P(l, e);
|
|
576
|
+
i.value = n || [];
|
|
577
577
|
}
|
|
578
578
|
},
|
|
579
579
|
{ deep: !0 }
|
|
580
580
|
);
|
|
581
581
|
const d = (e, l) => {
|
|
582
|
-
for (const
|
|
583
|
-
if (
|
|
584
|
-
return
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
582
|
+
for (const n of e) {
|
|
583
|
+
if (n.value === l)
|
|
584
|
+
return n.label || String(n.value);
|
|
585
|
+
if (n.children && n.children.length > 0) {
|
|
586
|
+
const u = d(n.children, l);
|
|
587
|
+
if (u) return u;
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
return null;
|
|
591
|
-
},
|
|
592
|
-
const e =
|
|
591
|
+
}, s = S(() => {
|
|
592
|
+
const e = r.modelValue;
|
|
593
593
|
if (!e && e !== 0)
|
|
594
594
|
return "";
|
|
595
|
-
const l =
|
|
595
|
+
const l = r.options || [];
|
|
596
596
|
if (Array.isArray(e)) {
|
|
597
|
-
const
|
|
598
|
-
return
|
|
597
|
+
const n = e[e.length - 1];
|
|
598
|
+
return n !== void 0 ? d(l, n) || String(n) : "";
|
|
599
599
|
}
|
|
600
600
|
return d(l, e) || String(e);
|
|
601
601
|
}), t = () => {
|
|
602
|
-
|
|
602
|
+
r.disabled || (f.value = !0);
|
|
603
603
|
}, o = (e, l) => {
|
|
604
604
|
if (Array.isArray(e)) {
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
const
|
|
608
|
-
|
|
605
|
+
const n = b(e), u = n[n.length - 1];
|
|
606
|
+
i.value = n;
|
|
607
|
+
const V = r.options || [];
|
|
608
|
+
O(V, u) && (c("update:modelValue", u), c("change", u, l), r.multiple || (f.value = !1));
|
|
609
609
|
} else
|
|
610
|
-
|
|
610
|
+
i.value = b(e), c("update:modelValue", e), c("change", e, l);
|
|
611
611
|
};
|
|
612
|
-
return (e, l) => (
|
|
613
|
-
|
|
614
|
-
value:
|
|
612
|
+
return (e, l) => (v(), $("div", Le, [
|
|
613
|
+
T(m(R), w({
|
|
614
|
+
value: s.value,
|
|
615
615
|
onClick: t
|
|
616
|
-
}, { ...e.$attrs, ...
|
|
616
|
+
}, { ...e.$attrs, ...I.value }, {
|
|
617
617
|
readonly: "",
|
|
618
|
-
"suffix-icon": () =>
|
|
619
|
-
}),
|
|
620
|
-
|
|
621
|
-
name:
|
|
622
|
-
fn:
|
|
623
|
-
|
|
618
|
+
"suffix-icon": () => Y(m(Z), { name: "chevron-right" })
|
|
619
|
+
}), K({ _: 2 }, [
|
|
620
|
+
j(e.$slots, (n, u) => ({
|
|
621
|
+
name: u,
|
|
622
|
+
fn: x((V) => [
|
|
623
|
+
A(e.$slots, u, D(W(V || {})), void 0, !0)
|
|
624
624
|
])
|
|
625
625
|
}))
|
|
626
626
|
]), 1040, ["value", "suffix-icon"]),
|
|
627
|
-
|
|
628
|
-
modelValue:
|
|
629
|
-
"onUpdate:modelValue": l[0] || (l[0] = (
|
|
627
|
+
T(m(X), w({
|
|
628
|
+
modelValue: f.value,
|
|
629
|
+
"onUpdate:modelValue": l[0] || (l[0] = (n) => f.value = n),
|
|
630
630
|
placement: "bottom"
|
|
631
|
-
},
|
|
632
|
-
default:
|
|
633
|
-
|
|
634
|
-
|
|
631
|
+
}, B.value), {
|
|
632
|
+
default: x(() => [
|
|
633
|
+
ne("div", Re, [
|
|
634
|
+
f.value ? (v(), C(m(fe), w({
|
|
635
635
|
key: 0,
|
|
636
|
-
value:
|
|
637
|
-
options:
|
|
638
|
-
},
|
|
636
|
+
value: i.value,
|
|
637
|
+
options: a.options
|
|
638
|
+
}, k.value, { onChange: o }), null, 16, ["value", "options"])) : E("", !0)
|
|
639
639
|
])
|
|
640
640
|
]),
|
|
641
641
|
_: 1
|
|
642
642
|
}, 16, ["modelValue"])
|
|
643
643
|
]));
|
|
644
644
|
}
|
|
645
|
-
}),
|
|
645
|
+
}), ze = /* @__PURE__ */ U(Ue, [["__scopeId", "data-v-4d44f50a"]]), Me = { class: "smart-upload" }, Ke = {
|
|
646
646
|
name: "SmartUpload"
|
|
647
|
-
},
|
|
648
|
-
...
|
|
647
|
+
}, je = /* @__PURE__ */ F({
|
|
648
|
+
...Ke,
|
|
649
649
|
props: {
|
|
650
650
|
modelValue: { default: "" },
|
|
651
651
|
valueType: {},
|
|
@@ -664,174 +664,174 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
664
664
|
formatResponse: {}
|
|
665
665
|
},
|
|
666
666
|
emits: ["update:modelValue", "success", "fail", "remove"],
|
|
667
|
-
setup(
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
670
|
-
const t =
|
|
667
|
+
setup(a, { emit: g }) {
|
|
668
|
+
const r = a, c = g, f = M([]), y = S(() => Array.isArray(r.accept) ? r.accept.join(",") : r.accept), p = S(() => {
|
|
669
|
+
if (r.valueType) return r.valueType;
|
|
670
|
+
const t = r.modelValue;
|
|
671
671
|
return typeof t == "string" ? "string" : Array.isArray(t) ? t.length === 0 ? "stringArray" : typeof t[0] == "object" && t[0] !== null ? "objectArray" : "stringArray" : "string";
|
|
672
|
-
}), h = (t) => /^(https?:|blob:|data:)/i.test(t),
|
|
672
|
+
}), h = (t) => /^(https?:|blob:|data:)/i.test(t), B = (t) => {
|
|
673
673
|
if (typeof t == "string") return t;
|
|
674
|
-
const o = t[
|
|
674
|
+
const o = t[r.urlKey];
|
|
675
675
|
return typeof o == "string" ? o : "";
|
|
676
|
-
},
|
|
677
|
-
if (typeof t == "object" && t[
|
|
678
|
-
const e = t[
|
|
676
|
+
}, I = (t, o) => {
|
|
677
|
+
if (typeof t == "object" && t[r.nameKey]) {
|
|
678
|
+
const e = t[r.nameKey];
|
|
679
679
|
return typeof e == "string" ? e : String(e);
|
|
680
680
|
}
|
|
681
681
|
return o.split("/").pop() || "";
|
|
682
|
-
},
|
|
682
|
+
}, k = (t) => !r.urlPrefix || !t ? t : t.startsWith(r.urlPrefix) ? t.slice(r.urlPrefix.length) : t, O = (t) => {
|
|
683
683
|
if (!t) return [];
|
|
684
684
|
let o = [];
|
|
685
|
-
return typeof t == "string" ? o = t.split(
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
688
|
-
const
|
|
689
|
-
url: h(
|
|
690
|
-
name:
|
|
685
|
+
return typeof t == "string" ? o = t.split(r.separator).filter(Boolean) : o = t.filter(Boolean), o.map((e, l) => {
|
|
686
|
+
const n = B(e);
|
|
687
|
+
if (!n) return null;
|
|
688
|
+
const V = {
|
|
689
|
+
url: h(n) ? n : r.urlPrefix + n,
|
|
690
|
+
name: I(e, n),
|
|
691
691
|
status: "success",
|
|
692
|
-
originalPath:
|
|
692
|
+
originalPath: n
|
|
693
693
|
};
|
|
694
|
-
return typeof e == "object" && (
|
|
694
|
+
return typeof e == "object" && (V.__rawResult__ = e), V;
|
|
695
695
|
}).filter(Boolean);
|
|
696
696
|
};
|
|
697
|
-
|
|
698
|
-
() =>
|
|
697
|
+
G(
|
|
698
|
+
() => r.modelValue,
|
|
699
699
|
(t) => {
|
|
700
|
-
const o =
|
|
700
|
+
const o = O(t), e = f.value.filter((n) => n.status === "success").map((n) => n.originalPath || n.url), l = o.map((n) => n.originalPath || n.url);
|
|
701
701
|
if (JSON.stringify(e) !== JSON.stringify(l)) {
|
|
702
|
-
const
|
|
703
|
-
|
|
702
|
+
const n = f.value.filter((u) => u.status !== "success");
|
|
703
|
+
f.value = [...o, ...n];
|
|
704
704
|
}
|
|
705
705
|
},
|
|
706
706
|
{ immediate: !0 }
|
|
707
707
|
);
|
|
708
|
-
const
|
|
709
|
-
const t =
|
|
708
|
+
const P = () => {
|
|
709
|
+
const t = f.value.filter((e) => e.status === "success");
|
|
710
710
|
let o;
|
|
711
|
-
switch (
|
|
711
|
+
switch (p.value) {
|
|
712
712
|
case "string":
|
|
713
|
-
o = t.map((e) =>
|
|
713
|
+
o = t.map((e) => k(e.originalPath || e.url || "")).filter(Boolean).join(r.separator);
|
|
714
714
|
break;
|
|
715
715
|
case "objectArray":
|
|
716
716
|
o = t.map((e) => {
|
|
717
717
|
if (e.__rawResult__ && typeof e.__rawResult__ == "object") {
|
|
718
|
-
const
|
|
718
|
+
const n = e.__rawResult__[r.urlKey];
|
|
719
719
|
return {
|
|
720
720
|
...e.__rawResult__,
|
|
721
|
-
[
|
|
721
|
+
[r.urlKey]: k(typeof n == "string" ? n : e.originalPath || e.url || "")
|
|
722
722
|
};
|
|
723
723
|
}
|
|
724
724
|
const l = {
|
|
725
|
-
[
|
|
725
|
+
[r.urlKey]: k(e.originalPath || e.url || "")
|
|
726
726
|
};
|
|
727
|
-
return
|
|
727
|
+
return r.nameKey && (l[r.nameKey] = e.name), l;
|
|
728
728
|
});
|
|
729
729
|
break;
|
|
730
730
|
default:
|
|
731
|
-
o = t.map((e) =>
|
|
731
|
+
o = t.map((e) => k(e.originalPath || e.url || "")).filter(Boolean);
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
|
-
|
|
735
|
-
},
|
|
734
|
+
c("update:modelValue", o);
|
|
735
|
+
}, i = (t) => {
|
|
736
736
|
const { file: o, response: e } = t;
|
|
737
737
|
if (console.log("[SmartUpload] onSuccess", { file: o, response: e }), o) {
|
|
738
738
|
let l = "";
|
|
739
|
-
if (
|
|
740
|
-
l =
|
|
739
|
+
if (r.formatResponse)
|
|
740
|
+
l = r.formatResponse(e);
|
|
741
741
|
else if (e && typeof e == "object") {
|
|
742
|
-
const
|
|
743
|
-
|
|
742
|
+
const n = Array.isArray(e) ? e[0] : e;
|
|
743
|
+
n && "url" in n && (l = n.url);
|
|
744
744
|
}
|
|
745
745
|
if (console.log("[SmartUpload] uploadResult:", l), l) {
|
|
746
|
-
const
|
|
747
|
-
let
|
|
748
|
-
if (
|
|
749
|
-
const
|
|
750
|
-
|
|
746
|
+
const n = typeof l == "object";
|
|
747
|
+
let u = "", V;
|
|
748
|
+
if (n) {
|
|
749
|
+
const L = l[r.urlKey];
|
|
750
|
+
u = typeof L == "string" ? L : "", V = l;
|
|
751
751
|
} else
|
|
752
|
-
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
console.log("[SmartUpload] fileIndex:",
|
|
757
|
-
...
|
|
752
|
+
u = l;
|
|
753
|
+
const _ = h(u) ? u : r.urlPrefix + u;
|
|
754
|
+
ee(() => {
|
|
755
|
+
const L = f.value.findIndex((se) => se.name === o.name);
|
|
756
|
+
console.log("[SmartUpload] fileIndex:", L), L >= 0 && (f.value[L] = {
|
|
757
|
+
...f.value[L],
|
|
758
758
|
status: "success",
|
|
759
|
-
url:
|
|
760
|
-
originalPath:
|
|
759
|
+
url: _,
|
|
760
|
+
originalPath: u,
|
|
761
761
|
// 对象数组模式下保存完整返回
|
|
762
|
-
__rawResult__:
|
|
763
|
-
}),
|
|
762
|
+
__rawResult__: V
|
|
763
|
+
}), P();
|
|
764
764
|
});
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
|
|
768
|
-
},
|
|
767
|
+
c("success", t);
|
|
768
|
+
}, b = (t) => {
|
|
769
769
|
const { file: o } = t;
|
|
770
770
|
if (o) {
|
|
771
|
-
const e =
|
|
772
|
-
e >= 0 &&
|
|
771
|
+
const e = f.value.findIndex((l) => l.name === o.name);
|
|
772
|
+
e >= 0 && f.value.splice(e, 1);
|
|
773
773
|
}
|
|
774
|
-
|
|
774
|
+
q.error("上传失败,请重试"), c("fail", t);
|
|
775
775
|
}, d = (t) => {
|
|
776
776
|
const { index: o = 0, file: e } = t;
|
|
777
|
-
|
|
778
|
-
|
|
777
|
+
c("remove", e, o), ee(() => {
|
|
778
|
+
P();
|
|
779
779
|
});
|
|
780
|
-
},
|
|
780
|
+
}, s = (t) => {
|
|
781
781
|
const { type: o, files: e } = t;
|
|
782
782
|
switch (console.log("[SmartUpload] onValidate", { type: o, files: e }), o) {
|
|
783
783
|
case "FILTER_FILE_SAME_NAME":
|
|
784
|
-
|
|
784
|
+
q.info("请勿上传重复的文件");
|
|
785
785
|
break;
|
|
786
786
|
case "FILE_OVER_SIZE_LIMIT":
|
|
787
|
-
|
|
787
|
+
q.error(`文件大小超过限制(最大 ${Math.round(r.maxSize / 1024)}MB)`);
|
|
788
788
|
break;
|
|
789
789
|
case "FILES_OVER_LENGTH_LIMIT":
|
|
790
|
-
|
|
790
|
+
q.info(`最多只能上传 ${r.max} 个文件`);
|
|
791
791
|
break;
|
|
792
792
|
}
|
|
793
793
|
};
|
|
794
|
-
return (t, o) => (
|
|
795
|
-
|
|
794
|
+
return (t, o) => (v(), $("div", Me, [
|
|
795
|
+
a.mode === "image" ? (v(), C(m(te), {
|
|
796
796
|
key: 0,
|
|
797
|
-
modelValue:
|
|
798
|
-
"onUpdate:modelValue": o[0] || (o[0] = (e) =>
|
|
799
|
-
action:
|
|
800
|
-
accept:
|
|
801
|
-
max:
|
|
802
|
-
"size-limit": { size:
|
|
803
|
-
multiple:
|
|
804
|
-
disabled:
|
|
805
|
-
"request-method":
|
|
806
|
-
onSuccess:
|
|
807
|
-
onFail:
|
|
797
|
+
modelValue: f.value,
|
|
798
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => f.value = e),
|
|
799
|
+
action: a.action,
|
|
800
|
+
accept: y.value,
|
|
801
|
+
max: a.max,
|
|
802
|
+
"size-limit": { size: a.maxSize, unit: "KB" },
|
|
803
|
+
multiple: a.multiple,
|
|
804
|
+
disabled: a.disabled,
|
|
805
|
+
"request-method": a.requestMethod,
|
|
806
|
+
onSuccess: i,
|
|
807
|
+
onFail: b,
|
|
808
808
|
onRemove: d,
|
|
809
|
-
onValidate:
|
|
810
|
-
}, null, 8, ["modelValue", "action", "accept", "max", "size-limit", "multiple", "disabled", "request-method"])) : (
|
|
809
|
+
onValidate: s
|
|
810
|
+
}, null, 8, ["modelValue", "action", "accept", "max", "size-limit", "multiple", "disabled", "request-method"])) : (v(), C(m(te), {
|
|
811
811
|
key: 1,
|
|
812
|
-
modelValue:
|
|
813
|
-
"onUpdate:modelValue": o[1] || (o[1] = (e) =>
|
|
814
|
-
action:
|
|
815
|
-
accept:
|
|
816
|
-
max:
|
|
817
|
-
"size-limit": { size:
|
|
818
|
-
multiple:
|
|
819
|
-
disabled:
|
|
820
|
-
"request-method":
|
|
821
|
-
onSuccess:
|
|
822
|
-
onFail:
|
|
812
|
+
modelValue: f.value,
|
|
813
|
+
"onUpdate:modelValue": o[1] || (o[1] = (e) => f.value = e),
|
|
814
|
+
action: a.action,
|
|
815
|
+
accept: y.value,
|
|
816
|
+
max: a.max,
|
|
817
|
+
"size-limit": { size: a.maxSize, unit: "KB" },
|
|
818
|
+
multiple: a.multiple,
|
|
819
|
+
disabled: a.disabled,
|
|
820
|
+
"request-method": a.requestMethod,
|
|
821
|
+
onSuccess: i,
|
|
822
|
+
onFail: b,
|
|
823
823
|
onRemove: d,
|
|
824
|
-
onValidate:
|
|
824
|
+
onValidate: s
|
|
825
825
|
}, null, 8, ["modelValue", "action", "accept", "max", "size-limit", "multiple", "disabled", "request-method"]))
|
|
826
826
|
]));
|
|
827
827
|
}
|
|
828
|
-
}),
|
|
828
|
+
}), Ne = /* @__PURE__ */ U(je, [["__scopeId", "data-v-a3054ef0"]]), qe = { class: "smart-form" }, Ye = {
|
|
829
829
|
key: 0,
|
|
830
830
|
class: "smart-form-footer"
|
|
831
|
-
},
|
|
831
|
+
}, De = {
|
|
832
832
|
name: "SmartForm"
|
|
833
|
-
},
|
|
834
|
-
...
|
|
833
|
+
}, We = /* @__PURE__ */ F({
|
|
834
|
+
...De,
|
|
835
835
|
props: {
|
|
836
836
|
modelValue: {},
|
|
837
837
|
schemas: {},
|
|
@@ -845,125 +845,254 @@ const Be = { class: "smart-select" }, xe = {
|
|
|
845
845
|
componentMap: {}
|
|
846
846
|
},
|
|
847
847
|
emits: ["update:modelValue", "submit", "reset", "validate-failed"],
|
|
848
|
-
setup(
|
|
849
|
-
const
|
|
850
|
-
input:
|
|
851
|
-
password:
|
|
852
|
-
number:
|
|
853
|
-
textarea:
|
|
854
|
-
select:
|
|
855
|
-
cascader:
|
|
856
|
-
"tree-select":
|
|
848
|
+
setup(a, { expose: g, emit: r }) {
|
|
849
|
+
const c = a, f = r, y = M(), p = {
|
|
850
|
+
input: R,
|
|
851
|
+
password: R,
|
|
852
|
+
number: R,
|
|
853
|
+
textarea: Be,
|
|
854
|
+
select: Ce,
|
|
855
|
+
cascader: Ee,
|
|
856
|
+
"tree-select": ze,
|
|
857
857
|
date: le,
|
|
858
858
|
time: le,
|
|
859
859
|
switch: he,
|
|
860
|
-
radio:
|
|
861
|
-
checkbox:
|
|
860
|
+
radio: ve,
|
|
861
|
+
checkbox: be,
|
|
862
862
|
stepper: ye,
|
|
863
|
-
upload:
|
|
864
|
-
}, h = (
|
|
865
|
-
const
|
|
866
|
-
return
|
|
867
|
-
},
|
|
868
|
-
const
|
|
869
|
-
return
|
|
870
|
-
},
|
|
871
|
-
const
|
|
863
|
+
upload: Ne
|
|
864
|
+
}, h = (i) => {
|
|
865
|
+
const b = i || "input";
|
|
866
|
+
return c.componentMap?.[b] ? c.componentMap[b] : p[b] ?? null;
|
|
867
|
+
}, B = (i) => {
|
|
868
|
+
const b = [];
|
|
869
|
+
return i.required && b.push({ required: !0, message: `${i.label || "该项"}不能为空` }), i.rules && b.push(...i.rules), b;
|
|
870
|
+
}, I = (i) => {
|
|
871
|
+
const b = c.modelValue;
|
|
872
872
|
let d = {};
|
|
873
|
-
typeof
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
876
|
-
`[SmartForm] Detected type="file" on Input component (field: ${
|
|
877
|
-
), delete d.type)),
|
|
873
|
+
typeof i.props == "function" ? d = i.props(b) : i.props && (d = { ...i.props });
|
|
874
|
+
const s = i.type || "input";
|
|
875
|
+
if (s === "password" ? Object.assign(d, { type: "password" }) : s === "number" ? Object.assign(d, { type: "number" }) : s === "date" ? Object.assign(d, { mode: "date" }) : s === "time" && Object.assign(d, { mode: ["hour", "minute"] }), ["input", "password", "number", "textarea"].includes(s) && (!(typeof i.props == "object" && i.props !== null && Object.prototype.hasOwnProperty.call(i.props, "borderless")) && d.borderless === void 0 && (d.borderless = !0), d.type === "file" && (console.warn(
|
|
876
|
+
`[SmartForm] Detected type="file" on Input component (field: ${i.name}). Please use type: "upload" in your schema instead.`
|
|
877
|
+
), delete d.type)), c.disabled)
|
|
878
878
|
Object.assign(d, { disabled: !0 });
|
|
879
|
-
else if (
|
|
880
|
-
const t = typeof
|
|
879
|
+
else if (i.disabled) {
|
|
880
|
+
const t = typeof i.disabled == "function" ? i.disabled(b) : i.disabled;
|
|
881
881
|
Object.assign(d, { disabled: t });
|
|
882
882
|
}
|
|
883
883
|
return d;
|
|
884
|
-
},
|
|
885
|
-
|
|
886
|
-
},
|
|
887
|
-
|
|
884
|
+
}, k = (i) => i.hidden === void 0 ? !0 : typeof i.hidden == "function" ? !i.hidden(c.modelValue) : !i.hidden, O = (i) => {
|
|
885
|
+
i.validateResult === !0 ? f("submit", ie(c.modelValue)) : f("validate-failed", i.validateResult);
|
|
886
|
+
}, P = () => {
|
|
887
|
+
y.value?.reset(), f("reset");
|
|
888
888
|
};
|
|
889
|
-
return
|
|
890
|
-
validate: () =>
|
|
891
|
-
reset: () =>
|
|
892
|
-
clearValidate: () =>
|
|
893
|
-
}), (
|
|
894
|
-
|
|
889
|
+
return g({
|
|
890
|
+
validate: () => y.value?.validate(),
|
|
891
|
+
reset: () => y.value?.reset(),
|
|
892
|
+
clearValidate: () => y.value?.clearValidate()
|
|
893
|
+
}), (i, b) => (v(), $("div", qe, [
|
|
894
|
+
T(m(pe), {
|
|
895
895
|
ref_key: "formRef",
|
|
896
|
-
ref:
|
|
897
|
-
data:
|
|
898
|
-
"label-width":
|
|
899
|
-
"label-align":
|
|
900
|
-
onSubmit:
|
|
896
|
+
ref: y,
|
|
897
|
+
data: a.modelValue,
|
|
898
|
+
"label-width": a.labelWidth,
|
|
899
|
+
"label-align": a.labelAlign,
|
|
900
|
+
onSubmit: O
|
|
901
901
|
}, {
|
|
902
|
-
default:
|
|
903
|
-
(
|
|
902
|
+
default: x(() => [
|
|
903
|
+
(v(!0), $(H, null, j(a.schemas, (d) => (v(), $(H, {
|
|
904
904
|
key: d.name
|
|
905
905
|
}, [
|
|
906
|
-
|
|
906
|
+
k(d) ? (v(), C(m(me), {
|
|
907
907
|
key: 0,
|
|
908
908
|
name: d.name,
|
|
909
909
|
label: d.label,
|
|
910
|
-
rules:
|
|
910
|
+
rules: B(d),
|
|
911
911
|
help: d.help
|
|
912
912
|
}, {
|
|
913
|
-
default:
|
|
914
|
-
d.type === "slot" && d.slot ?
|
|
913
|
+
default: x(() => [
|
|
914
|
+
d.type === "slot" && d.slot ? A(i.$slots, d.slot, {
|
|
915
915
|
key: 0,
|
|
916
|
-
model:
|
|
916
|
+
model: a.modelValue,
|
|
917
917
|
schema: d
|
|
918
|
-
}, void 0, !0) : (
|
|
918
|
+
}, void 0, !0) : (v(), C(N(h(d.type)), w({
|
|
919
919
|
key: 1,
|
|
920
|
-
modelValue:
|
|
921
|
-
"onUpdate:modelValue": (
|
|
922
|
-
}, { ref_for: !0 },
|
|
920
|
+
modelValue: a.modelValue[d.name],
|
|
921
|
+
"onUpdate:modelValue": (s) => a.modelValue[d.name] = s
|
|
922
|
+
}, { ref_for: !0 }, I(d)), null, 16, ["modelValue", "onUpdate:modelValue"]))
|
|
923
923
|
]),
|
|
924
924
|
_: 2
|
|
925
|
-
}, 1032, ["name", "label", "rules", "help"])) :
|
|
925
|
+
}, 1032, ["name", "label", "rules", "help"])) : E("", !0)
|
|
926
926
|
], 64))), 128)),
|
|
927
|
-
|
|
928
|
-
|
|
927
|
+
a.showFooter ? (v(), $("div", Ye, [
|
|
928
|
+
T(m(ae), {
|
|
929
929
|
theme: "primary",
|
|
930
930
|
type: "submit",
|
|
931
931
|
block: "",
|
|
932
|
-
loading:
|
|
933
|
-
disabled:
|
|
932
|
+
loading: a.loading,
|
|
933
|
+
disabled: a.disabled
|
|
934
934
|
}, {
|
|
935
|
-
default:
|
|
936
|
-
Q(
|
|
935
|
+
default: x(() => [
|
|
936
|
+
J(Q(a.submitBtnText), 1)
|
|
937
937
|
]),
|
|
938
938
|
_: 1
|
|
939
939
|
}, 8, ["loading", "disabled"]),
|
|
940
|
-
|
|
940
|
+
a.resetBtnText ? (v(), C(m(ae), {
|
|
941
941
|
key: 0,
|
|
942
942
|
theme: "default",
|
|
943
943
|
variant: "outline",
|
|
944
944
|
block: "",
|
|
945
945
|
class: "reset-btn",
|
|
946
|
-
onClick:
|
|
947
|
-
disabled:
|
|
946
|
+
onClick: P,
|
|
947
|
+
disabled: a.disabled || a.loading
|
|
948
948
|
}, {
|
|
949
|
-
default:
|
|
950
|
-
Q(
|
|
949
|
+
default: x(() => [
|
|
950
|
+
J(Q(a.resetBtnText), 1)
|
|
951
951
|
]),
|
|
952
952
|
_: 1
|
|
953
|
-
}, 8, ["disabled"])) :
|
|
954
|
-
])) :
|
|
953
|
+
}, 8, ["disabled"])) : E("", !0)
|
|
954
|
+
])) : E("", !0)
|
|
955
955
|
]),
|
|
956
956
|
_: 3
|
|
957
957
|
}, 8, ["data", "label-width", "label-align"])
|
|
958
958
|
]));
|
|
959
959
|
}
|
|
960
|
-
}),
|
|
960
|
+
}), _e = /* @__PURE__ */ U(We, [["__scopeId", "data-v-88de1754"]]), Ze = { class: "smart-page" }, Ge = { class: "smart-page__content" }, He = {
|
|
961
|
+
name: "SmartPage"
|
|
962
|
+
}, Je = /* @__PURE__ */ F({
|
|
963
|
+
...He,
|
|
964
|
+
props: {
|
|
965
|
+
title: {},
|
|
966
|
+
showNavbar: { type: Boolean, default: !0 },
|
|
967
|
+
showBack: { type: Boolean, default: !1 },
|
|
968
|
+
onBack: {},
|
|
969
|
+
showTabBar: { type: Boolean, default: !1 },
|
|
970
|
+
tabs: {},
|
|
971
|
+
navbarAnimation: { type: Boolean, default: !0 },
|
|
972
|
+
navbarCapsule: {},
|
|
973
|
+
navbarFixed: { type: Boolean, default: !0 },
|
|
974
|
+
navbarLeft: {},
|
|
975
|
+
navbarPlaceholder: { type: Boolean, default: !0 },
|
|
976
|
+
navbarRight: {},
|
|
977
|
+
navbarSafeAreaInsetTop: { type: Boolean, default: !0 },
|
|
978
|
+
navbarTitleMaxLength: {},
|
|
979
|
+
navbarVisible: { type: Boolean, default: !0 },
|
|
980
|
+
navbarZIndex: {},
|
|
981
|
+
tabBarValue: {},
|
|
982
|
+
tabBarBordered: { type: Boolean, default: !0 },
|
|
983
|
+
tabBarFixed: { type: Boolean, default: !0 },
|
|
984
|
+
tabBarPlaceholder: { type: Boolean, default: !0 },
|
|
985
|
+
tabBarSafeAreaInsetBottom: { type: Boolean, default: !0 },
|
|
986
|
+
tabBarShape: { default: "round" },
|
|
987
|
+
tabBarSplit: { type: Boolean, default: !0 },
|
|
988
|
+
tabBarTheme: { default: "normal" },
|
|
989
|
+
tabBarZIndex: {}
|
|
990
|
+
},
|
|
991
|
+
emits: ["update:tabBarValue", "tab-change", "back", "right-click"],
|
|
992
|
+
setup(a, { emit: g }) {
|
|
993
|
+
const r = a, c = g, f = () => {
|
|
994
|
+
c("back"), r.onBack ? r.onBack() : window.history.back();
|
|
995
|
+
}, y = (p) => {
|
|
996
|
+
c("update:tabBarValue", p), c("tab-change", p);
|
|
997
|
+
};
|
|
998
|
+
return (p, h) => (v(), $("div", Ze, [
|
|
999
|
+
a.showNavbar ? (v(), C(m(ge), {
|
|
1000
|
+
key: 0,
|
|
1001
|
+
title: a.title,
|
|
1002
|
+
"left-arrow": a.showBack,
|
|
1003
|
+
animation: a.navbarAnimation,
|
|
1004
|
+
fixed: a.navbarFixed,
|
|
1005
|
+
placeholder: a.navbarPlaceholder,
|
|
1006
|
+
"safe-area-inset-top": a.navbarSafeAreaInsetTop,
|
|
1007
|
+
"title-max-length": a.navbarTitleMaxLength,
|
|
1008
|
+
visible: a.navbarVisible,
|
|
1009
|
+
"z-index": a.navbarZIndex,
|
|
1010
|
+
onLeftClick: f,
|
|
1011
|
+
onRightClick: h[0] || (h[0] = (B) => c("right-click"))
|
|
1012
|
+
}, K({ _: 2 }, [
|
|
1013
|
+
p.$slots["navbar-left"] || a.navbarLeft ? {
|
|
1014
|
+
name: "left",
|
|
1015
|
+
fn: x(() => [
|
|
1016
|
+
A(p.$slots, "navbar-left", {}, () => [
|
|
1017
|
+
a.navbarLeft ? (v(), C(N(a.navbarLeft), { key: 0 })) : E("", !0)
|
|
1018
|
+
], !0)
|
|
1019
|
+
]),
|
|
1020
|
+
key: "0"
|
|
1021
|
+
} : void 0,
|
|
1022
|
+
p.$slots["navbar-title"] ? {
|
|
1023
|
+
name: "title",
|
|
1024
|
+
fn: x(() => [
|
|
1025
|
+
A(p.$slots, "navbar-title", {}, void 0, !0)
|
|
1026
|
+
]),
|
|
1027
|
+
key: "1"
|
|
1028
|
+
} : void 0,
|
|
1029
|
+
p.$slots["navbar-right"] || a.navbarRight ? {
|
|
1030
|
+
name: "right",
|
|
1031
|
+
fn: x(() => [
|
|
1032
|
+
A(p.$slots, "navbar-right", {}, () => [
|
|
1033
|
+
a.navbarRight ? (v(), C(N(a.navbarRight), { key: 0 })) : E("", !0)
|
|
1034
|
+
], !0)
|
|
1035
|
+
]),
|
|
1036
|
+
key: "2"
|
|
1037
|
+
} : void 0,
|
|
1038
|
+
p.$slots["navbar-capsule"] || a.navbarCapsule ? {
|
|
1039
|
+
name: "capsule",
|
|
1040
|
+
fn: x(() => [
|
|
1041
|
+
A(p.$slots, "navbar-capsule", {}, () => [
|
|
1042
|
+
a.navbarCapsule ? (v(), C(N(a.navbarCapsule), { key: 0 })) : E("", !0)
|
|
1043
|
+
], !0)
|
|
1044
|
+
]),
|
|
1045
|
+
key: "3"
|
|
1046
|
+
} : void 0
|
|
1047
|
+
]), 1032, ["title", "left-arrow", "animation", "fixed", "placeholder", "safe-area-inset-top", "title-max-length", "visible", "z-index"])) : E("", !0),
|
|
1048
|
+
ne("div", Ge, [
|
|
1049
|
+
A(p.$slots, "default", {}, void 0, !0)
|
|
1050
|
+
]),
|
|
1051
|
+
a.showTabBar && a.tabs?.length ? (v(), C(m(xe), {
|
|
1052
|
+
key: 1,
|
|
1053
|
+
value: a.tabBarValue,
|
|
1054
|
+
bordered: a.tabBarBordered,
|
|
1055
|
+
fixed: a.tabBarFixed,
|
|
1056
|
+
placeholder: a.tabBarPlaceholder,
|
|
1057
|
+
"safe-area-inset-bottom": a.tabBarSafeAreaInsetBottom,
|
|
1058
|
+
shape: a.tabBarShape,
|
|
1059
|
+
split: a.tabBarSplit,
|
|
1060
|
+
theme: a.tabBarTheme,
|
|
1061
|
+
"z-index": a.tabBarZIndex,
|
|
1062
|
+
onChange: y
|
|
1063
|
+
}, {
|
|
1064
|
+
default: x(() => [
|
|
1065
|
+
(v(!0), $(H, null, j(a.tabs, (B) => (v(), C(m(Ve), {
|
|
1066
|
+
key: B.value,
|
|
1067
|
+
value: B.value,
|
|
1068
|
+
"badge-props": B.badgeProps
|
|
1069
|
+
}, K({
|
|
1070
|
+
default: x(() => [
|
|
1071
|
+
J(" " + Q(B.label), 1)
|
|
1072
|
+
]),
|
|
1073
|
+
_: 2
|
|
1074
|
+
}, [
|
|
1075
|
+
B.icon ? {
|
|
1076
|
+
name: "icon",
|
|
1077
|
+
fn: x(() => [
|
|
1078
|
+
(v(), C(N(B.icon)))
|
|
1079
|
+
]),
|
|
1080
|
+
key: "0"
|
|
1081
|
+
} : void 0
|
|
1082
|
+
]), 1032, ["value", "badge-props"]))), 128))
|
|
1083
|
+
]),
|
|
1084
|
+
_: 1
|
|
1085
|
+
}, 8, ["value", "bordered", "fixed", "placeholder", "safe-area-inset-bottom", "shape", "split", "theme", "z-index"])) : E("", !0)
|
|
1086
|
+
]));
|
|
1087
|
+
}
|
|
1088
|
+
}), et = /* @__PURE__ */ U(Je, [["__scopeId", "data-v-ba4b4ca0"]]);
|
|
961
1089
|
export {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1090
|
+
Ee as SmartCascader,
|
|
1091
|
+
_e as SmartForm,
|
|
1092
|
+
et as SmartPage,
|
|
1093
|
+
Ce as SmartSelect,
|
|
965
1094
|
le as SmartTimePicker,
|
|
966
|
-
|
|
967
|
-
|
|
1095
|
+
ze as SmartTreeSelect,
|
|
1096
|
+
Ne as SmartUpload
|
|
968
1097
|
};
|
|
969
1098
|
//# sourceMappingURL=index.js.map
|