@sumaris-net/ngx-components 2.3.6 → 2.4.0-rc2
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/esm2020/public_api.mjs +4 -1
- package/esm2020/src/app/admin/users/users.mjs +3 -2
- package/esm2020/src/app/core/services/storage/entities-storage.service.mjs +9 -6
- package/esm2020/src/app/core/table/async-table.class.mjs +1615 -0
- package/esm2020/src/app/core/table/entities-async-table-datasource.class.mjs +383 -0
- package/esm2020/src/app/core/table/table.class.mjs +2 -12
- package/esm2020/src/app/core/table/table.model.mjs +12 -0
- package/esm2020/src/app/core/table/testing/table.testing.mjs +3 -2
- package/esm2020/src/app/shared/interceptors/progess.interceptor.mjs +10 -3
- package/esm2020/src/app/shared/material/datetime/material.datetime.mjs +2 -2
- package/esm2020/src/app/shared/services/progress-bar.service.mjs +3 -2
- package/esm2020/src/app/shared/shared.module.mjs +4 -4
- package/esm2020/src/app/shared/toolbar/toolbar.mjs +12 -9
- package/fesm2015/sumaris-net.ngx-components.mjs +2214 -127
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +2101 -128
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +3 -0
- package/src/app/core/services/storage/entities-storage.service.d.ts +2 -2
- package/src/app/core/table/async-table.class.d.ts +368 -0
- package/src/app/core/table/entities-async-table-datasource.class.d.ts +79 -0
- package/src/app/core/table/table.class.d.ts +1 -22
- package/src/app/core/table/table.model.d.ts +23 -0
- package/src/app/shared/interceptors/progess.interceptor.d.ts +2 -2
- package/src/app/shared/services/progress-bar.service.d.ts +9 -2
- package/src/app/shared/toolbar/toolbar.d.ts +2 -2
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -165,11 +165,14 @@ export * from './src/app/core/form/properties/properties.module';
|
|
|
165
165
|
export * from './src/app/core/form/text-popover/text-form.component';
|
|
166
166
|
export * from './src/app/core/form/text-popover/text-popover.component';
|
|
167
167
|
export * from './src/app/core/form/text-popover/text-popover.module';
|
|
168
|
+
export * from './src/app/core/table/table.model';
|
|
168
169
|
export * from './src/app/core/table/table.class';
|
|
170
|
+
export * from './src/app/core/table/async-table.class';
|
|
169
171
|
export * from './src/app/core/table/table.utils';
|
|
170
172
|
export * from './src/app/core/table/table.module';
|
|
171
173
|
export * from './src/app/core/table/memory-table.class';
|
|
172
174
|
export * from './src/app/core/table/entities-table-datasource.class';
|
|
175
|
+
export * from './src/app/core/table/entities-async-table-datasource.class';
|
|
173
176
|
export * from './src/app/core/table/table-select-columns.component';
|
|
174
177
|
export * from './src/app/core/table/actions-column.component';
|
|
175
178
|
export * from './src/app/core/icon/icon.component';
|
|
@@ -4,7 +4,7 @@ import { Platform } from '@ionic/angular';
|
|
|
4
4
|
import { Entity, IEntity } from '../model/entity.model';
|
|
5
5
|
import { LoadResult } from '../../../shared/services/entity-service.class';
|
|
6
6
|
import { EntityStorageLoadOptions, EntityStore, EntityStoreTypePolicy } from './entity-store.class';
|
|
7
|
-
import {
|
|
7
|
+
import { IProgressBarService } from '../../../shared/services/progress-bar.service';
|
|
8
8
|
import { Environment } from '../../../../environments/environment.class';
|
|
9
9
|
import { StartableService } from '../../../shared/services/startable-service.class';
|
|
10
10
|
import { IStorage } from '../../../shared/services/storage/storage.utils';
|
|
@@ -29,7 +29,7 @@ export declare class EntitiesStorage extends StartableService<EntityStorageMap>
|
|
|
29
29
|
private _dirty;
|
|
30
30
|
private _saving;
|
|
31
31
|
get dirty(): boolean;
|
|
32
|
-
constructor(platform: Platform, progressBarService:
|
|
32
|
+
constructor(platform: Platform, progressBarService: IProgressBarService, storage: IStorage, environment: Environment, typePolicies: EntitiesStorageTypePolicies);
|
|
33
33
|
ngOnStart(): Promise<EntityStorageMap>;
|
|
34
34
|
protected ngOnStop(): Promise<void>;
|
|
35
35
|
watchAll<T extends Entity<T>>(entityName: string, variables: {
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { AfterViewInit, EventEmitter, Injector, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { MatPaginator } from '@angular/material/paginator';
|
|
3
|
+
import { MatSort, MatSortable, SortDirection } from '@angular/material/sort';
|
|
4
|
+
import { MatTable } from '@angular/material/table';
|
|
5
|
+
import { BehaviorSubject, Observable, Subject, Subscription } from 'rxjs';
|
|
6
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
7
|
+
import { IEntity } from '../services/model/entity.model';
|
|
8
|
+
import { AlertController, ModalController, ToastController } from '@ionic/angular';
|
|
9
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
10
|
+
import { ColumnItem } from './table-select-columns.component';
|
|
11
|
+
import { Location } from '@angular/common';
|
|
12
|
+
import { IAppForm } from '../form/form.utils';
|
|
13
|
+
import { LocalSettingsService } from '../services/local-settings.service';
|
|
14
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
15
|
+
import { MatAutocompleteConfigHolder, MatAutocompleteFieldAddOptions, MatAutocompleteFieldConfig } from '../../shared/material/autocomplete/material.autocomplete.config';
|
|
16
|
+
import { CompletableEvent } from '../../shared/events';
|
|
17
|
+
import { WaitForOptions } from '../../shared/observables';
|
|
18
|
+
import { ShowToastOptions } from '../../shared/toast/toasts';
|
|
19
|
+
import { CdkColumnDef } from '@angular/cdk/table';
|
|
20
|
+
import { LoadResult } from '../../shared/services/entity-service.class';
|
|
21
|
+
import { FormErrorTranslator, FormErrorTranslatorOptions, IFormControlPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
22
|
+
import { SaveActionType } from './table.model';
|
|
23
|
+
import { AsyncTableElement } from '@e-is/ngx-material-table';
|
|
24
|
+
import { EntitiesAsyncTableDataSource } from './entities-async-table-datasource.class';
|
|
25
|
+
import * as i0 from "@angular/core";
|
|
26
|
+
export declare abstract class AppAsyncTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm, IFormControlPathTranslator {
|
|
27
|
+
protected columns: string[];
|
|
28
|
+
protected _dataSource?: EntitiesAsyncTableDataSource<T, F, ID>;
|
|
29
|
+
private _filter?;
|
|
30
|
+
private _initialized;
|
|
31
|
+
private _subscription;
|
|
32
|
+
private _dataSourceLoadingSubscription;
|
|
33
|
+
private _cellValueChangesDefs;
|
|
34
|
+
protected _enabled: boolean;
|
|
35
|
+
protected _autocompleteConfigHolder: MatAutocompleteConfigHolder;
|
|
36
|
+
protected allowRowDetail: boolean;
|
|
37
|
+
protected route: ActivatedRoute;
|
|
38
|
+
protected router: Router;
|
|
39
|
+
protected location: Location;
|
|
40
|
+
protected settings: LocalSettingsService;
|
|
41
|
+
protected translate: TranslateService;
|
|
42
|
+
protected modalCtrl: ModalController;
|
|
43
|
+
protected alertCtrl: AlertController;
|
|
44
|
+
protected toastController: ToastController;
|
|
45
|
+
protected previouslyEditedRowId: number;
|
|
46
|
+
protected formErrorAdapter: FormErrorTranslator;
|
|
47
|
+
protected readonly destroySubject: Subject<void>;
|
|
48
|
+
excludesColumns: string[];
|
|
49
|
+
displayedColumns: string[];
|
|
50
|
+
totalRowCount: number | null;
|
|
51
|
+
visibleRowCount: number;
|
|
52
|
+
errorTranslatorOptions: FormErrorTranslatorOptions;
|
|
53
|
+
readonly readySubject: BehaviorSubject<boolean>;
|
|
54
|
+
readonly loadingSubject: BehaviorSubject<boolean>;
|
|
55
|
+
readonly savingSubject: BehaviorSubject<boolean>;
|
|
56
|
+
readonly touchedSubject: BehaviorSubject<boolean>;
|
|
57
|
+
readonly dirtySubject: BehaviorSubject<boolean>;
|
|
58
|
+
readonly errorSubject: BehaviorSubject<string>;
|
|
59
|
+
get error(): string;
|
|
60
|
+
set error(error: string);
|
|
61
|
+
selection: SelectionModel<AsyncTableElement<T>>;
|
|
62
|
+
autocompleteFields: {
|
|
63
|
+
[key: string]: MatAutocompleteFieldConfig;
|
|
64
|
+
};
|
|
65
|
+
readonly mobile: boolean;
|
|
66
|
+
settingsId: string;
|
|
67
|
+
debug: boolean;
|
|
68
|
+
i18nColumnPrefix: string;
|
|
69
|
+
i18nColumnSuffix: string;
|
|
70
|
+
autoLoad: boolean;
|
|
71
|
+
readOnly: boolean;
|
|
72
|
+
inlineEdition: boolean;
|
|
73
|
+
focusFirstColumn: boolean;
|
|
74
|
+
confirmBeforeDelete: boolean;
|
|
75
|
+
confirmBeforeCancel: boolean;
|
|
76
|
+
undoableDeletion: boolean;
|
|
77
|
+
saveBeforeDelete: boolean;
|
|
78
|
+
keepEditedRowOnSave: boolean;
|
|
79
|
+
saveBeforeSort: boolean;
|
|
80
|
+
saveBeforeFilter: boolean;
|
|
81
|
+
propagateRowError: boolean;
|
|
82
|
+
defaultSortBy: string;
|
|
83
|
+
defaultSortDirection: SortDirection;
|
|
84
|
+
defaultPageSize: number;
|
|
85
|
+
defaultPageSizeOptions: number[];
|
|
86
|
+
focusColumn: string;
|
|
87
|
+
get firstUserColumn(): string;
|
|
88
|
+
get lastUserColumn(): string;
|
|
89
|
+
set dataSource(value: EntitiesAsyncTableDataSource<T, F, ID>);
|
|
90
|
+
get dataSource(): EntitiesAsyncTableDataSource<T, F, ID>;
|
|
91
|
+
set filter(value: F);
|
|
92
|
+
get filter(): F;
|
|
93
|
+
get empty(): boolean;
|
|
94
|
+
onRefresh: EventEmitter<any>;
|
|
95
|
+
onOpenRow: EventEmitter<AsyncTableElement<T>>;
|
|
96
|
+
onNewRow: EventEmitter<any>;
|
|
97
|
+
onStartEditingRow: EventEmitter<AsyncTableElement<T>>;
|
|
98
|
+
onConfirmEditCreateRow: EventEmitter<AsyncTableElement<T>>;
|
|
99
|
+
onCancelOrDeleteRow: EventEmitter<AsyncTableElement<T>>;
|
|
100
|
+
onBeforeDeleteRows: EventEmitter<import("../../shared/events").PromiseEvent<boolean, {
|
|
101
|
+
rows: AsyncTableElement<T>[];
|
|
102
|
+
}>>;
|
|
103
|
+
onBeforeCancelRows: EventEmitter<import("../../shared/events").PromiseEvent<boolean, {
|
|
104
|
+
rows: AsyncTableElement<T>[];
|
|
105
|
+
}>>;
|
|
106
|
+
onBeforeSave: EventEmitter<import("../../shared/events").PromiseEvent<{
|
|
107
|
+
confirmed: boolean;
|
|
108
|
+
save: boolean;
|
|
109
|
+
}, {
|
|
110
|
+
action: SaveActionType;
|
|
111
|
+
valid: boolean;
|
|
112
|
+
}>>;
|
|
113
|
+
onAfterDeletedRows: EventEmitter<AsyncTableElement<T>[]>;
|
|
114
|
+
onSort: EventEmitter<any>;
|
|
115
|
+
onDirty: EventEmitter<boolean>;
|
|
116
|
+
onError: EventEmitter<string>;
|
|
117
|
+
get dirty(): boolean;
|
|
118
|
+
get valid(): boolean;
|
|
119
|
+
get invalid(): boolean;
|
|
120
|
+
get pending(): boolean;
|
|
121
|
+
get touched(): boolean;
|
|
122
|
+
get untouched(): boolean;
|
|
123
|
+
disable(opts?: {
|
|
124
|
+
onlySelf?: boolean;
|
|
125
|
+
emitEvent?: boolean;
|
|
126
|
+
}): void;
|
|
127
|
+
enable(opts?: {
|
|
128
|
+
onlySelf?: boolean;
|
|
129
|
+
emitEvent?: boolean;
|
|
130
|
+
}): void;
|
|
131
|
+
get enabled(): boolean;
|
|
132
|
+
set disabled(value: boolean);
|
|
133
|
+
get disabled(): boolean;
|
|
134
|
+
markAsDirty(opts?: {
|
|
135
|
+
onlySelf?: boolean;
|
|
136
|
+
emitEvent?: boolean;
|
|
137
|
+
}): void;
|
|
138
|
+
markAsPristine(opts?: {
|
|
139
|
+
onlySelf?: boolean;
|
|
140
|
+
emitEvent?: boolean;
|
|
141
|
+
}): void;
|
|
142
|
+
markAsUntouched(opts?: {
|
|
143
|
+
onlySelf?: boolean;
|
|
144
|
+
emitEvent?: boolean;
|
|
145
|
+
}): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated prefer to use markAllAsTouched()
|
|
148
|
+
* @param opts
|
|
149
|
+
*/
|
|
150
|
+
markAsTouched(opts?: {
|
|
151
|
+
onlySelf?: boolean;
|
|
152
|
+
emitEvent?: boolean;
|
|
153
|
+
}): void;
|
|
154
|
+
markAllAsTouched(opts?: {
|
|
155
|
+
emitEvent?: boolean;
|
|
156
|
+
}): void;
|
|
157
|
+
markAsSaving(opts?: {
|
|
158
|
+
emitEvent?: boolean;
|
|
159
|
+
}): void;
|
|
160
|
+
markAsSaved(opts?: {
|
|
161
|
+
emitEvent?: boolean;
|
|
162
|
+
}): void;
|
|
163
|
+
markAsLoading(opts?: {
|
|
164
|
+
emitEvent?: boolean;
|
|
165
|
+
}): void;
|
|
166
|
+
markAsLoaded(opts?: {
|
|
167
|
+
emitEvent?: boolean;
|
|
168
|
+
}): void;
|
|
169
|
+
markAsReady(opts?: {
|
|
170
|
+
emitEvent?: boolean;
|
|
171
|
+
}): void;
|
|
172
|
+
get loading(): boolean;
|
|
173
|
+
get loaded(): boolean;
|
|
174
|
+
enableSort(): void;
|
|
175
|
+
disableSort(): void;
|
|
176
|
+
set pageSize(value: number);
|
|
177
|
+
get pageSize(): number;
|
|
178
|
+
get pageOffset(): number;
|
|
179
|
+
get sortActive(): string;
|
|
180
|
+
get sortDirection(): 'asc' | 'desc';
|
|
181
|
+
private _paginator;
|
|
182
|
+
set paginator(value: MatPaginator);
|
|
183
|
+
get paginator(): MatPaginator;
|
|
184
|
+
get destroyed(): boolean;
|
|
185
|
+
table: MatTable<T>;
|
|
186
|
+
childPaginator: MatPaginator;
|
|
187
|
+
sort: MatSort;
|
|
188
|
+
protected constructor(injector: Injector, columns: string[], _dataSource?: EntitiesAsyncTableDataSource<T, F, ID>, _filter?: F);
|
|
189
|
+
ngOnInit(): void;
|
|
190
|
+
ngAfterViewInit(): void;
|
|
191
|
+
ngOnDestroy(): void;
|
|
192
|
+
updateView(res: LoadResult<T> | undefined, opts?: {
|
|
193
|
+
emitEvent?: boolean;
|
|
194
|
+
}): Promise<void>;
|
|
195
|
+
setDatasource(datasource: EntitiesAsyncTableDataSource<T, F, ID>): void;
|
|
196
|
+
resetDataSource(): void;
|
|
197
|
+
addColumnDef(column: CdkColumnDef): void;
|
|
198
|
+
removeColumnDef(column: CdkColumnDef): void;
|
|
199
|
+
setFilter(filter: F, opts?: {
|
|
200
|
+
emitEvent?: boolean;
|
|
201
|
+
}): void;
|
|
202
|
+
confirmAndAdd(event?: Event, row?: AsyncTableElement<T>): Promise<boolean>;
|
|
203
|
+
confirmAndBackward(event?: Event, row?: AsyncTableElement<T>): Promise<boolean>;
|
|
204
|
+
confirmAndForward(event?: Event, row?: AsyncTableElement<T>): Promise<boolean>;
|
|
205
|
+
/**
|
|
206
|
+
* Confirm the creation of the given row, or if not specified the currently edited row
|
|
207
|
+
*
|
|
208
|
+
* @param event
|
|
209
|
+
* @param row
|
|
210
|
+
*/
|
|
211
|
+
confirmEditCreate(event?: Event, row?: AsyncTableElement<T>): Promise<boolean>;
|
|
212
|
+
cancelOrDelete(event: Event, row: AsyncTableElement<T>, opts?: {
|
|
213
|
+
interactive?: boolean;
|
|
214
|
+
keepEditing?: boolean;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
addRow(event?: Event, insertAt?: number, opts?: {
|
|
217
|
+
focusColumn?: string;
|
|
218
|
+
editing?: boolean;
|
|
219
|
+
}): Promise<boolean>;
|
|
220
|
+
save(opts?: {
|
|
221
|
+
keepEditing?: boolean;
|
|
222
|
+
}): Promise<boolean>;
|
|
223
|
+
cancel(event?: Event, opts?: {
|
|
224
|
+
interactive?: boolean;
|
|
225
|
+
}): Promise<void>;
|
|
226
|
+
duplicateRow(event?: Event, row?: AsyncTableElement<T>, opts?: {
|
|
227
|
+
skipProperties?: string[];
|
|
228
|
+
}): Promise<boolean>;
|
|
229
|
+
/** Whether the number of selected elements matches the total number of rows. */
|
|
230
|
+
isAllSelected(): boolean;
|
|
231
|
+
/** Selects all rows if they are not all selected; otherwise clear selection. */
|
|
232
|
+
masterToggle(): Promise<void>;
|
|
233
|
+
deleteSelection(event: Event, opts?: {
|
|
234
|
+
interactive?: boolean;
|
|
235
|
+
}): Promise<number>;
|
|
236
|
+
/**
|
|
237
|
+
*
|
|
238
|
+
* @param event
|
|
239
|
+
* @param row
|
|
240
|
+
* @param opts Use interactive=false to avoid user interaction (e.g. user confirmation)
|
|
241
|
+
* And to force deletion even if table is busy
|
|
242
|
+
*/
|
|
243
|
+
deleteRow(event: Event | null, row: AsyncTableElement<T>, opts?: {
|
|
244
|
+
interactive?: boolean;
|
|
245
|
+
}): Promise<boolean>;
|
|
246
|
+
/**
|
|
247
|
+
*
|
|
248
|
+
* @param event
|
|
249
|
+
* @param rows
|
|
250
|
+
* @param opts Use interactive=false to avoid user interaction (e.g. user confirmation)
|
|
251
|
+
* And to force deletion even if table is busy
|
|
252
|
+
*/
|
|
253
|
+
deleteRows(event: Event | null, rows: AsyncTableElement<T>[], opts?: {
|
|
254
|
+
interactive?: boolean;
|
|
255
|
+
}): Promise<number>;
|
|
256
|
+
selectRowById(id: number): Promise<boolean>;
|
|
257
|
+
/**
|
|
258
|
+
* Try to select row by data. Will use dataEquals() (that call EntityUtils.equals()) to find same row's data
|
|
259
|
+
* @param data
|
|
260
|
+
*/
|
|
261
|
+
selectRowByData(data: T): Promise<boolean>;
|
|
262
|
+
clickRow(event: Event | undefined, row: AsyncTableElement<T>): Promise<boolean>;
|
|
263
|
+
moveRow(id: number, direction: number): Promise<void>;
|
|
264
|
+
ready(opts?: WaitForOptions): Promise<void>;
|
|
265
|
+
waitIdle(opts?: WaitForOptions): Promise<void>;
|
|
266
|
+
openSelectColumnsModal(event?: Event): Promise<any>;
|
|
267
|
+
trackByFn(index: number, row: AsyncTableElement<T>): number;
|
|
268
|
+
doRefresh(event?: CompletableEvent): void;
|
|
269
|
+
getCurrentColumns(): ColumnItem[];
|
|
270
|
+
escapeEditingRow(event?: Event, row?: AsyncTableElement<T>): Promise<void>;
|
|
271
|
+
translateControlPath(path: string): string;
|
|
272
|
+
protected editRow(event: Event | undefined, row: AsyncTableElement<T>, opts?: {
|
|
273
|
+
focusColumn?: string;
|
|
274
|
+
}): Promise<boolean>;
|
|
275
|
+
/**
|
|
276
|
+
* Try to select row, by row.id, or by data. WIll use EntityUtils.equals()
|
|
277
|
+
* @param id
|
|
278
|
+
* @param data
|
|
279
|
+
* @protected
|
|
280
|
+
*/
|
|
281
|
+
protected selectRowByIdOrData(id: number, data?: T): Promise<boolean>;
|
|
282
|
+
/**
|
|
283
|
+
* return the selected row if unique in selection
|
|
284
|
+
*/
|
|
285
|
+
protected get singleSelectedRow(): AsyncTableElement<T>;
|
|
286
|
+
protected canDeleteRows(rows: AsyncTableElement<T>[], opts?: {
|
|
287
|
+
interactive?: boolean;
|
|
288
|
+
}): Promise<boolean>;
|
|
289
|
+
protected canCancelRows(rows?: AsyncTableElement<T>[], opts?: {
|
|
290
|
+
interactive?: boolean;
|
|
291
|
+
}): Promise<boolean>;
|
|
292
|
+
protected saveBeforeAction(saveAction: SaveActionType): Promise<boolean>;
|
|
293
|
+
/**
|
|
294
|
+
* Open a row detail view. By default, will to open row detail page.
|
|
295
|
+
* Can be overridden by subclasses, BUT prefer to subscribe on onOpenRow
|
|
296
|
+
* @param id
|
|
297
|
+
* @param row
|
|
298
|
+
* @protected
|
|
299
|
+
*/
|
|
300
|
+
protected openRow(id: ID, row: AsyncTableElement<T>): Promise<boolean>;
|
|
301
|
+
protected openNewRowDetail(event?: any): Promise<boolean>;
|
|
302
|
+
protected getRequiredColumns(): string[];
|
|
303
|
+
protected getUserColumns(): string[];
|
|
304
|
+
protected getSortedColumn(): MatSortable;
|
|
305
|
+
protected getPageSize(): number;
|
|
306
|
+
protected getDisplayColumns(): string[];
|
|
307
|
+
/**
|
|
308
|
+
* Recompute display columns
|
|
309
|
+
*
|
|
310
|
+
* @protected
|
|
311
|
+
*/
|
|
312
|
+
protected updateColumns(): void;
|
|
313
|
+
protected registerSubscription(sub: Subscription): void;
|
|
314
|
+
protected unregisterSubscription(sub: Subscription): void;
|
|
315
|
+
protected registerAutocompleteField<E = any, EF = any>(fieldName: string, options?: MatAutocompleteFieldAddOptions<E, EF>): MatAutocompleteFieldConfig<E, EF>;
|
|
316
|
+
protected getI18nColumnName(columnName: string): string;
|
|
317
|
+
protected generateTableId(): string;
|
|
318
|
+
protected addRowToTable(insertAt?: number, opts?: {
|
|
319
|
+
focusColumn?: string;
|
|
320
|
+
editing?: boolean;
|
|
321
|
+
emitEvent?: boolean;
|
|
322
|
+
}): Promise<AsyncTableElement<T> | undefined>;
|
|
323
|
+
protected registerCellValueChanges(name: string, formPath?: string, emitInitialValue?: boolean): Observable<any>;
|
|
324
|
+
protected setShowColumn(columnName: string, show: boolean, opts?: {
|
|
325
|
+
emitEvent?: boolean;
|
|
326
|
+
}): void;
|
|
327
|
+
protected getShowColumn(columnName: string): boolean;
|
|
328
|
+
protected startsWithUpperCase(input: string, search: string): boolean;
|
|
329
|
+
protected markForCheck(): void;
|
|
330
|
+
protected askDeleteConfirmation(event?: Event, rows?: AsyncTableElement<T>[]): Promise<boolean>;
|
|
331
|
+
protected askCancelConfirmation(event?: Event, rows?: AsyncTableElement<T>[]): Promise<boolean>;
|
|
332
|
+
protected askRestoreConfirmation(event?: Event): Promise<boolean>;
|
|
333
|
+
protected showToast(opts: ShowToastOptions): Promise<import("@ionic/core").OverlayEventDetail<any>>;
|
|
334
|
+
protected resetError(opts?: {
|
|
335
|
+
emitEvent?: boolean;
|
|
336
|
+
}): void;
|
|
337
|
+
protected getRowError(row?: AsyncTableElement<T>, opts?: FormErrorTranslatorOptions): string;
|
|
338
|
+
protected setError(value: string, opts?: {
|
|
339
|
+
emitEvent?: boolean;
|
|
340
|
+
}): void;
|
|
341
|
+
/**
|
|
342
|
+
* Compare data equality (default by id)
|
|
343
|
+
* Can be overridden to add additional properties to compare
|
|
344
|
+
*
|
|
345
|
+
* @param d1
|
|
346
|
+
* @param d2
|
|
347
|
+
* @protected
|
|
348
|
+
*/
|
|
349
|
+
protected equals(d1: T, d2: T): boolean;
|
|
350
|
+
protected markRowAsDirty(row?: AsyncTableElement<T>, opts?: {
|
|
351
|
+
onlySelf?: boolean;
|
|
352
|
+
emitEVent?: boolean;
|
|
353
|
+
}): void;
|
|
354
|
+
private listenSortAndPaginationEvents;
|
|
355
|
+
private editRowById;
|
|
356
|
+
private setLoading;
|
|
357
|
+
private deleteNewRow;
|
|
358
|
+
private deleteExistingRow;
|
|
359
|
+
private cancelExistingRow;
|
|
360
|
+
private checkIfRowPristine;
|
|
361
|
+
private checkIfPristine;
|
|
362
|
+
private applyFilter;
|
|
363
|
+
private listenDatasourceLoading;
|
|
364
|
+
private startCellValueChanges;
|
|
365
|
+
private stopCellValueChanges;
|
|
366
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppAsyncTable<any, any, any>, never>;
|
|
367
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AppAsyncTable<any, any, any>, never, never, { "settingsId": "settingsId"; "debug": "debug"; "i18nColumnPrefix": "i18nColumnPrefix"; "i18nColumnSuffix": "i18nColumnSuffix"; "autoLoad": "autoLoad"; "readOnly": "readOnly"; "inlineEdition": "inlineEdition"; "focusFirstColumn": "focusFirstColumn"; "confirmBeforeDelete": "confirmBeforeDelete"; "confirmBeforeCancel": "confirmBeforeCancel"; "undoableDeletion": "undoableDeletion"; "saveBeforeDelete": "saveBeforeDelete"; "keepEditedRowOnSave": "keepEditedRowOnSave"; "saveBeforeSort": "saveBeforeSort"; "saveBeforeFilter": "saveBeforeFilter"; "propagateRowError": "propagateRowError"; "defaultSortBy": "defaultSortBy"; "defaultSortDirection": "defaultSortDirection"; "defaultPageSize": "defaultPageSize"; "defaultPageSizeOptions": "defaultPageSizeOptions"; "focusColumn": "focusColumn"; "dataSource": "dataSource"; "filter": "filter"; "disabled": "disabled"; "paginator": "paginator"; }, { "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>;
|
|
368
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AsyncTableDataSource, AsyncTableElement, TableDataSourceConfig, ValidatorService } from '@e-is/ngx-material-table';
|
|
2
|
+
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
3
|
+
import { Entity, IEntity } from '../services/model/entity.model';
|
|
4
|
+
import { OnDestroy } from '@angular/core';
|
|
5
|
+
import { SortDirection } from '@angular/material/sort';
|
|
6
|
+
import { CollectionViewer } from '@angular/cdk/collections';
|
|
7
|
+
import { EntitiesServiceWatchOptions, FetchMoreFn, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export interface EntitiesAsyncTableDataSourceConfig<T extends Entity<T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, SO = any> extends TableDataSourceConfig {
|
|
10
|
+
onRowCreated?: (row: AsyncTableElement<T>) => Promise<void> | void;
|
|
11
|
+
saveOnlyDirtyRows?: boolean;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
16
|
+
dataServiceOptions?: WO & SO;
|
|
17
|
+
watchAllOptions?: WO;
|
|
18
|
+
saveAllOptions?: SO;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export declare class EntitiesAsyncTableDataSource<T extends IEntity<T, ID>, F = any, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, SO = any, V extends ValidatorService = ValidatorService, C extends EntitiesAsyncTableDataSourceConfig<T, ID, WO, SO> = EntitiesAsyncTableDataSourceConfig<T, ID, WO, SO>, R extends AsyncTableElement<T> = AsyncTableElement<T>> extends AsyncTableDataSource<T, V, C, R> implements OnDestroy {
|
|
22
|
+
readonly dataService: IEntitiesService<T, F, WO>;
|
|
23
|
+
private readonly _entityName;
|
|
24
|
+
protected _debug: boolean;
|
|
25
|
+
protected _creating: boolean;
|
|
26
|
+
protected _saving: boolean;
|
|
27
|
+
protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
|
|
28
|
+
protected _stopWatchSubject: Subject<void>;
|
|
29
|
+
loadingSubject: BehaviorSubject<boolean>;
|
|
30
|
+
get watchAllOptions(): WO;
|
|
31
|
+
set watchAllOptions(value: WO);
|
|
32
|
+
get saveAllOptions(): SO;
|
|
33
|
+
set saveAllOptions(value: SO);
|
|
34
|
+
get loaded(): boolean;
|
|
35
|
+
get loading(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new TableDataSource instance, that can be used as datasource of `@angular/cdk` data-table.
|
|
38
|
+
*
|
|
39
|
+
* @param dataService A service to load and save data
|
|
40
|
+
* @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
|
|
41
|
+
* @param environment
|
|
42
|
+
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
43
|
+
* @param config Additional configuration for table.
|
|
44
|
+
*/
|
|
45
|
+
constructor(dataType: new () => T, dataService: IEntitiesService<T, F, WO>, validatorService?: V, options?: C);
|
|
46
|
+
ngOnDestroy(): void;
|
|
47
|
+
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>): Observable<LoadResult<T>>;
|
|
48
|
+
protected updateDatasourceFromRows(rows: R[]): void;
|
|
49
|
+
save(): Promise<boolean>;
|
|
50
|
+
updateDatasource(data: T[], opts?: {
|
|
51
|
+
emitEvent: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
connect(collectionViewer: CollectionViewer): Observable<R[] | ReadonlyArray<R>>;
|
|
54
|
+
disconnect(collectionViewer?: CollectionViewer): void;
|
|
55
|
+
waitIdle(debounceTimeMs?: number): Promise<any>;
|
|
56
|
+
confirmCreate(row: R): Promise<boolean>;
|
|
57
|
+
confirmEdit(row: R): Promise<boolean>;
|
|
58
|
+
startEdit(row: R): Promise<boolean>;
|
|
59
|
+
handleError(error: any, message: string): Observable<LoadResult<T>>;
|
|
60
|
+
handleServiceError(error: any): void;
|
|
61
|
+
delete(id: number): Promise<boolean>;
|
|
62
|
+
deleteAll(rows: R[]): Promise<any>;
|
|
63
|
+
getRow(id: number): R;
|
|
64
|
+
getRows(): R[];
|
|
65
|
+
getEditingRows(): R[];
|
|
66
|
+
getSingleEditingRow(): R;
|
|
67
|
+
hasSomeEditingRow(): boolean;
|
|
68
|
+
createNew(insertAt?: number, opts?: {
|
|
69
|
+
editing: boolean;
|
|
70
|
+
}): Promise<R | undefined>;
|
|
71
|
+
getData(): T[];
|
|
72
|
+
fetchMore(opts?: {
|
|
73
|
+
emitEvent: boolean;
|
|
74
|
+
}): Promise<boolean>;
|
|
75
|
+
markAsLoading(): void;
|
|
76
|
+
markAsLoaded(): void;
|
|
77
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntitiesAsyncTableDataSource<any, any, any, any, any, any, any, any>, never>;
|
|
78
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<EntitiesAsyncTableDataSource<any, any, any, any, any, any, any, any>, never, never, {}, {}, never, never, false>;
|
|
79
|
+
}
|
|
@@ -21,29 +21,8 @@ import { ShowToastOptions } from '../../shared/toast/toasts';
|
|
|
21
21
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
22
22
|
import { LoadResult } from '../../shared/services/entity-service.class';
|
|
23
23
|
import { FormErrorTranslator, FormErrorTranslatorOptions, IFormControlPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
24
|
+
import { SaveActionType } from './table.model';
|
|
24
25
|
import * as i0 from "@angular/core";
|
|
25
|
-
export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
|
|
26
|
-
export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
|
|
27
|
-
export declare const SETTINGS_FILTER = "filter";
|
|
28
|
-
export declare const SETTINGS_PAGE_SIZE = "pageSize";
|
|
29
|
-
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
30
|
-
export declare const DEFAULT_PAGE_SIZE_OPTIONS: number[];
|
|
31
|
-
export declare const RESERVED_START_COLUMNS: string[];
|
|
32
|
-
export declare const RESERVED_END_COLUMNS: string[];
|
|
33
|
-
export declare const DEFAULT_REQUIRED_COLUMNS: string[];
|
|
34
|
-
export declare class CellValueChangeListener {
|
|
35
|
-
subject: Subject<any>;
|
|
36
|
-
subscription: Subscription;
|
|
37
|
-
formPath: string;
|
|
38
|
-
emitInitialValue: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface IModalDetailOptions<T = any> {
|
|
41
|
-
isNew: boolean;
|
|
42
|
-
data: T;
|
|
43
|
-
disabled: boolean;
|
|
44
|
-
onDelete?: (event: Event, data: T) => Promise<boolean>;
|
|
45
|
-
}
|
|
46
|
-
export declare type SaveActionType = 'delete' | 'sort' | 'filter';
|
|
47
26
|
export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm, IFormControlPathTranslator {
|
|
48
27
|
protected columns: string[];
|
|
49
28
|
protected _dataSource?: EntitiesTableDataSource<T, F, ID>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Subject, Subscription } from 'rxjs';
|
|
2
|
+
export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
|
|
3
|
+
export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
|
|
4
|
+
export declare const SETTINGS_FILTER = "filter";
|
|
5
|
+
export declare const SETTINGS_PAGE_SIZE = "pageSize";
|
|
6
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
7
|
+
export declare const DEFAULT_PAGE_SIZE_OPTIONS: number[];
|
|
8
|
+
export declare const RESERVED_START_COLUMNS: string[];
|
|
9
|
+
export declare const RESERVED_END_COLUMNS: string[];
|
|
10
|
+
export declare const DEFAULT_REQUIRED_COLUMNS: string[];
|
|
11
|
+
export declare class CellValueChangeListener {
|
|
12
|
+
subject: Subject<any>;
|
|
13
|
+
subscription: Subscription;
|
|
14
|
+
formPath: string;
|
|
15
|
+
emitInitialValue: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface IModalDetailOptions<T = any> {
|
|
18
|
+
isNew: boolean;
|
|
19
|
+
data: T;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
onDelete?: (event: Event, data: T) => Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export declare type SaveActionType = 'delete' | 'sort' | 'filter';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { IProgressBarService } from '../services/progress-bar.service';
|
|
4
4
|
export declare class ProgressInterceptor implements HttpInterceptor {
|
|
5
5
|
private progressBarService;
|
|
6
|
-
constructor(progressBarService:
|
|
6
|
+
constructor(progressBarService: IProgressBarService);
|
|
7
7
|
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
|
|
8
8
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
1
|
+
import { EventEmitter, InjectionToken } from '@angular/core';
|
|
2
2
|
import { ProgressBarMode } from '@angular/material/progress-bar';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
export declare const APP_PROGRESS_BAR_SERVICE: InjectionToken<IProgressBarService>;
|
|
4
5
|
export declare type ProgressMode = ProgressBarMode;
|
|
5
|
-
export
|
|
6
|
+
export interface IProgressBarService {
|
|
7
|
+
onProgressChanged: EventEmitter<ProgressBarMode>;
|
|
8
|
+
list(): number;
|
|
9
|
+
increase(): any;
|
|
10
|
+
decrease(): any;
|
|
11
|
+
}
|
|
12
|
+
export declare class ProgressBarService implements IProgressBarService {
|
|
6
13
|
private _requestsRunning;
|
|
7
14
|
onProgressChanged: EventEmitter<ProgressBarMode>;
|
|
8
15
|
list(): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { IProgressBarService } from '../services/progress-bar.service';
|
|
3
3
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
4
4
|
import { IonMenuToggle, IonRouterOutlet, IonSearchbar } from '@ionic/angular';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
@@ -44,7 +44,7 @@ export declare class ToolbarComponent implements ToolbarToken, OnInit, OnDestroy
|
|
|
44
44
|
showSearchBar: boolean;
|
|
45
45
|
searchbar: IonSearchbar;
|
|
46
46
|
menuToggle: IonMenuToggle;
|
|
47
|
-
constructor(route: ActivatedRoute, router: Router, routerOutlet: IonRouterOutlet, cd: ChangeDetectorRef, progressBarService:
|
|
47
|
+
constructor(route: ActivatedRoute, router: Router, routerOutlet: IonRouterOutlet, cd: ChangeDetectorRef, progressBarService: IProgressBarService);
|
|
48
48
|
ngOnInit(): void;
|
|
49
49
|
ngOnDestroy(): void;
|
|
50
50
|
toggleSearchBar(): Promise<void>;
|