shark-ng-table 7.0.0 → 8.0.0
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/README.md +66 -52
- package/fesm2022/shark-ng-table.mjs +2191 -1833
- package/fesm2022/shark-ng-table.mjs.map +1 -1
- package/package.json +43 -31
- package/shark-ng-table.css +19 -1
- package/shark-ng-table.min.css +2 -4
- package/types/shark-ng-table.d.ts +913 -0
- package/app/table/child.component.d.ts +0 -34
- package/app/table/column-change-event.d.ts +0 -5
- package/app/table/column.d.ts +0 -64
- package/app/table/current.data.event.d.ts +0 -5
- package/app/table/dynamic/dynamic.contents.d.ts +0 -20
- package/app/table/dynamic/dynamic.contents.directive.d.ts +0 -8
- package/app/table/header-button.component.d.ts +0 -16
- package/app/table/index.d.ts +0 -15
- package/app/table/localfilter.pipe.d.ts +0 -11
- package/app/table/notifier/aria-notifier.component.d.ts +0 -14
- package/app/table/notifier/notifier.service.d.ts +0 -7
- package/app/table/page.change.event.d.ts +0 -27
- package/app/table/page.d.ts +0 -20
- package/app/table/sort.type.d.ts +0 -30
- package/app/table/table.body.component.d.ts +0 -67
- package/app/table/table.cell.component.d.ts +0 -20
- package/app/table/table.component.d.ts +0 -202
- package/app/table/table.footer.component.d.ts +0 -49
- package/app/table/table.header.component.d.ts +0 -39
- package/app/table/table.info.header.component.d.ts +0 -28
- package/app/table/table.module.d.ts +0 -21
- package/app/table/table.pagination.component.d.ts +0 -21
- package/app/table/table.utils.d.ts +0 -13
- package/esm2022/app/table/child.component.mjs +0 -76
- package/esm2022/app/table/column-change-event.mjs +0 -5
- package/esm2022/app/table/column.mjs +0 -2
- package/esm2022/app/table/current.data.event.mjs +0 -5
- package/esm2022/app/table/dynamic/dynamic.contents.directive.mjs +0 -17
- package/esm2022/app/table/dynamic/dynamic.contents.mjs +0 -2
- package/esm2022/app/table/header-button.component.mjs +0 -52
- package/esm2022/app/table/index.mjs +0 -11
- package/esm2022/app/table/localfilter.pipe.mjs +0 -24
- package/esm2022/app/table/notifier/aria-notifier.component.mjs +0 -44
- package/esm2022/app/table/notifier/notifier.service.mjs +0 -13
- package/esm2022/app/table/page.change.event.mjs +0 -2
- package/esm2022/app/table/page.mjs +0 -2
- package/esm2022/app/table/sort.type.mjs +0 -32
- package/esm2022/app/table/table.body.component.mjs +0 -181
- package/esm2022/app/table/table.cell.component.mjs +0 -75
- package/esm2022/app/table/table.component.mjs +0 -773
- package/esm2022/app/table/table.footer.component.mjs +0 -176
- package/esm2022/app/table/table.header.component.mjs +0 -204
- package/esm2022/app/table/table.info.header.component.mjs +0 -142
- package/esm2022/app/table/table.module.mjs +0 -73
- package/esm2022/app/table/table.pagination.component.mjs +0 -134
- package/esm2022/app/table/table.utils.mjs +0 -72
- package/esm2022/public_api.mjs +0 -2
- package/esm2022/shark-ng-table.mjs +0 -5
- package/index.d.ts +0 -5
- package/public_api.d.ts +0 -1
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ComponentRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, PipeTransform, SimpleChanges, TemplateRef, Type, ViewContainerRef } from "@angular/core";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
/**
|
|
5
|
+
* Implement this interface in order to provide a custom component to render your
|
|
6
|
+
* child row or table cell.
|
|
7
|
+
*/
|
|
8
|
+
interface SharkDynamicContents {
|
|
9
|
+
/**
|
|
10
|
+
* Data for this instance of SharkDynamicContents, for a Child row, it will be all of the row's
|
|
11
|
+
* data, for a table cell, it will just be the data for that cell.
|
|
12
|
+
*/
|
|
13
|
+
data: any;
|
|
14
|
+
/**
|
|
15
|
+
* The row that was used to render this instance of SharkDynamicContents. For a Child row, this field won't
|
|
16
|
+
* be set as it's redundant with this.data. (Optional)
|
|
17
|
+
*/
|
|
18
|
+
row?: any;
|
|
19
|
+
/**
|
|
20
|
+
* This is called when a child row is opened, if you need to retrieve more data, etc.
|
|
21
|
+
*/
|
|
22
|
+
childOpen(value: boolean): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This Component is used to render your custom child row component.
|
|
26
|
+
*/
|
|
27
|
+
export declare class SharkChildComponent implements OnChanges, OnDestroy {
|
|
28
|
+
/**
|
|
29
|
+
* Your custom component which implements {@link SharkDynamicContents} that will be used
|
|
30
|
+
* to render each child row.
|
|
31
|
+
*/
|
|
32
|
+
component: Type<SharkDynamicContents> | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The entire row, you can display anything from this row in your child component.
|
|
35
|
+
*/
|
|
36
|
+
row: any;
|
|
37
|
+
rowIndex: number;
|
|
38
|
+
openChildren: number[];
|
|
39
|
+
dynamicHost: ViewContainerRef;
|
|
40
|
+
childOpen: boolean;
|
|
41
|
+
componentRef: ComponentRef<SharkDynamicContents> | undefined;
|
|
42
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
43
|
+
ngOnDestroy(): void;
|
|
44
|
+
private loadComponent;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkChildComponent, never>;
|
|
46
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkChildComponent, "shark-child", never, {
|
|
47
|
+
"component": {
|
|
48
|
+
"alias": "component";
|
|
49
|
+
"required": false;
|
|
50
|
+
};
|
|
51
|
+
"row": {
|
|
52
|
+
"alias": "row";
|
|
53
|
+
"required": false;
|
|
54
|
+
};
|
|
55
|
+
"rowIndex": {
|
|
56
|
+
"alias": "rowIndex";
|
|
57
|
+
"required": false;
|
|
58
|
+
};
|
|
59
|
+
"openChildren": {
|
|
60
|
+
"alias": "openChildren";
|
|
61
|
+
"required": false;
|
|
62
|
+
};
|
|
63
|
+
}, {}, never, never, true, never>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Enumeration of the 3 different Sort types
|
|
67
|
+
*/
|
|
68
|
+
export declare enum SharkSortType {
|
|
69
|
+
/**
|
|
70
|
+
* No sorting applied, defaults to ASC.
|
|
71
|
+
*/
|
|
72
|
+
NONE = 0,
|
|
73
|
+
/**
|
|
74
|
+
* Sort ascending (1, 2, 3)
|
|
75
|
+
*/
|
|
76
|
+
ASC = 1,
|
|
77
|
+
/**
|
|
78
|
+
* Sort descending (3, 2, 1)
|
|
79
|
+
*/
|
|
80
|
+
DESC = 2
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Placeholder for a column sort
|
|
84
|
+
*/
|
|
85
|
+
export declare class SharkCurrentSort {
|
|
86
|
+
/**
|
|
87
|
+
* Column property
|
|
88
|
+
*/
|
|
89
|
+
property: string;
|
|
90
|
+
/**
|
|
91
|
+
* Sort type
|
|
92
|
+
*/
|
|
93
|
+
sortType: SharkSortType;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A column definition for shark-ng-table
|
|
97
|
+
*/
|
|
98
|
+
interface SharkColumn {
|
|
99
|
+
/**
|
|
100
|
+
* Display name
|
|
101
|
+
*/
|
|
102
|
+
header: string;
|
|
103
|
+
/**
|
|
104
|
+
* Property for this column from the data Object
|
|
105
|
+
*/
|
|
106
|
+
property: string;
|
|
107
|
+
/**
|
|
108
|
+
* {@link PipeTransform} to use for rendering the column.
|
|
109
|
+
*/
|
|
110
|
+
pipe?: Type<PipeTransform>;
|
|
111
|
+
/**
|
|
112
|
+
* Any arguments for the pipe
|
|
113
|
+
*/
|
|
114
|
+
pipeConstructorArgs?: any[];
|
|
115
|
+
/**
|
|
116
|
+
* Arguments to pass to the pipe
|
|
117
|
+
*/
|
|
118
|
+
pipeArgs?: any[];
|
|
119
|
+
/**
|
|
120
|
+
* A Component to use for rendering the column.
|
|
121
|
+
*/
|
|
122
|
+
component?: Type<SharkDynamicContents>;
|
|
123
|
+
/**
|
|
124
|
+
* The current sort type for this column
|
|
125
|
+
*/
|
|
126
|
+
sortType?: SharkSortType | number;
|
|
127
|
+
/**
|
|
128
|
+
* Provide a custom column sorting function.
|
|
129
|
+
*/
|
|
130
|
+
ascendingSortFunction?: (left: any, right: any) => number;
|
|
131
|
+
/**
|
|
132
|
+
* If the column should be aligned to the right in the cell.
|
|
133
|
+
*/
|
|
134
|
+
alignRight?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* The current filter string for this column
|
|
137
|
+
*/
|
|
138
|
+
filter?: string;
|
|
139
|
+
/**
|
|
140
|
+
* If this column should not be sortable
|
|
141
|
+
*/
|
|
142
|
+
unsortable?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Disable filtering for this column
|
|
145
|
+
*/
|
|
146
|
+
hideHeaderFilter?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Disable column re-ordering for this column
|
|
149
|
+
*/
|
|
150
|
+
disableOrdering?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* If this column is currently shown, Default `true`
|
|
153
|
+
*/
|
|
154
|
+
displayed?: boolean;
|
|
155
|
+
}
|
|
156
|
+
export declare class SharkColumnChangeEvent {
|
|
157
|
+
columns: SharkColumn[];
|
|
158
|
+
currentSortString: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* This event is emitted when the current Page changes or if the current sorts/filters change
|
|
162
|
+
*/
|
|
163
|
+
interface SharkPageChangeEvent {
|
|
164
|
+
/**
|
|
165
|
+
* The new page number
|
|
166
|
+
*/
|
|
167
|
+
pageNo: number;
|
|
168
|
+
/**
|
|
169
|
+
* The current column array (with sorting/filtering information
|
|
170
|
+
*/
|
|
171
|
+
columns: SharkColumn[];
|
|
172
|
+
/**
|
|
173
|
+
* The current global filter text
|
|
174
|
+
*/
|
|
175
|
+
filter?: string;
|
|
176
|
+
/**
|
|
177
|
+
* The current sorting array
|
|
178
|
+
*/
|
|
179
|
+
sorts?: SharkCurrentSort[];
|
|
180
|
+
/**
|
|
181
|
+
* The current sort string, formatted as comma separated, with the `-` sign signifying descending
|
|
182
|
+
*/
|
|
183
|
+
sortString?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* TypeScript implementation of the Spring Data Page object
|
|
187
|
+
*/
|
|
188
|
+
interface Page {
|
|
189
|
+
content?: any[];
|
|
190
|
+
first?: boolean;
|
|
191
|
+
last?: boolean;
|
|
192
|
+
number?: number;
|
|
193
|
+
numberOfElements?: number;
|
|
194
|
+
size?: number;
|
|
195
|
+
totalElements?: number;
|
|
196
|
+
totalPages?: number;
|
|
197
|
+
sorts?: Sort[];
|
|
198
|
+
}
|
|
199
|
+
interface Sort {
|
|
200
|
+
direction: string;
|
|
201
|
+
property: string;
|
|
202
|
+
descending: boolean;
|
|
203
|
+
ascending: boolean;
|
|
204
|
+
}
|
|
205
|
+
interface SharkSortChangeEvent {
|
|
206
|
+
property: string;
|
|
207
|
+
sortType: SharkSortType;
|
|
208
|
+
}
|
|
209
|
+
declare class NotifierService {
|
|
210
|
+
messageObservable: Observable<string>;
|
|
211
|
+
private messageSubject;
|
|
212
|
+
constructor();
|
|
213
|
+
postMessage(message: string): void;
|
|
214
|
+
}
|
|
215
|
+
declare class SharkTableHeaderComponent {
|
|
216
|
+
private readonly document;
|
|
217
|
+
private readonly injector;
|
|
218
|
+
tableId: string;
|
|
219
|
+
sortable: boolean;
|
|
220
|
+
allColumns: SharkColumn[];
|
|
221
|
+
currentColumns: SharkColumn[];
|
|
222
|
+
columnOrdering: boolean;
|
|
223
|
+
childRows: boolean;
|
|
224
|
+
page: Page;
|
|
225
|
+
filterable: boolean;
|
|
226
|
+
columnFiltering: boolean;
|
|
227
|
+
filter: string;
|
|
228
|
+
showFilterPlaceholders: boolean;
|
|
229
|
+
notifierService: NotifierService;
|
|
230
|
+
localPagingSize: number;
|
|
231
|
+
sortChange: EventEmitter<SharkSortChangeEvent>;
|
|
232
|
+
filterChange: EventEmitter<SharkHeaderFilterChange>;
|
|
233
|
+
columnChange: EventEmitter<SharkColumn[]>;
|
|
234
|
+
ariaSort(column: SharkColumn): string | null;
|
|
235
|
+
orderButtonId(column: SharkColumn, dir: 'left' | 'right'): string;
|
|
236
|
+
dispatchSortChangeEvent(event: SharkSortChangeEvent): void;
|
|
237
|
+
fireFilterChange(): void;
|
|
238
|
+
moveColumnForward(index: number, column: SharkColumn): void;
|
|
239
|
+
moveColumnBackward(index: number, column: SharkColumn): void;
|
|
240
|
+
/**
|
|
241
|
+
* Keeps keyboard focus on the moved column's ordering button. If the column reached the end, the button
|
|
242
|
+
* the user pressed no longer exists, so focus moves to the opposite button.
|
|
243
|
+
*/
|
|
244
|
+
private restoreFocus;
|
|
245
|
+
private move;
|
|
246
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableHeaderComponent, never>;
|
|
247
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTableHeaderComponent, "[shark-table-header]", never, {
|
|
248
|
+
"tableId": {
|
|
249
|
+
"alias": "tableId";
|
|
250
|
+
"required": false;
|
|
251
|
+
};
|
|
252
|
+
"sortable": {
|
|
253
|
+
"alias": "sortable";
|
|
254
|
+
"required": false;
|
|
255
|
+
};
|
|
256
|
+
"allColumns": {
|
|
257
|
+
"alias": "allColumns";
|
|
258
|
+
"required": false;
|
|
259
|
+
};
|
|
260
|
+
"currentColumns": {
|
|
261
|
+
"alias": "currentColumns";
|
|
262
|
+
"required": false;
|
|
263
|
+
};
|
|
264
|
+
"columnOrdering": {
|
|
265
|
+
"alias": "columnOrdering";
|
|
266
|
+
"required": false;
|
|
267
|
+
};
|
|
268
|
+
"childRows": {
|
|
269
|
+
"alias": "childRows";
|
|
270
|
+
"required": false;
|
|
271
|
+
};
|
|
272
|
+
"page": {
|
|
273
|
+
"alias": "page";
|
|
274
|
+
"required": false;
|
|
275
|
+
};
|
|
276
|
+
"filterable": {
|
|
277
|
+
"alias": "filterable";
|
|
278
|
+
"required": false;
|
|
279
|
+
};
|
|
280
|
+
"columnFiltering": {
|
|
281
|
+
"alias": "columnFiltering";
|
|
282
|
+
"required": false;
|
|
283
|
+
};
|
|
284
|
+
"filter": {
|
|
285
|
+
"alias": "filter";
|
|
286
|
+
"required": false;
|
|
287
|
+
};
|
|
288
|
+
"showFilterPlaceholders": {
|
|
289
|
+
"alias": "showFilterPlaceholders";
|
|
290
|
+
"required": false;
|
|
291
|
+
};
|
|
292
|
+
"notifierService": {
|
|
293
|
+
"alias": "notifierService";
|
|
294
|
+
"required": false;
|
|
295
|
+
};
|
|
296
|
+
"localPagingSize": {
|
|
297
|
+
"alias": "localPagingSize";
|
|
298
|
+
"required": false;
|
|
299
|
+
};
|
|
300
|
+
}, {
|
|
301
|
+
"sortChange": "sortChange";
|
|
302
|
+
"filterChange": "filterChange";
|
|
303
|
+
"columnChange": "columnChange";
|
|
304
|
+
}, never, never, true, never>;
|
|
305
|
+
}
|
|
306
|
+
interface SharkHeaderFilterChange {
|
|
307
|
+
columns: SharkColumn[];
|
|
308
|
+
filter: string;
|
|
309
|
+
localPagingSize: number;
|
|
310
|
+
}
|
|
311
|
+
type RowStyleFunction =
|
|
312
|
+
/**
|
|
313
|
+
* Sends in the current row data and returns an object to be
|
|
314
|
+
* used in conjunction with NgStyle with the format like:
|
|
315
|
+
*
|
|
316
|
+
* { 'background-color': 'red' }
|
|
317
|
+
*/
|
|
318
|
+
(row: any) => {
|
|
319
|
+
[key: string]: string;
|
|
320
|
+
};
|
|
321
|
+
type CellStyleFunction =
|
|
322
|
+
/**
|
|
323
|
+
* Sends in the current row data and returns an object to be
|
|
324
|
+
* used in conjunction with NgStyle with the format like:
|
|
325
|
+
*
|
|
326
|
+
* { 'background-color': 'red' }
|
|
327
|
+
*/
|
|
328
|
+
(row: any, column: SharkColumn, cell: any) => {
|
|
329
|
+
[key: string]: string;
|
|
330
|
+
};
|
|
331
|
+
export declare class SharkTablePaginationComponent implements OnChanges {
|
|
332
|
+
private readonly elementRef;
|
|
333
|
+
private readonly injector;
|
|
334
|
+
pageCount: number[];
|
|
335
|
+
first: boolean;
|
|
336
|
+
last: boolean;
|
|
337
|
+
previous: boolean;
|
|
338
|
+
next: boolean;
|
|
339
|
+
displayedPages: number[];
|
|
340
|
+
currentPage: number;
|
|
341
|
+
page: Page;
|
|
342
|
+
tableId: string;
|
|
343
|
+
paginationChange: EventEmitter<number>;
|
|
344
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
345
|
+
changePage(pageNo: number): void;
|
|
346
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTablePaginationComponent, never>;
|
|
347
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTablePaginationComponent, "shark-table-pagination", never, {
|
|
348
|
+
"page": {
|
|
349
|
+
"alias": "page";
|
|
350
|
+
"required": false;
|
|
351
|
+
};
|
|
352
|
+
"tableId": {
|
|
353
|
+
"alias": "tableId";
|
|
354
|
+
"required": false;
|
|
355
|
+
};
|
|
356
|
+
}, {
|
|
357
|
+
"paginationChange": "paginationChange";
|
|
358
|
+
}, never, never, true, never>;
|
|
359
|
+
}
|
|
360
|
+
declare class SharkTableFooterComponent implements OnChanges {
|
|
361
|
+
private readonly tableUtils;
|
|
362
|
+
start: number;
|
|
363
|
+
end: number;
|
|
364
|
+
total: number;
|
|
365
|
+
filtered: boolean;
|
|
366
|
+
currentPageInfo: string;
|
|
367
|
+
paginationComponent: SharkTablePaginationComponent;
|
|
368
|
+
leftSideFooterTemplate: TemplateRef<unknown>;
|
|
369
|
+
rightSideFooterTemplate: TemplateRef<unknown>;
|
|
370
|
+
notifierService: NotifierService;
|
|
371
|
+
localPaging: boolean;
|
|
372
|
+
localPagingSize: number;
|
|
373
|
+
localPagingOptions: number[];
|
|
374
|
+
showLocalPagingOptions: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* The current {@link Page}
|
|
377
|
+
*/
|
|
378
|
+
page: Page;
|
|
379
|
+
/**
|
|
380
|
+
* The current {@link SharkColumn}[]
|
|
381
|
+
*/
|
|
382
|
+
currentColumns: SharkColumn[];
|
|
383
|
+
/**
|
|
384
|
+
* The current {@link SharkColumn}[]
|
|
385
|
+
*/
|
|
386
|
+
allColumns: SharkColumn[];
|
|
387
|
+
/**
|
|
388
|
+
* The current filter string
|
|
389
|
+
*/
|
|
390
|
+
filter: string;
|
|
391
|
+
tableId: string;
|
|
392
|
+
filterChange: EventEmitter<SharkHeaderFilterChange>;
|
|
393
|
+
paginationChange: EventEmitter<number>;
|
|
394
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
395
|
+
firePageSizeChange(): void;
|
|
396
|
+
changePage(pageNo: number): void;
|
|
397
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableFooterComponent, never>;
|
|
398
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTableFooterComponent, "shark-table-footer", never, {
|
|
399
|
+
"leftSideFooterTemplate": {
|
|
400
|
+
"alias": "leftSideFooterTemplate";
|
|
401
|
+
"required": false;
|
|
402
|
+
};
|
|
403
|
+
"rightSideFooterTemplate": {
|
|
404
|
+
"alias": "rightSideFooterTemplate";
|
|
405
|
+
"required": false;
|
|
406
|
+
};
|
|
407
|
+
"notifierService": {
|
|
408
|
+
"alias": "notifierService";
|
|
409
|
+
"required": false;
|
|
410
|
+
};
|
|
411
|
+
"localPaging": {
|
|
412
|
+
"alias": "localPaging";
|
|
413
|
+
"required": false;
|
|
414
|
+
};
|
|
415
|
+
"localPagingSize": {
|
|
416
|
+
"alias": "localPagingSize";
|
|
417
|
+
"required": false;
|
|
418
|
+
};
|
|
419
|
+
"localPagingOptions": {
|
|
420
|
+
"alias": "localPagingOptions";
|
|
421
|
+
"required": false;
|
|
422
|
+
};
|
|
423
|
+
"showLocalPagingOptions": {
|
|
424
|
+
"alias": "showLocalPagingOptions";
|
|
425
|
+
"required": false;
|
|
426
|
+
};
|
|
427
|
+
"page": {
|
|
428
|
+
"alias": "page";
|
|
429
|
+
"required": false;
|
|
430
|
+
};
|
|
431
|
+
"currentColumns": {
|
|
432
|
+
"alias": "currentColumns";
|
|
433
|
+
"required": false;
|
|
434
|
+
};
|
|
435
|
+
"allColumns": {
|
|
436
|
+
"alias": "allColumns";
|
|
437
|
+
"required": false;
|
|
438
|
+
};
|
|
439
|
+
"filter": {
|
|
440
|
+
"alias": "filter";
|
|
441
|
+
"required": false;
|
|
442
|
+
};
|
|
443
|
+
"tableId": {
|
|
444
|
+
"alias": "tableId";
|
|
445
|
+
"required": false;
|
|
446
|
+
};
|
|
447
|
+
}, {
|
|
448
|
+
"filterChange": "filterChange";
|
|
449
|
+
"paginationChange": "paginationChange";
|
|
450
|
+
}, never, never, true, never>;
|
|
451
|
+
}
|
|
452
|
+
declare class SharkTableInfoHeaderComponent {
|
|
453
|
+
leftSideHeaderTemplate: TemplateRef<unknown>;
|
|
454
|
+
rightSideHeaderTemplate: TemplateRef<unknown>;
|
|
455
|
+
filterInput: ElementRef<HTMLInputElement>;
|
|
456
|
+
columns: SharkColumn[];
|
|
457
|
+
allColumns: SharkColumn[];
|
|
458
|
+
columnPicker: boolean;
|
|
459
|
+
serverSideData: boolean;
|
|
460
|
+
filterable: boolean;
|
|
461
|
+
columnFiltering: boolean;
|
|
462
|
+
filter: string;
|
|
463
|
+
showFilterPlaceholders: boolean;
|
|
464
|
+
localPagingSize: number;
|
|
465
|
+
notifierService: NotifierService;
|
|
466
|
+
tableId: string;
|
|
467
|
+
filterChange: EventEmitter<SharkHeaderFilterChange>;
|
|
468
|
+
columnChange: EventEmitter<SharkColumn[]>;
|
|
469
|
+
showDropDown: boolean;
|
|
470
|
+
fireFilterChange(): void;
|
|
471
|
+
fireColumnChange(): void;
|
|
472
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableInfoHeaderComponent, never>;
|
|
473
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTableInfoHeaderComponent, "shark-table-info-header", never, {
|
|
474
|
+
"leftSideHeaderTemplate": {
|
|
475
|
+
"alias": "leftSideHeaderTemplate";
|
|
476
|
+
"required": false;
|
|
477
|
+
};
|
|
478
|
+
"rightSideHeaderTemplate": {
|
|
479
|
+
"alias": "rightSideHeaderTemplate";
|
|
480
|
+
"required": false;
|
|
481
|
+
};
|
|
482
|
+
"columns": {
|
|
483
|
+
"alias": "columns";
|
|
484
|
+
"required": false;
|
|
485
|
+
};
|
|
486
|
+
"allColumns": {
|
|
487
|
+
"alias": "allColumns";
|
|
488
|
+
"required": false;
|
|
489
|
+
};
|
|
490
|
+
"columnPicker": {
|
|
491
|
+
"alias": "columnPicker";
|
|
492
|
+
"required": false;
|
|
493
|
+
};
|
|
494
|
+
"serverSideData": {
|
|
495
|
+
"alias": "serverSideData";
|
|
496
|
+
"required": false;
|
|
497
|
+
};
|
|
498
|
+
"filterable": {
|
|
499
|
+
"alias": "filterable";
|
|
500
|
+
"required": false;
|
|
501
|
+
};
|
|
502
|
+
"columnFiltering": {
|
|
503
|
+
"alias": "columnFiltering";
|
|
504
|
+
"required": false;
|
|
505
|
+
};
|
|
506
|
+
"filter": {
|
|
507
|
+
"alias": "filter";
|
|
508
|
+
"required": false;
|
|
509
|
+
};
|
|
510
|
+
"showFilterPlaceholders": {
|
|
511
|
+
"alias": "showFilterPlaceholders";
|
|
512
|
+
"required": false;
|
|
513
|
+
};
|
|
514
|
+
"localPagingSize": {
|
|
515
|
+
"alias": "localPagingSize";
|
|
516
|
+
"required": false;
|
|
517
|
+
};
|
|
518
|
+
"notifierService": {
|
|
519
|
+
"alias": "notifierService";
|
|
520
|
+
"required": false;
|
|
521
|
+
};
|
|
522
|
+
"tableId": {
|
|
523
|
+
"alias": "tableId";
|
|
524
|
+
"required": false;
|
|
525
|
+
};
|
|
526
|
+
}, {
|
|
527
|
+
"filterChange": "filterChange";
|
|
528
|
+
"columnChange": "columnChange";
|
|
529
|
+
}, never, never, true, never>;
|
|
530
|
+
}
|
|
531
|
+
export declare class SharkTableCurrentDataEvent {
|
|
532
|
+
data: any[];
|
|
533
|
+
columns: SharkColumn[];
|
|
534
|
+
}
|
|
535
|
+
export declare class SharkTableComponent implements OnInit, OnChanges, OnDestroy {
|
|
536
|
+
private readonly tableUtils;
|
|
537
|
+
private readonly cdr;
|
|
538
|
+
headerInfoComponent: SharkTableInfoHeaderComponent;
|
|
539
|
+
headerComponent: SharkTableHeaderComponent;
|
|
540
|
+
footerComponent: SharkTableFooterComponent;
|
|
541
|
+
headerLeftTemplate: TemplateRef<unknown>;
|
|
542
|
+
headerRightTemplate: TemplateRef<unknown>;
|
|
543
|
+
footerLeftTemplate: TemplateRef<unknown>;
|
|
544
|
+
footerRightTemplate: TemplateRef<unknown>;
|
|
545
|
+
notifierService: NotifierService;
|
|
546
|
+
/**
|
|
547
|
+
* An ID for this table, used to build unique element ids. Defaults to a value unique within the page.
|
|
548
|
+
*/
|
|
549
|
+
tableId: string;
|
|
550
|
+
/**
|
|
551
|
+
* The raw table data
|
|
552
|
+
*/
|
|
553
|
+
data: Page | Observable<Page | any[]> | any[];
|
|
554
|
+
/**
|
|
555
|
+
* The table column definitions
|
|
556
|
+
*/
|
|
557
|
+
columns: SharkColumn[];
|
|
558
|
+
currentColumns: SharkColumn[];
|
|
559
|
+
/**
|
|
560
|
+
* The <caption> text for this table
|
|
561
|
+
*/
|
|
562
|
+
caption: string;
|
|
563
|
+
/**
|
|
564
|
+
* Whether or not the table <caption> should be hidden (screen-reader) only.
|
|
565
|
+
*/
|
|
566
|
+
hideCaption: boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Allow users to turn columns on and off
|
|
569
|
+
*/
|
|
570
|
+
columnPicker: boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Allow users to reorder columns with header buttons
|
|
573
|
+
*/
|
|
574
|
+
columnOrdering: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* The destination page for the call to `router.navigate` when the row is clicked.
|
|
577
|
+
*/
|
|
578
|
+
linkTarget: string | undefined;
|
|
579
|
+
/**
|
|
580
|
+
* The property name from the data object to pass to `router.navigate` when the rows is clicked.
|
|
581
|
+
*/
|
|
582
|
+
linkKey: string | undefined;
|
|
583
|
+
/**
|
|
584
|
+
* Enables the sorting headers
|
|
585
|
+
*/
|
|
586
|
+
sortable: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Enables the global filter text box
|
|
589
|
+
*/
|
|
590
|
+
filterable: boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Enables column specific filter boxes
|
|
593
|
+
*/
|
|
594
|
+
columnFiltering: boolean;
|
|
595
|
+
/**
|
|
596
|
+
* Enables client-side filtering as opposed to just emitting a `SharkPageChangeEvent`
|
|
597
|
+
*/
|
|
598
|
+
localFilter: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Enables the placeholder text for the filter boxes
|
|
601
|
+
*/
|
|
602
|
+
showFilterPlaceholders: boolean;
|
|
603
|
+
/**
|
|
604
|
+
* Enables client-side pagination as opposed to just emitting a `SharkPageChangeEvent`
|
|
605
|
+
*/
|
|
606
|
+
localPaging: boolean;
|
|
607
|
+
/**
|
|
608
|
+
* The size of each page
|
|
609
|
+
*/
|
|
610
|
+
localPagingSize: number;
|
|
611
|
+
/**
|
|
612
|
+
* The supported page sizes
|
|
613
|
+
*/
|
|
614
|
+
localPagingOptions: number[];
|
|
615
|
+
/**
|
|
616
|
+
* Enables the drop down for changing the page size
|
|
617
|
+
*/
|
|
618
|
+
showLocalPagingOptions: boolean;
|
|
619
|
+
/**
|
|
620
|
+
* Shows a button that when clicked, emits a `SharkPageChangeEvent`
|
|
621
|
+
*/
|
|
622
|
+
serverSideData: boolean;
|
|
623
|
+
/**
|
|
624
|
+
* The initial sortString
|
|
625
|
+
*/
|
|
626
|
+
initialSort: string;
|
|
627
|
+
cellStylingFunction: CellStyleFunction;
|
|
628
|
+
/**
|
|
629
|
+
* Enables children rows
|
|
630
|
+
*/
|
|
631
|
+
childRows: boolean;
|
|
632
|
+
/**
|
|
633
|
+
* Your custom component which implements {@link SharkDynamicContents} that will be used
|
|
634
|
+
* to render each child row.
|
|
635
|
+
*
|
|
636
|
+
* The easiest way to specify this component in your HTML template is to create an instance variable
|
|
637
|
+
* and assign it, eg:
|
|
638
|
+
*
|
|
639
|
+
* ```typescript
|
|
640
|
+
* @Component({
|
|
641
|
+
* imports: [SharkTableComponent],
|
|
642
|
+
* template: `
|
|
643
|
+
* <shark-table
|
|
644
|
+
* [data]="testData"
|
|
645
|
+
* [columns]="tableColumns"
|
|
646
|
+
* [childRows]="true"
|
|
647
|
+
* [childComponent]="childComponent"
|
|
648
|
+
* >
|
|
649
|
+
* </shark-table>
|
|
650
|
+
* `
|
|
651
|
+
* })
|
|
652
|
+
* export class MyComponent {
|
|
653
|
+
* childComponent = MyChildComponent
|
|
654
|
+
* }
|
|
655
|
+
*
|
|
656
|
+
* ```
|
|
657
|
+
*/
|
|
658
|
+
childComponent?: Type<SharkDynamicContents>;
|
|
659
|
+
/**
|
|
660
|
+
* {@link SharkPageChangeEvent} events are emitted from here
|
|
661
|
+
*/
|
|
662
|
+
pageChange: EventEmitter<SharkPageChangeEvent>;
|
|
663
|
+
/**
|
|
664
|
+
* The column metadata is emitted from here whenever it changes
|
|
665
|
+
*/
|
|
666
|
+
columnChange: EventEmitter<SharkColumnChangeEvent>;
|
|
667
|
+
/**
|
|
668
|
+
* Disable the column change event, if needed, for performance reasons
|
|
669
|
+
*/
|
|
670
|
+
disableColumnChangeEvent: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* The current filter value
|
|
673
|
+
*/
|
|
674
|
+
filter: string;
|
|
675
|
+
/**
|
|
676
|
+
* Show the footer with 'Showing x through y of z rows`
|
|
677
|
+
*/
|
|
678
|
+
footer: boolean;
|
|
679
|
+
/**
|
|
680
|
+
* Message to show when the table is empty
|
|
681
|
+
*/
|
|
682
|
+
tableEmptyMessage: string;
|
|
683
|
+
rowStylingFunction: RowStyleFunction;
|
|
684
|
+
/**
|
|
685
|
+
* The page currently being displayed.
|
|
686
|
+
*/
|
|
687
|
+
page: Page;
|
|
688
|
+
/** Rows supplied as an array (directly or via an Observable); filtered, sorted and paged locally. */
|
|
689
|
+
private localRows;
|
|
690
|
+
/** A Page supplied directly or via an Observable; paging is done by the caller. */
|
|
691
|
+
private sourcePage;
|
|
692
|
+
private initialSortApplied;
|
|
693
|
+
private dataSubscription;
|
|
694
|
+
ngOnInit(): void;
|
|
695
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
696
|
+
ngOnDestroy(): void;
|
|
697
|
+
updateCurrentColumns(newColumns: SharkColumn[], emitPageEvent?: boolean): void;
|
|
698
|
+
/**
|
|
699
|
+
* Emits a {@link SharkPageChangeEvent} with the current information. This event should be consumed by the host
|
|
700
|
+
* component and sent to a REST endpoint to update the data.
|
|
701
|
+
*/
|
|
702
|
+
emitCurrent(): void;
|
|
703
|
+
headerChange(event: SharkHeaderFilterChange): void;
|
|
704
|
+
changePage(pageNo: number): void;
|
|
705
|
+
changeSort(columnProperty: string, sortType: SharkSortType | number | undefined): void;
|
|
706
|
+
/**
|
|
707
|
+
* Returns the current "view" of the table data: every row (across all pages) that matches the current filters,
|
|
708
|
+
* in the current sort order, containing only the displayed columns.
|
|
709
|
+
*
|
|
710
|
+
* When the data is a {@link Page} (server side paging), only the rows on the current page are available.
|
|
711
|
+
*
|
|
712
|
+
* @param rendered If you would like inline pipes to be applied to the exported data
|
|
713
|
+
*/
|
|
714
|
+
exportCurrentData(rendered?: boolean): SharkTableCurrentDataEvent;
|
|
715
|
+
private emitPageChange;
|
|
716
|
+
private publishColumnChangeEvent;
|
|
717
|
+
private generateSortString;
|
|
718
|
+
private generateSortArray;
|
|
719
|
+
private isFiltering;
|
|
720
|
+
/** Returns a new array; never mutates the input. */
|
|
721
|
+
private filterAndSort;
|
|
722
|
+
private sort;
|
|
723
|
+
private updatePage;
|
|
724
|
+
private applyData;
|
|
725
|
+
/**
|
|
726
|
+
* Applies `initialSort` (once) and any `sorts` reported by a {@link Page}.
|
|
727
|
+
* Returns true when column sort state was changed and listeners should be notified.
|
|
728
|
+
*/
|
|
729
|
+
private applyInitialSorts;
|
|
730
|
+
/**
|
|
731
|
+
* Rebuilds {@link page} from the current data, filters, sorts and paging settings.
|
|
732
|
+
*/
|
|
733
|
+
private recalculate;
|
|
734
|
+
private buildSinglePage;
|
|
735
|
+
private buildLocalPage;
|
|
736
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableComponent, never>;
|
|
737
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTableComponent, "shark-table", never, {
|
|
738
|
+
"tableId": {
|
|
739
|
+
"alias": "tableId";
|
|
740
|
+
"required": false;
|
|
741
|
+
};
|
|
742
|
+
"data": {
|
|
743
|
+
"alias": "data";
|
|
744
|
+
"required": false;
|
|
745
|
+
};
|
|
746
|
+
"columns": {
|
|
747
|
+
"alias": "columns";
|
|
748
|
+
"required": false;
|
|
749
|
+
};
|
|
750
|
+
"caption": {
|
|
751
|
+
"alias": "caption";
|
|
752
|
+
"required": false;
|
|
753
|
+
};
|
|
754
|
+
"hideCaption": {
|
|
755
|
+
"alias": "hideCaption";
|
|
756
|
+
"required": false;
|
|
757
|
+
};
|
|
758
|
+
"columnPicker": {
|
|
759
|
+
"alias": "columnPicker";
|
|
760
|
+
"required": false;
|
|
761
|
+
};
|
|
762
|
+
"columnOrdering": {
|
|
763
|
+
"alias": "columnOrdering";
|
|
764
|
+
"required": false;
|
|
765
|
+
};
|
|
766
|
+
"linkTarget": {
|
|
767
|
+
"alias": "linkTarget";
|
|
768
|
+
"required": false;
|
|
769
|
+
};
|
|
770
|
+
"linkKey": {
|
|
771
|
+
"alias": "linkKey";
|
|
772
|
+
"required": false;
|
|
773
|
+
};
|
|
774
|
+
"sortable": {
|
|
775
|
+
"alias": "sortable";
|
|
776
|
+
"required": false;
|
|
777
|
+
};
|
|
778
|
+
"filterable": {
|
|
779
|
+
"alias": "filterable";
|
|
780
|
+
"required": false;
|
|
781
|
+
};
|
|
782
|
+
"columnFiltering": {
|
|
783
|
+
"alias": "columnFiltering";
|
|
784
|
+
"required": false;
|
|
785
|
+
};
|
|
786
|
+
"localFilter": {
|
|
787
|
+
"alias": "localFilter";
|
|
788
|
+
"required": false;
|
|
789
|
+
};
|
|
790
|
+
"showFilterPlaceholders": {
|
|
791
|
+
"alias": "showFilterPlaceholders";
|
|
792
|
+
"required": false;
|
|
793
|
+
};
|
|
794
|
+
"localPaging": {
|
|
795
|
+
"alias": "localPaging";
|
|
796
|
+
"required": false;
|
|
797
|
+
};
|
|
798
|
+
"localPagingSize": {
|
|
799
|
+
"alias": "localPagingSize";
|
|
800
|
+
"required": false;
|
|
801
|
+
};
|
|
802
|
+
"localPagingOptions": {
|
|
803
|
+
"alias": "localPagingOptions";
|
|
804
|
+
"required": false;
|
|
805
|
+
};
|
|
806
|
+
"showLocalPagingOptions": {
|
|
807
|
+
"alias": "showLocalPagingOptions";
|
|
808
|
+
"required": false;
|
|
809
|
+
};
|
|
810
|
+
"serverSideData": {
|
|
811
|
+
"alias": "serverSideData";
|
|
812
|
+
"required": false;
|
|
813
|
+
};
|
|
814
|
+
"initialSort": {
|
|
815
|
+
"alias": "initialSort";
|
|
816
|
+
"required": false;
|
|
817
|
+
};
|
|
818
|
+
"cellStylingFunction": {
|
|
819
|
+
"alias": "cellStylingFunction";
|
|
820
|
+
"required": false;
|
|
821
|
+
};
|
|
822
|
+
"childRows": {
|
|
823
|
+
"alias": "childRows";
|
|
824
|
+
"required": false;
|
|
825
|
+
};
|
|
826
|
+
"childComponent": {
|
|
827
|
+
"alias": "childComponent";
|
|
828
|
+
"required": false;
|
|
829
|
+
};
|
|
830
|
+
"disableColumnChangeEvent": {
|
|
831
|
+
"alias": "disableColumnChangeEvent";
|
|
832
|
+
"required": false;
|
|
833
|
+
};
|
|
834
|
+
"filter": {
|
|
835
|
+
"alias": "filter";
|
|
836
|
+
"required": false;
|
|
837
|
+
};
|
|
838
|
+
"footer": {
|
|
839
|
+
"alias": "footer";
|
|
840
|
+
"required": false;
|
|
841
|
+
};
|
|
842
|
+
"tableEmptyMessage": {
|
|
843
|
+
"alias": "tableEmptyMessage";
|
|
844
|
+
"required": false;
|
|
845
|
+
};
|
|
846
|
+
"rowStylingFunction": {
|
|
847
|
+
"alias": "rowStylingFunction";
|
|
848
|
+
"required": false;
|
|
849
|
+
};
|
|
850
|
+
}, {
|
|
851
|
+
"pageChange": "pageChange";
|
|
852
|
+
"columnChange": "columnChange";
|
|
853
|
+
}, ["headerLeftTemplate", "headerRightTemplate", "footerLeftTemplate", "footerRightTemplate"], never, true, never>;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Kept for backwards compatibility with NgModule based applications.
|
|
857
|
+
*
|
|
858
|
+
* All shark-ng-table components are standalone, so new code can import {@link SharkTableComponent} directly.
|
|
859
|
+
*/
|
|
860
|
+
export declare class SharkTableModule {
|
|
861
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableModule, never>;
|
|
862
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SharkTableModule, never, [typeof SharkTableComponent, typeof SharkTablePaginationComponent], [typeof SharkTableComponent, typeof SharkTablePaginationComponent]>;
|
|
863
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<SharkTableModule>;
|
|
864
|
+
}
|
|
865
|
+
export declare class SharkTableCellComponent implements OnChanges, OnDestroy {
|
|
866
|
+
private readonly tableUtils;
|
|
867
|
+
column: SharkColumn;
|
|
868
|
+
row: any;
|
|
869
|
+
dynamicHost: ViewContainerRef;
|
|
870
|
+
contents: any;
|
|
871
|
+
private componentRef;
|
|
872
|
+
ngOnChanges(): void;
|
|
873
|
+
ngOnDestroy(): void;
|
|
874
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableCellComponent, never>;
|
|
875
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SharkTableCellComponent, "shark-table-cell", never, {
|
|
876
|
+
"column": {
|
|
877
|
+
"alias": "column";
|
|
878
|
+
"required": false;
|
|
879
|
+
};
|
|
880
|
+
"row": {
|
|
881
|
+
"alias": "row";
|
|
882
|
+
"required": false;
|
|
883
|
+
};
|
|
884
|
+
}, {}, never, never, true, never>;
|
|
885
|
+
}
|
|
886
|
+
export declare class SharkTableUtils {
|
|
887
|
+
exportRow(row: object, columns: SharkColumn[], rendered: boolean): Record<string, any>;
|
|
888
|
+
retrieveCell(row: object, column: SharkColumn, rendered?: boolean): any;
|
|
889
|
+
applyPipe(pipe: Type<PipeTransform>, cell: any, pipeArgs?: any[], pipeConstructorArgs?: any[]): any;
|
|
890
|
+
/**
|
|
891
|
+
* Returns the rows that match either the column specific filters (when `columnFiltering` is enabled and any column
|
|
892
|
+
* has a filter) or the global `filterText`. Rows are returned unfiltered when neither applies.
|
|
893
|
+
*/
|
|
894
|
+
filter(items: any[], cols: SharkColumn[], columnFiltering: boolean, filterText: string | undefined): any[];
|
|
895
|
+
/**
|
|
896
|
+
* Safely reads a (possibly nested, dot separated) property from an object.
|
|
897
|
+
*/
|
|
898
|
+
findValue(input: any, key: string): any;
|
|
899
|
+
hasFilter(cols: SharkColumn[] | undefined): boolean;
|
|
900
|
+
/**
|
|
901
|
+
* Default ascending comparator used for sorting.
|
|
902
|
+
*
|
|
903
|
+
* - `null`/`undefined` sort after every other value
|
|
904
|
+
* - numbers, numeric strings and Dates compare numerically
|
|
905
|
+
* - everything else compares as strings
|
|
906
|
+
*/
|
|
907
|
+
compare(a: any, b: any): number;
|
|
908
|
+
private toNumber;
|
|
909
|
+
private cellText;
|
|
910
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SharkTableUtils, never>;
|
|
911
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
912
|
+
}
|
|
913
|
+
export type { CellStyleFunction, Page, RowStyleFunction, SharkColumn, SharkDynamicContents, SharkPageChangeEvent, Sort };
|