@sumaris-net/ngx-components 2.2.1-rc3 → 2.2.1-rc4

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.
@@ -4211,33 +4211,33 @@ function addValueInArray(arrayControl, createControl, equals, isEmpty, value, op
4211
4211
  }
4212
4212
  /**
4213
4213
  * Set an array using given default values. Each default value will be pass to the 'createControl()' function
4214
- * @param formArray
4214
+ * @param arrayControl
4215
4215
  * @param createControl
4216
4216
  * @param values
4217
4217
  */
4218
- function initArrayControlsFromValues(formArray, createControl, defaultValues, options) {
4219
- if (formArray.length === 0 && (!defaultValues || defaultValues.length === 0))
4218
+ function initArrayControlsFromValues(arrayControl, createControl, defaultValues, options) {
4219
+ if (arrayControl.length === 0 && (!defaultValues || defaultValues.length === 0))
4220
4220
  return false; // No changes need
4221
- const disabled = formArray.disabled;
4222
- while (formArray.length > 0) {
4223
- formArray.removeAt(formArray.length - 1, options);
4221
+ const disabled = arrayControl.disabled;
4222
+ while (arrayControl.length > 0) {
4223
+ arrayControl.removeAt(arrayControl.length - 1, options);
4224
4224
  }
4225
4225
  (defaultValues || []).forEach(value => {
4226
4226
  const control = createControl(value);
4227
4227
  // Apply parent disabled state, before to push it into the array
4228
- // This is need to avoid parent form to be enabled, after calling initArrayControlsFromValues()
4228
+ // This is need to avoid parent form to be enabled
4229
4229
  if (disabled && control.enabled)
4230
4230
  control.disable({ emitEvent: false });
4231
4231
  else if (!disabled && control.disabled)
4232
4232
  control.enable({ emitEvent: false });
4233
- formArray.push(control, options);
4233
+ arrayControl.push(control, options);
4234
4234
  });
4235
- return true; // has some changes
4235
+ return true; // Has some changes
4236
4236
  }
4237
4237
  function resizeArray(arrayControl, createControl, length, options) {
4238
4238
  if (arrayControl.length === length)
4239
4239
  return false; // No changes need
4240
- const disabled = this.formArray.disabled;
4240
+ const disabled = arrayControl.disabled;
4241
4241
  // Reduce size
4242
4242
  while (arrayControl.length > length) {
4243
4243
  arrayControl.removeAt(arrayControl.length - 1, options);
@@ -4253,7 +4253,7 @@ function resizeArray(arrayControl, createControl, length, options) {
4253
4253
  control.enable({ emitEvent: false });
4254
4254
  arrayControl.push(control, options);
4255
4255
  }
4256
- return true; // has some changes
4256
+ return true; // Has some changes
4257
4257
  }
4258
4258
  function removeValueInArray(arrayControl, isEmpty, index) {
4259
4259
  arrayControl.removeAt(index);