@harbor-design/proform 1.1.21 → 1.1.22
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,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (r, e, t) => (
|
|
4
|
-
import { isRef as x, watch as I, isReactive as k, toRaw as
|
|
1
|
+
var oe = Object.defineProperty;
|
|
2
|
+
var ne = (r, e, t) => e in r ? oe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var a = (r, e, t) => (ne(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import { isRef as x, watch as I, isReactive as k, toRaw as j, nextTick as w, ref as q, reactive as le, createVNode as p, withDirectives as Z, mergeProps as R, vShow as A, createTextVNode as ae, isVNode as ue, defineComponent as ce } from "vue";
|
|
5
5
|
class l {
|
|
6
6
|
static typeChecker(e) {
|
|
7
7
|
return {}.toString.call(e);
|
|
@@ -115,7 +115,7 @@ function g(r) {
|
|
|
115
115
|
function U(r, e) {
|
|
116
116
|
return r.replace(/undefined/g, e);
|
|
117
117
|
}
|
|
118
|
-
class
|
|
118
|
+
class fe {
|
|
119
119
|
constructor(e) {
|
|
120
120
|
a(this, "runtimeCore");
|
|
121
121
|
this.formCustomization = e;
|
|
@@ -184,7 +184,7 @@ class N {
|
|
|
184
184
|
return !t.lazy && e(), this.effects.add(e), () => this.effects.delete(e);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
class
|
|
187
|
+
class de {
|
|
188
188
|
constructor(e) {
|
|
189
189
|
a(this, "runtimeCore");
|
|
190
190
|
a(this, "processedSchemas");
|
|
@@ -252,7 +252,7 @@ class fe {
|
|
|
252
252
|
// 对于稳定初始化更新的抽象
|
|
253
253
|
stableUpdater(e = []) {
|
|
254
254
|
if (e.every(Boolean)) {
|
|
255
|
-
const t =
|
|
255
|
+
const t = j(this.processedSchemas.value);
|
|
256
256
|
!l.isProcessInprogress(t) && l.isObjectEmpty(this.stableModel) && (this.stableUpdaterProcessProgress || (this.stableUpdaterProcessProgress = Array.from({
|
|
257
257
|
length: t.length
|
|
258
258
|
}).fill(!1)), this.stableUpdaterProcessProgress[this.stableUpdaterTimes] = !0, this.stableUpdaterTimes++, this.modelProcessor(t));
|
|
@@ -419,7 +419,7 @@ class F {
|
|
|
419
419
|
return f.presets.uiPresets[e ?? f.presets.ui].container.ListItem;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
class
|
|
422
|
+
class pe {
|
|
423
423
|
constructor(e) {
|
|
424
424
|
this.ui = e;
|
|
425
425
|
}
|
|
@@ -449,10 +449,10 @@ class de {
|
|
|
449
449
|
return (t == null ? void 0 : t.clearValidate(e)) ?? (s == null ? void 0 : s.clearValidate(e));
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !
|
|
452
|
+
function he(r) {
|
|
453
|
+
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !ue(r);
|
|
454
454
|
}
|
|
455
|
-
class
|
|
455
|
+
class me {
|
|
456
456
|
constructor(e) {
|
|
457
457
|
a(this, "schemas", q([]));
|
|
458
458
|
a(this, "model", q({}));
|
|
@@ -463,16 +463,16 @@ class he {
|
|
|
463
463
|
});
|
|
464
464
|
a(this, "formRef", q(null));
|
|
465
465
|
a(this, "hydrateEffect", new N());
|
|
466
|
-
a(this, "native",
|
|
466
|
+
a(this, "native", le({}));
|
|
467
467
|
a(this, "grid", {});
|
|
468
468
|
a(this, "runtime", {});
|
|
469
469
|
a(this, "globalNativeFormOverride", {
|
|
470
470
|
props: {},
|
|
471
471
|
slots: {}
|
|
472
472
|
});
|
|
473
|
-
this.setup = e, this.processor = new
|
|
473
|
+
this.setup = e, this.processor = new de(this);
|
|
474
474
|
const t = this.setup(this);
|
|
475
|
-
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new
|
|
475
|
+
if (this.ui = t.ui ?? f.presets.ui, this.runtimeAdapter = new pe(this.ui), x(t.schemas)) {
|
|
476
476
|
const s = I(() => t.schemas, () => {
|
|
477
477
|
this.processor.parseSchemas(t.schemas.value), w(() => {
|
|
478
478
|
s();
|
|
@@ -493,13 +493,13 @@ class he {
|
|
|
493
493
|
}
|
|
494
494
|
getRuntimeMeta() {
|
|
495
495
|
return {
|
|
496
|
-
model:
|
|
496
|
+
model: j(g(this.model.value)),
|
|
497
497
|
reactiveModel: this.model.value
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
runtimeItemProcessor(e, t, s = this.model.value, i) {
|
|
501
501
|
var z, $, _, B, D, G, T, K, W, H, J, Q, X;
|
|
502
|
-
const o =
|
|
502
|
+
const o = j(e.component);
|
|
503
503
|
if (!o)
|
|
504
504
|
return;
|
|
505
505
|
m(this.globalNativeFormOverride.props, ($ = (z = e.native) == null ? void 0 : z.props) == null ? void 0 : $.Form), m(this.globalNativeFormOverride.slots, (B = (_ = e.native) == null ? void 0 : _.slots) == null ? void 0 : B.Form);
|
|
@@ -517,21 +517,21 @@ class he {
|
|
|
517
517
|
let h = e.label;
|
|
518
518
|
const V = (i == null ? void 0 : i.runtime) ?? this.runtime;
|
|
519
519
|
if (!l.isUndefined(t) && !l.isObjectEmpty(V) && (h = U((X = V == null ? void 0 : V.customizeItemLabel) == null ? void 0 : X.call(V, e.label ?? "", t + 1), "")), !v) {
|
|
520
|
-
let
|
|
521
|
-
l.isUndefined(y) ? v = `${
|
|
522
|
-
C[y.toLowerCase()], v = `${
|
|
523
|
-
y.toLowerCase().includes(Y.toLowerCase()) && (
|
|
524
|
-
}), v = `${
|
|
520
|
+
let E = "请输入";
|
|
521
|
+
l.isUndefined(y) ? v = `${E}${h}` : /* @ts-expect-error */ C[y.toLowerCase()] ? (E = // @ts-expect-error
|
|
522
|
+
C[y.toLowerCase()], v = `${E}${h}`) : (Object.keys(C).forEach((Y) => {
|
|
523
|
+
y.toLowerCase().includes(Y.toLowerCase()) && (E = C[Y]);
|
|
524
|
+
}), v = `${E}${h}`);
|
|
525
525
|
}
|
|
526
526
|
const ee = this.runtimeAdapter.getRuntimeRequired({
|
|
527
527
|
...e,
|
|
528
528
|
label: h
|
|
529
|
-
}), te = F.getItemContainer(this), se = F.getFormItemContainer(this), re = this;
|
|
529
|
+
}), te = F.getItemContainer(this), se = F.getFormItemContainer(this), re = this, ie = e.componentSlots;
|
|
530
530
|
return p("div", {
|
|
531
531
|
style: u
|
|
532
532
|
}, [p(te, null, {
|
|
533
533
|
default() {
|
|
534
|
-
return Z(p(se,
|
|
534
|
+
return Z(p(se, R(c, {
|
|
535
535
|
label: `${h}:`
|
|
536
536
|
}, d, ee), {
|
|
537
537
|
default() {
|
|
@@ -540,6 +540,7 @@ class he {
|
|
|
540
540
|
schema: e,
|
|
541
541
|
baseModel: s,
|
|
542
542
|
placeholder: v,
|
|
543
|
+
componentSlots: ie,
|
|
543
544
|
props: O
|
|
544
545
|
});
|
|
545
546
|
},
|
|
@@ -559,7 +560,7 @@ class he {
|
|
|
559
560
|
style: s
|
|
560
561
|
}, [p(i, {
|
|
561
562
|
schema: e
|
|
562
|
-
},
|
|
563
|
+
}, he(t = e.children.map((o) => this.runtimeItemProcessor(o))) ? t : {
|
|
563
564
|
default: () => [t]
|
|
564
565
|
})]);
|
|
565
566
|
}
|
|
@@ -607,7 +608,7 @@ class he {
|
|
|
607
608
|
add({
|
|
608
609
|
container: n
|
|
609
610
|
} = {}) {
|
|
610
|
-
let u = n ?? p("button", null, [
|
|
611
|
+
let u = n ?? p("button", null, [ae("添加")]);
|
|
611
612
|
return p(u, {
|
|
612
613
|
onClick: () => s.addListItem(e)
|
|
613
614
|
}, null);
|
|
@@ -625,7 +626,7 @@ class he {
|
|
|
625
626
|
gridAutoColumns: "1fr",
|
|
626
627
|
...this.grid
|
|
627
628
|
}, t = this, s = m(g((c = (u = this.native) == null ? void 0 : u.props) == null ? void 0 : c.Form) ?? {}, this.globalNativeFormOverride.props), i = m(g((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();
|
|
628
|
-
return p(o,
|
|
629
|
+
return p(o, R(s, {
|
|
629
630
|
ref: this.formRef
|
|
630
631
|
}, {
|
|
631
632
|
[n]: this.model.value
|
|
@@ -649,7 +650,7 @@ function M({
|
|
|
649
650
|
}) {
|
|
650
651
|
return r ? `${r.field}.${t}.${e.field}` : e.field;
|
|
651
652
|
}
|
|
652
|
-
const
|
|
653
|
+
const ye = {
|
|
653
654
|
ArcoVue: {
|
|
654
655
|
getRuntimeField(r) {
|
|
655
656
|
return {
|
|
@@ -684,17 +685,20 @@ const me = {
|
|
|
684
685
|
baseModel: e,
|
|
685
686
|
schema: t,
|
|
686
687
|
placeholder: s,
|
|
687
|
-
|
|
688
|
+
componentSlots: i,
|
|
689
|
+
props: o
|
|
688
690
|
}) {
|
|
689
|
-
return p(r,
|
|
691
|
+
return p(r, R({
|
|
690
692
|
modelValue: e[t.field],
|
|
691
|
-
"onUpdate:modelValue": (
|
|
693
|
+
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
692
694
|
placeholder: s
|
|
693
|
-
},
|
|
695
|
+
}, o), {
|
|
696
|
+
...i
|
|
697
|
+
});
|
|
694
698
|
},
|
|
695
699
|
validateForm(r) {
|
|
696
700
|
return new Promise((e, t) => {
|
|
697
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
701
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))));
|
|
698
702
|
});
|
|
699
703
|
},
|
|
700
704
|
clearValidate(r) {
|
|
@@ -736,13 +740,16 @@ const me = {
|
|
|
736
740
|
baseModel: e,
|
|
737
741
|
schema: t,
|
|
738
742
|
placeholder: s,
|
|
739
|
-
|
|
743
|
+
componentSlots: i,
|
|
744
|
+
props: o
|
|
740
745
|
}) {
|
|
741
|
-
return p(r,
|
|
746
|
+
return p(r, R({
|
|
742
747
|
modelValue: e[t.field],
|
|
743
|
-
"onUpdate:modelValue": (
|
|
748
|
+
"onUpdate:modelValue": (n) => e[t.field] = n,
|
|
744
749
|
placeholder: s
|
|
745
|
-
},
|
|
750
|
+
}, o), {
|
|
751
|
+
...i
|
|
752
|
+
});
|
|
746
753
|
},
|
|
747
754
|
validateForm(r) {
|
|
748
755
|
return new Promise((e, t) => {
|
|
@@ -750,7 +757,7 @@ const me = {
|
|
|
750
757
|
valid: s,
|
|
751
758
|
errors: i
|
|
752
759
|
}) => {
|
|
753
|
-
s ? e(r.cleanFallbackFields(
|
|
760
|
+
s ? e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))) : t(i);
|
|
754
761
|
});
|
|
755
762
|
});
|
|
756
763
|
},
|
|
@@ -793,24 +800,27 @@ const me = {
|
|
|
793
800
|
baseModel: e,
|
|
794
801
|
schema: t,
|
|
795
802
|
placeholder: s,
|
|
796
|
-
|
|
803
|
+
componentSlots: i,
|
|
804
|
+
props: o
|
|
797
805
|
}) {
|
|
798
|
-
return p(r,
|
|
806
|
+
return p(r, R({
|
|
799
807
|
value: e[t.field],
|
|
800
|
-
"onUpdate:value": (
|
|
808
|
+
"onUpdate:value": (n) => e[t.field] = n,
|
|
801
809
|
placeholder: s
|
|
802
|
-
},
|
|
810
|
+
}, o), {
|
|
811
|
+
...i
|
|
812
|
+
});
|
|
803
813
|
},
|
|
804
814
|
validateForm(r) {
|
|
805
815
|
return new Promise((e, t) => {
|
|
806
|
-
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(
|
|
816
|
+
r.runtimeCore.formRef.value.validate((s) => s ? t(s) : e(r.cleanFallbackFields(j(r.runtimeCore.processor.processedModel.value))));
|
|
807
817
|
});
|
|
808
818
|
},
|
|
809
819
|
clearValidate(r) {
|
|
810
820
|
r.formRef.value.restoreValidation();
|
|
811
821
|
}
|
|
812
822
|
}
|
|
813
|
-
},
|
|
823
|
+
}, S = class S {
|
|
814
824
|
static getPlaceholderPrefixPresetByComponentName() {
|
|
815
825
|
const e = {
|
|
816
826
|
请选择: ["select", "tree"],
|
|
@@ -823,7 +833,7 @@ const me = {
|
|
|
823
833
|
return t;
|
|
824
834
|
}
|
|
825
835
|
};
|
|
826
|
-
a(
|
|
836
|
+
a(S, "schemaPreset", {
|
|
827
837
|
type: {
|
|
828
838
|
defaultValue: "item"
|
|
829
839
|
},
|
|
@@ -833,6 +843,9 @@ a(j, "schemaPreset", {
|
|
|
833
843
|
componentProps: {
|
|
834
844
|
defaultValue: void 0
|
|
835
845
|
},
|
|
846
|
+
componentSlots: {
|
|
847
|
+
defaultValue: void 0
|
|
848
|
+
},
|
|
836
849
|
defaultValue: {
|
|
837
850
|
defaultValue: void 0
|
|
838
851
|
},
|
|
@@ -863,19 +876,19 @@ a(j, "schemaPreset", {
|
|
|
863
876
|
grid: {
|
|
864
877
|
default: void 0
|
|
865
878
|
}
|
|
866
|
-
}), a(
|
|
879
|
+
}), a(S, "componentPropsPreset", {
|
|
867
880
|
options: {
|
|
868
881
|
defaultValue: []
|
|
869
882
|
}
|
|
870
883
|
}), // 基于基本功能提出基本预设
|
|
871
|
-
a(
|
|
872
|
-
let L =
|
|
884
|
+
a(S, "placeholderPresetByComponentName", S.getPlaceholderPrefixPresetByComponentName());
|
|
885
|
+
let L = S;
|
|
873
886
|
const b = {
|
|
874
887
|
...L,
|
|
875
888
|
adapters: {
|
|
876
|
-
...
|
|
889
|
+
...ye
|
|
877
890
|
}
|
|
878
|
-
},
|
|
891
|
+
}, ge = /* @__PURE__ */ ce({
|
|
879
892
|
props: {
|
|
880
893
|
setup: {
|
|
881
894
|
type: Function,
|
|
@@ -883,12 +896,12 @@ const b = {
|
|
|
883
896
|
}
|
|
884
897
|
},
|
|
885
898
|
setup(r) {
|
|
886
|
-
const e = new
|
|
899
|
+
const e = new me(r.setup);
|
|
887
900
|
return () => e.exec();
|
|
888
901
|
}
|
|
889
902
|
});
|
|
890
|
-
function
|
|
891
|
-
const e = new
|
|
903
|
+
function Ce(r) {
|
|
904
|
+
const e = new fe(r);
|
|
892
905
|
return [
|
|
893
906
|
e.setup.bind(e),
|
|
894
907
|
{
|
|
@@ -897,22 +910,22 @@ function ge(r) {
|
|
|
897
910
|
}
|
|
898
911
|
];
|
|
899
912
|
}
|
|
900
|
-
function
|
|
913
|
+
function Ie(r) {
|
|
901
914
|
f.presets = r;
|
|
902
915
|
}
|
|
903
|
-
function
|
|
916
|
+
function Pe(r, e) {
|
|
904
917
|
return e === "native" && Object.defineProperty(r, "name", {
|
|
905
918
|
value: `__proform_raw_${r.name}`,
|
|
906
919
|
writable: !0
|
|
907
920
|
}), r;
|
|
908
921
|
}
|
|
909
|
-
function
|
|
910
|
-
return
|
|
922
|
+
function Ve(r) {
|
|
923
|
+
return Pe(r, "native");
|
|
911
924
|
}
|
|
912
925
|
export {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
926
|
+
ge as ProForm,
|
|
927
|
+
Ve as markNativeFunction,
|
|
928
|
+
Ce as useForm,
|
|
929
|
+
Ie as useFormPresetConfigurer,
|
|
930
|
+
Pe as useModifiers
|
|
918
931
|
};
|