@3kles/kles-material-table-v2 21.7.1 → 21.8.1

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.7.1",
3
+ "version": "21.8.1",
4
4
  "keywords": [
5
5
  "3KLES"
6
6
  ],
@@ -355,13 +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;
368
+ type RowClassValue = string | string[] | Set<string> | Record<string, boolean | null | undefined>;
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>;
374
+ }
359
375
  interface EmptyStateConfig {
360
376
  enabled?: boolean;
361
377
  component?: Type<unknown>;
362
378
  intl?: Type<KlesTableIntl>;
363
379
  }
364
- interface DefaultTableConfig {
380
+ interface DefaultTableConfig<TSource = unknown> extends RowAppearanceConfig<TSource> {
365
381
  id?: string;
366
382
  columns: KlesColumnConfig[];
367
383
  /** Reserved for row-level validation configuration; not applied yet. */
@@ -458,7 +474,7 @@ type Exclusive<T, U> = (T & {
458
474
  }) | (U & {
459
475
  [K in Exclude<keyof T, keyof U>]?: never;
460
476
  });
461
- type KlesTableConfig<T = unknown, R = unknown> = DefaultTableConfig & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop<R> & Selection<T> & ExtraRow;
477
+ type KlesTableConfig<T = unknown, R = unknown> = DefaultTableConfig<R> & Exclusive<PaginatorConfig, InfiniteScrollConfig> & LoaderConfig<T, R> & DragDrop<R> & Selection<T> & ExtraRow;
462
478
 
463
479
  type AggregationType = 'sum' | 'avg' | 'min' | 'max' | 'count';
464
480
  interface SortPayload {
@@ -869,15 +885,6 @@ declare class ColumnsService {
869
885
  static ɵprov: i0.ɵɵInjectableDeclaration<ColumnsService>;
870
886
  }
871
887
 
872
- interface KlesRowContext<TSource = unknown> {
873
- source: TSource;
874
- _id: string | number;
875
- meta: {
876
- depth: number;
877
- parentId: string | number | null;
878
- };
879
- }
880
-
881
888
  interface KlesCreatedRow<TSource = unknown> {
882
889
  formGroup: FormGroup;
883
890
  groupUi: GroupUiState;
@@ -1409,6 +1416,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1409
1416
  private readonly datasourceService;
1410
1417
  readonly tableService: ITableService;
1411
1418
  readonly dragDropRowService: DragDropService;
1419
+ readonly rowAppearance: RowAppearanceConfig;
1412
1420
  readonly selectionService: ISelectionService;
1413
1421
  readonly columnsService: ColumnsService;
1414
1422
  readonly loadingService: LoadingService;
@@ -1426,6 +1434,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1426
1434
  readonly cellService: CellService;
1427
1435
  readonly emptyStateService: EmptyStateService;
1428
1436
  private readonly treeService;
1437
+ private readonly rowContextStore;
1429
1438
  table: MatTable<FormGroup>;
1430
1439
  matSort: MatSort;
1431
1440
  formElemRef: ElementRef<HTMLElement>;
@@ -1446,7 +1455,8 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1446
1455
  private rafId?;
1447
1456
  private _cleanup?;
1448
1457
  emptyStateComponent: typeof KlesTableEmptyStateComponent;
1449
- 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>);
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);
1459
+ getRowContext(row: FormGroup): KlesRowContext;
1450
1460
  get isLoadingClass(): boolean;
1451
1461
  get isEmptyClass(): boolean;
1452
1462
  get events(): EventsApi;
@@ -1476,7 +1486,7 @@ declare class TableComponent implements ITable, OnInit, AfterViewInit, OnDestroy
1476
1486
  getStickyEndSeparator(column: KlesColumnConfig, section: TableSection): string | null;
1477
1487
  private getSeparatorStyle;
1478
1488
  private calculHeaderHeight;
1479
- 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]>;
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]>;
1480
1490
  static ɵcmp: i0.ɵɵComponentDeclaration<TableComponent, "kles-table", never, {}, {}, never, never, true, never>;
1481
1491
  }
1482
1492
 
@@ -1568,6 +1578,7 @@ declare const COLUMNS: InjectionToken<WritableSignal<KlesColumnConfig[]>>;
1568
1578
  declare const FOOTER: InjectionToken<WritableSignal<boolean>>;
1569
1579
  declare const EXTRA_ROWS: InjectionToken<WritableSignal<ExtraRowConfig[]>>;
1570
1580
  declare const MULTI_UNFOLD: InjectionToken<boolean>;
1581
+ declare const ROW_APPEARANCE_CONFIG: InjectionToken<RowAppearanceConfig<unknown>>;
1571
1582
  declare const ROW_DRAG_DROP: InjectionToken<DragDropService>;
1572
1583
  declare const DRAG_DROP_CONFIG: InjectionToken<DragDropConfig<unknown>>;
1573
1584
  declare const KLES_DRAG_DROP_ROW_CONTEXT: InjectionToken<DragDropRowContext<unknown>>;
@@ -1584,5 +1595,5 @@ declare const SCROLLBAR_ORCHESTRATOR_SERVICE: InjectionToken<IScrollbarOrchestra
1584
1595
  declare const TABLE_SERVICE: InjectionToken<ITableService>;
1585
1596
  declare const EMPTY_STATE_CONFIG: InjectionToken<boolean | EmptyStateConfig>;
1586
1597
 
1587
- 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_DRAG_DROP, SCROLLBAR_ORCHESTRATOR_SERVICE, SELECTION_CONFIG, SELECTION_SERVICE, SORT_CONFIG, SORT_SERVICE, Span, TABLE_SERVICE, TableComponent, linesLazyLoader, linesLoader, selectionConfig };
1588
- 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 };
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 };