@sumaris-net/ngx-components 1.23.38 → 1.23.41

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.
@@ -4208,6 +4208,25 @@
4208
4208
  }
4209
4209
  return hasChanged;
4210
4210
  }
4211
+ /**
4212
+ * Patch an array using given default values. Each default value will be pass to the 'createControl()' function
4213
+ * @param arrayControl
4214
+ * @param createControl
4215
+ * @param values
4216
+ */
4217
+ function patchValueInArray(arrayControl, createControl, defaultValues) {
4218
+ var hasChanged = false;
4219
+ while (arrayControl.length > 0) {
4220
+ arrayControl.removeAt(arrayControl.length - 1);
4221
+ hasChanged = true;
4222
+ }
4223
+ (defaultValues || []).forEach(function (value) {
4224
+ var control = createControl(value);
4225
+ arrayControl.push(control);
4226
+ hasChanged = true;
4227
+ });
4228
+ return hasChanged;
4229
+ }
4211
4230
  function resizeArray(arrayControl, createControl, length) {
4212
4231
  var hasChanged = arrayControl.length !== length;
4213
4232
  // Increase size
@@ -4604,18 +4623,13 @@
4604
4623
  return this._formArray.at(index);
4605
4624
  };
4606
4625
  /**
4607
- * Resize the FormArray, then patch values
4608
- * @param data
4626
+ * Patch a FormArray, using default values
4627
+ * @param values default values to apply.
4609
4628
  * @param opts
4629
+ * @return true if form arry has been changed
4610
4630
  */
4611
- FormArrayHelper.prototype.patchValue = function (values, opts) {
4612
- var _this = this;
4613
- this.resize((values === null || values === void 0 ? void 0 : values.length) || 0);
4614
- var emitEvent = (!opts || (opts === null || opts === void 0 ? void 0 : opts.emitEvent) !== false);
4615
- (values || []).forEach(function (value, i) {
4616
- var last = (i === values.length - 1);
4617
- _this.push(value, { emitEvent: last && emitEvent });
4618
- });
4631
+ FormArrayHelper.prototype.patchValue = function (values) {
4632
+ return patchValueInArray(this._formArray, this.createControl, values);
4619
4633
  };
4620
4634
  FormArrayHelper.prototype.disable = function (opts) {
4621
4635
  this._formArray.controls.forEach(function (c) { return c.disable(opts); });
@@ -28677,6 +28691,13 @@
28677
28691
  enumerable: false,
28678
28692
  configurable: true
28679
28693
  });
28694
+ Object.defineProperty(AppEditor.prototype, "loaded", {
28695
+ get: function () {
28696
+ return !this.loading;
28697
+ },
28698
+ enumerable: false,
28699
+ configurable: true
28700
+ });
28680
28701
  Object.defineProperty(AppEditor.prototype, "touched", {
28681
28702
  get: function () {
28682
28703
  return this.touchedSubject.value || (this._children && this._children.findIndex(function (c) { return c.enabled && c.touched; }) !== -1) || false;
@@ -35709,6 +35730,7 @@
35709
35730
  exports.notNilOrDefault = notNilOrDefault;
35710
35731
  exports.nullIfUndefined = nullIfUndefined;
35711
35732
  exports.parseLatitudeOrLongitude = parseLatitudeOrLongitude;
35733
+ exports.patchValueInArray = patchValueInArray;
35712
35734
  exports.propertiesPathComparator = propertiesPathComparator;
35713
35735
  exports.propertyComparator = propertyComparator;
35714
35736
  exports.propertyPathComparator = propertyPathComparator;