@sumaris-net/ngx-components 0.25.11 → 0.25.15
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/bundles/sumaris-net.ngx-components.umd.js +13303 -13329
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/public_api.js +3 -3
- package/esm2015/src/app/core/core.module.js +1 -4
- package/esm2015/src/app/core/form/form.utils.js +1 -1
- package/esm2015/src/app/core/table/table.class.js +24 -48
- package/esm2015/src/app/shared/pipes/form.pipes.js +19 -0
- package/esm2015/src/app/shared/pipes/pipes.module.js +6 -3
- package/esm2015/src/app/shared/validator/form-error-adapter.class.js +75 -0
- package/esm2015/src/app/shared/validator/validators.js +2 -21
- package/fesm2015/sumaris-net.ngx-components.js +11869 -11893
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +2 -2
- package/src/app/core/table/table.class.d.ts +6 -4
- package/src/app/{core/form/form-error-translate.pipe.d.ts → shared/pipes/form.pipes.d.ts} +2 -2
- package/src/app/shared/validator/form-error-adapter.class.d.ts +22 -0
- package/src/app/shared/validator/validators.d.ts +1 -3
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/core/form/form-error-translate.pipe.js +0 -19
- package/esm2015/src/app/core/form/form-error.adapter.js +0 -56
- package/src/app/core/form/form-error.adapter.d.ts +0 -16
package/package.json
CHANGED
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,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, FormErrorTranslateOptions, IFormControlPathTranslateService } from '../../shared/validator/form-error-adapter.class';
|
|
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";
|
|
@@ -42,7 +43,7 @@ export interface IModalDetailOptions<T = any> {
|
|
|
42
43
|
onDelete: (event: UIEvent, data: T) => Promise<boolean>;
|
|
43
44
|
}
|
|
44
45
|
export declare type SaveActionType = 'delete' | 'sort' | 'filter';
|
|
45
|
-
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 {
|
|
46
47
|
protected route: ActivatedRoute;
|
|
47
48
|
protected router: Router;
|
|
48
49
|
protected platform: Platform | PlatformService;
|
|
@@ -54,7 +55,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
54
55
|
private _filter?;
|
|
55
56
|
private _initialized;
|
|
56
57
|
private _subscription;
|
|
57
|
-
private
|
|
58
|
+
private _dataSourceLoadingSubscription;
|
|
58
59
|
private _cellValueChangesDefs;
|
|
59
60
|
protected _enabled: boolean;
|
|
60
61
|
protected _destroy$: Subject<unknown>;
|
|
@@ -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
|
+
translateErrorOptions: FormErrorTranslateOptions;
|
|
71
74
|
loadingSubject: BehaviorSubject<boolean>;
|
|
72
75
|
savingSubject: BehaviorSubject<boolean>;
|
|
73
76
|
dirtySubject: BehaviorSubject<boolean>;
|
|
@@ -288,6 +291,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
288
291
|
doRefresh(event?: CompletableEvent): void;
|
|
289
292
|
getCurrentColumns(): ColumnItem[];
|
|
290
293
|
escapeEditingRow(event?: Event, row?: TableElement<T>): void;
|
|
294
|
+
translateControlPath(path: string): string;
|
|
291
295
|
protected editRow(event: Event | undefined, row: TableElement<T>, opts?: {
|
|
292
296
|
focusColumn?: string;
|
|
293
297
|
}): boolean;
|
|
@@ -353,8 +357,6 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
353
357
|
separator?: string;
|
|
354
358
|
recursive?: boolean;
|
|
355
359
|
}): string;
|
|
356
|
-
protected getI18nFieldName(fieldName: string): string;
|
|
357
|
-
protected getI18nError(errorKey: string, errorContent?: any): string;
|
|
358
360
|
protected setError(value: string, opts?: {
|
|
359
361
|
emitEvent?: boolean;
|
|
360
362
|
}): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { FormErrorAdapter,
|
|
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?:
|
|
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;
|