@harbor-design/proform 1.2.4 → 1.2.6
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 +63 -71
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (r, e, t) => (
|
|
4
|
-
import { isRef as N, watch as P, isReactive as q, nextTick as E, toRaw as R, ref as U, reactive as
|
|
1
|
+
var ae = Object.defineProperty;
|
|
2
|
+
var ue = (r, e, t) => e in r ? ae(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (ue(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { isRef as N, watch as P, isReactive as q, nextTick as E, toRaw as R, ref as U, reactive as se, createVNode as p, mergeProps as O, withDirectives as ce, vShow as fe, createTextVNode as de, isVNode as he, defineComponent as pe } from "vue";
|
|
5
5
|
class l {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -121,7 +121,7 @@ function C(r) {
|
|
|
121
121
|
function x(r, e) {
|
|
122
122
|
return r.replace(/undefined/g, e);
|
|
123
123
|
}
|
|
124
|
-
class
|
|
124
|
+
class me {
|
|
125
125
|
constructor(e) {
|
|
126
126
|
a(this, "runtimeCore");
|
|
127
127
|
this.formCustomization = e;
|
|
@@ -220,7 +220,7 @@ class L {
|
|
|
220
220
|
return !t.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
class
|
|
223
|
+
class ve {
|
|
224
224
|
constructor(e) {
|
|
225
225
|
a(this, "runtimeCore");
|
|
226
226
|
a(this, "processedSchemas");
|
|
@@ -302,17 +302,17 @@ class de {
|
|
|
302
302
|
}).fill(!1);
|
|
303
303
|
this.objectParser({ data: e, index: t, updater: n });
|
|
304
304
|
function n(f) {
|
|
305
|
-
const c = f.index, d = f.key,
|
|
305
|
+
const c = f.index, d = f.key, y = f.keyIndex;
|
|
306
306
|
if (l.isUndefined(f.stable))
|
|
307
307
|
return;
|
|
308
308
|
const j = i.parseStable(f.stable), I = s == null ? void 0 : s.index, g = s == null ? void 0 : s.key;
|
|
309
|
-
let
|
|
310
|
-
if (l.isProcessInprogress(
|
|
309
|
+
let v = j;
|
|
310
|
+
if (l.isProcessInprogress(v) || (o[y] = !0), s) {
|
|
311
311
|
const m = i.processedSchemas.value[I][g][c][d];
|
|
312
|
-
m && l.isObject(m) && d !== "component" && (
|
|
312
|
+
m && l.isObject(m) && d !== "component" && (v = h(m, v)), i.processedSchemas.value[I][g][c][d] = v, i.stableUpdater(o);
|
|
313
313
|
} else {
|
|
314
314
|
const m = i.processedSchemas.value[c][d];
|
|
315
|
-
m && l.isObject(m) && d !== "component" && (
|
|
315
|
+
m && l.isObject(m) && d !== "component" && (v = h(m, v)), i.processedSchemas.value[c][d] = v, i.stableUpdater(o);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -466,7 +466,7 @@ class F {
|
|
|
466
466
|
return u.presets.uiPresets[e ?? u.presets.ui].container.ListItem;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
|
-
class
|
|
469
|
+
class ye {
|
|
470
470
|
constructor(e) {
|
|
471
471
|
this.ui = e;
|
|
472
472
|
}
|
|
@@ -500,10 +500,10 @@ class he {
|
|
|
500
500
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !
|
|
503
|
+
function Pe(r) {
|
|
504
|
+
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !he(r);
|
|
505
505
|
}
|
|
506
|
-
class
|
|
506
|
+
class be {
|
|
507
507
|
constructor(e) {
|
|
508
508
|
a(this, "schemas", U([]));
|
|
509
509
|
a(this, "model", U({}));
|
|
@@ -514,17 +514,17 @@ class me {
|
|
|
514
514
|
});
|
|
515
515
|
a(this, "formRef", U(null));
|
|
516
516
|
a(this, "hydrateEffect", new L());
|
|
517
|
-
a(this, "native",
|
|
517
|
+
a(this, "native", se({}));
|
|
518
518
|
a(this, "grid", {});
|
|
519
519
|
a(this, "runtime", {});
|
|
520
|
-
a(this, "globalNativeFormOverride", {
|
|
520
|
+
a(this, "globalNativeFormOverride", se({
|
|
521
521
|
props: {},
|
|
522
522
|
slots: {}
|
|
523
|
-
});
|
|
523
|
+
}));
|
|
524
524
|
a(this, "shared", {});
|
|
525
|
-
this.setup = e, this.processor = new
|
|
525
|
+
this.setup = e, this.processor = new ve(this);
|
|
526
526
|
const t = this.setup(this);
|
|
527
|
-
if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new
|
|
527
|
+
if (this.ui = t.ui ?? u.presets.ui, this.runtimeAdapter = new ye(this.ui), Object.assign(this.globalNativeFormOverride, this.runtimeAdapter.getRuntimeNative()), N(t.schemas))
|
|
528
528
|
P(
|
|
529
529
|
// @ts-expect-error
|
|
530
530
|
() => t.schemas.value,
|
|
@@ -581,51 +581,51 @@ class me {
|
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
584
|
-
var z, k, $, B, D, T, G, W, K, H, J, Q, X;
|
|
584
|
+
var z, k, $, B, D, T, G, W, K, H, J, Q, X, Y, Z, A, ee;
|
|
585
585
|
const o = R(e.component);
|
|
586
586
|
if (!o)
|
|
587
587
|
return;
|
|
588
|
-
h(this.globalNativeFormOverride.props, (
|
|
589
|
-
const n = h(C((
|
|
588
|
+
(k = (z = e.native) == null ? void 0 : z.props) != null && k.Form && h(this.globalNativeFormOverride.props, (B = ($ = e.native) == null ? void 0 : $.props) == null ? void 0 : B.Form), (T = (D = e.native) == null ? void 0 : D.slots) != null && T.Form && h(this.globalNativeFormOverride.slots, (W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form);
|
|
589
|
+
const n = h(C((H = (K = this.native) == null ? void 0 : K.slots) == null ? void 0 : H.FormItem) ?? {}, (Q = (J = e.native) == null ? void 0 : J.slots) == null ? void 0 : Q.FormItem), f = {
|
|
590
590
|
display: "grid",
|
|
591
591
|
gridColumn: "1 / -1",
|
|
592
592
|
...e.grid
|
|
593
|
-
}, c = h(C((
|
|
593
|
+
}, c = h(C((Y = (X = this.native) == null ? void 0 : X.props) == null ? void 0 : Y.FormItem) ?? {}, (A = (Z = e.native) == null ? void 0 : Z.props) == null ? void 0 : A.FormItem), d = this.runtimeAdapter.getRuntimeField({
|
|
594
594
|
schema: e,
|
|
595
595
|
parentSchema: i,
|
|
596
596
|
index: t
|
|
597
|
-
}),
|
|
598
|
-
let g = e.placeholder,
|
|
599
|
-
|
|
597
|
+
}), y = o.name, j = e.componentProps ?? {}, I = b.placeholderPresetByComponentName;
|
|
598
|
+
let g = e.placeholder, v = e.show;
|
|
599
|
+
v === void 0 && (v = !0);
|
|
600
600
|
let m = e.label ?? "";
|
|
601
601
|
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
602
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((
|
|
602
|
+
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((ee = V == null ? void 0 : V.customizeListItemLabel) == null ? void 0 : ee.call(V, e.label ?? "", t + 1), "")), !g) {
|
|
603
603
|
let S = "请输入";
|
|
604
|
-
l.isUndefined(
|
|
605
|
-
I[
|
|
606
|
-
|
|
604
|
+
l.isUndefined(y) ? g = `${S}${m}` : /* @ts-expect-error */ I[y.toLowerCase()] ? (S = // @ts-expect-error
|
|
605
|
+
I[y.toLowerCase()], g = `${S}${m}`) : (Object.keys(I).forEach((te) => {
|
|
606
|
+
y.toLowerCase().includes(te.toLowerCase()) && (S = I[te]);
|
|
607
607
|
}), g = `${S}${m}`);
|
|
608
608
|
}
|
|
609
|
-
const
|
|
609
|
+
const re = this.runtimeAdapter.getRuntimeRequired({
|
|
610
610
|
...e,
|
|
611
611
|
label: m
|
|
612
|
-
}),
|
|
612
|
+
}), ie = F.getItemContainer(this), oe = F.getFormItemContainer(this), ne = this, le = e.componentSlots;
|
|
613
613
|
return p("div", {
|
|
614
614
|
style: f
|
|
615
|
-
}, [p(
|
|
616
|
-
show:
|
|
615
|
+
}, [p(ie, {
|
|
616
|
+
show: v
|
|
617
617
|
}, {
|
|
618
618
|
default() {
|
|
619
|
-
return
|
|
619
|
+
return v && p(oe, O(c, {
|
|
620
620
|
label: `${m ? `${m}:` : ""}`
|
|
621
|
-
}, d,
|
|
621
|
+
}, d, re), {
|
|
622
622
|
default() {
|
|
623
|
-
return
|
|
623
|
+
return ne.runtimeAdapter.formComponentRenderer({
|
|
624
624
|
Component: o,
|
|
625
625
|
schema: e,
|
|
626
626
|
baseModel: s,
|
|
627
627
|
placeholder: g,
|
|
628
|
-
componentSlots:
|
|
628
|
+
componentSlots: le,
|
|
629
629
|
props: j
|
|
630
630
|
});
|
|
631
631
|
},
|
|
@@ -646,7 +646,7 @@ class me {
|
|
|
646
646
|
style: s
|
|
647
647
|
}, [o && p(i, {
|
|
648
648
|
schema: e
|
|
649
|
-
},
|
|
649
|
+
}, Pe(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
|
|
650
650
|
default: () => [t]
|
|
651
651
|
})]);
|
|
652
652
|
}
|
|
@@ -686,17 +686,17 @@ class me {
|
|
|
686
686
|
container: d
|
|
687
687
|
} = {}) {
|
|
688
688
|
var j;
|
|
689
|
-
const
|
|
690
|
-
return
|
|
689
|
+
const y = d ?? p("button", null, null);
|
|
690
|
+
return ce(p(y, {
|
|
691
691
|
onClick: () => s.deleteListItem(e, c)
|
|
692
|
-
}, null), [[
|
|
692
|
+
}, null), [[fe, ((j = s.model.value[e.field]) == null ? void 0 : j.length) > 1]]);
|
|
693
693
|
}
|
|
694
694
|
}));
|
|
695
695
|
},
|
|
696
696
|
add({
|
|
697
697
|
container: f
|
|
698
698
|
} = {}) {
|
|
699
|
-
const c = f ?? p("button", null, [
|
|
699
|
+
const c = f ?? p("button", null, [de("添加")]);
|
|
700
700
|
return p(c, {
|
|
701
701
|
onClick: () => s.addListItem(e)
|
|
702
702
|
}, null);
|
|
@@ -707,21 +707,13 @@ class me {
|
|
|
707
707
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
708
708
|
}
|
|
709
709
|
exec() {
|
|
710
|
-
var f, c, d,
|
|
710
|
+
var f, c, d, y;
|
|
711
711
|
const e = {
|
|
712
712
|
display: "grid",
|
|
713
713
|
gridColumn: "1 / -1",
|
|
714
714
|
gridAutoColumns: "1fr",
|
|
715
715
|
...this.grid
|
|
716
|
-
}, t = this, s = h(
|
|
717
|
-
C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {},
|
|
718
|
-
// @ts-expect-error
|
|
719
|
-
this.globalNativeFormOverride.props.Form
|
|
720
|
-
), i = h(
|
|
721
|
-
C((v = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : v.Form) ?? {},
|
|
722
|
-
// @ts-expect-error
|
|
723
|
-
this.globalNativeFormOverride.slots.Form
|
|
724
|
-
), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
716
|
+
}, t = this, s = h(C((c = (f = this.native) == null ? void 0 : f.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props), i = h(C((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {}, this.globalNativeFormOverride.slots), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
725
717
|
return p(o, O(s, {
|
|
726
718
|
ref: this.formRef
|
|
727
719
|
}, {
|
|
@@ -754,7 +746,7 @@ function M({
|
|
|
754
746
|
}) {
|
|
755
747
|
return r ? `${r.field}.${t}.${e.field}` : e.field;
|
|
756
748
|
}
|
|
757
|
-
const
|
|
749
|
+
const ge = {
|
|
758
750
|
ArcoVue: {
|
|
759
751
|
getRuntimeField(r) {
|
|
760
752
|
return {
|
|
@@ -990,9 +982,9 @@ let _ = w;
|
|
|
990
982
|
const b = {
|
|
991
983
|
..._,
|
|
992
984
|
adapters: {
|
|
993
|
-
...
|
|
985
|
+
...ge
|
|
994
986
|
}
|
|
995
|
-
},
|
|
987
|
+
}, je = /* @__PURE__ */ pe({
|
|
996
988
|
props: {
|
|
997
989
|
setup: {
|
|
998
990
|
type: Function,
|
|
@@ -1000,12 +992,12 @@ const b = {
|
|
|
1000
992
|
}
|
|
1001
993
|
},
|
|
1002
994
|
setup(r) {
|
|
1003
|
-
const e = new
|
|
995
|
+
const e = new be(r.setup);
|
|
1004
996
|
return () => e.exec();
|
|
1005
997
|
}
|
|
1006
998
|
});
|
|
1007
|
-
function
|
|
1008
|
-
const e = new
|
|
999
|
+
function Ve(r) {
|
|
1000
|
+
const e = new me(r);
|
|
1009
1001
|
return [
|
|
1010
1002
|
e.setup.bind(e),
|
|
1011
1003
|
{
|
|
@@ -1015,26 +1007,26 @@ function Ce(r) {
|
|
|
1015
1007
|
}
|
|
1016
1008
|
];
|
|
1017
1009
|
}
|
|
1018
|
-
function
|
|
1010
|
+
function Fe(r) {
|
|
1019
1011
|
u.presets = r;
|
|
1020
1012
|
}
|
|
1021
|
-
function
|
|
1013
|
+
function Ce(r, e) {
|
|
1022
1014
|
return e === "native" && Object.defineProperty(r, "name", {
|
|
1023
1015
|
value: `__proform_raw_${r.name}`,
|
|
1024
1016
|
writable: !0
|
|
1025
1017
|
}), r;
|
|
1026
1018
|
}
|
|
1027
|
-
function
|
|
1028
|
-
return
|
|
1019
|
+
function we(r) {
|
|
1020
|
+
return Ce(r, "native");
|
|
1029
1021
|
}
|
|
1030
|
-
function
|
|
1022
|
+
function Re(r) {
|
|
1031
1023
|
return r.__proform_raw_object = !0, r;
|
|
1032
1024
|
}
|
|
1033
1025
|
export {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1026
|
+
je as ProForm,
|
|
1027
|
+
we as markNativeFunction,
|
|
1028
|
+
Re as markNativeObject,
|
|
1029
|
+
Ve as useForm,
|
|
1030
|
+
Fe as useFormPresetConfigurer,
|
|
1031
|
+
Ce as useModifiers
|
|
1040
1032
|
};
|