h5-tdsign-for-vue 0.1.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/README.md +330 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +659 -0
- package/dist/index.js +969 -0
- package/dist/index.js.map +1 -0
- package/dist/resolver.cjs +2 -0
- package/dist/resolver.cjs.map +1 -0
- package/dist/resolver.d.ts +41 -0
- package/dist/resolver.js +24 -0
- package/dist/resolver.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +89 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,969 @@
|
|
|
1
|
+
import { ref as R, computed as x, defineComponent as L, toRef as w, createElementBlock as _, openBlock as B, createVNode as O, unref as m, mergeProps as T, h as M, createSlots as N, renderList as F, withCtx as I, renderSlot as K, normalizeProps as q, guardReactiveProps as Y, isRef as oe, watch as W, createElementVNode as re, createBlock as $, createCommentVNode as z, nextTick as J, Fragment as Z, resolveDynamicComponent as se, createTextVNode as Q, toDisplayString as X, toRaw as ue } from "vue";
|
|
2
|
+
import { Input as A, Icon as D, Popup as G, Picker as ie, DateTimePicker as de, Cascader as ce, TreeSelect as fe, Upload as ee, Message as j, Form as pe, FormItem as me, Button as te, Stepper as ye, CheckboxGroup as ve, RadioGroup as be, Switch as he, Textarea as ge } from "tdesign-mobile-vue";
|
|
3
|
+
function ae(s) {
|
|
4
|
+
const b = R(!1), n = x(() => {
|
|
5
|
+
const p = s.modelValue.value;
|
|
6
|
+
if (p == null || p === "")
|
|
7
|
+
return "";
|
|
8
|
+
const v = s.findLabel(s.options.value, p);
|
|
9
|
+
return v !== null ? v : s.displayLabel?.value ? s.displayLabel.value : String(p);
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
visible: b,
|
|
13
|
+
displayValue: n,
|
|
14
|
+
openPopup: () => {
|
|
15
|
+
b.value = !0;
|
|
16
|
+
},
|
|
17
|
+
closePopup: () => {
|
|
18
|
+
b.value = !1;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const Be = { class: "smart-select" }, xe = {
|
|
23
|
+
name: "SmartSelect"
|
|
24
|
+
}, Ve = /* @__PURE__ */ L({
|
|
25
|
+
...xe,
|
|
26
|
+
props: {
|
|
27
|
+
modelValue: { type: [String, Number, Boolean], default: "" },
|
|
28
|
+
columns: { type: [Array, Function], default: () => [] },
|
|
29
|
+
rules: { default: () => [] },
|
|
30
|
+
required: { type: Boolean, default: !1 },
|
|
31
|
+
title: { default: "" },
|
|
32
|
+
label: {},
|
|
33
|
+
placeholder: { default: "请选择" },
|
|
34
|
+
displayLabel: {},
|
|
35
|
+
align: { default: "left" },
|
|
36
|
+
allowInputOverMax: { type: Boolean },
|
|
37
|
+
autocomplete: {},
|
|
38
|
+
autofocus: { type: Boolean },
|
|
39
|
+
borderless: { type: Boolean, default: !0 },
|
|
40
|
+
clearTrigger: {},
|
|
41
|
+
clearable: { type: Boolean, default: !1 },
|
|
42
|
+
cursorColor: {},
|
|
43
|
+
disabled: { type: Boolean, default: !1 },
|
|
44
|
+
enterkeyhint: {},
|
|
45
|
+
extra: {},
|
|
46
|
+
format: {},
|
|
47
|
+
layout: {},
|
|
48
|
+
maxcharacter: {},
|
|
49
|
+
maxlength: {},
|
|
50
|
+
name: {},
|
|
51
|
+
prefixIcon: {},
|
|
52
|
+
readonly: { type: Boolean, default: !1 },
|
|
53
|
+
spellCheck: { type: Boolean },
|
|
54
|
+
status: {},
|
|
55
|
+
suffix: {},
|
|
56
|
+
suffixIcon: {},
|
|
57
|
+
tips: {},
|
|
58
|
+
type: {},
|
|
59
|
+
onBlur: {},
|
|
60
|
+
onClear: {},
|
|
61
|
+
onFocus: {},
|
|
62
|
+
onValidate: {},
|
|
63
|
+
cancelBtn: { type: [Boolean, String], default: !0 },
|
|
64
|
+
confirmBtn: { type: [Boolean, String], default: !0 },
|
|
65
|
+
footer: {},
|
|
66
|
+
header: {},
|
|
67
|
+
keys: {},
|
|
68
|
+
option: {},
|
|
69
|
+
renderLabel: {},
|
|
70
|
+
swipeDuration: {},
|
|
71
|
+
onPick: {},
|
|
72
|
+
attach: {},
|
|
73
|
+
closeBtn: { type: Boolean },
|
|
74
|
+
closeOnOverlayClick: { type: Boolean },
|
|
75
|
+
destroyOnClose: { type: Boolean },
|
|
76
|
+
duration: {},
|
|
77
|
+
overlayProps: {},
|
|
78
|
+
placement: { default: "bottom" },
|
|
79
|
+
preventScrollThrough: { type: Boolean },
|
|
80
|
+
showOverlay: { type: Boolean, default: !0 },
|
|
81
|
+
transitionName: {},
|
|
82
|
+
defaultVisible: { type: Boolean },
|
|
83
|
+
zIndex: {},
|
|
84
|
+
onClose: {},
|
|
85
|
+
onClosed: {},
|
|
86
|
+
onOpen: {},
|
|
87
|
+
onOpened: {}
|
|
88
|
+
},
|
|
89
|
+
emits: ["update:modelValue", "change", "confirm", "cancel"],
|
|
90
|
+
setup(s, { emit: b }) {
|
|
91
|
+
const n = s, f = b, c = (r, t) => {
|
|
92
|
+
let o = [];
|
|
93
|
+
Array.isArray(r) && (r.length > 0 && Array.isArray(r[0]) ? o = r.flat() : o = r);
|
|
94
|
+
const e = o.find((l) => l.value === t);
|
|
95
|
+
return e ? e.label : null;
|
|
96
|
+
}, { visible: p, displayValue: v, openPopup: h, closePopup: P } = ae({
|
|
97
|
+
modelValue: w(() => n.modelValue),
|
|
98
|
+
options: w(() => n.columns),
|
|
99
|
+
findLabel: (r, t) => c(r, t),
|
|
100
|
+
displayLabel: w(() => n.displayLabel)
|
|
101
|
+
}), C = ["attach", "closeBtn", "closeOnOverlayClick", "destroyOnClose", "duration", "overlayProps", "placement", "preventScrollThrough", "showOverlay", "transitionName", "zIndex"], V = x(() => {
|
|
102
|
+
const r = {}, t = n;
|
|
103
|
+
return C.forEach((o) => {
|
|
104
|
+
t[o] !== void 0 && (r[o] = t[o]);
|
|
105
|
+
}), r;
|
|
106
|
+
}), k = ["align", "autofocus", "borderless", "clearable", "clearTrigger", "disabled", "label", "layout", "maxcharacter", "maxlength", "name", "placeholder", "prefixIcon", "readonly", "size", "status", "suffix", "suffixIcon", "tips", "type"], S = x(() => {
|
|
107
|
+
const r = {}, t = n;
|
|
108
|
+
return k.forEach((o) => {
|
|
109
|
+
t[o] !== void 0 && (r[o] = t[o]);
|
|
110
|
+
}), r;
|
|
111
|
+
}), u = (r, t) => {
|
|
112
|
+
const o = r[0];
|
|
113
|
+
o !== void 0 && typeof o != "object" && f("update:modelValue", o), f("confirm", r, t), P();
|
|
114
|
+
}, y = (r) => {
|
|
115
|
+
f("cancel", r), P();
|
|
116
|
+
}, d = (r, t) => {
|
|
117
|
+
f("change", r, t);
|
|
118
|
+
};
|
|
119
|
+
return (r, t) => (B(), _("div", Be, [
|
|
120
|
+
O(m(A), T({
|
|
121
|
+
value: m(v),
|
|
122
|
+
onClick: m(h)
|
|
123
|
+
}, { ...r.$attrs, ...S.value }, {
|
|
124
|
+
readonly: "",
|
|
125
|
+
"suffix-icon": () => M(m(D), { name: "chevron-right" })
|
|
126
|
+
}), N({ _: 2 }, [
|
|
127
|
+
F(r.$slots, (o, e) => ({
|
|
128
|
+
name: e,
|
|
129
|
+
fn: I((l) => [
|
|
130
|
+
K(r.$slots, e, q(Y(l || {})), void 0, !0)
|
|
131
|
+
])
|
|
132
|
+
}))
|
|
133
|
+
]), 1040, ["value", "onClick", "suffix-icon"]),
|
|
134
|
+
O(m(G), T({
|
|
135
|
+
modelValue: m(p),
|
|
136
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => oe(p) ? p.value = o : null),
|
|
137
|
+
placement: "bottom"
|
|
138
|
+
}, V.value), {
|
|
139
|
+
default: I(() => [
|
|
140
|
+
O(m(ie), {
|
|
141
|
+
value: [s.modelValue],
|
|
142
|
+
columns: s.columns,
|
|
143
|
+
title: s.title,
|
|
144
|
+
"cancel-btn": s.cancelBtn,
|
|
145
|
+
"confirm-btn": s.confirmBtn,
|
|
146
|
+
onConfirm: u,
|
|
147
|
+
onCancel: y,
|
|
148
|
+
onChange: d
|
|
149
|
+
}, null, 8, ["value", "columns", "title", "cancel-btn", "confirm-btn"])
|
|
150
|
+
]),
|
|
151
|
+
_: 1
|
|
152
|
+
}, 16, ["modelValue"])
|
|
153
|
+
]));
|
|
154
|
+
}
|
|
155
|
+
}), U = (s, b) => {
|
|
156
|
+
const n = s.__vccOpts || s;
|
|
157
|
+
for (const [f, c] of b)
|
|
158
|
+
n[f] = c;
|
|
159
|
+
return n;
|
|
160
|
+
}, Se = /* @__PURE__ */ U(Ve, [["__scopeId", "data-v-af49dba1"]]), Pe = { class: "smart-time-picker" }, Ce = {
|
|
161
|
+
name: "SmartTimePicker"
|
|
162
|
+
}, ke = /* @__PURE__ */ L({
|
|
163
|
+
...Ce,
|
|
164
|
+
props: {
|
|
165
|
+
modelValue: { default: "" },
|
|
166
|
+
rules: { default: () => [] },
|
|
167
|
+
required: { type: Boolean, default: !1 },
|
|
168
|
+
label: {},
|
|
169
|
+
placeholder: { default: "请选择时间" },
|
|
170
|
+
mode: { default: "date" },
|
|
171
|
+
inputFormat: {},
|
|
172
|
+
align: { default: "left" },
|
|
173
|
+
allowInputOverMax: { type: Boolean },
|
|
174
|
+
autocomplete: {},
|
|
175
|
+
autofocus: { type: Boolean, default: !1 },
|
|
176
|
+
borderless: { type: Boolean, default: !0 },
|
|
177
|
+
clearTrigger: { default: "always" },
|
|
178
|
+
clearable: { type: Boolean, default: !1 },
|
|
179
|
+
cursorColor: { default: "#0052d9" },
|
|
180
|
+
disabled: { type: Boolean, default: !1 },
|
|
181
|
+
enterkeyhint: {},
|
|
182
|
+
extra: {},
|
|
183
|
+
layout: { default: "horizontal" },
|
|
184
|
+
maxcharacter: {},
|
|
185
|
+
maxlength: {},
|
|
186
|
+
name: { default: "" },
|
|
187
|
+
prefixIcon: {},
|
|
188
|
+
readonly: { type: Boolean, default: !1 },
|
|
189
|
+
spellCheck: { type: Boolean },
|
|
190
|
+
status: { default: "default" },
|
|
191
|
+
suffix: {},
|
|
192
|
+
suffixIcon: {},
|
|
193
|
+
tips: {},
|
|
194
|
+
type: { default: "text" },
|
|
195
|
+
onBlur: {},
|
|
196
|
+
onClear: {},
|
|
197
|
+
onFocus: {},
|
|
198
|
+
onValidate: {},
|
|
199
|
+
cancelBtn: { default: "" },
|
|
200
|
+
confirmBtn: { default: "" },
|
|
201
|
+
end: {},
|
|
202
|
+
footer: {},
|
|
203
|
+
format: { default: "YYYY-MM-DD HH:mm:ss" },
|
|
204
|
+
header: {},
|
|
205
|
+
renderLabel: {},
|
|
206
|
+
showWeek: { type: Boolean, default: !1 },
|
|
207
|
+
start: {},
|
|
208
|
+
steps: { default: () => ({}) },
|
|
209
|
+
title: { default: "" },
|
|
210
|
+
onPick: {},
|
|
211
|
+
attach: { type: [String, Function], default: "body" },
|
|
212
|
+
closeBtn: { type: Boolean },
|
|
213
|
+
closeOnOverlayClick: { type: Boolean, default: !0 },
|
|
214
|
+
destroyOnClose: { type: Boolean },
|
|
215
|
+
duration: { default: 240 },
|
|
216
|
+
overlayProps: { default: () => ({}) },
|
|
217
|
+
placement: { default: "bottom" },
|
|
218
|
+
preventScrollThrough: { type: Boolean, default: !0 },
|
|
219
|
+
showOverlay: { type: Boolean, default: !0 },
|
|
220
|
+
transitionName: { default: "" },
|
|
221
|
+
defaultVisible: { type: Boolean },
|
|
222
|
+
zIndex: {},
|
|
223
|
+
onClose: {},
|
|
224
|
+
onClosed: {},
|
|
225
|
+
onOpen: {},
|
|
226
|
+
onOpened: {}
|
|
227
|
+
},
|
|
228
|
+
emits: ["update:modelValue", "change", "confirm", "cancel", "pick"],
|
|
229
|
+
setup(s, { emit: b }) {
|
|
230
|
+
const n = s, f = b, c = R(!1), p = [
|
|
231
|
+
"attach",
|
|
232
|
+
"closeBtn",
|
|
233
|
+
"closeOnOverlayClick",
|
|
234
|
+
"destroyOnClose",
|
|
235
|
+
"duration",
|
|
236
|
+
"overlayProps",
|
|
237
|
+
"placement",
|
|
238
|
+
"preventScrollThrough",
|
|
239
|
+
"showOverlay",
|
|
240
|
+
"transitionName",
|
|
241
|
+
"zIndex",
|
|
242
|
+
"onClose",
|
|
243
|
+
"onClosed",
|
|
244
|
+
"onOpen",
|
|
245
|
+
"onOpened"
|
|
246
|
+
], v = n, h = x(() => {
|
|
247
|
+
const r = {};
|
|
248
|
+
return p.forEach((t) => {
|
|
249
|
+
v[t] !== void 0 && (r[t] = v[t]);
|
|
250
|
+
}), r;
|
|
251
|
+
}), P = x(() => {
|
|
252
|
+
const { modelValue: r, title: t, inputFormat: o, ...e } = n, l = { ...e };
|
|
253
|
+
return p.forEach((i) => {
|
|
254
|
+
delete l[i];
|
|
255
|
+
}), [
|
|
256
|
+
"cancelBtn",
|
|
257
|
+
"confirmBtn",
|
|
258
|
+
"end",
|
|
259
|
+
"footer",
|
|
260
|
+
"header",
|
|
261
|
+
"mode",
|
|
262
|
+
"renderLabel",
|
|
263
|
+
"showWeek",
|
|
264
|
+
"start",
|
|
265
|
+
"steps",
|
|
266
|
+
"format"
|
|
267
|
+
].forEach((i) => delete l[i]), o && (l.format = o), l;
|
|
268
|
+
}), C = x(() => {
|
|
269
|
+
const { label: r, placeholder: t, rules: o, required: e, modelValue: l, ...a } = n, i = { ...a };
|
|
270
|
+
return p.forEach((g) => {
|
|
271
|
+
delete i[g];
|
|
272
|
+
}), i;
|
|
273
|
+
}), V = x(() => String(n.modelValue || "")), k = () => {
|
|
274
|
+
c.value = !0;
|
|
275
|
+
}, S = (r) => {
|
|
276
|
+
f("update:modelValue", r), f("confirm", r), c.value = !1;
|
|
277
|
+
}, u = (r) => {
|
|
278
|
+
f("cancel", r), c.value = !1;
|
|
279
|
+
}, y = (r) => {
|
|
280
|
+
f("change", r);
|
|
281
|
+
}, d = (r) => {
|
|
282
|
+
f("pick", r);
|
|
283
|
+
};
|
|
284
|
+
return (r, t) => (B(), _("div", Pe, [
|
|
285
|
+
O(m(A), T({
|
|
286
|
+
value: V.value,
|
|
287
|
+
onClick: k
|
|
288
|
+
}, { ...r.$attrs, ...P.value }, {
|
|
289
|
+
readonly: "",
|
|
290
|
+
"suffix-icon": () => M(m(D), { name: "chevron-right" })
|
|
291
|
+
}), N({ _: 2 }, [
|
|
292
|
+
F(r.$slots, (o, e) => ({
|
|
293
|
+
name: e,
|
|
294
|
+
fn: I((l) => [
|
|
295
|
+
K(r.$slots, e, q(Y(l || {})), void 0, !0)
|
|
296
|
+
])
|
|
297
|
+
}))
|
|
298
|
+
]), 1040, ["value", "suffix-icon"]),
|
|
299
|
+
O(m(G), T({
|
|
300
|
+
modelValue: c.value,
|
|
301
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => c.value = o),
|
|
302
|
+
placement: "bottom"
|
|
303
|
+
}, h.value), {
|
|
304
|
+
default: I(() => [
|
|
305
|
+
O(m(de), T({ value: s.modelValue }, C.value, {
|
|
306
|
+
onConfirm: S,
|
|
307
|
+
onCancel: u,
|
|
308
|
+
onChange: y,
|
|
309
|
+
onPick: d
|
|
310
|
+
}), null, 16, ["value"])
|
|
311
|
+
]),
|
|
312
|
+
_: 1
|
|
313
|
+
}, 16, ["modelValue"])
|
|
314
|
+
]));
|
|
315
|
+
}
|
|
316
|
+
}), le = /* @__PURE__ */ U(ke, [["__scopeId", "data-v-cf6cd38e"]]), Oe = { class: "smart-cascader" }, Ie = {
|
|
317
|
+
name: "SmartCascader"
|
|
318
|
+
}, Te = /* @__PURE__ */ L({
|
|
319
|
+
...Ie,
|
|
320
|
+
props: {
|
|
321
|
+
modelValue: { default: "" },
|
|
322
|
+
placeholder: { default: "请选择" },
|
|
323
|
+
rules: { default: () => [] },
|
|
324
|
+
required: { type: Boolean, default: !1 },
|
|
325
|
+
label: {},
|
|
326
|
+
displayLabel: {},
|
|
327
|
+
align: { default: "left" },
|
|
328
|
+
allowInputOverMax: { type: Boolean },
|
|
329
|
+
autocomplete: {},
|
|
330
|
+
autofocus: { type: Boolean },
|
|
331
|
+
borderless: { type: Boolean, default: !0 },
|
|
332
|
+
clearTrigger: {},
|
|
333
|
+
clearable: { type: Boolean, default: !1 },
|
|
334
|
+
cursorColor: {},
|
|
335
|
+
disabled: { type: Boolean, default: !1 },
|
|
336
|
+
enterkeyhint: {},
|
|
337
|
+
extra: {},
|
|
338
|
+
format: {},
|
|
339
|
+
layout: {},
|
|
340
|
+
maxcharacter: {},
|
|
341
|
+
maxlength: {},
|
|
342
|
+
name: {},
|
|
343
|
+
prefixIcon: {},
|
|
344
|
+
readonly: { type: Boolean, default: !1 },
|
|
345
|
+
spellCheck: { type: Boolean },
|
|
346
|
+
status: {},
|
|
347
|
+
suffix: {},
|
|
348
|
+
suffixIcon: {},
|
|
349
|
+
tips: {},
|
|
350
|
+
type: {},
|
|
351
|
+
onBlur: {},
|
|
352
|
+
onClear: {},
|
|
353
|
+
onFocus: {},
|
|
354
|
+
onValidate: {},
|
|
355
|
+
checkStrictly: { type: Boolean, default: !1 },
|
|
356
|
+
closeBtn: { type: Boolean },
|
|
357
|
+
header: {},
|
|
358
|
+
keys: {},
|
|
359
|
+
load: {},
|
|
360
|
+
middleContent: {},
|
|
361
|
+
options: { default: () => [] },
|
|
362
|
+
overlayProps: {},
|
|
363
|
+
subTitles: {},
|
|
364
|
+
theme: { default: "step" },
|
|
365
|
+
title: { default: "" },
|
|
366
|
+
defaultValue: {}
|
|
367
|
+
},
|
|
368
|
+
emits: ["update:modelValue", "change", "pick", "close"],
|
|
369
|
+
setup(s, { emit: b }) {
|
|
370
|
+
const n = s, f = b, c = (t, o, e = []) => {
|
|
371
|
+
for (const l of t) {
|
|
372
|
+
const a = l.value ?? l.id, i = l.label ?? l.name;
|
|
373
|
+
if (a === o)
|
|
374
|
+
return [...e, String(i)];
|
|
375
|
+
if (l.children && l.children.length > 0) {
|
|
376
|
+
const g = c(l.children, o, [...e, String(i)]);
|
|
377
|
+
if (g) return g;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return null;
|
|
381
|
+
}, p = (t, o) => {
|
|
382
|
+
const e = c(t, o);
|
|
383
|
+
return e ? e.join(" / ") : null;
|
|
384
|
+
}, { visible: v, displayValue: h, openPopup: P, closePopup: C } = ae({
|
|
385
|
+
modelValue: w(() => n.modelValue),
|
|
386
|
+
options: w(() => n.options || []),
|
|
387
|
+
findLabel: p,
|
|
388
|
+
displayLabel: w(() => n.displayLabel)
|
|
389
|
+
}), V = ["align", "autofocus", "borderless", "clearable", "clearTrigger", "disabled", "label", "layout", "maxcharacter", "maxlength", "name", "placeholder", "prefixIcon", "readonly", "size", "status", "suffix", "suffixIcon", "tips", "type"], k = x(() => {
|
|
390
|
+
const t = {}, o = n;
|
|
391
|
+
return V.forEach((e) => {
|
|
392
|
+
o[e] !== void 0 && (t[e] = o[e]);
|
|
393
|
+
}), t;
|
|
394
|
+
}), S = ["checkStrictly", "closeBtn", "header", "keys", "load", "middleContent", "options", "overlayProps", "subTitles", "theme", "title"], u = x(() => {
|
|
395
|
+
const t = {}, o = n;
|
|
396
|
+
return S.forEach((e) => {
|
|
397
|
+
o[e] !== void 0 && (t[e] = o[e]);
|
|
398
|
+
}), t;
|
|
399
|
+
}), y = (t, o) => {
|
|
400
|
+
f("update:modelValue", t), f("change", t, o), C();
|
|
401
|
+
}, d = (t) => {
|
|
402
|
+
f("pick", t.value, t);
|
|
403
|
+
}, r = (t) => {
|
|
404
|
+
f("close", t), C();
|
|
405
|
+
};
|
|
406
|
+
return (t, o) => (B(), _("div", Oe, [
|
|
407
|
+
O(m(A), T({
|
|
408
|
+
value: m(h),
|
|
409
|
+
onClick: m(P)
|
|
410
|
+
}, { ...t.$attrs, ...k.value }, {
|
|
411
|
+
readonly: "",
|
|
412
|
+
"suffix-icon": () => M(m(D), { name: "chevron-right" })
|
|
413
|
+
}), N({ _: 2 }, [
|
|
414
|
+
F(t.$slots, (e, l) => ({
|
|
415
|
+
name: l,
|
|
416
|
+
fn: I((a) => [
|
|
417
|
+
K(t.$slots, l, q(Y(a || {})), void 0, !0)
|
|
418
|
+
])
|
|
419
|
+
}))
|
|
420
|
+
]), 1040, ["value", "onClick", "suffix-icon"]),
|
|
421
|
+
O(m(ce), T({
|
|
422
|
+
visible: m(v),
|
|
423
|
+
"onUpdate:visible": o[0] || (o[0] = (e) => oe(v) ? v.value = e : null),
|
|
424
|
+
value: s.modelValue
|
|
425
|
+
}, u.value, {
|
|
426
|
+
onChange: y,
|
|
427
|
+
onPick: d,
|
|
428
|
+
onClose: r
|
|
429
|
+
}), null, 16, ["visible", "value"])
|
|
430
|
+
]));
|
|
431
|
+
}
|
|
432
|
+
}), _e = /* @__PURE__ */ U(Te, [["__scopeId", "data-v-f420c3ed"]]), Ee = { class: "smart-tree-select" }, Ae = { class: "tree-select-wrapper" }, we = {
|
|
433
|
+
name: "SmartTreeSelect"
|
|
434
|
+
}, $e = /* @__PURE__ */ L({
|
|
435
|
+
...we,
|
|
436
|
+
props: {
|
|
437
|
+
modelValue: {},
|
|
438
|
+
options: { default: () => [] },
|
|
439
|
+
rules: { default: () => [] },
|
|
440
|
+
required: { type: Boolean, default: !1 },
|
|
441
|
+
title: { default: "" },
|
|
442
|
+
label: {},
|
|
443
|
+
placeholder: { default: "请选择" },
|
|
444
|
+
align: { default: "left" },
|
|
445
|
+
allowInputOverMax: { type: Boolean },
|
|
446
|
+
autocomplete: {},
|
|
447
|
+
autofocus: { type: Boolean, default: !1 },
|
|
448
|
+
borderless: { type: Boolean, default: !0 },
|
|
449
|
+
clearTrigger: { default: "always" },
|
|
450
|
+
clearable: { type: Boolean, default: !1 },
|
|
451
|
+
cursorColor: { default: "#0052d9" },
|
|
452
|
+
disabled: { type: Boolean, default: !1 },
|
|
453
|
+
enterkeyhint: {},
|
|
454
|
+
extra: {},
|
|
455
|
+
format: {},
|
|
456
|
+
layout: { default: "horizontal" },
|
|
457
|
+
maxcharacter: {},
|
|
458
|
+
maxlength: {},
|
|
459
|
+
name: { default: "" },
|
|
460
|
+
prefixIcon: {},
|
|
461
|
+
readonly: { type: Boolean, default: !1 },
|
|
462
|
+
spellCheck: { type: Boolean },
|
|
463
|
+
status: { default: "default" },
|
|
464
|
+
suffix: {},
|
|
465
|
+
suffixIcon: {},
|
|
466
|
+
tips: {},
|
|
467
|
+
type: { default: "text" },
|
|
468
|
+
onBlur: {},
|
|
469
|
+
onClear: {},
|
|
470
|
+
onFocus: {},
|
|
471
|
+
onValidate: {},
|
|
472
|
+
customStyle: { default: "" },
|
|
473
|
+
filterable: { type: Boolean, default: !1 },
|
|
474
|
+
height: { default: 336 },
|
|
475
|
+
keys: {},
|
|
476
|
+
multiple: { type: Boolean, default: !1 },
|
|
477
|
+
attach: { type: [String, Function], default: "body" },
|
|
478
|
+
closeBtn: { type: Boolean },
|
|
479
|
+
closeOnOverlayClick: { type: Boolean, default: !0 },
|
|
480
|
+
destroyOnClose: { type: Boolean },
|
|
481
|
+
duration: { default: 240 },
|
|
482
|
+
overlayProps: { default: () => ({}) },
|
|
483
|
+
placement: { default: "bottom" },
|
|
484
|
+
preventScrollThrough: { type: Boolean, default: !0 },
|
|
485
|
+
showOverlay: { type: Boolean, default: !0 },
|
|
486
|
+
transitionName: { default: "" },
|
|
487
|
+
zIndex: {},
|
|
488
|
+
onClose: {},
|
|
489
|
+
onClosed: {},
|
|
490
|
+
onOpen: {},
|
|
491
|
+
onOpened: {}
|
|
492
|
+
},
|
|
493
|
+
emits: ["update:modelValue", "change", "close"],
|
|
494
|
+
setup(s, { emit: b }) {
|
|
495
|
+
const n = s, f = b, c = R(!1), p = [
|
|
496
|
+
"attach",
|
|
497
|
+
"closeBtn",
|
|
498
|
+
"closeOnOverlayClick",
|
|
499
|
+
"destroyOnClose",
|
|
500
|
+
"duration",
|
|
501
|
+
"overlayProps",
|
|
502
|
+
"placement",
|
|
503
|
+
"preventScrollThrough",
|
|
504
|
+
"showOverlay",
|
|
505
|
+
"transitionName",
|
|
506
|
+
"zIndex",
|
|
507
|
+
"onClose",
|
|
508
|
+
"onClosed",
|
|
509
|
+
"onOpen",
|
|
510
|
+
"onOpened"
|
|
511
|
+
], v = [
|
|
512
|
+
"customStyle",
|
|
513
|
+
"filterable",
|
|
514
|
+
"height",
|
|
515
|
+
"keys",
|
|
516
|
+
"multiple",
|
|
517
|
+
"options"
|
|
518
|
+
], h = n, P = x(() => {
|
|
519
|
+
const e = {};
|
|
520
|
+
return p.forEach((l) => {
|
|
521
|
+
h[l] !== void 0 && (e[l] = h[l]);
|
|
522
|
+
}), e;
|
|
523
|
+
}), C = x(() => {
|
|
524
|
+
const { modelValue: e, ...l } = n, a = { ...l };
|
|
525
|
+
return p.forEach((i) => {
|
|
526
|
+
delete a[i];
|
|
527
|
+
}), v.forEach((i) => {
|
|
528
|
+
delete a[i];
|
|
529
|
+
}), delete a.rules, delete a.required, delete a.title, a;
|
|
530
|
+
}), V = x(() => {
|
|
531
|
+
const e = {};
|
|
532
|
+
return v.forEach((l) => {
|
|
533
|
+
l !== "options" && h[l] !== void 0 && (e[l] = h[l]);
|
|
534
|
+
}), h.keys !== void 0 && (e.keys = h.keys), e;
|
|
535
|
+
}), k = (e, l) => {
|
|
536
|
+
for (const a of e) {
|
|
537
|
+
if (a.value === l)
|
|
538
|
+
return !a.children || a.children.length === 0;
|
|
539
|
+
if (a.children && a.children.length > 0) {
|
|
540
|
+
const i = k(a.children, l);
|
|
541
|
+
if (i !== !1) return i;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return !1;
|
|
545
|
+
}, S = (e, l, a = []) => {
|
|
546
|
+
for (const i of e) {
|
|
547
|
+
if (i.value === l)
|
|
548
|
+
return [...a, i.value];
|
|
549
|
+
if (i.children && i.children.length > 0) {
|
|
550
|
+
const g = S(i.children, l, [...a, i.value]);
|
|
551
|
+
if (g) return g;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return null;
|
|
555
|
+
}, u = R([]), y = (e) => Array.isArray(e) ? e.flatMap((l) => Array.isArray(l) ? l : [l]).filter(
|
|
556
|
+
(l) => typeof l == "string" || typeof l == "number"
|
|
557
|
+
) : e == null || e === "" ? [] : [e];
|
|
558
|
+
W(
|
|
559
|
+
() => n.modelValue,
|
|
560
|
+
(e) => {
|
|
561
|
+
if (Array.isArray(e))
|
|
562
|
+
u.value = y(e);
|
|
563
|
+
else if (e !== void 0 && e !== "" && e !== null) {
|
|
564
|
+
const l = n.options || [], a = S(l, e);
|
|
565
|
+
u.value = a || [];
|
|
566
|
+
} else
|
|
567
|
+
u.value = [];
|
|
568
|
+
},
|
|
569
|
+
{ immediate: !0 }
|
|
570
|
+
), W(
|
|
571
|
+
() => n.options,
|
|
572
|
+
() => {
|
|
573
|
+
const e = n.modelValue;
|
|
574
|
+
if (!Array.isArray(e) && e !== void 0 && e !== "" && e !== null) {
|
|
575
|
+
const l = n.options || [], a = S(l, e);
|
|
576
|
+
u.value = a || [];
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{ deep: !0 }
|
|
580
|
+
);
|
|
581
|
+
const d = (e, l) => {
|
|
582
|
+
for (const a of e) {
|
|
583
|
+
if (a.value === l)
|
|
584
|
+
return a.label || String(a.value);
|
|
585
|
+
if (a.children && a.children.length > 0) {
|
|
586
|
+
const i = d(a.children, l);
|
|
587
|
+
if (i) return i;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return null;
|
|
591
|
+
}, r = x(() => {
|
|
592
|
+
const e = n.modelValue;
|
|
593
|
+
if (!e && e !== 0)
|
|
594
|
+
return "";
|
|
595
|
+
const l = n.options || [];
|
|
596
|
+
if (Array.isArray(e)) {
|
|
597
|
+
const a = e[e.length - 1];
|
|
598
|
+
return a !== void 0 ? d(l, a) || String(a) : "";
|
|
599
|
+
}
|
|
600
|
+
return d(l, e) || String(e);
|
|
601
|
+
}), t = () => {
|
|
602
|
+
n.disabled || (c.value = !0);
|
|
603
|
+
}, o = (e, l) => {
|
|
604
|
+
if (Array.isArray(e)) {
|
|
605
|
+
const a = y(e), i = a[a.length - 1];
|
|
606
|
+
u.value = a;
|
|
607
|
+
const g = n.options || [];
|
|
608
|
+
k(g, i) && (f("update:modelValue", i), f("change", i, l), n.multiple || (c.value = !1));
|
|
609
|
+
} else
|
|
610
|
+
u.value = y(e), f("update:modelValue", e), f("change", e, l);
|
|
611
|
+
};
|
|
612
|
+
return (e, l) => (B(), _("div", Ee, [
|
|
613
|
+
O(m(A), T({
|
|
614
|
+
value: r.value,
|
|
615
|
+
onClick: t
|
|
616
|
+
}, { ...e.$attrs, ...C.value }, {
|
|
617
|
+
readonly: "",
|
|
618
|
+
"suffix-icon": () => M(m(D), { name: "chevron-right" })
|
|
619
|
+
}), N({ _: 2 }, [
|
|
620
|
+
F(e.$slots, (a, i) => ({
|
|
621
|
+
name: i,
|
|
622
|
+
fn: I((g) => [
|
|
623
|
+
K(e.$slots, i, q(Y(g || {})), void 0, !0)
|
|
624
|
+
])
|
|
625
|
+
}))
|
|
626
|
+
]), 1040, ["value", "suffix-icon"]),
|
|
627
|
+
O(m(G), T({
|
|
628
|
+
modelValue: c.value,
|
|
629
|
+
"onUpdate:modelValue": l[0] || (l[0] = (a) => c.value = a),
|
|
630
|
+
placement: "bottom"
|
|
631
|
+
}, P.value), {
|
|
632
|
+
default: I(() => [
|
|
633
|
+
re("div", Ae, [
|
|
634
|
+
c.value ? (B(), $(m(fe), T({
|
|
635
|
+
key: 0,
|
|
636
|
+
value: u.value,
|
|
637
|
+
options: s.options
|
|
638
|
+
}, V.value, { onChange: o }), null, 16, ["value", "options"])) : z("", !0)
|
|
639
|
+
])
|
|
640
|
+
]),
|
|
641
|
+
_: 1
|
|
642
|
+
}, 16, ["modelValue"])
|
|
643
|
+
]));
|
|
644
|
+
}
|
|
645
|
+
}), Re = /* @__PURE__ */ U($e, [["__scopeId", "data-v-4d44f50a"]]), Le = { class: "smart-upload" }, Ue = {
|
|
646
|
+
name: "SmartUpload"
|
|
647
|
+
}, Fe = /* @__PURE__ */ L({
|
|
648
|
+
...Ue,
|
|
649
|
+
props: {
|
|
650
|
+
modelValue: { default: "" },
|
|
651
|
+
valueType: {},
|
|
652
|
+
separator: { default: "," },
|
|
653
|
+
urlPrefix: { default: "" },
|
|
654
|
+
urlKey: { default: "fileUrl" },
|
|
655
|
+
nameKey: { default: "filename" },
|
|
656
|
+
mode: { default: "image" },
|
|
657
|
+
accept: { default: "image/*" },
|
|
658
|
+
action: {},
|
|
659
|
+
max: { default: 9 },
|
|
660
|
+
maxSize: { default: 10 * 1024 },
|
|
661
|
+
multiple: { type: Boolean, default: !0 },
|
|
662
|
+
disabled: { type: Boolean, default: !1 },
|
|
663
|
+
requestMethod: {},
|
|
664
|
+
formatResponse: {}
|
|
665
|
+
},
|
|
666
|
+
emits: ["update:modelValue", "success", "fail", "remove"],
|
|
667
|
+
setup(s, { emit: b }) {
|
|
668
|
+
const n = s, f = b, c = R([]), p = x(() => Array.isArray(n.accept) ? n.accept.join(",") : n.accept), v = x(() => {
|
|
669
|
+
if (n.valueType) return n.valueType;
|
|
670
|
+
const t = n.modelValue;
|
|
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), P = (t) => {
|
|
673
|
+
if (typeof t == "string") return t;
|
|
674
|
+
const o = t[n.urlKey];
|
|
675
|
+
return typeof o == "string" ? o : "";
|
|
676
|
+
}, C = (t, o) => {
|
|
677
|
+
if (typeof t == "object" && t[n.nameKey]) {
|
|
678
|
+
const e = t[n.nameKey];
|
|
679
|
+
return typeof e == "string" ? e : String(e);
|
|
680
|
+
}
|
|
681
|
+
return o.split("/").pop() || "";
|
|
682
|
+
}, V = (t) => !n.urlPrefix || !t ? t : t.startsWith(n.urlPrefix) ? t.slice(n.urlPrefix.length) : t, k = (t) => {
|
|
683
|
+
if (!t) return [];
|
|
684
|
+
let o = [];
|
|
685
|
+
return typeof t == "string" ? o = t.split(n.separator).filter(Boolean) : o = t.filter(Boolean), o.map((e, l) => {
|
|
686
|
+
const a = P(e);
|
|
687
|
+
if (!a) return null;
|
|
688
|
+
const g = {
|
|
689
|
+
url: h(a) ? a : n.urlPrefix + a,
|
|
690
|
+
name: C(e, a),
|
|
691
|
+
status: "success",
|
|
692
|
+
originalPath: a
|
|
693
|
+
};
|
|
694
|
+
return typeof e == "object" && (g.__rawResult__ = e), g;
|
|
695
|
+
}).filter(Boolean);
|
|
696
|
+
};
|
|
697
|
+
W(
|
|
698
|
+
() => n.modelValue,
|
|
699
|
+
(t) => {
|
|
700
|
+
const o = k(t), e = c.value.filter((a) => a.status === "success").map((a) => a.originalPath || a.url), l = o.map((a) => a.originalPath || a.url);
|
|
701
|
+
if (JSON.stringify(e) !== JSON.stringify(l)) {
|
|
702
|
+
const a = c.value.filter((i) => i.status !== "success");
|
|
703
|
+
c.value = [...o, ...a];
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
{ immediate: !0 }
|
|
707
|
+
);
|
|
708
|
+
const S = () => {
|
|
709
|
+
const t = c.value.filter((e) => e.status === "success");
|
|
710
|
+
let o;
|
|
711
|
+
switch (v.value) {
|
|
712
|
+
case "string":
|
|
713
|
+
o = t.map((e) => V(e.originalPath || e.url || "")).filter(Boolean).join(n.separator);
|
|
714
|
+
break;
|
|
715
|
+
case "objectArray":
|
|
716
|
+
o = t.map((e) => {
|
|
717
|
+
if (e.__rawResult__ && typeof e.__rawResult__ == "object") {
|
|
718
|
+
const a = e.__rawResult__[n.urlKey];
|
|
719
|
+
return {
|
|
720
|
+
...e.__rawResult__,
|
|
721
|
+
[n.urlKey]: V(typeof a == "string" ? a : e.originalPath || e.url || "")
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
const l = {
|
|
725
|
+
[n.urlKey]: V(e.originalPath || e.url || "")
|
|
726
|
+
};
|
|
727
|
+
return n.nameKey && (l[n.nameKey] = e.name), l;
|
|
728
|
+
});
|
|
729
|
+
break;
|
|
730
|
+
default:
|
|
731
|
+
o = t.map((e) => V(e.originalPath || e.url || "")).filter(Boolean);
|
|
732
|
+
break;
|
|
733
|
+
}
|
|
734
|
+
f("update:modelValue", o);
|
|
735
|
+
}, u = (t) => {
|
|
736
|
+
const { file: o, response: e } = t;
|
|
737
|
+
if (console.log("[SmartUpload] onSuccess", { file: o, response: e }), o) {
|
|
738
|
+
let l = "";
|
|
739
|
+
if (n.formatResponse)
|
|
740
|
+
l = n.formatResponse(e);
|
|
741
|
+
else if (e && typeof e == "object") {
|
|
742
|
+
const a = Array.isArray(e) ? e[0] : e;
|
|
743
|
+
a && "url" in a && (l = a.url);
|
|
744
|
+
}
|
|
745
|
+
if (console.log("[SmartUpload] uploadResult:", l), l) {
|
|
746
|
+
const a = typeof l == "object";
|
|
747
|
+
let i = "", g;
|
|
748
|
+
if (a) {
|
|
749
|
+
const E = l[n.urlKey];
|
|
750
|
+
i = typeof E == "string" ? E : "", g = l;
|
|
751
|
+
} else
|
|
752
|
+
i = l;
|
|
753
|
+
const H = h(i) ? i : n.urlPrefix + i;
|
|
754
|
+
J(() => {
|
|
755
|
+
const E = c.value.findIndex((ne) => ne.name === o.name);
|
|
756
|
+
console.log("[SmartUpload] fileIndex:", E), E >= 0 && (c.value[E] = {
|
|
757
|
+
...c.value[E],
|
|
758
|
+
status: "success",
|
|
759
|
+
url: H,
|
|
760
|
+
originalPath: i,
|
|
761
|
+
// 对象数组模式下保存完整返回
|
|
762
|
+
__rawResult__: g
|
|
763
|
+
}), S();
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
f("success", t);
|
|
768
|
+
}, y = (t) => {
|
|
769
|
+
const { file: o } = t;
|
|
770
|
+
if (o) {
|
|
771
|
+
const e = c.value.findIndex((l) => l.name === o.name);
|
|
772
|
+
e >= 0 && c.value.splice(e, 1);
|
|
773
|
+
}
|
|
774
|
+
j.error("上传失败,请重试"), f("fail", t);
|
|
775
|
+
}, d = (t) => {
|
|
776
|
+
const { index: o = 0, file: e } = t;
|
|
777
|
+
f("remove", e, o), J(() => {
|
|
778
|
+
S();
|
|
779
|
+
});
|
|
780
|
+
}, r = (t) => {
|
|
781
|
+
const { type: o, files: e } = t;
|
|
782
|
+
switch (console.log("[SmartUpload] onValidate", { type: o, files: e }), o) {
|
|
783
|
+
case "FILTER_FILE_SAME_NAME":
|
|
784
|
+
j.info("请勿上传重复的文件");
|
|
785
|
+
break;
|
|
786
|
+
case "FILE_OVER_SIZE_LIMIT":
|
|
787
|
+
j.error(`文件大小超过限制(最大 ${Math.round(n.maxSize / 1024)}MB)`);
|
|
788
|
+
break;
|
|
789
|
+
case "FILES_OVER_LENGTH_LIMIT":
|
|
790
|
+
j.info(`最多只能上传 ${n.max} 个文件`);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
return (t, o) => (B(), _("div", Le, [
|
|
795
|
+
s.mode === "image" ? (B(), $(m(ee), {
|
|
796
|
+
key: 0,
|
|
797
|
+
modelValue: c.value,
|
|
798
|
+
"onUpdate:modelValue": o[0] || (o[0] = (e) => c.value = e),
|
|
799
|
+
action: s.action,
|
|
800
|
+
accept: p.value,
|
|
801
|
+
max: s.max,
|
|
802
|
+
"size-limit": { size: s.maxSize, unit: "KB" },
|
|
803
|
+
multiple: s.multiple,
|
|
804
|
+
disabled: s.disabled,
|
|
805
|
+
"request-method": s.requestMethod,
|
|
806
|
+
onSuccess: u,
|
|
807
|
+
onFail: y,
|
|
808
|
+
onRemove: d,
|
|
809
|
+
onValidate: r
|
|
810
|
+
}, null, 8, ["modelValue", "action", "accept", "max", "size-limit", "multiple", "disabled", "request-method"])) : (B(), $(m(ee), {
|
|
811
|
+
key: 1,
|
|
812
|
+
modelValue: c.value,
|
|
813
|
+
"onUpdate:modelValue": o[1] || (o[1] = (e) => c.value = e),
|
|
814
|
+
action: s.action,
|
|
815
|
+
accept: p.value,
|
|
816
|
+
max: s.max,
|
|
817
|
+
"size-limit": { size: s.maxSize, unit: "KB" },
|
|
818
|
+
multiple: s.multiple,
|
|
819
|
+
disabled: s.disabled,
|
|
820
|
+
"request-method": s.requestMethod,
|
|
821
|
+
onSuccess: u,
|
|
822
|
+
onFail: y,
|
|
823
|
+
onRemove: d,
|
|
824
|
+
onValidate: r
|
|
825
|
+
}, null, 8, ["modelValue", "action", "accept", "max", "size-limit", "multiple", "disabled", "request-method"]))
|
|
826
|
+
]));
|
|
827
|
+
}
|
|
828
|
+
}), Ke = /* @__PURE__ */ U(Fe, [["__scopeId", "data-v-a3054ef0"]]), je = { class: "smart-form" }, ze = {
|
|
829
|
+
key: 0,
|
|
830
|
+
class: "smart-form-footer"
|
|
831
|
+
}, Me = {
|
|
832
|
+
name: "SmartForm"
|
|
833
|
+
}, Ne = /* @__PURE__ */ L({
|
|
834
|
+
...Me,
|
|
835
|
+
props: {
|
|
836
|
+
modelValue: {},
|
|
837
|
+
schemas: {},
|
|
838
|
+
labelWidth: { default: "80px" },
|
|
839
|
+
labelAlign: { default: "left" },
|
|
840
|
+
showFooter: { type: Boolean, default: !0 },
|
|
841
|
+
submitBtnText: { default: "提交" },
|
|
842
|
+
resetBtnText: { default: "重置" },
|
|
843
|
+
loading: { type: Boolean, default: !1 },
|
|
844
|
+
disabled: { type: Boolean, default: !1 },
|
|
845
|
+
componentMap: {}
|
|
846
|
+
},
|
|
847
|
+
emits: ["update:modelValue", "submit", "reset", "validate-failed"],
|
|
848
|
+
setup(s, { expose: b, emit: n }) {
|
|
849
|
+
const f = s, c = n, p = R(), v = {
|
|
850
|
+
input: A,
|
|
851
|
+
password: A,
|
|
852
|
+
number: A,
|
|
853
|
+
textarea: ge,
|
|
854
|
+
select: Se,
|
|
855
|
+
cascader: _e,
|
|
856
|
+
"tree-select": Re,
|
|
857
|
+
date: le,
|
|
858
|
+
time: le,
|
|
859
|
+
switch: he,
|
|
860
|
+
radio: be,
|
|
861
|
+
checkbox: ve,
|
|
862
|
+
stepper: ye,
|
|
863
|
+
upload: Ke
|
|
864
|
+
}, h = (u) => {
|
|
865
|
+
const y = u || "input";
|
|
866
|
+
return f.componentMap?.[y] ? f.componentMap[y] : v[y] ?? null;
|
|
867
|
+
}, P = (u) => {
|
|
868
|
+
const y = [];
|
|
869
|
+
return u.required && y.push({ required: !0, message: `${u.label || "该项"}不能为空` }), u.rules && y.push(...u.rules), y;
|
|
870
|
+
}, C = (u) => {
|
|
871
|
+
const y = f.modelValue;
|
|
872
|
+
let d = {};
|
|
873
|
+
typeof u.props == "function" ? d = u.props(y) : u.props && (d = { ...u.props });
|
|
874
|
+
const r = u.type || "input";
|
|
875
|
+
if (r === "password" ? Object.assign(d, { type: "password" }) : r === "number" ? Object.assign(d, { type: "number" }) : r === "date" ? Object.assign(d, { mode: "date" }) : r === "time" && Object.assign(d, { mode: ["hour", "minute"] }), ["input", "password", "number", "textarea"].includes(r) && (!(typeof u.props == "object" && u.props !== null && Object.prototype.hasOwnProperty.call(u.props, "borderless")) && d.borderless === void 0 && (d.borderless = !0), d.type === "file" && (console.warn(
|
|
876
|
+
`[SmartForm] Detected type="file" on Input component (field: ${u.name}). Please use type: "upload" in your schema instead.`
|
|
877
|
+
), delete d.type)), f.disabled)
|
|
878
|
+
Object.assign(d, { disabled: !0 });
|
|
879
|
+
else if (u.disabled) {
|
|
880
|
+
const t = typeof u.disabled == "function" ? u.disabled(y) : u.disabled;
|
|
881
|
+
Object.assign(d, { disabled: t });
|
|
882
|
+
}
|
|
883
|
+
return d;
|
|
884
|
+
}, V = (u) => u.hidden === void 0 ? !0 : typeof u.hidden == "function" ? !u.hidden(f.modelValue) : !u.hidden, k = (u) => {
|
|
885
|
+
u.validateResult === !0 ? c("submit", ue(f.modelValue)) : c("validate-failed", u.validateResult);
|
|
886
|
+
}, S = () => {
|
|
887
|
+
p.value?.reset(), c("reset");
|
|
888
|
+
};
|
|
889
|
+
return b({
|
|
890
|
+
validate: () => p.value?.validate(),
|
|
891
|
+
reset: () => p.value?.reset(),
|
|
892
|
+
clearValidate: () => p.value?.clearValidate()
|
|
893
|
+
}), (u, y) => (B(), _("div", je, [
|
|
894
|
+
O(m(pe), {
|
|
895
|
+
ref_key: "formRef",
|
|
896
|
+
ref: p,
|
|
897
|
+
data: s.modelValue,
|
|
898
|
+
"label-width": s.labelWidth,
|
|
899
|
+
"label-align": s.labelAlign,
|
|
900
|
+
onSubmit: k
|
|
901
|
+
}, {
|
|
902
|
+
default: I(() => [
|
|
903
|
+
(B(!0), _(Z, null, F(s.schemas, (d) => (B(), _(Z, {
|
|
904
|
+
key: d.name
|
|
905
|
+
}, [
|
|
906
|
+
V(d) ? (B(), $(m(me), {
|
|
907
|
+
key: 0,
|
|
908
|
+
name: d.name,
|
|
909
|
+
label: d.label,
|
|
910
|
+
rules: P(d),
|
|
911
|
+
help: d.help
|
|
912
|
+
}, {
|
|
913
|
+
default: I(() => [
|
|
914
|
+
d.type === "slot" && d.slot ? K(u.$slots, d.slot, {
|
|
915
|
+
key: 0,
|
|
916
|
+
model: s.modelValue,
|
|
917
|
+
schema: d
|
|
918
|
+
}, void 0, !0) : (B(), $(se(h(d.type)), T({
|
|
919
|
+
key: 1,
|
|
920
|
+
modelValue: s.modelValue[d.name],
|
|
921
|
+
"onUpdate:modelValue": (r) => s.modelValue[d.name] = r
|
|
922
|
+
}, { ref_for: !0 }, C(d)), null, 16, ["modelValue", "onUpdate:modelValue"]))
|
|
923
|
+
]),
|
|
924
|
+
_: 2
|
|
925
|
+
}, 1032, ["name", "label", "rules", "help"])) : z("", !0)
|
|
926
|
+
], 64))), 128)),
|
|
927
|
+
s.showFooter ? (B(), _("div", ze, [
|
|
928
|
+
O(m(te), {
|
|
929
|
+
theme: "primary",
|
|
930
|
+
type: "submit",
|
|
931
|
+
block: "",
|
|
932
|
+
loading: s.loading,
|
|
933
|
+
disabled: s.disabled
|
|
934
|
+
}, {
|
|
935
|
+
default: I(() => [
|
|
936
|
+
Q(X(s.submitBtnText), 1)
|
|
937
|
+
]),
|
|
938
|
+
_: 1
|
|
939
|
+
}, 8, ["loading", "disabled"]),
|
|
940
|
+
s.resetBtnText ? (B(), $(m(te), {
|
|
941
|
+
key: 0,
|
|
942
|
+
theme: "default",
|
|
943
|
+
variant: "outline",
|
|
944
|
+
block: "",
|
|
945
|
+
class: "reset-btn",
|
|
946
|
+
onClick: S,
|
|
947
|
+
disabled: s.disabled || s.loading
|
|
948
|
+
}, {
|
|
949
|
+
default: I(() => [
|
|
950
|
+
Q(X(s.resetBtnText), 1)
|
|
951
|
+
]),
|
|
952
|
+
_: 1
|
|
953
|
+
}, 8, ["disabled"])) : z("", !0)
|
|
954
|
+
])) : z("", !0)
|
|
955
|
+
]),
|
|
956
|
+
_: 3
|
|
957
|
+
}, 8, ["data", "label-width", "label-align"])
|
|
958
|
+
]));
|
|
959
|
+
}
|
|
960
|
+
}), De = /* @__PURE__ */ U(Ne, [["__scopeId", "data-v-88de1754"]]);
|
|
961
|
+
export {
|
|
962
|
+
_e as SmartCascader,
|
|
963
|
+
De as SmartForm,
|
|
964
|
+
Se as SmartSelect,
|
|
965
|
+
le as SmartTimePicker,
|
|
966
|
+
Re as SmartTreeSelect,
|
|
967
|
+
Ke as SmartUpload
|
|
968
|
+
};
|
|
969
|
+
//# sourceMappingURL=index.js.map
|