@sumaris-net/ngx-components 0.25.12 → 0.25.13

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.12",
4
+ "version": "0.25.13",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -56,6 +56,7 @@ export * from './src/app/shared/pipes/maps.pipe';
56
56
  export * from './src/app/shared/pipes/string.pipes';
57
57
  export * from './src/app/shared/pipes/translate-context.pipe';
58
58
  export * from './src/app/shared/pipes/ng-init.pipe';
59
+ export * from './src/app/shared/pipes/form.pipes';
59
60
  export * from './src/app/shared/audio/audio';
60
61
  export * from './src/app/shared/file/file.service';
61
62
  export * from './src/app/shared/services/startable-service.class';
@@ -64,6 +65,7 @@ export * from './src/app/shared/services/memory-entity-service.class';
64
65
  export * from './src/app/shared/services/progress-bar.service';
65
66
  export * from './src/app/shared/services/translate-context.service';
66
67
  export * from './src/app/shared/services/job.utils';
68
+ export * from './src/app/shared/validator/form-error-adapter.class';
67
69
  export * from './src/app/shared/types';
68
70
  export * from './src/app/shared/dates';
69
71
  export * from './src/app/shared/functions';
@@ -105,7 +107,6 @@ export * from './src/app/core/services/pipes/account.pipes';
105
107
  export * from './src/app/core/services/pipes/department-to-string.pipe';
106
108
  export * from './src/app/core/services/pipes/person-to-string.pipe';
107
109
  export * from './src/app/core/services/pipes/usage-mode.pipes';
108
- export * from './src/app/core/form/form-error-translate.pipe';
109
110
  export * from './src/app/vendor';
110
111
  export * from './src/app/core/services/platform.service';
111
112
  export * from './src/app/core/services/network.service';
@@ -128,7 +129,6 @@ export * from './src/app/core/form/form.class';
128
129
  export * from './src/app/core/form/form.utils';
129
130
  export * from './src/app/core/form/form-buttons-bar.component';
130
131
  export * from './src/app/core/form/list.form';
131
- export * from './src/app/core/form/form-error.adapter';
132
132
  export * from './src/app/core/form/properties.form';
133
133
  export * from './src/app/core/table/table.class';
134
134
  export * from './src/app/core/table/table.utils';
@@ -20,7 +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
+ import { FormErrorAdapter, IFormPathTranslateService } from '../../shared/validator/form-error-adapter.class';
24
24
  export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
25
25
  export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
26
26
  export declare const SETTINGS_FILTER = "filter";
@@ -43,7 +43,7 @@ export interface IModalDetailOptions<T = any> {
43
43
  onDelete: (event: UIEvent, data: T) => Promise<boolean>;
44
44
  }
45
45
  export declare type SaveActionType = 'delete' | 'sort' | 'filter';
46
- export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm {
46
+ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm, IFormPathTranslateService {
47
47
  protected route: ActivatedRoute;
48
48
  protected router: Router;
49
49
  protected platform: Platform | PlatformService;
@@ -55,7 +55,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
55
55
  private _filter?;
56
56
  private _initialized;
57
57
  private _subscription;
58
- private _dataSourceloadingSubscription;
58
+ private _dataSourceLoadingSubscription;
59
59
  private _cellValueChangesDefs;
60
60
  protected _enabled: boolean;
61
61
  protected _destroy$: Subject<unknown>;
@@ -70,7 +70,6 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
70
70
  displayedColumns: string[];
71
71
  totalRowCount: number | null;
72
72
  visibleRowCount: number;
73
- i18nService: IFormI18nService;
74
73
  loadingSubject: BehaviorSubject<boolean>;
75
74
  savingSubject: BehaviorSubject<boolean>;
76
75
  dirtySubject: BehaviorSubject<boolean>;
@@ -291,6 +290,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
291
290
  doRefresh(event?: CompletableEvent): void;
292
291
  getCurrentColumns(): ColumnItem[];
293
292
  escapeEditingRow(event?: Event, row?: TableElement<T>): void;
293
+ translateFormControlPath(path: string): string;
294
294
  protected editRow(event: Event | undefined, row: TableElement<T>, opts?: {
295
295
  focusColumn?: string;
296
296
  }): boolean;
@@ -356,8 +356,6 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
356
356
  separator?: string;
357
357
  recursive?: boolean;
358
358
  }): string;
359
- protected getI18nFieldName(fieldName: string): string;
360
- protected getI18nError(errorKey: string, errorContent?: any): string;
361
359
  protected setError(value: string, opts?: {
362
360
  emitEvent?: boolean;
363
361
  }): void;
@@ -1,6 +1,6 @@
1
1
  import { PipeTransform } from '@angular/core';
2
2
  import { FormGroup } from '@angular/forms';
3
- import { FormErrorAdapter, FormErrorAdapterOptions } from './form-error.adapter';
3
+ import { FormErrorAdapter, FormErrorAdapterOptions } from '../validator/form-error-adapter.class';
4
4
  export declare class FormErrorTranslatePipe implements PipeTransform {
5
5
  private adapter;
6
6
  constructor(adapter: FormErrorAdapter);
@@ -0,0 +1,22 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { TranslateService } from '@ngx-translate/core';
3
+ import { FormGroup } from '@angular/forms';
4
+ import { ObjectMap } from '../types';
5
+ export declare const APP_FORM_ERROR_I18N_KEYS: InjectionToken<ObjectMap<string>>;
6
+ export interface IFormPathTranslateService {
7
+ translateFormControlPath: (controlPath: string) => string;
8
+ }
9
+ export interface FormErrorAdapterOptions {
10
+ i18nPrefix?: string;
11
+ pathTranslateService?: IFormPathTranslateService;
12
+ separator?: string;
13
+ recursive?: boolean;
14
+ }
15
+ export declare class FormErrorAdapter implements IFormPathTranslateService {
16
+ private translate;
17
+ private readonly errorI18nKeys;
18
+ constructor(translate: TranslateService, errorI18nKeys: ObjectMap<string>);
19
+ translateFormErrors(form: FormGroup, opts?: FormErrorAdapterOptions): string;
20
+ translateFormControlPath(path: string, opts?: FormErrorAdapterOptions): string;
21
+ translateError(errorKey: string, errorContent?: any): any;
22
+ }
@@ -1,7 +1,7 @@
1
1
  import { AbstractControl, FormControl, ValidationErrors, ValidatorFn } from '@angular/forms';
2
2
  import { Moment, unitOfTime } from 'moment';
3
3
  export declare class SharedValidators {
4
- static I18N_ERROR_KEYS: {
4
+ static readonly I18N_ERROR_KEYS: {
5
5
  required: string;
6
6
  min: string;
7
7
  max: string;
@@ -37,8 +37,6 @@ export declare class SharedValidators {
37
37
  static dateRangeStart(endDateFieldName: string, msg?: string): ValidatorFn;
38
38
  static copyParentErrors(errorNames?: string[]): ValidatorFn;
39
39
  static clearError(control: AbstractControl, errorCode: string): void;
40
- static translateError(translateFn: (key: string, obj?: any) => string, errorKey: string, errorContent?: any): string;
41
- static translateErrorKey(): void;
42
40
  }
43
41
  export declare class SharedFormGroupValidators {
44
42
  static dateRange(startDateField: string, endDateField: string, msg?: string): ValidatorFn;