simple-table-core 4.2.2 → 4.2.4

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.
@@ -148,7 +148,11 @@ export interface SimpleTableConfig<TData extends RowData = Row> {
148
148
  selectableCells?: boolean;
149
149
  selectableColumns?: boolean;
150
150
  serverSidePagination?: boolean;
151
- tableEmptyStateRenderer?: HTMLElement | string | null;
151
+ /**
152
+ * Empty-table UI. A prebuilt element is cloned (vanilla snapshot). A function
153
+ * is called and its node is appended live (clicks and Angular views keep working).
154
+ */
155
+ tableEmptyStateRenderer?: HTMLElement | string | null | (() => HTMLElement | string | null);
152
156
  theme?: Theme;
153
157
  totalRowCount?: number;
154
158
  }
@@ -155,7 +155,11 @@ export interface SimpleTableProps<TData extends RowData = Row> {
155
155
  selectableCells?: boolean;
156
156
  selectableColumns?: boolean;
157
157
  serverSidePagination?: boolean;
158
- tableEmptyStateRenderer?: HTMLElement | string | null;
158
+ /**
159
+ * Custom empty UI when the table has no rows. A prebuilt element is cloned.
160
+ * Pass a function to append a live node (button clicks still fire).
161
+ */
162
+ tableEmptyStateRenderer?: HTMLElement | string | null | (() => HTMLElement | string | null);
159
163
  theme?: Theme;
160
164
  totalRowCount?: number;
161
165
  }
@@ -1,9 +1,10 @@
1
1
  import type Row from "../../types/Row";
2
2
  import type TableRow from "../../types/TableRow";
3
- import { CellRenderContext } from "./types";
3
+ import { AbsoluteBodyCell, CellRenderContext } from "./types";
4
4
  export interface CellLiveRef {
5
5
  row: Row;
6
6
  tableRow: TableRow;
7
7
  context: CellRenderContext;
8
+ cell: AbsoluteBodyCell;
8
9
  }
9
10
  export declare const cellLiveRefMap: WeakMap<HTMLElement, CellLiveRef>;
@@ -2,4 +2,8 @@ import ColumnDef from "../../types/ColumnDef";
2
2
  import CellValue from "../../types/CellValue";
3
3
  import { AbsoluteBodyCell, CellRenderContext } from "./types";
4
4
  export declare const formatCellContent: (content: CellValue, header: ColumnDef, colIndex: number, row: any, rowIndex: number) => string | null;
5
+ export type ExpandChromeKind = "icon" | "placeholder" | "none";
6
+ /** Whether this cell should show a real caret, a spacer, or neither. */
7
+ export declare const getExpandChromeKind: (cell: AbsoluteBodyCell, context: CellRenderContext) => ExpandChromeKind;
8
+ export declare const readExpandChromeKind: (contentSpan: HTMLElement) => ExpandChromeKind;
5
9
  export declare const createCellContent: (cell: AbsoluteBodyCell, context: CellRenderContext, contentSpan: HTMLElement) => void;
@@ -6,6 +6,8 @@ export type { CellLiveRef };
6
6
  export declare const invalidateBodyCellContentMemo: (cellElement: HTMLElement) => void;
7
7
  export declare const untrackCellByRow: (rowId: string, cellElement: HTMLElement) => void;
8
8
  export declare const unregisterCellFromRegistry: (cellElement: HTMLElement, cellRegistry?: Map<string, CellRegistryEntry>) => void;
9
+ /** Move a recycled cell's live-update registry entry onto its new row identity. */
10
+ export declare const rekeyBodyCellIdentity: (cellElement: HTMLElement, nextCellId: string, cellRegistry?: Map<string, CellRegistryEntry>) => void;
9
11
  /** Clears row-hover classes and tracking for one table instance. */
10
12
  export declare const clearHoveredRowsForScope: (scopeId: string) => void;
11
13
  export declare const createBodyCellElement: (cell: AbsoluteBodyCell, context: CellRenderContext) => HTMLElement;
@@ -138,6 +138,8 @@ export interface CellRenderContext {
138
138
  setRowStateMap: Dispatch<SetStateAction<Map<string | number, RowState>>>;
139
139
  getCollapsedRows?: () => Map<string, number>;
140
140
  getExpandedRows?: () => Map<string, number>;
141
+ /** Paint now. Used after a chevron click so child rows exist before the click handler returns. */
142
+ forceUpdate?: () => void;
141
143
  icons: IconsConfig;
142
144
  theme: string;
143
145
  rowButtons?: RowButton[];
@@ -28,3 +28,11 @@ export interface FlattenRowsResult {
28
28
  parentEndPositions: number[];
29
29
  }
30
30
  export declare function flattenRows(config: FlattenRowsConfig): FlattenRowsResult;
31
+ /** Exactly one expand/collapse key changed; otherwise a full flatten is required. */
32
+ export declare function findSingleExpansionToggle(prevCollapsedKeys: string[], prevExpandedKeys: string[], nextCollapsed: Map<string, number>, nextExpanded: Map<string, number>): string | null;
33
+ /**
34
+ * Splice one group's children in or out of a cached flatten result instead of
35
+ * walking every still-open child. Used when a single chevron toggle is the
36
+ * only expand-state change.
37
+ */
38
+ export declare function patchFlattenRowsForSingleToggle(previous: FlattenRowsResult, toggleKey: string, config: FlattenRowsConfig): FlattenRowsResult | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-table-core",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",