@3kles/kles-material-table-v2 21.8.1 → 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.8.1",
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,13 +447,22 @@ 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';
460
+ type ExtraRowWidth = 'table' | 'viewport';
452
461
  interface ExtraRowConfig {
453
462
  cells: KlesExtraCellFieldConfig[];
454
463
  mode?: ExtraRowMode;
464
+ /** Controls whether the content uses the full table width or only the visible scroll viewport. Defaults to `table`. */
465
+ width?: ExtraRowWidth;
455
466
  when?: (index: number, rowData: FormGroup) => boolean;
456
467
  }
457
468
  interface ExtraRow {
@@ -1289,6 +1300,7 @@ interface ISelectionService {
1289
1300
  selectionModel?: IKlesSelectionModel<FormGroup>;
1290
1301
  readonly loadingRows: Signal<ReadonlySet<FormGroup>>;
1291
1302
  isLoading(row: FormGroup): boolean;
1303
+ onRowClick(event: MouseEvent, row: FormGroup): void;
1292
1304
  count(): Signal<number>;
1293
1305
  disable(): void;
1294
1306
  enable(): void;
@@ -1334,7 +1346,8 @@ declare class RenderService {
1334
1346
 
1335
1347
  declare class RowService {
1336
1348
  private readonly eventsService;
1337
- constructor(eventsService: EventsService);
1349
+ private readonly selectionService;
1350
+ constructor(eventsService: EventsService, selectionService: ISelectionService);
1338
1351
  onClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
1339
1352
  onDoubleClick(event: MouseEvent, row: FormGroup, rowIndex: number): void;
1340
1353
  onContextMenu(event: MouseEvent, row: FormGroup, rowIndex: number): void;
@@ -1408,6 +1421,19 @@ declare class TreeService<T, R> {
1408
1421
  static ɵprov: i0.ɵɵInjectableDeclaration<TreeService<any, any>>;
1409
1422
  }
1410
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
+
1411
1437
  type TableSection = 'header' | 'body' | 'footer';
1412
1438
  declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy {
1413
1439
  private readonly host;
@@ -1416,6 +1442,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1416
1442
  private readonly datasourceService;
1417
1443
  readonly tableService: ITableService;
1418
1444
  readonly dragDropRowService: DragDropService;
1445
+ readonly columnDragDropService: ColumnDragDropService;
1419
1446
  readonly rowAppearance: RowAppearanceConfig;
1420
1447
  readonly selectionService: ISelectionService;
1421
1448
  readonly columnsService: ColumnsService;
@@ -1438,9 +1465,13 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1438
1465
  table: MatTable<FormGroup>;
1439
1466
  matSort: MatSort;
1440
1467
  formElemRef: ElementRef<HTMLElement>;
1468
+ private readonly dropLists;
1469
+ private readonly drags;
1441
1470
  headerHeightPx: i0.WritableSignal<number>;
1442
1471
  scrollHeightPx: i0.WritableSignal<number>;
1443
1472
  footerHeightPx: i0.WritableSignal<number>;
1473
+ viewportWidthPx: i0.WritableSignal<number>;
1474
+ viewportScrollRangePx: i0.WritableSignal<number>;
1444
1475
  dataSource: IKlesDataSource;
1445
1476
  columns: Signal<KlesColumnConfig[]>;
1446
1477
  displayedColumns: Signal<string[]> | undefined;
@@ -1455,8 +1486,9 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1455
1486
  private rafId?;
1456
1487
  private _cleanup?;
1457
1488
  emptyStateComponent: typeof KlesTableEmptyStateComponent;
1458
- 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);
1459
1490
  getRowContext(row: FormGroup): KlesRowContext;
1491
+ isRowSelected(row: FormGroup): boolean;
1460
1492
  get isLoadingClass(): boolean;
1461
1493
  get isEmptyClass(): boolean;
1462
1494
  get events(): EventsApi;
@@ -1481,15 +1513,23 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1481
1513
  ngOnInit(): void;
1482
1514
  ngAfterViewInit(): void;
1483
1515
  ngOnDestroy(): void;
1516
+ private bindColumnDragsToHeader;
1517
+ private scheduleColumnDragBinding;
1484
1518
  getColumnSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1485
1519
  getStickyStartSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1486
1520
  getStickyEndSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1487
1521
  private getSeparatorStyle;
1488
1522
  private calculHeaderHeight;
1489
- 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]>;
1490
1524
  static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
1491
1525
  }
1492
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
+
1493
1533
  interface KlesTableApi<TValue = unknown> {
1494
1534
  refresh(): void;
1495
1535
  get scrollbar(): ScrollbarApi;
@@ -1514,6 +1554,7 @@ interface KlesTableApi<TValue = unknown> {
1514
1554
  declare class KlesTableComponent<TParams = unknown, TValue = unknown> implements OnInit, KlesTableApi<TValue> {
1515
1555
  private connectorService;
1516
1556
  tableConfig: i0.InputSignal<KlesTableConfig<TParams, TValue>>;
1557
+ readonly footerStart: i0.Signal<KlesTableFooterStartDirective>;
1517
1558
  private readonly destroyRef;
1518
1559
  tableEvent: EventEmitter<TableEvent<TValue>>;
1519
1560
  rowClick: EventEmitter<RowMousePayload<TValue>>;
@@ -1562,13 +1603,13 @@ declare class KlesTableComponent<TParams = unknown, TValue = unknown> implements
1562
1603
  }>;
1563
1604
  private dispatchEvent;
1564
1605
  static ɵfac: i0.ɵɵFactoryDeclaration<KlesTableComponent<any, any>, never>;
1565
- 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>;
1566
1607
  }
1567
1608
 
1568
1609
  declare class KlesMaterialTableModule {
1569
1610
  static declarations: any[][];
1570
1611
  static ɵfac: i0.ɵɵFactoryDeclaration<KlesMaterialTableModule, never>;
1571
- 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]>;
1572
1613
  static ɵinj: i0.ɵɵInjectorDeclaration<KlesMaterialTableModule>;
1573
1614
  }
1574
1615
 
@@ -1580,6 +1621,7 @@ declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
1580
1621
  declare const MULTI_UNFOLD: InjectionToken<boolean>;
1581
1622
  declare const ROW_APPEARANCE_CONFIG: InjectionToken<RowAppearanceConfig<unknown>>;
1582
1623
  declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
1624
+ declare const COLUMN_DRAG_DROP: InjectionToken<ColumnDragDropService>;
1583
1625
  declare const DRAG_DROP_CONFIG: InjectionToken<DragDropConfig<unknown>>;
1584
1626
  declare const KLES_DRAG_DROP_ROW_CONTEXT: InjectionToken<DragDropRowContext<unknown>>;
1585
1627
  declare const PAGINATOR_CONFIG: InjectionToken<PaginatorConfig>;
@@ -1595,5 +1637,5 @@ declare const SCROLLBAR_ORCHESTRATOR_SERVICE: InjectionToken<IScrollbarOrchestra
1595
1637
  declare const TABLE_SERVICE: InjectionToken<ITableService>;
1596
1638
  declare const EMPTY_STATE_CONFIG: InjectionToken<boolean | EmptyStateConfig>;
1597
1639
 
1598
- 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 };
1599
- 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, 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 };