@tmagic/form 1.2.0-beta.9 → 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} +307 -124
- package/dist/tmagic-form.js.map +1 -0
- package/dist/{tmagic-form.umd.js → tmagic-form.umd.cjs} +306 -122
- package/dist/tmagic-form.umd.cjs.map +1 -0
- package/package.json +10 -8
- package/src/Form.vue +2 -2
- package/src/FormDialog.vue +3 -1
- package/src/containers/Col.vue +3 -1
- package/src/containers/Container.vue +6 -3
- 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 +5 -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);
|
|
@@ -156,7 +156,7 @@ const getRules = function(mForm, rules = [], props) {
|
|
|
156
156
|
const initValue = async (mForm, { initValues, config }) => {
|
|
157
157
|
if (!Array.isArray(config))
|
|
158
158
|
throw new Error("config\u5E94\u8BE5\u4E3A\u6570\u7EC4");
|
|
159
|
-
let valuesTmp =
|
|
159
|
+
let valuesTmp = createValues(mForm, config, toRaw(initValues), {});
|
|
160
160
|
const [firstForm] = config;
|
|
161
161
|
if (firstForm && typeof firstForm.onInitValue === "function") {
|
|
162
162
|
valuesTmp = await firstForm.onInitValue(mForm, {
|
|
@@ -175,12 +175,16 @@ const _hoisted_5$4 = {
|
|
|
175
175
|
key: 4,
|
|
176
176
|
style: { "text-align": "center" }
|
|
177
177
|
};
|
|
178
|
+
const __default__$v = defineComponent({
|
|
179
|
+
name: "MFormContainer"
|
|
180
|
+
});
|
|
178
181
|
const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
179
|
-
|
|
182
|
+
...__default__$v,
|
|
180
183
|
props: {
|
|
181
184
|
model: null,
|
|
182
185
|
config: null,
|
|
183
186
|
prop: { default: "" },
|
|
187
|
+
disabled: { type: Boolean },
|
|
184
188
|
labelWidth: null,
|
|
185
189
|
expandMore: { type: Boolean, default: false },
|
|
186
190
|
stepActive: null,
|
|
@@ -211,7 +215,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
211
215
|
return component;
|
|
212
216
|
return "m-fields-text";
|
|
213
217
|
});
|
|
214
|
-
const disabled = computed(() => filterFunction(mForm, props.config.disabled, props));
|
|
218
|
+
const disabled = computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
|
|
215
219
|
const tooltip = computed(() => filterFunction(mForm, props.config.tooltip, props));
|
|
216
220
|
const extra = computed(() => filterFunction(mForm, props.config.extra, props));
|
|
217
221
|
const rule = computed(() => getRules(mForm, props.config.rules, props));
|
|
@@ -308,13 +312,14 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
308
312
|
size: __props.size,
|
|
309
313
|
model: __props.model,
|
|
310
314
|
config: __props.config,
|
|
315
|
+
disabled: unref(disabled),
|
|
311
316
|
name: unref(name),
|
|
312
317
|
prop: unref(itemProp),
|
|
313
318
|
"step-active": __props.stepActive,
|
|
314
319
|
"expand-more": expand.value,
|
|
315
320
|
"label-width": unref(itemLabelWidth),
|
|
316
321
|
onChange: onChangeHandler
|
|
317
|
-
}, 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 }, [
|
|
318
323
|
createVNode(unref(TMagicFormItem), {
|
|
319
324
|
style: normalizeStyle(__props.config.tip ? "flex: 1" : ""),
|
|
320
325
|
class: normalizeClass({ hidden: `${unref(itemLabelWidth)}` === "0" || !__props.config.text }),
|
|
@@ -389,18 +394,20 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
389
394
|
model: unref(name) || unref(name) === 0 ? __props.model[unref(name)] : __props.model,
|
|
390
395
|
config: item,
|
|
391
396
|
size: __props.size,
|
|
397
|
+
disabled: unref(disabled),
|
|
392
398
|
"step-active": __props.stepActive,
|
|
393
399
|
"expand-more": expand.value,
|
|
394
400
|
"label-width": unref(itemLabelWidth),
|
|
395
401
|
prop: unref(itemProp),
|
|
396
402
|
onChange: onChangeHandler
|
|
397
|
-
}, 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"]);
|
|
398
404
|
}), 128)) : createCommentVNode("", true)
|
|
399
405
|
], 64)) : createCommentVNode("", true),
|
|
400
406
|
__props.config.expand && unref(type) !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
|
|
401
407
|
createVNode(unref(TMagicButton), {
|
|
402
408
|
type: "primary",
|
|
403
409
|
size: "small",
|
|
410
|
+
disabled: false,
|
|
404
411
|
text: "",
|
|
405
412
|
onClick: expandHandler
|
|
406
413
|
}, {
|
|
@@ -426,15 +433,19 @@ const _hoisted_6$2 = {
|
|
|
426
433
|
};
|
|
427
434
|
const _hoisted_7$2 = { style: { "flex": "1" } };
|
|
428
435
|
const _hoisted_8$1 = ["src"];
|
|
436
|
+
const __default__$u = defineComponent({
|
|
437
|
+
name: "MFormFieldset"
|
|
438
|
+
});
|
|
429
439
|
const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
430
|
-
|
|
440
|
+
...__default__$u,
|
|
431
441
|
props: {
|
|
432
442
|
labelWidth: null,
|
|
433
443
|
prop: { default: "" },
|
|
434
444
|
size: null,
|
|
435
445
|
model: null,
|
|
436
446
|
config: null,
|
|
437
|
-
rules: { default: {} }
|
|
447
|
+
rules: { default: {} },
|
|
448
|
+
disabled: { type: Boolean }
|
|
438
449
|
},
|
|
439
450
|
emits: ["change"],
|
|
440
451
|
setup(__props, { emit }) {
|
|
@@ -513,10 +524,11 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
513
524
|
rules: unref(name) ? __props.rules[unref(name)] : [],
|
|
514
525
|
config: item,
|
|
515
526
|
prop: __props.prop,
|
|
527
|
+
disabled: __props.disabled,
|
|
516
528
|
labelWidth: unref(lWidth),
|
|
517
529
|
size: __props.size,
|
|
518
530
|
onChange: change
|
|
519
|
-
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size"]);
|
|
531
|
+
}, null, 8, ["model", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
|
|
520
532
|
}), 128))
|
|
521
533
|
]),
|
|
522
534
|
createElementVNode("img", {
|
|
@@ -532,8 +544,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
532
544
|
prop: __props.prop,
|
|
533
545
|
labelWidth: unref(lWidth),
|
|
534
546
|
size: __props.size,
|
|
547
|
+
disabled: __props.disabled,
|
|
535
548
|
onChange: change
|
|
536
|
-
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size"]);
|
|
549
|
+
}, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
|
|
537
550
|
}), 128)) : createCommentVNode("", true)
|
|
538
551
|
], 4)) : createCommentVNode("", true);
|
|
539
552
|
};
|
|
@@ -544,8 +557,11 @@ const _hoisted_1$9 = { class: "m-fields-group-list-item" };
|
|
|
544
557
|
const _hoisted_2$5 = /* @__PURE__ */ createTextVNode("\u4E0A\u79FB");
|
|
545
558
|
const _hoisted_3$5 = /* @__PURE__ */ createTextVNode("\u4E0B\u79FB");
|
|
546
559
|
const _hoisted_4$4 = ["innerHTML"];
|
|
560
|
+
const __default__$t = defineComponent({
|
|
561
|
+
name: "MFormGroupListItem"
|
|
562
|
+
});
|
|
547
563
|
const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
548
|
-
|
|
564
|
+
...__default__$t,
|
|
549
565
|
props: {
|
|
550
566
|
model: null,
|
|
551
567
|
groupModel: null,
|
|
@@ -553,7 +569,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
553
569
|
labelWidth: null,
|
|
554
570
|
prop: null,
|
|
555
571
|
size: null,
|
|
556
|
-
index: null
|
|
572
|
+
index: null,
|
|
573
|
+
disabled: { type: Boolean }
|
|
557
574
|
},
|
|
558
575
|
emits: ["swap-item", "remove-item", "change"],
|
|
559
576
|
setup(__props, { emit }) {
|
|
@@ -614,24 +631,27 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
614
631
|
}),
|
|
615
632
|
createVNode(unref(TMagicButton), {
|
|
616
633
|
text: "",
|
|
634
|
+
disabled: __props.disabled,
|
|
617
635
|
onClick: expandHandler
|
|
618
636
|
}, {
|
|
619
637
|
default: withCtx(() => [
|
|
620
638
|
createTextVNode(toDisplayString(unref(title)), 1)
|
|
621
639
|
]),
|
|
622
640
|
_: 1
|
|
623
|
-
}),
|
|
641
|
+
}, 8, ["disabled"]),
|
|
624
642
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
643
|
+
style: { "color": "#f56c6c" },
|
|
625
644
|
text: "",
|
|
626
645
|
icon: unref(Delete),
|
|
627
|
-
|
|
646
|
+
disabled: __props.disabled,
|
|
628
647
|
onClick: removeHandler
|
|
629
|
-
}, null, 8, ["icon"]), [
|
|
648
|
+
}, null, 8, ["icon", "disabled"]), [
|
|
630
649
|
[vShow, showDelete(parseInt(String(__props.index)))]
|
|
631
650
|
]),
|
|
632
651
|
movable() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
633
652
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
634
653
|
text: "",
|
|
654
|
+
disabled: __props.disabled,
|
|
635
655
|
size: "small",
|
|
636
656
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
637
657
|
}, {
|
|
@@ -645,10 +665,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
645
665
|
})
|
|
646
666
|
]),
|
|
647
667
|
_: 1
|
|
648
|
-
},
|
|
668
|
+
}, 8, ["disabled"]), [
|
|
649
669
|
[vShow, __props.index !== 0]
|
|
650
670
|
]),
|
|
651
671
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
672
|
+
disabled: __props.disabled,
|
|
652
673
|
text: "",
|
|
653
674
|
size: "small",
|
|
654
675
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
@@ -663,7 +684,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
663
684
|
})
|
|
664
685
|
]),
|
|
665
686
|
_: 1
|
|
666
|
-
},
|
|
687
|
+
}, 8, ["disabled"]), [
|
|
667
688
|
[vShow, __props.index !== unref(length) - 1]
|
|
668
689
|
])
|
|
669
690
|
], 64)) : createCommentVNode("", true),
|
|
@@ -680,8 +701,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
680
701
|
labelWidth: __props.labelWidth,
|
|
681
702
|
prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
|
|
682
703
|
size: __props.size,
|
|
704
|
+
disabled: __props.disabled,
|
|
683
705
|
onChange: changeHandler
|
|
684
|
-
}, null, 8, ["config", "model", "labelWidth", "prop", "size"])) : createCommentVNode("", true)
|
|
706
|
+
}, null, 8, ["config", "model", "labelWidth", "prop", "size", "disabled"])) : createCommentVNode("", true)
|
|
685
707
|
]);
|
|
686
708
|
};
|
|
687
709
|
}
|
|
@@ -699,15 +721,19 @@ const _hoisted_5$2 = [
|
|
|
699
721
|
];
|
|
700
722
|
const _hoisted_6$1 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u7EC4");
|
|
701
723
|
const _hoisted_7$1 = /* @__PURE__ */ createTextVNode("\u5207\u6362\u4E3A\u8868\u683C");
|
|
724
|
+
const __default__$s = defineComponent({
|
|
725
|
+
name: "MFormGroupList"
|
|
726
|
+
});
|
|
702
727
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
703
|
-
|
|
728
|
+
...__default__$s,
|
|
704
729
|
props: {
|
|
705
730
|
model: null,
|
|
706
731
|
config: null,
|
|
707
732
|
name: null,
|
|
708
733
|
labelWidth: null,
|
|
709
734
|
prop: null,
|
|
710
|
-
size: null
|
|
735
|
+
size: null,
|
|
736
|
+
disabled: { type: Boolean }
|
|
711
737
|
},
|
|
712
738
|
emits: ["change"],
|
|
713
739
|
setup(__props, { emit }) {
|
|
@@ -789,22 +815,24 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
789
815
|
index,
|
|
790
816
|
"label-width": __props.labelWidth,
|
|
791
817
|
size: __props.size,
|
|
818
|
+
disabled: __props.disabled,
|
|
792
819
|
"group-model": __props.model[__props.name],
|
|
793
820
|
onRemoveItem: removeHandler,
|
|
794
821
|
onSwapItem: swapHandler,
|
|
795
822
|
onChange: changeHandler
|
|
796
|
-
}, null, 8, ["model", "config", "prop", "index", "label-width", "size", "group-model"]);
|
|
823
|
+
}, null, 8, ["model", "config", "prop", "index", "label-width", "size", "disabled", "group-model"]);
|
|
797
824
|
}), 128)),
|
|
798
825
|
unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
799
826
|
key: 3,
|
|
800
827
|
onClick: addHandler,
|
|
801
|
-
size: "small"
|
|
828
|
+
size: "small",
|
|
829
|
+
disabled: __props.disabled
|
|
802
830
|
}, {
|
|
803
831
|
default: withCtx(() => [
|
|
804
832
|
_hoisted_6$1
|
|
805
833
|
]),
|
|
806
834
|
_: 1
|
|
807
|
-
})) : createCommentVNode("", true),
|
|
835
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
808
836
|
__props.config.enableToggleMode ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
809
837
|
key: 4,
|
|
810
838
|
icon: unref(Grid),
|
|
@@ -829,15 +857,19 @@ const _hoisted_3$3 = {
|
|
|
829
857
|
};
|
|
830
858
|
const _hoisted_4$2 = { style: { "flex": "1" } };
|
|
831
859
|
const _hoisted_5$1 = ["src"];
|
|
860
|
+
const __default__$r = defineComponent({
|
|
861
|
+
name: "MFormPanel"
|
|
862
|
+
});
|
|
832
863
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
833
|
-
|
|
864
|
+
...__default__$r,
|
|
834
865
|
props: {
|
|
835
866
|
model: null,
|
|
836
867
|
config: null,
|
|
837
868
|
name: null,
|
|
838
869
|
labelWidth: null,
|
|
839
870
|
prop: null,
|
|
840
|
-
size: null
|
|
871
|
+
size: null,
|
|
872
|
+
disabled: { type: Boolean }
|
|
841
873
|
},
|
|
842
874
|
emits: ["change"],
|
|
843
875
|
setup(__props, { emit }) {
|
|
@@ -887,9 +919,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
887
919
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
888
920
|
prop: __props.prop,
|
|
889
921
|
size: __props.size,
|
|
922
|
+
disabled: __props.disabled,
|
|
890
923
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
891
924
|
onChange: changeHandler
|
|
892
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"]);
|
|
925
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"]);
|
|
893
926
|
}), 128))
|
|
894
927
|
]),
|
|
895
928
|
createElementVNode("img", {
|
|
@@ -903,9 +936,10 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
903
936
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
904
937
|
prop: __props.prop,
|
|
905
938
|
size: __props.size,
|
|
939
|
+
disabled: __props.disabled,
|
|
906
940
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
907
941
|
onChange: changeHandler
|
|
908
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"]);
|
|
942
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"]);
|
|
909
943
|
}), 128))
|
|
910
944
|
])
|
|
911
945
|
]),
|
|
@@ -915,8 +949,11 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
915
949
|
}
|
|
916
950
|
});
|
|
917
951
|
|
|
952
|
+
const __default__$q = defineComponent({
|
|
953
|
+
name: "MFormCol"
|
|
954
|
+
});
|
|
918
955
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
919
|
-
|
|
956
|
+
...__default__$q,
|
|
920
957
|
props: {
|
|
921
958
|
model: null,
|
|
922
959
|
config: null,
|
|
@@ -924,7 +961,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
924
961
|
expandMore: { type: Boolean },
|
|
925
962
|
span: null,
|
|
926
963
|
size: null,
|
|
927
|
-
prop: null
|
|
964
|
+
prop: null,
|
|
965
|
+
disabled: { type: Boolean }
|
|
928
966
|
},
|
|
929
967
|
emits: ["change"],
|
|
930
968
|
setup(__props, { emit }) {
|
|
@@ -942,8 +980,9 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
942
980
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
943
981
|
"expand-more": __props.expandMore,
|
|
944
982
|
size: __props.size,
|
|
983
|
+
disabled: __props.disabled,
|
|
945
984
|
onChange: changeHandler
|
|
946
|
-
}, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size"])
|
|
985
|
+
}, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size", "disabled"])
|
|
947
986
|
]),
|
|
948
987
|
_: 1
|
|
949
988
|
}, 8, ["span"])), [
|
|
@@ -953,8 +992,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
953
992
|
}
|
|
954
993
|
});
|
|
955
994
|
|
|
995
|
+
const __default__$p = defineComponent({
|
|
996
|
+
name: "MFormRow"
|
|
997
|
+
});
|
|
956
998
|
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
957
|
-
|
|
999
|
+
...__default__$p,
|
|
958
1000
|
props: {
|
|
959
1001
|
model: null,
|
|
960
1002
|
config: null,
|
|
@@ -962,7 +1004,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
962
1004
|
labelWidth: null,
|
|
963
1005
|
prop: null,
|
|
964
1006
|
size: null,
|
|
965
|
-
expandMore: { type: Boolean }
|
|
1007
|
+
expandMore: { type: Boolean },
|
|
1008
|
+
disabled: { type: Boolean }
|
|
966
1009
|
},
|
|
967
1010
|
emits: ["change"],
|
|
968
1011
|
setup(__props, { emit }) {
|
|
@@ -982,8 +1025,9 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
982
1025
|
model: __props.name ? __props.model[__props.name] : __props.model,
|
|
983
1026
|
prop: __props.prop,
|
|
984
1027
|
size: __props.size,
|
|
1028
|
+
disabled: __props.disabled,
|
|
985
1029
|
onChange: changeHandler
|
|
986
|
-
}, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "prop", "size"]);
|
|
1030
|
+
}, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "prop", "size", "disabled"]);
|
|
987
1031
|
}), 128))
|
|
988
1032
|
]),
|
|
989
1033
|
_: 1
|
|
@@ -992,14 +1036,18 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
992
1036
|
}
|
|
993
1037
|
});
|
|
994
1038
|
|
|
1039
|
+
const __default__$o = defineComponent({
|
|
1040
|
+
name: "MFormStep"
|
|
1041
|
+
});
|
|
995
1042
|
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
996
|
-
|
|
1043
|
+
...__default__$o,
|
|
997
1044
|
props: {
|
|
998
1045
|
model: null,
|
|
999
1046
|
config: null,
|
|
1000
1047
|
stepActive: { default: 1 },
|
|
1001
1048
|
labelWidth: null,
|
|
1002
|
-
size: null
|
|
1049
|
+
size: null,
|
|
1050
|
+
disabled: { type: Boolean }
|
|
1003
1051
|
},
|
|
1004
1052
|
emits: ["change"],
|
|
1005
1053
|
setup(__props, { emit }) {
|
|
@@ -1045,9 +1093,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
1045
1093
|
model: step.name ? __props.model[step.name] : __props.model,
|
|
1046
1094
|
prop: `${step.name}`,
|
|
1047
1095
|
size: __props.size,
|
|
1096
|
+
disabled: __props.disabled,
|
|
1048
1097
|
"label-width": __props.config.labelWidth || __props.labelWidth,
|
|
1049
1098
|
onChange: changeHandler
|
|
1050
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width"])), [
|
|
1099
|
+
}, null, 8, ["config", "model", "prop", "size", "disabled", "label-width"])), [
|
|
1051
1100
|
[vShow, active.value - 1 === index]
|
|
1052
1101
|
]) : createCommentVNode("", true)
|
|
1053
1102
|
], 64);
|
|
@@ -1069,11 +1118,15 @@ const _hoisted_7 = /* @__PURE__ */ createTextVNode("\u5BFC\u5165EXCEL");
|
|
|
1069
1118
|
const _hoisted_8 = /* @__PURE__ */ createTextVNode("\xA0 ");
|
|
1070
1119
|
const _hoisted_9 = /* @__PURE__ */ createTextVNode("\u6E05\u7A7A");
|
|
1071
1120
|
const _hoisted_10 = {
|
|
1121
|
+
key: 1,
|
|
1072
1122
|
class: "bottom",
|
|
1073
1123
|
style: { "text-align": "right" }
|
|
1074
1124
|
};
|
|
1125
|
+
const __default__$n = defineComponent({
|
|
1126
|
+
name: "MFormTable"
|
|
1127
|
+
});
|
|
1075
1128
|
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
1076
|
-
|
|
1129
|
+
...__default__$n,
|
|
1077
1130
|
props: {
|
|
1078
1131
|
model: null,
|
|
1079
1132
|
config: null,
|
|
@@ -1081,6 +1134,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1081
1134
|
prop: { default: "" },
|
|
1082
1135
|
labelWidth: null,
|
|
1083
1136
|
sort: { type: Boolean },
|
|
1137
|
+
disabled: { type: Boolean },
|
|
1084
1138
|
sortKey: { default: "" },
|
|
1085
1139
|
text: null,
|
|
1086
1140
|
size: null,
|
|
@@ -1100,6 +1154,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1100
1154
|
const updateKey = ref(1);
|
|
1101
1155
|
const isFullscreen = ref(false);
|
|
1102
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
|
+
);
|
|
1103
1162
|
const sortChange = ({ prop, order }) => {
|
|
1104
1163
|
if (order === "ascending") {
|
|
1105
1164
|
props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
|
|
@@ -1125,10 +1184,10 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1125
1184
|
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1126
1185
|
};
|
|
1127
1186
|
const rowDrop = () => {
|
|
1128
|
-
const tableEl = tMagicTable.value
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
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, {
|
|
1132
1191
|
onEnd: ({ newIndex, oldIndex }) => {
|
|
1133
1192
|
if (typeof newIndex === "undefined")
|
|
1134
1193
|
return;
|
|
@@ -1140,11 +1199,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1140
1199
|
sortable.destroy();
|
|
1141
1200
|
mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
|
|
1142
1201
|
sleep(1e3).then(() => {
|
|
1143
|
-
const
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
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)";
|
|
1146
1205
|
sleep(1e3).then(() => {
|
|
1147
|
-
|
|
1206
|
+
elTrs[newIndex].style.backgroundColor = "";
|
|
1148
1207
|
});
|
|
1149
1208
|
}
|
|
1150
1209
|
});
|
|
@@ -1215,6 +1274,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1215
1274
|
if (props.sort && props.sortKey) {
|
|
1216
1275
|
props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
|
|
1217
1276
|
}
|
|
1277
|
+
});
|
|
1278
|
+
watchEffect(() => {
|
|
1218
1279
|
if (props.config.dropSort) {
|
|
1219
1280
|
rowDrop();
|
|
1220
1281
|
}
|
|
@@ -1261,6 +1322,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1261
1322
|
return fuc;
|
|
1262
1323
|
};
|
|
1263
1324
|
const removeHandler = (index) => {
|
|
1325
|
+
if (props.disabled)
|
|
1326
|
+
return;
|
|
1264
1327
|
props.model[modelName.value].splice(index, 1);
|
|
1265
1328
|
emit("change", props.model[modelName.value]);
|
|
1266
1329
|
};
|
|
@@ -1277,8 +1340,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1277
1340
|
const toggleRowSelection = (row, selected) => {
|
|
1278
1341
|
tMagicTable.value?.toggleRowSelection.call(tMagicTable.value, row, selected);
|
|
1279
1342
|
};
|
|
1280
|
-
const makeConfig = (config) => {
|
|
1343
|
+
const makeConfig = (config, row) => {
|
|
1281
1344
|
const newConfig = cloneDeep(config);
|
|
1345
|
+
if (typeof config.itemsFunction === "function") {
|
|
1346
|
+
newConfig.items = config.itemsFunction(row);
|
|
1347
|
+
}
|
|
1282
1348
|
delete newConfig.display;
|
|
1283
1349
|
return newConfig;
|
|
1284
1350
|
};
|
|
@@ -1336,8 +1402,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1336
1402
|
}
|
|
1337
1403
|
const reader = new FileReader();
|
|
1338
1404
|
reader.onload = () => {
|
|
1339
|
-
const
|
|
1340
|
-
const pdata = globalThis.XLSX.read(
|
|
1405
|
+
const data2 = reader.result;
|
|
1406
|
+
const pdata = globalThis.XLSX.read(data2, { type: "array" });
|
|
1341
1407
|
pdata.SheetNames.forEach((sheetName) => {
|
|
1342
1408
|
const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
|
|
1343
1409
|
if (arr?.[0]) {
|
|
@@ -1419,7 +1485,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1419
1485
|
ref_key: "tMagicTable",
|
|
1420
1486
|
ref: tMagicTable,
|
|
1421
1487
|
style: { "width": "100%" },
|
|
1422
|
-
|
|
1488
|
+
"row-key": __props.config.rowKey || "id",
|
|
1489
|
+
data: unref(data),
|
|
1423
1490
|
border: __props.config.border,
|
|
1424
1491
|
"max-height": __props.config.maxHeight,
|
|
1425
1492
|
"default-expand-all": true,
|
|
@@ -1480,10 +1547,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1480
1547
|
size: "small",
|
|
1481
1548
|
type: "primary",
|
|
1482
1549
|
icon: unref(ArrowUp),
|
|
1550
|
+
disabled: __props.disabled,
|
|
1483
1551
|
text: "",
|
|
1484
1552
|
onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
1485
1553
|
onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1486
|
-
}, null, 8, ["icon", "onClick", "onDblclick"])
|
|
1554
|
+
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
1487
1555
|
]),
|
|
1488
1556
|
_: 2
|
|
1489
1557
|
}, 1024)) : createCommentVNode("", true),
|
|
@@ -1498,10 +1566,11 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1498
1566
|
size: "small",
|
|
1499
1567
|
type: "primary",
|
|
1500
1568
|
icon: unref(ArrowDown),
|
|
1569
|
+
disabled: __props.disabled,
|
|
1501
1570
|
text: "",
|
|
1502
1571
|
onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
|
|
1503
1572
|
onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
|
|
1504
|
-
}, null, 8, ["icon", "onClick", "onDblclick"])
|
|
1573
|
+
}, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
|
|
1505
1574
|
]),
|
|
1506
1575
|
_: 2
|
|
1507
1576
|
}, 1024)) : createCommentVNode("", true)
|
|
@@ -1540,13 +1609,14 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1540
1609
|
scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$v, {
|
|
1541
1610
|
key: 0,
|
|
1542
1611
|
labelWidth: "0",
|
|
1612
|
+
disabled: __props.disabled,
|
|
1543
1613
|
prop: getProp(scope.$index),
|
|
1544
1614
|
rules: column.rules,
|
|
1545
|
-
config: makeConfig(column),
|
|
1615
|
+
config: makeConfig(column, scope.row),
|
|
1546
1616
|
model: scope.row,
|
|
1547
1617
|
size: __props.size,
|
|
1548
1618
|
onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", __props.model[unref(modelName)]))
|
|
1549
|
-
}, null, 8, ["prop", "rules", "config", "model", "size"])) : createCommentVNode("", true)
|
|
1619
|
+
}, null, 8, ["disabled", "prop", "rules", "config", "model", "size"])) : createCommentVNode("", true)
|
|
1550
1620
|
]),
|
|
1551
1621
|
_: 2
|
|
1552
1622
|
}, 1032, ["prop", "width", "label", "sortable", "class-name"])) : createCommentVNode("", true)
|
|
@@ -1554,7 +1624,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1554
1624
|
}), 256))
|
|
1555
1625
|
]),
|
|
1556
1626
|
_: 1
|
|
1557
|
-
}, 8, ["data", "border", "max-height"])) : createCommentVNode("", true)
|
|
1627
|
+
}, 8, ["row-key", "data", "border", "max-height"])) : createCommentVNode("", true)
|
|
1558
1628
|
]),
|
|
1559
1629
|
_: 1
|
|
1560
1630
|
}, 8, ["disabled"]),
|
|
@@ -1563,6 +1633,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1563
1633
|
key: 0,
|
|
1564
1634
|
size: "small",
|
|
1565
1635
|
type: "primary",
|
|
1636
|
+
disabled: __props.disabled,
|
|
1566
1637
|
plain: "",
|
|
1567
1638
|
onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
|
|
1568
1639
|
}, {
|
|
@@ -1570,7 +1641,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1570
1641
|
_hoisted_4$1
|
|
1571
1642
|
]),
|
|
1572
1643
|
_: 1
|
|
1573
|
-
})) : createCommentVNode("", true),
|
|
1644
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
1574
1645
|
_hoisted_5,
|
|
1575
1646
|
__props.enableToggleMode && !isFullscreen.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1576
1647
|
key: 1,
|
|
@@ -1598,32 +1669,35 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1598
1669
|
}, 8, ["icon"])) : createCommentVNode("", true),
|
|
1599
1670
|
unref(importable) ? (openBlock(), createBlock(unref(TMagicUpload), {
|
|
1600
1671
|
key: 3,
|
|
1672
|
+
style: { "display": "inline-block" },
|
|
1601
1673
|
ref_key: "excelBtn",
|
|
1602
1674
|
ref: excelBtn,
|
|
1603
1675
|
action: "/noop",
|
|
1676
|
+
disabled: __props.disabled,
|
|
1604
1677
|
"on-change": excelHandler,
|
|
1605
|
-
"auto-upload": false
|
|
1606
|
-
style: { "display": "inline-block" }
|
|
1678
|
+
"auto-upload": false
|
|
1607
1679
|
}, {
|
|
1608
1680
|
default: withCtx(() => [
|
|
1609
1681
|
createVNode(unref(TMagicButton), {
|
|
1610
1682
|
size: "small",
|
|
1611
1683
|
type: "success",
|
|
1684
|
+
disabled: __props.disabled,
|
|
1612
1685
|
plain: ""
|
|
1613
1686
|
}, {
|
|
1614
1687
|
default: withCtx(() => [
|
|
1615
1688
|
_hoisted_7
|
|
1616
1689
|
]),
|
|
1617
1690
|
_: 1
|
|
1618
|
-
})
|
|
1691
|
+
}, 8, ["disabled"])
|
|
1619
1692
|
]),
|
|
1620
1693
|
_: 1
|
|
1621
|
-
},
|
|
1694
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
1622
1695
|
_hoisted_8,
|
|
1623
1696
|
unref(importable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
1624
1697
|
key: 4,
|
|
1625
1698
|
size: "small",
|
|
1626
1699
|
type: "warning",
|
|
1700
|
+
disabled: __props.disabled,
|
|
1627
1701
|
plain: "",
|
|
1628
1702
|
onClick: _cache[2] || (_cache[2] = ($event) => clearHandler())
|
|
1629
1703
|
}, {
|
|
@@ -1631,9 +1705,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1631
1705
|
_hoisted_9
|
|
1632
1706
|
]),
|
|
1633
1707
|
_: 1
|
|
1634
|
-
})) : createCommentVNode("", true)
|
|
1708
|
+
}, 8, ["disabled"])) : createCommentVNode("", true)
|
|
1635
1709
|
]),
|
|
1636
|
-
|
|
1710
|
+
__props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
1637
1711
|
createVNode(unref(TMagicPagination), {
|
|
1638
1712
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
1639
1713
|
"hide-on-single-page": __props.model[unref(modelName)].length < pagesize.value,
|
|
@@ -1644,14 +1718,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
1644
1718
|
onSizeChange: handleSizeChange,
|
|
1645
1719
|
onCurrentChange: handleCurrentChange
|
|
1646
1720
|
}, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
|
|
1647
|
-
])
|
|
1721
|
+
])) : createCommentVNode("", true)
|
|
1648
1722
|
], 2);
|
|
1649
1723
|
};
|
|
1650
1724
|
}
|
|
1651
1725
|
});
|
|
1652
1726
|
|
|
1727
|
+
const __default__$m = defineComponent({
|
|
1728
|
+
name: "MFormTabs"
|
|
1729
|
+
});
|
|
1653
1730
|
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
1654
|
-
|
|
1731
|
+
...__default__$m,
|
|
1655
1732
|
props: {
|
|
1656
1733
|
model: null,
|
|
1657
1734
|
config: null,
|
|
@@ -1659,11 +1736,13 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1659
1736
|
size: null,
|
|
1660
1737
|
labelWidth: null,
|
|
1661
1738
|
prop: null,
|
|
1662
|
-
expandMore: { type: Boolean }
|
|
1739
|
+
expandMore: { type: Boolean },
|
|
1740
|
+
disabled: { type: Boolean }
|
|
1663
1741
|
},
|
|
1664
1742
|
emits: ["change"],
|
|
1665
1743
|
setup(__props, { emit }) {
|
|
1666
1744
|
const props = __props;
|
|
1745
|
+
const uiComponent = getConfig$1("components").tabPane;
|
|
1667
1746
|
const getActive = (mForm2, props2, activeTabName2) => {
|
|
1668
1747
|
const { config, model, prop } = props2;
|
|
1669
1748
|
const { active } = config;
|
|
@@ -1765,7 +1844,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1765
1844
|
default: withCtx(() => [
|
|
1766
1845
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(tabs), (tab, tabIndex) => {
|
|
1767
1846
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1768
|
-
display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(unref(
|
|
1847
|
+
display$1(tab.display) && tabItems(tab).length ? (openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
|
|
1769
1848
|
key: tab[unref(mForm)?.keyProp || "__key"] ?? tabIndex,
|
|
1770
1849
|
name: filter(tab.status) || tabIndex.toString(),
|
|
1771
1850
|
label: filter(tab.title),
|
|
@@ -1776,13 +1855,14 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
1776
1855
|
return openBlock(), createBlock(_sfc_main$v, {
|
|
1777
1856
|
key: item[unref(mForm)?.keyProp || "__key"],
|
|
1778
1857
|
config: item,
|
|
1858
|
+
disabled: __props.disabled,
|
|
1779
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,
|
|
1780
1860
|
prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
|
|
1781
1861
|
size: __props.size,
|
|
1782
1862
|
"label-width": tab.labelWidth || __props.labelWidth,
|
|
1783
1863
|
"expand-more": __props.expandMore,
|
|
1784
1864
|
onChange: changeHandler
|
|
1785
|
-
}, null, 8, ["config", "model", "prop", "size", "label-width", "expand-more"]);
|
|
1865
|
+
}, null, 8, ["config", "disabled", "model", "prop", "size", "label-width", "expand-more"]);
|
|
1786
1866
|
}), 128))
|
|
1787
1867
|
]),
|
|
1788
1868
|
_: 2
|
|
@@ -1822,8 +1902,11 @@ const useAddField = (prop) => {
|
|
|
1822
1902
|
);
|
|
1823
1903
|
};
|
|
1824
1904
|
|
|
1905
|
+
const __default__$l = defineComponent({
|
|
1906
|
+
name: "MFormCascader"
|
|
1907
|
+
});
|
|
1825
1908
|
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
1826
|
-
|
|
1909
|
+
...__default__$l,
|
|
1827
1910
|
props: {
|
|
1828
1911
|
config: null,
|
|
1829
1912
|
model: null,
|
|
@@ -1906,8 +1989,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
1906
1989
|
}
|
|
1907
1990
|
});
|
|
1908
1991
|
|
|
1992
|
+
const __default__$k = defineComponent({
|
|
1993
|
+
name: "MFormCheckbox"
|
|
1994
|
+
});
|
|
1909
1995
|
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
1910
|
-
|
|
1996
|
+
...__default__$k,
|
|
1911
1997
|
props: {
|
|
1912
1998
|
config: null,
|
|
1913
1999
|
model: null,
|
|
@@ -1964,8 +2050,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
1964
2050
|
}
|
|
1965
2051
|
});
|
|
1966
2052
|
|
|
2053
|
+
const __default__$j = defineComponent({
|
|
2054
|
+
name: "MFormCheckGroup"
|
|
2055
|
+
});
|
|
1967
2056
|
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
1968
|
-
|
|
2057
|
+
...__default__$j,
|
|
1969
2058
|
props: {
|
|
1970
2059
|
config: null,
|
|
1971
2060
|
model: null,
|
|
@@ -2006,6 +2095,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2006
2095
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(options), (option) => {
|
|
2007
2096
|
return openBlock(), createBlock(unref(TMagicCheckbox), {
|
|
2008
2097
|
label: option.value,
|
|
2098
|
+
value: option.value,
|
|
2009
2099
|
key: option.value,
|
|
2010
2100
|
disabled: option.disabled
|
|
2011
2101
|
}, {
|
|
@@ -2013,7 +2103,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2013
2103
|
createTextVNode(toDisplayString(option.text), 1)
|
|
2014
2104
|
]),
|
|
2015
2105
|
_: 2
|
|
2016
|
-
}, 1032, ["label", "disabled"]);
|
|
2106
|
+
}, 1032, ["label", "value", "disabled"]);
|
|
2017
2107
|
}), 128))
|
|
2018
2108
|
]),
|
|
2019
2109
|
_: 1
|
|
@@ -2022,8 +2112,11 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2022
2112
|
}
|
|
2023
2113
|
});
|
|
2024
2114
|
|
|
2115
|
+
const __default__$i = defineComponent({
|
|
2116
|
+
name: "MFormColorPicker"
|
|
2117
|
+
});
|
|
2025
2118
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2026
|
-
|
|
2119
|
+
...__default__$i,
|
|
2027
2120
|
props: {
|
|
2028
2121
|
config: null,
|
|
2029
2122
|
model: null,
|
|
@@ -2052,8 +2145,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2052
2145
|
}
|
|
2053
2146
|
});
|
|
2054
2147
|
|
|
2148
|
+
const __default__$h = defineComponent({
|
|
2149
|
+
name: "MFormDate"
|
|
2150
|
+
});
|
|
2055
2151
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2056
|
-
|
|
2152
|
+
...__default__$h,
|
|
2057
2153
|
props: {
|
|
2058
2154
|
config: null,
|
|
2059
2155
|
model: null,
|
|
@@ -2081,15 +2177,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2081
2177
|
placeholder: __props.config.placeholder,
|
|
2082
2178
|
disabled: __props.disabled,
|
|
2083
2179
|
format: __props.config.format,
|
|
2084
|
-
"value-format": __props.config.
|
|
2180
|
+
"value-format": __props.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
|
|
2085
2181
|
onChange: changeHandler
|
|
2086
2182
|
}, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
|
|
2087
2183
|
};
|
|
2088
2184
|
}
|
|
2089
2185
|
});
|
|
2090
2186
|
|
|
2187
|
+
const __default__$g = defineComponent({
|
|
2188
|
+
name: "MFormDateRange"
|
|
2189
|
+
});
|
|
2091
2190
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
2092
|
-
|
|
2191
|
+
...__default__$g,
|
|
2093
2192
|
props: {
|
|
2094
2193
|
config: null,
|
|
2095
2194
|
model: null,
|
|
@@ -2186,8 +2285,11 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
2186
2285
|
}
|
|
2187
2286
|
});
|
|
2188
2287
|
|
|
2288
|
+
const __default__$f = defineComponent({
|
|
2289
|
+
name: "MFormDateTime"
|
|
2290
|
+
});
|
|
2189
2291
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
2190
|
-
|
|
2292
|
+
...__default__$f,
|
|
2191
2293
|
props: {
|
|
2192
2294
|
config: null,
|
|
2193
2295
|
model: null,
|
|
@@ -2232,8 +2334,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2232
2334
|
});
|
|
2233
2335
|
|
|
2234
2336
|
const _hoisted_1$5 = { key: 0 };
|
|
2337
|
+
const __default__$e = defineComponent({
|
|
2338
|
+
name: "MFormDisplay"
|
|
2339
|
+
});
|
|
2235
2340
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2236
|
-
|
|
2341
|
+
...__default__$e,
|
|
2237
2342
|
props: {
|
|
2238
2343
|
config: null,
|
|
2239
2344
|
model: null,
|
|
@@ -2255,8 +2360,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2255
2360
|
});
|
|
2256
2361
|
|
|
2257
2362
|
const _hoisted_1$4 = { class: "m-fields-dynamic-field" };
|
|
2363
|
+
const __default__$d = defineComponent({
|
|
2364
|
+
name: "MFormDynamicField"
|
|
2365
|
+
});
|
|
2258
2366
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
2259
|
-
|
|
2367
|
+
...__default__$d,
|
|
2260
2368
|
props: {
|
|
2261
2369
|
config: null,
|
|
2262
2370
|
model: null,
|
|
@@ -2343,8 +2451,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
2343
2451
|
}
|
|
2344
2452
|
});
|
|
2345
2453
|
|
|
2454
|
+
const __default__$c = defineComponent({
|
|
2455
|
+
name: "MFormHidden"
|
|
2456
|
+
});
|
|
2346
2457
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
2347
|
-
|
|
2458
|
+
...__default__$c,
|
|
2348
2459
|
props: {
|
|
2349
2460
|
config: null,
|
|
2350
2461
|
model: null,
|
|
@@ -2368,8 +2479,11 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
2368
2479
|
}
|
|
2369
2480
|
});
|
|
2370
2481
|
|
|
2482
|
+
const __default__$b = defineComponent({
|
|
2483
|
+
name: "MForm"
|
|
2484
|
+
});
|
|
2371
2485
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
2372
|
-
|
|
2486
|
+
...__default__$b,
|
|
2373
2487
|
props: {
|
|
2374
2488
|
config: { default: () => [] },
|
|
2375
2489
|
initValues: { default: () => ({}) },
|
|
@@ -2473,7 +2587,6 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2473
2587
|
ref: tMagicForm,
|
|
2474
2588
|
model: values.value,
|
|
2475
2589
|
"label-width": __props.labelWidth,
|
|
2476
|
-
disabled: __props.disabled,
|
|
2477
2590
|
style: normalizeStyle(`height: ${__props.height}`),
|
|
2478
2591
|
inline: __props.inline,
|
|
2479
2592
|
"label-position": __props.labelPosition
|
|
@@ -2481,6 +2594,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2481
2594
|
default: withCtx(() => [
|
|
2482
2595
|
initialized.value && Array.isArray(__props.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.config, (item, index) => {
|
|
2483
2596
|
return openBlock(), createBlock(_sfc_main$v, {
|
|
2597
|
+
disabled: __props.disabled,
|
|
2484
2598
|
key: item[__props.keyProp] ?? index,
|
|
2485
2599
|
config: item,
|
|
2486
2600
|
model: values.value,
|
|
@@ -2488,11 +2602,11 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
2488
2602
|
"step-active": __props.stepActive,
|
|
2489
2603
|
size: __props.size,
|
|
2490
2604
|
onChange: changeHandler
|
|
2491
|
-
}, null, 8, ["config", "model", "label-width", "step-active", "size"]);
|
|
2605
|
+
}, null, 8, ["disabled", "config", "model", "label-width", "step-active", "size"]);
|
|
2492
2606
|
}), 128)) : createCommentVNode("", true)
|
|
2493
2607
|
]),
|
|
2494
2608
|
_: 1
|
|
2495
|
-
}, 8, ["model", "label-width", "
|
|
2609
|
+
}, 8, ["model", "label-width", "style", "inline", "label-position"]);
|
|
2496
2610
|
};
|
|
2497
2611
|
}
|
|
2498
2612
|
});
|
|
@@ -2501,8 +2615,11 @@ const _hoisted_1$3 = { style: { "min-height": "1px" } };
|
|
|
2501
2615
|
const _hoisted_2$1 = /* @__PURE__ */ createTextVNode("\u53D6 \u6D88");
|
|
2502
2616
|
const _hoisted_3$1 = /* @__PURE__ */ createTextVNode("\u4E0A\u4E00\u6B65");
|
|
2503
2617
|
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u4E0B\u4E00\u6B65");
|
|
2618
|
+
const __default__$a = defineComponent({
|
|
2619
|
+
name: "MFormDialog"
|
|
2620
|
+
});
|
|
2504
2621
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2505
|
-
|
|
2622
|
+
...__default__$a,
|
|
2506
2623
|
props: {
|
|
2507
2624
|
config: { default: () => [] },
|
|
2508
2625
|
values: { default: () => ({}) },
|
|
@@ -2510,6 +2627,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2510
2627
|
width: null,
|
|
2511
2628
|
labelWidth: null,
|
|
2512
2629
|
fullscreen: { type: Boolean },
|
|
2630
|
+
disabled: { type: Boolean },
|
|
2513
2631
|
title: null,
|
|
2514
2632
|
zIndex: null,
|
|
2515
2633
|
size: null,
|
|
@@ -2665,12 +2783,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
2665
2783
|
ref_key: "form",
|
|
2666
2784
|
ref: form,
|
|
2667
2785
|
size: __props.size,
|
|
2786
|
+
disabled: __props.disabled,
|
|
2668
2787
|
config: __props.config,
|
|
2669
2788
|
"init-values": __props.values,
|
|
2670
2789
|
"parent-values": __props.parentValues,
|
|
2671
2790
|
"label-width": __props.labelWidth,
|
|
2672
2791
|
onChange: changeHandler
|
|
2673
|
-
}, null, 8, ["modelValue", "size", "config", "init-values", "parent-values", "label-width"]),
|
|
2792
|
+
}, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width"]),
|
|
2674
2793
|
renderSlot(_ctx.$slots, "default")
|
|
2675
2794
|
], 4)) : createCommentVNode("", true)
|
|
2676
2795
|
]),
|
|
@@ -2686,8 +2805,11 @@ const _hoisted_2 = {
|
|
|
2686
2805
|
class: "m-fields-link"
|
|
2687
2806
|
};
|
|
2688
2807
|
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u70B9\u51FB\u7F16\u8F91");
|
|
2808
|
+
const __default__$9 = defineComponent({
|
|
2809
|
+
name: "MFormLink"
|
|
2810
|
+
});
|
|
2689
2811
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
2690
|
-
|
|
2812
|
+
...__default__$9,
|
|
2691
2813
|
props: {
|
|
2692
2814
|
config: null,
|
|
2693
2815
|
model: null,
|
|
@@ -2780,8 +2902,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
2780
2902
|
}
|
|
2781
2903
|
});
|
|
2782
2904
|
|
|
2905
|
+
const __default__$8 = defineComponent({
|
|
2906
|
+
name: "MFormNumber"
|
|
2907
|
+
});
|
|
2783
2908
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
2784
|
-
|
|
2909
|
+
...__default__$8,
|
|
2785
2910
|
props: {
|
|
2786
2911
|
config: null,
|
|
2787
2912
|
model: null,
|
|
@@ -2824,8 +2949,11 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
2824
2949
|
}
|
|
2825
2950
|
});
|
|
2826
2951
|
|
|
2952
|
+
const __default__$7 = defineComponent({
|
|
2953
|
+
name: "MFormRadioGroup"
|
|
2954
|
+
});
|
|
2827
2955
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2828
|
-
|
|
2956
|
+
...__default__$7,
|
|
2829
2957
|
props: {
|
|
2830
2958
|
config: null,
|
|
2831
2959
|
model: null,
|
|
@@ -2856,13 +2984,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2856
2984
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.config.options, (option) => {
|
|
2857
2985
|
return openBlock(), createBlock(unref(TMagicRadio), {
|
|
2858
2986
|
label: option.value,
|
|
2987
|
+
value: option.value,
|
|
2859
2988
|
key: `${option.value}`
|
|
2860
2989
|
}, {
|
|
2861
2990
|
default: withCtx(() => [
|
|
2862
2991
|
createTextVNode(toDisplayString(option.text), 1)
|
|
2863
2992
|
]),
|
|
2864
2993
|
_: 2
|
|
2865
|
-
}, 1032, ["label"]);
|
|
2994
|
+
}, 1032, ["label", "value"]);
|
|
2866
2995
|
}), 128))
|
|
2867
2996
|
]),
|
|
2868
2997
|
_: 1
|
|
@@ -2871,8 +3000,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
2871
3000
|
}
|
|
2872
3001
|
});
|
|
2873
3002
|
|
|
3003
|
+
const __default__$6 = defineComponent({
|
|
3004
|
+
name: "MFormSelectOptionGroups"
|
|
3005
|
+
});
|
|
2874
3006
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2875
|
-
|
|
3007
|
+
...__default__$6,
|
|
2876
3008
|
props: {
|
|
2877
3009
|
options: null
|
|
2878
3010
|
},
|
|
@@ -2902,8 +3034,11 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
2902
3034
|
}
|
|
2903
3035
|
});
|
|
2904
3036
|
|
|
3037
|
+
const __default__$5 = defineComponent({
|
|
3038
|
+
name: "MFormSelectOptions"
|
|
3039
|
+
});
|
|
2905
3040
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2906
|
-
|
|
3041
|
+
...__default__$5,
|
|
2907
3042
|
props: {
|
|
2908
3043
|
options: null,
|
|
2909
3044
|
valueKey: null
|
|
@@ -2923,8 +3058,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
2923
3058
|
});
|
|
2924
3059
|
|
|
2925
3060
|
const _hoisted_1$1 = { key: 2 };
|
|
3061
|
+
const __default__$4 = defineComponent({
|
|
3062
|
+
name: "MFormSelect"
|
|
3063
|
+
});
|
|
2926
3064
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2927
|
-
|
|
3065
|
+
...__default__$4,
|
|
2928
3066
|
props: {
|
|
2929
3067
|
config: null,
|
|
2930
3068
|
model: null,
|
|
@@ -2979,30 +3117,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
2979
3117
|
let items = [];
|
|
2980
3118
|
const { config } = props;
|
|
2981
3119
|
const { option } = config;
|
|
2982
|
-
|
|
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
|
+
}
|
|
2983
3125
|
let postOptions = {
|
|
2984
3126
|
method: option.method || "POST",
|
|
2985
|
-
url
|
|
3127
|
+
url,
|
|
2986
3128
|
cache: option.cache,
|
|
2987
3129
|
timeout: option.timeout,
|
|
2988
3130
|
mode: option.mode,
|
|
2989
3131
|
headers: option.headers || {},
|
|
2990
3132
|
json: option.json || false
|
|
2991
3133
|
};
|
|
2992
|
-
if (body) {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
});
|
|
3000
|
-
}
|
|
3001
|
-
body.query = query.value;
|
|
3002
|
-
body.pgSize = pgSize.value;
|
|
3003
|
-
body.pgIndex = pgIndex.value;
|
|
3004
|
-
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
|
+
});
|
|
3005
3141
|
}
|
|
3142
|
+
body.query = query.value;
|
|
3143
|
+
body.pgSize = pgSize.value;
|
|
3144
|
+
body.pgIndex = pgIndex.value;
|
|
3145
|
+
postOptions.data = body;
|
|
3006
3146
|
const requestFuc = getConfig("request");
|
|
3007
3147
|
if (typeof option.beforeRequest === "function") {
|
|
3008
3148
|
postOptions = option.beforeRequest(mForm, postOptions, {
|
|
@@ -3022,9 +3162,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3022
3162
|
config: props.config
|
|
3023
3163
|
});
|
|
3024
3164
|
}
|
|
3025
|
-
const optionsData =
|
|
3026
|
-
|
|
3027
|
-
|
|
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;
|
|
3028
3172
|
}
|
|
3029
3173
|
remoteData.value = remoteData.value.concat(optionsData);
|
|
3030
3174
|
if (optionsData) {
|
|
@@ -3073,6 +3217,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3073
3217
|
return [];
|
|
3074
3218
|
const { config } = props;
|
|
3075
3219
|
const { option } = config;
|
|
3220
|
+
const { root = "", initRoot = "" } = option;
|
|
3221
|
+
let { initBody = {} } = option;
|
|
3076
3222
|
let options2 = [];
|
|
3077
3223
|
let url = option.initUrl;
|
|
3078
3224
|
if (!url) {
|
|
@@ -3081,22 +3227,45 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3081
3227
|
if (typeof url === "function") {
|
|
3082
3228
|
url = await url(mForm, { model: props.model, formValue: mForm?.values });
|
|
3083
3229
|
}
|
|
3084
|
-
|
|
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 = {
|
|
3085
3239
|
method: option.method || "POST",
|
|
3086
3240
|
url,
|
|
3087
3241
|
data: {
|
|
3088
|
-
id: props.model[props.name]
|
|
3242
|
+
id: props.model[props.name],
|
|
3243
|
+
...initBody
|
|
3089
3244
|
},
|
|
3090
3245
|
mode: option.mode,
|
|
3091
3246
|
headers: option.headers || {},
|
|
3092
3247
|
json: option.json || false
|
|
3093
3248
|
};
|
|
3249
|
+
if (typeof option.beforeInitRequest === "function") {
|
|
3250
|
+
postOptions = option.beforeInitRequest(mForm, postOptions, {
|
|
3251
|
+
model: props.model,
|
|
3252
|
+
formValue: mForm?.values
|
|
3253
|
+
});
|
|
3254
|
+
}
|
|
3094
3255
|
if (option.method?.toLocaleLowerCase() === "jsonp") {
|
|
3095
3256
|
postOptions.jsonpCallback = option.jsonpCallback || "callback";
|
|
3096
3257
|
}
|
|
3097
3258
|
const requestFuc = getConfig("request");
|
|
3098
|
-
|
|
3099
|
-
|
|
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);
|
|
3100
3269
|
if (initData) {
|
|
3101
3270
|
if (!Array.isArray(initData)) {
|
|
3102
3271
|
initData = [initData];
|
|
@@ -3231,8 +3400,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3231
3400
|
}
|
|
3232
3401
|
});
|
|
3233
3402
|
|
|
3403
|
+
const __default__$3 = defineComponent({
|
|
3404
|
+
name: "MFormSwitch"
|
|
3405
|
+
});
|
|
3234
3406
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3235
|
-
|
|
3407
|
+
...__default__$3,
|
|
3236
3408
|
props: {
|
|
3237
3409
|
config: null,
|
|
3238
3410
|
model: null,
|
|
@@ -3285,8 +3457,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3285
3457
|
});
|
|
3286
3458
|
|
|
3287
3459
|
const _hoisted_1 = { key: 0 };
|
|
3460
|
+
const __default__$2 = defineComponent({
|
|
3461
|
+
name: "MFormText"
|
|
3462
|
+
});
|
|
3288
3463
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3289
|
-
|
|
3464
|
+
...__default__$2,
|
|
3290
3465
|
props: {
|
|
3291
3466
|
config: null,
|
|
3292
3467
|
model: null,
|
|
@@ -3405,8 +3580,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3405
3580
|
}
|
|
3406
3581
|
});
|
|
3407
3582
|
|
|
3583
|
+
const __default__$1 = defineComponent({
|
|
3584
|
+
name: "MFormTextarea"
|
|
3585
|
+
});
|
|
3408
3586
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3409
|
-
|
|
3587
|
+
...__default__$1,
|
|
3410
3588
|
props: {
|
|
3411
3589
|
config: null,
|
|
3412
3590
|
model: null,
|
|
@@ -3445,8 +3623,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3445
3623
|
}
|
|
3446
3624
|
});
|
|
3447
3625
|
|
|
3626
|
+
const __default__ = defineComponent({
|
|
3627
|
+
name: "MFormTime"
|
|
3628
|
+
});
|
|
3448
3629
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3449
|
-
|
|
3630
|
+
...__default__,
|
|
3450
3631
|
props: {
|
|
3451
3632
|
config: null,
|
|
3452
3633
|
model: null,
|
|
@@ -3468,11 +3649,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3468
3649
|
return openBlock(), createBlock(unref(TMagicTimePicker), {
|
|
3469
3650
|
modelValue: __props.model[__props.name],
|
|
3470
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",
|
|
3471
3654
|
size: __props.size,
|
|
3472
3655
|
placeholder: __props.config.placeholder,
|
|
3473
3656
|
disabled: __props.disabled,
|
|
3474
3657
|
onChange: changeHandler
|
|
3475
|
-
}, null, 8, ["modelValue", "size", "placeholder", "disabled"]);
|
|
3658
|
+
}, null, 8, ["modelValue", "value-format", "format", "size", "placeholder", "disabled"]);
|
|
3476
3659
|
};
|
|
3477
3660
|
}
|
|
3478
3661
|
});
|
|
@@ -3517,5 +3700,5 @@ const index = {
|
|
|
3517
3700
|
install
|
|
3518
3701
|
};
|
|
3519
3702
|
|
|
3520
|
-
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 };
|
|
3521
|
-
//# 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
|