@harbor-design/proform 1.3.23 → 1.3.24
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/dist/index.js +504 -534
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Te = Object.defineProperty;
|
|
2
|
-
var ze = (
|
|
3
|
-
var u = (
|
|
4
|
-
import { ref as z, readonly as Pe, nextTick as
|
|
2
|
+
var ze = (t, e, r) => e in t ? Te(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var u = (t, e, r) => (ze(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
+
import { ref as z, readonly as Pe, nextTick as O, isRef as q, watch as _, isReactive as U, toRaw as x, reactive as K, createVNode as b, mergeProps as N, withDirectives as Le, vShow as De, createTextVNode as Ge, isVNode as Be, defineComponent as He } from "vue";
|
|
5
5
|
class o {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -50,17 +50,17 @@ class o {
|
|
|
50
50
|
return !1;
|
|
51
51
|
if (this.isObjectEmpty(e))
|
|
52
52
|
return !0;
|
|
53
|
-
for (const
|
|
54
|
-
if (
|
|
53
|
+
for (const r in e) {
|
|
54
|
+
if (r === "componentProps")
|
|
55
55
|
return !1;
|
|
56
|
-
if (e.hasOwnProperty(
|
|
56
|
+
if (e.hasOwnProperty(r) && this.isProcessInprogress(e[r]))
|
|
57
57
|
return !0;
|
|
58
58
|
}
|
|
59
59
|
} else if (this.isArray(e)) {
|
|
60
60
|
if (this.isArrayEmpty(e))
|
|
61
61
|
return !0;
|
|
62
|
-
for (const
|
|
63
|
-
if (this.isProcessInprogress(
|
|
62
|
+
for (const r of e)
|
|
63
|
+
if (this.isProcessInprogress(r))
|
|
64
64
|
return !0;
|
|
65
65
|
}
|
|
66
66
|
return !1;
|
|
@@ -69,20 +69,20 @@ class o {
|
|
|
69
69
|
return !!e.__proform_raw_object;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function h(
|
|
73
|
-
return e.forEach((
|
|
74
|
-
if (Array.isArray(
|
|
75
|
-
Array.isArray(
|
|
76
|
-
typeof i == "object" && i !== null ?
|
|
72
|
+
function h(t, ...e) {
|
|
73
|
+
return e.forEach((r) => {
|
|
74
|
+
if (Array.isArray(r))
|
|
75
|
+
Array.isArray(t) || (t = []), r.forEach((i, s) => {
|
|
76
|
+
typeof i == "object" && i !== null ? t[s] = h(Array.isArray(i) ? [] : {}, i) : t[s] = i;
|
|
77
77
|
});
|
|
78
78
|
else
|
|
79
|
-
for (const i in
|
|
80
|
-
|
|
81
|
-
}),
|
|
79
|
+
for (const i in r)
|
|
80
|
+
r.hasOwnProperty(i) && (typeof r[i] == "object" && r[i] !== null ? t[i] = h(t[i] || {}, r[i]) : t[i] = r[i]);
|
|
81
|
+
}), t;
|
|
82
82
|
}
|
|
83
|
-
function P(
|
|
83
|
+
function P(t) {
|
|
84
84
|
const e = /* @__PURE__ */ new WeakMap();
|
|
85
|
-
function
|
|
85
|
+
function r(i) {
|
|
86
86
|
if (i === null || typeof i != "object")
|
|
87
87
|
return i;
|
|
88
88
|
if (i instanceof Date)
|
|
@@ -92,13 +92,13 @@ function P(r) {
|
|
|
92
92
|
if (i instanceof Map) {
|
|
93
93
|
const n = /* @__PURE__ */ new Map();
|
|
94
94
|
for (const [a, l] of i)
|
|
95
|
-
n.set(
|
|
95
|
+
n.set(r(a), r(l));
|
|
96
96
|
return n;
|
|
97
97
|
}
|
|
98
98
|
if (i instanceof Set) {
|
|
99
99
|
const n = /* @__PURE__ */ new Set();
|
|
100
100
|
for (const a of i)
|
|
101
|
-
n.add(
|
|
101
|
+
n.add(r(a));
|
|
102
102
|
return n;
|
|
103
103
|
}
|
|
104
104
|
if (e.has(i))
|
|
@@ -107,19 +107,19 @@ function P(r) {
|
|
|
107
107
|
const n = [];
|
|
108
108
|
e.set(i, n);
|
|
109
109
|
for (let a = 0; a < i.length; a++)
|
|
110
|
-
n[a] =
|
|
110
|
+
n[a] = r(i[a]);
|
|
111
111
|
return n;
|
|
112
112
|
}
|
|
113
113
|
const s = Object.create(Object.getPrototypeOf(i));
|
|
114
114
|
e.set(i, s);
|
|
115
115
|
for (const n in i)
|
|
116
|
-
i.hasOwnProperty(n) && (s[n] =
|
|
116
|
+
i.hasOwnProperty(n) && (s[n] = r(i[n]));
|
|
117
117
|
return s;
|
|
118
118
|
}
|
|
119
|
-
return t
|
|
119
|
+
return r(t);
|
|
120
120
|
}
|
|
121
|
-
function Y(
|
|
122
|
-
return
|
|
121
|
+
function Y(t, e) {
|
|
122
|
+
return t.replace(/undefined/g, e);
|
|
123
123
|
}
|
|
124
124
|
class Ke {
|
|
125
125
|
constructor(e) {
|
|
@@ -129,8 +129,8 @@ class Ke {
|
|
|
129
129
|
}
|
|
130
130
|
// happy path, 后续可以完善更多的 fallback 处理,fallback 处理是为了不卡住异步时的首次渲染做的优化
|
|
131
131
|
cleanFallbackFields(e) {
|
|
132
|
-
return e !== null && typeof e == "object" && (delete e.__yiwwhl_async_field_fallback, Object.values(e).forEach((
|
|
133
|
-
this.cleanFallbackFields(
|
|
132
|
+
return e !== null && typeof e == "object" && (delete e.__yiwwhl_async_field_fallback, Object.values(e).forEach((r) => {
|
|
133
|
+
this.cleanFallbackFields(r);
|
|
134
134
|
})), e;
|
|
135
135
|
}
|
|
136
136
|
setup(e) {
|
|
@@ -138,14 +138,14 @@ class Ke {
|
|
|
138
138
|
}
|
|
139
139
|
submit() {
|
|
140
140
|
var i;
|
|
141
|
-
const e = (i = c.getPreset(this.runtimeCore.ui)) == null ? void 0 : i.adapter,
|
|
142
|
-
return (e == null ? void 0 : e.validateForm(this)) ?? (
|
|
141
|
+
const e = (i = c.getPreset(this.runtimeCore.ui)) == null ? void 0 : i.adapter, r = I.adapters[c.getUI(this.runtimeCore.ui)];
|
|
142
|
+
return (e == null ? void 0 : e.validateForm(this)) ?? (r == null ? void 0 : r.validateForm(this));
|
|
143
143
|
}
|
|
144
144
|
hydrate(e) {
|
|
145
|
-
|
|
145
|
+
O(() => {
|
|
146
146
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
147
147
|
() => {
|
|
148
|
-
|
|
148
|
+
q(e) ? _(
|
|
149
149
|
() => e.value,
|
|
150
150
|
() => {
|
|
151
151
|
h(this.runtimeCore.model.value, e.value);
|
|
@@ -154,7 +154,7 @@ class Ke {
|
|
|
154
154
|
deep: !0,
|
|
155
155
|
immediate: !0
|
|
156
156
|
}
|
|
157
|
-
) :
|
|
157
|
+
) : U(e) ? _(
|
|
158
158
|
() => e,
|
|
159
159
|
() => {
|
|
160
160
|
h(this.runtimeCore.model.value, e);
|
|
@@ -172,65 +172,45 @@ class Ke {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
share(e) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
()
|
|
178
|
-
|
|
179
|
-
h(this.runtimeCore.shared, e.value);
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
deep: !0,
|
|
183
|
-
immediate: !0
|
|
184
|
-
}
|
|
185
|
-
) : j(e) ? g(
|
|
186
|
-
() => e,
|
|
187
|
-
() => {
|
|
188
|
-
h(this.runtimeCore.shared, e);
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
deep: !0,
|
|
192
|
-
immediate: !0
|
|
193
|
-
}
|
|
194
|
-
) : Object.keys(e).forEach((t) => {
|
|
195
|
-
console.log(e[t], S(e[t]), j(e[t])), S(e[t]) ? (Object.assign(this.runtimeCore.shared, {
|
|
196
|
-
[t]: e[t].value
|
|
197
|
-
}), g(
|
|
198
|
-
() => e[t].value,
|
|
175
|
+
O(() => {
|
|
176
|
+
Object.keys(e).forEach((r) => {
|
|
177
|
+
q(e[r]) ? _(
|
|
178
|
+
() => e[r].value,
|
|
199
179
|
() => {
|
|
200
180
|
h(this.runtimeCore.shared, {
|
|
201
|
-
[
|
|
181
|
+
[r]: e[r].value
|
|
202
182
|
});
|
|
203
183
|
},
|
|
204
184
|
{
|
|
205
|
-
deep: !0
|
|
185
|
+
deep: !0,
|
|
186
|
+
immediate: !0
|
|
206
187
|
}
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
}), g(
|
|
210
|
-
() => e[t],
|
|
188
|
+
) : U(e[r]) ? _(
|
|
189
|
+
() => e[r],
|
|
211
190
|
() => {
|
|
212
191
|
h(this.runtimeCore.shared, {
|
|
213
|
-
[
|
|
192
|
+
[r]: e[r]
|
|
214
193
|
});
|
|
215
194
|
},
|
|
216
195
|
{
|
|
217
|
-
deep: !0
|
|
196
|
+
deep: !0,
|
|
197
|
+
immediate: !0
|
|
218
198
|
}
|
|
219
|
-
)
|
|
220
|
-
[
|
|
199
|
+
) : h(this.runtimeCore.shared, {
|
|
200
|
+
[r]: e[r]
|
|
221
201
|
});
|
|
222
202
|
});
|
|
223
203
|
});
|
|
224
204
|
}
|
|
225
205
|
subscribeModel(e) {
|
|
226
|
-
|
|
227
|
-
const
|
|
206
|
+
O(() => {
|
|
207
|
+
const r = _(
|
|
228
208
|
() => this.readonlyReactiveModel.value,
|
|
229
209
|
(i) => {
|
|
230
210
|
e(i, {
|
|
231
211
|
stopSubscribe() {
|
|
232
|
-
|
|
233
|
-
|
|
212
|
+
O(() => {
|
|
213
|
+
r();
|
|
234
214
|
});
|
|
235
215
|
}
|
|
236
216
|
});
|
|
@@ -262,81 +242,81 @@ class Z {
|
|
|
262
242
|
triggerEffects() {
|
|
263
243
|
Array.from(this.effects).forEach((e) => e());
|
|
264
244
|
}
|
|
265
|
-
trackEffect(e,
|
|
245
|
+
trackEffect(e, r = {
|
|
266
246
|
lazy: !0
|
|
267
247
|
}) {
|
|
268
|
-
return !
|
|
248
|
+
return !r.lazy && e(), r.identifier ? this.identifierMap.get(r.identifier) || (this.effects.add(e), this.identifierMap.set(r.identifier, !0)) : this.effects.add(e), () => this.effects.delete(e);
|
|
269
249
|
}
|
|
270
250
|
}
|
|
271
|
-
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Q = We || Xe || Function("return this")(),
|
|
272
|
-
function Je(
|
|
273
|
-
var e = Ye.call(
|
|
251
|
+
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Q = We || Xe || Function("return this")(), E = Q.Symbol, je = Object.prototype, Ye = je.hasOwnProperty, Ze = je.toString, V = E ? E.toStringTag : void 0;
|
|
252
|
+
function Je(t) {
|
|
253
|
+
var e = Ye.call(t, V), r = t[V];
|
|
274
254
|
try {
|
|
275
|
-
|
|
255
|
+
t[V] = void 0;
|
|
276
256
|
var i = !0;
|
|
277
257
|
} catch {
|
|
278
258
|
}
|
|
279
|
-
var s = Ze.call(
|
|
280
|
-
return i && (e ?
|
|
259
|
+
var s = Ze.call(t);
|
|
260
|
+
return i && (e ? t[V] = r : delete t[V]), s;
|
|
281
261
|
}
|
|
282
262
|
var Qe = Object.prototype, ke = Qe.toString;
|
|
283
|
-
function Ae(
|
|
284
|
-
return ke.call(
|
|
263
|
+
function Ae(t) {
|
|
264
|
+
return ke.call(t);
|
|
285
265
|
}
|
|
286
|
-
var et = "[object Null]", tt = "[object Undefined]",
|
|
287
|
-
function we(
|
|
288
|
-
return
|
|
266
|
+
var et = "[object Null]", tt = "[object Undefined]", Ie = E ? E.toStringTag : void 0;
|
|
267
|
+
function we(t) {
|
|
268
|
+
return t == null ? t === void 0 ? tt : et : Ie && Ie in Object(t) ? Je(t) : Ae(t);
|
|
289
269
|
}
|
|
290
|
-
function rt(
|
|
291
|
-
return
|
|
270
|
+
function rt(t) {
|
|
271
|
+
return t != null && typeof t == "object";
|
|
292
272
|
}
|
|
293
273
|
var it = "[object Symbol]";
|
|
294
|
-
function k(
|
|
295
|
-
return typeof
|
|
274
|
+
function k(t) {
|
|
275
|
+
return typeof t == "symbol" || rt(t) && we(t) == it;
|
|
296
276
|
}
|
|
297
|
-
function st(
|
|
298
|
-
for (var
|
|
299
|
-
s[
|
|
277
|
+
function st(t, e) {
|
|
278
|
+
for (var r = -1, i = t == null ? 0 : t.length, s = Array(i); ++r < i; )
|
|
279
|
+
s[r] = e(t[r], r, t);
|
|
300
280
|
return s;
|
|
301
281
|
}
|
|
302
|
-
var A = Array.isArray, nt = 1 / 0,
|
|
303
|
-
function Me(
|
|
304
|
-
if (typeof
|
|
305
|
-
return
|
|
306
|
-
if (A(
|
|
307
|
-
return st(
|
|
308
|
-
if (k(
|
|
309
|
-
return
|
|
310
|
-
var e =
|
|
311
|
-
return e == "0" && 1 /
|
|
282
|
+
var A = Array.isArray, nt = 1 / 0, Ce = E ? E.prototype : void 0, Se = Ce ? Ce.toString : void 0;
|
|
283
|
+
function Me(t) {
|
|
284
|
+
if (typeof t == "string")
|
|
285
|
+
return t;
|
|
286
|
+
if (A(t))
|
|
287
|
+
return st(t, Me) + "";
|
|
288
|
+
if (k(t))
|
|
289
|
+
return Se ? Se.call(t) : "";
|
|
290
|
+
var e = t + "";
|
|
291
|
+
return e == "0" && 1 / t == -nt ? "-0" : e;
|
|
312
292
|
}
|
|
313
|
-
function G(
|
|
314
|
-
var e = typeof
|
|
315
|
-
return
|
|
293
|
+
function G(t) {
|
|
294
|
+
var e = typeof t;
|
|
295
|
+
return t != null && (e == "object" || e == "function");
|
|
316
296
|
}
|
|
317
297
|
var ot = "[object AsyncFunction]", at = "[object Function]", lt = "[object GeneratorFunction]", ut = "[object Proxy]";
|
|
318
|
-
function ft(
|
|
319
|
-
if (!G(
|
|
298
|
+
function ft(t) {
|
|
299
|
+
if (!G(t))
|
|
320
300
|
return !1;
|
|
321
|
-
var e = we(
|
|
301
|
+
var e = we(t);
|
|
322
302
|
return e == at || e == lt || e == ot || e == ut;
|
|
323
303
|
}
|
|
324
|
-
var W = Q["__core-js_shared__"],
|
|
325
|
-
var
|
|
326
|
-
return
|
|
304
|
+
var W = Q["__core-js_shared__"], Oe = function() {
|
|
305
|
+
var t = /[^.]+$/.exec(W && W.keys && W.keys.IE_PROTO || "");
|
|
306
|
+
return t ? "Symbol(src)_1." + t : "";
|
|
327
307
|
}();
|
|
328
|
-
function ct(
|
|
329
|
-
return !!
|
|
308
|
+
function ct(t) {
|
|
309
|
+
return !!Oe && Oe in t;
|
|
330
310
|
}
|
|
331
311
|
var dt = Function.prototype, pt = dt.toString;
|
|
332
|
-
function ht(
|
|
333
|
-
if (
|
|
312
|
+
function ht(t) {
|
|
313
|
+
if (t != null) {
|
|
334
314
|
try {
|
|
335
|
-
return pt.call(
|
|
315
|
+
return pt.call(t);
|
|
336
316
|
} catch {
|
|
337
317
|
}
|
|
338
318
|
try {
|
|
339
|
-
return
|
|
319
|
+
return t + "";
|
|
340
320
|
} catch {
|
|
341
321
|
}
|
|
342
322
|
}
|
|
@@ -345,242 +325,242 @@ function ht(r) {
|
|
|
345
325
|
var mt = /[\\^$.*+?()[\]{}|]/g, bt = /^\[object .+?Constructor\]$/, gt = Function.prototype, vt = Object.prototype, yt = gt.toString, _t = vt.hasOwnProperty, Pt = RegExp(
|
|
346
326
|
"^" + yt.call(_t).replace(mt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
347
327
|
);
|
|
348
|
-
function
|
|
349
|
-
if (!G(
|
|
328
|
+
function It(t) {
|
|
329
|
+
if (!G(t) || ct(t))
|
|
350
330
|
return !1;
|
|
351
|
-
var e = ft(
|
|
352
|
-
return e.test(ht(
|
|
331
|
+
var e = ft(t) ? Pt : bt;
|
|
332
|
+
return e.test(ht(t));
|
|
353
333
|
}
|
|
354
|
-
function
|
|
355
|
-
return
|
|
334
|
+
function Ct(t, e) {
|
|
335
|
+
return t == null ? void 0 : t[e];
|
|
356
336
|
}
|
|
357
|
-
function ee(
|
|
358
|
-
var
|
|
359
|
-
return
|
|
337
|
+
function ee(t, e) {
|
|
338
|
+
var r = Ct(t, e);
|
|
339
|
+
return It(r) ? r : void 0;
|
|
360
340
|
}
|
|
361
|
-
var
|
|
341
|
+
var Fe = function() {
|
|
362
342
|
try {
|
|
363
|
-
var
|
|
364
|
-
return
|
|
343
|
+
var t = ee(Object, "defineProperty");
|
|
344
|
+
return t({}, "", {}), t;
|
|
365
345
|
} catch {
|
|
366
346
|
}
|
|
367
|
-
}(),
|
|
368
|
-
function
|
|
369
|
-
var
|
|
370
|
-
return e = e ??
|
|
347
|
+
}(), St = 9007199254740991, Ot = /^(?:0|[1-9]\d*)$/;
|
|
348
|
+
function Ft(t, e) {
|
|
349
|
+
var r = typeof t;
|
|
350
|
+
return e = e ?? St, !!e && (r == "number" || r != "symbol" && Ot.test(t)) && t > -1 && t % 1 == 0 && t < e;
|
|
371
351
|
}
|
|
372
|
-
function
|
|
373
|
-
e == "__proto__" &&
|
|
352
|
+
function jt(t, e, r) {
|
|
353
|
+
e == "__proto__" && Fe ? Fe(t, e, {
|
|
374
354
|
configurable: !0,
|
|
375
355
|
enumerable: !0,
|
|
376
|
-
value:
|
|
356
|
+
value: r,
|
|
377
357
|
writable: !0
|
|
378
|
-
}) :
|
|
358
|
+
}) : t[e] = r;
|
|
379
359
|
}
|
|
380
|
-
function xe(
|
|
381
|
-
return
|
|
360
|
+
function xe(t, e) {
|
|
361
|
+
return t === e || t !== t && e !== e;
|
|
382
362
|
}
|
|
383
363
|
var wt = Object.prototype, Mt = wt.hasOwnProperty;
|
|
384
|
-
function xt(
|
|
385
|
-
var i =
|
|
386
|
-
(!(Mt.call(
|
|
364
|
+
function xt(t, e, r) {
|
|
365
|
+
var i = t[e];
|
|
366
|
+
(!(Mt.call(t, e) && xe(i, r)) || r === void 0 && !(e in t)) && jt(t, e, r);
|
|
387
367
|
}
|
|
388
368
|
var Et = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rt = /^\w*$/;
|
|
389
|
-
function $t(
|
|
390
|
-
if (A(
|
|
369
|
+
function $t(t, e) {
|
|
370
|
+
if (A(t))
|
|
391
371
|
return !1;
|
|
392
|
-
var
|
|
393
|
-
return
|
|
372
|
+
var r = typeof t;
|
|
373
|
+
return r == "number" || r == "symbol" || r == "boolean" || t == null || k(t) ? !0 : Rt.test(t) || !Et.test(t) || e != null && t in Object(e);
|
|
394
374
|
}
|
|
395
375
|
var T = ee(Object, "create");
|
|
396
376
|
function Vt() {
|
|
397
377
|
this.__data__ = T ? T(null) : {}, this.size = 0;
|
|
398
378
|
}
|
|
399
|
-
function Nt(
|
|
400
|
-
var e = this.has(
|
|
379
|
+
function Nt(t) {
|
|
380
|
+
var e = this.has(t) && delete this.__data__[t];
|
|
401
381
|
return this.size -= e ? 1 : 0, e;
|
|
402
382
|
}
|
|
403
383
|
var qt = "__lodash_hash_undefined__", Ut = Object.prototype, Tt = Ut.hasOwnProperty;
|
|
404
|
-
function zt(
|
|
384
|
+
function zt(t) {
|
|
405
385
|
var e = this.__data__;
|
|
406
386
|
if (T) {
|
|
407
|
-
var
|
|
408
|
-
return
|
|
387
|
+
var r = e[t];
|
|
388
|
+
return r === qt ? void 0 : r;
|
|
409
389
|
}
|
|
410
|
-
return Tt.call(e,
|
|
390
|
+
return Tt.call(e, t) ? e[t] : void 0;
|
|
411
391
|
}
|
|
412
392
|
var Lt = Object.prototype, Dt = Lt.hasOwnProperty;
|
|
413
|
-
function Gt(
|
|
393
|
+
function Gt(t) {
|
|
414
394
|
var e = this.__data__;
|
|
415
|
-
return T ? e[
|
|
395
|
+
return T ? e[t] !== void 0 : Dt.call(e, t);
|
|
416
396
|
}
|
|
417
397
|
var Bt = "__lodash_hash_undefined__";
|
|
418
|
-
function Ht(
|
|
419
|
-
var
|
|
420
|
-
return this.size += this.has(
|
|
421
|
-
}
|
|
422
|
-
function
|
|
423
|
-
var e = -1,
|
|
424
|
-
for (this.clear(); ++e <
|
|
425
|
-
var i =
|
|
398
|
+
function Ht(t, e) {
|
|
399
|
+
var r = this.__data__;
|
|
400
|
+
return this.size += this.has(t) ? 0 : 1, r[t] = T && e === void 0 ? Bt : e, this;
|
|
401
|
+
}
|
|
402
|
+
function F(t) {
|
|
403
|
+
var e = -1, r = t == null ? 0 : t.length;
|
|
404
|
+
for (this.clear(); ++e < r; ) {
|
|
405
|
+
var i = t[e];
|
|
426
406
|
this.set(i[0], i[1]);
|
|
427
407
|
}
|
|
428
408
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
409
|
+
F.prototype.clear = Vt;
|
|
410
|
+
F.prototype.delete = Nt;
|
|
411
|
+
F.prototype.get = zt;
|
|
412
|
+
F.prototype.has = Gt;
|
|
413
|
+
F.prototype.set = Ht;
|
|
434
414
|
function Kt() {
|
|
435
415
|
this.__data__ = [], this.size = 0;
|
|
436
416
|
}
|
|
437
|
-
function B(
|
|
438
|
-
for (var
|
|
439
|
-
if (xe(r
|
|
440
|
-
return
|
|
417
|
+
function B(t, e) {
|
|
418
|
+
for (var r = t.length; r--; )
|
|
419
|
+
if (xe(t[r][0], e))
|
|
420
|
+
return r;
|
|
441
421
|
return -1;
|
|
442
422
|
}
|
|
443
423
|
var Wt = Array.prototype, Xt = Wt.splice;
|
|
444
|
-
function Yt(
|
|
445
|
-
var e = this.__data__,
|
|
446
|
-
if (
|
|
424
|
+
function Yt(t) {
|
|
425
|
+
var e = this.__data__, r = B(e, t);
|
|
426
|
+
if (r < 0)
|
|
447
427
|
return !1;
|
|
448
428
|
var i = e.length - 1;
|
|
449
|
-
return
|
|
429
|
+
return r == i ? e.pop() : Xt.call(e, r, 1), --this.size, !0;
|
|
450
430
|
}
|
|
451
|
-
function Zt(
|
|
452
|
-
var e = this.__data__,
|
|
453
|
-
return
|
|
431
|
+
function Zt(t) {
|
|
432
|
+
var e = this.__data__, r = B(e, t);
|
|
433
|
+
return r < 0 ? void 0 : e[r][1];
|
|
454
434
|
}
|
|
455
|
-
function Jt(
|
|
456
|
-
return B(this.__data__,
|
|
435
|
+
function Jt(t) {
|
|
436
|
+
return B(this.__data__, t) > -1;
|
|
457
437
|
}
|
|
458
|
-
function Qt(
|
|
459
|
-
var
|
|
460
|
-
return i < 0 ? (++this.size,
|
|
438
|
+
function Qt(t, e) {
|
|
439
|
+
var r = this.__data__, i = B(r, t);
|
|
440
|
+
return i < 0 ? (++this.size, r.push([t, e])) : r[i][1] = e, this;
|
|
461
441
|
}
|
|
462
|
-
function
|
|
463
|
-
var e = -1,
|
|
464
|
-
for (this.clear(); ++e <
|
|
465
|
-
var i =
|
|
442
|
+
function R(t) {
|
|
443
|
+
var e = -1, r = t == null ? 0 : t.length;
|
|
444
|
+
for (this.clear(); ++e < r; ) {
|
|
445
|
+
var i = t[e];
|
|
466
446
|
this.set(i[0], i[1]);
|
|
467
447
|
}
|
|
468
448
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
449
|
+
R.prototype.clear = Kt;
|
|
450
|
+
R.prototype.delete = Yt;
|
|
451
|
+
R.prototype.get = Zt;
|
|
452
|
+
R.prototype.has = Jt;
|
|
453
|
+
R.prototype.set = Qt;
|
|
474
454
|
var kt = ee(Q, "Map");
|
|
475
455
|
function At() {
|
|
476
456
|
this.size = 0, this.__data__ = {
|
|
477
|
-
hash: new
|
|
478
|
-
map: new (kt ||
|
|
479
|
-
string: new
|
|
457
|
+
hash: new F(),
|
|
458
|
+
map: new (kt || R)(),
|
|
459
|
+
string: new F()
|
|
480
460
|
};
|
|
481
461
|
}
|
|
482
|
-
function er(
|
|
483
|
-
var e = typeof
|
|
484
|
-
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ?
|
|
462
|
+
function er(t) {
|
|
463
|
+
var e = typeof t;
|
|
464
|
+
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
485
465
|
}
|
|
486
|
-
function H(
|
|
487
|
-
var
|
|
488
|
-
return er(e) ?
|
|
466
|
+
function H(t, e) {
|
|
467
|
+
var r = t.__data__;
|
|
468
|
+
return er(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
|
|
489
469
|
}
|
|
490
|
-
function tr(
|
|
491
|
-
var e = H(this,
|
|
470
|
+
function tr(t) {
|
|
471
|
+
var e = H(this, t).delete(t);
|
|
492
472
|
return this.size -= e ? 1 : 0, e;
|
|
493
473
|
}
|
|
494
|
-
function rr(
|
|
495
|
-
return H(this,
|
|
474
|
+
function rr(t) {
|
|
475
|
+
return H(this, t).get(t);
|
|
496
476
|
}
|
|
497
|
-
function ir(
|
|
498
|
-
return H(this,
|
|
477
|
+
function ir(t) {
|
|
478
|
+
return H(this, t).has(t);
|
|
499
479
|
}
|
|
500
|
-
function sr(
|
|
501
|
-
var
|
|
502
|
-
return
|
|
480
|
+
function sr(t, e) {
|
|
481
|
+
var r = H(this, t), i = r.size;
|
|
482
|
+
return r.set(t, e), this.size += r.size == i ? 0 : 1, this;
|
|
503
483
|
}
|
|
504
|
-
function
|
|
505
|
-
var e = -1,
|
|
506
|
-
for (this.clear(); ++e <
|
|
507
|
-
var i =
|
|
484
|
+
function j(t) {
|
|
485
|
+
var e = -1, r = t == null ? 0 : t.length;
|
|
486
|
+
for (this.clear(); ++e < r; ) {
|
|
487
|
+
var i = t[e];
|
|
508
488
|
this.set(i[0], i[1]);
|
|
509
489
|
}
|
|
510
490
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
491
|
+
j.prototype.clear = At;
|
|
492
|
+
j.prototype.delete = tr;
|
|
493
|
+
j.prototype.get = rr;
|
|
494
|
+
j.prototype.has = ir;
|
|
495
|
+
j.prototype.set = sr;
|
|
516
496
|
var nr = "Expected a function";
|
|
517
|
-
function te(
|
|
518
|
-
if (typeof
|
|
497
|
+
function te(t, e) {
|
|
498
|
+
if (typeof t != "function" || e != null && typeof e != "function")
|
|
519
499
|
throw new TypeError(nr);
|
|
520
|
-
var
|
|
521
|
-
var i = arguments, s = e ? e.apply(this, i) : i[0], n =
|
|
500
|
+
var r = function() {
|
|
501
|
+
var i = arguments, s = e ? e.apply(this, i) : i[0], n = r.cache;
|
|
522
502
|
if (n.has(s))
|
|
523
503
|
return n.get(s);
|
|
524
|
-
var a =
|
|
525
|
-
return
|
|
504
|
+
var a = t.apply(this, i);
|
|
505
|
+
return r.cache = n.set(s, a) || n, a;
|
|
526
506
|
};
|
|
527
|
-
return
|
|
507
|
+
return r.cache = new (te.Cache || j)(), r;
|
|
528
508
|
}
|
|
529
|
-
te.Cache =
|
|
509
|
+
te.Cache = j;
|
|
530
510
|
var or = 500;
|
|
531
|
-
function ar(
|
|
532
|
-
var e = te(
|
|
533
|
-
return
|
|
534
|
-
}),
|
|
511
|
+
function ar(t) {
|
|
512
|
+
var e = te(t, function(i) {
|
|
513
|
+
return r.size === or && r.clear(), i;
|
|
514
|
+
}), r = e.cache;
|
|
535
515
|
return e;
|
|
536
516
|
}
|
|
537
|
-
var lr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ur = /\\(\\)?/g, fr = ar(function(
|
|
517
|
+
var lr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ur = /\\(\\)?/g, fr = ar(function(t) {
|
|
538
518
|
var e = [];
|
|
539
|
-
return
|
|
540
|
-
e.push(s ? n.replace(ur, "$1") : i ||
|
|
519
|
+
return t.charCodeAt(0) === 46 && e.push(""), t.replace(lr, function(r, i, s, n) {
|
|
520
|
+
e.push(s ? n.replace(ur, "$1") : i || r);
|
|
541
521
|
}), e;
|
|
542
522
|
});
|
|
543
|
-
function cr(
|
|
544
|
-
return
|
|
523
|
+
function cr(t) {
|
|
524
|
+
return t == null ? "" : Me(t);
|
|
545
525
|
}
|
|
546
|
-
function Ee(
|
|
547
|
-
return A(
|
|
526
|
+
function Ee(t, e) {
|
|
527
|
+
return A(t) ? t : $t(t, e) ? [t] : fr(cr(t));
|
|
548
528
|
}
|
|
549
529
|
var dr = 1 / 0;
|
|
550
|
-
function Re(
|
|
551
|
-
if (typeof
|
|
552
|
-
return
|
|
553
|
-
var e =
|
|
554
|
-
return e == "0" && 1 /
|
|
530
|
+
function Re(t) {
|
|
531
|
+
if (typeof t == "string" || k(t))
|
|
532
|
+
return t;
|
|
533
|
+
var e = t + "";
|
|
534
|
+
return e == "0" && 1 / t == -dr ? "-0" : e;
|
|
555
535
|
}
|
|
556
|
-
function pr(
|
|
557
|
-
e = Ee(e,
|
|
558
|
-
for (var
|
|
559
|
-
|
|
560
|
-
return
|
|
536
|
+
function pr(t, e) {
|
|
537
|
+
e = Ee(e, t);
|
|
538
|
+
for (var r = 0, i = e.length; t != null && r < i; )
|
|
539
|
+
t = t[Re(e[r++])];
|
|
540
|
+
return r && r == i ? t : void 0;
|
|
561
541
|
}
|
|
562
|
-
function L(
|
|
563
|
-
var i =
|
|
564
|
-
return i === void 0 ?
|
|
542
|
+
function L(t, e, r) {
|
|
543
|
+
var i = t == null ? void 0 : pr(t, e);
|
|
544
|
+
return i === void 0 ? r : i;
|
|
565
545
|
}
|
|
566
|
-
function hr(
|
|
567
|
-
if (!G(
|
|
568
|
-
return
|
|
569
|
-
e = Ee(e,
|
|
570
|
-
for (var s = -1, n = e.length, a = n - 1, l =
|
|
571
|
-
var f = Re(e[s]), d =
|
|
546
|
+
function hr(t, e, r, i) {
|
|
547
|
+
if (!G(t))
|
|
548
|
+
return t;
|
|
549
|
+
e = Ee(e, t);
|
|
550
|
+
for (var s = -1, n = e.length, a = n - 1, l = t; l != null && ++s < n; ) {
|
|
551
|
+
var f = Re(e[s]), d = r;
|
|
572
552
|
if (f === "__proto__" || f === "constructor" || f === "prototype")
|
|
573
|
-
return
|
|
553
|
+
return t;
|
|
574
554
|
if (s != a) {
|
|
575
555
|
var p = l[f];
|
|
576
|
-
d = i ? i(p, f, l) : void 0, d === void 0 && (d = G(p) ? p :
|
|
556
|
+
d = i ? i(p, f, l) : void 0, d === void 0 && (d = G(p) ? p : Ft(e[s + 1]) ? [] : {});
|
|
577
557
|
}
|
|
578
558
|
xt(l, f, d), l = l[f];
|
|
579
559
|
}
|
|
580
|
-
return
|
|
560
|
+
return t;
|
|
581
561
|
}
|
|
582
|
-
function D(
|
|
583
|
-
return
|
|
562
|
+
function D(t, e, r) {
|
|
563
|
+
return t == null ? t : hr(t, e, r);
|
|
584
564
|
}
|
|
585
565
|
class mr {
|
|
586
566
|
constructor(e) {
|
|
@@ -590,8 +570,8 @@ class mr {
|
|
|
590
570
|
u(this, "getRuntimeMeta");
|
|
591
571
|
u(this, "stableSchemas", []);
|
|
592
572
|
u(this, "stableModel", {});
|
|
593
|
-
u(this, "schemaPreset",
|
|
594
|
-
u(this, "componentPropsPreset",
|
|
573
|
+
u(this, "schemaPreset", I.schemaPreset);
|
|
574
|
+
u(this, "componentPropsPreset", I.componentPropsPreset);
|
|
595
575
|
u(this, "stableUpdaterProcessProgress");
|
|
596
576
|
u(this, "stableUpdaterTimes", 0);
|
|
597
577
|
u(this, "schemaEffect", new Z());
|
|
@@ -599,7 +579,7 @@ class mr {
|
|
|
599
579
|
u(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
600
580
|
u(this, "baseDefaultValueFunctionsLength");
|
|
601
581
|
u(this, "isModelInitialized", !0);
|
|
602
|
-
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e),
|
|
582
|
+
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), _(
|
|
603
583
|
() => this.processedModel.value,
|
|
604
584
|
() => {
|
|
605
585
|
this.schemaEffect.triggerEffects();
|
|
@@ -610,81 +590,81 @@ class mr {
|
|
|
610
590
|
);
|
|
611
591
|
}
|
|
612
592
|
// 核心处理过程,接收一个初始的代理数据结构,由其衍生的有 parseSchema
|
|
613
|
-
parse(e,
|
|
593
|
+
parse(e, r) {
|
|
614
594
|
e.forEach((i, s) => {
|
|
615
|
-
this.parseItem(i, s,
|
|
595
|
+
this.parseItem(i, s, r);
|
|
616
596
|
});
|
|
617
597
|
}
|
|
618
598
|
// 初始化空数据结构,避免后续复杂的 if else
|
|
619
599
|
initSchemas(e) {
|
|
620
|
-
return e.map((
|
|
600
|
+
return e.map((r) => {
|
|
621
601
|
const i = {};
|
|
622
|
-
return
|
|
602
|
+
return r.children && (i.children = this.initSchemas(r.children)), i;
|
|
623
603
|
});
|
|
624
604
|
}
|
|
625
605
|
countFunctionDefaultValues(e) {
|
|
626
|
-
let
|
|
606
|
+
let r = 0;
|
|
627
607
|
const i = /* @__PURE__ */ new Set();
|
|
628
608
|
function s(n) {
|
|
629
609
|
if (!i.has(n) && (Array.isArray(n) || n !== null && typeof n == "object")) {
|
|
630
610
|
i.add(n);
|
|
631
611
|
for (const a in n)
|
|
632
|
-
n.hasOwnProperty(a) && (a === "defaultValue" && typeof n[a] == "function" && !n[a].toString().includes("[native code]") &&
|
|
612
|
+
n.hasOwnProperty(a) && (a === "defaultValue" && typeof n[a] == "function" && !n[a].toString().includes("[native code]") && r++, s(n[a]));
|
|
633
613
|
}
|
|
634
614
|
}
|
|
635
|
-
return s(e),
|
|
615
|
+
return s(e), r;
|
|
636
616
|
}
|
|
637
617
|
// 派生过程,用于外部应用
|
|
638
|
-
parseSchemas(e,
|
|
618
|
+
parseSchemas(e, r) {
|
|
639
619
|
o.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
640
620
|
P(e)
|
|
641
|
-
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e,
|
|
621
|
+
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, r);
|
|
642
622
|
}
|
|
643
623
|
parseStable(e) {
|
|
644
|
-
const
|
|
624
|
+
const r = {};
|
|
645
625
|
if (!o.isUndefined(e.stable))
|
|
646
|
-
|
|
626
|
+
r[e.key] = this.parseStable(e.stable);
|
|
647
627
|
else
|
|
648
628
|
return e;
|
|
649
|
-
return
|
|
629
|
+
return r;
|
|
650
630
|
}
|
|
651
631
|
// 对于稳定初始化更新的抽象
|
|
652
632
|
stableUpdater(e = []) {
|
|
653
633
|
if (e.every(Boolean)) {
|
|
654
|
-
const
|
|
655
|
-
!o.isProcessInprogress(
|
|
656
|
-
length:
|
|
657
|
-
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(
|
|
634
|
+
const r = x(this.processedSchemas.value);
|
|
635
|
+
!o.isProcessInprogress(r) && o.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
636
|
+
length: r.length
|
|
637
|
+
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(r));
|
|
658
638
|
}
|
|
659
639
|
}
|
|
660
640
|
// 核心单 schema 处理过程,接收一个对象键值对的数据结构
|
|
661
|
-
parseItem(e,
|
|
641
|
+
parseItem(e, r, i) {
|
|
662
642
|
const s = this, n = Array.from({
|
|
663
643
|
length: Object.keys(e).filter((l) => l !== "children").length
|
|
664
644
|
}).fill(!1);
|
|
665
|
-
this.objectParser({ data: e, index:
|
|
645
|
+
this.objectParser({ data: e, index: r, updater: a, parentMeta: i });
|
|
666
646
|
function a(l) {
|
|
667
647
|
const f = l.index, d = l.key, p = l.keyIndex;
|
|
668
648
|
if (o.isUndefined(l.stable))
|
|
669
649
|
return;
|
|
670
|
-
const m = s.parseStable(l.stable),
|
|
671
|
-
let
|
|
672
|
-
if (o.isProcessInprogress(
|
|
673
|
-
const
|
|
674
|
-
|
|
650
|
+
const m = s.parseStable(l.stable), v = i == null ? void 0 : i.index, C = i == null ? void 0 : i.key;
|
|
651
|
+
let y = m;
|
|
652
|
+
if (o.isProcessInprogress(y) || (n[p] = !0), i) {
|
|
653
|
+
const g = s.processedSchemas.value[v][C][f][d];
|
|
654
|
+
g && o.isObject(g) && d !== "component" && (y = h(g, y)), s.processedSchemas.value[v][C][f][d] = y, s.stableUpdater(n);
|
|
675
655
|
} else {
|
|
676
|
-
const
|
|
677
|
-
|
|
656
|
+
const g = s.processedSchemas.value[f][d];
|
|
657
|
+
g && o.isObject(g) && d !== "component" && (y = h(g, y)), s.processedSchemas.value[f][d] = y, s.stableUpdater(n);
|
|
678
658
|
}
|
|
679
659
|
}
|
|
680
660
|
}
|
|
681
661
|
// 只做基本的对象 parser
|
|
682
662
|
objectParser(e) {
|
|
683
|
-
const
|
|
684
|
-
Object.keys(
|
|
663
|
+
const r = e.data;
|
|
664
|
+
Object.keys(r).forEach((s, n) => {
|
|
685
665
|
var a, l;
|
|
686
666
|
if (s === "children")
|
|
687
|
-
this.parseSchemas(
|
|
667
|
+
this.parseSchemas(r[s], {
|
|
688
668
|
...e,
|
|
689
669
|
key: s,
|
|
690
670
|
keyIndex: n
|
|
@@ -698,16 +678,16 @@ class mr {
|
|
|
698
678
|
stable: d
|
|
699
679
|
});
|
|
700
680
|
};
|
|
701
|
-
o.isFunction(
|
|
681
|
+
o.isFunction(r[s]) ? s !== "defaultValue" ? this.schemaEffect.trackEffect(
|
|
702
682
|
() => {
|
|
703
683
|
if (s === "component") {
|
|
704
|
-
const d =
|
|
684
|
+
const d = r[s](this.getRuntimeMeta());
|
|
705
685
|
this.promiseFieldParser(d, f, !1, {
|
|
706
686
|
rootIndex: e.index,
|
|
707
687
|
parentMeta: e.parentMeta
|
|
708
688
|
});
|
|
709
689
|
} else
|
|
710
|
-
this.fieldParser(
|
|
690
|
+
this.fieldParser(r[s], f, {
|
|
711
691
|
rootIndex: e.index,
|
|
712
692
|
parentMeta: e.parentMeta
|
|
713
693
|
});
|
|
@@ -720,17 +700,17 @@ class mr {
|
|
|
720
700
|
() => {
|
|
721
701
|
const d = this.schemaEffect.trackEffect(
|
|
722
702
|
() => {
|
|
723
|
-
/\{\s*model\s*\}/.test(
|
|
724
|
-
|
|
703
|
+
/\{\s*model\s*\}/.test(r[s].toString()) ? this.fieldParser(
|
|
704
|
+
r[s],
|
|
725
705
|
(p) => {
|
|
726
706
|
if (!p)
|
|
727
707
|
return f(p);
|
|
728
|
-
this.defaultValueInprogressMap.set(
|
|
708
|
+
this.defaultValueInprogressMap.set(r[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
729
709
|
this.defaultValueInprogressMap.values()
|
|
730
710
|
).every((m) => {
|
|
731
|
-
var
|
|
732
|
-
return !((
|
|
733
|
-
}) ? (f(p), this.defaultValueEffect.clearEffects(),
|
|
711
|
+
var v;
|
|
712
|
+
return !((v = m == null ? void 0 : m.includes) != null && v.call(m, "undefined"));
|
|
713
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), O(() => {
|
|
734
714
|
d();
|
|
735
715
|
})) : f(p);
|
|
736
716
|
},
|
|
@@ -739,14 +719,14 @@ class mr {
|
|
|
739
719
|
parentMeta: e.parentMeta
|
|
740
720
|
}
|
|
741
721
|
) : this.fieldParser(
|
|
742
|
-
|
|
722
|
+
r[s],
|
|
743
723
|
(p) => {
|
|
744
|
-
this.defaultValueInprogressMap.set(
|
|
724
|
+
this.defaultValueInprogressMap.set(r[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
745
725
|
this.defaultValueInprogressMap.values()
|
|
746
726
|
).every((m) => {
|
|
747
|
-
var
|
|
748
|
-
return !((
|
|
749
|
-
}) ? (f(p), this.defaultValueEffect.clearEffects(),
|
|
727
|
+
var v;
|
|
728
|
+
return !((v = m == null ? void 0 : m.includes) != null && v.call(m, "undefined"));
|
|
729
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), O(() => {
|
|
750
730
|
d();
|
|
751
731
|
})) : f(p);
|
|
752
732
|
},
|
|
@@ -764,74 +744,74 @@ class mr {
|
|
|
764
744
|
{
|
|
765
745
|
lazy: !1
|
|
766
746
|
}
|
|
767
|
-
) : s === "component" || s === "slots" || s === "runtime" ? this.promiseFieldParser(
|
|
747
|
+
) : s === "component" || s === "slots" || s === "runtime" ? this.promiseFieldParser(r[s], f, !1, {
|
|
768
748
|
rootIndex: e.index,
|
|
769
749
|
parentMeta: e.parentMeta
|
|
770
|
-
}) : this.fieldParser(
|
|
750
|
+
}) : this.fieldParser(r[s], f, {
|
|
771
751
|
rootIndex: e.index,
|
|
772
752
|
parentMeta: e.parentMeta
|
|
773
753
|
});
|
|
774
754
|
}
|
|
775
755
|
});
|
|
776
756
|
}
|
|
777
|
-
promiseFieldParser(e,
|
|
757
|
+
promiseFieldParser(e, r, i, s) {
|
|
778
758
|
o.isPromise(e) ? e.then((n) => {
|
|
779
759
|
o.isString(n) && (n = Y(n, "")), i && o.isObject(n) && !o.isNativeObject(n) ? this.objectParser({
|
|
780
760
|
data: n,
|
|
781
|
-
updater:
|
|
761
|
+
updater: r,
|
|
782
762
|
index: s.rootIndex,
|
|
783
763
|
parentMeta: s.parentMeta
|
|
784
|
-
}) :
|
|
764
|
+
}) : r(n);
|
|
785
765
|
}) : (o.isString(e) && (e = Y(e, "")), i && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
786
766
|
data: e,
|
|
787
|
-
updater:
|
|
767
|
+
updater: r,
|
|
788
768
|
index: s.rootIndex,
|
|
789
769
|
parentMeta: s.parentMeta
|
|
790
|
-
}) :
|
|
770
|
+
}) : r(e));
|
|
791
771
|
}
|
|
792
772
|
// 对任意对象中单个字段的 parse: 做基本处理
|
|
793
|
-
fieldParser(e,
|
|
773
|
+
fieldParser(e, r, i, s = !0) {
|
|
794
774
|
if (o.isFunction(e))
|
|
795
775
|
if (e.name.startsWith("__proform_raw_"))
|
|
796
|
-
|
|
776
|
+
r(
|
|
797
777
|
(...n) => e({
|
|
798
778
|
rawArgs: n,
|
|
799
779
|
...this.getRuntimeMeta()
|
|
800
780
|
})
|
|
801
781
|
);
|
|
802
782
|
else if (e.name.startsWith("__proform_structured_path_parsing_mark_"))
|
|
803
|
-
|
|
783
|
+
r(e);
|
|
804
784
|
else if (e.__proform_cached_result) {
|
|
805
785
|
const n = e.__proform_cached_result;
|
|
806
|
-
this.promiseFieldParser(n,
|
|
786
|
+
this.promiseFieldParser(n, r, s, i);
|
|
807
787
|
} else {
|
|
808
788
|
const n = e(this.getRuntimeMeta());
|
|
809
|
-
e.name.startsWith("__proform_onetime_") && (e.__proform_cached_result = n), this.promiseFieldParser(n,
|
|
789
|
+
e.name.startsWith("__proform_onetime_") && (e.__proform_cached_result = n), this.promiseFieldParser(n, r, s, i);
|
|
810
790
|
}
|
|
811
791
|
else
|
|
812
|
-
|
|
792
|
+
q(e) ? _(
|
|
813
793
|
() => e.value,
|
|
814
794
|
() => {
|
|
815
795
|
o.isUndefined(e.value) || (s && o.isObject(e.value) && !o.isNativeObject(e.value) ? this.objectParser({
|
|
816
796
|
data: e.value,
|
|
817
|
-
updater:
|
|
797
|
+
updater: r,
|
|
818
798
|
index: i.rootIndex,
|
|
819
799
|
parentMeta: i.parentMeta
|
|
820
|
-
}) :
|
|
800
|
+
}) : r(e.value));
|
|
821
801
|
},
|
|
822
802
|
{
|
|
823
803
|
immediate: !0,
|
|
824
804
|
deep: !0
|
|
825
805
|
}
|
|
826
|
-
) :
|
|
806
|
+
) : U(e) ? _(
|
|
827
807
|
() => e,
|
|
828
808
|
() => {
|
|
829
809
|
o.isUndefined(e) || (s && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
830
810
|
data: e,
|
|
831
|
-
updater:
|
|
811
|
+
updater: r,
|
|
832
812
|
index: i.rootIndex,
|
|
833
813
|
parentMeta: i.parentMeta
|
|
834
|
-
}) :
|
|
814
|
+
}) : r(e));
|
|
835
815
|
},
|
|
836
816
|
{
|
|
837
817
|
immediate: !0,
|
|
@@ -839,37 +819,37 @@ class mr {
|
|
|
839
819
|
}
|
|
840
820
|
) : s && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
841
821
|
data: e,
|
|
842
|
-
updater:
|
|
822
|
+
updater: r,
|
|
843
823
|
index: i.rootIndex,
|
|
844
824
|
parentMeta: i.parentMeta
|
|
845
|
-
}) :
|
|
825
|
+
}) : r(e);
|
|
846
826
|
}
|
|
847
827
|
modelProcessor(e) {
|
|
848
828
|
e.map(
|
|
849
|
-
(
|
|
829
|
+
(r) => this.createModel(r, this.processedModel.value)
|
|
850
830
|
), o.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = P(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
|
|
851
831
|
}
|
|
852
|
-
setModel(e,
|
|
853
|
-
o.isFunction(
|
|
832
|
+
setModel(e, r, i) {
|
|
833
|
+
o.isFunction(r) ? D(e, r(), i) : e[r] = i;
|
|
854
834
|
}
|
|
855
|
-
createModel(e,
|
|
856
|
-
if (o.isListSchema(e) && (
|
|
857
|
-
this.createModel(i,
|
|
835
|
+
createModel(e, r) {
|
|
836
|
+
if (o.isListSchema(e) && (r[e.field] || this.setModel(r, e.field, [{}]), e.children.forEach((i) => {
|
|
837
|
+
this.createModel(i, r[e.field][0]);
|
|
858
838
|
})), o.isGroupSchema(e) && e.children.forEach((i) => {
|
|
859
|
-
this.createModel(i,
|
|
839
|
+
this.createModel(i, r);
|
|
860
840
|
}), o.isItemSchema(e))
|
|
861
841
|
if ("defaultValue" in e)
|
|
862
|
-
this.setModel(
|
|
842
|
+
this.setModel(r, e.field, e.defaultValue);
|
|
863
843
|
else {
|
|
864
|
-
if (o.isFunction(e.field) && L(
|
|
844
|
+
if (o.isFunction(e.field) && L(r, e.field()))
|
|
865
845
|
return;
|
|
866
|
-
if (o.isString(e.field) &&
|
|
846
|
+
if (o.isString(e.field) && r[e.field])
|
|
867
847
|
return;
|
|
868
|
-
this.setModel(
|
|
848
|
+
this.setModel(r, e.field, void 0);
|
|
869
849
|
}
|
|
870
850
|
}
|
|
871
851
|
}
|
|
872
|
-
class
|
|
852
|
+
class w {
|
|
873
853
|
static getFormContainer({ ui: e } = {}) {
|
|
874
854
|
return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
|
|
875
855
|
}
|
|
@@ -894,37 +874,37 @@ class br {
|
|
|
894
874
|
this.ui = e;
|
|
895
875
|
}
|
|
896
876
|
getRuntimeNative() {
|
|
897
|
-
var
|
|
898
|
-
return (
|
|
877
|
+
var r;
|
|
878
|
+
return (r = c.presets.uiPresets[this.ui]) == null ? void 0 : r.native;
|
|
899
879
|
}
|
|
900
880
|
getRuntimeField(e) {
|
|
901
881
|
var s;
|
|
902
|
-
const
|
|
903
|
-
return (
|
|
882
|
+
const r = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
|
|
883
|
+
return (r == null ? void 0 : r.getRuntimeField(e)) ?? (i == null ? void 0 : i.getRuntimeField(e));
|
|
904
884
|
}
|
|
905
885
|
getRuntimeRequired(e) {
|
|
906
886
|
var s;
|
|
907
|
-
const
|
|
908
|
-
return (
|
|
887
|
+
const r = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
|
|
888
|
+
return (r == null ? void 0 : r.getRuntimeRequired(e)) ?? (i == null ? void 0 : i.getRuntimeRequired(e));
|
|
909
889
|
}
|
|
910
890
|
getFormModelPropName() {
|
|
911
891
|
var i;
|
|
912
|
-
const e = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter,
|
|
913
|
-
return (e == null ? void 0 : e.getFormModelPropName()) ?? (
|
|
892
|
+
const e = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, r = I.adapters[c.getUI(this.ui)];
|
|
893
|
+
return (e == null ? void 0 : e.getFormModelPropName()) ?? (r == null ? void 0 : r.getFormModelPropName());
|
|
914
894
|
}
|
|
915
895
|
formComponentRenderer(e) {
|
|
916
896
|
var s;
|
|
917
|
-
const
|
|
918
|
-
return (
|
|
897
|
+
const r = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
|
|
898
|
+
return (r == null ? void 0 : r.formComponentRenderer(e)) ?? (i == null ? void 0 : i.formComponentRenderer(e));
|
|
919
899
|
}
|
|
920
900
|
clearValidate(e) {
|
|
921
901
|
var s;
|
|
922
|
-
const
|
|
923
|
-
return (
|
|
902
|
+
const r = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, i = I.adapters[c.getUI(this.ui)];
|
|
903
|
+
return (r == null ? void 0 : r.clearValidate(e)) ?? (i == null ? void 0 : i.clearValidate(e));
|
|
924
904
|
}
|
|
925
905
|
}
|
|
926
|
-
function gr(
|
|
927
|
-
return typeof
|
|
906
|
+
function gr(t) {
|
|
907
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !Be(t);
|
|
928
908
|
}
|
|
929
909
|
class vr {
|
|
930
910
|
constructor(e) {
|
|
@@ -952,71 +932,61 @@ class vr {
|
|
|
952
932
|
}));
|
|
953
933
|
u(this, "shared", K({}));
|
|
954
934
|
this.setup = e, this.processor = new mr(this);
|
|
955
|
-
const
|
|
956
|
-
if (this.ui =
|
|
957
|
-
|
|
935
|
+
const r = this.setup(this);
|
|
936
|
+
if (this.ui = r.ui ?? c.presets.ui, this.runtimeAdapter = new br(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(r.schemas))
|
|
937
|
+
_(
|
|
958
938
|
// @ts-expect-error
|
|
959
|
-
() =>
|
|
939
|
+
() => r.schemas.value,
|
|
960
940
|
() => {
|
|
961
|
-
this.processor.parseSchemas(
|
|
941
|
+
this.processor.parseSchemas(r.schemas.value);
|
|
962
942
|
},
|
|
963
943
|
{
|
|
964
944
|
deep: !0
|
|
965
945
|
}
|
|
966
946
|
);
|
|
967
|
-
else if (
|
|
968
|
-
const i =
|
|
969
|
-
this.processor.parseSchemas(
|
|
947
|
+
else if (U(r.schemas)) {
|
|
948
|
+
const i = _(() => r.schemas, () => {
|
|
949
|
+
this.processor.parseSchemas(r.schemas), O(() => {
|
|
970
950
|
i();
|
|
971
951
|
});
|
|
972
952
|
}, {
|
|
973
953
|
deep: !0
|
|
974
954
|
});
|
|
975
955
|
} else
|
|
976
|
-
this.processor.parseSchemas(
|
|
956
|
+
this.processor.parseSchemas(r.schemas);
|
|
977
957
|
}
|
|
978
958
|
getRuntimeMeta() {
|
|
979
959
|
return {
|
|
980
|
-
model:
|
|
960
|
+
model: x(P(this.model.value)),
|
|
981
961
|
reactiveModel: this.model.value,
|
|
982
962
|
shared: this.shared,
|
|
983
963
|
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
984
|
-
share: (
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
}, {
|
|
988
|
-
deep: !0,
|
|
989
|
-
immediate: !0
|
|
990
|
-
}) : j(t) ? g(() => t, () => {
|
|
991
|
-
h(this.shared, t);
|
|
992
|
-
}, {
|
|
993
|
-
deep: !0,
|
|
994
|
-
immediate: !0
|
|
995
|
-
}) : Object.keys(t).forEach((i) => {
|
|
996
|
-
S(t[i]) ? g(() => t[i].value, () => {
|
|
964
|
+
share: (r) => {
|
|
965
|
+
Object.keys(r).forEach((i) => {
|
|
966
|
+
q(r[i]) ? _(() => r[i].value, () => {
|
|
997
967
|
h(this.shared, {
|
|
998
|
-
[i]:
|
|
968
|
+
[i]: r[i].value
|
|
999
969
|
});
|
|
1000
970
|
}, {
|
|
1001
971
|
deep: !0,
|
|
1002
972
|
immediate: !0
|
|
1003
|
-
}) :
|
|
973
|
+
}) : U(r[i]) ? _(() => r[i], () => {
|
|
1004
974
|
h(this.shared, {
|
|
1005
|
-
[i]:
|
|
975
|
+
[i]: r[i]
|
|
1006
976
|
});
|
|
1007
977
|
}, {
|
|
1008
978
|
deep: !0,
|
|
1009
979
|
immediate: !0
|
|
1010
980
|
}) : h(this.shared, {
|
|
1011
|
-
[i]:
|
|
981
|
+
[i]: r[i]
|
|
1012
982
|
});
|
|
1013
983
|
});
|
|
1014
984
|
}
|
|
1015
985
|
};
|
|
1016
986
|
}
|
|
1017
|
-
runtimeItemProcessor(e,
|
|
987
|
+
runtimeItemProcessor(e, r, i = this.model.value, s) {
|
|
1018
988
|
var ie, se, ne, oe, ae, le, ue, fe, ce, de, pe, he, me, be, ge, ve, ye;
|
|
1019
|
-
const n =
|
|
989
|
+
const n = x(e.component);
|
|
1020
990
|
if (!n)
|
|
1021
991
|
return;
|
|
1022
992
|
(se = (ie = e.native) == null ? void 0 : ie.props) != null && se.Form && h(this.globalNativeFormOverride.props.Form, (oe = (ne = e.native) == null ? void 0 : ne.props) == null ? void 0 : oe.Form), (le = (ae = e.native) == null ? void 0 : ae.slots) != null && le.Form && h(this.globalNativeFormOverride.slots.Form, (fe = (ue = e.native) == null ? void 0 : ue.slots) == null ? void 0 : fe.Form);
|
|
@@ -1027,37 +997,37 @@ class vr {
|
|
|
1027
997
|
}, f = h(P((be = (me = this.native) == null ? void 0 : me.props) == null ? void 0 : be.FormItem) ?? {}, (ve = (ge = e.native) == null ? void 0 : ge.props) == null ? void 0 : ve.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
1028
998
|
schema: e,
|
|
1029
999
|
parentSchema: s,
|
|
1030
|
-
index:
|
|
1031
|
-
}), p = n.name, m = e.componentProps ?? {},
|
|
1032
|
-
let
|
|
1033
|
-
|
|
1034
|
-
let
|
|
1035
|
-
if (e.runtime ?
|
|
1036
|
-
let
|
|
1037
|
-
o.isUndefined(p) ?
|
|
1038
|
-
|
|
1039
|
-
p.toLowerCase().includes(_e.toLowerCase()) && (
|
|
1040
|
-
}),
|
|
1000
|
+
index: r
|
|
1001
|
+
}), p = n.name, m = e.componentProps ?? {}, v = I.placeholderPresetByComponentName;
|
|
1002
|
+
let C = e.placeholder, y = e.show;
|
|
1003
|
+
y === void 0 && (y = !0);
|
|
1004
|
+
let g = e.label ?? "", S;
|
|
1005
|
+
if (e.runtime ? S = e.runtime : S = (s == null ? void 0 : s.runtime) ?? this.runtime, !o.isUndefined(r) && !o.isObjectEmpty(S) && (g = Y((ye = S == null ? void 0 : S.customizeListItemLabel) == null ? void 0 : ye.call(S, e.label ?? "", r + 1), "")), !C) {
|
|
1006
|
+
let $ = "请输入";
|
|
1007
|
+
o.isUndefined(p) ? C = `${$}${g}` : /* @ts-expect-error */ v[p.toLowerCase()] ? ($ = // @ts-expect-error
|
|
1008
|
+
v[p.toLowerCase()], C = `${$}${g}`) : (Object.keys(v).forEach((_e) => {
|
|
1009
|
+
p.toLowerCase().includes(_e.toLowerCase()) && ($ = v[_e]);
|
|
1010
|
+
}), C = `${$}${g}`);
|
|
1041
1011
|
}
|
|
1042
1012
|
const $e = this.runtimeAdapter.getRuntimeRequired({
|
|
1043
1013
|
...e,
|
|
1044
|
-
label:
|
|
1045
|
-
}), Ve =
|
|
1014
|
+
label: g
|
|
1015
|
+
}), Ve = w.getItemContainer(this), Ne = w.getFormItemContainer(this), qe = this, Ue = e.componentSlots;
|
|
1046
1016
|
return b("div", {
|
|
1047
1017
|
style: l
|
|
1048
1018
|
}, [b(Ve, {
|
|
1049
|
-
show:
|
|
1019
|
+
show: y
|
|
1050
1020
|
}, {
|
|
1051
1021
|
default() {
|
|
1052
|
-
return
|
|
1053
|
-
label: `${
|
|
1022
|
+
return y && b(Ne, N(f, {
|
|
1023
|
+
label: `${g ? `${g}:` : ""}`
|
|
1054
1024
|
}, d, $e), {
|
|
1055
1025
|
default() {
|
|
1056
1026
|
return qe.runtimeAdapter.formComponentRenderer({
|
|
1057
1027
|
Component: n,
|
|
1058
1028
|
schema: e,
|
|
1059
1029
|
baseModel: i,
|
|
1060
|
-
placeholder:
|
|
1030
|
+
placeholder: C,
|
|
1061
1031
|
componentSlots: Ue,
|
|
1062
1032
|
props: m
|
|
1063
1033
|
});
|
|
@@ -1068,35 +1038,35 @@ class vr {
|
|
|
1068
1038
|
})]);
|
|
1069
1039
|
}
|
|
1070
1040
|
runtimeGroupProcessor(e) {
|
|
1071
|
-
let
|
|
1041
|
+
let r;
|
|
1072
1042
|
const i = {
|
|
1073
1043
|
display: "grid",
|
|
1074
1044
|
gridColumn: "1 / -1",
|
|
1075
1045
|
...e.grid
|
|
1076
|
-
}, s =
|
|
1046
|
+
}, s = w.getGroupContainer(this);
|
|
1077
1047
|
let n = e.show;
|
|
1078
1048
|
return n === void 0 && (n = !0), b("div", {
|
|
1079
1049
|
style: i
|
|
1080
1050
|
}, [n && b(s, {
|
|
1081
1051
|
schema: e
|
|
1082
|
-
}, gr(
|
|
1083
|
-
default: () => [
|
|
1052
|
+
}, gr(r = e.children.map((a) => this.runtimeItemProcessor(a))) ? r : {
|
|
1053
|
+
default: () => [r]
|
|
1084
1054
|
})]);
|
|
1085
1055
|
}
|
|
1086
1056
|
addListItem(e) {
|
|
1087
|
-
var
|
|
1088
|
-
if (!((
|
|
1057
|
+
var r, i;
|
|
1058
|
+
if (!((r = this.processor.stableModel[e.field]) != null && r[0]))
|
|
1089
1059
|
return Promise.reject({
|
|
1090
1060
|
code: "0001",
|
|
1091
1061
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
1092
1062
|
});
|
|
1093
1063
|
(i = this.processor.stableModel[e.field]) != null && i[0] && this.model.value[e.field].push(P(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
1094
1064
|
}
|
|
1095
|
-
deleteListItem(e,
|
|
1096
|
-
this.model.value[e.field].splice(
|
|
1065
|
+
deleteListItem(e, r) {
|
|
1066
|
+
this.model.value[e.field].splice(r, 1), this.runtimeAdapter.clearValidate(this);
|
|
1097
1067
|
}
|
|
1098
1068
|
runtimeListProcessor(e) {
|
|
1099
|
-
const
|
|
1069
|
+
const r = {
|
|
1100
1070
|
display: "grid",
|
|
1101
1071
|
gridColumn: "1 / -1",
|
|
1102
1072
|
...e.grid
|
|
@@ -1104,9 +1074,9 @@ class vr {
|
|
|
1104
1074
|
i.model.value[e.field] || (i.model.value[e.field] = [{}]);
|
|
1105
1075
|
let s = e.show;
|
|
1106
1076
|
s === void 0 && (s = !0);
|
|
1107
|
-
const n =
|
|
1077
|
+
const n = w.getListContainer(this), a = w.getListItemContainer(this);
|
|
1108
1078
|
return b("div", {
|
|
1109
|
-
style:
|
|
1079
|
+
style: r
|
|
1110
1080
|
}, [s && b(n, {
|
|
1111
1081
|
schema: e
|
|
1112
1082
|
}, {
|
|
@@ -1137,7 +1107,7 @@ class vr {
|
|
|
1137
1107
|
})]);
|
|
1138
1108
|
}
|
|
1139
1109
|
runtimeProcessor(e) {
|
|
1140
|
-
return e.map((
|
|
1110
|
+
return e.map((r) => (r.type || (r.type = "item"), this.processorBySchemaType[r.type](r)));
|
|
1141
1111
|
}
|
|
1142
1112
|
exec() {
|
|
1143
1113
|
var l, f, d, p;
|
|
@@ -1146,8 +1116,8 @@ class vr {
|
|
|
1146
1116
|
gridColumn: "1 / -1",
|
|
1147
1117
|
gridAutoColumns: "1fr",
|
|
1148
1118
|
...this.grid
|
|
1149
|
-
},
|
|
1150
|
-
return b(n,
|
|
1119
|
+
}, r = this, i = h(this.globalNativeFormOverride.props.Form, P((f = (l = this.native) == null ? void 0 : l.props) == null ? void 0 : f.Form) ?? {}), s = h(this.globalNativeFormOverride.slots.Form, P((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = w.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
|
|
1120
|
+
return b(n, N(i, {
|
|
1151
1121
|
ref: this.formRef
|
|
1152
1122
|
}, {
|
|
1153
1123
|
[a]: this.model.value
|
|
@@ -1155,7 +1125,7 @@ class vr {
|
|
|
1155
1125
|
default() {
|
|
1156
1126
|
return b("div", {
|
|
1157
1127
|
style: e
|
|
1158
|
-
}, [
|
|
1128
|
+
}, [r.runtimeProcessor(r.schemas.value)]);
|
|
1159
1129
|
},
|
|
1160
1130
|
...s
|
|
1161
1131
|
});
|
|
@@ -1163,247 +1133,247 @@ class vr {
|
|
|
1163
1133
|
}
|
|
1164
1134
|
class c {
|
|
1165
1135
|
static getPreset(e) {
|
|
1166
|
-
var
|
|
1167
|
-
return (i = (
|
|
1136
|
+
var r, i, s;
|
|
1137
|
+
return (i = (r = this.presets.uiPresets) == null ? void 0 : r[e]) != null && i.extend ? this.presets.uiPresets[(s = this.presets.uiPresets[e]) == null ? void 0 : s.extend] : this.presets.uiPresets[e];
|
|
1168
1138
|
}
|
|
1169
1139
|
static getUI(e) {
|
|
1170
|
-
var
|
|
1171
|
-
return (i = (
|
|
1140
|
+
var r, i, s;
|
|
1141
|
+
return (i = (r = this.presets.uiPresets) == null ? void 0 : r[e]) != null && i.extend ? (s = this.presets.uiPresets[e]) == null ? void 0 : s.extend : e;
|
|
1172
1142
|
}
|
|
1173
1143
|
}
|
|
1174
1144
|
u(c, "presets");
|
|
1175
1145
|
function X({
|
|
1176
|
-
parentSchema:
|
|
1146
|
+
parentSchema: t,
|
|
1177
1147
|
schema: e,
|
|
1178
|
-
index:
|
|
1148
|
+
index: r
|
|
1179
1149
|
}) {
|
|
1180
|
-
return
|
|
1150
|
+
return t ? `${t.field}.${r}.${e.field}` : e.field;
|
|
1181
1151
|
}
|
|
1182
1152
|
const yr = {
|
|
1183
1153
|
ArcoVue: {
|
|
1184
|
-
getRuntimeField(
|
|
1185
|
-
const e = X(
|
|
1154
|
+
getRuntimeField(t) {
|
|
1155
|
+
const e = X(t);
|
|
1186
1156
|
return o.isFunction(e) ? {
|
|
1187
1157
|
field: e()
|
|
1188
1158
|
} : {
|
|
1189
1159
|
field: e
|
|
1190
1160
|
};
|
|
1191
1161
|
},
|
|
1192
|
-
getRuntimeRequired(
|
|
1162
|
+
getRuntimeRequired(t) {
|
|
1193
1163
|
var e;
|
|
1194
|
-
if (
|
|
1195
|
-
if (!
|
|
1196
|
-
|
|
1164
|
+
if (t.required)
|
|
1165
|
+
if (!t.rules)
|
|
1166
|
+
t.rules = [], t.rules.push({
|
|
1197
1167
|
required: !0,
|
|
1198
|
-
message: `${
|
|
1168
|
+
message: `${t.label}是必填项`
|
|
1199
1169
|
});
|
|
1200
1170
|
else {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1171
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1172
|
+
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1203
1173
|
required: !0,
|
|
1204
|
-
message: `${
|
|
1174
|
+
message: `${t.label}是必填项`
|
|
1205
1175
|
});
|
|
1206
1176
|
}
|
|
1207
|
-
else if (
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1177
|
+
else if (t.rules) {
|
|
1178
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1179
|
+
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1210
1180
|
required: !0,
|
|
1211
|
-
message: `${
|
|
1181
|
+
message: `${t.label}是必填项`
|
|
1212
1182
|
});
|
|
1213
1183
|
}
|
|
1214
1184
|
return {
|
|
1215
|
-
rules:
|
|
1185
|
+
rules: t.rules
|
|
1216
1186
|
};
|
|
1217
1187
|
},
|
|
1218
1188
|
getFormModelPropName() {
|
|
1219
1189
|
return "model";
|
|
1220
1190
|
},
|
|
1221
1191
|
formComponentRenderer({
|
|
1222
|
-
Component:
|
|
1192
|
+
Component: t,
|
|
1223
1193
|
baseModel: e,
|
|
1224
|
-
schema:
|
|
1194
|
+
schema: r,
|
|
1225
1195
|
placeholder: i,
|
|
1226
1196
|
componentSlots: s,
|
|
1227
1197
|
props: n
|
|
1228
1198
|
}) {
|
|
1229
1199
|
let a;
|
|
1230
|
-
return o.isFunction(
|
|
1200
|
+
return o.isFunction(r.field) ? a = L(e, r.field()) : a = e[r.field], b(t, N({
|
|
1231
1201
|
modelValue: a,
|
|
1232
1202
|
"onUpdate:modelValue": (l) => {
|
|
1233
|
-
o.isFunction(
|
|
1203
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1234
1204
|
},
|
|
1235
1205
|
placeholder: i
|
|
1236
1206
|
}, n), {
|
|
1237
1207
|
...s
|
|
1238
1208
|
});
|
|
1239
1209
|
},
|
|
1240
|
-
validateForm(
|
|
1241
|
-
return new Promise((e,
|
|
1242
|
-
|
|
1210
|
+
validateForm(t) {
|
|
1211
|
+
return new Promise((e, r) => {
|
|
1212
|
+
t.runtimeCore.formRef.value.validate((i) => i ? r(i) : e(t.cleanFallbackFields(x(t.runtimeCore.processor.processedModel.value))));
|
|
1243
1213
|
});
|
|
1244
1214
|
},
|
|
1245
|
-
clearValidate(
|
|
1246
|
-
var e,
|
|
1247
|
-
(
|
|
1215
|
+
clearValidate(t) {
|
|
1216
|
+
var e, r;
|
|
1217
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.clearValidate) == null || r.call(e);
|
|
1248
1218
|
}
|
|
1249
1219
|
},
|
|
1250
1220
|
NutUI: {
|
|
1251
|
-
getRuntimeField(
|
|
1252
|
-
const e = X(
|
|
1221
|
+
getRuntimeField(t) {
|
|
1222
|
+
const e = X(t);
|
|
1253
1223
|
return o.isFunction(e) ? {
|
|
1254
1224
|
prop: e()
|
|
1255
1225
|
} : {
|
|
1256
1226
|
prop: e
|
|
1257
1227
|
};
|
|
1258
1228
|
},
|
|
1259
|
-
getRuntimeRequired(
|
|
1229
|
+
getRuntimeRequired(t) {
|
|
1260
1230
|
var e;
|
|
1261
|
-
if (
|
|
1262
|
-
if (!
|
|
1263
|
-
|
|
1231
|
+
if (t.required)
|
|
1232
|
+
if (!t.rules)
|
|
1233
|
+
t.rules = [], t.rules.push({
|
|
1264
1234
|
required: !0,
|
|
1265
|
-
message: `${
|
|
1235
|
+
message: `${t.label}是必填项`
|
|
1266
1236
|
});
|
|
1267
1237
|
else {
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1238
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1239
|
+
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1270
1240
|
required: !0,
|
|
1271
|
-
message: `${
|
|
1241
|
+
message: `${t.label}是必填项`
|
|
1272
1242
|
});
|
|
1273
1243
|
}
|
|
1274
|
-
else if (
|
|
1275
|
-
const
|
|
1276
|
-
|
|
1244
|
+
else if (t.rules) {
|
|
1245
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1246
|
+
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1277
1247
|
required: !0,
|
|
1278
|
-
message: `${
|
|
1248
|
+
message: `${t.label}是必填项`
|
|
1279
1249
|
});
|
|
1280
1250
|
}
|
|
1281
1251
|
return {
|
|
1282
|
-
rules:
|
|
1283
|
-
required:
|
|
1252
|
+
rules: t.rules,
|
|
1253
|
+
required: t.required
|
|
1284
1254
|
};
|
|
1285
1255
|
},
|
|
1286
1256
|
getFormModelPropName() {
|
|
1287
1257
|
return "modelValue";
|
|
1288
1258
|
},
|
|
1289
1259
|
formComponentRenderer({
|
|
1290
|
-
Component:
|
|
1260
|
+
Component: t,
|
|
1291
1261
|
baseModel: e,
|
|
1292
|
-
schema:
|
|
1262
|
+
schema: r,
|
|
1293
1263
|
placeholder: i,
|
|
1294
1264
|
componentSlots: s,
|
|
1295
1265
|
props: n
|
|
1296
1266
|
}) {
|
|
1297
1267
|
let a;
|
|
1298
|
-
return o.isFunction(
|
|
1268
|
+
return o.isFunction(r.field) ? a = L(e, r.field()) : a = e[r.field], b(t, N({
|
|
1299
1269
|
modelValue: a,
|
|
1300
1270
|
"onUpdate:modelValue": (l) => {
|
|
1301
|
-
o.isFunction(
|
|
1271
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1302
1272
|
},
|
|
1303
1273
|
placeholder: i
|
|
1304
1274
|
}, n), {
|
|
1305
1275
|
...s
|
|
1306
1276
|
});
|
|
1307
1277
|
},
|
|
1308
|
-
validateForm(
|
|
1309
|
-
return new Promise((e,
|
|
1310
|
-
|
|
1278
|
+
validateForm(t) {
|
|
1279
|
+
return new Promise((e, r) => {
|
|
1280
|
+
t.runtimeCore.formRef.value.validate().then(({
|
|
1311
1281
|
valid: i,
|
|
1312
1282
|
errors: s
|
|
1313
1283
|
}) => {
|
|
1314
|
-
i ? e(
|
|
1284
|
+
i ? e(t.cleanFallbackFields(x(t.runtimeCore.processor.processedModel.value))) : r(s);
|
|
1315
1285
|
});
|
|
1316
1286
|
});
|
|
1317
1287
|
},
|
|
1318
|
-
clearValidate(
|
|
1319
|
-
var e,
|
|
1320
|
-
(
|
|
1288
|
+
clearValidate(t) {
|
|
1289
|
+
var e, r;
|
|
1290
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.reset) == null || r.call(e);
|
|
1321
1291
|
}
|
|
1322
1292
|
},
|
|
1323
1293
|
NaiveUI: {
|
|
1324
|
-
getRuntimeField(
|
|
1325
|
-
const e = X(
|
|
1294
|
+
getRuntimeField(t) {
|
|
1295
|
+
const e = X(t);
|
|
1326
1296
|
return o.isFunction(e) ? {
|
|
1327
1297
|
path: e()
|
|
1328
1298
|
} : {
|
|
1329
1299
|
path: e
|
|
1330
1300
|
};
|
|
1331
1301
|
},
|
|
1332
|
-
getRuntimeRequired(
|
|
1302
|
+
getRuntimeRequired(t) {
|
|
1333
1303
|
var e;
|
|
1334
|
-
if (
|
|
1335
|
-
if (!
|
|
1336
|
-
|
|
1304
|
+
if (t.required)
|
|
1305
|
+
if (!t.rules)
|
|
1306
|
+
t.rules = [], t.rules.push({
|
|
1337
1307
|
required: !0,
|
|
1338
|
-
message: `${
|
|
1308
|
+
message: `${t.label}是必填项`,
|
|
1339
1309
|
trigger: ["input", "blur"]
|
|
1340
1310
|
});
|
|
1341
1311
|
else {
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1312
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1313
|
+
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1344
1314
|
required: !0,
|
|
1345
|
-
message: `${
|
|
1315
|
+
message: `${t.label}是必填项`,
|
|
1346
1316
|
trigger: ["input", "blur"]
|
|
1347
1317
|
});
|
|
1348
1318
|
}
|
|
1349
|
-
else if (
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1319
|
+
else if (t.rules) {
|
|
1320
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1321
|
+
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1352
1322
|
required: !0,
|
|
1353
|
-
message: `${
|
|
1323
|
+
message: `${t.label}是必填项`,
|
|
1354
1324
|
trigger: ["input", "blur"]
|
|
1355
1325
|
});
|
|
1356
1326
|
}
|
|
1357
1327
|
return {
|
|
1358
|
-
rule:
|
|
1328
|
+
rule: t.rules
|
|
1359
1329
|
};
|
|
1360
1330
|
},
|
|
1361
1331
|
getFormModelPropName() {
|
|
1362
1332
|
return "model";
|
|
1363
1333
|
},
|
|
1364
1334
|
formComponentRenderer({
|
|
1365
|
-
Component:
|
|
1335
|
+
Component: t,
|
|
1366
1336
|
baseModel: e,
|
|
1367
|
-
schema:
|
|
1337
|
+
schema: r,
|
|
1368
1338
|
placeholder: i,
|
|
1369
1339
|
componentSlots: s,
|
|
1370
1340
|
props: n
|
|
1371
1341
|
}) {
|
|
1372
1342
|
let a;
|
|
1373
|
-
return o.isFunction(
|
|
1343
|
+
return o.isFunction(r.field) ? a = L(e, r.field()) : a = e[r.field], b(t, N({
|
|
1374
1344
|
value: a,
|
|
1375
1345
|
"onUpdate:value": (l) => {
|
|
1376
|
-
o.isFunction(
|
|
1346
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1377
1347
|
},
|
|
1378
1348
|
placeholder: i
|
|
1379
1349
|
}, n), {
|
|
1380
1350
|
...s
|
|
1381
1351
|
});
|
|
1382
1352
|
},
|
|
1383
|
-
validateForm(
|
|
1384
|
-
return new Promise((e,
|
|
1385
|
-
|
|
1353
|
+
validateForm(t) {
|
|
1354
|
+
return new Promise((e, r) => {
|
|
1355
|
+
t.runtimeCore.formRef.value.validate((i) => i ? r(i) : e(t.cleanFallbackFields(x(t.runtimeCore.processor.processedModel.value))));
|
|
1386
1356
|
});
|
|
1387
1357
|
},
|
|
1388
|
-
clearValidate(
|
|
1389
|
-
var e,
|
|
1390
|
-
(
|
|
1358
|
+
clearValidate(t) {
|
|
1359
|
+
var e, r;
|
|
1360
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.restoreValidation) == null || r.call(e);
|
|
1391
1361
|
}
|
|
1392
1362
|
}
|
|
1393
|
-
},
|
|
1363
|
+
}, M = class M {
|
|
1394
1364
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
1395
1365
|
const e = {
|
|
1396
1366
|
请选择: ["select", "tree"],
|
|
1397
1367
|
请输入: ["input"]
|
|
1398
|
-
},
|
|
1368
|
+
}, r = {};
|
|
1399
1369
|
for (const i in e)
|
|
1400
1370
|
e[i].forEach((s) => {
|
|
1401
|
-
|
|
1371
|
+
r[s] = i;
|
|
1402
1372
|
});
|
|
1403
|
-
return
|
|
1373
|
+
return r;
|
|
1404
1374
|
}
|
|
1405
1375
|
};
|
|
1406
|
-
u(
|
|
1376
|
+
u(M, "schemaPreset", {
|
|
1407
1377
|
type: {
|
|
1408
1378
|
defaultValue: "item"
|
|
1409
1379
|
},
|
|
@@ -1449,32 +1419,32 @@ u(E, "schemaPreset", {
|
|
|
1449
1419
|
runtime: {
|
|
1450
1420
|
default: void 0
|
|
1451
1421
|
}
|
|
1452
|
-
}), u(
|
|
1422
|
+
}), u(M, "componentPropsPreset", {
|
|
1453
1423
|
options: {
|
|
1454
1424
|
defaultValue: []
|
|
1455
1425
|
}
|
|
1456
1426
|
}), // 基于基本功能提出基本预设
|
|
1457
|
-
u(
|
|
1458
|
-
let J =
|
|
1459
|
-
const
|
|
1427
|
+
u(M, "placeholderPresetByComponentName", M.getPlaceholderPrefixPresetByComponentName());
|
|
1428
|
+
let J = M;
|
|
1429
|
+
const I = {
|
|
1460
1430
|
...J,
|
|
1461
1431
|
adapters: {
|
|
1462
1432
|
...yr
|
|
1463
1433
|
}
|
|
1464
|
-
},
|
|
1434
|
+
}, Ir = /* @__PURE__ */ He({
|
|
1465
1435
|
props: {
|
|
1466
1436
|
setup: {
|
|
1467
1437
|
type: Function,
|
|
1468
1438
|
required: !0
|
|
1469
1439
|
}
|
|
1470
1440
|
},
|
|
1471
|
-
setup(
|
|
1472
|
-
const e = new vr(
|
|
1441
|
+
setup(t) {
|
|
1442
|
+
const e = new vr(t.setup);
|
|
1473
1443
|
return () => e.exec();
|
|
1474
1444
|
}
|
|
1475
1445
|
});
|
|
1476
|
-
function
|
|
1477
|
-
const e = new Ke(
|
|
1446
|
+
function Cr(t) {
|
|
1447
|
+
const e = new Ke(t);
|
|
1478
1448
|
return [
|
|
1479
1449
|
e.setup.bind(e),
|
|
1480
1450
|
{
|
|
@@ -1486,33 +1456,33 @@ function Ir(r) {
|
|
|
1486
1456
|
}
|
|
1487
1457
|
];
|
|
1488
1458
|
}
|
|
1489
|
-
function
|
|
1490
|
-
c.presets =
|
|
1459
|
+
function Sr(t) {
|
|
1460
|
+
c.presets = t;
|
|
1491
1461
|
}
|
|
1492
|
-
function re(
|
|
1493
|
-
return e === "native" && Object.defineProperty(
|
|
1494
|
-
value: `__proform_raw_${
|
|
1462
|
+
function re(t, e) {
|
|
1463
|
+
return e === "native" && Object.defineProperty(t, "name", {
|
|
1464
|
+
value: `__proform_raw_${t.name}`,
|
|
1495
1465
|
writable: !0
|
|
1496
|
-
}), e === "structured_path_parsing_mark" && Object.defineProperty(
|
|
1497
|
-
value: `__proform_structured_path_parsing_mark_${
|
|
1466
|
+
}), e === "structured_path_parsing_mark" && Object.defineProperty(t, "name", {
|
|
1467
|
+
value: `__proform_structured_path_parsing_mark_${t.name}`,
|
|
1498
1468
|
writable: !0
|
|
1499
|
-
}), e === "onetime" && Object.defineProperty(
|
|
1500
|
-
value: `__proform_onetime_${
|
|
1469
|
+
}), e === "onetime" && Object.defineProperty(t, "name", {
|
|
1470
|
+
value: `__proform_onetime_${t.name}`,
|
|
1501
1471
|
writable: !0
|
|
1502
|
-
}),
|
|
1472
|
+
}), t;
|
|
1503
1473
|
}
|
|
1504
|
-
function
|
|
1505
|
-
return re(
|
|
1474
|
+
function Or(t) {
|
|
1475
|
+
return re(t, "native");
|
|
1506
1476
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return
|
|
1477
|
+
function Fr(t) {
|
|
1478
|
+
return t.__proform_raw_object = !0, t;
|
|
1509
1479
|
}
|
|
1510
|
-
function
|
|
1511
|
-
return re(
|
|
1480
|
+
function jr(t) {
|
|
1481
|
+
return re(t, "onetime");
|
|
1512
1482
|
}
|
|
1513
|
-
function wr(
|
|
1483
|
+
function wr(t) {
|
|
1514
1484
|
function e() {
|
|
1515
|
-
return
|
|
1485
|
+
return t;
|
|
1516
1486
|
}
|
|
1517
1487
|
return re(
|
|
1518
1488
|
e,
|
|
@@ -1520,12 +1490,12 @@ function wr(r) {
|
|
|
1520
1490
|
);
|
|
1521
1491
|
}
|
|
1522
1492
|
export {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1493
|
+
Ir as ProForm,
|
|
1494
|
+
Or as markNativeFunction,
|
|
1495
|
+
Fr as markNativeObject,
|
|
1496
|
+
jr as markOnetimeFunction,
|
|
1527
1497
|
wr as markStructuredPathParsing,
|
|
1528
|
-
|
|
1529
|
-
|
|
1498
|
+
Cr as useForm,
|
|
1499
|
+
Sr as useFormPresetConfigurer,
|
|
1530
1500
|
re as useModifiers
|
|
1531
1501
|
};
|