@rxap/forms 13.0.3 → 13.0.4

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.
@@ -241,18 +241,19 @@ class RxapFormArray extends FormArray {
241
241
  // `undefined` as a value.
242
242
  if (value == null /* both `null` and `undefined` */)
243
243
  return;
244
- const largesIndex = value.length === 0 ? -1 : Object.keys(value).map(Number).sort().reverse()[0];
244
+ if (options?.strict) {
245
+ if (this.length > value.length) {
246
+ for (let index = this.length - 1; index >= value.length; index--) {
247
+ this.removeAt(index);
248
+ }
249
+ }
250
+ }
245
251
  value.forEach((newValue, index) => {
246
- if (options?.strict && index > largesIndex) {
247
- this.removeAt(index);
252
+ if (this.at(index)) {
253
+ this.at(index).patchValue(newValue, { ...(options ?? {}), onlySelf: true });
248
254
  }
249
- else {
250
- if (this.at(index)) {
251
- this.at(index).patchValue(newValue, { ...(options ?? {}), onlySelf: true });
252
- }
253
- else if (options?.coerce) {
254
- this.insertAt(index, value[index]);
255
- }
255
+ else if (options?.coerce) {
256
+ this.insertAt(index, value[index]);
256
257
  }
257
258
  });
258
259
  this.updateValueAndValidity(options);