@harbor-design/proform 1.2.26 → 1.2.28
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 +127 -117
- package/dist/types/index.d.ts +1 -1
- package/dist/types/src/interactions/useModifiers.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ue = Object.defineProperty;
|
|
2
2
|
var ze = (t, e, r) => e in t ? Ue(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var c = (t, e, r) => (ze(t, typeof e != "symbol" ? e + "" : e, r), r);
|
|
4
|
-
import { ref as z, readonly as
|
|
4
|
+
import { ref as z, readonly as _e, 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 ke, defineComponent as Be } from "vue";
|
|
5
5
|
class a {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -80,7 +80,7 @@ function h(t, ...e) {
|
|
|
80
80
|
r.hasOwnProperty(s) && (typeof r[s] == "object" && r[s] !== null ? t[s] = h(t[s] || {}, r[s]) : t[s] = r[s]);
|
|
81
81
|
}), t;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function _(t) {
|
|
84
84
|
const e = /* @__PURE__ */ new WeakMap();
|
|
85
85
|
function r(s) {
|
|
86
86
|
if (s === null || typeof s != "object")
|
|
@@ -118,7 +118,7 @@ function P(t) {
|
|
|
118
118
|
}
|
|
119
119
|
return r(t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function K(t, e) {
|
|
122
122
|
return t.replace(/undefined/g, e);
|
|
123
123
|
}
|
|
124
124
|
class He {
|
|
@@ -134,11 +134,11 @@ class He {
|
|
|
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 = _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
140
|
var s;
|
|
141
|
-
const e = (s = d.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, r =
|
|
141
|
+
const e = (s = d.getPreset(this.runtimeCore.ui)) == null ? void 0 : s.adapter, r = P.adapters[d.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) {
|
|
@@ -225,9 +225,9 @@ 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 = _(
|
|
229
229
|
this.runtimeCore.processor.stableModel
|
|
230
|
-
), this.readonlyReactiveModel.value =
|
|
230
|
+
), this.readonlyReactiveModel.value = _e(this.runtimeCore.model.value), this.runtimeCore.runtimeAdapter.clearValidate(this.runtimeCore));
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
class X {
|
|
@@ -246,7 +246,7 @@ class X {
|
|
|
246
246
|
return !r.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
var
|
|
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")(), V = Z.Symbol, Ee = Object.prototype, Xe = Ee.hasOwnProperty, Ye = Ee.toString, M = V ? V.toStringTag : void 0;
|
|
250
250
|
function Ze(t) {
|
|
251
251
|
var e = Xe.call(t, M), r = t[M];
|
|
252
252
|
try {
|
|
@@ -261,30 +261,30 @@ var Je = Object.prototype, Qe = Je.toString;
|
|
|
261
261
|
function Ae(t) {
|
|
262
262
|
return Qe.call(t);
|
|
263
263
|
}
|
|
264
|
-
var et = "[object Null]", tt = "[object Undefined]",
|
|
265
|
-
function
|
|
266
|
-
return t == null ? t === void 0 ? tt : et :
|
|
264
|
+
var et = "[object Null]", tt = "[object Undefined]", Ce = V ? V.toStringTag : void 0;
|
|
265
|
+
function je(t) {
|
|
266
|
+
return t == null ? t === void 0 ? tt : et : Ce && Ce in Object(t) ? Ze(t) : Ae(t);
|
|
267
267
|
}
|
|
268
268
|
function rt(t) {
|
|
269
269
|
return t != null && typeof t == "object";
|
|
270
270
|
}
|
|
271
271
|
var st = "[object Symbol]";
|
|
272
272
|
function J(t) {
|
|
273
|
-
return typeof t == "symbol" || rt(t) &&
|
|
273
|
+
return typeof t == "symbol" || rt(t) && je(t) == st;
|
|
274
274
|
}
|
|
275
275
|
function it(t, e) {
|
|
276
276
|
for (var r = -1, s = t == null ? 0 : t.length, i = Array(s); ++r < s; )
|
|
277
277
|
i[r] = e(t[r], r, t);
|
|
278
278
|
return i;
|
|
279
279
|
}
|
|
280
|
-
var Q = Array.isArray, nt = 1 / 0,
|
|
281
|
-
function
|
|
280
|
+
var Q = Array.isArray, nt = 1 / 0, Ie = V ? V.prototype : void 0, Se = Ie ? Ie.toString : void 0;
|
|
281
|
+
function we(t) {
|
|
282
282
|
if (typeof t == "string")
|
|
283
283
|
return t;
|
|
284
284
|
if (Q(t))
|
|
285
|
-
return it(t,
|
|
285
|
+
return it(t, we) + "";
|
|
286
286
|
if (J(t))
|
|
287
|
-
return
|
|
287
|
+
return Se ? Se.call(t) : "";
|
|
288
288
|
var e = t + "";
|
|
289
289
|
return e == "0" && 1 / t == -nt ? "-0" : e;
|
|
290
290
|
}
|
|
@@ -296,15 +296,15 @@ var ot = "[object AsyncFunction]", at = "[object Function]", lt = "[object Gener
|
|
|
296
296
|
function ct(t) {
|
|
297
297
|
if (!D(t))
|
|
298
298
|
return !1;
|
|
299
|
-
var e =
|
|
299
|
+
var e = je(t);
|
|
300
300
|
return e == at || e == lt || e == ot || e == ut;
|
|
301
301
|
}
|
|
302
|
-
var
|
|
303
|
-
var t = /[^.]+$/.exec(
|
|
302
|
+
var B = Z["__core-js_shared__"], Oe = function() {
|
|
303
|
+
var t = /[^.]+$/.exec(B && B.keys && B.keys.IE_PROTO || "");
|
|
304
304
|
return t ? "Symbol(src)_1." + t : "";
|
|
305
305
|
}();
|
|
306
306
|
function ft(t) {
|
|
307
|
-
return !!
|
|
307
|
+
return !!Oe && Oe in t;
|
|
308
308
|
}
|
|
309
309
|
var dt = Function.prototype, pt = dt.toString;
|
|
310
310
|
function ht(t) {
|
|
@@ -320,13 +320,13 @@ function ht(t) {
|
|
|
320
320
|
}
|
|
321
321
|
return "";
|
|
322
322
|
}
|
|
323
|
-
var mt = /[\\^$.*+?()[\]{}|]/g,
|
|
324
|
-
"^" + vt.call(
|
|
323
|
+
var mt = /[\\^$.*+?()[\]{}|]/g, yt = /^\[object .+?Constructor\]$/, gt = Function.prototype, bt = Object.prototype, vt = gt.toString, _t = bt.hasOwnProperty, Pt = RegExp(
|
|
324
|
+
"^" + vt.call(_t).replace(mt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
325
325
|
);
|
|
326
326
|
function Ct(t) {
|
|
327
327
|
if (!D(t) || ft(t))
|
|
328
328
|
return !1;
|
|
329
|
-
var e = ct(t) ?
|
|
329
|
+
var e = ct(t) ? Pt : yt;
|
|
330
330
|
return e.test(ht(t));
|
|
331
331
|
}
|
|
332
332
|
function It(t, e) {
|
|
@@ -336,7 +336,7 @@ function A(t, e) {
|
|
|
336
336
|
var r = It(t, e);
|
|
337
337
|
return Ct(r) ? r : void 0;
|
|
338
338
|
}
|
|
339
|
-
var
|
|
339
|
+
var Fe = function() {
|
|
340
340
|
try {
|
|
341
341
|
var t = A(Object, "defineProperty");
|
|
342
342
|
return t({}, "", {}), t;
|
|
@@ -348,27 +348,27 @@ function Ft(t, e) {
|
|
|
348
348
|
return e = e ?? St, !!e && (r == "number" || r != "symbol" && Ot.test(t)) && t > -1 && t % 1 == 0 && t < e;
|
|
349
349
|
}
|
|
350
350
|
function Et(t, e, r) {
|
|
351
|
-
e == "__proto__" &&
|
|
351
|
+
e == "__proto__" && Fe ? Fe(t, e, {
|
|
352
352
|
configurable: !0,
|
|
353
353
|
enumerable: !0,
|
|
354
354
|
value: r,
|
|
355
355
|
writable: !0
|
|
356
356
|
}) : t[e] = r;
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function Re(t, e) {
|
|
359
359
|
return t === e || t !== t && e !== e;
|
|
360
360
|
}
|
|
361
361
|
var jt = Object.prototype, wt = jt.hasOwnProperty;
|
|
362
362
|
function Rt(t, e, r) {
|
|
363
363
|
var s = t[e];
|
|
364
|
-
(!(wt.call(t, e) &&
|
|
364
|
+
(!(wt.call(t, e) && Re(s, r)) || r === void 0 && !(e in t)) && Et(t, e, r);
|
|
365
365
|
}
|
|
366
|
-
var Vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
367
|
-
function
|
|
366
|
+
var Vt = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, $t = /^\w*$/;
|
|
367
|
+
function Nt(t, e) {
|
|
368
368
|
if (Q(t))
|
|
369
369
|
return !1;
|
|
370
370
|
var r = typeof t;
|
|
371
|
-
return r == "number" || r == "symbol" || r == "boolean" || t == null || J(t) ? !0 :
|
|
371
|
+
return r == "number" || r == "symbol" || r == "boolean" || t == null || J(t) ? !0 : $t.test(t) || !Vt.test(t) || e != null && t in Object(e);
|
|
372
372
|
}
|
|
373
373
|
var U = A(Object, "create");
|
|
374
374
|
function Mt() {
|
|
@@ -392,10 +392,10 @@ function Gt(t) {
|
|
|
392
392
|
var e = this.__data__;
|
|
393
393
|
return U ? e[t] !== void 0 : Dt.call(e, t);
|
|
394
394
|
}
|
|
395
|
-
var
|
|
396
|
-
function
|
|
395
|
+
var kt = "__lodash_hash_undefined__";
|
|
396
|
+
function Bt(t, e) {
|
|
397
397
|
var r = this.__data__;
|
|
398
|
-
return this.size += this.has(t) ? 0 : 1, r[t] = U && e === void 0 ?
|
|
398
|
+
return this.size += this.has(t) ? 0 : 1, r[t] = U && e === void 0 ? kt : e, this;
|
|
399
399
|
}
|
|
400
400
|
function O(t) {
|
|
401
401
|
var e = -1, r = t == null ? 0 : t.length;
|
|
@@ -408,23 +408,23 @@ O.prototype.clear = Mt;
|
|
|
408
408
|
O.prototype.delete = xt;
|
|
409
409
|
O.prototype.get = zt;
|
|
410
410
|
O.prototype.has = Gt;
|
|
411
|
-
O.prototype.set =
|
|
411
|
+
O.prototype.set = Bt;
|
|
412
412
|
function Ht() {
|
|
413
413
|
this.__data__ = [], this.size = 0;
|
|
414
414
|
}
|
|
415
415
|
function G(t, e) {
|
|
416
416
|
for (var r = t.length; r--; )
|
|
417
|
-
if (
|
|
417
|
+
if (Re(t[r][0], e))
|
|
418
418
|
return r;
|
|
419
419
|
return -1;
|
|
420
420
|
}
|
|
421
|
-
var
|
|
421
|
+
var Wt = Array.prototype, Kt = Wt.splice;
|
|
422
422
|
function Xt(t) {
|
|
423
423
|
var e = this.__data__, r = G(e, t);
|
|
424
424
|
if (r < 0)
|
|
425
425
|
return !1;
|
|
426
426
|
var s = e.length - 1;
|
|
427
|
-
return r == s ? e.pop() :
|
|
427
|
+
return r == s ? e.pop() : Kt.call(e, r, 1), --this.size, !0;
|
|
428
428
|
}
|
|
429
429
|
function Yt(t) {
|
|
430
430
|
var e = this.__data__, r = G(e, t);
|
|
@@ -437,23 +437,23 @@ function Jt(t, e) {
|
|
|
437
437
|
var r = this.__data__, s = G(r, t);
|
|
438
438
|
return s < 0 ? (++this.size, r.push([t, e])) : r[s][1] = e, this;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function $(t) {
|
|
441
441
|
var e = -1, r = t == null ? 0 : t.length;
|
|
442
442
|
for (this.clear(); ++e < r; ) {
|
|
443
443
|
var s = t[e];
|
|
444
444
|
this.set(s[0], s[1]);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
447
|
+
$.prototype.clear = Ht;
|
|
448
|
+
$.prototype.delete = Xt;
|
|
449
|
+
$.prototype.get = Yt;
|
|
450
|
+
$.prototype.has = Zt;
|
|
451
|
+
$.prototype.set = Jt;
|
|
452
452
|
var Qt = A(Z, "Map");
|
|
453
453
|
function At() {
|
|
454
454
|
this.size = 0, this.__data__ = {
|
|
455
455
|
hash: new O(),
|
|
456
|
-
map: new (Qt ||
|
|
456
|
+
map: new (Qt || $)(),
|
|
457
457
|
string: new O()
|
|
458
458
|
};
|
|
459
459
|
}
|
|
@@ -461,22 +461,22 @@ function er(t) {
|
|
|
461
461
|
var e = typeof t;
|
|
462
462
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function k(t, e) {
|
|
465
465
|
var r = t.__data__;
|
|
466
466
|
return er(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
|
|
467
467
|
}
|
|
468
468
|
function tr(t) {
|
|
469
|
-
var e =
|
|
469
|
+
var e = k(this, t).delete(t);
|
|
470
470
|
return this.size -= e ? 1 : 0, e;
|
|
471
471
|
}
|
|
472
472
|
function rr(t) {
|
|
473
|
-
return
|
|
473
|
+
return k(this, t).get(t);
|
|
474
474
|
}
|
|
475
475
|
function sr(t) {
|
|
476
|
-
return
|
|
476
|
+
return k(this, t).has(t);
|
|
477
477
|
}
|
|
478
478
|
function ir(t, e) {
|
|
479
|
-
var r =
|
|
479
|
+
var r = k(this, t), s = r.size;
|
|
480
480
|
return r.set(t, e), this.size += r.size == s ? 0 : 1, this;
|
|
481
481
|
}
|
|
482
482
|
function F(t) {
|
|
@@ -519,22 +519,22 @@ var lr = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=
|
|
|
519
519
|
}), e;
|
|
520
520
|
});
|
|
521
521
|
function fr(t) {
|
|
522
|
-
return t == null ? "" :
|
|
522
|
+
return t == null ? "" : we(t);
|
|
523
523
|
}
|
|
524
|
-
function
|
|
525
|
-
return Q(t) ? t :
|
|
524
|
+
function Ve(t, e) {
|
|
525
|
+
return Q(t) ? t : Nt(t, e) ? [t] : cr(fr(t));
|
|
526
526
|
}
|
|
527
527
|
var dr = 1 / 0;
|
|
528
|
-
function
|
|
528
|
+
function $e(t) {
|
|
529
529
|
if (typeof t == "string" || J(t))
|
|
530
530
|
return t;
|
|
531
531
|
var e = t + "";
|
|
532
532
|
return e == "0" && 1 / t == -dr ? "-0" : e;
|
|
533
533
|
}
|
|
534
534
|
function pr(t, e) {
|
|
535
|
-
e =
|
|
535
|
+
e = Ve(e, t);
|
|
536
536
|
for (var r = 0, s = e.length; t != null && r < s; )
|
|
537
|
-
t = t[
|
|
537
|
+
t = t[$e(e[r++])];
|
|
538
538
|
return r && r == s ? t : void 0;
|
|
539
539
|
}
|
|
540
540
|
function H(t, e, r) {
|
|
@@ -544,9 +544,9 @@ function H(t, e, r) {
|
|
|
544
544
|
function hr(t, e, r, s) {
|
|
545
545
|
if (!D(t))
|
|
546
546
|
return t;
|
|
547
|
-
e =
|
|
547
|
+
e = Ve(e, t);
|
|
548
548
|
for (var i = -1, n = e.length, o = n - 1, l = t; l != null && ++i < n; ) {
|
|
549
|
-
var u =
|
|
549
|
+
var u = $e(e[i]), f = r;
|
|
550
550
|
if (u === "__proto__" || u === "constructor" || u === "prototype")
|
|
551
551
|
return t;
|
|
552
552
|
if (i != o) {
|
|
@@ -568,8 +568,8 @@ class mr {
|
|
|
568
568
|
c(this, "getRuntimeMeta");
|
|
569
569
|
c(this, "stableSchemas", []);
|
|
570
570
|
c(this, "stableModel", {});
|
|
571
|
-
c(this, "schemaPreset",
|
|
572
|
-
c(this, "componentPropsPreset",
|
|
571
|
+
c(this, "schemaPreset", P.schemaPreset);
|
|
572
|
+
c(this, "componentPropsPreset", P.componentPropsPreset);
|
|
573
573
|
c(this, "stableUpdaterProcessProgress");
|
|
574
574
|
c(this, "stableUpdaterTimes", 0);
|
|
575
575
|
c(this, "schemaEffect", new X());
|
|
@@ -615,7 +615,7 @@ class mr {
|
|
|
615
615
|
// 派生过程,用于外部应用
|
|
616
616
|
parseSchemas(e, r) {
|
|
617
617
|
a.isArrayEmpty(this.processedSchemas.value) && (this.baseDefaultValueFunctionsLength = this.countFunctionDefaultValues(
|
|
618
|
-
|
|
618
|
+
_(e)
|
|
619
619
|
), this.processedSchemas.value = this.initSchemas(e)), this.parse(e, r);
|
|
620
620
|
}
|
|
621
621
|
parseStable(e) {
|
|
@@ -646,13 +646,13 @@ class mr {
|
|
|
646
646
|
if (a.isUndefined(l.stable))
|
|
647
647
|
return;
|
|
648
648
|
const E = i.parseStable(l.stable), S = s == null ? void 0 : s.index, C = s == null ? void 0 : s.key;
|
|
649
|
-
let
|
|
650
|
-
if (a.isProcessInprogress(
|
|
651
|
-
const
|
|
652
|
-
|
|
649
|
+
let g = E;
|
|
650
|
+
if (a.isProcessInprogress(g) || (n[p] = !0), s) {
|
|
651
|
+
const y = i.processedSchemas.value[S][C][u][f];
|
|
652
|
+
y && a.isObject(y) && f !== "component" && (g = h(y, g)), i.processedSchemas.value[S][C][u][f] = g, i.stableUpdater(n);
|
|
653
653
|
} else {
|
|
654
|
-
const
|
|
655
|
-
|
|
654
|
+
const y = i.processedSchemas.value[u][f];
|
|
655
|
+
y && a.isObject(y) && f !== "component" && (g = h(y, g)), i.processedSchemas.value[u][f] = g, i.stableUpdater(n);
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
658
|
}
|
|
@@ -726,11 +726,11 @@ class mr {
|
|
|
726
726
|
}
|
|
727
727
|
promiseFieldParser(e, r, s) {
|
|
728
728
|
a.isPromise(e) ? e.then((i) => {
|
|
729
|
-
a.isString(i) && (i =
|
|
729
|
+
a.isString(i) && (i = K(i, "")), s && a.isObject(i) && !a.isNativeObject(i) ? this.objectParser({
|
|
730
730
|
data: i,
|
|
731
731
|
updater: r
|
|
732
732
|
}) : r(i);
|
|
733
|
-
}) : (a.isString(e) && (e =
|
|
733
|
+
}) : (a.isString(e) && (e = K(e, "")), s && a.isObject(e) && !a.isNativeObject(e) ? this.objectParser({
|
|
734
734
|
data: e,
|
|
735
735
|
updater: r
|
|
736
736
|
}) : r(e));
|
|
@@ -752,7 +752,7 @@ class mr {
|
|
|
752
752
|
this.promiseFieldParser(i, r, s);
|
|
753
753
|
} else {
|
|
754
754
|
const i = e(this.getRuntimeMeta());
|
|
755
|
-
e.__proform_async_result = i, this.promiseFieldParser(i, r, s);
|
|
755
|
+
e.name.startsWith("__proform_onetime_") && (e.__proform_async_result = i), this.promiseFieldParser(i, r, s);
|
|
756
756
|
}
|
|
757
757
|
else
|
|
758
758
|
q(e) ? b(
|
|
@@ -787,7 +787,7 @@ class mr {
|
|
|
787
787
|
modelProcessor(e) {
|
|
788
788
|
e.map(
|
|
789
789
|
(r) => this.createModel(r, this.processedModel.value)
|
|
790
|
-
), a.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel =
|
|
790
|
+
), a.isObjectEmpty(this.stableModel) && this.stableUpdaterProcessProgress.every(Boolean) && this.defaultValueEffect.effects.size === 0 && (this.stableModel = _(this.processedModel.value), this.runtimeCore.hydrateEffect.triggerEffects(), this.runtimeCore.hydrateEffect.clearEffects());
|
|
791
791
|
}
|
|
792
792
|
setModel(e, r, s) {
|
|
793
793
|
a.isFunction(r) ? L(e, r(), s) : e[r] = s;
|
|
@@ -820,7 +820,7 @@ class j {
|
|
|
820
820
|
return d.presets.uiPresets[e ?? d.presets.ui].container.ListItem;
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
|
-
class
|
|
823
|
+
class yr {
|
|
824
824
|
constructor(e) {
|
|
825
825
|
this.ui = e;
|
|
826
826
|
}
|
|
@@ -830,32 +830,32 @@ class gr {
|
|
|
830
830
|
}
|
|
831
831
|
getRuntimeField(e) {
|
|
832
832
|
var i;
|
|
833
|
-
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
833
|
+
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[d.getUI(this.ui)];
|
|
834
834
|
return (r == null ? void 0 : r.getRuntimeField(e)) ?? (s == null ? void 0 : s.getRuntimeField(e));
|
|
835
835
|
}
|
|
836
836
|
getRuntimeRequired(e) {
|
|
837
837
|
var i;
|
|
838
|
-
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
838
|
+
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[d.getUI(this.ui)];
|
|
839
839
|
return (r == null ? void 0 : r.getRuntimeRequired(e)) ?? (s == null ? void 0 : s.getRuntimeRequired(e));
|
|
840
840
|
}
|
|
841
841
|
getFormModelPropName() {
|
|
842
842
|
var s;
|
|
843
|
-
const e = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, r =
|
|
843
|
+
const e = (s = d.presets.uiPresets[this.ui]) == null ? void 0 : s.adapter, r = P.adapters[d.getUI(this.ui)];
|
|
844
844
|
return (e == null ? void 0 : e.getFormModelPropName()) ?? (r == null ? void 0 : r.getFormModelPropName());
|
|
845
845
|
}
|
|
846
846
|
formComponentRenderer(e) {
|
|
847
847
|
var i;
|
|
848
|
-
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
848
|
+
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[d.getUI(this.ui)];
|
|
849
849
|
return (r == null ? void 0 : r.formComponentRenderer(e)) ?? (s == null ? void 0 : s.formComponentRenderer(e));
|
|
850
850
|
}
|
|
851
851
|
clearValidate(e) {
|
|
852
852
|
var i;
|
|
853
|
-
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s =
|
|
853
|
+
const r = (i = d.presets.uiPresets[this.ui]) == null ? void 0 : i.adapter, s = P.adapters[d.getUI(this.ui)];
|
|
854
854
|
return (r == null ? void 0 : r.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !
|
|
857
|
+
function gr(t) {
|
|
858
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !ke(t);
|
|
859
859
|
}
|
|
860
860
|
class br {
|
|
861
861
|
constructor(e) {
|
|
@@ -884,7 +884,7 @@ class br {
|
|
|
884
884
|
c(this, "shared", {});
|
|
885
885
|
this.setup = e, this.processor = new mr(this);
|
|
886
886
|
const r = this.setup(this);
|
|
887
|
-
if (this.ui = r.ui ?? d.presets.ui, this.runtimeAdapter = new
|
|
887
|
+
if (this.ui = r.ui ?? d.presets.ui, this.runtimeAdapter = new yr(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), q(r.schemas))
|
|
888
888
|
b(
|
|
889
889
|
// @ts-expect-error
|
|
890
890
|
() => r.schemas.value,
|
|
@@ -907,7 +907,7 @@ class br {
|
|
|
907
907
|
this.processor.parseSchemas(r.schemas);
|
|
908
908
|
}
|
|
909
909
|
getRuntimeMeta() {
|
|
910
|
-
const e = R(
|
|
910
|
+
const e = R(_(this.model.value));
|
|
911
911
|
let r;
|
|
912
912
|
return {
|
|
913
913
|
model: e,
|
|
@@ -941,43 +941,43 @@ class br {
|
|
|
941
941
|
};
|
|
942
942
|
}
|
|
943
943
|
runtimeItemProcessor(e, r, s = this.model.value, i) {
|
|
944
|
-
var
|
|
944
|
+
var re, se, ie, ne, oe, ae, le, ue, ce, fe, de, pe, he, me, ye, ge, be;
|
|
945
945
|
const n = R(e.component);
|
|
946
946
|
if (!n)
|
|
947
947
|
return;
|
|
948
|
-
(
|
|
949
|
-
const o = h(
|
|
948
|
+
(se = (re = e.native) == null ? void 0 : re.props) != null && se.Form && h(this.globalNativeFormOverride.props.Form, (ne = (ie = e.native) == null ? void 0 : ie.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);
|
|
949
|
+
const o = h(_((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 = {
|
|
950
950
|
display: "grid",
|
|
951
951
|
gridColumn: "1 / -1",
|
|
952
952
|
...e.grid
|
|
953
|
-
}, u = h(
|
|
953
|
+
}, u = h(_((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), f = this.runtimeAdapter.getRuntimeField({
|
|
954
954
|
schema: e,
|
|
955
955
|
parentSchema: i,
|
|
956
956
|
index: r
|
|
957
|
-
}), p = n.name, E = e.componentProps ?? {}, S =
|
|
958
|
-
let C = e.placeholder,
|
|
959
|
-
|
|
960
|
-
let
|
|
961
|
-
if (e.runtime ? I = e.runtime : I = (i == null ? void 0 : i.runtime) ?? this.runtime, !a.isUndefined(r) && !a.isObjectEmpty(I) && (
|
|
962
|
-
let
|
|
963
|
-
a.isUndefined(p) ? C = `${
|
|
964
|
-
S[p.toLowerCase()], C = `${
|
|
965
|
-
p.toLowerCase().includes(
|
|
966
|
-
}), C = `${
|
|
957
|
+
}), p = n.name, E = e.componentProps ?? {}, S = P.placeholderPresetByComponentName;
|
|
958
|
+
let C = e.placeholder, g = e.show;
|
|
959
|
+
g === void 0 && (g = !0);
|
|
960
|
+
let y = 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) && (y = K((be = I == null ? void 0 : I.customizeListItemLabel) == null ? void 0 : be.call(I, e.label ?? "", r + 1), "")), !C) {
|
|
962
|
+
let N = "请输入";
|
|
963
|
+
a.isUndefined(p) ? C = `${N}${y}` : /* @ts-expect-error */ S[p.toLowerCase()] ? (N = // @ts-expect-error
|
|
964
|
+
S[p.toLowerCase()], C = `${N}${y}`) : (Object.keys(S).forEach((ve) => {
|
|
965
|
+
p.toLowerCase().includes(ve.toLowerCase()) && (N = S[ve]);
|
|
966
|
+
}), C = `${N}${y}`);
|
|
967
967
|
}
|
|
968
|
-
const
|
|
968
|
+
const Ne = this.runtimeAdapter.getRuntimeRequired({
|
|
969
969
|
...e,
|
|
970
|
-
label:
|
|
970
|
+
label: y
|
|
971
971
|
}), Me = j.getItemContainer(this), xe = j.getFormItemContainer(this), qe = this, Te = e.componentSlots;
|
|
972
972
|
return m("div", {
|
|
973
973
|
style: l
|
|
974
974
|
}, [m(Me, {
|
|
975
|
-
show:
|
|
975
|
+
show: g
|
|
976
976
|
}, {
|
|
977
977
|
default() {
|
|
978
|
-
return
|
|
979
|
-
label: `${
|
|
980
|
-
}, f,
|
|
978
|
+
return g && m(xe, x(u, {
|
|
979
|
+
label: `${y ? `${y}:` : ""}`
|
|
980
|
+
}, f, Ne), {
|
|
981
981
|
default() {
|
|
982
982
|
return qe.runtimeAdapter.formComponentRenderer({
|
|
983
983
|
Component: n,
|
|
@@ -1005,7 +1005,7 @@ class br {
|
|
|
1005
1005
|
style: s
|
|
1006
1006
|
}, [n && m(i, {
|
|
1007
1007
|
schema: e
|
|
1008
|
-
},
|
|
1008
|
+
}, gr(r = e.children.map((o) => this.runtimeItemProcessor(o))) ? r : {
|
|
1009
1009
|
default: () => [r]
|
|
1010
1010
|
})]);
|
|
1011
1011
|
}
|
|
@@ -1016,7 +1016,7 @@ class br {
|
|
|
1016
1016
|
code: "0001",
|
|
1017
1017
|
message: "异步默认值数据正在处理中,请您耐心等待... "
|
|
1018
1018
|
});
|
|
1019
|
-
(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(_(this.processor.stableModel[e.field][0])), this.runtimeAdapter.clearValidate(this);
|
|
1020
1020
|
}
|
|
1021
1021
|
deleteListItem(e, r) {
|
|
1022
1022
|
this.model.value[e.field].splice(r, 1), this.runtimeAdapter.clearValidate(this);
|
|
@@ -1072,7 +1072,7 @@ class br {
|
|
|
1072
1072
|
gridColumn: "1 / -1",
|
|
1073
1073
|
gridAutoColumns: "1fr",
|
|
1074
1074
|
...this.grid
|
|
1075
|
-
}, r = this, s = h(this.globalNativeFormOverride.props.Form,
|
|
1075
|
+
}, r = this, s = h(this.globalNativeFormOverride.props.Form, _((u = (l = this.native) == null ? void 0 : l.props) == null ? void 0 : u.Form) ?? {}), i = h(this.globalNativeFormOverride.slots.Form, _((p = (f = this.native) == null ? void 0 : f.slots) == null ? void 0 : p.Form) ?? {}), n = j.getFormContainer(this), o = this.runtimeAdapter.getFormModelPropName();
|
|
1076
1076
|
return m(n, x(s, {
|
|
1077
1077
|
ref: this.formRef
|
|
1078
1078
|
}, {
|
|
@@ -1098,7 +1098,7 @@ class d {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
}
|
|
1100
1100
|
c(d, "presets");
|
|
1101
|
-
function
|
|
1101
|
+
function W({
|
|
1102
1102
|
parentSchema: t,
|
|
1103
1103
|
schema: e,
|
|
1104
1104
|
index: r
|
|
@@ -1108,7 +1108,7 @@ function K({
|
|
|
1108
1108
|
const vr = {
|
|
1109
1109
|
ArcoVue: {
|
|
1110
1110
|
getRuntimeField(t) {
|
|
1111
|
-
const e =
|
|
1111
|
+
const e = W(t);
|
|
1112
1112
|
return a.isFunction(e) ? {
|
|
1113
1113
|
field: e()
|
|
1114
1114
|
} : {
|
|
@@ -1169,12 +1169,13 @@ const vr = {
|
|
|
1169
1169
|
});
|
|
1170
1170
|
},
|
|
1171
1171
|
clearValidate(t) {
|
|
1172
|
-
|
|
1172
|
+
var e, r;
|
|
1173
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.clearValidate) == null || r.call(e);
|
|
1173
1174
|
}
|
|
1174
1175
|
},
|
|
1175
1176
|
NutUI: {
|
|
1176
1177
|
getRuntimeField(t) {
|
|
1177
|
-
const e =
|
|
1178
|
+
const e = W(t);
|
|
1178
1179
|
return a.isFunction(e) ? {
|
|
1179
1180
|
prop: e()
|
|
1180
1181
|
} : {
|
|
@@ -1241,12 +1242,13 @@ const vr = {
|
|
|
1241
1242
|
});
|
|
1242
1243
|
},
|
|
1243
1244
|
clearValidate(t) {
|
|
1244
|
-
|
|
1245
|
+
var e, r;
|
|
1246
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.reset) == null || r.call(e);
|
|
1245
1247
|
}
|
|
1246
1248
|
},
|
|
1247
1249
|
NaiveUI: {
|
|
1248
1250
|
getRuntimeField(t) {
|
|
1249
|
-
const e =
|
|
1251
|
+
const e = W(t);
|
|
1250
1252
|
return a.isFunction(e) ? {
|
|
1251
1253
|
path: e()
|
|
1252
1254
|
} : {
|
|
@@ -1310,7 +1312,8 @@ const vr = {
|
|
|
1310
1312
|
});
|
|
1311
1313
|
},
|
|
1312
1314
|
clearValidate(t) {
|
|
1313
|
-
|
|
1315
|
+
var e, r;
|
|
1316
|
+
(r = (e = t.formRef.value) == null ? void 0 : e.restoreValidation) == null || r.call(e);
|
|
1314
1317
|
}
|
|
1315
1318
|
}
|
|
1316
1319
|
}, w = class w {
|
|
@@ -1379,12 +1382,12 @@ c(w, "schemaPreset", {
|
|
|
1379
1382
|
}), // 基于基本功能提出基本预设
|
|
1380
1383
|
c(w, "placeholderPresetByComponentName", w.getPlaceholderPrefixPresetByComponentName());
|
|
1381
1384
|
let Y = w;
|
|
1382
|
-
const
|
|
1385
|
+
const P = {
|
|
1383
1386
|
...Y,
|
|
1384
1387
|
adapters: {
|
|
1385
1388
|
...vr
|
|
1386
1389
|
}
|
|
1387
|
-
}, Cr = /* @__PURE__ */
|
|
1390
|
+
}, Cr = /* @__PURE__ */ Be({
|
|
1388
1391
|
props: {
|
|
1389
1392
|
setup: {
|
|
1390
1393
|
type: Function,
|
|
@@ -1412,26 +1415,32 @@ function Ir(t) {
|
|
|
1412
1415
|
function Sr(t) {
|
|
1413
1416
|
d.presets = t;
|
|
1414
1417
|
}
|
|
1415
|
-
function
|
|
1418
|
+
function te(t, e) {
|
|
1416
1419
|
return e === "native" && Object.defineProperty(t, "name", {
|
|
1417
1420
|
value: `__proform_raw_${t.name}`,
|
|
1418
1421
|
writable: !0
|
|
1419
1422
|
}), e === "structured_path_parsing_mark" && Object.defineProperty(t, "name", {
|
|
1420
1423
|
value: `__proform_structured_path_parsing_mark_${t.name}`,
|
|
1421
1424
|
writable: !0
|
|
1425
|
+
}), e === "onetime" && Object.defineProperty(t, "name", {
|
|
1426
|
+
value: `__proform_onetime_${t.name}`,
|
|
1427
|
+
writable: !0
|
|
1422
1428
|
}), t;
|
|
1423
1429
|
}
|
|
1424
1430
|
function Or(t) {
|
|
1425
|
-
return
|
|
1431
|
+
return te(t, "native");
|
|
1426
1432
|
}
|
|
1427
1433
|
function Fr(t) {
|
|
1428
1434
|
return t.__proform_raw_object = !0, t;
|
|
1429
1435
|
}
|
|
1430
1436
|
function Er(t) {
|
|
1437
|
+
return te(t, "onetime");
|
|
1438
|
+
}
|
|
1439
|
+
function jr(t) {
|
|
1431
1440
|
function e() {
|
|
1432
1441
|
return t;
|
|
1433
1442
|
}
|
|
1434
|
-
return
|
|
1443
|
+
return te(
|
|
1435
1444
|
e,
|
|
1436
1445
|
"structured_path_parsing_mark"
|
|
1437
1446
|
);
|
|
@@ -1440,8 +1449,9 @@ export {
|
|
|
1440
1449
|
Cr as ProForm,
|
|
1441
1450
|
Or as markNativeFunction,
|
|
1442
1451
|
Fr as markNativeObject,
|
|
1443
|
-
Er as
|
|
1452
|
+
Er as markOnetimeFunction,
|
|
1453
|
+
jr as markStructuredPathParsing,
|
|
1444
1454
|
Ir as useForm,
|
|
1445
1455
|
Sr as useFormPresetConfigurer,
|
|
1446
|
-
|
|
1456
|
+
te as useModifiers
|
|
1447
1457
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as ProForm } from "./src/form/index";
|
|
2
2
|
export { useForm } from "./src/interactions/useForm";
|
|
3
3
|
export { useFormPresetConfigurer } from "./src/interactions/useFormPresetConfigurer";
|
|
4
|
-
export { useModifiers, markNativeFunction, markNativeObject, markStructuredPathParsing, } from "./src/interactions/useModifiers";
|
|
4
|
+
export { useModifiers, markNativeFunction, markNativeObject, markStructuredPathParsing, markOnetimeFunction, } from "./src/interactions/useModifiers";
|
|
5
5
|
export * from "./src/types/index";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AnyObject, RuntimeMeta } from "../types";
|
|
2
|
-
type Modifier = "native" | "structured_path_parsing_mark";
|
|
1
|
+
import { AnyFunction, AnyObject, RuntimeMeta } from "../types";
|
|
2
|
+
type Modifier = "native" | "structured_path_parsing_mark" | "onetime";
|
|
3
3
|
type FunctionNative = (args: {
|
|
4
4
|
rawArgs: any[];
|
|
5
5
|
} & RuntimeMeta) => any;
|
|
6
6
|
export declare function useModifiers(functionNative: FunctionNative, modifier: Modifier): FunctionNative;
|
|
7
7
|
export declare function markNativeFunction(functionNative: FunctionNative): FunctionNative;
|
|
8
8
|
export declare function markNativeObject(objectNative: AnyObject): AnyObject;
|
|
9
|
+
export declare function markOnetimeFunction(functionNative: FunctionNative): AnyFunction;
|
|
9
10
|
export declare function markStructuredPathParsing(stringNative: string): string;
|
|
10
11
|
export {};
|