@rolster/forms 2.9.0 → 2.10.0

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.
@@ -58,6 +58,12 @@ function hasError(errors, key) {
58
58
  function someErrors(errors, keys) {
59
59
  return reduceErrors(errors).some((key) => keys.includes(key));
60
60
  }
61
+ function reduceControlsToArray(controls, key) {
62
+ return Object.values(controls).map((control) => control[key]);
63
+ }
64
+ function reduceGroupToArray(group, key) {
65
+ return reduceControlsToArray(group.controls, key);
66
+ }
61
67
 
62
68
  exports.arrayIsValid = arrayIsValid;
63
69
  exports.controlIsValid = controlIsValid;
@@ -68,5 +74,7 @@ exports.groupAllChecked = groupAllChecked;
68
74
  exports.groupIsValid = groupIsValid;
69
75
  exports.groupPartialChecked = groupPartialChecked;
70
76
  exports.hasError = hasError;
77
+ exports.reduceControlsToArray = reduceControlsToArray;
78
+ exports.reduceGroupToArray = reduceGroupToArray;
71
79
  exports.someErrors = someErrors;
72
80
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../esm/helpers.js"],"sourcesContent":["import { parseBoolean } from '@rolster/commons';\nfunction reduceErrors(errors) {\n return errors.reduce((keys, { id }) => [...keys, id], []);\n}\nexport const controlIsValid = ({ value, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(value);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport const controlsAllChecked = (controls, key) => {\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value && parseBoolean(control[key]), true);\n};\nexport const controlsPartialChecked = (controls, key) => {\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value || parseBoolean(control[key]), false);\n};\nexport const controlsToValue = (controls) => {\n return Object.entries(controls).reduce((result, [key, { value }]) => {\n result[key] = value;\n return result;\n }, {});\n};\nexport const groupIsValid = ({ controls, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(controls);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport function groupAllChecked(groups, key) {\n return groups.reduce((value, group) => value && parseBoolean(group[key]), true);\n}\nexport function groupPartialChecked(groups, key) {\n return groups.reduce((value, group) => value || parseBoolean(group[key]), false);\n}\nexport const arrayIsValid = ({ groups, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(groups);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport function hasError(errors, key) {\n return reduceErrors(errors).includes(key);\n}\nexport function someErrors(errors, keys) {\n return reduceErrors(errors).some((key) => keys.includes(key));\n}\n//# sourceMappingURL=helpers.js.map"],"names":["parseBoolean"],"mappings":";;;;;;AACA,SAAS,YAAY,CAAC,MAAM,EAAE;AAC9B,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC;AACW,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK;AACzD,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,SAAS;AACT,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,EAAE;AACU,MAAC,kBAAkB,GAAG,CAAC,QAAQ,EAAE,GAAG,KAAK;AACrD,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,GAAG,KAAK,GAAG,KAAK,IAAIA,oBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAA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AAS,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE;AACjD,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,KAAK,IAAIA,oBAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACrF,CAAC;AACW,MAAC,YAAY,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK;AACxD,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AACxC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/B,SAAS;AACT,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK,EAAE,EAAE,CAAC,CAAC;AACX,EAAE;AACK,SAAS,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;AACtC,IAAI,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC9C,CAAC;AACM,SAAS,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE;AACzC,IAAI,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../esm/helpers.js"],"sourcesContent":["import { parseBoolean } from '@rolster/commons';\nfunction reduceErrors(errors) {\n return errors.reduce((keys, { id }) => [...keys, id], []);\n}\nexport const controlIsValid = ({ value, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(value);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport const controlsAllChecked = (controls, key) => {\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value && parseBoolean(control[key]), true);\n};\nexport const controlsPartialChecked = (controls, key) => {\n return Object.values(controls).reduce((value, control) => control.disabled ? value : value || parseBoolean(control[key]), false);\n};\nexport const controlsToValue = (controls) => {\n return Object.entries(controls).reduce((result, [key, { value }]) => {\n result[key] = value;\n return result;\n }, {});\n};\nexport const groupIsValid = ({ controls, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(controls);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport function groupAllChecked(groups, key) {\n return groups.reduce((value, group) => value && parseBoolean(group[key]), true);\n}\nexport function groupPartialChecked(groups, key) {\n return groups.reduce((value, group) => value || parseBoolean(group[key]), false);\n}\nexport const arrayIsValid = ({ groups, validators }) => {\n return validators.reduce((errors, validator) => {\n const error = validator(groups);\n if (error) {\n errors.push(error);\n }\n return errors;\n }, []);\n};\nexport function hasError(errors, key) {\n return reduceErrors(errors).includes(key);\n}\nexport function someErrors(errors, keys) {\n return reduceErrors(errors).some((key) => keys.includes(key));\n}\nexport function reduceControlsToArray(controls, key) {\n return Object.values(controls).map((control) => control[key]);\n}\nexport function reduceGroupToArray(group, key) {\n return reduceControlsToArray(group.controls, key);\n}\n//# sourceMappingURL=helpers.js.map"],"names":["parseBoolean"],"mappings":";;;;;;AACA,SAAS,YAAY,CAAC,MAAM,EAAE;AAC9B,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC;AACW,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK;AACzD,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,SAAS,KAAK;AACpD,QAAQ,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,QAAQ,IAAI,KAAK,EAAE;AACnB,YAAY,MAAM,CAAC,IAAI,CAAC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,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AACM,SAAS,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE;AACrD,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AAClE,CAAC;AACM,SAAS,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE;AAC/C,IAAI,OAAO,qBAAqB,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACtD;;;;;;;;;;;;;;;"}
package/dist/cjs/index.js CHANGED
@@ -109,58 +109,58 @@ function someErrors(errors, keys) {
109
109
  }
110
110
 
111
111
  class FormControl {
112
- constructor(controlOptions, controlValidators) {
113
- this.currentFocused = false;
114
- this.currentTouched = false;
115
- this.currentDirty = false;
116
- this.currentDisabled = false;
117
- this.currentValid = true;
118
- this.currentErrors = [];
119
- const { value, validators } = createFormControlOptions(controlOptions, controlValidators);
120
- this.observable = commons.observable(value);
121
- this.initialValue = value;
122
- this.validators = validators;
123
- this.currentValue = value;
124
- this.updateValueAndValidity(value, validators);
112
+ constructor(options, validators) {
113
+ this._focused = false;
114
+ this._touched = false;
115
+ this._dirty = false;
116
+ this._disabled = false;
117
+ this._valid = true;
118
+ this._errors = [];
119
+ const _options = createFormControlOptions(options, validators);
120
+ this.observable = commons.observable(_options.value);
121
+ this.currentValue = _options.value;
122
+ this.validators = _options.validators;
123
+ this._value = _options.value;
124
+ this.updateValueAndValidity(_options.value, _options.validators);
125
125
  }
126
126
  get focused() {
127
- return this.currentFocused;
127
+ return this._focused;
128
128
  }
129
129
  get unfocused() {
130
- return !this.currentFocused;
130
+ return !this._focused;
131
131
  }
132
132
  get touched() {
133
- return this.currentTouched;
133
+ return this._touched;
134
134
  }
135
135
  get untouched() {
136
- return !this.currentTouched;
136
+ return !this._touched;
137
137
  }
138
138
  get dirty() {
139
- return this.currentDirty;
139
+ return this._dirty;
140
140
  }
141
141
  get pristine() {
142
- return !this.currentDirty;
142
+ return !this._dirty;
143
143
  }
144
144
  get disabled() {
145
- return this.currentDisabled;
145
+ return this._disabled;
146
146
  }
147
147
  get enabled() {
148
- return !this.currentDisabled;
148
+ return !this._disabled;
149
149
  }
150
150
  get valid() {
151
- return this.currentValid;
151
+ return this._valid;
152
152
  }
153
153
  get invalid() {
154
- return !this.currentValid;
154
+ return !this._valid;
155
155
  }
156
156
  get value() {
157
- return this.currentValue;
157
+ return this._value;
158
158
  }
159
159
  get errors() {
160
- return this.currentErrors;
160
+ return this._errors;
161
161
  }
162
162
  get error() {
163
- return this.currentError;
163
+ return this._error;
164
164
  }
165
165
  get wrong() {
166
166
  return this.touched && this.invalid;
@@ -172,34 +172,34 @@ class FormControl {
172
172
  return someErrors(this.errors, keys);
173
173
  }
174
174
  reset() {
175
- this.setValue(this.initialValue);
176
- this.currentDirty = false;
177
- this.currentTouched = false;
175
+ this.setValue(this.currentValue);
176
+ this._dirty = false;
177
+ this._touched = false;
178
178
  }
179
179
  focus() {
180
- this.currentFocused = true;
180
+ this._focused = true;
181
181
  }
182
182
  blur() {
183
- this.currentFocused = false;
184
- this.currentTouched = true;
183
+ this._focused = false;
184
+ this._touched = true;
185
185
  }
186
186
  disable() {
187
- this.currentDisabled = true;
187
+ this._disabled = true;
188
188
  }
189
189
  enable() {
190
- this.currentDisabled = false;
190
+ this._disabled = false;
191
191
  }
192
192
  touch() {
193
- this.currentTouched = true;
193
+ this._touched = true;
194
194
  }
195
195
  setInitialValue(value) {
196
- this.initialValue = value;
196
+ this.currentValue = value;
197
197
  this.setValue(value);
198
198
  }
199
199
  setValue(value) {
200
200
  if (this.enabled) {
201
- this.currentValue = value;
202
- this.currentDirty = true;
201
+ this._value = value;
202
+ this._dirty = true;
203
203
  this.updateValueAndValidity(value, this.validators);
204
204
  this.observable.next(value);
205
205
  }
@@ -214,14 +214,14 @@ class FormControl {
214
214
  updateValueAndValidity(value, validators) {
215
215
  if (validators) {
216
216
  const errors = controlIsValid({ value, validators });
217
- this.currentError = errors[0];
218
- this.currentErrors = errors;
219
- this.currentValid = errors.length === 0;
217
+ this._error = errors[0];
218
+ this._errors = errors;
219
+ this._valid = errors.length === 0;
220
220
  }
221
221
  else {
222
- this.currentValid = true;
223
- this.currentError = undefined;
224
- this.currentErrors = [];
222
+ this._valid = true;
223
+ this._error = undefined;
224
+ this._errors = [];
225
225
  }
226
226
  }
227
227
  }
@@ -230,9 +230,9 @@ function formControl(options, validators) {
230
230
  }
231
231
 
232
232
  class FormArrayControl extends FormControl {
233
- constructor(controlOptions, controlValidators) {
234
- const { value, validators } = createFormControlOptions(controlOptions, controlValidators);
235
- super(value, validators);
233
+ constructor(options, validators) {
234
+ const _options = createFormControlOptions(options, validators);
235
+ super(_options.value, _options.validators);
236
236
  this.uuid = uuid.v4();
237
237
  }
238
238
  }
@@ -241,15 +241,15 @@ function formArrayControl(options, validators) {
241
241
  }
242
242
 
243
243
  class FormGroup {
244
- constructor(groupOptions, groupValidators) {
245
- this.currentErrors = [];
246
- this.currentValid = true;
247
- const { controls, validators } = createFormGroupOptions(groupOptions, groupValidators);
248
- this.currentControls = controls;
249
- this.validators = validators;
250
- this.updateValueAndValidity(controls, validators);
244
+ constructor(options, validators) {
245
+ this._errors = [];
246
+ this._valid = true;
247
+ const _options = createFormGroupOptions(options, validators);
248
+ this._controls = _options.controls;
249
+ this.validators = _options.validators;
250
+ this.updateValueAndValidity(_options.controls, _options.validators);
251
251
  this.observable = commons.observable(this.value);
252
- Object.values(controls).forEach((control) => {
252
+ Object.values(_options.controls).forEach((control) => {
253
253
  control.subscribe(() => {
254
254
  this.updateValueAndValidity(this.controls, this.validators);
255
255
  this.observable.next(this.value);
@@ -257,34 +257,34 @@ class FormGroup {
257
257
  });
258
258
  }
259
259
  get controls() {
260
- return this.currentControls;
260
+ return this._controls;
261
261
  }
262
262
  get touched() {
263
263
  return controlsPartialChecked(this.controls, 'touched');
264
264
  }
265
- get touchedAll() {
265
+ get toucheds() {
266
266
  return controlsAllChecked(this.controls, 'touched');
267
267
  }
268
268
  get untouched() {
269
269
  return !this.touched;
270
270
  }
271
- get untouchedAll() {
272
- return !this.touchedAll;
271
+ get untoucheds() {
272
+ return !this.toucheds;
273
273
  }
274
274
  get dirty() {
275
275
  return controlsPartialChecked(this.controls, 'dirty');
276
276
  }
277
- get dirtyAll() {
277
+ get dirties() {
278
278
  return controlsAllChecked(this.controls, 'dirty');
279
279
  }
280
280
  get pristine() {
281
281
  return !this.dirty;
282
282
  }
283
- get pristineAll() {
284
- return this.dirtyAll;
283
+ get pristines() {
284
+ return this.dirties;
285
285
  }
286
286
  get valid() {
287
- return this.currentValid && controlsAllChecked(this.controls, 'valid');
287
+ return this._valid && controlsAllChecked(this.controls, 'valid');
288
288
  }
289
289
  get invalid() {
290
290
  return !this.valid;
@@ -293,10 +293,10 @@ class FormGroup {
293
293
  return controlsToValue(this.controls);
294
294
  }
295
295
  get errors() {
296
- return this.currentErrors;
296
+ return this._errors;
297
297
  }
298
298
  get error() {
299
- return this.currentError;
299
+ return this._error;
300
300
  }
301
301
  get wrong() {
302
302
  return this.touched && this.invalid;
@@ -316,14 +316,14 @@ class FormGroup {
316
316
  updateValueAndValidity(controls, validators) {
317
317
  if (validators) {
318
318
  const errors = groupIsValid({ controls, validators });
319
- this.currentErrors = errors;
320
- this.currentError = errors[0];
321
- this.currentValid = errors.length === 0;
319
+ this._errors = errors;
320
+ this._error = errors[0];
321
+ this._valid = errors.length === 0;
322
322
  }
323
323
  else {
324
- this.currentErrors = [];
325
- this.currentError = undefined;
326
- this.currentValid = true;
324
+ this._errors = [];
325
+ this._error = undefined;
326
+ this._valid = true;
327
327
  }
328
328
  }
329
329
  }
@@ -332,11 +332,11 @@ function formGroup(options, validators) {
332
332
  }
333
333
 
334
334
  class FormArrayGroup extends FormGroup {
335
- constructor(groupOptions, groupValidators) {
336
- const { controls, resource, validators } = createFormGroupOptions(groupOptions, groupValidators);
337
- super(controls, validators);
335
+ constructor(options, validators) {
336
+ const _options = createFormGroupOptions(options, validators);
337
+ super(_options.controls, _options.validators);
338
338
  this.uuid = uuid.v4();
339
- this.resource = resource;
339
+ this.resource = _options.resource;
340
340
  }
341
341
  }
342
342
  function formArrayGroup(options, validators) {
@@ -345,14 +345,14 @@ function formArrayGroup(options, validators) {
345
345
 
346
346
  class FormArrayList extends FormControl {
347
347
  constructor(valueToControls, value, validators) {
348
- const initialValue = value || [];
349
- super(initialValue, validators);
348
+ const _value = value || [];
349
+ super(_value, validators);
350
350
  this.valueToControls = valueToControls;
351
- this.currentControls = initialValue.map((value) => this.createControls(value));
351
+ this._controls = _value.map((value) => this.createControls(value));
352
352
  this.uuid = uuid.v4();
353
353
  }
354
354
  get controls() {
355
- return this.currentControls;
355
+ return this._controls;
356
356
  }
357
357
  get touched() {
358
358
  return this.controls.reduce((valid, controls) => valid && controlsPartialChecked(controls, 'touched'), true);
@@ -361,20 +361,20 @@ class FormArrayList extends FormControl {
361
361
  return this.controls.reduce((valid, controls) => valid && controlsPartialChecked(controls, 'dirty'), true);
362
362
  }
363
363
  get valid() {
364
- return (this.currentValid &&
364
+ return (this._valid &&
365
365
  this.controls.reduce((valid, controls) => valid && controlsAllChecked(controls, 'valid'), true));
366
366
  }
367
367
  get value() {
368
368
  return this.controls.map((controls) => controlsToValue(controls));
369
369
  }
370
370
  setValue(values) {
371
- this.currentControls = values.map((value) => this.createControls(value));
371
+ this._controls = values.map((value) => this.createControls(value));
372
372
  }
373
373
  push(controls) {
374
- this.currentControls = this.currentControls.concat([controls]);
374
+ this._controls = this._controls.concat([controls]);
375
375
  }
376
376
  remove(controls) {
377
- this.currentControls = this.currentControls.filter((currentControls) => currentControls !== controls);
377
+ this._controls = this._controls.filter((_controls) => _controls !== controls);
378
378
  }
379
379
  createControls(value) {
380
380
  const controls = this.valueToControls(value);
@@ -393,23 +393,23 @@ function formArrayList(valueToControl, value, validators) {
393
393
  }
394
394
 
395
395
  class FormArray {
396
- constructor(arrayOptions, arrayValidators) {
397
- this.currentGroups = [];
398
- this.currentValid = true;
399
- this.currentDisabled = false;
400
- this.currentErrors = [];
401
- const { groups, validators } = createFormArrayOptions(arrayOptions, arrayValidators);
396
+ constructor(options, validators) {
397
+ this._groups = [];
398
+ this._valid = true;
399
+ this._disabled = false;
400
+ this._errors = [];
401
+ const _options = createFormArrayOptions(options, validators);
402
402
  this.unsusbcriptions = new Map();
403
- this.initialValue = groups;
404
- this.validators = validators;
405
- this.refresh(this.initialValue);
403
+ this.currentValue = _options.groups;
404
+ this.validators = _options.validators;
405
+ this.refresh(this.currentValue);
406
406
  this.observable = commons.observable(this.value);
407
- groups?.forEach((group) => {
407
+ _options.groups?.forEach((group) => {
408
408
  this.subscription(group);
409
409
  });
410
410
  }
411
411
  get groups() {
412
- return this.currentGroups;
412
+ return this._groups;
413
413
  }
414
414
  get controls() {
415
415
  return this.groups.map(({ controls }) => controls);
@@ -417,47 +417,47 @@ class FormArray {
417
417
  get touched() {
418
418
  return groupPartialChecked(this.groups, 'touched');
419
419
  }
420
- get touchedAll() {
421
- return groupAllChecked(this.groups, 'touchedAll');
420
+ get toucheds() {
421
+ return groupAllChecked(this.groups, 'toucheds');
422
422
  }
423
423
  get untouched() {
424
424
  return !this.touched;
425
425
  }
426
- get untouchedAll() {
427
- return !this.touchedAll;
426
+ get untoucheds() {
427
+ return !this.toucheds;
428
428
  }
429
429
  get dirty() {
430
430
  return groupPartialChecked(this.groups, 'dirty');
431
431
  }
432
- get dirtyAll() {
433
- return groupAllChecked(this.groups, 'dirtyAll');
432
+ get dirties() {
433
+ return groupAllChecked(this.groups, 'dirties');
434
434
  }
435
435
  get pristine() {
436
436
  return !this.dirty;
437
437
  }
438
- get pristineAll() {
439
- return !this.dirtyAll;
438
+ get pristines() {
439
+ return !this.dirties;
440
440
  }
441
441
  get disabled() {
442
- return this.currentDisabled;
442
+ return this._disabled;
443
443
  }
444
444
  get enabled() {
445
- return !this.currentDisabled;
445
+ return !this._disabled;
446
446
  }
447
447
  get valid() {
448
- return this.currentValid && groupAllChecked(this.groups, 'valid');
448
+ return this._valid && groupAllChecked(this.groups, 'valid');
449
449
  }
450
450
  get invalid() {
451
- return !this.currentValid;
451
+ return !this._valid;
452
452
  }
453
453
  get value() {
454
454
  return this.groups.map(({ value: state }) => state);
455
455
  }
456
456
  get error() {
457
- return this.currentError;
457
+ return this._error;
458
458
  }
459
459
  get errors() {
460
- return this.currentErrors;
460
+ return this._errors;
461
461
  }
462
462
  get wrong() {
463
463
  return this.touched && this.invalid;
@@ -469,13 +469,13 @@ class FormArray {
469
469
  return someErrors(this.errors, keys);
470
470
  }
471
471
  reset() {
472
- this.refresh(this.initialValue);
472
+ this.refresh(this.currentValue);
473
473
  }
474
474
  disable() {
475
- this.currentDisabled = true;
475
+ this._disabled = true;
476
476
  }
477
477
  enable() {
478
- this.currentDisabled = false;
478
+ this._disabled = false;
479
479
  }
480
480
  push(group) {
481
481
  this.subscription(group);
@@ -488,11 +488,11 @@ class FormArray {
488
488
  this.refresh([...this.groups, ...groups]);
489
489
  }
490
490
  setInitialValue(groups) {
491
- this.initialValue = groups;
491
+ this.currentValue = groups;
492
492
  this.setValue(groups);
493
493
  }
494
494
  setValue(groups) {
495
- this.currentGroups.forEach(({ uuid }) => {
495
+ this._groups.forEach(({ uuid }) => {
496
496
  this.unsusbcriptions.delete(uuid);
497
497
  });
498
498
  groups.forEach((group) => {
@@ -519,19 +519,19 @@ class FormArray {
519
519
  updateValidityStatus(groups, validators) {
520
520
  if (validators) {
521
521
  const errors = arrayIsValid({ groups, validators });
522
- this.currentErrors = errors;
523
- this.currentError = errors[0];
524
- this.currentValid = errors.length === 0;
522
+ this._errors = errors;
523
+ this._error = errors[0];
524
+ this._valid = errors.length === 0;
525
525
  }
526
526
  else {
527
- this.currentValid = true;
528
- this.currentErrors = [];
529
- this.currentError = undefined;
527
+ this._valid = true;
528
+ this._errors = [];
529
+ this._error = undefined;
530
530
  }
531
531
  }
532
532
  refresh(newGroups) {
533
533
  const groups = newGroups || [];
534
- this.currentGroups = groups;
534
+ this._groups = groups;
535
535
  this.updateValidityStatus(groups, this.validators);
536
536
  }
537
537
  }