cc1-form 1.3.4 → 1.3.5
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/cc1-form.js +284 -285
- package/dist/cc1-form.umd.cjs +1 -1
- package/dist/components/TCurd/index.d.ts +2798 -1
- package/dist/components/TCurd/index.vue.d.ts +8272 -13
- package/package.json +1 -1
package/dist/cc1-form.js
CHANGED
|
@@ -147,8 +147,8 @@ class $ {
|
|
|
147
147
|
useCORS: !0,
|
|
148
148
|
backgroundColor: "#ffffff00"
|
|
149
149
|
}).then(function(i) {
|
|
150
|
-
let
|
|
151
|
-
n(
|
|
150
|
+
let u = i.toDataURL("image/png");
|
|
151
|
+
n(u);
|
|
152
152
|
});
|
|
153
153
|
} catch (i) {
|
|
154
154
|
o(i);
|
|
@@ -543,7 +543,7 @@ class W {
|
|
|
543
543
|
* @returns 该字段对应类型的 options 配置,如 select 类型返回 `options.select`
|
|
544
544
|
*/
|
|
545
545
|
static findOptions = (t, n) => {
|
|
546
|
-
const o = t.column.find((a) => a.key === n), r = (a) => a.replace(/-([a-z])/g, (i,
|
|
546
|
+
const o = t.column.find((a) => a.key === n), r = (a) => a.replace(/-([a-z])/g, (i, u) => u.toUpperCase());
|
|
547
547
|
if (o)
|
|
548
548
|
return o.options[r(o.type)];
|
|
549
549
|
};
|
|
@@ -598,8 +598,8 @@ class Q {
|
|
|
598
598
|
const r = L.config.table.rowKey;
|
|
599
599
|
n[t].forEach((a) => {
|
|
600
600
|
o.forEach((i) => {
|
|
601
|
-
let
|
|
602
|
-
i.type === "number" && (
|
|
601
|
+
let u = i.default ?? "";
|
|
602
|
+
i.type === "number" && (u = i.default ?? 0), i.type === "boolean" && (u = i.default ?? !1), i.type === "time" && (u = i.default ?? /* @__PURE__ */ new Date()), a[i.value] === void 0 && (a[i.value] = u);
|
|
603
603
|
}), a[r] || (a[r] = Q.getIdFun());
|
|
604
604
|
});
|
|
605
605
|
};
|
|
@@ -616,9 +616,9 @@ class Q {
|
|
|
616
616
|
const i = L.config.table.rowKey;
|
|
617
617
|
n[t].push(
|
|
618
618
|
a.reduce(
|
|
619
|
-
(
|
|
620
|
-
let
|
|
621
|
-
return c.type === "number" && (
|
|
619
|
+
(u, c) => {
|
|
620
|
+
let d = c.default ?? "";
|
|
621
|
+
return c.type === "number" && (d = c.default ?? 0), c.type === "boolean" && (d = c.default ?? !1), c.type === "time" && (d = c.default ?? /* @__PURE__ */ new Date()), u[c.value] = d, u;
|
|
622
622
|
},
|
|
623
623
|
{ [i]: Q.getIdFun() }
|
|
624
624
|
)
|
|
@@ -696,13 +696,13 @@ const pt = {
|
|
|
696
696
|
setup(e, { emit: t }) {
|
|
697
697
|
const n = e, o = re({
|
|
698
698
|
show: !1,
|
|
699
|
-
add: (a, i,
|
|
700
|
-
Q.add(a, i,
|
|
699
|
+
add: (a, i, u) => {
|
|
700
|
+
Q.add(a, i, u, () => {
|
|
701
701
|
r("change");
|
|
702
702
|
});
|
|
703
703
|
},
|
|
704
|
-
remove: (a, i,
|
|
705
|
-
Q.remove(a, i,
|
|
704
|
+
remove: (a, i, u) => {
|
|
705
|
+
Q.remove(a, i, u, () => {
|
|
706
706
|
r("change");
|
|
707
707
|
});
|
|
708
708
|
}
|
|
@@ -712,14 +712,14 @@ const pt = {
|
|
|
712
712
|
});
|
|
713
713
|
const r = t;
|
|
714
714
|
return (a, i) => {
|
|
715
|
-
const
|
|
715
|
+
const u = fe("el-button"), c = fe("el-input");
|
|
716
716
|
return o.show ? (g(), v("div", pt, [
|
|
717
717
|
S(a.$slots, "list-start", { row: e.row }),
|
|
718
718
|
e.addBottom ? V("", !0) : (g(), v("div", wt, [
|
|
719
|
-
F(
|
|
719
|
+
F(u, {
|
|
720
720
|
link: "",
|
|
721
721
|
type: "primary",
|
|
722
|
-
onClick: i[0] || (i[0] = (
|
|
722
|
+
onClick: i[0] || (i[0] = (d) => o.add(e.field, e.row, e.itemFields))
|
|
723
723
|
}, {
|
|
724
724
|
default: p(() => [...i[3] || (i[3] = [
|
|
725
725
|
M("添加", -1)
|
|
@@ -727,27 +727,27 @@ const pt = {
|
|
|
727
727
|
_: 1
|
|
728
728
|
})
|
|
729
729
|
])),
|
|
730
|
-
(g(!0), v(B, null, G(e.row[e.field], (
|
|
730
|
+
(g(!0), v(B, null, G(e.row[e.field], (d) => (g(), v("div", kt, [
|
|
731
731
|
S(a.$slots, "item-start", {
|
|
732
|
-
item:
|
|
732
|
+
item: d,
|
|
733
733
|
row: e.row
|
|
734
734
|
}),
|
|
735
735
|
(g(!0), v(B, null, G(e.itemFields, (s) => (g(), b(c, {
|
|
736
|
-
modelValue:
|
|
737
|
-
"onUpdate:modelValue": (h) =>
|
|
736
|
+
modelValue: d[s.value],
|
|
737
|
+
"onUpdate:modelValue": (h) => d[s.value] = h,
|
|
738
738
|
style: pe({ width: e.inputWidth }),
|
|
739
739
|
class: J(e.inputClass),
|
|
740
740
|
placeholder: s[e.label] || s[e.value],
|
|
741
741
|
onChange: i[1] || (i[1] = (h) => r("change"))
|
|
742
742
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "style", "class", "placeholder"]))), 256)),
|
|
743
743
|
S(a.$slots, "item-end", {
|
|
744
|
-
item:
|
|
744
|
+
item: d,
|
|
745
745
|
row: e.row
|
|
746
746
|
}),
|
|
747
|
-
F(
|
|
747
|
+
F(u, {
|
|
748
748
|
link: "",
|
|
749
749
|
type: "danger",
|
|
750
|
-
onClick: (s) => o.remove(e.field, e.row,
|
|
750
|
+
onClick: (s) => o.remove(e.field, e.row, d)
|
|
751
751
|
}, {
|
|
752
752
|
default: p(() => [...i[4] || (i[4] = [
|
|
753
753
|
M("删除", -1)
|
|
@@ -756,10 +756,10 @@ const pt = {
|
|
|
756
756
|
}, 8, ["onClick"])
|
|
757
757
|
]))), 256)),
|
|
758
758
|
e.addBottom ? (g(), v("div", vt, [
|
|
759
|
-
F(
|
|
759
|
+
F(u, {
|
|
760
760
|
link: "",
|
|
761
761
|
type: "primary",
|
|
762
|
-
onClick: i[2] || (i[2] = (
|
|
762
|
+
onClick: i[2] || (i[2] = (d) => o.add(e.field, e.row, e.itemFields))
|
|
763
763
|
}, {
|
|
764
764
|
default: p(() => [...i[5] || (i[5] = [
|
|
765
765
|
M("添加", -1)
|
|
@@ -787,23 +787,23 @@ const pt = {
|
|
|
787
787
|
},
|
|
788
788
|
setup(e) {
|
|
789
789
|
const t = e, n = X(), o = () => {
|
|
790
|
-
const
|
|
791
|
-
return
|
|
792
|
-
}, r = async (
|
|
793
|
-
|
|
790
|
+
const u = n.value?.validateState;
|
|
791
|
+
return u && typeof u == "object" && "value" in u ? u.value : u;
|
|
792
|
+
}, r = async (u) => {
|
|
793
|
+
u && (await mt(), await n.value?.validate?.("").catch(() => {
|
|
794
794
|
}));
|
|
795
|
-
}, a = (
|
|
796
|
-
const c = t.getOn(
|
|
795
|
+
}, a = (u, c) => Array.isArray(u) ? Promise.all(u.map((d) => typeof d == "function" ? d(...c) : d)) : typeof u == "function" ? u(...c) : void 0, i = (u) => {
|
|
796
|
+
const c = t.getOn(u);
|
|
797
797
|
return {
|
|
798
798
|
...c,
|
|
799
|
-
change: (...
|
|
800
|
-
const s = o() === "error", h = a(c.change,
|
|
799
|
+
change: (...d) => {
|
|
800
|
+
const s = o() === "error", h = a(c.change, d);
|
|
801
801
|
return Promise.resolve(h).then(() => r(s), () => r(s)).catch(() => {
|
|
802
802
|
}), h;
|
|
803
803
|
}
|
|
804
804
|
};
|
|
805
805
|
};
|
|
806
|
-
return (
|
|
806
|
+
return (u, c) => (g(), b(l(be), {
|
|
807
807
|
ref_key: "formItemRef",
|
|
808
808
|
ref: n,
|
|
809
809
|
label: e.item.text?.form?.label ?? e.item.label,
|
|
@@ -812,20 +812,20 @@ const pt = {
|
|
|
812
812
|
}, {
|
|
813
813
|
default: p(() => [
|
|
814
814
|
R("div", Ct, [
|
|
815
|
-
S(
|
|
815
|
+
S(u.$slots, "form-" + e.item.key + "-start", {
|
|
816
816
|
row: e.form,
|
|
817
817
|
item: e.item
|
|
818
818
|
}),
|
|
819
819
|
R("div", xt, [
|
|
820
820
|
R("div", Vt, [
|
|
821
|
-
S(
|
|
821
|
+
S(u.$slots, "form-" + e.item.key, {
|
|
822
822
|
row: e.form,
|
|
823
823
|
item: e.item
|
|
824
824
|
}, () => [
|
|
825
825
|
e.item.type === "input" ? (g(), b(l(ue), x({
|
|
826
826
|
key: 0,
|
|
827
827
|
modelValue: e.form[e.item.key],
|
|
828
|
-
"onUpdate:modelValue": c[0] || (c[0] = (
|
|
828
|
+
"onUpdate:modelValue": c[0] || (c[0] = (d) => e.form[e.item.key] = d)
|
|
829
829
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
830
830
|
disabled: e.getDisabled(e.item)
|
|
831
831
|
}), Y({ _: 2 }, [
|
|
@@ -839,78 +839,78 @@ const pt = {
|
|
|
839
839
|
]), 1040, ["modelValue", "disabled"])) : e.item.type === "number" ? (g(), b(l(ot), x({
|
|
840
840
|
key: 1,
|
|
841
841
|
modelValue: e.form[e.item.key],
|
|
842
|
-
"onUpdate:modelValue": c[1] || (c[1] = (
|
|
842
|
+
"onUpdate:modelValue": c[1] || (c[1] = (d) => e.form[e.item.key] = d)
|
|
843
843
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
844
844
|
disabled: e.getDisabled(e.item)
|
|
845
845
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "textarea" ? (g(), b(l(ue), x({
|
|
846
846
|
key: 2,
|
|
847
847
|
type: "textarea",
|
|
848
848
|
modelValue: e.form[e.item.key],
|
|
849
|
-
"onUpdate:modelValue": c[2] || (c[2] = (
|
|
849
|
+
"onUpdate:modelValue": c[2] || (c[2] = (d) => e.form[e.item.key] = d)
|
|
850
850
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
851
851
|
disabled: e.getDisabled(e.item)
|
|
852
852
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "switch" ? (g(), b(l(he), x({
|
|
853
853
|
key: 3,
|
|
854
854
|
modelValue: e.form[e.item.key],
|
|
855
|
-
"onUpdate:modelValue": c[3] || (c[3] = (
|
|
855
|
+
"onUpdate:modelValue": c[3] || (c[3] = (d) => e.form[e.item.key] = d)
|
|
856
856
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
857
857
|
disabled: e.getDisabled(e.item)
|
|
858
858
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "select" ? (g(), b(l(ce), x({
|
|
859
859
|
key: 4,
|
|
860
860
|
modelValue: e.form[e.item.key],
|
|
861
|
-
"onUpdate:modelValue": c[4] || (c[4] = (
|
|
861
|
+
"onUpdate:modelValue": c[4] || (c[4] = (d) => e.form[e.item.key] = d)
|
|
862
862
|
}, e.getBind(e.item), E(i(e.item)), {
|
|
863
863
|
disabled: e.getDisabled(e.item),
|
|
864
864
|
style: { width: "100%" }
|
|
865
865
|
}), {
|
|
866
866
|
default: p(() => [
|
|
867
|
-
(g(!0), v(B, null, G(e.getBind(e.item).data || [], (
|
|
868
|
-
key:
|
|
869
|
-
}, { ref_for: !0 },
|
|
867
|
+
(g(!0), v(B, null, G(e.getBind(e.item).data || [], (d) => (g(), b(l(ne), x({
|
|
868
|
+
key: d.value
|
|
869
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
870
870
|
]),
|
|
871
871
|
_: 1
|
|
872
872
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "radio" ? (g(), b(l(Ue), x({
|
|
873
873
|
key: 5,
|
|
874
874
|
modelValue: e.form[e.item.key],
|
|
875
|
-
"onUpdate:modelValue": c[5] || (c[5] = (
|
|
875
|
+
"onUpdate:modelValue": c[5] || (c[5] = (d) => e.form[e.item.key] = d)
|
|
876
876
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
877
877
|
disabled: e.getDisabled(e.item),
|
|
878
878
|
style: { width: "100%" }
|
|
879
879
|
}), {
|
|
880
880
|
default: p(() => [
|
|
881
|
-
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (
|
|
882
|
-
key:
|
|
883
|
-
}, { ref_for: !0 },
|
|
884
|
-
key:
|
|
885
|
-
}, { ref_for: !0 },
|
|
881
|
+
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(at), x({
|
|
882
|
+
key: d.value
|
|
883
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128)) : (g(!0), v(B, { key: 1 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(Ae), x({
|
|
884
|
+
key: d.value
|
|
885
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
886
886
|
]),
|
|
887
887
|
_: 1
|
|
888
888
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "checkbox" ? (g(), b(l(nt), x({
|
|
889
889
|
key: 6,
|
|
890
890
|
modelValue: e.form[e.item.key],
|
|
891
|
-
"onUpdate:modelValue": c[6] || (c[6] = (
|
|
891
|
+
"onUpdate:modelValue": c[6] || (c[6] = (d) => e.form[e.item.key] = d)
|
|
892
892
|
}, e.getBind(e.item), E(i(e.item)), {
|
|
893
893
|
disabled: e.getDisabled(e.item),
|
|
894
894
|
style: { width: "100%" }
|
|
895
895
|
}), {
|
|
896
896
|
default: p(() => [
|
|
897
|
-
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (
|
|
898
|
-
key:
|
|
899
|
-
}, { ref_for: !0 },
|
|
900
|
-
key:
|
|
901
|
-
}, { ref_for: !0 },
|
|
897
|
+
e.getBind(e.item).type === "group" ? (g(!0), v(B, { key: 0 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(lt), x({
|
|
898
|
+
key: d.value
|
|
899
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128)) : (g(!0), v(B, { key: 1 }, G(e.getBind(e.item).data || [], (d) => (g(), b(l(it), x({
|
|
900
|
+
key: d.value
|
|
901
|
+
}, { ref_for: !0 }, d, E(d.on || {})), null, 16))), 128))
|
|
902
902
|
]),
|
|
903
903
|
_: 1
|
|
904
904
|
}, 16, ["modelValue", "disabled"])) : e.item.type === "color" ? (g(), b(l(rt), x({
|
|
905
905
|
key: 7,
|
|
906
906
|
modelValue: e.form[e.item.key],
|
|
907
|
-
"onUpdate:modelValue": c[7] || (c[7] = (
|
|
907
|
+
"onUpdate:modelValue": c[7] || (c[7] = (d) => e.form[e.item.key] = d)
|
|
908
908
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
909
909
|
disabled: e.getDisabled(e.item)
|
|
910
910
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "slider" ? (g(), b(l(st), x({
|
|
911
911
|
key: 8,
|
|
912
912
|
modelValue: e.form[e.item.key],
|
|
913
|
-
"onUpdate:modelValue": c[8] || (c[8] = (
|
|
913
|
+
"onUpdate:modelValue": c[8] || (c[8] = (d) => e.form[e.item.key] = d)
|
|
914
914
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
915
915
|
disabled: e.getDisabled(e.item)
|
|
916
916
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "list" ? (g(), b(Ke, x({
|
|
@@ -923,36 +923,36 @@ const pt = {
|
|
|
923
923
|
}), null, 16, ["row", "field", "disabled"])) : e.item.type === "treeSelect" ? (g(), b(l(dt), x({
|
|
924
924
|
key: 10,
|
|
925
925
|
modelValue: e.form[e.item.key],
|
|
926
|
-
"onUpdate:modelValue": c[9] || (c[9] = (
|
|
926
|
+
"onUpdate:modelValue": c[9] || (c[9] = (d) => e.form[e.item.key] = d)
|
|
927
927
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
928
928
|
disabled: e.getDisabled(e.item),
|
|
929
929
|
style: { width: "100%" }
|
|
930
930
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type === "datetime" ? (g(), b(l(Be), x({
|
|
931
931
|
key: 11,
|
|
932
932
|
modelValue: e.form[e.item.key],
|
|
933
|
-
"onUpdate:modelValue": c[10] || (c[10] = (
|
|
933
|
+
"onUpdate:modelValue": c[10] || (c[10] = (d) => e.form[e.item.key] = d)
|
|
934
934
|
}, e.getBind(e.item), E(i(e.item)), {
|
|
935
935
|
disabled: e.getDisabled(e.item)
|
|
936
936
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type && typeof e.item.type == "object" ? (g(), b(ee(e.item.type), x({
|
|
937
937
|
key: 12,
|
|
938
938
|
modelValue: e.form[e.item.key],
|
|
939
|
-
"onUpdate:modelValue": c[11] || (c[11] = (
|
|
939
|
+
"onUpdate:modelValue": c[11] || (c[11] = (d) => e.form[e.item.key] = d)
|
|
940
940
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
941
941
|
disabled: e.getDisabled(e.item)
|
|
942
942
|
}), null, 16, ["modelValue", "disabled"])) : e.item.type && (l(W).customComponent[e.item.type] || l(W).customComponent[e.item.type]?.form) ? (g(), b(ee(l(W).customComponent[e.item.type]?.form || l(W).customComponent[e.item.type]), x({
|
|
943
943
|
key: 13,
|
|
944
944
|
modelValue: e.form[e.item.key],
|
|
945
|
-
"onUpdate:modelValue": c[12] || (c[12] = (
|
|
945
|
+
"onUpdate:modelValue": c[12] || (c[12] = (d) => e.form[e.item.key] = d)
|
|
946
946
|
}, e.getBind(e.item), E(e.getOn(e.item)), {
|
|
947
947
|
disabled: e.getDisabled(e.item)
|
|
948
948
|
}), null, 16, ["modelValue", "disabled"])) : V("", !0)
|
|
949
949
|
]),
|
|
950
|
-
S(
|
|
950
|
+
S(u.$slots, "form-" + e.item.key + "-right", {
|
|
951
951
|
row: e.form,
|
|
952
952
|
item: e.item
|
|
953
953
|
})
|
|
954
954
|
]),
|
|
955
|
-
S(
|
|
955
|
+
S(u.$slots, "form-" + e.item.key + "-tip", {
|
|
956
956
|
row: e.form,
|
|
957
957
|
item: e.item
|
|
958
958
|
}, () => [
|
|
@@ -963,7 +963,7 @@ const pt = {
|
|
|
963
963
|
}, null, 8, St)) : V("", !0)
|
|
964
964
|
])
|
|
965
965
|
]),
|
|
966
|
-
S(
|
|
966
|
+
S(u.$slots, "form-" + e.item.key + "-end", {
|
|
967
967
|
row: e.form,
|
|
968
968
|
item: e.item
|
|
969
969
|
})
|
|
@@ -1085,11 +1085,11 @@ const we = (e) => {
|
|
|
1085
1085
|
error: zt(o)
|
|
1086
1086
|
}))), ge = $.EDialog, le = (e) => typeof e.type == "object" ? "component" : e.type || "input", Mt = (e, t, n) => {
|
|
1087
1087
|
const o = we(() => t.form), r = (i) => De(i.update.formGrid || [], i.update.form, i.update.type, i.update.formMaxSpan).map((c) => c.item.key).filter(Boolean), a = async (i) => {
|
|
1088
|
-
const
|
|
1089
|
-
if (!
|
|
1090
|
-
const c = r(i),
|
|
1091
|
-
if (
|
|
1092
|
-
if (!await
|
|
1088
|
+
const u = n.ruleFormRef.value;
|
|
1089
|
+
if (!u) return !0;
|
|
1090
|
+
const c = r(i), d = Object.keys(i.update.rules || {}).filter((h) => !c.includes(h));
|
|
1091
|
+
if (d.length && u.clearValidate(d), !c.length) return !0;
|
|
1092
|
+
if (!await u.validateField(c, async (h, f) => {
|
|
1093
1093
|
h || me(ke(f));
|
|
1094
1094
|
})) throw !1;
|
|
1095
1095
|
return !0;
|
|
@@ -1112,26 +1112,26 @@ const we = (e) => {
|
|
|
1112
1112
|
formColumn: [],
|
|
1113
1113
|
formGrid: [],
|
|
1114
1114
|
formMaxSpan: 12,
|
|
1115
|
-
getDisabled: (i,
|
|
1115
|
+
getDisabled: (i, u = !1) => {
|
|
1116
1116
|
const c = e();
|
|
1117
|
-
return t.option.table?.editMode &&
|
|
1117
|
+
return t.option.table?.editMode && u ? i.disabled?.table === void 0 ? !1 : $.isFun(i.disabled?.table, c.update.form) : Ie(i, c.update.type, c.update.form);
|
|
1118
1118
|
},
|
|
1119
1119
|
getBind: (i) => {
|
|
1120
|
-
const
|
|
1121
|
-
return Ne(i,
|
|
1120
|
+
const u = e();
|
|
1121
|
+
return Ne(i, u.update.type);
|
|
1122
1122
|
},
|
|
1123
|
-
getOn: (i,
|
|
1123
|
+
getOn: (i, u) => {
|
|
1124
1124
|
const c = e();
|
|
1125
|
-
return Ge(i, c.update.type, [
|
|
1125
|
+
return Ge(i, c.update.type, [u || c.update.form, i]);
|
|
1126
1126
|
},
|
|
1127
1127
|
getOptions: (i) => {
|
|
1128
|
-
const
|
|
1128
|
+
const u = e();
|
|
1129
1129
|
try {
|
|
1130
|
-
const
|
|
1131
|
-
return
|
|
1132
|
-
options:
|
|
1130
|
+
const d = qe(u.update.formGrid?.length ? u.update.formGrid : u.update.formColumn).find((s) => s.item.key === i)?.item;
|
|
1131
|
+
return d ? {
|
|
1132
|
+
options: d.options,
|
|
1133
1133
|
//@ts-ignore
|
|
1134
|
-
bind:
|
|
1134
|
+
bind: u.update.getBind(d)
|
|
1135
1135
|
} : { options: {}, bind: {} };
|
|
1136
1136
|
} catch {
|
|
1137
1137
|
return { options: {}, bind: {} };
|
|
@@ -1140,42 +1140,42 @@ const we = (e) => {
|
|
|
1140
1140
|
edit: {
|
|
1141
1141
|
data: {},
|
|
1142
1142
|
getApiData: (i) => {
|
|
1143
|
-
const
|
|
1143
|
+
const u = e();
|
|
1144
1144
|
if (t.option.form?.editAll) return i;
|
|
1145
1145
|
const c = {
|
|
1146
|
-
[t.option.table?.rowKey]:
|
|
1146
|
+
[t.option.table?.rowKey]: u.update.edit.data[t.option.table?.rowKey]
|
|
1147
1147
|
};
|
|
1148
|
-
return Object.keys(
|
|
1149
|
-
i[
|
|
1148
|
+
return Object.keys(u.update.edit.data).forEach((d) => {
|
|
1149
|
+
i[d] !== u.update.edit.data[d] && (c[d] = i[d]);
|
|
1150
1150
|
}), c;
|
|
1151
1151
|
}
|
|
1152
1152
|
},
|
|
1153
1153
|
view: {},
|
|
1154
1154
|
openLoading: !1,
|
|
1155
|
-
open: async (i,
|
|
1155
|
+
open: async (i, u) => {
|
|
1156
1156
|
const c = e();
|
|
1157
1157
|
if (!(c.update.showContent || c.update.openLoading)) {
|
|
1158
1158
|
$.loading(!0), c.update.openLoading = !0;
|
|
1159
1159
|
try {
|
|
1160
1160
|
c.update.type = i;
|
|
1161
|
-
const
|
|
1162
|
-
c.update.edit.data =
|
|
1163
|
-
const s =
|
|
1164
|
-
Z.setValue(c.update.form, s, !0), await c.initApiData("update"), await t.option.form?.openBefore?.(c.update.form, c.update), (!t.option.table?.inlineEdit ||
|
|
1165
|
-
} catch (
|
|
1166
|
-
console.error(
|
|
1161
|
+
const d = i === ge.Add;
|
|
1162
|
+
c.update.edit.data = d ? void 0 : JSONUtil.cp(u), c.update.title = C.tCurd(d ? "add" : i === ge.View ? "view" : "edit");
|
|
1163
|
+
const s = d ? ObjectUtil.deepMerge(JSONUtil.cp(c.update.formDefault), u ? JSONUtil.cp(u) : {}) : JSONUtil.cp(u);
|
|
1164
|
+
Z.setValue(c.update.form, s, !0), await c.initApiData("update"), await t.option.form?.openBefore?.(c.update.form, c.update), (!t.option.table?.inlineEdit || d) && (c.update.show = !0, c.update.showContent = !0), t.option.form?.openAfter?.(c.update.form, c.update);
|
|
1165
|
+
} catch (d) {
|
|
1166
|
+
console.error(d);
|
|
1167
1167
|
} finally {
|
|
1168
1168
|
$.loading(!1), c.update.openLoading = !1;
|
|
1169
1169
|
}
|
|
1170
1170
|
}
|
|
1171
1171
|
},
|
|
1172
1172
|
validate: async (i = !0) => {
|
|
1173
|
-
const
|
|
1173
|
+
const u = e();
|
|
1174
1174
|
try {
|
|
1175
|
-
const c = t.option.table?.editMode ?
|
|
1175
|
+
const c = t.option.table?.editMode ? u.tableEditValidate.validate() : a(u);
|
|
1176
1176
|
return await Promise.all([
|
|
1177
1177
|
c,
|
|
1178
|
-
|
|
1178
|
+
u.formRef.validate()
|
|
1179
1179
|
]), !0;
|
|
1180
1180
|
} catch {
|
|
1181
1181
|
return i && $.fail(C.tCurd("checkFormData")), !1;
|
|
@@ -1192,18 +1192,18 @@ const we = (e) => {
|
|
|
1192
1192
|
i.update.loading = !1;
|
|
1193
1193
|
return;
|
|
1194
1194
|
}
|
|
1195
|
-
let
|
|
1196
|
-
delete
|
|
1195
|
+
let d = ObjectUtil.deepMerge(i.update.form, {});
|
|
1196
|
+
delete d.children;
|
|
1197
1197
|
const s = new Set(t.option.column.filter((h) => h.type === "datetime").map((h) => h.key));
|
|
1198
|
-
Object.keys(
|
|
1199
|
-
if (s.has(h) &&
|
|
1200
|
-
const f = new Date(
|
|
1201
|
-
isNaN(f) || (
|
|
1198
|
+
Object.keys(d).forEach((h) => {
|
|
1199
|
+
if (s.has(h) && d[h] != null) {
|
|
1200
|
+
const f = new Date(d[h]).getTime();
|
|
1201
|
+
isNaN(f) || (d[h] = f);
|
|
1202
1202
|
}
|
|
1203
1203
|
});
|
|
1204
1204
|
try {
|
|
1205
1205
|
if (!c) return;
|
|
1206
|
-
await c({ ...
|
|
1206
|
+
await c({ ...d }), i.update.close(), await i.table.getList(), t.option.form?.submitAfter?.(d, i.update);
|
|
1207
1207
|
} catch (h) {
|
|
1208
1208
|
console.error(h);
|
|
1209
1209
|
} finally {
|
|
@@ -1233,22 +1233,22 @@ const we = (e) => {
|
|
|
1233
1233
|
return e.options?.[t === $.EDialog.Add ? "formAdd" : "formUpdate"]?.[n] || e.options?.[n] || {};
|
|
1234
1234
|
}, Ge = (e, t, n = []) => {
|
|
1235
1235
|
const o = le(e), a = e.options?.[t === $.EDialog.Add ? "formAdd" : "formUpdate"]?.[o]?.on || e.options?.[o]?.on || {}, i = {};
|
|
1236
|
-
return Object.keys(a).forEach((
|
|
1237
|
-
const c = a[
|
|
1238
|
-
typeof c == "function" ? i[
|
|
1239
|
-
return c.apply(this, [...
|
|
1240
|
-
} : i[
|
|
1236
|
+
return Object.keys(a).forEach((u) => {
|
|
1237
|
+
const c = a[u];
|
|
1238
|
+
typeof c == "function" ? i[u] = function(...d) {
|
|
1239
|
+
return c.apply(this, [...d, ...n]);
|
|
1240
|
+
} : i[u] = c;
|
|
1241
1241
|
}), i;
|
|
1242
1242
|
}, He = (e, t, n, o, r) => {
|
|
1243
1243
|
const a = e, i = a.colSpan ?? e.span;
|
|
1244
1244
|
if (!e.item.form?.spanCol)
|
|
1245
1245
|
return i;
|
|
1246
|
-
const
|
|
1246
|
+
const u = r?.maxSpan || 12, c = r?.defaultSpan || u / 2, d = a.gridBand, h = t.filter((f) => d != null ? f.gridBand === d && !$.isFun(f.item.show?.form, n, o) : f.gridRow === a.gridRow && !$.isFun(f.item.show?.form, n, o)).reduce((f, m) => f + (m.colSpan ?? m.span ?? c), 0);
|
|
1247
1247
|
return i + h;
|
|
1248
1248
|
}, Ot = (e, t) => {
|
|
1249
1249
|
const n = (o, r) => {
|
|
1250
|
-
const a = o.gridRow, i = o.gridRow + o.rowSpan - 1,
|
|
1251
|
-
return a <= c &&
|
|
1250
|
+
const a = o.gridRow, i = o.gridRow + o.rowSpan - 1, u = r.gridRow, c = r.gridRow + r.rowSpan - 1;
|
|
1251
|
+
return a <= c && u <= i;
|
|
1252
1252
|
};
|
|
1253
1253
|
return e.map((o) => e.filter((a) => n(o, a)).length !== 1 || o.colSpan >= t ? o : {
|
|
1254
1254
|
...o,
|
|
@@ -1259,7 +1259,7 @@ const we = (e) => {
|
|
|
1259
1259
|
}, We = (e, t, n = {}) => {
|
|
1260
1260
|
const o = /* @__PURE__ */ new Set(), r = [];
|
|
1261
1261
|
let a = 0, i = 0;
|
|
1262
|
-
const
|
|
1262
|
+
const u = (m) => Math.floor(m / H) * H, c = (m, w) => `${m},${w}`, d = (m, w, D, T) => {
|
|
1263
1263
|
if (w + D > t) return !1;
|
|
1264
1264
|
for (let O = 0; O < T; O++)
|
|
1265
1265
|
for (let A = 0; A < D; A++)
|
|
@@ -1270,17 +1270,17 @@ const we = (e) => {
|
|
|
1270
1270
|
for (let A = 0; A < D; A++)
|
|
1271
1271
|
o.add(c(m + O, w + A));
|
|
1272
1272
|
}, h = (m, w, D, T) => {
|
|
1273
|
-
for (let A =
|
|
1274
|
-
const de = A + H, Ce = A ===
|
|
1273
|
+
for (let A = u(m); A < 500 * H; A += H) {
|
|
1274
|
+
const de = A + H, Ce = A === u(m) ? Math.max(A, m) : A;
|
|
1275
1275
|
for (let _ = Ce; _ < de; _++) {
|
|
1276
1276
|
const xe = _ === m ? w : 0;
|
|
1277
1277
|
for (let te = xe; te <= t - D; te++)
|
|
1278
|
-
if (
|
|
1278
|
+
if (d(_, te, D, T)) return { tr: _, tc: te };
|
|
1279
1279
|
}
|
|
1280
1280
|
}
|
|
1281
1281
|
return { tr: m, tc: w };
|
|
1282
1282
|
}, f = (m, w, D, T) => {
|
|
1283
|
-
const O =
|
|
1283
|
+
const O = u(m);
|
|
1284
1284
|
if (T < H && m + T < O + H) {
|
|
1285
1285
|
a = m + T, i = w;
|
|
1286
1286
|
return;
|
|
@@ -1294,9 +1294,9 @@ const we = (e) => {
|
|
|
1294
1294
|
};
|
|
1295
1295
|
return e.forEach((m) => {
|
|
1296
1296
|
const w = m.colSpan ?? (m.span === 0 ? t : m.span), D = m.rowSpan ?? Pe(m.item);
|
|
1297
|
-
m.item.form?.rowBreak && r.length && (i = 0, a =
|
|
1298
|
-
let { tr: T, tc: O } =
|
|
1299
|
-
|
|
1297
|
+
m.item.form?.rowBreak && r.length && (i = 0, a = u(a) + H);
|
|
1298
|
+
let { tr: T, tc: O } = d(a, i, w, D) ? { tr: a, tc: i } : h(a, i, w, D);
|
|
1299
|
+
d(T, O, w, D) || ({ tr: T, tc: O } = h(0, 0, w, D)), s(T, O, w, D);
|
|
1300
1300
|
const A = T + 1;
|
|
1301
1301
|
r.push({
|
|
1302
1302
|
...m,
|
|
@@ -1309,23 +1309,23 @@ const we = (e) => {
|
|
|
1309
1309
|
}), f(T, O, w, D);
|
|
1310
1310
|
}), n.fillSingleRows ? Ot(r, t) : r;
|
|
1311
1311
|
}, De = (e, t, n, o = H) => {
|
|
1312
|
-
const r = e.filter((
|
|
1313
|
-
e.forEach((
|
|
1314
|
-
const
|
|
1315
|
-
a.has(
|
|
1312
|
+
const r = e.filter((u) => $.isFun(u.item.show?.form, t, n)), a = /* @__PURE__ */ new Map();
|
|
1313
|
+
e.forEach((u) => {
|
|
1314
|
+
const d = `${u.gridBand ?? ie(u)}:${u.gridColumn}:${u.colSpan}`;
|
|
1315
|
+
a.has(d) || a.set(d, []), a.get(d).push(u);
|
|
1316
1316
|
});
|
|
1317
1317
|
const i = /* @__PURE__ */ new Map();
|
|
1318
|
-
return a.forEach((
|
|
1319
|
-
const c =
|
|
1320
|
-
if (!(
|
|
1321
|
-
const s =
|
|
1318
|
+
return a.forEach((u) => {
|
|
1319
|
+
const c = u.reduce((f, m) => f + m.rowSpan, 0);
|
|
1320
|
+
if (!(u.length > 1 && c === H && u.every((f) => f.rowSpan < H))) return;
|
|
1321
|
+
const s = u.filter((f) => $.isFun(f.item.show?.form, t, n));
|
|
1322
1322
|
if (s.length !== 1) return;
|
|
1323
1323
|
const h = s[0];
|
|
1324
1324
|
i.set(h.item.key, {
|
|
1325
1325
|
...h,
|
|
1326
1326
|
rowSpan: H
|
|
1327
1327
|
});
|
|
1328
|
-
}), We(r.map((
|
|
1328
|
+
}), We(r.map((u) => i.get(u.item.key) || u), o, {
|
|
1329
1329
|
fillSingleRows: !0
|
|
1330
1330
|
});
|
|
1331
1331
|
}, Je = (e) => {
|
|
@@ -1351,12 +1351,12 @@ const we = (e) => {
|
|
|
1351
1351
|
}, Qe = (e, t = {}) => {
|
|
1352
1352
|
const n = t.maxSpan ?? 12, o = t.defaultSpan ?? n / 2, r = t.layout ?? "row", i = Ut(e, { maxSpan: n, defaultSpan: o, layout: r });
|
|
1353
1353
|
if (r === "column") {
|
|
1354
|
-
const
|
|
1354
|
+
const u = [];
|
|
1355
1355
|
let c = 1;
|
|
1356
|
-
return i.forEach((
|
|
1357
|
-
const s = Pe(
|
|
1358
|
-
|
|
1359
|
-
...
|
|
1356
|
+
return i.forEach((d) => {
|
|
1357
|
+
const s = Pe(d.item), h = n;
|
|
1358
|
+
u.push({
|
|
1359
|
+
...d,
|
|
1360
1360
|
span: h,
|
|
1361
1361
|
colSpan: h,
|
|
1362
1362
|
rowSpan: s,
|
|
@@ -1364,7 +1364,7 @@ const we = (e) => {
|
|
|
1364
1364
|
gridColumn: 1,
|
|
1365
1365
|
gridBand: ie({ gridRow: c })
|
|
1366
1366
|
}), c += s;
|
|
1367
|
-
}), { cells:
|
|
1367
|
+
}), { cells: u, maxSpan: n };
|
|
1368
1368
|
}
|
|
1369
1369
|
return { cells: We(i, n), maxSpan: n };
|
|
1370
1370
|
}, At = (e) => e.map((t) => t.item?.show?.form), Bt = (e, t, n) => {
|
|
@@ -1373,25 +1373,25 @@ const we = (e) => {
|
|
|
1373
1373
|
required: !0,
|
|
1374
1374
|
message: t(e),
|
|
1375
1375
|
trigger: "blur"
|
|
1376
|
-
}, r = le(e), a = e.options?.datetime?.type, i = r === "datetime" && typeof a == "string" && a.includes("range"),
|
|
1377
|
-
(i || r === "checkbox" ||
|
|
1376
|
+
}, r = le(e), a = e.options?.datetime?.type, i = r === "datetime" && typeof a == "string" && a.includes("range"), u = r === "select" && !!e.options?.select?.multiple;
|
|
1377
|
+
(i || r === "checkbox" || u) && (o.type = "array", o.min = i ? 2 : 1);
|
|
1378
1378
|
const c = typeof e.rules == "boolean" ? [o] : e.rules;
|
|
1379
|
-
return n ? c.map((
|
|
1379
|
+
return n ? c.map((d) => n(d)) : c;
|
|
1380
1380
|
}, Xe = (e) => (t, n) => Bt(t, e, (o) => {
|
|
1381
1381
|
const r = (i) => {
|
|
1382
1382
|
if (!n || !Object.prototype.hasOwnProperty.call(n, t.key)) return i;
|
|
1383
|
-
const
|
|
1384
|
-
return
|
|
1383
|
+
const u = n[t.key];
|
|
1384
|
+
return u === void 0 ? i : u;
|
|
1385
1385
|
}, a = (i) => {
|
|
1386
|
-
const
|
|
1387
|
-
return typeof o.transform == "function" ? o.transform(
|
|
1386
|
+
const u = r(i);
|
|
1387
|
+
return typeof o.transform == "function" ? o.transform(u) : u;
|
|
1388
1388
|
};
|
|
1389
1389
|
if (o.validator) {
|
|
1390
1390
|
const i = o.validator;
|
|
1391
1391
|
return {
|
|
1392
1392
|
...o,
|
|
1393
1393
|
transform: a,
|
|
1394
|
-
validator: (
|
|
1394
|
+
validator: (u, c, d) => i(u, c, d, n)
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
1397
|
return {
|
|
@@ -1405,9 +1405,9 @@ const we = (e) => {
|
|
|
1405
1405
|
}, o = (n[le(e) || "input"] || n.input) + e.label;
|
|
1406
1406
|
return (t || W.error.callback)?.(e.key, e) || o;
|
|
1407
1407
|
}, Ze = (e) => Xe((t) => Ye(t, e?.error)), Tt = (e, t, n) => {
|
|
1408
|
-
const o = {}, r = {}, a = t?.maxSpan || 12, i = t?.defaultSpan || a / 2,
|
|
1409
|
-
e.forEach((s) => ve(s, !0)), Fe(e, o, r, (s) =>
|
|
1410
|
-
const { cells: c, maxSpan:
|
|
1408
|
+
const o = {}, r = {}, a = t?.maxSpan || 12, i = t?.defaultSpan || a / 2, u = Ze(t);
|
|
1409
|
+
e.forEach((s) => ve(s, !0)), Fe(e, o, r, (s) => u(s, n));
|
|
1410
|
+
const { cells: c, maxSpan: d } = Qe(e, {
|
|
1411
1411
|
maxSpan: a,
|
|
1412
1412
|
defaultSpan: i,
|
|
1413
1413
|
layout: t?.layout
|
|
@@ -1416,7 +1416,7 @@ const we = (e) => {
|
|
|
1416
1416
|
formDefault: o,
|
|
1417
1417
|
rules: r,
|
|
1418
1418
|
formGrid: c,
|
|
1419
|
-
formMaxSpan:
|
|
1419
|
+
formMaxSpan: d,
|
|
1420
1420
|
formColumn: Je(c)
|
|
1421
1421
|
};
|
|
1422
1422
|
}, Fe = (e, t, n, o) => {
|
|
@@ -1462,7 +1462,7 @@ const we = (e) => {
|
|
|
1462
1462
|
const w = m.gridRow + m.rowSpan - 1;
|
|
1463
1463
|
w > f && (f = w);
|
|
1464
1464
|
}), f;
|
|
1465
|
-
}),
|
|
1465
|
+
}), u = (f) => f.gridRow + f.rowSpan - 1 >= i.value, c = (f) => f.rowSpan >= H, d = (f) => {
|
|
1466
1466
|
const m = f.gridBand ?? ie(f);
|
|
1467
1467
|
return r.value.get(m) ?? m;
|
|
1468
1468
|
}, s = (f) => He(f, o.value, n.form, n.type, {
|
|
@@ -1484,9 +1484,9 @@ const we = (e) => {
|
|
|
1484
1484
|
(g(!0), v(B, null, G(o.value, (w) => (g(), v("div", {
|
|
1485
1485
|
key: w.item.key,
|
|
1486
1486
|
class: J(["curd-form-grid-cell", [
|
|
1487
|
-
e.stripe !== !1 &&
|
|
1487
|
+
e.stripe !== !1 && d(w) % 2 === 0 ? "stripe-band-odd" : "",
|
|
1488
1488
|
w.gridColumn > 1 ? "has-col-border" : "",
|
|
1489
|
-
e.stripe !== !1 &&
|
|
1489
|
+
e.stripe !== !1 && u(w) ? "is-last-row" : "",
|
|
1490
1490
|
c(w) ? "is-row-span" : "",
|
|
1491
1491
|
`form-item-col-${w.item.key}`
|
|
1492
1492
|
]]),
|
|
@@ -1536,9 +1536,9 @@ const we = (e) => {
|
|
|
1536
1536
|
setup(e, { expose: t }) {
|
|
1537
1537
|
const n = $.EDialog, o = X(), r = e;
|
|
1538
1538
|
let a = we(r.form);
|
|
1539
|
-
const i = Me.getConf("curdConf"),
|
|
1539
|
+
const i = Me.getConf("curdConf"), u = "formRef-" + StrUtil.getId();
|
|
1540
1540
|
Le(() => {
|
|
1541
|
-
i?.formRef?.remove(
|
|
1541
|
+
i?.formRef?.remove(u);
|
|
1542
1542
|
});
|
|
1543
1543
|
const c = re({
|
|
1544
1544
|
rules: {},
|
|
@@ -1551,37 +1551,37 @@ const we = (e) => {
|
|
|
1551
1551
|
get form() {
|
|
1552
1552
|
return a.get();
|
|
1553
1553
|
},
|
|
1554
|
-
set form(
|
|
1555
|
-
a.set(
|
|
1554
|
+
set form(d) {
|
|
1555
|
+
a.set(d);
|
|
1556
1556
|
},
|
|
1557
|
-
getDisabled: (
|
|
1558
|
-
getBind: (
|
|
1559
|
-
getOn: (
|
|
1557
|
+
getDisabled: (d) => Ie(d, c.type, c.form),
|
|
1558
|
+
getBind: (d) => Ne(d, c.type),
|
|
1559
|
+
getOn: (d) => Ge(d, c.type, [c.form, d]),
|
|
1560
1560
|
initColumnForm: () => {
|
|
1561
|
-
const
|
|
1562
|
-
c.formDefault = s.formDefault, c.rules = s.rules, c.formGrid = s.formGrid, c.formMaxSpan = s.formMaxSpan, c.formColumn = s.formColumn, c.type === n.Add ?
|
|
1561
|
+
const d = a, s = Tt(r.option.column, r.option.form, d.get());
|
|
1562
|
+
c.formDefault = s.formDefault, c.rules = s.rules, c.formGrid = s.formGrid, c.formMaxSpan = s.formMaxSpan, c.formColumn = s.formColumn, c.type === n.Add ? d.isExternal() ? d.merge(JSONUtil.cp(c.formDefault)) : d.set(JSONUtil.cp(c.formDefault)) : !d.isExternal() && r.form && d.set(JSONUtil.cp(r.form));
|
|
1563
1563
|
}
|
|
1564
1564
|
});
|
|
1565
|
-
return i?.formRef?.set(
|
|
1566
|
-
validate: async (
|
|
1565
|
+
return i?.formRef?.set(u, {
|
|
1566
|
+
validate: async (d) => {
|
|
1567
1567
|
const s = o.value;
|
|
1568
1568
|
if (!s)
|
|
1569
|
-
return
|
|
1569
|
+
return d?.(!0), !0;
|
|
1570
1570
|
const h = De(c.formGrid || [], c.form, c.type, c.formMaxSpan).map((w) => w.item.key).filter(Boolean), f = Object.keys(c.rules || {}).filter((w) => !h.includes(w));
|
|
1571
1571
|
if (f.length && s.clearValidate(f), !h.length)
|
|
1572
|
-
return
|
|
1572
|
+
return d?.(!0), !0;
|
|
1573
1573
|
const m = await s.validateField(h, async (w, D) => {
|
|
1574
1574
|
w || me(ke(D));
|
|
1575
1575
|
});
|
|
1576
|
-
if (
|
|
1576
|
+
if (d?.(!!m), !m) throw !1;
|
|
1577
1577
|
return !0;
|
|
1578
1578
|
}
|
|
1579
1579
|
}), r.option.form?.initStart?.(c), c.initColumnForm(), r.option.form?.initEnd?.(c), gt(
|
|
1580
1580
|
() => r.form,
|
|
1581
|
-
(
|
|
1582
|
-
a = we(
|
|
1581
|
+
(d) => {
|
|
1582
|
+
a = we(d), c.initColumnForm();
|
|
1583
1583
|
}
|
|
1584
|
-
), t({ ref: o, conf: c }), (
|
|
1584
|
+
), t({ ref: o, conf: c }), (d, s) => (g(), b(l(oe), {
|
|
1585
1585
|
ref_key: "ruleFormRef",
|
|
1586
1586
|
ref: o,
|
|
1587
1587
|
model: c.form,
|
|
@@ -1601,10 +1601,10 @@ const we = (e) => {
|
|
|
1601
1601
|
"get-on": c.getOn,
|
|
1602
1602
|
"get-disabled": c.getDisabled
|
|
1603
1603
|
}, Y({ _: 2 }, [
|
|
1604
|
-
G(
|
|
1604
|
+
G(d.$slots, (h, f) => ({
|
|
1605
1605
|
name: f,
|
|
1606
1606
|
fn: p((m) => [
|
|
1607
|
-
S(
|
|
1607
|
+
S(d.$slots, f, $e(ze(m || {})))
|
|
1608
1608
|
])
|
|
1609
1609
|
}))
|
|
1610
1610
|
]), 1032, ["form-grid", "max-span", "form", "type", "stripe", "label-width", "form-option", "get-bind", "get-on", "get-disabled"])) : V("", !0)
|
|
@@ -1616,13 +1616,13 @@ const we = (e) => {
|
|
|
1616
1616
|
const t = Kt(e);
|
|
1617
1617
|
return t?.validate ? new Promise((n, o) => {
|
|
1618
1618
|
let r = !1;
|
|
1619
|
-
const a = (i,
|
|
1620
|
-
r || (r = !0, i === !1 ? (me(ke(
|
|
1619
|
+
const a = (i, u) => {
|
|
1620
|
+
r || (r = !0, i === !1 ? (me(ke(u)), o(!1)) : n(!0));
|
|
1621
1621
|
};
|
|
1622
1622
|
try {
|
|
1623
1623
|
const i = t.validate(a);
|
|
1624
|
-
i && typeof i.then == "function" ? i.then((
|
|
1625
|
-
me(ke(
|
|
1624
|
+
i && typeof i.then == "function" ? i.then((u) => a(u)).catch((u) => {
|
|
1625
|
+
me(ke(u?.fields || u)), o(u);
|
|
1626
1626
|
}) : (i !== void 0 || t.validate.length === 0) && a(i);
|
|
1627
1627
|
} catch (i) {
|
|
1628
1628
|
o(i);
|
|
@@ -1747,8 +1747,8 @@ const we = (e) => {
|
|
|
1747
1747
|
else {
|
|
1748
1748
|
const r = (a) => {
|
|
1749
1749
|
let i = [];
|
|
1750
|
-
return a.forEach((
|
|
1751
|
-
i.push(
|
|
1750
|
+
return a.forEach((u) => {
|
|
1751
|
+
i.push(u[t.option.table.rowKey]), u.children?.length && (i = i.concat(r(u.children)));
|
|
1752
1752
|
}), i;
|
|
1753
1753
|
};
|
|
1754
1754
|
o.table.expand.rowKeys = r(o.table.data);
|
|
@@ -1770,8 +1770,8 @@ const we = (e) => {
|
|
|
1770
1770
|
const o = e(), r = !o.table.header.group.expand;
|
|
1771
1771
|
o.table.header.group.expand = r;
|
|
1772
1772
|
const a = (i) => {
|
|
1773
|
-
i.forEach((
|
|
1774
|
-
|
|
1773
|
+
i.forEach((u) => {
|
|
1774
|
+
u.table?.header?.group !== void 0 && (u.table.header.group = !r), u.table?.header?.groupKey !== void 0 && (u.table.header.show = r), Array.isArray(u.children) && u.children.length && a(u.children);
|
|
1775
1775
|
});
|
|
1776
1776
|
};
|
|
1777
1777
|
a(o.table.column.list);
|
|
@@ -1792,14 +1792,14 @@ const we = (e) => {
|
|
|
1792
1792
|
[D.field]: o.table.sort.order
|
|
1793
1793
|
};
|
|
1794
1794
|
}
|
|
1795
|
-
const
|
|
1795
|
+
const u = await r({
|
|
1796
1796
|
...o.page.getQuery(),
|
|
1797
1797
|
...i
|
|
1798
|
-
}), c = L.config.field.result,
|
|
1798
|
+
}), c = L.config.field.result, d = u.data || { [c.list]: u }, s = (Array.isArray(d[c.list]), d[c.list]), h = qe(o.update.formGrid?.length ? o.update.formGrid : o.update.formColumn), m = ObjectUtil.deepMerge({ data: s }, {}).data.map((w) => (Object.keys(w).forEach((T) => {
|
|
1799
1799
|
const O = h.find((A) => A.item.key === T);
|
|
1800
1800
|
O && ["select", "radio"].includes(O.item.type) && (O.item.table.format || (O.item.table.format = (A) => O.item.options[O.item.type].data?.find((de) => de.value == A[T])?.label || A[T]));
|
|
1801
1801
|
}), w));
|
|
1802
|
-
o.table.data = t.option.data ? await t.option.data(m, s) : m, o.tableEditValidate?.clear?.(), o.page.total =
|
|
1802
|
+
o.table.data = t.option.data ? await t.option.data(m, s) : m, o.tableEditValidate?.clear?.(), o.page.total = d[c.total] || 0, setTimeout(() => {
|
|
1803
1803
|
o.table.selection.setList(a);
|
|
1804
1804
|
}, 20);
|
|
1805
1805
|
} catch (i) {
|
|
@@ -1818,12 +1818,12 @@ const we = (e) => {
|
|
|
1818
1818
|
a.table.selection.list = [];
|
|
1819
1819
|
const i = n.tableRef.value;
|
|
1820
1820
|
if (i?.clearSelection(), !i || !o?.length) return;
|
|
1821
|
-
const
|
|
1821
|
+
const u = t.option.table?.rowKey, c = (d) => {
|
|
1822
1822
|
const s = (h) => {
|
|
1823
1823
|
for (const f of h) {
|
|
1824
|
-
if (
|
|
1825
|
-
if (f[
|
|
1826
|
-
} else if (f ===
|
|
1824
|
+
if (u != null && u !== "") {
|
|
1825
|
+
if (f[u] === d[u]) return f;
|
|
1826
|
+
} else if (f === d)
|
|
1827
1827
|
return f;
|
|
1828
1828
|
if (Array.isArray(f.children) && f.children.length) {
|
|
1829
1829
|
const m = s(f.children);
|
|
@@ -1833,12 +1833,12 @@ const we = (e) => {
|
|
|
1833
1833
|
};
|
|
1834
1834
|
return s(a.table.data);
|
|
1835
1835
|
};
|
|
1836
|
-
o.forEach((
|
|
1837
|
-
const s = c(
|
|
1836
|
+
o.forEach((d) => {
|
|
1837
|
+
const s = c(d);
|
|
1838
1838
|
if (s)
|
|
1839
1839
|
if (r) {
|
|
1840
1840
|
const h = () => i.toggleRowSelection(s, !0, !1);
|
|
1841
|
-
r(
|
|
1841
|
+
r(d) !== !1 && h();
|
|
1842
1842
|
} else
|
|
1843
1843
|
i.toggleRowSelection(s, !0, !1);
|
|
1844
1844
|
});
|
|
@@ -1868,13 +1868,13 @@ const we = (e) => {
|
|
|
1868
1868
|
}, i = (y) => {
|
|
1869
1869
|
const k = t.option.table?.rowKey, z = k ? y[k] : void 0;
|
|
1870
1870
|
return z != null && z !== "" ? String(z) : a(y);
|
|
1871
|
-
},
|
|
1871
|
+
}, u = (y, k) => `${i(y)}-${k.key}`, c = (y) => Ye(y, t.option.form?.error), d = Xe(c), s = () => {
|
|
1872
1872
|
Object.keys(n).forEach((y) => {
|
|
1873
1873
|
delete n[y];
|
|
1874
1874
|
});
|
|
1875
1875
|
}, h = (y, k) => {
|
|
1876
|
-
delete n[
|
|
1877
|
-
}, f = (y, k) => n[
|
|
1876
|
+
delete n[u(y, k)];
|
|
1877
|
+
}, f = (y, k) => n[u(y, k)] || "", m = (y, k) => y.message || c(k), w = (y) => y == null || y === "" || Array.isArray(y) && y.length === 0, D = (y) => {
|
|
1878
1878
|
if (typeof y == "number") return y;
|
|
1879
1879
|
if (typeof y == "string" || Array.isArray(y)) return y.length;
|
|
1880
1880
|
}, T = (y, k) => {
|
|
@@ -1945,14 +1945,14 @@ const we = (e) => {
|
|
|
1945
1945
|
}, xe = async (y, k) => {
|
|
1946
1946
|
if (!Ce(k, y))
|
|
1947
1947
|
return h(y, k), !0;
|
|
1948
|
-
const z =
|
|
1948
|
+
const z = d(k, y);
|
|
1949
1949
|
if (!z) return !0;
|
|
1950
1950
|
h(y, k);
|
|
1951
1951
|
const K = Array.isArray(z) ? z : [z];
|
|
1952
1952
|
for (const P of K) {
|
|
1953
1953
|
const j = await A(P, y[k.key], k);
|
|
1954
1954
|
if (j !== !0)
|
|
1955
|
-
return n[
|
|
1955
|
+
return n[u(y, k)] = j, {
|
|
1956
1956
|
field: k.key,
|
|
1957
1957
|
error: j
|
|
1958
1958
|
};
|
|
@@ -1993,12 +1993,12 @@ class Jt {
|
|
|
1993
1993
|
static exportToExcel = async (t, n, o) => {
|
|
1994
1994
|
if (!t || t.length === 0) return;
|
|
1995
1995
|
const r = await $.loadModule("xlsx"), a = t.map((c) => {
|
|
1996
|
-
const
|
|
1996
|
+
const d = {};
|
|
1997
1997
|
return n.forEach((s) => {
|
|
1998
|
-
|
|
1999
|
-
}),
|
|
2000
|
-
}), i = r.utils.json_to_sheet(a),
|
|
2001
|
-
r.utils.book_append_sheet(
|
|
1998
|
+
d[s.label] = c[s.key];
|
|
1999
|
+
}), d;
|
|
2000
|
+
}), i = r.utils.json_to_sheet(a), u = r.utils.book_new();
|
|
2001
|
+
r.utils.book_append_sheet(u, i, "Sheet1"), o ? typeof o == "function" && (o = o()) : o = `导出数据_${(/* @__PURE__ */ new Date()).Format("yyyy-MM-dd")}_${(/* @__PURE__ */ new Date()).getTime()}`, r.writeFile(u, `${o}.xlsx`);
|
|
2002
2002
|
};
|
|
2003
2003
|
}
|
|
2004
2004
|
const qt = (e, t) => ({
|
|
@@ -2006,8 +2006,8 @@ const qt = (e, t) => ({
|
|
|
2006
2006
|
run: {
|
|
2007
2007
|
start: async (n) => {
|
|
2008
2008
|
let r = await e().export.run[n]();
|
|
2009
|
-
const a = t.option.column, i = ObjectUtil.deepMerge({ data: r, columns: a }, {}),
|
|
2010
|
-
|
|
2009
|
+
const a = t.option.column, i = ObjectUtil.deepMerge({ data: r, columns: a }, {}), u = t.option.tools?.export || {};
|
|
2010
|
+
u.before?.(i), Jt.exportToExcel(i.data, i.columns, u.fileName);
|
|
2011
2011
|
},
|
|
2012
2012
|
select: async () => {
|
|
2013
2013
|
const n = e();
|
|
@@ -2125,28 +2125,28 @@ const qt = (e, t) => ({
|
|
|
2125
2125
|
o.initCurdConfig(), o.initColumnOptions(), o.initColumnForm();
|
|
2126
2126
|
},
|
|
2127
2127
|
initApiData: async (o) => {
|
|
2128
|
-
const r = e(), a = [], i = (
|
|
2129
|
-
if (
|
|
2130
|
-
|
|
2128
|
+
const r = e(), a = [], i = (u) => {
|
|
2129
|
+
if (u.children?.length) {
|
|
2130
|
+
u.children.forEach((d) => i(d));
|
|
2131
2131
|
return;
|
|
2132
2132
|
}
|
|
2133
|
-
const c = le(
|
|
2134
|
-
if (
|
|
2135
|
-
if (r.apiDataMap[
|
|
2136
|
-
const
|
|
2133
|
+
const c = le(u);
|
|
2134
|
+
if (u.options?.[c]?.dataApi && u.options?.[c]?.dataApiConfig?.[o]) {
|
|
2135
|
+
if (r.apiDataMap[u.key] && u.options?.[c]?.dataApiConfig?.once) return;
|
|
2136
|
+
const d = (async () => {
|
|
2137
2137
|
try {
|
|
2138
|
-
let s = await
|
|
2138
|
+
let s = await u.options?.[c]?.dataApi?.(r.update.form, r.update.type);
|
|
2139
2139
|
if (s) {
|
|
2140
|
-
const h =
|
|
2141
|
-
!Array.isArray(s) && h && (s = ObjectUtil.getPathValue(s, h)),
|
|
2140
|
+
const h = u.options?.[c]?.dataPath;
|
|
2141
|
+
!Array.isArray(s) && h && (s = ObjectUtil.getPathValue(s, h)), u.options[c].data = s, u.options.search[c].data = s, u.options.search[u.options.search.type ?? c] || (u.options.search[u.options.search.type ?? c] = {}), u.options.search[u.options.search.type ?? c].data = s, u.options.formAdd[c].data = s, u.options.formUpdate[c].data = s, r.apiDataMap[u.key] = s;
|
|
2142
2142
|
}
|
|
2143
2143
|
} catch {
|
|
2144
2144
|
}
|
|
2145
2145
|
})();
|
|
2146
|
-
a.push(
|
|
2146
|
+
a.push(d);
|
|
2147
2147
|
}
|
|
2148
2148
|
};
|
|
2149
|
-
return t.option.column.forEach((
|
|
2149
|
+
return t.option.column.forEach((u) => i(u)), await Promise.all(a), !0;
|
|
2150
2150
|
},
|
|
2151
2151
|
initCurdConfig: () => {
|
|
2152
2152
|
const o = ObjectUtil.deepMerge(L.config, {});
|
|
@@ -2169,19 +2169,19 @@ const qt = (e, t) => ({
|
|
|
2169
2169
|
r.options
|
|
2170
2170
|
);
|
|
2171
2171
|
const a = (i) => {
|
|
2172
|
-
const
|
|
2173
|
-
for (const
|
|
2174
|
-
if (
|
|
2172
|
+
const u = le(i);
|
|
2173
|
+
for (const d in r) {
|
|
2174
|
+
if (d === "table") {
|
|
2175
2175
|
if (i.table = ObjectUtil.deepMerge(r.table, i.table || {}), i.children) {
|
|
2176
2176
|
i.children.forEach((s) => a(s));
|
|
2177
2177
|
return;
|
|
2178
2178
|
}
|
|
2179
|
-
} else
|
|
2180
|
-
i.options = i.options || {}, i.options[
|
|
2179
|
+
} else d === "type" ? i.type = i.type || r.type : i[d] = ObjectUtil.deepMerge(r[d], i[d] || {});
|
|
2180
|
+
i.options = i.options || {}, i.options[u] = i.options[u] || {}, i.options[u].size = t.option.size.form;
|
|
2181
2181
|
}
|
|
2182
|
-
["search", "formAdd", "formUpdate"].forEach((
|
|
2183
|
-
i.options[
|
|
2184
|
-
}), i.table = ObjectUtil.deepMerge(i.table, i.options[
|
|
2182
|
+
["search", "formAdd", "formUpdate"].forEach((d) => {
|
|
2183
|
+
i.options[d] = ObjectUtil.deepMerge(i.options, i.options[d] || {}), d === "search" ? t.option.size.search && (i.options[d][u].size = t.option.size.search) : t.option.size.form && (i.options[d][u].size = t.option.size.form);
|
|
2184
|
+
}), i.table = ObjectUtil.deepMerge(i.table, i.options[u].table || {}), u === "switch" && (i.options.switch.tableBeforeChange = async (d, s) => {
|
|
2185
2185
|
const h = i.options?.switch;
|
|
2186
2186
|
try {
|
|
2187
2187
|
h.tableConfig?.confirm && await n.switchConfirmRef.value?.open({
|
|
@@ -2192,10 +2192,10 @@ const qt = (e, t) => ({
|
|
|
2192
2192
|
if (!t.option.api.update && !h.tableConfig?.api) return;
|
|
2193
2193
|
const f = s[t.option.table?.rowKey];
|
|
2194
2194
|
h.loadingMap || (h.loadingMap = {}), h.loadingMap[f] || (h.loadingMap[f] = { loading: !1 }), h.loadingMap[f].loading = !0;
|
|
2195
|
-
const m = s[
|
|
2195
|
+
const m = s[d] === h.activeValue ? h.inactiveValue : h.activeValue, w = h.tableConfig?.api ? h.tableConfig.api : t.option.api.update;
|
|
2196
2196
|
if (!w) return;
|
|
2197
2197
|
try {
|
|
2198
|
-
await w({ ...s, [
|
|
2198
|
+
await w({ ...s, [d]: m }, "switch");
|
|
2199
2199
|
} catch {
|
|
2200
2200
|
return !1;
|
|
2201
2201
|
} finally {
|
|
@@ -2210,14 +2210,14 @@ const qt = (e, t) => ({
|
|
|
2210
2210
|
} catch {
|
|
2211
2211
|
return !1;
|
|
2212
2212
|
}
|
|
2213
|
-
}),
|
|
2213
|
+
}), u === "treeSelect" && (i.options.treeSelect.rowKey = t.option.table?.rowKey, i.options.treeSelect.nodeKey = t.option.table?.rowKey);
|
|
2214
2214
|
};
|
|
2215
2215
|
t.option.column.forEach(a), t.option.table?.column?.forEach(a);
|
|
2216
2216
|
},
|
|
2217
2217
|
initColumnForm: () => {
|
|
2218
2218
|
const o = e(), r = t.option;
|
|
2219
2219
|
o.update.formColumn = [], o.update.formGrid = [], o.update.formMaxSpan = 12, o.table.column.show = { list: [], listSource: [] };
|
|
2220
|
-
const a = t.option.form?.maxSpan || 12, i = t.option.form?.defaultSpan || a / 2,
|
|
2220
|
+
const a = t.option.form?.maxSpan || 12, i = t.option.form?.defaultSpan || a / 2, u = Ze(t.option.form), c = (f) => {
|
|
2221
2221
|
if (f.children) {
|
|
2222
2222
|
o.table.column.show.list.push(f.key), f.children.forEach((m) => c(m));
|
|
2223
2223
|
return;
|
|
@@ -2228,13 +2228,13 @@ const qt = (e, t) => ({
|
|
|
2228
2228
|
ve(f, !0), c(f);
|
|
2229
2229
|
}), t.option.table?.column?.forEach((f) => {
|
|
2230
2230
|
ve(f, !1), c(f);
|
|
2231
|
-
}), o.search.column.list = r.column.concat(r.table?.column || []), o.table.column.list = o.search.column.list.filter((f) => f.table?.table), o.search.column.list.sort((f, m) => f.sort?.search - m.sort?.search), o.table.column.list.sort((f, m) => f.sort?.table - m.sort?.table), o.update.rules = {}, Fe(r.column, o.update.formDefault, o.update.rules, (f) =>
|
|
2232
|
-
const
|
|
2231
|
+
}), o.search.column.list = r.column.concat(r.table?.column || []), o.table.column.list = o.search.column.list.filter((f) => f.table?.table), o.search.column.list.sort((f, m) => f.sort?.search - m.sort?.search), o.table.column.list.sort((f, m) => f.sort?.table - m.sort?.table), o.update.rules = {}, Fe(r.column, o.update.formDefault, o.update.rules, (f) => u(f, o.update.form)), r.table?.editMode && Fe(r.table?.column || [], o.update.formDefault, o.update.rules, (f) => u(f, o.update.form));
|
|
2232
|
+
const d = Qe(r.column, {
|
|
2233
2233
|
maxSpan: a,
|
|
2234
2234
|
defaultSpan: i,
|
|
2235
2235
|
layout: t.option.form?.layout
|
|
2236
2236
|
});
|
|
2237
|
-
o.update.formGrid =
|
|
2237
|
+
o.update.formGrid = d.cells, o.update.formMaxSpan = d.maxSpan, o.update.formColumn = Je(d.cells);
|
|
2238
2238
|
const s = t.option.search?.formDefault;
|
|
2239
2239
|
s && Object.keys(s).forEach((f) => {
|
|
2240
2240
|
o.search.formDefault[f] = s[f];
|
|
@@ -2245,30 +2245,29 @@ const qt = (e, t) => ({
|
|
|
2245
2245
|
Z.setValue(o.search.form, h, !0);
|
|
2246
2246
|
}
|
|
2247
2247
|
}), Yt = (e) => {
|
|
2248
|
-
const t = X(), n = X(), o = X(), r = { switchConfirmRef: t, ruleFormRef: n, tableRef: o }, a = je(), i = Me.getConf("curdConf")
|
|
2249
|
-
let d;
|
|
2250
|
-
const c = (h) => {
|
|
2248
|
+
const t = X(), n = X(), o = X(), r = { switchConfirmRef: t, ruleFormRef: n, tableRef: o }, a = je(), i = Me.getConf("curdConf"), u = (h) => {
|
|
2251
2249
|
h = h || d;
|
|
2252
2250
|
let f = h, m = h;
|
|
2253
2251
|
for (; f?.parentCurdConf; )
|
|
2254
2252
|
m = f.parentCurdConf, f = f.parentCurdConf;
|
|
2255
2253
|
return m;
|
|
2256
|
-
},
|
|
2257
|
-
d = re({
|
|
2254
|
+
}, c = () => d;
|
|
2255
|
+
let d = re({
|
|
2258
2256
|
parentCurdConf: i,
|
|
2259
|
-
getCurdConf:
|
|
2260
|
-
getRootCurdConf:
|
|
2257
|
+
getCurdConf: u,
|
|
2258
|
+
getRootCurdConf: u,
|
|
2261
2259
|
...It(),
|
|
2262
2260
|
option: e.option,
|
|
2263
|
-
...Nt(
|
|
2264
|
-
...Gt(
|
|
2265
|
-
...Ht(
|
|
2266
|
-
...Wt(
|
|
2267
|
-
...qt(
|
|
2268
|
-
...Mt(
|
|
2269
|
-
...Qt(
|
|
2270
|
-
...Xt(
|
|
2271
|
-
})
|
|
2261
|
+
...Nt(c, e),
|
|
2262
|
+
...Gt(c, e),
|
|
2263
|
+
...Ht(c, e, r),
|
|
2264
|
+
...Wt(c, e),
|
|
2265
|
+
...qt(c, e),
|
|
2266
|
+
...Mt(c, e, r),
|
|
2267
|
+
...Qt(c, e),
|
|
2268
|
+
...Xt(c, e, r)
|
|
2269
|
+
});
|
|
2270
|
+
d.init();
|
|
2272
2271
|
const s = a ? `curdRef-${a.uid}` : "";
|
|
2273
2272
|
return i?.formRef && s && (i.formRef.set(s, {
|
|
2274
2273
|
validate: async (h) => {
|
|
@@ -2289,15 +2288,15 @@ const qt = (e, t) => ({
|
|
|
2289
2288
|
setup(e, { expose: t }) {
|
|
2290
2289
|
const n = X(!1), o = X("确认修改"), r = X("确认要修改状态吗?");
|
|
2291
2290
|
let a = null, i = null;
|
|
2292
|
-
const
|
|
2291
|
+
const u = (s) => (s?.title && (o.value = s.title), s?.content && (r.value = s.content), n.value = !0, new Promise((h, f) => {
|
|
2293
2292
|
a = h, i = f;
|
|
2294
2293
|
})), c = () => {
|
|
2295
2294
|
n.value = !1, a?.(!0), a = null, i = null;
|
|
2296
|
-
},
|
|
2295
|
+
}, d = () => {
|
|
2297
2296
|
n.value = !1, i?.(new Error("用户取消操作")), a = null, i = null;
|
|
2298
2297
|
};
|
|
2299
2298
|
return t({
|
|
2300
|
-
open:
|
|
2299
|
+
open: u
|
|
2301
2300
|
}), (s, h) => {
|
|
2302
2301
|
const f = fe("el-form");
|
|
2303
2302
|
return g(), b(l(Ee), {
|
|
@@ -2311,7 +2310,7 @@ const qt = (e, t) => ({
|
|
|
2311
2310
|
F(f, { size: e.size }, {
|
|
2312
2311
|
default: p(() => [
|
|
2313
2312
|
R("span", Zt, [
|
|
2314
|
-
F(l(N), { onClick:
|
|
2313
|
+
F(l(N), { onClick: d }, {
|
|
2315
2314
|
default: p(() => [...h[1] || (h[1] = [
|
|
2316
2315
|
M("取消", -1)
|
|
2317
2316
|
])]),
|
|
@@ -2534,9 +2533,9 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2534
2533
|
option: {}
|
|
2535
2534
|
},
|
|
2536
2535
|
setup(e) {
|
|
2537
|
-
const t = $.isFun, n = e, r = je().type, a = (
|
|
2538
|
-
return (
|
|
2539
|
-
const
|
|
2536
|
+
const t = $.isFun, n = e, r = je().type, a = (u) => u === !0 ? !0 : (Array.isArray(u) ? u : u ? [u] : []).some((d) => d?.required === !0), i = (u) => n.option.table?.editMode ? a(u.rules) || a(n.conf.update.rules?.[u.key]) : !1;
|
|
2537
|
+
return (u, c) => {
|
|
2538
|
+
const d = fe("el-tooltip");
|
|
2540
2539
|
return g(!0), v(B, null, G(e.columnList, (s) => (g(), v(B, {
|
|
2541
2540
|
key: s.key
|
|
2542
2541
|
}, [
|
|
@@ -2547,9 +2546,9 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2547
2546
|
label: s.label
|
|
2548
2547
|
}, { ref_for: !0 }, s.table), {
|
|
2549
2548
|
header: p(() => [
|
|
2550
|
-
S(
|
|
2549
|
+
S(u.$slots, "table-header-" + s.key, { item: s }, () => [
|
|
2551
2550
|
R("div", $o, [
|
|
2552
|
-
s.table?.header?.tooltip ? (g(), b(
|
|
2551
|
+
s.table?.header?.tooltip ? (g(), b(d, {
|
|
2553
2552
|
key: 0,
|
|
2554
2553
|
effect: "dark",
|
|
2555
2554
|
placement: "top"
|
|
@@ -2593,10 +2592,10 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2593
2592
|
columnList: s.children,
|
|
2594
2593
|
option: e.option
|
|
2595
2594
|
}, Y({ _: 2 }, [
|
|
2596
|
-
G(
|
|
2595
|
+
G(u.$slots, (f, m) => ({
|
|
2597
2596
|
name: m,
|
|
2598
2597
|
fn: p((w) => [
|
|
2599
|
-
S(
|
|
2598
|
+
S(u.$slots, m, x({ ref_for: !0 }, w || {}))
|
|
2600
2599
|
])
|
|
2601
2600
|
}))
|
|
2602
2601
|
]), 1032, ["conf", "columnList", "option"]))
|
|
@@ -2612,7 +2611,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2612
2611
|
class: J(["row", ["table-edit-" + s.key]]),
|
|
2613
2612
|
style: { width: "100%" }
|
|
2614
2613
|
}, [
|
|
2615
|
-
S(
|
|
2614
|
+
S(u.$slots, "table-edit-left-" + s.key, {
|
|
2616
2615
|
row: h,
|
|
2617
2616
|
item: s
|
|
2618
2617
|
}),
|
|
@@ -2658,7 +2657,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2658
2657
|
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2659
2658
|
"onUpdate:modelValue": (f) => e.conf.tableEditValidate.clearField(h, s)
|
|
2660
2659
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : V("", !0),
|
|
2661
|
-
S(
|
|
2660
|
+
S(u.$slots, "table-edit-right-" + s.key, {
|
|
2662
2661
|
row: h,
|
|
2663
2662
|
item: s
|
|
2664
2663
|
})
|
|
@@ -2702,7 +2701,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2702
2701
|
}, { ref_for: !0 }, e.conf.update.getBind(s), E(e.conf.update.getOn(s, h)), {
|
|
2703
2702
|
disabled: e.conf.update.getDisabled(s, !0)
|
|
2704
2703
|
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : V("", !0)
|
|
2705
|
-
], 64)) : S(
|
|
2704
|
+
], 64)) : S(u.$slots, "table-" + s.key, {
|
|
2706
2705
|
key: 1,
|
|
2707
2706
|
row: h,
|
|
2708
2707
|
item: s
|
|
@@ -2773,10 +2772,10 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2773
2772
|
}
|
|
2774
2773
|
},
|
|
2775
2774
|
setup(e, { expose: t }) {
|
|
2776
|
-
const n = $.EDialog, o = e, r = $.isFun, { conf: a, switchConfirmRef: i, ruleFormRef:
|
|
2775
|
+
const n = $.EDialog, o = e, r = $.isFun, { conf: a, switchConfirmRef: i, ruleFormRef: u, tableRef: c } = Yt(o);
|
|
2777
2776
|
return t({
|
|
2778
2777
|
conf: a
|
|
2779
|
-
}), (
|
|
2778
|
+
}), (d, s) => {
|
|
2780
2779
|
const h = fe("el-tooltip"), f = yt("loading");
|
|
2781
2780
|
return g(), v("div", {
|
|
2782
2781
|
class: J(["relative cc1-form-box", [e.option.table?.fitHeight ? "col" : "no-min-height"]])
|
|
@@ -2785,7 +2784,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2785
2784
|
class: J(["row", [e.option.table?.fitHeight ? "absolute fit" : ""]]),
|
|
2786
2785
|
style: { overflow: "hidden" }
|
|
2787
2786
|
}, [
|
|
2788
|
-
S(
|
|
2787
|
+
S(d.$slots, "box-left"),
|
|
2789
2788
|
R("div", {
|
|
2790
2789
|
class: J(["column fit-width no-wrap", [e.option.table?.fitHeight ? "col" : ""]])
|
|
2791
2790
|
}, [
|
|
@@ -2796,13 +2795,13 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2796
2795
|
size: e.option.size?.search
|
|
2797
2796
|
}, {
|
|
2798
2797
|
default: p(() => [
|
|
2799
|
-
S(
|
|
2798
|
+
S(d.$slots, "search-start", {
|
|
2800
2799
|
row: l(a).search.form
|
|
2801
2800
|
}),
|
|
2802
2801
|
(g(!0), v(B, null, G(l(a).search.column.list, (m) => (g(), v(B, {
|
|
2803
2802
|
key: m.key
|
|
2804
2803
|
}, [
|
|
2805
|
-
S(
|
|
2804
|
+
S(d.$slots, "search-" + m.key + "-start", {
|
|
2806
2805
|
row: l(a).search.form
|
|
2807
2806
|
}),
|
|
2808
2807
|
(typeof m.show?.search == "function" ? m.show?.search(l(a).search.form) : m.show?.search) ? (g(), b(l(be), {
|
|
@@ -2810,10 +2809,10 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2810
2809
|
label: m.text?.search?.label ?? m.label
|
|
2811
2810
|
}, {
|
|
2812
2811
|
default: p(() => [
|
|
2813
|
-
S(
|
|
2812
|
+
S(d.$slots, "search-" + m.key + "-left", {
|
|
2814
2813
|
row: l(a).search.form
|
|
2815
2814
|
}),
|
|
2816
|
-
S(
|
|
2815
|
+
S(d.$slots, "search-" + m.key, {
|
|
2817
2816
|
row: l(a).search.form
|
|
2818
2817
|
}, () => [
|
|
2819
2818
|
m.options?.search?.type ? (g(), b(Re, {
|
|
@@ -2828,17 +2827,17 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2828
2827
|
type: m.type
|
|
2829
2828
|
}, null, 8, ["item", "conf", "type"]))
|
|
2830
2829
|
]),
|
|
2831
|
-
S(
|
|
2830
|
+
S(d.$slots, "search-" + m.key + "-right", {
|
|
2832
2831
|
row: l(a).search.form
|
|
2833
2832
|
})
|
|
2834
2833
|
]),
|
|
2835
2834
|
_: 2
|
|
2836
2835
|
}, 1032, ["label"])) : V("", !0),
|
|
2837
|
-
S(
|
|
2836
|
+
S(d.$slots, "search-" + m.key + "-end", {
|
|
2838
2837
|
row: l(a).search.form
|
|
2839
2838
|
})
|
|
2840
2839
|
], 64))), 128)),
|
|
2841
|
-
S(
|
|
2840
|
+
S(d.$slots, "search-center", {
|
|
2842
2841
|
row: l(a).search.form
|
|
2843
2842
|
}),
|
|
2844
2843
|
e.option.tools?.search || e.option.tools?.reset ? (g(), b(l(be), { key: 0 }, {
|
|
@@ -2865,7 +2864,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2865
2864
|
]),
|
|
2866
2865
|
_: 1
|
|
2867
2866
|
})) : V("", !0),
|
|
2868
|
-
S(
|
|
2867
|
+
S(d.$slots, "search-end", {
|
|
2869
2868
|
row: l(a).search.form
|
|
2870
2869
|
})
|
|
2871
2870
|
]),
|
|
@@ -2980,10 +2979,10 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
2980
2979
|
}, 8, ["loading", "size"])
|
|
2981
2980
|
]))
|
|
2982
2981
|
], 64)) : V("", !0),
|
|
2983
|
-
S(
|
|
2982
|
+
S(d.$slots, "tools-left")
|
|
2984
2983
|
]),
|
|
2985
2984
|
R("div", Go, [
|
|
2986
|
-
S(
|
|
2985
|
+
S(d.$slots, "tools-right"),
|
|
2987
2986
|
l(a).page.showTools ? (g(), b(l(Oe), x({
|
|
2988
2987
|
key: 0,
|
|
2989
2988
|
"current-page": l(a).page.num,
|
|
@@ -3067,14 +3066,14 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3067
3066
|
columnList: l(a).table.column.list,
|
|
3068
3067
|
option: e.option
|
|
3069
3068
|
}, Y({ _: 2 }, [
|
|
3070
|
-
G(
|
|
3069
|
+
G(d.$slots, (m, w) => ({
|
|
3071
3070
|
name: w,
|
|
3072
3071
|
fn: p((D) => [
|
|
3073
|
-
S(
|
|
3072
|
+
S(d.$slots, w, $e(ze(D || {})))
|
|
3074
3073
|
])
|
|
3075
3074
|
}))
|
|
3076
3075
|
]), 1032, ["conf", "columnList", "option"]),
|
|
3077
|
-
l(r)(e.option.table?.add) || l(r)(e.option.table?.update) || l(r)(e.option.table?.delete) || l(r)(e.option.table?.view) ||
|
|
3076
|
+
l(r)(e.option.table?.add) || l(r)(e.option.table?.update) || l(r)(e.option.table?.delete) || l(r)(e.option.table?.view) || d.$slots["table-op-left"] || d.$slots["table-op-right"] ? (g(), b(l(ye), x({
|
|
3078
3077
|
key: 2,
|
|
3079
3078
|
align: "center",
|
|
3080
3079
|
fixed: "right"
|
|
@@ -3083,7 +3082,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3083
3082
|
"show-overflow-tooltip": !1
|
|
3084
3083
|
}), {
|
|
3085
3084
|
header: p(() => [
|
|
3086
|
-
S(
|
|
3085
|
+
S(d.$slots, "table-header-op", {}, () => [
|
|
3087
3086
|
M(U(l(C).tCurd("operation")), 1)
|
|
3088
3087
|
])
|
|
3089
3088
|
]),
|
|
@@ -3092,7 +3091,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3092
3091
|
size: e.option.size?.table
|
|
3093
3092
|
}, {
|
|
3094
3093
|
default: p(() => [
|
|
3095
|
-
S(
|
|
3094
|
+
S(d.$slots, "table-op-left", { row: m }),
|
|
3096
3095
|
l(a).update.type === l(n).Update && e.option.table?.inlineEdit && l(a).update.form[o.option.table?.rowKey] === m[o.option.table?.rowKey] ? (g(), v(B, { key: 0 }, [
|
|
3097
3096
|
F(l(N), {
|
|
3098
3097
|
link: "",
|
|
@@ -3115,7 +3114,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3115
3114
|
]),
|
|
3116
3115
|
_: 1
|
|
3117
3116
|
}, 8, ["onClick", "loading"]),
|
|
3118
|
-
S(
|
|
3117
|
+
S(d.$slots, "table-op-edit-right", { row: m })
|
|
3119
3118
|
], 64)) : (g(), v(B, { key: 1 }, [
|
|
3120
3119
|
l(r)(e.option.table?.add, m) ? (g(), b(l(N), {
|
|
3121
3120
|
key: 0,
|
|
@@ -3161,7 +3160,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3161
3160
|
]),
|
|
3162
3161
|
_: 1
|
|
3163
3162
|
}, 8, ["onClick"])) : V("", !0),
|
|
3164
|
-
S(
|
|
3163
|
+
S(d.$slots, "table-op-right", { row: m })
|
|
3165
3164
|
], 64))
|
|
3166
3165
|
]),
|
|
3167
3166
|
_: 2
|
|
@@ -3194,7 +3193,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3194
3193
|
}, e.option.page?.pagination || {}, E(e.option.page?.pagination?.on || {})), null, 16, ["current-page", "page-size", "page-sizes", "pager-count", "layout", "total", "size", "onSizeChange", "onCurrentChange"])) : V("", !0)
|
|
3195
3194
|
])
|
|
3196
3195
|
], 2),
|
|
3197
|
-
S(
|
|
3196
|
+
S(d.$slots, "box-right")
|
|
3198
3197
|
], 2),
|
|
3199
3198
|
F(l(Ee), x({
|
|
3200
3199
|
modelValue: l(a).update.show,
|
|
@@ -3208,7 +3207,7 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3208
3207
|
size: e.option.size?.form
|
|
3209
3208
|
}, {
|
|
3210
3209
|
default: p(() => [
|
|
3211
|
-
S(
|
|
3210
|
+
S(d.$slots, "dialog-footer", {
|
|
3212
3211
|
row: l(a).update
|
|
3213
3212
|
}, () => [
|
|
3214
3213
|
F(l(N), {
|
|
@@ -3237,12 +3236,12 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3237
3236
|
])
|
|
3238
3237
|
]),
|
|
3239
3238
|
default: p(() => [
|
|
3240
|
-
S(
|
|
3239
|
+
S(d.$slots, "dialog-start", {
|
|
3241
3240
|
row: l(a).update
|
|
3242
3241
|
}),
|
|
3243
3242
|
F(l(oe), {
|
|
3244
3243
|
ref_key: "ruleFormRef",
|
|
3245
|
-
ref:
|
|
3244
|
+
ref: u,
|
|
3246
3245
|
model: l(a).update.form,
|
|
3247
3246
|
rules: l(a).update.rules,
|
|
3248
3247
|
size: e.option.size?.form,
|
|
@@ -3262,17 +3261,17 @@ const Eo = /* @__PURE__ */ se(xo, [["render", So]]), $o = { class: "row flex-cen
|
|
|
3262
3261
|
"get-on": l(a).update.getOn,
|
|
3263
3262
|
"get-disabled": l(a).update.getDisabled
|
|
3264
3263
|
}, Y({ _: 2 }, [
|
|
3265
|
-
G(
|
|
3264
|
+
G(d.$slots, (m, w) => ({
|
|
3266
3265
|
name: w,
|
|
3267
3266
|
fn: p((D) => [
|
|
3268
|
-
S(
|
|
3267
|
+
S(d.$slots, w, $e(ze(D || {})))
|
|
3269
3268
|
])
|
|
3270
3269
|
}))
|
|
3271
3270
|
]), 1032, ["form-grid", "max-span", "form", "type", "stripe", "label-width", "form-option", "get-bind", "get-on", "get-disabled"])) : V("", !0)
|
|
3272
3271
|
]),
|
|
3273
3272
|
_: 3
|
|
3274
3273
|
}, 8, ["model", "rules", "size"]),
|
|
3275
|
-
S(
|
|
3274
|
+
S(d.$slots, "dialog-end", {
|
|
3276
3275
|
row: l(a).update
|
|
3277
3276
|
})
|
|
3278
3277
|
]),
|
|
@@ -3362,18 +3361,18 @@ class oa {
|
|
|
3362
3361
|
r.type = "file";
|
|
3363
3362
|
const a = t?.accept || ".json";
|
|
3364
3363
|
r.accept = a, r.style.display = "none", r.onchange = (i) => {
|
|
3365
|
-
const
|
|
3366
|
-
if (!
|
|
3364
|
+
const u = i.target.files[0];
|
|
3365
|
+
if (!u) {
|
|
3367
3366
|
$.fail("未选择文件"), o("未选择文件");
|
|
3368
3367
|
return;
|
|
3369
3368
|
}
|
|
3370
3369
|
const c = new FileReader();
|
|
3371
|
-
c.onload = async (
|
|
3372
|
-
const s = a == ".json" ? JSON.parse(
|
|
3370
|
+
c.onload = async (d) => {
|
|
3371
|
+
const s = a == ".json" ? JSON.parse(d.target.result) : d.target.result;
|
|
3373
3372
|
n(s);
|
|
3374
3373
|
}, c.onerror = () => {
|
|
3375
3374
|
$.fail("文件读取失败"), o("文件读取失败");
|
|
3376
|
-
}, c.readAsText(
|
|
3375
|
+
}, c.readAsText(u), document.body.removeChild(r);
|
|
3377
3376
|
}, document.body.appendChild(r), r.click();
|
|
3378
3377
|
});
|
|
3379
3378
|
}
|