@tmagic/form 1.2.8 → 1.2.10

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 CHANGED
@@ -166,17 +166,15 @@ fieldset.m-fieldset .m-form-tip {
166
166
  }
167
167
 
168
168
  .magic-form-dynamic-tab .el-tabs__header.is-top {
169
- display: flex;
170
- flex-direction: row-reverse;
171
169
  padding-right: 8px;
172
170
  }
173
171
  .magic-form-dynamic-tab .el-tabs__header.is-top .el-tabs__new-tab {
174
172
  margin-right: auto;
175
- min-width: 36px;
173
+ min-width: 50px;
176
174
  outline: none;
177
175
  border-color: #409eff;
178
176
  color: #409eff;
179
- width: 36px;
177
+ width: 10px;
180
178
  }
181
179
  .magic-form-dynamic-tab .el-tabs__header.is-top .el-tabs__new-tab::before {
182
180
  content: "添加";
@@ -1,6 +1,6 @@
1
1
  import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, unref, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, resolveDirective, createSlots, withModifiers } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
- import { cloneDeep, isEqual } from 'lodash-es';
3
+ import { cloneDeep, isEqual, isEmpty } from 'lodash-es';
4
4
  import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicTabs, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicTimePicker } from '@tmagic/design';
5
5
  import Sortable from 'sortablejs';
6
6
  import { asyncLoadJs, sleep, datetimeFormatter, isNumber } from '@tmagic/utils';
@@ -166,7 +166,7 @@ const initValue = async (mForm, { initValues, config }) => {
166
166
  return valuesTmp || {};
167
167
  };
168
168
 
169
- const _hoisted_1$c = ["innerHTML"];
169
+ const _hoisted_1$b = ["innerHTML"];
170
170
  const _hoisted_2$7 = ["innerHTML"];
171
171
  const _hoisted_3$7 = ["innerHTML"];
172
172
  const _hoisted_4$6 = ["innerHTML"];
@@ -365,7 +365,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
365
365
  label: withCtx(() => [
366
366
  createElementVNode("span", {
367
367
  innerHTML: unref(type) === "checkbox" ? "" : __props.config.text
368
- }, null, 8, _hoisted_1$c)
368
+ }, null, 8, _hoisted_1$b)
369
369
  ]),
370
370
  default: withCtx(() => [
371
371
  unref(tooltip) ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
@@ -377,26 +377,28 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
377
377
  key: key(__props.config),
378
378
  size: __props.size,
379
379
  model: __props.model,
380
+ "last-values": __props.lastValues,
380
381
  config: __props.config,
381
382
  name: unref(name),
382
383
  disabled: unref(disabled),
383
384
  prop: unref(itemProp),
384
385
  onChange: onChangeHandler,
385
386
  onAddDiffCount
386
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
387
+ }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"]))
387
388
  ]),
388
389
  _: 1
