@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.
- package/dist/style.css +2 -2
- package/dist/tmagic-form.js +37 -37
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +39 -44
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +7 -7
- package/types/Form.vue.d.ts +5 -5
- package/types/FormDialog.vue.d.ts +41 -743
- package/types/containers/Col.vue.d.ts +2 -2
- package/types/containers/Container.vue.d.ts +3 -3
- package/types/containers/Fieldset.vue.d.ts +3 -3
- package/types/containers/GroupList.vue.d.ts +2 -2
- package/types/containers/GroupListItem.vue.d.ts +2 -2
- package/types/containers/Panel.vue.d.ts +22 -90
- package/types/containers/Row.vue.d.ts +2 -2
- package/types/containers/Step.vue.d.ts +3 -3
- package/types/containers/Table.vue.d.ts +42 -155
- package/types/containers/Tabs.vue.d.ts +3 -3
- package/types/fields/Cascader.vue.d.ts +4 -4
- package/types/fields/Checkbox.vue.d.ts +4 -4
- package/types/fields/CheckboxGroup.vue.d.ts +4 -4
- package/types/fields/ColorPicker.vue.d.ts +4 -4
- package/types/fields/Date.vue.d.ts +4 -4
- package/types/fields/DateTime.vue.d.ts +4 -4
- package/types/fields/Daterange.vue.d.ts +4 -4
- package/types/fields/Display.vue.d.ts +2 -2
- package/types/fields/DynamicField.vue.d.ts +4 -4
- package/types/fields/Hidden.vue.d.ts +2 -2
- package/types/fields/Link.vue.d.ts +4 -4
- package/types/fields/Number.vue.d.ts +4 -4
- package/types/fields/RadioGroup.vue.d.ts +4 -4
- package/types/fields/Select.vue.d.ts +4 -4
- package/types/fields/SelectOptionGroups.vue.d.ts +2 -2
- package/types/fields/SelectOptions.vue.d.ts +2 -2
- package/types/fields/Switch.vue.d.ts +4 -4
- package/types/fields/Text.vue.d.ts +4 -4
- package/types/fields/Textarea.vue.d.ts +4 -4
- package/types/fields/Time.vue.d.ts +4 -4
- package/types/schema.d.ts +14 -14
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -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
|
|
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 ? "
|
|
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("
|
|
747
|
-
const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("
|
|
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
|
|
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" }, "
|
|
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("
|
|
910
|
-
const _hoisted_7$1 = /* @__PURE__ */ vue.createTextVNode("
|
|
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("
|
|
1332
|
-
const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode("
|
|
1333
|
-
const _hoisted_6 = /* @__PURE__ */ vue.createTextVNode("
|
|
1334
|
-
const _hoisted_7 = /* @__PURE__ */ vue.createTextVNode("
|
|
1335
|
-
const _hoisted_8 = /* @__PURE__ */ vue.createTextVNode("
|
|
1336
|
-
const _hoisted_9 = /* @__PURE__ */ vue.createTextVNode("
|
|
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 =
|
|
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(
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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 ? "
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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": "
|
|
2527
|
-
"end-placeholder": "
|
|
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 :
|
|
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} ->
|
|
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("
|
|
2886
|
-
const _hoisted_3$1 = /* @__PURE__ */ vue.createTextVNode("
|
|
2887
|
-
const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("
|
|
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: "
|
|
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("
|
|
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 "
|
|
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 || "
|
|
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("
|
|
3345
|
+
throw new Error("不能没有model");
|
|
3351
3346
|
useAddField(props.prop);
|
|
3352
3347
|
const tMagicSelect = vue.ref();
|
|
3353
3348
|
const mForm = vue.inject("mForm");
|