@3kles/kles-material-table-v2 21.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.
|
@@ -0,0 +1,1213 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal, EventEmitter, Type, WritableSignal, OnInit, AfterViewInit, OnDestroy, ElementRef, InjectionToken } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { FormControlStatus, FormGroup, FormArray, ValidatorFn, AsyncValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
5
|
+
import { MatTableDataSource, MatTable } from '@angular/material/table';
|
|
6
|
+
import * as i4 from '@3kles/kles-material-dynamicforms';
|
|
7
|
+
import { IKlesFieldConfig, GroupUiState, ArrayUiState, AbstractUiState } from '@3kles/kles-material-dynamicforms';
|
|
8
|
+
import { SortHeaderArrowPosition, SortDirection, Sort, MatSort } from '@angular/material/sort';
|
|
9
|
+
import * as rxjs from 'rxjs';
|
|
10
|
+
import { Observable } from 'rxjs';
|
|
11
|
+
import { PageEvent, MatPaginatorIntl, MatPaginatorSelectConfig, MatPaginator } from '@angular/material/paginator';
|
|
12
|
+
import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
13
|
+
import { DataSource } from '@angular/cdk/table';
|
|
14
|
+
|
|
15
|
+
declare enum AlignCell {
|
|
16
|
+
LEFT = "left",
|
|
17
|
+
CENTER = "center",
|
|
18
|
+
RIGHT = "right"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare enum Span {
|
|
22
|
+
MAX = "max"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type B = Omit<IKlesFieldConfig, 'name'>;
|
|
26
|
+
type C = Omit<IKlesFieldConfig, 'name' | 'value'>;
|
|
27
|
+
type NgStyleInput = Record<string, any> | ((value?: any, status?: FormControlStatus, row?: Record<string, any>, rowStatus?: FormControlStatus) => Record<string, string | any>);
|
|
28
|
+
interface IStyle {
|
|
29
|
+
ngStyle?: NgStyleInput;
|
|
30
|
+
}
|
|
31
|
+
interface IKlesHeaderFieldConfig {
|
|
32
|
+
field?: B;
|
|
33
|
+
label?: string;
|
|
34
|
+
tooltip?: string;
|
|
35
|
+
filterClearable?: boolean;
|
|
36
|
+
filterPredicate?: (value: any, filter: any) => boolean;
|
|
37
|
+
sortPredicate?: (data: any) => string | number;
|
|
38
|
+
style?: IStyle;
|
|
39
|
+
}
|
|
40
|
+
interface IKlesCellFieldConfig {
|
|
41
|
+
executeAfterChange?: (property?: string, row?: any, group?: FormGroup<any> | FormArray<any>) => Observable<any>;
|
|
42
|
+
style?: IStyle;
|
|
43
|
+
field: C;
|
|
44
|
+
}
|
|
45
|
+
interface IKlesFooterFieldConfig {
|
|
46
|
+
style?: IStyle;
|
|
47
|
+
field: B;
|
|
48
|
+
}
|
|
49
|
+
interface KlesExtraCellFieldConfig extends IKlesCellFieldConfig {
|
|
50
|
+
columnDef: string;
|
|
51
|
+
colspan?: number | Span;
|
|
52
|
+
rowspan?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface KlesColumnConfig {
|
|
56
|
+
columnDef: string;
|
|
57
|
+
sticky?: boolean;
|
|
58
|
+
stickyEnd?: boolean;
|
|
59
|
+
visible?: boolean;
|
|
60
|
+
visibleWhen?: Signal<boolean>;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
ngClass?: any;
|
|
63
|
+
filterable?: boolean;
|
|
64
|
+
sortable?: boolean;
|
|
65
|
+
sortArrowPosition?: SortHeaderArrowPosition;
|
|
66
|
+
resizable?: boolean;
|
|
67
|
+
headerCell: IKlesHeaderFieldConfig;
|
|
68
|
+
cell: IKlesCellFieldConfig;
|
|
69
|
+
footerCell?: IKlesFooterFieldConfig;
|
|
70
|
+
align?: AlignCell;
|
|
71
|
+
width?: string;
|
|
72
|
+
minWidth?: string;
|
|
73
|
+
maxWidth?: string;
|
|
74
|
+
canExpand?: boolean;
|
|
75
|
+
canExpandNode?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ColumnApi {
|
|
79
|
+
setVisible(columnDef: string, visible: boolean): void;
|
|
80
|
+
toggleVisible(columnDef: string): void;
|
|
81
|
+
changeWidth(columnDef: string, options: {
|
|
82
|
+
width?: string;
|
|
83
|
+
maxWidth?: string;
|
|
84
|
+
minWidth?: string;
|
|
85
|
+
}): void;
|
|
86
|
+
setResizable(columnDef: string, resizable: boolean): any;
|
|
87
|
+
toggleResizable(columnDef: string): any;
|
|
88
|
+
setSticky(columnDef: string, options: {
|
|
89
|
+
sticky?: boolean;
|
|
90
|
+
stickyEnd?: boolean;
|
|
91
|
+
}): any;
|
|
92
|
+
columns(): KlesColumnConfig[];
|
|
93
|
+
setColumnPosition: (columnDef: any, position: number) => void;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface FooterApi$1 {
|
|
97
|
+
show(): void;
|
|
98
|
+
hide(): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface LoadingApi {
|
|
102
|
+
start(): any;
|
|
103
|
+
stop(): any;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface PaginationApi {
|
|
107
|
+
setPageIndex(value: number): void;
|
|
108
|
+
setPageSize(value: number): void;
|
|
109
|
+
setPageSizeOptions(option: number[]): void;
|
|
110
|
+
firstPage(): void;
|
|
111
|
+
lastPage(): void;
|
|
112
|
+
enable(): void;
|
|
113
|
+
disable(): void;
|
|
114
|
+
page: EventEmitter<PageEvent>;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface ScrollbarApi {
|
|
118
|
+
toTop(sb?: ScrollBehavior): void;
|
|
119
|
+
toLeft(sb?: ScrollBehavior): void;
|
|
120
|
+
toBottom(sb?: ScrollBehavior): void;
|
|
121
|
+
toRight(sb?: ScrollBehavior): void;
|
|
122
|
+
to(top: number, left: number, sb?: ScrollBehavior): void;
|
|
123
|
+
getTop(): number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare enum KlesSelectionModelState {
|
|
127
|
+
ENABLED = "enabled",
|
|
128
|
+
DISABLED = "disabled"
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface IKlesSelectionModel<T> {
|
|
132
|
+
select(value: T | T[], options?: {
|
|
133
|
+
emitEvent?: boolean;
|
|
134
|
+
}): void;
|
|
135
|
+
deselect(value: T | T[], options?: {
|
|
136
|
+
emitEvent?: boolean;
|
|
137
|
+
}): void;
|
|
138
|
+
toggle(value: T, options?: {
|
|
139
|
+
emitEvent?: boolean;
|
|
140
|
+
}): void;
|
|
141
|
+
isEmpty(): boolean;
|
|
142
|
+
hasValue(): boolean;
|
|
143
|
+
disable(): void;
|
|
144
|
+
enable(): void;
|
|
145
|
+
get selected(): {
|
|
146
|
+
items?: T[];
|
|
147
|
+
count: number;
|
|
148
|
+
state: KlesSelectionModelState;
|
|
149
|
+
};
|
|
150
|
+
get changed(): Observable<{
|
|
151
|
+
added?: T[];
|
|
152
|
+
removed?: T[];
|
|
153
|
+
count: number;
|
|
154
|
+
state: KlesSelectionModelState;
|
|
155
|
+
}>;
|
|
156
|
+
get state(): KlesSelectionModelState;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface SelectionApi {
|
|
160
|
+
selectionModel?: IKlesSelectionModel<FormGroup>;
|
|
161
|
+
count: Signal<number>;
|
|
162
|
+
disable(): void;
|
|
163
|
+
enable(): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface SortApi {
|
|
167
|
+
setDirection(direction: SortDirection): void;
|
|
168
|
+
setActive(active: string): void;
|
|
169
|
+
sortChange(): EventEmitter<Sort>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface FormApi {
|
|
173
|
+
header: HeaderApi;
|
|
174
|
+
rows: RowsApi;
|
|
175
|
+
footer: FooterApi;
|
|
176
|
+
}
|
|
177
|
+
type Id = string | number;
|
|
178
|
+
interface HeaderApi {
|
|
179
|
+
setValue(value: {
|
|
180
|
+
[key: string]: any;
|
|
181
|
+
}, options?: {
|
|
182
|
+
emitEvent?: boolean;
|
|
183
|
+
onlySelf?: boolean;
|
|
184
|
+
}): void;
|
|
185
|
+
patchValue(value: {
|
|
186
|
+
[key: string]: any;
|
|
187
|
+
}, options?: {
|
|
188
|
+
emitEvent?: boolean;
|
|
189
|
+
onlySelf?: boolean;
|
|
190
|
+
}): void;
|
|
191
|
+
get(): FormGroup;
|
|
192
|
+
clear(value?: any, options?: {
|
|
193
|
+
emitEvent?: boolean;
|
|
194
|
+
}): void;
|
|
195
|
+
}
|
|
196
|
+
interface FooterApi {
|
|
197
|
+
setValue(value: {
|
|
198
|
+
[key: string]: any;
|
|
199
|
+
}, options?: {
|
|
200
|
+
emitEvent?: boolean;
|
|
201
|
+
onlySelf?: boolean;
|
|
202
|
+
}): void;
|
|
203
|
+
patchValue(value: {
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
}, options?: {
|
|
206
|
+
emitEvent?: boolean;
|
|
207
|
+
onlySelf?: boolean;
|
|
208
|
+
}): void;
|
|
209
|
+
get(): FormGroup;
|
|
210
|
+
clear(value?: any, options?: {
|
|
211
|
+
emitEvent?: boolean;
|
|
212
|
+
}): void;
|
|
213
|
+
}
|
|
214
|
+
interface RowsApi {
|
|
215
|
+
create(value: {
|
|
216
|
+
[key: string]: any;
|
|
217
|
+
}, index?: number, options?: {
|
|
218
|
+
emitEvent?: boolean;
|
|
219
|
+
}): FormGroup;
|
|
220
|
+
patch(_id: Id, value: {
|
|
221
|
+
[key: string]: any;
|
|
222
|
+
}, options?: {
|
|
223
|
+
emitEvent?: boolean;
|
|
224
|
+
onlySelf?: boolean;
|
|
225
|
+
}): FormGroup | undefined;
|
|
226
|
+
reset(_id: Id, value?: {
|
|
227
|
+
[key: string]: any;
|
|
228
|
+
}, options?: {
|
|
229
|
+
emitEvent?: boolean;
|
|
230
|
+
onlySelf?: boolean;
|
|
231
|
+
overwriteDefaultValue?: boolean;
|
|
232
|
+
}): void;
|
|
233
|
+
remove(_id: Id, options?: {
|
|
234
|
+
emitEvent?: boolean;
|
|
235
|
+
}): void;
|
|
236
|
+
list(): FormArray<FormGroup>;
|
|
237
|
+
get(_id: Id): FormGroup | undefined;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface EventsApi {
|
|
241
|
+
listen(): Observable<any>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface ITable {
|
|
245
|
+
scrollbar: ScrollbarApi;
|
|
246
|
+
column: ColumnApi;
|
|
247
|
+
pagination?: PaginationApi | undefined;
|
|
248
|
+
selection: SelectionApi;
|
|
249
|
+
sort: SortApi;
|
|
250
|
+
footer: FooterApi$1;
|
|
251
|
+
loading: LoadingApi;
|
|
252
|
+
form: FormApi;
|
|
253
|
+
events: EventsApi;
|
|
254
|
+
ui: GroupUiState<{
|
|
255
|
+
header: GroupUiState;
|
|
256
|
+
rows: ArrayUiState;
|
|
257
|
+
footer: GroupUiState;
|
|
258
|
+
}>;
|
|
259
|
+
refresh(): void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
type Pagination = {
|
|
263
|
+
page: number;
|
|
264
|
+
perPage: number;
|
|
265
|
+
};
|
|
266
|
+
type Filters = Record<string, unknown>;
|
|
267
|
+
type Query = {
|
|
268
|
+
pagination?: Pagination;
|
|
269
|
+
sort?: Sort;
|
|
270
|
+
filters?: Filters;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type LoaderLazyResult<R> = Observable<{
|
|
274
|
+
total: number;
|
|
275
|
+
items: R[];
|
|
276
|
+
header?: {
|
|
277
|
+
[key: string]: unknown;
|
|
278
|
+
};
|
|
279
|
+
}>;
|
|
280
|
+
type LoaderResult<R> = Observable<{
|
|
281
|
+
items: R[];
|
|
282
|
+
}>;
|
|
283
|
+
type LinesLoaderDef<T, R> = {
|
|
284
|
+
params?: () => Observable<T>;
|
|
285
|
+
loader: (params: T) => LoaderResult<R>;
|
|
286
|
+
hasChildren?: (parent: FormGroup, depth: number) => boolean;
|
|
287
|
+
childrens?: (params: T, parent: FormGroup, depth: number) => LoaderResult<R>;
|
|
288
|
+
};
|
|
289
|
+
type LinesLazyLoaderDef<T, R> = {
|
|
290
|
+
params?: () => Observable<T>;
|
|
291
|
+
loader: (params: T, query?: Query) => LoaderLazyResult<R>;
|
|
292
|
+
hasChildren?: (parent: FormGroup, depth: number) => boolean;
|
|
293
|
+
childrens?: (params: T, parent: FormGroup, depth: number, query?: Query) => LoaderLazyResult<R>;
|
|
294
|
+
};
|
|
295
|
+
type Brand$1<K extends string> = {
|
|
296
|
+
readonly __brand: K;
|
|
297
|
+
};
|
|
298
|
+
type LinesLoader<T, R> = LinesLoaderDef<T, R> & Brand$1<'LinesLoader'>;
|
|
299
|
+
type LinesLazyLoader<T, R> = LinesLazyLoaderDef<T, R> & Brand$1<'LinesLazyLoader'>;
|
|
300
|
+
declare const linesLoader: <T, R>(l: LinesLoaderDef<T, R>) => LinesLoader<T, R>;
|
|
301
|
+
declare const linesLazyLoader: <T, R>(l: LinesLazyLoaderDef<T, R>) => LinesLazyLoader<T, R>;
|
|
302
|
+
|
|
303
|
+
type RowId = string | number;
|
|
304
|
+
type SelectionConfigDef<T> = {
|
|
305
|
+
selectionMode?: boolean;
|
|
306
|
+
key?: string;
|
|
307
|
+
params?: () => Observable<T>;
|
|
308
|
+
select?: (params: T, row: FormGroup, selected: boolean, filters?: {
|
|
309
|
+
[key: string]: any;
|
|
310
|
+
}) => Observable<{
|
|
311
|
+
selected?: boolean;
|
|
312
|
+
count?: number;
|
|
313
|
+
}>;
|
|
314
|
+
selectAll?: (params: T, selected: boolean, filters: {
|
|
315
|
+
[key: string]: any;
|
|
316
|
+
}) => Observable<{
|
|
317
|
+
selected: boolean;
|
|
318
|
+
footer?: any;
|
|
319
|
+
count?: number;
|
|
320
|
+
}>;
|
|
321
|
+
/** optionnel */
|
|
322
|
+
/** pour indiquer le critère des lignes déja sélectionné */
|
|
323
|
+
isSelected?: (row: FormGroup) => boolean;
|
|
324
|
+
isDisabled?: (row: FormGroup) => boolean;
|
|
325
|
+
};
|
|
326
|
+
type Brand<K extends string> = {
|
|
327
|
+
readonly __brand: K;
|
|
328
|
+
};
|
|
329
|
+
type SelectionConfig<T> = SelectionConfigDef<T> & Brand<'SelectionConfig'>;
|
|
330
|
+
declare const selectionConfig: <T>(l: SelectionConfigDef<T>) => SelectionConfig<T>;
|
|
331
|
+
|
|
332
|
+
interface DefaultTableConfig {
|
|
333
|
+
id?: string;
|
|
334
|
+
columns: KlesColumnConfig[];
|
|
335
|
+
lineValidations?: ValidatorFn[];
|
|
336
|
+
lineAsyncValidations?: AsyncValidatorFn[];
|
|
337
|
+
footer?: boolean;
|
|
338
|
+
sortConfig?: Sort;
|
|
339
|
+
}
|
|
340
|
+
interface PaginatorConfig {
|
|
341
|
+
paginator?: boolean;
|
|
342
|
+
customMatPaginatorIntl?: Type<MatPaginatorIntl>;
|
|
343
|
+
pageSize?: number;
|
|
344
|
+
pageSizeOptions?: number[];
|
|
345
|
+
showFirstLastButtons?: boolean;
|
|
346
|
+
selectConfig?: MatPaginatorSelectConfig;
|
|
347
|
+
}
|
|
348
|
+
interface InfiniteScrollConfig {
|
|
349
|
+
infinite?: boolean;
|
|
350
|
+
}
|
|
351
|
+
interface DragDropConfig {
|
|
352
|
+
enable?: boolean;
|
|
353
|
+
options?: {
|
|
354
|
+
autoScrollStep?: number;
|
|
355
|
+
connectedTo?: string[];
|
|
356
|
+
dragDisabled?: (row: FormGroup) => boolean;
|
|
357
|
+
dragPreview?: {
|
|
358
|
+
matchSize?: boolean;
|
|
359
|
+
component: Type<any>;
|
|
360
|
+
};
|
|
361
|
+
dragPlaceholder?: {
|
|
362
|
+
component: Type<any>;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
interface DragDrop {
|
|
367
|
+
dragDropRows?: DragDropConfig;
|
|
368
|
+
drapDropColumns?: DragDropConfig;
|
|
369
|
+
}
|
|
370
|
+
type ExtraRowMode = 'expand' | 'always';
|
|
371
|
+
interface ExtraRowConfig {
|
|
372
|
+
cells: KlesExtraCellFieldConfig[];
|
|
373
|
+
mode?: ExtraRowMode;
|
|
374
|
+
when?: (index: number, rowData: FormGroup) => boolean;
|
|
375
|
+
}
|
|
376
|
+
interface ExtraRow {
|
|
377
|
+
extraRows?: ExtraRowConfig[];
|
|
378
|
+
multiUnfold?: boolean;
|
|
379
|
+
}
|
|
380
|
+
type LoaderConfig<T, R> = {
|
|
381
|
+
lazy: true;
|
|
382
|
+
lines: LinesLazyLoader<T, R>;
|
|
383
|
+
} | {
|
|
384
|
+
lazy?: false | undefined;
|
|
385
|
+
lines: LinesLoader<T, R>;
|
|
386
|
+
};
|
|
387
|
+
type Selection<T> = {
|
|
388
|
+
selection?: SelectionConfig<T>;
|
|
389
|
+
};
|
|
390
|
+
type Exclusive<T, U> = (T & {
|
|
391
|
+
[K in keyof U]?: never;
|
|
392
|
+
}) | (U & {
|
|
393
|
+
[K in keyof T]?: never;
|
|
394
|
+
});
|
|
395
|
+
type KlesTableConfig<T = any, R = any> = DefaultTableConfig & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop & Selection<T> & ExtraRow;
|
|
396
|
+
|
|
397
|
+
interface ITableStore {
|
|
398
|
+
reset(): void;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
declare class PaginatorStore implements ITableStore {
|
|
402
|
+
protected config: PaginatorConfig;
|
|
403
|
+
private s;
|
|
404
|
+
page$: Observable<Pagination>;
|
|
405
|
+
constructor(config: PaginatorConfig);
|
|
406
|
+
setPage(v: Pagination): void;
|
|
407
|
+
snapshot(): Pagination;
|
|
408
|
+
reset(): void;
|
|
409
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorStore, [{ optional: true; }]>;
|
|
410
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PaginatorStore>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
declare abstract class DragDropBase {
|
|
414
|
+
protected config?: DragDropConfig;
|
|
415
|
+
constructor(config?: DragDropConfig);
|
|
416
|
+
get enable(): boolean;
|
|
417
|
+
get autoScrollStep(): number | true;
|
|
418
|
+
get connectedTo(): string[];
|
|
419
|
+
get sortPredicate(): (index: number, item: CdkDrag<number>) => boolean;
|
|
420
|
+
get previewComponent(): i0.Type<any>;
|
|
421
|
+
get previewMatchSize(): true;
|
|
422
|
+
abstract listDropped(event: CdkDragDrop<FormArray<FormGroup>>): void;
|
|
423
|
+
}
|
|
424
|
+
declare class DragDropService extends DragDropBase {
|
|
425
|
+
protected config?: DragDropConfig;
|
|
426
|
+
private paginatorStore?;
|
|
427
|
+
constructor(config?: DragDropConfig, paginatorStore?: PaginatorStore | null);
|
|
428
|
+
listDropped(event: CdkDragDrop<FormArray<FormGroup>>): void;
|
|
429
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DragDropService, [{ optional: true; }, { optional: true; }]>;
|
|
430
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DragDropService>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class ScrollbarService {
|
|
434
|
+
private element;
|
|
435
|
+
private default;
|
|
436
|
+
register(el: HTMLElement): void;
|
|
437
|
+
unregister(): void;
|
|
438
|
+
toTop(sb?: ScrollBehavior): void;
|
|
439
|
+
toBottom(sb?: ScrollBehavior): void;
|
|
440
|
+
toLeft(sb?: ScrollBehavior): void;
|
|
441
|
+
toRight(sb?: ScrollBehavior): void;
|
|
442
|
+
to(top: number, left: number, sb?: ScrollBehavior): void;
|
|
443
|
+
getTop(): number;
|
|
444
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollbarService, never>;
|
|
445
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ScrollbarService>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
declare class KlesTableConnectorService {
|
|
449
|
+
private _connected$;
|
|
450
|
+
private _table?;
|
|
451
|
+
readonly connected$: Observable<boolean>;
|
|
452
|
+
constructor();
|
|
453
|
+
connect(table: ITable): () => void;
|
|
454
|
+
get table(): ITable;
|
|
455
|
+
get scrollbar(): ScrollbarApi;
|
|
456
|
+
get column(): ColumnApi;
|
|
457
|
+
get pagination(): PaginationApi | undefined;
|
|
458
|
+
get sort(): SortApi;
|
|
459
|
+
get loading(): LoadingApi;
|
|
460
|
+
get selection(): SelectionApi;
|
|
461
|
+
get footer(): FooterApi$1;
|
|
462
|
+
get form(): FormApi;
|
|
463
|
+
get ui(): GroupUiState<{
|
|
464
|
+
header: GroupUiState;
|
|
465
|
+
rows: ArrayUiState;
|
|
466
|
+
footer: GroupUiState;
|
|
467
|
+
}>;
|
|
468
|
+
get events(): EventsApi;
|
|
469
|
+
refresh(): void;
|
|
470
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableConnectorService, never>;
|
|
471
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KlesTableConnectorService>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
interface SortPayload {
|
|
475
|
+
active: string;
|
|
476
|
+
direction: SortDirection;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Payload de base pour une ligne.
|
|
480
|
+
*
|
|
481
|
+
* row = le FormGroup de la ligne
|
|
482
|
+
* value = row.value, donc sans les champs disabled
|
|
483
|
+
* rawValue = row.getRawValue(), donc avec les champs disabled
|
|
484
|
+
*/
|
|
485
|
+
interface RowPayload<TValue = unknown> {
|
|
486
|
+
row: FormGroup;
|
|
487
|
+
rowIndex: number;
|
|
488
|
+
value: Partial<TValue>;
|
|
489
|
+
rawValue: TValue;
|
|
490
|
+
}
|
|
491
|
+
interface RowMousePayload<TValue = unknown> extends RowPayload<TValue> {
|
|
492
|
+
event: MouseEvent;
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Payload de base pour une cellule.
|
|
496
|
+
*/
|
|
497
|
+
interface CellPayload<TValue = unknown> {
|
|
498
|
+
row: FormGroup;
|
|
499
|
+
rowIndex: number;
|
|
500
|
+
columnDef: string;
|
|
501
|
+
control: AbstractControl | null;
|
|
502
|
+
value: unknown;
|
|
503
|
+
rawValue: TValue;
|
|
504
|
+
event?: Event;
|
|
505
|
+
}
|
|
506
|
+
interface CellMousePayload<TValue = unknown> extends CellPayload<TValue> {
|
|
507
|
+
event: MouseEvent;
|
|
508
|
+
}
|
|
509
|
+
interface CellValueChangePayload<TValue = unknown> {
|
|
510
|
+
row: FormGroup;
|
|
511
|
+
rowIndex: number;
|
|
512
|
+
columnDef: string;
|
|
513
|
+
control: AbstractControl;
|
|
514
|
+
previousValue: unknown;
|
|
515
|
+
currentValue: unknown;
|
|
516
|
+
value: Partial<TValue>;
|
|
517
|
+
rawValue: TValue;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Pagination.
|
|
521
|
+
*/
|
|
522
|
+
interface PageChangePayload {
|
|
523
|
+
pageIndex: number;
|
|
524
|
+
previousPageIndex?: number;
|
|
525
|
+
pageSize: number;
|
|
526
|
+
totalItems?: number;
|
|
527
|
+
sourceEvent?: PageEvent;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Filtres / recherche.
|
|
531
|
+
*/
|
|
532
|
+
interface FilterChangePayload {
|
|
533
|
+
filters: Record<string, unknown>;
|
|
534
|
+
changedFilter?: {
|
|
535
|
+
columnDef: string;
|
|
536
|
+
previousValue: unknown;
|
|
537
|
+
currentValue: unknown;
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Colonnes.
|
|
542
|
+
*/
|
|
543
|
+
interface ColumnPayload {
|
|
544
|
+
columnDef: string;
|
|
545
|
+
}
|
|
546
|
+
interface ColumnResizePayload {
|
|
547
|
+
columnDef: string;
|
|
548
|
+
width: number;
|
|
549
|
+
previousWidth?: number;
|
|
550
|
+
}
|
|
551
|
+
interface ColumnOrderChangePayload {
|
|
552
|
+
previousIndex: number;
|
|
553
|
+
currentIndex: number;
|
|
554
|
+
columns: string[];
|
|
555
|
+
}
|
|
556
|
+
interface ColumnVisibilityChangePayload {
|
|
557
|
+
columnDef: string;
|
|
558
|
+
visible: boolean;
|
|
559
|
+
columns: string[];
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Drag & drop.
|
|
563
|
+
*/
|
|
564
|
+
interface RowDropPayload<TValue = unknown> extends RowPayload<TValue> {
|
|
565
|
+
previousIndex: number;
|
|
566
|
+
currentIndex: number;
|
|
567
|
+
previousContainerId?: string;
|
|
568
|
+
currentContainerId?: string;
|
|
569
|
+
}
|
|
570
|
+
interface ColumnDropPayload {
|
|
571
|
+
columnDef: string;
|
|
572
|
+
previousIndex: number;
|
|
573
|
+
currentIndex: number;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Expansion / tree.
|
|
577
|
+
*/
|
|
578
|
+
interface ExpansionPayload<TValue = unknown> extends RowPayload<TValue> {
|
|
579
|
+
level?: number;
|
|
580
|
+
}
|
|
581
|
+
interface TreePayload<TValue = unknown> extends RowPayload<TValue> {
|
|
582
|
+
level: number;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Lazy loading.
|
|
586
|
+
*/
|
|
587
|
+
interface LoadSuccessPayload<TValue = unknown> {
|
|
588
|
+
rows: FormGroup[];
|
|
589
|
+
values: Partial<TValue>[];
|
|
590
|
+
rawValues: TValue[];
|
|
591
|
+
total?: number;
|
|
592
|
+
}
|
|
593
|
+
interface LoadErrorPayload {
|
|
594
|
+
error: unknown;
|
|
595
|
+
message?: string;
|
|
596
|
+
}
|
|
597
|
+
interface ValidationErrorPayload<TValue = unknown> {
|
|
598
|
+
row?: FormGroup;
|
|
599
|
+
rowIndex?: number;
|
|
600
|
+
columnDef?: string;
|
|
601
|
+
control?: AbstractControl | null;
|
|
602
|
+
value?: Partial<TValue>;
|
|
603
|
+
rawValue?: TValue;
|
|
604
|
+
errors: ValidationErrors | null;
|
|
605
|
+
controlsErrors?: Record<string, ValidationErrors | null | undefined>;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
interface TableEventMap<TValue = unknown> {
|
|
609
|
+
/**
|
|
610
|
+
* row
|
|
611
|
+
*/
|
|
612
|
+
rowClick: RowMousePayload<TValue>;
|
|
613
|
+
rowDoubleClick: RowMousePayload<TValue>;
|
|
614
|
+
rowContextMenu: RowMousePayload<TValue>;
|
|
615
|
+
rowMouseEnter: RowMousePayload<TValue>;
|
|
616
|
+
rowMouseLeave: RowMousePayload<TValue>;
|
|
617
|
+
rowCreate: RowPayload<TValue>;
|
|
618
|
+
rowUpdate: RowPayload<TValue>;
|
|
619
|
+
rowPatch: RowPayload<TValue>;
|
|
620
|
+
rowDelete: RowPayload<TValue>;
|
|
621
|
+
/**
|
|
622
|
+
* cell
|
|
623
|
+
*/
|
|
624
|
+
cellClick: CellMousePayload<TValue>;
|
|
625
|
+
cellDoubleClick: CellMousePayload<TValue>;
|
|
626
|
+
cellContextMenu: CellMousePayload<TValue>;
|
|
627
|
+
cellValueChange: CellValueChangePayload<TValue>;
|
|
628
|
+
/**
|
|
629
|
+
* pagination
|
|
630
|
+
*/
|
|
631
|
+
pageChange: PageChangePayload;
|
|
632
|
+
/**
|
|
633
|
+
* sort
|
|
634
|
+
*/
|
|
635
|
+
sortChange: SortPayload;
|
|
636
|
+
/**
|
|
637
|
+
* filters
|
|
638
|
+
*/
|
|
639
|
+
filterChange: FilterChangePayload;
|
|
640
|
+
/**
|
|
641
|
+
* columns
|
|
642
|
+
*/
|
|
643
|
+
columnResize: ColumnResizePayload;
|
|
644
|
+
columnResizeStart: ColumnResizePayload;
|
|
645
|
+
columnResizeEnd: ColumnResizePayload;
|
|
646
|
+
columnOrderChange: ColumnOrderChangePayload;
|
|
647
|
+
columnVisibilityChange: ColumnVisibilityChangePayload;
|
|
648
|
+
/**
|
|
649
|
+
* Drag & drop
|
|
650
|
+
*/
|
|
651
|
+
rowDragStart: RowPayload<TValue>;
|
|
652
|
+
rowDragMove: RowPayload<TValue>;
|
|
653
|
+
rowDragEnd: RowPayload<TValue>;
|
|
654
|
+
rowDrop: RowDropPayload<TValue>;
|
|
655
|
+
columnDragStart: ColumnPayload;
|
|
656
|
+
columnDragEnd: ColumnPayload;
|
|
657
|
+
columnDrop: ColumnDropPayload;
|
|
658
|
+
/**
|
|
659
|
+
* Expansion / tree
|
|
660
|
+
*/
|
|
661
|
+
rowExpand: ExpansionPayload<TValue>;
|
|
662
|
+
rowCollapse: ExpansionPayload<TValue>;
|
|
663
|
+
rowToggleExpand: ExpansionPayload<TValue>;
|
|
664
|
+
expandAll: void;
|
|
665
|
+
collapseAll: void;
|
|
666
|
+
nodeExpand: TreePayload<TValue>;
|
|
667
|
+
nodeCollapse: TreePayload<TValue>;
|
|
668
|
+
nodeLoadChildren: TreePayload<TValue>;
|
|
669
|
+
nodeChildrenLoaded: TreePayload<TValue>;
|
|
670
|
+
/**
|
|
671
|
+
* Loading / lazy
|
|
672
|
+
*/
|
|
673
|
+
loadStart: void;
|
|
674
|
+
loadSuccess: LoadSuccessPayload<TValue>;
|
|
675
|
+
loadError: LoadErrorPayload;
|
|
676
|
+
refresh: void;
|
|
677
|
+
/**
|
|
678
|
+
* Error / validation
|
|
679
|
+
*/
|
|
680
|
+
rowValidationError: ValidationErrorPayload<TValue>;
|
|
681
|
+
cellValidationError: ValidationErrorPayload<TValue>;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
type TableEventType<TValue = unknown> = keyof TableEventMap<TValue>;
|
|
685
|
+
type TableEvent<TValue = unknown> = {
|
|
686
|
+
[K in keyof TableEventMap<TValue>]: TableEventMap<TValue>[K] extends void ? {
|
|
687
|
+
type: K;
|
|
688
|
+
} : {
|
|
689
|
+
type: K;
|
|
690
|
+
payload: TableEventMap<TValue>[K];
|
|
691
|
+
};
|
|
692
|
+
}[keyof TableEventMap<TValue>];
|
|
693
|
+
type TableEventPayload<TValue, K extends keyof TableEventMap<TValue>> = TableEventMap<TValue>[K];
|
|
694
|
+
|
|
695
|
+
declare class EventsService<TValue = unknown> {
|
|
696
|
+
private readonly eventsSubject;
|
|
697
|
+
readonly events$: Observable<TableEvent<TValue>>;
|
|
698
|
+
/**
|
|
699
|
+
* Émet un event typé.
|
|
700
|
+
*
|
|
701
|
+
* Si l'event a un payload, TypeScript t'oblige à le fournir.
|
|
702
|
+
* Si l'event est void, TypeScript t'empêche de fournir un payload.
|
|
703
|
+
*/
|
|
704
|
+
emit<K extends TableEventType<TValue>>(type: K, ...args: TableEventMap<TValue>[K] extends void ? [] : [payload: TableEventPayload<TValue, K>]): void;
|
|
705
|
+
/**
|
|
706
|
+
* Émet directement un event complet.
|
|
707
|
+
* Pratique si tu construis déjà l'objet ailleurs.
|
|
708
|
+
*/
|
|
709
|
+
emitEvent(event: TableEvent<TValue>): void;
|
|
710
|
+
complete(): void;
|
|
711
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EventsService<any>, never>;
|
|
712
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EventsService<any>>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
declare class ColumnsService {
|
|
716
|
+
private _columns;
|
|
717
|
+
private readonly eventsService;
|
|
718
|
+
displayedColumns: Signal<string[]> | undefined;
|
|
719
|
+
constructor(_columns: WritableSignal<KlesColumnConfig[]>, eventsService: EventsService);
|
|
720
|
+
register(): void;
|
|
721
|
+
get columns(): Signal<KlesColumnConfig[]>;
|
|
722
|
+
getVisible(): string[];
|
|
723
|
+
setVisible(columnDef: string, visible: boolean): void;
|
|
724
|
+
toggleVisible(columnDef: string): void;
|
|
725
|
+
changeWidth(columnDef: string, options: {
|
|
726
|
+
width?: string;
|
|
727
|
+
maxWidth?: string;
|
|
728
|
+
minWidth?: string;
|
|
729
|
+
}): void;
|
|
730
|
+
setResizable(columnDef: string, resizable: boolean): void;
|
|
731
|
+
toggleResizable(columnDef: string): void;
|
|
732
|
+
setSticky(columnDef: string, options: {
|
|
733
|
+
sticky?: boolean;
|
|
734
|
+
stickyEnd?: boolean;
|
|
735
|
+
}): void;
|
|
736
|
+
setColumnPosition(columnDef: string, position: number): void;
|
|
737
|
+
private updateColumn;
|
|
738
|
+
private setDisplayedColumns;
|
|
739
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnsService, never>;
|
|
740
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColumnsService>;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
declare class LoadingService {
|
|
744
|
+
private _loading;
|
|
745
|
+
get loading(): i0.Signal<boolean>;
|
|
746
|
+
start(): void;
|
|
747
|
+
stop(): void;
|
|
748
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoadingService, never>;
|
|
749
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LoadingService>;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
interface IKlesDataSource extends DataSource<FormGroup> {
|
|
753
|
+
set data(data: any[]);
|
|
754
|
+
get paginator(): MatPaginator | null | undefined;
|
|
755
|
+
set paginator(paginator: MatPaginator | null | undefined);
|
|
756
|
+
get sort(): MatSort | null | undefined;
|
|
757
|
+
set sort(sort: MatSort | null | undefined);
|
|
758
|
+
get filter(): string | undefined;
|
|
759
|
+
set filter(f: string);
|
|
760
|
+
connect(): Observable<readonly FormGroup[]>;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
declare class KlesDataSource extends MatTableDataSource<FormGroup, MatPaginator> implements IKlesDataSource {
|
|
764
|
+
constructor();
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
declare class RowFormFactory {
|
|
768
|
+
createControl(field: IKlesFieldConfig, value?: any): {
|
|
769
|
+
control: AbstractControl;
|
|
770
|
+
ui: AbstractUiState;
|
|
771
|
+
};
|
|
772
|
+
createRow(fields: IKlesFieldConfig[], record: any, meta?: {
|
|
773
|
+
depth: number;
|
|
774
|
+
parentId: string | null;
|
|
775
|
+
}): {
|
|
776
|
+
formGroup: FormGroup;
|
|
777
|
+
groupUi: GroupUiState;
|
|
778
|
+
};
|
|
779
|
+
createRows(fields: IKlesFieldConfig[], records: any[], meta?: {
|
|
780
|
+
depth: number;
|
|
781
|
+
parentId: string | null;
|
|
782
|
+
}): {
|
|
783
|
+
formGroup: FormGroup;
|
|
784
|
+
groupUi: GroupUiState;
|
|
785
|
+
}[];
|
|
786
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RowFormFactory, never>;
|
|
787
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RowFormFactory>;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
declare class KlesForm {
|
|
791
|
+
private columnsService;
|
|
792
|
+
private rowFactory;
|
|
793
|
+
readonly form: FormGroup<{
|
|
794
|
+
header: FormGroup<{}>;
|
|
795
|
+
rows: FormArray<FormGroup<any>>;
|
|
796
|
+
footer: FormGroup<{}>;
|
|
797
|
+
}>;
|
|
798
|
+
readonly ui: GroupUiState<{
|
|
799
|
+
header: GroupUiState<{}>;
|
|
800
|
+
rows: ArrayUiState<any, any[], any[]>;
|
|
801
|
+
footer: GroupUiState<{}>;
|
|
802
|
+
}>;
|
|
803
|
+
readonly uiStore: WeakMap<AbstractControl<any, any, any>, AbstractUiState<any, any>>;
|
|
804
|
+
private readonly rowsStructureChangedSubject;
|
|
805
|
+
readonly rowsStructureChanged$: rxjs.Observable<void>;
|
|
806
|
+
constructor(columnsService: ColumnsService, rowFactory: RowFormFactory);
|
|
807
|
+
getRows(): FormArray<FormGroup>;
|
|
808
|
+
getUiRows(): ArrayUiState;
|
|
809
|
+
getUiHeader(): GroupUiState;
|
|
810
|
+
getUiFooter(): GroupUiState;
|
|
811
|
+
getHeader(): FormGroup;
|
|
812
|
+
getFooter(): FormGroup;
|
|
813
|
+
setRows(rows: {
|
|
814
|
+
formGroup: FormGroup;
|
|
815
|
+
groupUi: GroupUiState;
|
|
816
|
+
}[]): void;
|
|
817
|
+
private insertRowAndNotify;
|
|
818
|
+
insertRow(row: {
|
|
819
|
+
formGroup: FormGroup;
|
|
820
|
+
groupUi: GroupUiState;
|
|
821
|
+
}, index?: number, options?: {
|
|
822
|
+
emitEvent?: boolean;
|
|
823
|
+
}): {
|
|
824
|
+
formGroup: FormGroup;
|
|
825
|
+
groupUi: GroupUiState;
|
|
826
|
+
};
|
|
827
|
+
insertRows(rows: {
|
|
828
|
+
formGroup: FormGroup;
|
|
829
|
+
groupUi: GroupUiState;
|
|
830
|
+
}[], index?: number): void;
|
|
831
|
+
updateRow(_id: number | string, value: any, options?: {
|
|
832
|
+
emitEvent?: boolean;
|
|
833
|
+
onlySelf?: boolean;
|
|
834
|
+
}): FormGroup<any>;
|
|
835
|
+
resetRow(_id: number | string, value?: any, options?: {
|
|
836
|
+
onlySelf?: boolean;
|
|
837
|
+
emitEvent?: boolean;
|
|
838
|
+
overwriteDefaultValue?: boolean;
|
|
839
|
+
}): void;
|
|
840
|
+
deleteRowById(id: number | string, option?: {
|
|
841
|
+
emitEvent?: boolean;
|
|
842
|
+
}): void;
|
|
843
|
+
setHeaderControl(name: string, header: AbstractControl, options?: {
|
|
844
|
+
emitEvent?: false;
|
|
845
|
+
}): void;
|
|
846
|
+
setFooterControl(name: string, footer: AbstractControl, options?: {
|
|
847
|
+
emitEvent?: false;
|
|
848
|
+
}): void;
|
|
849
|
+
setHeaderUi(name: string, header: AbstractUiState): void;
|
|
850
|
+
setFooterUi(name: string, footer: AbstractUiState): void;
|
|
851
|
+
get rows(): FormGroup[];
|
|
852
|
+
init(): void;
|
|
853
|
+
private notifyRowsStructureChanged;
|
|
854
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KlesForm, never>;
|
|
855
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KlesForm>;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
declare class CellValueChangeService {
|
|
859
|
+
private readonly eventsService;
|
|
860
|
+
private readonly destroyRef;
|
|
861
|
+
private readonly subscriptions;
|
|
862
|
+
constructor(eventsService: EventsService);
|
|
863
|
+
listen(visibleRows: FormGroup[], visibleColumns: string[]): void;
|
|
864
|
+
private getCellKey;
|
|
865
|
+
private subscribeToCell;
|
|
866
|
+
private unsubscribeInvisibleCells;
|
|
867
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CellValueChangeService, never>;
|
|
868
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CellValueChangeService>;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
declare class ValidationService {
|
|
872
|
+
private readonly eventsService;
|
|
873
|
+
private readonly destroyRef;
|
|
874
|
+
private readonly columnSubscriptions;
|
|
875
|
+
private readonly rowSubscriptions;
|
|
876
|
+
constructor(eventsService: EventsService);
|
|
877
|
+
listen(visibleRows: FormGroup[], visibleColumns: string[]): void;
|
|
878
|
+
private getCellKey;
|
|
879
|
+
private getRowKey;
|
|
880
|
+
private subscribeToCell;
|
|
881
|
+
private subscribeToRow;
|
|
882
|
+
private unsubscribe;
|
|
883
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationService, never>;
|
|
884
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ValidationService>;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
interface IDatasourceService {
|
|
888
|
+
get datasource(): IKlesDataSource;
|
|
889
|
+
register(): void;
|
|
890
|
+
}
|
|
891
|
+
declare class DatasourceService implements IDatasourceService {
|
|
892
|
+
private fm;
|
|
893
|
+
private columnsService;
|
|
894
|
+
private cellValueChangeService;
|
|
895
|
+
private validationService;
|
|
896
|
+
private _datasource;
|
|
897
|
+
private readonly destroyRef;
|
|
898
|
+
constructor(fm: KlesForm, columnsService: ColumnsService, cellValueChangeService: CellValueChangeService, validationService: ValidationService);
|
|
899
|
+
register(): void;
|
|
900
|
+
get datasource(): KlesDataSource;
|
|
901
|
+
private createDataSource;
|
|
902
|
+
private listen;
|
|
903
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DatasourceService, never>;
|
|
904
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DatasourceService>;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
declare class PaginatorService {
|
|
908
|
+
private config;
|
|
909
|
+
protected paginatorStore: PaginatorStore | null;
|
|
910
|
+
private datasourceService;
|
|
911
|
+
private readonly eventsService;
|
|
912
|
+
private _paginator;
|
|
913
|
+
private _disabled;
|
|
914
|
+
private _pageChanged;
|
|
915
|
+
private readonly destroyRef;
|
|
916
|
+
constructor(config: PaginatorConfig, paginatorStore: PaginatorStore | null, datasourceService: IDatasourceService, eventsService: EventsService);
|
|
917
|
+
register(paginator: MatPaginator): void;
|
|
918
|
+
get paginator(): MatPaginator | undefined;
|
|
919
|
+
pageChanged(): EventEmitter<PageEvent>;
|
|
920
|
+
setPageIndex(index: number): void;
|
|
921
|
+
setPageSize(size: number): void;
|
|
922
|
+
setPageSizeOptions(option: number[]): void;
|
|
923
|
+
setlength(length: number): void;
|
|
924
|
+
firstPage(): void;
|
|
925
|
+
lastPage(): void;
|
|
926
|
+
disabled(): Signal<boolean>;
|
|
927
|
+
disable(): void;
|
|
928
|
+
enable(): void;
|
|
929
|
+
private setSizeIndex;
|
|
930
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorService, [{ optional: true; }, { optional: true; }, null, null]>;
|
|
931
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PaginatorService>;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
interface ISortService {
|
|
935
|
+
sort: MatSort;
|
|
936
|
+
register(s: MatSort): void;
|
|
937
|
+
setDirection(direction: SortDirection): void;
|
|
938
|
+
setActive(active: string): void;
|
|
939
|
+
sortChange(): EventEmitter<Sort>;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
declare class FilterService {
|
|
943
|
+
private columnsService;
|
|
944
|
+
private datasourceService;
|
|
945
|
+
constructor(columnsService: ColumnsService, datasourceService: DatasourceService);
|
|
946
|
+
register(): void;
|
|
947
|
+
formatData(data: {
|
|
948
|
+
[key: string]: any;
|
|
949
|
+
}): any;
|
|
950
|
+
private createFilterPredicate;
|
|
951
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FilterService, never>;
|
|
952
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FilterService>;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
interface ILoader<R> {
|
|
956
|
+
load(): Observable<{
|
|
957
|
+
total: number;
|
|
958
|
+
items: R[];
|
|
959
|
+
loading: boolean;
|
|
960
|
+
error?: any;
|
|
961
|
+
header?: any;
|
|
962
|
+
}>;
|
|
963
|
+
refresh(): void;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
interface IHeaderService {
|
|
967
|
+
register(): void;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
declare class ExpandedRowStore implements ITableStore {
|
|
971
|
+
private readonly _expandedIds$;
|
|
972
|
+
readonly expandedIds$: rxjs.Observable<Set<string>>;
|
|
973
|
+
reset(): void;
|
|
974
|
+
isExpanded(id: string): boolean;
|
|
975
|
+
get expandedIds(): ReadonlySet<string>;
|
|
976
|
+
expand(id: string): void;
|
|
977
|
+
collapse(id: string): void;
|
|
978
|
+
toggle(id: string): void;
|
|
979
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExpandedRowStore, never>;
|
|
980
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ExpandedRowStore>;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
declare class ExtraRowService {
|
|
984
|
+
private _extraRowsConfig;
|
|
985
|
+
private expandedRowStore;
|
|
986
|
+
multiTemplateDataRows: Signal<boolean>;
|
|
987
|
+
rows: Signal<(ExtraRowConfig & {
|
|
988
|
+
displayedColumns: string[];
|
|
989
|
+
})[]>;
|
|
990
|
+
constructor(_extraRowsConfig: WritableSignal<ExtraRowConfig[]>, expandedRowStore: ExpandedRowStore);
|
|
991
|
+
extraColumns(): KlesExtraCellFieldConfig[];
|
|
992
|
+
private createWhen;
|
|
993
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExtraRowService, never>;
|
|
994
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ExtraRowService>;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
interface ILinesService {
|
|
998
|
+
register(): void;
|
|
999
|
+
total(): number;
|
|
1000
|
+
loaded(): EventEmitter<void>;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
interface ISelectionService {
|
|
1004
|
+
key: string;
|
|
1005
|
+
selectionMode: boolean;
|
|
1006
|
+
register(): void;
|
|
1007
|
+
selectionModel?: IKlesSelectionModel<FormGroup>;
|
|
1008
|
+
count(): Signal<number>;
|
|
1009
|
+
disable(): void;
|
|
1010
|
+
enable(): void;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
interface IScrollbarOrchestratorService {
|
|
1014
|
+
register(): void;
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
interface ITableService {
|
|
1018
|
+
readonly form: FormGroup<{
|
|
1019
|
+
header: FormGroup<{}>;
|
|
1020
|
+
rows: FormArray<FormGroup<any>>;
|
|
1021
|
+
footer: FormGroup<{}>;
|
|
1022
|
+
}>;
|
|
1023
|
+
readonly ui: GroupUiState<{
|
|
1024
|
+
header: GroupUiState;
|
|
1025
|
+
rows: ArrayUiState<any, any, any>;
|
|
1026
|
+
footer: GroupUiState;
|
|
1027
|
+
}>;
|
|
1028
|
+
klesForm: KlesForm;
|
|
1029
|
+
trackBy: (_: number, row: FormGroup) => any;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
declare class FooterService {
|
|
1033
|
+
private _footer;
|
|
1034
|
+
constructor(_footer: WritableSignal<boolean>);
|
|
1035
|
+
get footer(): Signal<boolean>;
|
|
1036
|
+
show(): void;
|
|
1037
|
+
hide(): void;
|
|
1038
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FooterService, never>;
|
|
1039
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FooterService>;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
declare class RenderService {
|
|
1043
|
+
private _render;
|
|
1044
|
+
render(): EventEmitter<void>;
|
|
1045
|
+
forceRenderRows(): void;
|
|
1046
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RenderService, never>;
|
|
1047
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RenderService>;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
declare class RowService {
|
|
1051
|
+
private readonly eventsService;
|
|
1052
|
+
constructor(eventsService: EventsService);
|
|
1053
|
+
onClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
|
|
1054
|
+
onDoubleClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
|
|
1055
|
+
onContextMenu(event: MouseEvent, row: FormGroup, rowIndex: number): void;
|
|
1056
|
+
onMouseEnter(event: MouseEvent, row: FormGroup, rowIndex: number): void;
|
|
1057
|
+
onMouseLeave(event: MouseEvent, row: FormGroup, rowIndex: number): void;
|
|
1058
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RowService, never>;
|
|
1059
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RowService>;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
declare class CellService {
|
|
1063
|
+
private readonly eventsService;
|
|
1064
|
+
constructor(eventsService: EventsService);
|
|
1065
|
+
onClick(event: MouseEvent, row: FormGroup, rowIndex: number, columnDef: string): void;
|
|
1066
|
+
onDoubleClick(event: MouseEvent, row: FormGroup, rowIndex: number, columnDef: string): void;
|
|
1067
|
+
onContextMenu(event: MouseEvent, row: FormGroup, rowIndex: number, columnDef: string): void;
|
|
1068
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CellService, never>;
|
|
1069
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CellService>;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy {
|
|
1073
|
+
private readonly host;
|
|
1074
|
+
private readonly connectorService;
|
|
1075
|
+
private readonly loader;
|
|
1076
|
+
private readonly datasourceService;
|
|
1077
|
+
readonly tableService: ITableService;
|
|
1078
|
+
readonly dragDropRowService: DragDropService;
|
|
1079
|
+
private readonly selectionService;
|
|
1080
|
+
readonly columnsService: ColumnsService;
|
|
1081
|
+
readonly loadingService: LoadingService;
|
|
1082
|
+
private readonly paginatorService;
|
|
1083
|
+
private readonly scrollbarService;
|
|
1084
|
+
private readonly footerService;
|
|
1085
|
+
private readonly extraRowService;
|
|
1086
|
+
private readonly renderService;
|
|
1087
|
+
private readonly sortService;
|
|
1088
|
+
private readonly filterService;
|
|
1089
|
+
private readonly expandedRowStore;
|
|
1090
|
+
private readonly rowFactory;
|
|
1091
|
+
private readonly eventsService;
|
|
1092
|
+
readonly rowService: RowService;
|
|
1093
|
+
readonly cellService: CellService;
|
|
1094
|
+
table: MatTable<FormGroup>;
|
|
1095
|
+
matSort: MatSort;
|
|
1096
|
+
formElemRef: ElementRef<HTMLElement>;
|
|
1097
|
+
headerHeightPx: number;
|
|
1098
|
+
scrollHeightPx: number;
|
|
1099
|
+
footerHeightPx: number;
|
|
1100
|
+
dataSource: IKlesDataSource;
|
|
1101
|
+
columns: Signal<KlesColumnConfig[]>;
|
|
1102
|
+
displayedColumns: Signal<string[]> | undefined;
|
|
1103
|
+
showFooter: Signal<boolean>;
|
|
1104
|
+
multiTemplateDataRows: Signal<boolean>;
|
|
1105
|
+
extraRows: Signal<(ExtraRowConfig & {
|
|
1106
|
+
displayedColumns: string[];
|
|
1107
|
+
})[]>;
|
|
1108
|
+
private ro?;
|
|
1109
|
+
private readonly destroyRef;
|
|
1110
|
+
private rafId?;
|
|
1111
|
+
private _cleanup?;
|
|
1112
|
+
constructor(host: ElementRef<HTMLElement>, connectorService: KlesTableConnectorService, loader: ILoader<any>, datasourceService: IDatasourceService, tableService: ITableService, dragDropRowService: DragDropService, selectionService: ISelectionService, columnsService: ColumnsService, loadingService: LoadingService, paginatorService: PaginatorService, scrollbarService: ScrollbarService, footerService: FooterService, extraRowService: ExtraRowService, renderService: RenderService, sortService: ISortService, filterService: FilterService, expandedRowStore: ExpandedRowStore, rowFactory: RowFormFactory, eventsService: EventsService, rowService: RowService, cellService: CellService);
|
|
1113
|
+
get isLoadingClass(): boolean;
|
|
1114
|
+
get events(): EventsApi;
|
|
1115
|
+
get form(): FormApi;
|
|
1116
|
+
get scrollbar(): ScrollbarApi;
|
|
1117
|
+
get column(): ColumnApi;
|
|
1118
|
+
get pagination(): PaginationApi;
|
|
1119
|
+
get selection(): SelectionApi;
|
|
1120
|
+
get sort(): SortApi;
|
|
1121
|
+
get loading(): LoadingApi;
|
|
1122
|
+
get footer(): FooterApi$1;
|
|
1123
|
+
get ui(): GroupUiState<{
|
|
1124
|
+
header: GroupUiState;
|
|
1125
|
+
rows: ArrayUiState;
|
|
1126
|
+
footer: GroupUiState;
|
|
1127
|
+
}>;
|
|
1128
|
+
refresh(): void;
|
|
1129
|
+
ngOnInit(): void;
|
|
1130
|
+
ngAfterViewInit(): void;
|
|
1131
|
+
ngOnDestroy(): void;
|
|
1132
|
+
submit(): void;
|
|
1133
|
+
private calculHeaderHeight;
|
|
1134
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent, [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, null, null, null, null, null]>;
|
|
1135
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
interface KlesTableApi {
|
|
1139
|
+
refresh(): void;
|
|
1140
|
+
get scrollbar(): ScrollbarApi;
|
|
1141
|
+
get column(): ColumnApi;
|
|
1142
|
+
get pagination(): PaginationApi | undefined;
|
|
1143
|
+
get sort(): SortApi;
|
|
1144
|
+
get loading(): LoadingApi;
|
|
1145
|
+
get selection(): SelectionApi;
|
|
1146
|
+
get form(): FormApi;
|
|
1147
|
+
get footer(): FooterApi$1;
|
|
1148
|
+
get ui(): GroupUiState<{
|
|
1149
|
+
header: GroupUiState;
|
|
1150
|
+
rows: ArrayUiState;
|
|
1151
|
+
footer: GroupUiState;
|
|
1152
|
+
}>;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableApi {
|
|
1156
|
+
private connectorService;
|
|
1157
|
+
tableConfig: i0.InputSignal<KlesTableConfig>;
|
|
1158
|
+
private readonly destroyRef;
|
|
1159
|
+
tableEvent: EventEmitter<TableEvent<TValue>>;
|
|
1160
|
+
rowClick: EventEmitter<RowMousePayload<TValue>>;
|
|
1161
|
+
rowDoubleClick: EventEmitter<RowMousePayload<TValue>>;
|
|
1162
|
+
rowContextMenu: EventEmitter<RowMousePayload<TValue>>;
|
|
1163
|
+
cellClick: EventEmitter<CellMousePayload<TValue>>;
|
|
1164
|
+
cellValueChange: EventEmitter<CellValueChangePayload<TValue>>;
|
|
1165
|
+
constructor(connectorService: KlesTableConnectorService);
|
|
1166
|
+
ngOnInit(): void;
|
|
1167
|
+
get hostId(): string;
|
|
1168
|
+
refresh(): void;
|
|
1169
|
+
get scrollbar(): ScrollbarApi;
|
|
1170
|
+
get column(): ColumnApi;
|
|
1171
|
+
get pagination(): PaginationApi | undefined;
|
|
1172
|
+
get sort(): SortApi;
|
|
1173
|
+
get loading(): LoadingApi;
|
|
1174
|
+
get selection(): SelectionApi;
|
|
1175
|
+
get form(): FormApi;
|
|
1176
|
+
get footer(): FooterApi$1;
|
|
1177
|
+
get ui(): GroupUiState<{
|
|
1178
|
+
header: GroupUiState;
|
|
1179
|
+
rows: ArrayUiState;
|
|
1180
|
+
footer: GroupUiState;
|
|
1181
|
+
}>;
|
|
1182
|
+
private dispatchEvent;
|
|
1183
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableComponent<any>, never>;
|
|
1184
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<KlesTableComponent<any>, "kles-dynamic-table", never, { "tableConfig": { "alias": "tableConfig"; "required": true; "isSignal": true; }; }, { "tableEvent": "tableEvent"; "rowClick": "rowClick"; "rowDoubleClick": "rowDoubleClick"; "rowContextMenu": "rowContextMenu"; "cellClick": "cellClick"; "cellValueChange": "cellValueChange"; }, never, never, true, never>;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
declare class KlesMaterialTableModule {
|
|
1188
|
+
static declarations: any[][];
|
|
1189
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KlesMaterialTableModule, never>;
|
|
1190
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<KlesMaterialTableModule, never, [typeof i1.CommonModule, typeof TableComponent, typeof KlesTableComponent, typeof i4.KlesMaterialDynamicformsModule], [typeof KlesTableComponent]>;
|
|
1191
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<KlesMaterialTableModule>;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
declare const SELECTION_CONFIG: InjectionToken<SelectionConfig<any>>;
|
|
1195
|
+
declare const LOADER_CONFIG: InjectionToken<LoaderConfig<any, any>>;
|
|
1196
|
+
declare const COLUMNS: InjectionToken<WritableSignal<KlesColumnConfig[]>>;
|
|
1197
|
+
declare const FOOTER: InjectionToken<WritableSignal<boolean>>;
|
|
1198
|
+
declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
|
|
1199
|
+
declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
|
|
1200
|
+
declare const DRAG_DROP_CONFIG: InjectionToken<DragDropService>;
|
|
1201
|
+
declare const PAGINATOR_CONFIG: InjectionToken<PaginatorConfig>;
|
|
1202
|
+
declare const SORT_CONFIG: InjectionToken<Sort>;
|
|
1203
|
+
declare const HEADER_SERVICE: InjectionToken<IHeaderService>;
|
|
1204
|
+
declare const LOADER_SERVICE: InjectionToken<ILoader<any>>;
|
|
1205
|
+
declare const LINES_SERVICE: InjectionToken<ILinesService>;
|
|
1206
|
+
declare const DATASOURCE_SERVICE: InjectionToken<IDatasourceService>;
|
|
1207
|
+
declare const SELECTION_SERVICE: InjectionToken<ISelectionService>;
|
|
1208
|
+
declare const SORT_SERVICE: InjectionToken<ISortService>;
|
|
1209
|
+
declare const SCROLLBAR_ORCHESTRATOR_SERVICE: InjectionToken<IScrollbarOrchestratorService>;
|
|
1210
|
+
declare const TABLE_SERVICE: InjectionToken<ITableService>;
|
|
1211
|
+
|
|
1212
|
+
export { AlignCell, COLUMNS, DATASOURCE_SERVICE, DRAG_DROP_CONFIG, EXTRA_ROWS, FOOTER, HEADER_SERVICE, KlesMaterialTableModule, KlesTableComponent, LINES_SERVICE, LOADER_CONFIG, LOADER_SERVICE, PAGINATOR_CONFIG, ROW_DRAG_DROP, SCROLLBAR_ORCHESTRATOR_SERVICE, SELECTION_CONFIG, SELECTION_SERVICE, SORT_CONFIG, SORT_SERVICE, Span, TABLE_SERVICE, TableComponent, linesLazyLoader, linesLoader, selectionConfig };
|
|
1213
|
+
export type { DefaultTableConfig, DragDrop, DragDropConfig, ExtraRow, ExtraRowConfig, ExtraRowMode, IKlesCellFieldConfig, IKlesFooterFieldConfig, IKlesHeaderFieldConfig, ITable, InfiniteScrollConfig, KlesColumnConfig, KlesExtraCellFieldConfig, KlesTableApi, KlesTableConfig, LinesLazyLoader, LinesLoader, LoaderConfig, LoaderLazyResult, LoaderResult, NgStyleInput, PaginatorConfig, RowId, Selection, SelectionConfig };
|