389
390
  })) : (openBlock(), createBlock(resolveDynamicComponent(unref(tagName)), {
390
391
  key: key(__props.config),
391
392
  size: __props.size,
392
393
  model: __props.model,
394
+ "last-values": __props.lastValues,
393
395
  config: __props.config,
394
396
  name: unref(name),
395
397
  disabled: unref(disabled),
396
398
  prop: unref(itemProp),
397
399
  onChange: onChangeHandler,
398
400
  onAddDiffCount
399
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
401
+ }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"])),
400
402
  unref(extra) ? (openBlock(), createElementBlock("div", {
401
403
  key: 2,
402
404
  innerHTML: unref(extra),
@@ -564,7 +566,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
564
566
  return openBlock(), createBlock(_component_Container, {
565
567
  key: key(item),
566
568
  model: unref(name) || unref(name) === 0 ? __props.model[unref(name)] : __props.model,
567
- "last-values": unref(name) || unref(name) === 0 ? __props.lastValues[unref(name)] : __props.lastValues,
569
+ "last-values": unref(name) || unref(name) === 0 ? __props.lastValues[unref(name)] || {} : __props.lastValues,
568
570
  "is-compare": __props.isCompare,
569
571
  config: item,
570
572
  size: __props.size,
@@ -597,7 +599,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
597
599
  }
598
600
  });
599
601
 
600
- const _hoisted_1$b = ["innerHTML"];
602
+ const _hoisted_1$a = ["innerHTML"];
601
603
  const _hoisted_2$6 = ["innerHTML"];
602
604
  const _hoisted_3$6 = { key: 1 };
603
605
  const _hoisted_4$5 = ["innerHTML"];
@@ -672,7 +674,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
672
674
  default: withCtx(() => [
673
675
  createElementVNode("span", {
674
676
  innerHTML: __props.config.legend
675
- }, null, 8, _hoisted_1$b),
677
+ }, null, 8, _hoisted_1$a),
676
678
  __props.config.extra ? (openBlock(), createElementBlock("span", {
677
679
  key: 0,
678
680
  innerHTML: __props.config.extra,
@@ -737,7 +739,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
737
739
  }
738
740
  });
739
741
 
740
- const _hoisted_1$a = { class: "m-fields-group-list-item" };
742
+ const _hoisted_1$9 = { class: "m-fields-group-list-item" };
741
743
  const _hoisted_2$5 = /* @__PURE__ */ createTextVNode("\u4E0A\u79FB");
742
744
  const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("\u4E0B\u79FB");
743
745
  const _hoisted_4$4 = ["innerHTML"];
@@ -805,7 +807,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
805
807
  };
806
808
  const onAddDiffCount = () => emit("addDiffCount");
807
809
  return (_ctx, _cache) => {
808
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
810
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
809
811
  createElementVNode("div", null, [
810
812
  createVNode(unref(TMagicIcon), {
811
813
  style: { "margin-right": "7px" },
@@ -899,7 +901,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
899
901
  }
900
902
  });
901
903
 
902
- const _hoisted_1$9 = { class: "m-fields-group-list" };
904
+ const _hoisted_1$8 = { class: "m-fields-group-list" };
903
905
  const _hoisted_2$4 = ["innerHTML"];
904
906
  const _hoisted_3$4 = {
905
907
  key: 1,
@@ -994,7 +996,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
994
996
  const onAddDiffCount = () => emit("addDiffCount");
995
997
  const getLastValues = (item, index) => item?.[index] || {};
996
998
  return (_ctx, _cache) => {
997
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
999
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
998
1000
  __props.config.extra ? (openBlock(), createElementBlock("div", {
999
1001
  key: 0,
1000
1002
  innerHTML: __props.config.extra,
@@ -1046,7 +1048,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1046
1048
  }
1047
1049
  });
1048
1050
 
1049
- const _hoisted_1$8 = { class: "clearfix" };
1051
+ const _hoisted_1$7 = { class: "clearfix" };
1050
1052
  const _hoisted_2$3 = ["innerHTML"];
1051
1053
  const _hoisted_3$3 = {
1052
1054
  key: 0,
@@ -1086,7 +1088,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1086
1088
  "body-style": { display: expand.value ? "block" : "none" }
1087
1089
  }, {
1088
1090
  header: withCtx(() => [
1089
- createElementVNode("div", _hoisted_1$8, [
1091
+ createElementVNode("div", _hoisted_1$7, [
1090
1092
  createElementVNode("a", {
1091
1093
  href: "javascript:",
1092
1094
  style: { "width": "100%", "display": "block" },
@@ -1332,7 +1334,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1332
1334
  }
1333
1335
  });
1334
1336
 
1335
- const _hoisted_1$7 = ["innerHTML"];
1337
+ const _hoisted_1$6 = ["innerHTML"];
1336
1338
  const _hoisted_2$2 = { class: "el-form-item__content" };
1337
1339
  const _hoisted_3$2 = ["innerHTML"];
1338
1340
  const _hoisted_4$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0");
@@ -1705,7 +1707,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1705
1707
  key: 0,
1706
1708
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1707
1709
  innerHTML: __props.config.extra
1708
- }, null, 8, _hoisted_1$7)) : createCommentVNode("", true),
1710
+ }, null, 8, _hoisted_1$6)) : createCommentVNode("", true),
1709
1711
  createElementVNode("div", _hoisted_2$2, [
1710
1712
  createVNode(unref(TMagicTooltip), {
1711
1713
  content: "\u62D6\u62FD\u53EF\u6392\u5E8F",
@@ -1961,7 +1963,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1961
1963
  }
1962
1964
  });
1963
1965
 
1964
- const _hoisted_1$6 = { class: "custom-tabs-label" };
1965
1966
  const __default__$m = defineComponent({
1966
1967
  name: "MFormTabs"
1967
1968
  });
@@ -2070,17 +2071,6 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2070
2071
  props.config.onChange(mForm, { model: props.model, prop: props.prop, config: props.config });
2071
2072
  }
2072
2073
  };
2073
- const getValues = (model, tabIndex, tab) => {
2074
- const tabName = props.config.dynamic ? (model[props?.name] || model)[tabIndex] : tab.name;
2075
- let propName = props.name;
2076
- if (tabName) {
2077
- propName = (model[props?.name] || model)[tab.name];
2078
- }
2079
- if (propName) {
2080
- return model[props.name];
2081
- }
2082
- return model;
2083
- };
2084
2074
  const onAddDiffCount = (tabIndex) => {
2085
2075
  if (!diffCount.value[tabIndex]) {
2086
2076
  diffCount.value[tabIndex] = 1;
@@ -2108,11 +2098,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2108
2098
  display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
2109
2099
  key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex,
2110
2100
  name: filter(tab.status) || tabIndex.toString(),
2111
- label: filter(tab.title),
2112
2101
  lazy: tab.lazy || false
2113
2102
  }, {
2114
2103
  label: withCtx(() => [
2115
- createElementVNode("span", _hoisted_1$6, [
2104
+ createElementVNode("span", null, [
2116
2105
  createTextVNode(toDisplayString(filter(tab.title)), 1),
2117
2106
  createVNode(_component_el_badge, {
2118
2107
  hidden: !diffCount.value[tabIndex],
@@ -2127,8 +2116,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2127
2116
  key: item[unref(mForm)?.keyProp || "__key"],
2128
2117
  config: item,
2129
2118
  disabled: __props.disabled,
2130
- model: getValues(__props.model, tabIndex, tab),
2131
- "last-values": getValues(__props.lastValues, tabIndex, tab),
2119
+ model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
2120
+ "last-values": unref(isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
2132
2121
  "is-compare": __props.isCompare,
2133
2122
  prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2134
2123
  size: __props.size,
@@ -2140,7 +2129,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2140
2129
  }), 128))
2141
2130
  ]),
2142
2131
  _: 2
2143
- }, 1032, ["name", "label", "lazy"])) : createCommentVNode("", true)
2132
+ }, 1032, ["name", "lazy"])) : createCommentVNode("", true)
2144
2133
  ], 64);
2145
2134
  }), 256))
2146
2135
  ]),