@tmagic/form 1.7.11 → 1.7.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +2 -36
- package/dist/es/{table → containers/table}/ActionsColumn.js +1 -1
- package/dist/es/{table → containers/table}/ActionsColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/{table → containers/table}/SortColumn.js +1 -1
- package/dist/es/{table → containers/table}/SortColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/{table → containers/table}/Table.js +1 -1
- package/dist/es/{table → containers/table}/Table.vue_vue_type_script_setup_true_lang.js +10 -16
- package/dist/es/containers/table/useFullscreen.js +22 -0
- package/dist/es/{table → containers/table}/useImport.js +3 -5
- package/dist/es/{table → containers/table}/usePagination.js +2 -2
- package/dist/es/{table → containers/table}/useSelection.js +1 -1
- package/dist/es/{table → containers/table}/useSortable.js +2 -2
- package/dist/es/{table → containers/table}/useTableColumns.js +5 -5
- package/dist/es/containers/{TableGroupList.js → table-group-list/TableGroupList.js} +1 -1
- package/dist/es/containers/{TableGroupList.vue_vue_type_script_setup_true_lang.js → table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js} +25 -26
- package/dist/es/{table → containers/table-group-list}/useAdd.js +19 -4
- package/dist/es/index.js +1 -1
- package/dist/es/plugin.js +1 -1
- package/dist/tmagic-form.umd.cjs +484 -504
- package/package.json +4 -4
- package/src/containers/GroupList.vue +2 -55
- package/src/{table → containers/table}/ActionsColumn.vue +1 -1
- package/src/{table → containers/table}/Table.vue +8 -18
- package/src/containers/table/useFullscreen.ts +31 -0
- package/src/{table → containers/table}/useImport.ts +2 -5
- package/src/{table → containers/table}/usePagination.ts +1 -1
- package/src/{table → containers/table}/useSortable.ts +1 -1
- package/src/{table → containers/table}/useTableColumns.ts +8 -5
- package/src/containers/{TableGroupList.vue → table-group-list/TableGroupList.vue} +21 -29
- package/src/{table → containers/table-group-list}/useAdd.ts +33 -7
- package/src/index.ts +3 -3
- package/src/plugin.ts +1 -1
- package/types/index.d.ts +4 -2
- package/dist/es/table/useFullscreen.js +0 -15
- package/src/table/useFullscreen.ts +0 -18
- /package/src/{table → containers/table}/SortColumn.vue +0 -0
- /package/src/{table → containers/table}/type.ts +0 -0
- /package/src/{table → containers/table}/useSelection.ts +0 -0
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -4689,75 +4689,342 @@
|
|
|
4689
4689
|
}
|
|
4690
4690
|
});
|
|
4691
4691
|
//#endregion
|
|
4692
|
-
//#region packages/form/src/
|
|
4693
|
-
var
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
}
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4692
|
+
//#region packages/form/src/containers/GroupListItem.vue?vue&type=script&setup=true&lang.ts
|
|
4693
|
+
var _hoisted_1$9 = ["innerHTML"];
|
|
4694
|
+
var _hoisted_2$4 = { style: {
|
|
4695
|
+
"text-align": "right",
|
|
4696
|
+
"margin-top": "20px"
|
|
4697
|
+
} };
|
|
4698
|
+
var _hoisted_3$3 = ["innerHTML"];
|
|
4699
|
+
//#endregion
|
|
4700
|
+
//#region packages/form/src/containers/GroupListItem.vue
|
|
4701
|
+
var GroupListItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4702
|
+
name: "MFormGroupListItem",
|
|
4703
|
+
__name: "GroupListItem",
|
|
4704
|
+
props: {
|
|
4705
|
+
model: {},
|
|
4706
|
+
lastValues: {},
|
|
4707
|
+
isCompare: { type: Boolean },
|
|
4708
|
+
groupModel: {},
|
|
4709
|
+
config: {},
|
|
4710
|
+
labelWidth: {},
|
|
4711
|
+
prop: {},
|
|
4712
|
+
size: {},
|
|
4713
|
+
index: {},
|
|
4714
|
+
disabled: { type: Boolean }
|
|
4715
|
+
},
|
|
4716
|
+
emits: [
|
|
4717
|
+
"swap-item",
|
|
4718
|
+
"remove-item",
|
|
4719
|
+
"change",
|
|
4720
|
+
"addDiffCount",
|
|
4721
|
+
"copy-item"
|
|
4722
|
+
],
|
|
4723
|
+
setup(__props, { emit: __emit }) {
|
|
4724
|
+
const props = __props;
|
|
4725
|
+
const emit = __emit;
|
|
4726
|
+
const mForm = (0, vue.inject)("mForm");
|
|
4727
|
+
const defaultExpandQuantity = props.config.defaultExpandQuantity ?? 7;
|
|
4728
|
+
const expand = (0, vue.ref)(props.config.expandAll || defaultExpandQuantity > props.index);
|
|
4729
|
+
const rowConfig = (0, vue.computed)(() => ({
|
|
4730
|
+
type: "row",
|
|
4731
|
+
span: props.config.span || 24,
|
|
4732
|
+
items: props.config.items,
|
|
4733
|
+
labelWidth: props.config.labelWidth,
|
|
4734
|
+
[mForm?.keyProp || "__key"]: `${props.config[mForm?.keyProp || "__key"]}${String(props.index)}`
|
|
4735
|
+
}));
|
|
4736
|
+
const title = (0, vue.computed)(() => {
|
|
4737
|
+
if (props.config.titleKey && props.model[props.config.titleKey]) return props.model[props.config.titleKey];
|
|
4738
|
+
if (props.config.title) return filterFunction(mForm, props.config.title, props);
|
|
4739
|
+
return `${props.config.titlePrefix || "组"} ${String(props.index + 1)}`;
|
|
4724
4740
|
});
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4741
|
+
const length = (0, vue.computed)(() => props.groupModel?.length || 0);
|
|
4742
|
+
const itemExtra = (0, vue.computed)(() => filterFunction(mForm, props.config.itemExtra, props));
|
|
4743
|
+
const removeHandler = () => emit("remove-item", props.index);
|
|
4744
|
+
const changeHandler = (v, eventData) => {
|
|
4745
|
+
emit("change", props.model, eventData);
|
|
4746
|
+
};
|
|
4747
|
+
const expandHandler = () => {
|
|
4748
|
+
expand.value = !expand.value;
|
|
4749
|
+
};
|
|
4750
|
+
const showDelete = (0, vue.computed)(() => {
|
|
4751
|
+
const deleteFunc = props.config.delete;
|
|
4752
|
+
if (deleteFunc && typeof deleteFunc === "function") return deleteFunc(props.model, props.index, mForm?.values);
|
|
4753
|
+
return true;
|
|
4754
|
+
});
|
|
4755
|
+
const changeOrder = (offset = 0) => emit("swap-item", props.index, props.index + offset);
|
|
4756
|
+
const movable = (0, vue.computed)(() => {
|
|
4757
|
+
const { movable } = props.config;
|
|
4758
|
+
if (movable === void 0) return true;
|
|
4759
|
+
if (typeof movable === "function") return movable(mForm, props.index || 0, props.model, props.groupModel);
|
|
4760
|
+
return movable;
|
|
4761
|
+
});
|
|
4762
|
+
const copyable = (0, vue.computed)(() => filterFunction(mForm, props.config.copyable, props));
|
|
4763
|
+
const onAddDiffCount = () => emit("addDiffCount");
|
|
4764
|
+
const copyHandler = () => {
|
|
4765
|
+
emit("copy-item", props.index);
|
|
4766
|
+
};
|
|
4767
|
+
const moveSpecifyLocationVisible = (0, vue.ref)(false);
|
|
4768
|
+
const moveSpecifyLocationIndex = (0, vue.ref)(1);
|
|
4769
|
+
const moveSpecifyLocationHandler = () => {
|
|
4770
|
+
moveSpecifyLocationVisible.value = false;
|
|
4771
|
+
emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
|
|
4772
|
+
};
|
|
4773
|
+
return (_ctx, _cache) => {
|
|
4774
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicCard), {
|
|
4775
|
+
class: "m-fields-group-list-item",
|
|
4776
|
+
"body-style": { display: expand.value ? "block" : "none" }
|
|
4777
|
+
}, {
|
|
4778
|
+
header: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [
|
|
4779
|
+
(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4780
|
+
link: "",
|
|
4781
|
+
disabled: __props.disabled,
|
|
4782
|
+
onClick: expandHandler
|
|
4783
|
+
}, {
|
|
4784
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), null, {
|
|
4785
|
+
default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretBottom), { key: 0 })) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretRight), { key: 1 }))]),
|
|
4786
|
+
_: 1
|
|
4787
|
+
}), (0, vue.createElementVNode)("span", { innerHTML: title.value }, null, 8, _hoisted_1$9)]),
|
|
4788
|
+
_: 1
|
|
4789
|
+
}, 8, ["disabled"]),
|
|
4790
|
+
(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4791
|
+
type: "danger",
|
|
4792
|
+
size: "small",
|
|
4793
|
+
link: "",
|
|
4794
|
+
icon: (0, vue.unref)(_element_plus_icons_vue.Delete),
|
|
4795
|
+
disabled: __props.disabled,
|
|
4796
|
+
onClick: removeHandler
|
|
4797
|
+
}, null, 8, ["icon", "disabled"]), [[vue.vShow, showDelete.value]]),
|
|
4798
|
+
copyable.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4799
|
+
key: 0,
|
|
4800
|
+
link: "",
|
|
4801
|
+
size: "small",
|
|
4802
|
+
type: "primary",
|
|
4803
|
+
icon: (0, vue.unref)(_element_plus_icons_vue.DocumentCopy),
|
|
4804
|
+
disabled: __props.disabled,
|
|
4805
|
+
onClick: copyHandler
|
|
4806
|
+
}, {
|
|
4807
|
+
default: (0, vue.withCtx)(() => [..._cache[6] || (_cache[6] = [(0, vue.createTextVNode)("复制", -1)])]),
|
|
4808
|
+
_: 1
|
|
4809
|
+
}, 8, ["icon", "disabled"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
4810
|
+
movable.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4811
|
+
link: "",
|
|
4812
|
+
size: "small",
|
|
4813
|
+
disabled: __props.disabled,
|
|
4814
|
+
icon: (0, vue.unref)(_element_plus_icons_vue.CaretTop),
|
|
4815
|
+
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
4816
|
+
}, {
|
|
4817
|
+
default: (0, vue.withCtx)(() => [..._cache[7] || (_cache[7] = [(0, vue.createTextVNode)("上移", -1)])]),
|
|
4818
|
+
_: 1
|
|
4819
|
+
}, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== 0]]), (0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4820
|
+
link: "",
|
|
4821
|
+
size: "small",
|
|
4822
|
+
disabled: __props.disabled,
|
|
4823
|
+
icon: (0, vue.unref)(_element_plus_icons_vue.CaretBottom),
|
|
4824
|
+
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
4825
|
+
}, {
|
|
4826
|
+
default: (0, vue.withCtx)(() => [..._cache[8] || (_cache[8] = [(0, vue.createTextVNode)("下移", -1)])]),
|
|
4827
|
+
_: 1
|
|
4828
|
+
}, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== length.value - 1]])], 64)) : (0, vue.createCommentVNode)("v-if", true),
|
|
4829
|
+
__props.config.moveSpecifyLocation ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicPopover), {
|
|
4830
|
+
key: 2,
|
|
4831
|
+
trigger: "click",
|
|
4832
|
+
placement: "top",
|
|
4833
|
+
width: "200",
|
|
4834
|
+
visible: moveSpecifyLocationVisible.value
|
|
4835
|
+
}, {
|
|
4836
|
+
reference: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4837
|
+
link: "",
|
|
4838
|
+
size: "small",
|
|
4839
|
+
type: "primary",
|
|
4840
|
+
icon: (0, vue.unref)(_element_plus_icons_vue.Position),
|
|
4841
|
+
disabled: __props.disabled,
|
|
4842
|
+
onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
|
|
4843
|
+
}, {
|
|
4844
|
+
default: (0, vue.withCtx)(() => [..._cache[9] || (_cache[9] = [(0, vue.createTextVNode)("移动至", -1)])]),
|
|
4845
|
+
_: 1
|
|
4846
|
+
}, 8, ["icon", "disabled"])]),
|
|
4847
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [(0, vue.createElementVNode)("div", null, [
|
|
4848
|
+
_cache[10] || (_cache[10] = (0, vue.createTextVNode)(" 第", -1)),
|
|
4849
|
+
(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicInputNumber), {
|
|
4850
|
+
style: { "margin": "0 5px" },
|
|
4851
|
+
modelValue: moveSpecifyLocationIndex.value,
|
|
4852
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
|
|
4853
|
+
size: "small",
|
|
4854
|
+
min: 1,
|
|
4855
|
+
disabled: __props.disabled
|
|
4856
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
4857
|
+
_cache[11] || (_cache[11] = (0, vue.createTextVNode)("行 ", -1))
|
|
4858
|
+
]), (0, vue.createElementVNode)("div", _hoisted_2$4, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4859
|
+
size: "small",
|
|
4860
|
+
text: "",
|
|
4861
|
+
onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
|
|
4862
|
+
}, {
|
|
4863
|
+
default: (0, vue.withCtx)(() => [..._cache[12] || (_cache[12] = [(0, vue.createTextVNode)("取消", -1)])]),
|
|
4864
|
+
_: 1
|
|
4865
|
+
}), (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
4866
|
+
size: "small",
|
|
4867
|
+
type: "primary",
|
|
4868
|
+
onClick: moveSpecifyLocationHandler
|
|
4869
|
+
}, {
|
|
4870
|
+
default: (0, vue.withCtx)(() => [..._cache[13] || (_cache[13] = [(0, vue.createTextVNode)("确认", -1)])]),
|
|
4871
|
+
_: 1
|
|
4872
|
+
})])])]),
|
|
4873
|
+
_: 1
|
|
4874
|
+
}, 8, ["visible"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
4875
|
+
itemExtra.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
4876
|
+
key: 3,
|
|
4877
|
+
innerHTML: itemExtra.value,
|
|
4878
|
+
class: "m-form-tip"
|
|
4879
|
+
}, null, 8, _hoisted_3$3)) : (0, vue.createCommentVNode)("v-if", true)
|
|
4880
|
+
])]),
|
|
4881
|
+
default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
|
|
4882
|
+
key: 0,
|
|
4883
|
+
config: rowConfig.value,
|
|
4884
|
+
model: __props.model,
|
|
4885
|
+
lastValues: __props.lastValues,
|
|
4886
|
+
"is-compare": __props.isCompare,
|
|
4887
|
+
labelWidth: __props.labelWidth,
|
|
4888
|
+
prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
|
|
4889
|
+
size: __props.size,
|
|
4890
|
+
disabled: __props.disabled,
|
|
4891
|
+
onChange: changeHandler,
|
|
4892
|
+
onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
|
|
4893
|
+
}, null, 8, [
|
|
4894
|
+
"config",
|
|
4895
|
+
"model",
|
|
4896
|
+
"lastValues",
|
|
4897
|
+
"is-compare",
|
|
4898
|
+
"labelWidth",
|
|
4899
|
+
"prop",
|
|
4900
|
+
"size",
|
|
4901
|
+
"disabled"
|
|
4902
|
+
])) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
4903
|
+
_: 1
|
|
4904
|
+
}, 8, ["body-style"]);
|
|
4905
|
+
};
|
|
4906
|
+
}
|
|
4907
|
+
});
|
|
4908
|
+
//#endregion
|
|
4909
|
+
//#region packages/form/src/containers/GroupList.vue?vue&type=script&setup=true&lang.ts
|
|
4910
|
+
var _hoisted_1$8 = { class: "m-fields-group-list" };
|
|
4911
|
+
var _hoisted_2$3 = ["innerHTML"];
|
|
4912
|
+
var _hoisted_3$2 = {
|
|
4913
|
+
key: 1,
|
|
4914
|
+
class: "el-table__empty-block"
|
|
4744
4915
|
};
|
|
4916
|
+
var _hoisted_4$1 = { class: "m-fields-group-list-footer" };
|
|
4917
|
+
var _hoisted_5 = { style: {
|
|
4918
|
+
"display": "flex",
|
|
4919
|
+
"justify-content": "flex-end",
|
|
4920
|
+
"flex": "1"
|
|
4921
|
+
} };
|
|
4922
|
+
//#endregion
|
|
4923
|
+
//#region packages/form/src/containers/GroupList.vue
|
|
4924
|
+
var GroupList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4925
|
+
name: "MFormGroupList",
|
|
4926
|
+
__name: "GroupList",
|
|
4927
|
+
props: {
|
|
4928
|
+
model: {},
|
|
4929
|
+
lastValues: {},
|
|
4930
|
+
isCompare: { type: Boolean },
|
|
4931
|
+
config: {},
|
|
4932
|
+
name: {},
|
|
4933
|
+
labelWidth: {},
|
|
4934
|
+
prop: {},
|
|
4935
|
+
size: {},
|
|
4936
|
+
disabled: { type: Boolean },
|
|
4937
|
+
showIndex: { type: Boolean }
|
|
4938
|
+
},
|
|
4939
|
+
emits: ["change", "addDiffCount"],
|
|
4940
|
+
setup(__props, { emit: __emit }) {
|
|
4941
|
+
const props = __props;
|
|
4942
|
+
const emit = __emit;
|
|
4943
|
+
const changeHandler = (v, eventData) => {
|
|
4944
|
+
emit("change", props.model, eventData);
|
|
4945
|
+
};
|
|
4946
|
+
const removeHandler = (index) => {
|
|
4947
|
+
if (!props.name) return false;
|
|
4948
|
+
props.model[props.name].splice(index, 1);
|
|
4949
|
+
emit("change", props.model[props.name]);
|
|
4950
|
+
};
|
|
4951
|
+
const copyHandler = (index) => {
|
|
4952
|
+
props.model[props.name].push(cloneDeep(props.model[props.name][index]));
|
|
4953
|
+
};
|
|
4954
|
+
const swapHandler = (idx1, idx2) => {
|
|
4955
|
+
if (!props.name) return false;
|
|
4956
|
+
const { length } = props.model[props.name];
|
|
4957
|
+
const [currRow] = props.model[props.name].splice(idx1, 1);
|
|
4958
|
+
props.model[props.name].splice(Math.min(Math.max(idx2, 0), length - 1), 0, currRow);
|
|
4959
|
+
emit("change", props.model[props.name]);
|
|
4960
|
+
};
|
|
4961
|
+
const onAddDiffCount = () => emit("addDiffCount");
|
|
4962
|
+
const getLastValues = (item, index) => item?.[index] || {};
|
|
4963
|
+
return (_ctx, _cache) => {
|
|
4964
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$8, [
|
|
4965
|
+
__props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
4966
|
+
key: 0,
|
|
4967
|
+
innerHTML: __props.config.extra,
|
|
4968
|
+
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
4969
|
+
}, null, 8, _hoisted_2$3)) : (0, vue.createCommentVNode)("v-if", true),
|
|
4970
|
+
!__props.model[__props.name] || !__props.model[__props.name].length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$2, [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("span", { class: "el-table__empty-text t-table__empty" }, "暂无数据", -1)])])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)(__props.model[__props.name], (item, index) => {
|
|
4971
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)(GroupListItem_default, {
|
|
4972
|
+
key: index,
|
|
4973
|
+
model: item,
|
|
4974
|
+
lastValues: getLastValues(__props.lastValues?.[__props.name], Number(index)),
|
|
4975
|
+
"is-compare": __props.isCompare,
|
|
4976
|
+
config: __props.config,
|
|
4977
|
+
prop: __props.prop,
|
|
4978
|
+
index: Number(index),
|
|
4979
|
+
"label-width": __props.labelWidth,
|
|
4980
|
+
size: __props.size,
|
|
4981
|
+
disabled: __props.disabled,
|
|
4982
|
+
"group-model": __props.model[__props.name],
|
|
4983
|
+
onRemoveItem: removeHandler,
|
|
4984
|
+
onCopyItem: copyHandler,
|
|
4985
|
+
onSwapItem: swapHandler,
|
|
4986
|
+
onChange: changeHandler,
|
|
4987
|
+
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
4988
|
+
}, null, 8, [
|
|
4989
|
+
"model",
|
|
4990
|
+
"lastValues",
|
|
4991
|
+
"is-compare",
|
|
4992
|
+
"config",
|
|
4993
|
+
"prop",
|
|
4994
|
+
"index",
|
|
4995
|
+
"label-width",
|
|
4996
|
+
"size",
|
|
4997
|
+
"disabled",
|
|
4998
|
+
"group-model"
|
|
4999
|
+
]);
|
|
5000
|
+
}), 128)),
|
|
5001
|
+
(0, vue.createElementVNode)("div", _hoisted_4$1, [(0, vue.renderSlot)(_ctx.$slots, "toggle-button"), (0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.renderSlot)(_ctx.$slots, "add-button")])])
|
|
5002
|
+
]);
|
|
5003
|
+
};
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
4745
5006
|
//#endregion
|
|
4746
|
-
//#region packages/form/src/table/useFullscreen.ts
|
|
5007
|
+
//#region packages/form/src/containers/table/useFullscreen.ts
|
|
4747
5008
|
var useFullscreen = () => {
|
|
5009
|
+
const { nextZIndex } = (0, _tmagic_design.useZIndex)();
|
|
5010
|
+
const fullscreenZIndex = (0, vue.ref)(nextZIndex());
|
|
4748
5011
|
const isFullscreen = (0, vue.ref)(false);
|
|
4749
5012
|
const toggleFullscreen = () => {
|
|
4750
5013
|
if (isFullscreen.value) isFullscreen.value = false;
|
|
4751
5014
|
else isFullscreen.value = true;
|
|
4752
5015
|
};
|
|
5016
|
+
(0, vue.watch)(isFullscreen, (value) => {
|
|
5017
|
+
if (value) fullscreenZIndex.value = nextZIndex();
|
|
5018
|
+
});
|
|
4753
5019
|
return {
|
|
4754
5020
|
isFullscreen,
|
|
5021
|
+
fullscreenZIndex,
|
|
4755
5022
|
toggleFullscreen
|
|
4756
5023
|
};
|
|
4757
5024
|
};
|
|
4758
5025
|
//#endregion
|
|
4759
|
-
//#region packages/form/src/table/useImport.ts
|
|
4760
|
-
var useImport = (props, emit
|
|
5026
|
+
//#region packages/form/src/containers/table/useImport.ts
|
|
5027
|
+
var useImport = (props, emit) => {
|
|
4761
5028
|
const mForm = (0, vue.inject)("mForm");
|
|
4762
5029
|
const modelName = (0, vue.computed)(() => props.name || props.config.name || "");
|
|
4763
5030
|
const importable = (0, vue.computed)(() => {
|
|
@@ -4777,9 +5044,7 @@
|
|
|
4777
5044
|
const pdata = globalThis.XLSX.read(data, { type: "array" });
|
|
4778
5045
|
pdata.SheetNames.forEach((sheetName) => {
|
|
4779
5046
|
const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
|
|
4780
|
-
if (arr?.[0]) arr
|
|
4781
|
-
newHandler(row);
|
|
4782
|
-
});
|
|
5047
|
+
if (arr?.[0]) emit("add", arr);
|
|
4783
5048
|
setTimeout(() => {
|
|
4784
5049
|
excelBtn.value?.clearFiles();
|
|
4785
5050
|
}, 300);
|
|
@@ -4799,7 +5064,7 @@
|
|
|
4799
5064
|
};
|
|
4800
5065
|
};
|
|
4801
5066
|
//#endregion
|
|
4802
|
-
//#region packages/form/src/table/usePagination.ts
|
|
5067
|
+
//#region packages/form/src/containers/table/usePagination.ts
|
|
4803
5068
|
var usePagination = (props, modelName) => {
|
|
4804
5069
|
const pageSize = (0, vue.ref)(10);
|
|
4805
5070
|
/**
|
|
@@ -4822,7 +5087,7 @@
|
|
|
4822
5087
|
};
|
|
4823
5088
|
};
|
|
4824
5089
|
//#endregion
|
|
4825
|
-
//#region packages/form/src/table/useSelection.ts
|
|
5090
|
+
//#region packages/form/src/containers/table/useSelection.ts
|
|
4826
5091
|
var useSelection = (props, emit, tMagicTableRef) => {
|
|
4827
5092
|
const mForm = (0, vue.inject)("mForm");
|
|
4828
5093
|
const selectHandle = (selection, row) => {
|
|
@@ -4846,7 +5111,7 @@
|
|
|
4846
5111
|
};
|
|
4847
5112
|
};
|
|
4848
5113
|
//#endregion
|
|
4849
|
-
//#region packages/form/src/table/useSortable.ts
|
|
5114
|
+
//#region packages/form/src/containers/table/useSortable.ts
|
|
4850
5115
|
var SortablePromise;
|
|
4851
5116
|
var loadSortable = () => SortablePromise ??= import("sortablejs").then((m) => m.default);
|
|
4852
5117
|
var useSortable = (props, emit, tMagicTableRef, modelName, updateKey) => {
|
|
@@ -4882,7 +5147,7 @@
|
|
|
4882
5147
|
});
|
|
4883
5148
|
};
|
|
4884
5149
|
//#endregion
|
|
4885
|
-
//#region packages/form/src/table/ActionsColumn.vue
|
|
5150
|
+
//#region packages/form/src/containers/table/ActionsColumn.vue
|
|
4886
5151
|
var ActionsColumn_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4887
5152
|
__name: "ActionsColumn",
|
|
4888
5153
|
props: {
|
|
@@ -4984,7 +5249,7 @@
|
|
|
4984
5249
|
}
|
|
4985
5250
|
});
|
|
4986
5251
|
//#endregion
|
|
4987
|
-
//#region packages/form/src/table/SortColumn.vue
|
|
5252
|
+
//#region packages/form/src/containers/table/SortColumn.vue
|
|
4988
5253
|
var SortColumn_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
4989
5254
|
__name: "SortColumn",
|
|
4990
5255
|
props: {
|
|
@@ -5068,7 +5333,7 @@
|
|
|
5068
5333
|
}
|
|
5069
5334
|
});
|
|
5070
5335
|
//#endregion
|
|
5071
|
-
//#region packages/form/src/table/useTableColumns.ts
|
|
5336
|
+
//#region packages/form/src/containers/table/useTableColumns.ts
|
|
5072
5337
|
var useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
|
|
5073
5338
|
const mForm = (0, vue.inject)("mForm");
|
|
5074
5339
|
const display$1 = (fuc) => display(mForm, fuc, props);
|
|
@@ -5185,7 +5450,7 @@
|
|
|
5185
5450
|
columns.push({
|
|
5186
5451
|
props: {
|
|
5187
5452
|
prop: column.name,
|
|
5188
|
-
label: column.label,
|
|
5453
|
+
label: column.label || column.text,
|
|
5189
5454
|
width: column.width,
|
|
5190
5455
|
sortable: column.sortable,
|
|
5191
5456
|
sortOrders: ["ascending", "descending"],
|
|
@@ -5209,7 +5474,7 @@
|
|
|
5209
5474
|
display: "inline-flex",
|
|
5210
5475
|
alignItems: "center",
|
|
5211
5476
|
gap: "5px"
|
|
5212
|
-
} }, [(0, vue.h)("span", column.label), (0, vue.h)(_tmagic_design.TMagicIcon, {}, { default: () => (0, vue.h)(_element_plus_icons_vue.WarningFilled) })]),
|
|
5477
|
+
} }, [(0, vue.h)("span", column.label || column.text), (0, vue.h)(_tmagic_design.TMagicIcon, {}, { default: () => (0, vue.h)(_element_plus_icons_vue.WarningFilled) })]),
|
|
5213
5478
|
content: () => (0, vue.h)("div", { innerHTML: titleTipValue })
|
|
5214
5479
|
}) : void 0
|
|
5215
5480
|
});
|
|
@@ -5219,21 +5484,21 @@
|
|
|
5219
5484
|
}) };
|
|
5220
5485
|
};
|
|
5221
5486
|
//#endregion
|
|
5222
|
-
//#region packages/form/src/table/Table.vue?vue&type=script&setup=true&lang.ts
|
|
5223
|
-
var _hoisted_1$
|
|
5224
|
-
var _hoisted_2$
|
|
5487
|
+
//#region packages/form/src/containers/table/Table.vue?vue&type=script&setup=true&lang.ts
|
|
5488
|
+
var _hoisted_1$7 = ["innerHTML"];
|
|
5489
|
+
var _hoisted_2$2 = { style: {
|
|
5225
5490
|
"display": "flex",
|
|
5226
5491
|
"justify-content": "space-between",
|
|
5227
5492
|
"margin": "10px 0"
|
|
5228
5493
|
} };
|
|
5229
|
-
var _hoisted_3$
|
|
5230
|
-
var _hoisted_4
|
|
5494
|
+
var _hoisted_3$1 = { style: { "display": "flex" } };
|
|
5495
|
+
var _hoisted_4 = {
|
|
5231
5496
|
key: 1,
|
|
5232
5497
|
class: "bottom",
|
|
5233
5498
|
style: { "text-align": "right" }
|
|
5234
5499
|
};
|
|
5235
5500
|
//#endregion
|
|
5236
|
-
//#region packages/form/src/table/Table.vue
|
|
5501
|
+
//#region packages/form/src/containers/table/Table.vue
|
|
5237
5502
|
var Table_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5238
5503
|
name: "MFormTable",
|
|
5239
5504
|
__name: "Table",
|
|
@@ -5261,7 +5526,8 @@
|
|
|
5261
5526
|
emits: [
|
|
5262
5527
|
"change",
|
|
5263
5528
|
"select",
|
|
5264
|
-
"addDiffCount"
|
|
5529
|
+
"addDiffCount",
|
|
5530
|
+
"add"
|
|
5265
5531
|
],
|
|
5266
5532
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
5267
5533
|
const props = __props;
|
|
@@ -5269,17 +5535,11 @@
|
|
|
5269
5535
|
const modelName = (0, vue.computed)(() => props.name || props.config.name || "");
|
|
5270
5536
|
const tMagicTableRef = (0, vue.useTemplateRef)("tMagicTable");
|
|
5271
5537
|
const { pageSize, currentPage, paginationData, handleSizeChange, handleCurrentChange } = usePagination(props, modelName);
|
|
5272
|
-
const { nextZIndex } = (0, _tmagic_design.useZIndex)();
|
|
5273
5538
|
const updateKey = (0, vue.ref)(1);
|
|
5274
|
-
const fullscreenZIndex = (0, vue.ref)(nextZIndex());
|
|
5275
|
-
const { newHandler } = useAdd(props, emit);
|
|
5276
5539
|
const { columns } = useTableColumns(props, emit, currentPage, pageSize, modelName);
|
|
5277
5540
|
useSortable(props, emit, tMagicTableRef, modelName, updateKey);
|
|
5278
|
-
const { isFullscreen, toggleFullscreen } = useFullscreen();
|
|
5279
|
-
|
|
5280
|
-
if (value) fullscreenZIndex.value = nextZIndex();
|
|
5281
|
-
});
|
|
5282
|
-
const { importable, excelHandler, clearHandler } = useImport(props, emit, newHandler);
|
|
5541
|
+
const { isFullscreen, fullscreenZIndex, toggleFullscreen } = useFullscreen();
|
|
5542
|
+
const { importable, excelHandler, clearHandler } = useImport(props, emit);
|
|
5283
5543
|
const { selectHandle, toggleRowSelection } = useSelection(props, emit, tMagicTableRef);
|
|
5284
5544
|
const data = (0, vue.computed)(() => props.config.pagination ? paginationData.value : props.model[modelName.value]);
|
|
5285
5545
|
const sortChangeHandler = (sortOptions) => {
|
|
@@ -5293,13 +5553,13 @@
|
|
|
5293
5553
|
disabled: !(0, vue.unref)(isFullscreen)
|
|
5294
5554
|
}, [(0, vue.createElementVNode)("div", (0, vue.mergeProps)(_ctx.$attrs, {
|
|
5295
5555
|
class: ["m-fields-table-wrap", { fixed: (0, vue.unref)(isFullscreen) }],
|
|
5296
|
-
style: (0, vue.unref)(isFullscreen) ? `z-index: ${fullscreenZIndex
|
|
5556
|
+
style: (0, vue.unref)(isFullscreen) ? `z-index: ${(0, vue.unref)(fullscreenZIndex)}` : ""
|
|
5297
5557
|
}), [(0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }]) }, [
|
|
5298
5558
|
__props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
5299
5559
|
key: 0,
|
|
5300
5560
|
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
5301
5561
|
innerHTML: __props.config.extra
|
|
5302
|
-
}, null, 8, _hoisted_1$
|
|
5562
|
+
}, null, 8, _hoisted_1$7)) : (0, vue.createCommentVNode)("v-if", true),
|
|
5303
5563
|
(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
|
|
5304
5564
|
content: "拖拽可排序",
|
|
5305
5565
|
placement: "left-start",
|
|
@@ -5329,425 +5589,147 @@
|
|
|
5329
5589
|
_: 1
|
|
5330
5590
|
}, 8, ["disabled"]),
|
|
5331
5591
|
(0, vue.renderSlot)(_ctx.$slots, "default"),
|
|
5332
|
-
(0, vue.createElementVNode)("div", _hoisted_2$
|
|
5592
|
+
(0, vue.createElementVNode)("div", _hoisted_2$2, [(0, vue.createElementVNode)("div", _hoisted_3$1, [
|
|
5333
5593
|
!(0, vue.unref)(isFullscreen) ? (0, vue.renderSlot)(_ctx.$slots, "toggle-button", { key: 0 }) : (0, vue.createCommentVNode)("v-if", true),
|
|
5334
5594
|
__props.config.enableFullscreen !== false ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5335
5595
|
key: 1,
|
|
5336
5596
|
icon: (0, vue.unref)(_element_plus_icons_vue.FullScreen),
|
|
5337
5597
|
size: "small",
|
|
5338
|
-
onClick: (0, vue.unref)(toggleFullscreen)
|
|
5339
|
-
}, {
|
|
5340
|
-
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(isFullscreen) ? "退出全屏" : "全屏编辑"), 1)]),
|
|
5341
|
-
_: 1
|
|
5342
|
-
}, 8, ["icon", "onClick"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
5343
|
-
(0, vue.unref)(importable) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicUpload), {
|
|
5344
|
-
key: 2,
|
|
5345
|
-
style: { "display": "inline-block" },
|
|
5346
|
-
ref: "excelBtn",
|
|
5347
|
-
action: "/noop",
|
|
5348
|
-
disabled: __props.disabled,
|
|
5349
|
-
"on-change": (0, vue.unref)(excelHandler),
|
|
5350
|
-
"auto-upload": false
|
|
5351
|
-
}, {
|
|
5352
|
-
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5353
|
-
size: "small",
|
|
5354
|
-
type: "success",
|
|
5355
|
-
disabled: __props.disabled,
|
|
5356
|
-
plain: ""
|
|
5357
|
-
}, {
|
|
5358
|
-
default: (0, vue.withCtx)(() => [..._cache[0] || (_cache[0] = [(0, vue.createTextVNode)("导入EXCEL", -1)])]),
|
|
5359
|
-
_: 1
|
|
5360
|
-
}, 8, ["disabled"])]),
|
|
5361
|
-
_: 1
|
|
5362
|
-
}, 8, ["disabled", "on-change"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
5363
|
-
(0, vue.unref)(importable) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5364
|
-
key: 3,
|
|
5365
|
-
size: "small",
|
|
5366
|
-
type: "warning",
|
|
5367
|
-
disabled: __props.disabled,
|
|
5368
|
-
plain: "",
|
|
5369
|
-
onClick: (0, vue.unref)(clearHandler)
|
|
5370
|
-
}, {
|
|
5371
|
-
default: (0, vue.withCtx)(() => [..._cache[1] || (_cache[1] = [(0, vue.createTextVNode)("清空", -1)])]),
|
|
5372
|
-
_: 1
|
|
5373
|
-
}, 8, ["disabled", "onClick"])) : (0, vue.createCommentVNode)("v-if", true)
|
|
5374
|
-
]), (0, vue.renderSlot)(_ctx.$slots, "add-button", { trigger: (0, vue.unref)(newHandler) })]),
|
|
5375
|
-
__props.config.pagination ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$1, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPagination), {
|
|
5376
|
-
layout: "total, sizes, prev, pager, next, jumper",
|
|
5377
|
-
"hide-on-single-page": __props.model[modelName.value].length < (0, vue.unref)(pageSize),
|
|
5378
|
-
"current-page": (0, vue.unref)(currentPage) + 1,
|
|
5379
|
-
"page-sizes": [
|
|
5380
|
-
(0, vue.unref)(pageSize),
|
|
5381
|
-
60,
|
|
5382
|
-
120,
|
|
5383
|
-
300
|
|
5384
|
-
],
|
|
5385
|
-
"page-size": (0, vue.unref)(pageSize),
|
|
5386
|
-
total: __props.model[modelName.value].length,
|
|
5387
|
-
onSizeChange: (0, vue.unref)(handleSizeChange),
|
|
5388
|
-
onCurrentChange: (0, vue.unref)(handleCurrentChange)
|
|
5389
|
-
}, null, 8, [
|
|
5390
|
-
"hide-on-single-page",
|
|
5391
|
-
"current-page",
|
|
5392
|
-
"page-sizes",
|
|
5393
|
-
"page-size",
|
|
5394
|
-
"total",
|
|
5395
|
-
"onSizeChange",
|
|
5396
|
-
"onCurrentChange"
|
|
5397
|
-
])])) : (0, vue.createCommentVNode)("v-if", true)
|
|
5398
|
-
], 2)], 16)], 8, ["disabled"]);
|
|
5399
|
-
};
|
|
5400
|
-
}
|
|
5401
|
-
});
|
|
5402
|
-
//#endregion
|
|
5403
|
-
//#region packages/form/src/containers/GroupListItem.vue?vue&type=script&setup=true&lang.ts
|
|
5404
|
-
var _hoisted_1$8 = ["innerHTML"];
|
|
5405
|
-
var _hoisted_2$3 = { style: {
|
|
5406
|
-
"text-align": "right",
|
|
5407
|
-
"margin-top": "20px"
|
|
5408
|
-
} };
|
|
5409
|
-
var _hoisted_3$2 = ["innerHTML"];
|
|
5410
|
-
//#endregion
|
|
5411
|
-
//#region packages/form/src/containers/GroupListItem.vue
|
|
5412
|
-
var GroupListItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5413
|
-
name: "MFormGroupListItem",
|
|
5414
|
-
__name: "GroupListItem",
|
|
5415
|
-
props: {
|
|
5416
|
-
model: {},
|
|
5417
|
-
lastValues: {},
|
|
5418
|
-
isCompare: { type: Boolean },
|
|
5419
|
-
groupModel: {},
|
|
5420
|
-
config: {},
|
|
5421
|
-
labelWidth: {},
|
|
5422
|
-
prop: {},
|
|
5423
|
-
size: {},
|
|
5424
|
-
index: {},
|
|
5425
|
-
disabled: { type: Boolean }
|
|
5426
|
-
},
|
|
5427
|
-
emits: [
|
|
5428
|
-
"swap-item",
|
|
5429
|
-
"remove-item",
|
|
5430
|
-
"change",
|
|
5431
|
-
"addDiffCount",
|
|
5432
|
-
"copy-item"
|
|
5433
|
-
],
|
|
5434
|
-
setup(__props, { emit: __emit }) {
|
|
5435
|
-
const props = __props;
|
|
5436
|
-
const emit = __emit;
|
|
5437
|
-
const mForm = (0, vue.inject)("mForm");
|
|
5438
|
-
const defaultExpandQuantity = props.config.defaultExpandQuantity ?? 7;
|
|
5439
|
-
const expand = (0, vue.ref)(props.config.expandAll || defaultExpandQuantity > props.index);
|
|
5440
|
-
const rowConfig = (0, vue.computed)(() => ({
|
|
5441
|
-
type: "row",
|
|
5442
|
-
span: props.config.span || 24,
|
|
5443
|
-
items: props.config.items,
|
|
5444
|
-
labelWidth: props.config.labelWidth,
|
|
5445
|
-
[mForm?.keyProp || "__key"]: `${props.config[mForm?.keyProp || "__key"]}${String(props.index)}`
|
|
5446
|
-
}));
|
|
5447
|
-
const title = (0, vue.computed)(() => {
|
|
5448
|
-
if (props.config.titleKey && props.model[props.config.titleKey]) return props.model[props.config.titleKey];
|
|
5449
|
-
if (props.config.title) return filterFunction(mForm, props.config.title, props);
|
|
5450
|
-
return `${props.config.titlePrefix || "组"} ${String(props.index + 1)}`;
|
|
5451
|
-
});
|
|
5452
|
-
const length = (0, vue.computed)(() => props.groupModel?.length || 0);
|
|
5453
|
-
const itemExtra = (0, vue.computed)(() => filterFunction(mForm, props.config.itemExtra, props));
|
|
5454
|
-
const removeHandler = () => emit("remove-item", props.index);
|
|
5455
|
-
const changeHandler = (v, eventData) => {
|
|
5456
|
-
emit("change", props.model, eventData);
|
|
5457
|
-
};
|
|
5458
|
-
const expandHandler = () => {
|
|
5459
|
-
expand.value = !expand.value;
|
|
5460
|
-
};
|
|
5461
|
-
const showDelete = (0, vue.computed)(() => {
|
|
5462
|
-
const deleteFunc = props.config.delete;
|
|
5463
|
-
if (deleteFunc && typeof deleteFunc === "function") return deleteFunc(props.model, props.index, mForm?.values);
|
|
5464
|
-
return true;
|
|
5465
|
-
});
|
|
5466
|
-
const changeOrder = (offset = 0) => emit("swap-item", props.index, props.index + offset);
|
|
5467
|
-
const movable = (0, vue.computed)(() => {
|
|
5468
|
-
const { movable } = props.config;
|
|
5469
|
-
if (movable === void 0) return true;
|
|
5470
|
-
if (typeof movable === "function") return movable(mForm, props.index || 0, props.model, props.groupModel);
|
|
5471
|
-
return movable;
|
|
5472
|
-
});
|
|
5473
|
-
const copyable = (0, vue.computed)(() => filterFunction(mForm, props.config.copyable, props));
|
|
5474
|
-
const onAddDiffCount = () => emit("addDiffCount");
|
|
5475
|
-
const copyHandler = () => {
|
|
5476
|
-
emit("copy-item", props.index);
|
|
5477
|
-
};
|
|
5478
|
-
const moveSpecifyLocationVisible = (0, vue.ref)(false);
|
|
5479
|
-
const moveSpecifyLocationIndex = (0, vue.ref)(1);
|
|
5480
|
-
const moveSpecifyLocationHandler = () => {
|
|
5481
|
-
moveSpecifyLocationVisible.value = false;
|
|
5482
|
-
emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
|
|
5483
|
-
};
|
|
5484
|
-
return (_ctx, _cache) => {
|
|
5485
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicCard), {
|
|
5486
|
-
class: "m-fields-group-list-item",
|
|
5487
|
-
"body-style": { display: expand.value ? "block" : "none" }
|
|
5488
|
-
}, {
|
|
5489
|
-
header: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [
|
|
5490
|
-
(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5491
|
-
link: "",
|
|
5492
|
-
disabled: __props.disabled,
|
|
5493
|
-
onClick: expandHandler
|
|
5494
|
-
}, {
|
|
5495
|
-
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), null, {
|
|
5496
|
-
default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretBottom), { key: 0 })) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretRight), { key: 1 }))]),
|
|
5497
|
-
_: 1
|
|
5498
|
-
}), (0, vue.createElementVNode)("span", { innerHTML: title.value }, null, 8, _hoisted_1$8)]),
|
|
5499
|
-
_: 1
|
|
5500
|
-
}, 8, ["disabled"]),
|
|
5501
|
-
(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5502
|
-
type: "danger",
|
|
5503
|
-
size: "small",
|
|
5504
|
-
link: "",
|
|
5505
|
-
icon: (0, vue.unref)(_element_plus_icons_vue.Delete),
|
|
5506
|
-
disabled: __props.disabled,
|
|
5507
|
-
onClick: removeHandler
|
|
5508
|
-
}, null, 8, ["icon", "disabled"]), [[vue.vShow, showDelete.value]]),
|
|
5509
|
-
copyable.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5510
|
-
key: 0,
|
|
5511
|
-
link: "",
|
|
5512
|
-
size: "small",
|
|
5513
|
-
type: "primary",
|
|
5514
|
-
icon: (0, vue.unref)(_element_plus_icons_vue.DocumentCopy),
|
|
5515
|
-
disabled: __props.disabled,
|
|
5516
|
-
onClick: copyHandler
|
|
5517
|
-
}, {
|
|
5518
|
-
default: (0, vue.withCtx)(() => [..._cache[6] || (_cache[6] = [(0, vue.createTextVNode)("复制", -1)])]),
|
|
5519
|
-
_: 1
|
|
5520
|
-
}, 8, ["icon", "disabled"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
5521
|
-
movable.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5522
|
-
link: "",
|
|
5523
|
-
size: "small",
|
|
5524
|
-
disabled: __props.disabled,
|
|
5525
|
-
icon: (0, vue.unref)(_element_plus_icons_vue.CaretTop),
|
|
5526
|
-
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
5527
|
-
}, {
|
|
5528
|
-
default: (0, vue.withCtx)(() => [..._cache[7] || (_cache[7] = [(0, vue.createTextVNode)("上移", -1)])]),
|
|
5529
|
-
_: 1
|
|
5530
|
-
}, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== 0]]), (0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5531
|
-
link: "",
|
|
5532
|
-
size: "small",
|
|
5533
|
-
disabled: __props.disabled,
|
|
5534
|
-
icon: (0, vue.unref)(_element_plus_icons_vue.CaretBottom),
|
|
5535
|
-
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
5536
|
-
}, {
|
|
5537
|
-
default: (0, vue.withCtx)(() => [..._cache[8] || (_cache[8] = [(0, vue.createTextVNode)("下移", -1)])]),
|
|
5538
|
-
_: 1
|
|
5539
|
-
}, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== length.value - 1]])], 64)) : (0, vue.createCommentVNode)("v-if", true),
|
|
5540
|
-
__props.config.moveSpecifyLocation ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicPopover), {
|
|
5541
|
-
key: 2,
|
|
5542
|
-
trigger: "click",
|
|
5543
|
-
placement: "top",
|
|
5544
|
-
width: "200",
|
|
5545
|
-
visible: moveSpecifyLocationVisible.value
|
|
5546
|
-
}, {
|
|
5547
|
-
reference: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5548
|
-
link: "",
|
|
5549
|
-
size: "small",
|
|
5550
|
-
type: "primary",
|
|
5551
|
-
icon: (0, vue.unref)(_element_plus_icons_vue.Position),
|
|
5552
|
-
disabled: __props.disabled,
|
|
5553
|
-
onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
|
|
5554
|
-
}, {
|
|
5555
|
-
default: (0, vue.withCtx)(() => [..._cache[9] || (_cache[9] = [(0, vue.createTextVNode)("移动至", -1)])]),
|
|
5556
|
-
_: 1
|
|
5557
|
-
}, 8, ["icon", "disabled"])]),
|
|
5558
|
-
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [(0, vue.createElementVNode)("div", null, [
|
|
5559
|
-
_cache[10] || (_cache[10] = (0, vue.createTextVNode)(" 第", -1)),
|
|
5560
|
-
(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicInputNumber), {
|
|
5561
|
-
style: { "margin": "0 5px" },
|
|
5562
|
-
modelValue: moveSpecifyLocationIndex.value,
|
|
5563
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
|
|
5564
|
-
size: "small",
|
|
5565
|
-
min: 1,
|
|
5566
|
-
disabled: __props.disabled
|
|
5567
|
-
}, null, 8, ["modelValue", "disabled"]),
|
|
5568
|
-
_cache[11] || (_cache[11] = (0, vue.createTextVNode)("行 ", -1))
|
|
5569
|
-
]), (0, vue.createElementVNode)("div", _hoisted_2$3, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5570
|
-
size: "small",
|
|
5571
|
-
text: "",
|
|
5572
|
-
onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
|
|
5573
|
-
}, {
|
|
5574
|
-
default: (0, vue.withCtx)(() => [..._cache[12] || (_cache[12] = [(0, vue.createTextVNode)("取消", -1)])]),
|
|
5575
|
-
_: 1
|
|
5576
|
-
}), (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5598
|
+
onClick: (0, vue.unref)(toggleFullscreen)
|
|
5599
|
+
}, {
|
|
5600
|
+
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(isFullscreen) ? "退出全屏" : "全屏编辑"), 1)]),
|
|
5601
|
+
_: 1
|
|
5602
|
+
}, 8, ["icon", "onClick"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
5603
|
+
(0, vue.unref)(importable) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicUpload), {
|
|
5604
|
+
key: 2,
|
|
5605
|
+
style: { "display": "inline-block" },
|
|
5606
|
+
ref: "excelBtn",
|
|
5607
|
+
action: "/noop",
|
|
5608
|
+
disabled: __props.disabled,
|
|
5609
|
+
"on-change": (0, vue.unref)(excelHandler),
|
|
5610
|
+
"auto-upload": false
|
|
5611
|
+
}, {
|
|
5612
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5577
5613
|
size: "small",
|
|
5578
|
-
type: "
|
|
5579
|
-
|
|
5614
|
+
type: "success",
|
|
5615
|
+
disabled: __props.disabled,
|
|
5616
|
+
plain: ""
|
|
5580
5617
|
}, {
|
|
5581
|
-
default: (0, vue.withCtx)(() => [..._cache[
|
|
5618
|
+
default: (0, vue.withCtx)(() => [..._cache[0] || (_cache[0] = [(0, vue.createTextVNode)("导入EXCEL", -1)])]),
|
|
5582
5619
|
_: 1
|
|
5583
|
-
}
|
|
5620
|
+
}, 8, ["disabled"])]),
|
|
5584
5621
|
_: 1
|
|
5585
|
-
}, 8, ["
|
|
5586
|
-
|
|
5622
|
+
}, 8, ["disabled", "on-change"])) : (0, vue.createCommentVNode)("v-if", true),
|
|
5623
|
+
(0, vue.unref)(importable) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5587
5624
|
key: 3,
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5625
|
+
size: "small",
|
|
5626
|
+
type: "warning",
|
|
5627
|
+
disabled: __props.disabled,
|
|
5628
|
+
plain: "",
|
|
5629
|
+
onClick: (0, vue.unref)(clearHandler)
|
|
5630
|
+
}, {
|
|
5631
|
+
default: (0, vue.withCtx)(() => [..._cache[1] || (_cache[1] = [(0, vue.createTextVNode)("清空", -1)])]),
|
|
5632
|
+
_: 1
|
|
5633
|
+
}, 8, ["disabled", "onClick"])) : (0, vue.createCommentVNode)("v-if", true)
|
|
5634
|
+
]), (0, vue.renderSlot)(_ctx.$slots, "add-button")]),
|
|
5635
|
+
__props.config.pagination ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPagination), {
|
|
5636
|
+
layout: "total, sizes, prev, pager, next, jumper",
|
|
5637
|
+
"hide-on-single-page": __props.model[modelName.value].length < (0, vue.unref)(pageSize),
|
|
5638
|
+
"current-page": (0, vue.unref)(currentPage) + 1,
|
|
5639
|
+
"page-sizes": [
|
|
5640
|
+
(0, vue.unref)(pageSize),
|
|
5641
|
+
60,
|
|
5642
|
+
120,
|
|
5643
|
+
300
|
|
5644
|
+
],
|
|
5645
|
+
"page-size": (0, vue.unref)(pageSize),
|
|
5646
|
+
total: __props.model[modelName.value].length,
|
|
5647
|
+
onSizeChange: (0, vue.unref)(handleSizeChange),
|
|
5648
|
+
onCurrentChange: (0, vue.unref)(handleCurrentChange)
|
|
5604
5649
|
}, null, 8, [
|
|
5605
|
-
"
|
|
5606
|
-
"
|
|
5607
|
-
"
|
|
5608
|
-
"
|
|
5609
|
-
"
|
|
5610
|
-
"
|
|
5611
|
-
"
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
_: 1
|
|
5615
|
-
}, 8, ["body-style"]);
|
|
5650
|
+
"hide-on-single-page",
|
|
5651
|
+
"current-page",
|
|
5652
|
+
"page-sizes",
|
|
5653
|
+
"page-size",
|
|
5654
|
+
"total",
|
|
5655
|
+
"onSizeChange",
|
|
5656
|
+
"onCurrentChange"
|
|
5657
|
+
])])) : (0, vue.createCommentVNode)("v-if", true)
|
|
5658
|
+
], 2)], 16)], 8, ["disabled"]);
|
|
5616
5659
|
};
|
|
5617
5660
|
}
|
|
5618
5661
|
});
|
|
5619
5662
|
//#endregion
|
|
5620
|
-
//#region packages/form/src/containers/
|
|
5621
|
-
var
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
labelWidth: {},
|
|
5645
|
-
prop: {},
|
|
5646
|
-
size: {},
|
|
5647
|
-
disabled: { type: Boolean },
|
|
5648
|
-
showIndex: { type: Boolean }
|
|
5649
|
-
},
|
|
5650
|
-
emits: ["change", "addDiffCount"],
|
|
5651
|
-
setup(__props, { emit: __emit }) {
|
|
5652
|
-
const props = __props;
|
|
5653
|
-
const emit = __emit;
|
|
5654
|
-
const mForm = (0, vue.inject)("mForm");
|
|
5655
|
-
const changeHandler = (v, eventData) => {
|
|
5656
|
-
emit("change", props.model, eventData);
|
|
5657
|
-
};
|
|
5658
|
-
const addHandler = async () => {
|
|
5659
|
-
if (!props.name) return false;
|
|
5660
|
-
if (props.config.max && props.model[props.name].length >= props.config.max) {
|
|
5661
|
-
_tmagic_design.tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
|
|
5662
|
-
return;
|
|
5663
|
-
}
|
|
5664
|
-
if (typeof props.config.beforeAddRow === "function") {
|
|
5665
|
-
if (!await props.config.beforeAddRow(mForm, {
|
|
5666
|
-
model: props.model[props.name],
|
|
5667
|
-
formValue: mForm?.values,
|
|
5668
|
-
prop: props.prop
|
|
5669
|
-
})) return;
|
|
5670
|
-
}
|
|
5671
|
-
let initValues = {};
|
|
5672
|
-
if (typeof props.config.defaultAdd === "function") initValues = await props.config.defaultAdd(mForm, {
|
|
5673
|
-
model: props.model[props.name],
|
|
5663
|
+
//#region packages/form/src/containers/table-group-list/useAdd.ts
|
|
5664
|
+
var useAdd = (props, emit) => {
|
|
5665
|
+
const mForm = (0, vue.inject)("mForm");
|
|
5666
|
+
const addable = (0, vue.computed)(() => {
|
|
5667
|
+
const modelName = props.name || props.config.name || "";
|
|
5668
|
+
if (!modelName) return false;
|
|
5669
|
+
if (!props.model[modelName].length) return true;
|
|
5670
|
+
if (typeof props.config.addable === "function") return props.config.addable(mForm, {
|
|
5671
|
+
model: props.model[modelName],
|
|
5672
|
+
formValue: mForm?.values,
|
|
5673
|
+
prop: props.prop,
|
|
5674
|
+
config: props.config
|
|
5675
|
+
});
|
|
5676
|
+
return typeof props.config.addable === "undefined" ? true : props.config.addable;
|
|
5677
|
+
});
|
|
5678
|
+
const newHandler = async (row) => {
|
|
5679
|
+
const modelName = props.name || props.config.name || "";
|
|
5680
|
+
if (props.config.max && props.model[modelName].length >= props.config.max) {
|
|
5681
|
+
_tmagic_design.tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
|
|
5682
|
+
return;
|
|
5683
|
+
}
|
|
5684
|
+
if (typeof props.config.beforeAddRow === "function") {
|
|
5685
|
+
if (!await props.config.beforeAddRow(mForm, {
|
|
5686
|
+
model: props.model[modelName],
|
|
5674
5687
|
formValue: mForm?.values,
|
|
5688
|
+
prop: props.prop
|
|
5689
|
+
})) return;
|
|
5690
|
+
}
|
|
5691
|
+
const columns = props.config.items;
|
|
5692
|
+
const enumValues = props.config.enum || [];
|
|
5693
|
+
let enumV = [];
|
|
5694
|
+
const { length } = props.model[modelName];
|
|
5695
|
+
const key = props.config.key || "id";
|
|
5696
|
+
let inputs = {};
|
|
5697
|
+
if (enumValues.length) {
|
|
5698
|
+
if (length >= enumValues.length) return;
|
|
5699
|
+
enumV = enumValues.filter((item) => {
|
|
5700
|
+
let i = 0;
|
|
5701
|
+
for (; i < length; i++) if (item[key] === props.model[modelName][i][key]) break;
|
|
5702
|
+
return i === length;
|
|
5703
|
+
});
|
|
5704
|
+
if (enumV.length > 0) inputs = enumV[0];
|
|
5705
|
+
} else if (Array.isArray(row)) columns.forEach((column, index) => {
|
|
5706
|
+
column.name && (inputs[column.name] = row[index]);
|
|
5707
|
+
});
|
|
5708
|
+
else {
|
|
5709
|
+
if (typeof props.config.defaultAdd === "function") inputs = await props.config.defaultAdd(mForm, {
|
|
5710
|
+
model: props.model[modelName],
|
|
5675
5711
|
prop: props.prop,
|
|
5676
|
-
|
|
5712
|
+
formValue: mForm?.values
|
|
5677
5713
|
});
|
|
5678
|
-
else if (props.config.defaultAdd)
|
|
5679
|
-
|
|
5680
|
-
config:
|
|
5681
|
-
initValues
|
|
5714
|
+
else if (props.config.defaultAdd) inputs = props.config.defaultAdd;
|
|
5715
|
+
inputs = await initValue(mForm, {
|
|
5716
|
+
config: columns,
|
|
5717
|
+
initValues: inputs
|
|
5682
5718
|
});
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
};
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
props.model[props.name].push(cloneDeep(props.model[props.name][index]));
|
|
5696
|
-
};
|
|
5697
|
-
const swapHandler = (idx1, idx2) => {
|
|
5698
|
-
if (!props.name) return false;
|
|
5699
|
-
const { length } = props.model[props.name];
|
|
5700
|
-
const [currRow] = props.model[props.name].splice(idx1, 1);
|
|
5701
|
-
props.model[props.name].splice(Math.min(Math.max(idx2, 0), length - 1), 0, currRow);
|
|
5702
|
-
emit("change", props.model[props.name]);
|
|
5703
|
-
};
|
|
5704
|
-
const onAddDiffCount = () => emit("addDiffCount");
|
|
5705
|
-
const getLastValues = (item, index) => item?.[index] || {};
|
|
5706
|
-
return (_ctx, _cache) => {
|
|
5707
|
-
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$7, [
|
|
5708
|
-
__props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
5709
|
-
key: 0,
|
|
5710
|
-
innerHTML: __props.config.extra,
|
|
5711
|
-
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
5712
|
-
}, null, 8, _hoisted_2$2)) : (0, vue.createCommentVNode)("v-if", true),
|
|
5713
|
-
!__props.model[__props.name] || !__props.model[__props.name].length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$1, [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("span", { class: "el-table__empty-text t-table__empty" }, "暂无数据", -1)])])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)(__props.model[__props.name], (item, index) => {
|
|
5714
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)(GroupListItem_default, {
|
|
5715
|
-
key: index,
|
|
5716
|
-
model: item,
|
|
5717
|
-
lastValues: getLastValues(__props.lastValues?.[__props.name], Number(index)),
|
|
5718
|
-
"is-compare": __props.isCompare,
|
|
5719
|
-
config: __props.config,
|
|
5720
|
-
prop: __props.prop,
|
|
5721
|
-
index: Number(index),
|
|
5722
|
-
"label-width": __props.labelWidth,
|
|
5723
|
-
size: __props.size,
|
|
5724
|
-
disabled: __props.disabled,
|
|
5725
|
-
"group-model": __props.model[__props.name],
|
|
5726
|
-
onRemoveItem: removeHandler,
|
|
5727
|
-
onCopyItem: copyHandler,
|
|
5728
|
-
onSwapItem: swapHandler,
|
|
5729
|
-
onChange: changeHandler,
|
|
5730
|
-
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
5731
|
-
}, null, 8, [
|
|
5732
|
-
"model",
|
|
5733
|
-
"lastValues",
|
|
5734
|
-
"is-compare",
|
|
5735
|
-
"config",
|
|
5736
|
-
"prop",
|
|
5737
|
-
"index",
|
|
5738
|
-
"label-width",
|
|
5739
|
-
"size",
|
|
5740
|
-
"disabled",
|
|
5741
|
-
"group-model"
|
|
5742
|
-
]);
|
|
5743
|
-
}), 128)),
|
|
5744
|
-
(0, vue.createElementVNode)("div", _hoisted_4, [(0, vue.renderSlot)(_ctx.$slots, "toggle-button"), (0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.renderSlot)(_ctx.$slots, "add-button", { trigger: addHandler })])])
|
|
5745
|
-
]);
|
|
5746
|
-
};
|
|
5747
|
-
}
|
|
5748
|
-
});
|
|
5719
|
+
}
|
|
5720
|
+
if (props.sortKey && length) inputs[props.sortKey] = props.model[modelName][length - 1][props.sortKey] - 1;
|
|
5721
|
+
emit("change", [...props.model[modelName], inputs], { changeRecords: [{
|
|
5722
|
+
propPath: `${props.prop}.${props.model[modelName].length}`,
|
|
5723
|
+
value: inputs
|
|
5724
|
+
}] });
|
|
5725
|
+
};
|
|
5726
|
+
return {
|
|
5727
|
+
addable,
|
|
5728
|
+
newHandler
|
|
5729
|
+
};
|
|
5730
|
+
};
|
|
5749
5731
|
//#endregion
|
|
5750
|
-
//#region packages/form/src/containers/TableGroupList.vue
|
|
5732
|
+
//#region packages/form/src/containers/table-group-list/TableGroupList.vue
|
|
5751
5733
|
var TableGroupList_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
5752
5734
|
name: "MFormTableGroupList",
|
|
5753
5735
|
inheritAttrs: false,
|
|
@@ -5772,22 +5754,10 @@
|
|
|
5772
5754
|
"select",
|
|
5773
5755
|
"addDiffCount"
|
|
5774
5756
|
],
|
|
5775
|
-
setup(__props, { emit: __emit }) {
|
|
5757
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
5776
5758
|
const props = __props;
|
|
5777
5759
|
const emit = __emit;
|
|
5778
|
-
const
|
|
5779
|
-
const addable = (0, vue.computed)(() => {
|
|
5780
|
-
const modelName = props.name || props.config.name || "";
|
|
5781
|
-
if (!modelName) return false;
|
|
5782
|
-
if (!props.model[modelName].length) return true;
|
|
5783
|
-
if (typeof props.config.addable === "function") return props.config.addable(mForm, {
|
|
5784
|
-
model: props.model[modelName],
|
|
5785
|
-
formValue: mForm?.values,
|
|
5786
|
-
prop: props.prop,
|
|
5787
|
-
config: props.config
|
|
5788
|
-
});
|
|
5789
|
-
return typeof props.config.addable === "undefined" ? true : props.config.addable;
|
|
5790
|
-
});
|
|
5760
|
+
const { addable, newHandler } = useAdd(props, emit);
|
|
5791
5761
|
const isGroupListType = (type) => type === "groupList" || type === "group-list";
|
|
5792
5762
|
const displayMode = (0, vue.ref)(isGroupListType(props.config.type) ? "groupList" : "table");
|
|
5793
5763
|
const calcLabelWidth = (label) => {
|
|
@@ -5839,8 +5809,15 @@
|
|
|
5839
5809
|
const onChange = (v, eventData) => emit("change", v, eventData);
|
|
5840
5810
|
const onSelect = (...args) => emit("select", ...args);
|
|
5841
5811
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
5812
|
+
const onAdd = (rows) => {
|
|
5813
|
+
rows.forEach((row) => {
|
|
5814
|
+
newHandler(row);
|
|
5815
|
+
});
|
|
5816
|
+
};
|
|
5817
|
+
const tableGroupListRef = (0, vue.useTemplateRef)("tableGroupList");
|
|
5818
|
+
__expose({ toggleRowSelection: (row, selected) => tableGroupListRef.value?.toggleRowSelection?.(row, selected) });
|
|
5842
5819
|
return (_ctx, _cache) => {
|
|
5843
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(displayMode.value === "table" ? Table_default : GroupList_default), (0, vue.mergeProps)(_ctx.$attrs, {
|
|
5820
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(displayMode.value === "table" ? Table_default : GroupList_default), (0, vue.mergeProps)({ ref: "tableGroupList" }, _ctx.$attrs, {
|
|
5844
5821
|
model: __props.model,
|
|
5845
5822
|
name: `${__props.name}`,
|
|
5846
5823
|
config: currentConfig.value,
|
|
@@ -5855,8 +5832,9 @@
|
|
|
5855
5832
|
sort: __props.sort,
|
|
5856
5833
|
onChange,
|
|
5857
5834
|
onSelect,
|
|
5858
|
-
onAddDiffCount
|
|
5859
|
-
|
|
5835
|
+
onAddDiffCount,
|
|
5836
|
+
onAdd
|
|
5837
|
+
}), (0, vue.createSlots)({
|
|
5860
5838
|
"toggle-button": (0, vue.withCtx)(() => [__props.config.enableToggleMode || __props.enableToggleMode ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
5861
5839
|
key: 0,
|
|
5862
5840
|
icon: (0, vue.unref)(_element_plus_icons_vue.Grid),
|
|
@@ -5866,14 +5844,16 @@
|
|
|
5866
5844
|
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(displayMode.value === "table" ? "展开配置" : "切换为表格"), 1)]),
|
|
5867
5845
|
_: 1
|
|
5868
5846
|
}, 8, ["icon"])) : (0, vue.createCommentVNode)("v-if", true)]),
|
|
5869
|
-
|
|
5870
|
-
|
|
5847
|
+
_: 2
|
|
5848
|
+
}, [(0, vue.unref)(addable) ? {
|
|
5849
|
+
name: "add-button",
|
|
5850
|
+
fn: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), (0, vue.mergeProps)({
|
|
5871
5851
|
class: displayMode.value === "table" ? "m-form-table-add-button" : "",
|
|
5872
5852
|
size: addButtonSize.value,
|
|
5873
5853
|
plain: displayMode.value === "table",
|
|
5874
5854
|
icon: (0, vue.unref)(_element_plus_icons_vue.Plus),
|
|
5875
5855
|
disabled: __props.disabled
|
|
5876
|
-
}, currentConfig.value.addButtonConfig?.props || { type: "primary" }, { onClick:
|
|
5856
|
+
}, currentConfig.value.addButtonConfig?.props || { type: "primary" }, { onClick: (0, vue.unref)(newHandler) }), {
|
|
5877
5857
|
default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(currentConfig.value.addButtonConfig?.text || (displayMode.value === "table" ? "新增一行" : "新增")), 1)]),
|
|
5878
5858
|
_: 1
|
|
5879
5859
|
}, 16, [
|
|
@@ -5883,9 +5863,9 @@
|
|
|
5883
5863
|
"icon",
|
|
5884
5864
|
"disabled",
|
|
5885
5865
|
"onClick"
|
|
5886
|
-
])
|
|
5887
|
-
|
|
5888
|
-
},
|
|
5866
|
+
])]),
|
|
5867
|
+
key: "0"
|
|
5868
|
+
} : void 0]), 1040, [
|
|
5889
5869
|
"model",
|
|
5890
5870
|
"name",
|
|
5891
5871
|
"config",
|