@tmagic/form 1.2.0-beta.8 → 1.2.0
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 +1 -1
- package/dist/{tmagic-form.mjs → tmagic-form.js} +322 -126
- package/dist/tmagic-form.js.map +1 -0
- package/dist/{tmagic-form.umd.js → tmagic-form.umd.cjs} +321 -124
- package/dist/tmagic-form.umd.cjs.map +1 -0
- package/package.json +10 -8
- package/src/Form.vue +11 -3
- package/src/FormDialog.vue +3 -1
- package/src/containers/Col.vue +3 -1
- package/src/containers/Container.vue +12 -6
- package/src/containers/Fieldset.vue +4 -1
- package/src/containers/GroupList.vue +4 -2
- package/src/containers/GroupListItem.vue +8 -5
- package/src/containers/Panel.vue +4 -1
- package/src/containers/Row.vue +3 -1
- package/src/containers/Step.vue +3 -1
- package/src/containers/Table.vue +44 -18
- package/src/containers/Tabs.vue +9 -4
- package/src/fields/Cascader.vue +2 -2
- package/src/fields/Checkbox.vue +2 -2
- package/src/fields/CheckboxGroup.vue +8 -3
- package/src/fields/ColorPicker.vue +2 -2
- package/src/fields/Date.vue +3 -3
- package/src/fields/DateTime.vue +2 -2
- package/src/fields/Daterange.vue +2 -2
- package/src/fields/Display.vue +1 -1
- package/src/fields/DynamicField.vue +2 -2
- package/src/fields/Hidden.vue +1 -1
- package/src/fields/Link.vue +2 -2
- package/src/fields/Number.vue +2 -2
- package/src/fields/RadioGroup.vue +9 -5
- package/src/fields/Select.vue +63 -24
- package/src/fields/SelectOptionGroups.vue +1 -1
- package/src/fields/SelectOptions.vue +1 -1
- package/src/fields/Switch.vue +2 -2
- package/src/fields/Text.vue +2 -2
- package/src/fields/Textarea.vue +2 -2
- package/src/fields/Time.vue +4 -2
- package/src/schema.ts +18 -4
- package/src/theme/form.scss +1 -1
- package/src/utils/form.ts +9 -5
- package/types/Form.vue.d.ts +32 -170
- package/types/FormDialog.vue.d.ts +4 -0
- package/types/containers/Col.vue.d.ts +12 -74
- package/types/containers/Container.vue.d.ts +17 -95
- package/types/containers/Fieldset.vue.d.ts +15 -87
- package/types/containers/GroupList.vue.d.ts +11 -71
- package/types/containers/GroupListItem.vue.d.ts +12 -80
- package/types/containers/Panel.vue.d.ts +4 -0
- package/types/containers/Row.vue.d.ts +12 -74
- package/types/containers/Step.vue.d.ts +13 -79
- package/types/containers/Table.vue.d.ts +4 -0
- package/types/containers/Tabs.vue.d.ts +12 -74
- package/types/fields/Cascader.vue.d.ts +12 -78
- package/types/fields/Checkbox.vue.d.ts +12 -78
- package/types/fields/CheckboxGroup.vue.d.ts +12 -78
- package/types/fields/ColorPicker.vue.d.ts +12 -78
- package/types/fields/Date.vue.d.ts +12 -78
- package/types/fields/DateTime.vue.d.ts +12 -78
- package/types/fields/Daterange.vue.d.ts +12 -78
- package/types/fields/Display.vue.d.ts +9 -65
- package/types/fields/DynamicField.vue.d.ts +12 -78
- package/types/fields/Hidden.vue.d.ts +9 -65
- package/types/fields/Link.vue.d.ts +12 -78
- package/types/fields/Number.vue.d.ts +12 -81
- package/types/fields/RadioGroup.vue.d.ts +12 -78
- package/types/fields/Select.vue.d.ts +12 -79
- package/types/fields/SelectOptionGroups.vue.d.ts +4 -50
- package/types/fields/SelectOptions.vue.d.ts +5 -53
- package/types/fields/Switch.vue.d.ts +12 -78
- package/types/fields/Text.vue.d.ts +12 -81
- package/types/fields/Textarea.vue.d.ts +12 -81
- package/types/fields/Time.vue.d.ts +12 -78
- package/types/schema.d.ts +17 -4
- package/types/utils/form.d.ts +2 -1
- package/dist/tmagic-form.mjs.map +0 -1
- package/dist/tmagic-form.umd.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, unref, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, watch, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, nextTick, resolveDirective, createSlots, withModifiers } from 'vue';
|
|
2
2
|
import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
|
|
3
|
-
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage,
|
|
3
|
+
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';
|
|
4
4
|
import { cloneDeep } from 'lodash-es';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
6
6
|
import { asyncLoadJs, sleep, datetimeFormatter, isNumber } from '@tmagic/utils';
|
|
@@ -17,9 +17,9 @@ const asyncLoadConfig = (value, initValue2, { asyncLoad, name, type }) => {
|
|
|
17
17
|
const isMultipleValue = (type) => typeof type === "string" && ["checkbox-group", "checkboxGroup", "table", "cascader", "group-list", "groupList"].includes(type);
|
|
18
18
|
const initItemsValue = (mForm, value, initValue2, { items, name, extensible }) => {
|
|
19
19
|
if (Array.isArray(initValue2[name])) {
|
|
20
|
-
value[name] = initValue2[name].map((v, index) =>
|
|
20
|
+
value[name] = initValue2[name].map((v, index) => createValues(mForm, items, v, value[name]?.[index]));
|
|
21
21
|
} else {
|
|
22
|
-
value[name] =
|
|
22
|
+
value[name] = createValues(mForm, items, initValue2[name], value[name]);
|
|
23
23
|
if (extensible) {
|
|
24
24
|
value[name] = Object.assign({}, initValue2[name], value[name]);
|
|
25
25
|
}
|
|
@@ -64,12 +64,12 @@ const initValueItem = function(mForm, item, initValue2, value) {
|
|
|
64
64
|
return names.forEach((n) => value[n] = initValue2[n] || "");
|
|
65
65
|
}
|
|
66
66
|
if (!name) {
|
|
67
|
-
return
|
|
67
|
+
return createValues(mForm, items, initValue2, value);
|
|
68
68
|
}
|
|
69
69
|
setValue(mForm, value, initValue2, item);
|
|
70
70
|
return value;
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const createValues = function(mForm, config = [], initValue2 = {}, value = {}) {
|
|
73
73
|
if (Array.isArray(config)) {
|
|
74
74
|
config.forEach((item) => {
|
|
75
75
|
initValueItem(mForm, item, initValue2, value);
|
|
@@ -112,6 +112,9 @@ const filterFunction = (mForm, config, props) => {
|
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
114
|
const display = function(mForm, config, props) {
|
|
115
|
+
if (config === "expand") {
|
|
116
|
+
return config;
|
|
117
|
+
}
|
|
115
118
|
if (typeof config === "function") {
|
|
116
119
|
return filterFunction(mForm, config, props);
|
|
117
120
|
}
|
|
@@ -153,7 +156,7 @@ const getRules = function(mForm, rules = [], props) {
|
|
|
153
156
|
const initValue = async (mForm, { initValues, config }) => {
|
|
154
157
|
if (!Array.isArray(config))
|
|
155
158
|
throw new Error("config\u5E94\u8BE5\u4E3A\u6570\u7EC4");
|
|
156
|
-
let valuesTmp =
|
|
159
|
+
let valuesTmp = createValues(mForm, config, toRaw(initValues), {});
|
|
157
160
|
const [firstForm] = config;
|
|
158
161
|
if (firstForm && typeof firstForm.onInitValue === "function") {
|
|
159
162
|
valuesTmp = await firstForm.onInitValue(mForm, {
|
|
@@ -172,12 +175,16 @@ const _hoisted_5$4 = {
|
|
|
172
175
|
key: 4,
|
|
173
176
|
style: { "text-align": "center" }
|
|
174
177
|
};
|
|
178
|
+
const __default__$v = defineComponent({
|
|
179
|
+
name: "MFormContainer"
|
|
180
|
+
});
|
|
175
181
|
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
176
|
-
|
|
182
|
+
...__default__$v,
|
|
177
183
|
props: {
|
|
178
184
|
model: null,
|
|
179
185
|
config: null,
|
|
180
186
|
prop: { default: "" },
|
|
187
|
+
disabled: { type: Boolean },
|
|
181
188
|
labelWidth: null,
|
|
182
189
|
expandMore: { type: Boolean, default: false },
|
|
183
190
|
stepActive: null,
|
|
@@ -208,7 +215,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
208
215
|
return component;
|
|
209
216
|
return "m-fields-text";
|
|
210
217
|
});
|
|
211
|
-
const disabled = computed(() => filterFunction(mForm, props.config.disabled, props));
|
|
218
|
+
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
|
212
219
|
const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
|
|
213
220
|
const extra = computed(() => filterFunction(mForm, props.config.extra, props));
|
|
214
221
|
const rule = computed(() => getRules(mForm, props.config.rules, props));
|
|
@@ -224,10 +231,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
224
231
|
return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (items.value ? "" : "text");
|
|
225
232
|
});
|
|
226
233
|
const display$1 = computed(() => {
|
|
227
|
-
|
|
234
|
+
const value = display(mForm, props.config.display, props);
|
|
235
|
+
if (value === "expand") {
|
|
228
236
|
return expand.value;
|
|
229
237
|
}
|
|
230
|
-
return
|
|
238
|
+
return value;
|
|
231
239
|
});
|
|
232
240
|
const itemLabelWidth = computed(() => props.config.labelWidth || props.labelWidth);
|
|
233
241
|
watchEffect(() => {
|
|
@@ -304,13 +312,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
304
312
|
size: __props.size,
|
|
305
313
|
model: __props.model,
|
|
306
314
|
config: __props.config,
|
|
315
|
+
disabled: unref(disabled),
|
|
307
316
|
name: unref(name),
|
|
308
317
|
prop: unref(itemProp),
|
|
309
318
|
"step-active": __props.stepActive,
|
|
310
319
|
"expand-more": expand.value,
|
|
311
320
|
"label-width": unref(itemLabelWidth),
|
|
312
321
|
onChange: onChangeHandler
|
|
313
|
-
}, null, 40, ["size", "model", "config", "name", "prop", "step-active", "expand-more", "label-width"])) : unref(type) && unref(display$1) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
322
|
+
}, null, 40, ["size", "model", "config", "disabled", "name", "prop", "step-active", "expand-more", "label-width"])) : unref(type) && unref(display$1) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
314
323
|
createVNode(unref(TMagicFormItem), {
|
|
315
324
|
style: normalizeStyle(__props.config.tip ? "flex: 1" : ""),
|
|
316
325
|
class: normalizeClass({ hidden: `${unref(itemLabelWidth)}` === "0" || !__props.config.text }),
|
|
@@ -385,16 +394,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
385
394
|
model: unref(name) || unref(name) === 0 ? __props.model[unref(name)] : __props.model,
|
|
386
395
|
config: item,
|
|
387
396
|
size: __props.size,
|
|
397
|
+
disabled: unref(disabled),
|
|
388
398
|
"step-active": __props.stepActive,
|
|
389
399
|
"expand-more": expand.value,
|
|
390
400
|
"label-width": unref(itemLabelWidth),
|
|
391
401
|
prop: unref(itemProp),
|
|
392
402
|
onChange: onChangeHandler
|
|
393
|
-
}, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop"]);
|
|
403
|
+
}, null, 8, ["model", "config", "size", "disabled", "step-active", "expand-more", "label-width", "prop"]);
|
|
394
404
|
}), 128)) : createCommentVNode("", true)
|
|
395
405
|
], 64)) : createCommentVNode("", true),
|
|
396
406
|
__props.config.expand && unref(type) !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
|
|
397
407
|
createVNode(unref(TMagicButton), {
|
|
408
|
+
type: "primary",
|
|
409
|
+
size: "small",
|
|
410
|
+
disabled: false,
|
|
398
411
|
text: "",
|
|
399
412
|
onClick: expandHandler
|
|
400
413
|
}, {
|
|
@@ -420,15 +433,19 @@ const _hoisted_6$2 = {
|
|
|
420
433
|
};
|
|
421
434
|
const _hoisted_7$2 = { style: { "flex": "1" } };
|
|
422
435
|
const _hoisted_8$1 = ["src"];
|
|
436
|
+
const __default__$u = defineComponent({
|
|
437
|
+
name: "MFormFieldset"
|
|
438
|
+
});
|
|
423
439
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
424
|
-
|
|
440
|
+
...__default__$u,
|
|
425
441
|
props: {
|
|
426
442
|
labelWidth: null,
|
|
427
443
|
prop: { default: "" },
|
|
428
444
|
size: null,
|
|
429
445
|
model: null,
|
|
430
446
|
config: null,
|
|
431
|
-
rules: { default: {} }
|
|
447
|
+
rules: { default: {} },
|
|
448
|
+
disabled: { type: Boolean }
|
|
432
449
|
},
|
|
433
450
|
emits: ["change"],
|
|
434
451
|
setup(__props, { emit }) {
|
|
@@ -507,10 +524,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
507
524
|
rules: unref(name) ? __props.rules[unref(name)] : [],
|
|
508
525
|
config: item,
|
|
509
526
|
prop: __props.prop,
|
|
527
|
+
disabled: __props.disabled,
|
|
510
528
|
labelWidth: unref(lWidth),
|
|
511
529
|
size: __props.size,
|
|
512
530
|
onChange: change
|
|
513
|
-
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size"]);
|
|
531
|
+
}, null, 8, ["model", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
|
|
514
532
|
}), 128))
|
|
515
533
|
]),
|
|
516
534
|
createElementVNode("img", {
|
|
@@ -526,8 +544,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
526
544
|
prop: __props.prop,
|
|
527
545
|
labelWidth: unref(lWidth),
|
|
528
546
|
size: __props.size,
|
|
547
|
+
disabled: __props.disabled,
|
|
529
548
|
onChange: change
|
|
530
|
-
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size"]);
|
|
549
|
+
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
|
|
531
550
|
}), 128)) : createCommentVNode("", true)
|
|
532
551
|
], 4)) : createCommentVNode("", true);
|
|
533
552
|
};
|
|
@@ -538,8 +557,11 @@ const _hoisted_1$9 = { class: "m-fields-group-list-item" };
|
|
|
538
557
|
const _hoisted_2$5 = /* @__PURE__ */ createTextVNode("\u4E0A\u79FB");
|
|
539
558
|
const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("\u4E0B\u79FB");
|
|
540
559
|
const _hoisted_4$4 = ["innerHTML"];
|
|
560
|
+
const __default__$t = defineComponent({
|
|
561
|
+
name: "MFormGroupListItem"
|
|
562
|
+
});
|
|
541
563
|
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
542
|
-
|
|
564
|
+
...__default__$t,
|
|
543
565
|
props: {
|
|
544
566
|
model: null,
|
|
545
567
|
groupModel: null,
|
|
@@ -547,7 +569,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
547
569
|
labelWidth: null,
|
|
548
570
|
prop: null,
|
|
549
571
|
size: null,
|
|
550
|
-
index: null
|
|
572
|
+
index: null,
|
|
573
|
+
disabled: { type: Boolean }
|
|
551
574
|
},
|
|
552
575
|
emits: ["swap-item", "remove-item", "change"],
|
|
553
576
|
setup(__props, { emit }) {
|
|
@@ -608,24 +631,27 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
608
631
|
}),
|
|
609
632
|
createVNode(unref(TMagicButton), {
|
|
610
633
|
text: "",
|
|
634
|
+
disabled: __props.disabled,
|
|
611
635
|
onClick: expandHandler
|
|
612
636
|
}, {
|
|
613
637
|
default: withCtx(() => [
|
|
614
638
|
createTextVNode(toDisplayString(unref(title)), 1)
|
|
615
639
|
]),
|
|
616
640
|
_: 1
|
|
617
|
-
}),
|
|
641
|
+
}, 8, ["disabled"]),
|
|
618
642
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
643
|
+
style: { "color": "#f56c6c" },
|
|
619
644
|
text: "",
|
|
620
645
|
icon: unref(Delete),
|
|
621
|
-
|
|
646
|
+
disabled: __props.disabled,
|
|
622
647
|
onClick: removeHandler
|
|
623
|
-
}, null, 8, ["icon"]), [
|
|
648
|
+
}, null, 8, ["icon", "disabled"]), [
|
|
624
649
|
[vShow, showDelete(parseInt(String(__props.index)))]
|
|
625
650
|
]),
|
|
626
651
|
movable() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
627
652
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
628
653
|
text: "",
|
|
654
|
+
disabled: __props.disabled,
|
|
629
655
|
size: "small",
|
|
630
656
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
631
657
|
}, {
|
|
@@ -639,10 +665,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
639
665
|
})
|
|
640
666
|
]),
|
|
641
667
|
_: 1
|
|
642
|
-
},
|
|
668
|
+
}, 8, ["disabled"]), [
|
|
643
669
|
[vShow, __props.index !== 0]
|
|
644
670
|
]),
|
|
645
671
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
672
|
+
disabled: __props.disabled,
|
|
646
673
|
text: "",
|
|
647
674
|
size: "small",
|
|
648
675
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
@@ -657,7 +684,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
657
684
|
})
|
|
658
685
|
]),
|
|
659
686
|
_: 1
|
|
660
|
-
},
|
|
687
|
+
}, 8, ["disabled"]), [
|
|
661
688
|
[vShow, __props.index !== unref(length) - 1]
|
|
662
689
|
])
|
|
663
690
|
], 64)) : createCommentVNode("", true),
|
|
@@ -674,8 +701,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
674
701
|
labelWidth: __props.labelWidth,
|
|
675
702
|
prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
|
|
676
703
|
size: __props.size,
|
|
704
|
+
disabled: __props.disabled,
|
|
677
705
|
onChange: changeHandler
|
|
678
|
-
}, null, 8, ["config", "model", "labelWidth", "prop", "size"])) : createCommentVNode("", true)
|
|
706
|
+
}, null, 8, ["config", "model", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("", true)
|
|
679
707
|
]);
|
|
680
708
|
};
|
|
681
709
|
}
|
|
@@ -693,15 +721,19 @@ const _hoisted_5$2 = [
|
|
|
693
721
|
];
|
|
694
722
|
const _hoisted_6$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u7EC4");
|
|
695
723
|
const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u5207\u6362\u4E3A\u8868\u683C");
|
|
724
|
+
const __default__$s = defineComponent({
|
|
725
|
+
name: "MFormGroupList"
|
|
726
|
+
});
|
|
696
727
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
697
|
-
|
|
728
|
+
...__default__$s,
|
|
698
729
|
props: {
|
|
699
730
|
model: null,
|
|
700
731
|
config: null,
|
|
701
732
|
name: null,
|
|
702
733
|
labelWidth: null,
|
|
703
734
|
prop: null,
|
|
704
|
-
size: null
|
|
735
|
+
size: null,
|
|
736
|
+
disabled: { type: Boolean }
|
|
705
737
|
},
|
|
706
738
|
emits: ["change"],
|
|
707
739
|
setup(__props, { emit }) {
|
|
@@ -783,22 +815,24 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
783
815
|
index,
|
|
784
816
|
"label-width": __props.labelWidth,
|
|
785
817
|
size: __props.size,
|
|
818
|
+
disabled: __props.disabled,
|
|
786
819
|
"group-model": __props.model[__props.name],
|
|
787
820
|
onRemoveItem: removeHandler,
|
|
788
821
|
onSwapItem: swapHandler,
|
|
789
822
|
onChange: changeHandler
|
|
790
|
-
}, null, 8, ["model", "config", "prop", "index", "label-width", "size", "group-model"]);
|
|
823
|
+
}, null, 8, ["model", "config", "prop", "index", "label-width", "size", "disabled", "group-model"]);
|
|
791
824
|
}), 128)),
|
|
792
825
|
unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
793
826
|
key: 3,
|
|
794
827
|
onClick: addHandler,
|
|
795
|
-
size: "small"
|
|
828
|
+
size: "small",
|
|
829
|
+
disabled: __props.disabled
|
|
796
830
|
}, {
|
|
797
831
|
default: withCtx(() => [
|
|
798
832
|
_hoisted_6$1
|
|
799
833
|
]),
|
|
800
834
|
_: 1
|
|
801
|
-
})) : createCommentVNode("", true),
|
|
835
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
802
836
|
__props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
803
837
|
key: 4,
|
|
804
838
|
icon: unref(Grid),
|
|
@@ -823,15 +857,19 @@ const _hoisted_3$3 = {
|
|
|
823
857
|
};
|
|
824
858
|
const _hoisted_4$2 = { style: { "flex": "1" } };
|
|
825
859
|
const _hoisted_5$1 = ["src"];
|
|
860
|
+
const __default__$r = defineComponent({
|
|
861
|
+
name: "MFormPanel"
|
|
862
|
+
});
|
|
826
863
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
827
|
-
|
|
864
|
+
...__default__$r,
|
|
828
865
|
props: {
|
|
829
866
|
model: null,
|
|
830
867
|
config: null,
|
|
831
868
|
name: null,
|
|
832
869
|
labelWidth: null,
|
|
833
870
|
prop: null,
|
|
834
|
-
size: null
|
|
871
|
+
size: null,
|
|
872
|
+
disabled: { type: Boolean }
|
|
835
873
|
},
|
|
836
874
|
emits: ["change"],
|
|
837
875
|
setup(__props, { emit }) {
|
|
@@ -881,9 +919,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
881
919
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
882
920
|
prop: __props.prop,
|
|
883
921
|
size: __props.size,
|
|
922
|
+
disabled: __props.disabled,
|
|
884
923
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
885
924
|
onChange: changeHandler
|
|
886
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"]);
|
|
925
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"]);
|
|
887
926
|
}), 128))
|
|
888
927
|
]),
|
|
889
928
|
createElementVNode("img", {
|
|
@@ -897,9 +936,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
897
936
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
898
937
|
prop: __props.prop,
|
|
899
938
|
size: __props.size,
|
|
939
|
+
disabled: __props.disabled,
|
|
900
940
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
901
941
|
onChange: changeHandler
|
|
902
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"]);
|
|
942
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"]);
|
|
903
943
|
}), 128))
|
|
904
944
|
])
|
|
905
945
|
]),
|
|
@@ -909,8 +949,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
909
949
|
}
|
|
910
950
|
});
|
|
911
951
|
|
|
952
|
+
const __default__$q = defineComponent({
|
|
953
|
+
name: "MFormCol"
|
|
954
|
+
});
|
|
912
955
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
913
|
-
|
|
956
|
+
...__default__$q,
|
|
914
957
|
props: {
|
|
915
958
|
model: null,
|
|
916
959
|
config: null,
|
|
@@ -918,7 +961,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
918
961
|
expandMore: { type: Boolean },
|
|
919
962
|
span: null,
|
|
920
963
|
size: null,
|
|
921
|
-
prop: null
|
|
964
|
+
prop: null,
|
|
965
|
+
disabled: { type: Boolean }
|
|
922
966
|
},
|
|
923
967
|
emits: ["change"],
|
|
924
968
|
setup(__props, { emit }) {
|
|
@@ -936,8 +980,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
936
980
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
937
981
|
"expand-more": __props.expandMore,
|
|
938
982
|
size: __props.size,
|
|
983
|
+
disabled: __props.disabled,
|
|
939
984
|
onChange: changeHandler
|
|
940
|
-
}, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size"])
|
|
985
|
+
}, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size", "disabled"])
|
|
941
986
|
]),
|
|
942
987
|
_: 1
|
|
943
988
|
}, 8, ["span"])), [
|
|
@@ -947,8 +992,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
947
992
|
}
|
|
948
993
|
});
|
|
949
994
|
|
|
995
|
+
const __default__$p = defineComponent({
|
|
996
|
+
name: "MFormRow"
|
|
997
|
+
});
|
|
950
998
|
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
951
|
-
|
|
999
|
+
...__default__$p,
|
|
952
1000
|
props: {
|
|
953
1001
|
model: null,
|
|
954
1002
|
config: null,
|
|
@@ -956,7 +1004,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
956
1004
|
labelWidth: null,
|
|
957
1005
|
prop: null,
|
|
958
1006
|
size: null,
|
|
959
|
-
expandMore: { type: Boolean }
|
|
1007
|
+
expandMore: { type: Boolean },
|
|
1008
|
+
disabled: { type: Boolean }
|
|
960
1009
|
},
|
|
961
1010
|
emits: ["change"],
|
|
962
1011
|
setup(__props, { emit }) {
|
|
@@ -976,8 +1025,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
976
1025
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
977
1026
|
prop: __props.prop,
|
|
978
1027
|
size: __props.size,
|
|
1028
|
+
disabled: __props.disabled,
|
|
979
1029
|
onChange: changeHandler
|
|
980
|
-
}, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "prop", "size"]);
|
|
1030
|
+
}, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "prop", "size", "disabled"]);
|
|
981
1031
|
}), 128))
|
|
982
1032
|
]),
|
|
983
1033
|
_: 1
|
|
@@ -986,14 +1036,18 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
986
1036
|
}
|
|
987
1037
|
});
|
|
988
1038
|
|
|
1039
|
+
const __default__$o = defineComponent({
|
|
1040
|
+
name: "MFormStep"
|
|
1041
|
+
});
|
|
989
1042
|
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
990
|
-
|
|
1043
|
+
...__default__$o,
|
|
991
1044
|
props: {
|
|
992
1045
|
model: null,
|
|
993
1046
|
config: null,
|
|
994
1047
|
stepActive: { default: 1 },
|
|
995
1048
|
labelWidth: null,
|
|
996
|
-
size: null
|
|
1049
|
+
size: null,
|
|
1050
|
+
disabled: { type: Boolean }
|
|
997
1051
|
},
|
|
998
1052
|
emits: ["change"],
|
|
999
1053
|
setup(__props, { emit }) {
|
|
@@ -1039,9 +1093,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
1039
1093
|
model: step.name ? __props.model[step.name] : __props.model,
|
|
1040
1094
|
prop: `${step.name}`,
|
|
1041
1095
|
size: __props.size,
|
|
1096
|
+
disabled: __props.disabled,
|
|
1042
1097
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1043
1098
|
onChange: changeHandler
|
|
1044
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"])), [
|
|
1099
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"])), [
|
|
1045
1100
|
[vShow, active.value - 1 === index]
|
|
1046
1101
|
]) : createCommentVNode("", true)
|
|
1047
1102
|
], 64);
|
|
@@ -1063,11 +1118,15 @@ const _hoisted_7 = /* @__PURE__ */ createTextVNode("\u5BFC\u5165EXCEL");
|
|
|
1063
1118
|
const _hoisted_8 = /* @__PURE__ */ createTextVNode("\xA0 ");
|
|
1064
1119
|
const _hoisted_9 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A");
|
|
1065
1120
|
const _hoisted_10 = {
|
|
1121
|
+
key: 1,
|
|
1066
1122
|
class: "bottom",
|
|
1067
1123
|
style: { "text-align": "right" }
|
|
1068
1124
|
};
|
|
1125
|
+
const __default__$n = defineComponent({
|
|
1126
|
+
name: "MFormTable"
|
|
1127
|
+
});
|
|
1069
1128
|
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
1070
|
-
|
|
1129
|
+
...__default__$n,
|
|
1071
1130
|
props: {
|
|
1072
1131
|
model: null,
|
|
1073
1132
|
config: null,
|
|
@@ -1075,6 +1134,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1075
1134
|
prop: { default: "" },
|
|
1076
1135
|
labelWidth: null,
|
|
1077
1136
|
sort: { type: Boolean },
|
|
1137
|
+
disabled: { type: Boolean },
|
|
1078
1138
|
sortKey: { default: "" },
|
|
1079
1139
|
text: null,
|
|
1080
1140
|
size: null,
|
|
@@ -1094,6 +1154,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1094
1154
|
const updateKey = ref(1);
|
|
1095
1155
|
const isFullscreen = ref(false);
|
|
1096
1156
|
const modelName = computed(() => props.name || props.config.name || "");
|
|
1157
|
+
const data = computed(
|
|
1158
|
+
() => props.config.pagination ? props.model[modelName.value].filter(
|
|
1159
|
+
(item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value
|
|
1160
|
+
) : props.model[modelName.value]
|
|
1161
|
+
);
|
|
1097
1162
|
const sortChange = ({ prop, order }) => {
|
|
1098
1163
|
if (order === "ascending") {
|
|
1099
1164
|
props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
|
|
@@ -1119,10 +1184,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1119
1184
|
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1120
1185
|
};
|
|
1121
1186
|
const rowDrop = () => {
|
|
1122
|
-
const tableEl = tMagicTable.value
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
const sortable = Sortable.create(
|
|
1187
|
+
const tableEl = tMagicTable.value?.instance.$el;
|
|
1188
|
+
const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
|
|
1189
|
+
if (tBodyEl) {
|
|
1190
|
+
const sortable = Sortable.create(tBodyEl, {
|
|
1126
1191
|
onEnd: ({ newIndex, oldIndex }) => {
|
|
1127
1192
|
if (typeof newIndex === "undefined")
|
|
1128
1193
|
return;
|
|
@@ -1134,11 +1199,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1134
1199
|
sortable.destroy();
|
|
1135
1200
|
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1136
1201
|
sleep(1e3).then(() => {
|
|
1137
|
-
const
|
|
1138
|
-
if (
|
|
1139
|
-
|
|
1202
|
+
const elTrs = tableEl.querySelectorAll(".el-table__body > tbody > tr");
|
|
1203
|
+
if (elTrs?.[newIndex]) {
|
|
1204
|
+
elTrs[newIndex].style.backgroundColor = "rgba(243, 89, 59, 0.2)";
|
|
1140
1205
|
sleep(1e3).then(() => {
|
|
1141
|
-
|
|
1206
|
+
elTrs[newIndex].style.backgroundColor = "";
|
|
1142
1207
|
});
|
|
1143
1208
|
}
|
|
1144
1209
|
});
|
|
@@ -1209,6 +1274,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1209
1274
|
if (props.sort && props.sortKey) {
|
|
1210
1275
|
props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
|
|
1211
1276
|
}
|
|
1277
|
+
});
|
|
1278
|
+
watchEffect(() => {
|
|
1212
1279
|
if (props.config.dropSort) {
|
|
1213
1280
|
rowDrop();
|
|
1214
1281
|
}
|
|
@@ -1255,6 +1322,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1255
1322
|
return fuc;
|
|
1256
1323
|
};
|
|
1257
1324
|
const removeHandler = (index) => {
|
|
1325
|
+
if (props.disabled)
|
|
1326
|
+
return;
|
|
1258
1327
|
props.model[modelName.value].splice(index, 1);
|
|
1259
1328
|
emit("change", props.model[modelName.value]);
|
|
1260
1329
|
};
|
|
@@ -1271,8 +1340,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1271
1340
|
const toggleRowSelection = (row, selected) => {
|
|
1272
1341
|
tMagicTable.value?.toggleRowSelection.call(tMagicTable.value, row, selected);
|
|
1273
1342
|
};
|
|
1274
|
-
const makeConfig = (config) => {
|
|
1343
|
+
const makeConfig = (config, row) => {
|
|
1275
1344
|
const newConfig = cloneDeep(config);
|
|
1345
|
+
if (typeof config.itemsFunction === "function") {
|
|
1346
|
+
newConfig.items = config.itemsFunction(row);
|
|
1347
|
+
}
|
|
1276
1348
|
delete newConfig.display;
|
|
1277
1349
|
return newConfig;
|
|
1278
1350
|
};
|
|
@@ -1330,8 +1402,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1330
1402
|
}
|
|
1331
1403
|
const reader = new FileReader();
|
|
1332
1404
|
reader.onload = () => {
|
|
1333
|
-
const
|
|
1334
|
-
const pdata = globalThis.XLSX.read(
|
|
1405
|
+
const data2 = reader.result;
|
|
1406
|
+
const pdata = globalThis.XLSX.read(data2, { type: "array" });
|
|
1335
1407
|
pdata.SheetNames.forEach((sheetName) => {
|
|
1336
1408
|
const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
|
|
1337
1409
|
if (arr?.[0]) {
|
|
@@ -1413,7 +1485,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1413
1485
|
ref_key: "tMagicTable",
|
|
1414
1486
|
ref: tMagicTable,
|
|
1415
1487
|
style: { "width": "100%" },
|
|
1416
|
-
|
|
1488
|
+
"row-key": __props.config.rowKey || "id",
|
|
1489
|
+
data: unref(data),
|
|
1417
1490
|
border: __props.config.border,
|
|
1418
1491
|
"max-height": __props.config.maxHeight,
|
|
1419
1492
|
"default-expand-all": true,
|
|
@@ -1474,10 +1547,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1474
1547
|
size: "small",
|
|
1475
1548
|
type: "primary",
|
|
1476
1549
|
icon: unref(ArrowUp),
|
|
1550
|
+
disabled: __props.disabled,
|
|
1477
1551
|
text: "",
|
|
1478
1552
|
onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
1479
1553
|
onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1480
|
-
}, null, 8, ["icon", "onClick", "onDblclick"])
|
|
1554
|
+
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
1481
1555
|
]),
|
|
1482
1556
|
_: 2
|
|
1483
1557
|
}, 1024)) : createCommentVNode("", true),
|
|
@@ -1492,10 +1566,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1492
1566
|
size: "small",
|
|
1493
1567
|
type: "primary",
|
|
1494
1568
|
icon: unref(ArrowDown),
|
|
1569
|
+
disabled: __props.disabled,
|
|
1495
1570
|
text: "",
|
|
1496
1571
|
onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
1497
1572
|
onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1498
|
-
}, null, 8, ["icon", "onClick", "onDblclick"])
|
|
1573
|
+
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
1499
1574
|
]),
|
|
1500
1575
|
_: 2
|
|
1501
1576
|
}, 1024)) : createCommentVNode("", true)
|
|
@@ -1534,13 +1609,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1534
1609
|
scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$v, {
|
|
1535
1610
|
key: 0,
|
|
1536
1611
|
labelWidth: "0",
|
|
1612
|
+
disabled: __props.disabled,
|
|
1537
1613
|
prop: getProp(scope.$index),
|
|
1538
1614
|
rules: column.rules,
|
|
1539
|
-
config: makeConfig(column),
|
|
1615
|
+
config: makeConfig(column, scope.row),
|
|
1540
1616
|
model: scope.row,
|
|
1541
1617
|
size: __props.size,
|
|
1542
1618
|
onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", __props.model[unref(modelName)]))
|
|
1543
|
-
}, null, 8, ["prop", "rules", "config", "model", "size"])) : createCommentVNode("", true)
|
|
1619
|
+
}, null, 8, ["disabled", "prop", "rules", "config", "model", "size"])) : createCommentVNode("", true)
|
|
1544
1620
|
]),
|
|
1545
1621
|
_: 2
|
|
1546
1622
|
}, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
|
|
@@ -1548,7 +1624,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1548
1624
|
}), 256))
|
|
1549
1625
|
]),
|
|
1550
1626
|
_: 1
|
|
1551
|
-
}, 8, ["data", "border", "max-height"])) : createCommentVNode("", true)
|
|
1627
|
+
}, 8, ["row-key", "data", "border", "max-height"])) : createCommentVNode("", true)
|
|
1552
1628
|
]),
|
|
1553
1629
|
_: 1
|
|
1554
1630
|
}, 8, ["disabled"]),
|
|
@@ -1557,6 +1633,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1557
1633
|
key: 0,
|
|
1558
1634
|
size: "small",
|
|
1559
1635
|
type: "primary",
|
|
1636
|
+
disabled: __props.disabled,
|
|
1560
1637
|
plain: "",
|
|
1561
1638
|
onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
|
|
1562
1639
|
}, {
|
|
@@ -1564,7 +1641,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1564
1641
|
_hoisted_4$1
|
|
1565
1642
|
]),
|
|
1566
1643
|
_: 1
|
|
1567
|
-
})) : createCommentVNode("", true),
|
|
1644
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
1568
1645
|
_hoisted_5,
|
|
1569
1646
|
__props.enableToggleMode && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1570
1647
|
key: 1,
|
|
@@ -1592,32 +1669,35 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1592
1669
|
}, 8, ["icon"])) : createCommentVNode("", true),
|
|
1593
1670
|
unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
|
|
1594
1671
|
key: 3,
|
|
1672
|
+
style: { "display": "inline-block" },
|
|
1595
1673
|
ref_key: "excelBtn",
|
|
1596
1674
|
ref: excelBtn,
|
|
1597
1675
|
action: "/noop",
|
|
1676
|
+
disabled: __props.disabled,
|
|
1598
1677
|
"on-change": excelHandler,
|
|
1599
|
-
"auto-upload": false
|
|
1600
|
-
style: { "display": "inline-block" }
|
|
1678
|
+
"auto-upload": false
|
|
1601
1679
|
}, {
|
|
1602
1680
|
default: withCtx(() => [
|
|
1603
1681
|
createVNode(unref(TMagicButton), {
|
|
1604
1682
|
size: "small",
|
|
1605
1683
|
type: "success",
|
|
1684
|
+
disabled: __props.disabled,
|
|
1606
1685
|
plain: ""
|
|
1607
1686
|
}, {
|
|
1608
1687
|
default: withCtx(() => [
|
|
1609
1688
|
_hoisted_7
|
|
1610
1689
|
]),
|
|
1611
1690
|
_: 1
|
|
1612
|
-
})
|
|
1691
|
+
}, 8, ["disabled"])
|
|
1613
1692
|
]),
|
|
1614
1693
|
_: 1
|
|
1615
|
-
},
|
|
1694
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
1616
1695
|
_hoisted_8,
|
|
1617
1696
|
unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1618
1697
|
key: 4,
|
|
1619
1698
|
size: "small",
|
|
1620
1699
|
type: "warning",
|
|
1700
|
+
disabled: __props.disabled,
|
|
1621
1701
|
plain: "",
|
|
1622
1702
|
onClick: _cache[2] || (_cache[2] = ($event) => clearHandler())
|
|
1623
1703
|
}, {
|
|
@@ -1625,9 +1705,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1625
1705
|
_hoisted_9
|
|
1626
1706
|
]),
|
|
1627
1707
|
_: 1
|
|
1628
|
-
})) : createCommentVNode("", true)
|
|
1708
|
+
}, 8, ["disabled"])) : createCommentVNode("", true)
|
|
1629
1709
|
]),
|
|
1630
|
-
|
|
1710
|
+
__props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
1631
1711
|
createVNode(unref(TMagicPagination), {
|
|
1632
1712
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
1633
1713
|
"hide-on-single-page": __props.model[unref(modelName)].length < pagesize.value,
|
|
@@ -1638,14 +1718,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1638
1718
|
onSizeChange: handleSizeChange,
|
|
1639
1719
|
onCurrentChange: handleCurrentChange
|
|
1640
1720
|
}, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
|
|
1641
|
-
])
|
|
1721
|
+
])) : createCommentVNode("", true)
|
|
1642
1722
|
], 2);
|
|
1643
1723
|
};
|
|
1644
1724
|
}
|
|
1645
1725
|
});
|
|
1646
1726
|
|
|
1727
|
+
const __default__$m = defineComponent({
|
|
1728
|
+
name: "MFormTabs"
|
|
1729
|
+
});
|
|
1647
1730
|
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
1648
|
-
|
|
1731
|
+
...__default__$m,
|
|
1649
1732
|
props: {
|
|
1650
1733
|
model: null,
|
|
1651
1734
|
config: null,
|
|
@@ -1653,11 +1736,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1653
1736
|
size: null,
|
|
1654
1737
|
labelWidth: null,
|
|
1655
1738
|
prop: null,
|
|
1656
|
-
expandMore: { type: Boolean }
|
|
1739
|
+
expandMore: { type: Boolean },
|
|
1740
|
+
disabled: { type: Boolean }
|
|
1657
1741
|
},
|
|
1658
1742
|
emits: ["change"],
|
|
1659
1743
|
setup(__props, { emit }) {
|
|
1660
1744
|
const props = __props;
|
|
1745
|
+
const uiComponent = getConfig$1("components").tabPane;
|
|
1661
1746
|
const getActive = (mForm2, props2, activeTabName2) => {
|
|
1662
1747
|
const { config, model, prop } = props2;
|
|
1663
1748
|
const { active } = config;
|
|
@@ -1759,7 +1844,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1759
1844
|
default: withCtx(() => [
|
|
1760
1845
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab, tabIndex) => {
|
|
1761
1846
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1762
|
-
display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(unref(
|
|
1847
|
+
display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
|
|
1763
1848
|
key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex,
|
|
1764
1849
|
name: filter(tab.status) || tabIndex.toString(),
|
|
1765
1850
|
label: filter(tab.title),
|
|
@@ -1770,13 +1855,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1770
1855
|
return openBlock(), createBlock(_sfc_main$v, {
|
|
1771
1856
|
key: item[unref(mForm)?.keyProp || "__key"],
|
|
1772
1857
|
config: item,
|
|
1858
|
+
disabled: __props.disabled,
|
|
1773
1859
|
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,
|
|
1774
1860
|
prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
|
|
1775
1861
|
size: __props.size,
|
|
1776
1862
|
"label-width": tab.labelWidth || __props.labelWidth,
|
|
1777
1863
|
"expand-more": __props.expandMore,
|
|
1778
1864
|
onChange: changeHandler
|
|
1779
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width", "expand-more"]);
|
|
1865
|
+
}, null, 8, ["config", "disabled", "model", "prop", "size", "label-width", "expand-more"]);
|
|
1780
1866
|
}), 128))
|
|
1781
1867
|
]),
|
|
1782
1868
|
_: 2
|
|
@@ -1816,8 +1902,11 @@ const useAddField = (prop) => {
|
|
|
1816
1902
|
);
|
|
1817
1903
|
};
|
|
1818
1904
|
|
|
1905
|
+
const __default__$l = defineComponent({
|
|
1906
|
+
name: "MFormCascader"
|
|
1907
|
+
});
|
|
1819
1908
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
1820
|
-
|
|
1909
|
+
...__default__$l,
|
|
1821
1910
|
props: {
|
|
1822
1911
|
config: null,
|
|
1823
1912
|
model: null,
|
|
@@ -1900,8 +1989,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
1900
1989
|
}
|
|
1901
1990
|
});
|
|
1902
1991
|
|
|
1992
|
+
const __default__$k = defineComponent({
|
|
1993
|
+
name: "MFormCheckbox"
|
|
1994
|
+
});
|
|
1903
1995
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
1904
|
-
|
|
1996
|
+
...__default__$k,
|
|
1905
1997
|
props: {
|
|
1906
1998
|
config: null,
|
|
1907
1999
|
model: null,
|
|
@@ -1958,8 +2050,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1958
2050
|
}
|
|
1959
2051
|
});
|
|
1960
2052
|
|
|
2053
|
+
const __default__$j = defineComponent({
|
|
2054
|
+
name: "MFormCheckGroup"
|
|
2055
|
+
});
|
|
1961
2056
|
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
1962
|
-
|
|
2057
|
+
...__default__$j,
|
|
1963
2058
|
props: {
|
|
1964
2059
|
config: null,
|
|
1965
2060
|
model: null,
|
|
@@ -2000,6 +2095,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2000
2095
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(options), (option) => {
|
|
2001
2096
|
return openBlock(), createBlock(unref(TMagicCheckbox), {
|
|
2002
2097
|
label: option.value,
|
|
2098
|
+
value: option.value,
|
|
2003
2099
|
key: option.value,
|
|
2004
2100
|
disabled: option.disabled
|
|
2005
2101
|
}, {
|
|
@@ -2007,7 +2103,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2007
2103
|
createTextVNode(toDisplayString(option.text), 1)
|
|
2008
2104
|
]),
|
|
2009
2105
|
_: 2
|
|
2010
|
-
}, 1032, ["label", "disabled"]);
|
|
2106
|
+
}, 1032, ["label", "value", "disabled"]);
|
|
2011
2107
|
}), 128))
|
|
2012
2108
|
]),
|
|
2013
2109
|
_: 1
|
|
@@ -2016,8 +2112,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2016
2112
|
}
|
|
2017
2113
|
});
|
|
2018
2114
|
|
|
2115
|
+
const __default__$i = defineComponent({
|
|
2116
|
+
name: "MFormColorPicker"
|
|
2117
|
+
});
|
|
2019
2118
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2020
|
-
|
|
2119
|
+
...__default__$i,
|
|
2021
2120
|
props: {
|
|
2022
2121
|
config: null,
|
|
2023
2122
|
model: null,
|
|
@@ -2046,8 +2145,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2046
2145
|
}
|
|
2047
2146
|
});
|
|
2048
2147
|
|
|
2148
|
+
const __default__$h = defineComponent({
|
|
2149
|
+
name: "MFormDate"
|
|
2150
|
+
});
|
|
2049
2151
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2050
|
-
|
|
2152
|
+
...__default__$h,
|
|
2051
2153
|
props: {
|
|
2052
2154
|
config: null,
|
|
2053
2155
|
model: null,
|
|
@@ -2075,15 +2177,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2075
2177
|
placeholder: __props.config.placeholder,
|
|
2076
2178
|
disabled: __props.disabled,
|
|
2077
2179
|
format: __props.config.format,
|
|
2078
|
-
"value-format": __props.config.
|
|
2180
|
+
"value-format": __props.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
|
|
2079
2181
|
onChange: changeHandler
|
|
2080
2182
|
}, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2081
2183
|
};
|
|
2082
2184
|
}
|
|
2083
2185
|
});
|
|
2084
2186
|
|
|
2187
|
+
const __default__$g = defineComponent({
|
|
2188
|
+
name: "MFormDateRange"
|
|
2189
|
+
});
|
|
2085
2190
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2086
|
-
|
|
2191
|
+
...__default__$g,
|
|
2087
2192
|
props: {
|
|
2088
2193
|
config: null,
|
|
2089
2194
|
model: null,
|
|
@@ -2180,8 +2285,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
2180
2285
|
}
|
|
2181
2286
|
});
|
|
2182
2287
|
|
|
2288
|
+
const __default__$f = defineComponent({
|
|
2289
|
+
name: "MFormDateTime"
|
|
2290
|
+
});
|
|
2183
2291
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2184
|
-
|
|
2292
|
+
...__default__$f,
|
|
2185
2293
|
props: {
|
|
2186
2294
|
config: null,
|
|
2187
2295
|
model: null,
|
|
@@ -2226,8 +2334,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2226
2334
|
});
|
|
2227
2335
|
|
|
2228
2336
|
const _hoisted_1$5 = { key: 0 };
|
|
2337
|
+
const __default__$e = defineComponent({
|
|
2338
|
+
name: "MFormDisplay"
|
|
2339
|
+
});
|
|
2229
2340
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2230
|
-
|
|
2341
|
+
...__default__$e,
|
|
2231
2342
|
props: {
|
|
2232
2343
|
config: null,
|
|
2233
2344
|
model: null,
|
|
@@ -2249,8 +2360,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2249
2360
|
});
|
|
2250
2361
|
|
|
2251
2362
|
const _hoisted_1$4 = { class: "m-fields-dynamic-field" };
|
|
2363
|
+
const __default__$d = defineComponent({
|
|
2364
|
+
name: "MFormDynamicField"
|
|
2365
|
+
});
|
|
2252
2366
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
2253
|
-
|
|
2367
|
+
...__default__$d,
|
|
2254
2368
|
props: {
|
|
2255
2369
|
config: null,
|
|
2256
2370
|
model: null,
|
|
@@ -2337,8 +2451,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2337
2451
|
}
|
|
2338
2452
|
});
|
|
2339
2453
|
|
|
2454
|
+
const __default__$c = defineComponent({
|
|
2455
|
+
name: "MFormHidden"
|
|
2456
|
+
});
|
|
2340
2457
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2341
|
-
|
|
2458
|
+
...__default__$c,
|
|
2342
2459
|
props: {
|
|
2343
2460
|
config: null,
|
|
2344
2461
|
model: null,
|
|
@@ -2362,8 +2479,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
2362
2479
|
}
|
|
2363
2480
|
});
|
|
2364
2481
|
|
|
2482
|
+
const __default__$b = defineComponent({
|
|
2483
|
+
name: "MForm"
|
|
2484
|
+
});
|
|
2365
2485
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
2366
|
-
|
|
2486
|
+
...__default__$b,
|
|
2367
2487
|
props: {
|
|
2368
2488
|
config: { default: () => [] },
|
|
2369
2489
|
initValues: { default: () => ({}) },
|
|
@@ -2407,6 +2527,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2407
2527
|
}
|
|
2408
2528
|
}
|
|
2409
2529
|
});
|
|
2530
|
+
watchEffect(() => {
|
|
2531
|
+
formState.initValues = props.initValues;
|
|
2532
|
+
formState.config = props.config;
|
|
2533
|
+
formState.keyProp = props.keyProp;
|
|
2534
|
+
formState.popperClass = props.popperClass;
|
|
2535
|
+
formState.parentValues = props.parentValues;
|
|
2536
|
+
});
|
|
2410
2537
|
provide("mForm", formState);
|
|
2411
2538
|
watch(
|
|
2412
2539
|
[() => props.config, () => props.initValues],
|
|
@@ -2460,7 +2587,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2460
2587
|
ref: tMagicForm,
|
|
2461
2588
|
model: values.value,
|
|
2462
2589
|
"label-width": __props.labelWidth,
|
|
2463
|
-
disabled: __props.disabled,
|
|
2464
2590
|
style: normalizeStyle(`height: ${__props.height}`),
|
|
2465
2591
|
inline: __props.inline,
|
|
2466
2592
|
"label-position": __props.labelPosition
|
|
@@ -2468,6 +2594,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2468
2594
|
default: withCtx(() => [
|
|
2469
2595
|
initialized.value && Array.isArray(__props.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.config, (item, index) => {
|
|
2470
2596
|
return openBlock(), createBlock(_sfc_main$v, {
|
|
2597
|
+
disabled: __props.disabled,
|
|
2471
2598
|
key: item[__props.keyProp] ?? index,
|
|
2472
2599
|
config: item,
|
|
2473
2600
|
model: values.value,
|
|
@@ -2475,11 +2602,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2475
2602
|
"step-active": __props.stepActive,
|
|
2476
2603
|
size: __props.size,
|
|
2477
2604
|
onChange: changeHandler
|
|
2478
|
-
}, null, 8, ["config", "model", "label-width", "step-active", "size"]);
|
|
2605
|
+
}, null, 8, ["disabled", "config", "model", "label-width", "step-active", "size"]);
|
|
2479
2606
|
}), 128)) : createCommentVNode("", true)
|
|
2480
2607
|
]),
|
|
2481
2608
|
_: 1
|
|
2482
|
-
}, 8, ["model", "label-width", "
|
|
2609
|
+
}, 8, ["model", "label-width", "style", "inline", "label-position"]);
|
|
2483
2610
|
};
|
|
2484
2611
|
}
|
|
2485
2612
|
});
|
|
@@ -2488,8 +2615,11 @@ const _hoisted_1$3 = { style: { "min-height": "1px" } };
|
|
|
2488
2615
|
const _hoisted_2$1 = /* @__PURE__ */ createTextVNode("\u53D6 \u6D88");
|
|
2489
2616
|
const _hoisted_3$1 = /* @__PURE__ */ createTextVNode("\u4E0A\u4E00\u6B65");
|
|
2490
2617
|
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u4E0B\u4E00\u6B65");
|
|
2618
|
+
const __default__$a = defineComponent({
|
|
2619
|
+
name: "MFormDialog"
|
|
2620
|
+
});
|
|
2491
2621
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2492
|
-
|
|
2622
|
+
...__default__$a,
|
|
2493
2623
|
props: {
|
|
2494
2624
|
config: { default: () => [] },
|
|
2495
2625
|
values: { default: () => ({}) },
|
|
@@ -2497,6 +2627,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2497
2627
|
width: null,
|
|
2498
2628
|
labelWidth: null,
|
|
2499
2629
|
fullscreen: { type: Boolean },
|
|
2630
|
+
disabled: { type: Boolean },
|
|
2500
2631
|
title: null,
|
|
2501
2632
|
zIndex: null,
|
|
2502
2633
|
size: null,
|
|
@@ -2652,12 +2783,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2652
2783
|
ref_key: "form",
|
|
2653
2784
|
ref: form,
|
|
2654
2785
|
size: __props.size,
|
|
2786
|
+
disabled: __props.disabled,
|
|
2655
2787
|
config: __props.config,
|
|
2656
2788
|
"init-values": __props.values,
|
|
2657
2789
|
"parent-values": __props.parentValues,
|
|
2658
2790
|
"label-width": __props.labelWidth,
|
|
2659
2791
|
onChange: changeHandler
|
|
2660
|
-
}, null, 8, ["modelValue", "size", "config", "init-values", "parent-values", "label-width"]),
|
|
2792
|
+
}, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width"]),
|
|
2661
2793
|
renderSlot(_ctx.$slots, "default")
|
|
2662
2794
|
], 4)) : createCommentVNode("", true)
|
|
2663
2795
|
]),
|
|
@@ -2673,8 +2805,11 @@ const _hoisted_2 = {
|
|
|
2673
2805
|
class: "m-fields-link"
|
|
2674
2806
|
};
|
|
2675
2807
|
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u7F16\u8F91");
|
|
2808
|
+
const __default__$9 = defineComponent({
|
|
2809
|
+
name: "MFormLink"
|
|
2810
|
+
});
|
|
2676
2811
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
2677
|
-
|
|
2812
|
+
...__default__$9,
|
|
2678
2813
|
props: {
|
|
2679
2814
|
config: null,
|
|
2680
2815
|
model: null,
|
|
@@ -2767,8 +2902,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
2767
2902
|
}
|
|
2768
2903
|
});
|
|
2769
2904
|
|
|
2905
|
+
const __default__$8 = defineComponent({
|
|
2906
|
+
name: "MFormNumber"
|
|
2907
|
+
});
|
|
2770
2908
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
2771
|
-
|
|
2909
|
+
...__default__$8,
|
|
2772
2910
|
props: {
|
|
2773
2911
|
config: null,
|
|
2774
2912
|
model: null,
|
|
@@ -2811,8 +2949,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2811
2949
|
}
|
|
2812
2950
|
});
|
|
2813
2951
|
|
|
2952
|
+
const __default__$7 = defineComponent({
|
|
2953
|
+
name: "MFormRadioGroup"
|
|
2954
|
+
});
|
|
2814
2955
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2815
|
-
|
|
2956
|
+
...__default__$7,
|
|
2816
2957
|
props: {
|
|
2817
2958
|
config: null,
|
|
2818
2959
|
model: null,
|
|
@@ -2843,13 +2984,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2843
2984
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.options, (option) => {
|
|
2844
2985
|
return openBlock(), createBlock(unref(TMagicRadio), {
|
|
2845
2986
|
label: option.value,
|
|
2987
|
+
value: option.value,
|
|
2846
2988
|
key: `${option.value}`
|
|
2847
2989
|
}, {
|
|
2848
2990
|
default: withCtx(() => [
|
|
2849
2991
|
createTextVNode(toDisplayString(option.text), 1)
|
|
2850
2992
|
]),
|
|
2851
2993
|
_: 2
|
|
2852
|
-
}, 1032, ["label"]);
|
|
2994
|
+
}, 1032, ["label", "value"]);
|
|
2853
2995
|
}), 128))
|
|
2854
2996
|
]),
|
|
2855
2997
|
_: 1
|
|
@@ -2858,8 +3000,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2858
3000
|
}
|
|
2859
3001
|
});
|
|
2860
3002
|
|
|
3003
|
+
const __default__$6 = defineComponent({
|
|
3004
|
+
name: "MFormSelectOptionGroups"
|
|
3005
|
+
});
|
|
2861
3006
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2862
|
-
|
|
3007
|
+
...__default__$6,
|
|
2863
3008
|
props: {
|
|
2864
3009
|
options: null
|
|
2865
3010
|
},
|
|
@@ -2889,8 +3034,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2889
3034
|
}
|
|
2890
3035
|
});
|
|
2891
3036
|
|
|
3037
|
+
const __default__$5 = defineComponent({
|
|
3038
|
+
name: "MFormSelectOptions"
|
|
3039
|
+
});
|
|
2892
3040
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2893
|
-
|
|
3041
|
+
...__default__$5,
|
|
2894
3042
|
props: {
|
|
2895
3043
|
options: null,
|
|
2896
3044
|
valueKey: null
|
|
@@ -2910,8 +3058,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2910
3058
|
});
|
|
2911
3059
|
|
|
2912
3060
|
const _hoisted_1$1 = { key: 2 };
|
|
3061
|
+
const __default__$4 = defineComponent({
|
|
3062
|
+
name: "MFormSelect"
|
|
3063
|
+
});
|
|
2913
3064
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2914
|
-
|
|
3065
|
+
...__default__$4,
|
|
2915
3066
|
props: {
|
|
2916
3067
|
config: null,
|
|
2917
3068
|
model: null,
|
|
@@ -2966,30 +3117,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
2966
3117
|
let items = [];
|
|
2967
3118
|
const { config } = props;
|
|
2968
3119
|
const { option } = config;
|
|
2969
|
-
|
|
3120
|
+
const { root = "", totalKey = "total" } = option;
|
|
3121
|
+
let { body = {}, url } = option;
|
|
3122
|
+
if (typeof url === "function") {
|
|
3123
|
+
url = await url(mForm, { model: props.model, formValue: mForm?.values });
|
|
3124
|
+
}
|
|
2970
3125
|
let postOptions = {
|
|
2971
3126
|
method: option.method || "POST",
|
|
2972
|
-
url
|
|
3127
|
+
url,
|
|
2973
3128
|
cache: option.cache,
|
|
2974
3129
|
timeout: option.timeout,
|
|
2975
3130
|
mode: option.mode,
|
|
2976
3131
|
headers: option.headers || {},
|
|
2977
3132
|
json: option.json || false
|
|
2978
3133
|
};
|
|
2979
|
-
if (body) {
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
});
|
|
2987
|
-
}
|
|
2988
|
-
body.query = query.value;
|
|
2989
|
-
body.pgSize = pgSize.value;
|
|
2990
|
-
body.pgIndex = pgIndex.value;
|
|
2991
|
-
postOptions.data = body;
|
|
3134
|
+
if (typeof body === "function") {
|
|
3135
|
+
body = body(mForm, {
|
|
3136
|
+
model: props.model,
|
|
3137
|
+
formValue: mForm?.values,
|
|
3138
|
+
formValues: mForm?.values,
|
|
3139
|
+
config: props.config
|
|
3140
|
+
});
|
|
2992
3141
|
}
|
|
3142
|
+
body.query = query.value;
|
|
3143
|
+
body.pgSize = pgSize.value;
|
|
3144
|
+
body.pgIndex = pgIndex.value;
|
|
3145
|
+
postOptions.data = body;
|
|
2993
3146
|
const requestFuc = getConfig("request");
|
|
2994
3147
|
if (typeof option.beforeRequest === "function") {
|
|
2995
3148
|
postOptions = option.beforeRequest(mForm, postOptions, {
|
|
@@ -3009,9 +3162,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3009
3162
|
config: props.config
|
|
3010
3163
|
});
|
|
3011
3164
|
}
|
|
3012
|
-
const optionsData =
|
|
3013
|
-
|
|
3014
|
-
|
|
3165
|
+
const optionsData = root.split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res);
|
|
3166
|
+
const resTotal = globalThis.parseInt(
|
|
3167
|
+
totalKey.split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res),
|
|
3168
|
+
10
|
|
3169
|
+
);
|
|
3170
|
+
if (resTotal > 0) {
|
|
3171
|
+
total.value = resTotal;
|
|
3015
3172
|
}
|
|
3016
3173
|
remoteData.value = remoteData.value.concat(optionsData);
|
|
3017
3174
|
if (optionsData) {
|
|
@@ -3060,6 +3217,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3060
3217
|
return [];
|
|
3061
3218
|
const { config } = props;
|
|
3062
3219
|
const { option } = config;
|
|
3220
|
+
const { root = "", initRoot = "" } = option;
|
|
3221
|
+
let { initBody = {} } = option;
|
|
3063
3222
|
let options2 = [];
|
|
3064
3223
|
let url = option.initUrl;
|
|
3065
3224
|
if (!url) {
|
|
@@ -3068,22 +3227,45 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3068
3227
|
if (typeof url === "function") {
|
|
3069
3228
|
url = await url(mForm, { model: props.model, formValue: mForm?.values });
|
|
3070
3229
|
}
|
|
3071
|
-
|
|
3230
|
+
if (typeof initBody === "function") {
|
|
3231
|
+
initBody = initBody(mForm, {
|
|
3232
|
+
model: props.model,
|
|
3233
|
+
formValue: mForm?.values,
|
|
3234
|
+
formValues: mForm?.values,
|
|
3235
|
+
config: props.config
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
let postOptions = {
|
|
3072
3239
|
method: option.method || "POST",
|
|
3073
3240
|
url,
|
|
3074
3241
|
data: {
|
|
3075
|
-
id: props.model[props.name]
|
|
3242
|
+
id: props.model[props.name],
|
|
3243
|
+
...initBody
|
|
3076
3244
|
},
|
|
3077
3245
|
mode: option.mode,
|
|
3078
3246
|
headers: option.headers || {},
|
|
3079
3247
|
json: option.json || false
|
|
3080
3248
|
};
|
|
3249
|
+
if (typeof option.beforeInitRequest === "function") {
|
|
3250
|
+
postOptions = option.beforeInitRequest(mForm, postOptions, {
|
|
3251
|
+
model: props.model,
|
|
3252
|
+
formValue: mForm?.values
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3081
3255
|
if (option.method?.toLocaleLowerCase() === "jsonp") {
|
|
3082
3256
|
postOptions.jsonpCallback = option.jsonpCallback || "callback";
|
|
3083
3257
|
}
|
|
3084
3258
|
const requestFuc = getConfig("request");
|
|
3085
|
-
|
|
3086
|
-
|
|
3259
|
+
let res = await requestFuc(postOptions);
|
|
3260
|
+
if (typeof option.afterRequest === "function") {
|
|
3261
|
+
res = option.afterRequest(mForm, res, {
|
|
3262
|
+
model: props.model,
|
|
3263
|
+
formValue: mForm?.values,
|
|
3264
|
+
formValues: mForm?.values,
|
|
3265
|
+
config: props.config
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
let initData = (initRoot || root).split(".").reduce((accumulator, currentValue) => accumulator[currentValue], res);
|
|
3087
3269
|
if (initData) {
|
|
3088
3270
|
if (!Array.isArray(initData)) {
|
|
3089
3271
|
initData = [initData];
|
|
@@ -3218,8 +3400,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3218
3400
|
}
|
|
3219
3401
|
});
|
|
3220
3402
|
|
|
3403
|
+
const __default__$3 = defineComponent({
|
|
3404
|
+
name: "MFormSwitch"
|
|
3405
|
+
});
|
|
3221
3406
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3222
|
-
|
|
3407
|
+
...__default__$3,
|
|
3223
3408
|
props: {
|
|
3224
3409
|
config: null,
|
|
3225
3410
|
model: null,
|
|
@@ -3272,8 +3457,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3272
3457
|
});
|
|
3273
3458
|
|
|
3274
3459
|
const _hoisted_1 = { key: 0 };
|
|
3460
|
+
const __default__$2 = defineComponent({
|
|
3461
|
+
name: "MFormText"
|
|
3462
|
+
});
|
|
3275
3463
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3276
|
-
|
|
3464
|
+
...__default__$2,
|
|
3277
3465
|
props: {
|
|
3278
3466
|
config: null,
|
|
3279
3467
|
model: null,
|
|
@@ -3392,8 +3580,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3392
3580
|
}
|
|
3393
3581
|
});
|
|
3394
3582
|
|
|
3583
|
+
const __default__$1 = defineComponent({
|
|
3584
|
+
name: "MFormTextarea"
|
|
3585
|
+
});
|
|
3395
3586
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3396
|
-
|
|
3587
|
+
...__default__$1,
|
|
3397
3588
|
props: {
|
|
3398
3589
|
config: null,
|
|
3399
3590
|
model: null,
|
|
@@ -3432,8 +3623,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3432
3623
|
}
|
|
3433
3624
|
});
|
|
3434
3625
|
|
|
3626
|
+
const __default__ = defineComponent({
|
|
3627
|
+
name: "MFormTime"
|
|
3628
|
+
});
|
|
3435
3629
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3436
|
-
|
|
3630
|
+
...__default__,
|
|
3437
3631
|
props: {
|
|
3438
3632
|
config: null,
|
|
3439
3633
|
model: null,
|
|
@@ -3455,11 +3649,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3455
3649
|
return openBlock(), createBlock(unref(TMagicTimePicker), {
|
|
3456
3650
|
modelValue: __props.model[__props.name],
|
|
3457
3651
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
|
|
3652
|
+
"value-format": __props.config.valueFormat || "HH:mm:ss",
|
|
3653
|
+
format: __props.config.format || "HH:mm:ss",
|
|
3458
3654
|
size: __props.size,
|
|
3459
3655
|
placeholder: __props.config.placeholder,
|
|
3460
3656
|
disabled: __props.disabled,
|
|
3461
3657
|
onChange: changeHandler
|
|
3462
|
-
}, null, 8, ["modelValue", "size", "placeholder", "disabled"]);
|
|
3658
|
+
}, null, 8, ["modelValue", "value-format", "format", "size", "placeholder", "disabled"]);
|
|
3463
3659
|
};
|
|
3464
3660
|
}
|
|
3465
3661
|
});
|
|
@@ -3504,5 +3700,5 @@ const index = {
|
|
|
3504
3700
|
install
|
|
3505
3701
|
};
|
|
3506
3702
|
|
|
3507
|
-
export { _sfc_main$l as MCascader, _sfc_main$k as MCheckbox, _sfc_main$j as MCheckboxGroup, _sfc_main$i as MColorPicker, _sfc_main$v as MContainer, _sfc_main$h as MDate, _sfc_main$f as MDateTime, _sfc_main$g as MDaterange, _sfc_main$e as MDisplay, _sfc_main$d as MDynamicField, _sfc_main$u as MFieldset, _sfc_main$b as MForm, _sfc_main$a as MFormDialog, _sfc_main$s as MGroupList, _sfc_main$c as MHidden, _sfc_main$9 as MLink, _sfc_main$8 as MNumber, _sfc_main$r as MPanel, _sfc_main$7 as MRadioGroup, _sfc_main$p as MRow, _sfc_main$4 as MSelect, _sfc_main$3 as MSwitch, _sfc_main$n as MTable, _sfc_main$m as MTabs, _sfc_main$2 as MText, _sfc_main$1 as MTextarea, _sfc_main as MTime, index as default, display, filterFunction, getRules, initValue, useAddField };
|
|
3508
|
-
//# sourceMappingURL=tmagic-form.
|
|
3703
|
+
export { _sfc_main$l as MCascader, _sfc_main$k as MCheckbox, _sfc_main$j as MCheckboxGroup, _sfc_main$i as MColorPicker, _sfc_main$v as MContainer, _sfc_main$h as MDate, _sfc_main$f as MDateTime, _sfc_main$g as MDaterange, _sfc_main$e as MDisplay, _sfc_main$d as MDynamicField, _sfc_main$u as MFieldset, _sfc_main$b as MForm, _sfc_main$a as MFormDialog, _sfc_main$s as MGroupList, _sfc_main$c as MHidden, _sfc_main$9 as MLink, _sfc_main$8 as MNumber, _sfc_main$r as MPanel, _sfc_main$7 as MRadioGroup, _sfc_main$p as MRow, _sfc_main$4 as MSelect, _sfc_main$3 as MSwitch, _sfc_main$n as MTable, _sfc_main$m as MTabs, _sfc_main$2 as MText, _sfc_main$1 as MTextarea, _sfc_main as MTime, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
|
|
3704
|
+
//# sourceMappingURL=tmagic-form.js.map
|