@harbor-design/proform 1.3.23 → 1.3.25
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 +134 -164
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Te = Object.defineProperty;
|
|
2
2
|
var ze = (r, e, t) => e in r ? Te(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var u = (r, e, t) => (ze(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
import { ref as z, readonly as Pe, nextTick as
|
|
4
|
+
import { ref as z, readonly as Pe, nextTick as S, isRef as q, watch as _, isReactive as U, toRaw as x, reactive as K, createVNode as m, mergeProps as N, withDirectives as Le, vShow as De, createTextVNode as Ge, isVNode as Be, defineComponent as He } from "vue";
|
|
5
5
|
class o {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -69,15 +69,15 @@ class o {
|
|
|
69
69
|
return !!e.__proform_raw_object;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function b(r, ...e) {
|
|
73
73
|
return e.forEach((t) => {
|
|
74
74
|
if (Array.isArray(t))
|
|
75
75
|
Array.isArray(r) || (r = []), t.forEach((i, s) => {
|
|
76
|
-
typeof i == "object" && i !== null ? r[s] =
|
|
76
|
+
typeof i == "object" && i !== null ? r[s] = b(Array.isArray(i) ? [] : {}, i) : r[s] = i;
|
|
77
77
|
});
|
|
78
78
|
else
|
|
79
79
|
for (const i in t)
|
|
80
|
-
t.hasOwnProperty(i) && (typeof t[i] == "object" && t[i] !== null ? r[i] =
|
|
80
|
+
t.hasOwnProperty(i) && (typeof t[i] == "object" && t[i] !== null ? r[i] = b(r[i] || {}, t[i]) : r[i] = t[i]);
|
|
81
81
|
}), r;
|
|
82
82
|
}
|
|
83
83
|
function P(r) {
|
|
@@ -142,28 +142,28 @@ class Ke {
|
|
|
142
142
|
return (e == null ? void 0 : e.validateForm(this)) ?? (t == null ? void 0 : t.validateForm(this));
|
|
143
143
|
}
|
|
144
144
|
hydrate(e) {
|
|
145
|
-
|
|
145
|
+
S(() => {
|
|
146
146
|
this.runtimeCore.hydrateEffect.trackEffect(
|
|
147
147
|
() => {
|
|
148
|
-
|
|
148
|
+
q(e) ? _(
|
|
149
149
|
() => e.value,
|
|
150
150
|
() => {
|
|
151
|
-
|
|
151
|
+
b(this.runtimeCore.model.value, e.value);
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
deep: !0,
|
|
155
155
|
immediate: !0
|
|
156
156
|
}
|
|
157
|
-
) :
|
|
157
|
+
) : U(e) ? _(
|
|
158
158
|
() => e,
|
|
159
159
|
() => {
|
|
160
|
-
|
|
160
|
+
b(this.runtimeCore.model.value, e);
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
deep: !0,
|
|
164
164
|
immediate: !0
|
|
165
165
|
}
|
|
166
|
-
) :
|
|
166
|
+
) : b(this.runtimeCore.model.value, e);
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
169
|
lazy: !1
|
|
@@ -172,64 +172,44 @@ class Ke {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
share(e) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
()
|
|
178
|
-
() => {
|
|
179
|
-
h(this.runtimeCore.shared, e.value);
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
deep: !0,
|
|
183
|
-
immediate: !0
|
|
184
|
-
}
|
|
185
|
-
) : j(e) ? g(
|
|
186
|
-
() => e,
|
|
187
|
-
() => {
|
|
188
|
-
h(this.runtimeCore.shared, e);
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
deep: !0,
|
|
192
|
-
immediate: !0
|
|
193
|
-
}
|
|
194
|
-
) : Object.keys(e).forEach((t) => {
|
|
195
|
-
console.log(e[t], S(e[t]), j(e[t])), S(e[t]) ? (Object.assign(this.runtimeCore.shared, {
|
|
196
|
-
[t]: e[t].value
|
|
197
|
-
}), g(
|
|
175
|
+
S(() => {
|
|
176
|
+
Object.keys(e).forEach((t) => {
|
|
177
|
+
q(e[t]) ? _(
|
|
198
178
|
() => e[t].value,
|
|
199
179
|
() => {
|
|
200
|
-
|
|
180
|
+
this.runtimeCore.shared[t] ? this.runtimeCore.shared[t] = e[t].value : Object.assign(this.runtimeCore.shared, {
|
|
201
181
|
[t]: e[t].value
|
|
202
182
|
});
|
|
203
183
|
},
|
|
204
184
|
{
|
|
205
|
-
deep: !0
|
|
185
|
+
deep: !0,
|
|
186
|
+
immediate: !0
|
|
206
187
|
}
|
|
207
|
-
)
|
|
208
|
-
[t]: e[t]
|
|
209
|
-
}), g(
|
|
188
|
+
) : U(e[t]) ? _(
|
|
210
189
|
() => e[t],
|
|
211
190
|
() => {
|
|
212
|
-
|
|
191
|
+
this.runtimeCore.shared[t] ? this.runtimeCore.shared[t] = e[t] : Object.assign(this.runtimeCore.shared, {
|
|
213
192
|
[t]: e[t]
|
|
214
193
|
});
|
|
215
194
|
},
|
|
216
195
|
{
|
|
217
|
-
deep: !0
|
|
196
|
+
deep: !0,
|
|
197
|
+
immediate: !0
|
|
218
198
|
}
|
|
219
|
-
)
|
|
199
|
+
) : this.runtimeCore.shared[t] ? this.runtimeCore.shared[t] = e[t] : Object.assign(this.runtimeCore.shared, {
|
|
220
200
|
[t]: e[t]
|
|
221
201
|
});
|
|
222
202
|
});
|
|
223
203
|
});
|
|
224
204
|
}
|
|
225
205
|
subscribeModel(e) {
|
|
226
|
-
|
|
227
|
-
const t =
|
|
206
|
+
S(() => {
|
|
207
|
+
const t = _(
|
|
228
208
|
() => this.readonlyReactiveModel.value,
|
|
229
209
|
(i) => {
|
|
230
210
|
e(i, {
|
|
231
211
|
stopSubscribe() {
|
|
232
|
-
|
|
212
|
+
S(() => {
|
|
233
213
|
t();
|
|
234
214
|
});
|
|
235
215
|
}
|
|
@@ -268,22 +248,22 @@ class Z {
|
|
|
268
248
|
return !t.lazy && e(), t.identifier ? this.identifierMap.get(t.identifier) || (this.effects.add(e), this.identifierMap.set(t.identifier, !0)) : this.effects.add(e), () => this.effects.delete(e);
|
|
269
249
|
}
|
|
270
250
|
}
|
|
271
|
-
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Q = We || Xe || Function("return this")(),
|
|
251
|
+
var We = typeof global == "object" && global && global.Object === Object && global, Xe = typeof self == "object" && self && self.Object === Object && self, Q = We || Xe || Function("return this")(), E = Q.Symbol, Fe = Object.prototype, Ye = Fe.hasOwnProperty, Ze = Fe.toString, V = E ? E.toStringTag : void 0;
|
|
272
252
|
function Je(r) {
|
|
273
|
-
var e = Ye.call(r,
|
|
253
|
+
var e = Ye.call(r, V), t = r[V];
|
|
274
254
|
try {
|
|
275
|
-
r[
|
|
255
|
+
r[V] = void 0;
|
|
276
256
|
var i = !0;
|
|
277
257
|
} catch {
|
|
278
258
|
}
|
|
279
259
|
var s = Ze.call(r);
|
|
280
|
-
return i && (e ? r[
|
|
260
|
+
return i && (e ? r[V] = t : delete r[V]), s;
|
|
281
261
|
}
|
|
282
262
|
var Qe = Object.prototype, ke = Qe.toString;
|
|
283
263
|
function Ae(r) {
|
|
284
264
|
return ke.call(r);
|
|
285
265
|
}
|
|
286
|
-
var et = "[object Null]", tt = "[object Undefined]", Ce =
|
|
266
|
+
var et = "[object Null]", tt = "[object Undefined]", Ce = E ? E.toStringTag : void 0;
|
|
287
267
|
function we(r) {
|
|
288
268
|
return r == null ? r === void 0 ? tt : et : Ce && Ce in Object(r) ? Je(r) : Ae(r);
|
|
289
269
|
}
|
|
@@ -299,7 +279,7 @@ function st(r, e) {
|
|
|
299
279
|
s[t] = e(r[t], t, r);
|
|
300
280
|
return s;
|
|
301
281
|
}
|
|
302
|
-
var A = Array.isArray, nt = 1 / 0, Ie =
|
|
282
|
+
var A = Array.isArray, nt = 1 / 0, Ie = E ? E.prototype : void 0, Oe = Ie ? Ie.toString : void 0;
|
|
303
283
|
function Me(r) {
|
|
304
284
|
if (typeof r == "string")
|
|
305
285
|
return r;
|
|
@@ -419,18 +399,18 @@ function Ht(r, e) {
|
|
|
419
399
|
var t = this.__data__;
|
|
420
400
|
return this.size += this.has(r) ? 0 : 1, t[r] = T && e === void 0 ? Bt : e, this;
|
|
421
401
|
}
|
|
422
|
-
function
|
|
402
|
+
function j(r) {
|
|
423
403
|
var e = -1, t = r == null ? 0 : r.length;
|
|
424
404
|
for (this.clear(); ++e < t; ) {
|
|
425
405
|
var i = r[e];
|
|
426
406
|
this.set(i[0], i[1]);
|
|
427
407
|
}
|
|
428
408
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
409
|
+
j.prototype.clear = Vt;
|
|
410
|
+
j.prototype.delete = Nt;
|
|
411
|
+
j.prototype.get = zt;
|
|
412
|
+
j.prototype.has = Gt;
|
|
413
|
+
j.prototype.set = Ht;
|
|
434
414
|
function Kt() {
|
|
435
415
|
this.__data__ = [], this.size = 0;
|
|
436
416
|
}
|
|
@@ -459,24 +439,24 @@ function Qt(r, e) {
|
|
|
459
439
|
var t = this.__data__, i = B(t, r);
|
|
460
440
|
return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
|
|
461
441
|
}
|
|
462
|
-
function
|
|
442
|
+
function R(r) {
|
|
463
443
|
var e = -1, t = r == null ? 0 : r.length;
|
|
464
444
|
for (this.clear(); ++e < t; ) {
|
|
465
445
|
var i = r[e];
|
|
466
446
|
this.set(i[0], i[1]);
|
|
467
447
|
}
|
|
468
448
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
449
|
+
R.prototype.clear = Kt;
|
|
450
|
+
R.prototype.delete = Yt;
|
|
451
|
+
R.prototype.get = Zt;
|
|
452
|
+
R.prototype.has = Jt;
|
|
453
|
+
R.prototype.set = Qt;
|
|
474
454
|
var kt = ee(Q, "Map");
|
|
475
455
|
function At() {
|
|
476
456
|
this.size = 0, this.__data__ = {
|
|
477
|
-
hash: new
|
|
478
|
-
map: new (kt ||
|
|
479
|
-
string: new
|
|
457
|
+
hash: new j(),
|
|
458
|
+
map: new (kt || R)(),
|
|
459
|
+
string: new j()
|
|
480
460
|
};
|
|
481
461
|
}
|
|
482
462
|
function er(r) {
|
|
@@ -501,18 +481,18 @@ function sr(r, e) {
|
|
|
501
481
|
var t = H(this, r), i = t.size;
|
|
502
482
|
return t.set(r, e), this.size += t.size == i ? 0 : 1, this;
|
|
503
483
|
}
|
|
504
|
-
function
|
|
484
|
+
function F(r) {
|
|
505
485
|
var e = -1, t = r == null ? 0 : r.length;
|
|
506
486
|
for (this.clear(); ++e < t; ) {
|
|
507
487
|
var i = r[e];
|
|
508
488
|
this.set(i[0], i[1]);
|
|
509
489
|
}
|
|
510
490
|
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
491
|
+
F.prototype.clear = At;
|
|
492
|
+
F.prototype.delete = tr;
|
|
493
|
+
F.prototype.get = rr;
|
|
494
|
+
F.prototype.has = ir;
|
|
495
|
+
F.prototype.set = sr;
|
|
516
496
|
var nr = "Expected a function";
|
|
517
497
|
function te(r, e) {
|
|
518
498
|
if (typeof r != "function" || e != null && typeof e != "function")
|
|
@@ -524,9 +504,9 @@ function te(r, e) {
|
|
|
524
504
|
var a = r.apply(this, i);
|
|
525
505
|
return t.cache = n.set(s, a) || n, a;
|
|
526
506
|
};
|
|
527
|
-
return t.cache = new (te.Cache ||
|
|
507
|
+
return t.cache = new (te.Cache || F)(), t;
|
|
528
508
|
}
|
|
529
|
-
te.Cache =
|
|
509
|
+
te.Cache = F;
|
|
530
510
|
var or = 500;
|
|
531
511
|
function ar(r) {
|
|
532
512
|
var e = te(r, function(i) {
|
|
@@ -599,7 +579,7 @@ class mr {
|
|
|
599
579
|
u(this, "defaultValueInprogressMap", /* @__PURE__ */ new Map());
|
|
600
580
|
u(this, "baseDefaultValueFunctionsLength");
|
|
601
581
|
u(this, "isModelInitialized", !0);
|
|
602
|
-
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e),
|
|
582
|
+
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e), _(
|
|
603
583
|
() => this.processedModel.value,
|
|
604
584
|
() => {
|
|
605
585
|
this.schemaEffect.triggerEffects();
|
|
@@ -651,7 +631,7 @@ class mr {
|
|
|
651
631
|
// 对于稳定初始化更新的抽象
|
|
652
632
|
stableUpdater(e = []) {
|
|
653
633
|
if (e.every(Boolean)) {
|
|
654
|
-
const t =
|
|
634
|
+
const t = x(this.processedSchemas.value);
|
|
655
635
|
!o.isProcessInprogress(t) && o.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
656
636
|
length: t.length
|
|
657
637
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -667,14 +647,14 @@ class mr {
|
|
|
667
647
|
const f = l.index, d = l.key, p = l.keyIndex;
|
|
668
648
|
if (o.isUndefined(l.stable))
|
|
669
649
|
return;
|
|
670
|
-
const
|
|
671
|
-
let
|
|
672
|
-
if (o.isProcessInprogress(
|
|
673
|
-
const
|
|
674
|
-
|
|
650
|
+
const h = s.parseStable(l.stable), v = i == null ? void 0 : i.index, I = i == null ? void 0 : i.key;
|
|
651
|
+
let y = h;
|
|
652
|
+
if (o.isProcessInprogress(y) || (n[p] = !0), i) {
|
|
653
|
+
const g = s.processedSchemas.value[v][I][f][d];
|
|
654
|
+
g && o.isObject(g) && d !== "component" && (y = b(g, y)), s.processedSchemas.value[v][I][f][d] = y, s.stableUpdater(n);
|
|
675
655
|
} else {
|
|
676
|
-
const
|
|
677
|
-
|
|
656
|
+
const g = s.processedSchemas.value[f][d];
|
|
657
|
+
g && o.isObject(g) && d !== "component" && (y = b(g, y)), s.processedSchemas.value[f][d] = y, s.stableUpdater(n);
|
|
678
658
|
}
|
|
679
659
|
}
|
|
680
660
|
}
|
|
@@ -727,10 +707,10 @@ class mr {
|
|
|
727
707
|
return f(p);
|
|
728
708
|
this.defaultValueInprogressMap.set(t[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
729
709
|
this.defaultValueInprogressMap.values()
|
|
730
|
-
).every((
|
|
731
|
-
var
|
|
732
|
-
return !((
|
|
733
|
-
}) ? (f(p), this.defaultValueEffect.clearEffects(),
|
|
710
|
+
).every((h) => {
|
|
711
|
+
var v;
|
|
712
|
+
return !((v = h == null ? void 0 : h.includes) != null && v.call(h, "undefined"));
|
|
713
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), S(() => {
|
|
734
714
|
d();
|
|
735
715
|
})) : f(p);
|
|
736
716
|
},
|
|
@@ -743,10 +723,10 @@ class mr {
|
|
|
743
723
|
(p) => {
|
|
744
724
|
this.defaultValueInprogressMap.set(t[s], p), !o.isProcessInprogress(p) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
745
725
|
this.defaultValueInprogressMap.values()
|
|
746
|
-
).every((
|
|
747
|
-
var
|
|
748
|
-
return !((
|
|
749
|
-
}) ? (f(p), this.defaultValueEffect.clearEffects(),
|
|
726
|
+
).every((h) => {
|
|
727
|
+
var v;
|
|
728
|
+
return !((v = h == null ? void 0 : h.includes) != null && v.call(h, "undefined"));
|
|
729
|
+
}) ? (f(p), this.defaultValueEffect.clearEffects(), S(() => {
|
|
750
730
|
d();
|
|
751
731
|
})) : f(p);
|
|
752
732
|
},
|
|
@@ -809,7 +789,7 @@ class mr {
|
|
|
809
789
|
e.name.startsWith("__proform_onetime_") && (e.__proform_cached_result = n), this.promiseFieldParser(n, t, s, i);
|
|
810
790
|
}
|
|
811
791
|
else
|
|
812
|
-
|
|
792
|
+
q(e) ? _(
|
|
813
793
|
() => e.value,
|
|
814
794
|
() => {
|
|
815
795
|
o.isUndefined(e.value) || (s && o.isObject(e.value) && !o.isNativeObject(e.value) ? this.objectParser({
|
|
@@ -823,7 +803,7 @@ class mr {
|
|
|
823
803
|
immediate: !0,
|
|
824
804
|
deep: !0
|
|
825
805
|
}
|
|
826
|
-
) :
|
|
806
|
+
) : U(e) ? _(
|
|
827
807
|
() => e,
|
|
828
808
|
() => {
|
|
829
809
|
o.isUndefined(e) || (s && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
@@ -869,7 +849,7 @@ class mr {
|
|
|
869
849
|
}
|
|
870
850
|
}
|
|
871
851
|
}
|
|
872
|
-
class
|
|
852
|
+
class w {
|
|
873
853
|
static getFormContainer({ ui: e } = {}) {
|
|
874
854
|
return c.presets.uiPresets[e ?? c.presets.ui].container.Form;
|
|
875
855
|
}
|
|
@@ -953,8 +933,8 @@ class vr {
|
|
|
953
933
|
u(this, "shared", K({}));
|
|
954
934
|
this.setup = e, this.processor = new mr(this);
|
|
955
935
|
const t = this.setup(this);
|
|
956
|
-
if (this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new br(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()),
|
|
957
|
-
|
|
936
|
+
if (this.ui = t.ui ?? c.presets.ui, this.runtimeAdapter = new br(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(t.schemas))
|
|
937
|
+
_(
|
|
958
938
|
// @ts-expect-error
|
|
959
939
|
() => t.schemas.value,
|
|
960
940
|
() => {
|
|
@@ -964,9 +944,9 @@ class vr {
|
|
|
964
944
|
deep: !0
|
|
965
945
|
}
|
|
966
946
|
);
|
|
967
|
-
else if (
|
|
968
|
-
const i =
|
|
969
|
-
this.processor.parseSchemas(t.schemas),
|
|
947
|
+
else if (U(t.schemas)) {
|
|
948
|
+
const i = _(() => t.schemas, () => {
|
|
949
|
+
this.processor.parseSchemas(t.schemas), S(() => {
|
|
970
950
|
i();
|
|
971
951
|
});
|
|
972
952
|
}, {
|
|
@@ -977,37 +957,27 @@ class vr {
|
|
|
977
957
|
}
|
|
978
958
|
getRuntimeMeta() {
|
|
979
959
|
return {
|
|
980
|
-
model:
|
|
960
|
+
model: x(P(this.model.value)),
|
|
981
961
|
reactiveModel: this.model.value,
|
|
982
962
|
shared: this.shared,
|
|
983
963
|
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
984
964
|
share: (t) => {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
deep: !0,
|
|
989
|
-
immediate: !0
|
|
990
|
-
}) : j(t) ? g(() => t, () => {
|
|
991
|
-
h(this.shared, t);
|
|
992
|
-
}, {
|
|
993
|
-
deep: !0,
|
|
994
|
-
immediate: !0
|
|
995
|
-
}) : Object.keys(t).forEach((i) => {
|
|
996
|
-
S(t[i]) ? g(() => t[i].value, () => {
|
|
997
|
-
h(this.shared, {
|
|
965
|
+
Object.keys(t).forEach((i) => {
|
|
966
|
+
q(t[i]) ? _(() => t[i].value, () => {
|
|
967
|
+
b(this.shared, {
|
|
998
968
|
[i]: t[i].value
|
|
999
969
|
});
|
|
1000
970
|
}, {
|
|
1001
971
|
deep: !0,
|
|
1002
972
|
immediate: !0
|
|
1003
|
-
}) :
|
|
1004
|
-
|
|
973
|
+
}) : U(t[i]) ? _(() => t[i], () => {
|
|
974
|
+
b(this.shared, {
|
|
1005
975
|
[i]: t[i]
|
|
1006
976
|
});
|
|
1007
977
|
}, {
|
|
1008
978
|
deep: !0,
|
|
1009
979
|
immediate: !0
|
|
1010
|
-
}) :
|
|
980
|
+
}) : b(this.shared, {
|
|
1011
981
|
[i]: t[i]
|
|
1012
982
|
});
|
|
1013
983
|
});
|
|
@@ -1016,41 +986,41 @@ class vr {
|
|
|
1016
986
|
}
|
|
1017
987
|
runtimeItemProcessor(e, t, i = this.model.value, s) {
|
|
1018
988
|
var ie, se, ne, oe, ae, le, ue, fe, ce, de, pe, he, me, be, ge, ve, ye;
|
|
1019
|
-
const n =
|
|
989
|
+
const n = x(e.component);
|
|
1020
990
|
if (!n)
|
|
1021
991
|
return;
|
|
1022
|
-
(se = (ie = e.native) == null ? void 0 : ie.props) != null && se.Form &&
|
|
1023
|
-
const a =
|
|
992
|
+
(se = (ie = e.native) == null ? void 0 : ie.props) != null && se.Form && b(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 && b(this.globalNativeFormOverride.slots.Form, (fe = (ue = e.native) == null ? void 0 : ue.slots) == null ? void 0 : fe.Form);
|
|
993
|
+
const a = b(P((de = (ce = this.native) == null ? void 0 : ce.slots) == null ? void 0 : de.FormItem) ?? {}, (he = (pe = e.native) == null ? void 0 : pe.slots) == null ? void 0 : he.FormItem), l = {
|
|
1024
994
|
display: "grid",
|
|
1025
995
|
gridColumn: "1 / -1",
|
|
1026
996
|
...e.grid
|
|
1027
|
-
}, f =
|
|
997
|
+
}, f = b(P((be = (me = this.native) == null ? void 0 : me.props) == null ? void 0 : be.FormItem) ?? {}, (ve = (ge = e.native) == null ? void 0 : ge.props) == null ? void 0 : ve.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
1028
998
|
schema: e,
|
|
1029
999
|
parentSchema: s,
|
|
1030
1000
|
index: t
|
|
1031
|
-
}), p = n.name,
|
|
1032
|
-
let I = e.placeholder,
|
|
1033
|
-
|
|
1034
|
-
let
|
|
1035
|
-
if (e.runtime ? O = e.runtime : O = (s == null ? void 0 : s.runtime) ?? this.runtime, !o.isUndefined(t) && !o.isObjectEmpty(O) && (
|
|
1036
|
-
let
|
|
1037
|
-
o.isUndefined(p) ? I = `${
|
|
1038
|
-
|
|
1039
|
-
p.toLowerCase().includes(_e.toLowerCase()) && (
|
|
1040
|
-
}), I = `${
|
|
1001
|
+
}), p = n.name, h = e.componentProps ?? {}, v = C.placeholderPresetByComponentName;
|
|
1002
|
+
let I = e.placeholder, y = e.show;
|
|
1003
|
+
y === void 0 && (y = !0);
|
|
1004
|
+
let g = e.label ?? "", O;
|
|
1005
|
+
if (e.runtime ? O = e.runtime : O = (s == null ? void 0 : s.runtime) ?? this.runtime, !o.isUndefined(t) && !o.isObjectEmpty(O) && (g = Y((ye = O == null ? void 0 : O.customizeListItemLabel) == null ? void 0 : ye.call(O, e.label ?? "", t + 1), "")), !I) {
|
|
1006
|
+
let $ = "请输入";
|
|
1007
|
+
o.isUndefined(p) ? I = `${$}${g}` : /* @ts-expect-error */ v[p.toLowerCase()] ? ($ = // @ts-expect-error
|
|
1008
|
+
v[p.toLowerCase()], I = `${$}${g}`) : (Object.keys(v).forEach((_e) => {
|
|
1009
|
+
p.toLowerCase().includes(_e.toLowerCase()) && ($ = v[_e]);
|
|
1010
|
+
}), I = `${$}${g}`);
|
|
1041
1011
|
}
|
|
1042
1012
|
const $e = this.runtimeAdapter.getRuntimeRequired({
|
|
1043
1013
|
...e,
|
|
1044
|
-
label:
|
|
1045
|
-
}), Ve =
|
|
1046
|
-
return
|
|
1014
|
+
label: g
|
|
1015
|
+
}), Ve = w.getItemContainer(this), Ne = w.getFormItemContainer(this), qe = this, Ue = e.componentSlots;
|
|
1016
|
+
return m("div", {
|
|
1047
1017
|
style: l
|
|
1048
|
-
}, [
|
|
1049
|
-
show:
|
|
1018
|
+
}, [m(Ve, {
|
|
1019
|
+
show: y
|
|
1050
1020
|
}, {
|
|
1051
1021
|
default() {
|
|
1052
|
-
return
|
|
1053
|
-
label: `${
|
|
1022
|
+
return y && m(Ne, N(f, {
|
|
1023
|
+
label: `${g ? `${g}:` : ""}`
|
|
1054
1024
|
}, d, $e), {
|
|
1055
1025
|
default() {
|
|
1056
1026
|
return qe.runtimeAdapter.formComponentRenderer({
|
|
@@ -1059,7 +1029,7 @@ class vr {
|
|
|
1059
1029
|
baseModel: i,
|
|
1060
1030
|
placeholder: I,
|
|
1061
1031
|
componentSlots: Ue,
|
|
1062
|
-
props:
|
|
1032
|
+
props: h
|
|
1063
1033
|
});
|
|
1064
1034
|
},
|
|
1065
1035
|
...a
|
|
@@ -1073,11 +1043,11 @@ class vr {
|
|
|
1073
1043
|
display: "grid",
|
|
1074
1044
|
gridColumn: "1 / -1",
|
|
1075
1045
|
...e.grid
|
|
1076
|
-
}, s =
|
|
1046
|
+
}, s = w.getGroupContainer(this);
|
|
1077
1047
|
let n = e.show;
|
|
1078
|
-
return n === void 0 && (n = !0),
|
|
1048
|
+
return n === void 0 && (n = !0), m("div", {
|
|
1079
1049
|
style: i
|
|
1080
|
-
}, [n &&
|
|
1050
|
+
}, [n && m(s, {
|
|
1081
1051
|
schema: e
|
|
1082
1052
|
}, gr(t = e.children.map((a) => this.runtimeItemProcessor(a))) ? t : {
|
|
1083
1053
|
default: () => [t]
|
|
@@ -1104,33 +1074,33 @@ class vr {
|
|
|
1104
1074
|
i.model.value[e.field] || (i.model.value[e.field] = [{}]);
|
|
1105
1075
|
let s = e.show;
|
|
1106
1076
|
s === void 0 && (s = !0);
|
|
1107
|
-
const n =
|
|
1108
|
-
return
|
|
1077
|
+
const n = w.getListContainer(this), a = w.getListItemContainer(this);
|
|
1078
|
+
return m("div", {
|
|
1109
1079
|
style: t
|
|
1110
|
-
}, [s &&
|
|
1080
|
+
}, [s && m(n, {
|
|
1111
1081
|
schema: e
|
|
1112
1082
|
}, {
|
|
1113
1083
|
default() {
|
|
1114
|
-
return i.model.value[e.field].map((l, f) =>
|
|
1084
|
+
return i.model.value[e.field].map((l, f) => m(a, null, {
|
|
1115
1085
|
default() {
|
|
1116
1086
|
return e.children.map((d) => i.runtimeItemProcessor(d, f, l, e));
|
|
1117
1087
|
},
|
|
1118
1088
|
delete({
|
|
1119
1089
|
container: d
|
|
1120
1090
|
} = {}) {
|
|
1121
|
-
var
|
|
1122
|
-
const p = d ??
|
|
1123
|
-
return Le(
|
|
1091
|
+
var h;
|
|
1092
|
+
const p = d ?? m("button", null, null);
|
|
1093
|
+
return Le(m(p, {
|
|
1124
1094
|
onClick: () => i.deleteListItem(e, f)
|
|
1125
|
-
}, null), [[De, ((
|
|
1095
|
+
}, null), [[De, ((h = i.model.value[e.field]) == null ? void 0 : h.length) > 1]]);
|
|
1126
1096
|
}
|
|
1127
1097
|
}));
|
|
1128
1098
|
},
|
|
1129
1099
|
add({
|
|
1130
1100
|
container: l
|
|
1131
1101
|
} = {}) {
|
|
1132
|
-
const f = l ??
|
|
1133
|
-
return
|
|
1102
|
+
const f = l ?? m("button", null, [Ge("添加")]);
|
|
1103
|
+
return m(f, {
|
|
1134
1104
|
onClick: () => i.addListItem(e)
|
|
1135
1105
|
}, null);
|
|
1136
1106
|
}
|
|
@@ -1146,14 +1116,14 @@ class vr {
|
|
|
1146
1116
|
gridColumn: "1 / -1",
|
|
1147
1117
|
gridAutoColumns: "1fr",
|
|
1148
1118
|
...this.grid
|
|
1149
|
-
}, t = this, i =
|
|
1150
|
-
return
|
|
1119
|
+
}, t = this, i = b(this.globalNativeFormOverride.props.Form, P((f = (l = this.native) == null ? void 0 : l.props) == null ? void 0 : f.Form) ?? {}), s = b(this.globalNativeFormOverride.slots.Form, P((p = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : p.Form) ?? {}), n = w.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
|
|
1120
|
+
return m(n, N(i, {
|
|
1151
1121
|
ref: this.formRef
|
|
1152
1122
|
}, {
|
|
1153
1123
|
[a]: this.model.value
|
|
1154
1124
|
}), {
|
|
1155
1125
|
default() {
|
|
1156
|
-
return
|
|
1126
|
+
return m("div", {
|
|
1157
1127
|
style: e
|
|
1158
1128
|
}, [t.runtimeProcessor(t.schemas.value)]);
|
|
1159
1129
|
},
|
|
@@ -1227,7 +1197,7 @@ const yr = {
|
|
|
1227
1197
|
props: n
|
|
1228
1198
|
}) {
|
|
1229
1199
|
let a;
|
|
1230
|
-
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field],
|
|
1200
|
+
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field], m(r, N({
|
|
1231
1201
|
modelValue: a,
|
|
1232
1202
|
"onUpdate:modelValue": (l) => {
|
|
1233
1203
|
o.isFunction(t.field) ? D(e, t.field(), l) : e[t.field] = l;
|
|
@@ -1239,7 +1209,7 @@ const yr = {
|
|
|
1239
1209
|
},
|
|
1240
1210
|
validateForm(r) {
|
|
1241
1211
|
return new Promise((e, t) => {
|
|
1242
|
-
r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(
|
|
1212
|
+
r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))));
|
|
1243
1213
|
});
|
|
1244
1214
|
},
|
|
1245
1215
|
clearValidate(r) {
|
|
@@ -1295,7 +1265,7 @@ const yr = {
|
|
|
1295
1265
|
props: n
|
|
1296
1266
|
}) {
|
|
1297
1267
|
let a;
|
|
1298
|
-
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field],
|
|
1268
|
+
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field], m(r, N({
|
|
1299
1269
|
modelValue: a,
|
|
1300
1270
|
"onUpdate:modelValue": (l) => {
|
|
1301
1271
|
o.isFunction(t.field) ? D(e, t.field(), l) : e[t.field] = l;
|
|
@@ -1311,7 +1281,7 @@ const yr = {
|
|
|
1311
1281
|
valid: i,
|
|
1312
1282
|
errors: s
|
|
1313
1283
|
}) => {
|
|
1314
|
-
i ? e(r.cleanFallbackFields(
|
|
1284
|
+
i ? e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))) : t(s);
|
|
1315
1285
|
});
|
|
1316
1286
|
});
|
|
1317
1287
|
},
|
|
@@ -1370,7 +1340,7 @@ const yr = {
|
|
|
1370
1340
|
props: n
|
|
1371
1341
|
}) {
|
|
1372
1342
|
let a;
|
|
1373
|
-
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field],
|
|
1343
|
+
return o.isFunction(t.field) ? a = L(e, t.field()) : a = e[t.field], m(r, N({
|
|
1374
1344
|
value: a,
|
|
1375
1345
|
"onUpdate:value": (l) => {
|
|
1376
1346
|
o.isFunction(t.field) ? D(e, t.field(), l) : e[t.field] = l;
|
|
@@ -1382,7 +1352,7 @@ const yr = {
|
|
|
1382
1352
|
},
|
|
1383
1353
|
validateForm(r) {
|
|
1384
1354
|
return new Promise((e, t) => {
|
|
1385
|
-
r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(
|
|
1355
|
+
r.runtimeCore.formRef.value.validate((i) => i ? t(i) : e(r.cleanFallbackFields(x(r.runtimeCore.processor.processedModel.value))));
|
|
1386
1356
|
});
|
|
1387
1357
|
},
|
|
1388
1358
|
clearValidate(r) {
|
|
@@ -1390,7 +1360,7 @@ const yr = {
|
|
|
1390
1360
|
(t = (e = r.formRef.value) == null ? void 0 : e.restoreValidation) == null || t.call(e);
|
|
1391
1361
|
}
|
|
1392
1362
|
}
|
|
1393
|
-
},
|
|
1363
|
+
}, M = class M {
|
|
1394
1364
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
1395
1365
|
const e = {
|
|
1396
1366
|
请选择: ["select", "tree"],
|
|
@@ -1403,7 +1373,7 @@ const yr = {
|
|
|
1403
1373
|
return t;
|
|
1404
1374
|
}
|
|
1405
1375
|
};
|
|
1406
|
-
u(
|
|
1376
|
+
u(M, "schemaPreset", {
|
|
1407
1377
|
type: {
|
|
1408
1378
|
defaultValue: "item"
|
|
1409
1379
|
},
|
|
@@ -1449,13 +1419,13 @@ u(E, "schemaPreset", {
|
|
|
1449
1419
|
runtime: {
|
|
1450
1420
|
default: void 0
|
|
1451
1421
|
}
|
|
1452
|
-
}), u(
|
|
1422
|
+
}), u(M, "componentPropsPreset", {
|
|
1453
1423
|
options: {
|
|
1454
1424
|
defaultValue: []
|
|
1455
1425
|
}
|
|
1456
1426
|
}), // 基于基本功能提出基本预设
|
|
1457
|
-
u(
|
|
1458
|
-
let J =
|
|
1427
|
+
u(M, "placeholderPresetByComponentName", M.getPlaceholderPrefixPresetByComponentName());
|
|
1428
|
+
let J = M;
|
|
1459
1429
|
const C = {
|
|
1460
1430
|
...J,
|
|
1461
1431
|
adapters: {
|