@sumaris-net/ngx-components 1.20.12 → 1.20.15
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 +43 -31
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +6 -0
- package/esm2015/src/app/core/menu/menu.component.js +11 -7
- package/esm2015/src/app/shared/validator/validators.js +26 -18
- package/fesm2015/sumaris-net.ngx-components.js +35 -23
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/validator/validators.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -3371,15 +3371,15 @@
|
|
|
3371
3371
|
}
|
|
3372
3372
|
SharedValidators.getDoubleRegexp = function (maxDecimals) {
|
|
3373
3373
|
if (isNil(maxDecimals))
|
|
3374
|
-
return this.
|
|
3374
|
+
return this._DOUBLE_REGEXP_CACHE.NO_LIMIT;
|
|
3375
3375
|
if (maxDecimals < 0)
|
|
3376
3376
|
throw new Error("Invalid maxDecimals value: " + maxDecimals);
|
|
3377
|
-
var regexp = this.
|
|
3377
|
+
var regexp = this._DOUBLE_REGEXP_CACHE[maxDecimals];
|
|
3378
3378
|
if (regexp)
|
|
3379
3379
|
return regexp;
|
|
3380
|
-
// New
|
|
3381
|
-
this.
|
|
3382
|
-
return this.
|
|
3380
|
+
// New: add to cache
|
|
3381
|
+
this._DOUBLE_REGEXP_CACHE[maxDecimals] = new RegExp("^-?\\d+([.,]\\d{1," + maxDecimals + "})?$");
|
|
3382
|
+
return this._DOUBLE_REGEXP_CACHE[maxDecimals];
|
|
3383
3383
|
};
|
|
3384
3384
|
SharedValidators.latitude = function (control) {
|
|
3385
3385
|
var value = control.value;
|
|
@@ -3477,8 +3477,10 @@
|
|
|
3477
3477
|
var errorCode = msg ? 'msg' : 'dateRange';
|
|
3478
3478
|
var error = msg ? { msg: msg } : { dateRange: true };
|
|
3479
3479
|
return function (control) {
|
|
3480
|
-
|
|
3481
|
-
|
|
3480
|
+
// Form group not created yet: skip
|
|
3481
|
+
if (!control.parent)
|
|
3482
|
+
return null;
|
|
3483
|
+
var startControl = control.parent.get(startDateFieldName);
|
|
3482
3484
|
if (!startControl) {
|
|
3483
3485
|
console.warn("Cannot find brother control '" + startDateFieldName + "' in the parent form");
|
|
3484
3486
|
return null;
|
|
@@ -3498,8 +3500,10 @@
|
|
|
3498
3500
|
var errorCode = msg ? 'msg' : 'dateRange';
|
|
3499
3501
|
var error = msg ? { msg: msg } : { dateRange: true };
|
|
3500
3502
|
return function (control) {
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
+
// Form group not created yet: skip
|
|
3504
|
+
if (!control.parent)
|
|
3505
|
+
return null;
|
|
3506
|
+
var endDateControl = control.parent.get(endDateFieldName);
|
|
3503
3507
|
if (!endDateControl) {
|
|
3504
3508
|
console.warn("Cannot find control '" + endDateFieldName + "' in the parent form");
|
|
3505
3509
|
return null;
|
|
@@ -3520,7 +3524,13 @@
|
|
|
3520
3524
|
// Skip if control already has some errors
|
|
3521
3525
|
if (control.errors)
|
|
3522
3526
|
return null;
|
|
3523
|
-
|
|
3527
|
+
// Skip if parent form group not created yet
|
|
3528
|
+
if (!control.parent)
|
|
3529
|
+
return null;
|
|
3530
|
+
// Form group not created yet
|
|
3531
|
+
if (!control.parent)
|
|
3532
|
+
return null;
|
|
3533
|
+
var errors = control.parent.errors;
|
|
3524
3534
|
// No errors, or copy all errors
|
|
3525
3535
|
if (!errors || isEmptyArray(errorNames))
|
|
3526
3536
|
return errors;
|
|
@@ -3551,13 +3561,11 @@
|
|
|
3551
3561
|
};
|
|
3552
3562
|
return SharedValidators;
|
|
3553
3563
|
}());
|
|
3554
|
-
SharedValidators.
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
3: /^[-]?[0-9]+([.,][0-9]{1,2})?$/,
|
|
3560
|
-
}
|
|
3564
|
+
SharedValidators._DOUBLE_REGEXP_CACHE = {
|
|
3565
|
+
NO_LIMIT: /^-?\d+([.,]\d*)?$/,
|
|
3566
|
+
1: /^-?\d+([.,]\d)?$/,
|
|
3567
|
+
2: /^-?\d+([.,]\d{1,2})?$/,
|
|
3568
|
+
3: /^-?\d+([.,]\d{1,3})?$/ // 3 decimals max
|
|
3561
3569
|
};
|
|
3562
3570
|
SharedValidators.I18N_ERROR_KEYS = {
|
|
3563
3571
|
required: 'ERROR.FIELD_REQUIRED',
|
|
@@ -3727,13 +3735,13 @@
|
|
|
3727
3735
|
*/
|
|
3728
3736
|
SharedFormArrayValidators.uniqueEntity = function (controlName) {
|
|
3729
3737
|
return function (array) {
|
|
3730
|
-
var e_1,
|
|
3738
|
+
var e_1, _a;
|
|
3731
3739
|
var controls = [];
|
|
3732
3740
|
if (array.length) {
|
|
3733
3741
|
try {
|
|
3734
3742
|
// gather controls in array with valid entity
|
|
3735
|
-
for (var
|
|
3736
|
-
var control =
|
|
3743
|
+
for (var _b = __values(array.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3744
|
+
var control = _c.value;
|
|
3737
3745
|
var fromGroup = control;
|
|
3738
3746
|
if (fromGroup.controls[controlName]) {
|
|
3739
3747
|
var value = fromGroup.controls[controlName].value;
|
|
@@ -3745,7 +3753,7 @@
|
|
|
3745
3753
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3746
3754
|
finally {
|
|
3747
3755
|
try {
|
|
3748
|
-
if (
|
|
3756
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3749
3757
|
}
|
|
3750
3758
|
finally { if (e_1) throw e_1.error; }
|
|
3751
3759
|
}
|
|
@@ -3790,12 +3798,12 @@
|
|
|
3790
3798
|
*/
|
|
3791
3799
|
SharedFormArrayValidators.validSumMaxValue = function (controlName, max) {
|
|
3792
3800
|
return function (array) {
|
|
3793
|
-
var e_2,
|
|
3801
|
+
var e_2, _a;
|
|
3794
3802
|
var controls = [];
|
|
3795
3803
|
if (array.length) {
|
|
3796
3804
|
try {
|
|
3797
|
-
for (var
|
|
3798
|
-
var control =
|
|
3805
|
+
for (var _b = __values(array.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3806
|
+
var control = _c.value;
|
|
3799
3807
|
var fromGroup = control;
|
|
3800
3808
|
if (fromGroup.controls[controlName] && isNotNilOrNaN(fromGroup.controls[controlName].value)) {
|
|
3801
3809
|
controls.push(fromGroup.controls[controlName]);
|
|
@@ -3805,7 +3813,7 @@
|
|
|
3805
3813
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3806
3814
|
finally {
|
|
3807
3815
|
try {
|
|
3808
|
-
if (
|
|
3816
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3809
3817
|
}
|
|
3810
3818
|
finally { if (e_2) throw e_2.error; }
|
|
3811
3819
|
}
|
|
@@ -24302,11 +24310,11 @@
|
|
|
24302
24310
|
.pipe(operators.distinctUntilChanged())
|
|
24303
24311
|
.subscribe(function (value) { return value ? _this.open() : _this.close(); });
|
|
24304
24312
|
// Update component when refresh is need (=login events or config changed)
|
|
24305
|
-
this._subscription.add(rxjs.merge(this.accountService.onLogin, this.accountService.onLogout
|
|
24306
|
-
.pipe(operators.tap(function (config) { return _this._config = config; })))
|
|
24313
|
+
this._subscription.add(rxjs.merge(rxjs.merge(this.accountService.onLogin, this.accountService.onLogout)
|
|
24307
24314
|
.pipe(
|
|
24308
24315
|
// Wait account service ready (can be restarted)
|
|
24309
|
-
operators.mergeMap(function () { return _this.accountService.ready(); }), operators.map(function () { return _this.accountService.isLogin(); }), operators.distinctUntilChanged())
|
|
24316
|
+
operators.mergeMap(function () { return _this.accountService.ready(); }), operators.map(function () { return _this.accountService.isLogin(); }), operators.distinctUntilChanged()), this.configService.config
|
|
24317
|
+
.pipe(operators.tap(function (config) { return _this._config = config; }), operators.mergeMap(function () { return _this.accountService.ready(); }), operators.map(function () { return _this.accountService.isLogin(); })))
|
|
24310
24318
|
.subscribe(function (login) {
|
|
24311
24319
|
if (login) {
|
|
24312
24320
|
_this.onLogin(_this.accountService.account);
|
|
@@ -24326,7 +24334,7 @@
|
|
|
24326
24334
|
return __generator(this, function (_a) {
|
|
24327
24335
|
switch (_a.label) {
|
|
24328
24336
|
case 0:
|
|
24329
|
-
console.info('[menu] Update
|
|
24337
|
+
console.info('[menu] Update (login)');
|
|
24330
24338
|
this.accountAvatar = account.avatar;
|
|
24331
24339
|
this.accountName = account.displayName;
|
|
24332
24340
|
this.accountEmail = account.email;
|
|
@@ -24348,8 +24356,12 @@
|
|
|
24348
24356
|
return __generator(this, function (_a) {
|
|
24349
24357
|
switch (_a.label) {
|
|
24350
24358
|
case 0:
|
|
24351
|
-
if (!skipRedirect)
|
|
24352
|
-
console.debug('[menu]
|
|
24359
|
+
if (!skipRedirect) {
|
|
24360
|
+
console.debug('[menu] Logout');
|
|
24361
|
+
}
|
|
24362
|
+
else {
|
|
24363
|
+
console.debug('[menu] Update (logout)');
|
|
24364
|
+
}
|
|
24353
24365
|
this.isLogin = false;
|
|
24354
24366
|
this.accountAvatar = null;
|
|
24355
24367
|
this.accountEmail = null;
|