@sumaris-net/ngx-components 1.7.0 → 1.7.3
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 +41 -21
- 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/esm2015/src/app/core/form/entity-editor.class.js +34 -16
- package/esm2015/src/app/core/table/table.class.js +5 -3
- package/esm2015/src/app/shared/material/latlong/material.latlong.js +6 -6
- package/fesm2015/sumaris-net.ngx-components.js +41 -21
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/entity-editor.class.d.ts +17 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -4758,11 +4758,8 @@
|
|
|
4758
4758
|
this.pattern = 'DDMM';
|
|
4759
4759
|
this.mask = MASKS[this.type][this.pattern];
|
|
4760
4760
|
}
|
|
4761
|
-
if (isNil(this.maxDecimals)) {
|
|
4762
|
-
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4763
|
-
}
|
|
4764
4761
|
// Remove max decimals in the DDMMSS format
|
|
4765
|
-
|
|
4762
|
+
if (this.pattern === 'DD') {
|
|
4766
4763
|
console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
|
|
4767
4764
|
this.maxDecimals = 7;
|
|
4768
4765
|
}
|
|
@@ -4770,12 +4767,15 @@
|
|
|
4770
4767
|
console.warn("Invalid attribute 'maxDecimals' - Must be '0' when using the 'DDMMSS' pattern.");
|
|
4771
4768
|
this.maxDecimals = 0;
|
|
4772
4769
|
}
|
|
4770
|
+
else if (isNil(this.maxDecimals)) {
|
|
4771
|
+
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4772
|
+
}
|
|
4773
4773
|
else if (this.maxDecimals < 0) {
|
|
4774
4774
|
console.error('Invalid attribute \'maxDecimals\'. Must a positive value.');
|
|
4775
4775
|
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4776
4776
|
}
|
|
4777
4777
|
else if (this.maxDecimals !== DEFAULT_MAX_DECIMALS) {
|
|
4778
|
-
console.warn("Invalid attribute 'maxDecimals' - Expected value: " + DEFAULT_MAX_DECIMALS + ". Other value not implemented.");
|
|
4778
|
+
console.warn("Invalid attribute 'maxDecimals' - Expected value: " + DEFAULT_MAX_DECIMALS + " but get: " + this.maxDecimals + ". Other value not implemented.");
|
|
4779
4779
|
this.maxDecimals = DEFAULT_MAX_DECIMALS;
|
|
4780
4780
|
}
|
|
4781
4781
|
this.showSignControl = this.pattern !== 'DD';
|
|
@@ -25033,7 +25033,7 @@
|
|
|
25033
25033
|
rxjs.merge(
|
|
25034
25034
|
// Listen sort events
|
|
25035
25035
|
this.sort && this.sort.sortChange
|
|
25036
|
-
.pipe(operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_d) {
|
|
25036
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }), operators.mergeMap(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_d) {
|
|
25037
25037
|
return [2 /*return*/, this.saveBeforeAction('sort')];
|
|
25038
25038
|
}); }); }), operators.filter(function (res) { return res === true; }),
|
|
25039
25039
|
// Save sort in settings
|
|
@@ -25054,7 +25054,9 @@
|
|
|
25054
25054
|
});
|
|
25055
25055
|
// If the user changes the sort order, reset back to the first page.
|
|
25056
25056
|
if (this.sort && this.paginator) {
|
|
25057
|
-
this.registerSubscription(this.sort.sortChange
|
|
25057
|
+
this.registerSubscription(this.sort.sortChange
|
|
25058
|
+
.pipe(operators.filter(function () { return !_this.sort.disabled; }))
|
|
25059
|
+
.subscribe(function () { return _this.paginator.pageIndex = 0; }));
|
|
25058
25060
|
}
|
|
25059
25061
|
};
|
|
25060
25062
|
AppTable.prototype.ngOnDestroy = function () {
|
|
@@ -27280,7 +27282,7 @@
|
|
|
27280
27282
|
case 0:
|
|
27281
27283
|
if (!this.dataService)
|
|
27282
27284
|
throw new Error('Cannot load data: missing \'dataService\'!');
|
|
27283
|
-
this.
|
|
27285
|
+
this.resetError();
|
|
27284
27286
|
if (!isNil(id)) return [3 /*break*/, 7];
|
|
27285
27287
|
_b.label = 1;
|
|
27286
27288
|
case 1:
|
|
@@ -27296,7 +27298,7 @@
|
|
|
27296
27298
|
return [3 /*break*/, 6];
|
|
27297
27299
|
case 4:
|
|
27298
27300
|
err_1 = _b.sent();
|
|
27299
|
-
this.setError(err_1);
|
|
27301
|
+
this.setError(err_1, { emitEvent: false });
|
|
27300
27302
|
this.selectedTabIndex = 0;
|
|
27301
27303
|
return [3 /*break*/, 6];
|
|
27302
27304
|
case 5:
|
|
@@ -27528,7 +27530,7 @@
|
|
|
27528
27530
|
return [2 /*return*/, false];
|
|
27529
27531
|
}
|
|
27530
27532
|
this.markAsSaving();
|
|
27531
|
-
this.
|
|
27533
|
+
this.resetError();
|
|
27532
27534
|
if (this.debug)
|
|
27533
27535
|
console.debug('[data-editor] Saving data...');
|
|
27534
27536
|
_b.label = 2;
|
|
@@ -27630,7 +27632,7 @@
|
|
|
27630
27632
|
return [2 /*return*/];
|
|
27631
27633
|
console.debug('[data-editor] Asking to delete...');
|
|
27632
27634
|
this.markAsSaving();
|
|
27633
|
-
this.
|
|
27635
|
+
this.resetError();
|
|
27634
27636
|
_b.label = 2;
|
|
27635
27637
|
case 2:
|
|
27636
27638
|
_b.trys.push([2, 7, , 8]);
|
|
@@ -27702,17 +27704,35 @@
|
|
|
27702
27704
|
});
|
|
27703
27705
|
});
|
|
27704
27706
|
};
|
|
27705
|
-
AppEntityEditor.prototype.
|
|
27706
|
-
|
|
27707
|
-
|
|
27708
|
-
|
|
27709
|
-
|
|
27710
|
-
|
|
27711
|
-
|
|
27712
|
-
|
|
27713
|
-
|
|
27707
|
+
AppEntityEditor.prototype.resetError = function (opts) {
|
|
27708
|
+
if (isNotNilOrBlank(this.error)) {
|
|
27709
|
+
this.error = null;
|
|
27710
|
+
if (!opts || opts.emitEvent !== false)
|
|
27711
|
+
this.markForCheck();
|
|
27712
|
+
}
|
|
27713
|
+
};
|
|
27714
|
+
AppEntityEditor.prototype.setError = function (err, opts) {
|
|
27715
|
+
if (!err || typeof err === 'string') {
|
|
27716
|
+
console.error('[entity-editor] Error: ' + (err || ''));
|
|
27717
|
+
this.error = err;
|
|
27714
27718
|
}
|
|
27715
|
-
|
|
27719
|
+
else {
|
|
27720
|
+
console.error('[entity-editor] Error: ' + err.message || '', err);
|
|
27721
|
+
var userMessage = err.message && this.translate.instant(err.message) || err;
|
|
27722
|
+
// Add details error (if any) under the main message
|
|
27723
|
+
var detailMessage = (!err.details || typeof err.details === 'string')
|
|
27724
|
+
? err.details
|
|
27725
|
+
: err.details.message;
|
|
27726
|
+
if (isNotNilOrBlank(detailMessage)) {
|
|
27727
|
+
var cssClass = (opts === null || opts === void 0 ? void 0 : opts.detailsCssClass) || 'hidden-xs hidden-sm';
|
|
27728
|
+
userMessage += "<br/><small class=\"" + cssClass + "\" title=\"" + detailMessage + "\">";
|
|
27729
|
+
userMessage += detailMessage.length < 70 ? detailMessage : detailMessage.substring(0, 67) + '...';
|
|
27730
|
+
userMessage += '</small>';
|
|
27731
|
+
}
|
|
27732
|
+
this.error = userMessage;
|
|
27733
|
+
}
|
|
27734
|
+
if (!opts || opts.emitEvent !== false)
|
|
27735
|
+
this.markForCheck();
|
|
27716
27736
|
};
|
|
27717
27737
|
/* -- protected methods -- */
|
|
27718
27738
|
/**
|