simple-table-core 3.0.0-beta.15 → 3.0.0-beta.18

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.
Files changed (42) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/src/core/SimpleTableVanilla.d.ts +2 -0
  3. package/dist/cjs/src/core/initialization/TableInitializer.d.ts +4 -1
  4. package/dist/cjs/src/core/rendering/RenderOrchestrator.d.ts +1 -0
  5. package/dist/cjs/src/core/rendering/TableRenderer.d.ts +1 -0
  6. package/dist/cjs/src/index.d.ts +3 -2
  7. package/dist/cjs/src/types/ColumnEditorConfig.d.ts +5 -2
  8. package/dist/cjs/src/types/ColumnEditorCustomRendererProps.d.ts +14 -0
  9. package/dist/cjs/src/types/HeaderObject.d.ts +1 -1
  10. package/dist/cjs/src/types/SimpleTableConfig.d.ts +0 -2
  11. package/dist/cjs/src/types/SimpleTableProps.d.ts +0 -13
  12. package/dist/cjs/src/utils/asRows.d.ts +7 -0
  13. package/dist/cjs/src/utils/bodyCell/expansion.d.ts +9 -1
  14. package/dist/cjs/src/utils/columnEditor/createColumnEditorRow.d.ts +8 -1
  15. package/dist/cjs/src/utils/headerCell/collapsing.d.ts +1 -1
  16. package/dist/cjs/stories/tests/37-TableRefMethodsTests.stories.d.ts +1 -1
  17. package/dist/cjs/styles.css +1 -1
  18. package/dist/index.es.js +1 -1
  19. package/dist/src/core/SimpleTableVanilla.d.ts +2 -0
  20. package/dist/src/core/initialization/TableInitializer.d.ts +4 -1
  21. package/dist/src/core/rendering/RenderOrchestrator.d.ts +1 -0
  22. package/dist/src/core/rendering/TableRenderer.d.ts +1 -0
  23. package/dist/src/index.d.ts +3 -2
  24. package/dist/src/types/ColumnEditorConfig.d.ts +5 -2
  25. package/dist/src/types/ColumnEditorCustomRendererProps.d.ts +14 -0
  26. package/dist/src/types/HeaderObject.d.ts +1 -1
  27. package/dist/src/types/SimpleTableConfig.d.ts +0 -2
  28. package/dist/src/types/SimpleTableProps.d.ts +0 -13
  29. package/dist/src/utils/asRows.d.ts +7 -0
  30. package/dist/src/utils/bodyCell/expansion.d.ts +9 -1
  31. package/dist/src/utils/columnEditor/createColumnEditorRow.d.ts +8 -1
  32. package/dist/src/utils/headerCell/collapsing.d.ts +1 -1
  33. package/dist/stories/tests/37-TableRefMethodsTests.stories.d.ts +1 -1
  34. package/dist/styles.css +1 -1
  35. package/package.json +2 -1
  36. package/src/styles/base.css +5 -0
  37. package/src/styles/themes/modern-dark.css +0 -12
  38. package/src/styles/themes/modern-light.css +0 -12
  39. package/dist/cjs/src/types/TableRefType.d.ts +0 -78
  40. package/dist/cjs/src/utils/deprecatedPropsWarnings.d.ts +0 -10
  41. package/dist/src/types/TableRefType.d.ts +0 -78
  42. package/dist/src/utils/deprecatedPropsWarnings.d.ts +0 -10
@@ -66,6 +66,8 @@ export declare class SimpleTableVanilla {
66
66
  private getRenderState;
67
67
  private render;
68
68
  update(config: Partial<SimpleTableConfig>): void;
69
+ /** @deprecated Use {@link update} — same behavior. */
70
+ updateConfig(config: Partial<SimpleTableConfig>): void;
69
71
  destroy(): void;
70
72
  getAPI(): TableAPI;
71
73
  }
@@ -1,5 +1,7 @@
1
1
  import { SimpleTableConfig } from "../../types/SimpleTableConfig";
2
2
  import { CustomTheme } from "../../types/CustomTheme";
3
+ import { ColumnEditorRowRenderer } from "../../types/ColumnEditorRowRendererProps";
4
+ import { ColumnEditorCustomRenderer } from "../../types/ColumnEditorCustomRendererProps";
3
5
  import HeaderObject, { Accessor } from "../../types/HeaderObject";
