@sumaris-net/ngx-components 2.9.0-alpha3 → 2.9.0-alpha5
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/doc/changelog.md +3 -1
- package/esm2022/src/app/core/form/form.class.mjs +5 -5
- package/esm2022/src/app/core/table/async-table.class.mjs +23 -6
- package/esm2022/src/app/core/table/table.class.mjs +18 -5
- package/esm2022/src/app/shared/pipes/form.pipes.mjs +2 -2
- package/esm2022/src/app/shared/validator/form-error-adapter.class.mjs +14 -2
- package/fesm2022/sumaris-net.ngx-components.mjs +55 -13
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.class.d.ts +4 -4
- package/src/app/core/table/async-table.class.d.ts +13 -4
- package/src/app/core/table/table.class.d.ts +11 -3
- package/src/app/shared/pipes/form.pipes.d.ts +4 -4
- package/src/app/shared/validator/form-error-adapter.class.d.ts +29 -5
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { BehaviorSubject, Subject, Subscription } from 'rxjs';
|
|
|
4
4
|
import { IAppForm } from './form.utils';
|
|
5
5
|
import { LocalSettingsService } from '../services/local-settings.service';
|
|
6
6
|
import { WaitForOptions } from '../../shared/observables';
|
|
7
|
-
import {
|
|
7
|
+
import { FormErrorTranslateOptions, FormErrorTranslator, IFormPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
8
8
|
import { TranslateService } from '@ngx-translate/core';
|
|
9
9
|
import { MatAutocompleteConfigHolder, MatAutocompleteFieldAddOptions, MatAutocompleteFieldConfig } from '../../shared/material/autocomplete/material.autocomplete.config';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
@@ -55,7 +55,7 @@ export declare class AppForm<T> implements IAppForm<T>, OnInit, OnDestroy, IForm
|
|
|
55
55
|
get destroyed(): boolean;
|
|
56
56
|
debug: boolean;
|
|
57
57
|
tabindex: number;
|
|
58
|
-
|
|
58
|
+
formErrorTranslateOptions: FormErrorTranslateOptions;
|
|
59
59
|
set form(value: UntypedFormGroup);
|
|
60
60
|
get form(): UntypedFormGroup;
|
|
61
61
|
onCancel: EventEmitter<any>;
|
|
@@ -132,7 +132,7 @@ export declare class AppForm<T> implements IAppForm<T>, OnInit, OnDestroy, IForm
|
|
|
132
132
|
emitEvent?: boolean;
|
|
133
133
|
}): void;
|
|
134
134
|
translateFormPath(path: string): any;
|
|
135
|
-
protected getFormError(form: UntypedFormGroup, opts?:
|
|
135
|
+
protected getFormError(form: UntypedFormGroup, opts?: FormErrorTranslateOptions): string;
|
|
136
136
|
protected getI18nFieldName(path: string): string;
|
|
137
137
|
protected registerSubscription(sub: Subscription): void;
|
|
138
138
|
protected unregisterSubscription(sub: Subscription): void;
|
|
@@ -143,5 +143,5 @@ export declare class AppForm<T> implements IAppForm<T>, OnInit, OnDestroy, IForm
|
|
|
143
143
|
protected markForCheck(): void;
|
|
144
144
|
private setLoading;
|
|
145
145
|
static ɵfac: i0.ɵɵFactoryDeclaration<AppForm<any>, never>;
|
|
146
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AppForm<any>, never, never, { "debug": { "alias": "debug"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "
|
|
146
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AppForm<any>, never, never, { "debug": { "alias": "debug"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "formErrorTranslateOptions": { "alias": "formErrorTranslateOptions"; "required": false; }; "form": { "alias": "form"; "required": false; }; }, { "onCancel": "onCancel"; "onSubmit": "onSubmit"; }, never, never, false, never>;
|
|
147
147
|
}
|
|
@@ -18,7 +18,7 @@ import { WaitForOptions } from '../../shared/observables';
|
|
|
18
18
|
import { ShowToastOptions } from '../../shared/toast/toasts';
|
|
19
19
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
20
20
|
import { LoadResult } from '../../shared/services/entity-service.class';
|
|
21
|
-
import { FormErrorTranslator, FormErrorTranslatorOptions, IFormPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
21
|
+
import { FormErrorTranslateOptions, FormErrorTranslator, FormErrorTranslatorOptions, IFormPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
22
22
|
import { SaveActionType } from './table.model';
|
|
23
23
|
import { AsyncTableElement } from '@e-is/ngx-material-table';
|
|
24
24
|
import { EntitiesAsyncTableDataSource } from './entities-async-table-datasource.class';
|
|
@@ -50,7 +50,7 @@ export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, I
|
|
|
50
50
|
displayedColumns: string[];
|
|
51
51
|
totalRowCount: number | null;
|
|
52
52
|
visibleRowCount: number;
|
|
53
|
-
|
|
53
|
+
errorTranslateOptions: FormErrorTranslateOptions | FormErrorTranslatorOptions;
|
|
54
54
|
readonly readySubject: BehaviorSubject<boolean>;
|
|
55
55
|
readonly loadingSubject: BehaviorSubject<boolean>;
|
|
56
56
|
readonly savingSubject: BehaviorSubject<boolean>;
|
|
@@ -59,6 +59,14 @@ export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, I
|
|
|
59
59
|
readonly errorSubject: BehaviorSubject<string>;
|
|
60
60
|
get error(): string;
|
|
61
61
|
set error(error: string);
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated use errorTranslateOptions instead
|
|
64
|
+
*/
|
|
65
|
+
get errorTranslatorOptions(): FormErrorTranslatorOptions;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated use errorTranslateOptions instead
|
|
68
|
+
*/
|
|
69
|
+
set errorTranslatorOptions(options: FormErrorTranslatorOptions);
|
|
62
70
|
selection: SelectionModel<AsyncTableElement<T>>;
|
|
63
71
|
permanentSelection: SelectionModel<T>;
|
|
64
72
|
permanentSelectionChangedPrevented: boolean;
|
|
@@ -92,6 +100,7 @@ export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, I
|
|
|
92
100
|
get lastUserColumn(): string;
|
|
93
101
|
set dataSource(value: EntitiesAsyncTableDataSource<T, F, ID>);
|
|
94
102
|
get dataSource(): EntitiesAsyncTableDataSource<T, F, ID>;
|
|
103
|
+
set filter(value: F);
|
|
95
104
|
get filter(): F;
|
|
96
105
|
get empty(): boolean;
|
|
97
106
|
get selectedEntities(): T[];
|
|
@@ -343,7 +352,7 @@ export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, I
|
|
|
343
352
|
protected resetError(opts?: {
|
|
344
353
|
emitEvent?: boolean;
|
|
345
354
|
}): void;
|
|
346
|
-
protected getRowError(row?: AsyncTableElement<T>, opts?:
|
|
355
|
+
protected getRowError(row?: AsyncTableElement<T>, opts?: FormErrorTranslateOptions): string;
|
|
347
356
|
protected setError(value: string, opts?: {
|
|
348
357
|
emitEvent?: boolean;
|
|
349
358
|
}): void;
|
|
@@ -382,5 +391,5 @@ export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, I
|
|
|
382
391
|
private startCellValueChanges;
|
|
383
392
|
private stopCellValueChanges;
|
|
384
393
|
static ɵfac: i0.ɵɵFactoryDeclaration<AppAsyncTable<any, any, any>, never>;
|
|
385
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AppAsyncTable<any, any, any>, never, never, { "settingsId": { "alias": "settingsId"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "i18nColumnPrefix": { "alias": "i18nColumnPrefix"; "required": false; }; "i18nColumnSuffix": { "alias": "i18nColumnSuffix"; "required": false; }; "autoLoad": { "alias": "autoLoad"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "inlineEdition": { "alias": "inlineEdition"; "required": false; }; "focusFirstColumn": { "alias": "focusFirstColumn"; "required": false; }; "confirmBeforeDelete": { "alias": "confirmBeforeDelete"; "required": false; }; "confirmBeforeCancel": { "alias": "confirmBeforeCancel"; "required": false; }; "undoableDeletion": { "alias": "undoableDeletion"; "required": false; }; "saveBeforeDelete": { "alias": "saveBeforeDelete"; "required": false; }; "keepEditedRowOnSave": { "alias": "keepEditedRowOnSave"; "required": false; }; "saveBeforeSort": { "alias": "saveBeforeSort"; "required": false; }; "saveBeforeFilter": { "alias": "saveBeforeFilter"; "required": false; }; "propagateRowError": { "alias": "propagateRowError"; "required": false; }; "permanentSelectionAllowed": { "alias": "permanentSelectionAllowed"; "required": false; }; "defaultSortBy": { "alias": "defaultSortBy"; "required": false; }; "defaultSortDirection": { "alias": "defaultSortDirection"; "required": false; }; "defaultPageSize": { "alias": "defaultPageSize"; "required": false; }; "defaultPageSizeOptions": { "alias": "defaultPageSizeOptions"; "required": false; }; "focusColumn": { "alias": "focusColumn"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "paginator": { "alias": "paginator"; "required": false; }; }, { "onRefresh": "onRefresh"; "onOpenRow": "onOpenRow"; "onNewRow": "onNewRow"; "onStartEditingRow": "onStartEditingRow"; "onConfirmEditCreateRow": "onConfirmEditCreateRow"; "onCancelOrDeleteRow": "onCancelOrDeleteRow"; "onBeforeDeleteRows": "onBeforeDeleteRows"; "onBeforeCancelRows": "onBeforeCancelRows"; "onBeforeSave": "onBeforeSave"; "onAfterDeletedRows": "onAfterDeletedRows"; "onSort": "onSort"; "onDirty": "onDirty"; "onError": "onError"; }, never, never, false, never>;
|
|
394
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AppAsyncTable<any, any, any>, never, never, { "settingsId": { "alias": "settingsId"; "required": false; }; "debug": { "alias": "debug"; "required": false; }; "i18nColumnPrefix": { "alias": "i18nColumnPrefix"; "required": false; }; "i18nColumnSuffix": { "alias": "i18nColumnSuffix"; "required": false; }; "autoLoad": { "alias": "autoLoad"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "inlineEdition": { "alias": "inlineEdition"; "required": false; }; "focusFirstColumn": { "alias": "focusFirstColumn"; "required": false; }; "confirmBeforeDelete": { "alias": "confirmBeforeDelete"; "required": false; }; "confirmBeforeCancel": { "alias": "confirmBeforeCancel"; "required": false; }; "undoableDeletion": { "alias": "undoableDeletion"; "required": false; }; "saveBeforeDelete": { "alias": "saveBeforeDelete"; "required": false; }; "keepEditedRowOnSave": { "alias": "keepEditedRowOnSave"; "required": false; }; "saveBeforeSort": { "alias": "saveBeforeSort"; "required": false; }; "saveBeforeFilter": { "alias": "saveBeforeFilter"; "required": false; }; "propagateRowError": { "alias": "propagateRowError"; "required": false; }; "permanentSelectionAllowed": { "alias": "permanentSelectionAllowed"; "required": false; }; "defaultSortBy": { "alias": "defaultSortBy"; "required": false; }; "defaultSortDirection": { "alias": "defaultSortDirection"; "required": false; }; "defaultPageSize": { "alias": "defaultPageSize"; "required": false; }; "defaultPageSizeOptions": { "alias": "defaultPageSizeOptions"; "required": false; }; "focusColumn": { "alias": "focusColumn"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "paginator": { "alias": "paginator"; "required": false; }; }, { "onRefresh": "onRefresh"; "onOpenRow": "onOpenRow"; "onNewRow": "onNewRow"; "onStartEditingRow": "onStartEditingRow"; "onConfirmEditCreateRow": "onConfirmEditCreateRow"; "onCancelOrDeleteRow": "onCancelOrDeleteRow"; "onBeforeDeleteRows": "onBeforeDeleteRows"; "onBeforeCancelRows": "onBeforeCancelRows"; "onBeforeSave": "onBeforeSave"; "onAfterDeletedRows": "onAfterDeletedRows"; "onSort": "onSort"; "onDirty": "onDirty"; "onError": "onError"; }, never, never, false, never>;
|
|
386
395
|
}
|
|
@@ -18,7 +18,7 @@ import { WaitForOptions } from '../../shared/observables';
|
|
|
18
18
|
import { ShowToastOptions } from '../../shared/toast/toasts';
|
|
19
19
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
20
20
|
import { LoadResult } from '../../shared/services/entity-service.class';
|
|
21
|
-
import { FormErrorTranslator, FormErrorTranslatorOptions, IFormPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
21
|
+
import { FormErrorTranslateOptions, FormErrorTranslator, FormErrorTranslatorOptions, IFormPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
22
22
|
import { SaveActionType } from './table.model';
|
|
23
23
|
import { MatPaginator } from '@angular/material/paginator';
|
|
24
24
|
import { MatTable } from '@angular/material/table';
|
|
@@ -50,7 +50,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
50
50
|
displayedColumns: string[];
|
|
51
51
|
totalRowCount: number | null;
|
|
52
52
|
visibleRowCount: number;
|
|
53
|
-
|
|
53
|
+
errorTranslateOptions: FormErrorTranslateOptions | FormErrorTranslatorOptions;
|
|
54
54
|
readonly readySubject: BehaviorSubject<boolean>;
|
|
55
55
|
readonly loadingSubject: BehaviorSubject<boolean>;
|
|
56
56
|
readonly savingSubject: BehaviorSubject<boolean>;
|
|
@@ -63,6 +63,14 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
63
63
|
* @deprecated
|
|
64
64
|
*/
|
|
65
65
|
get error$(): Observable<string>;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated use errorTranslateOptions instead
|
|
68
|
+
*/
|
|
69
|
+
get errorTranslatorOptions(): FormErrorTranslatorOptions;
|
|
70
|
+
/**
|
|
71
|
+
* @deprecated use errorTranslateOptions instead
|
|
72
|
+
*/
|
|
73
|
+
set errorTranslatorOptions(options: FormErrorTranslatorOptions);
|
|
66
74
|
selection: SelectionModel<TableElement<T>>;
|
|
67
75
|
permanentSelection: SelectionModel<T>;
|
|
68
76
|
permanentSelectionChangedPrevented: boolean;
|
|
@@ -349,7 +357,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
349
357
|
protected resetError(opts?: {
|
|
350
358
|
emitEvent?: boolean;
|
|
351
359
|
}): void;
|
|
352
|
-
protected getRowError(row?: TableElement<T>, opts?:
|
|
360
|
+
protected getRowError(row?: TableElement<T>, opts?: FormErrorTranslateOptions): string;
|
|
353
361
|
protected setError(value: string, opts?: {
|
|
354
362
|
emitEvent?: boolean;
|
|
355
363
|
}): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeDetectorRef, OnDestroy, PipeTransform } from '@angular/core';
|
|
2
2
|
import { AbstractControl, UntypedFormArray, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
3
|
-
import { FormErrorTranslator, FormErrorTranslatorOptions } from '../validator/form-error-adapter.class';
|
|
3
|
+
import { FormErrorTranslateOptions, FormErrorTranslator, FormErrorTranslatorOptions } from '../validator/form-error-adapter.class';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export declare class FormErrorPipe implements PipeTransform, OnDestroy {
|
|
6
6
|
private service;
|
|
@@ -10,7 +10,7 @@ export declare class FormErrorPipe implements PipeTransform, OnDestroy {
|
|
|
10
10
|
private _lastOptions;
|
|
11
11
|
private _onFormStatusChanges;
|
|
12
12
|
constructor(service: FormErrorTranslator, _ref: ChangeDetectorRef);
|
|
13
|
-
transform(form: UntypedFormGroup, opts?:
|
|
13
|
+
transform(form: UntypedFormGroup, opts?: FormErrorTranslateOptions): string;
|
|
14
14
|
ngOnDestroy(): void;
|
|
15
15
|
private _updateValue;
|
|
16
16
|
/**
|
|
@@ -22,11 +22,11 @@ export declare class FormErrorPipe implements PipeTransform, OnDestroy {
|
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Same a FormErrorPipe
|
|
25
|
-
* @deprecated
|
|
25
|
+
* @deprecated use `formError` instead
|
|
26
26
|
*/
|
|
27
27
|
export declare class FormErrorTranslatePipe extends FormErrorPipe {
|
|
28
28
|
constructor(service: FormErrorTranslator, _ref: ChangeDetectorRef);
|
|
29
|
-
transform(form: UntypedFormGroup, opts?: FormErrorTranslatorOptions): string;
|
|
29
|
+
transform(form: UntypedFormGroup, opts?: FormErrorTranslateOptions | FormErrorTranslatorOptions): string;
|
|
30
30
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormErrorTranslatePipe, never>;
|
|
31
31
|
static ɵpipe: i0.ɵɵPipeDeclaration<FormErrorTranslatePipe, "translateFormError", false>;
|
|
32
32
|
}
|
|
@@ -8,19 +8,43 @@ export declare const APP_FORM_ERROR_I18N_KEYS: InjectionToken<ObjectMap<string>>
|
|
|
8
8
|
export interface IFormPathTranslator {
|
|
9
9
|
translateFormPath: (path: string) => string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface FormErrorTranslateOptions {
|
|
12
12
|
i18nPrefix?: string;
|
|
13
13
|
pathTranslator?: IFormPathTranslator;
|
|
14
14
|
separator?: string;
|
|
15
15
|
recursive?: boolean;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated use IFormPathTranslator instead
|
|
19
|
+
*/
|
|
20
|
+
export interface IFormControlPathTranslator {
|
|
21
|
+
/**
|
|
22
|
+
* @Deprecated use 'translateControlPath' from IFormPathTranslator interface
|
|
23
|
+
*/
|
|
24
|
+
translateControlPath: (path: string) => string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @Deprecated use 'FormErrorTranslateOptions' instead
|
|
28
|
+
*/
|
|
29
|
+
export interface FormErrorTranslatorOptions extends FormErrorTranslateOptions {
|
|
30
|
+
/**
|
|
31
|
+
* @Deprecated use 'pathTranslator' instead
|
|
32
|
+
*/
|
|
33
|
+
controlPathTranslator?: IFormControlPathTranslator;
|
|
34
|
+
}
|
|
35
|
+
export declare class FormErrorTranslator implements IFormPathTranslator, IFormControlPathTranslator {
|
|
18
36
|
private translate;
|
|
19
37
|
private readonly errorI18nKeys;
|
|
20
38
|
constructor(translate: TranslateService, errorI18nKeys: ObjectMap<string>);
|
|
21
|
-
translateFormErrors(control: AbstractControl, opts?: FormErrorTranslatorOptions): string;
|
|
22
|
-
translateErrors(errors: FormErrors, opts?:
|
|
23
|
-
translateFormPath(path: string, opts?: FormErrorTranslatorOptions): string;
|
|
39
|
+
translateFormErrors(control: AbstractControl, opts?: FormErrorTranslateOptions | FormErrorTranslatorOptions): string;
|
|
40
|
+
translateErrors(errors: FormErrors, opts?: FormErrorTranslateOptions): string;
|
|
41
|
+
translateFormPath(path: string, opts?: FormErrorTranslateOptions | FormErrorTranslatorOptions): string;
|
|
42
|
+
/**
|
|
43
|
+
* @Deprecated use translateFormPath() instead
|
|
44
|
+
* @param path
|
|
45
|
+
* @param opts
|
|
46
|
+
*/
|
|
47
|
+
translateControlPath(path: string, opts?: FormErrorTranslatorOptions): string;
|
|
24
48
|
translateError(errorKey: string, errorContent?: any): any;
|
|
25
49
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormErrorTranslator, [null, { optional: true; }]>;
|
|
26
50
|
static ɵprov: i0.ɵɵInjectableDeclaration<FormErrorTranslator>;
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "2.9.0-
|
|
5
|
+
"version": "2.9.0-alpha5",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|