@3kles/kles-material-table-v2 21.4.2 → 21.6.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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Signal, EventEmitter, Type, WritableSignal, OnInit, AfterViewInit, OnDestroy, ElementRef, InjectionToken } from '@angular/core';
2
+ import { Signal, EventEmitter, Type, WritableSignal, Injector, OnInit, AfterViewInit, OnDestroy, ElementRef, InjectionToken } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { FormControlStatus, FormGroup, FormArray, ValidatorFn, AsyncValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
4
+ import { FormGroup, FormControlStatus, FormArray, ValidatorFn, AsyncValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
5
5
  import { MatTableDataSource, MatTable } from '@angular/material/table';
6
6
  import * as i4 from '@3kles/kles-material-dynamicforms';
7
7
  import { IKlesFieldConfig, GroupUiState, ArrayUiState, AbstractUiState } from '@3kles/kles-material-dynamicforms';
@@ -10,6 +10,7 @@ import * as rxjs from 'rxjs';
10
10
  import { Observable, Subject } from 'rxjs';
11
11
  import { PageEvent, MatPaginatorIntl, MatPaginatorSelectConfig, MatPaginator } from '@angular/material/paginator';
12
12
  import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
13
+ import * as _3kles_kles_material_table_v2 from '@3kles/kles-material-table-v2';
13
14
  import { DataSource } from '@angular/cdk/table';
14
15
 
15
16
  declare enum AlignCell {
@@ -24,7 +25,9 @@ declare enum Span {
24
25
 
25
26
  type B = Omit<IKlesFieldConfig, 'name'>;
26
27
  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
+ type KlesStyleValue = string | number | null | undefined;
29
+ type KlesStyleMap = Record<string, KlesStyleValue>;
30
+ type NgStyleInput = KlesStyleMap | ((value?: unknown, status?: FormControlStatus, row?: Record<string, unknown>, rowStatus?: FormControlStatus) => KlesStyleMap);
28
31
  interface IStyle {
29
32
  ngStyle?: NgStyleInput;
30
33
  }
@@ -32,13 +35,16 @@ interface IKlesHeaderFieldConfig {
32
35
  field?: B;
33
36
  label?: string;
34
37
  tooltip?: string;
38
+ /** Displays the action used to clear this column's filter. */
35
39
  filterClearable?: boolean;
36
- filterPredicate?: (value: any, filter: any) => boolean;
37
- sortPredicate?: (data: any) => string | number;
40
+ /** Overrides the default filter predicate for this column. */
41
+ filterPredicate?: (value: unknown, filter: unknown) => boolean;
42
+ /** Overrides the default sorting value for this column. */
43
+ sortPredicate?: (data: FormGroup) => string | number;
38
44
  style?: IStyle;
39
45
  }
40
46
  interface IKlesCellFieldConfig {
41
- executeAfterChange?: (property?: string, row?: any, group?: FormGroup<any> | FormArray<any>) => Observable<any>;
47
+ executeAfterChange?: (property?: string, row?: unknown, group?: FormGroup | FormArray) => Observable<unknown>;
42
48
  style?: IStyle;
43
49
  field?: C;
44
50
  }
@@ -53,6 +59,7 @@ interface KlesExtraCellFieldConfig extends IKlesCellFieldConfig {
53
59
  }
54
60
 
55
61
  type ColumnSeparatorStyle = 'solid' | 'dashed' | 'dotted' | 'double';
62
+ type ColumnClass = string | string[] | Set<string> | Record<string, boolean | null | undefined>;
56
63
  interface ColumnSeparatorConfig {
57
64
  color?: string;
58
65
  width?: string;
@@ -69,7 +76,7 @@ interface KlesColumnConfig {
69
76
  visible?: boolean;
70
77
  visibleWhen?: Signal<boolean>;
71
78
  disabled?: boolean;
72
- ngClass?: any;
79
+ ngClass?: ColumnClass;
73
80
  filterable?: boolean;
74
81
  sortable?: boolean;
75
82
  sortArrowPosition?: SortHeaderArrowPosition;
@@ -87,6 +94,7 @@ interface KlesColumnConfig {
87
94
  }
88
95
 
89
96
  interface ColumnApi {
97
+ getVisible(): string[];
90
98
  setVisible(columnDef: string, visible: boolean): void;
91
99
  toggleVisible(columnDef: string): void;
92
100
  changeWidth(columnDef: string, options: {
@@ -94,27 +102,30 @@ interface ColumnApi {
94
102
  maxWidth?: string;
95
103
  minWidth?: string;
96
104
  }): void;
97
- setResizable(columnDef: string, resizable: boolean): any;
98
- toggleResizable(columnDef: string): any;
105
+ setResizable(columnDef: string, resizable: boolean): void;
106
+ toggleResizable(columnDef: string): void;
99
107
  setSticky(columnDef: string, options: {
100
108
  sticky?: boolean;
101
109
  stickyEnd?: boolean;
102
- }): any;
110
+ }): void;
103
111
  columns(): KlesColumnConfig[];
104
- setColumnPosition: (columnDef: any, position: number) => void;
112
+ setColumnPosition(columnDef: string, position: number): void;
105
113
  }
106
114
 
107
- interface FooterApi$1 {
115
+ interface FooterApi {
116
+ visible: Signal<boolean>;
108
117
  show(): void;
109
118
  hide(): void;
110
119
  }
111
120
 
112
121
  interface LoadingApi {
113
- start(): any;
114
- stop(): any;
122
+ active: Signal<boolean>;
123
+ start(): void;
124
+ stop(): void;
115
125
  }
116
126
 
117
127
  interface PaginationApi {
128
+ disabled: Signal<boolean>;
118
129
  setPageIndex(value: number): void;
119
130
  setPageSize(value: number): void;
120
131
  setPageSizeOptions(option: number[]): void;
@@ -126,6 +137,9 @@ interface PaginationApi {
126
137
  }
127
138
 
128
139
  interface ScrollbarApi {
140
+ setVisible(visible: boolean): void;
141
+ show(): void;
142
+ hide(): void;
129
143
  toTop(sb?: ScrollBehavior): void;
130
144
  toLeft(sb?: ScrollBehavior): void;
131
145
  toBottom(sb?: ScrollBehavior): void;
@@ -140,6 +154,21 @@ declare enum KlesSelectionModelState {
140
154
  }
141
155
 
142
156
  interface IKlesSelectionModel<T> {
157
+ readonly count: Signal<number>;
158
+ readonly changed: Observable<{
159
+ added?: T[];
160
+ removed?: T[];
161
+ count: number;
162
+ state: KlesSelectionModelState;
163
+ }>;
164
+ readonly stateChanged: Observable<KlesSelectionModelState>;
165
+ readonly selected: {
166
+ items: T[];
167
+ count: number;
168
+ state: KlesSelectionModelState;
169
+ };
170
+ readonly state: KlesSelectionModelState;
171
+ readonly selectionMode: boolean;
143
172
  select(value: T | T[], options?: {
144
173
  emitEvent?: boolean;
145
174
  }): void;
@@ -149,22 +178,15 @@ interface IKlesSelectionModel<T> {
149
178
  toggle(value: T, options?: {
150
179
  emitEvent?: boolean;
151
180
  }): void;
181
+ reset(values: T[], options?: {
182
+ emitEvent?: boolean;
183
+ }): void;
184
+ isSelected(value: T): boolean;
185
+ isMultipleSelection(): boolean;
152
186
  isEmpty(): boolean;
153
187
  hasValue(): boolean;
154
188
  disable(): void;
155
189
  enable(): void;
156
- get selected(): {
157
- items?: T[];
158
- count: number;
159
- state: KlesSelectionModelState;
160
- };
161
- get changed(): Observable<{
162
- added?: T[];
163
- removed?: T[];
164
- count: number;
165
- state: KlesSelectionModelState;
166
- }>;
167
- get state(): KlesSelectionModelState;
168
190
  }
169
191
 
170
192
  interface SelectionApi {
@@ -180,63 +202,51 @@ interface SortApi {
180
202
  sortChange(): EventEmitter<Sort>;
181
203
  }
182
204
 
183
- interface FormApi {
184
- header: HeaderApi;
185
- rows: RowsApi;
186
- footer: FooterApi;
205
+ type FormValue = Record<string, unknown>;
206
+ type TableFormValue<TValue> = TValue extends object ? TValue : FormValue;
207
+ interface FormApi<TRow = FormValue> {
208
+ header: HeaderFormApi;
209
+ rows: RowsFormApi<TRow>;
210
+ footer: FooterFormApi;
187
211
  }
188
212
  type Id = string | number;
189
- interface HeaderApi {
190
- setValue(value: {
191
- [key: string]: any;
192
- }, options?: {
213
+ interface HeaderFormApi {
214
+ setValue(value: FormValue, options?: {
193
215
  emitEvent?: boolean;
194
216
  onlySelf?: boolean;
195
217
  }): void;
196
- patchValue(value: {
197
- [key: string]: any;
198
- }, options?: {
218
+ patchValue(value: FormValue, options?: {
199
219
  emitEvent?: boolean;
200
220
  onlySelf?: boolean;
201
221
  }): void;
202
222
  get(): FormGroup;
203
- clear(value?: any, options?: {
223
+ clear(value?: unknown, options?: {
204
224
  emitEvent?: boolean;
205
225
  }): void;
206
226
  }
207
- interface FooterApi {
208
- setValue(value: {
209
- [key: string]: any;
210
- }, options?: {
227
+ interface FooterFormApi {
228
+ setValue(value: FormValue, options?: {
211
229
  emitEvent?: boolean;
212
230
  onlySelf?: boolean;
213
231
  }): void;
214
- patchValue(value: {
215
- [key: string]: any;
216
- }, options?: {
232
+ patchValue(value: FormValue, options?: {
217
233
  emitEvent?: boolean;
218
234
  onlySelf?: boolean;
219
235
  }): void;
220
236
  get(): FormGroup;
221
- clear(value?: any, options?: {
237
+ clear(value?: unknown, options?: {
222
238
  emitEvent?: boolean;
223
239
  }): void;
224
240
  }
225
- interface RowsApi {
226
- create(value: {
227
- [key: string]: any;
228
- }, index?: number, options?: {
241
+ interface RowsFormApi<TRow = FormValue> {
242
+ create(value: TRow, index?: number, options?: {
229
243
  emitEvent?: boolean;
230
244
  }): FormGroup;
231
- patch(_id: Id, value: {
232
- [key: string]: any;
233
- }, options?: {
245
+ patch(_id: Id, value: Partial<TRow>, options?: {
234
246
  emitEvent?: boolean;
235
247
  onlySelf?: boolean;
236
248
  }): FormGroup | undefined;
237
- reset(_id: Id, value?: {
238
- [key: string]: any;
239
- }, options?: {
249
+ reset(_id: Id, value?: TRow, options?: {
240
250
  emitEvent?: boolean;
241
251
  onlySelf?: boolean;
242
252
  overwriteDefaultValue?: boolean;
@@ -248,28 +258,6 @@ interface RowsApi {
248
258
  get(_id: Id): FormGroup | undefined;
249
259
  }
250
260
 
251
- interface EventsApi {
252
- listen(): Observable<any>;
253
- }
254
-
255
- interface ITable {
256
- scrollbar: ScrollbarApi;
257
- column: ColumnApi;
258
- pagination?: PaginationApi | undefined;
259
- selection: SelectionApi;
260
- sort: SortApi;
261
- footer: FooterApi$1;
262
- loading: LoadingApi;
263
- form: FormApi;
264
- events: EventsApi;
265
- ui: GroupUiState<{
266
- header: GroupUiState;
267
- rows: ArrayUiState;
268
- footer: GroupUiState;
269
- }>;
270
- refresh(): void;
271
- }
272
-
273
261
  type Pagination = {
274
262
  page: number;
275
263
  perPage: number;
@@ -281,6 +269,9 @@ type Query = {
281
269
  filters?: Filters;
282
270
  };
283
271
 
272
+ type LoaderCallback<TArgs extends unknown[], TResult> = {
273
+ bivarianceHack(...args: TArgs): TResult;
274
+ }['bivarianceHack'];
284
275
  type LoaderLazyResult<R> = Observable<{
285
276
  total: number;
286
277
  items: R[];
@@ -291,39 +282,42 @@ type LoaderLazyResult<R> = Observable<{
291
282
  type LoaderResult<R> = Observable<{
292
283
  items: R[];
293
284
  }>;
294
- type LinesLoaderDef<T, R> = {
285
+ type LinesLoaderDef<T, R, C> = {
295
286
  params?: () => Observable<T>;
296
- loader: (params: T) => LoaderResult<R>;
297
- hasChildren?: (parent: FormGroup, depth: number) => boolean;
298
- childrens?: (params: T, parent: FormGroup, depth: number) => LoaderResult<R>;
287
+ loader: LoaderCallback<[params: T], LoaderResult<R>>;
288
+ hasChildren?: LoaderCallback<[parent: FormGroup, depth: number], boolean>;
289
+ childrens?: LoaderCallback<[params: T, parent: FormGroup, depth: number], LoaderResult<C>>;
299
290
  };
300
- type LinesLazyLoaderDef<T, R> = {
291
+ type LinesLazyLoaderDef<T, R, C> = {
301
292
  params?: () => Observable<T>;
302
- loader: (params: T, query?: Query) => LoaderLazyResult<R>;
303
- hasChildren?: (parent: FormGroup, depth: number) => boolean;
304
- childrens?: (params: T, parent: FormGroup, depth: number, query?: Query) => LoaderLazyResult<R>;
293
+ loader: LoaderCallback<[params: T, query?: Query], LoaderLazyResult<R>>;
294
+ hasChildren?: LoaderCallback<[parent: FormGroup, depth: number], boolean>;
295
+ childrens?: LoaderCallback<[params: T, parent: FormGroup, depth: number, query?: Query], LoaderLazyResult<C>>;
305
296
  };
306
297
  type Brand$1<K extends string> = {
307
298
  readonly __brand: K;
308
299
  };
309
- type LinesLoader<T, R> = LinesLoaderDef<T, R> & Brand$1<'LinesLoader'>;
310
- type LinesLazyLoader<T, R> = LinesLazyLoaderDef<T, R> & Brand$1<'LinesLazyLoader'>;
311
- declare const linesLoader: <T, R>(l: LinesLoaderDef<T, R>) => LinesLoader<T, R>;
312
- declare const linesLazyLoader: <T, R>(l: LinesLazyLoaderDef<T, R>) => LinesLazyLoader<T, R>;
313
-
300
+ type LinesLoader<T, R, C = R> = LinesLoaderDef<T, R, C> & Brand$1<'LinesLoader'>;
301
+ type LinesLazyLoader<T, R, C = R> = LinesLazyLoaderDef<T, R, C> & Brand$1<'LinesLazyLoader'>;
302
+ declare const linesLoader: <T, R, C = R>(l: LinesLoaderDef<T, R, C>) => LinesLoader<T, R, C>;
303
+ declare const linesLazyLoader: <T, R, C = R>(l: LinesLazyLoaderDef<T, R, C>) => LinesLazyLoader<T, R, C>;
304
+
305
+ type SelectionCallback<TArgs extends unknown[], TResult> = {
306
+ bivarianceHack(...args: TArgs): TResult;
307
+ }['bivarianceHack'];
314
308
  type RowId = string | number;
315
309
  interface SelectionResponse {
316
310
  selected: boolean;
317
311
  count?: number;
318
312
  }
319
313
  interface SelectionAllResponse extends SelectionResponse {
320
- footer?: any;
314
+ footer?: unknown;
321
315
  }
322
316
  interface SelectionState {
323
317
  loading: boolean;
324
318
  success: boolean;
325
319
  selected?: boolean;
326
- footer?: any;
320
+ footer?: unknown;
327
321
  count?: number;
328
322
  error?: unknown;
329
323
  }
@@ -331,15 +325,20 @@ type SelectionConfigDef<T> = {
331
325
  selectionMode?: boolean;
332
326
  key?: string;
333
327
  params?: () => Observable<T>;
334
- select?: (params: T, row: FormGroup, selected: boolean, filters?: {
335
- [key: string]: any;
336
- }) => Observable<SelectionResponse>;
337
- selectAll?: (params: T, selected: boolean, filters?: {
338
- [key: string]: any;
339
- }) => Observable<SelectionAllResponse>;
340
- /** optionnel */
341
- /** pour indiquer le critère des lignes déja sélectionné */
328
+ select?: SelectionCallback<[
329
+ params: T,
330
+ row: FormGroup,
331
+ selected: boolean,
332
+ filters?: Record<string, unknown>
333
+ ], Observable<SelectionResponse>>;
334
+ selectAll?: SelectionCallback<[
335
+ params: T,
336
+ selected: boolean,
337
+ filters?: Record<string, unknown>
338
+ ], Observable<SelectionAllResponse>>;
339
+ /** Resolves the initial selected state of a row. */
342
340
  isSelected?: (row: FormGroup) => boolean;
341
+ /** Resolves whether selection must remain disabled for a row. */
343
342
  isDisabled?: (row: FormGroup) => boolean;
344
343
  };
345
344
  type Brand<K extends string> = {
@@ -365,7 +364,9 @@ interface EmptyStateConfig {
365
364
  interface DefaultTableConfig {
366
365
  id?: string;
367
366
  columns: KlesColumnConfig[];
367
+ /** Reserved for row-level validation configuration; not applied yet. */
368
368
  lineValidations?: ValidatorFn[];
369
+ /** Reserved for asynchronous row-level validation configuration; not applied yet. */
369
370
  lineAsyncValidations?: AsyncValidatorFn[];
370
371
  footer?: boolean;
371
372
  sortConfig?: Sort;
@@ -382,26 +383,49 @@ interface PaginatorConfig {
382
383
  selectConfig?: MatPaginatorSelectConfig;
383
384
  }
384
385
  interface InfiniteScrollConfig {
386
+ /** Reserved for the future infinite-scroll implementation. */
385
387
  infinite?: boolean;
386
388
  }
387
- interface DragDropConfig {
389
+ interface DragDropRowChange<TValue = unknown> extends DragDropRowContext<TValue> {
390
+ previousIndex: number;
391
+ currentIndex: number;
392
+ previousContainerId?: string;
393
+ currentContainerId?: string;
394
+ parentId?: string | number | null;
395
+ depth?: number;
396
+ previousSiblingIndex?: number;
397
+ currentSiblingIndex?: number;
398
+ movedRows?: FormGroup[];
399
+ movedRawValues?: TValue[];
400
+ }
401
+ interface DragDropConfig<TValue = unknown> {
388
402
  enable?: boolean;
389
403
  options?: {
404
+ /** Restricts row dragging to the dedicated handle rendered in the first visible column. */
405
+ handleOnly?: boolean;
390
406
  autoScrollStep?: number;
391
407
  connectedTo?: string[];
392
408
  dragDisabled?: (row: FormGroup) => boolean;
409
+ drop?: (change: DragDropRowChange<TValue>) => Observable<unknown>;
393
410
  dragPreview?: {
394
411
  matchSize?: boolean;
395
- component: Type<any>;
412
+ component: Type<unknown>;
396
413
  };
397
414
  dragPlaceholder?: {
398
- component: Type<any>;
415
+ component: Type<unknown>;
399
416
  };
400
417
  };
401
418
  }
402
- interface DragDrop {
403
- dragDropRows?: DragDropConfig;
404
- drapDropColumns?: DragDropConfig;
419
+ interface DragDropRowContext<TValue = unknown> {
420
+ row: FormGroup;
421
+ rowIndex: number;
422
+ value: Partial<TValue>;
423
+ rawValue: TValue;
424
+ }
425
+ interface DragDrop<TValue = unknown> {
426
+ dragDropRows?: DragDropConfig<TValue>;
427
+ /** Reserved for the future column drag-and-drop implementation. */
428
+ dragDropColumns?: DragDropConfig<TValue>;
405
429
  }
406
430
  type ExtraRowMode = 'expand' | 'always';
407
431
  interface ExtraRowConfig {
@@ -411,6 +435,7 @@ interface ExtraRowConfig {
411
435
  }
412
436
  interface ExtraRow {
413
437
  extraRows?: ExtraRowConfig[];
438
+ /** Allows several expandable data rows to remain open. Defaults to false. */
414
439
  multiUnfold?: boolean;
415
440
  }
416
441
  type LoaderConfig<T, R> = {
@@ -428,89 +453,9 @@ type Exclusive<T, U> = (T & {
428
453
  }) | (U & {
429
454
  [K in keyof T]?: never;
430
455
  });
431
- type KlesTableConfig<T = any, R = any> = DefaultTableConfig & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop & Selection<T> & ExtraRow;
432
-
433
- interface ITableStore {
434
- reset(): void;
435
- }
436
-
437
- declare class PaginatorStore implements ITableStore {
438
- protected config: PaginatorConfig;
439
- private s;
440
- page$: Observable<Pagination>;
441
- constructor(config: PaginatorConfig);
442
- setPage(v: Pagination): void;
443
- snapshot(): Pagination;
444
- reset(): void;
445
- static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorStore, [{ optional: true; }]>;
446
- static ɵprov: i0.ɵɵInjectableDeclaration<PaginatorStore>;
447
- }
448
-
449
- declare abstract class DragDropBase {
450
- protected config?: DragDropConfig;
451
- constructor(config?: DragDropConfig);
452
- get enable(): boolean;
453
- get autoScrollStep(): number | true;
454
- get connectedTo(): string[];
455
- get sortPredicate(): (index: number, item: CdkDrag<number>) => boolean;
456
- get previewComponent(): i0.Type<any>;
457
- get previewMatchSize(): true;
458
- abstract listDropped(event: CdkDragDrop<FormArray<FormGroup>>): void;
459
- }
460
- declare class DragDropService extends DragDropBase {
461
- protected config?: DragDropConfig;
462
- private paginatorStore?;
463
- constructor(config?: DragDropConfig, paginatorStore?: PaginatorStore | null);
464
- listDropped(event: CdkDragDrop<FormArray<FormGroup>>): void;
465
- static ɵfac: i0.ɵɵFactoryDeclaration<DragDropService, [{ optional: true; }, { optional: true; }]>;
466
- static ɵprov: i0.ɵɵInjectableDeclaration<DragDropService>;
467
- }
468
-
469
- declare class ScrollbarService {
470
- private element;
471
- private default;
472
- private readonly hiddenClass;
473
- register(el: HTMLElement): void;
474
- unregister(): void;
475
- setScrollbarVisible(visible: boolean): void;
476
- hideScrollbar(): void;
477
- showScrollbar(): void;
478
- toTop(sb?: ScrollBehavior): void;
479
- toBottom(sb?: ScrollBehavior): void;
480
- toLeft(sb?: ScrollBehavior): void;
481
- toRight(sb?: ScrollBehavior): void;
482
- to(top: number, left: number, sb?: ScrollBehavior): void;
483
- getTop(): number;
484
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollbarService, never>;
485
- static ɵprov: i0.ɵɵInjectableDeclaration<ScrollbarService>;
486
- }
487
-
488
- declare class KlesTableConnectorService {
489
- private _connected$;
490
- private _table?;
491
- readonly connected$: Observable<boolean>;
492
- constructor();
493
- connect(table: ITable): () => void;
494
- get table(): ITable;
495
- get scrollbar(): ScrollbarApi;
496
- get column(): ColumnApi;
497
- get pagination(): PaginationApi | undefined;
498
- get sort(): SortApi;
499
- get loading(): LoadingApi;
500
- get selection(): SelectionApi;
501
- get footer(): FooterApi$1;
502
- get form(): FormApi;
503
- get ui(): GroupUiState<{
504
- header: GroupUiState;
505
- rows: ArrayUiState;
506
- footer: GroupUiState;
507
- }>;
508
- get events(): EventsApi;
509
- refresh(): void;
510
- static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableConnectorService, never>;
511
- static ɵprov: i0.ɵɵInjectableDeclaration<KlesTableConnectorService>;
512
- }
456
+ type KlesTableConfig<T = unknown, R = unknown> = DefaultTableConfig & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop<R> & Selection<T> & ExtraRow;
513
457
 
458
+ type AggregationType = 'sum' | 'avg' | 'min' | 'max' | 'count';
514
459
  interface SortPayload {
515
460
  active: string;
516
461
  direction: SortDirection;
@@ -531,6 +476,18 @@ interface RowPayload<TValue = unknown> {
531
476
  interface RowMousePayload<TValue = unknown> extends RowPayload<TValue> {
532
477
  event: MouseEvent;
533
478
  }
479
+ interface RowActionClickPayload<TValue = unknown> extends RowPayload<TValue> {
480
+ actionKey: string;
481
+ event?: MouseEvent;
482
+ }
483
+ interface BulkActionClickPayload<TValue = unknown> {
484
+ actionKey: string;
485
+ selectedRows: FormGroup[];
486
+ selectedValues: Partial<TValue>[];
487
+ selectedRawValues: TValue[];
488
+ selectedCount: number;
489
+ event?: MouseEvent;
490
+ }
534
491
  /**
535
492
  * Payload de base pour une cellule.
536
493
  */
@@ -556,6 +513,36 @@ interface CellValueChangePayload<TValue = unknown> {
556
513
  value: Partial<TValue>;
557
514
  rawValue: TValue;
558
515
  }
516
+ /**
517
+ * Sélection.
518
+ */
519
+ interface SelectionChangePayload<TValue = unknown> {
520
+ selectedRows: FormGroup[];
521
+ selectedValues: Partial<TValue>[];
522
+ selectedRawValues: TValue[];
523
+ selectedCount: number;
524
+ addedRows?: FormGroup[];
525
+ removedRows?: FormGroup[];
526
+ allSelected?: boolean;
527
+ }
528
+ interface SelectionErrorPayload<TValue = unknown> {
529
+ error: unknown;
530
+ requestedSelected: boolean;
531
+ previousSelected: boolean;
532
+ row?: FormGroup;
533
+ rowIndex?: number;
534
+ value?: Partial<TValue>;
535
+ rawValue?: TValue;
536
+ }
537
+ interface LoadingChangePayload {
538
+ loading: boolean;
539
+ }
540
+ interface VisibilityChangePayload {
541
+ visible: boolean;
542
+ }
543
+ interface EmptyStateChangePayload {
544
+ enabled: boolean;
545
+ }
559
546
  /**
560
547
  * Pagination.
561
548
  */
@@ -577,6 +564,9 @@ interface FilterChangePayload {
577
564
  currentValue: unknown;
578
565
  };
579
566
  }
567
+ interface GlobalSearchPayload {
568
+ search: string;
569
+ }
580
570
  /**
581
571
  * Colonnes.
582
572
  */
@@ -601,11 +591,11 @@ interface ColumnVisibilityChangePayload {
601
591
  /**
602
592
  * Drag & drop.
603
593
  */
604
- interface RowDropPayload<TValue = unknown> extends RowPayload<TValue> {
605
- previousIndex: number;
606
- currentIndex: number;
607
- previousContainerId?: string;
608
- currentContainerId?: string;
594
+ interface RowDropPayload<TValue = unknown> extends DragDropRowChange<TValue> {
595
+ }
596
+ interface RowDropErrorPayload<TValue = unknown> {
597
+ change: RowDropPayload<TValue>;
598
+ error: unknown;
609
599
  }
610
600
  interface ColumnDropPayload {
611
601
  columnDef: string;
@@ -620,6 +610,8 @@ interface ExpansionPayload<TValue = unknown> extends RowPayload<TValue> {
620
610
  }
621
611
  interface TreePayload<TValue = unknown> extends RowPayload<TValue> {
622
612
  level: number;
613
+ children?: FormGroup[];
614
+ childValues?: TValue[];
623
615
  }
624
616
  /**
625
617
  * Lazy loading.
@@ -634,6 +626,33 @@ interface LoadErrorPayload {
634
626
  error: unknown;
635
627
  message?: string;
636
628
  }
629
+ /**
630
+ * État / vue.
631
+ */
632
+ interface StateChangePayload {
633
+ columns: string[];
634
+ filters: Record<string, unknown>;
635
+ sort?: SortPayload;
636
+ pageIndex?: number;
637
+ pageSize?: number;
638
+ }
639
+ /**
640
+ * Footer / résumé.
641
+ */
642
+ interface SummaryChangePayload {
643
+ columnDef: string;
644
+ value: unknown;
645
+ aggregation: AggregationType;
646
+ }
647
+ /**
648
+ * Validation.
649
+ */
650
+ interface RowValidatePayload<TValue = unknown> extends RowPayload<TValue> {
651
+ valid: boolean;
652
+ invalid: boolean;
653
+ errors: ValidationErrors | null;
654
+ controlsErrors: Record<string, ValidationErrors | null>;
655
+ }
637
656
  interface ValidationErrorPayload<TValue = unknown> {
638
657
  row?: FormGroup;
639
658
  rowIndex?: number;
@@ -665,6 +684,15 @@ interface TableEventMap<TValue = unknown> {
665
684
  cellDoubleClick: CellMousePayload<TValue>;
666
685
  cellContextMenu: CellMousePayload<TValue>;
667
686
  cellValueChange: CellValueChangePayload<TValue>;
687
+ /**
688
+ * Sélection
689
+ */
690
+ selectionChange: SelectionChangePayload<TValue>;
691
+ rowSelect: RowPayload<TValue>;
692
+ rowUnselect: RowPayload<TValue>;
693
+ selectAll: SelectionChangePayload<TValue>;
694
+ unselectAll: SelectionChangePayload<TValue>;
695
+ selectionError: SelectionErrorPayload<TValue>;
668
696
  /**
669
697
  * pagination
670
698
  */
@@ -692,17 +720,14 @@ interface TableEventMap<TValue = unknown> {
692
720
  rowDragMove: RowPayload<TValue>;
693
721
  rowDragEnd: RowPayload<TValue>;
694
722
  rowDrop: RowDropPayload<TValue>;
695
- columnDragStart: ColumnPayload;
696
- columnDragEnd: ColumnPayload;
697
- columnDrop: ColumnDropPayload;
723
+ rowDropSuccess: RowDropPayload<TValue>;
724
+ rowDropError: RowDropErrorPayload<TValue>;
698
725
  /**
699
726
  * Expansion / tree
700
727
  */
701
728
  rowExpand: ExpansionPayload<TValue>;
702
729
  rowCollapse: ExpansionPayload<TValue>;
703
730
  rowToggleExpand: ExpansionPayload<TValue>;
704
- expandAll: void;
705
- collapseAll: void;
706
731
  nodeExpand: TreePayload<TValue>;
707
732
  nodeCollapse: TreePayload<TValue>;
708
733
  nodeLoadChildren: TreePayload<TValue>;
@@ -714,6 +739,12 @@ interface TableEventMap<TValue = unknown> {
714
739
  loadSuccess: LoadSuccessPayload<TValue>;
715
740
  loadError: LoadErrorPayload;
716
741
  refresh: void;
742
+ /**
743
+ * États d'affichage
744
+ */
745
+ loadingChange: LoadingChangePayload;
746
+ footerVisibilityChange: VisibilityChangePayload;
747
+ emptyStateChange: EmptyStateChangePayload;
717
748
  /**
718
749
  * Error / validation
719
750
  */
@@ -732,6 +763,56 @@ type TableEvent<TValue = unknown> = {
732
763
  }[keyof TableEventMap<TValue>];
733
764
  type TableEventPayload<TValue, K extends keyof TableEventMap<TValue>> = TableEventMap<TValue>[K];
734
765
 
766
+ interface EventsApi<TValue = unknown> {
767
+ listen(): Observable<TableEvent<TValue>>;
768
+ }
769
+
770
+ interface EmptyStateApi {
771
+ enabled: Signal<boolean>;
772
+ enable(): void;
773
+ disable(): void;
774
+ toggle(): void;
775
+ }
776
+
777
+ interface RenderApi {
778
+ rows(): void;
779
+ }
780
+
781
+ type TreeNodeId = string | number;
782
+ interface TreeApi {
783
+ readonly expandedIds: Signal<ReadonlySet<TreeNodeId>>;
784
+ readonly loadingIds: Signal<ReadonlySet<TreeNodeId>>;
785
+ isExpanded(id: TreeNodeId): boolean;
786
+ isLoading(id: TreeNodeId): boolean;
787
+ getChildren(id: TreeNodeId): FormGroup[];
788
+ getDescendants(id: TreeNodeId): FormGroup[];
789
+ expand(id: TreeNodeId): void;
790
+ collapse(id: TreeNodeId): void;
791
+ toggle(id: TreeNodeId): void;
792
+ collapseAll(): void;
793
+ }
794
+
795
+ interface ITable {
796
+ scrollbar: ScrollbarApi;
797
+ column: ColumnApi;
798
+ pagination?: PaginationApi | undefined;
799
+ selection: SelectionApi;
800
+ sort: SortApi;
801
+ footer: FooterApi;
802
+ loading: LoadingApi;
803
+ form: FormApi;
804
+ events: EventsApi;
805
+ emptyState: EmptyStateApi;
806
+ render: RenderApi;
807
+ tree: TreeApi;
808
+ ui: GroupUiState<{
809
+ header: GroupUiState;
810
+ rows: ArrayUiState;
811
+ footer: GroupUiState;
812
+ }>;
813
+ refresh(): void;
814
+ }
815
+
735
816
  declare class EventsService<TValue = unknown> {
736
817
  private readonly eventsSubject;
737
818
  readonly events$: Observable<TableEvent<TValue>>;
@@ -783,36 +864,12 @@ declare class ColumnsService {
783
864
  static ɵprov: i0.ɵɵInjectableDeclaration<ColumnsService>;
784
865
  }
785
866
 
786
- declare class LoadingService {
787
- private _loading;
788
- get loading(): i0.Signal<boolean>;
789
- start(): void;
790
- stop(): void;
791
- static ɵfac: i0.ɵɵFactoryDeclaration<LoadingService, never>;
792
- static ɵprov: i0.ɵɵInjectableDeclaration<LoadingService>;
793
- }
794
-
795
- interface IKlesDataSource extends DataSource<FormGroup> {
796
- set data(data: any[]);
797
- get paginator(): MatPaginator | null | undefined;
798
- set paginator(paginator: MatPaginator | null | undefined);
799
- get sort(): MatSort | null | undefined;
800
- set sort(sort: MatSort | null | undefined);
801
- get filter(): string | undefined;
802
- set filter(f: string);
803
- connect(): Observable<readonly FormGroup[]>;
804
- }
805
-
806
- declare class KlesDataSource extends MatTableDataSource<FormGroup, MatPaginator> implements IKlesDataSource {
807
- constructor();
808
- }
809
-
810
867
  interface KlesRowContext<TSource = unknown> {
811
868
  source: TSource;
812
869
  _id: string | number;
813
870
  meta: {
814
871
  depth: number;
815
- parentId: string | null;
872
+ parentId: string | number | null;
816
873
  };
817
874
  }
818
875
 
@@ -828,11 +885,11 @@ declare class RowFormFactory {
828
885
  };
829
886
  createRow<TSource extends Record<string, any>>(fields: IKlesFieldConfig[], record: TSource, meta?: {
830
887
  depth: number;
831
- parentId: string | null;
888
+ parentId: string | number | null;
832
889
  }): KlesCreatedRow<TSource>;
833
890
  createRows<TSource extends Record<string, any>>(fields: IKlesFieldConfig[], records: TSource[], meta?: {
834
891
  depth: number;
835
- parentId: string | null;
892
+ parentId: string | number | null;
836
893
  }): KlesCreatedRow<TSource>[];
837
894
  static ɵfac: i0.ɵɵFactoryDeclaration<RowFormFactory, never>;
838
895
  static ɵprov: i0.ɵɵInjectableDeclaration<RowFormFactory>;
@@ -848,6 +905,13 @@ declare class RowContextStore {
848
905
  static ɵprov: i0.ɵɵInjectableDeclaration<RowContextStore>;
849
906
  }
850
907
 
908
+ interface KlesRowMoveResult {
909
+ previousIndex: number;
910
+ currentIndex: number;
911
+ previousSiblingIndex: number;
912
+ currentSiblingIndex: number;
913
+ movedRows: FormGroup[];
914
+ }
851
915
  declare class KlesForm {
852
916
  private columnsService;
853
917
  private rowFactory;
@@ -864,7 +928,9 @@ declare class KlesForm {
864
928
  }>;
865
929
  readonly uiStore: WeakMap<AbstractControl<any, any, any>, AbstractUiState<any, any>>;
866
930
  private readonly rowsStructureChangedSubject;
931
+ private readonly rowsReplacedSubject;
867
932
  readonly rowsStructureChanged$: rxjs.Observable<void>;
933
+ readonly rowsReplaced$: rxjs.Observable<void>;
868
934
  constructor(columnsService: ColumnsService, rowFactory: RowFormFactory, rowContextStore: RowContextStore);
869
935
  getRows(): FormArray<FormGroup>;
870
936
  getUiRows(): ArrayUiState;
@@ -881,6 +947,19 @@ declare class KlesForm {
881
947
  groupUi: GroupUiState;
882
948
  };
883
949
  insertRows(rows: KlesCreatedRow[], index?: number): void;
950
+ moveRow(row: FormGroup, targetRow: FormGroup): {
951
+ previousIndex: number;
952
+ currentIndex: number;
953
+ } | undefined;
954
+ canMoveSubtree(row: FormGroup, targetRow: FormGroup): boolean;
955
+ moveSubtree(row: FormGroup, targetRow: FormGroup): KlesRowMoveResult | undefined;
956
+ getSubtreeRows(row: FormGroup): FormGroup[];
957
+ private getSiblingIndex;
958
+ transferRowTo(target: KlesForm, row: FormGroup, targetRow?: FormGroup): {
959
+ previousIndex: number;
960
+ currentIndex: number;
961
+ } | undefined;
962
+ transferSubtreeTo(target: KlesForm, row: FormGroup, targetRow?: FormGroup): KlesRowMoveResult | undefined;
884
963
  updateRow(_id: number | string, value: any, options?: {
885
964
  emitEvent?: boolean;
886
965
  onlySelf?: boolean;
@@ -893,6 +972,9 @@ declare class KlesForm {
893
972
  deleteRowById(id: number | string, option?: {
894
973
  emitEvent?: boolean;
895
974
  }): void;
975
+ deleteRowsByIds(ids: ReadonlyArray<number | string>, option?: {
976
+ emitEvent?: boolean;
977
+ }): void;
896
978
  setHeaderControl(name: string, header: AbstractControl, options?: {
897
979
  emitEvent?: false;
898
980
  }): void;
@@ -908,6 +990,134 @@ declare class KlesForm {
908
990
  static ɵprov: i0.ɵɵInjectableDeclaration<KlesForm>;
909
991
  }
910
992
 
993
+ declare abstract class DragDropBase {
994
+ protected config: DragDropConfig | undefined;
995
+ protected readonly eventsService: EventsService;
996
+ protected readonly klesForm: KlesForm;
997
+ protected readonly injector: Injector;
998
+ private static nextDropListId;
999
+ readonly dropListId: string;
1000
+ constructor(config: DragDropConfig | undefined, eventsService: EventsService, klesForm: KlesForm, injector: Injector, tableId?: string);
1001
+ get enable(): boolean;
1002
+ get handleOnly(): boolean;
1003
+ get autoScrollStep(): number;
1004
+ get connectedTo(): string[];
1005
+ get sortPredicate(): (index: number, item: CdkDrag<FormGroup>) => boolean;
1006
+ get previewComponent(): i0.Type<unknown>;
1007
+ get previewMatchSize(): boolean;
1008
+ get placeholderComponent(): i0.Type<unknown>;
1009
+ isDragDisabled(row: FormGroup): boolean;
1010
+ componentInjector(row: FormGroup, rowIndex: number): Injector;
1011
+ abstract listDropped(event: CdkDragDrop<KlesForm>): void;
1012
+ rowDragStarted(row: FormGroup, rowIndex: number): void;
1013
+ rowDragMoved(row: FormGroup, rowIndex: number): void;
1014
+ rowDragEnded(row: FormGroup, rowIndex: number): void;
1015
+ protected rowPayload(row: FormGroup, rowIndex: number): {
1016
+ row: FormGroup<any>;
1017
+ rowIndex: number;
1018
+ value: any;
1019
+ rawValue: any;
1020
+ };
1021
+ protected reorder(event: CdkDragDrop<KlesForm>): void;
1022
+ protected transfer(event: CdkDragDrop<KlesForm>): void;
1023
+ private handleDrop;
1024
+ private toDropListId;
1025
+ }
1026
+ declare class DragDropService extends DragDropBase {
1027
+ constructor(config: DragDropConfig | undefined, eventsService: EventsService, klesForm: KlesForm, injector: Injector, tableId?: string);
1028
+ listDropped(event: CdkDragDrop<KlesForm>): void;
1029
+ }
1030
+
1031
+ declare class ScrollbarService {
1032
+ private element;
1033
+ private default;
1034
+ private readonly hiddenClass;
1035
+ register(el: HTMLElement): void;
1036
+ unregister(): void;
1037
+ setScrollbarVisible(visible: boolean): void;
1038
+ hideScrollbar(): void;
1039
+ showScrollbar(): void;
1040
+ toTop(sb?: ScrollBehavior): void;
1041
+ toBottom(sb?: ScrollBehavior): void;
1042
+ toLeft(sb?: ScrollBehavior): void;
1043
+ toRight(sb?: ScrollBehavior): void;
1044
+ to(top: number, left: number, sb?: ScrollBehavior): void;
1045
+ getTop(): number;
1046
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollbarService, never>;
1047
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollbarService>;
1048
+ }
1049
+
1050
+ declare class KlesTableConnectorService {
1051
+ private _connected$;
1052
+ private _table?;
1053
+ readonly connected$: Observable<boolean>;
1054
+ constructor();
1055
+ connect(table: ITable): () => void;
1056
+ get table(): ITable;
1057
+ get scrollbar(): ScrollbarApi;
1058
+ get column(): ColumnApi;
1059
+ get pagination(): PaginationApi | undefined;
1060
+ get sort(): SortApi;
1061
+ get loading(): LoadingApi;
1062
+ get selection(): SelectionApi;
1063
+ get footer(): FooterApi;
1064
+ get form(): _3kles_kles_material_table_v2.FormApi<_3kles_kles_material_table_v2.FormValue>;
1065
+ get ui(): GroupUiState<{
1066
+ header: GroupUiState;
1067
+ rows: ArrayUiState;
1068
+ footer: GroupUiState;
1069
+ }>;
1070
+ get events(): EventsApi;
1071
+ get emptyState(): EmptyStateApi;
1072
+ get render(): RenderApi;
1073
+ get tree(): TreeApi;
1074
+ refresh(): void;
1075
+ static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableConnectorService, never>;
1076
+ static ɵprov: i0.ɵɵInjectableDeclaration<KlesTableConnectorService>;
1077
+ }
1078
+
1079
+ declare class LoadingService {
1080
+ private readonly eventsService;
1081
+ private _loading;
1082
+ constructor(eventsService: EventsService);
1083
+ get loading(): i0.Signal<boolean>;
1084
+ start(): void;
1085
+ stop(): void;
1086
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoadingService, never>;
1087
+ static ɵprov: i0.ɵɵInjectableDeclaration<LoadingService>;
1088
+ }
1089
+
1090
+ interface ITableStore {
1091
+ reset(): void;
1092
+ }
1093
+
1094
+ declare class PaginatorStore implements ITableStore {
1095
+ protected config: PaginatorConfig;
1096
+ private s;
1097
+ page$: Observable<Pagination>;
1098
+ constructor(config: PaginatorConfig);
1099
+ setPage(v: Pagination): void;
1100
+ snapshot(): Pagination;
1101
+ reset(): void;
1102
+ static ɵfac: i0.ɵɵFactoryDeclaration<PaginatorStore, [{ optional: true; }]>;
1103
+ static ɵprov: i0.ɵɵInjectableDeclaration<PaginatorStore>;
1104
+ }
1105
+
1106
+ interface IKlesDataSource extends DataSource<FormGroup> {
1107
+ set data(data: unknown[]);
1108
+ get paginator(): MatPaginator | null | undefined;
1109
+ set paginator(paginator: MatPaginator | null | undefined);
1110
+ get sort(): MatSort | null | undefined;
1111
+ set sort(sort: MatSort | null | undefined);
1112
+ get filter(): string | undefined;
1113
+ set filter(f: string);
1114
+ connect(): Observable<readonly FormGroup[]>;
1115
+ }
1116
+
1117
+ declare class KlesDataSource extends MatTableDataSource<FormGroup, MatPaginator> implements IKlesDataSource {
1118
+ constructor();
1119
+ }
1120
+
911
1121
  declare class CellValueChangeService {
912
1122
  private readonly eventsService;
913
1123
  private readonly destroyRef;
@@ -1013,8 +1223,8 @@ interface ILoader<R> {
1013
1223
  total: number;
1014
1224
  items: R[];
1015
1225
  loading: boolean;
1016
- error?: any;
1017
- header?: any;
1226
+ error?: unknown;
1227
+ header?: Record<string, unknown>;
1018
1228
  }>;
1019
1229
  refresh(): void;
1020
1230
  }
@@ -1023,15 +1233,18 @@ interface IHeaderService {
1023
1233
  register(): void;
1024
1234
  }
1025
1235
 
1236
+ type ExpandedRowId = string | number;
1026
1237
  declare class ExpandedRowStore implements ITableStore {
1238
+ private readonly multiUnfold;
1027
1239
  private readonly _expandedIds$;
1028
- readonly expandedIds$: rxjs.Observable<Set<string>>;
1240
+ readonly expandedIds$: rxjs.Observable<Set<ExpandedRowId>>;
1241
+ constructor(multiUnfold?: boolean);
1029
1242
  reset(): void;
1030
- isExpanded(id: string): boolean;
1031
- get expandedIds(): ReadonlySet<string>;
1032
- expand(id: string): void;
1033
- collapse(id: string): void;
1034
- toggle(id: string): void;
1243
+ isExpanded(id: ExpandedRowId): boolean;
1244
+ get expandedIds(): ReadonlySet<ExpandedRowId>;
1245
+ expand(id: ExpandedRowId): void;
1246
+ collapse(id: ExpandedRowId): void;
1247
+ toggle(id: ExpandedRowId): void;
1035
1248
  static ɵfac: i0.ɵɵFactoryDeclaration<ExpandedRowStore, never>;
1036
1249
  static ɵprov: i0.ɵɵInjectableDeclaration<ExpandedRowStore>;
1037
1250
  }
@@ -1044,7 +1257,7 @@ declare class ExtraRowService {
1044
1257
  displayedColumns: string[];
1045
1258
  })[]>;
1046
1259
  constructor(_extraRowsConfig: WritableSignal<ExtraRowConfig[]>, expandedRowStore: ExpandedRowStore);
1047
- extraColumns(): KlesExtraCellFieldConfig[];
1260
+ extraFields(): IKlesFieldConfig[];
1048
1261
  private createWhen;
1049
1262
  static ɵfac: i0.ɵɵFactoryDeclaration<ExtraRowService, never>;
1050
1263
  static ɵprov: i0.ɵɵInjectableDeclaration<ExtraRowService>;
@@ -1062,6 +1275,8 @@ interface ISelectionService {
1062
1275
  selectionMode: boolean;
1063
1276
  register(): void;
1064
1277
  selectionModel?: IKlesSelectionModel<FormGroup>;
1278
+ readonly loadingRows: Signal<ReadonlySet<FormGroup>>;
1279
+ isLoading(row: FormGroup): boolean;
1065
1280
  count(): Signal<number>;
1066
1281
  disable(): void;
1067
1282
  enable(): void;
@@ -1088,7 +1303,8 @@ interface ITableService {
1088
1303
 
1089
1304
  declare class FooterService {
1090
1305
  private _footer;
1091
- constructor(_footer: WritableSignal<boolean>);
1306
+ private readonly eventsService;
1307
+ constructor(_footer: WritableSignal<boolean>, eventsService: EventsService);
1092
1308
  get footer(): Signal<boolean>;
1093
1309
  show(): void;
1094
1310
  hide(): void;
@@ -1136,10 +1352,11 @@ declare class KlesTableEmptyStateComponent {
1136
1352
  }
1137
1353
 
1138
1354
  declare class EmptyStateService {
1355
+ private readonly eventsService;
1139
1356
  private readonly _enabled;
1140
1357
  readonly enabled: i0.Signal<boolean>;
1141
1358
  readonly component: Type<unknown>;
1142
- constructor(config: boolean | EmptyStateConfig | undefined);
1359
+ constructor(config: boolean | EmptyStateConfig | undefined, eventsService: EventsService);
1143
1360
  enable(): void;
1144
1361
  disable(): void;
1145
1362
  toggle(): void;
@@ -1147,6 +1364,38 @@ declare class EmptyStateService {
1147
1364
  static ɵprov: i0.ɵɵInjectableDeclaration<EmptyStateService>;
1148
1365
  }
1149
1366
 
1367
+ declare class TreeService<T, R> {
1368
+ private readonly loaderConfig;
1369
+ private readonly loaderChildrensService;
1370
+ private readonly fm;
1371
+ private readonly columnsService;
1372
+ private readonly rowFactory;
1373
+ private readonly eventsService;
1374
+ private readonly destroyRef;
1375
+ private readonly expandedSubject;
1376
+ readonly expandedIds$: rxjs.Observable<Set<TreeNodeId>>;
1377
+ readonly expandedIds: i0.WritableSignal<ReadonlySet<TreeNodeId>>;
1378
+ readonly loadingIds: i0.WritableSignal<ReadonlySet<TreeNodeId>>;
1379
+ constructor();
1380
+ toggle(id: TreeNodeId, group?: FormGroup, depth?: number): void;
1381
+ expand(id: TreeNodeId, group?: FormGroup, depth?: number): void;
1382
+ collapse(id: TreeNodeId, group?: FormGroup, depth?: number): void;
1383
+ collapseAll(): void;
1384
+ reset(): void;
1385
+ isExpanded(id: TreeNodeId): boolean;
1386
+ isLoading(id: TreeNodeId): boolean;
1387
+ getChildren(id: TreeNodeId): FormGroup[];
1388
+ getDescendants(id: TreeNodeId): FormGroup[];
1389
+ hasChildren(group: FormGroup, depth: number): boolean;
1390
+ private findRow;
1391
+ private setExpanded;
1392
+ private publishExpanded;
1393
+ private setLoading;
1394
+ private rowPayload;
1395
+ static ɵfac: i0.ɵɵFactoryDeclaration<TreeService<any, any>, never>;
1396
+ static ɵprov: i0.ɵɵInjectableDeclaration<TreeService<any, any>>;
1397
+ }
1398
+
1150
1399
  type TableSection = 'header' | 'body' | 'footer';
1151
1400
  declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy {
1152
1401
  private readonly host;
@@ -1155,7 +1404,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1155
1404
  private readonly datasourceService;
1156
1405
  readonly tableService: ITableService;
1157
1406
  readonly dragDropRowService: DragDropService;
1158
- private readonly selectionService;
1407
+ readonly selectionService: ISelectionService;
1159
1408
  readonly columnsService: ColumnsService;
1160
1409
  readonly loadingService: LoadingService;
1161
1410
  private readonly paginatorService;
@@ -1171,6 +1420,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1171
1420
  readonly rowService: RowService;
1172
1421
  readonly cellService: CellService;
1173
1422
  readonly emptyStateService: EmptyStateService;
1423
+ private readonly treeService;
1174
1424
  table: MatTable<FormGroup>;
1175
1425
  matSort: MatSort;
1176
1426
  formElemRef: ElementRef<HTMLElement>;
@@ -1191,10 +1441,13 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1191
1441
  private rafId?;
1192
1442
  private _cleanup?;
1193
1443
  emptyStateComponent: typeof KlesTableEmptyStateComponent;
1194
- 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, emptyStateService: EmptyStateService);
1444
+ constructor(host: ElementRef<HTMLElement>, connectorService: KlesTableConnectorService, loader: ILoader<unknown>, 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, emptyStateService: EmptyStateService, treeService: TreeService<unknown, unknown>);
1195
1445
  get isLoadingClass(): boolean;
1196
1446
  get isEmptyClass(): boolean;
1197
1447
  get events(): EventsApi;
1448
+ get emptyState(): EmptyStateApi;
1449
+ get render(): RenderApi;
1450
+ get tree(): TreeApi;
1198
1451
  get form(): FormApi;
1199
1452
  get scrollbar(): ScrollbarApi;
1200
1453
  get column(): ColumnApi;
@@ -1202,27 +1455,27 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1202
1455
  get selection(): SelectionApi;
1203
1456
  get sort(): SortApi;
1204
1457
  get loading(): LoadingApi;
1205
- get footer(): FooterApi$1;
1458
+ get footer(): FooterApi;
1206
1459
  get ui(): GroupUiState<{
1207
1460
  header: GroupUiState;
1208
1461
  rows: ArrayUiState;
1209
1462
  footer: GroupUiState;
1210
1463
  }>;
1211
1464
  refresh(): void;
1465
+ private rowEventPayload;
1212
1466
  ngOnInit(): void;
1213
1467
  ngAfterViewInit(): void;
1214
1468
  ngOnDestroy(): void;
1215
- submit(): void;
1216
1469
  getColumnSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1217
1470
  getStickyStartSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1218
1471
  getStickyEndSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1219
1472
  private getSeparatorStyle;
1220
1473
  private calculHeaderHeight;
1221
- 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, null]>;
1474
+ 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, null, null]>;
1222
1475
  static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
1223
1476
  }
1224
1477
 
1225
- interface KlesTableApi {
1478
+ interface KlesTableApi<TValue = unknown> {
1226
1479
  refresh(): void;
1227
1480
  get scrollbar(): ScrollbarApi;
1228
1481
  get column(): ColumnApi;
@@ -1230,8 +1483,12 @@ interface KlesTableApi {
1230
1483
  get sort(): SortApi;
1231
1484
  get loading(): LoadingApi;
1232
1485
  get selection(): SelectionApi;
1233
- get form(): FormApi;
1234
- get footer(): FooterApi$1;
1486
+ get form(): FormApi<TableFormValue<TValue>>;
1487
+ get footer(): FooterApi;
1488
+ get emptyState(): EmptyStateApi;
1489
+ get render(): RenderApi;
1490
+ get tree(): TreeApi;
1491
+ get events(): EventsApi<TValue>;
1235
1492
  get ui(): GroupUiState<{
1236
1493
  header: GroupUiState;
1237
1494
  rows: ArrayUiState;
@@ -1239,7 +1496,7 @@ interface KlesTableApi {
1239
1496
  }>;
1240
1497
  }
1241
1498
 
1242
- declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableApi {
1499
+ declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableApi<TValue> {
1243
1500
  private connectorService;
1244
1501
  tableConfig: i0.InputSignal<KlesTableConfig>;
1245
1502
  private readonly destroyRef;
@@ -1247,8 +1504,25 @@ declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableA
1247
1504
  rowClick: EventEmitter<RowMousePayload<TValue>>;
1248
1505
  rowDoubleClick: EventEmitter<RowMousePayload<TValue>>;
1249
1506
  rowContextMenu: EventEmitter<RowMousePayload<TValue>>;
1507
+ rowMouseEnter: EventEmitter<RowMousePayload<TValue>>;
1508
+ rowMouseLeave: EventEmitter<RowMousePayload<TValue>>;
1509
+ rowDrop: EventEmitter<RowDropPayload<TValue>>;
1510
+ rowDropSuccess: EventEmitter<RowDropPayload<TValue>>;
1511
+ rowDropError: EventEmitter<RowDropErrorPayload<TValue>>;
1250
1512
  cellClick: EventEmitter<CellMousePayload<TValue>>;
1513
+ cellDoubleClick: EventEmitter<CellMousePayload<TValue>>;
1514
+ cellContextMenu: EventEmitter<CellMousePayload<TValue>>;
1251
1515
  cellValueChange: EventEmitter<CellValueChangePayload<TValue>>;
1516
+ selectionChange: EventEmitter<SelectionChangePayload<TValue>>;
1517
+ selectionError: EventEmitter<SelectionErrorPayload<TValue>>;
1518
+ pageChange: EventEmitter<PageChangePayload>;
1519
+ sortChange: EventEmitter<SortPayload>;
1520
+ filterChange: EventEmitter<FilterChangePayload>;
1521
+ loadError: EventEmitter<LoadErrorPayload>;
1522
+ nodeExpand: EventEmitter<TreePayload<TValue>>;
1523
+ nodeCollapse: EventEmitter<TreePayload<TValue>>;
1524
+ nodeLoadChildren: EventEmitter<TreePayload<TValue>>;
1525
+ nodeChildrenLoaded: EventEmitter<TreePayload<TValue>>;
1252
1526
  readonly elevationShadow: i0.Signal<string>;
1253
1527
  constructor(connectorService: KlesTableConnectorService);
1254
1528
  ngOnInit(): void;
@@ -1260,8 +1534,12 @@ declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableA
1260
1534
  get sort(): SortApi;
1261
1535
  get loading(): LoadingApi;
1262
1536
  get selection(): SelectionApi;
1263
- get form(): FormApi;
1264
- get footer(): FooterApi$1;
1537
+ get form(): FormApi<TableFormValue<TValue>>;
1538
+ get footer(): FooterApi;
1539
+ get emptyState(): EmptyStateApi;
1540
+ get render(): RenderApi;
1541
+ get events(): EventsApi<TValue>;
1542
+ get tree(): TreeApi;
1265
1543
  get ui(): GroupUiState<{
1266
1544
  header: GroupUiState;
1267
1545
  rows: ArrayUiState;
@@ -1269,7 +1547,7 @@ declare class KlesTableComponent<TValue = unknown> implements OnInit, KlesTableA
1269
1547
  }>;
1270
1548
  private dispatchEvent;
1271
1549
  static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableComponent<any>, never>;
1272
- 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>;
1550
+ 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"; "rowMouseEnter": "rowMouseEnter"; "rowMouseLeave": "rowMouseLeave"; "rowDrop": "rowDrop"; "rowDropSuccess": "rowDropSuccess"; "rowDropError": "rowDropError"; "cellClick": "cellClick"; "cellDoubleClick": "cellDoubleClick"; "cellContextMenu": "cellContextMenu"; "cellValueChange": "cellValueChange"; "selectionChange": "selectionChange"; "selectionError": "selectionError"; "pageChange": "pageChange"; "sortChange": "sortChange"; "filterChange": "filterChange"; "loadError": "loadError"; "nodeExpand": "nodeExpand"; "nodeCollapse": "nodeCollapse"; "nodeLoadChildren": "nodeLoadChildren"; "nodeChildrenLoaded": "nodeChildrenLoaded"; }, never, never, true, never>;
1273
1551
  }
1274
1552
 
1275
1553
  declare class KlesMaterialTableModule {
@@ -1279,17 +1557,19 @@ declare class KlesMaterialTableModule {
1279
1557
  static ɵinj: i0.ɵɵInjectorDeclaration<KlesMaterialTableModule>;
1280
1558
  }
1281
1559
 
1282
- declare const SELECTION_CONFIG: InjectionToken<SelectionConfig<any>>;
1283
- declare const LOADER_CONFIG: InjectionToken<LoaderConfig<any, any>>;
1560
+ declare const SELECTION_CONFIG: InjectionToken<SelectionConfig<unknown>>;
1561
+ declare const LOADER_CONFIG: InjectionToken<LoaderConfig<unknown, unknown>>;
1284
1562
  declare const COLUMNS: InjectionToken<WritableSignal<KlesColumnConfig[]>>;
1285
1563
  declare const FOOTER: InjectionToken<WritableSignal<boolean>>;
1286
1564
  declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
1565
+ declare const MULTI_UNFOLD: InjectionToken<boolean>;
1287
1566
  declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
1288
- declare const DRAG_DROP_CONFIG: InjectionToken<DragDropService>;
1567
+ declare const DRAG_DROP_CONFIG: InjectionToken<DragDropConfig<unknown>>;
1568
+ declare const KLES_DRAG_DROP_ROW_CONTEXT: InjectionToken<DragDropRowContext<unknown>>;
1289
1569
  declare const PAGINATOR_CONFIG: InjectionToken<PaginatorConfig>;
1290
1570
  declare const SORT_CONFIG: InjectionToken<Sort>;
1291
1571
  declare const HEADER_SERVICE: InjectionToken<IHeaderService>;
1292
- declare const LOADER_SERVICE: InjectionToken<ILoader<any>>;
1572
+ declare const LOADER_SERVICE: InjectionToken<ILoader<unknown>>;
1293
1573
  declare const LINES_SERVICE: InjectionToken<ILinesService>;
1294
1574
  declare const DATASOURCE_SERVICE: InjectionToken<IDatasourceService>;
1295
1575
  declare const SELECTION_SERVICE: InjectionToken<ISelectionService>;
@@ -1298,5 +1578,5 @@ declare const SCROLLBAR_ORCHESTRATOR_SERVICE: InjectionToken<IScrollbarOrchestra
1298
1578
  declare const TABLE_SERVICE: InjectionToken<ITableService>;
1299
1579
  declare const EMPTY_STATE_CONFIG: InjectionToken<boolean | EmptyStateConfig>;
1300
1580
 
1301
- export { AlignCell, COLUMNS, DATASOURCE_SERVICE, DRAG_DROP_CONFIG, EMPTY_STATE_CONFIG, EXTRA_ROWS, FOOTER, HEADER_SERVICE, KlesMaterialTableModule, KlesTableComponent, KlesTableEmptyStateComponent, KlesTableIntl, 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 };
1302
- export type { ColumnSeparatorConfig, ColumnSeparatorStyle, DefaultTableConfig, DragDrop, DragDropConfig, EmptyStateConfig, ExtraRow, ExtraRowConfig, ExtraRowMode, IKlesCellFieldConfig, IKlesFooterFieldConfig, IKlesHeaderFieldConfig, ITable, InfiniteScrollConfig, KlesColumnConfig, KlesExtraCellFieldConfig, KlesTableApi, KlesTableConfig, LinesLazyLoader, LinesLoader, LoaderConfig, LoaderLazyResult, LoaderResult, NgStyleInput, PaginatorConfig, RowId, Selection, SelectionAllResponse, SelectionConfig, SelectionResponse, SelectionState, TableElevationLevel };
1581
+ export { AlignCell, COLUMNS, DATASOURCE_SERVICE, DRAG_DROP_CONFIG, EMPTY_STATE_CONFIG, EXTRA_ROWS, FOOTER, HEADER_SERVICE, KLES_DRAG_DROP_ROW_CONTEXT, KlesMaterialTableModule, KlesTableComponent, KlesTableEmptyStateComponent, KlesTableIntl, LINES_SERVICE, LOADER_CONFIG, LOADER_SERVICE, MULTI_UNFOLD, PAGINATOR_CONFIG, ROW_DRAG_DROP, SCROLLBAR_ORCHESTRATOR_SERVICE, SELECTION_CONFIG, SELECTION_SERVICE, SORT_CONFIG, SORT_SERVICE, Span, TABLE_SERVICE, TableComponent, linesLazyLoader, linesLoader, selectionConfig };
1582
+ export type { AggregationType, BulkActionClickPayload, CellMousePayload, CellPayload, CellValueChangePayload, ColumnApi, ColumnClass, ColumnDropPayload, ColumnOrderChangePayload, ColumnPayload, ColumnResizePayload, ColumnSeparatorConfig, ColumnSeparatorStyle, ColumnVisibilityChangePayload, DefaultTableConfig, DragDrop, DragDropConfig, DragDropRowChange, DragDropRowContext, EmptyStateApi, EmptyStateChangePayload, EmptyStateConfig, EventsApi, ExpansionPayload, ExtraRow, ExtraRowConfig, ExtraRowMode, FilterChangePayload, FooterApi, FooterFormApi, FormApi, FormValue, GlobalSearchPayload, HeaderFormApi, IKlesCellFieldConfig, IKlesFooterFieldConfig, IKlesHeaderFieldConfig, ITable, InfiniteScrollConfig, KlesColumnConfig, KlesExtraCellFieldConfig, KlesStyleMap, KlesStyleValue, KlesTableApi, KlesTableConfig, LinesLazyLoader, LinesLoader, LoadErrorPayload, LoadSuccessPayload, LoaderConfig, LoaderLazyResult, LoaderResult, LoadingApi, LoadingChangePayload, NgStyleInput, PageChangePayload, PaginationApi, PaginatorConfig, RenderApi, RowActionClickPayload, RowDropErrorPayload, RowDropPayload, RowId, RowMousePayload, RowPayload, RowValidatePayload, RowsFormApi, ScrollbarApi, Selection, SelectionAllResponse, SelectionApi, SelectionChangePayload, SelectionConfig, SelectionErrorPayload, SelectionResponse, SelectionState, SortApi, SortPayload, StateChangePayload, SummaryChangePayload, TableElevationLevel, TableEvent, TableEventMap, TableEventPayload, TableEventType, TableFormValue, TreeApi, TreeNodeId, TreePayload, ValidationErrorPayload, VisibilityChangePayload };