@tmagic/form 1.7.0-beta.2 → 1.7.0-beta.3

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.
@@ -1,7 +1,7 @@
1
1
  import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, createCommentVNode, mergeProps, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, readonly, withDirectives, vShow, renderSlot, getCurrentInstance, createSlots, onUnmounted, reactive, onBeforeUnmount, vModelText, useTemplateRef, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, withModifiers, Teleport, h } from 'vue';
2
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, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessage, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, useZIndex, TMagicTable, TMagicUpload, TMagicPagination, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicPopover, TMagicInputNumber, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessage, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, useZIndex, TMagicTable, TMagicUpload, TMagicPagination, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
5
5
  import { getValueByKeyPath, setValueByKeyPath, isNumber, asyncLoadJs } from '@tmagic/utils';
6
6
  import dayjs from 'dayjs';
7
7
  import utc from 'dayjs/plugin/utc';
@@ -227,8 +227,8 @@ const sortChange = (data, { prop, order }) => {
227
227
 
228
228
  const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
229
229
  const _hoisted_2$7 = ["innerHTML", "title"];
230
- const _hoisted_3$6 = ["innerHTML"];
231
- const _hoisted_4$3 = ["innerHTML"];
230
+ const _hoisted_3$5 = ["innerHTML"];
231
+ const _hoisted_4$4 = ["innerHTML"];
232
232
  const _hoisted_5$3 = ["innerHTML", "title"];
233
233
  const _hoisted_6$1 = ["innerHTML"];
234
234
  const _hoisted_7$1 = ["innerHTML"];
@@ -495,7 +495,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
495
495
  content: withCtx(() => [
496
496
  createElementVNode("div", {
497
497
  innerHTML: tooltip.value.text
498
- }, null, 8, _hoisted_3$6)
498
+ }, null, 8, _hoisted_3$5)
499
499
  ]),
