@harbor-design/proform 1.2.30 → 1.3.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 +504 -469
- package/dist/types/src/services/Effect/index.d.ts +1 -0
- package/dist/types/src/services/Processor/index.d.ts +2 -2
- package/dist/types/src/types/effectTypes.d.ts +1 -0
- package/dist/types/src/types/formCustomizerTypes.d.ts +4 -2
- 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,22 +563,22 @@ 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
|
-
this.runtimeCore = e, this.processedSchemas = e.schemas, this.processedModel = e.model, this.getRuntimeMeta = e.getRuntimeMeta.bind(e),
|
|
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), _(
|
|
581
582
|
() => this.processedModel.value,
|
|
582
583
|
() => {
|
|
583
584
|
this.schemaEffect.triggerEffects();
|
|
@@ -589,38 +590,38 @@ class mr {
|
|
|
589
590
|
}
|
|
590
591
|
// 核心处理过程,接收一个初始的代理数据结构,由其衍生的有 parseSchema
|
|
591
592
|
parse(e, r) {
|
|
592
|
-
e.forEach((
|
|
593
|
-
this.parseItem(
|
|
593
|
+
e.forEach((i, s) => {
|
|
594
|
+
this.parseItem(i, s, r);
|
|
594
595
|
});
|
|
595
596
|
}
|
|
596
597
|
// 初始化空数据结构,避免后续复杂的 if else
|
|
597
598
|
initSchemas(e) {
|
|
598
599
|
return e.map((r) => {
|
|
599
|
-
const
|
|
600
|
-
return r.children && (
|
|
600
|
+
const i = {};
|
|
601
|
+
return r.children && (i.children = this.initSchemas(r.children)), i;
|
|
601
602
|
});
|
|
602
603
|
}
|
|
603
604
|
countFunctionDefaultValues(e) {
|
|
604
605
|
let r = 0;
|
|
605
|
-
const
|
|
606
|
-
function
|
|
607
|
-
if (!
|
|
608
|
-
|
|
609
|
-
for (const
|
|
610
|
-
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]));
|
|
611
612
|
}
|
|
612
613
|
}
|
|
613
|
-
return
|
|
614
|
+
return s(e), r;
|
|
614
615
|
}
|
|
615
616
|
// 派生过程,用于外部应用
|
|
616
617
|
parseSchemas(e, r) {
|
|
617
|
-
|
|
618
|
-
|
|
618
|
+
o.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
619
|
+
C(e)
|
|
619
620
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, r);
|
|
620
621
|
}
|
|
621
622
|
parseStable(e) {
|
|
622
623
|
const r = {};
|
|
623
|
-
if (!
|
|
624
|
+
if (!o.isUndefined(e.stable))
|
|
624
625
|
r[e.key] = this.parseStable(e.stable);
|
|
625
626
|
else
|
|
626
627
|
return e;
|
|
@@ -629,88 +630,110 @@ class mr {
|
|
|
629
630
|
// 对于稳定初始化更新的抽象
|
|
630
631
|
stableUpdater(e = []) {
|
|
631
632
|
if (e.every(Boolean)) {
|
|
632
|
-
const r =
|
|
633
|
-
!
|
|
633
|
+
const r = E(this.processedSchemas.value);
|
|
634
|
+
!o.isProcessInprogress(r) && o.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
634
635
|
length: r.length
|
|
635
636
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(r));
|
|
636
637
|
}
|
|
637
638
|
}
|
|
638
639
|
// 核心单 schema 处理过程,接收一个对象键值对的数据结构
|
|
639
|
-
parseItem(e, r,
|
|
640
|
-
const
|
|
640
|
+
parseItem(e, r, i) {
|
|
641
|
+
const s = this, n = Array.from({
|
|
641
642
|
length: Object.keys(e).filter((l) => l !== "children").length
|
|
642
643
|
}).fill(!1);
|
|
643
|
-
this.objectParser({ data: e, index: r, updater:
|
|
644
|
-
function
|
|
645
|
-
const
|
|
646
|
-
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))
|
|
647
648
|
return;
|
|
648
|
-
const
|
|
649
|
-
let
|
|
650
|
-
if (
|
|
651
|
-
const g =
|
|
652
|
-
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);
|
|
653
654
|
} else {
|
|
654
|
-
const g =
|
|
655
|
-
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);
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
659
|
}
|
|
659
660
|
// 只做基本的对象 parser
|
|
660
661
|
objectParser(e) {
|
|
661
662
|
const r = e.data;
|
|
662
|
-
Object.keys(r).forEach((
|
|
663
|
-
|
|
664
|
-
|
|
663
|
+
Object.keys(r).forEach((s, n) => {
|
|
664
|
+
var a, l;
|
|
665
|
+
if (s === "children")
|
|
666
|
+
this.parseSchemas(r[s], {
|
|
665
667
|
...e,
|
|
666
|
-
key:
|
|
668
|
+
key: s,
|
|
667
669
|
keyIndex: n
|
|
668
670
|
});
|
|
669
671
|
else {
|
|
670
|
-
const
|
|
672
|
+
const c = (d) => {
|
|
671
673
|
e.updater({
|
|
672
674
|
...e,
|
|
673
|
-
key:
|
|
675
|
+
key: s,
|
|
674
676
|
keyIndex: n,
|
|
675
|
-
stable:
|
|
677
|
+
stable: d
|
|
676
678
|
});
|
|
677
679
|
};
|
|
678
|
-
|
|
680
|
+
o.isFunction(r[s]) ? s !== "defaultValue" ? this.schemaEffect.trackEffect(
|
|
679
681
|
() => {
|
|
680
|
-
if (
|
|
681
|
-
const
|
|
682
|
-
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
|
+
});
|
|
683
688
|
} else
|
|
684
|
-
this.fieldParser(r[
|
|
689
|
+
this.fieldParser(r[s], c, {
|
|
690
|
+
rootIndex: e.index,
|
|
691
|
+
parentMeta: e.parentMeta
|
|
692
|
+
});
|
|
685
693
|
},
|
|
686
694
|
{
|
|
687
|
-
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}`
|
|
688
697
|
}
|
|
689
698
|
) : this.defaultValueEffect.trackEffect(
|
|
690
699
|
() => {
|
|
691
|
-
const
|
|
700
|
+
const d = this.schemaEffect.trackEffect(
|
|
692
701
|
() => {
|
|
693
|
-
/\{\s*model\s*\}/.test(r[
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
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
|
+
);
|
|
714
737
|
},
|
|
715
738
|
{
|
|
716
739
|
lazy: !1
|
|
@@ -720,167 +743,183 @@ class mr {
|
|
|
720
743
|
{
|
|
721
744
|
lazy: !1
|
|
722
745
|
}
|
|
723
|
-
) :
|
|
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
|
+
});
|
|
724
753
|
}
|
|
725
754
|
});
|
|
726
755
|
}
|
|
727
|
-
promiseFieldParser(e, r, s) {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
data:
|
|
731
|
-
updater: r
|
|
732
|
-
|
|
733
|
-
|
|
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({
|
|
734
765
|
data: e,
|
|
735
|
-
updater: r
|
|
766
|
+
updater: r,
|
|
767
|
+
index: s.rootIndex,
|
|
768
|
+
parentMeta: s.parentMeta
|
|
736
769
|
}) : r(e));
|
|
737
770
|
}
|
|
738
771
|
// 对任意对象中单个字段的 parse: 做基本处理
|
|
739
|
-
fieldParser(e, r, s = !0) {
|
|
740
|
-
if (
|
|
772
|
+
fieldParser(e, r, i, s = !0) {
|
|
773
|
+
if (o.isFunction(e))
|
|
741
774
|
if (e.name.startsWith("__proform_raw_"))
|
|
742
775
|
r(
|
|
743
|
-
(...
|
|
744
|
-
rawArgs:
|
|
776
|
+
(...n) => e({
|
|
777
|
+
rawArgs: n,
|
|
745
778
|
...this.getRuntimeMeta()
|
|
746
779
|
})
|
|
747
780
|
);
|
|
748
781
|
else if (e.name.startsWith("__proform_structured_path_parsing_mark_"))
|
|
749
782
|
r(e);
|
|
750
783
|
else if (e.__proform_cached_result) {
|
|
751
|
-
const
|
|
752
|
-
this.promiseFieldParser(
|
|
784
|
+
const n = e.__proform_cached_result;
|
|
785
|
+
this.promiseFieldParser(n, r, s, i);
|
|
753
786
|
} else {
|
|
754
|
-
const
|
|
755
|
-
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);
|
|
756
789
|
}
|
|
757
790
|
else
|
|
758
|
-
q(e) ?
|
|
791
|
+
q(e) ? _(
|
|
759
792
|
() => e.value,
|
|
760
793
|
() => {
|
|
761
|
-
|
|
794
|
+
o.isUndefined(e.value) || (s && o.isObject(e.value) && !o.isNativeObject(e.value) ? this.objectParser({
|
|
762
795
|
data: e.value,
|
|
763
|
-
updater: r
|
|
796
|
+
updater: r,
|
|
797
|
+
index: i.rootIndex,
|
|
798
|
+
parentMeta: i.parentMeta
|
|
764
799
|
}) : r(e.value));
|
|
765
800
|
},
|
|
766
801
|
{
|
|
767
802
|
immediate: !0,
|
|
768
803
|
deep: !0
|
|
769
804
|
}
|
|
770
|
-
) :
|
|
805
|
+
) : U(e) ? _(
|
|
771
806
|
() => e,
|
|
772
807
|
() => {
|
|
773
|
-
|
|
808
|
+
o.isUndefined(e) || (s && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
774
809
|
data: e,
|
|
775
|
-
updater: r
|
|
810
|
+
updater: r,
|
|
811
|
+
index: i.rootIndex,
|
|
812
|
+
parentMeta: i.parentMeta
|
|
776
813
|
}) : r(e));
|
|
777
814
|
},
|
|
778
815
|
{
|
|
779
816
|
immediate: !0,
|
|
780
817
|
deep: !0
|
|
781
818
|
}
|
|
782
|
-
) : s &&
|
|
819
|
+
) : s && o.isObject(e) && !o.isNativeObject(e) ? this.objectParser({
|
|
783
820
|
data: e,
|
|
784
|
-
updater: r
|
|
821
|
+
updater: r,
|
|
822
|
+
index: i.rootIndex,
|
|
823
|
+
parentMeta: i.parentMeta
|
|
785
824
|
}) : r(e);
|
|
786
825
|
}
|
|
787
826
|
modelProcessor(e) {
|
|
788
827
|
e.map(
|
|
789
828
|
(r) => this.createModel(r, this.processedModel.value)
|
|
790
|
-
),
|
|
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());
|
|
791
830
|
}
|
|
792
|
-
setModel(e, r,
|
|
793
|
-
|
|
831
|
+
setModel(e, r, i) {
|
|
832
|
+
o.isFunction(r) ? D(e, r(), i) : e[r] = i;
|
|
794
833
|
}
|
|
795
834
|
createModel(e, r) {
|
|
796
|
-
if (
|
|
797
|
-
this.createModel(
|
|
798
|
-
})),
|
|
799
|
-
this.createModel(
|
|
800
|
-
}),
|
|
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))
|
|
801
840
|
if ("defaultValue" in e)
|
|
802
841
|
this.setModel(r, e.field, e.defaultValue);
|
|
803
842
|
else {
|
|
804
|
-
if (
|
|
843
|
+
if (o.isFunction(e.field) && L(r, e.field()))
|
|
805
844
|
return;
|
|
806
|
-
if (
|
|
845
|
+
if (o.isString(e.field) && r[e.field])
|
|
807
846
|
return;
|
|
808
847
|
this.setModel(r, e.field, void 0);
|
|
809
848
|
}
|
|
810
849
|
}
|
|
811
850
|
}
|
|
812
|
-
class
|
|
851
|
+
class w {
|
|
813
852
|
static getFormContainer({ ui: e } = {}) {
|
|
814
|
-
return
|
|
853
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Form;
|
|
815
854
|
}
|
|
816
855
|
static getFormItemContainer({ ui: e } = {}) {
|
|
817
|
-
return
|
|
856
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.FormItem;
|
|
818
857
|
}
|
|
819
858
|
static getItemContainer({ ui: e } = {}) {
|
|
820
|
-
return
|
|
859
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Item;
|
|
821
860
|
}
|
|
822
861
|
static getGroupContainer({ ui: e } = {}) {
|
|
823
|
-
return
|
|
862
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.Group;
|
|
824
863
|
}
|
|
825
864
|
static getListContainer({ ui: e } = {}) {
|
|
826
|
-
return
|
|
865
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.List;
|
|
827
866
|
}
|
|
828
867
|
static getListItemContainer({ ui: e } = {}) {
|
|
829
|
-
return
|
|
868
|
+
return f.presets.uiPresets[e ?? f.presets.ui].container.ListItem;
|
|
830
869
|
}
|
|
831
870
|
}
|
|
832
|
-
class
|
|
871
|
+
class yr {
|
|
833
872
|
constructor(e) {
|
|
834
873
|
this.ui = e;
|
|
835
874
|
}
|
|
836
875
|
getRuntimeNative() {
|
|
837
876
|
var r;
|
|
838
|
-
return (r =
|
|
877
|
+
return (r = f.presets.uiPresets[this.ui]) == null ? void 0 : r.native;
|
|
839
878
|
}
|
|
840
879
|
getRuntimeField(e) {
|
|
841
|
-
var
|
|
842
|
-
const r = (
|
|
843
|
-
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));
|
|
844
883
|
}
|
|
845
884
|
getRuntimeRequired(e) {
|
|
846
|
-
var
|
|
847
|
-
const r = (
|
|
848
|
-
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));
|
|
849
888
|
}
|
|
850
889
|
getFormModelPropName() {
|
|
851
|
-
var
|
|
852
|
-
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)];
|
|
853
892
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (r == null ? void 0 : r.getFormModelPropName());
|
|
854
893
|
}
|
|
855
894
|
formComponentRenderer(e) {
|
|
856
|
-
var
|
|
857
|
-
const r = (
|
|
858
|
-
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));
|
|
859
898
|
}
|
|
860
899
|
clearValidate(e) {
|
|
861
|
-
var
|
|
862
|
-
const r = (
|
|
863
|
-
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));
|
|
864
903
|
}
|
|
865
904
|
}
|
|
866
|
-
function
|
|
867
|
-
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);
|
|
868
907
|
}
|
|
869
908
|
class br {
|
|
870
909
|
constructor(e) {
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
910
|
+
u(this, "schemas", z([]));
|
|
911
|
+
u(this, "model", z({}));
|
|
912
|
+
u(this, "processorBySchemaType", {
|
|
874
913
|
item: this.runtimeItemProcessor.bind(this),
|
|
875
914
|
group: this.runtimeGroupProcessor.bind(this),
|
|
876
915
|
list: this.runtimeListProcessor.bind(this)
|
|
877
916
|
});
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
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({
|
|
884
923
|
props: {
|
|
885
924
|
Form: {},
|
|
886
925
|
FormItem: {}
|
|
@@ -890,11 +929,11 @@ class br {
|
|
|
890
929
|
FormItem: {}
|
|
891
930
|
}
|
|
892
931
|
}));
|
|
893
|
-
|
|
932
|
+
u(this, "shared", {});
|
|
894
933
|
this.setup = e, this.processor = new mr(this);
|
|
895
934
|
const r = this.setup(this);
|
|
896
|
-
if (this.ui = r.ui ??
|
|
897
|
-
|
|
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
|
+
_(
|
|
898
937
|
// @ts-expect-error
|
|
899
938
|
() => r.schemas.value,
|
|
900
939
|
() => {
|
|
@@ -904,10 +943,10 @@ class br {
|
|
|
904
943
|
deep: !0
|
|
905
944
|
}
|
|
906
945
|
);
|
|
907
|
-
else if (
|
|
908
|
-
const
|
|
909
|
-
this.processor.parseSchemas(r.schemas),
|
|
910
|
-
|
|
946
|
+
else if (U(r.schemas)) {
|
|
947
|
+
const i = _(() => r.schemas, () => {
|
|
948
|
+
this.processor.parseSchemas(r.schemas), P(() => {
|
|
949
|
+
i();
|
|
911
950
|
});
|
|
912
951
|
}, {
|
|
913
952
|
deep: !0
|
|
@@ -916,116 +955,112 @@ class br {
|
|
|
916
955
|
this.processor.parseSchemas(r.schemas);
|
|
917
956
|
}
|
|
918
957
|
getRuntimeMeta() {
|
|
919
|
-
const e = R(_(this.model.value));
|
|
920
|
-
let r;
|
|
921
958
|
return {
|
|
922
|
-
model:
|
|
959
|
+
model: E(C(this.model.value)),
|
|
923
960
|
reactiveModel: this.model.value,
|
|
924
961
|
shared: this.shared,
|
|
925
962
|
// share 增加防抖,当开发者在过程中进行 share 时避免频繁触发爆栈
|
|
926
|
-
share: (
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
i();
|
|
932
|
-
});
|
|
933
|
-
}, {
|
|
934
|
-
deep: !0,
|
|
935
|
-
immediate: !0
|
|
963
|
+
share: (r) => {
|
|
964
|
+
if (q(r)) {
|
|
965
|
+
const i = _(() => r.value, () => {
|
|
966
|
+
h(this.shared, r.value), P(() => {
|
|
967
|
+
i();
|
|
936
968
|
});
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
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();
|
|
945
977
|
});
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
|
|
978
|
+
}, {
|
|
979
|
+
deep: !0,
|
|
980
|
+
immediate: !0
|
|
981
|
+
});
|
|
982
|
+
} else
|
|
983
|
+
h(this.shared, r);
|
|
949
984
|
}
|
|
950
985
|
};
|
|
951
986
|
}
|
|
952
|
-
runtimeItemProcessor(e, r,
|
|
953
|
-
var re,
|
|
954
|
-
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);
|
|
955
990
|
if (!n)
|
|
956
991
|
return;
|
|
957
|
-
(
|
|
958
|
-
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 = {
|
|
959
994
|
display: "grid",
|
|
960
995
|
gridColumn: "1 / -1",
|
|
961
996
|
...e.grid
|
|
962
|
-
},
|
|
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({
|
|
963
998
|
schema: e,
|
|
964
|
-
parentSchema:
|
|
999
|
+
parentSchema: s,
|
|
965
1000
|
index: r
|
|
966
|
-
}), p = n.name,
|
|
967
|
-
let
|
|
968
|
-
|
|
969
|
-
let g = e.label ?? "",
|
|
970
|
-
if (e.runtime ?
|
|
971
|
-
let
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
p.toLowerCase().includes(ve.toLowerCase()) && (
|
|
975
|
-
}),
|
|
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}`);
|
|
976
1011
|
}
|
|
977
|
-
const
|
|
1012
|
+
const $e = this.runtimeAdapter.getRuntimeRequired({
|
|
978
1013
|
...e,
|
|
979
1014
|
label: g
|
|
980
|
-
}),
|
|
981
|
-
return
|
|
1015
|
+
}), Ve = w.getItemContainer(this), Ne = w.getFormItemContainer(this), qe = this, Ue = e.componentSlots;
|
|
1016
|
+
return y("div", {
|
|
982
1017
|
style: l
|
|
983
|
-
}, [
|
|
984
|
-
show:
|
|
1018
|
+
}, [y(Ve, {
|
|
1019
|
+
show: v
|
|
985
1020
|
}, {
|
|
986
1021
|
default() {
|
|
987
|
-
return
|
|
1022
|
+
return v && y(Ne, N(c, {
|
|
988
1023
|
label: `${g ? `${g}:` : ""}`
|
|
989
|
-
},
|
|
1024
|
+
}, d, $e), {
|
|
990
1025
|
default() {
|
|
991
1026
|
return qe.runtimeAdapter.formComponentRenderer({
|
|
992
1027
|
Component: n,
|
|
993
1028
|
schema: e,
|
|
994
|
-
baseModel:
|
|
995
|
-
placeholder:
|
|
996
|
-
componentSlots:
|
|
997
|
-
props:
|
|
1029
|
+
baseModel: i,
|
|
1030
|
+
placeholder: S,
|
|
1031
|
+
componentSlots: Ue,
|
|
1032
|
+
props: m
|
|
998
1033
|
});
|
|
999
1034
|
},
|
|
1000
|
-
...
|
|
1035
|
+
...a
|
|
1001
1036
|
});
|
|
1002
1037
|
}
|
|
1003
1038
|
})]);
|
|
1004
1039
|
}
|
|
1005
1040
|
runtimeGroupProcessor(e) {
|
|
1006
1041
|
let r;
|
|
1007
|
-
const
|
|
1042
|
+
const i = {
|
|
1008
1043
|
display: "grid",
|
|
1009
1044
|
gridColumn: "1 / -1",
|
|
1010
1045
|
...e.grid
|
|
1011
|
-
},
|
|
1046
|
+
}, s = w.getGroupContainer(this);
|
|
1012
1047
|
let n = e.show;
|
|
1013
|
-
return n === void 0 && (n = !0),
|
|
1014
|
-
style:
|
|
1015
|
-
}, [n &&
|
|
1048
|
+
return n === void 0 && (n = !0), y("div", {
|
|
1049
|
+
style: i
|
|
1050
|
+
}, [n && y(s, {
|
|
1016
1051
|
schema: e
|
|
1017
|
-
},
|
|
1052
|
+
}, gr(r = e.children.map((a) => this.runtimeItemProcessor(a))) ? r : {
|
|
1018
1053
|
default: () => [r]
|
|
1019
1054
|
})]);
|
|
1020
1055
|
}
|
|
1021
1056
|
addListItem(e) {
|
|
1022
|
-
var r,
|
|
1057
|
+
var r, i;
|
|
1023
1058
|
if (!((r = this.processor.stableModel[e.field]) != null && r[0]))
|
|
1024
1059
|
return Promise.reject({
|
|
1025
1060
|
code: "0001",
|
|
1026
1061
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
1027
1062
|
});
|
|
1028
|
-
(
|
|
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);
|
|
1029
1064
|
}
|
|
1030
1065
|
deleteListItem(e, r) {
|
|
1031
1066
|
this.model.value[e.field].splice(r, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -1035,38 +1070,38 @@ class br {
|
|
|
1035
1070
|
display: "grid",
|
|
1036
1071
|
gridColumn: "1 / -1",
|
|
1037
1072
|
...e.grid
|
|
1038
|
-
},
|
|
1039
|
-
|
|
1040
|
-
let
|
|
1041
|
-
|
|
1042
|
-
const n =
|
|
1043
|
-
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", {
|
|
1044
1079
|
style: r
|
|
1045
|
-
}, [
|
|
1080
|
+
}, [s && y(n, {
|
|
1046
1081
|
schema: e
|
|
1047
1082
|
}, {
|
|
1048
1083
|
default() {
|
|
1049
|
-
return
|
|
1084
|
+
return i.model.value[e.field].map((l, c) => y(a, null, {
|
|
1050
1085
|
default() {
|
|
1051
|
-
return e.children.map((
|
|
1086
|
+
return e.children.map((d) => i.runtimeItemProcessor(d, c, l, e));
|
|
1052
1087
|
},
|
|
1053
1088
|
delete({
|
|
1054
|
-
container:
|
|
1089
|
+
container: d
|
|
1055
1090
|
} = {}) {
|
|
1056
|
-
var
|
|
1057
|
-
const p =
|
|
1058
|
-
return Le(
|
|
1059
|
-
onClick: () =>
|
|
1060
|
-
}, 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]]);
|
|
1061
1096
|
}
|
|
1062
1097
|
}));
|
|
1063
1098
|
},
|
|
1064
1099
|
add({
|
|
1065
1100
|
container: l
|
|
1066
1101
|
} = {}) {
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1069
|
-
onClick: () =>
|
|
1102
|
+
const c = l ?? y("button", null, [Ge("添加")]);
|
|
1103
|
+
return y(c, {
|
|
1104
|
+
onClick: () => i.addListItem(e)
|
|
1070
1105
|
}, null);
|
|
1071
1106
|
}
|
|
1072
1107
|
})]);
|
|
@@ -1075,38 +1110,38 @@ class br {
|
|
|
1075
1110
|
return e.map((r) => (r.type || (r.type = "item"), this.processorBySchemaType[r.type](r)));
|
|
1076
1111
|
}
|
|
1077
1112
|
exec() {
|
|
1078
|
-
var l,
|
|
1113
|
+
var l, c, d, p;
|
|
1079
1114
|
const e = {
|
|
1080
1115
|
display: "grid",
|
|
1081
1116
|
gridColumn: "1 / -1",
|
|
1082
1117
|
gridAutoColumns: "1fr",
|
|
1083
1118
|
...this.grid
|
|
1084
|
-
}, r = this,
|
|
1085
|
-
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, {
|
|
1086
1121
|
ref: this.formRef
|
|
1087
1122
|
}, {
|
|
1088
|
-
[
|
|
1123
|
+
[a]: this.model.value
|
|
1089
1124
|
}), {
|
|
1090
1125
|
default() {
|
|
1091
|
-
return
|
|
1126
|
+
return y("div", {
|
|
1092
1127
|
style: e
|
|
1093
1128
|
}, [r.runtimeProcessor(r.schemas.value)]);
|
|
1094
1129
|
},
|
|
1095
|
-
...
|
|
1130
|
+
...s
|
|
1096
1131
|
});
|
|
1097
1132
|
}
|
|
1098
1133
|
}
|
|
1099
|
-
class
|
|
1134
|
+
class f {
|
|
1100
1135
|
static getPreset(e) {
|
|
1101
|
-
var r,
|
|
1102
|
-
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];
|
|
1103
1138
|
}
|
|
1104
1139
|
static getUI(e) {
|
|
1105
|
-
var r,
|
|
1106
|
-
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;
|
|
1107
1142
|
}
|
|
1108
1143
|
}
|
|
1109
|
-
|
|
1144
|
+
u(f, "presets");
|
|
1110
1145
|
function W({
|
|
1111
1146
|
parentSchema: t,
|
|
1112
1147
|
schema: e,
|
|
@@ -1118,7 +1153,7 @@ const vr = {
|
|
|
1118
1153
|
ArcoVue: {
|
|
1119
1154
|
getRuntimeField(t) {
|
|
1120
1155
|
const e = W(t);
|
|
1121
|
-
return
|
|
1156
|
+
return o.isFunction(e) ? {
|
|
1122
1157
|
field: e()
|
|
1123
1158
|
} : {
|
|
1124
1159
|
field: e
|
|
@@ -1133,14 +1168,14 @@ const vr = {
|
|
|
1133
1168
|
message: `${t.label}是必填项`
|
|
1134
1169
|
});
|
|
1135
1170
|
else {
|
|
1136
|
-
const r = t.rules.findIndex((
|
|
1171
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1137
1172
|
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1138
1173
|
required: !0,
|
|
1139
1174
|
message: `${t.label}是必填项`
|
|
1140
1175
|
});
|
|
1141
1176
|
}
|
|
1142
1177
|
else if (t.rules) {
|
|
1143
|
-
const r = (e = t.rules) == null ? void 0 : e.findIndex((
|
|
1178
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1144
1179
|
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1145
1180
|
required: !0,
|
|
1146
1181
|
message: `${t.label}是必填项`
|
|
@@ -1157,24 +1192,24 @@ const vr = {
|
|
|
1157
1192
|
Component: t,
|
|
1158
1193
|
baseModel: e,
|
|
1159
1194
|
schema: r,
|
|
1160
|
-
placeholder:
|
|
1161
|
-
componentSlots:
|
|
1195
|
+
placeholder: i,
|
|
1196
|
+
componentSlots: s,
|
|
1162
1197
|
props: n
|
|
1163
1198
|
}) {
|
|
1164
|
-
let
|
|
1165
|
-
return
|
|
1166
|
-
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,
|
|
1167
1202
|
"onUpdate:modelValue": (l) => {
|
|
1168
|
-
|
|
1203
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1169
1204
|
},
|
|
1170
|
-
placeholder:
|
|
1205
|
+
placeholder: i
|
|
1171
1206
|
}, n), {
|
|
1172
|
-
...
|
|
1207
|
+
...s
|
|
1173
1208
|
});
|
|
1174
1209
|
},
|
|
1175
1210
|
validateForm(t) {
|
|
1176
1211
|
return new Promise((e, r) => {
|
|
1177
|
-
t.runtimeCore.formRef.value.validate((
|
|
1212
|
+
t.runtimeCore.formRef.value.validate((i) => i ? r(i) : e(t.cleanFallbackFields(E(t.runtimeCore.processor.processedModel.value))));
|
|
1178
1213
|
});
|
|
1179
1214
|
},
|
|
1180
1215
|
clearValidate(t) {
|
|
@@ -1185,7 +1220,7 @@ const vr = {
|
|
|
1185
1220
|
NutUI: {
|
|
1186
1221
|
getRuntimeField(t) {
|
|
1187
1222
|
const e = W(t);
|
|
1188
|
-
return
|
|
1223
|
+
return o.isFunction(e) ? {
|
|
1189
1224
|
prop: e()
|
|
1190
1225
|
} : {
|
|
1191
1226
|
prop: e
|
|
@@ -1200,14 +1235,14 @@ const vr = {
|
|
|
1200
1235
|
message: `${t.label}是必填项`
|
|
1201
1236
|
});
|
|
1202
1237
|
else {
|
|
1203
|
-
const r = t.rules.findIndex((
|
|
1238
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1204
1239
|
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1205
1240
|
required: !0,
|
|
1206
1241
|
message: `${t.label}是必填项`
|
|
1207
1242
|
});
|
|
1208
1243
|
}
|
|
1209
1244
|
else if (t.rules) {
|
|
1210
|
-
const r = (e = t.rules) == null ? void 0 : e.findIndex((
|
|
1245
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1211
1246
|
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1212
1247
|
required: !0,
|
|
1213
1248
|
message: `${t.label}是必填项`
|
|
@@ -1225,28 +1260,28 @@ const vr = {
|
|
|
1225
1260
|
Component: t,
|
|
1226
1261
|
baseModel: e,
|
|
1227
1262
|
schema: r,
|
|
1228
|
-
placeholder:
|
|
1229
|
-
componentSlots:
|
|
1263
|
+
placeholder: i,
|
|
1264
|
+
componentSlots: s,
|
|
1230
1265
|
props: n
|
|
1231
1266
|
}) {
|
|
1232
|
-
let
|
|
1233
|
-
return
|
|
1234
|
-
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,
|
|
1235
1270
|
"onUpdate:modelValue": (l) => {
|
|
1236
|
-
|
|
1271
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1237
1272
|
},
|
|
1238
|
-
placeholder:
|
|
1273
|
+
placeholder: i
|
|
1239
1274
|
}, n), {
|
|
1240
|
-
...
|
|
1275
|
+
...s
|
|
1241
1276
|
});
|
|
1242
1277
|
},
|
|
1243
1278
|
validateForm(t) {
|
|
1244
1279
|
return new Promise((e, r) => {
|
|
1245
1280
|
t.runtimeCore.formRef.value.validate().then(({
|
|
1246
|
-
valid:
|
|
1247
|
-
errors:
|
|
1281
|
+
valid: i,
|
|
1282
|
+
errors: s
|
|
1248
1283
|
}) => {
|
|
1249
|
-
|
|
1284
|
+
i ? e(t.cleanFallbackFields(E(t.runtimeCore.processor.processedModel.value))) : r(s);
|
|
1250
1285
|
});
|
|
1251
1286
|
});
|
|
1252
1287
|
},
|
|
@@ -1258,7 +1293,7 @@ const vr = {
|
|
|
1258
1293
|
NaiveUI: {
|
|
1259
1294
|
getRuntimeField(t) {
|
|
1260
1295
|
const e = W(t);
|
|
1261
|
-
return
|
|
1296
|
+
return o.isFunction(e) ? {
|
|
1262
1297
|
path: e()
|
|
1263
1298
|
} : {
|
|
1264
1299
|
path: e
|
|
@@ -1274,7 +1309,7 @@ const vr = {
|
|
|
1274
1309
|
trigger: ["input", "blur"]
|
|
1275
1310
|
});
|
|
1276
1311
|
else {
|
|
1277
|
-
const r = t.rules.findIndex((
|
|
1312
|
+
const r = t.rules.findIndex((i) => !o.isUndefined(i.required));
|
|
1278
1313
|
r !== -1 ? (t.rules[r].required = !0, t.rules[r].message = `${t.label}是必填项`) : t.rules.unshift({
|
|
1279
1314
|
required: !0,
|
|
1280
1315
|
message: `${t.label}是必填项`,
|
|
@@ -1282,7 +1317,7 @@ const vr = {
|
|
|
1282
1317
|
});
|
|
1283
1318
|
}
|
|
1284
1319
|
else if (t.rules) {
|
|
1285
|
-
const r = (e = t.rules) == null ? void 0 : e.findIndex((
|
|
1320
|
+
const r = (e = t.rules) == null ? void 0 : e.findIndex((i) => !!i.required);
|
|
1286
1321
|
r !== -1 ? t.rules[r].required = !1 : t.rules.unshift({
|
|
1287
1322
|
required: !0,
|
|
1288
1323
|
message: `${t.label}是必填项`,
|
|
@@ -1300,24 +1335,24 @@ const vr = {
|
|
|
1300
1335
|
Component: t,
|
|
1301
1336
|
baseModel: e,
|
|
1302
1337
|
schema: r,
|
|
1303
|
-
placeholder:
|
|
1304
|
-
componentSlots:
|
|
1338
|
+
placeholder: i,
|
|
1339
|
+
componentSlots: s,
|
|
1305
1340
|
props: n
|
|
1306
1341
|
}) {
|
|
1307
|
-
let
|
|
1308
|
-
return
|
|
1309
|
-
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,
|
|
1310
1345
|
"onUpdate:value": (l) => {
|
|
1311
|
-
|
|
1346
|
+
o.isFunction(r.field) ? D(e, r.field(), l) : e[r.field] = l;
|
|
1312
1347
|
},
|
|
1313
|
-
placeholder:
|
|
1348
|
+
placeholder: i
|
|
1314
1349
|
}, n), {
|
|
1315
|
-
...
|
|
1350
|
+
...s
|
|
1316
1351
|
});
|
|
1317
1352
|
},
|
|
1318
1353
|
validateForm(t) {
|
|
1319
1354
|
return new Promise((e, r) => {
|
|
1320
|
-
t.runtimeCore.formRef.value.validate((
|
|
1355
|
+
t.runtimeCore.formRef.value.validate((i) => i ? r(i) : e(t.cleanFallbackFields(E(t.runtimeCore.processor.processedModel.value))));
|
|
1321
1356
|
});
|
|
1322
1357
|
},
|
|
1323
1358
|
clearValidate(t) {
|
|
@@ -1325,20 +1360,20 @@ const vr = {
|
|
|
1325
1360
|
(r = (e = t.formRef.value) == null ? void 0 : e.restoreValidation) == null || r.call(e);
|
|
1326
1361
|
}
|
|
1327
1362
|
}
|
|
1328
|
-
},
|
|
1363
|
+
}, M = class M {
|
|
1329
1364
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
1330
1365
|
const e = {
|
|
1331
1366
|
请选择: ["select", "tree"],
|
|
1332
1367
|
请输入: ["input"]
|
|
1333
1368
|
}, r = {};
|
|
1334
|
-
for (const
|
|
1335
|
-
e[
|
|
1336
|
-
r[
|
|
1369
|
+
for (const i in e)
|
|
1370
|
+
e[i].forEach((s) => {
|
|
1371
|
+
r[s] = i;
|
|
1337
1372
|
});
|
|
1338
1373
|
return r;
|
|
1339
1374
|
}
|
|
1340
1375
|
};
|
|
1341
|
-
|
|
1376
|
+
u(M, "schemaPreset", {
|
|
1342
1377
|
type: {
|
|
1343
1378
|
defaultValue: "item"
|
|
1344
1379
|
},
|
|
@@ -1384,19 +1419,19 @@ c(w, "schemaPreset", {
|
|
|
1384
1419
|
runtime: {
|
|
1385
1420
|
default: void 0
|
|
1386
1421
|
}
|
|
1387
|
-
}),
|
|
1422
|
+
}), u(M, "componentPropsPreset", {
|
|
1388
1423
|
options: {
|
|
1389
1424
|
defaultValue: []
|
|
1390
1425
|
}
|
|
1391
1426
|
}), // 基于基本功能提出基本预设
|
|
1392
|
-
|
|
1393
|
-
let Y =
|
|
1394
|
-
const
|
|
1427
|
+
u(M, "placeholderPresetByComponentName", M.getPlaceholderPrefixPresetByComponentName());
|
|
1428
|
+
let Y = M;
|
|
1429
|
+
const I = {
|
|
1395
1430
|
...Y,
|
|
1396
1431
|
adapters: {
|
|
1397
1432
|
...vr
|
|
1398
1433
|
}
|
|
1399
|
-
}, Cr = /* @__PURE__ */
|
|
1434
|
+
}, Cr = /* @__PURE__ */ ke({
|
|
1400
1435
|
props: {
|
|
1401
1436
|
setup: {
|
|
1402
1437
|
type: Function,
|
|
@@ -1422,7 +1457,7 @@ function Ir(t) {
|
|
|
1422
1457
|
];
|
|
1423
1458
|
}
|
|
1424
1459
|
function Sr(t) {
|
|
1425
|
-
|
|
1460
|
+
f.presets = t;
|
|
1426
1461
|
}
|
|
1427
1462
|
function te(t, e) {
|
|
1428
1463
|
return e === "native" && Object.defineProperty(t, "name", {
|
|
@@ -1442,10 +1477,10 @@ function Or(t) {
|
|
|
1442
1477
|
function Fr(t) {
|
|
1443
1478
|
return t.__proform_raw_object = !0, t;
|
|
1444
1479
|
}
|
|
1445
|
-
function
|
|
1480
|
+
function jr(t) {
|
|
1446
1481
|
return te(t, "onetime");
|
|
1447
1482
|
}
|
|
1448
|
-
function
|
|
1483
|
+
function wr(t) {
|
|
1449
1484
|
function e() {
|
|
1450
1485
|
return t;
|
|
1451
1486
|
}
|
|
@@ -1458,8 +1493,8 @@ export {
|
|
|
1458
1493
|
Cr as ProForm,
|
|
1459
1494
|
Or as markNativeFunction,
|
|
1460
1495
|
Fr as markNativeObject,
|
|
1461
|
-
|
|
1462
|
-
|
|
1496
|
+
jr as markOnetimeFunction,
|
|
1497
|
+
wr as markStructuredPathParsing,
|
|
1463
1498
|
Ir as useForm,
|
|
1464
1499
|
Sr as useFormPresetConfigurer,
|
|
1465
1500
|
te as useModifiers
|