@harbor-design/proform 1.4.12 → 1.4.13
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 +32 -31
- package/dist/types/src/types/useFormTypes.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -63,7 +63,7 @@ function pt(r) {
|
|
|
63
63
|
return !!je && je in r;
|
|
64
64
|
}
|
|
65
65
|
var mt = Function.prototype, gt = mt.toString;
|
|
66
|
-
function
|
|
66
|
+
function vt(r) {
|
|
67
67
|
if (r != null) {
|
|
68
68
|
try {
|
|
69
69
|
return gt.call(r);
|
|
@@ -76,14 +76,14 @@ function bt(r) {
|
|
|
76
76
|
}
|
|
77
77
|
return "";
|
|
78
78
|
}
|
|
79
|
-
var
|
|
80
|
-
"^" + Ct.call(It).replace(
|
|
79
|
+
var bt = /[\\^$.*+?()[\]{}|]/g, yt = /^\[object .+?Constructor\]$/, _t = Function.prototype, Pt = Object.prototype, Ct = _t.toString, It = Pt.hasOwnProperty, St = RegExp(
|
|
80
|
+
"^" + Ct.call(It).replace(bt, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
81
81
|
);
|
|
82
82
|
function Et(r) {
|
|
83
83
|
if (!B(r) || pt(r))
|
|
84
84
|
return !1;
|
|
85
85
|
var e = ht(r) ? St : yt;
|
|
86
|
-
return e.test(
|
|
86
|
+
return e.test(vt(r));
|
|
87
87
|
}
|
|
88
88
|
function Ot(r, e) {
|
|
89
89
|
return r == null ? void 0 : r[e];
|
|
@@ -297,7 +297,7 @@ function D(r, e, t) {
|
|
|
297
297
|
var i = r == null ? void 0 : gr(r, e);
|
|
298
298
|
return i === void 0 ? t : i;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function vr(r, e, t, i) {
|
|
301
301
|
if (!B(r))
|
|
302
302
|
return r;
|
|
303
303
|
e = Ne(e, r);
|
|
@@ -314,7 +314,7 @@ function br(r, e, t, i) {
|
|
|
314
314
|
return r;
|
|
315
315
|
}
|
|
316
316
|
function _(r, e, t) {
|
|
317
|
-
return r == null ? r :
|
|
317
|
+
return r == null ? r : vr(r, e, t);
|
|
318
318
|
}
|
|
319
319
|
class o {
|
|
320
320
|
static typeChecker(e) {
|
|
@@ -391,13 +391,13 @@ class o {
|
|
|
391
391
|
return !!e.__proform_raw_object;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function b(r, ...e) {
|
|
395
395
|
return e.forEach((t) => {
|
|
396
396
|
if (Array.isArray(t))
|
|
397
397
|
r = [...t];
|
|
398
398
|
else
|
|
399
399
|
for (const i in t)
|
|
400
|
-
t.hasOwnProperty(i) && t[i] !== void 0 && (typeof t[i] == "object" && t[i] !== null && !(t[i] instanceof Date) && !(t[i] instanceof RegExp) ? Array.isArray(t[i]) ? r[i] = [...t[i]] : r[i] =
|
|
400
|
+
t.hasOwnProperty(i) && t[i] !== void 0 && (typeof t[i] == "object" && t[i] !== null && !(t[i] instanceof Date) && !(t[i] instanceof RegExp) ? Array.isArray(t[i]) ? r[i] = [...t[i]] : r[i] = b(r[i] || {}, t[i]) : r[i] = t[i]);
|
|
401
401
|
}), r;
|
|
402
402
|
}
|
|
403
403
|
function C(r) {
|
|
@@ -441,7 +441,7 @@ function C(r) {
|
|
|
441
441
|
function Q(r, e) {
|
|
442
442
|
return r.replace(/undefined/g, e);
|
|
443
443
|
}
|
|
444
|
-
class
|
|
444
|
+
class br {
|
|
445
445
|
constructor(e) {
|
|
446
446
|
l(this, "runtimeCore");
|
|
447
447
|
l(this, "readonlyReactiveModel", H({}));
|
|
@@ -469,7 +469,7 @@ class vr {
|
|
|
469
469
|
T(e) ? w(
|
|
470
470
|
() => e.value,
|
|
471
471
|
() => {
|
|
472
|
-
|
|
472
|
+
b(this.runtimeCore.model.value, e.value);
|
|
473
473
|
},
|
|
474
474
|
{
|
|
475
475
|
deep: !0,
|
|
@@ -478,13 +478,13 @@ class vr {
|
|
|
478
478
|
) : z(e) ? w(
|
|
479
479
|
() => e,
|
|
480
480
|
() => {
|
|
481
|
-
|
|
481
|
+
b(this.runtimeCore.model.value, e);
|
|
482
482
|
},
|
|
483
483
|
{
|
|
484
484
|
deep: !0,
|
|
485
485
|
immediate: !0
|
|
486
486
|
}
|
|
487
|
-
) :
|
|
487
|
+
) : b(this.runtimeCore.model.value, e);
|
|
488
488
|
},
|
|
489
489
|
{
|
|
490
490
|
lazy: !1
|
|
@@ -509,6 +509,7 @@ class vr {
|
|
|
509
509
|
() => this.readonlyReactiveModel.value,
|
|
510
510
|
(i) => {
|
|
511
511
|
e(i, {
|
|
512
|
+
reactiveModel: this.runtimeCore.model.value,
|
|
512
513
|
stopSubscribe() {
|
|
513
514
|
S(() => {
|
|
514
515
|
t();
|
|
@@ -641,11 +642,11 @@ class yr {
|
|
|
641
642
|
const f = u.index, c = u.key, h = u.keyIndex;
|
|
642
643
|
if (o.isUndefined(u.stable) || o.isNull(u.stable))
|
|
643
644
|
return;
|
|
644
|
-
const p = s.parseStable(u.stable),
|
|
645
|
+
const p = s.parseStable(u.stable), v = i == null ? void 0 : i.index, E = i == null ? void 0 : i.key;
|
|
645
646
|
let y = p;
|
|
646
647
|
if (o.isProcessInprogress(y) || (n[h] = !0), i) {
|
|
647
|
-
const g = s.processedSchemas.value[
|
|
648
|
-
g && o.isObject(g) && c !== "component" && (y =
|
|
648
|
+
const g = s.processedSchemas.value[v][E][f][c];
|
|
649
|
+
g && o.isObject(g) && c !== "component" && (y = b(g, y)), s.processedSchemas.value[v][E][f][c] = y, s.stableUpdater(
|
|
649
650
|
n,
|
|
650
651
|
i,
|
|
651
652
|
t,
|
|
@@ -654,7 +655,7 @@ class yr {
|
|
|
654
655
|
);
|
|
655
656
|
} else {
|
|
656
657
|
const g = s.processedSchemas.value[f][c];
|
|
657
|
-
g && o.isObject(g) && c !== "component" && (y =
|
|
658
|
+
g && o.isObject(g) && c !== "component" && (y = b(g, y)), s.processedSchemas.value[f][c] = y, s.stableUpdater(
|
|
658
659
|
n,
|
|
659
660
|
i,
|
|
660
661
|
t,
|
|
@@ -714,8 +715,8 @@ class yr {
|
|
|
714
715
|
this.defaultValueInprogressMap.set(t[s], h), !o.isProcessInprogress(h) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
715
716
|
this.defaultValueInprogressMap.values()
|
|
716
717
|
).every((p) => {
|
|
717
|
-
var
|
|
718
|
-
return !((
|
|
718
|
+
var v;
|
|
719
|
+
return !((v = p == null ? void 0 : p.includes) != null && v.call(p, "undefined"));
|
|
719
720
|
}) ? (f(h), this.defaultValueEffect.clearEffects(), S(() => {
|
|
720
721
|
c();
|
|
721
722
|
})) : f(h);
|
|
@@ -730,8 +731,8 @@ class yr {
|
|
|
730
731
|
this.defaultValueInprogressMap.set(t[s], h), !o.isProcessInprogress(h) && this.defaultValueInprogressMap.size === this.baseDefaultValueFunctionsLength && Array.from(
|
|
731
732
|
this.defaultValueInprogressMap.values()
|
|
732
733
|
).every((p) => {
|
|
733
|
-
var
|
|
734
|
-
return !((
|
|
734
|
+
var v;
|
|
735
|
+
return !((v = p == null ? void 0 : p.includes) != null && v.call(p, "undefined"));
|
|
735
736
|
}) ? (f(h), this.defaultValueEffect.clearEffects(), S(() => {
|
|
736
737
|
c();
|
|
737
738
|
})) : f(h);
|
|
@@ -838,7 +839,7 @@ class yr {
|
|
|
838
839
|
});
|
|
839
840
|
}
|
|
840
841
|
setModel(e, t, i) {
|
|
841
|
-
o.isFunction(t) ? _(e, t(), i) :
|
|
842
|
+
o.isFunction(t) ? _(e, t(), i) : b(e, {
|
|
842
843
|
[t]: i
|
|
843
844
|
});
|
|
844
845
|
}
|
|
@@ -980,28 +981,28 @@ class Cr {
|
|
|
980
981
|
};
|
|
981
982
|
}
|
|
982
983
|
runtimeItemProcessor(e, t, i = this.model.value, s) {
|
|
983
|
-
var oe, ae, le, ue, fe, ce, de, he, pe, me, ge,
|
|
984
|
+
var oe, ae, le, ue, fe, ce, de, he, pe, me, ge, ve, be, ye, _e, Pe, Ce, Ie;
|
|
984
985
|
const n = $(e.component);
|
|
985
986
|
if (!n)
|
|
986
987
|
return;
|
|
987
|
-
(ae = (oe = e.native) == null ? void 0 : oe.props) != null && ae.Form &&
|
|
988
|
-
const a =
|
|
988
|
+
(ae = (oe = e.native) == null ? void 0 : oe.props) != null && ae.Form && b(this.globalNativeFormOverride.props.Form, (ue = (le = e.native) == null ? void 0 : le.props) == null ? void 0 : ue.Form), (ce = (fe = e.native) == null ? void 0 : fe.slots) != null && ce.Form && b(this.globalNativeFormOverride.slots.Form, (he = (de = e.native) == null ? void 0 : de.slots) == null ? void 0 : he.Form);
|
|
989
|
+
const a = b(C((me = (pe = this.native) == null ? void 0 : pe.slots) == null ? void 0 : me.FormItem) ?? {}, (ve = (ge = e.native) == null ? void 0 : ge.slots) == null ? void 0 : ve.FormItem), u = {
|
|
989
990
|
display: "grid",
|
|
990
991
|
gridColumn: "1 / -1",
|
|
991
992
|
...e.grid
|
|
992
|
-
}, f =
|
|
993
|
+
}, f = b(C((ye = (be = this.native) == null ? void 0 : be.props) == null ? void 0 : ye.FormItem) ?? {}, (Pe = (_e = e.native) == null ? void 0 : _e.props) == null ? void 0 : Pe.FormItem), c = this.runtimeAdapter.getRuntimeField({
|
|
993
994
|
schema: e,
|
|
994
995
|
parentSchema: s,
|
|
995
996
|
index: t
|
|
996
|
-
}), h = n.name, p = e.componentProps ?? {},
|
|
997
|
+
}), h = n.name, p = e.componentProps ?? {}, v = I.placeholderPresetByComponentName;
|
|
997
998
|
let E = e.placeholder, y = e.show;
|
|
998
999
|
y === void 0 && (y = !0);
|
|
999
1000
|
let g = e.label ?? "", O;
|
|
1000
1001
|
if (e.runtime ? O = e.runtime : O = (s == null ? void 0 : s.runtime) ?? this.runtime, !o.isUndefined(t) && !o.isObjectEmpty(O) && (g = Q((Ce = O == null ? void 0 : O.customizeListItemLabel) == null ? void 0 : Ce.call(O, e.label ?? "", t + 1), "")), !E) {
|
|
1001
1002
|
let N = "请输入";
|
|
1002
|
-
o.isUndefined(h) ? E = `${N}${g}` : /* @ts-expect-error */
|
|
1003
|
-
|
|
1004
|
-
h.toLowerCase().includes(Se.toLowerCase()) && (N =
|
|
1003
|
+
o.isUndefined(h) ? E = `${N}${g}` : /* @ts-expect-error */ v[h.toLowerCase()] ? (N = // @ts-expect-error
|
|
1004
|
+
v[h.toLowerCase()], E = `${N}${g}`) : (Object.keys(v).forEach((Se) => {
|
|
1005
|
+
h.toLowerCase().includes(Se.toLowerCase()) && (N = v[Se]);
|
|
1005
1006
|
}), E = `${N}${g}`);
|
|
1006
1007
|
}
|
|
1007
1008
|
const qe = this.runtimeAdapter.getRuntimeRequired({
|
|
@@ -1107,7 +1108,7 @@ class Cr {
|
|
|
1107
1108
|
gridColumn: "1 / -1",
|
|
1108
1109
|
gridAutoColumns: "1fr",
|
|
1109
1110
|
...this.grid
|
|
1110
|
-
}, t = this, i =
|
|
1111
|
+
}, t = this, i = b(this.globalNativeFormOverride.props.Form, C((f = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : f.Form) ?? {}), s = b(this.globalNativeFormOverride.slots.Form, C((h = (c = this.native) == null ? void 0 : c.slots) == null ? void 0 : h.Form) ?? {}), n = x.getFormContainer(this), a = this.runtimeAdapter.getFormModelPropName();
|
|
1111
1112
|
return m(n, q(i, {
|
|
1112
1113
|
ref: this.formRef
|
|
1113
1114
|
}, {
|
|
@@ -1413,7 +1414,7 @@ const I = {
|
|
|
1413
1414
|
}
|
|
1414
1415
|
});
|
|
1415
1416
|
function wr(r) {
|
|
1416
|
-
const e = new
|
|
1417
|
+
const e = new br(r);
|
|
1417
1418
|
return [
|
|
1418
1419
|
e.setup.bind(e),
|
|
1419
1420
|
{
|
|
@@ -3,6 +3,7 @@ import type { RuntimeCore } from "../services";
|
|
|
3
3
|
import { WatchStopHandle } from "vue";
|
|
4
4
|
export type Setup = (runtimeCore: RuntimeCore) => any;
|
|
5
5
|
export type SubscribeUtils = {
|
|
6
|
+
reactiveModel: AnyObject;
|
|
6
7
|
stopSubscribe: WatchStopHandle;
|
|
7
8
|
};
|
|
8
9
|
export type SubscribeCallback = (value: any, utils: SubscribeUtils) => any;
|