500
500
  default: withCtx(() => [
501
501
  (openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
@@ -524,7 +524,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
524
524
  content: withCtx(() => [
525
525
  createElementVNode("div", {
526
526
  innerHTML: __props.config.tip
527
- }, null, 8, _hoisted_4$3)
527
+ }, null, 8, _hoisted_4$4)
528
528
  ]),
529
529
  default: withCtx(() => [
530
530
  createVNode(unref(TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -721,8 +721,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
721
721
 
722
722
  const _hoisted_1$c = ["innerHTML"];
723
723
  const _hoisted_2$6 = ["innerHTML"];
724
- const _hoisted_3$5 = { key: 1 };
725
- const _hoisted_4$2 = ["innerHTML"];
724
+ const _hoisted_3$4 = { key: 1 };
725
+ const _hoisted_4$3 = ["innerHTML"];
726
726
  const _hoisted_5$2 = ["innerHTML"];
727
727
  const _hoisted_6 = {
728
728
  key: 2,
@@ -822,10 +822,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
822
822
  ]),
823
823
  _: 1
824
824
  /* STABLE */
825
- })) : (openBlock(), createElementBlock("legend", _hoisted_3$5, [
825
+ })) : (openBlock(), createElementBlock("legend", _hoisted_3$4, [
826
826
  createElementVNode("span", {
827
827
  innerHTML: __props.config.legend
828
- }, null, 8, _hoisted_4$2),
828
+ }, null, 8, _hoisted_4$3),
829
829
  __props.config.extra ? (openBlock(), createElementBlock("span", {
830
830
  key: 0,
831
831
  innerHTML: __props.config.extra,
@@ -954,9 +954,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
954
954
  }
955
955
  });
956
956
 
957
- const _hoisted_1$b = { class: "m-fields-group-list-item" };
958
- const _hoisted_2$5 = { style: { "text-align": "right", "margin-top": "20px" } };
959
- const _hoisted_3$4 = ["innerHTML"];
957
+ const _hoisted_1$b = { style: { "text-align": "right", "margin-top": "20px" } };
958
+ const _hoisted_2$5 = ["innerHTML"];
960
959
  const _sfc_main$x = /* @__PURE__ */ defineComponent({
961
960
  ...{
962
961
  name: "MFormGroupListItem"
@@ -1035,211 +1034,220 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1035
1034
  emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
1036
1035
  };
1037
1036
  return (_ctx, _cache) => {
1038
- return openBlock(), createElementBlock("div", _hoisted_1$b, [
1039
- createElementVNode("div", null, [
1040
- createVNode(unref(TMagicButton), {
1041
- link: "",
1042
- disabled: __props.disabled,
1043
- onClick: expandHandler
1044
- }, {
1045
- default: withCtx(() => [
1046
- createVNode(unref(TMagicIcon), null, {
1047
- default: withCtx(() => [
1048
- expand.value ? (openBlock(), createBlock(unref(CaretBottom), { key: 0 })) : (openBlock(), createBlock(unref(CaretRight), { key: 1 }))
1049
- ]),
1050
- _: 1
1051
- /* STABLE */
1052
- }),
1053
- createTextVNode(
1054
- toDisplayString(title.value),
1055
- 1
1056
- /* TEXT */
1057
- )
1058
- ]),
1059
- _: 1
1060
- /* STABLE */
1061
- }, 8, ["disabled"]),
1062
- withDirectives(createVNode(unref(TMagicButton), {
1063
- type: "danger",
1064
- size: "small",
1065
- link: "",
1066
- icon: unref(Delete),
1067
- disabled: __props.disabled,
1068
- onClick: removeHandler
1069
- }, null, 8, ["icon", "disabled"]), [
1070
- [vShow, showDelete.value]
1071
- ]),
1072
- copyable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1073
- key: 0,
1074
- link: "",
1075
- size: "small",
1076
- type: "primary",
1077
- icon: unref(DocumentCopy),
1078
- disabled: __props.disabled,
1079
- onClick: copyHandler
1080
- }, {
1081
- default: withCtx(() => [..._cache[6] || (_cache[6] = [
1082
- createTextVNode(
1083
- "复制",
1084
- -1
1085
- /* CACHED */
1086
- )
1087
- ])]),
1088
- _: 1
1089
- /* STABLE */
1090
- }, 8, ["icon", "disabled"])) : createCommentVNode("v-if", true),
1091
- movable.value ? (openBlock(), createElementBlock(
1092
- Fragment,
1093
- { key: 1 },
1094
- [
1095
- withDirectives(createVNode(unref(TMagicButton), {
1096
- link: "",
1097
- size: "small",
1098
- disabled: __props.disabled,
1099
- icon: unref(CaretTop),
1100
- onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
1101
- }, {
1102
- default: withCtx(() => [..._cache[7] || (_cache[7] = [
1103
- createTextVNode(
1104
- "上移",
1105
- -1
1106
- /* CACHED */
1107
- )
1108
- ])]),
1109
- _: 1
1110
- /* STABLE */
1111
- }, 8, ["disabled", "icon"]), [
1112
- [vShow, __props.index !== 0]
1037
+ return openBlock(), createBlock(unref(TMagicCard), {
1038
+ class: "m-fields-group-list-item",
1039
+ "body-style": { display: expand.value ? "block" : "none" }
1040
+ }, {
1041
+ header: withCtx(() => [
1042
+ createElementVNode("div", null, [
1043
+ createVNode(unref(TMagicButton), {
1044
+ link: "",
1045
+ disabled: __props.disabled,
1046
+ onClick: expandHandler
1047
+ }, {
1048
+ default: withCtx(() => [
1049
+ createVNode(unref(TMagicIcon), null, {
1050
+ default: withCtx(() => [
1051
+ expand.value ? (openBlock(), createBlock(unref(CaretBottom), { key: 0 })) : (openBlock(), createBlock(unref(CaretRight), { key: 1 }))
1052
+ ]),
1053
+ _: 1
1054
+ /* STABLE */
1055
+ }),
1056
+ createTextVNode(
1057
+ toDisplayString(title.value),
1058
+ 1
1059
+ /* TEXT */
1060
+ )
1113
1061
  ]),
1114
- withDirectives(createVNode(unref(TMagicButton), {
1115
- link: "",
1116
- size: "small",
1117
- disabled: __props.disabled,
1118
- icon: unref(CaretBottom),
1119
- onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
1120
- }, {
1121
- default: withCtx(() => [..._cache[8] || (_cache[8] = [
1122
- createTextVNode(
1123
- "下移",
1124
- -1
1125
- /* CACHED */
1126
- )
1127
- ])]),
1128
- _: 1
1129
- /* STABLE */
1130
- }, 8, ["disabled", "icon"]), [
1131
- [vShow, __props.index !== length.value - 1]
1132
- ])
1133
- ],
1134
- 64
1135
- /* STABLE_FRAGMENT */
1136
- )) : createCommentVNode("v-if", true),
1137
- __props.config.moveSpecifyLocation ? (openBlock(), createBlock(unref(TMagicPopover), {
1138
- key: 2,
1139
- trigger: "click",
1140
- placement: "top",
1141
- width: "200",
1142
- visible: moveSpecifyLocationVisible.value
1143
- }, {
1144
- reference: withCtx(() => [
1145
- createVNode(unref(TMagicButton), {
1146
- link: "",
1147
- size: "small",
1148
- type: "primary",
1149
- icon: unref(Position),
1150
- disabled: __props.disabled,
1151
- onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
1152
- }, {
1153
- default: withCtx(() => [..._cache[9] || (_cache[9] = [
1154
- createTextVNode(
1155
- "移动至",
1156
- -1
1157
- /* CACHED */
1158
- )
1159
- ])]),
1160
- _: 1
1161
- /* STABLE */
1162
- }, 8, ["icon", "disabled"])
1062
+ _: 1
1063
+ /* STABLE */
1064
+ }, 8, ["disabled"]),
1065
+ withDirectives(createVNode(unref(TMagicButton), {
1066
+ type: "danger",
1067
+ size: "small",
1068
+ link: "",
1069
+ icon: unref(Delete),
1070
+ disabled: __props.disabled,
1071
+ onClick: removeHandler
1072
+ }, null, 8, ["icon", "disabled"]), [
1073
+ [vShow, showDelete.value]
1163
1074
  ]),
1164
- default: withCtx(() => [
1165
- createElementVNode("div", null, [
1166
- createElementVNode("div", null, [
1167
- _cache[10] || (_cache[10] = createTextVNode(
1168
- " ",
1169
- -1
1170
- /* CACHED */
1171
- )),
1172
- createVNode(unref(TMagicInputNumber), {
1173
- style: { "margin": "0 5px" },
1174
- modelValue: moveSpecifyLocationIndex.value,
1175
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
1176
- size: "small",
1177
- min: 1,
1178
- disabled: __props.disabled
1179
- }, null, 8, ["modelValue", "disabled"]),
1180
- _cache[11] || (_cache[11] = createTextVNode(
1181
- "行 ",
1182
- -1
1183
- /* CACHED */
1184
- ))
1075
+ copyable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1076
+ key: 0,
1077
+ link: "",
1078
+ size: "small",
1079
+ type: "primary",
1080
+ icon: unref(DocumentCopy),
1081
+ disabled: __props.disabled,
1082
+ onClick: copyHandler
1083
+ }, {
1084
+ default: withCtx(() => [..._cache[6] || (_cache[6] = [
1085
+ createTextVNode(
1086
+ "复制",
1087
+ -1
1088
+ /* CACHED */
1089
+ )
1090
+ ])]),
1091
+ _: 1
1092
+ /* STABLE */
1093
+ }, 8, ["icon", "disabled"])) : createCommentVNode("v-if", true),
1094
+ movable.value ? (openBlock(), createElementBlock(
1095
+ Fragment,
1096
+ { key: 1 },
1097
+ [
1098
+ withDirectives(createVNode(unref(TMagicButton), {
1099
+ link: "",
1100
+ size: "small",
1101
+ disabled: __props.disabled,
1102
+ icon: unref(CaretTop),
1103
+ onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
1104
+ }, {
1105
+ default: withCtx(() => [..._cache[7] || (_cache[7] = [
1106
+ createTextVNode(
1107
+ "上移",
1108
+ -1
1109
+ /* CACHED */
1110
+ )
1111
+ ])]),
1112
+ _: 1
1113
+ /* STABLE */
1114
+ }, 8, ["disabled", "icon"]), [
1115
+ [vShow, __props.index !== 0]
1185
1116
  ]),
1186
- createElementVNode("div", _hoisted_2$5, [
1187
- createVNode(unref(TMagicButton), {
1188
- size: "small",
1189
- text: "",
1190
- onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
1191
- }, {
1192
- default: withCtx(() => [..._cache[12] || (_cache[12] = [
1193
- createTextVNode(
1194
- "取消",
1195
- -1
1196
- /* CACHED */
1197
- )
1198
- ])]),
1199
- _: 1
1200
- /* STABLE */
1201
- }),
1202
- createVNode(unref(TMagicButton), {
1203
- size: "small",
1204
- type: "primary",
1205
- onClick: moveSpecifyLocationHandler
1206
- }, {
1207
- default: withCtx(() => [..._cache[13] || (_cache[13] = [
1208
- createTextVNode(
1209
- "确认",
1210
- -1
1211
- /* CACHED */
1212
- )
1213
- ])]),
1214
- _: 1
1215
- /* STABLE */
1216
- })
1117
+ withDirectives(createVNode(unref(TMagicButton), {
1118
+ link: "",
1119
+ size: "small",
1120
+ disabled: __props.disabled,
1121
+ icon: unref(CaretBottom),
1122
+ onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
1123
+ }, {
1124
+ default: withCtx(() => [..._cache[8] || (_cache[8] = [
1125
+ createTextVNode(
1126
+ "下移",
1127
+ -1
1128
+ /* CACHED */
1129
+ )
1130
+ ])]),
1131
+ _: 1
1132
+ /* STABLE */
1133
+ }, 8, ["disabled", "icon"]), [
1134
+ [vShow, __props.index !== length.value - 1]
1217
1135
  ])
1218
- ])
1219
- ]),
1220
- _: 1
1221
- /* STABLE */
1222
- }, 8, ["visible"])) : createCommentVNode("v-if", true),
1223
- itemExtra.value ? (openBlock(), createElementBlock("span", {
1224
- key: 3,
1225
- innerHTML: itemExtra.value,
1226
- class: "m-form-tip"
1227
- }, null, 8, _hoisted_3$4)) : createCommentVNode("v-if", true)
1136
+ ],
1137
+ 64
1138
+ /* STABLE_FRAGMENT */
1139
+ )) : createCommentVNode("v-if", true),
1140
+ __props.config.moveSpecifyLocation ? (openBlock(), createBlock(unref(TMagicPopover), {
1141
+ key: 2,
1142
+ trigger: "click",
1143
+ placement: "top",
1144
+ width: "200",
1145
+ visible: moveSpecifyLocationVisible.value
1146
+ }, {
1147
+ reference: withCtx(() => [
1148
+ createVNode(unref(TMagicButton), {
1149
+ link: "",
1150
+ size: "small",
1151
+ type: "primary",
1152
+ icon: unref(Position),
1153
+ disabled: __props.disabled,
1154
+ onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
1155
+ }, {
1156
+ default: withCtx(() => [..._cache[9] || (_cache[9] = [
1157
+ createTextVNode(
1158
+ "移动至",
1159
+ -1
1160
+ /* CACHED */
1161
+ )
1162
+ ])]),
1163
+ _: 1
1164
+ /* STABLE */
1165
+ }, 8, ["icon", "disabled"])
1166
+ ]),
1167
+ default: withCtx(() => [
1168
+ createElementVNode("div", null, [
1169
+ createElementVNode("div", null, [
1170
+ _cache[10] || (_cache[10] = createTextVNode(
1171
+ " 第",
1172
+ -1
1173
+ /* CACHED */
1174
+ )),
1175
+ createVNode(unref(TMagicInputNumber), {
1176
+ style: { "margin": "0 5px" },
1177
+ modelValue: moveSpecifyLocationIndex.value,
1178
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
1179
+ size: "small",
1180
+ min: 1,
1181
+ disabled: __props.disabled
1182
+ }, null, 8, ["modelValue", "disabled"]),
1183
+ _cache[11] || (_cache[11] = createTextVNode(
1184
+ "行 ",
1185
+ -1
1186
+ /* CACHED */
1187
+ ))
1188
+ ]),
1189
+ createElementVNode("div", _hoisted_1$b, [
1190
+ createVNode(unref(TMagicButton), {
1191
+ size: "small",
1192
+ text: "",
1193
+ onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
1194
+ }, {
1195
+ default: withCtx(() => [..._cache[12] || (_cache[12] = [
1196
+ createTextVNode(
1197
+ "取消",
1198
+ -1
1199
+ /* CACHED */
1200
+ )
1201
+ ])]),
1202
+ _: 1
1203
+ /* STABLE */
1204
+ }),
1205
+ createVNode(unref(TMagicButton), {
1206
+ size: "small",
1207
+ type: "primary",
1208
+ onClick: moveSpecifyLocationHandler
1209
+ }, {
1210
+ default: withCtx(() => [..._cache[13] || (_cache[13] = [
1211
+ createTextVNode(
1212
+ "确认",
1213
+ -1
1214
+ /* CACHED */
1215
+ )
1216
+ ])]),
1217
+ _: 1
1218
+ /* STABLE */
1219
+ })
1220
+ ])
1221
+ ])
1222
+ ]),
1223
+ _: 1
1224
+ /* STABLE */
1225
+ }, 8, ["visible"])) : createCommentVNode("v-if", true),
1226
+ itemExtra.value ? (openBlock(), createElementBlock("span", {
1227
+ key: 3,
1228
+ innerHTML: itemExtra.value,
1229
+ class: "m-form-tip"
1230
+ }, null, 8, _hoisted_2$5)) : createCommentVNode("v-if", true)
1231
+ ])
1228
1232
  ]),
1229
- expand.value ? (openBlock(), createBlock(_sfc_main$A, {
1230
- key: 0,
1231
- config: rowConfig.value,
1232
- model: __props.model,
1233
- lastValues: __props.lastValues,
1234
- "is-compare": __props.isCompare,
1235
- labelWidth: __props.labelWidth,
1236
- prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
1237
- size: __props.size,
1238
- disabled: __props.disabled,
1239
- onChange: changeHandler,
1240
- onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
1241
- }, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("v-if", true)
1242
- ]);
1233
+ default: withCtx(() => [
1234
+ expand.value ? (openBlock(), createBlock(_sfc_main$A, {
1235
+ key: 0,
1236
+ config: rowConfig.value,
1237
+ model: __props.model,
1238
+ lastValues: __props.lastValues,
1239
+ "is-compare": __props.isCompare,
1240
+ labelWidth: __props.labelWidth,
1241
+ prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
1242
+ size: __props.size,
1243
+ disabled: __props.disabled,
1244
+ onChange: changeHandler,
1245
+ onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
1246
+ }, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("v-if", true)
1247
+ ]),
1248
+ _: 1
1249
+ /* STABLE */
1250
+ }, 8, ["body-style"]);
1243
1251
  };
1244
1252
  }
1245
1253
  });
@@ -1250,6 +1258,8 @@ const _hoisted_3$3 = {
1250
1258
  key: 1,
1251
1259
  class: "el-table__empty-block"
1252
1260
  };
1261
+ const _hoisted_4$2 = { class: "m-fields-group-list-footer" };
1262
+ const _hoisted_5$1 = { style: { "display": "flex", "justify-content": "flex-end", "flex": "1" } };
1253
1263
  const _sfc_main$w = /* @__PURE__ */ defineComponent({
1254
1264
  ...{
1255
1265
  name: "MFormGroupList"
@@ -1349,7 +1359,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1349
1359
  !__props.model[__props.name] || !__props.model[__props.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, [..._cache[1] || (_cache[1] = [
1350
1360
  createElementVNode(
1351
1361
  "span",
1352
- { class: "el-table__empty-text" },
1362
+ { class: "el-table__empty-text t-table__empty" },
1353
1363
  "暂无数据",
1354
1364
  -1
1355
1365
  /* CACHED */
@@ -1380,39 +1390,43 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1380
1390
  128
1381
1391
  /* KEYED_FRAGMENT */
1382
1392
  )),
1383
- addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1384
- key: 3,
1385
- type: "primary",
1386
- size: __props.config.enableToggleMode ? "small" : "default",
1387
- disabled: __props.disabled,
1388
- onClick: addHandler
1389
- }, {
1390
- default: withCtx(() => [..._cache[2] || (_cache[2] = [
1391
- createTextVNode(
1392
- "新增",
1393
- -1
1394
- /* CACHED */
1395
- )
1396
- ])]),
1397
- _: 1
1398
- /* STABLE */
1399
- }, 8, ["size", "disabled"])) : createCommentVNode("v-if", true),
1400
- __props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
1401
- key: 4,
1402
- icon: unref(Grid),
1403
- size: "small",
1404
- onClick: toggleMode
1405
- }, {
1406
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
1407
- createTextVNode(
1408
- "切换为表格",
1409
- -1
1410
- /* CACHED */
1411
- )
1412
- ])]),
1413
- _: 1
1414
- /* STABLE */
1415
- }, 8, ["icon"])) : createCommentVNode("v-if", true)
1393
+ createElementVNode("div", _hoisted_4$2, [
1394
+ __props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
1395
+ key: 0,
1396
+ icon: unref(Grid),
1397
+ size: "small",
1398
+ onClick: toggleMode
1399
+ }, {
1400
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
1401
+ createTextVNode(
1402
+ "切换为表格",
1403
+ -1
1404
+ /* CACHED */
1405
+ )
1406
+ ])]),
1407
+ _: 1
1408
+ /* STABLE */
1409
+ }, 8, ["icon"])) : createCommentVNode("v-if", true),
1410
+ createElementVNode("div", _hoisted_5$1, [
1411
+ addable.value ? (openBlock(), createBlock(unref(TMagicButton), {
1412
+ key: 0,
1413
+ type: "primary",
1414
+ size: __props.config.enableToggleMode ? "small" : "default",
1415
+ disabled: __props.disabled,
1416
+ onClick: addHandler
1417
+ }, {
1418
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
1419
+ createTextVNode(
1420
+ "新增",
1421
+ -1
1422
+ /* CACHED */
1423
+ )
1424
+ ])]),
1425
+ _: 1
1426
+ /* STABLE */
1427
+ }, 8, ["size", "disabled"])) : createCommentVNode("v-if", true)
1428
+ ])
1429
+ ])
1416
1430
  ]);
