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