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