@tmagic/form 1.2.0-beta.16 → 1.2.0-beta.18
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/tmagic-form.mjs
CHANGED
|
@@ -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, {
|
|
@@ -3627,5 +3627,5 @@ const index = {
|
|
|
3627
3627
|
install
|
|
3628
3628
|
};
|
|
3629
3629
|
|
|
3630
|
-
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 };
|
|
3630
|
+
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 };
|
|
3631
3631
|
//# sourceMappingURL=tmagic-form.mjs.map
|