@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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.0-beta.17",
2
+ "version": "1.2.0-beta.18",
3
3
  "name": "@tmagic/form",
4
4
  "sideEffects": [
5
5
  "dist/*",
@@ -35,8 +35,8 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@element-plus/icons-vue": "^2.0.9",
38
- "@tmagic/design": "1.2.0-beta.17",
39
- "@tmagic/utils": "1.2.0-beta.17",
38
+ "@tmagic/design": "1.2.0-beta.18",
39
+ "@tmagic/utils": "1.2.0-beta.18",
40
40
  "lodash-es": "^4.17.21",
41
41
  "sortablejs": "^1.14.0",
42
42
  "vue": "^3.2.37"
package/src/utils/form.ts CHANGED
@@ -62,9 +62,9 @@ const initItemsValue = (
62
62
  { items, name, extensible }: any,
63
63
  ) => {
64
64
  if (Array.isArray(initValue[name])) {
65
- value[name] = initValue[name].map((v: any, index: number) => init(mForm, items, v, value[name]?.[index]));
65
+ value[name] = initValue[name].map((v: any, index: number) => createValues(mForm, items, v, value[name]?.[index]));
66
66
  } else {
67
- value[name] = init(mForm, items, initValue[name], value[name]);
67
+ value[name] = createValues(mForm, items, initValue[name], value[name]);
68
68
  if (extensible) {
69
69
  value[name] = Object.assign({}, initValue[name], value[name]);
70
70
  }
@@ -129,7 +129,7 @@ const initValueItem = function (
129
129
 
130
130
  if (!name) {
131
131
  // 没有配置name,直接跳过
132
- return init(mForm, items, initValue, value);
132
+ return createValues(mForm, items, initValue, value);
133
133
  }
134
134
 
135
135
  setValue(mForm, value, initValue, item);
@@ -137,7 +137,7 @@ const initValueItem = function (
137
137
  return value;
138
138
  };
139
139
 
140
- const init = function (
140
+ export const createValues = function (
141
141
  mForm: FormState | undefined,
142
142
  config: FormConfig | TabPaneConfig[] = [],
143
143
  initValue: FormValue = {},
@@ -253,7 +253,7 @@ export const initValue = async (
253
253
  ) => {
254
254
  if (!Array.isArray(config)) throw new Error('config应该为数组');
255
255
 
256
- let valuesTmp = init(mForm, config, toRaw(initValues), {});
256
+ let valuesTmp = createValues(mForm, config, toRaw(initValues), {});
257
257
 
258
258
  const [firstForm] = config as [ContainerCommonConfig];
259
259
  if (firstForm && typeof firstForm.onInitValue === 'function') {
@@ -1,4 +1,5 @@
1
- import { FormConfig, FormState, FormValue, Rule } from '../schema';
1
+ import { FormConfig, FormState, FormValue, Rule, TabPaneConfig } from '../schema';
2
+ export declare const createValues: (mForm: FormState | undefined, config?: FormConfig | TabPaneConfig[], initValue?: FormValue, value?: FormValue) => FormValue;
2
3
  export declare const filterFunction: (mForm: FormState | undefined, config: any, props: any) => any;
3
4
  export declare const display: (mForm: FormState | undefined, config: any, props: any) => any;
4
5
  export declare const getRules: (mForm: FormState | undefined, rules: Rule | Rule[] | undefined, props: any) => Rule[];