4
6
  export interface ResolvedIcons {
5
7
  drag: string | HTMLElement | SVGSVGElement;
@@ -18,7 +20,8 @@ export interface MergedColumnEditorConfig {
18
20
  searchPlaceholder: string;
19
21
  allowColumnPinning: boolean;
20
22
  searchFunction?: (header: HeaderObject, searchText: string) => boolean;
21
- rowRenderer?: any;
23
+ rowRenderer?: ColumnEditorRowRenderer;
24
+ customRenderer?: ColumnEditorCustomRenderer;
22
25
  }
23
26
  export declare class TableInitializer {
24
27
  static resolveIcons(config: SimpleTableConfig): ResolvedIcons;
@@ -31,6 +31,7 @@ export interface RenderContext {
31
31
  getCollapsedRows: () => Map<string, number>;
32
32
  getCollapsedHeaders?: () => Set<Accessor>;
33
33
  getExpandedRows: () => Map<string, number>;
34
+ getHeaders: () => HeaderObject[];
34
35
  getRowStateMap: () => Map<string | number, RowState>;
35
36
  headerRegistry: Map<string, any>;
36
37
  headers: HeaderObject[];
@@ -25,6 +25,7 @@ export interface TableRendererDeps {
25
25
  getCollapsedHeaders?: () => Set<Accessor>;
26
26
  getCollapsedRows: () => Map<string, number>;
27
27
  getExpandedRows: () => Map<string, number>;
28
+ getHeaders: () => HeaderObject[];
28
29
  getRowStateMap: () => Map<string | number, any>;
29
30
  headerRegistry: Map<string, any>;
30
31
  headers: HeaderObject[];
@@ -16,7 +16,6 @@ import type SharedTableProps from "./types/SharedTableProps";
16
16
  import type SortColumn from "./types/SortColumn";
17
17
  import type TableHeaderProps from "./types/TableHeaderProps";
18
18
  import type { TableAPI, SetHeaderRenameProps, ExportToCSVProps } from "./types/TableAPI";
19
- import type TableRefType from "./types/TableRefType";
20
19
  import type TableRowProps from "./types/TableRowProps";
21
20
  import type Theme from "./types/Theme";
22
21
  import type UpdateDataProps from "./types/UpdateCellProps";
@@ -31,6 +30,7 @@ import type HeaderRendererProps from "./types/HeaderRendererProps";
31
30
  import type { HeaderRenderer, HeaderRendererComponents } from "./types/HeaderRendererProps";
32
31
  import type ColumnEditorRowRendererProps from "./types/ColumnEditorRowRendererProps";
33
32
  import type { ColumnEditorRowRenderer, ColumnEditorRowRendererComponents } from "./types/ColumnEditorRowRendererProps";
33
+ import type { ColumnEditorCustomRendererProps, ColumnEditorCustomRenderer } from "./types/ColumnEditorCustomRendererProps";
34
34
  import type HeaderDropdownProps from "./types/HeaderDropdownProps";
35
35
  import type { HeaderDropdown } from "./types/HeaderDropdownProps";
36
36
  import type { RowButtonProps } from "./types/RowButton";
@@ -45,4 +45,5 @@ import type { SimpleTableProps } from "./types/SimpleTableProps";
45
45
  import type { RowId } from "./types/RowId";
46
46
  import type { PinnedSectionsState } from "./types/PinnedSectionsState";
47
47
  export { SimpleTableVanilla };
48
- export type { Accessor, AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, DragHandlerProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FooterRendererProps, GetRowId, GetRowIdParams, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, HeaderDropdown, HeaderDropdownProps, HeaderObject, HeaderRenderer, HeaderRendererProps, HeaderRendererComponents, OnRowGroupExpandProps, OnSortProps, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRefType, TableRowProps, Theme, PinnedSectionsState, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, };
48
+ export { asRows } from "./utils/asRows";
49
+ export type { Accessor, AggregationConfig, AggregationType, BoundingBox, Cell, CellChangeProps, CellClickProps, CellRenderer, CellRendererProps, CellValue, ChartOptions, ColumnEditorConfig, ColumnEditorCustomRenderer, ColumnEditorCustomRendererProps, ColumnEditorRowRenderer, ColumnEditorRowRendererComponents, ColumnEditorRowRendererProps, ColumnEditorSearchFunction, ColumnType, ColumnVisibilityState, Comparator, ComparatorProps, CustomTheme, CustomThemeProps, DragHandlerProps, EmptyStateRenderer, EmptyStateRendererProps, EnumOption, ErrorStateRenderer, ErrorStateRendererProps, ExportToCSVProps, ExportValueGetter, ExportValueProps, FilterCondition, FooterRendererProps, GetRowId, GetRowIdParams, IconsConfig, LoadingStateRenderer, LoadingStateRendererProps, HeaderDropdown, HeaderDropdownProps, HeaderObject, HeaderRenderer, HeaderRendererProps, HeaderRendererComponents, OnRowGroupExpandProps, OnSortProps, QuickFilterConfig, QuickFilterGetter, QuickFilterGetterProps, QuickFilterMode, Row, RowButtonProps, RowId, RowSelectionChangeProps, RowState, SetHeaderRenameProps, SharedTableProps, ShowWhen, SimpleTableConfig, SimpleTableProps, SortColumn, TableAPI, TableFilterState, TableHeaderProps, TableRowProps, Theme, PinnedSectionsState, UpdateDataProps, ValueFormatter, ValueFormatterProps, ValueGetter, ValueGetterProps, };
@@ -1,5 +1,6 @@
1
1
  import HeaderObject from "./HeaderObject";
2
2
  import { ColumnEditorRowRenderer } from "./ColumnEditorRowRendererProps";
3
+ import { ColumnEditorCustomRenderer } from "./ColumnEditorCustomRendererProps";
3
4
  /**
4
5
  * Custom search function for filtering columns in the column editor
5
6
  * @param header - The header object to check
@@ -26,7 +27,9 @@ export interface ColumnEditorConfig {
26
27
  allowColumnPinning?: boolean;
27
28
  /** Custom renderer for column editor row layout to reposition icons and labels */
28
29
  rowRenderer?: ColumnEditorRowRenderer;
30
+ /** Custom renderer for the entire column editor panel. Receives pre-built sections (search, list, reset) and headers. */
31
+ customRenderer?: ColumnEditorCustomRenderer;
29
32
  }
30
- export declare const DEFAULT_COLUMN_EDITOR_CONFIG: Required<Omit<ColumnEditorConfig, "searchFunction" | "rowRenderer">>;
33
+ export declare const DEFAULT_COLUMN_EDITOR_CONFIG: Required<Omit<ColumnEditorConfig, "searchFunction" | "rowRenderer" | "customRenderer">>;
31
34
  /** Column editor config with defaults applied (text, searchEnabled, searchPlaceholder are required) */
32
- export type MergedColumnEditorConfig = Required<Pick<ColumnEditorConfig, "text" | "searchEnabled" | "searchPlaceholder" | "allowColumnPinning">> & Pick<ColumnEditorConfig, "searchFunction" | "rowRenderer">;
35
+ export type MergedColumnEditorConfig = Required<Pick<ColumnEditorConfig, "text" | "searchEnabled" | "searchPlaceholder" | "allowColumnPinning">> & Pick<ColumnEditorConfig, "searchFunction" | "rowRenderer" | "customRenderer">;
@@ -0,0 +1,14 @@
1
+ import type HeaderObject from "./HeaderObject";
2
+ export interface ColumnEditorCustomRendererProps {
3
+ /** The current headers array */
4
+ headers: HeaderObject[];
5
+ /** Pre-built search input section, or null if search is disabled */
6
+ searchSection: HTMLElement | null;
7
+ /** Pre-built column list section with drag-and-drop, checkboxes, etc. */
8
+ listSection: HTMLElement;
9
+ /** Pre-built reset button section, or null if no default headers are configured */
10
+ resetSection: HTMLElement | null;
11
+ /** Function to reset columns to their default configuration */
12
+ resetColumns?: () => void;
13
+ }
14
+ export type ColumnEditorCustomRenderer = (props: ColumnEditorCustomRendererProps) => HTMLElement | string | null;
@@ -80,7 +80,7 @@ type HeaderObject = {
80
80
  label: string;
81
81
  minWidth?: number | string;
82
82
  sortingOrder?: ("asc" | "desc" | null)[];
83
- nestedTable?: Omit<SimpleTableProps, "rows" | "loadingStateRenderer" | "errorStateRenderer" | "emptyStateRenderer" | "tableEmptyStateRenderer" | "expandIcon" | "filterIcon" | "sortUpIcon" | "sortDownIcon" | "nextIcon" | "prevIcon" | "headerCollapseIcon" | "headerExpandIcon">;
83
+ nestedTable?: Omit<SimpleTableProps, "rows" | "loadingStateRenderer" | "errorStateRenderer" | "emptyStateRenderer" | "tableEmptyStateRenderer">;
84
84
  pinned?: Pinned;
85
85
  quickFilterable?: boolean;
86
86
  quickFilterGetter?: QuickFilterGetter;
@@ -19,14 +19,12 @@ import { ColumnEditorConfig } from "./ColumnEditorConfig";
19
19
  import { VanillaIconsConfig } from "./IconsConfig";
20
20
  import { QuickFilterConfig } from "./QuickFilterTypes";
21
21
  export interface SimpleTableConfig {
22
- allowAnimations?: boolean;
23
22
  autoExpandColumns?: boolean;
24
23
  canExpandRowGroup?: (row: Row) => boolean;
25
24
  cellUpdateFlash?: boolean;
26
25
  className?: string;
27
26
  columnBorders?: boolean;
28
27
  columnEditorConfig?: ColumnEditorConfig;
29
- columnEditorText?: string;
30
28
  columnReordering?: boolean;
31
29
  columnResizing?: boolean;
32
30
  copyHeadersToClipboard?: boolean;
@@ -12,7 +12,6 @@ import OnNextPage from "./OnNextPage";
12
12
  import OnRowGroupExpandProps from "./OnRowGroupExpandProps";
13
13
  import RowSelectionChangeProps from "./RowSelectionChangeProps";
14
14
  import { RowButton } from "./RowButton";
15
- import TableRefType from "./TableRefType";
16
15
  import Theme from "./Theme";
17
16
  import { CustomThemeProps } from "./CustomTheme";
18
17
  import { GetRowId } from "./GetRowId";
@@ -26,7 +25,6 @@ export interface SimpleTableProps {
26
25
  className?: string;
27
26
  columnBorders?: boolean;
28
27
  columnEditorConfig?: ColumnEditorConfig;
29
- columnEditorText?: string;
30
28
  columnReordering?: boolean;
31
29
  columnResizing?: boolean;
32
30
  copyHeadersToClipboard?: boolean;
@@ -40,14 +38,10 @@ export interface SimpleTableProps {
40
38
  enableStickyParents?: boolean;
41
39
  errorStateRenderer?: ErrorStateRenderer;
42
40
  expandAll?: boolean;
43
- expandIcon?: IconsConfig["expand"];
44
41
  externalFilterHandling?: boolean;
45
42
  externalSortHandling?: boolean;
46
- filterIcon?: IconsConfig["filter"];
47
43
  footerRenderer?: (props: FooterRendererProps) => HTMLElement | string | null;
48
- headerCollapseIcon?: IconsConfig["headerCollapse"];
49
44
  headerDropdown?: HeaderDropdown;
50
- headerExpandIcon?: IconsConfig["headerExpand"];
51
45
  height?: string | number;
52
46
  hideFooter?: boolean;
53
47
  hideHeader?: boolean;
@@ -58,7 +52,6 @@ export interface SimpleTableProps {
58
52
  isLoading?: boolean;
59
53
  loadingStateRenderer?: LoadingStateRenderer;
60
54
  maxHeight?: string | number;
61
- nextIcon?: IconsConfig["next"];
62
55
  onCellClick?: (props: CellClickProps) => void;
63
56
  onCellEdit?: (props: CellChangeProps) => void;
64
57
  onColumnOrderChange?: (newHeaders: HeaderObject[]) => void;
@@ -74,7 +67,6 @@ export interface SimpleTableProps {
74
67
  onRowGroupExpand?: (props: OnRowGroupExpandProps) => void | Promise<void>;
75
68
  onRowSelectionChange?: (props: RowSelectionChangeProps) => void;
76
69
  onSortChange?: (sort: SortColumn | null) => void;
77
- prevIcon?: IconsConfig["prev"];
78
70
  quickFilter?: QuickFilterConfig;
79
71
  rowButtons?: RowButton[];
80
72
  rowGrouping?: Accessor[];
@@ -85,12 +77,7 @@ export interface SimpleTableProps {
85
77
  selectableColumns?: boolean;
86
78
  serverSidePagination?: boolean;
87
79
  shouldPaginate?: boolean;
88
- sortDownIcon?: IconsConfig["sortDown"];
89
- sortUpIcon?: IconsConfig["sortUp"];
90
80
  tableEmptyStateRenderer?: HTMLElement | string | null;
91
- tableRef?: {
92
- current: TableRefType | null;
93
- };
94
81
  theme?: Theme;
95
82
  totalRowCount?: number;
96
83
  useHoverRowBackground?: boolean;
@@ -0,0 +1,7 @@
1
+ import type Row from "../types/Row";
2
+ /**
3
+ * Structural typing bridge: domain row interfaces often do not assign to {@link Row}[]
4
+ * because `Row` uses an index signature. Use when passing typed data to `rows` and
5
+ * similar APIs.
6
+ */
7
+ export declare function asRows<T>(rows: readonly T[]): Row[];
@@ -1,4 +1,12 @@
1
1
  import { AbsoluteBodyCell, CellRenderContext } from "./types";
2
2
  export declare const createExpandIcon: (cell: AbsoluteBodyCell, context: CellRenderContext, isExpanded: boolean) => HTMLElement;
3
+ export type UpdateExpandIconStateOptions = {
4
+ /** aria-label when the group is expanded (chevron shows collapse action). */
5
+ ariaLabelWhenExpanded?: string;
6
+ /** aria-label when the group is collapsed (chevron shows expand action). */
7
+ ariaLabelWhenCollapsed?: string;
8
+ /** When true, sets aria-expanded to match isExpanded after the toggle. */
9
+ syncAriaExpanded?: boolean;
10
+ };
3
11
  /** Update expand/collapse icon direction on an existing cell (e.g. after expand state changes for nested grids). */
4
- export declare const updateExpandIconState: (cellElement: HTMLElement, isExpanded: boolean) => void;
12
+ export declare const updateExpandIconState: (cellElement: HTMLElement, isExpanded: boolean, options?: UpdateExpandIconStateOptions) => void;
@@ -27,5 +27,12 @@ export interface CreateColumnEditorRowOptions {
27
27
  setHeaders: (headers: HeaderObject[]) => void;
28
28
  onColumnVisibilityChange?: (state: ColumnVisibilityState) => void;
29
29
  onColumnOrderChange?: (headers: HeaderObject[]) => void;
30
+ /** When set (e.g. after expand toggle), used with updateExpandIconState so the chevron animates like table cells. */
31
+ previousExpandedHeaders?: ReadonlySet<string>;
30
32
  }
31
- export declare const createColumnEditorRow: (options: CreateColumnEditorRowOptions) => DocumentFragment;
33
+ export interface CreateColumnEditorRowResult {
34
+ fragment: DocumentFragment;
35
+ /** Run after the row fragment is connected to the document (e.g. listEl.appendChild). */
36
+ scheduleExpandIconAnimation?: () => void;
37
+ }
38
+ export declare const createColumnEditorRow: (options: CreateColumnEditorRowOptions) => CreateColumnEditorRowResult;
@@ -2,5 +2,5 @@ import HeaderObject from "../../types/HeaderObject";
2
2
  import { HeaderRenderContext } from "./types";
3
3
  /** Use same icon and animation as body row expand/collapse (icons.expand + st-expand-icon-container). */
4
4
  export declare const createCollapseIcon: (header: HeaderObject, context: HeaderRenderContext) => HTMLElement | null;
5
- /** Update header collapse icon direction on an existing cell (same pattern as body updateExpandIconState). */
5
+ /** Update header collapse icon direction on an existing cell (delegates to body updateExpandIconState). */
6
6
  export declare const updateHeaderCollapseIconState: (cellElement: HTMLElement, isCollapsed: boolean, label?: string) => void;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * TABLE REF METHODS TESTS
3
- * Tests for tableRef / getAPI() methods: getVisibleRows, getAllRows, getHeaders,
3
+ * Tests for TableAPI (getAPI()) methods: getVisibleRows, getAllRows, getHeaders,
4
4
  * getSortState/applySortState, getFilterState/applyFilter/clearFilter,
5
5
  * getCurrentPage/setPage, setQuickFilter, toggleColumnEditor/applyColumnVisibility,
6
6
  * expandAll/collapseAll/getExpandedDepths.