@flowgram.ai/form 0.3.4 → 0.3.6

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/index.d.mts CHANGED
@@ -264,6 +264,7 @@ declare class FormModel<TValues = any> implements Disposable {
264
264
  getValueIn<TValue>(name: FieldName): TValue;
265
265
  setValueIn<TValue>(name: FieldName, value: TValue): void;
266
266
  setInitValueIn<TValue = any>(name: FieldName, value: TValue): void;
267
+ validateDisabled: boolean;
267
268
  clearValueIn(name: FieldName): void;
268
269
  validateIn(name: FieldName): Promise<(string | FormErrorOptions | FormWarningOptions | undefined)[] | undefined>;
269
270
  protected getValidateOptions(): Record<string, Validate> | undefined;
package/dist/index.d.ts CHANGED
@@ -264,6 +264,7 @@ declare class FormModel<TValues = any> implements Disposable {
264
264
  getValueIn<TValue>(name: FieldName): TValue;
265
265
  setValueIn<TValue>(name: FieldName, value: TValue): void;
266
266
  setInitValueIn<TValue = any>(name: FieldName, value: TValue): void;
267
+ validateDisabled: boolean;
267
268
  clearValueIn(name: FieldName): void;
268
269
  validateIn(name: FieldName): Promise<(string | FormErrorOptions | FormWarningOptions | undefined)[] | undefined>;
269
270
  protected getValidateOptions(): Record<string, Validate> | undefined;
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ function shallowSetIn(obj, path, value) {
93
93
  resVal = resVal[currentPath] = isInteger(nextPath) && Number(nextPath) >= 0 ? [] : {};
94
94
  }
95
95
  }
96
- if ((i === 0 ? obj : resVal)[pathArray[i]] === value) {
96
+ if ((i === 0 ? obj : resVal)[pathArray[i]] === value && pathArray[i] in obj) {
97
97
  return obj;
98
98
  }
99
99
  resVal[pathArray[i]] = value;
@@ -1283,6 +1283,7 @@ var FormModel = class {
1283
1283
  createFormModelState()
1284
1284
  );
1285
1285
  this._initialized = false;
1286
+ this.validateDisabled = false;
1286
1287
  }
1287
1288
  set fieldMap(map) {
1288
1289
  this._fieldMap = map;
@@ -1424,6 +1425,7 @@ var FormModel = class {
1424
1425
  this.setValueIn(name, void 0);
1425
1426
  }
1426
1427
  async validateIn(name) {
1428
+ if (this.validateDisabled) return [];
1427
1429
  const validateOptions = this.getValidateOptions();
1428
1430
  if (!validateOptions) {
1429
1431
  return;
@@ -1450,6 +1452,7 @@ var FormModel = class {
1450
1452
  return validate;
1451
1453
  }
1452
1454
  async validate() {
1455
+ if (this.validateDisabled) return [];
1453
1456
  const validateOptions = this.getValidateOptions();
1454
1457
  if (!validateOptions) {
1455
1458
  return [];