@3kles/kles-material-table-v2 21.9.0 → 21.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3kles/kles-material-table-v2",
3
- "version": "21.9.0",
3
+ "version": "21.10.0",
4
4
  "keywords": [
5
5
  "3KLES"
6
6
  ],
@@ -3,7 +3,7 @@ import { Signal, EventEmitter, Type, WritableSignal, Injector, OnInit, AfterView
3
3
  import * as i1 from '@angular/common';
4
4
  import { FormGroup, FormControlStatus, FormArray, ValidatorFn, AsyncValidatorFn, AbstractControl, ValidationErrors } from '@angular/forms';
5
5
  import { MatTableDataSource, MatTable } from '@angular/material/table';
6
- import * as i4 from '@3kles/kles-material-dynamicforms';
6
+ import * as i5 from '@3kles/kles-material-dynamicforms';
7
7
  import { IKlesFieldConfig, GroupUiState, ArrayUiState, AbstractUiState } from '@3kles/kles-material-dynamicforms';
8
8
  import { SortHeaderArrowPosition, SortDirection, Sort, MatSort } from '@angular/material/sort';
9
9
  import * as rxjs from 'rxjs';
@@ -323,6 +323,8 @@ interface SelectionState {
323
323
  }
324
324
  type SelectionConfigDef<T> = {
325
325
  selectionMode?: boolean;
326
+ /** Toggles selection when the non-interactive area of a data row is clicked. */
327
+ selectOnRowClick?: boolean;
326
328
  key?: string;
327
329
  params?: () => Observable<T>;
328
330
  select?: SelectionCallback<[
@@ -445,8 +447,14 @@ interface DragDropRowContext<TValue = unknown> {
445
447
  }
446
448
  interface DragDrop<TValue = unknown> {
447
449
  dragDropRows?: DragDropConfig<TValue>;
448
- /** Reserved for the future column drag-and-drop implementation. */
449
- dragDropColumns?: DragDropConfig<TValue>;
450
+ dragDropColumns?: ColumnDragDropConfig;
451
+ }
452
+ interface ColumnDragDropConfig {
453
+ enable?: boolean;
454
+ options?: {
455
+ /** Prevents specific columns from being moved. */
456
+ dragDisabled?: (column: KlesColumnConfig) => boolean;
457
+ };
450
458
  }
451
459
  type ExtraRowMode = 'expand' | 'always';
452
460
  type ExtraRowWidth = 'table' | 'viewport';
@@ -1292,6 +1300,7 @@ interface ISelectionService {
1292
1300
  selectionModel?: IKlesSelectionModel<FormGroup>;
1293
1301
  readonly loadingRows: Signal<ReadonlySet<FormGroup>>;
1294
1302
  isLoading(row: FormGroup): boolean;
1303
+ onRowClick(event: MouseEvent, row: FormGroup): void;
1295
1304
  count(): Signal<number>;
1296
1305
  disable(): void;
1297
1306
  enable(): void;
@@ -1337,7 +1346,8 @@ declare class RenderService {
1337
1346
 
1338
1347
  declare class RowService {
1339
1348
  private readonly eventsService;
1340
- constructor(eventsService: EventsService);
1349
+ private readonly selectionService;
1350
+ constructor(eventsService: EventsService, selectionService: ISelectionService);
1341
1351
  onClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
1342
1352
  onDoubleClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
1343
1353
  onContextMenu(event: MouseEvent, row: FormGroup, rowIndex: number): void;
@@ -1411,6 +1421,19 @@ declare class TreeService<T, R> {
1411
1421
  static ɵprov: i0.ɵɵInjectableDeclaration<TreeService<any, any>>;
1412
1422
  }
1413
1423
 
1424
+ declare class ColumnDragDropService {
1425
+ private readonly config;
1426
+ private readonly columnsService;
1427
+ readonly enable: boolean;
1428
+ constructor(config: ColumnDragDropConfig | undefined, columnsService: ColumnsService);
1429
+ readonly sortPredicate: (index: number, drag: CdkDrag<KlesColumnConfig>) => boolean;
1430
+ visibleColumns(): KlesColumnConfig[];
1431
+ isDragDisabled(column: KlesColumnConfig): boolean;
1432
+ listDropped(event: CdkDragDrop<KlesColumnConfig[]>): void;
1433
+ private isSameGroup;
1434
+ private groupOf;
1435
+ }
1436
+
1414
1437
  type TableSection = 'header' | 'body' | 'footer';
1415
1438
  declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy {
1416
1439
  private readonly host;
@@ -1419,6 +1442,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1419
1442
  private readonly datasourceService;
1420
1443
  readonly tableService: ITableService;
1421
1444
  readonly dragDropRowService: DragDropService;
1445
+ readonly columnDragDropService: ColumnDragDropService;
1422
1446
  readonly rowAppearance: RowAppearanceConfig;
1423
1447
  readonly selectionService: ISelectionService;
1424
1448
  readonly columnsService: ColumnsService;
@@ -1441,6 +1465,8 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1441
1465
  table: MatTable<FormGroup>;
1442
1466
  matSort: MatSort;
1443
1467
  formElemRef: ElementRef<HTMLElement>;
1468
+ private readonly dropLists;
1469
+ private readonly drags;
1444
1470
  headerHeightPx: i0.WritableSignal<number>;
1445
1471
  scrollHeightPx: i0.WritableSignal<number>;
1446
1472
  footerHeightPx: i0.WritableSignal<number>;
@@ -1460,8 +1486,9 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1460
1486
  private rafId?;
1461
1487
  private _cleanup?;
1462
1488
  emptyStateComponent: typeof KlesTableEmptyStateComponent;
1463
- constructor(host: ElementRef<HTMLElement>, connectorService: KlesTableConnectorService, loader: ILoader<unknown>, datasourceService: IDatasourceService, tableService: ITableService, dragDropRowService: DragDropService, rowAppearance: RowAppearanceConfig, 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>, rowContextStore: RowContextStore);
1489
+ constructor(host: ElementRef<HTMLElement>, connectorService: KlesTableConnectorService, loader: ILoader<unknown>, datasourceService: IDatasourceService, tableService: ITableService, dragDropRowService: DragDropService, columnDragDropService: ColumnDragDropService, rowAppearance: RowAppearanceConfig, 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>, rowContextStore: RowContextStore);
1464
1490
  getRowContext(row: FormGroup): KlesRowContext;
1491
+ isRowSelected(row: FormGroup): boolean;
1465
1492
  get isLoadingClass(): boolean;
1466
1493
  get isEmptyClass(): boolean;
1467
1494
  get events(): EventsApi;
@@ -1486,15 +1513,23 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1486
1513
  ngOnInit(): void;
1487
1514
  ngAfterViewInit(): void;
1488
1515
  ngOnDestroy(): void;
1516
+ private bindColumnDragsToHeader;
1517
+ private scheduleColumnDragBinding;
1489
1518
  getColumnSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1490
1519
  getStickyStartSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1491
1520
  getStickyEndSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1492
1521
  private getSeparatorStyle;
1493
1522
  private calculHeaderHeight;
1494
- static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent, [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, null, null, null, null, null, null, null, null]>;
1523
+ static ɵfac: i0.ɵɵFactoryDeclaration<TableComponent, [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, null, null, null, null, null, null, null, null]>;
1495
1524
  static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
1496
1525
  }
1497
1526
 
1527
+ declare class KlesTableFooterStartDirective {
1528
+ readonly elementRef: ElementRef<HTMLElement>;
1529
+ static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableFooterStartDirective, never>;
1530
+ static ɵdir: i0.ɵɵDirectiveDeclaration<KlesTableFooterStartDirective, "[klesTableFooterStart]", never, {}, {}, never, never, true, never>;
1531
+ }
1532
+
1498
1533
  interface KlesTableApi<TValue = unknown> {
1499
1534
  refresh(): void;
1500
1535
  get scrollbar(): ScrollbarApi;
@@ -1519,6 +1554,7 @@ interface KlesTableApi<TValue = unknown> {
1519
1554
  declare class KlesTableComponent<TParams = unknown, TValue = unknown> implements OnInit, KlesTableApi<TValue> {
1520
1555
  private connectorService;
1521
1556
  tableConfig: i0.InputSignal<KlesTableConfig<TParams, TValue>>;
1557
+ readonly footerStart: i0.Signal<KlesTableFooterStartDirective>;
1522
1558
  private readonly destroyRef;
1523
1559
  tableEvent: EventEmitter<TableEvent<TValue>>;
1524
1560
  rowClick: EventEmitter<RowMousePayload<TValue>>;
@@ -1567,13 +1603,13 @@ declare class KlesTableComponent<TParams = unknown, TValue = unknown> implements
1567
1603
  }>;
1568
1604
  private dispatchEvent;
1569
1605
  static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableComponent<any, any>, never>;
1570
- static ɵcmp: i0.ɵɵComponentDeclaration<KlesTableComponent<any, 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>;
1606
+ static ɵcmp: i0.ɵɵComponentDeclaration<KlesTableComponent<any, 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"; }, ["footerStart"], never, true, never>;
1571
1607
  }
1572
1608
 
1573
1609
  declare class KlesMaterialTableModule {
1574
1610
  static declarations: any[][];
1575
1611
  static ɵfac: i0.ɵɵFactoryDeclaration<KlesMaterialTableModule, never>;
1576
- static ɵmod: i0.ɵɵNgModuleDeclaration<KlesMaterialTableModule, never, [typeof i1.CommonModule, typeof TableComponent, typeof KlesTableComponent, typeof i4.KlesMaterialDynamicformsModule], [typeof KlesTableComponent]>;
1612
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KlesMaterialTableModule, never, [typeof i1.CommonModule, typeof TableComponent, typeof KlesTableFooterStartDirective, typeof KlesTableComponent, typeof i5.KlesMaterialDynamicformsModule], [typeof KlesTableFooterStartDirective, typeof KlesTableComponent]>;
1577
1613
  static ɵinj: i0.ɵɵInjectorDeclaration<KlesMaterialTableModule>;
1578
1614
  }
1579
1615
 
@@ -1585,6 +1621,7 @@ declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
1585
1621
  declare const MULTI_UNFOLD: InjectionToken<boolean>;
1586
1622
  declare const ROW_APPEARANCE_CONFIG: InjectionToken<RowAppearanceConfig<unknown>>;
1587
1623
  declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
1624
+ declare const COLUMN_DRAG_DROP: InjectionToken<ColumnDragDropService>;
1588
1625
  declare const DRAG_DROP_CONFIG: InjectionToken<DragDropConfig<unknown>>;
1589
1626
  declare const KLES_DRAG_DROP_ROW_CONTEXT: InjectionToken<DragDropRowContext<unknown>>;
1590
1627
  declare const PAGINATOR_CONFIG: InjectionToken<PaginatorConfig>;
@@ -1600,5 +1637,5 @@ declare const SCROLLBAR_ORCHESTRATOR_SERVICE: InjectionToken<IScrollbarOrchestra
1600
1637
  declare const TABLE_SERVICE: InjectionToken<ITableService>;
1601
1638
  declare const EMPTY_STATE_CONFIG: InjectionToken<boolean | EmptyStateConfig>;
1602
1639
 
1603
- export { AlignCell, COLUMNS, DATASOURCE_SERVICE, DRAG_DROP_CONFIG, EMPTY_STATE_CONFIG, EXTRA_ROWS, FOOTER, HEADER_SERVICE, INFINITE_SCROLL_CONFIG, KLES_DRAG_DROP_ROW_CONTEXT, KlesMaterialTableModule, KlesTableComponent, KlesTableEmptyStateComponent, KlesTableIntl, LINES_SERVICE, LOADER_CONFIG, LOADER_SERVICE, MULTI_UNFOLD, PAGINATOR_CONFIG, ROW_APPEARANCE_CONFIG, ROW_DRAG_DROP, SCROLLBAR_ORCHESTRATOR_SERVICE, SELECTION_CONFIG, SELECTION_SERVICE, SORT_CONFIG, SORT_SERVICE, Span, TABLE_SERVICE, TableComponent, linesLazyLoader, linesLoader, selectionConfig };
1604
- 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, ExtraRowWidth, FilterChangePayload, FooterApi, FooterFormApi, FormApi, FormValue, GlobalSearchPayload, HeaderFormApi, IKlesCellFieldConfig, IKlesFooterFieldConfig, IKlesHeaderFieldConfig, ITable, InfiniteScrollConfig, KlesColumnConfig, KlesExtraCellFieldConfig, KlesRowContext, KlesStyleMap, KlesStyleValue, KlesTableApi, KlesTableConfig, LinesLazyLoader, LinesLoader, LoadErrorPayload, LoadSuccessPayload, LoaderConfig, LoaderLazyResult, LoaderResult, LoadingApi, LoadingChangePayload, NgStyleInput, PageChangePayload, PaginationApi, PaginatorConfig, RenderApi, RowActionClickPayload, RowAppearanceConfig, RowClassInput, RowClassValue, RowDropErrorPayload, RowDropPayload, RowId, RowMousePayload, RowPayload, RowStyleInput, 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 };
1640
+ export { AlignCell, COLUMNS, COLUMN_DRAG_DROP, DATASOURCE_SERVICE, DRAG_DROP_CONFIG, EMPTY_STATE_CONFIG, EXTRA_ROWS, FOOTER, HEADER_SERVICE, INFINITE_SCROLL_CONFIG, KLES_DRAG_DROP_ROW_CONTEXT, KlesMaterialTableModule, KlesTableComponent, KlesTableEmptyStateComponent, KlesTableFooterStartDirective, KlesTableIntl, LINES_SERVICE, LOADER_CONFIG, LOADER_SERVICE, MULTI_UNFOLD, PAGINATOR_CONFIG, ROW_APPEARANCE_CONFIG, ROW_DRAG_DROP, SCROLLBAR_ORCHESTRATOR_SERVICE, SELECTION_CONFIG, SELECTION_SERVICE, SORT_CONFIG, SORT_SERVICE, Span, TABLE_SERVICE, TableComponent, linesLazyLoader, linesLoader, selectionConfig };
1641
+ export type { AggregationType, BulkActionClickPayload, CellMousePayload, CellPayload, CellValueChangePayload, ColumnApi, ColumnClass, ColumnDragDropConfig, ColumnDropPayload, ColumnOrderChangePayload, ColumnPayload, ColumnResizePayload, ColumnSeparatorConfig, ColumnSeparatorStyle, ColumnVisibilityChangePayload, DefaultTableConfig, DragDrop, DragDropConfig, DragDropRowChange, DragDropRowContext, EmptyStateApi, EmptyStateChangePayload, EmptyStateConfig, EventsApi, ExpansionPayload, ExtraRow, ExtraRowConfig, ExtraRowMode, ExtraRowWidth, FilterChangePayload, FooterApi, FooterFormApi, FormApi, FormValue, GlobalSearchPayload, HeaderFormApi, IKlesCellFieldConfig, IKlesFooterFieldConfig, IKlesHeaderFieldConfig, ITable, InfiniteScrollConfig, KlesColumnConfig, KlesExtraCellFieldConfig, KlesRowContext, KlesStyleMap, KlesStyleValue, KlesTableApi, KlesTableConfig, LinesLazyLoader, LinesLoader, LoadErrorPayload, LoadSuccessPayload, LoaderConfig, LoaderLazyResult, LoaderResult, LoadingApi, LoadingChangePayload, NgStyleInput, PageChangePayload, PaginationApi, PaginatorConfig, RenderApi, RowActionClickPayload, RowAppearanceConfig, RowClassInput, RowClassValue, RowDropErrorPayload, RowDropPayload, RowId, RowMousePayload, RowPayload, RowStyleInput, 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 };