simple-table-core 3.0.0-beta.9 → 3.0.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/README.md +20 -17
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/src/core/SimpleTableVanilla.d.ts +2 -0
- package/dist/cjs/src/core/initialization/TableInitializer.d.ts +4 -1
- package/dist/cjs/src/core/rendering/RenderOrchestrator.d.ts +1 -0
- package/dist/cjs/src/core/rendering/TableRenderer.d.ts +1 -0
- package/dist/cjs/src/index.d.ts +3 -2
- package/dist/cjs/src/managers/DimensionManager.d.ts +3 -0
- package/dist/cjs/src/managers/SelectionManager/SelectionManager.d.ts +7 -0
- package/dist/cjs/src/managers/SelectionManager/mouseUtils.d.ts +2 -1
- package/dist/cjs/src/managers/SelectionManager/types.d.ts +6 -0
- package/dist/cjs/src/types/ColumnEditorConfig.d.ts +5 -2
- package/dist/cjs/src/types/ColumnEditorCustomRendererProps.d.ts +14 -0
- package/dist/cjs/src/types/CustomTheme.d.ts +2 -0
- package/dist/cjs/src/types/HeaderObject.d.ts +1 -1
- package/dist/cjs/src/types/SimpleTableConfig.d.ts +0 -2
- package/dist/cjs/src/types/SimpleTableProps.d.ts +0 -13
- package/dist/cjs/src/utils/asRows.d.ts +7 -0
- package/dist/cjs/src/utils/bodyCell/expansion.d.ts +9 -1
- package/dist/cjs/src/utils/columnEditor/createColumnEditor.d.ts +0 -1
- package/dist/cjs/src/utils/columnEditor/createColumnEditorPopout.d.ts +0 -1
- package/dist/cjs/src/utils/columnEditor/createColumnEditorRow.d.ts +8 -1
- package/dist/cjs/src/utils/filters/createDropdown.d.ts +17 -0
- package/dist/cjs/src/utils/filters/createFilterActions.d.ts +1 -0
- package/dist/cjs/src/utils/headerCell/collapsing.d.ts +1 -1
- package/dist/cjs/src/utils/headerCell/eventTracking.d.ts +3 -0
- package/dist/cjs/src/utils/headerCell/resizing.d.ts +1 -1
- package/dist/cjs/src/utils/headerCell/styling.d.ts +3 -3
- package/dist/cjs/src/utils/headerCell/types.d.ts +2 -0
- package/dist/cjs/src/utils/headerWidthUtils.d.ts +4 -2
- package/dist/cjs/src/utils/pinnedColumnUtils.d.ts +5 -1
- package/dist/cjs/src/utils/resizeUtils/index.d.ts +18 -1
- package/dist/cjs/src/utils/rowSeparatorRenderer.d.ts +4 -0
- package/dist/cjs/stories/SimpleTable.stories.d.ts +1 -0
- package/dist/cjs/stories/examples/infrastructure/InfrastructureExample.d.ts +1 -0
- package/dist/cjs/stories/examples/spreadsheet/SpreadsheetExample.d.ts +4 -0
- package/dist/cjs/stories/tests/07-RowSelectionTests.stories.d.ts +1 -0
- package/dist/cjs/stories/tests/10-ColumnPinningTests.stories.d.ts +9 -0
- package/dist/cjs/stories/tests/13-ColumnResizeTests.stories.d.ts +27 -0
- package/dist/cjs/stories/tests/37-TableRefMethodsTests.stories.d.ts +1 -1
- package/dist/cjs/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +127 -0
- package/dist/cjs/stories/tests/testUtils.d.ts +2 -0
- package/dist/cjs/styles.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/src/core/SimpleTableVanilla.d.ts +2 -0
- package/dist/src/core/initialization/TableInitializer.d.ts +4 -1
- package/dist/src/core/rendering/RenderOrchestrator.d.ts +1 -0
- package/dist/src/core/rendering/TableRenderer.d.ts +1 -0
- package/dist/src/index.d.ts +3 -2
- package/dist/src/managers/DimensionManager.d.ts +3 -0
- package/dist/src/managers/SelectionManager/SelectionManager.d.ts +7 -0
- package/dist/src/managers/SelectionManager/mouseUtils.d.ts +2 -1
- package/dist/src/managers/SelectionManager/types.d.ts +6 -0
- package/dist/src/types/ColumnEditorConfig.d.ts +5 -2
- package/dist/src/types/ColumnEditorCustomRendererProps.d.ts +14 -0
- package/dist/src/types/CustomTheme.d.ts +2 -0
- package/dist/src/types/HeaderObject.d.ts +1 -1
- package/dist/src/types/SimpleTableConfig.d.ts +0 -2
- package/dist/src/types/SimpleTableProps.d.ts +0 -13
- package/dist/src/utils/asRows.d.ts +7 -0
- package/dist/src/utils/bodyCell/expansion.d.ts +9 -1
- package/dist/src/utils/columnEditor/createColumnEditor.d.ts +0 -1
- package/dist/src/utils/columnEditor/createColumnEditorPopout.d.ts +0 -1
- package/dist/src/utils/columnEditor/createColumnEditorRow.d.ts +8 -1
- package/dist/src/utils/filters/createDropdown.d.ts +17 -0
- package/dist/src/utils/filters/createFilterActions.d.ts +1 -0
- package/dist/src/utils/headerCell/collapsing.d.ts +1 -1
- package/dist/src/utils/headerCell/eventTracking.d.ts +3 -0
- package/dist/src/utils/headerCell/resizing.d.ts +1 -1
- package/dist/src/utils/headerCell/styling.d.ts +3 -3
- package/dist/src/utils/headerCell/types.d.ts +2 -0
- package/dist/src/utils/headerWidthUtils.d.ts +4 -2
- package/dist/src/utils/pinnedColumnUtils.d.ts +5 -1
- package/dist/src/utils/resizeUtils/index.d.ts +18 -1
- package/dist/src/utils/rowSeparatorRenderer.d.ts +4 -0
- package/dist/stories/SimpleTable.stories.d.ts +1 -0
- package/dist/stories/examples/infrastructure/InfrastructureExample.d.ts +1 -0
- package/dist/stories/examples/spreadsheet/SpreadsheetExample.d.ts +4 -0
- package/dist/stories/tests/07-RowSelectionTests.stories.d.ts +1 -0
- package/dist/stories/tests/10-ColumnPinningTests.stories.d.ts +9 -0
- package/dist/stories/tests/13-ColumnResizeTests.stories.d.ts +27 -0
- package/dist/stories/tests/37-TableRefMethodsTests.stories.d.ts +1 -1
- package/dist/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +127 -0
- package/dist/stories/tests/testUtils.d.ts +2 -0
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/styles/all-themes.css +1 -0
- package/src/styles/base.css +61 -16
- package/src/styles/themes/modern-dark.css +4 -16
- package/src/styles/themes/modern-light.css +4 -16
- package/src/styles/themes/theme-custom.css +253 -0
- package/dist/cjs/src/types/TableRefType.d.ts +0 -78
- package/dist/cjs/src/utils/deprecatedPropsWarnings.d.ts +0 -10
- package/dist/src/types/TableRefType.d.ts +0 -78
- 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?:
|
|
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[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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
|
|
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, };
|
|
@@ -22,6 +22,8 @@ export declare class DimensionManager {
|
|
|
22
22
|
private subscribers;
|
|
23
23
|
private resizeObserver;
|
|
24
24
|
private rafId;
|
|
25
|
+
/** Set when applyContainerWidthSync updates state before any subscriber exists. */
|
|
26
|
+
private initialNotifyPending;
|
|
25
27
|
constructor(config: DimensionManagerConfig);
|
|
26
28
|
private getHeaderDepth;
|
|
27
29
|
private calculateMaxHeaderDepth;
|
|
@@ -29,6 +31,7 @@ export declare class DimensionManager {
|
|
|
29
31
|
private convertHeightToPixels;
|
|
30
32
|
private calculateContentHeight;
|
|
31
33
|
private observeContainer;
|
|
34
|
+
private applyContainerWidthSync;
|
|
32
35
|
updateConfig(config: Partial<DimensionManagerConfig>): void;
|
|
33
36
|
subscribe(callback: StateChangeCallback): () => void;
|
|
34
37
|
private notifySubscribers;
|
|
@@ -139,6 +139,13 @@ export declare class SelectionManager {
|
|
|
139
139
|
*/
|
|
140
140
|
private updateCellFlashClasses;
|
|
141
141
|
private static readonly SELECTION_CLASSES;
|
|
142
|
+
private static readonly HEADER_SELECTION_CLASSES;
|
|
143
|
+
/**
|
|
144
|
+
* Keep column header highlight in sync with cell/column selection during drag.
|
|
145
|
+
* Body cells are patched here; headers normally update only on full render.
|
|
146
|
+
*/
|
|
147
|
+
private syncHeaderSelectionClasses;
|
|
148
|
+
private clearHeaderSelectionHighlightClasses;
|
|
142
149
|
/**
|
|
143
150
|
* Apply selection classes to all currently rendered cells. Used after drag ends
|
|
144
151
|
* so that the DOM (which may have been replaced during scroll) reflects selection.
|
|
@@ -11,5 +11,6 @@ export declare function calculateNearestCell(clientX: number, clientY: number):
|
|
|
11
11
|
export declare function getCellFromMousePosition(clientX: number, clientY: number): Cell | null;
|
|
12
12
|
/**
|
|
13
13
|
* Handle auto-scrolling when dragging near table edges.
|
|
14
|
+
* @param root - Table root (e.g. `.simple-table-root`); limits queries to this instance.
|
|
14
15
|
*/
|
|
15
|
-
export declare function handleAutoScroll(clientX: number, clientY: number): void;
|
|
16
|
+
export declare function handleAutoScroll(clientX: number, clientY: number, root?: Document | HTMLElement): void;
|
|
@@ -6,6 +6,12 @@ import type { CustomTheme } from "../../types/CustomTheme";
|
|
|
6
6
|
export declare const createSetString: ({ rowIndex, colIndex, rowId }: Cell) => string;
|
|
7
7
|
export interface SelectionManagerConfig {
|
|
8
8
|
selectableCells: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* When true, column header click selects columns (`st-header-selected` on headers).
|
|
11
|
+
* Cell-in-column header tint (`st-header-has-highlighted-cell`) also applies when `selectableCells` is true
|
|
12
|
+
* even if this is false.
|
|
13
|
+
*/
|
|
14
|
+
selectableColumns?: boolean;
|
|
9
15
|
headers: HeaderObject[];
|
|
10
16
|
tableRows: TableRowType[];
|
|
11
17
|
onCellEdit?: (props: any) => void;
|
|
@@ -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;
|
|
@@ -24,3 +24,5 @@ export type CustomTheme = Required<CustomThemeProps>;
|
|
|
24
24
|
* These match the original hardcoded constants throughout the codebase
|
|
25
25
|
*/
|
|
26
26
|
export declare const DEFAULT_CUSTOM_THEME: CustomTheme;
|
|
27
|
+
/** Shallow value equality — used to skip layout work when React passes a new `customTheme` object with the same numbers. */
|
|
28
|
+
export declare function areCustomThemesEqual(a: CustomTheme, b: CustomTheme): boolean;
|
|
@@ -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"
|
|
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;
|
|
@@ -10,7 +10,6 @@ export interface CreateColumnEditorOptions {
|
|
|
10
10
|
searchPlaceholder: string;
|
|
11
11
|
searchFunction?: ColumnEditorSearchFunction;
|
|
12
12
|
columnEditorConfig: ColumnEditorConfig;
|
|
13
|
-
contextHeaders: HeaderObject[];
|
|
14
13
|
essentialAccessors?: ReadonlySet<string>;
|
|
15
14
|
resetColumns?: () => void;
|
|
16
15
|
setHeaders: (headers: HeaderObject[]) => void;
|
|
@@ -8,7 +8,6 @@ export interface CreateColumnEditorPopoutOptions {
|
|
|
8
8
|
searchPlaceholder: string;
|
|
9
9
|
searchFunction?: ColumnEditorSearchFunction;
|
|
10
10
|
columnEditorConfig: ColumnEditorConfig;
|
|
11
|
-
contextHeaders: HeaderObject[];
|
|
12
11
|
essentialAccessors?: ReadonlySet<string>;
|
|
13
12
|
setHeaders: (headers: HeaderObject[]) => void;
|
|
14
13
|
onColumnVisibilityChange?: (state: ColumnVisibilityState) => 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
|
|
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;
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter / filter-UI dropdown positioning (React-era parity):
|
|
3
|
+
* - Fixed: portaled under `.simple-table-root`, anchored to `anchorElement` (e.g. filter icon) so
|
|
4
|
+
* `overflow: hidden` on `.st-header-cell` does not clip the panel. Same top/left +4px and
|
|
5
|
+
* container-based flip as legacy React Dropdown.tsx.
|
|
6
|
+
* - Absolute: stays under caller’s parent (e.g. `.st-custom-select`); use `anchorElement` for the
|
|
7
|
+
* trigger rect vs `position: relative` parent (React CustomSelect pattern).
|
|
8
|
+
*/
|
|
1
9
|
export interface CreateDropdownOptions {
|
|
2
10
|
children: HTMLElement;
|
|
3
11
|
containerRef?: HTMLElement;
|
|
4
12
|
mainBodyRef?: HTMLElement;
|
|
13
|
+
/** Rect used for placement. Required for fixed portaling (e.g. filter icon); for absolute, pass the real trigger (button/input) when it differs from the dropdown parent. */
|
|
14
|
+
anchorElement?: HTMLElement;
|
|
5
15
|
onClose: () => void;
|
|
6
16
|
open: boolean;
|
|
7
17
|
overflow?: "auto" | "visible" | "hidden";
|
|
8
18
|
width?: number;
|
|
19
|
+
maxWidth?: number;
|
|
9
20
|
positioning?: "fixed" | "absolute";
|
|
21
|
+
/**
|
|
22
|
+
* When true, this panel does not clip overflowing descendants (e.g. nested operator menus inside
|
|
23
|
+
* the filter popover). Uses overflow: visible and drops max-height on the shell — see
|
|
24
|
+
* `.st-dropdown-content--allow-descendant-overflow` in base.css.
|
|
25
|
+
*/
|
|
26
|
+
allowDescendantOverflow?: boolean;
|
|
10
27
|
}
|
|
11
28
|
export declare const createDropdown: (options: CreateDropdownOptions) => {
|
|
12
29
|
element: HTMLDivElement;
|
|
@@ -4,6 +4,7 @@ export interface CreateFilterActionsOptions {
|
|
|
4
4
|
canApply: boolean;
|
|
5
5
|
showClear: boolean;
|
|
6
6
|
}
|
|
7
|
+
/** Matches React FilterActions: `st-filter-button-apply`, `st-filter-button-clear`, `st-filter-button-disabled`. */
|
|
7
8
|
export declare const createFilterActions: (options: CreateFilterActionsOptions) => {
|
|
8
9
|
element: HTMLDivElement;
|
|
9
10
|
update: (newOptions: Partial<CreateFilterActionsOptions>) => void;
|
|
@@ -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 (
|
|
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;
|
|
@@ -22,4 +22,7 @@ export declare const getHeaderPositionCache: (container: HTMLElement) => Map<str
|
|
|
22
22
|
export declare const REVERT_TO_PREVIOUS_HEADERS_DELAY = 1500;
|
|
23
23
|
export declare const throttle: (callback: () => void, limit: number) => void;
|
|
24
24
|
export declare const addTrackedEventListener: (element: HTMLElement, event: string, handler: EventListener, options?: AddEventListenerOptions) => void;
|
|
25
|
+
/** Header tooltips are portaled under .simple-table-root; remove them when header DOM is torn down
|
|
26
|
+
* without pointer leave (e.g. sort/filter invalidates context cache and removes header cells). */
|
|
27
|
+
export declare const removeFloatingHeaderTooltips: (fromElement: HTMLElement) => void;
|
|
25
28
|
export declare const cleanupHeaderCellRendering: (container?: HTMLElement) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import HeaderObject from "../../types/HeaderObject";
|
|
2
2
|
import { HeaderRenderContext } from "./types";
|
|
3
|
-
export declare const createResizeHandle: (header: HeaderObject, context: HeaderRenderContext,
|
|
3
|
+
export declare const createResizeHandle: (header: HeaderObject, context: HeaderRenderContext, isLastMainAutoExpandColumn: boolean) => HTMLElement | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbsoluteCell, HeaderRenderContext } from "./types";
|
|
2
|
-
export declare const calculateHeaderCellClasses: (cell: AbsoluteCell, context: HeaderRenderContext,
|
|
3
|
-
export declare const createHeaderCellElement: (cell: AbsoluteCell, context: HeaderRenderContext,
|
|
2
|
+
export declare const calculateHeaderCellClasses: (cell: AbsoluteCell, context: HeaderRenderContext, isLastMainAutoExpandColumn: boolean) => string;
|
|
3
|
+
export declare const createHeaderCellElement: (cell: AbsoluteCell, context: HeaderRenderContext, isLastMainAutoExpandColumn: boolean) => HTMLElement;
|
|
4
4
|
export declare const getLastHeaderIndex: (absoluteCells: AbsoluteCell[]) => number;
|
|
5
|
-
export declare const updateHeaderCellElement: (cellElement: HTMLElement, cell: AbsoluteCell, context: HeaderRenderContext,
|
|
5
|
+
export declare const updateHeaderCellElement: (cellElement: HTMLElement, cell: AbsoluteCell, context: HeaderRenderContext, isLastMainAutoExpandColumn: boolean) => void;
|
|
@@ -39,6 +39,8 @@ export interface HeaderRenderContext {
|
|
|
39
39
|
handleApplyFilter: (filter: FilterCondition) => void;
|
|
40
40
|
handleClearFilter: (accessor: Accessor) => void;
|
|
41
41
|
handleSelectAll?: (checked: boolean) => void;
|
|
42
|
+
/** Live header tree from table state (avoids stale `headers` snapshot in long-lived handlers). */
|
|
43
|
+
getHeaders: () => HeaderObject[];
|
|
42
44
|
headerHeight: number;
|
|
43
45
|
headerRegistry?: Map<string, {
|
|
44
46
|
setEditing: (editing: boolean) => void;
|
|
@@ -13,8 +13,8 @@ export declare const DEFAULT_TABLE_WIDTH = 800;
|
|
|
13
13
|
* Normalize header widths so that fr and % are converted to pixels.
|
|
14
14
|
* Call this as soon as headers are received so the rest of the code can assume numeric widths.
|
|
15
15
|
* If totalWidth is not provided, a reasonable total is computed from fixed widths + default for fr columns.
|
|
16
|
-
* If options.containerWidth is provided,
|
|
17
|
-
*
|
|
16
|
+
* If options.containerWidth is provided, all fr/% columns are resolved against the full container width,
|
|
17
|
+
* so pinned and non-pinned fr columns share the same proportional pool.
|
|
18
18
|
*/
|
|
19
19
|
export declare function normalizeHeaderWidths(headers: HeaderObject[], totalWidthOrOptions?: number | {
|
|
20
20
|
containerWidth: number;
|
|
@@ -53,4 +53,6 @@ export declare const calculateHeaderContentWidth: (accessor: Accessor, options?:
|
|
|
53
53
|
header?: HeaderObject;
|
|
54
54
|
maxWidth?: number;
|
|
55
55
|
sampleSize?: number;
|
|
56
|
+
/** Scope `.st-cell-content` font/padding sampling to this table instance */
|
|
57
|
+
styleRoot?: ParentNode | null;
|
|
56
58
|
}) => number;
|
|
@@ -21,5 +21,9 @@ export declare function getPinnedSectionsState(headers: HeaderObject[]): PinnedS
|
|
|
21
21
|
* Clamps essential columns to the left within each section. Returns null if accessors don't match roots.
|
|
22
22
|
*/
|
|
23
23
|
export declare function rebuildHeadersFromPinnedState(headers: HeaderObject[], state: PinnedSectionsState, essentialAccessors: ReadonlySet<string>): HeaderObject[] | null;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Move a root column to another pin section.
|
|
26
|
+
* Appends within left/right targets. For `main`, left-pinned columns are inserted at the
|
|
27
|
+
* start of main; right-pinned (and other) columns are inserted at the end of main.
|
|
28
|
+
*/
|
|
25
29
|
export declare function moveRootColumnPinSide(headers: HeaderObject[], accessor: Accessor, target: Exclude<PanelSection, "main"> | "main", essentialAccessors: ReadonlySet<string>): HeaderObject[] | null;
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
+
import type HeaderObject from "../../types/HeaderObject";
|
|
2
|
+
import type { Accessor } from "../../types/HeaderObject";
|
|
1
3
|
import type { HandleResizeStartProps } from "../../types/HandleResizeStartProps";
|
|
2
4
|
/**
|
|
3
5
|
* Handler for when resize dragging starts
|
|
4
6
|
*/
|
|
5
|
-
export declare const handleResizeStart: ({ autoExpandColumns, collapsedHeaders, containerWidth, event, header, headers, onColumnWidthChange, reverse, setHeaders, setIsResizing, startWidth, }: HandleResizeStartProps) => void;
|
|
7
|
+
export declare const handleResizeStart: ({ autoExpandColumns, collapsedHeaders, containerWidth, event, header, headers, mainBodyRef, onColumnWidthChange, reverse, setHeaders, setIsResizing, startWidth, }: HandleResizeStartProps) => void;
|
|
8
|
+
export type ApplyColumnAutoFitWithAutoExpandParams = {
|
|
9
|
+
collapsedHeaders: Set<Accessor>;
|
|
10
|
+
containerWidth: number;
|
|
11
|
+
getTargetLeafWidth: (leafHeader: HeaderObject) => number;
|
|
12
|
+
header: HeaderObject;
|
|
13
|
+
headerCellElement: HTMLElement | null;
|
|
14
|
+
headers: HeaderObject[];
|
|
15
|
+
mainBodyRef: HandleResizeStartProps["mainBodyRef"];
|
|
16
|
+
reverse: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Apply a one-shot "fit to content" width for a column while preserving autoExpand
|
|
20
|
+
* compensation (same redistribution rules as dragging the resize handle).
|
|
21
|
+
*/
|
|
22
|
+
export declare const applyColumnAutoFitWithAutoExpand: ({ header, headers, collapsedHeaders, containerWidth, mainBodyRef, reverse, headerCellElement, getTargetLeafWidth, }: ApplyColumnAutoFitWithAutoExpandParams) => void;
|
|
@@ -7,6 +7,10 @@ export interface CreateRowSeparatorOptions {
|
|
|
7
7
|
heightOffsets?: HeightOffsets;
|
|
8
8
|
customTheme?: CustomTheme;
|
|
9
9
|
isSticky?: boolean;
|
|
10
|
+
/** Same px width as the body/sticky section (`SectionRenderer` / sticky pane); omit to use 100%. */
|
|
11
|
+
sectionWidthPx?: number;
|
|
10
12
|
}
|
|
13
|
+
/** Keep separator width in sync with section layout (resize, pinned width changes). */
|
|
14
|
+
export declare const applyRowSeparatorSectionWidth: (separator: HTMLElement, sectionWidthPx?: number) => void;
|
|
11
15
|
export declare const createRowSeparator: (options: CreateRowSeparatorOptions) => HTMLElement;
|
|
12
16
|
export declare const createSpacerRow: (position: number, rowHeight: number, heightOffsets: HeightOffsets | undefined, customTheme: CustomTheme, className: string, height?: number) => HTMLElement;
|
|
@@ -58,5 +58,6 @@ export declare const RowSelection: StoryObj;
|
|
|
58
58
|
export declare const SalesExample: StoryObj;
|
|
59
59
|
export declare const SelectableCells: StoryObj;
|
|
60
60
|
export declare const ServerSidePagination: StoryObj;
|
|
61
|
+
export declare const Spreadsheet: StoryObj;
|
|
61
62
|
export declare const Theming: StoryObj;
|
|
62
63
|
export declare const Tooltip: StoryObj;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type UniversalVanillaArgs } from "../../vanillaStoryConfig";
|
|
2
|
+
import "./spreadsheet-demo.css";
|
|
3
|
+
export declare const spreadsheetExampleDefaults: Partial<UniversalVanillaArgs>;
|
|
4
|
+
export declare function renderSpreadsheetExample(args?: Partial<UniversalVanillaArgs>): HTMLElement;
|
|
@@ -30,6 +30,15 @@ export declare const BothLeftAndRightPinned: {
|
|
|
30
30
|
canvasElement: any;
|
|
31
31
|
}) => Promise<void>;
|
|
32
32
|
};
|
|
33
|
+
/** Document order of pinned header/body sections: left before main before right. */
|
|
34
|
+
export declare const PinnedSectionsDomOrder: {
|
|
35
|
+
play: ({ canvasElement }: {
|
|
36
|
+
canvasElement: HTMLElement;
|
|
37
|
+
}) => Promise<void>;
|
|
38
|
+
render: () => HTMLDivElement & {
|
|
39
|
+
_table?: SimpleTableVanilla | undefined;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
33
42
|
export declare const MultipleLeftPinnedColumns: {
|
|
34
43
|
render: () => HTMLDivElement & {
|
|
35
44
|
_table?: SimpleTableVanilla | undefined;
|
|
@@ -53,6 +53,33 @@ export declare const OnColumnWidthChangeCallbackFires: {
|
|
|
53
53
|
}) => Promise<void>;
|
|
54
54
|
};
|
|
55
55
|
export declare const DoubleClickResizeHandleAutoFit: {
|
|
56
|
+
parameters: {
|
|
57
|
+
tags: string[];
|
|
58
|
+
};
|
|
59
|
+
render: () => HTMLDivElement & {
|
|
60
|
+
_table?: SimpleTableVanilla | undefined;
|
|
61
|
+
};
|
|
62
|
+
play: ({ canvasElement }: {
|
|
63
|
+
canvasElement: HTMLElement;
|
|
64
|
+
}) => Promise<void>;
|
|
65
|
+
};
|
|
66
|
+
export declare const ResizeLeftPinnedColumn: {
|
|
67
|
+
render: () => HTMLDivElement & {
|
|
68
|
+
_table?: SimpleTableVanilla | undefined;
|
|
69
|
+
};
|
|
70
|
+
play: ({ canvasElement }: {
|
|
71
|
+
canvasElement: HTMLElement;
|
|
72
|
+
}) => Promise<void>;
|
|
73
|
+
};
|
|
74
|
+
export declare const ResizeRightPinnedColumn: {
|
|
75
|
+
render: () => HTMLDivElement & {
|
|
76
|
+
_table?: SimpleTableVanilla | undefined;
|
|
77
|
+
};
|
|
78
|
+
play: ({ canvasElement }: {
|
|
79
|
+
canvasElement: HTMLElement;
|
|
80
|
+
}) => Promise<void>;
|
|
81
|
+
};
|
|
82
|
+
export declare const ResizeWithBothPinnedSections: {
|
|
56
83
|
render: () => HTMLDivElement & {
|
|
57
84
|
_table?: SimpleTableVanilla | undefined;
|
|
58
85
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TABLE REF METHODS TESTS
|
|
3
|
-
* Tests for
|
|
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.
|