@tmagic/form 1.1.4 → 1.1.6

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.
@@ -129,20 +129,24 @@
129
129
  return rules.map((item) => {
130
130
  if (typeof item.validator === "function") {
131
131
  const fnc = item.validator;
132
- item.validator = (rule, value, callback, source, options) => fnc({
133
- rule,
134
- value: props.config.names ? props.model : value,
135
- callback,
136
- source,
137
- options
138
- }, {
139
- values: mForm?.initValues || {},
140
- model: props.model,
141
- parent: mForm?.parentValues || {},
142
- formValue: mForm?.values || props.model,
143
- prop: props.prop,
144
- config: props.config
145
- }, mForm);
132
+ item.validator = (rule, value, callback, source, options) => fnc(
133
+ {
134
+ rule,
135
+ value: props.config.names ? props.model : value,
136
+ callback,
137
+ source,
138
+ options
139
+ },
140
+ {
141
+ values: mForm?.initValues || {},
142
+ model: props.model,
143
+ parent: mForm?.parentValues || {},
144
+ formValue: mForm?.values || props.model,
145
+ prop: props.prop,
146
+ config: props.config
147
+ },
148
+ mForm
149
+ );
146
150
  }
147
151
  return item;
148
152
  });
@@ -319,7 +323,7 @@
319
323
  const _hoisted_2$7 = ["innerHTML"];
320
324
  const _hoisted_3$7 = ["innerHTML"];
321
325
  const _hoisted_4$6 = ["innerHTML"];
322
- const _hoisted_5$4 = {
326
+ const _hoisted_5$5 = {
323
327
  key: 4,
324
328
  style: { "text-align": "center" }
325
329
  };
@@ -437,7 +441,7 @@
437
441
  }, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop", "onChange"]);
438
442
  }), 128)) : vue.createCommentVNode("", true)
439
443
  ], 64)) : vue.createCommentVNode("", true),
440
- _ctx.config.expand && _ctx.type !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
444
+ _ctx.config.expand && _ctx.type !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$5, [
441
445
  vue.createVNode(_component_el_button, {
442
446
  text: "",
443
447
  onClick: _ctx.expandHandler
@@ -456,7 +460,7 @@
456
460
  const _hoisted_2$6 = ["innerHTML"];
457
461
  const _hoisted_3$6 = { key: 1 };
458
462
  const _hoisted_4$5 = ["innerHTML"];
459
- const _hoisted_5$3 = ["innerHTML"];
463
+ const _hoisted_5$4 = ["innerHTML"];
460
464
  const _hoisted_6$2 = {
461
465
  key: 2,
462
466
  style: { "display": "flex" }
@@ -495,9 +499,12 @@
495
499
  };
496
500
  const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
497
501
  if (props.config.checkbox && name.value) {
498
- vue.watch(() => props.model[name.value]?.value, () => {
499
- emit("change", props.model);
500
- });
502
+ vue.watch(
503
+ () => props.model[name.value]?.value,
504
+ () => {
505
+ emit("change", props.model);
506
+ }
507
+ );
501
508
  }
502
509
  return (_ctx, _cache) => {
503
510
  const _component_el_checkbox = vue.resolveComponent("el-checkbox");
@@ -538,7 +545,7 @@
538
545
  key: 0,
539
546
  innerHTML: __props.config.extra,
540
547
  class: "m-form-tip"
541
- }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
548
+ }, null, 8, _hoisted_5$4)) : vue.createCommentVNode("", true)
542
549
  ])),
543
550
  __props.config.schematic && vue.unref(show) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$2, [
544
551
  vue.createElementVNode("div", _hoisted_7$2, [
@@ -844,6 +851,7 @@
844
851
  }));
845
852
  };
846
853
  return {
854
+ Grid: iconsVue.Grid,
847
855
  addable,
848
856
  toggleMode,
849
857
  removeHandler,
@@ -861,7 +869,7 @@
861
869
  class: "el-table__empty-block"
862
870
  };
863
871
  const _hoisted_4$3 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "\u6682\u65E0\u6570\u636E", -1);
