@sumaris-net/ngx-components 2.4.34 → 2.4.36

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.
@@ -4765,7 +4765,7 @@ class FormArrayHelper {
4765
4765
  }
4766
4766
  class AppFormArray extends UntypedFormArray {
4767
4767
  constructor(createControl, equals, isEmpty, options) {
4768
- super([], options); // empty array not allow by default
4768
+ super([], options);
4769
4769
  this.createControl = createControl;
4770
4770
  this.equals = equals;
4771
4771
  this.isEmpty = isEmpty;
@@ -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 });
@@ -21213,6 +21217,10 @@ class ColorScale {
21213
21217
  return this.getLegendForValue(value).color;
21214
21218
  }
21215
21219
  getLegendForValue(value) {
21220
+ if (value <= this._min)
21221
+ return this._legendItems[0];
21222
+ if (value >= this._max)
21223
+ return this._legendItems[this._legendItems.length - 1];
21216
21224
  const index = Math.floor(value * (this._legendItems.length - 1) / this._max);
21217
21225
  return this._legendItems[index];
21218
21226
  }
@@ -28923,8 +28931,9 @@ class AppEntityEditorModal extends AppTabEditor {
28923
28931
  }
28924
28932
  async updateView(data, opts) {
28925
28933
  this.resetError();
28926
- if (!this.data)
28934
+ if (!data)
28927
28935
  throw { code: ErrorCodes.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
28936
+ this.data = data;
28928
28937
  await this.setValue(data);
28929
28938
  if (!opts || opts.emitEvent !== false) {
28930
28939
  this.markAsPristine();