@harbor-design/proform 1.2.5 → 1.2.7
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 +71 -63
- 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,59 @@ 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
|
-
|
|
589
|
-
|
|
588
|
+
(k = (z = e.native) == null ? void 0 : z.props) != null && k.Form && h(
|
|
589
|
+
// @ts-expect-error
|
|
590
|
+
this.globalNativeFormOverride.props.Form,
|
|
591
|
+
(B = ($ = e.native) == null ? void 0 : $.props) == null ? void 0 : B.Form
|
|
592
|
+
), (T = (D = e.native) == null ? void 0 : D.slots) != null && T.Form && h(
|
|
593
|
+
// @ts-expect-error
|
|
594
|
+
this.globalNativeFormOverride.slots.Form,
|
|
595
|
+
(W = (G = e.native) == null ? void 0 : G.slots) == null ? void 0 : W.Form
|
|
596
|
+
);
|
|
597
|
+
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
598
|
display: "grid",
|
|
591
599
|
gridColumn: "1 / -1",
|
|
592
600
|
...e.grid
|
|
593
|
-
}, c = h(C((
|
|
601
|
+
}, 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
602
|
schema: e,
|
|
595
603
|
parentSchema: i,
|
|
596
604
|
index: t
|
|
597
|
-
}),
|
|
598
|
-
let g = e.placeholder,
|
|
599
|
-
|
|
605
|
+
}), y = o.name, j = e.componentProps ?? {}, I = b.placeholderPresetByComponentName;
|
|
606
|
+
let g = e.placeholder, v = e.show;
|
|
607
|
+
v === void 0 && (v = !0);
|
|
600
608
|
let m = e.label ?? "";
|
|
601
609
|
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
602
|
-
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (m = x((
|
|
610
|
+
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
611
|
let S = "请输入";
|
|
604
|
-
l.isUndefined(
|
|
605
|
-
I[
|
|
606
|
-
|
|
612
|
+
l.isUndefined(y) ? g = `${S}${m}` : /* @ts-expect-error */ I[y.toLowerCase()] ? (S = // @ts-expect-error
|
|
613
|
+
I[y.toLowerCase()], g = `${S}${m}`) : (Object.keys(I).forEach((te) => {
|
|
614
|
+
y.toLowerCase().includes(te.toLowerCase()) && (S = I[te]);
|
|
607
615
|
}), g = `${S}${m}`);
|
|
608
616
|
}
|
|
609
|
-
const
|
|
617
|
+
const re = this.runtimeAdapter.getRuntimeRequired({
|
|
610
618
|
...e,
|
|
611
619
|
label: m
|
|
612
|
-
}),
|
|
620
|
+
}), ie = F.getItemContainer(this), oe = F.getFormItemContainer(this), ne = this, le = e.componentSlots;
|
|
613
621
|
return p("div", {
|
|
614
622
|
style: f
|
|
615
|
-
}, [p(
|
|
616
|
-
show:
|
|
623
|
+
}, [p(ie, {
|
|
624
|
+
show: v
|
|
617
625
|
}, {
|
|
618
626
|
default() {
|
|
619
|
-
return
|
|
627
|
+
return v && p(oe, O(c, {
|
|
620
628
|
label: `${m ? `${m}:` : ""}`
|
|
621
|
-
}, d,
|
|
629
|
+
}, d, re), {
|
|
622
630
|
default() {
|
|
623
|
-
return
|
|
631
|
+
return ne.runtimeAdapter.formComponentRenderer({
|
|
624
632
|
Component: o,
|
|
625
633
|
schema: e,
|
|
626
634
|
baseModel: s,
|
|
627
635
|
placeholder: g,
|
|
628
|
-
componentSlots:
|
|
636
|
+
componentSlots: le,
|
|
629
637
|
props: j
|
|
630
638
|
});
|
|
631
639
|
},
|
|
@@ -646,7 +654,7 @@ class me {
|
|
|
646
654
|
style: s
|
|
647
655
|
}, [o && p(i, {
|
|
648
656
|
schema: e
|
|
649
|
-
},
|
|
657
|
+
}, Pe(t = e.children.map((n) => this.runtimeItemProcessor(n))) ? t : {
|
|
650
658
|
default: () => [t]
|
|
651
659
|
})]);
|
|
652
660
|
}
|
|
@@ -686,17 +694,17 @@ class me {
|
|
|
686
694
|
container: d
|
|
687
695
|
} = {}) {
|
|
688
696
|
var j;
|
|
689
|
-
const
|
|
690
|
-
return
|
|
697
|
+
const y = d ?? p("button", null, null);
|
|
698
|
+
return ce(p(y, {
|
|
691
699
|
onClick: () => s.deleteListItem(e, c)
|
|
692
|
-
}, null), [[
|
|
700
|
+
}, null), [[fe, ((j = s.model.value[e.field]) == null ? void 0 : j.length) > 1]]);
|
|
693
701
|
}
|
|
694
702
|
}));
|
|
695
703
|
},
|
|
696
704
|
add({
|
|
697
705
|
container: f
|
|
698
706
|
} = {}) {
|
|
699
|
-
const c = f ?? p("button", null, [
|
|
707
|
+
const c = f ?? p("button", null, [de("添加")]);
|
|
700
708
|
return p(c, {
|
|
701
709
|
onClick: () => s.addListItem(e)
|
|
702
710
|
}, null);
|
|
@@ -707,7 +715,7 @@ class me {
|
|
|
707
715
|
return e.map((t) => (t.type || (t.type = "item"), this.processorBySchemaType[t.type](t)));
|
|
708
716
|
}
|
|
709
717
|
exec() {
|
|
710
|
-
var f, c, d,
|
|
718
|
+
var f, c, d, y;
|
|
711
719
|
const e = {
|
|
712
720
|
display: "grid",
|
|
713
721
|
gridColumn: "1 / -1",
|
|
@@ -718,7 +726,7 @@ class me {
|
|
|
718
726
|
// @ts-expect-error
|
|
719
727
|
this.globalNativeFormOverride.props.Form
|
|
720
728
|
), i = h(
|
|
721
|
-
C((
|
|
729
|
+
C((y = (d = this.native) == null ? void 0 : d.slots) == null ? void 0 : y.Form) ?? {},
|
|
722
730
|
// @ts-expect-error
|
|
723
731
|
this.globalNativeFormOverride.slots.Form
|
|
724
732
|
), o = F.getFormContainer(this), n = this.runtimeAdapter.getFormModelPropName();
|
|
@@ -754,7 +762,7 @@ function M({
|
|
|
754
762
|
}) {
|
|
755
763
|
return r ? `${r.field}.${t}.${e.field}` : e.field;
|
|
756
764
|
}
|
|
757
|
-
const
|
|
765
|
+
const ge = {
|
|
758
766
|
ArcoVue: {
|
|
759
767
|
getRuntimeField(r) {
|
|
760
768
|
return {
|
|
@@ -990,9 +998,9 @@ let _ = w;
|
|
|
990
998
|
const b = {
|
|
991
999
|
..._,
|
|
992
1000
|
adapters: {
|
|
993
|
-
...
|
|
1001
|
+
...ge
|
|
994
1002
|
}
|
|
995
|
-
},
|
|
1003
|
+
}, je = /* @__PURE__ */ pe({
|
|
996
1004
|
props: {
|
|
997
1005
|
setup: {
|
|
998
1006
|
type: Function,
|
|
@@ -1000,12 +1008,12 @@ const b = {
|
|
|
1000
1008
|
}
|
|
1001
1009
|
},
|
|
1002
1010
|
setup(r) {
|
|
1003
|
-
const e = new
|
|
1011
|
+
const e = new be(r.setup);
|
|
1004
1012
|
return () => e.exec();
|
|
1005
1013
|
}
|
|
1006
1014
|
});
|
|
1007
|
-
function
|
|
1008
|
-
const e = new
|
|
1015
|
+
function Ve(r) {
|
|
1016
|
+
const e = new me(r);
|
|
1009
1017
|
return [
|
|
1010
1018
|
e.setup.bind(e),
|
|
1011
1019
|
{
|
|
@@ -1015,26 +1023,26 @@ function Ce(r) {
|
|
|
1015
1023
|
}
|
|
1016
1024
|
];
|
|
1017
1025
|
}
|
|
1018
|
-
function
|
|
1026
|
+
function Fe(r) {
|
|
1019
1027
|
u.presets = r;
|
|
1020
1028
|
}
|
|
1021
|
-
function
|
|
1029
|
+
function Ce(r, e) {
|
|
1022
1030
|
return e === "native" && Object.defineProperty(r, "name", {
|
|
1023
1031
|
value: `__proform_raw_${r.name}`,
|
|
1024
1032
|
writable: !0
|
|
1025
1033
|
}), r;
|
|
1026
1034
|
}
|
|
1027
|
-
function
|
|
1028
|
-
return
|
|
1035
|
+
function we(r) {
|
|
1036
|
+
return Ce(r, "native");
|
|
1029
1037
|
}
|
|
1030
|
-
function
|
|
1038
|
+
function Re(r) {
|
|
1031
1039
|
return r.__proform_raw_object = !0, r;
|
|
1032
1040
|
}
|
|
1033
1041
|
export {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1042
|
+
je as ProForm,
|
|
1043
|
+
we as markNativeFunction,
|
|
1044
|
+
Re as markNativeObject,
|
|
1045
|
+
Ve as useForm,
|
|
1046
|
+
Fe as useFormPresetConfigurer,
|
|
1047
|
+
Ce as useModifiers
|
|
1040
1048
|
};
|