864
- const _hoisted_5$2 = [
872
+ const _hoisted_5$3 = [
865
873
  _hoisted_4$3
866
874
  ];
867
875
  const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0\u7EC4");
@@ -875,7 +883,7 @@
875
883
  innerHTML: _ctx.config.extra,
876
884
  style: { "color": "rgba(0, 0, 0, 0.45)" }
877
885
  }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
878
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
886
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, _hoisted_5$3)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
879
887
  return vue.openBlock(), vue.createBlock(_component_m_fields_group_list_item, {
880
888
  key: index,
881
889
  model: item,
@@ -902,7 +910,7 @@
902
910
  }, 8, ["onClick"])) : vue.createCommentVNode("", true),
903
911
  _ctx.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(_component_el_button, {
904
912
  key: 4,
905
- icon: "el-icon-s-grid",
913
+ icon: _ctx.Grid,
906
914
  size: "small",
907
915
  onClick: _ctx.toggleMode
908
916
  }, {
@@ -910,7 +918,7 @@
910
918
  _hoisted_7$1
911
919
  ]),
912
920
  _: 1
913
- }, 8, ["onClick"])) : vue.createCommentVNode("", true)
921
+ }, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
914
922
  ]);
915
923
  }
916
924
  const GroupList = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$m]]);
@@ -956,7 +964,7 @@
956
964
  style: { "display": "flex" }
957
965
  };
958
966
  const _hoisted_4$2 = { style: { "flex": "1" } };
959
- const _hoisted_5$1 = ["src"];
967
+ const _hoisted_5$2 = ["src"];
960
968
  function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
961
969
  const _component_caret_bottom = vue.resolveComponent("caret-bottom");
962
970
  const _component_caret_right = vue.resolveComponent("caret-right");
@@ -1010,7 +1018,7 @@
1010
1018
  vue.createElementVNode("img", {
1011
1019
  class: "m-form-schematic",
1012
1020
  src: _ctx.config.schematic
1013
- }, null, 8, _hoisted_5$1)
1021
+ }, null, 8, _hoisted_5$2)
1014
1022
  ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.items, (item, index) => {
1015
1023
  return vue.openBlock(), vue.createBlock(_component_m_form_container, {
1016
1024
  key: item[_ctx.mForm?.keyProp || "__key"] ?? index,
@@ -1213,10 +1221,7 @@
1213
1221
  }
1214
1222
  const MStep = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$i]]);
1215
1223
 
