@sumaris-net/ngx-components 0.25.13 → 0.25.14
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 +12 -12
- 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/table/table.class.js +3 -3
- package/esm2015/src/app/shared/pipes/form.pipes.js +2 -2
- package/esm2015/src/app/shared/validator/form-error-adapter.class.js +10 -10
- package/fesm2015/sumaris-net.ngx-components.js +12 -12
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/table.class.d.ts +3 -3
- package/src/app/shared/validator/form-error-adapter.class.d.ts +7 -7
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -3989,21 +3989,21 @@
|
|
|
3989
3989
|
this.translate = translate;
|
|
3990
3990
|
this.errorI18nKeys = Object.assign(Object.assign({}, SharedValidators.I18N_ERROR_KEYS), errorI18nKeys);
|
|
3991
3991
|
}
|
|
3992
|
-
FormErrorAdapter.prototype.
|
|
3992
|
+
FormErrorAdapter.prototype.translateErrors = function (control, opts) {
|
|
3993
3993
|
var _this = this;
|
|
3994
|
-
if (!
|
|
3994
|
+
if (!control || !control.invalid)
|
|
3995
3995
|
return '';
|
|
3996
3996
|
var separator = opts && opts.separator || ', ';
|
|
3997
3997
|
var recursive = !opts || opts.recursive !== false;
|
|
3998
|
-
var errors = AppFormUtils.getFormErrors(
|
|
3998
|
+
var errors = AppFormUtils.getFormErrors(control, { recursive: recursive });
|
|
3999
3999
|
return errors && Object.keys(errors).reduce(function (res, path) {
|
|
4000
|
-
var
|
|
4000
|
+
var childControl = control.get(path);
|
|
4001
4001
|
// Should be a control map of errors
|
|
4002
|
-
if (
|
|
4002
|
+
if (childControl) {
|
|
4003
4003
|
// Try to convert the control path
|
|
4004
|
-
var i18nPath = _this.
|
|
4004
|
+
var i18nPath = _this.translateControlPath(path, opts);
|
|
4005
4005
|
// OK, we have a field name: use it
|
|
4006
|
-
var columnErrors = Object.keys(
|
|
4006
|
+
var columnErrors = Object.keys(childControl.errors).map(function (errorKey) { return _this.translateError(errorKey, childControl.errors[errorKey]); });
|
|
4007
4007
|
if (isEmptyArray(columnErrors))
|
|
4008
4008
|
return res;
|
|
4009
4009
|
// Add separator
|
|
@@ -4018,9 +4018,9 @@
|
|
|
4018
4018
|
return res + (res.length ? separator : '') + formError;
|
|
4019
4019
|
}, "");
|
|
4020
4020
|
};
|
|
4021
|
-
FormErrorAdapter.prototype.
|
|
4021
|
+
FormErrorAdapter.prototype.translateControlPath = function (path, opts) {
|
|
4022
4022
|
if (opts === null || opts === void 0 ? void 0 : opts.pathTranslateService) {
|
|
4023
|
-
return opts === null || opts === void 0 ? void 0 : opts.pathTranslateService.
|
|
4023
|
+
return opts === null || opts === void 0 ? void 0 : opts.pathTranslateService.translateControlPath(path);
|
|
4024
4024
|
}
|
|
4025
4025
|
var i18nKey = (opts && opts.i18nPrefix || '') + changeCaseToUnderscore(path).toUpperCase();
|
|
4026
4026
|
return this.translate.instant(i18nKey);
|
|
@@ -4058,7 +4058,7 @@
|
|
|
4058
4058
|
this.adapter = adapter;
|
|
4059
4059
|
}
|
|
4060
4060
|
FormErrorTranslatePipe.prototype.transform = function (form, opts) {
|
|
4061
|
-
return this.adapter.
|
|
4061
|
+
return this.adapter.translateErrors(form, opts);
|
|
4062
4062
|
};
|
|
4063
4063
|
return FormErrorTranslatePipe;
|
|
4064
4064
|
}());
|
|
@@ -24437,7 +24437,7 @@
|
|
|
24437
24437
|
}
|
|
24438
24438
|
}
|
|
24439
24439
|
};
|
|
24440
|
-
AppTable.prototype.
|
|
24440
|
+
AppTable.prototype.translateControlPath = function (path) {
|
|
24441
24441
|
// Can be override by subclasses, to resolve all field name
|
|
24442
24442
|
var _a;
|
|
24443
24443
|
// Use columns key, has default name
|
|
@@ -24891,7 +24891,7 @@
|
|
|
24891
24891
|
row = row || this.editedRow;
|
|
24892
24892
|
if (!row || !this.formErrorAdapter)
|
|
24893
24893
|
return undefined;
|
|
24894
|
-
return this.formErrorAdapter.
|
|
24894
|
+
return this.formErrorAdapter.translateErrors(row.validator, Object.assign({ pathTranslateService: this }, opts));
|
|
24895
24895
|
};
|
|
24896
24896
|
AppTable.prototype.setError = function (value, opts) {
|
|
24897
24897
|
if (this.errorSubject.value !== value) {
|