@sumaris-net/ngx-components 0.25.12 → 0.25.16

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.16",
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';
@@ -78,6 +80,7 @@ export * from './src/app/shared/graph/colors.utils';
78
80
  export * from './src/app/shared/gesture/gesture-config';
79
81
  export * from './src/app/shared/gesture/hammer.utils';
80
82
  export * from './src/app/shared/validator/validators';
83
+ export * from './src/app/shared/validator/form-error-adapter.class';
81
84
  export * from './src/app/shared/material/latlong/latlong.utils';
82
85
  export * from './src/app/shared/shared.testing.module';
83
86
  export * from './src/app/shared/material/testing/material.testing.module';
@@ -105,7 +108,6 @@ export * from './src/app/core/services/pipes/account.pipes';
105
108
  export * from './src/app/core/services/pipes/department-to-string.pipe';
106
109
  export * from './src/app/core/services/pipes/person-to-string.pipe';
107
110
  export * from './src/app/core/services/pipes/usage-mode.pipes';
108
- export * from './src/app/core/form/form-error-translate.pipe';
109
111
  export * from './src/app/vendor';
110
112
  export * from './src/app/core/services/platform.service';
111
113
  export * from './src/app/core/services/network.service';
@@ -128,7 +130,6 @@ export * from './src/app/core/form/form.class';
128
130
  export * from './src/app/core/form/form.utils';
129
131
  export * from './src/app/core/form/form-buttons-bar.component';
130
132
  export * from './src/app/core/form/list.form';
131
- export * from './src/app/core/form/form-error.adapter';
132
133
  export * from './src/app/core/form/properties.form';
133
134
  export * from './src/app/core/table/table.class';
134
135
  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, FormErrorTranslateOptions, IFormControlPathTranslateService } 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, IFormControlPathTranslateService {
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,7 @@ 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;
73
+ translateErrorOptions: FormErrorTranslateOptions;
74
74
  loadingSubject: BehaviorSubject<boolean>;
75
75
  savingSubject: BehaviorSubject<boolean>;
76
76
  dirtySubject: BehaviorSubject<boolean>;
@@ -291,6 +291,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
291
291
  doRefresh(event?: CompletableEvent): void;
292
292
  getCurrentColumns(): ColumnItem[];
293
293
  escapeEditingRow(event?: Event, row?: TableElement<T>): void;
294
+ translateControlPath(path: string): string;
294
295
  protected editRow(event: Event | undefined, row: TableElement<T>, opts?: {
295
296
  focusColumn?: string;
296
297
  }): boolean;
@@ -356,8 +357,6 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
356
357
  separator?: string;
357
358
  recursive?: boolean;
358
359
  }): string;
359
- protected getI18nFieldName(fieldName: string): string;
360
- protected getI18nError(errorKey: string, errorContent?: any): string;
361
360
  protected setError(value: string, opts?: {
362
361
  emitEvent?: boolean;
363
362
  }): void;
@@ -1,8 +1,8 @@
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, FormErrorTranslateOptions } from '../validator/form-error-adapter.class';
4
4
  export declare class FormErrorTranslatePipe implements PipeTransform {
5
5
  private adapter;
6
6
  constructor(adapter: FormErrorAdapter);
7
- transform(form: FormGroup, opts?: FormErrorAdapterOptions): string;
7
+ transform(form: FormGroup, opts?: FormErrorTranslateOptions): string;
8
8
  }
@@ -0,0 +1,22 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { TranslateService } from '@ngx-translate/core';
3
+ import { AbstractControl } from '@angular/forms';
4
+ import { ObjectMap } from '../types';
5
+ export declare const APP_FORM_ERROR_I18N_KEYS: InjectionToken<ObjectMap<string>>;
6
+ export interface IFormControlPathTranslateService {
7
+ translateControlPath: (controlPath: string) => string;
8
+ }
9
+ export interface FormErrorTranslateOptions {
10
+ i18nPrefix?: string;
11
+ pathTranslateService?: IFormControlPathTranslateService;
12
+ separator?: string;
13
+ recursive?: boolean;
14
+ }
15
+ export declare class FormErrorAdapter implements IFormControlPathTranslateService {
16
+ private translate;
17
+ private readonly errorI18nKeys;
18
+ constructor(translate: TranslateService, errorI18nKeys: ObjectMap<string>);
19
+ translateErrors(control: AbstractControl, opts?: FormErrorTranslateOptions): string;
20
+ translateControlPath(path: string, opts?: FormErrorTranslateOptions): 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;