@tmagic/form 1.5.0-beta.0 → 1.5.0-beta.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 +2 -2
- package/dist/tmagic-form.js +129 -104
- package/dist/tmagic-form.umd.cjs +129 -105
- package/package.json +10 -8
- package/src/containers/Container.vue +5 -5
- package/src/containers/Table.vue +4 -2
- package/src/containers/Tabs.vue +3 -3
- package/src/fields/Date.vue +4 -4
- package/src/fields/DateTime.vue +6 -2
- package/src/fields/Daterange.vue +18 -15
- package/src/fields/Select.vue +1 -1
- package/src/fields/Text.vue +1 -1
- package/src/fields/Timerange.vue +1 -2
- package/src/index.ts +5 -5
- package/src/schema.ts +7 -4
- package/src/theme/form.scss +2 -2
- package/src/utils/form.ts +27 -0
- package/types/index.d.ts +1096 -1764
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('@tmagic/design'), require('sortablejs'), require('@tmagic/utils')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', '@tmagic/design', 'sortablejs', '@tmagic/utils'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.iconsVue, global.lodashEs, global.design, global.Sortable, global.utils));
|
|
5
|
-
})(this, (function (exports, vue, iconsVue, lodashEs, design, Sortable, utils) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('@tmagic/design'), require('dayjs'), require('dayjs/plugin/utc'), require('sortablejs'), require('@tmagic/utils')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', '@tmagic/design', 'dayjs', 'dayjs/plugin/utc', 'sortablejs', '@tmagic/utils'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.iconsVue, global.lodashEs, global.design, global.dayjs, global.utc, global.Sortable, global.utils));
|
|
5
|
+
})(this, (function (exports, vue, iconsVue, lodashEs, design, dayjs, utc, Sortable, utils) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
|
|
8
8
|
const asyncLoadConfig = (value, initValue2, { asyncLoad, name, type }) => {
|
|
@@ -163,12 +163,30 @@
|
|
|
163
163
|
}
|
|
164
164
|
return valuesTmp || {};
|
|
165
165
|
};
|
|
166
|
+
const datetimeFormatter = (v, defaultValue = "-", format = "YYYY-MM-DD HH:mm:ss") => {
|
|
167
|
+
if (v) {
|
|
168
|
+
let time;
|
|
169
|
+
if (["x", "timestamp"].includes(format)) {
|
|
170
|
+
time = dayjs(v).valueOf();
|
|
171
|
+
} else if (typeof v === "string" && v.includes("Z") || v.constructor === Date) {
|
|
172
|
+
dayjs.extend(utc);
|
|
173
|
+
time = dayjs(v).utcOffset(8).format(format);
|
|
174
|
+
} else {
|
|
175
|
+
time = dayjs(v).format(format);
|
|
176
|
+
}
|
|
177
|
+
if (time !== "Invalid Date") {
|
|
178
|
+
return time;
|
|
179
|
+
}
|
|
180
|
+
return defaultValue;
|
|
181
|
+
}
|
|
182
|
+
return defaultValue;
|
|
183
|
+
};
|
|
166
184
|
|
|
167
|
-
const _hoisted_1$d = ["id", "data-
|
|
168
|
-
const _hoisted_2$
|
|
169
|
-
const _hoisted_3$
|
|
170
|
-
const _hoisted_4$
|
|
171
|
-
const _hoisted_5$
|
|
185
|
+
const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
|
|
186
|
+
const _hoisted_2$7 = ["innerHTML", "title"];
|
|
187
|
+
const _hoisted_3$4 = ["innerHTML"];
|
|
188
|
+
const _hoisted_4$3 = ["innerHTML"];
|
|
189
|
+
const _hoisted_5$3 = ["innerHTML"];
|
|
172
190
|
const _hoisted_6$2 = ["innerHTML", "title"];
|
|
173
191
|
const _hoisted_7$1 = ["innerHTML"];
|
|
174
192
|
const _hoisted_8$1 = ["innerHTML"];
|
|
@@ -318,8 +336,8 @@
|
|
|
318
336
|
const _component_Container = vue.resolveComponent("Container", true);
|
|
319
337
|
return _ctx.config ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
320
338
|
key: 0,
|
|
321
|
-
id: _ctx.config.id,
|
|
322
|
-
"data-
|
|
339
|
+
"data-tmagic-id": _ctx.config.id,
|
|
340
|
+
"data-tmagic-form-item-prop": itemProp.value,
|
|
323
341
|
style: vue.normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
|
|
324
342
|
class: vue.normalizeClass(`m-form-container m-container-${type.value || ""} ${_ctx.config.className || ""}`)
|
|
325
343
|
}, [
|
|
@@ -348,7 +366,7 @@
|
|
|
348
366
|
}, null, 40, ["size", "model", "last-values", "is-compare", "config", "disabled", "name", "prop", "step-active", "expand-more", "label-width"])) : type.value && display$1.value && !showDiff.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
349
367
|
vue.createVNode(vue.unref(design.TMagicFormItem), {
|
|
350
368
|
style: vue.normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
|
|
351
|
-
class: vue.normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
369
|
+
class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
352
370
|
prop: itemProp.value,
|
|
353
371
|
"label-width": itemLabelWidth.value,
|
|
354
372
|
rules: rule.value
|
|
@@ -357,12 +375,12 @@
|
|
|
357
375
|
vue.createElementVNode("span", {
|
|
358
376
|
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
359
377
|
title: _ctx.config.labelTitle
|
|
360
|
-
}, null, 8, _hoisted_2$
|
|
378
|
+
}, null, 8, _hoisted_2$7)
|
|
361
379
|
]),
|
|
362
380
|
default: vue.withCtx(() => [
|
|
363
381
|
tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
|
|
364
382
|
content: vue.withCtx(() => [
|
|
365
|
-
vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$
|
|
383
|
+
vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$4)
|
|
366
384
|
]),
|
|
367
385
|
default: vue.withCtx(() => [
|
|
368
386
|
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
|
|
@@ -395,7 +413,7 @@
|
|
|
395
413
|
key: 2,
|
|
396
414
|
innerHTML: extra.value,
|
|
397
415
|
class: "m-form-tip"
|
|
398
|
-
}, null, 8, _hoisted_4$
|
|
416
|
+
}, null, 8, _hoisted_4$3)) : vue.createCommentVNode("", true)
|
|
399
417
|
]),
|
|
400
418
|
_: 1
|
|
401
419
|
}, 8, ["style", "class", "prop", "label-width", "rules"]),
|
|
@@ -406,7 +424,7 @@
|
|
|
406
424
|
content: vue.withCtx(() => [
|
|
407
425
|
vue.createElementVNode("div", {
|
|
408
426
|
innerHTML: _ctx.config.tip
|
|
409
|
-
}, null, 8, _hoisted_5$
|
|
427
|
+
}, null, 8, _hoisted_5$3)
|
|
410
428
|
]),
|
|
411
429
|
default: vue.withCtx(() => [
|
|
412
430
|
vue.createVNode(vue.unref(design.TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
|
|
@@ -421,7 +439,7 @@
|
|
|
421
439
|
], 64)) : type.value && display$1.value && showDiff.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
|
|
422
440
|
vue.createVNode(vue.unref(design.TMagicFormItem), {
|
|
423
441
|
style: vue.normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
|
|
424
|
-
class: vue.normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
442
|
+
class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
425
443
|
prop: itemProp.value,
|
|
426
444
|
"label-width": itemLabelWidth.value,
|
|
427
445
|
rules: rule.value
|
|
@@ -489,7 +507,7 @@
|
|
|
489
507
|
})) : vue.createCommentVNode("", true),
|
|
490
508
|
vue.createVNode(vue.unref(design.TMagicFormItem), {
|
|
491
509
|
style: vue.normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
|
|
492
|
-
class: vue.normalizeClass({ hidden: `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
510
|
+
class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
|
|
493
511
|
prop: itemProp.value,
|
|
494
512
|
"label-width": itemLabelWidth.value,
|
|
495
513
|
rules: rule.value
|
|
@@ -594,10 +612,10 @@
|
|
|
594
612
|
});
|
|
595
613
|
|
|
596
614
|
const _hoisted_1$c = ["innerHTML"];
|
|
597
|
-
const _hoisted_2$
|
|
598
|
-
const _hoisted_3$
|
|
599
|
-
const _hoisted_4$
|
|
600
|
-
const _hoisted_5$
|
|
615
|
+
const _hoisted_2$6 = ["innerHTML"];
|
|
616
|
+
const _hoisted_3$3 = { key: 1 };
|
|
617
|
+
const _hoisted_4$2 = ["innerHTML"];
|
|
618
|
+
const _hoisted_5$2 = ["innerHTML"];
|
|
601
619
|
const _hoisted_6$1 = {
|
|
602
620
|
key: 2,
|
|
603
621
|
style: { "display": "flex" }
|
|
@@ -669,21 +687,21 @@
|
|
|
669
687
|
key: 0,
|
|
670
688
|
innerHTML: _ctx.config.extra,
|
|
671
689
|
class: "m-form-tip"
|
|
672
|
-
}, null, 8, _hoisted_2$
|
|
690
|
+
}, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
|
|
673
691
|
]),
|
|
674
692
|
_: 1
|
|
675
693
|
}, 8, ["modelValue", "prop"])
|
|
676
694
|
]),
|
|
677
695
|
_: 1
|
|
678
|
-
})) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$
|
|
696
|
+
})) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$3, [
|
|
679
697
|
vue.createElementVNode("span", {
|
|
680
698
|
innerHTML: _ctx.config.legend
|
|
681
|
-
}, null, 8, _hoisted_4$
|
|
699
|
+
}, null, 8, _hoisted_4$2),
|
|
682
700
|
_ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
683
701
|
key: 0,
|
|
684
702
|
innerHTML: _ctx.config.extra,
|
|
685
703
|
class: "m-form-tip"
|
|
686
|
-
}, null, 8, _hoisted_5$
|
|
704
|
+
}, null, 8, _hoisted_5$2)) : vue.createCommentVNode("", true)
|
|
687
705
|
])),
|
|
688
706
|
_ctx.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
|
|
689
707
|
vue.createElementVNode("div", _hoisted_7, [
|
|
@@ -730,7 +748,7 @@
|
|
|
730
748
|
});
|
|
731
749
|
|
|
732
750
|
const _hoisted_1$b = { class: "m-fields-group-list-item" };
|
|
733
|
-
const _hoisted_2$
|
|
751
|
+
const _hoisted_2$5 = ["innerHTML"];
|
|
734
752
|
const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
|
|
735
753
|
...{
|
|
736
754
|
name: "MFormGroupListItem"
|
|
@@ -831,7 +849,7 @@
|
|
|
831
849
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
832
850
|
}, {
|
|
833
851
|
default: vue.withCtx(() => [
|
|
834
|
-
vue.createTextVNode("上移"),
|
|
852
|
+
_cache[3] || (_cache[3] = vue.createTextVNode("上移")),
|
|
835
853
|
vue.createVNode(vue.unref(design.TMagicIcon), null, {
|
|
836
854
|
default: vue.withCtx(() => [
|
|
837
855
|
vue.createVNode(vue.unref(iconsVue.CaretTop))
|
|
@@ -850,7 +868,7 @@
|
|
|
850
868
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
851
869
|
}, {
|
|
852
870
|
default: vue.withCtx(() => [
|
|
853
|
-
vue.createTextVNode("下移"),
|
|
871
|
+
_cache[4] || (_cache[4] = vue.createTextVNode("下移")),
|
|
854
872
|
vue.createVNode(vue.unref(design.TMagicIcon), null, {
|
|
855
873
|
default: vue.withCtx(() => [
|
|
856
874
|
vue.createVNode(vue.unref(iconsVue.CaretBottom))
|
|
@@ -867,7 +885,7 @@
|
|
|
867
885
|
key: 1,
|
|
868
886
|
innerHTML: itemExtra.value,
|
|
869
887
|
class: "m-form-tip"
|
|
870
|
-
}, null, 8, _hoisted_2$
|
|
888
|
+
}, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true)
|
|
871
889
|
]),
|
|
872
890
|
expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
873
891
|
key: 0,
|
|
@@ -888,15 +906,11 @@
|
|
|
888
906
|
});
|
|
889
907
|
|
|
890
908
|
const _hoisted_1$a = { class: "m-fields-group-list" };
|
|
891
|
-
const _hoisted_2$
|
|
892
|
-
const _hoisted_3$
|
|
909
|
+
const _hoisted_2$4 = ["innerHTML"];
|
|
910
|
+
const _hoisted_3$2 = {
|
|
893
911
|
key: 1,
|
|
894
912
|
class: "el-table__empty-block"
|
|
895
913
|
};
|
|
896
|
-
const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
|
|
897
|
-
const _hoisted_5$2 = [
|
|
898
|
-
_hoisted_4$2
|
|
899
|
-
];
|
|
900
914
|
const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
|
|
901
915
|
...{
|
|
902
916
|
name: "MFormGroupList"
|
|
@@ -982,8 +996,10 @@
|
|
|
982
996
|
key: 0,
|
|
983
997
|
innerHTML: _ctx.config.extra,
|
|
984
998
|
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
985
|
-
}, null, 8, _hoisted_2$
|
|
986
|
-
!_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$
|
|
999
|
+
}, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
|
|
1000
|
+
!_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, _cache[1] || (_cache[1] = [
|
|
1001
|
+
vue.createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1)
|
|
1002
|
+
]))) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
|
|
987
1003
|
return vue.openBlock(), vue.createBlock(_sfc_main$v, {
|
|
988
1004
|
key: index,
|
|
989
1005
|
model: item,
|
|
@@ -1008,9 +1024,9 @@
|
|
|
1008
1024
|
size: "small",
|
|
1009
1025
|
disabled: _ctx.disabled
|
|
1010
1026
|
}, {
|
|
1011
|
-
default: vue.withCtx(() => [
|
|
1027
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
1012
1028
|
vue.createTextVNode("新增")
|
|
1013
|
-
]),
|
|
1029
|
+
])),
|
|
1014
1030
|
_: 1
|
|
1015
1031
|
}, 8, ["disabled"])) : vue.createCommentVNode("", true),
|
|
1016
1032
|
_ctx.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
@@ -1019,9 +1035,9 @@
|
|
|
1019
1035
|
size: "small",
|
|
1020
1036
|
onClick: toggleMode
|
|
1021
1037
|
}, {
|
|
1022
|
-
default: vue.withCtx(() => [
|
|
1038
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
1023
1039
|
vue.createTextVNode("切换为表格")
|
|
1024
|
-
]),
|
|
1040
|
+
])),
|
|
1025
1041
|
_: 1
|
|
1026
1042
|
}, 8, ["icon"])) : vue.createCommentVNode("", true)
|
|
1027
1043
|
]);
|
|
@@ -1030,8 +1046,8 @@
|
|
|
1030
1046
|
});
|
|
1031
1047
|
|
|
1032
1048
|
const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
1033
|
-
const _hoisted_2$
|
|
1034
|
-
const _hoisted_3$
|
|
1049
|
+
const _hoisted_2$3 = ["innerHTML"];
|
|
1050
|
+
const _hoisted_3$1 = {
|
|
1035
1051
|
key: 0,
|
|
1036
1052
|
style: { "display": "flex" }
|
|
1037
1053
|
};
|
|
@@ -1081,7 +1097,7 @@
|
|
|
1081
1097
|
key: 0,
|
|
1082
1098
|
innerHTML: _ctx.config.extra,
|
|
1083
1099
|
class: "m-form-tip"
|
|
1084
|
-
}, null, 8, _hoisted_2$
|
|
1100
|
+
}, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true),
|
|
1085
1101
|
vue.renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1086
1102
|
vue.createTextVNode(vue.toDisplayString(filter(_ctx.config.title)), 1)
|
|
1087
1103
|
])
|
|
@@ -1090,7 +1106,7 @@
|
|
|
1090
1106
|
default: vue.withCtx(() => [
|
|
1091
1107
|
vue.createElementVNode("div", null, [
|
|
1092
1108
|
vue.renderSlot(_ctx.$slots, "default"),
|
|
1093
|
-
_ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$
|
|
1109
|
+
_ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
|
|
1094
1110
|
vue.createElementVNode("div", _hoisted_4$1, [
|
|
1095
1111
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
|
|
1096
1112
|
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
@@ -1316,8 +1332,8 @@
|
|
|
1316
1332
|
});
|
|
1317
1333
|
|
|
1318
1334
|
const _hoisted_1$8 = { class: "m-fields-table-wrap" };
|
|
1319
|
-
const _hoisted_2$
|
|
1320
|
-
const _hoisted_3
|
|
1335
|
+
const _hoisted_2$2 = ["innerHTML"];
|
|
1336
|
+
const _hoisted_3 = ["innerHTML"];
|
|
1321
1337
|
const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
1322
1338
|
const _hoisted_5 = { style: { "display": "flex" } };
|
|
1323
1339
|
const _hoisted_6 = {
|
|
@@ -1564,6 +1580,7 @@
|
|
|
1564
1580
|
}
|
|
1565
1581
|
timer = setTimeout(() => {
|
|
1566
1582
|
swapArray(index, index - 1);
|
|
1583
|
+
timer = void 0;
|
|
1567
1584
|
}, 300);
|
|
1568
1585
|
};
|
|
1569
1586
|
const topHandler = (index) => {
|
|
@@ -1582,6 +1599,7 @@
|
|
|
1582
1599
|
}
|
|
1583
1600
|
timer = setTimeout(() => {
|
|
1584
1601
|
swapArray(index, index + 1);
|
|
1602
|
+
timer = void 0;
|
|
1585
1603
|
}, 300);
|
|
1586
1604
|
};
|
|
1587
1605
|
const bottomHandler = (index) => {
|
|
@@ -1693,7 +1711,7 @@
|
|
|
1693
1711
|
key: 0,
|
|
1694
1712
|
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
1695
1713
|
innerHTML: _ctx.config.extra
|
|
1696
|
-
}, null, 8, _hoisted_2$
|
|
1714
|
+
}, null, 8, _hoisted_2$2)) : vue.createCommentVNode("", true),
|
|
1697
1715
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
1698
1716
|
content: "拖拽可排序",
|
|
1699
1717
|
placement: "left-start",
|
|
@@ -1725,7 +1743,7 @@
|
|
|
1725
1743
|
vue.createElementVNode("span", {
|
|
1726
1744
|
innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
|
|
1727
1745
|
class: "m-form-tip"
|
|
1728
|
-
}, null, 8, _hoisted_3
|
|
1746
|
+
}, null, 8, _hoisted_3)
|
|
1729
1747
|
]),
|
|
1730
1748
|
_: 1
|
|
1731
1749
|
})) : vue.createCommentVNode("", true),
|
|
@@ -1862,9 +1880,9 @@
|
|
|
1862
1880
|
plain: "",
|
|
1863
1881
|
onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
|
|
1864
1882
|
}, {
|
|
1865
|
-
default: vue.withCtx(() => [
|
|
1883
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
1866
1884
|
vue.createTextVNode("新增一行")
|
|
1867
|
-
]),
|
|
1885
|
+
])),
|
|
1868
1886
|
_: 1
|
|
1869
1887
|
}, 8, ["disabled"])) : vue.createCommentVNode("", true),
|
|
1870
1888
|
vue.createElementVNode("div", _hoisted_5, [
|
|
@@ -1875,9 +1893,9 @@
|
|
|
1875
1893
|
type: "primary",
|
|
1876
1894
|
onClick: toggleMode
|
|
1877
1895
|
}, {
|
|
1878
|
-
default: vue.withCtx(() => [
|
|
1896
|
+
default: vue.withCtx(() => _cache[5] || (_cache[5] = [
|
|
1879
1897
|
vue.createTextVNode("展开配置")
|
|
1880
|
-
]),
|
|
1898
|
+
])),
|
|
1881
1899
|
_: 1
|
|
1882
1900
|
}, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
1883
1901
|
_ctx.config.enableFullscreen !== false ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
@@ -1909,9 +1927,9 @@
|
|
|
1909
1927
|
disabled: _ctx.disabled,
|
|
1910
1928
|
plain: ""
|
|
1911
1929
|
}, {
|
|
1912
|
-
default: vue.withCtx(() => [
|
|
1930
|
+
default: vue.withCtx(() => _cache[6] || (_cache[6] = [
|
|
1913
1931
|
vue.createTextVNode("导入EXCEL")
|
|
1914
|
-
]),
|
|
1932
|
+
])),
|
|
1915
1933
|
_: 1
|
|
1916
1934
|
}, 8, ["disabled"])
|
|
1917
1935
|
]),
|
|
@@ -1925,9 +1943,9 @@
|
|
|
1925
1943
|
plain: "",
|
|
1926
1944
|
onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
|
|
1927
1945
|
}, {
|
|
1928
|
-
default: vue.withCtx(() => [
|
|
1946
|
+
default: vue.withCtx(() => _cache[7] || (_cache[7] = [
|
|
1929
1947
|
vue.createTextVNode("清空")
|
|
1930
|
-
]),
|
|
1948
|
+
])),
|
|
1931
1949
|
_: 1
|
|
1932
1950
|
}, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
1933
1951
|
])
|
|
@@ -1970,8 +1988,8 @@
|
|
|
1970
1988
|
},
|
|
1971
1989
|
emits: ["change", "addDiffCount"],
|
|
1972
1990
|
setup(__props, { emit: __emit }) {
|
|
1973
|
-
const tabPaneComponent = design.
|
|
1974
|
-
const tabsComponent = design.
|
|
1991
|
+
const tabPaneComponent = design.getDesignConfig("components")?.tabPane;
|
|
1992
|
+
const tabsComponent = design.getDesignConfig("components")?.tabs;
|
|
1975
1993
|
const getActive = (mForm2, props2, activeTabName2) => {
|
|
1976
1994
|
const { config, model, prop } = props2;
|
|
1977
1995
|
const { active } = config;
|
|
@@ -2454,7 +2472,7 @@
|
|
|
2454
2472
|
const props = __props;
|
|
2455
2473
|
const emit = __emit;
|
|
2456
2474
|
useAddField(props.prop);
|
|
2457
|
-
props.model[props.name] =
|
|
2475
|
+
props.model[props.name] = datetimeFormatter(props.model[props.name], "", props.config.valueFormat || "YYYY/MM/DD");
|
|
2458
2476
|
const changeHandler = (v) => {
|
|
2459
2477
|
emit("change", v);
|
|
2460
2478
|
};
|
|
@@ -2466,8 +2484,8 @@
|
|
|
2466
2484
|
size: _ctx.size,
|
|
2467
2485
|
placeholder: _ctx.config.placeholder,
|
|
2468
2486
|
disabled: _ctx.disabled,
|
|
2469
|
-
format: _ctx.config.format,
|
|
2470
|
-
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD
|
|
2487
|
+
format: _ctx.config.format || "YYYY/MM/DD",
|
|
2488
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD",
|
|
2471
2489
|
onChange: changeHandler
|
|
2472
2490
|
}, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2473
2491
|
};
|
|
@@ -2505,9 +2523,10 @@
|
|
|
2505
2523
|
if (!value.value) {
|
|
2506
2524
|
value.value = [];
|
|
2507
2525
|
}
|
|
2526
|
+
const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
|
|
2508
2527
|
if (!start || !end) value.value = [];
|
|
2509
|
-
if (start !== preStart) value.value[0] =
|
|
2510
|
-
if (end !== preEnd) value.value[1] =
|
|
2528
|
+
if (start !== preStart) value.value[0] = datetimeFormatter(start, "", format);
|
|
2529
|
+
if (end !== preEnd) value.value[1] = datetimeFormatter(end, "", format);
|
|
2511
2530
|
},
|
|
2512
2531
|
{
|
|
2513
2532
|
immediate: true
|
|
@@ -2517,7 +2536,11 @@
|
|
|
2517
2536
|
vue.watch(
|
|
2518
2537
|
() => props.model[props.name],
|
|
2519
2538
|
(start, preStart) => {
|
|
2520
|
-
|
|
2539
|
+
const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
|
|
2540
|
+
if (start !== preStart)
|
|
2541
|
+
value.value = start.map(
|
|
2542
|
+
(item) => item ? datetimeFormatter(item, "", format) : void 0
|
|
2543
|
+
);
|
|
2521
2544
|
},
|
|
2522
2545
|
{
|
|
2523
2546
|
immediate: true
|
|
@@ -2531,7 +2554,7 @@
|
|
|
2531
2554
|
return;
|
|
2532
2555
|
}
|
|
2533
2556
|
if (Array.isArray(v)) {
|
|
2534
|
-
props.model[item] =
|
|
2557
|
+
props.model[item] = v[index];
|
|
2535
2558
|
} else {
|
|
2536
2559
|
props.model[item] = void 0;
|
|
2537
2560
|
}
|
|
@@ -2540,18 +2563,12 @@
|
|
|
2540
2563
|
const changeHandler = (v) => {
|
|
2541
2564
|
const value2 = v || [];
|
|
2542
2565
|
if (props.name) {
|
|
2543
|
-
emit(
|
|
2544
|
-
"change",
|
|
2545
|
-
value2.map((item) => {
|
|
2546
|
-
if (item) return utils.datetimeFormatter(item, "");
|
|
2547
|
-
return void 0;
|
|
2548
|
-
})
|
|
2549
|
-
);
|
|
2566
|
+
emit("change", value2);
|
|
2550
2567
|
} else {
|
|
2551
2568
|
if (names?.length) {
|
|
2552
2569
|
setValue(value2);
|
|
2553
2570
|
}
|
|
2554
|
-
emit("change",
|
|
2571
|
+
emit("change", props.model);
|
|
2555
2572
|
}
|
|
2556
2573
|
};
|
|
2557
2574
|
return (_ctx, _cache) => {
|
|
@@ -2566,8 +2583,11 @@
|
|
|
2566
2583
|
"unlink-panels": true,
|
|
2567
2584
|
disabled: _ctx.disabled,
|
|
2568
2585
|
"default-time": _ctx.config.defaultTime,
|
|
2586
|
+
"value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
|
|
2587
|
+
"date-format": _ctx.config.dateFormat || "YYYY/MM/DD",
|
|
2588
|
+
"time-format": _ctx.config.timeFormat || "HH:mm:ss",
|
|
2569
2589
|
onChange: changeHandler
|
|
2570
|
-
}, null, 8, ["modelValue", "size", "disabled", "default-time"]);
|
|
2590
|
+
}, null, 8, ["modelValue", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
|
|
2571
2591
|
};
|
|
2572
2592
|
}
|
|
2573
2593
|
});
|
|
@@ -2598,7 +2618,11 @@
|
|
|
2598
2618
|
if (value === "Invalid Date") {
|
|
2599
2619
|
props.model[props.name] = "";
|
|
2600
2620
|
} else {
|
|
2601
|
-
props.model[props.name] =
|
|
2621
|
+
props.model[props.name] = datetimeFormatter(
|
|
2622
|
+
props.model[props.name],
|
|
2623
|
+
"",
|
|
2624
|
+
props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
|
|
2625
|
+
);
|
|
2602
2626
|
}
|
|
2603
2627
|
}
|
|
2604
2628
|
const changeHandler = (v) => {
|
|
@@ -3054,9 +3078,9 @@
|
|
|
3054
3078
|
onClick: cancel,
|
|
3055
3079
|
size: "small"
|
|
3056
3080
|
}, {
|
|
3057
|
-
default: vue.withCtx(() => [
|
|
3081
|
+
default: vue.withCtx(() => _cache[2] || (_cache[2] = [
|
|
3058
3082
|
vue.createTextVNode("取 消")
|
|
3059
|
-
]),
|
|
3083
|
+
])),
|
|
3060
3084
|
_: 1
|
|
3061
3085
|
}),
|
|
3062
3086
|
hasStep.value && stepActive.value > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
@@ -3065,9 +3089,9 @@
|
|
|
3065
3089
|
size: "small",
|
|
3066
3090
|
onClick: preStep
|
|
3067
3091
|
}, {
|
|
3068
|
-
default: vue.withCtx(() => [
|
|
3092
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
3069
3093
|
vue.createTextVNode("上一步")
|
|
3070
|
-
]),
|
|
3094
|
+
])),
|
|
3071
3095
|
_: 1
|
|
3072
3096
|
})) : vue.createCommentVNode("", true),
|
|
3073
3097
|
hasStep.value && stepCount.value > stepActive.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
@@ -3076,9 +3100,9 @@
|
|
|
3076
3100
|
size: "small",
|
|
3077
3101
|
onClick: nextStep
|
|
3078
3102
|
}, {
|
|
3079
|
-
default: vue.withCtx(() => [
|
|
3103
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
3080
3104
|
vue.createTextVNode("下一步")
|
|
3081
|
-
]),
|
|
3105
|
+
])),
|
|
3082
3106
|
_: 1
|
|
3083
3107
|
})) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
3084
3108
|
key: 2,
|
|
@@ -3132,7 +3156,7 @@
|
|
|
3132
3156
|
});
|
|
3133
3157
|
|
|
3134
3158
|
const _hoisted_1$4 = ["href"];
|
|
3135
|
-
const _hoisted_2$
|
|
3159
|
+
const _hoisted_2$1 = {
|
|
3136
3160
|
key: 2,
|
|
3137
3161
|
class: "m-fields-link"
|
|
3138
3162
|
};
|
|
@@ -3208,15 +3232,15 @@
|
|
|
3208
3232
|
}, vue.toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
3209
3233
|
key: 1,
|
|
3210
3234
|
style: vue.normalizeStyle(_ctx.config.disabledCss || {})
|
|
3211
|
-
}, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
3235
|
+
}, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
|
|
3212
3236
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3213
3237
|
link: "",
|
|
3214
3238
|
type: "primary",
|
|
3215
3239
|
onClick: editHandler
|
|
3216
3240
|
}, {
|
|
3217
|
-
default: vue.withCtx(() => [
|
|
3241
|
+
default: vue.withCtx(() => _cache[0] || (_cache[0] = [
|
|
3218
3242
|
vue.createTextVNode("点击编辑")
|
|
3219
|
-
]),
|
|
3243
|
+
])),
|
|
3220
3244
|
_: 1
|
|
3221
3245
|
}),
|
|
3222
3246
|
vue.createVNode(_sfc_main$c, {
|
|
@@ -3285,7 +3309,6 @@
|
|
|
3285
3309
|
});
|
|
3286
3310
|
|
|
3287
3311
|
const _hoisted_1$3 = { class: "m-fields-number-range" };
|
|
3288
|
-
const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
|
|
3289
3312
|
const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
3290
3313
|
...{
|
|
3291
3314
|
name: "MFormNumberRange"
|
|
@@ -3326,7 +3349,7 @@
|
|
|
3326
3349
|
disabled: _ctx.disabled,
|
|
3327
3350
|
onChange: minChangeHandler
|
|
3328
3351
|
}, null, 8, ["modelValue", "size", "disabled"]),
|
|
3329
|
-
|
|
3352
|
+
_cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "split-tag" }, "-", -1)),
|
|
3330
3353
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3331
3354
|
modelValue: _ctx.model[_ctx.name][1],
|
|
3332
3355
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
|
|
@@ -3413,8 +3436,8 @@
|
|
|
3413
3436
|
setup(__props, { emit: __emit }) {
|
|
3414
3437
|
const props = __props;
|
|
3415
3438
|
const emit = __emit;
|
|
3416
|
-
const optionComponent = design.
|
|
3417
|
-
const optionGroupComponent = design.
|
|
3439
|
+
const optionComponent = design.getDesignConfig("components")?.option;
|
|
3440
|
+
const optionGroupComponent = design.getDesignConfig("components")?.optionGroup;
|
|
3418
3441
|
if (!props.model) throw new Error("不能没有model");
|
|
3419
3442
|
useAddField(props.prop);
|
|
3420
3443
|
const tMagicSelect = vue.ref();
|
|
@@ -3849,8 +3872,7 @@
|
|
|
3849
3872
|
});
|
|
3850
3873
|
|
|
3851
3874
|
const _hoisted_1$1 = { class: "m-form-item__content" };
|
|
3852
|
-
const _hoisted_2 =
|
|
3853
|
-
const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
|
|
3875
|
+
const _hoisted_2 = { style: { "display": "flex", "justify-content": "flex-end" } };
|
|
3854
3876
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3855
3877
|
...{
|
|
3856
3878
|
name: "MFormText"
|
|
@@ -3967,8 +3989,9 @@
|
|
|
3967
3989
|
};
|
|
3968
3990
|
return (_ctx, _cache) => {
|
|
3969
3991
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
|
|
3992
|
+
width: "220px",
|
|
3970
3993
|
visible: popoverVisible.value,
|
|
3971
|
-
|
|
3994
|
+
"destroy-on-close": true
|
|
3972
3995
|
}, {
|
|
3973
3996
|
reference: vue.withCtx(() => [
|
|
3974
3997
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
@@ -4003,16 +4026,16 @@
|
|
|
4003
4026
|
]),
|
|
4004
4027
|
default: vue.withCtx(() => [
|
|
4005
4028
|
vue.createElementVNode("div", _hoisted_1$1, [
|
|
4006
|
-
|
|
4007
|
-
vue.createElementVNode("div",
|
|
4029
|
+
_cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1)),
|
|
4030
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
4008
4031
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4009
4032
|
link: "",
|
|
4010
4033
|
size: "small",
|
|
4011
4034
|
onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
|
|
4012
4035
|
}, {
|
|
4013
|
-
default: vue.withCtx(() => [
|
|
4036
|
+
default: vue.withCtx(() => _cache[3] || (_cache[3] = [
|
|
4014
4037
|
vue.createTextVNode("保持原样")
|
|
4015
|
-
]),
|
|
4038
|
+
])),
|
|
4016
4039
|
_: 1
|
|
4017
4040
|
}),
|
|
4018
4041
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -4020,9 +4043,9 @@
|
|
|
4020
4043
|
size: "small",
|
|
4021
4044
|
onClick: confirmTrimHandler
|
|
4022
4045
|
}, {
|
|
4023
|
-
default: vue.withCtx(() => [
|
|
4046
|
+
default: vue.withCtx(() => _cache[4] || (_cache[4] = [
|
|
4024
4047
|
vue.createTextVNode("移除空格")
|
|
4025
|
-
]),
|
|
4048
|
+
])),
|
|
4026
4049
|
_: 1
|
|
4027
4050
|
})
|
|
4028
4051
|
])
|
|
@@ -4163,7 +4186,7 @@
|
|
|
4163
4186
|
return;
|
|
4164
4187
|
}
|
|
4165
4188
|
if (Array.isArray(v)) {
|
|
4166
|
-
props.model[item] =
|
|
4189
|
+
props.model[item] = v[index];
|
|
4167
4190
|
} else {
|
|
4168
4191
|
props.model[item] = void 0;
|
|
4169
4192
|
}
|
|
@@ -4308,9 +4331,9 @@
|
|
|
4308
4331
|
default: vue.withCtx(() => [
|
|
4309
4332
|
vue.renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
4310
4333
|
vue.createVNode(vue.unref(design.TMagicButton), { onClick: handleClose }, {
|
|
4311
|
-
default: vue.withCtx(() => [
|
|
4334
|
+
default: vue.withCtx(() => _cache[1] || (_cache[1] = [
|
|
4312
4335
|
vue.createTextVNode("关闭")
|
|
4313
|
-
]),
|
|
4336
|
+
])),
|
|
4314
4337
|
_: 1
|
|
4315
4338
|
}),
|
|
4316
4339
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
@@ -4485,8 +4508,8 @@
|
|
|
4485
4508
|
const createForm = (config) => config;
|
|
4486
4509
|
const defaultInstallOpt = {};
|
|
4487
4510
|
const index = {
|
|
4488
|
-
install(app, opt
|
|
4489
|
-
const option = Object.assign(defaultInstallOpt, opt);
|
|
4511
|
+
install(app, opt) {
|
|
4512
|
+
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
4490
4513
|
app.config.globalProperties.$MAGIC_FORM = option;
|
|
4491
4514
|
setConfig(option);
|
|
4492
4515
|
app.component("m-form", _sfc_main$d);
|
|
@@ -4555,6 +4578,7 @@
|
|
|
4555
4578
|
exports.MTimerange = _sfc_main$2;
|
|
4556
4579
|
exports.createForm = createForm;
|
|
4557
4580
|
exports.createValues = createValues;
|
|
4581
|
+
exports.datetimeFormatter = datetimeFormatter;
|
|
4558
4582
|
exports.default = index;
|
|
4559
4583
|
exports.display = display;
|
|
4560
4584
|
exports.filterFunction = filterFunction;
|