1417
1431
  };
1418
1432
  }
@@ -1425,7 +1439,7 @@ const _hoisted_3$2 = {
1425
1439
  style: { "display": "flex" }
1426
1440
  };
1427
1441
  const _hoisted_4$1 = { style: { "flex": "1" } };
1428
- const _hoisted_5$1 = ["src"];
1442
+ const _hoisted_5 = ["src"];
1429
1443
  const _sfc_main$v = /* @__PURE__ */ defineComponent({
1430
1444
  ...{
1431
1445
  name: "MFormPanel"
@@ -1512,7 +1526,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1512
1526
  createElementVNode("img", {
1513
1527
  class: "m-form-schematic",
1514
1528
  src: __props.config.schematic
1515
- }, null, 8, _hoisted_5$1)
1529
+ }, null, 8, _hoisted_5)
1516
1530
  ])) : (openBlock(true), createElementBlock(
1517
1531
  Fragment,
1518
1532
  { key: 1 },
@@ -3037,7 +3051,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3037
3051
  default: withCtx(() => [
3038
3052
  renderSlot(_ctx.$slots, "footer", {}, () => [
3039
3053
  createVNode(unref(TMagicButton), {
3040
- type: "default",
3041
3054
  onClick: cancel,
3042
3055
  size: "small"
3043
3056
  }, {
@@ -3190,7 +3203,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3190
3203
  if (typeof props.config.form === "function") {
3191
3204
  return props.config.form(mForm, {
3192
3205
  model: props.model || {},
3193
- values: props.values || {}
3206
+ values: mForm ? readonly(mForm.initValues) : null,
3207
+ formValue: props.values || {}
3194
3208
  });
3195
3209
  }
3196
3210
  return props.config.form;
@@ -4047,10 +4061,25 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
4047
4061
  const buttonClickHandler = () => {
4048
4062
  if (!appendConfig.value) return;
4049
4063
  if (typeof appendConfig.value.handler === "function") {
4064
+ const newChangeRecords = [];
4065
+ const setModel = (key, value) => {
4066
+ newChangeRecords.push({ propPath: props.prop.replace(`${props.name}`, key), value });
4067
+ };
4068
+ const setFormValue = (key, value) => {
4069
+ newChangeRecords.push({ propPath: key, value });
4070
+ };
4050
4071
  appendConfig.value.handler(mForm, {
4051
4072
  model: props.model,
4052
- values: mForm?.values
4073
+ values: mForm ? readonly(mForm.initValues) : null,
4074
+ formValue: props.values || {},
4075
+ setModel,
4076
+ setFormValue
4053
4077
  });
4078
+ if (newChangeRecords.length > 0) {
4079
+ emit("change", props.model[props.name], {
4080
+ changeRecords: newChangeRecords
4081
+ });
4082
+ }
4054
4083
  }
4055
4084
  };
4056
4085
  const keyUpHandler = ($event) => {
@@ -4472,6 +4501,7 @@ const useAdd = (props, emit) => {
4472
4501
  if (typeof props.config.defaultAdd === "function") {
4473
4502
  inputs = await props.config.defaultAdd(mForm, {
4474
4503
  model: props.model[modelName],
4504
+ prop: props.prop,
4475
4505
  formValue: mForm?.values
4476
4506
  });
4477
4507
  } else if (props.config.defaultAdd) {
@@ -4502,16 +4532,10 @@ const useAdd = (props, emit) => {
4502
4532
 
4503
4533
  const useFullscreen = () => {
4504
4534
  const isFullscreen = ref(false);
4505
- const mTableEl = useTemplateRef("mTable");
4506
- const { nextZIndex } = useZIndex();
4507
4535
  const toggleFullscreen = () => {
4508
- if (!mTableEl.value) return;
4509
4536
  if (isFullscreen.value) {
4510
- mTableEl.value.classList.remove("fixed");
4511
4537
  isFullscreen.value = false;
4512
4538
  } else {
4513
- mTableEl.value.classList.add("fixed");
4514
- mTableEl.value.style.zIndex = `${nextZIndex()}`;
4515
4539
  isFullscreen.value = true;
4516
4540
  }
4517
4541
  };
@@ -4997,11 +5021,10 @@ const useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
4997
5021
  };
4998
5022
  };
4999
5023
 
5000
- const _hoisted_1$1 = { class: "m-fields-table-wrap" };
5001
- const _hoisted_2 = ["innerHTML"];
5002
- const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
5003
- const _hoisted_4 = { style: { "display": "flex" } };
5004
- const _hoisted_5 = {
5024
+ const _hoisted_1$1 = ["innerHTML"];
5025
+ const _hoisted_2 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
5026
+ const _hoisted_3 = { style: { "display": "flex" } };
5027
+ const _hoisted_4 = {
5005
5028
  key: 1,
5006
5029
  class: "bottom",
5007
5030
  style: { "text-align": "right" }
@@ -5037,6 +5060,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5037
5060
  props,
5038
5061
  modelName
5039
5062
  );
5063
+ const { nextZIndex } = useZIndex();
5040
5064
  const { addable, newHandler } = useAdd(props, emit);
5041
5065
  const { columns } = useTableColumns(props, emit, currentPage, pageSize, modelName);
5042
5066
  useSortable(props, emit, tMagicTableRef, modelName);
@@ -5074,170 +5098,176 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5074
5098
  toggleRowSelection
5075
5099
  });
5076
5100
  return (_ctx, _cache) => {
5077
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
5078
- (openBlock(), createBlock(Teleport, {
5079
- to: "body",
5080
- disabled: !unref(isFullscreen)
5081
- }, [
5082
- createElementVNode(
5083
- "div",
5084
- {
5085
- ref: "mTable",
5086
- class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
5087
- },
5088
- [
5089
- __props.config.extra ? (openBlock(), createElementBlock("span", {
5090
- key: 0,
5091
- style: { "color": "rgba(0, 0, 0, 0.45)" },
5092
- innerHTML: __props.config.extra
5093
- }, null, 8, _hoisted_2)) : createCommentVNode("v-if", true),
5094
- createVNode(unref(TMagicTooltip), {
5095
- content: "拖拽可排序",
5096
- placement: "left-start",
5097
- disabled: __props.config.dropSort !== true
5098
- }, {
5099
- default: withCtx(() => [
5100
- __props.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
5101
- ref: "tMagicTable",
5102
- style: { "width": "100%" },
5103
- "show-header": "",
5104
- "row-key": __props.config.rowKey || "id",
5105
- columns: unref(columns),
5106
- data: data.value,
5107
- border: __props.config.border,
5108
- "max-height": __props.config.maxHeight,
5109
- "default-expand-all": true,
5110
- key: updateKey.value,
5111
- onSelect: unref(selectHandle),
5112
- onSortChange: sortChangeHandler
5113
- }, null, 8, ["row-key", "columns", "data", "border", "max-height", "onSelect"])) : createCommentVNode("v-if", true)
5114
- ]),
5115
- _: 1
5116
- /* STABLE */
5117
- }, 8, ["disabled"]),
5118
- renderSlot(_ctx.$slots, "default"),
5119
- createElementVNode("div", _hoisted_3, [
5120
- createElementVNode("div", _hoisted_4, [
5121
- __props.enableToggleMode && __props.config.enableToggleMode !== false && !unref(isFullscreen) ? (openBlock(), createBlock(unref(TMagicButton), {
5101
+ return openBlock(), createBlock(Teleport, {
5102
+ to: "body",
5103
+ disabled: !unref(isFullscreen)
5104
+ }, [
5105
+ createElementVNode(
5106
+ "div",
5107
+ mergeProps(_ctx.$attrs, {
5108
+ class: ["m-fields-table-wrap", { fixed: unref(isFullscreen) }],
5109
+ style: unref(isFullscreen) ? `z-index: ${unref(nextZIndex)()}` : ""
5110
+ }),
5111
+ [
5112
+ createElementVNode(
5113
+ "div",
5114
+ {
5115
+ class: normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
5116
+ },
5117
+ [
5118
+ __props.config.extra ? (openBlock(), createElementBlock("span", {
5119
+ key: 0,
5120
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
5121
+ innerHTML: __props.config.extra
5122
+ }, null, 8, _hoisted_1$1)) : createCommentVNode("v-if", true),
5123
+ createVNode(unref(TMagicTooltip), {
5124
+ content: "拖拽可排序",
5125
+ placement: "left-start",
5126
+ disabled: __props.config.dropSort !== true
5127
+ }, {
5128
+ default: withCtx(() => [
5129
+ __props.model[modelName.value] ? (openBlock(), createBlock(unref(TMagicTable), {
5130
+ ref: "tMagicTable",
5131
+ style: { "width": "100%" },
5132
+ "show-header": "",
5133
+ "row-key": __props.config.rowKey || "id",
5134
+ columns: unref(columns),
5135
+ data: data.value,
5136
+ border: __props.config.border,
5137
+ "max-height": __props.config.maxHeight,
5138
+ "default-expand-all": true,
5139
+ key: updateKey.value,
5140
+ onSelect: unref(selectHandle),
5141
+ onSortChange: sortChangeHandler
5142
+ }, null, 8, ["row-key", "columns", "data", "border", "max-height", "onSelect"])) : createCommentVNode("v-if", true)
5143
+ ]),
5144
+ _: 1
5145
+ /* STABLE */
5146
+ }, 8, ["disabled"]),
5147
+ renderSlot(_ctx.$slots, "default"),
5148
+ createElementVNode("div", _hoisted_2, [
5149
+ createElementVNode("div", _hoisted_3, [
5150
+ __props.enableToggleMode && __props.config.enableToggleMode !== false && !unref(isFullscreen) ? (openBlock(), createBlock(unref(TMagicButton), {
5151
+ key: 0,
5152
+ icon: unref(Grid),
5153
+ size: "small",
5154
+ onClick: toggleMode
5155
+ }, {
5156
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
5157
+ createTextVNode(
5158
+ "展开配置",
5159
+ -1
5160
+ /* CACHED */
5161
+ )
5162
+ ])]),
5163
+ _: 1
5164
+ /* STABLE */
5165
+ }, 8, ["icon"])) : createCommentVNode("v-if", true),
5166
+ __props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
5167
+ key: 1,
5168
+ icon: unref(FullScreen),
5169
+ size: "small",
5170
+ onClick: unref(toggleFullscreen)
5171
+ }, {
5172
+ default: withCtx(() => [
5173
+ createTextVNode(
5174
+ toDisplayString(unref(isFullscreen) ? "退出全屏" : "全屏编辑"),
5175
+ 1
5176
+ /* TEXT */
5177
+ )
5178
+ ]),
5179
+ _: 1
5180
+ /* STABLE */
5181
+ }, 8, ["icon", "onClick"])) : createCommentVNode("v-if", true),
5182
+ unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
5183
+ key: 2,
5184
+ style: { "display": "inline-block" },
5185
+ ref: "excelBtn",
5186
+ action: "/noop",
5187
+ disabled: __props.disabled,
5188
+ "on-change": unref(excelHandler),
5189
+ "auto-upload": false
5190
+ }, {
5191
+ default: withCtx(() => [
5192
+ createVNode(unref(TMagicButton), {
5193
+ size: "small",
5194
+ type: "success",
5195
+ disabled: __props.disabled,
5196
+ plain: ""
5197
+ }, {
5198
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
5199
+ createTextVNode(
5200
+ "导入EXCEL",
5201
+ -1
5202
+ /* CACHED */
5203
+ )
5204
+ ])]),
5205
+ _: 1
5206
+ /* STABLE */
5207
+ }, 8, ["disabled"])
5208
+ ]),
5209
+ _: 1
5210
+ /* STABLE */
5211
+ }, 8, ["disabled", "on-change"])) : createCommentVNode("v-if", true),
5212
+ unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
5213
+ key: 3,
5214
+ size: "small",
5215
+ type: "warning",
5216
+ disabled: __props.disabled,
5217
+ plain: "",
5218
+ onClick: unref(clearHandler)
5219
+ }, {
5220
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
5221
+ createTextVNode(
5222
+ "清空",
5223
+ -1
5224
+ /* CACHED */
5225
+ )
5226
+ ])]),
5227
+ _: 1
5228
+ /* STABLE */
5229
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("v-if", true)
5230
+ ]),
5231
+ unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
5122
5232
  key: 0,
5123
- icon: unref(Grid),
5124
5233
  size: "small",
5125
- type: "defalut",
5126
- onClick: toggleMode
5127
- }, {
5128
- default: withCtx(() => [..._cache[1] || (_cache[1] = [
5129
- createTextVNode(
5130
- "展开配置",
5131
- -1
5132
- /* CACHED */
5133
- )
5134
- ])]),
5135
- _: 1
5136
- /* STABLE */
5137
- }, 8, ["icon"])) : createCommentVNode("v-if", true),
5138
- __props.config.enableFullscreen !== false ? (openBlock(), createBlock(unref(TMagicButton), {
5139
- key: 1,
5140
- icon: unref(FullScreen),
5141
- size: "small",
5142
- type: "defalut",
5143
- onClick: unref(toggleFullscreen)
5144
- }, {
5145
- default: withCtx(() => [
5146
- createTextVNode(
5147
- toDisplayString(unref(isFullscreen) ? "退出全屏" : "全屏编辑"),
5148
- 1
5149
- /* TEXT */
5150
- )
5151
- ]),
5152
- _: 1
5153
- /* STABLE */
5154
- }, 8, ["icon", "onClick"])) : createCommentVNode("v-if", true),
5155
- unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
5156
- key: 2,
5157
- style: { "display": "inline-block" },
5158
- ref: "excelBtn",
5159
- action: "/noop",
5160
- disabled: __props.disabled,
5161
- "on-change": unref(excelHandler),
5162
- "auto-upload": false
5163
- }, {
5164
- default: withCtx(() => [
5165
- createVNode(unref(TMagicButton), {
5166
- size: "small",
5167
- type: "success",
5168
- disabled: __props.disabled,
5169
- plain: ""
5170
- }, {
5171
- default: withCtx(() => [..._cache[2] || (_cache[2] = [
5172
- createTextVNode(
5173
- "导入EXCEL",
5174
- -1
5175
- /* CACHED */
5176
- )
5177
- ])]),
5178
- _: 1
5179
- /* STABLE */
5180
- }, 8, ["disabled"])
5181
- ]),
5182
- _: 1
5183
- /* STABLE */
5184
- }, 8, ["disabled", "on-change"])) : createCommentVNode("v-if", true),
5185
- unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
5186
- key: 3,
5187
- size: "small",
5188
- type: "warning",
5234
+ type: "primary",
5189
5235
  disabled: __props.disabled,
5190
5236
  plain: "",
5191
- onClick: unref(clearHandler)
5237
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
5192
5238
  }, {
5193
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
5239
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
5194
5240
  createTextVNode(
5195
- "清空",
5241
+ "新增一行",
5196
5242
  -1
5197
5243
  /* CACHED */
5198
5244
  )
5199
5245
  ])]),
