@tmagic/form 1.2.13 → 1.2.14

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.
Files changed (39) hide show
  1. package/dist/style.css +2 -2
  2. package/dist/tmagic-form.js +37 -37
  3. package/dist/tmagic-form.js.map +1 -1
  4. package/dist/tmagic-form.umd.cjs +39 -44
  5. package/dist/tmagic-form.umd.cjs.map +1 -1
  6. package/package.json +7 -7
  7. package/types/Form.vue.d.ts +5 -5
  8. package/types/FormDialog.vue.d.ts +41 -743
  9. package/types/containers/Col.vue.d.ts +2 -2
  10. package/types/containers/Container.vue.d.ts +3 -3
  11. package/types/containers/Fieldset.vue.d.ts +3 -3
  12. package/types/containers/GroupList.vue.d.ts +2 -2
  13. package/types/containers/GroupListItem.vue.d.ts +2 -2
  14. package/types/containers/Panel.vue.d.ts +22 -90
  15. package/types/containers/Row.vue.d.ts +2 -2
  16. package/types/containers/Step.vue.d.ts +3 -3
  17. package/types/containers/Table.vue.d.ts +42 -155
  18. package/types/containers/Tabs.vue.d.ts +3 -3
  19. package/types/fields/Cascader.vue.d.ts +4 -4
  20. package/types/fields/Checkbox.vue.d.ts +4 -4
  21. package/types/fields/CheckboxGroup.vue.d.ts +4 -4
  22. package/types/fields/ColorPicker.vue.d.ts +4 -4
  23. package/types/fields/Date.vue.d.ts +4 -4
  24. package/types/fields/DateTime.vue.d.ts +4 -4
  25. package/types/fields/Daterange.vue.d.ts +4 -4
  26. package/types/fields/Display.vue.d.ts +2 -2
  27. package/types/fields/DynamicField.vue.d.ts +4 -4
  28. package/types/fields/Hidden.vue.d.ts +2 -2
  29. package/types/fields/Link.vue.d.ts +4 -4
  30. package/types/fields/Number.vue.d.ts +4 -4
  31. package/types/fields/RadioGroup.vue.d.ts +4 -4
  32. package/types/fields/Select.vue.d.ts +4 -4
  33. package/types/fields/SelectOptionGroups.vue.d.ts +2 -2
  34. package/types/fields/SelectOptions.vue.d.ts +2 -2
  35. package/types/fields/Switch.vue.d.ts +4 -4
  36. package/types/fields/Text.vue.d.ts +4 -4
  37. package/types/fields/Textarea.vue.d.ts +4 -4
  38. package/types/fields/Time.vue.d.ts +4 -4
  39. package/types/schema.d.ts +14 -14
@@ -4,11 +4,6 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.iconsVue, global.lodashEs, global.design, global.Sortable, global.utils, global.cloneDeep));
5
5
  })(this, (function (exports, vue, iconsVue, lodashEs, design, Sortable, utils, cloneDeep) { 'use strict';
6
6
 
7
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
8
-
9
- const Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
10
- const cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
11
-
12
7
  const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
13
8
  const asyncLoadConfig = (value, initValue2, { asyncLoad, name, type }) => {
14
9
  if (type === "html" && typeof asyncLoad === "object" && typeof name !== "undefined") {
@@ -157,7 +152,7 @@
157
152
  };
158
153
  const initValue = async (mForm, { initValues, config }) => {
159
154
  if (!Array.isArray(config))
160
- throw new Error("config\u5E94\u8BE5\u4E3A\u6570\u7EC4");
155
+ throw new Error("config应该为数组");
161
156
  let valuesTmp = createValues(mForm, config, vue.toRaw(initValues), {});
162
157
  const [firstForm] = config;
163
158
  if (firstForm && typeof firstForm.onInitValue === "function") {
@@ -592,7 +587,7 @@
592
587
  onClick: expandHandler
593
588
  }, {
594
589
  default: vue.withCtx(() => [
595
- vue.createTextVNode(vue.toDisplayString(expand.value ? "\u6536\u8D77\u914D\u7F6E" : "\u5C55\u5F00\u66F4\u591A\u914D\u7F6E"), 1)
590
+ vue.createTextVNode(vue.toDisplayString(expand.value ? "收起配置" : "展开更多配置"), 1)
596
591
  ]),
597
592
  _: 1
598
593
  })
@@ -743,8 +738,8 @@
743
738
  });
744
739
 
745
740
  const _hoisted_1$9 = { class: "m-fields-group-list-item" };
746
- const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u79FB");
747
- const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u79FB");
741
+ const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("上移");
742
+ const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("下移");
748
743
  const _hoisted_4$4 = ["innerHTML"];
749
744
  const __default__$t = vue.defineComponent({
750
745
  name: "MFormGroupListItem"
@@ -782,7 +777,7 @@
782
777
  if (props.config.titleKey && props.model[props.config.titleKey]) {
783
778
  return props.model[props.config.titleKey];
784
779
  }
785
- return `\u7EC4 ${String(props.index)}`;
780
+ return `组 ${String(props.index)}`;
786
781
  });
787
782
  const length = vue.computed(() => props.groupModel?.length || 0);
788
783
  const itemExtra = vue.computed(() => filterFunction(mForm, props.config.itemExtra, props));
@@ -902,12 +897,12 @@
902
897
  key: 1,
903
898
  class: "el-table__empty-block"
904
899
  };
905
- const _hoisted_4$3 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "\u6682\u65E0\u6570\u636E", -1);
900
+ const _hoisted_4$3 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
906
901
  const _hoisted_5$2 = [
907
902
  _hoisted_4$3
908
903
  ];
