@tmagic/form 1.2.7 → 1.2.9

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 }, {
@@ -597,7 +597,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
597
597
  }
598
598
  });
599
599
 
600
- const _hoisted_1$b = ["innerHTML"];
600
+ const _hoisted_1$a = ["innerHTML"];
601
601
  const _hoisted_2$6 = ["innerHTML"];
602
602
  const _hoisted_3$6 = { key: 1 };
603
603
  const _hoisted_4$5 = ["innerHTML"];
@@ -672,7 +672,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
672
672
  default: withCtx(() => [
673
673
  createElementVNode("span", {
674
674
  innerHTML: __props.config.legend
675
- }, null, 8, _hoisted_1$b),
675
+ }, null, 8, _hoisted_1$a),
676
676
  __props.config.extra ? (openBlock(), createElementBlock("span", {
677
677
  key: 0,
678
678
  innerHTML: __props.config.extra,
@@ -737,7 +737,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
737
737
  }
738
738
  });
739
739
 
740
- const _hoisted_1$a = { class: "m-fields-group-list-item" };
740
+ const _hoisted_1$9 = { class: "m-fields-group-list-item" };
741
741
  const _hoisted_2$5 = /* @__PURE__ */ createTextVNode("\u4E0A\u79FB");
742
742
  const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("\u4E0B\u79FB");
743
743
  const _hoisted_4$4 = ["innerHTML"];
@@ -805,7 +805,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
805
805
  };
806
806
  const onAddDiffCount = () => emit("addDiffCount");
807
807
  return (_ctx, _cache) => {
808
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
808
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
809
809
  createElementVNode("div", null, [
810
810
  createVNode(unref(TMagicIcon), {
811
811
  style: { "margin-right": "7px" },
@@ -899,7 +899,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
899
899
  }
900
900
  });
901
901
 
902
- const _hoisted_1$9 = { class: "m-fields-group-list" };
902
+ const _hoisted_1$8 = { class: "m-fields-group-list" };
903
903
  const _hoisted_2$4 = ["innerHTML"];
904
904
  const _hoisted_3$4 = {
905
905
  key: 1,
@@ -994,7 +994,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
994
994
  const onAddDiffCount = () => emit("addDiffCount");
995
995
  const getLastValues = (item, index) => item?.[index] || {};
996
996
  return (_ctx, _cache) => {
997
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
997
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
998
998
  __props.config.extra ? (openBlock(), createElementBlock("div", {
999
999
  key: 0,
1000
1000
  innerHTML: __props.config.extra,
@@ -1046,7 +1046,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1046
1046
  }
1047
1047
  });
1048
1048
 
1049
- const _hoisted_1$8 = { class: "clearfix" };
1049
+ const _hoisted_1$7 = { class: "clearfix" };
1050
1050
  const _hoisted_2$3 = ["innerHTML"];
1051
1051
  const _hoisted_3$3 = {
1052
1052
  key: 0,
@@ -1086,7 +1086,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1086
1086
  "body-style": { display: expand.value ? "block" : "none" }
1087
1087
  }, {
1088
1088
  header: withCtx(() => [
1089
- createElementVNode("div", _hoisted_1$8, [
1089
+ createElementVNode("div", _hoisted_1$7, [
1090
1090
  createElementVNode("a", {
1091
1091
  href: "javascript:",
1092
1092
  style: { "width": "100%", "display": "block" },
@@ -1332,7 +1332,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1332
1332
  }
1333
1333
  });
1334
1334
 
1335
- const _hoisted_1$7 = ["innerHTML"];
1335
+ const _hoisted_1$6 = ["innerHTML"];
1336
1336
  const _hoisted_2$2 = { class: "el-form-item__content" };
1337
1337
  const _hoisted_3$2 = ["innerHTML"];
1338
1338
  const _hoisted_4$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0");
@@ -1705,7 +1705,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1705
1705
  key: 0,
1706
1706
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1707
1707
  innerHTML: __props.config.extra
1708
- }, null, 8, _hoisted_1$7)) : createCommentVNode("", true),
1708
+ }, null, 8, _hoisted_1$6)) : createCommentVNode("", true),
1709
1709
  createElementVNode("div", _hoisted_2$2, [
1710
1710
  createVNode(unref(TMagicTooltip), {
1711
1711
  content: "\u62D6\u62FD\u53EF\u6392\u5E8F",
@@ -1961,7 +1961,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1961
1961
  }
1962
1962
  });
1963
1963
 
1964
- const _hoisted_1$6 = { class: "custom-tabs-label" };
1965
1964
  const __default__$m = defineComponent({
1966
1965
  name: "MFormTabs"
1967
1966
  });
@@ -2070,17 +2069,6 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2070
2069
  props.config.onChange(mForm, { model: props.model, prop: props.prop, config: props.config });
2071
2070
  }
2072
2071
  };
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
2072
  const onAddDiffCount = (tabIndex) => {
2085
2073
  if (!diffCount.value[tabIndex]) {
2086
2074
  diffCount.value[tabIndex] = 1;
@@ -2108,11 +2096,10 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2108
2096
  display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
2109
2097
  key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex,
2110
2098
  name: filter(tab.status) || tabIndex.toString(),
2111
- label: filter(tab.title),
2112
2099
  lazy: tab.lazy || false
2113
2100
  }, {
2114
2101
  label: withCtx(() => [
2115
- createElementVNode("span", _hoisted_1$6, [
2102
+ createElementVNode("span", null, [
2116
2103
  createTextVNode(toDisplayString(filter(tab.title)), 1),
2117
2104
  createVNode(_component_el_badge, {
2118
2105
  hidden: !diffCount.value[tabIndex],
@@ -2127,8 +2114,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2127
2114
  key: item[unref(mForm)?.keyProp || "__key"],
2128
2115
  config: item,
2129
2116
  disabled: __props.disabled,
2130
- model: getValues(__props.model, tabIndex, tab),
2131
- "last-values": getValues(__props.lastValues, tabIndex, tab),
2117
+ 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,
2118
+ "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
2119
  "is-compare": __props.isCompare,
2133
2120
  prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
2134
2121
  size: __props.size,
@@ -2140,7 +2127,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2140
2127
  }), 128))
2141
2128
  ]),
2142
2129
  _: 2
2143
- }, 1032, ["name", "label", "lazy"])) : createCommentVNode("", true)
2130
+ }, 1032, ["name", "lazy"])) : createCommentVNode("", true)
2144
2131
  ], 64);
2145
2132
  }), 256))
2146
2133
  ]),