@tmagic/form 1.5.2 → 1.5.4
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/style.css +0 -4
- package/dist/tmagic-form.js +234 -82
- package/dist/tmagic-form.umd.cjs +231 -79
- package/package.json +3 -3
- package/src/containers/Container.vue +8 -10
- package/src/containers/GroupList.vue +9 -1
- package/src/containers/GroupListItem.vue +91 -17
- package/src/containers/Table.vue +40 -7
- package/src/fields/RadioGroup.vue +29 -5
- package/src/schema.ts +6 -0
- package/src/theme/table.scss +0 -5
- package/types/index.d.ts +6 -0
package/dist/style.css
CHANGED
package/dist/tmagic-form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, createSlots
|
|
2
|
-
import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
|
|
1
|
+
import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, shallowRef, withModifiers, onBeforeMount, nextTick, resolveDirective, createSlots } from 'vue';
|
|
2
|
+
import { WarningFilled, CaretBottom, CaretRight, Delete, DocumentCopy, CaretTop, Position, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
|
|
3
3
|
import { cloneDeep, isEqual, isEmpty, debounce } from 'lodash-es';
|
|
4
|
-
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessageBox, TMagicDialog,
|
|
4
|
+
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import utc from 'dayjs/plugin/utc';
|
|
7
7
|
import Sortable from 'sortablejs';
|
|
@@ -186,9 +186,9 @@ const datetimeFormatter = (v, defaultValue = "-", format = "YYYY-MM-DD HH:mm:ss"
|
|
|
186
186
|
return defaultValue;
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
const _hoisted_1$
|
|
189
|
+
const _hoisted_1$e = ["data-tmagic-id", "data-tmagic-form-item-prop"];
|
|
190
190
|
const _hoisted_2$7 = ["innerHTML", "title"];
|
|
191
|
-
const _hoisted_3$
|
|
191
|
+
const _hoisted_3$5 = ["innerHTML"];
|
|
192
192
|
const _hoisted_4$3 = ["innerHTML"];
|
|
193
193
|
const _hoisted_5$3 = ["innerHTML"];
|
|
194
194
|
const _hoisted_6$2 = ["innerHTML", "title"];
|
|
@@ -249,7 +249,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
249
249
|
}
|
|
250
250
|
return `${n}`;
|
|
251
251
|
});
|
|
252
|
-
const tagName = computed(() =>
|
|
252
|
+
const tagName = computed(() => {
|
|
253
|
+
if (type.value === "component" && props.config.component) {
|
|
254
|
+
return props.config.component;
|
|
255
|
+
}
|
|
256
|
+
return `m-${items.value ? "form" : "fields"}-${type.value}`;
|
|
257
|
+
});
|
|
253
258
|
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
|
254
259
|
const text = computed(() => filterFunction(mForm, props.config.text, props));
|
|
255
260
|
const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
|
|
@@ -417,7 +422,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
417
422
|
default: withCtx(() => [
|
|
418
423
|
tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
|
|
419
424
|
content: withCtx(() => [
|
|
420
|
-
createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$
|
|
425
|
+
createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
|
|
421
426
|
]),
|
|
422
427
|
default: withCtx(() => [
|
|
423
428
|
(openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
|
|
@@ -645,14 +650,14 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
645
650
|
_: 1
|
|
646
651
|
})
|
|
647
652
|
])) : createCommentVNode("", true)
|
|
648
|
-
], 14, _hoisted_1$
|
|
653
|
+
], 14, _hoisted_1$e)) : createCommentVNode("", true);
|
|
649
654
|
};
|
|
650
655
|
}
|
|
651
656
|
});
|
|
652
657
|
|
|
653
|
-
const _hoisted_1$
|
|
658
|
+
const _hoisted_1$d = ["innerHTML"];
|
|
654
659
|
const _hoisted_2$6 = ["innerHTML"];
|
|
655
|
-
const _hoisted_3$
|
|
660
|
+
const _hoisted_3$4 = { key: 1 };
|
|
656
661
|
const _hoisted_4$2 = ["innerHTML"];
|
|
657
662
|
const _hoisted_5$2 = ["innerHTML"];
|
|
658
663
|
const _hoisted_6$1 = {
|
|
@@ -722,7 +727,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
722
727
|
default: withCtx(() => [
|
|
723
728
|
createElementVNode("span", {
|
|
724
729
|
innerHTML: _ctx.config.legend
|
|
725
|
-
}, null, 8, _hoisted_1$
|
|
730
|
+
}, null, 8, _hoisted_1$d),
|
|
726
731
|
_ctx.config.extra ? (openBlock(), createElementBlock("span", {
|
|
727
732
|
key: 0,
|
|
728
733
|
innerHTML: _ctx.config.extra,
|
|
@@ -733,7 +738,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
733
738
|
}, 8, ["modelValue", "prop"])
|
|
734
739
|
]),
|
|
735
740
|
_: 1
|
|
736
|
-
})) : (openBlock(), createElementBlock("legend", _hoisted_3$
|
|
741
|
+
})) : (openBlock(), createElementBlock("legend", _hoisted_3$4, [
|
|
737
742
|
createElementVNode("span", {
|
|
738
743
|
innerHTML: _ctx.config.legend
|
|
739
744
|
}, null, 8, _hoisted_4$2),
|
|
@@ -787,8 +792,9 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
787
792
|
}
|
|
788
793
|
});
|
|
789
794
|
|
|
790
|
-
const _hoisted_1$
|
|
791
|
-
const _hoisted_2$5 =
|
|
795
|
+
const _hoisted_1$c = { class: "m-fields-group-list-item" };
|
|
796
|
+
const _hoisted_2$5 = { style: { "text-align": "right", "margin-top": "20px" } };
|
|
797
|
+
const _hoisted_3$3 = ["innerHTML"];
|
|
792
798
|
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
793
799
|
...{
|
|
794
800
|
name: "MFormGroupListItem"
|
|
@@ -806,7 +812,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
806
812
|
index: {},
|
|
807
813
|
disabled: { type: Boolean }
|
|
808
814
|
},
|
|
809
|
-
emits: ["swap-item", "remove-item", "change", "addDiffCount"],
|
|
815
|
+
emits: ["swap-item", "remove-item", "change", "addDiffCount", "copy-item"],
|
|
810
816
|
setup(__props, { emit: __emit }) {
|
|
811
817
|
const props = __props;
|
|
812
818
|
const emit = __emit;
|
|
@@ -838,25 +844,35 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
838
844
|
const expandHandler = () => {
|
|
839
845
|
expand.value = !expand.value;
|
|
840
846
|
};
|
|
841
|
-
const showDelete = (
|
|
847
|
+
const showDelete = computed(() => {
|
|
842
848
|
const deleteFunc = props.config.delete;
|
|
843
849
|
if (deleteFunc && typeof deleteFunc === "function") {
|
|
844
|
-
return deleteFunc(props.model, index, mForm?.values);
|
|
850
|
+
return deleteFunc(props.model, props.index, mForm?.values);
|
|
845
851
|
}
|
|
846
852
|
return true;
|
|
847
|
-
};
|
|
853
|
+
});
|
|
848
854
|
const changeOrder = (offset = 0) => emit("swap-item", props.index, props.index + offset);
|
|
849
|
-
const movable = () => {
|
|
855
|
+
const movable = computed(() => {
|
|
850
856
|
const { movable: movable2 } = props.config;
|
|
851
857
|
if (movable2 === void 0) return true;
|
|
852
858
|
if (typeof movable2 === "function") {
|
|
853
859
|
return movable2(mForm, props.index || 0, props.model, props.groupModel);
|
|
854
860
|
}
|
|
855
861
|
return movable2;
|
|
856
|
-
};
|
|
862
|
+
});
|
|
863
|
+
const copyable = computed(() => filterFunction(mForm, props.config.copyable, props));
|
|
857
864
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
865
|
+
const copyHandler = () => {
|
|
866
|
+
emit("copy-item", props.index);
|
|
867
|
+
};
|
|
868
|
+
const moveSpecifyLocationVisible = ref(false);
|
|
869
|
+
const moveSpecifyLocationIndex = ref(1);
|
|
870
|
+
const moveSpecifyLocationHandler = () => {
|
|
871
|
+
moveSpecifyLocationVisible.value = false;
|
|
872
|
+
emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
|
|
873
|
+
};
|
|
858
874
|
return (_ctx, _cache) => {
|
|
859
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
875
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
860
876
|
createElementVNode("div", null, [
|
|
861
877
|
createVNode(unref(TMagicButton), {
|
|
862
878
|
link: "",
|
|
@@ -875,59 +891,126 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
875
891
|
_: 1
|
|
876
892
|
}, 8, ["disabled"]),
|
|
877
893
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
878
|
-
|
|
894
|
+
type: "danger",
|
|
895
|
+
size: "small",
|
|
879
896
|
link: "",
|
|
880
897
|
icon: unref(Delete),
|
|
881
898
|
disabled: _ctx.disabled,
|
|
882
899
|
onClick: removeHandler
|
|
883
900
|
}, null, 8, ["icon", "disabled"]), [
|
|
884
|
-
[vShow, showDelete
|
|
901
|
+
[vShow, showDelete.value]
|
|
885
902
|
]),
|
|
886
|
-
|
|
903
|
+
copyable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
904
|
+
key: 0,
|
|
905
|
+
link: "",
|
|
906
|
+
size: "small",
|
|
907
|
+
type: "primary",
|
|
908
|
+
icon: unref(DocumentCopy),
|
|
909
|
+
disabled: _ctx.disabled,
|
|
910
|
+
onClick: copyHandler
|
|
911
|
+
}, {
|
|
912
|
+
default: withCtx(() => _cache[6] || (_cache[6] = [
|
|
913
|
+
createTextVNode("复制")
|
|
914
|
+
])),
|
|
915
|
+
_: 1
|
|
916
|
+
}, 8, ["icon", "disabled"])) : createCommentVNode("", true),
|
|
917
|
+
movable.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
887
918
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
888
919
|
link: "",
|
|
889
|
-
disabled: _ctx.disabled,
|
|
890
920
|
size: "small",
|
|
921
|
+
disabled: _ctx.disabled,
|
|
922
|
+
icon: unref(CaretTop),
|
|
891
923
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
892
924
|
}, {
|
|
893
|
-
default: withCtx(() => [
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
default: withCtx(() => [
|
|
897
|
-
createVNode(unref(CaretTop))
|
|
898
|
-
]),
|
|
899
|
-
_: 1
|
|
900
|
-
})
|
|
901
|
-
]),
|
|
925
|
+
default: withCtx(() => _cache[7] || (_cache[7] = [
|
|
926
|
+
createTextVNode("上移")
|
|
927
|
+
])),
|
|
902
928
|
_: 1
|
|
903
|
-
}, 8, ["disabled"]), [
|
|
929
|
+
}, 8, ["disabled", "icon"]), [
|
|
904
930
|
[vShow, _ctx.index !== 0]
|
|
905
931
|
]),
|
|
906
932
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
907
|
-
disabled: _ctx.disabled,
|
|
908
933
|
link: "",
|
|
909
934
|
size: "small",
|
|
935
|
+
disabled: _ctx.disabled,
|
|
936
|
+
icon: unref(CaretBottom),
|
|
910
937
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
911
938
|
}, {
|
|
912
|
-
default: withCtx(() => [
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
default: withCtx(() => [
|
|
916
|
-
createVNode(unref(CaretBottom))
|
|
917
|
-
]),
|
|
918
|
-
_: 1
|
|
919
|
-
})
|
|
920
|
-
]),
|
|
939
|
+
default: withCtx(() => _cache[8] || (_cache[8] = [
|
|
940
|
+
createTextVNode("下移")
|
|
941
|
+
])),
|
|
921
942
|
_: 1
|
|
922
|
-
}, 8, ["disabled"]), [
|
|
943
|
+
}, 8, ["disabled", "icon"]), [
|
|
923
944
|
[vShow, _ctx.index !== length.value - 1]
|
|
924
945
|
])
|
|
925
946
|
], 64)) : createCommentVNode("", true),
|
|
947
|
+
_ctx.config.moveSpecifyLocation ? (openBlock(), createBlock(unref(TMagicPopover), {
|
|
948
|
+
key: 2,
|
|
949
|
+
trigger: "click",
|
|
950
|
+
placement: "top",
|
|
951
|
+
width: "200",
|
|
952
|
+
visible: moveSpecifyLocationVisible.value
|
|
953
|
+
}, {
|
|
954
|
+
reference: withCtx(() => [
|
|
955
|
+
createVNode(unref(TMagicButton), {
|
|
956
|
+
link: "",
|
|
957
|
+
size: "small",
|
|
958
|
+
type: "primary",
|
|
959
|
+
icon: unref(Position),
|
|
960
|
+
disabled: _ctx.disabled,
|
|
961
|
+
onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
|
|
962
|
+
}, {
|
|
963
|
+
default: withCtx(() => _cache[9] || (_cache[9] = [
|
|
964
|
+
createTextVNode("移动至")
|
|
965
|
+
])),
|
|
966
|
+
_: 1
|
|
967
|
+
}, 8, ["icon", "disabled"])
|
|
968
|
+
]),
|
|
969
|
+
default: withCtx(() => [
|
|
970
|
+
createElementVNode("div", null, [
|
|
971
|
+
createElementVNode("div", null, [
|
|
972
|
+
_cache[10] || (_cache[10] = createTextVNode(" 第")),
|
|
973
|
+
createVNode(unref(TMagicInputNumber), {
|
|
974
|
+
style: { "margin": "0 5px" },
|
|
975
|
+
modelValue: moveSpecifyLocationIndex.value,
|
|
976
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
|
|
977
|
+
size: "small",
|
|
978
|
+
min: 1,
|
|
979
|
+
disabled: _ctx.disabled
|
|
980
|
+
}, null, 8, ["modelValue", "disabled"]),
|
|
981
|
+
_cache[11] || (_cache[11] = createTextVNode("行 "))
|
|
982
|
+
]),
|
|
983
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
984
|
+
createVNode(unref(TMagicButton), {
|
|
985
|
+
size: "small",
|
|
986
|
+
text: "",
|
|
987
|
+
onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
|
|
988
|
+
}, {
|
|
989
|
+
default: withCtx(() => _cache[12] || (_cache[12] = [
|
|
990
|
+
createTextVNode("取消")
|
|
991
|
+
])),
|
|
992
|
+
_: 1
|
|
993
|
+
}),
|
|
994
|
+
createVNode(unref(TMagicButton), {
|
|
995
|
+
size: "small",
|
|
996
|
+
type: "primary",
|
|
997
|
+
onClick: moveSpecifyLocationHandler
|
|
998
|
+
}, {
|
|
999
|
+
default: withCtx(() => _cache[13] || (_cache[13] = [
|
|
1000
|
+
createTextVNode("确认")
|
|
1001
|
+
])),
|
|
1002
|
+
_: 1
|
|
1003
|
+
})
|
|
1004
|
+
])
|
|
1005
|
+
])
|
|
1006
|
+
]),
|
|
1007
|
+
_: 1
|
|
1008
|
+
}, 8, ["visible"])) : createCommentVNode("", true),
|
|
926
1009
|
itemExtra.value ? (openBlock(), createElementBlock("span", {
|
|
927
|
-
key:
|
|
1010
|
+
key: 3,
|
|
928
1011
|
innerHTML: itemExtra.value,
|
|
929
1012
|
class: "m-form-tip"
|
|
930
|
-
}, null, 8,
|
|
1013
|
+
}, null, 8, _hoisted_3$3)) : createCommentVNode("", true)
|
|
931
1014
|
]),
|
|
932
1015
|
expand.value ? (openBlock(), createBlock(_sfc_main$x, {
|
|
933
1016
|
key: 0,
|
|
@@ -940,14 +1023,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
940
1023
|
size: _ctx.size,
|
|
941
1024
|
disabled: _ctx.disabled,
|
|
942
1025
|
onChange: changeHandler,
|
|
943
|
-
onAddDiffCount: _cache[
|
|
1026
|
+
onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
|
|
944
1027
|
}, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("", true)
|
|
945
1028
|
]);
|
|
946
1029
|
};
|
|
947
1030
|
}
|
|
948
1031
|
});
|
|
949
1032
|
|
|
950
|
-
const _hoisted_1$
|
|
1033
|
+
const _hoisted_1$b = { class: "m-fields-group-list" };
|
|
951
1034
|
const _hoisted_2$4 = ["innerHTML"];
|
|
952
1035
|
const _hoisted_3$2 = {
|
|
953
1036
|
key: 1,
|
|
@@ -1021,10 +1104,14 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1021
1104
|
props.model[props.name].splice(index, 1);
|
|
1022
1105
|
emit("change", props.model[props.name]);
|
|
1023
1106
|
};
|
|
1107
|
+
const copyHandler = (index) => {
|
|
1108
|
+
props.model[props.name].push(cloneDeep(props.model[props.name][index]));
|
|
1109
|
+
};
|
|
1024
1110
|
const swapHandler = (idx1, idx2) => {
|
|
1025
1111
|
if (!props.name) return false;
|
|
1112
|
+
const { length } = props.model[props.name];
|
|
1026
1113
|
const [currRow] = props.model[props.name].splice(idx1, 1);
|
|
1027
|
-
props.model[props.name].splice(idx2, 0, currRow);
|
|
1114
|
+
props.model[props.name].splice(Math.min(Math.max(idx2, 0), length - 1), 0, currRow);
|
|
1028
1115
|
emit("change", props.model[props.name]);
|
|
1029
1116
|
};
|
|
1030
1117
|
const toggleMode = () => {
|
|
@@ -1039,7 +1126,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1039
1126
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
1040
1127
|
const getLastValues = (item, index) => item?.[index] || {};
|
|
1041
1128
|
return (_ctx, _cache) => {
|
|
1042
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1129
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
1043
1130
|
_ctx.config.extra ? (openBlock(), createElementBlock("div", {
|
|
1044
1131
|
key: 0,
|
|
1045
1132
|
innerHTML: _ctx.config.extra,
|
|
@@ -1061,6 +1148,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1061
1148
|
disabled: _ctx.disabled,
|
|
1062
1149
|
"group-model": _ctx.model[_ctx.name],
|
|
1063
1150
|
onRemoveItem: removeHandler,
|
|
1151
|
+
onCopyItem: copyHandler,
|
|
1064
1152
|
onSwapItem: swapHandler,
|
|
1065
1153
|
onChange: changeHandler,
|
|
1066
1154
|
onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
|
|
@@ -1094,7 +1182,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
1094
1182
|
}
|
|
1095
1183
|
});
|
|
1096
1184
|
|
|
1097
|
-
const _hoisted_1$
|
|
1185
|
+
const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
1098
1186
|
const _hoisted_2$3 = ["innerHTML"];
|
|
1099
1187
|
const _hoisted_3$1 = {
|
|
1100
1188
|
key: 0,
|
|
@@ -1137,7 +1225,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1137
1225
|
"body-style": { display: expand.value ? "block" : "none" }
|
|
1138
1226
|
}, {
|
|
1139
1227
|
header: withCtx(() => [
|
|
1140
|
-
createElementVNode("div", _hoisted_1$
|
|
1228
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
1141
1229
|
createVNode(unref(TMagicButton), {
|
|
1142
1230
|
style: { "padding": "0" },
|
|
1143
1231
|
link: "",
|
|
@@ -1385,7 +1473,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
1385
1473
|
}
|
|
1386
1474
|
});
|
|
1387
1475
|
|
|
1388
|
-
const _hoisted_1$
|
|
1476
|
+
const _hoisted_1$9 = { class: "m-fields-table-wrap" };
|
|
1389
1477
|
const _hoisted_2$2 = ["innerHTML"];
|
|
1390
1478
|
const _hoisted_3 = ["innerHTML"];
|
|
1391
1479
|
const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
@@ -1670,6 +1758,21 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1670
1758
|
}
|
|
1671
1759
|
return true;
|
|
1672
1760
|
};
|
|
1761
|
+
const copyable = (index) => {
|
|
1762
|
+
const copyableFunc = props.config.copyable;
|
|
1763
|
+
if (copyableFunc && typeof copyableFunc === "function") {
|
|
1764
|
+
return copyableFunc(mForm, {
|
|
1765
|
+
values: mForm?.initValues || {},
|
|
1766
|
+
model: props.model,
|
|
1767
|
+
parent: mForm?.parentValues || {},
|
|
1768
|
+
formValue: mForm?.values || props.model,
|
|
1769
|
+
prop: props.prop,
|
|
1770
|
+
config: props.config,
|
|
1771
|
+
index
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
return true;
|
|
1775
|
+
};
|
|
1673
1776
|
const clearHandler = () => {
|
|
1674
1777
|
const len = props.model[modelName.value].length;
|
|
1675
1778
|
props.model[modelName.value].splice(0, len);
|
|
@@ -1707,6 +1810,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1707
1810
|
const handleCurrentChange = (val) => {
|
|
1708
1811
|
pagecontext.value = val - 1;
|
|
1709
1812
|
};
|
|
1813
|
+
const copyHandler = (index) => {
|
|
1814
|
+
props.model[modelName.value].push(cloneDeep(props.model[modelName.value][index]));
|
|
1815
|
+
};
|
|
1710
1816
|
const toggleMode = () => {
|
|
1711
1817
|
const calcLabelWidth = (label) => {
|
|
1712
1818
|
if (!label) return "0px";
|
|
@@ -1751,7 +1857,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1751
1857
|
toggleRowSelection
|
|
1752
1858
|
});
|
|
1753
1859
|
return (_ctx, _cache) => {
|
|
1754
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1860
|
+
return openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
1755
1861
|
(openBlock(), createBlock(Teleport, {
|
|
1756
1862
|
to: "body",
|
|
1757
1863
|
disabled: !isFullscreen.value
|
|
@@ -1803,23 +1909,32 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
1803
1909
|
})) : createCommentVNode("", true),
|
|
1804
1910
|
createVNode(unref(TMagicTableColumn), {
|
|
1805
1911
|
label: "操作",
|
|
1806
|
-
width: _ctx.config.operateColWidth ||
|
|
1912
|
+
width: _ctx.config.operateColWidth || 100,
|
|
1807
1913
|
align: "center",
|
|
1808
1914
|
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
1809
1915
|
}, {
|
|
1810
1916
|
default: withCtx((scope) => [
|
|
1811
1917
|
renderSlot(_ctx.$slots, "operateCol", { scope }),
|
|
1812
|
-
withDirectives(createVNode(unref(
|
|
1813
|
-
|
|
1918
|
+
withDirectives(createVNode(unref(TMagicButton), {
|
|
1919
|
+
size: "small",
|
|
1920
|
+
type: "danger",
|
|
1921
|
+
link: "",
|
|
1922
|
+
title: "删除",
|
|
1923
|
+
icon: unref(Delete),
|
|
1814
1924
|
onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1815
|
-
},
|
|
1816
|
-
default: withCtx(() => [
|
|
1817
|
-
createVNode(unref(Delete))
|
|
1818
|
-
]),
|
|
1819
|
-
_: 2
|
|
1820
|
-
}, 1032, ["onClick"]), [
|
|
1925
|
+
}, null, 8, ["icon", "onClick"]), [
|
|
1821
1926
|
[vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
|
|
1822
|
-
])
|
|
1927
|
+
]),
|
|
1928
|
+
copyable(scope.$index + 1 + pagecontext.value * pagesize.value - 1) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1929
|
+
key: 0,
|
|
1930
|
+
link: "",
|
|
1931
|
+
size: "small",
|
|
1932
|
+
type: "primary",
|
|
1933
|
+
title: "复制",
|
|
1934
|
+
icon: unref(DocumentCopy),
|
|
1935
|
+
disabled: _ctx.disabled,
|
|
1936
|
+
onClick: ($event) => copyHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1937
|
+
}, null, 8, ["icon", "disabled", "onClick"])) : createCommentVNode("", true)
|
|
1823
1938
|
]),
|
|
1824
1939
|
_: 3
|
|
1825
1940
|
}, 8, ["width", "fixed"]),
|
|
@@ -2708,7 +2823,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2708
2823
|
}
|
|
2709
2824
|
});
|
|
2710
2825
|
|
|
2711
|
-
const _hoisted_1$
|
|
2826
|
+
const _hoisted_1$8 = { key: 0 };
|
|
2712
2827
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2713
2828
|
...{
|
|
2714
2829
|
name: "MFormDisplay"
|
|
@@ -2732,12 +2847,12 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
2732
2847
|
}
|
|
2733
2848
|
useAddField(props.prop);
|
|
2734
2849
|
return (_ctx, _cache) => {
|
|
2735
|
-
return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$
|
|
2850
|
+
return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
|
|
2736
2851
|
};
|
|
2737
2852
|
}
|
|
2738
2853
|
});
|
|
2739
2854
|
|
|
2740
|
-
const _hoisted_1$
|
|
2855
|
+
const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
|
|
2741
2856
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2742
2857
|
...{
|
|
2743
2858
|
name: "MFormDynamicField"
|
|
@@ -2804,7 +2919,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2804
2919
|
});
|
|
2805
2920
|
};
|
|
2806
2921
|
return (_ctx, _cache) => {
|
|
2807
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2922
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
2808
2923
|
createVNode(unref(TMagicForm), { size: "small" }, {
|
|
2809
2924
|
default: withCtx(() => [
|
|
2810
2925
|
(openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
|
|
@@ -3038,7 +3153,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3038
3153
|
}
|
|
3039
3154
|
});
|
|
3040
3155
|
|
|
3041
|
-
const _hoisted_1$
|
|
3156
|
+
const _hoisted_1$6 = { style: { "min-height": "1px" } };
|
|
3042
3157
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
3043
3158
|
...{
|
|
3044
3159
|
name: "MFormDialog"
|
|
@@ -3148,7 +3263,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3148
3263
|
style: { "text-align": "left" }
|
|
3149
3264
|
}, {
|
|
3150
3265
|
default: withCtx(() => [
|
|
3151
|
-
createElementVNode("div", _hoisted_1$
|
|
3266
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
3152
3267
|
renderSlot(_ctx.$slots, "left")
|
|
3153
3268
|
])
|
|
3154
3269
|
]),
|
|
@@ -3239,7 +3354,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3239
3354
|
}
|
|
3240
3355
|
});
|
|
3241
3356
|
|
|
3242
|
-
const _hoisted_1$
|
|
3357
|
+
const _hoisted_1$5 = ["href"];
|
|
3243
3358
|
const _hoisted_2$1 = {
|
|
3244
3359
|
key: 2,
|
|
3245
3360
|
class: "m-fields-link"
|
|
@@ -3313,7 +3428,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3313
3428
|
target: "_blank",
|
|
3314
3429
|
href: href.value,
|
|
3315
3430
|
style: normalizeStyle(_ctx.config.css || {})
|
|
3316
|
-
}, toDisplayString(displayText.value), 13, _hoisted_1$
|
|
3431
|
+
}, toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
|
|
3317
3432
|
key: 1,
|
|
3318
3433
|
style: normalizeStyle(_ctx.config.disabledCss || {})
|
|
3319
3434
|
}, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
@@ -3392,7 +3507,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3392
3507
|
}
|
|
3393
3508
|
});
|
|
3394
3509
|
|
|
3395
|
-
const _hoisted_1$
|
|
3510
|
+
const _hoisted_1$4 = { class: "m-fields-number-range" };
|
|
3396
3511
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
3397
3512
|
...{
|
|
3398
3513
|
name: "MFormNumberRange"
|
|
@@ -3424,7 +3539,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3424
3539
|
emit("change", [props.model[props.name][0], Number(v)]);
|
|
3425
3540
|
};
|
|
3426
3541
|
return (_ctx, _cache) => {
|
|
3427
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3542
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
3428
3543
|
createVNode(unref(TMagicInput), {
|
|
3429
3544
|
modelValue: _ctx.model[_ctx.name][0],
|
|
3430
3545
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
|
|
@@ -3447,6 +3562,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3447
3562
|
}
|
|
3448
3563
|
});
|
|
3449
3564
|
|
|
3565
|
+
const _hoisted_1$3 = { key: 1 };
|
|
3450
3566
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
3451
3567
|
...{
|
|
3452
3568
|
name: "MFormRadioGroup"
|
|
@@ -3466,10 +3582,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3466
3582
|
emits: ["change"],
|
|
3467
3583
|
setup(__props, { emit: __emit }) {
|
|
3468
3584
|
const props = __props;
|
|
3585
|
+
const itemComponent = computed(() => props.config.childType === "button" ? TMagicRadioButton : TMagicRadio);
|
|
3469
3586
|
const emit = __emit;
|
|
3470
3587
|
const changeHandler = (value) => {
|
|
3471
3588
|
emit("change", value);
|
|
3472
3589
|
};
|
|
3590
|
+
const clickHandler = (item) => {
|
|
3591
|
+
props.model[props.name] = props.model[props.name] === item ? "" : item;
|
|
3592
|
+
changeHandler(props.model[props.name]);
|
|
3593
|
+
};
|
|
3473
3594
|
useAddField(props.prop);
|
|
3474
3595
|
return (_ctx, _cache) => {
|
|
3475
3596
|
return _ctx.model ? (openBlock(), createBlock(unref(TMagicRadioGroup), {
|
|
@@ -3477,20 +3598,51 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3477
3598
|
modelValue: _ctx.model[_ctx.name],
|
|
3478
3599
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
|
|
3479
3600
|
size: _ctx.size,
|
|
3480
|
-
disabled: _ctx.disabled
|
|
3481
|
-
onChange: changeHandler
|
|
3601
|
+
disabled: _ctx.disabled
|
|
3482
3602
|
}, {
|
|
3483
3603
|
default: withCtx(() => [
|
|
3484
3604
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.options, (option) => {
|
|
3485
|
-
return openBlock(), createBlock(
|
|
3605
|
+
return openBlock(), createBlock(resolveDynamicComponent(itemComponent.value), {
|
|
3486
3606
|
value: option.value,
|
|
3487
|
-
key: `${option.value}
|
|
3607
|
+
key: `${option.value}`,
|
|
3608
|
+
onClick: withModifiers(($event) => clickHandler(option.value), ["prevent"])
|
|
3488
3609
|
}, {
|
|
3489
3610
|
default: withCtx(() => [
|
|
3490
|
-
|
|
3611
|
+
option.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3612
|
+
key: 0,
|
|
3613
|
+
placement: "top-start",
|
|
3614
|
+
content: option.tooltip
|
|
3615
|
+
}, {
|
|
3616
|
+
default: withCtx(() => [
|
|
3617
|
+
createElementVNode("div", null, [
|
|
3618
|
+
option.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
3619
|
+
key: 0,
|
|
3620
|
+
size: "16"
|
|
3621
|
+
}, {
|
|
3622
|
+
default: withCtx(() => [
|
|
3623
|
+
(openBlock(), createBlock(resolveDynamicComponent(option.icon)))
|
|
3624
|
+
]),
|
|
3625
|
+
_: 2
|
|
3626
|
+
}, 1024)) : createCommentVNode("", true),
|
|
3627
|
+
createElementVNode("span", null, toDisplayString(option.text), 1)
|
|
3628
|
+
])
|
|
3629
|
+
]),
|
|
3630
|
+
_: 2
|
|
3631
|
+
}, 1032, ["content"])) : (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
3632
|
+
option.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
3633
|
+
key: 0,
|
|
3634
|
+
size: "16"
|
|
3635
|
+
}, {
|
|
3636
|
+
default: withCtx(() => [
|
|
3637
|
+
(openBlock(), createBlock(resolveDynamicComponent(option.icon)))
|
|
3638
|
+
]),
|
|
3639
|
+
_: 2
|
|
3640
|
+
}, 1024)) : createCommentVNode("", true),
|
|
3641
|
+
createElementVNode("span", null, toDisplayString(option.text), 1)
|
|
3642
|
+
]))
|
|
3491
3643
|
]),
|
|
3492
3644
|
_: 2
|
|
3493
|
-
}, 1032, ["value"]);
|
|
3645
|
+
}, 1032, ["value", "onClick"]);
|
|
3494
3646
|
}), 128))
|
|
3495
3647
|
]),
|
|
3496
3648
|
_: 1
|