@sumaris-net/ngx-components 2.4.33 → 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 });
@@ -28834,7 +28838,7 @@ class AppEntityEditorModal extends AppTabEditor {
28834
28838
  return !this._enabled;
28835
28839
  }
28836
28840
  get isOnFieldMode() {
28837
- return this.settings.isOnFieldMode(this._usageMode);
28841
+ return this.settings.isOnFieldMode(this.usageMode);
28838
28842
  }
28839
28843
  get saving() {
28840
28844
  return this.savingSubject.value;
@@ -28856,6 +28860,7 @@ class AppEntityEditorModal extends AppTabEditor {
28856
28860
  ngOnInit() {
28857
28861
  // Default values
28858
28862
  this.mobile = isNotNil(this.mobile) ? this.mobile : this.settings.mobile;
28863
+ this.usageMode = this.usageMode || this.settings.usageMode;
28859
28864
  super.ngOnInit();
28860
28865
  // Register forms
28861
28866
  this.registerForms();
@@ -28922,8 +28927,9 @@ class AppEntityEditorModal extends AppTabEditor {
28922
28927
  }
28923
28928
  async updateView(data, opts) {
28924
28929
  this.resetError();
28925
- if (!this.data)
28930
+ if (!data)
28926
28931
  throw { code: ErrorCodes.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
28932
+ this.data = data;
28927
28933
  await this.setValue(data);
28928
28934
  if (!opts || opts.emitEvent !== false) {
28929
28935
  this.markAsPristine();