@harbor-design/proform 1.3.34 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +141 -146
- package/dist/types/src/services/RuntimeCore/index.d.ts +1 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var ze = Object.defineProperty;
|
|
2
2
|
var Le = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var l = (r, e, t) => (Le(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { ref as L, readonly as Ce, nextTick as
|
|
5
|
-
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, A = We || Xe || Function("return this")(), R = A.Symbol,
|
|
4
|
+
import { ref as L, readonly as Ce, nextTick as _, isRef as U, watch as E, isReactive as T, watchEffect as D, toRaw as x, reactive as W, createVNode as m, mergeProps as q, withDirectives as He, vShow as De, createTextVNode as Ge, isVNode as Be, defineComponent as Ke } from "vue";
|
|
5
|
+
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, A = We || Xe || Function("return this")(), R = A.Symbol, we = Object.prototype, Ye = we.hasOwnProperty, Ze = we.toString, N = R ? R.toStringTag : void 0;
|
|
6
6
|
function Je(r) {
|
|
7
7
|
var e = Ye.call(r, N), t = r[N];
|
|
8
8
|
try {
|
|
@@ -18,7 +18,7 @@ function ke(r) {
|
|
|
18
18
|
return Ae.call(r);
|
|
19
19
|
}
|
|
20
20
|
var et = "[object Null]", tt = "[object Undefined]", Ie = R ? R.toStringTag : void 0;
|
|
21
|
-
function
|
|
21
|
+
function je(r) {
|
|
22
22
|
return r == null ? r === void 0 ? tt : et : Ie && Ie in Object(r) ? Je(r) : ke(r);
|
|
23
23
|
}
|
|
24
24
|
function rt(r) {
|
|
@@ -26,7 +26,7 @@ function rt(r) {
|
|
|
26
26
|
}
|
|
27
27
|
var st = "[object Symbol]";
|
|
28
28
|
function k(r) {
|
|
29
|
-
return typeof r == "symbol" || rt(r) &&
|
|
29
|
+
return typeof r == "symbol" || rt(r) && je(r) == st;
|
|
30
30
|
}
|
|
31
31
|
function it(r, e) {
|
|
32
32
|
for (var t = -1, s = r == null ? 0 : r.length, i = Array(s); ++t < s; )
|
|
@@ -52,7 +52,7 @@ var ot = "[object AsyncFunction]", at = "[object Function]", lt = "[object Gener
|
|
|
52
52
|
function ft(r) {
|
|
53
53
|
if (!G(r))
|
|
54
54
|
return !1;
|
|
55
|
-
var e =
|
|
55
|
+
var e = je(r);
|
|
56
56
|
return e == at || e == lt || e == ot || e == ut;
|
|
57
57
|
}
|
|
58
58
|
var X = A["__core-js_shared__"], Ee = function() {
|
|
@@ -62,11 +62,11 @@ var X = A["__core-js_shared__"], Ee = function() {
|
|
|
62
62
|
function ct(r) {
|
|
63
63
|
return !!Ee && Ee in r;
|
|
64
64
|
}
|
|
65
|
-
var dt = Function.prototype,
|
|
66
|
-
function
|
|
65
|
+
var dt = Function.prototype, pt = dt.toString;
|
|
66
|
+
function ht(r) {
|
|
67
67
|
if (r != null) {
|
|
68
68
|
try {
|
|
69
|
-
return
|
|
69
|
+
return pt.call(r);
|
|
70
70
|
} catch {
|
|
71
71
|
}
|
|
72
72
|
try {
|
|
@@ -83,7 +83,7 @@ function Ct(r) {
|
|
|
83
83
|
if (!G(r) || ct(r))
|
|
84
84
|
return !1;
|
|
85
85
|
var e = ft(r) ? Pt : gt;
|
|
86
|
-
return e.test(
|
|
86
|
+
return e.test(ht(r));
|
|
87
87
|
}
|
|
88
88
|
function It(r, e) {
|
|
89
89
|
return r == null ? void 0 : r[e];
|
|
@@ -114,10 +114,10 @@ function Ft(r, e, t) {
|
|
|
114
114
|
function xe(r, e) {
|
|
115
115
|
return r === e || r !== r && e !== e;
|
|
116
116
|
}
|
|
117
|
-
var
|
|
117
|
+
var wt = Object.prototype, jt = wt.hasOwnProperty;
|
|
118
118
|
function Mt(r, e, t) {
|
|
119
119
|
var s = r[e];
|
|
120
|
-
(!(
|
|
120
|
+
(!(jt.call(r, e) && xe(s, t)) || t === void 0 && !(e in r)) && Ft(r, e, t);
|
|
121
121
|
}
|
|
122
122
|
var xt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rt = /^\w*$/;
|
|
123
123
|
function $t(r, e) {
|
|
@@ -134,14 +134,14 @@ function Nt(r) {
|
|
|
134
134
|
var e = this.has(r) && delete this.__data__[r];
|
|
135
135
|
return this.size -= e ? 1 : 0, e;
|
|
136
136
|
}
|
|
137
|
-
var qt = "__lodash_hash_undefined__",
|
|
137
|
+
var qt = "__lodash_hash_undefined__", Ut = Object.prototype, Tt = Ut.hasOwnProperty;
|
|
138
138
|
function zt(r) {
|
|
139
139
|
var e = this.__data__;
|
|
140
140
|
if (z) {
|
|
141
141
|
var t = e[r];
|
|
142
142
|
return t === qt ? void 0 : t;
|
|
143
143
|
}
|
|
144
|
-
return
|
|
144
|
+
return Tt.call(e, r) ? e[r] : void 0;
|
|
145
145
|
}
|
|
146
146
|
var Lt = Object.prototype, Ht = Lt.hasOwnProperty;
|
|
147
147
|
function Dt(r) {
|
|
@@ -235,18 +235,18 @@ function ir(r, e) {
|
|
|
235
235
|
var t = K(this, r), s = t.size;
|
|
236
236
|
return t.set(r, e), this.size += t.size == s ? 0 : 1, this;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function w(r) {
|
|
239
239
|
var e = -1, t = r == null ? 0 : r.length;
|
|
240
240
|
for (this.clear(); ++e < t; ) {
|
|
241
241
|
var s = r[e];
|
|
242
242
|
this.set(s[0], s[1]);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
w.prototype.clear = kt;
|
|
246
|
+
w.prototype.delete = tr;
|
|
247
|
+
w.prototype.get = rr;
|
|
248
|
+
w.prototype.has = sr;
|
|
249
|
+
w.prototype.set = ir;
|
|
250
250
|
var nr = "Expected a function";
|
|
251
251
|
function re(r, e) {
|
|
252
252
|
if (typeof r != "function" || e != null && typeof e != "function")
|
|
@@ -258,9 +258,9 @@ function re(r, e) {
|
|
|
258
258
|
var a = r.apply(this, s);
|
|
259
259
|
return t.cache = n.set(i, a) || n, a;
|
|
260
260
|
};
|
|
261
|
-
return t.cache = new (re.Cache ||
|
|
261
|
+
return t.cache = new (re.Cache || w)(), t;
|
|
262
262
|
}
|
|
263
|
-
re.Cache =
|
|
263
|
+
re.Cache = w;
|
|
264
264
|
var or = 500;
|
|
265
265
|
function ar(r) {
|
|
266
266
|
var e = re(r, function(s) {
|
|
@@ -287,17 +287,17 @@ function $e(r) {
|
|
|
287
287
|
var e = r + "";
|
|
288
288
|
return e == "0" && 1 / r == -dr ? "-0" : e;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function pr(r, e) {
|
|
291
291
|
e = Re(e, r);
|
|
292
292
|
for (var t = 0, s = e.length; r != null && t < s; )
|
|
293
293
|
r = r[$e(e[t++])];
|
|
294
294
|
return t && t == s ? r : void 0;
|
|
295
295
|
}
|
|
296
296
|
function H(r, e, t) {
|
|
297
|
-
var s = r == null ? void 0 :
|
|
297
|
+
var s = r == null ? void 0 : pr(r, e);
|
|
298
298
|
return s === void 0 ? t : s;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function hr(r, e, t, s) {
|
|
301
301
|
if (!G(r))
|
|
302
302
|
return r;
|
|
303
303
|
e = Re(e, r);
|
|
@@ -306,15 +306,15 @@ function pr(r, e, t, s) {
|
|
|
306
306
|
if (f === "__proto__" || f === "constructor" || f === "prototype")
|
|
307
307
|
return r;
|
|
308
308
|
if (i != a) {
|
|
309
|
-
var
|
|
310
|
-
d = s ? s(
|
|
309
|
+
var p = u[f];
|
|
310
|
+
d = s ? s(p, f, u) : void 0, d === void 0 && (d = G(p) ? p : Et(e[i + 1]) ? [] : {});
|
|
311
311
|
}
|
|
312
312
|
Mt(u, f, d), u = u[f];
|
|
313
313
|
}
|
|
314
314
|
return r;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
return r == null ? r :
|
|
316
|
+
function P(r, e, t) {
|
|
317
|
+
return r == null ? r : hr(r, e, t);
|
|
318
318
|
}
|
|
319
319
|
class o {
|
|
320
320
|
static typeChecker(e) {
|
|
@@ -374,8 +374,7 @@ class o {
|
|
|
374
374
|
if (this.isArrayEmpty(e))
|
|
375
375
|
return !0;
|
|
376
376
|
for (const t of e)
|
|
377
|
-
|
|
378
|
-
return !0;
|
|
377
|
+
return this.isProcessInprogress(t);
|
|
379
378
|
}
|
|
380
379
|
return !1;
|
|
381
380
|
}
|
|
@@ -383,18 +382,18 @@ class o {
|
|
|
383
382
|
return !!e.__proform_raw_object;
|
|
384
383
|
}
|
|
385
384
|
}
|
|
386
|
-
function
|
|
385
|
+
function b(r, ...e) {
|
|
387
386
|
return e.forEach((t) => {
|
|
388
387
|
if (Array.isArray(t))
|
|
389
388
|
Array.isArray(r) || (r = []), t.forEach((s, i) => {
|
|
390
|
-
typeof s == "object" && s !== null ? r[i] =
|
|
389
|
+
typeof s == "object" && s !== null ? r[i] = b(Array.isArray(s) ? [] : {}, s) : r[i] = s;
|
|
391
390
|
});
|
|
392
391
|
else
|
|
393
392
|
for (const s in t)
|
|
394
|
-
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] =
|
|
393
|
+
t.hasOwnProperty(s) && (typeof t[s] == "object" && t[s] !== null ? r[s] = b(r[s] || {}, t[s]) : r[s] = t[s]);
|
|
395
394
|
}), r;
|
|
396
395
|
}
|
|
397
|
-
function
|
|
396
|
+
function C(r) {
|
|
398
397
|
const e = /* @__PURE__ */ new WeakMap();
|
|
399
398
|
function t(s) {
|
|
400
399
|
if (s === null || typeof s != "object")
|
|
@@ -453,32 +452,32 @@ class mr {
|
|
|
453
452
|
}
|
|
454
453
|
submit() {
|
|
455
454
|
var s;
|
|
456
|
-
const e = (s = c.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, t =
|
|
455
|
+
const e = (s = c.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, t = I.adapters[c.getUI(this.runtimeCore.ui)];
|
|
457
456
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
458
457
|
}
|
|
459
458
|
hydrate(e) {
|
|
460
|
-
|
|
459
|
+
_(() => {
|
|
461
460
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
462
461
|
() => {
|
|
463
|
-
|
|
462
|
+
U(e) ? E(
|
|
464
463
|
() => e.value,
|
|
465
464
|
() => {
|
|
466
|
-
|
|
465
|
+
b(this.runtimeCore.model.value, e.value);
|
|
467
466
|
},
|
|
468
467
|
{
|
|
469
468
|
deep: !0,
|
|
470
469
|
immediate: !0
|
|
471
470
|
}
|
|
472
|
-
) :
|
|
471
|
+
) : T(e) ? E(
|
|
473
472
|
() => e,
|
|
474
473
|
() => {
|
|
475
|
-
|
|
474
|
+
b(this.runtimeCore.model.value, e);
|
|
476
475
|
},
|
|
477
476
|
{
|
|
478
477
|
deep: !0,
|
|
479
478
|
immediate: !0
|
|
480
479
|
}
|
|
481
|
-
) :
|
|
480
|
+
) : b(this.runtimeCore.model.value, e);
|
|
482
481
|
},
|
|
483
482
|
{
|
|
484
483
|
lazy: !1
|
|
@@ -487,24 +486,24 @@ class mr {
|
|
|
487
486
|
});
|
|
488
487
|
}
|
|
489
488
|
share(e) {
|
|
490
|
-
|
|
489
|
+
_(() => {
|
|
491
490
|
Object.keys(e).forEach((t) => {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
}) :
|
|
495
|
-
|
|
496
|
-
}) : (
|
|
491
|
+
U(e[t]) ? D(() => {
|
|
492
|
+
P(this.runtimeCore.shared, t, e[t].value), this.shareHistory.get(t) !== e[t].value && (this.shareHistory.set(t, e[t].value), this.runtimeCore.processor.schemaEffect.triggerEffects());
|
|
493
|
+
}) : T(e[t]) ? D(() => {
|
|
494
|
+
P(this.runtimeCore.shared, t, e[t]), this.shareHistory.get(t) !== e[t] && (this.shareHistory.set(t, e[t]), this.runtimeCore.processor.schemaEffect.triggerEffects());
|
|
495
|
+
}) : (P(this.runtimeCore.shared, t, e[t]), this.shareHistory.get(t) !== e[t] && (this.shareHistory.set(t, e[t]), this.runtimeCore.processor.schemaEffect.triggerEffects()));
|
|
497
496
|
});
|
|
498
497
|
});
|
|
499
498
|
}
|
|
500
499
|
subscribeModel(e) {
|
|
501
|
-
|
|
500
|
+
_(() => {
|
|
502
501
|
const t = E(
|
|
503
502
|
() => this.readonlyReactiveModel.value,
|
|
504
503
|
(s) => {
|
|
505
504
|
e(s, {
|
|
506
505
|
stopSubscribe() {
|
|
507
|
-
|
|
506
|
+
_(() => {
|
|
508
507
|
t();
|
|
509
508
|
});
|
|
510
509
|
}
|
|
@@ -519,7 +518,7 @@ class mr {
|
|
|
519
518
|
}
|
|
520
519
|
resetModel() {
|
|
521
520
|
var e;
|
|
522
|
-
(e = this.runtimeCore) != null && e.model.value && (this.runtimeCore.model.value =
|
|
521
|
+
(e = this.runtimeCore) != null && e.model.value && (this.runtimeCore.model.value = C(
|
|
523
522
|
this.runtimeCore.processor.stableModel
|
|
524
523
|
), this.readonlyReactiveModel.value = Ce(this.runtimeCore.model.value), this.runtimeCore.runtimeAdapter.clearValidate(this.runtimeCore));
|
|
525
524
|
}
|
|
@@ -551,8 +550,8 @@ class gr {
|
|
|
551
550
|
l(this, "getRuntimeMeta");
|
|
552
551
|
l(this, "stableSchemas", []);
|
|
553
552
|
l(this, "stableModel", {});
|
|
554
|
-
l(this, "schemaPreset",
|
|
555
|
-
l(this, "componentPropsPreset",
|
|
553
|
+
l(this, "schemaPreset", I.schemaPreset);
|
|
554
|
+
l(this, "componentPropsPreset", I.componentPropsPreset);
|
|
556
555
|
l(this, "stableUpdaterProcessProgress");
|
|
557
556
|
l(this, "stableUpdaterTimes", 0);
|
|
558
557
|
l(this, "schemaEffect", new J());
|
|
@@ -598,7 +597,7 @@ class gr {
|
|
|
598
597
|
// 派生过程,用于外部应用
|
|
599
598
|
parseSchemas(e, t) {
|
|
600
599
|
o.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
601
|
-
|
|
600
|
+
C(e)
|
|
602
601
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, t);
|
|
603
602
|
}
|
|
604
603
|
parseStable(e) {
|
|
@@ -625,17 +624,17 @@ class gr {
|
|
|
625
624
|
}).fill(!1);
|
|
626
625
|
this.objectParser({ data: e, index: t, updater: a, parentMeta: s });
|
|
627
626
|
function a(u) {
|
|
628
|
-
const f = u.index, d = u.key,
|
|
627
|
+
const f = u.index, d = u.key, p = u.keyIndex;
|
|
629
628
|
if (o.isUndefined(u.stable))
|
|
630
629
|
return;
|
|
631
|
-
const
|
|
632
|
-
let y =
|
|
633
|
-
if (o.isProcessInprogress(y) || (n[
|
|
634
|
-
const g = i.processedSchemas.value[
|
|
635
|
-
g && o.isObject(g) && d !== "component" && (y =
|
|
630
|
+
const h = i.parseStable(u.stable), v = s == null ? void 0 : s.index, S = s == null ? void 0 : s.key;
|
|
631
|
+
let y = h;
|
|
632
|
+
if (o.isProcessInprogress(y) || (n[p] = !0), s) {
|
|
633
|
+
const g = i.processedSchemas.value[v][S][f][d];
|
|
634
|
+
g && o.isObject(g) && d !== "component" && (y = b(g, y)), i.processedSchemas.value[v][S][f][d] = y, i.stableUpdater(n);
|
|
636
635
|
} else {
|
|
637
636
|
const g = i.processedSchemas.value[f][d];
|
|
638
|
-
g && o.isObject(g) && d !== "component" && (y =
|
|
637
|
+
g && o.isObject(g) && d !== "component" && (y = b(g, y)), i.processedSchemas.value[f][d] = y, i.stableUpdater(n);
|
|
639
638
|
}
|
|
640
639
|
}
|
|
641
640
|
}
|
|
@@ -683,17 +682,17 @@ class gr {
|
|
|
683
682
|
() => {
|
|
684
683
|
/\{\s*model\s*\}/.test(t[i].toString()) ? this.fieldParser(
|
|
685
684
|
t[i],
|
|
686
|
-
(
|
|
687
|
-
if (!
|
|
688
|
-
return f(
|
|
689
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
685
|
+
(p) => {
|
|
686
|
+
if (!p)
|
|
687
|
+
return f(p);
|
|
688
|
+
this.defaultValueInprogressMap.set(t[i], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
690
689
|
this.defaultValueInprogressMap.values()
|
|
691
|
-
).every((
|
|
692
|
-
var
|
|
693
|
-
return !((
|
|
694
|
-
}) ? (f(
|
|
690
|
+
).every((h) => {
|
|
691
|
+
var v;
|
|
692
|
+
return !((v = h == null ? void 0 : h.includes) != null && v.call(h, "undefined"));
|
|
693
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), _(() => {
|
|
695
694
|
d();
|
|
696
|
-
})) : f(
|
|
695
|
+
})) : f(p);
|
|
697
696
|
},
|
|
698
697
|
{
|
|
699
698
|
rootIndex: e.index,
|
|
@@ -701,15 +700,15 @@ class gr {
|
|
|
701
700
|
}
|
|
702
701
|
) : this.fieldParser(
|
|
703
702
|
t[i],
|
|
704
|
-
(
|
|
705
|
-
this.defaultValueInprogressMap.set(t[i],
|
|
703
|
+
(p) => {
|
|
704
|
+
this.defaultValueInprogressMap.set(t[i], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
706
705
|
this.defaultValueInprogressMap.values()
|
|
707
|
-
).every((
|
|
708
|
-
var
|
|
709
|
-
return !((
|
|
710
|
-
}) ? (f(
|
|
706
|
+
).every((h) => {
|
|
707
|
+
var v;
|
|
708
|
+
return !((v = h == null ? void 0 : h.includes) != null && v.call(h, "undefined"));
|
|
709
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), _(() => {
|
|
711
710
|
d();
|
|
712
|
-
})) : f(
|
|
711
|
+
})) : f(p);
|
|
713
712
|
},
|
|
714
713
|
{
|
|
715
714
|
rootIndex: e.index,
|
|
@@ -770,7 +769,7 @@ class gr {
|
|
|
770
769
|
e.name.startsWith("__proform_onetime_") && (e.__proform_cached_result = n), this.promiseFieldParser(n, t, i, s);
|
|
771
770
|
}
|
|
772
771
|
else
|
|
773
|
-
|
|
772
|
+
U(e) ? E(
|
|
774
773
|
() => e.value,
|
|
775
774
|
() => {
|
|
776
775
|
o.isUndefined(e.value) || (i && o.isObject(e.value) && !o.isNativeObject(e.value) ? this.objectParser({
|
|
@@ -784,7 +783,7 @@ class gr {
|
|
|
784
783
|
immediate: !0,
|
|
785
784
|
deep: !0
|
|
786
785
|
}
|
|
787
|
-
) :
|
|
786
|
+
) : T(e) ? E(
|
|
788
787
|
() => e,
|
|
789
788
|
() => {
|
|
790
789
|
o.isUndefined(e) || (i && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
@@ -808,17 +807,21 @@ class gr {
|
|
|
808
807
|
modelProcessor(e) {
|
|
809
808
|
e.map(
|
|
810
809
|
(t) => this.createModel(t, this.processedModel.value)
|
|
811
|
-
), o.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (
|
|
810
|
+
), o.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && _(() => {
|
|
811
|
+
this.stableModel = C(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects();
|
|
812
|
+
});
|
|
812
813
|
}
|
|
813
814
|
setModel(e, t, s) {
|
|
814
|
-
o.isFunction(t) ?
|
|
815
|
+
o.isFunction(t) ? P(e, t(), s) : b(e, {
|
|
816
|
+
[t]: s
|
|
817
|
+
});
|
|
815
818
|
}
|
|
816
819
|
createModel(e, t) {
|
|
817
|
-
|
|
820
|
+
o.isListSchema(e) && (t[e.field] || this.setModel(t, e.field, [{}]), e.children.forEach((s) => {
|
|
818
821
|
this.createModel(s, t[e.field][0]);
|
|
819
822
|
})), o.isGroupSchema(e) && e.children.forEach((s) => {
|
|
820
823
|
this.createModel(s, t);
|
|
821
|
-
}), o.isItemSchema(e))
|
|
824
|
+
}), o.isItemSchema(e) && _(() => {
|
|
822
825
|
if ("defaultValue" in e)
|
|
823
826
|
this.setModel(t, e.field, e.defaultValue);
|
|
824
827
|
else {
|
|
@@ -828,9 +831,10 @@ class gr {
|
|
|
828
831
|
return;
|
|
829
832
|
this.setModel(t, e.field, void 0);
|
|
830
833
|
}
|
|
834
|
+
});
|
|
831
835
|
}
|
|
832
836
|
}
|
|
833
|
-
class
|
|
837
|
+
class j {
|
|
834
838
|
static getFormContainer({ ui: e } = {}) {
|
|
835
839
|
return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
|
|
836
840
|
}
|
|
@@ -860,27 +864,27 @@ class br {
|
|
|
860
864
|
}
|
|
861
865
|
getRuntimeField(e) {
|
|
862
866
|
var i;
|
|
863
|
-
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
867
|
+
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = I.adapters[c.getUI(this.ui)];
|
|
864
868
|
return (t == null ? void 0 : t.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
865
869
|
}
|
|
866
870
|
getRuntimeRequired(e) {
|
|
867
871
|
var i;
|
|
868
|
-
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
872
|
+
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = I.adapters[c.getUI(this.ui)];
|
|
869
873
|
return (t == null ? void 0 : t.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
870
874
|
}
|
|
871
875
|
getFormModelPropName() {
|
|
872
876
|
var s;
|
|
873
|
-
const e = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t =
|
|
877
|
+
const e = (s = c.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, t = I.adapters[c.getUI(this.ui)];
|
|
874
878
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (t == null ? void 0 : t.getFormModelPropName());
|
|
875
879
|
}
|
|
876
880
|
formComponentRenderer(e) {
|
|
877
881
|
var i;
|
|
878
|
-
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
882
|
+
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = I.adapters[c.getUI(this.ui)];
|
|
879
883
|
return (t == null ? void 0 : t.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
880
884
|
}
|
|
881
885
|
clearValidate(e) {
|
|
882
886
|
var i;
|
|
883
|
-
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
887
|
+
const t = (i = c.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = I.adapters[c.getUI(this.ui)];
|
|
884
888
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
885
889
|
}
|
|
886
890
|
}
|
|
@@ -915,7 +919,7 @@ class yr {
|
|
|
915
919
|
l(this, "shareHistory", /* @__PURE__ */ new Map());
|
|
916
920
|
this.setup = e, this.processor = new gr(this);
|
|
917
921
|
const t = this.setup(this);
|
|
918
|
-
if (this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new br(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()),
|
|
922
|
+
if (this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new br(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), U(t.schemas))
|
|
919
923
|
E(
|
|
920
924
|
// @ts-expect-error
|
|
921
925
|
() => t.schemas.value,
|
|
@@ -926,9 +930,9 @@ class yr {
|
|
|
926
930
|
deep: !0
|
|
927
931
|
}
|
|
928
932
|
);
|
|
929
|
-
else if (
|
|
933
|
+
else if (T(t.schemas)) {
|
|
930
934
|
const s = E(() => t.schemas, () => {
|
|
931
|
-
this.processor.parseSchemas(t.schemas),
|
|
935
|
+
this.processor.parseSchemas(t.schemas), _(() => {
|
|
932
936
|
s();
|
|
933
937
|
});
|
|
934
938
|
}, {
|
|
@@ -939,54 +943,52 @@ class yr {
|
|
|
939
943
|
}
|
|
940
944
|
getRuntimeMeta() {
|
|
941
945
|
return {
|
|
942
|
-
model: x(
|
|
946
|
+
model: x(C(this.model.value)),
|
|
943
947
|
reactiveModel: this.model.value,
|
|
944
948
|
shared: this.shared,
|
|
945
949
|
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
946
950
|
share: (t) => {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
});
|
|
956
|
-
}, 0);
|
|
951
|
+
_(() => {
|
|
952
|
+
Object.keys(t).forEach((s) => {
|
|
953
|
+
U(t[s]) ? D(() => {
|
|
954
|
+
P(this.shared, s, t[s].value), this.shareHistory.get(s) !== t[s].value && (this.shareHistory.set(s, t[s].value), this.processor.schemaEffect.triggerEffects());
|
|
955
|
+
}) : T(t[s]) ? D(() => {
|
|
956
|
+
P(this.shared, s, t[s]), this.shareHistory.get(s) !== t[s] && (this.shareHistory.set(s, t[s]), this.processor.schemaEffect.triggerEffects());
|
|
957
|
+
}) : (P(this.shared, s, t[s]), this.shareHistory.get(s) !== t[s] && (this.shareHistory.set(s, t[s]), this.processor.schemaEffect.triggerEffects()));
|
|
958
|
+
});
|
|
957
959
|
});
|
|
958
960
|
}
|
|
959
961
|
};
|
|
960
962
|
}
|
|
961
963
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
962
|
-
var ie, ne, oe, ae, le, ue, fe, ce, de,
|
|
964
|
+
var ie, ne, oe, ae, le, ue, fe, ce, de, pe, he, me, ge, be, ve, ye, _e;
|
|
963
965
|
const n = x(e.component);
|
|
964
966
|
if (!n)
|
|
965
967
|
return;
|
|
966
|
-
(ne = (ie = e.native) == null ? void 0 : ie.props) != null && ne.Form &&
|
|
967
|
-
const a =
|
|
968
|
+
(ne = (ie = e.native) == null ? void 0 : ie.props) != null && ne.Form && b(this.globalNativeFormOverride.props.Form, (ae = (oe = e.native) == null ? void 0 : oe.props) == null ? void 0 : ae.Form), (ue = (le = e.native) == null ? void 0 : le.slots) != null && ue.Form && b(this.globalNativeFormOverride.slots.Form, (ce = (fe = e.native) == null ? void 0 : fe.slots) == null ? void 0 : ce.Form);
|
|
969
|
+
const a = b(C((pe = (de = this.native) == null ? void 0 : de.slots) == null ? void 0 : pe.FormItem) ?? {}, (me = (he = e.native) == null ? void 0 : he.slots) == null ? void 0 : me.FormItem), u = {
|
|
968
970
|
display: "grid",
|
|
969
971
|
gridColumn: "1 / -1",
|
|
970
972
|
...e.grid
|
|
971
|
-
}, f =
|
|
973
|
+
}, f = b(C((be = (ge = this.native) == null ? void 0 : ge.props) == null ? void 0 : be.FormItem) ?? {}, (ye = (ve = e.native) == null ? void 0 : ve.props) == null ? void 0 : ye.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
972
974
|
schema: e,
|
|
973
975
|
parentSchema: i,
|
|
974
976
|
index: t
|
|
975
|
-
}),
|
|
976
|
-
let
|
|
977
|
+
}), p = n.name, h = e.componentProps ?? {}, v = I.placeholderPresetByComponentName;
|
|
978
|
+
let S = e.placeholder, y = e.show;
|
|
977
979
|
y === void 0 && (y = !0);
|
|
978
|
-
let g = e.label ?? "",
|
|
979
|
-
if (e.runtime ?
|
|
980
|
+
let g = e.label ?? "", O;
|
|
981
|
+
if (e.runtime ? O = e.runtime : O = (i == null ? void 0 : i.runtime) ?? this.runtime, !o.isUndefined(t) && !o.isObjectEmpty(O) && (g = Z((_e = O == null ? void 0 : O.customizeListItemLabel) == null ? void 0 : _e.call(O, e.label ?? "", t + 1), "")), !S) {
|
|
980
982
|
let V = "请输入";
|
|
981
|
-
o.isUndefined(
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
}),
|
|
983
|
+
o.isUndefined(p) ? S = `${V}${g}` : /* @ts-expect-error */ v[p.toLowerCase()] ? (V = // @ts-expect-error
|
|
984
|
+
v[p.toLowerCase()], S = `${V}${g}`) : (Object.keys(v).forEach((Pe) => {
|
|
985
|
+
p.toLowerCase().includes(Pe.toLowerCase()) && (V = v[Pe]);
|
|
986
|
+
}), S = `${V}${g}`);
|
|
985
987
|
}
|
|
986
988
|
const Ve = this.runtimeAdapter.getRuntimeRequired({
|
|
987
989
|
...e,
|
|
988
990
|
label: g
|
|
989
|
-
}), Ne =
|
|
991
|
+
}), Ne = j.getItemContainer(this), qe = j.getFormItemContainer(this), Ue = this, Te = e.componentSlots;
|
|
990
992
|
return m("div", {
|
|
991
993
|
style: u
|
|
992
994
|
}, [m(Ne, {
|
|
@@ -997,13 +999,13 @@ class yr {
|
|
|
997
999
|
label: `${g ? `${g}:` : ""}`
|
|
998
1000
|
}, d, Ve), {
|
|
999
1001
|
default() {
|
|
1000
|
-
return
|
|
1002
|
+
return Ue.runtimeAdapter.formComponentRenderer({
|
|
1001
1003
|
Component: n,
|
|
1002
1004
|
schema: e,
|
|
1003
1005
|
baseModel: s,
|
|
1004
|
-
placeholder:
|
|
1005
|
-
componentSlots:
|
|
1006
|
-
props:
|
|
1006
|
+
placeholder: S,
|
|
1007
|
+
componentSlots: Te,
|
|
1008
|
+
props: h
|
|
1007
1009
|
});
|
|
1008
1010
|
},
|
|
1009
1011
|
...a
|
|
@@ -1017,7 +1019,7 @@ class yr {
|
|
|
1017
1019
|
display: "grid",
|
|
1018
1020
|
gridColumn: "1 / -1",
|
|
1019
1021
|
...e.grid
|
|
1020
|
-
}, i =
|
|
1022
|
+
}, i = j.getGroupContainer(this);
|
|
1021
1023
|
let n = e.show;
|
|
1022
1024
|
return n === void 0 && (n = !0), m("div", {
|
|
1023
1025
|
style: s
|
|
@@ -1028,13 +1030,8 @@ class yr {
|
|
|
1028
1030
|
})]);
|
|
1029
1031
|
}
|
|
1030
1032
|
addListItem(e) {
|
|
1031
|
-
var t
|
|
1032
|
-
|
|
1033
|
-
return Promise.reject({
|
|
1034
|
-
code: "0001",
|
|
1035
|
-
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
1036
|
-
});
|
|
1037
|
-
(s = this.processor.stableModel[e.field]) != null && s[0] && this.model.value[e.field].push(P(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
1033
|
+
var t;
|
|
1034
|
+
console.log("this", this.processor.stableModel, e.field), (t = this.processor.stableModel[e.field]) != null && t[0] && this.model.value[e.field].push(C(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
1038
1035
|
}
|
|
1039
1036
|
deleteListItem(e, t) {
|
|
1040
1037
|
this.model.value[e.field].splice(t, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -1048,7 +1045,7 @@ class yr {
|
|
|
1048
1045
|
s.model.value[e.field] || (s.model.value[e.field] = [{}]);
|
|
1049
1046
|
let i = e.show;
|
|
1050
1047
|
i === void 0 && (i = !0);
|
|
1051
|
-
const n =
|
|
1048
|
+
const n = j.getListContainer(this), a = j.getListItemContainer(this);
|
|
1052
1049
|
return m("div", {
|
|
1053
1050
|
style: t
|
|
1054
1051
|
}, [i && m(n, {
|
|
@@ -1062,11 +1059,11 @@ class yr {
|
|
|
1062
1059
|
delete({
|
|
1063
1060
|
container: d
|
|
1064
1061
|
} = {}) {
|
|
1065
|
-
var
|
|
1066
|
-
const
|
|
1067
|
-
return He(m(
|
|
1062
|
+
var h;
|
|
1063
|
+
const p = d ?? m("button", null, null);
|
|
1064
|
+
return He(m(p, {
|
|
1068
1065
|
onClick: () => s.deleteListItem(e, f)
|
|
1069
|
-
}, null), [[De, ((
|
|
1066
|
+
}, null), [[De, ((h = s.model.value[e.field]) == null ? void 0 : h.length) > 1]]);
|
|
1070
1067
|
}
|
|
1071
1068
|
}));
|
|
1072
1069
|
},
|
|
@@ -1084,13 +1081,13 @@ class yr {
|
|
|
1084
1081
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
1085
1082
|
}
|
|
1086
1083
|
exec() {
|
|
1087
|
-
var u, f, d,
|
|
1084
|
+
var u, f, d, p;
|
|
1088
1085
|
const e = {
|
|
1089
1086
|
display: "grid",
|
|
1090
1087
|
gridColumn: "1 / -1",
|
|
1091
1088
|
gridAutoColumns: "1fr",
|
|
1092
1089
|
...this.grid
|
|
1093
|
-
}, t = this, s =
|
|
1090
|
+
}, t = this, s = b(this.globalNativeFormOverride.props.Form, C((f = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : f.Form) ?? {}), i = b(this.globalNativeFormOverride.slots.Form, C((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = j.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
|
|
1094
1091
|
return m(n, q(s, {
|
|
1095
1092
|
ref: this.formRef
|
|
1096
1093
|
}, {
|
|
@@ -1148,13 +1145,11 @@ const _r = {
|
|
|
1148
1145
|
message: `${r.label}是必填项`
|
|
1149
1146
|
});
|
|
1150
1147
|
}
|
|
1151
|
-
else
|
|
1152
|
-
|
|
1153
|
-
t !== -1 ? r.rules[t].required = !1 : r.rules.unshift({
|
|
1148
|
+
else
|
|
1149
|
+
r.rules && ((e = r.rules) == null ? void 0 : e.findIndex((s) => !!s.required)) === -1 && r.rules.unshift({
|
|
1154
1150
|
required: !0,
|
|
1155
1151
|
message: `${r.label}是必填项`
|
|
1156
1152
|
});
|
|
1157
|
-
}
|
|
1158
1153
|
return {
|
|
1159
1154
|
rules: r.rules
|
|
1160
1155
|
};
|
|
@@ -1174,7 +1169,7 @@ const _r = {
|
|
|
1174
1169
|
return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, q({
|
|
1175
1170
|
modelValue: a,
|
|
1176
1171
|
"onUpdate:modelValue": (u) => {
|
|
1177
|
-
o.isFunction(t.field) ?
|
|
1172
|
+
o.isFunction(t.field) ? P(e, t.field(), u) : e[t.field] = u;
|
|
1178
1173
|
},
|
|
1179
1174
|
placeholder: s
|
|
1180
1175
|
}, n), {
|
|
@@ -1242,7 +1237,7 @@ const _r = {
|
|
|
1242
1237
|
return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, q({
|
|
1243
1238
|
modelValue: a,
|
|
1244
1239
|
"onUpdate:modelValue": (u) => {
|
|
1245
|
-
o.isFunction(t.field) ?
|
|
1240
|
+
o.isFunction(t.field) ? P(e, t.field(), u) : e[t.field] = u;
|
|
1246
1241
|
},
|
|
1247
1242
|
placeholder: s
|
|
1248
1243
|
}, n), {
|
|
@@ -1317,7 +1312,7 @@ const _r = {
|
|
|
1317
1312
|
return o.isFunction(t.field) ? a = H(e, t.field()) : a = e[t.field], m(r, q({
|
|
1318
1313
|
value: a,
|
|
1319
1314
|
"onUpdate:value": (u) => {
|
|
1320
|
-
o.isFunction(t.field) ?
|
|
1315
|
+
o.isFunction(t.field) ? P(e, t.field(), u) : e[t.field] = u;
|
|
1321
1316
|
},
|
|
1322
1317
|
placeholder: s
|
|
1323
1318
|
}, n), {
|
|
@@ -1400,7 +1395,7 @@ l(M, "schemaPreset", {
|
|
|
1400
1395
|
}), // 基于基本功能提出基本预设
|
|
1401
1396
|
l(M, "placeholderPresetByComponentName", M.getPlaceholderPrefixPresetByComponentName());
|
|
1402
1397
|
let Q = M;
|
|
1403
|
-
const
|
|
1398
|
+
const I = {
|
|
1404
1399
|
...Q,
|
|
1405
1400
|
adapters: {
|
|
1406
1401
|
..._r
|
|
@@ -1451,10 +1446,10 @@ function Er(r) {
|
|
|
1451
1446
|
function Fr(r) {
|
|
1452
1447
|
return r.__proform_raw_object = !0, r;
|
|
1453
1448
|
}
|
|
1454
|
-
function
|
|
1449
|
+
function wr(r) {
|
|
1455
1450
|
return se(r, "onetime");
|
|
1456
1451
|
}
|
|
1457
|
-
function
|
|
1452
|
+
function jr(r) {
|
|
1458
1453
|
function e() {
|
|
1459
1454
|
return r;
|
|
1460
1455
|
}
|
|
@@ -1467,8 +1462,8 @@ export {
|
|
|
1467
1462
|
Ir as ProForm,
|
|
1468
1463
|
Er as markNativeFunction,
|
|
1469
1464
|
Fr as markNativeObject,
|
|
1470
|
-
|
|
1471
|
-
|
|
1465
|
+
wr as markOnetimeFunction,
|
|
1466
|
+
jr as markStructuredPathParsing,
|
|
1472
1467
|
Sr as useForm,
|
|
1473
1468
|
Or as useFormPresetConfigurer,
|
|
1474
1469
|
se as useModifiers
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Ref } from "vue";
|
|
3
2
|
import { Setup, Schema, AnyObject, ItemSchema, GroupSchema, ListSchema, ProcessorBySchemaType, Runtime, NativeCustomizationOptions } from "../../types";
|
|
4
3
|
import Processor from "../Processor";
|
|
@@ -28,7 +27,6 @@ export default class RuntimeCore {
|
|
|
28
27
|
ui: string;
|
|
29
28
|
runtimeAdapter: RuntimeAdpter;
|
|
30
29
|
shared: AnyObject;
|
|
31
|
-
shareTimeout: NodeJS.Timeout;
|
|
32
30
|
shareHistory: Map<any, any>;
|
|
33
31
|
constructor(setup: Setup);
|
|
34
32
|
getRuntimeMeta(): {
|
|
@@ -39,7 +37,7 @@ export default class RuntimeCore {
|
|
|
39
37
|
};
|
|
40
38
|
runtimeItemProcessor(schema: ItemSchema, index?: number, baseModel?: AnyObject, parentSchema?: ListSchema): JSX.Element | undefined;
|
|
41
39
|
runtimeGroupProcessor(schema: GroupSchema): JSX.Element;
|
|
42
|
-
addListItem(schema: AnyObject):
|
|
40
|
+
addListItem(schema: AnyObject): void;
|
|
43
41
|
deleteListItem(schema: AnyObject, index: number): void;
|
|
44
42
|
runtimeListProcessor(schema: ListSchema): JSX.Element;
|
|
45
43
|
runtimeProcessor(schemas: Schema[]): any[];
|