5200
5246
  _: 1
5201
5247
  /* STABLE */
5202
- }, 8, ["disabled", "onClick"])) : createCommentVNode("v-if", true)
5248
+ }, 8, ["disabled"])) : createCommentVNode("v-if", true)
5203
5249
  ]),
5204
- unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
5205
- key: 0,
5206
- size: "small",
5207
- type: "primary",
5208
- disabled: __props.disabled,
5209
- plain: "",
5210
- onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
5211
- }, {
5212
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
5213
- createTextVNode(
5214
- "新增一行",
5215
- -1
5216
- /* CACHED */
5217
- )
5218
- ])]),
5219
- _: 1
5220
- /* STABLE */
5221
- }, 8, ["disabled"])) : createCommentVNode("v-if", true)
5222
- ]),
5223
- __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
5224
- createVNode(unref(TMagicPagination), {
5225
- layout: "total, sizes, prev, pager, next, jumper",
5226
- "hide-on-single-page": __props.model[modelName.value].length < unref(pageSize),
5227
- "current-page": unref(currentPage) + 1,
5228
- "page-sizes": [unref(pageSize), 60, 120, 300],
5229
- "page-size": unref(pageSize),
5230
- total: __props.model[modelName.value].length,
5231
- onSizeChange: unref(handleSizeChange),
5232
- onCurrentChange: unref(handleCurrentChange)
5233
- }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
5234
- ])) : createCommentVNode("v-if", true)
5235
- ],
5236
- 2
5237
- /* CLASS */
5238
- )
5239
- ], 8, ["disabled"]))
5240
- ]);
5250
+ __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_4, [
5251
+ createVNode(unref(TMagicPagination), {
5252
+ layout: "total, sizes, prev, pager, next, jumper",
5253
+ "hide-on-single-page": __props.model[modelName.value].length < unref(pageSize),
5254
+ "current-page": unref(currentPage) + 1,
5255
+ "page-sizes": [unref(pageSize), 60, 120, 300],
5256
+ "page-size": unref(pageSize),
5257
+ total: __props.model[modelName.value].length,
5258
+ onSizeChange: unref(handleSizeChange),
5259
+ onCurrentChange: unref(handleCurrentChange)
5260
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
5261
+ ])) : createCommentVNode("v-if", true)
5262
+ ],
5263
+ 2
5264
+ /* CLASS */
5265
+ )
5266
+ ],
5267
+ 16
5268
+ /* FULL_PROPS */
5269
+ )
5270
+ ], 8, ["disabled"]);
5241
5271
  };
5242
5272
  }
5243
5273
  });
@@ -5358,10 +5388,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5358
5388
  createVNode(unref(TMagicCol), { span: 12 }, {
5359
5389
  default: withCtx(() => [
5360
5390
  renderSlot(_ctx.$slots, "footer", {}, () => [
5361
- createVNode(unref(TMagicButton), {
5362
- type: "default",
5363
- onClick: handleClose
5364
- }, {
5391
+ createVNode(unref(TMagicButton), { onClick: handleClose }, {
5365
5392
  default: withCtx(() => [..._cache[1] || (_cache[1] = [
5366
5393
  createTextVNode(
5367
5394
  "关闭",