@sumaris-net/ngx-components 2.5.3 → 2.5.4

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.
@@ -9950,13 +9950,9 @@ class MatPaginatorI18n extends MatPaginatorIntl {
9950
9950
  constructor(translate) {
9951
9951
  super();
9952
9952
  this.translate = translate;
9953
- this.itemsPerPageLabel = 'Items per page';
9954
- this.nextPageLabel = 'Next page';
9955
- this.previousPageLabel = 'Previous page';
9956
- this.getRangeLabel = function (page, pageSize, length) {
9957
- const of = this.translate ? this.translate.instant('COMMON.PAGINATOR.OF') : 'of';
9953
+ this.getRangeLabel = (page, pageSize, length) => {
9958
9954
  if (length === 0 || pageSize === 0) {
9959
- return '0 ' + of + ' ' + length;
9955
+ return '0 ' + this.ofLabel + ' ' + length;
9960
9956
  }
9961
9957
  length = Math.max(length, 0);
9962
9958
  const startIndex = page * pageSize;
@@ -9964,17 +9960,25 @@ class MatPaginatorI18n extends MatPaginatorIntl {
9964
9960
  const endIndex = startIndex < length ?
9965
9961
  Math.min(startIndex + pageSize, length) :
9966
9962
  startIndex + pageSize;
9967
- return startIndex + 1 + ' - ' + endIndex + ' ' + of + ' ' + length;
9963
+ return startIndex + 1 + ' - ' + endIndex + ' ' + this.ofLabel + ' ' + length;
9968
9964
  };
9969
- this.translate = translate;
9970
- translate.onLangChange.subscribe(() => this.translateLabels());
9971
- this.translateLabels();
9965
+ this.translate.get([
9966
+ 'COMMON.PAGINATOR.ITEMS_PER_PAGE',
9967
+ 'COMMON.PAGINATOR.NEXT_PAGE',
9968
+ 'COMMON.PAGINATOR.PREVIOUS_PAGE',
9969
+ 'COMMON.PAGINATOR.OF',
9970
+ ])
9971
+ .subscribe((translations) => {
9972
+ console.info('[MatPaginatorI18n] Update pagination translations');
9973
+ this.itemsPerPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.ITEMS_PER_PAGE', '');
9974
+ this.nextPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.NEXT_PAGE', '>');
9975
+ this.previousPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.PREVIOUS_PAGE', '<');
9976
+ this.ofLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.OF', '/');
9977
+ this.changes.next();
9978
+ });
9972
9979
  }
9973
- translateLabels() {
9974
- //console.debug("[i18n] Update pagination translations");
9975
- this.itemsPerPageLabel = this.translate.instant('COMMON.PAGINATOR.ITEMS_PER_PAGE');
9976
- this.nextPageLabel = this.translate.instant('COMMON.PAGINATOR.NEXT_PAGE');
9977
- this.previousPageLabel = this.translate.instant('COMMON.PAGINATOR.PREVIOUS_PAGE');
9980
+ _getTranslationValue(translations, key, defaultValue) {
9981
+ return (translations[key] !== key) ? translations[key] : defaultValue;
9978
9982
  }
9979
9983
  }
9980
9984
  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 });
@@ -26880,7 +26884,7 @@ class AccountPage extends AppForm {
26880
26884
  // Get user options
26881
26885
  this.optionDefinitions = this.accountService.optionDefs.slice();
26882
26886
  // Observed some events
26883
- this.registerSubscription(this.accountService.onLogin.subscribe(account => this.onLogin(account)));
26887
+ this.registerSubscription(this.accountService.onLogin.pipe(filter(() => !this.saving)).subscribe(account => this.onLogin(account)));
26884
26888
  this.registerSubscription(this.accountService.onLogout.subscribe(() => this.onLogout()));
26885
26889
  this.registerSubscription(this.onCancel.subscribe(() => {
26886
26890
  this.setValue(this.accountService.account);