@sumaris-net/ngx-components 1.23.37 → 1.23.38
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/bundles/sumaris-net.ngx-components.umd.js +25 -18
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/form/form.utils.js +25 -18
- package/esm2015/src/app/shared/forms.js +2 -2
- package/fesm2015/sumaris-net.ngx-components.js +25 -18
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +16 -11
- package/src/app/shared/forms.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -4174,7 +4174,7 @@
|
|
|
4174
4174
|
control.disable(opts);
|
|
4175
4175
|
});
|
|
4176
4176
|
}
|
|
4177
|
-
function
|
|
4177
|
+
function pushValueInArray(arrayControl, createControl, equals, isEmpty, value, options) {
|
|
4178
4178
|
options = options || { emitEvent: true };
|
|
4179
4179
|
var hasChanged = false;
|
|
4180
4180
|
var index = -1;
|
|
@@ -4524,6 +4524,10 @@
|
|
|
4524
4524
|
this.equals = equals;
|
|
4525
4525
|
this.isEmpty = isEmpty;
|
|
4526
4526
|
this._validators = options && options.validators;
|
|
4527
|
+
// Register into the form array
|
|
4528
|
+
if (options === null || options === void 0 ? void 0 : options.helperProperty) {
|
|
4529
|
+
_formArray[FormArrayHelper.FORMA_HELPER_PROPERTY] = this;
|
|
4530
|
+
}
|
|
4527
4531
|
// empty array not allow by default
|
|
4528
4532
|
this.setAllowEmptyArray(toBoolean(options && options.allowEmptyArray, false));
|
|
4529
4533
|
}
|
|
@@ -4535,6 +4539,9 @@
|
|
|
4535
4539
|
}
|
|
4536
4540
|
return arrayControl;
|
|
4537
4541
|
};
|
|
4542
|
+
FormArrayHelper.hasHelper = function (formArray) {
|
|
4543
|
+
return formArray && !!formArray[this.FORMA_HELPER_PROPERTY];
|
|
4544
|
+
};
|
|
4538
4545
|
Object.defineProperty(FormArrayHelper.prototype, "allowEmptyArray", {
|
|
4539
4546
|
get: function () {
|
|
4540
4547
|
return this._allowEmptyArray;
|
|
@@ -4552,9 +4559,17 @@
|
|
|
4552
4559
|
enumerable: false,
|
|
4553
4560
|
configurable: true
|
|
4554
4561
|
});
|
|
4562
|
+
/**
|
|
4563
|
+
* @param value
|
|
4564
|
+
* @param options
|
|
4565
|
+
* @deprecated Use push() instead
|
|
4566
|
+
*/
|
|
4555
4567
|
FormArrayHelper.prototype.add = function (value, options) {
|
|
4568
|
+
return pushValueInArray(this._formArray, this.createControl, this.equals, this.isEmpty, value, options);
|
|
4569
|
+
};
|
|
4570
|
+
FormArrayHelper.prototype.push = function (value, options) {
|
|
4556
4571
|
var _this = this;
|
|
4557
|
-
return
|
|
4572
|
+
return pushValueInArray(this._formArray, function () { return _this.createControl(value); }, this.equals, this.isEmpty, value, options);
|
|
4558
4573
|
};
|
|
4559
4574
|
FormArrayHelper.prototype.removeAt = function (index) {
|
|
4560
4575
|
// Do not remove if last criterion
|
|
@@ -4589,28 +4604,19 @@
|
|
|
4589
4604
|
return this._formArray.at(index);
|
|
4590
4605
|
};
|
|
4591
4606
|
/**
|
|
4592
|
-
* Resize the FormArray, then
|
|
4593
|
-
* @param
|
|
4607
|
+
* Resize the FormArray, then patch values
|
|
4608
|
+
* @param data
|
|
4594
4609
|
* @param opts
|
|
4595
4610
|
*/
|
|
4596
|
-
FormArrayHelper.prototype.
|
|
4611
|
+
FormArrayHelper.prototype.patchValue = function (values, opts) {
|
|
4597
4612
|
var _this = this;
|
|
4598
|
-
this.resize(0);
|
|
4613
|
+
this.resize((values === null || values === void 0 ? void 0 : values.length) || 0);
|
|
4599
4614
|
var emitEvent = (!opts || (opts === null || opts === void 0 ? void 0 : opts.emitEvent) !== false);
|
|
4600
4615
|
(values || []).forEach(function (value, i) {
|
|
4601
4616
|
var last = (i === values.length - 1);
|
|
4602
|
-
_this.
|
|
4617
|
+
_this.push(value, { emitEvent: last && emitEvent });
|
|
4603
4618
|
});
|
|
4604
4619
|
};
|
|
4605
|
-
/**
|
|
4606
|
-
* Resize the FormArray, then patch values
|
|
4607
|
-
* @param data
|
|
4608
|
-
* @param opts
|
|
4609
|
-
*/
|
|
4610
|
-
FormArrayHelper.prototype.patchValue = function (data, opts) {
|
|
4611
|
-
this.resize((data === null || data === void 0 ? void 0 : data.length) || 0);
|
|
4612
|
-
this._formArray.patchValue(data, opts);
|
|
4613
|
-
};
|
|
4614
4620
|
FormArrayHelper.prototype.disable = function (opts) {
|
|
4615
4621
|
this._formArray.controls.forEach(function (c) { return c.disable(opts); });
|
|
4616
4622
|
};
|
|
@@ -4640,6 +4646,7 @@
|
|
|
4640
4646
|
};
|
|
4641
4647
|
return FormArrayHelper;
|
|
4642
4648
|
}());
|
|
4649
|
+
FormArrayHelper.FORMA_HELPER_PROPERTY = '_helper';
|
|
4643
4650
|
// TODO continue to use this kind of declaration ?
|
|
4644
4651
|
var AppFormUtils = /** @class */ (function () {
|
|
4645
4652
|
function AppFormUtils() {
|
|
@@ -4673,7 +4680,7 @@
|
|
|
4673
4680
|
AppFormUtils.updateValueAndValidity = updateValueAndValidity;
|
|
4674
4681
|
AppFormUtils.getFormErrors = getFormErrors;
|
|
4675
4682
|
// ArrayForm
|
|
4676
|
-
AppFormUtils.addValueInArray =
|
|
4683
|
+
AppFormUtils.addValueInArray = pushValueInArray;
|
|
4677
4684
|
AppFormUtils.removeValueInArray = removeValueInArray;
|
|
4678
4685
|
AppFormUtils.resizeArray = resizeArray;
|
|
4679
4686
|
AppFormUtils.clearValueInArray = clearValueInArray;
|
|
@@ -35603,7 +35610,6 @@
|
|
|
35603
35610
|
exports.UsersPage = UsersPage;
|
|
35604
35611
|
exports.accountToString = accountToString;
|
|
35605
35612
|
exports.adaptValueToControl = adaptValueToControl;
|
|
35606
|
-
exports.addValueInArray = addValueInArray;
|
|
35607
35613
|
exports.arrayDistinct = arrayDistinct;
|
|
35608
35614
|
exports.arrayGroupBy = arrayGroupBy;
|
|
35609
35615
|
exports.arraySize = arraySize;
|
|
@@ -35706,6 +35712,7 @@
|
|
|
35706
35712
|
exports.propertiesPathComparator = propertiesPathComparator;
|
|
35707
35713
|
exports.propertyComparator = propertyComparator;
|
|
35708
35714
|
exports.propertyPathComparator = propertyPathComparator;
|
|
35715
|
+
exports.pushValueInArray = pushValueInArray;
|
|
35709
35716
|
exports.referentialToString = referentialToString;
|
|
35710
35717
|
exports.referentialsToString = referentialsToString;
|
|
35711
35718
|
exports.remove = remove;
|