1216
- let loadedAMapJS = false;
1217
- let firstLoadingAMapJS = true;
1218
1224
  const _sfc_main$m = vue.defineComponent({
1219
- name: "m-form-table",
1220
1225
  props: {
1221
1226
  name: {
1222
1227
  type: String,
@@ -1253,9 +1258,14 @@
1253
1258
  enableToggleMode: {
1254
1259
  type: Boolean,
1255
1260
  default: true
1261
+ },
1262
+ showIndex: {
1263
+ type: Boolean,
1264
+ default: true
1256
1265
  }
1257
1266
  },
1258
1267
  emits: ["change", "select"],
1268
+ components: { Delete: iconsVue.Delete },
1259
1269
  setup(props, { emit }) {
1260
1270
  let timer = null;
1261
1271
  const mForm = vue.inject("mForm");
@@ -1279,7 +1289,11 @@
1279
1289
  setTimeout(() => rowDrop());
1280
1290
  };
1281
1291
  const swapArray = (index1, index2) => {
1282
- [props.model[modelName.value][index1]] = props.model[modelName.value].splice(index2, 1, props.model[modelName.value][index1]);
1292
+ [props.model[modelName.value][index1]] = props.model[modelName.value].splice(
1293
+ index2,
1294
+ 1,
1295
+ props.model[modelName.value][index1]
1296
+ );
1283
1297
  if (props.sortKey) {
1284
1298
  for (let i = props.model[modelName.value].length - 1, v = 0; i >= 0; i--, v++) {
1285
1299
  props.model[modelName.value][v][props.sortKey] = i;
@@ -1366,17 +1380,14 @@
1366
1380
  props.model[modelName.value].push(inputs);
1367
1381
  emit("change", props.model[modelName.value]);
1368
1382
  };
1369
- if (!loadedAMapJS && firstLoadingAMapJS && !globalThis.XLSX) {
1370
- firstLoadingAMapJS = false;
1371
- utils.asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js").then(() => {
1372
- loadedAMapJS = true;
1373
- }).catch(() => {
1374
- firstLoadingAMapJS = true;
1375
- });
1383
+ if (!globalThis.XLSX) {
1384
+ utils.asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
1376
1385
  }
1377
1386
  vue.onMounted(() => {
1378
1387
  if (props.config.defautSort) {
1379
1388
  sortChange(props.config.defautSort);
1389
+ } else if (props.config.defaultSort) {
1390
+ sortChange(props.config.defaultSort);
1380
1391
  }
1381
1392
  if (props.sort && props.sortKey) {
1382
1393
  props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
@@ -1401,7 +1412,11 @@
1401
1412
  Delete: iconsVue.Delete,
1402
1413
  FullScreen: iconsVue.FullScreen,
1403
1414
  Grid: iconsVue.Grid,
1404
- data: vue.computed(() => props.model[modelName.value].filter((item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value)),
1415
+ data: vue.computed(
1416
+ () => props.model[modelName.value].filter(
1417
+ (item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value
1418
+ )
1419
+ ),
1405
1420
  addable: vue.computed(() => {
1406
1421
  if (!props.model[modelName.value].length) {
1407
1422
  return true;
@@ -1589,7 +1604,7 @@
1589
1604
  const _hoisted_2$2 = { class: "el-form-item__content" };
1590
1605
  const _hoisted_3$2 = ["innerHTML"];
1591
1606
  const _hoisted_4$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0");
1592
- const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode(" \xA0 ");
1607
+ const _hoisted_5$1 = /* @__PURE__ */ vue.createTextVNode(" \xA0 ");
1593
1608
  const _hoisted_6 = /* @__PURE__ */ vue.createTextVNode("\u5C55\u5F00\u914D\u7F6E");
1594
1609
  const _hoisted_7 = /* @__PURE__ */ vue.createTextVNode("\u5BFC\u5165EXCEL");
1595
1610
  const _hoisted_8 = /* @__PURE__ */ vue.createTextVNode("\xA0 ");
@@ -1600,6 +1615,8 @@
1600
1615
  };
1601
1616
  function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1602
1617
  const _component_el_table_column = vue.resolveComponent("el-table-column");
1618
+ const _component_Delete = vue.resolveComponent("Delete");
1619
+ const _component_el_icon = vue.resolveComponent("el-icon");
1603
1620
  const _component_el_button = vue.resolveComponent("el-button");
1604
1621
  const _component_el_tooltip = vue.resolveComponent("el-tooltip");
1605
1622
  const _component_m_form_container = vue.resolveComponent("m-form-container");
@@ -1650,16 +1667,20 @@
1650
1667
  })) : vue.createCommentVNode("", true),
1651
1668
  vue.createVNode(_component_el_table_column, {
1652
1669
  label: "\u64CD\u4F5C",
1653
- width: "60",
1670
+ width: "55",
1671
+ align: "center",
1654
1672
  fixed: _ctx.config.fixed === false ? void 0 : "left"
1655
1673
  }, {
1656
1674
  default: vue.withCtx((scope) => [
1657
- vue.withDirectives(vue.createVNode(_component_el_button, {
1658
- type: "danger",
1659
- text: "",
1660
- icon: _ctx.Delete,
1675
+ vue.withDirectives(vue.createVNode(_component_el_icon, {
1676
+ class: "m-table-delete-icon",
1661
1677
  onClick: ($event) => _ctx.removeHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1662
- }, null, 8, ["icon", "onClick"]), [
1678
+ }, {
1679
+ default: vue.withCtx(() => [
1680
+ vue.createVNode(_component_Delete)
1681
+ ]),
1682
+ _: 2
1683
+ }, 1032, ["onClick"]), [
1663
1684
  [vue.vShow, _ctx.showDelete(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)]
1664
1685
  ])
1665
1686
  ]),
@@ -1717,7 +1738,8 @@
1717
1738
  type: "selection",
1718
1739
  width: "45"
1719
1740
  })) : vue.createCommentVNode("", true),
1720
- vue.createVNode(_component_el_table_column, {
1741
+ _ctx.showIndex && _ctx.config.showIndex ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1742
+ key: 3,
1721
1743
  width: "60",
1722
1744
  label: "\u5E8F\u53F7"
1723
1745
  }, {
@@ -1725,7 +1747,7 @@
1725
1747
  vue.createTextVNode(vue.toDisplayString(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize), 1)
1726
1748
  ]),
1727
1749
  _: 1
1728
- }),
1750
+ })) : vue.createCommentVNode("", true),
1729
1751
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (column, index) => {
1730
1752
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1731
1753
  column.type !== "hidden" && _ctx.display(column.display) ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
@@ -1772,7 +1794,7 @@
1772
1794
  ]),
1773
1795
  _: 1
1774
1796
  })) : vue.createCommentVNode("", true),
