@tmagic/form 1.0.0-beta.1 → 1.0.0-beta.12
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/LICENSE +5432 -0
- package/README.md +1 -0
- package/dist/style.css +0 -1
- package/dist/tmagic-form.es.js +71 -47
- package/dist/tmagic-form.es.js.map +1 -1
- package/dist/tmagic-form.umd.js +71 -47
- package/dist/tmagic-form.umd.js.map +1 -1
- package/dist/types/src/containers/Container.vue.d.ts +1 -1
- package/dist/types/src/containers/Fieldset.vue.d.ts +1 -1
- package/dist/types/src/containers/GroupList.vue.d.ts +1 -1
- package/dist/types/src/containers/GroupListItem.vue.d.ts +1 -1
- package/dist/types/src/containers/Panel.vue.d.ts +1 -1
- package/dist/types/src/containers/Row.vue.d.ts +1 -1
- package/dist/types/src/containers/Step.vue.d.ts +1 -1
- package/dist/types/src/containers/Tabs.vue.d.ts +2 -2
- package/dist/types/src/fields/Checkbox.vue.d.ts +2 -2
- package/dist/types/src/fields/CheckboxGroup.vue.d.ts +2 -2
- package/dist/types/src/fields/Date.vue.d.ts +2 -2
- package/dist/types/src/fields/DateTime.vue.d.ts +2 -2
- package/dist/types/src/fields/Daterange.vue.d.ts +2 -2
- package/dist/types/src/fields/DynamicField.vue.d.ts +2 -2
- package/dist/types/src/fields/Number.vue.d.ts +2 -2
- package/dist/types/src/fields/RadioGroup.vue.d.ts +2 -2
- package/dist/types/src/fields/Switch.vue.d.ts +2 -2
- package/dist/types/src/fields/Text.vue.d.ts +2 -2
- package/dist/types/src/fields/Textarea.vue.d.ts +2 -2
- package/dist/types/src/fields/Time.vue.d.ts +2 -2
- package/dist/types/src/schema.d.ts +2 -0
- package/package.json +10 -8
- package/src/Form.vue +39 -30
- package/src/FormDialog.vue +3 -0
- package/src/containers/Container.vue +20 -7
- package/src/containers/Table.vue +8 -6
- package/src/containers/Tabs.vue +4 -0
- package/src/fields/Select.vue +4 -3
- package/src/fields/Text.vue +4 -4
- package/src/schema.ts +2 -0
- package/src/theme/table.scss +0 -1
- package/src/utils/form.ts +5 -1
- package/dist/types/src/Form.vue.d.ts +0 -304
- package/dist/types/src/FormDialog.vue.d.ts +0 -641
- package/dist/types/src/containers/Table.vue.d.ts +0 -1401
- package/dist/types/src/fields/Cascader.vue.d.ts +0 -1748
- package/dist/types/src/fields/Link.vue.d.ts +0 -1365
- package/dist/types/src/fields/Select.vue.d.ts +0 -975
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# [文档](https://tencent.github.io/tmagic-editor/docs/)
|
package/dist/style.css
CHANGED
package/dist/tmagic-form.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, watch, unref, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, provide } from 'vue';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ElMessage
|
|
1
|
+
import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, toRefs, getCurrentInstance, watch, unref, reactive, onBeforeUnmount, vModelText, onBeforeMount, resolveDirective, createSlots, withModifiers, provide } from 'vue';
|
|
2
|
+
import { WarningFilled, CaretRight, CaretBottom, Delete, ArrowDown, ArrowUp, FullScreen, Grid } from '@element-plus/icons';
|
|
3
|
+
import { cloneDeep, isEqual } from 'lodash-es';
|
|
4
|
+
import { ElMessage } from 'element-plus';
|
|
5
5
|
import Sortable from 'sortablejs';
|
|
6
6
|
import { asyncLoadJs, sleep, datetimeFormatter } from '@tmagic/utils';
|
|
7
7
|
|
|
@@ -59,7 +59,11 @@ const initValueItem = function(mForm, item, initValue2, value) {
|
|
|
59
59
|
asyncLoadConfig(value, initValue2, item);
|
|
60
60
|
if (name && !items && typeof initValue2[name] !== "undefined") {
|
|
61
61
|
if (typeof value[name] === "undefined") {
|
|
62
|
-
|
|
62
|
+
if (type === "number") {
|
|
63
|
+
value[name] = Number(initValue2[name]);
|
|
64
|
+
} else {
|
|
65
|
+
value[name] = typeof initValue2[name] === "object" ? cloneDeep(initValue2[name]) : initValue2[name];
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
return value;
|
|
65
69
|
}
|
|
@@ -171,6 +175,7 @@ var _export_sfc = (sfc, props) => {
|
|
|
171
175
|
|
|
172
176
|
const _sfc_main$s = defineComponent({
|
|
173
177
|
name: "m-form-container",
|
|
178
|
+
components: { WarningFilled },
|
|
174
179
|
props: {
|
|
175
180
|
labelWidth: String,
|
|
176
181
|
expandMore: Boolean,
|
|
@@ -264,9 +269,14 @@ const _sfc_main$s = defineComponent({
|
|
|
264
269
|
};
|
|
265
270
|
const onChangeHandler = async function(v, key2) {
|
|
266
271
|
const { filter, onChange, trim, name: name2, dynamicKey } = props.config;
|
|
267
|
-
let value =
|
|
268
|
-
|
|
269
|
-
|
|
272
|
+
let value = v;
|
|
273
|
+
try {
|
|
274
|
+
value = filterHandler(filter, v);
|
|
275
|
+
value = await changeHandler(onChange, value) ?? value;
|
|
276
|
+
value = trimHandler(trim, value) ?? value;
|
|
277
|
+
} catch (e) {
|
|
278
|
+
console.error(e);
|
|
279
|
+
}
|
|
270
280
|
if ((name2 || name2 === 0) && props.model !== value && (v !== value || props.model[name2] !== value)) {
|
|
271
281
|
props.model[name2] = value;
|
|
272
282
|
}
|
|
@@ -296,9 +306,8 @@ const _sfc_main$s = defineComponent({
|
|
|
296
306
|
const _hoisted_1$g = ["innerHTML"];
|
|
297
307
|
const _hoisted_2$7 = ["innerHTML"];
|
|
298
308
|
const _hoisted_3$7 = ["innerHTML"];
|
|
299
|
-
const _hoisted_4$6 =
|
|
300
|
-
const _hoisted_5$4 =
|
|
301
|
-
const _hoisted_6$3 = {
|
|
309
|
+
const _hoisted_4$6 = ["innerHTML"];
|
|
310
|
+
const _hoisted_5$4 = {
|
|
302
311
|
key: 4,
|
|
303
312
|
style: { "text-align": "center" }
|
|
304
313
|
};
|
|
@@ -306,11 +315,13 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
306
315
|
const _component_m_fields_hidden = resolveComponent("m-fields-hidden");
|
|
307
316
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
308
317
|
const _component_el_form_item = resolveComponent("el-form-item");
|
|
318
|
+
const _component_warning_filled = resolveComponent("warning-filled");
|
|
319
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
309
320
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
310
321
|
const _component_el_button = resolveComponent("el-button");
|
|
311
322
|
return _ctx.config ? (openBlock(), createElementBlock("div", {
|
|
312
323
|
key: 0,
|
|
313
|
-
style: normalizeStyle(_ctx.config.tip ? "display: flex" : ""),
|
|
324
|
+
style: normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
|
|
314
325
|
class: normalizeClass([_ctx.config.className, "m-form-container"])
|
|
315
326
|
}, [
|
|
316
327
|
_ctx.type === "hidden" ? (openBlock(), createBlock(_component_m_fields_hidden, {
|
|
@@ -381,16 +392,20 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
381
392
|
}, 8, ["style", "prop", "label-width", "rules"]),
|
|
382
393
|
_ctx.config.tip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
383
394
|
key: 0,
|
|
384
|
-
placement: "top"
|
|
385
|
-
style: { "line-height": "40px", "margin-left": "5px" }
|
|
395
|
+
placement: "top"
|
|
386
396
|
}, {
|
|
387
397
|
content: withCtx(() => [
|
|
388
398
|
createElementVNode("div", {
|
|
389
399
|
innerHTML: _ctx.config.tip
|
|
390
|
-
}, null, 8,
|
|
400
|
+
}, null, 8, _hoisted_4$6)
|
|
391
401
|
]),
|
|
392
402
|
default: withCtx(() => [
|
|
393
|
-
|
|
403
|
+
createVNode(_component_el_icon, { style: { "line-height": "40px", "margin-left": "5px" } }, {
|
|
404
|
+
default: withCtx(() => [
|
|
405
|
+
createVNode(_component_warning_filled)
|
|
406
|
+
]),
|
|
407
|
+
_: 1
|
|
408
|
+
})
|
|
394
409
|
]),
|
|
395
410
|
_: 1
|
|
396
411
|
})) : createCommentVNode("", true)
|
|
@@ -409,7 +424,7 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
409
424
|
}, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop", "onChange"]);
|
|
410
425
|
}), 128)) : createCommentVNode("", true)
|
|
411
426
|
], 64)) : createCommentVNode("", true),
|
|
412
|
-
_ctx.config.expand && _ctx.type !== "fieldset" ? (openBlock(), createElementBlock("div",
|
|
427
|
+
_ctx.config.expand && _ctx.type !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
|
|
413
428
|
createVNode(_component_el_button, {
|
|
414
429
|
type: "text",
|
|
415
430
|
onClick: _ctx.expandHandler
|
|
@@ -1359,6 +1374,8 @@ const _sfc_main$l = defineComponent({
|
|
|
1359
1374
|
ArrowDown,
|
|
1360
1375
|
ArrowUp,
|
|
1361
1376
|
Delete,
|
|
1377
|
+
FullScreen,
|
|
1378
|
+
Grid,
|
|
1362
1379
|
data: computed(() => props.model[modelName.value].filter((item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value)),
|
|
1363
1380
|
addable: computed(() => {
|
|
1364
1381
|
if (!props.model[modelName.value].length) {
|
|
@@ -1607,7 +1624,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1607
1624
|
})) : createCommentVNode("", true),
|
|
1608
1625
|
createVNode(_component_el_table_column, {
|
|
1609
1626
|
label: "\u64CD\u4F5C",
|
|
1610
|
-
width: "
|
|
1627
|
+
width: "60",
|
|
1611
1628
|
fixed: _ctx.config.fixed === false ? void 0 : "left"
|
|
1612
1629
|
}, {
|
|
1613
1630
|
default: withCtx((scope) => [
|
|
@@ -1625,7 +1642,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1625
1642
|
_ctx.sort && _ctx.model[_ctx.modelName] && _ctx.model[_ctx.modelName].length > 1 ? (openBlock(), createBlock(_component_el_table_column, {
|
|
1626
1643
|
key: 1,
|
|
1627
1644
|
label: "\u6392\u5E8F",
|
|
1628
|
-
width: "
|
|
1645
|
+
width: "60"
|
|
1629
1646
|
}, {
|
|
1630
1647
|
default: withCtx((scope) => [
|
|
1631
1648
|
scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1 !== 0 ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
@@ -1673,7 +1690,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1673
1690
|
width: "45"
|
|
1674
1691
|
})) : createCommentVNode("", true),
|
|
1675
1692
|
createVNode(_component_el_table_column, {
|
|
1676
|
-
width: "
|
|
1693
|
+
width: "60",
|
|
1677
1694
|
label: "\u5E8F\u53F7"
|
|
1678
1695
|
}, {
|
|
1679
1696
|
default: withCtx((scope) => [
|
|
@@ -1730,7 +1747,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1730
1747
|
_hoisted_5,
|
|
1731
1748
|
_ctx.enableToggleMode && !_ctx.isFullscreen ? (openBlock(), createBlock(_component_el_button, {
|
|
1732
1749
|
key: 1,
|
|
1733
|
-
icon:
|
|
1750
|
+
icon: _ctx.Grid,
|
|
1734
1751
|
size: "small",
|
|
1735
1752
|
onClick: _ctx.toggleMode
|
|
1736
1753
|
}, {
|
|
@@ -1738,10 +1755,10 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1738
1755
|
_hoisted_6
|
|
1739
1756
|
]),
|
|
1740
1757
|
_: 1
|
|
1741
|
-
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
1758
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("", true),
|
|
1742
1759
|
_ctx.config.enableFullscreen !== false ? (openBlock(), createBlock(_component_el_button, {
|
|
1743
1760
|
key: 2,
|
|
1744
|
-
icon:
|
|
1761
|
+
icon: _ctx.FullScreen,
|
|
1745
1762
|
size: "small",
|
|
1746
1763
|
onClick: _ctx.toggleFullscreen
|
|
1747
1764
|
}, {
|
|
@@ -1749,7 +1766,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1749
1766
|
createTextVNode(toDisplayString(_ctx.isFullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u7F16\u8F91"), 1)
|
|
1750
1767
|
]),
|
|
1751
1768
|
_: 1
|
|
1752
|
-
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
1769
|
+
}, 8, ["icon", "onClick"])) : createCommentVNode("", true),
|
|
1753
1770
|
_ctx.importable ? (openBlock(), createBlock(_component_el_upload, {
|
|
1754
1771
|
key: 3,
|
|
1755
1772
|
ref: "excelBtn",
|
|
@@ -1815,6 +1832,7 @@ const getActive = (mForm, props, activeTabName) => {
|
|
|
1815
1832
|
};
|
|
1816
1833
|
const tabClickHandler = (mForm, tab, props) => {
|
|
1817
1834
|
const { config, model, prop } = props;
|
|
1835
|
+
tab.name = tab.paneName;
|
|
1818
1836
|
if (typeof config.onTabClick === "function") {
|
|
1819
1837
|
config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
|
|
1820
1838
|
}
|
|
@@ -2934,6 +2952,7 @@ const _sfc_main$6 = defineComponent({
|
|
|
2934
2952
|
watch(() => mForm?.values, () => {
|
|
2935
2953
|
typeof props.config.options === "function" && Promise.resolve(props.config.options(mForm, {
|
|
2936
2954
|
model: props.model,
|
|
2955
|
+
prop: props.prop,
|
|
2937
2956
|
formValues: mForm?.values,
|
|
2938
2957
|
formValue: mForm?.values
|
|
2939
2958
|
})).then((data) => {
|
|
@@ -2983,11 +3002,10 @@ const _sfc_main$6 = defineComponent({
|
|
|
2983
3002
|
remote,
|
|
2984
3003
|
options,
|
|
2985
3004
|
moreLoadingVisible,
|
|
3005
|
+
popperClass: mForm?.popperClass,
|
|
2986
3006
|
getRequestFuc() {
|
|
2987
3007
|
return getConfig("request");
|
|
2988
3008
|
},
|
|
2989
|
-
async getInitOption() {
|
|
2990
|
-
},
|
|
2991
3009
|
changeHandler(value) {
|
|
2992
3010
|
emit("change", value);
|
|
2993
3011
|
},
|
|
@@ -3036,6 +3054,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3036
3054
|
ref: "select",
|
|
3037
3055
|
clearable: "",
|
|
3038
3056
|
filterable: "",
|
|
3057
|
+
"popper-class": `m-select-popper ${_ctx.popperClass}`,
|
|
3039
3058
|
size: _ctx.size,
|
|
3040
3059
|
remote: _ctx.remote,
|
|
3041
3060
|
placeholder: _ctx.config.placeholder,
|
|
@@ -3043,7 +3062,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3043
3062
|
"value-key": _ctx.config.valueKey || "value",
|
|
3044
3063
|
"allow-create": _ctx.config.allowCreate,
|
|
3045
3064
|
disabled: _ctx.disabled,
|
|
3046
|
-
"remote-method": _ctx.remoteMethod,
|
|
3065
|
+
"remote-method": _ctx.config.remote && _ctx.remoteMethod,
|
|
3047
3066
|
onChange: _ctx.changeHandler,
|
|
3048
3067
|
onVisibleChange: _ctx.visibleHandler
|
|
3049
3068
|
}, {
|
|
@@ -3079,7 +3098,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3079
3098
|
]) : createCommentVNode("", true)
|
|
3080
3099
|
]),
|
|
3081
3100
|
_: 1
|
|
3082
|
-
}, 8, ["modelValue", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method", "onChange", "onVisibleChange"])), [
|
|
3101
|
+
}, 8, ["modelValue", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method", "onChange", "onVisibleChange"])), [
|
|
3083
3102
|
[_directive_loading, _ctx.loading]
|
|
3084
3103
|
]) : createCommentVNode("", true);
|
|
3085
3104
|
}
|
|
@@ -3151,6 +3170,7 @@ const _sfc_main$4 = defineComponent({
|
|
|
3151
3170
|
},
|
|
3152
3171
|
emits: ["change", "input"],
|
|
3153
3172
|
setup(props, { emit }) {
|
|
3173
|
+
const mForm = inject("mForm");
|
|
3154
3174
|
useAddField(props.prop);
|
|
3155
3175
|
const modelName = computed(() => props.name || props.config.name || "");
|
|
3156
3176
|
return {
|
|
@@ -3159,12 +3179,10 @@ const _sfc_main$4 = defineComponent({
|
|
|
3159
3179
|
emit("change", v);
|
|
3160
3180
|
},
|
|
3161
3181
|
inputHandler(v) {
|
|
3162
|
-
const mForm = inject("mForm");
|
|
3163
3182
|
emit("input", v);
|
|
3164
3183
|
mForm?.$emit("field-input", props.prop, v);
|
|
3165
3184
|
},
|
|
3166
3185
|
buttonClickHandler() {
|
|
3167
|
-
const mForm = inject("mForm");
|
|
3168
3186
|
if (typeof props.config.append === "string")
|
|
3169
3187
|
return;
|
|
3170
3188
|
if (props.config.append?.handler) {
|
|
@@ -3250,13 +3268,14 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3250
3268
|
typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (openBlock(), createBlock(_component_el_button, {
|
|
3251
3269
|
key: 1,
|
|
3252
3270
|
style: { "color": "#409eff" },
|
|
3253
|
-
|
|
3271
|
+
size: _ctx.size,
|
|
3272
|
+
onClick: withModifiers(_ctx.buttonClickHandler, ["prevent"])
|
|
3254
3273
|
}, {
|
|
3255
3274
|
default: withCtx(() => [
|
|
3256
3275
|
createTextVNode(toDisplayString(_ctx.config.append.text), 1)
|
|
3257
3276
|
]),
|
|
3258
3277
|
_: 1
|
|
3259
|
-
}, 8, ["onClick"])) : createCommentVNode("", true)
|
|
3278
|
+
}, 8, ["size", "onClick"])) : createCommentVNode("", true)
|
|
3260
3279
|
])
|
|
3261
3280
|
} : void 0
|
|
3262
3281
|
]), 1032, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"]);
|
|
@@ -3355,7 +3374,6 @@ var Time = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]])
|
|
|
3355
3374
|
|
|
3356
3375
|
const _sfc_main$1 = defineComponent({
|
|
3357
3376
|
name: "m-form",
|
|
3358
|
-
components: { ElForm, MContainer: Container },
|
|
3359
3377
|
props: {
|
|
3360
3378
|
initValues: {
|
|
3361
3379
|
type: Object,
|
|
@@ -3388,8 +3406,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3388
3406
|
default: () => 1
|
|
3389
3407
|
},
|
|
3390
3408
|
size: {
|
|
3391
|
-
type: String
|
|
3392
|
-
default: "small"
|
|
3409
|
+
type: String
|
|
3393
3410
|
},
|
|
3394
3411
|
inline: {
|
|
3395
3412
|
type: Boolean,
|
|
@@ -3402,6 +3419,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
3402
3419
|
keyProp: {
|
|
3403
3420
|
type: String,
|
|
3404
3421
|
default: "__key"
|
|
3422
|
+
},
|
|
3423
|
+
popperClass: {
|
|
3424
|
+
type: String
|
|
3405
3425
|
}
|
|
3406
3426
|
},
|
|
3407
3427
|
emits: ["change", "field-input", "field-change"],
|
|
@@ -3413,6 +3433,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3413
3433
|
const requestFuc = getConfig("request");
|
|
3414
3434
|
const formState = reactive({
|
|
3415
3435
|
keyProp: props.keyProp,
|
|
3436
|
+
popperClass: props.popperClass,
|
|
3416
3437
|
config: props.config,
|
|
3417
3438
|
initValues: props.initValues,
|
|
3418
3439
|
parentValues: props.parentValues,
|
|
@@ -3432,8 +3453,10 @@ const _sfc_main$1 = defineComponent({
|
|
|
3432
3453
|
}
|
|
3433
3454
|
});
|
|
3434
3455
|
provide("mForm", formState);
|
|
3435
|
-
|
|
3436
|
-
|
|
3456
|
+
watch([() => props.config, () => props.initValues], ([config], [preConfig]) => {
|
|
3457
|
+
if (!isEqual(toRaw(config), toRaw(preConfig))) {
|
|
3458
|
+
initialized.value = false;
|
|
3459
|
+
}
|
|
3437
3460
|
initValue(formState, {
|
|
3438
3461
|
initValues: props.initValues,
|
|
3439
3462
|
config: props.config
|
|
@@ -3441,7 +3464,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3441
3464
|
values.value = value;
|
|
3442
3465
|
initialized.value = true;
|
|
3443
3466
|
});
|
|
3444
|
-
});
|
|
3467
|
+
}, { immediate: true });
|
|
3445
3468
|
return {
|
|
3446
3469
|
initialized,
|
|
3447
3470
|
values,
|
|
@@ -3474,10 +3497,9 @@ const _sfc_main$1 = defineComponent({
|
|
|
3474
3497
|
}
|
|
3475
3498
|
});
|
|
3476
3499
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3477
|
-
const
|
|
3478
|
-
const
|
|
3479
|
-
return
|
|
3480
|
-
key: 0,
|
|
3500
|
+
const _component_m_form_container = resolveComponent("m-form-container");
|
|
3501
|
+
const _component_el_form = resolveComponent("el-form");
|
|
3502
|
+
return openBlock(), createBlock(_component_el_form, {
|
|
3481
3503
|
class: "m-form",
|
|
3482
3504
|
ref: "elForm",
|
|
3483
3505
|
model: _ctx.values,
|
|
@@ -3488,8 +3510,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3488
3510
|
"label-position": _ctx.labelPosition
|
|
3489
3511
|
}, {
|
|
3490
3512
|
default: withCtx(() => [
|
|
3491
|
-
(openBlock(true), createElementBlock(Fragment,
|
|
3492
|
-
return openBlock(), createBlock(
|
|
3513
|
+
_ctx.initialized && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
|
|
3514
|
+
return openBlock(), createBlock(_component_m_form_container, {
|
|
3493
3515
|
key: item[_ctx.keyProp] ?? index,
|
|
3494
3516
|
config: item,
|
|
3495
3517
|
model: _ctx.values,
|
|
@@ -3498,10 +3520,10 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3498
3520
|
size: _ctx.size,
|
|
3499
3521
|
onChange: _ctx.changeHandler
|
|
3500
3522
|
}, null, 8, ["config", "model", "label-width", "step-active", "size", "onChange"]);
|
|
3501
|
-
}), 128))
|
|
3523
|
+
}), 128)) : createCommentVNode("", true)
|
|
3502
3524
|
]),
|
|
3503
3525
|
_: 1
|
|
3504
|
-
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"])
|
|
3526
|
+
}, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"]);
|
|
3505
3527
|
}
|
|
3506
3528
|
var Form = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3507
3529
|
|
|
@@ -3521,6 +3543,7 @@ const _sfc_main = defineComponent({
|
|
|
3521
3543
|
default: () => []
|
|
3522
3544
|
},
|
|
3523
3545
|
labelWidth: [Number, String],
|
|
3546
|
+
size: String,
|
|
3524
3547
|
confirmText: {
|
|
3525
3548
|
type: String,
|
|
3526
3549
|
default: "\u786E\u5B9A"
|
|
@@ -3691,11 +3714,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3691
3714
|
modelValue: _ctx.stepActive,
|
|
3692
3715
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
|
|
3693
3716
|
ref: "form",
|
|
3717
|
+
size: _ctx.size,
|
|
3694
3718
|
config: _ctx.config,
|
|
3695
3719
|
"init-values": _ctx.values,
|
|
3696
3720
|
"label-width": _ctx.labelWidth,
|
|
3697
3721
|
onChange: _ctx.changeHandler
|
|
3698
|
-
}, null, 8, ["modelValue", "config", "init-values", "label-width", "onChange"]),
|
|
3722
|
+
}, null, 8, ["modelValue", "size", "config", "init-values", "label-width", "onChange"]),
|
|
3699
3723
|
renderSlot(_ctx.$slots, "default")
|
|
3700
3724
|
], 4)
|
|
3701
3725
|
]),
|