@tmagic/form 1.4.0-beta.1 → 1.4.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 +3 -8
- package/dist/tmagic-form.js +123 -111
- package/dist/tmagic-form.umd.cjs +122 -110
- package/package.json +3 -3
- package/src/FormBox.vue +48 -34
- package/src/containers/Fieldset.vue +2 -2
- package/src/containers/GroupListItem.vue +3 -3
- package/src/theme/form-box.scss +3 -8
- package/types/FormBox.vue.d.ts +4 -3
package/dist/style.css
CHANGED
|
@@ -221,17 +221,12 @@ fieldset.m-fieldset .m-form-tip {
|
|
|
221
221
|
.m-form-box {
|
|
222
222
|
display: flex;
|
|
223
223
|
flex-direction: column;
|
|
224
|
-
padding: 16px;
|
|
225
|
-
box-sizing: border-box;
|
|
226
224
|
}
|
|
227
225
|
.m-form-box .el-box__header {
|
|
228
226
|
margin: 0;
|
|
229
227
|
}
|
|
230
|
-
.m-form-box .m-box-body {
|
|
231
|
-
flex: 1;
|
|
232
|
-
overflow-y: auto;
|
|
233
|
-
overflow-x: hidden;
|
|
234
|
-
}
|
|
235
228
|
.m-form-box .dialog-footer {
|
|
236
|
-
|
|
229
|
+
display: flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: space-between;
|
|
237
232
|
}
|
package/dist/tmagic-form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, 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
3
|
import { cloneDeep, isEqual, isEmpty } from 'lodash-es';
|
|
4
|
-
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer } from '@tmagic/design';
|
|
4
|
+
import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
6
6
|
import { sleep, asyncLoadJs, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
|
|
7
7
|
|
|
@@ -166,8 +166,8 @@ const initValue = async (mForm, { initValues, config }) => {
|
|
|
166
166
|
return valuesTmp || {};
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
const _hoisted_1$
|
|
170
|
-
const _hoisted_2$
|
|
169
|
+
const _hoisted_1$d = ["id", "data-magic-id"];
|
|
170
|
+
const _hoisted_2$8 = ["innerHTML", "title"];
|
|
171
171
|
const _hoisted_3$5 = ["innerHTML"];
|
|
172
172
|
const _hoisted_4$4 = ["innerHTML"];
|
|
173
173
|
const _hoisted_5$4 = ["innerHTML"];
|
|
@@ -373,7 +373,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
373
373
|
createElementVNode("span", {
|
|
374
374
|
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
375
375
|
title: _ctx.config.labelTitle
|
|
376
|
-
}, null, 8, _hoisted_2$
|
|
376
|
+
}, null, 8, _hoisted_2$8)
|
|
377
377
|
]),
|
|
378
378
|
default: withCtx(() => [
|
|
379
379
|
tooltip.value ? (openBlock(), createBlock(unref(TMagicTooltip), { key: 0 }, {
|
|
@@ -604,13 +604,13 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
604
604
|
_: 1
|
|
605
605
|
})
|
|
606
606
|
])) : createCommentVNode("", true)
|
|
607
|
-
], 14, _hoisted_1$
|
|
607
|
+
], 14, _hoisted_1$d)) : createCommentVNode("", true);
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
610
|
});
|
|
611
611
|
|
|
612
|
-
const _hoisted_1$
|
|
613
|
-
const _hoisted_2$
|
|
612
|
+
const _hoisted_1$c = ["innerHTML"];
|
|
613
|
+
const _hoisted_2$7 = ["innerHTML"];
|
|
614
614
|
const _hoisted_3$4 = { key: 1 };
|
|
615
615
|
const _hoisted_4$3 = ["innerHTML"];
|
|
616
616
|
const _hoisted_5$3 = ["innerHTML"];
|
|
@@ -674,18 +674,18 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
674
674
|
change
|
|
675
675
|
],
|
|
676
676
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
|
|
677
|
-
"true-
|
|
678
|
-
"false-
|
|
677
|
+
"true-value": 1,
|
|
678
|
+
"false-value": 0
|
|
679
679
|
}, {
|
|
680
680
|
default: withCtx(() => [
|
|
681
681
|
createElementVNode("span", {
|
|
682
682
|
innerHTML: _ctx.config.legend
|
|
683
|
-
}, null, 8, _hoisted_1$
|
|
683
|
+
}, null, 8, _hoisted_1$c),
|
|
684
684
|
_ctx.config.extra ? (openBlock(), createElementBlock("span", {
|
|
685
685
|
key: 0,
|
|
686
686
|
innerHTML: _ctx.config.extra,
|
|
687
687
|
class: "m-form-tip"
|
|
688
|
-
}, null, 8, _hoisted_2$
|
|
688
|
+
}, null, 8, _hoisted_2$7)) : createCommentVNode("", true)
|
|
689
689
|
]),
|
|
690
690
|
_: 1
|
|
691
691
|
}, 8, ["modelValue", "prop"])
|
|
@@ -745,8 +745,8 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
747
|
|
|
748
|
-
const _hoisted_1$
|
|
749
|
-
const _hoisted_2$
|
|
748
|
+
const _hoisted_1$b = { class: "m-fields-group-list-item" };
|
|
749
|
+
const _hoisted_2$6 = ["innerHTML"];
|
|
750
750
|
const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
751
751
|
...{
|
|
752
752
|
name: "MFormGroupListItem"
|
|
@@ -813,19 +813,24 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
813
813
|
};
|
|
814
814
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
815
815
|
return (_ctx, _cache) => {
|
|
816
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
816
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
817
817
|
createElementVNode("div", null, [
|
|
818
818
|
createVNode(unref(TMagicButton), {
|
|
819
819
|
link: "",
|
|
820
820
|
disabled: _ctx.disabled,
|
|
821
|
-
icon: expand.value ? unref(CaretBottom) : unref(CaretRight),
|
|
822
821
|
onClick: expandHandler
|
|
823
822
|
}, {
|
|
824
823
|
default: withCtx(() => [
|
|
824
|
+
createVNode(unref(TMagicIcon), null, {
|
|
825
|
+
default: withCtx(() => [
|
|
826
|
+
expand.value ? (openBlock(), createBlock(unref(CaretBottom), { key: 0 })) : (openBlock(), createBlock(unref(CaretRight), { key: 1 }))
|
|
827
|
+
]),
|
|
828
|
+
_: 1
|
|
829
|
+
}),
|
|
825
830
|
createTextVNode(toDisplayString(title.value), 1)
|
|
826
831
|
]),
|
|
827
832
|
_: 1
|
|
828
|
-
}, 8, ["disabled"
|
|
833
|
+
}, 8, ["disabled"]),
|
|
829
834
|
withDirectives(createVNode(unref(TMagicButton), {
|
|
830
835
|
style: { "color": "#f56c6c" },
|
|
831
836
|
link: "",
|
|
@@ -879,7 +884,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
879
884
|
key: 1,
|
|
880
885
|
innerHTML: itemExtra.value,
|
|
881
886
|
class: "m-form-tip"
|
|
882
|
-
}, null, 8, _hoisted_2$
|
|
887
|
+
}, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
|
|
883
888
|
]),
|
|
884
889
|
expand.value ? (openBlock(), createBlock(_sfc_main$z, {
|
|
885
890
|
key: 0,
|
|
@@ -899,8 +904,8 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
899
904
|
}
|
|
900
905
|
});
|
|
901
906
|
|
|
902
|
-
const _hoisted_1$
|
|
903
|
-
const _hoisted_2$
|
|
907
|
+
const _hoisted_1$a = { class: "m-fields-group-list" };
|
|
908
|
+
const _hoisted_2$5 = ["innerHTML"];
|
|
904
909
|
const _hoisted_3$3 = {
|
|
905
910
|
key: 1,
|
|
906
911
|
class: "el-table__empty-block"
|
|
@@ -993,12 +998,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
993
998
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
994
999
|
const getLastValues = (item, index) => item?.[index] || {};
|
|
995
1000
|
return (_ctx, _cache) => {
|
|
996
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1001
|
+
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
997
1002
|
_ctx.config.extra ? (openBlock(), createElementBlock("div", {
|
|
998
1003
|
key: 0,
|
|
999
1004
|
innerHTML: _ctx.config.extra,
|
|
1000
1005
|
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
1001
|
-
}, null, 8, _hoisted_2$
|
|
1006
|
+
}, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
|
|
1002
1007
|
!_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
|
|
1003
1008
|
return openBlock(), createBlock(_sfc_main$x, {
|
|
1004
1009
|
key: index,
|
|
@@ -1045,8 +1050,8 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1045
1050
|
}
|
|
1046
1051
|
});
|
|
1047
1052
|
|
|
1048
|
-
const _hoisted_1$
|
|
1049
|
-
const _hoisted_2$
|
|
1053
|
+
const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
1054
|
+
const _hoisted_2$4 = ["innerHTML"];
|
|
1050
1055
|
const _hoisted_3$2 = {
|
|
1051
1056
|
key: 0,
|
|
1052
1057
|
style: { "display": "flex" }
|
|
@@ -1086,7 +1091,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1086
1091
|
"body-style": { display: expand.value ? "block" : "none" }
|
|
1087
1092
|
}, {
|
|
1088
1093
|
header: withCtx(() => [
|
|
1089
|
-
createElementVNode("div", _hoisted_1$
|
|
1094
|
+
createElementVNode("div", _hoisted_1$9, [
|
|
1090
1095
|
createVNode(unref(TMagicButton), {
|
|
1091
1096
|
style: { "padding": "0" },
|
|
1092
1097
|
link: "",
|
|
@@ -1097,7 +1102,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
|
|
|
1097
1102
|
key: 0,
|
|
1098
1103
|
innerHTML: _ctx.config.extra,
|
|
1099
1104
|
class: "m-form-tip"
|
|
1100
|
-
}, null, 8, _hoisted_2$
|
|
1105
|
+
}, null, 8, _hoisted_2$4)) : createCommentVNode("", true),
|
|
1101
1106
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1102
1107
|
createTextVNode(toDisplayString(filter(_ctx.config.title)), 1)
|
|
1103
1108
|
])
|
|
@@ -1331,8 +1336,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
1331
1336
|
}
|
|
1332
1337
|
});
|
|
1333
1338
|
|
|
1334
|
-
const _hoisted_1$
|
|
1335
|
-
const _hoisted_2$
|
|
1339
|
+
const _hoisted_1$8 = { class: "m-fields-table-wrap" };
|
|
1340
|
+
const _hoisted_2$3 = ["innerHTML"];
|
|
1336
1341
|
const _hoisted_3$1 = ["innerHTML"];
|
|
1337
1342
|
const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
1338
1343
|
const _hoisted_5 = { style: { "display": "flex" } };
|
|
@@ -1701,7 +1706,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
1701
1706
|
toggleRowSelection
|
|
1702
1707
|
});
|
|
1703
1708
|
return (_ctx, _cache) => {
|
|
1704
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1709
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
1705
1710
|
(openBlock(), createBlock(Teleport, {
|
|
1706
1711
|
to: "body",
|
|
1707
1712
|
disabled: !isFullscreen.value
|
|
@@ -1715,7 +1720,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
1715
1720
|
key: 0,
|
|
1716
1721
|
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
1717
1722
|
innerHTML: _ctx.config.extra
|
|
1718
|
-
}, null, 8, _hoisted_2$
|
|
1723
|
+
}, null, 8, _hoisted_2$3)) : createCommentVNode("", true),
|
|
1719
1724
|
createVNode(unref(TMagicTooltip), {
|
|
1720
1725
|
content: "拖拽可排序",
|
|
1721
1726
|
placement: "left-start",
|
|
@@ -2633,7 +2638,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
2633
2638
|
}
|
|
2634
2639
|
});
|
|
2635
2640
|
|
|
2636
|
-
const _hoisted_1$
|
|
2641
|
+
const _hoisted_1$7 = { key: 0 };
|
|
2637
2642
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2638
2643
|
...{
|
|
2639
2644
|
name: "MFormDisplay"
|
|
@@ -2657,12 +2662,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2657
2662
|
}
|
|
2658
2663
|
useAddField(props.prop);
|
|
2659
2664
|
return (_ctx, _cache) => {
|
|
2660
|
-
return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$
|
|
2665
|
+
return _ctx.model ? (openBlock(), createElementBlock("span", _hoisted_1$7, toDisplayString(_ctx.model[_ctx.name]), 1)) : createCommentVNode("", true);
|
|
2661
2666
|
};
|
|
2662
2667
|
}
|
|
2663
2668
|
});
|
|
2664
2669
|
|
|
2665
|
-
const _hoisted_1$
|
|
2670
|
+
const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
|
|
2666
2671
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2667
2672
|
...{
|
|
2668
2673
|
name: "MFormDynamicField"
|
|
@@ -2729,7 +2734,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2729
2734
|
emit("change", fieldMap.value[key], key);
|
|
2730
2735
|
};
|
|
2731
2736
|
return (_ctx, _cache) => {
|
|
2732
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
2737
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
2733
2738
|
createVNode(unref(TMagicForm), { size: "small" }, {
|
|
2734
2739
|
default: withCtx(() => [
|
|
2735
2740
|
(openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(fieldMap.value), (key) => {
|
|
@@ -2948,7 +2953,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2948
2953
|
}
|
|
2949
2954
|
});
|
|
2950
2955
|
|
|
2951
|
-
const _hoisted_1$
|
|
2956
|
+
const _hoisted_1$5 = { style: { "min-height": "1px" } };
|
|
2952
2957
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2953
2958
|
...{
|
|
2954
2959
|
name: "MFormDialog"
|
|
@@ -3057,7 +3062,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3057
3062
|
style: { "text-align": "left" }
|
|
3058
3063
|
}, {
|
|
3059
3064
|
default: withCtx(() => [
|
|
3060
|
-
createElementVNode("div", _hoisted_1$
|
|
3065
|
+
createElementVNode("div", _hoisted_1$5, [
|
|
3061
3066
|
renderSlot(_ctx.$slots, "left")
|
|
3062
3067
|
])
|
|
3063
3068
|
]),
|
|
@@ -3147,8 +3152,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3147
3152
|
}
|
|
3148
3153
|
});
|
|
3149
3154
|
|
|
3150
|
-
const _hoisted_1$
|
|
3151
|
-
const _hoisted_2$
|
|
3155
|
+
const _hoisted_1$4 = ["href"];
|
|
3156
|
+
const _hoisted_2$2 = {
|
|
3152
3157
|
key: 2,
|
|
3153
3158
|
class: "m-fields-link"
|
|
3154
3159
|
};
|
|
@@ -3221,10 +3226,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3221
3226
|
target: "_blank",
|
|
3222
3227
|
href: href.value,
|
|
3223
3228
|
style: normalizeStyle(_ctx.config.css || {})
|
|
3224
|
-
}, toDisplayString(displayText.value), 13, _hoisted_1$
|
|
3229
|
+
}, toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (openBlock(), createElementBlock("span", {
|
|
3225
3230
|
key: 1,
|
|
3226
3231
|
style: normalizeStyle(_ctx.config.disabledCss || {})
|
|
3227
|
-
}, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$
|
|
3232
|
+
}, toDisplayString(displayText.value), 5)) : (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
3228
3233
|
createVNode(unref(TMagicButton), {
|
|
3229
3234
|
link: "",
|
|
3230
3235
|
type: "primary",
|
|
@@ -3300,8 +3305,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3300
3305
|
}
|
|
3301
3306
|
});
|
|
3302
3307
|
|
|
3303
|
-
const _hoisted_1$
|
|
3304
|
-
const _hoisted_2$
|
|
3308
|
+
const _hoisted_1$3 = { class: "m-fields-number-range" };
|
|
3309
|
+
const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
|
|
3305
3310
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
3306
3311
|
...{
|
|
3307
3312
|
name: "MFormNumberRange"
|
|
@@ -3333,7 +3338,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3333
3338
|
emit("change", [props.model[props.name][0], Number(v)]);
|
|
3334
3339
|
};
|
|
3335
3340
|
return (_ctx, _cache) => {
|
|
3336
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3341
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
3337
3342
|
createVNode(unref(TMagicInput), {
|
|
3338
3343
|
modelValue: _ctx.model[_ctx.name][0],
|
|
3339
3344
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
|
|
@@ -3342,7 +3347,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
3342
3347
|
disabled: _ctx.disabled,
|
|
3343
3348
|
onChange: minChangeHandler
|
|
3344
3349
|
}, null, 8, ["modelValue", "size", "disabled"]),
|
|
3345
|
-
_hoisted_2$
|
|
3350
|
+
_hoisted_2$1,
|
|
3346
3351
|
createVNode(unref(TMagicInput), {
|
|
3347
3352
|
modelValue: _ctx.model[_ctx.name][1],
|
|
3348
3353
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
|
|
@@ -3465,7 +3470,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
3465
3470
|
}
|
|
3466
3471
|
});
|
|
3467
3472
|
|
|
3468
|
-
const _hoisted_1$
|
|
3473
|
+
const _hoisted_1$2 = { key: 2 };
|
|
3469
3474
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3470
3475
|
...{
|
|
3471
3476
|
name: "MFormSelect"
|
|
@@ -3814,7 +3819,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
3814
3819
|
key: 1,
|
|
3815
3820
|
options: unref(itemOptions)
|
|
3816
3821
|
}, null, 8, ["options"])),
|
|
3817
|
-
moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$
|
|
3822
|
+
moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
|
|
3818
3823
|
[_directive_loading, true]
|
|
3819
3824
|
]) : createCommentVNode("", true)
|
|
3820
3825
|
]),
|
|
@@ -3884,8 +3889,8 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3884
3889
|
}
|
|
3885
3890
|
});
|
|
3886
3891
|
|
|
3887
|
-
const _hoisted_1$
|
|
3888
|
-
const _hoisted_2
|
|
3892
|
+
const _hoisted_1$1 = { class: "m-form-item__content" };
|
|
3893
|
+
const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
|
|
3889
3894
|
const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
|
|
3890
3895
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3891
3896
|
...{
|
|
@@ -4041,8 +4046,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4041
4046
|
]), 1032, ["modelValue", "size", "placeholder", "disabled"])
|
|
4042
4047
|
]),
|
|
4043
4048
|
default: withCtx(() => [
|
|
4044
|
-
createElementVNode("div", _hoisted_1$
|
|
4045
|
-
_hoisted_2
|
|
4049
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
4050
|
+
_hoisted_2,
|
|
4046
4051
|
createElementVNode("div", _hoisted_3, [
|
|
4047
4052
|
createVNode(unref(TMagicButton), {
|
|
4048
4053
|
link: "",
|
|
@@ -4236,7 +4241,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
4236
4241
|
}
|
|
4237
4242
|
});
|
|
4238
4243
|
|
|
4239
|
-
const _hoisted_1
|
|
4244
|
+
const _hoisted_1 = { style: { "min-height": "1px" } };
|
|
4240
4245
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
4241
4246
|
...{
|
|
4242
4247
|
name: "MFormDialog"
|
|
@@ -4340,7 +4345,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4340
4345
|
style: { "text-align": "left" }
|
|
4341
4346
|
}, {
|
|
4342
4347
|
default: withCtx(() => [
|
|
4343
|
-
createElementVNode("div", _hoisted_1
|
|
4348
|
+
createElementVNode("div", _hoisted_1, [
|
|
4344
4349
|
renderSlot(_ctx.$slots, "left")
|
|
4345
4350
|
])
|
|
4346
4351
|
]),
|
|
@@ -4403,11 +4408,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
4403
4408
|
}
|
|
4404
4409
|
});
|
|
4405
4410
|
|
|
4406
|
-
const
|
|
4407
|
-
const _hoisted_2 = { style: { "min-height": "1px" } };
|
|
4411
|
+
const footerHeight = 60;
|
|
4408
4412
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
4409
4413
|
...{
|
|
4410
|
-
name: "
|
|
4414
|
+
name: "MFormBox"
|
|
4411
4415
|
},
|
|
4412
4416
|
__name: "FormBox",
|
|
4413
4417
|
props: {
|
|
@@ -4415,6 +4419,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4415
4419
|
values: { default: () => ({}) },
|
|
4416
4420
|
parentValues: {},
|
|
4417
4421
|
width: {},
|
|
4422
|
+
height: {},
|
|
4418
4423
|
labelWidth: {},
|
|
4419
4424
|
disabled: { type: Boolean },
|
|
4420
4425
|
size: {},
|
|
@@ -4424,15 +4429,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4424
4429
|
},
|
|
4425
4430
|
emits: ["submit", "change", "error"],
|
|
4426
4431
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4432
|
+
const props = __props;
|
|
4427
4433
|
const emit = __emit;
|
|
4434
|
+
const style = computed(() => {
|
|
4435
|
+
const style2 = {};
|
|
4436
|
+
if (typeof props.width === "number") {
|
|
4437
|
+
style2.width = `${props.width}px`;
|
|
4438
|
+
}
|
|
4439
|
+
if (typeof props.height === "number") {
|
|
4440
|
+
style2.height = `${props.height}px`;
|
|
4441
|
+
}
|
|
4442
|
+
return style2;
|
|
4443
|
+
});
|
|
4428
4444
|
const form = ref();
|
|
4429
|
-
const boxBody = ref();
|
|
4430
4445
|
const saveFetch = ref(false);
|
|
4431
4446
|
const bodyHeight = ref(0);
|
|
4432
4447
|
watchEffect(() => {
|
|
4433
|
-
if (
|
|
4434
|
-
|
|
4448
|
+
if (!props.height) {
|
|
4449
|
+
return;
|
|
4435
4450
|
}
|
|
4451
|
+
bodyHeight.value = props.height - footerHeight;
|
|
4436
4452
|
});
|
|
4437
4453
|
const submitHandler = async () => {
|
|
4438
4454
|
try {
|
|
@@ -4452,67 +4468,63 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
4452
4468
|
__expose({
|
|
4453
4469
|
form,
|
|
4454
4470
|
saveFetch,
|
|
4455
|
-
bodyHeight,
|
|
4456
4471
|
show,
|
|
4457
4472
|
hide
|
|
4458
4473
|
});
|
|
4459
4474
|
return (_ctx, _cache) => {
|
|
4460
|
-
return openBlock(), createElementBlock("div",
|
|
4475
|
+
return openBlock(), createElementBlock("div", {
|
|
4476
|
+
class: "m-form-box",
|
|
4477
|
+
style: normalizeStyle(style.value)
|
|
4478
|
+
}, [
|
|
4461
4479
|
createElementVNode("div", {
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
class: "m-box-body"
|
|
4480
|
+
class: "m-box-body",
|
|
4481
|
+
style: normalizeStyle(bodyHeight.value ? { height: `${bodyHeight.value}px` } : {})
|
|
4465
4482
|
}, [
|
|
4466
|
-
createVNode(
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
_: 3
|
|
4493
|
-
}),
|
|
4494
|
-
createVNode(unref(TMagicCol), { span: 12 }, {
|
|
4495
|
-
default: withCtx(() => [
|
|
4496
|
-
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
4497
|
-
createVNode(unref(TMagicButton), {
|
|
4498
|
-
type: "primary",
|
|
4499
|
-
disabled: _ctx.disabled,
|
|
4500
|
-
loading: saveFetch.value,
|
|
4501
|
-
onClick: submitHandler
|
|
4502
|
-
}, {
|
|
4503
|
-
default: withCtx(() => [
|
|
4504
|
-
createTextVNode(toDisplayString(_ctx.confirmText), 1)
|
|
4505
|
-
]),
|
|
4506
|
-
_: 1
|
|
4507
|
-
}, 8, ["disabled", "loading"])
|
|
4508
|
-
])
|
|
4509
|
-
]),
|
|
4510
|
-
_: 3
|
|
4511
|
-
})
|
|
4483
|
+
createVNode(unref(TMagicScrollbar), null, {
|
|
4484
|
+
default: withCtx(() => [
|
|
4485
|
+
createVNode(_sfc_main$f, {
|
|
4486
|
+
ref_key: "form",
|
|
4487
|
+
ref: form,
|
|
4488
|
+
size: _ctx.size,
|
|
4489
|
+
disabled: _ctx.disabled,
|
|
4490
|
+
config: _ctx.config,
|
|
4491
|
+
"init-values": _ctx.values,
|
|
4492
|
+
"parent-values": _ctx.parentValues,
|
|
4493
|
+
"label-width": _ctx.labelWidth,
|
|
4494
|
+
"label-position": _ctx.labelPosition,
|
|
4495
|
+
inline: _ctx.inline,
|
|
4496
|
+
onChange: changeHandler
|
|
4497
|
+
}, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
|
|
4498
|
+
renderSlot(_ctx.$slots, "default")
|
|
4499
|
+
]),
|
|
4500
|
+
_: 3
|
|
4501
|
+
})
|
|
4502
|
+
], 4),
|
|
4503
|
+
createElementVNode("div", {
|
|
4504
|
+
class: "dialog-footer",
|
|
4505
|
+
style: normalizeStyle(`height: ${footerHeight}px`)
|
|
4506
|
+
}, [
|
|
4507
|
+
createElementVNode("div", null, [
|
|
4508
|
+
renderSlot(_ctx.$slots, "left")
|
|
4512
4509
|
]),
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4510
|
+
createElementVNode("div", null, [
|
|
4511
|
+
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
4512
|
+
createVNode(unref(TMagicButton), {
|
|
4513
|
+
type: "primary",
|
|
4514
|
+
size: _ctx.size,
|
|
4515
|
+
disabled: _ctx.disabled,
|
|
4516
|
+
loading: saveFetch.value,
|
|
4517
|
+
onClick: submitHandler
|
|
4518
|
+
}, {
|
|
4519
|
+
default: withCtx(() => [
|
|
4520
|
+
createTextVNode(toDisplayString(_ctx.confirmText), 1)
|
|
4521
|
+
]),
|
|
4522
|
+
_: 1
|
|
4523
|
+
}, 8, ["size", "disabled", "loading"])
|
|
4524
|
+
])
|
|
4525
|
+
])
|
|
4526
|
+
], 4)
|
|
4527
|
+
], 4);
|
|
4516
4528
|
};
|
|
4517
4529
|
}
|
|
4518
4530
|
});
|
package/dist/tmagic-form.umd.cjs
CHANGED
|
@@ -165,8 +165,8 @@
|
|
|
165
165
|
return valuesTmp || {};
|
|
166
166
|
};
|
|
167
167
|
|
|
168
|
-
const _hoisted_1$
|
|
169
|
-
const _hoisted_2$
|
|
168
|
+
const _hoisted_1$d = ["id", "data-magic-id"];
|
|
169
|
+
const _hoisted_2$8 = ["innerHTML", "title"];
|
|
170
170
|
const _hoisted_3$5 = ["innerHTML"];
|
|
171
171
|
const _hoisted_4$4 = ["innerHTML"];
|
|
172
172
|
const _hoisted_5$4 = ["innerHTML"];
|
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
vue.createElementVNode("span", {
|
|
373
373
|
innerHTML: type.value === "checkbox" ? "" : text.value,
|
|
374
374
|
title: _ctx.config.labelTitle
|
|
375
|
-
}, null, 8, _hoisted_2$
|
|
375
|
+
}, null, 8, _hoisted_2$8)
|
|
376
376
|
]),
|
|
377
377
|
default: vue.withCtx(() => [
|
|
378
378
|
tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
|
|
@@ -603,13 +603,13 @@
|
|
|
603
603
|
_: 1
|
|
604
604
|
})
|
|
605
605
|
])) : vue.createCommentVNode("", true)
|
|
606
|
-
], 14, _hoisted_1$
|
|
606
|
+
], 14, _hoisted_1$d)) : vue.createCommentVNode("", true);
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
|
|
611
|
-
const _hoisted_1$
|
|
612
|
-
const _hoisted_2$
|
|
611
|
+
const _hoisted_1$c = ["innerHTML"];
|
|
612
|
+
const _hoisted_2$7 = ["innerHTML"];
|
|
613
613
|
const _hoisted_3$4 = { key: 1 };
|
|
614
614
|
const _hoisted_4$3 = ["innerHTML"];
|
|
615
615
|
const _hoisted_5$3 = ["innerHTML"];
|
|
@@ -673,18 +673,18 @@
|
|
|
673
673
|
change
|
|
674
674
|
],
|
|
675
675
|
prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
|
|
676
|
-
"true-
|
|
677
|
-
"false-
|
|
676
|
+
"true-value": 1,
|
|
677
|
+
"false-value": 0
|
|
678
678
|
}, {
|
|
679
679
|
default: vue.withCtx(() => [
|
|
680
680
|
vue.createElementVNode("span", {
|
|
681
681
|
innerHTML: _ctx.config.legend
|
|
682
|
-
}, null, 8, _hoisted_1$
|
|
682
|
+
}, null, 8, _hoisted_1$c),
|
|
683
683
|
_ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
684
684
|
key: 0,
|
|
685
685
|
innerHTML: _ctx.config.extra,
|
|
686
686
|
class: "m-form-tip"
|
|
687
|
-
}, null, 8, _hoisted_2$
|
|
687
|
+
}, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
|
|
688
688
|
]),
|
|
689
689
|
_: 1
|
|
690
690
|
}, 8, ["modelValue", "prop"])
|
|
@@ -744,8 +744,8 @@
|
|
|
744
744
|
}
|
|
745
745
|
});
|
|
746
746
|
|
|
747
|
-
const _hoisted_1$
|
|
748
|
-
const _hoisted_2$
|
|
747
|
+
const _hoisted_1$b = { class: "m-fields-group-list-item" };
|
|
748
|
+
const _hoisted_2$6 = ["innerHTML"];
|
|
749
749
|
const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
|
|
750
750
|
...{
|
|
751
751
|
name: "MFormGroupListItem"
|
|
@@ -812,19 +812,24 @@
|
|
|
812
812
|
};
|
|
813
813
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
814
814
|
return (_ctx, _cache) => {
|
|
815
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
815
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
816
816
|
vue.createElementVNode("div", null, [
|
|
817
817
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
818
818
|
link: "",
|
|
819
819
|
disabled: _ctx.disabled,
|
|
820
|
-
icon: expand.value ? vue.unref(iconsVue.CaretBottom) : vue.unref(iconsVue.CaretRight),
|
|
821
820
|
onClick: expandHandler
|
|
822
821
|
}, {
|
|
823
822
|
default: vue.withCtx(() => [
|
|
823
|
+
vue.createVNode(vue.unref(design.TMagicIcon), null, {
|
|
824
|
+
default: vue.withCtx(() => [
|
|
825
|
+
expand.value ? (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.CaretBottom), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(iconsVue.CaretRight), { key: 1 }))
|
|
826
|
+
]),
|
|
827
|
+
_: 1
|
|
828
|
+
}),
|
|
824
829
|
vue.createTextVNode(vue.toDisplayString(title.value), 1)
|
|
825
830
|
]),
|
|
826
831
|
_: 1
|
|
827
|
-
}, 8, ["disabled"
|
|
832
|
+
}, 8, ["disabled"]),
|
|
828
833
|
vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
|
|
829
834
|
style: { "color": "#f56c6c" },
|
|
830
835
|
link: "",
|
|
@@ -878,7 +883,7 @@
|
|
|
878
883
|
key: 1,
|
|
879
884
|
innerHTML: itemExtra.value,
|
|
880
885
|
class: "m-form-tip"
|
|
881
|
-
}, null, 8, _hoisted_2$
|
|
886
|
+
}, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
|
|
882
887
|
]),
|
|
883
888
|
expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$z, {
|
|
884
889
|
key: 0,
|
|
@@ -898,8 +903,8 @@
|
|
|
898
903
|
}
|
|
899
904
|
});
|
|
900
905
|
|
|
901
|
-
const _hoisted_1$
|
|
902
|
-
const _hoisted_2$
|
|
906
|
+
const _hoisted_1$a = { class: "m-fields-group-list" };
|
|
907
|
+
const _hoisted_2$5 = ["innerHTML"];
|
|
903
908
|
const _hoisted_3$3 = {
|
|
904
909
|
key: 1,
|
|
905
910
|
class: "el-table__empty-block"
|
|
@@ -992,12 +997,12 @@
|
|
|
992
997
|
const onAddDiffCount = () => emit("addDiffCount");
|
|
993
998
|
const getLastValues = (item, index) => item?.[index] || {};
|
|
994
999
|
return (_ctx, _cache) => {
|
|
995
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1000
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
|
|
996
1001
|
_ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
997
1002
|
key: 0,
|
|
998
1003
|
innerHTML: _ctx.config.extra,
|
|
999
1004
|
style: { "color": "rgba(0, 0, 0, 0.45)" }
|
|
1000
|
-
}, null, 8, _hoisted_2$
|
|
1005
|
+
}, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
|
|
1001
1006
|
!_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
|
|
1002
1007
|
return vue.openBlock(), vue.createBlock(_sfc_main$x, {
|
|
1003
1008
|
key: index,
|
|
@@ -1044,8 +1049,8 @@
|
|
|
1044
1049
|
}
|
|
1045
1050
|
});
|
|
1046
1051
|
|
|
1047
|
-
const _hoisted_1$
|
|
1048
|
-
const _hoisted_2$
|
|
1052
|
+
const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
|
|
1053
|
+
const _hoisted_2$4 = ["innerHTML"];
|
|
1049
1054
|
const _hoisted_3$2 = {
|
|
1050
1055
|
key: 0,
|
|
1051
1056
|
style: { "display": "flex" }
|
|
@@ -1085,7 +1090,7 @@
|
|
|
1085
1090
|
"body-style": { display: expand.value ? "block" : "none" }
|
|
1086
1091
|
}, {
|
|
1087
1092
|
header: vue.withCtx(() => [
|
|
1088
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
1093
|
+
vue.createElementVNode("div", _hoisted_1$9, [
|
|
1089
1094
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
1090
1095
|
style: { "padding": "0" },
|
|
1091
1096
|
link: "",
|
|
@@ -1096,7 +1101,7 @@
|
|
|
1096
1101
|
key: 0,
|
|
1097
1102
|
innerHTML: _ctx.config.extra,
|
|
1098
1103
|
class: "m-form-tip"
|
|
1099
|
-
}, null, 8, _hoisted_2$
|
|
1104
|
+
}, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
|
|
1100
1105
|
vue.renderSlot(_ctx.$slots, "header", {}, () => [
|
|
1101
1106
|
vue.createTextVNode(vue.toDisplayString(filter(_ctx.config.title)), 1)
|
|
1102
1107
|
])
|
|
@@ -1330,8 +1335,8 @@
|
|
|
1330
1335
|
}
|
|
1331
1336
|
});
|
|
1332
1337
|
|
|
1333
|
-
const _hoisted_1$
|
|
1334
|
-
const _hoisted_2$
|
|
1338
|
+
const _hoisted_1$8 = { class: "m-fields-table-wrap" };
|
|
1339
|
+
const _hoisted_2$3 = ["innerHTML"];
|
|
1335
1340
|
const _hoisted_3$1 = ["innerHTML"];
|
|
1336
1341
|
const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
|
|
1337
1342
|
const _hoisted_5 = { style: { "display": "flex" } };
|
|
@@ -1700,7 +1705,7 @@
|
|
|
1700
1705
|
toggleRowSelection
|
|
1701
1706
|
});
|
|
1702
1707
|
return (_ctx, _cache) => {
|
|
1703
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1708
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
|
|
1704
1709
|
(vue.openBlock(), vue.createBlock(vue.Teleport, {
|
|
1705
1710
|
to: "body",
|
|
1706
1711
|
disabled: !isFullscreen.value
|
|
@@ -1714,7 +1719,7 @@
|
|
|
1714
1719
|
key: 0,
|
|
1715
1720
|
style: { "color": "rgba(0, 0, 0, 0.45)" },
|
|
1716
1721
|
innerHTML: _ctx.config.extra
|
|
1717
|
-
}, null, 8, _hoisted_2$
|
|
1722
|
+
}, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true),
|
|
1718
1723
|
vue.createVNode(vue.unref(design.TMagicTooltip), {
|
|
1719
1724
|
content: "拖拽可排序",
|
|
1720
1725
|
placement: "left-start",
|
|
@@ -2632,7 +2637,7 @@
|
|
|
2632
2637
|
}
|
|
2633
2638
|
});
|
|
2634
2639
|
|
|
2635
|
-
const _hoisted_1$
|
|
2640
|
+
const _hoisted_1$7 = { key: 0 };
|
|
2636
2641
|
const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
|
|
2637
2642
|
...{
|
|
2638
2643
|
name: "MFormDisplay"
|
|
@@ -2656,12 +2661,12 @@
|
|
|
2656
2661
|
}
|
|
2657
2662
|
useAddField(props.prop);
|
|
2658
2663
|
return (_ctx, _cache) => {
|
|
2659
|
-
return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$
|
|
2664
|
+
return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$7, vue.toDisplayString(_ctx.model[_ctx.name]), 1)) : vue.createCommentVNode("", true);
|
|
2660
2665
|
};
|
|
2661
2666
|
}
|
|
2662
2667
|
});
|
|
2663
2668
|
|
|
2664
|
-
const _hoisted_1$
|
|
2669
|
+
const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
|
|
2665
2670
|
const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
|
|
2666
2671
|
...{
|
|
2667
2672
|
name: "MFormDynamicField"
|
|
@@ -2728,7 +2733,7 @@
|
|
|
2728
2733
|
emit("change", fieldMap.value[key], key);
|
|
2729
2734
|
};
|
|
2730
2735
|
return (_ctx, _cache) => {
|
|
2731
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
2736
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
2732
2737
|
vue.createVNode(vue.unref(design.TMagicForm), { size: "small" }, {
|
|
2733
2738
|
default: vue.withCtx(() => [
|
|
2734
2739
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Object.keys(fieldMap.value), (key) => {
|
|
@@ -2947,7 +2952,7 @@
|
|
|
2947
2952
|
}
|
|
2948
2953
|
});
|
|
2949
2954
|
|
|
2950
|
-
const _hoisted_1$
|
|
2955
|
+
const _hoisted_1$5 = { style: { "min-height": "1px" } };
|
|
2951
2956
|
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
2952
2957
|
...{
|
|
2953
2958
|
name: "MFormDialog"
|
|
@@ -3056,7 +3061,7 @@
|
|
|
3056
3061
|
style: { "text-align": "left" }
|
|
3057
3062
|
}, {
|
|
3058
3063
|
default: vue.withCtx(() => [
|
|
3059
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
3064
|
+
vue.createElementVNode("div", _hoisted_1$5, [
|
|
3060
3065
|
vue.renderSlot(_ctx.$slots, "left")
|
|
3061
3066
|
])
|
|
3062
3067
|
]),
|
|
@@ -3146,8 +3151,8 @@
|
|
|
3146
3151
|
}
|
|
3147
3152
|
});
|
|
3148
3153
|
|
|
3149
|
-
const _hoisted_1$
|
|
3150
|
-
const _hoisted_2$
|
|
3154
|
+
const _hoisted_1$4 = ["href"];
|
|
3155
|
+
const _hoisted_2$2 = {
|
|
3151
3156
|
key: 2,
|
|
3152
3157
|
class: "m-fields-link"
|
|
3153
3158
|
};
|
|
@@ -3220,10 +3225,10 @@
|
|
|
3220
3225
|
target: "_blank",
|
|
3221
3226
|
href: href.value,
|
|
3222
3227
|
style: vue.normalizeStyle(_ctx.config.css || {})
|
|
3223
|
-
}, vue.toDisplayString(displayText.value), 13, _hoisted_1$
|
|
3228
|
+
}, vue.toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
3224
3229
|
key: 1,
|
|
3225
3230
|
style: vue.normalizeStyle(_ctx.config.disabledCss || {})
|
|
3226
|
-
}, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$
|
|
3231
|
+
}, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
|
|
3227
3232
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
3228
3233
|
link: "",
|
|
3229
3234
|
type: "primary",
|
|
@@ -3299,8 +3304,8 @@
|
|
|
3299
3304
|
}
|
|
3300
3305
|
});
|
|
3301
3306
|
|
|
3302
|
-
const _hoisted_1$
|
|
3303
|
-
const _hoisted_2$
|
|
3307
|
+
const _hoisted_1$3 = { class: "m-fields-number-range" };
|
|
3308
|
+
const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
|
|
3304
3309
|
const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
|
|
3305
3310
|
...{
|
|
3306
3311
|
name: "MFormNumberRange"
|
|
@@ -3332,7 +3337,7 @@
|
|
|
3332
3337
|
emit("change", [props.model[props.name][0], Number(v)]);
|
|
3333
3338
|
};
|
|
3334
3339
|
return (_ctx, _cache) => {
|
|
3335
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3340
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
3336
3341
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3337
3342
|
modelValue: _ctx.model[_ctx.name][0],
|
|
3338
3343
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
|
|
@@ -3341,7 +3346,7 @@
|
|
|
3341
3346
|
disabled: _ctx.disabled,
|
|
3342
3347
|
onChange: minChangeHandler
|
|
3343
3348
|
}, null, 8, ["modelValue", "size", "disabled"]),
|
|
3344
|
-
_hoisted_2$
|
|
3349
|
+
_hoisted_2$1,
|
|
3345
3350
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
3346
3351
|
modelValue: _ctx.model[_ctx.name][1],
|
|
3347
3352
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
|
|
@@ -3464,7 +3469,7 @@
|
|
|
3464
3469
|
}
|
|
3465
3470
|
});
|
|
3466
3471
|
|
|
3467
|
-
const _hoisted_1$
|
|
3472
|
+
const _hoisted_1$2 = { key: 2 };
|
|
3468
3473
|
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
3469
3474
|
...{
|
|
3470
3475
|
name: "MFormSelect"
|
|
@@ -3813,7 +3818,7 @@
|
|
|
3813
3818
|
key: 1,
|
|
3814
3819
|
options: vue.unref(itemOptions)
|
|
3815
3820
|
}, null, 8, ["options"])),
|
|
3816
|
-
moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3821
|
+
moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, null, 512)), [
|
|
3817
3822
|
[_directive_loading, true]
|
|
3818
3823
|
]) : vue.createCommentVNode("", true)
|
|
3819
3824
|
]),
|
|
@@ -3883,8 +3888,8 @@
|
|
|
3883
3888
|
}
|
|
3884
3889
|
});
|
|
3885
3890
|
|
|
3886
|
-
const _hoisted_1$
|
|
3887
|
-
const _hoisted_2
|
|
3891
|
+
const _hoisted_1$1 = { class: "m-form-item__content" };
|
|
3892
|
+
const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
|
|
3888
3893
|
const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
|
|
3889
3894
|
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3890
3895
|
...{
|
|
@@ -4040,8 +4045,8 @@
|
|
|
4040
4045
|
]), 1032, ["modelValue", "size", "placeholder", "disabled"])
|
|
4041
4046
|
]),
|
|
4042
4047
|
default: vue.withCtx(() => [
|
|
4043
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4044
|
-
_hoisted_2
|
|
4048
|
+
vue.createElementVNode("div", _hoisted_1$1, [
|
|
4049
|
+
_hoisted_2,
|
|
4045
4050
|
vue.createElementVNode("div", _hoisted_3, [
|
|
4046
4051
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4047
4052
|
link: "",
|
|
@@ -4235,7 +4240,7 @@
|
|
|
4235
4240
|
}
|
|
4236
4241
|
});
|
|
4237
4242
|
|
|
4238
|
-
const _hoisted_1
|
|
4243
|
+
const _hoisted_1 = { style: { "min-height": "1px" } };
|
|
4239
4244
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
4240
4245
|
...{
|
|
4241
4246
|
name: "MFormDialog"
|
|
@@ -4339,7 +4344,7 @@
|
|
|
4339
4344
|
style: { "text-align": "left" }
|
|
4340
4345
|
}, {
|
|
4341
4346
|
default: vue.withCtx(() => [
|
|
4342
|
-
vue.createElementVNode("div", _hoisted_1
|
|
4347
|
+
vue.createElementVNode("div", _hoisted_1, [
|
|
4343
4348
|
vue.renderSlot(_ctx.$slots, "left")
|
|
4344
4349
|
])
|
|
4345
4350
|
]),
|
|
@@ -4402,11 +4407,10 @@
|
|
|
4402
4407
|
}
|
|
4403
4408
|
});
|
|
4404
4409
|
|
|
4405
|
-
const
|
|
4406
|
-
const _hoisted_2 = { style: { "min-height": "1px" } };
|
|
4410
|
+
const footerHeight = 60;
|
|
4407
4411
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
4408
4412
|
...{
|
|
4409
|
-
name: "
|
|
4413
|
+
name: "MFormBox"
|
|
4410
4414
|
},
|
|
4411
4415
|
__name: "FormBox",
|
|
4412
4416
|
props: {
|
|
@@ -4414,6 +4418,7 @@
|
|
|
4414
4418
|
values: { default: () => ({}) },
|
|
4415
4419
|
parentValues: {},
|
|
4416
4420
|
width: {},
|
|
4421
|
+
height: {},
|
|
4417
4422
|
labelWidth: {},
|
|
4418
4423
|
disabled: { type: Boolean },
|
|
4419
4424
|
size: {},
|
|
@@ -4423,15 +4428,26 @@
|
|
|
4423
4428
|
},
|
|
4424
4429
|
emits: ["submit", "change", "error"],
|
|
4425
4430
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
4431
|
+
const props = __props;
|
|
4426
4432
|
const emit = __emit;
|
|
4433
|
+
const style = vue.computed(() => {
|
|
4434
|
+
const style2 = {};
|
|
4435
|
+
if (typeof props.width === "number") {
|
|
4436
|
+
style2.width = `${props.width}px`;
|
|
4437
|
+
}
|
|
4438
|
+
if (typeof props.height === "number") {
|
|
4439
|
+
style2.height = `${props.height}px`;
|
|
4440
|
+
}
|
|
4441
|
+
return style2;
|
|
4442
|
+
});
|
|
4427
4443
|
const form = vue.ref();
|
|
4428
|
-
const boxBody = vue.ref();
|
|
4429
4444
|
const saveFetch = vue.ref(false);
|
|
4430
4445
|
const bodyHeight = vue.ref(0);
|
|
4431
4446
|
vue.watchEffect(() => {
|
|
4432
|
-
if (
|
|
4433
|
-
|
|
4447
|
+
if (!props.height) {
|
|
4448
|
+
return;
|
|
4434
4449
|
}
|
|
4450
|
+
bodyHeight.value = props.height - footerHeight;
|
|
4435
4451
|
});
|
|
4436
4452
|
const submitHandler = async () => {
|
|
4437
4453
|
try {
|
|
@@ -4451,67 +4467,63 @@
|
|
|
4451
4467
|
__expose({
|
|
4452
4468
|
form,
|
|
4453
4469
|
saveFetch,
|
|
4454
|
-
bodyHeight,
|
|
4455
4470
|
show,
|
|
4456
4471
|
hide
|
|
4457
4472
|
});
|
|
4458
4473
|
return (_ctx, _cache) => {
|
|
4459
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
4474
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
4475
|
+
class: "m-form-box",
|
|
4476
|
+
style: vue.normalizeStyle(style.value)
|
|
4477
|
+
}, [
|
|
4460
4478
|
vue.createElementVNode("div", {
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
class: "m-box-body"
|
|
4479
|
+
class: "m-box-body",
|
|
4480
|
+
style: vue.normalizeStyle(bodyHeight.value ? { height: `${bodyHeight.value}px` } : {})
|
|
4464
4481
|
}, [
|
|
4465
|
-
vue.createVNode(
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
_: 3
|
|
4492
|
-
}),
|
|
4493
|
-
vue.createVNode(vue.unref(design.TMagicCol), { span: 12 }, {
|
|
4494
|
-
default: vue.withCtx(() => [
|
|
4495
|
-
vue.renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
4496
|
-
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4497
|
-
type: "primary",
|
|
4498
|
-
disabled: _ctx.disabled,
|
|
4499
|
-
loading: saveFetch.value,
|
|
4500
|
-
onClick: submitHandler
|
|
4501
|
-
}, {
|
|
4502
|
-
default: vue.withCtx(() => [
|
|
4503
|
-
vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
|
|
4504
|
-
]),
|
|
4505
|
-
_: 1
|
|
4506
|
-
}, 8, ["disabled", "loading"])
|
|
4507
|
-
])
|
|
4508
|
-
]),
|
|
4509
|
-
_: 3
|
|
4510
|
-
})
|
|
4482
|
+
vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
|
|
4483
|
+
default: vue.withCtx(() => [
|
|
4484
|
+
vue.createVNode(_sfc_main$f, {
|
|
4485
|
+
ref_key: "form",
|
|
4486
|
+
ref: form,
|
|
4487
|
+
size: _ctx.size,
|
|
4488
|
+
disabled: _ctx.disabled,
|
|
4489
|
+
config: _ctx.config,
|
|
4490
|
+
"init-values": _ctx.values,
|
|
4491
|
+
"parent-values": _ctx.parentValues,
|
|
4492
|
+
"label-width": _ctx.labelWidth,
|
|
4493
|
+
"label-position": _ctx.labelPosition,
|
|
4494
|
+
inline: _ctx.inline,
|
|
4495
|
+
onChange: changeHandler
|
|
4496
|
+
}, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline"]),
|
|
4497
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
4498
|
+
]),
|
|
4499
|
+
_: 3
|
|
4500
|
+
})
|
|
4501
|
+
], 4),
|
|
4502
|
+
vue.createElementVNode("div", {
|
|
4503
|
+
class: "dialog-footer",
|
|
4504
|
+
style: vue.normalizeStyle(`height: ${footerHeight}px`)
|
|
4505
|
+
}, [
|
|
4506
|
+
vue.createElementVNode("div", null, [
|
|
4507
|
+
vue.renderSlot(_ctx.$slots, "left")
|
|
4511
4508
|
]),
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4509
|
+
vue.createElementVNode("div", null, [
|
|
4510
|
+
vue.renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
4511
|
+
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4512
|
+
type: "primary",
|
|
4513
|
+
size: _ctx.size,
|
|
4514
|
+
disabled: _ctx.disabled,
|
|
4515
|
+
loading: saveFetch.value,
|
|
4516
|
+
onClick: submitHandler
|
|
4517
|
+
}, {
|
|
4518
|
+
default: vue.withCtx(() => [
|
|
4519
|
+
vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
|
|
4520
|
+
]),
|
|
4521
|
+
_: 1
|
|
4522
|
+
}, 8, ["size", "disabled", "loading"])
|
|
4523
|
+
])
|
|
4524
|
+
])
|
|
4525
|
+
], 4)
|
|
4526
|
+
], 4);
|
|
4515
4527
|
};
|
|
4516
4528
|
}
|
|
4517
4529
|
});
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.4.0
|
|
2
|
+
"version": "1.4.0",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@element-plus/icons-vue": "^2.3.1",
|
|
35
|
-
"@tmagic/design": "1.4.0
|
|
36
|
-
"@tmagic/utils": "1.4.0
|
|
35
|
+
"@tmagic/design": "1.4.0",
|
|
36
|
+
"@tmagic/utils": "1.4.0",
|
|
37
37
|
"lodash-es": "^4.17.21",
|
|
38
38
|
"sortablejs": "^1.14.0",
|
|
39
39
|
"vue": "^3.4.21"
|
package/src/FormBox.vue
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="m-form-box">
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<div class="m-form-box" :style="style">
|
|
3
|
+
<div class="m-box-body" :style="bodyHeight ? { height: `${bodyHeight}px` } : {}">
|
|
4
|
+
<TMagicScrollbar>
|
|
5
|
+
<Form
|
|
6
|
+
ref="form"
|
|
7
|
+
:size="size"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:config="config"
|
|
10
|
+
:init-values="values"
|
|
11
|
+
:parent-values="parentValues"
|
|
12
|
+
:label-width="labelWidth"
|
|
13
|
+
:label-position="labelPosition"
|
|
14
|
+
:inline="inline"
|
|
15
|
+
@change="changeHandler"
|
|
16
|
+
></Form>
|
|
17
|
+
<slot></slot>
|
|
18
|
+
</TMagicScrollbar>
|
|
17
19
|
</div>
|
|
18
20
|
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</TMagicCol>
|
|
25
|
-
<TMagicCol :span="12">
|
|
21
|
+
<div class="dialog-footer" :style="`height: ${footerHeight}px`">
|
|
22
|
+
<div>
|
|
23
|
+
<slot name="left"></slot>
|
|
24
|
+
</div>
|
|
25
|
+
<div>
|
|
26
26
|
<slot name="footer">
|
|
27
|
-
<TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
|
|
27
|
+
<TMagicButton type="primary" :size="size" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
|
|
28
28
|
confirmText
|
|
29
29
|
}}</TMagicButton>
|
|
30
30
|
</slot>
|
|
31
|
-
</
|
|
32
|
-
</
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
33
|
</div>
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
|
-
import { ref, watchEffect } from 'vue';
|
|
37
|
+
import { computed, ref, watchEffect } from 'vue';
|
|
38
38
|
|
|
39
|
-
import { TMagicButton,
|
|
39
|
+
import { TMagicButton, TMagicScrollbar } from '@tmagic/design';
|
|
40
40
|
|
|
41
41
|
import Form from './Form.vue';
|
|
42
42
|
import type { FormConfig } from './schema';
|
|
43
43
|
|
|
44
44
|
defineOptions({
|
|
45
|
-
name: '
|
|
45
|
+
name: 'MFormBox',
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
withDefaults(
|
|
48
|
+
const props = withDefaults(
|
|
49
49
|
defineProps<{
|
|
50
50
|
config?: FormConfig;
|
|
51
51
|
values?: Object;
|
|
52
52
|
parentValues?: Object;
|
|
53
|
-
width?:
|
|
53
|
+
width?: number;
|
|
54
|
+
height?: number;
|
|
54
55
|
labelWidth?: string;
|
|
55
56
|
disabled?: boolean;
|
|
56
57
|
size?: 'small' | 'default' | 'large';
|
|
@@ -67,15 +68,29 @@ withDefaults(
|
|
|
67
68
|
|
|
68
69
|
const emit = defineEmits(['submit', 'change', 'error']);
|
|
69
70
|
|
|
71
|
+
const footerHeight = 60;
|
|
72
|
+
|
|
73
|
+
const style = computed(() => {
|
|
74
|
+
const style: { width?: string; height?: string } = {};
|
|
75
|
+
if (typeof props.width === 'number') {
|
|
76
|
+
style.width = `${props.width}px`;
|
|
77
|
+
}
|
|
78
|
+
if (typeof props.height === 'number') {
|
|
79
|
+
style.height = `${props.height}px`;
|
|
80
|
+
}
|
|
81
|
+
return style;
|
|
82
|
+
});
|
|
83
|
+
|
|
70
84
|
const form = ref<InstanceType<typeof Form>>();
|
|
71
|
-
const boxBody = ref<HTMLDivElement>();
|
|
72
85
|
const saveFetch = ref(false);
|
|
86
|
+
|
|
73
87
|
const bodyHeight = ref(0);
|
|
74
88
|
|
|
75
89
|
watchEffect(() => {
|
|
76
|
-
if (
|
|
77
|
-
|
|
90
|
+
if (!props.height) {
|
|
91
|
+
return;
|
|
78
92
|
}
|
|
93
|
+
bodyHeight.value = props.height - footerHeight;
|
|
79
94
|
});
|
|
80
95
|
|
|
81
96
|
const submitHandler = async () => {
|
|
@@ -98,7 +113,6 @@ const hide = () => {};
|
|
|
98
113
|
defineExpose({
|
|
99
114
|
form,
|
|
100
115
|
saveFetch,
|
|
101
|
-
bodyHeight,
|
|
102
116
|
|
|
103
117
|
show,
|
|
104
118
|
hide,
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<TMagicCheckbox
|
|
9
9
|
v-model="model[name].value"
|
|
10
10
|
:prop="`${prop}${prop ? '.' : ''}${config.name}.value`"
|
|
11
|
-
:true-
|
|
12
|
-
:false-
|
|
11
|
+
:true-value="1"
|
|
12
|
+
:false-value="0"
|
|
13
13
|
@update:modelValue="change"
|
|
14
14
|
><span v-html="config.legend"></span><span v-if="config.extra" v-html="config.extra" class="m-form-tip"></span
|
|
15
15
|
></TMagicCheckbox>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="m-fields-group-list-item">
|
|
3
3
|
<div>
|
|
4
|
-
<TMagicButton link :disabled="disabled"
|
|
5
|
-
title
|
|
6
|
-
|
|
4
|
+
<TMagicButton link :disabled="disabled" @click="expandHandler">
|
|
5
|
+
<TMagicIcon><CaretBottom v-if="expand" /><CaretRight v-else /></TMagicIcon>{{ title }}
|
|
6
|
+
</TMagicButton>
|
|
7
7
|
|
|
8
8
|
<TMagicButton
|
|
9
9
|
v-show="showDelete(parseInt(String(index)))"
|
package/src/theme/form-box.scss
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
.m-form-box {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
|
-
padding: 16px;
|
|
5
|
-
box-sizing: border-box;
|
|
6
4
|
.el-box__header {
|
|
7
5
|
margin: 0;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
.m-box-body {
|
|
11
|
-
flex: 1;
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
overflow-x: hidden;
|
|
14
|
-
}
|
|
15
8
|
.dialog-footer {
|
|
16
|
-
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: space-between;
|
|
17
12
|
}
|
|
18
13
|
}
|
package/types/FormBox.vue.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
3
3
|
config?: FormConfig | undefined;
|
|
4
4
|
values?: Object | undefined;
|
|
5
5
|
parentValues?: Object | undefined;
|
|
6
|
-
width?:
|
|
6
|
+
width?: number | undefined;
|
|
7
|
+
height?: number | undefined;
|
|
7
8
|
labelWidth?: string | undefined;
|
|
8
9
|
disabled?: boolean | undefined;
|
|
9
10
|
size?: "large" | "default" | "small" | undefined;
|
|
@@ -266,7 +267,6 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
266
267
|
labelPosition: string;
|
|
267
268
|
}> | undefined>;
|
|
268
269
|
saveFetch: import("vue").Ref<boolean>;
|
|
269
|
-
bodyHeight: import("vue").Ref<number>;
|
|
270
270
|
show: () => void;
|
|
271
271
|
hide: () => void;
|
|
272
272
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -277,7 +277,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
277
277
|
config?: FormConfig | undefined;
|
|
278
278
|
values?: Object | undefined;
|
|
279
279
|
parentValues?: Object | undefined;
|
|
280
|
-
width?:
|
|
280
|
+
width?: number | undefined;
|
|
281
|
+
height?: number | undefined;
|
|
281
282
|
labelWidth?: string | undefined;
|
|
282
283
|
disabled?: boolean | undefined;
|
|
283
284
|
size?: "large" | "default" | "small" | undefined;
|