@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.
@@ -4754,7 +4754,7 @@ class FormArrayHelper {
4754
4754
  }
4755
4755
  class AppFormArray extends UntypedFormArray {
4756
4756
  constructor(createControl, equals, isEmpty, options) {
4757
- super([], options); // empty array not allow by default
4757
+ super([], options);
4758
4758
  this.createControl = createControl;
4759
4759
  this.equals = equals;
4760
4760
  this.isEmpty = isEmpty;
@@ -10003,13 +10003,9 @@ class MatPaginatorI18n extends MatPaginatorIntl {
10003
10003
  constructor(translate) {
10004
10004
  super();
10005
10005
  this.translate = translate;
10006
- this.itemsPerPageLabel = 'Items per page';
10007
- this.nextPageLabel = 'Next page';
10008
- this.previousPageLabel = 'Previous page';
10009
- this.getRangeLabel = function (page, pageSize, length) {
10010
- const of = this.translate ? this.translate.instant('COMMON.PAGINATOR.OF') : 'of';
10006
+ this.getRangeLabel = (page, pageSize, length) => {
10011
10007
  if (length === 0 || pageSize === 0) {
10012
- return '0 ' + of + ' ' + length;
10008
+ return '0 ' + this.ofLabel + ' ' + length;
10013
10009
  }
10014
10010
  length = Math.max(length, 0);
10015
10011
  const startIndex = page * pageSize;
@@ -10017,17 +10013,25 @@ class MatPaginatorI18n extends MatPaginatorIntl {
10017
10013
  const endIndex = startIndex < length ?
10018
10014
  Math.min(startIndex + pageSize, length) :
10019
10015
  startIndex + pageSize;
10020
- return startIndex + 1 + ' - ' + endIndex + ' ' + of + ' ' + length;
10016
+ return startIndex + 1 + ' - ' + endIndex + ' ' + this.ofLabel + ' ' + length;
10021
10017
  };
10022
- this.translate = translate;
10023
- translate.onLangChange.subscribe(() => this.translateLabels());
10024
- this.translateLabels();
10018
+ this.translate.get([
10019
+ 'COMMON.PAGINATOR.ITEMS_PER_PAGE',
10020
+ 'COMMON.PAGINATOR.NEXT_PAGE',
10021
+ 'COMMON.PAGINATOR.PREVIOUS_PAGE',
10022
+ 'COMMON.PAGINATOR.OF',
10023
+ ])
10024
+ .subscribe((translations) => {
10025
+ console.info('[MatPaginatorI18n] Update pagination translations');
10026
+ this.itemsPerPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.ITEMS_PER_PAGE', '');
10027
+ this.nextPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.NEXT_PAGE', '>');
10028
+ this.previousPageLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.PREVIOUS_PAGE', '<');
10029
+ this.ofLabel = this._getTranslationValue(translations, 'COMMON.PAGINATOR.OF', '/');
10030
+ this.changes.next();
10031
+ });
10025
10032
  }
10026
- translateLabels() {
10027
- //console.debug("[i18n] Update pagination translations");
10028
- this.itemsPerPageLabel = this.translate.instant('COMMON.PAGINATOR.ITEMS_PER_PAGE');
10029
- this.nextPageLabel = this.translate.instant('COMMON.PAGINATOR.NEXT_PAGE');
10030
- this.previousPageLabel = this.translate.instant('COMMON.PAGINATOR.PREVIOUS_PAGE');
10033
+ _getTranslationValue(translations, key, defaultValue) {
10034
+ return (translations[key] !== key) ? translations[key] : defaultValue;
10031
10035
  }
10032
10036
  }
10033
10037
  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 });
@@ -21542,6 +21546,10 @@ class ColorScale {
21542
21546
  return this.getLegendForValue(value).color;
21543
21547
  }
21544
21548
  getLegendForValue(value) {
21549
+ if (value <= this._min)
21550
+ return this._legendItems[0];
21551
+ if (value >= this._max)
21552
+ return this._legendItems[this._legendItems.length - 1];
21545
21553
  const index = Math.floor(value * (this._legendItems.length - 1) / this._max);
21546
21554
  return this._legendItems[index];
21547
21555
  }
@@ -29514,8 +29522,9 @@ class AppEntityEditorModal extends AppTabEditor {
29514
29522
  updateView(data, opts) {
29515
29523
  return __awaiter(this, void 0, void 0, function* () {
29516
29524
  this.resetError();
29517
- if (!this.data)
29525
+ if (!data)
29518
29526
  throw { code: ErrorCodes.DATA_NOT_FOUND_ERROR, message: 'ERROR.DATA_NO_FOUND' };
29527
+ this.data = data;
29519
29528
  yield this.setValue(data);
29520
29529
  if (!opts || opts.emitEvent !== false) {
29521
29530
  this.markAsPristine();