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