@sumaris-net/ngx-components 2.4.34 → 2.4.35

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.
@@ -9986,13 +9986,9 @@ class MatPaginatorI18n extends MatPaginatorIntl {
9986
9986
  constructor(translate) {
9987
9987
  super();
9988
9988
  this.translate = translate;
9989
- this.itemsPerPageLabel = 'Items per page';
9990
- this.nextPageLabel = 'Next page';
9991
- this.previousPageLabel = 'Previous page';
9992
- this.getRangeLabel = function (page, pageSize, length) {
9993
- const of = this.translate ? this.translate.instant('COMMON.PAGINATOR.OF') : 'of';
9989
+ this.getRangeLabel = (page, pageSize, length) => {
9994
9990
  if (length === 0 || pageSize === 0) {
9995
- return '0 ' + of + ' ' + length;
9991
+ return '0 ' + this.ofLabel + ' ' + length;
9996
9992
  }
9997
9993
  length = Math.max(length, 0);
9998
9994
  const startIndex = page * pageSize;
@@ -10000,17 +9996,25 @@ class MatPaginatorI18n extends MatPaginatorIntl {
10000
9996
  const endIndex = startIndex < length ?
10001
9997
  Math.min(startIndex + pageSize, length) :
10002
9998
  startIndex + pageSize;
10003
- return startIndex + 1 + ' - ' + endIndex + ' ' + of + ' ' + length;
9999
+ return startIndex + 1 + ' - ' + endIndex + ' ' + this.ofLabel + ' ' + length;
10004
10000
  };
10005
- this.translate = translate;
10006
- translate.onLangChange.subscribe(() => this.translateLabels());
10007
- this.translateLabels();
10001
+ this.translate.get([
10002
+ 'COMMON.PAGINATOR.ITEMS_PER_PAGE',
10003
+ 'COMMON.PAGINATOR.NEXT_PAGE',
10004
+ 'COMMON.PAGINATOR.PREVIOUS_PAGE',
10005
+ 'COMMON.PAGINATOR.OF',
10006
+ ])
10007
+ .subscribe((translations) => {
10008
+ console.info('[MatPaginatorI18n] Update pagination translations');
10009
+ this.itemsPerPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.ITEMS_PER_PAGE', '');
10010
+ this.nextPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.NEXT_PAGE', '>');
10011
+ this.previousPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.PREVIOUS_PAGE', '<');
10012
+ this.ofLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.OF', '/');
10013
+ this.changes.next();
10014
+ });
10008
10015
  }
10009
- translateLabels() {
10010
- //console.debug("[i18n] Update pagination translations");
10011
- this.itemsPerPageLabel = this.translate.instant('COMMON.PAGINATOR.ITEMS_PER_PAGE');
10012
- this.nextPageLabel = this.translate.instant('COMMON.PAGINATOR.NEXT_PAGE');
10013
- this.previousPageLabel = this.translate.instant('COMMON.PAGINATOR.PREVIOUS_PAGE');
10016
+ _getTranslationValue(translations, key, defaultValue) {
10017
+ return (translations[key] !== key) ? translations[key] : defaultValue;
10014
10018
  }
10015
10019
  }
10016
10020
  MatPaginatorI18n.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: MatPaginatorI18n, deps: [{ token: i1$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -28923,8 +28927,9 @@ class AppEntityEditorModal extends AppTabEditor {
28923
28927
  }
28924
28928
  async updateView(data, opts) {
28925
28929
  this.resetError();
28926
- if (!this.data)
28930
+ if (!data)
28927
28931
  throw { code: ErrorCodes.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
28932
+ this.data = data;
28928
28933
  await this.setValue(data);
28929
28934
  if (!opts || opts.emitEvent !== false) {
28930
28935
  this.markAsPristine();