1775
- _hoisted_5,
1797
+ _hoisted_5$1,
1776
1798
  _ctx.enableToggleMode && !_ctx.isFullscreen ? (vue.openBlock(), vue.createBlock(_component_el_button, {
1777
1799
  key: 1,
1778
1800
  icon: _ctx.Grid,
@@ -2046,15 +2068,19 @@
2046
2068
  return;
2047
2069
  const mForm = vue.inject("mForm");
2048
2070
  const instance = vue.getCurrentInstance();
2049
- vue.watch(() => instance?.proxy, (vm) => {
2050
- if (vm) {
2051
- mForm?.setField(prop, vm);
2052
- } else {
2053
- mForm?.deleteField(prop);
2071
+ vue.watch(
2072
+ () => instance?.proxy,
2073
+ (vm) => {
2074
+ if (vm) {
2075
+ mForm?.setField(prop, vm);
2076
+ } else {
2077
+ mForm?.deleteField(prop);
2078
+ }
2079
+ },
2080
+ {
2081
+ immediate: true
2054
2082
  }
2055
- }, {
2056
- immediate: true
2057
- });
2083
+ );
2058
2084
  };
2059
2085
 
2060
2086
  const _sfc_main$l = vue.defineComponent({
@@ -2106,7 +2132,9 @@
2106
2132
  }
2107
2133
  };
2108
2134
  if (typeof props.config.options === "function" && props.model && mForm) {
2109
- vue.watchEffect(() => options.value = props.config.options(vm, { model: props.model, formValues: mForm.values }));
2135
+ vue.watchEffect(
2136
+ () => options.value = props.config.options(vm, { model: props.model, formValues: mForm.values })
2137
+ );
2110
2138
  } else if (!props.config.options || !props.config.options.length || props.config.remote) {
2111
2139
  Promise.resolve(setRemoteOptions());
2112
2140
  }
@@ -2370,26 +2398,34 @@
2370
2398
  const value = vue.ref([]);
2371
2399
  if (props.model !== void 0) {
2372
2400
  if (names?.length) {
2373
- vue.watch([() => props.model[names[0]], () => props.model[names[1]]], ([start, end], [preStart, preEnd]) => {
2374
- if (!value.value) {
2375
- value.value = [];
2401
+ vue.watch(
2402
+ [() => props.model[names[0]], () => props.model[names[1]]],
2403
+ ([start, end], [preStart, preEnd]) => {
2404
+ if (!value.value) {
2405
+ value.value = [];
2406
+ }
2407
+ if (!start || !end)
2408
+ value.value = [];
2409
+ if (start !== preStart)
2410
+ value.value[0] = new Date(start);
2411
+ if (end !== preEnd)
2412
+ value.value[1] = new Date(end);
2413
+ },
2414
+ {
2415
+ immediate: true
2376
2416
  }
2377
- if (!start || !end)
2378
- value.value = [];
2379
- if (start !== preStart)
2380
- value.value[0] = new Date(start);
2381
- if (end !== preEnd)
2382
- value.value[1] = new Date(end);
2383
- }, {
2384
- immediate: true
2385
- });
2417
+ );
2386
2418
  } else if (props.name && props.model[props.name]) {
2387
- vue.watch(() => props.model[props.name], (start, preStart) => {
2388
- if (start !== preStart)
2389
- value.value = start.map((item) => item ? new Date(item) : void 0);
2390
- }, {
2391
- immediate: true
2392
- });
2419
+ vue.watch(
2420
+ () => props.model[props.name],
2421
+ (start, preStart) => {
2422
+ if (start !== preStart)
2423
+ value.value = start.map((item) => item ? new Date(item) : void 0);
2424
+ },
2425
+ {
2426
+ immediate: true
2427
+ }
2428
+ );
2393
2429
  }
2394
2430
  }
2395
2431
  const setValue = (v) => {
@@ -2407,11 +2443,14 @@
2407
2443
  const changeHandler = (v) => {
2408
2444
  const value2 = v || [];
2409
2445
  if (props.name) {
2410
- emit("change", value2.map((item) => {
2411
- if (item)
2412
- return utils.datetimeFormatter(item, "");
2413
- return void 0;
2414
- }));
2446
+ emit(
2447
+ "change",
2448
+ value2.map((item) => {
2449
+ if (item)
2450
+ return utils.datetimeFormatter(item, "");
2451
+ return void 0;
2452
+ })
2453
+ );
2415
2454
  } else {
2416
2455
  if (names?.length) {
2417
2456
  setValue(value2);
@@ -2545,13 +2584,17 @@
2545
2584
  fieldLabelMap.value[v.name] = v.label || "";
2546
2585
  });
2547
2586
  };
2548
- const unwatch = vue.watch(() => props.model?.[props.config.dynamicKey], (val) => {
2549
- if (val !== "") {
2550
- changeFieldMap();
2587
+ const unwatch = vue.watch(
2588
+ () => props.model?.[props.config.dynamicKey],
2589
+ (val) => {
2590
+ if (val !== "") {
2591
+ changeFieldMap();
2592
+ }
2593
+ },
2594
+ {
2595
+ immediate: true
2551
2596
  }
2552
- }, {
2553
- immediate: true
2554
- });
2597
+ );
2555
2598
  vue.onBeforeUnmount(() => {
2556
2599
  if (typeof unwatch === "function") {
2557
2600
  unwatch();
@@ -3016,12 +3059,18 @@
3016
3059
  remote.value = false;
3017
3060
  if (config.group) {
3018
3061
  if (config.multiple && value.findIndex) {
3019
- return localOptions.value.filter((group) => group.options.findIndex((item) => value.find((v) => equalValue(item.value, v)) > -1) > -1);
3062
+ return localOptions.value.filter(
3063
+ (group) => group.options.findIndex((item) => value.find((v) => equalValue(item.value, v)) > -1) > -1
3064
+ );
3020
3065
  }
3021
- return localOptions.value.filter((group) => group.options.findIndex((item) => equalValue(item.value, value)) > -1);
3066
+ return localOptions.value.filter(
3067
+ (group) => group.options.findIndex((item) => equalValue(item.value, value)) > -1
3068
+ );
3022
3069
  }
3023
3070
  if (config.multiple && value.findIndex) {
3024
- return localOptions.value.filter((item) => value.findIndex((v) => equalValue(item.value, v)) > -1);
3071
+ return localOptions.value.filter(
3072
+ (item) => value.findIndex((v) => equalValue(item.value, v)) > -1
3073
+ );
3025
3074
  }
3026
3075
  return localOptions.value.filter((item) => equalValue(item.value, value));
3027
3076
  };
@@ -3067,24 +3116,34 @@
3067
3116
  return options2;
3068
3117
  };
3069
3118
  if (typeof props.config.options === "function") {
3070
- vue.watch(() => mForm?.values, () => {
3071
- typeof props.config.options === "function" && Promise.resolve(props.config.options(mForm, {
3072
- model: props.model,
3073
- prop: props.prop,
3074
- formValues: mForm?.values,
3075
- formValue: mForm?.values,
3076
- config: props.config
3077
- })).then((data) => {
3078
- options.value = data;
3079
- });
3080
- }, {
3081
- deep: true,
3082
- immediate: true
3083
- });
3119
+ vue.watch(
3120
+ () => mForm?.values,
3121
+ () => {
3122
+ typeof props.config.options === "function" && Promise.resolve(
3123
+ props.config.options(mForm, {
3124
+ model: props.model,
3125
+ prop: props.prop,
3126
+ formValues: mForm?.values,
3127
+ formValue: mForm?.values,
3128
+ config: props.config
3129
+ })
3130
+ ).then((data) => {
3131
+ options.value = data;
3132
+ });
3133
+ },
3134
+ {
3135
+ deep: true,
3136
+ immediate: true
3137
+ }
3138
+ );
3084
3139
  } else if (Array.isArray(props.config.options)) {
3085
- vue.watch(() => props.config.options, () => {
3086
- options.value = props.config.options;
3087
- }, { immediate: true });
3140
+ vue.watch(
3141
+ () => props.config.options,
3142
+ () => {
3143
+ options.value = props.config.options;
3144
+ },
3145
+ { immediate: true }
3146
+ );
3088
3147
  } else if (props.config.option) {
3089
3148
  vue.onBeforeMount(() => {
3090
3149
  if (!props.model)
@@ -3551,18 +3610,22 @@
3551
3610
  }
3552
3611
  });
3553
3612
  vue.provide("mForm", formState);
3554
- vue.watch([() => props.config, () => props.initValues], ([config], [preConfig]) => {
3555
- if (!lodashEs.isEqual(vue.toRaw(config), vue.toRaw(preConfig))) {
3556
- initialized.value = false;
3557
- }
3558
- initValue(formState, {
3559
- initValues: props.initValues,
3560
- config: props.config
3561
- }).then((value) => {
3562
- values.value = value;
3563
- initialized.value = true;
3564
- });
3565
- }, { immediate: true });
3613
+ vue.watch(
3614
+ [() => props.config, () => props.initValues],
3615
+ ([config], [preConfig]) => {
3616
+ if (!lodashEs.isEqual(vue.toRaw(config), vue.toRaw(preConfig))) {
3617
+ initialized.value = false;
3618
+ }
3619
+ initValue(formState, {
3620
+ initValues: props.initValues,
3621
+ config: props.config
3622
+ }).then((value) => {
3623
+ values.value = value;
3624
+ initialized.value = true;
3625
+ });
3626
+ },
3627
+ { immediate: true }
3628
+ );
3566
3629
  return {
3567
3630
  initialized,
3568
3631
  values,
@@ -3633,6 +3696,9 @@
3633
3696
  type: Object,
3634
3697
  default: () => ({})
3635
3698
  },
3699
+ parentValues: {
3700
+ type: Object
3701
+ },
3636
3702
  width: [Number, String],
3637
3703
  fullscreen: Boolean,
3638
3704
  title: String,
@@ -3715,116 +3781,120 @@
3715
3781
  }
3716
3782
  });
3717
3783
 
3718
- const _hoisted_1 = { style: { "min-height": "1px" } };
3719
- const _hoisted_2 = /* @__PURE__ */ vue.createTextVNode("\u53D6 \u6D88");
3720
- const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u4E00\u6B65");
3721
- const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u4E00\u6B65");
3784
+ const _hoisted_1 = { class: "m-form-dialog" };
3785
+ const _hoisted_2 = { style: { "min-height": "1px" } };
3786
+ const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u53D6 \u6D88");
3787
+ const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u4E00\u6B65");
3788
+ const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u4E00\u6B65");
3722
3789
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3723
3790
  const _component_m_form = vue.resolveComponent("m-form");
3724
3791
  const _component_el_col = vue.resolveComponent("el-col");
3725
3792
  const _component_el_button = vue.resolveComponent("el-button");
3726
3793
  const _component_el_row = vue.resolveComponent("el-row");
3727
3794
  const _component_el_dialog = vue.resolveComponent("el-dialog");
3728
- return vue.openBlock(), vue.createElementBlock("div", null, [
3729
- vue.createVNode(_component_el_dialog, {
3730
- modelValue: _ctx.dialogVisible,
3731
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dialogVisible = $event),
3732
- class: "m-form-dialog",
3733
- top: "20px",
3734
- title: _ctx.title,
3735
- appendToBody: true,
3736
- width: _ctx.width,
3737
- fullscreen: _ctx.fullscreen,
3738
- "close-on-click-modal": false,
3739
- onClose: _ctx.closeHandler
3740
- }, {
3741
- footer: vue.withCtx(() => [
3742
- vue.createVNode(_component_el_row, { class: "dialog-footer" }, {
3743
- default: vue.withCtx(() => [
3744
- vue.createVNode(_component_el_col, {
3745
- span: 12,
3746
- style: { "text-align": "left" }
3747
- }, {
3748
- default: vue.withCtx(() => [
3749
- vue.createElementVNode("div", _hoisted_1, [
3750
- vue.renderSlot(_ctx.$slots, "left")
3751
- ])
3752
- ]),
3753
- _: 3
3754
- }),
3755
- vue.createVNode(_component_el_col, { span: 12 }, {
3756
- default: vue.withCtx(() => [
3757
- vue.renderSlot(_ctx.$slots, "footer", {}, () => [
3758
- vue.createVNode(_component_el_button, {
3759
- onClick: _ctx.cancel,
3760
- size: "small"
3761
- }, {
3762
- default: vue.withCtx(() => [
3763
- _hoisted_2
3764
- ]),
3765
- _: 1
3766
- }, 8, ["onClick"]),
3767
- _ctx.hasStep && _ctx.stepActive > 1 ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3768
- key: 0,
3769
- type: "info",
3770
- size: "small",
3771
- onClick: _ctx.preStep
3772
- }, {
3773
- default: vue.withCtx(() => [
3774
- _hoisted_3
3775
- ]),
3776
- _: 1
3777
- }, 8, ["onClick"])) : vue.createCommentVNode("", true),
3778
- _ctx.hasStep && _ctx.stepCount > _ctx.stepActive ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3779
- key: 1,
3780
- type: "info",
3781
- size: "small",
3782
- onClick: _ctx.nextStep
3783
- }, {
3784
- default: vue.withCtx(() => [
3785
- _hoisted_4
3786
- ]),
3787
- _: 1
3788
- }, 8, ["onClick"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
3789
- key: 2,
3790
- type: "primary",
3791
- size: "small",
3792
- loading: _ctx.saveFetch,
3793
- onClick: _ctx.save
3794
- }, {
3795
- default: vue.withCtx(() => [
3796
- vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
3797
- ]),
3798
- _: 1
3799
- }, 8, ["loading", "onClick"]))
3800
- ])
3801
- ]),
3802
- _: 3
3803
- })
3804
- ]),
3805
- _: 3
3806
- })
3807
- ]),
3808
- default: vue.withCtx(() => [
3809
- vue.createElementVNode("div", {
3810
- class: "m-dialog-body",
3811
- style: vue.normalizeStyle(`max-height: ${_ctx.bodyHeight}; overflow-y: auto; overflow-x: hidden;`)
3812
- }, [
3813
- vue.createVNode(_component_m_form, {
3814
- modelValue: _ctx.stepActive,
3815
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3816
- ref: "form",
3817
- size: _ctx.size,
3818
- config: _ctx.config,
3819
- "init-values": _ctx.values,
3820
- "label-width": _ctx.labelWidth,
3821
- onChange: _ctx.changeHandler
3822
- }, null, 8, ["modelValue", "size", "config", "init-values", "label-width", "onChange"]),
3823
- vue.renderSlot(_ctx.$slots, "default")
3824
- ], 4)
3825
- ]),
3826
- _: 3
3827
- }, 8, ["modelValue", "title", "width", "fullscreen", "onClose"])
3795
+ return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
3796
+ vue.withDirectives(vue.createElementVNode("div", _hoisted_1, [
3797
+ vue.createVNode(_component_el_dialog, {
3798
+ modelValue: _ctx.dialogVisible,
3799
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dialogVisible = $event),
3800
+ top: "20px",
3801
+ title: _ctx.title,
3802
+ width: _ctx.width,
3803
+ fullscreen: _ctx.fullscreen,
3804
+ "close-on-click-modal": false,
3805
+ onClose: _ctx.closeHandler
3806
+ }, {
3807
+ footer: vue.withCtx(() => [
3808
+ vue.createVNode(_component_el_row, { class: "dialog-footer" }, {
3809
+ default: vue.withCtx(() => [
3810
+ vue.createVNode(_component_el_col, {
3811
+ span: 12,
3812
+ style: { "text-align": "left" }
3813
+ }, {
3814
+ default: vue.withCtx(() => [
3815
+ vue.createElementVNode("div", _hoisted_2, [
3816
+ vue.renderSlot(_ctx.$slots, "left")
3817
+ ])
3818
+ ]),
3819
+ _: 3
3820
+ }),
3821
+ vue.createVNode(_component_el_col, { span: 12 }, {
3822
+ default: vue.withCtx(() => [
3823
+ vue.renderSlot(_ctx.$slots, "footer", {}, () => [
3824
+ vue.createVNode(_component_el_button, {
3825
+ onClick: _ctx.cancel,
3826
+ size: "small"
3827
+ }, {
3828
+ default: vue.withCtx(() => [
3829
+ _hoisted_3
3830
+ ]),
3831
+ _: 1
3832
+ }, 8, ["onClick"]),
3833
+ _ctx.hasStep && _ctx.stepActive > 1 ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3834
+ key: 0,
3835
+ type: "info",
3836
+ size: "small",
3837
+ onClick: _ctx.preStep
3838
+ }, {
3839
+ default: vue.withCtx(() => [
3840
+ _hoisted_4
3841
+ ]),
3842
+ _: 1
3843
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
3844
+ _ctx.hasStep && _ctx.stepCount > _ctx.stepActive ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3845
+ key: 1,
3846
+ type: "info",
3847
+ size: "small",
3848
+ onClick: _ctx.nextStep
3849
+ }, {
3850
+ default: vue.withCtx(() => [
3851
+ _hoisted_5
3852
+ ]),
3853
+ _: 1
3854
+ }, 8, ["onClick"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
3855
+ key: 2,
3856
+ type: "primary",
3857
+ size: "small",
3858
+ loading: _ctx.saveFetch,
3859
+ onClick: _ctx.save
3860
+ }, {
3861
+ default: vue.withCtx(() => [
3862
+ vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
3863
+ ]),
3864
+ _: 1
3865
+ }, 8, ["loading", "onClick"]))
3866
+ ])
3867
+ ]),
3868
+ _: 3
3869
+ })
3870
+ ]),
3871
+ _: 3
3872
+ })
3873
+ ]),
3874
+ default: vue.withCtx(() => [
3875
+ vue.createElementVNode("div", {
3876
+ class: "m-dialog-body",
3877
+ style: vue.normalizeStyle(`max-height: ${_ctx.bodyHeight}; overflow-y: auto; overflow-x: hidden;`)
3878
+ }, [
3879
+ vue.createVNode(_component_m_form, {
3880
+ modelValue: _ctx.stepActive,
3881
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3882
+ ref: "form",
3883
+ size: _ctx.size,
3884
+ config: _ctx.config,
3885
+ "init-values": _ctx.values,
3886
+ "parent-values": _ctx.parentValues,
3887
+ "label-width": _ctx.labelWidth,
3888
+ onChange: _ctx.changeHandler
3889
+ }, null, 8, ["modelValue", "size", "config", "init-values", "parent-values", "label-width", "onChange"]),
3890
+ vue.renderSlot(_ctx.$slots, "default")
3891
+ ], 4)
3892
+ ]),
3893
+ _: 3
3894
+ }, 8, ["modelValue", "title", "width", "fullscreen", "onClose"])
3895
+ ], 512), [
3896
+ [vue.vShow, _ctx.dialogVisible]
3897
+ ])
3828
3898
  ]);
3829
3899
  }
3830
3900
  const FormDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
@@ -3844,7 +3914,7 @@
3844
3914
  app.component(Panel.name, Panel);
3845
3915
  app.component(Row.name, Row);
3846
3916
  app.component(MStep.name, MStep);
3847
- app.component(Table.name, Table);
3917
+ app.component("m-form-table", Table);
3848
3918
  app.component(Tabs.name, Tabs);
3849
3919
  app.component(Text.name, Text);
3850
3920
  app.component(Number$1.name, Number$1);