@3kles/kles-material-table-v2 21.8.0 → 21.9.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.0",
3
+ "version": "21.9.0",
4
4
  "keywords": [
5
5
  "3KLES"
6
6
  ],
@@ -355,20 +355,29 @@ declare class KlesTableIntl {
355
355
  static ɵprov: i0.ɵɵInjectableDeclaration<KlesTableIntl>;
356
356
  }
357
357
 
358
+ interface KlesRowContext<TSource = unknown> {
359
+ source: TSource;
360
+ _id: string | number;
361
+ meta: {
362
+ depth: number;
363
+ parentId: string | number | null;
364
+ };
365
+ }
366
+
358
367
  type TableElevationLevel = 0 | 1 | 2 | 3 | 4 | 5;
359
368
  type RowClassValue = string | string[] | Set<string> | Record<string, boolean | null | undefined>;
360
- type RowStyleInput = KlesStyleMap | ((row: Record<string, unknown>, status: FormControlStatus, index: number) => KlesStyleMap);
361
- type RowClassInput = RowClassValue | ((row: Record<string, unknown>, status: FormControlStatus, index: number) => RowClassValue);
362
- interface RowAppearanceConfig {
363
- rowStyle?: RowStyleInput;
364
- rowClass?: RowClassInput;
369
+ type RowStyleInput<TSource = unknown> = KlesStyleMap | ((row: Record<string, unknown>, status: FormControlStatus, index: number, context: KlesRowContext<TSource>) => KlesStyleMap);
370
+ type RowClassInput<TSource = unknown> = RowClassValue | ((row: Record<string, unknown>, status: FormControlStatus, index: number, context: KlesRowContext<TSource>) => RowClassValue);
371
+ interface RowAppearanceConfig<TSource = unknown> {
372
+ rowStyle?: RowStyleInput<TSource>;
373
+ rowClass?: RowClassInput<TSource>;
365
374
  }
366
375
  interface EmptyStateConfig {
367
376
  enabled?: boolean;
368
377
  component?: Type<unknown>;
369
378
  intl?: Type<KlesTableIntl>;
370
379
  }
371
- interface DefaultTableConfig extends RowAppearanceConfig {
380
+ interface DefaultTableConfig<TSource = unknown> extends RowAppearanceConfig<TSource> {
372
381
  id?: string;
373
382
  columns: KlesColumnConfig[];
374
383
  /** Reserved for row-level validation configuration; not applied yet. */
@@ -440,9 +449,12 @@ interface DragDrop<TValue = unknown> {
440
449
  dragDropColumns?: DragDropConfig<TValue>;
441
450
  }
442
451
  type ExtraRowMode = 'expand' | 'always';
452
+ type ExtraRowWidth = 'table' | 'viewport';
443
453
  interface ExtraRowConfig {
444
454
  cells: KlesExtraCellFieldConfig[];
445
455
  mode?: ExtraRowMode;
456
+ /** Controls whether the content uses the full table width or only the visible scroll viewport. Defaults to `table`. */
457
+ width?: ExtraRowWidth;
446
458
  when?: (index: number, rowData: FormGroup) => boolean;
447
459
  }
448
460
  interface ExtraRow {
@@ -465,7 +477,7 @@ type Exclusive<T, U> = (T & {
465
477
  }) | (U & {
466
478
  [K in Exclude<keyof T, keyof U>]?: never;
467
479
  });
468
- type KlesTableConfig<T = unknown, R = unknown> = DefaultTableConfig & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop<R> & Selection<T> & ExtraRow;
480
+ type KlesTableConfig<T = unknown, R = unknown> = DefaultTableConfig<R> & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop<R> & Selection<T> & ExtraRow;
469
481
 
470
482
  type AggregationType = 'sum' | 'avg' | 'min' | 'max' | 'count';
471
483
  interface SortPayload {
@@ -876,15 +888,6 @@ declare class ColumnsService {
876
888
  static ɵprov: i0.ɵɵInjectableDeclaration<ColumnsService>;
877
889
  }
878
890
 
879
- interface KlesRowContext<TSource = unknown> {
880
- source: TSource;
881
- _id: string | number;
882
- meta: {
883
- depth: number;
884
- parentId: string | number | null;
885
- };
886
- }
887
-
888
891
  interface KlesCreatedRow<TSource = unknown> {
889
892
  formGroup: FormGroup;
890
893
  groupUi: GroupUiState;
@@ -1434,12 +1437,15 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1434
1437
  readonly cellService: CellService;
1435
1438
  readonly emptyStateService: EmptyStateService;
1436
1439
  private readonly treeService;
1440
+ private readonly rowContextStore;
1437
1441
  table: MatTable<FormGroup>;
1438
1442
  matSort: MatSort;
1439
1443
  formElemRef: ElementRef<HTMLElement>;
1440
1444
  headerHeightPx: i0.WritableSignal<number>;
1441
1445
  scrollHeightPx: i0.WritableSignal<number>;
1442
1446
  footerHeightPx: i0.WritableSignal<number>;
1447
+ viewportWidthPx: i0.WritableSignal<number>;
1448
+ viewportScrollRangePx: i0.WritableSignal<number>;
1443
1449
  dataSource: IKlesDataSource;
1444
1450
  columns: Signal<KlesColumnConfig[]>;
1445
1451
  displayedColumns: Signal<string[]> | undefined;
@@ -1454,7 +1460,8 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1454
1460
  private rafId?;
1455
1461
  private _cleanup?;
1456
1462
  emptyStateComponent: typeof KlesTableEmptyStateComponent;
1457
- 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>);
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);
1464
+ getRowContext(row: FormGroup): KlesRowContext;
1458
1465
  get isLoadingClass(): boolean;
1459
1466
  get isEmptyClass(): boolean;
1460
1467
  get events(): EventsApi;
@@ -1484,7 +1491,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1484
1491
  getStickyEndSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1485
1492
  private getSeparatorStyle;
1486
1493
  private calculHeaderHeight;
1487
- 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]>;
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]>;
1488
1495
  static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
1489
1496
  }
1490
1497
 
@@ -1576,7 +1583,7 @@ declare const COLUMNS: InjectionToken<WritableSignal<KlesColumnConfig[]>>;
1576
1583
  declare const FOOTER: InjectionToken<WritableSignal<boolean>>;
1577
1584
  declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
1578
1585
  declare const MULTI_UNFOLD: InjectionToken<boolean>;
1579
- declare const ROW_APPEARANCE_CONFIG: InjectionToken<RowAppearanceConfig>;
1586
+ declare const ROW_APPEARANCE_CONFIG: InjectionToken<RowAppearanceConfig<unknown>>;
1580
1587
  declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
1581
1588
  declare const DRAG_DROP_CONFIG: InjectionToken<DragDropConfig<unknown>>;
1582
1589
  declare const KLES_DRAG_DROP_ROW_CONTEXT: InjectionToken<DragDropRowContext<unknown>>;
@@ -1594,4 +1601,4 @@ declare const TABLE_SERVICE: InjectionToken<ITableService>;
1594
1601
  declare const EMPTY_STATE_CONFIG: InjectionToken<boolean | EmptyStateConfig>;
1595
1602
 
1596
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 };
1597
- 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, 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 };
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 };