@sumaris-net/ngx-components 1.22.12 → 1.23.0-rc3
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 +536 -457
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/services/local-settings.service.js +2 -2
- package/esm2015/src/app/core/services/platform.service.js +4 -2
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +108 -98
- package/esm2015/src/app/core/table/memory-table.class.js +3 -3
- package/esm2015/src/app/core/table/table.class.js +12 -8
- package/esm2015/src/app/core/table/testing/table.testing.js +16 -21
- package/esm2015/src/app/shared/file/images.utils.js +2 -2
- package/esm2015/src/app/shared/functions.js +11 -1
- package/esm2015/src/app/shared/services/memory-entity-service.class.js +44 -18
- package/fesm2015/sumaris-net.ngx-components.js +436 -375
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/entities-table-datasource.class.d.ts +20 -25
- package/src/app/core/table/memory-table.class.d.ts +2 -2
- package/src/app/core/table/table.class.d.ts +2 -0
- package/src/app/core/table/testing/table.testing.d.ts +5 -3
- package/src/app/shared/functions.d.ts +6 -0
- package/src/app/shared/services/memory-entity-service.class.d.ts +2 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
|
@@ -4,37 +4,30 @@ import { Entity, IEntity } from '../services/model/entity.model';
|
|
|
4
4
|
import { OnDestroy } from '@angular/core';
|
|
5
5
|
import { SortDirection } from '@angular/material/sort';
|
|
6
6
|
import { CollectionViewer } from '@angular/cdk/collections';
|
|
7
|
-
import {
|
|
7
|
+
import { TableDataSourceConfig } from '@e-is/ngx-material-table/src/app/ngx-material-table/table-data-source';
|
|
8
8
|
import { EntitiesServiceWatchOptions, FetchMoreFn, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
|
|
9
|
-
export declare interface
|
|
9
|
+
export declare interface EntitiesTableServiceOptions extends EntitiesServiceWatchOptions {
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
saveOnlyDirtyRows?: boolean;
|
|
12
12
|
readOnly?: boolean;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export interface EntitiesTableDataSourceConfig<T extends Entity<T, ID>, ID = number, WO extends EntitiesTableServiceOptions = EntitiesServiceWatchOptions> extends TableDataSourceConfig {
|
|
15
15
|
[key: string]: any;
|
|
16
|
-
prependNewElements?: boolean;
|
|
17
|
-
suppressErrors?: boolean;
|
|
18
|
-
keepOriginalDataAfterConfirm?: boolean;
|
|
19
16
|
onRowCreated?: (row: TableElement<T>) => Promise<void> | void;
|
|
20
|
-
dataServiceOptions?:
|
|
17
|
+
dataServiceOptions?: WO;
|
|
21
18
|
debug?: boolean;
|
|
22
19
|
}
|
|
23
|
-
export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any, ID = number,
|
|
24
|
-
readonly dataService: IEntitiesService<T, F,
|
|
25
|
-
private readonly
|
|
26
|
-
private readonly _options;
|
|
27
|
-
protected readonly _debug: boolean;
|
|
20
|
+
export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any, ID = number, WO extends EntitiesTableServiceOptions = EntitiesTableServiceOptions, V extends ValidatorService = ValidatorService, C extends EntitiesTableDataSourceConfig<T, ID, WO> = EntitiesTableDataSourceConfig<T, ID, WO>> extends TableDataSource<T, V, C> implements OnDestroy {
|
|
21
|
+
readonly dataService: IEntitiesService<T, F, WO>;
|
|
22
|
+
private readonly _entityName;
|
|
28
23
|
protected _creating: boolean;
|
|
29
24
|
protected _saving: boolean;
|
|
30
|
-
protected _useValidator: boolean;
|
|
31
25
|
protected _stopWatching$: Subject<any>;
|
|
32
26
|
protected _editingRowCount: number;
|
|
33
27
|
protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
|
|
34
28
|
loadingSubject: BehaviorSubject<boolean>;
|
|
35
|
-
get serviceOptions():
|
|
36
|
-
set serviceOptions(value:
|
|
37
|
-
get options(): AppTableDataSourceOptions<T, ID, O>;
|
|
29
|
+
get serviceOptions(): WO;
|
|
30
|
+
set serviceOptions(value: WO);
|
|
38
31
|
get loaded(): boolean;
|
|
39
32
|
get loading(): boolean;
|
|
40
33
|
/**
|
|
@@ -46,28 +39,30 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
|
|
|
46
39
|
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
47
40
|
* @param config Additional configuration for table.
|
|
48
41
|
*/
|
|
49
|
-
constructor(dataType: new () => T, dataService: IEntitiesService<T, F,
|
|
42
|
+
constructor(dataType: new () => T, dataService: IEntitiesService<T, F, WO>, validatorService?: V, options?: C);
|
|
50
43
|
ngOnDestroy(): void;
|
|
51
44
|
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>): Observable<LoadResult<T>>;
|
|
45
|
+
protected updateDatasourceFromRows(rows: TableElement<T>[]): void;
|
|
52
46
|
save(): Promise<boolean>;
|
|
53
47
|
updateDatasource(data: T[], opts?: {
|
|
54
48
|
emitEvent: boolean;
|
|
55
49
|
}): void;
|
|
56
|
-
createNew(insertAt?: number): void;
|
|
57
50
|
connect(collectionViewer: CollectionViewer): Observable<TableElement<T>[] | ReadonlyArray<TableElement<T>>>;
|
|
58
51
|
disconnect(collectionViewer?: CollectionViewer): void;
|
|
59
52
|
waitIdle(debounceTimeMs?: number): Promise<any>;
|
|
60
53
|
confirmCreate(row: TableElement<T>): boolean;
|
|
61
54
|
confirmEdit(row: TableElement<T>): boolean;
|
|
62
|
-
startEdit(row: TableElement<T>):
|
|
63
|
-
cancelOrDelete(row: TableElement<T>): void;
|
|
55
|
+
startEdit(row: TableElement<T>): boolean;
|
|
64
56
|
handleError(error: any, message: string): Observable<LoadResult<T>>;
|
|
65
|
-
|
|
66
|
-
delete(id: number):
|
|
57
|
+
handleServiceError(error: any): void;
|
|
58
|
+
delete(id: number): boolean;
|
|
67
59
|
deleteAll(rows: TableElement<T>[]): Promise<any>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
getRow(id: number): TableElement<T>;
|
|
61
|
+
getRows(): TableElement<T>[];
|
|
62
|
+
createNew(insertAt?: number, options?: {
|
|
63
|
+
editing: boolean;
|
|
64
|
+
}): Promise<TableElement<T> | undefined>;
|
|
65
|
+
getData(): T[];
|
|
71
66
|
fetchMore(opts?: {
|
|
72
67
|
emitEvent: boolean;
|
|
73
68
|
}): Promise<boolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Injector } from '@angular/core';
|
|
2
2
|
import { ValidatorService } from '@e-is/ngx-material-table';
|
|
3
|
-
import {
|
|
3
|
+
import { EntitiesTableDataSourceConfig } from './entities-table-datasource.class';
|
|
4
4
|
import { AppTable } from './table.class';
|
|
5
5
|
import { IEntity } from '../services/model/entity.model';
|
|
6
6
|
import { InMemoryEntitiesService } from '../../shared/services/memory-entity-service.class';
|
|
@@ -13,7 +13,7 @@ export declare abstract class AppInMemoryTable<T extends IEntity<T, ID>, F = any
|
|
|
13
13
|
canDelete: boolean;
|
|
14
14
|
set value(data: T[]);
|
|
15
15
|
get value(): T[];
|
|
16
|
-
protected constructor(injector: Injector, columns: string[], dataType: new () => T, memoryDataService: InMemoryEntitiesService<T, F, ID>, validatorService: ValidatorService, options?:
|
|
16
|
+
protected constructor(injector: Injector, columns: string[], dataType: new () => T, memoryDataService: InMemoryEntitiesService<T, F, ID>, validatorService: ValidatorService, options?: EntitiesTableDataSourceConfig<T, ID>, filter?: F);
|
|
17
17
|
ngOnInit(): void;
|
|
18
18
|
setValue(value: T[], opts?: {
|
|
19
19
|
emitEvent?: boolean;
|
|
@@ -251,6 +251,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
251
251
|
}): void;
|
|
252
252
|
addRow(event?: Event, insertAt?: number, opts?: {
|
|
253
253
|
focusColumn?: string;
|
|
254
|
+
editing?: boolean;
|
|
254
255
|
}): boolean;
|
|
255
256
|
save(opts?: {
|
|
256
257
|
keepEditing?: boolean;
|
|
@@ -350,6 +351,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
350
351
|
protected generateTableId(): string;
|
|
351
352
|
protected addRowToTable(insertAt?: number, opts?: {
|
|
352
353
|
focusColumn?: string;
|
|
354
|
+
editing?: boolean;
|
|
353
355
|
}): Promise<TableElement<T>>;
|
|
354
356
|
protected registerCellValueChanges(name: string, formPath?: string, emitInitialValue?: boolean): Observable<any>;
|
|
355
357
|
protected setShowColumn(columnName: string, show: boolean, opts?: {
|
|
@@ -35,12 +35,14 @@ export declare class TableTestPage extends AppTable<Referential, ReferentialFilt
|
|
|
35
35
|
protected restoreFilter(): void;
|
|
36
36
|
toggleTimer(): void;
|
|
37
37
|
load(): void;
|
|
38
|
-
|
|
38
|
+
fetchMore(event?: CustomEvent & {
|
|
39
39
|
target?: EventTarget & {
|
|
40
40
|
complete?: () => void;
|
|
41
41
|
};
|
|
42
|
-
}): void
|
|
43
|
-
save(
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
save(opts?: {
|
|
44
|
+
keepEditing?: boolean;
|
|
45
|
+
}): Promise<boolean>;
|
|
44
46
|
clearControlValue(event: UIEvent, formControl: AbstractControl): boolean;
|
|
45
47
|
applyFilterAndClosePanel(event?: UIEvent): void;
|
|
46
48
|
resetFilter(event?: UIEvent): void;
|
|
@@ -114,4 +114,10 @@ export declare class Beans {
|
|
|
114
114
|
static isEmpty<T>(data: T, keys?: KeysEnum<T> | string[], opts?: {
|
|
115
115
|
blankStringLikeEmpty?: boolean;
|
|
116
116
|
}): boolean;
|
|
117
|
+
static collectById<T>(array: T[]): {
|
|
118
|
+
[key: string]: T;
|
|
119
|
+
};
|
|
120
|
+
static collectByProperty<T>(array: T[], propertyName: keyof T): {
|
|
121
|
+
[key: string]: T;
|
|
122
|
+
};
|
|
117
123
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { EntitiesService, EntitiesServiceWatchOptions, FilterFn, FilterFnFactory, IEntitiesService, LoadResult } from './entity-service.class';
|
|
2
|
+
import { EntitiesService, EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, FilterFn, FilterFnFactory, IEntitiesService, LoadResult } from './entity-service.class';
|
|
3
3
|
import { SortDirection } from '@angular/material/sort';
|
|
4
4
|
import { OnDestroy } from '@angular/core';
|
|
5
5
|
import { IEntity } from '../../core/services/model/entity.model';
|
|
@@ -36,6 +36,7 @@ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any,
|
|
|
36
36
|
setValue(data: T[], opts?: {
|
|
37
37
|
emitEvent?: boolean;
|
|
38
38
|
}): void;
|
|
39
|
+
loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: EntitiesServiceLoadOptions): Promise<LoadResult<T>>;
|
|
39
40
|
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filterData?: F, options?: any): Observable<LoadResult<T>>;
|
|
40
41
|
saveAll(data: T[], options?: any): Promise<T[]>;
|
|
41
42
|
deleteAll(dataToRemove: T[], options?: any): Promise<any>;
|