909
- const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0\u7EC4");
910
- const _hoisted_7$1 = /* @__PURE__ */ vue.createTextVNode("\u5207\u6362\u4E3A\u8868\u683C");
904
+ const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("添加组");
905
+ const _hoisted_7$1 = /* @__PURE__ */ vue.createTextVNode("切换为表格");
911
906
  const __default__$s = vue.defineComponent({
912
907
  name: "MFormGroupList"
913
908
  });
@@ -1328,12 +1323,12 @@
1328
1323
  const _hoisted_1$6 = ["innerHTML"];
1329
1324
  const _hoisted_2$2 = { class: "el-form-item__content" };
1330
1325
  const _hoisted_3$2 = ["innerHTML"];
1331
- const _hoisted_4$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0");
1332
- const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode(" \xA0 ");
1333
- const _hoisted_6 = /* @__PURE__ */ vue.createTextVNode("\u5C55\u5F00\u914D\u7F6E");
1334
- const _hoisted_7 = /* @__PURE__ */ vue.createTextVNode("\u5BFC\u5165EXCEL");
1335
- const _hoisted_8 = /* @__PURE__ */ vue.createTextVNode("\xA0 ");
1336
- const _hoisted_9 = /* @__PURE__ */ vue.createTextVNode("\u6E05\u7A7A");
1326
+ const _hoisted_4$1 = /* @__PURE__ */ vue.createTextVNode("添加");
1327
+ const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode("   ");
1328
+ const _hoisted_6 = /* @__PURE__ */ vue.createTextVNode("展开配置");
1329
+ const _hoisted_7 = /* @__PURE__ */ vue.createTextVNode("导入EXCEL");
1330
+ const _hoisted_8 = /* @__PURE__ */ vue.createTextVNode("  ");
1331
+ const _hoisted_9 = /* @__PURE__ */ vue.createTextVNode("清空");
1337
1332
  const _hoisted_10 = {
1338
1333
  key: 1,
1339
1334
  class: "bottom",
@@ -1407,7 +1402,7 @@
1407
1402
  const tableEl = tMagicTable.value?.instance.$el;
1408
1403
  const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
1409
1404
  if (tBodyEl) {
1410
- const sortable = Sortable__default.default.create(tBodyEl, {
1405
+ const sortable = Sortable.create(tBodyEl, {
1411
1406
  onEnd: ({ newIndex, oldIndex }) => {
1412
1407
  if (typeof newIndex === "undefined")
1413
1408
  return;
@@ -1433,7 +1428,7 @@
1433
1428
  };
1434
1429
  const newHandler = async (row) => {
1435
1430
  if (props.config.max && props.model[modelName.value].length >= props.config.max) {
1436
- design.tMagicMessage.error(`\u6700\u591A\u65B0\u589E\u914D\u7F6E\u4E0D\u80FD\u8D85\u8FC7${props.config.max}\u6761`);
1431
+ design.tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
1437
1432
  return;
1438
1433
  }
1439
1434
  const columns = props.config.items;
@@ -1697,7 +1692,7 @@
1697
1692
  }, null, 8, _hoisted_1$6)) : vue.createCommentVNode("", true),
1698
1693
  vue.createElementVNode("div", _hoisted_2$2, [
1699
1694
  vue.createVNode(vue.unref(design.TMagicTooltip), {
1700
- content: "\u62D6\u62FD\u53EF\u6392\u5E8F",
1695
+ content: "拖拽可排序",
1701
1696
  placement: "left-start",
1702
1697
  disabled: __props.config.dropSort !== true
1703
1698
  }, {
@@ -1732,7 +1727,7 @@
1732
1727
  _: 1
1733
1728
  })) : vue.createCommentVNode("", true),
1734
1729
  vue.createVNode(vue.unref(design.TMagicTableColumn), {
1735
- label: "\u64CD\u4F5C",
1730
+ label: "操作",
1736
1731
  width: __props.config.operateColWidth || 55,
1737
1732
  align: "center",
1738
1733
  fixed: __props.config.fixed === false ? void 0 : "left"
@@ -1755,13 +1750,13 @@
1755
1750
  }, 8, ["width", "fixed"]),
1756
1751
  __props.sort && __props.model[vue.unref(modelName)] && __props.model[vue.unref(modelName)].length > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
1757
1752
  key: 1,
1758
- label: "\u6392\u5E8F",
1753
+ label: "排序",
1759
1754
  width: "60"
1760
1755
  }, {
1761
1756
  default: vue.withCtx((scope) => [
1762
1757
  scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
1763
1758
  key: 0,
1764
- content: "\u70B9\u51FB\u4E0A\u79FB\uFF0C\u53CC\u51FB\u7F6E\u9876",
1759
+ content: "点击上移,双击置顶",
1765
1760
  placement: "top"
1766
1761
  }, {
1767
1762
  default: vue.withCtx(() => [
@@ -1780,7 +1775,7 @@
1780
1775
  }, 1024)) : vue.createCommentVNode("", true),
1781
1776
  scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== __props.model[vue.unref(modelName)].length - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
1782
1777
  key: 1,
1783
- content: "\u70B9\u51FB\u4E0B\u79FB\uFF0C\u53CC\u51FB\u7F6E\u5E95",
1778
+ content: "点击下移,双击置底",
1784
1779
  placement: "top"
1785
1780
  }, {
1786
1781
  default: vue.withCtx(() => [
@@ -1810,7 +1805,7 @@
1810
1805
  __props.showIndex && __props.config.showIndex ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
1811
1806
  key: 3,
1812
1807
  width: "60",
1813
- label: "\u5E8F\u53F7"
1808
+ label: "序号"
1814
1809
  }, {
1815
1810
  default: vue.withCtx((scope) => [
1816
1811
  vue.createTextVNode(vue.toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value), 1)
@@ -1889,7 +1884,7 @@
1889
1884
  onClick: toggleFullscreen
1890
1885
  }, {
1891
1886
  default: vue.withCtx(() => [
1892
- vue.createTextVNode(vue.toDisplayString(isFullscreen.value ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u7F16\u8F91"), 1)
1887
+ vue.createTextVNode(vue.toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"), 1)
1893
1888
  ]),
1894
1889
  _: 1
1895
1890
  }, 8, ["icon"])) : vue.createCommentVNode("", true),
@@ -1999,7 +1994,7 @@
1999
1994
  const tabs = vue.computed(() => {
2000
1995
  if (props.config.dynamic) {
2001
1996
  if (!props.config.name)
2002
- throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1997
+ throw new Error("dynamic tab 必须配置name");
2003
1998
  return props.model[props.config.name] || [];
2004
1999
  }
2005
2000
  return props.config.items;
@@ -2017,7 +2012,7 @@
2017
2012
  const tabClickHandler = (tab) => tabClick(mForm, tab, props);
2018
2013
  const onTabAdd = () => {
2019
2014
  if (!props.config.name)
2020
- throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
2015
+ throw new Error("dynamic tab 必须配置name");
2021
2016
  if (typeof props.config.onTabAdd === "function") {
2022
2017
  props.config.onTabAdd(mForm, {
2023
2018
  model: props.model,
@@ -2026,7 +2021,7 @@
2026
2021
  });
2027
2022
  } else if (tabs.value.length > 0) {
2028
2023
  const newObj = lodashEs.cloneDeep(tabs.value[0]);
2029
- newObj.title = `\u6807\u7B7E${tabs.value.length + 1}`;
2024
+ newObj.title = `标签${tabs.value.length + 1}`;
2030
2025
  props.model[props.config.name].push(newObj);
2031
2026
  }
2032
2027
  emit("change", props.model);
@@ -2034,7 +2029,7 @@
2034
2029
  };
2035
2030
  const onTabRemove = (tabName) => {
2036
2031
  if (!props.config.name)
2037
- throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
2032
+ throw new Error("dynamic tab 必须配置name");
2038
2033
  if (typeof props.config.onTabRemove === "function") {
2039
2034
  props.config.onTabRemove(mForm, tabName, {
2040
2035
  model: props.model,
@@ -2523,8 +2518,8 @@
2523
2518
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
2524
2519
  type: "datetimerange",
2525
2520
  "range-separator": "-",
2526
- "start-placeholder": "\u5F00\u59CB\u65E5\u671F",
2527
- "end-placeholder": "\u7ED3\u675F\u65E5\u671F",
2521
+ "start-placeholder": "开始日期",
2522
+ "end-placeholder": "结束日期",
2528
2523
  size: __props.size,
2529
2524
  "unlink-panels": true,
2530
2525
  disabled: __props.disabled,
@@ -2831,7 +2826,7 @@
2831
2826
  submitForm: async (native) => {
2832
2827
  try {
2833
2828
  await tMagicForm.value?.validate();
2834
- return native ? values.value : cloneDeep__default.default(vue.toRaw(values.value));
2829
+ return native ? values.value : cloneDeep(vue.toRaw(values.value));
2835
2830
  } catch (invalidFields) {
2836
2831
  const error = [];
2837
2832
  Object.entries(invalidFields).forEach(([, ValidateError]) => {
@@ -2839,7 +2834,7 @@
2839
2834
  if (field && message)
2840
2835
  error.push(`${field} -> ${message}`);
2841
2836
  if (field && !message)
2842
- error.push(`${field} -> \u51FA\u73B0\u9519\u8BEF`);
2837
+ error.push(`${field} -> 出现错误`);
2843
2838
  if (!field && message)
2844
2839
  error.push(`${message}`);
2845
2840
  });
@@ -2882,9 +2877,9 @@
2882
2877
  });
2883
2878
 
2884
2879
  const _hoisted_1$3 = { style: { "min-height": "1px" } };
2885
- const _hoisted_2$1 = /* @__PURE__ */ vue.createTextVNode("\u53D6 \u6D88");
2886
- const _hoisted_3$1 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u4E00\u6B65");
2887
- const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u4E00\u6B65");
2880
+ const _hoisted_2$1 = /* @__PURE__ */ vue.createTextVNode(" ");
2881
+ const _hoisted_3$1 = /* @__PURE__ */ vue.createTextVNode("上一步");
2882
+ const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("下一步");
2888
2883
  const __default__$a = vue.defineComponent({
2889
2884
  name: "MFormDialog"
2890
2885
  });
@@ -2901,7 +2896,7 @@
2901
2896
  title: null,
2902
2897
  zIndex: null,
2903
2898
  size: null,
2904
- confirmText: { default: "\u786E\u5B9A" }
2899
+ confirmText: { default: "确定" }
2905
2900
  },
2906
2901
  emits: ["close", "submit", "error", "change"],
2907
2902
  setup(__props, { expose, emit }) {
@@ -3074,7 +3069,7 @@
3074
3069
  key: 2,
3075
3070
  class: "m-fields-link"
3076
3071
  };
3077
- const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u70B9\u51FB\u7F16\u8F91");
3072
+ const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("点击编辑");
3078
3073
  const __default__$9 = vue.defineComponent({
3079
3074
  name: "MFormLink"
3080
3075
  });
@@ -3122,7 +3117,7 @@
3122
3117
  if (props.config.displayText) {
3123
3118
  return props.config.displayText;
3124
3119
  }
3125
- return "\u8DF3\u8F6C";
3120
+ return "跳转";
3126
3121
  });
3127
3122
  const editHandler = () => {
3128
3123
  init();
@@ -3159,7 +3154,7 @@
3159
3154
  vue.createVNode(_sfc_main$a, {
3160
3155
  ref_key: "editor",
3161
3156
  ref: editor,
3162
- title: __props.config.formTitle || "\u7F16\u8F91\u6269\u5C55\u914D\u7F6E",
3157
+ title: __props.config.formTitle || "编辑扩展配置",
3163
3158
  width: __props.config.formWidth,
3164
3159
  values: formValue.value,
3165
3160
  config: vue.unref(formConfig),
@@ -3347,7 +3342,7 @@
3347
3342
  setup(__props, { emit }) {
3348
3343
  const props = __props;
3349
3344
  if (!props.model)
3350
- throw new Error("\u4E0D\u80FD\u6CA1\u6709model");
3345
+ throw new Error("不能没有model");
3351
3346
  useAddField(props.prop);
3352
3347
  const tMagicSelect = vue.ref();
3353
3348
  const mForm = vue.inject("mForm");