@sumaris-net/ngx-components 0.25.11 → 0.25.12

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "0.25.11",
4
+ "version": "0.25.12",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,7 +1,21 @@
1
1
  import { TranslateService } from '@ngx-translate/core';
2
2
  import { FormGroup } from '@angular/forms';
3
+ export declare class IFormI18nService {
4
+ /**
5
+ * From a fieldName complete name (e.g. 'startDate', 'taxonGroup', 'measurementValues.1'), should return an i18n key to be used translation
6
+ * @param fieldName the field name to convert
7
+ */
8
+ getI18nFieldName: (fieldName: any) => string;
9
+ /**
10
+ * From a error key (e.g. 'required'), should return an i18n key to be used translation
11
+ * @param errorKey the error key
12
+ * @param errorContent the error content
13
+ */
14
+ getI18nError?: (e: any, c: any) => string;
15
+ }
3
16
  export interface FormErrorAdapterOptions {
4
17
  i18nPrefix?: string;
18
+ i18nService?: IFormI18nService;
5
19
  separator?: string;
6
20
  recursive?: boolean;
7
21
  }
@@ -9,8 +23,6 @@ export declare class FormErrorAdapter {
9
23
  private translate;
10
24
  constructor(translate: TranslateService);
11
25
  formatError(form: FormGroup, opts?: FormErrorAdapterOptions): string;
12
- protected getI18nFieldName(fieldName: string, opts?: {
13
- i18nPrefix?: string;
14
- }): string;
15
- protected getI18nError(errorKey: string, errorContent?: any): string;
26
+ protected getI18nKey(fieldName: string, opts?: FormErrorAdapterOptions): string;
27
+ protected getI18nError(errorKey: string, errorContent?: any, opts?: FormErrorAdapterOptions): string;
16
28
  }
@@ -20,6 +20,7 @@ import { CompletableEvent } from '../../shared/events';
20
20
  import { ShowToastOptions } from '../../shared/toasts';
21
21
  import { CdkColumnDef } from '@angular/cdk/table';
22
22
  import { LoadResult } from '../../shared/services/entity-service.class';
23
+ import { FormErrorAdapter, IFormI18nService } from '../form/form-error.adapter';
23
24
  export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
24
25
  export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
25
26
  export declare const SETTINGS_FILTER = "filter";
@@ -64,10 +65,12 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
64
65
  protected alertCtrl: AlertController;
65
66
  protected toastController: ToastController;
66
67
  protected previouslyEditedRowId: number;
68
+ protected formErrorAdapter: FormErrorAdapter;
67
69
  excludesColumns: string[];
68
70
  displayedColumns: string[];
69
71
  totalRowCount: number | null;
70
72
  visibleRowCount: number;
73
+ i18nService: IFormI18nService;
71
74
  loadingSubject: BehaviorSubject<boolean>;
72
75
  savingSubject: BehaviorSubject<boolean>;
73
76
  dirtySubject: BehaviorSubject<boolean>;