kui-utils 0.0.21 → 0.0.23

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/index.d.ts CHANGED
@@ -127,10 +127,14 @@ declare class MultistepForm<T extends object, U extends readonly string[] = []>
127
127
  updateFormFields: (fields: Partial<T>) => void;
128
128
  replaceFieldInArray: <V>(fieldName: keyof T, newValue: V, index: number) => void;
129
129
  addValueToField: (valueName: string, value: any, fieldName?: string | undefined) => void;
130
- getNestedField: (fieldName?: string | undefined) => Partial<T>;
130
+ getNestedField: (fieldName?: string | undefined) => {
131
+ path: Partial<T>;
132
+ fields: Partial<T>;
133
+ };
131
134
  nextStep: () => void;
132
135
  prevStep: () => void;
133
136
  setStage: (stage: Values<U>) => void;
137
+ setStep: (step: number) => void;
134
138
  resetForm: () => void;
135
139
  get stage(): Values<U> | null;
136
140
  }
package/index.js CHANGED
@@ -2238,8 +2238,9 @@ var MultistepForm = /** @class */ (function () {
2238
2238
  this.addValueToField = function (valueName, value, fieldName) {
2239
2239
  if (!_this.fields)
2240
2240
  _this.fields = {};
2241
- var path = _this.getNestedField(fieldName);
2241
+ var _a = _this.getNestedField(fieldName), path = _a.path, fields = _a.fields;
2242
2242
  path[valueName] = value;
2243
+ _this.fields = fields;
2243
2244
  };
2244
2245
  this.getNestedField = function (fieldName) {
2245
2246
  if (!_this.fields)
@@ -2251,11 +2252,12 @@ var MultistepForm = /** @class */ (function () {
2251
2252
  // @ts-ignore
2252
2253
  _this.fields[fieldParts[0]] = [];
2253
2254
  }
2254
- var path = _this.fields;
2255
+ var fields = _this.fields;
2256
+ var path = fields;
2255
2257
  fieldParts === null || fieldParts === void 0 ? void 0 : fieldParts.forEach(function (part) {
2256
2258
  path = path[part];
2257
2259
  });
2258
- return path;
2260
+ return { path: path, fields: fields };
2259
2261
  };
2260
2262
  this.nextStep = function () {
2261
2263
  _this.step += 1;
@@ -2273,6 +2275,9 @@ var MultistepForm = /** @class */ (function () {
2273
2275
  _this.step = _this.associations.indexOf(stage) + 1;
2274
2276
  }
2275
2277
  };
2278
+ this.setStep = function (step) {
2279
+ _this.step = step;
2280
+ };
2276
2281
  this.resetForm = function () {
2277
2282
  _this.fields = null;
2278
2283
  _this.step = 1;