@sheinx/hooks 3.3.6-beta.7 → 3.3.7-beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -192,11 +192,11 @@ function useFormControl(props) {
192
192
  if (inForm && controlFunc) {
193
193
  if ((0, _is.isArray)(name)) {
194
194
  name.forEach(function (n) {
195
- controlFunc.unbind(n, reserveAble);
195
+ controlFunc.unbind(n, reserveAble, validateFiled, update);
196
196
  updateError(n, undefined);
197
197
  });
198
198
  } else {
199
- controlFunc.unbind(name, reserveAble);
199
+ controlFunc.unbind(name, reserveAble, validateFiled, update);
200
200
  updateError(name, undefined);
201
201
  }
202
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAmK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAuDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAiI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA1CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAuDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAiI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CA4P9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAuK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAyDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAmI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA5CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAyDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAmI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAoQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -74,8 +74,10 @@ var useForm = function useForm(props) {
74
74
  var _context$flowMap$glob;
75
75
  if (!name) {
76
76
  Object.keys(context.updateMap).forEach(function (key) {
77
- var _context$updateMap$ke, _context$updateMap;
78
- (_context$updateMap$ke = (_context$updateMap = context.updateMap)[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.call(_context$updateMap, context.value, context.errors, context.serverErrors);
77
+ var _context$updateMap$ke;
78
+ (_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
79
+ update(context.value, context.errors, context.serverErrors);
80
+ });
79
81
  });
80
82
  Object.keys(context.flowMap).forEach(function (key) {
81
83
  context.flowMap[key].forEach(function (update) {
@@ -85,8 +87,10 @@ var useForm = function useForm(props) {
85
87
  } else {
86
88
  var names = (0, _utils.isArray)(name) ? name : [name];
87
89
  names.forEach(function (key) {
88
- var _context$updateMap$ke2, _context$updateMap2, _context$flowMap$key;
89
- (_context$updateMap$ke2 = (_context$updateMap2 = context.updateMap)[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.call(_context$updateMap2, context.value, context.errors, context.serverErrors);
90
+ var _context$updateMap$ke2, _context$flowMap$key;
91
+ (_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
92
+ update(context.value, context.errors, context.serverErrors);
93
+ });
90
94
  (_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
91
95
  update();
92
96
  });
@@ -142,9 +146,11 @@ var useForm = function useForm(props) {
142
146
  }) : Object.keys(context.validateMap);
143
147
  var validates = files2.map(function (key) {
144
148
  var validateField = context.validateMap[key];
145
- return validateField(key, (0, _utils.deepGet)(context.value, key), context.value, config);
149
+ return Array.from(validateField).map(function (validate) {
150
+ return validate(key, (0, _utils.deepGet)(context.value, key), context.value, config);
151
+ });
146
152
  });
147
- Promise.all(validates).then(function (results) {
153
+ Promise.all(validates.flat()).then(function (results) {
148
154
  var error = results.find(function (n) {
149
155
  return n !== true;
150
156
  });
@@ -189,8 +195,10 @@ var useForm = function useForm(props) {
189
195
  Object.keys(vals).forEach(function (key) {
190
196
  (0, _utils.deepSet)(draft, key, vals[key], deepSetOptions);
191
197
  if (option.validate) {
192
- var _context$validateMap$, _context$validateMap;
193
- (_context$validateMap$ = (_context$validateMap = context.validateMap)[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.call(_context$validateMap, key, vals[key], (0, _immer.current)(draft));
198
+ var _context$validateMap$;
199
+ (_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
200
+ validate(key, vals[key], (0, _immer.current)(draft));
201
+ });
194
202
  }
195
203
  });
196
204
  });
@@ -334,12 +342,17 @@ var useForm = function useForm(props) {
334
342
  var controlFunc = (0, _useLatestObj.default)({
335
343
  bind: function bind(n, df, validate, updateFn) {
336
344
  if (context.names.has(n)) {
337
- console.error("name \"".concat(n, "\" already exist"));
338
- return;
345
+ console.warn("name \"".concat(n, "\" already exist"));
339
346
  }
340
347
  context.names.add(n);
341
- context.validateMap[n] = validate;
342
- context.updateMap[n] = updateFn;
348
+ if (!context.validateMap[n]) {
349
+ context.validateMap[n] = new Set();
350
+ }
351
+ context.validateMap[n].add(validate);
352
+ if (!context.updateMap[n]) {
353
+ context.updateMap[n] = new Set();
354
+ }
355
+ context.updateMap[n].add(updateFn);
343
356
  context.removeArr.delete(n);
344
357
  if (df !== undefined && (0, _utils.deepGet)(context.value, n) === undefined) {
345
358
  if (!context.mounted) context.defaultValues[n] = df;
@@ -349,11 +362,19 @@ var useForm = function useForm(props) {
349
362
  }
350
363
  update(n);
351
364
  },
352
- unbind: function unbind(n, reserveAble) {
353
- delete context.validateMap[n];
354
- delete context.defaultValues[n];
355
- delete context.updateMap[n];
356
- context.names.delete(n);
365
+ unbind: function unbind(n, reserveAble, validateFiled, update) {
366
+ var validateFieldSet = context.validateMap[n];
367
+ if (validateFiled && validateFieldSet.has(validateFiled)) {
368
+ validateFieldSet.delete(validateFiled);
369
+ }
370
+ var updateFieldSet = context.updateMap[n];
371
+ if (update && updateFieldSet.has(update)) {
372
+ updateFieldSet.delete(update);
373
+ }
374
+ if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
375
+ context.names.delete(n);
376
+ delete context.defaultValues[n];
377
+ }
357
378
  if (!reserveAble && !context.removeLock) {
358
379
  addRemove(n);
359
380
  }
@@ -428,12 +449,12 @@ var useForm = function useForm(props) {
428
449
  React.useEffect(function () {
429
450
  // 服务端错误更新
430
451
  if (!props.error) context.serverErrors = {};else {
431
- var _errors = Object.keys(props.error).reduce(function (prev, cur) {
452
+ var errors = Object.keys(props.error).reduce(function (prev, cur) {
432
453
  var item = props.error[cur];
433
454
  var error = item instanceof Error ? item : new Error(item);
434
455
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cur, error));
435
456
  }, {});
436
- context.serverErrors = _errors;
457
+ context.serverErrors = errors;
437
458
  }
438
459
  update();
439
460
  }, [props.error]);
@@ -2,12 +2,15 @@
2
2
  import { ReactNode } from 'react';
3
3
  import { AddNoProps, ObjectType } from '../../common/type';
4
4
  import { FormItemRule } from '../../utils/rule/rule.type';
5
+ import { FormError } from '../../utils';
6
+ export type ValidateFn = (name: string, value: any, formData: ObjectType, config?: {
7
+ ignoreBind?: boolean;
8
+ }) => Promise<boolean | FormError>;
9
+ export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
5
10
  export interface FormContextValueType {
6
11
  func?: {
7
- unbind: (n: string, reserveAble?: boolean) => void;
8
- bind: (n: string, df: any, validate: (name: string, value: any, formData: ObjectType, config: {
9
- ignoreBind?: boolean;
10
- }) => void, update: (formValue: ObjectType, errors: ObjectType<Error>, serverErrors: ObjectType<Error>) => void) => void;
12
+ unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
13
+ bind: (n: string, df: any, validate: ValidateFn, update: UpdateFn) => void;
11
14
  combineRules: <ValueItem>(name: string, propRules: FormItemRule<ValueItem>) => FormItemRule<ValueItem>;
12
15
  watch: (names: string[] | undefined, update: () => void) => void;
13
16
  unWatch: (names: string[] | undefined, update: () => void) => void;
@@ -149,7 +152,9 @@ export interface BaseFormProps<T> extends FormCommonConfig {
149
152
  export type UseFormProps<T> = BaseFormProps<T>;
150
153
  export type FormContext = {
151
154
  defaultValues: ObjectType;
152
- validateMap: ObjectType;
155
+ validateMap: ObjectType<Set<(name: string, v: any, formValue: ObjectType, config?: {
156
+ ignoreBind?: boolean;
157
+ }) => Promise<boolean | FormError>>>;
153
158
  removeArr: Set<string>;
154
159
  removeTimer?: number | NodeJS.Timeout;
155
160
  names: Set<string>;
@@ -157,7 +162,7 @@ export type FormContext = {
157
162
  lastValue: ObjectType | undefined;
158
163
  resetTime: number;
159
164
  mounted: boolean;
160
- updateMap: ObjectType;
165
+ updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
161
166
  flowMap: ObjectType<Set<() => void>>;
162
167
  value: ObjectType;
163
168
  errors: ObjectType<Error | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE;QACL,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;QACnD,IAAI,EAAE,CACJ,CAAC,EAAE,MAAM,EACT,EAAE,EAAE,GAAG,EACP,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,EACV,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE;YACN,UAAU,CAAC,EAAE,OAAO,CAAC;SACtB,KACE,IAAI,EACT,MAAM,EAAE,CACN,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,EACzB,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC,KAC5B,IAAI,KACN,IAAI,CAAC;QACV,YAAY,EAAE,CAAC,SAAS,EACtB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,YAAY,CAAC,SAA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EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;IACtC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;IAElC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IAEjB,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAEhJ,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACtC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
@@ -183,11 +183,11 @@ export default function useFormControl(props) {
183
183
  if (inForm && controlFunc) {
184
184
  if (isArray(name)) {
185
185
  name.forEach(function (n) {
186
- controlFunc.unbind(n, reserveAble);
186
+ controlFunc.unbind(n, reserveAble, validateFiled, update);
187
187
  updateError(n, undefined);
188
188
  });
189
189
  } else {
190
- controlFunc.unbind(name, reserveAble);
190
+ controlFunc.unbind(name, reserveAble, validateFiled, update);
191
191
  updateError(name, undefined);
192
192
  }
193
193
  }
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAmK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAuDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAiI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA1CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAuDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCArEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAiI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CA4P9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAuK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAyDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAmI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA5CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAyDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAmI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAoQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -65,8 +65,10 @@ var useForm = function useForm(props) {
65
65
  var _context$flowMap$glob;
66
66
  if (!name) {
67
67
  Object.keys(context.updateMap).forEach(function (key) {
68
- var _context$updateMap$ke, _context$updateMap;
69
- (_context$updateMap$ke = (_context$updateMap = context.updateMap)[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.call(_context$updateMap, context.value, context.errors, context.serverErrors);
68
+ var _context$updateMap$ke;
69
+ (_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
70
+ update(context.value, context.errors, context.serverErrors);
71
+ });
70
72
  });
71
73
  Object.keys(context.flowMap).forEach(function (key) {
72
74
  context.flowMap[key].forEach(function (update) {
@@ -76,8 +78,10 @@ var useForm = function useForm(props) {
76
78
  } else {
77
79
  var names = isArray(name) ? name : [name];
78
80
  names.forEach(function (key) {
79
- var _context$updateMap$ke2, _context$updateMap2, _context$flowMap$key;
80
- (_context$updateMap$ke2 = (_context$updateMap2 = context.updateMap)[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.call(_context$updateMap2, context.value, context.errors, context.serverErrors);
81
+ var _context$updateMap$ke2, _context$flowMap$key;
82
+ (_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
83
+ update(context.value, context.errors, context.serverErrors);
84
+ });
81
85
  (_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
82
86
  update();
83
87
  });
@@ -133,9 +137,11 @@ var useForm = function useForm(props) {
133
137
  }) : Object.keys(context.validateMap);
134
138
  var validates = files2.map(function (key) {
135
139
  var validateField = context.validateMap[key];
136
- return validateField(key, deepGet(context.value, key), context.value, config);
140
+ return Array.from(validateField).map(function (validate) {
141
+ return validate(key, deepGet(context.value, key), context.value, config);
142
+ });
137
143
  });
138
- Promise.all(validates).then(function (results) {
144
+ Promise.all(validates.flat()).then(function (results) {
139
145
  var error = results.find(function (n) {
140
146
  return n !== true;
141
147
  });
@@ -180,8 +186,10 @@ var useForm = function useForm(props) {
180
186
  Object.keys(vals).forEach(function (key) {
181
187
  deepSet(draft, key, vals[key], deepSetOptions);
182
188
  if (option.validate) {
183
- var _context$validateMap$, _context$validateMap;
184
- (_context$validateMap$ = (_context$validateMap = context.validateMap)[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.call(_context$validateMap, key, vals[key], current(draft));
189
+ var _context$validateMap$;
190
+ (_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
191
+ validate(key, vals[key], current(draft));
192
+ });
185
193
  }
186
194
  });
187
195
  });
@@ -325,12 +333,17 @@ var useForm = function useForm(props) {
325
333
  var controlFunc = useLatestObj({
326
334
  bind: function bind(n, df, validate, updateFn) {
327
335
  if (context.names.has(n)) {
328
- console.error("name \"".concat(n, "\" already exist"));
329
- return;
336
+ console.warn("name \"".concat(n, "\" already exist"));
330
337
  }
331
338
  context.names.add(n);
332
- context.validateMap[n] = validate;
333
- context.updateMap[n] = updateFn;
339
+ if (!context.validateMap[n]) {
340
+ context.validateMap[n] = new Set();
341
+ }
342
+ context.validateMap[n].add(validate);
343
+ if (!context.updateMap[n]) {
344
+ context.updateMap[n] = new Set();
345
+ }
346
+ context.updateMap[n].add(updateFn);
334
347
  context.removeArr.delete(n);
335
348
  if (df !== undefined && deepGet(context.value, n) === undefined) {
336
349
  if (!context.mounted) context.defaultValues[n] = df;
@@ -340,11 +353,19 @@ var useForm = function useForm(props) {
340
353
  }
341
354
  update(n);
342
355
  },
343
- unbind: function unbind(n, reserveAble) {
344
- delete context.validateMap[n];
345
- delete context.defaultValues[n];
346
- delete context.updateMap[n];
347
- context.names.delete(n);
356
+ unbind: function unbind(n, reserveAble, validateFiled, update) {
357
+ var validateFieldSet = context.validateMap[n];
358
+ if (validateFiled && validateFieldSet.has(validateFiled)) {
359
+ validateFieldSet.delete(validateFiled);
360
+ }
361
+ var updateFieldSet = context.updateMap[n];
362
+ if (update && updateFieldSet.has(update)) {
363
+ updateFieldSet.delete(update);
364
+ }
365
+ if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
366
+ context.names.delete(n);
367
+ delete context.defaultValues[n];
368
+ }
348
369
  if (!reserveAble && !context.removeLock) {
349
370
  addRemove(n);
350
371
  }
@@ -419,12 +440,12 @@ var useForm = function useForm(props) {
419
440
  React.useEffect(function () {
420
441
  // 服务端错误更新
421
442
  if (!props.error) context.serverErrors = {};else {
422
- var _errors = Object.keys(props.error).reduce(function (prev, cur) {
443
+ var errors = Object.keys(props.error).reduce(function (prev, cur) {
423
444
  var item = props.error[cur];
424
445
  var error = item instanceof Error ? item : new Error(item);
425
446
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cur, error));
426
447
  }, {});
427
- context.serverErrors = _errors;
448
+ context.serverErrors = errors;
428
449
  }
429
450
  update();
430
451
  }, [props.error]);
@@ -2,12 +2,15 @@
2
2
  import { ReactNode } from 'react';
3
3
  import { AddNoProps, ObjectType } from '../../common/type';
4
4
  import { FormItemRule } from '../../utils/rule/rule.type';
5
+ import { FormError } from '../../utils';
6
+ export type ValidateFn = (name: string, value: any, formData: ObjectType, config?: {
7
+ ignoreBind?: boolean;
8
+ }) => Promise<boolean | FormError>;
9
+ export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
5
10
  export interface FormContextValueType {
6
11
  func?: {
7
- unbind: (n: string, reserveAble?: boolean) => void;
8
- bind: (n: string, df: any, validate: (name: string, value: any, formData: ObjectType, config: {
9
- ignoreBind?: boolean;
10
- }) => void, update: (formValue: ObjectType, errors: ObjectType<Error>, serverErrors: ObjectType<Error>) => void) => void;
12
+ unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
13
+ bind: (n: string, df: any, validate: ValidateFn, update: UpdateFn) => void;
11
14
  combineRules: <ValueItem>(name: string, propRules: FormItemRule<ValueItem>) => FormItemRule<ValueItem>;
12
15
  watch: (names: string[] | undefined, update: () => void) => void;
13
16
  unWatch: (names: string[] | undefined, update: () => void) => void;
@@ -149,7 +152,9 @@ export interface BaseFormProps<T> extends FormCommonConfig {
149
152
  export type UseFormProps<T> = BaseFormProps<T>;
150
153
  export type FormContext = {
151
154
  defaultValues: ObjectType;
152
- validateMap: ObjectType;
155
+ validateMap: ObjectType<Set<(name: string, v: any, formValue: ObjectType, config?: {
156
+ ignoreBind?: boolean;
157
+ }) => Promise<boolean | FormError>>>;
153
158
  removeArr: Set<string>;
154
159
  removeTimer?: number | NodeJS.Timeout;
155
160
  names: Set<string>;
@@ -157,7 +162,7 @@ export type FormContext = {
157
162
  lastValue: ObjectType | undefined;
158
163
  resetTime: number;
159
164
  mounted: boolean;
160
- updateMap: ObjectType;
165
+ updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
161
166
  flowMap: ObjectType<Set<() => void>>;
162
167
  value: ObjectType;
163
168
  errors: ObjectType<Error | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"use-form.type.d.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