@tmagic/form 1.2.0-beta.17 → 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.
@@ -20,9 +20,9 @@
20
20
  const isMultipleValue = (type) => typeof type === "string" && ["checkbox-group", "checkboxGroup", "table", "cascader", "group-list", "groupList"].includes(type);
21
21
  const initItemsValue = (mForm, value, initValue2, { items, name, extensible }) => {
22
22
  if (Array.isArray(initValue2[name])) {
23
- value[name] = initValue2[name].map((v, index) => init(mForm, items, v, value[name]?.[index]));
23
+ value[name] = initValue2[name].map((v, index) => createValues(mForm, items, v, value[name]?.[index]));
24
24
  } else {
25
- value[name] = init(mForm, items, initValue2[name], value[name]);
25
+ value[name] = createValues(mForm, items, initValue2[name], value[name]);
26
26
  if (extensible) {
27
27
  value[name] = Object.assign({}, initValue2[name], value[name]);
28
28
  }
@@ -67,12 +67,12 @@
67
67
  return names.forEach((n) => value[n] = initValue2[n] || "");
68
68
  }
69
69
  if (!name) {
70
- return init(mForm, items, initValue2, value);
70
+ return createValues(mForm, items, initValue2, value);
71
71
  }
72
72
  setValue(mForm, value, initValue2, item);
73
73
  return value;
74
74
  };
75
- const init = function(mForm, config = [], initValue2 = {}, value = {}) {
75
+ const createValues = function(mForm, config = [], initValue2 = {}, value = {}) {
76
76
  if (Array.isArray(config)) {
77
77
  config.forEach((item) => {
78
78
  initValueItem(mForm, item, initValue2, value);
@@ -159,7 +159,7 @@
159
159
  const initValue = async (mForm, { initValues, config }) => {
160
160
  if (!Array.isArray(config))
161
161
  throw new Error("config\u5E94\u8BE5\u4E3A\u6570\u7EC4");
162
- let valuesTmp = init(mForm, config, vue.toRaw(initValues), {});
162
+ let valuesTmp = createValues(mForm, config, vue.toRaw(initValues), {});
163
163
  const [firstForm] = config;
164
164
  if (firstForm && typeof firstForm.onInitValue === "function") {
165
165
  valuesTmp = await firstForm.onInitValue(mForm, {
@@ -3657,6 +3657,7 @@
3657
3657
  exports.MText = _sfc_main$2;
3658
3658
  exports.MTextarea = _sfc_main$1;
3659
3659
  exports.MTime = _sfc_main;
3660
+ exports.createValues = createValues;
3660
3661
  exports.default = index;
3661
3662
  exports.display = display;
3662
3663
  exports.filterFunction = filterFunction;