simple-table-core 4.0.3 → 4.0.5
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/dist/cjs/index.js +1 -1
- package/dist/consts/general-consts.d.ts +2 -2
- package/dist/core/SimpleTableVanilla.d.ts +3 -3
- package/dist/core/api/TableAPIImpl.d.ts +6 -6
- package/dist/core/initialization/TableInitializer.d.ts +4 -4
- package/dist/core/rendering/RenderOrchestrator.d.ts +9 -9
- package/dist/core/rendering/SectionRenderer.d.ts +3 -3
- package/dist/core/rendering/TableRenderer.d.ts +8 -8
- package/dist/hooks/contentHeight.d.ts +2 -2
- package/dist/hooks/expandedDepths.d.ts +1 -1
- package/dist/hooks/handleOutsideClick.d.ts +3 -3
- package/dist/hooks/useAggregatedRows.d.ts +2 -2
- package/dist/hooks/useQuickFilter.d.ts +2 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +1 -1
- package/dist/managers/AutoScaleManager.d.ts +5 -5
- package/dist/managers/ColumnManager.d.ts +12 -12
- package/dist/managers/DimensionManager.d.ts +2 -2
- package/dist/managers/DragHandlerManager.d.ts +20 -20
- package/dist/managers/FilterManager.d.ts +2 -2
- package/dist/managers/PivotManager.d.ts +4 -4
- package/dist/managers/RowManager.d.ts +2 -2
- package/dist/managers/SelectionManager/types.d.ts +3 -3
- package/dist/managers/SortManager.d.ts +2 -2
- package/dist/managers/TableManager.d.ts +4 -4
- package/dist/types/CellChangeProps.d.ts +1 -1
- package/dist/types/CellClickProps.d.ts +1 -1
- package/dist/types/CellRendererProps.d.ts +1 -1
- package/dist/types/{HeaderObject.d.ts → ColumnDef.d.ts} +7 -21
- package/dist/types/ColumnEditorConfig.d.ts +2 -2
- package/dist/types/ColumnEditorCustomRendererProps.d.ts +2 -2
- package/dist/types/ColumnEditorRowRendererProps.d.ts +6 -6
- package/dist/types/ColumnVisibilityTypes.d.ts +1 -1
- package/dist/types/DragHandlerProps.d.ts +6 -6
- package/dist/types/FilterTypes.d.ts +1 -1
- package/dist/types/FlattenedHeader.d.ts +3 -3
- package/dist/types/HandleResizeStartProps.d.ts +5 -5
- package/dist/types/HeaderRendererProps.d.ts +3 -3
- package/dist/types/OnRowGroupExpandProps.d.ts +1 -1
- package/dist/types/OnSortProps.d.ts +1 -1
- package/dist/types/PinnedSectionsState.d.ts +1 -1
- package/dist/types/PivotTypes.d.ts +3 -3
- package/dist/types/QuickFilterTypes.d.ts +1 -1
- package/dist/types/SharedTableProps.d.ts +7 -7
- package/dist/types/SimpleTableConfig.d.ts +24 -16
- package/dist/types/SimpleTableProps.d.ts +19 -58
- package/dist/types/SortColumn.d.ts +2 -2
- package/dist/types/TableAPI.d.ts +4 -4
- package/dist/types/TableBodyProps.d.ts +3 -3
- package/dist/types/TableHeaderProps.d.ts +4 -4
- package/dist/types/TableHeaderSectionProps.d.ts +2 -2
- package/dist/types/TableRow.d.ts +2 -2
- package/dist/types/TableRowProps.d.ts +6 -6
- package/dist/types/UpdateCellProps.d.ts +1 -1
- package/dist/utils/bodyCell/content.d.ts +2 -2
- package/dist/utils/bodyCell/types.d.ts +6 -6
- package/dist/utils/cellClipboardUtils.d.ts +4 -4
- package/dist/utils/cellUtils.d.ts +3 -3
- package/dist/utils/collapseUtils.d.ts +7 -7
- package/dist/utils/columnEditor/columnEditorUtils.d.ts +5 -5
- package/dist/utils/columnEditor/createColumnEditor.d.ts +5 -5
- package/dist/utils/columnEditor/createColumnEditorPopout.d.ts +4 -4
- package/dist/utils/columnEditor/createColumnEditorRow.d.ts +6 -6
- package/dist/utils/columnIndicesUtils.d.ts +4 -4
- package/dist/utils/columnVirtualizationUtils.d.ts +10 -10
- package/dist/utils/csvExportUtils.d.ts +3 -3
- package/dist/utils/filters/createBooleanFilter.d.ts +2 -2
- package/dist/utils/filters/createDateFilter.d.ts +2 -2
- package/dist/utils/filters/createEnumFilter.d.ts +2 -2
- package/dist/utils/filters/createFilterDropdown.d.ts +2 -2
- package/dist/utils/filters/createNumberFilter.d.ts +2 -2
- package/dist/utils/filters/createStringFilter.d.ts +2 -2
- package/dist/utils/footer/createTableFooter.d.ts +1 -1
- package/dist/utils/generalUtils.d.ts +2 -2
- package/dist/utils/headerCell/collapsing.d.ts +2 -2
- package/dist/utils/headerCell/dragging.d.ts +4 -4
- package/dist/utils/headerCell/editing.d.ts +3 -3
- package/dist/utils/headerCell/eventTracking.d.ts +3 -3
- package/dist/utils/headerCell/filtering.d.ts +2 -2
- package/dist/utils/headerCell/resizing.d.ts +2 -2
- package/dist/utils/headerCell/sorting.d.ts +2 -2
- package/dist/utils/headerCell/types.d.ts +13 -13
- package/dist/utils/headerLayoutUtils.d.ts +2 -2
- package/dist/utils/headerUtils.d.ts +5 -5
- package/dist/utils/headerWidthUtils.d.ts +10 -10
- package/dist/utils/horizontalScrollbarRenderer.d.ts +1 -1
- package/dist/utils/infiniteScrollUtils.d.ts +1 -1
- package/dist/utils/normalizeConfig.d.ts +8 -53
- package/dist/utils/pinnedColumnUtils.d.ts +13 -13
- package/dist/utils/pivot/pivotRows.d.ts +4 -4
- package/dist/utils/propSyncEqual.d.ts +4 -4
- package/dist/utils/resizeUtils/autoExpandResize.d.ts +5 -5
- package/dist/utils/resizeUtils/compensation.d.ts +2 -2
- package/dist/utils/resizeUtils/domUpdates.d.ts +3 -3
- package/dist/utils/resizeUtils/index.d.ts +5 -5
- package/dist/utils/resizeUtils/maxWidth.d.ts +3 -3
- package/dist/utils/resizeUtils/parentHeaderResize.d.ts +2 -2
- package/dist/utils/resizeUtils/sectionWidths.d.ts +2 -2
- package/dist/utils/rowFlattening.d.ts +2 -2
- package/dist/utils/rowProcessing.d.ts +2 -2
- package/dist/utils/rowSelectionUtils.d.ts +2 -2
- package/dist/utils/rowUtils.d.ts +2 -2
- package/dist/utils/sortUtils.d.ts +2 -2
- package/dist/utils/stickyParentsRenderer.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type ColumnDef from "./ColumnDef";
|
|
2
|
+
import { Accessor } from "./ColumnDef";
|
|
2
3
|
import Row from "./Row";
|
|
3
4
|
import { VanillaEmptyStateRenderer, VanillaErrorStateRenderer, VanillaLoadingStateRenderer } from "./RowStateRendererProps";
|
|
4
5
|
import FooterRendererProps from "./FooterRendererProps";
|
|
@@ -23,9 +24,8 @@ import { AnimationsConfig } from "./AnimationsConfig";
|
|
|
23
24
|
import type { FooterPosition } from "./FooterPosition";
|
|
24
25
|
import type { PivotConfig } from "./PivotTypes";
|
|
25
26
|
/**
|
|
26
|
-
* Canonical runtime config after {@link normalizeConfig}.
|
|
27
|
-
*
|
|
28
|
-
* {@link SimpleTableConfigInput} / {@link SimpleTableProps} and collapsed here.
|
|
27
|
+
* Canonical runtime config after {@link normalizeConfig}.
|
|
28
|
+
* Preferred public prop names only (no legacy aliases).
|
|
29
29
|
*/
|
|
30
30
|
export interface SimpleTableConfig {
|
|
31
31
|
animations?: AnimationsConfig;
|
|
@@ -44,13 +44,18 @@ export interface SimpleTableConfig {
|
|
|
44
44
|
columnEditorConfig?: ColumnEditorConfig;
|
|
45
45
|
columnReordering?: boolean;
|
|
46
46
|
columnResizing?: boolean;
|
|
47
|
+
/** Column definitions. */
|
|
48
|
+
columns: ColumnDef[];
|
|
47
49
|
copyHeadersToClipboard?: boolean;
|
|
48
50
|
customTheme?: CustomThemeProps;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
/** Show the column editor / visibility UI. */
|
|
52
|
+
enableColumnEditor?: boolean;
|
|
53
|
+
/** Open the column editor when the table loads. */
|
|
54
|
+
enableColumnEditorInitOpen?: boolean;
|
|
52
55
|
emptyStateRenderer?: VanillaEmptyStateRenderer;
|
|
53
56
|
enableHeaderEditing?: boolean;
|
|
57
|
+
/** Enable client-side pagination. */
|
|
58
|
+
enablePagination?: boolean;
|
|
54
59
|
enableRowSelection?: boolean;
|
|
55
60
|
/** @see SimpleTableProps.rowSelectionMode */
|
|
56
61
|
rowSelectionMode?: RowSelectionMode;
|
|
@@ -78,6 +83,8 @@ export interface SimpleTableConfig {
|
|
|
78
83
|
height?: string | number;
|
|
79
84
|
hideFooter?: boolean;
|
|
80
85
|
hideHeader?: boolean;
|
|
86
|
+
/** Highlight the hovered row. */
|
|
87
|
+
hoverRowBackground?: boolean;
|
|
81
88
|
icons?: VanillaIconsConfig;
|
|
82
89
|
includeHeadersInCSVExport?: boolean;
|
|
83
90
|
initialSortColumn?: string;
|
|
@@ -85,15 +92,20 @@ export interface SimpleTableConfig {
|
|
|
85
92
|
isLoading?: boolean;
|
|
86
93
|
loadingStateRenderer?: VanillaLoadingStateRenderer;
|
|
87
94
|
maxHeight?: string | number;
|
|
95
|
+
/** Alternate column background. */
|
|
96
|
+
oddColumnBackground?: boolean;
|
|
97
|
+
/** Alternate odd/even row backgrounds. */
|
|
98
|
+
oddEvenRowBackground?: boolean;
|
|
88
99
|
onCellClick?: (props: CellClickProps) => void;
|
|
89
100
|
onCellEdit?: (props: CellChangeProps) => void;
|
|
90
|
-
onColumnOrderChange?: (newHeaders:
|
|
91
|
-
onColumnSelect?: (header:
|
|
101
|
+
onColumnOrderChange?: (newHeaders: ColumnDef[]) => void;
|
|
102
|
+
onColumnSelect?: (header: ColumnDef) => void;
|
|
92
103
|
onColumnVisibilityChange?: (visibilityState: ColumnVisibilityState) => void;
|
|
93
|
-
onColumnWidthChange?: (headers:
|
|
104
|
+
onColumnWidthChange?: (headers: ColumnDef[]) => void;
|
|
94
105
|
onFilterChange?: (filters: TableFilterState) => void;
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
/** Called once when the table is ready. */
|
|
107
|
+
onTableReady?: () => void;
|
|
108
|
+
onHeaderEdit?: (header: ColumnDef, newLabel: string) => void;
|
|
97
109
|
infiniteScrollThreshold?: number;
|
|
98
110
|
onLoadMore?: () => void;
|
|
99
111
|
onNextPage?: OnNextPage;
|
|
@@ -125,11 +137,7 @@ export interface SimpleTableConfig {
|
|
|
125
137
|
selectableCells?: boolean;
|
|
126
138
|
selectableColumns?: boolean;
|
|
127
139
|
serverSidePagination?: boolean;
|
|
128
|
-
shouldPaginate?: boolean;
|
|
129
140
|
tableEmptyStateRenderer?: HTMLElement | string | null;
|
|
130
141
|
theme?: Theme;
|
|
131
142
|
totalRowCount?: number;
|
|
132
|
-
useHoverRowBackground?: boolean;
|
|
133
|
-
useOddColumnBackground?: boolean;
|
|
134
|
-
useOddEvenRowBackground?: boolean;
|
|
135
143
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type ColumnDef from "./ColumnDef";
|
|
2
|
+
import { Accessor } from "./ColumnDef";
|
|
2
3
|
import Row from "./Row";
|
|
3
4
|
import { EmptyStateRenderer, ErrorStateRenderer, LoadingStateRenderer } from "./RowStateRendererProps";
|
|
4
5
|
import FooterRendererProps from "./FooterRendererProps";
|
|
@@ -32,31 +33,18 @@ export interface SimpleTableProps {
|
|
|
32
33
|
columnEditorConfig?: ColumnEditorConfig;
|
|
33
34
|
columnReordering?: boolean;
|
|
34
35
|
columnResizing?: boolean;
|
|
36
|
+
/** Column definitions. */
|
|
37
|
+
columns?: ColumnDef[];
|
|
35
38
|
copyHeadersToClipboard?: boolean;
|
|
36
39
|
customTheme?: CustomThemeProps;
|
|
37
|
-
/**
|
|
38
|
-
* Column definitions.
|
|
39
|
-
* @deprecated Prefer {@link columns}
|
|
40
|
-
*/
|
|
41
|
-
defaultHeaders?: HeaderObject[];
|
|
42
|
-
/** Column definitions. Preferred over `defaultHeaders`. */
|
|
43
|
-
columns?: HeaderObject[];
|
|
44
|
-
/**
|
|
45
|
-
* Show the column editor / visibility UI.
|
|
46
|
-
* @deprecated Prefer {@link enableColumnEditor}
|
|
47
|
-
*/
|
|
48
|
-
editColumns?: boolean;
|
|
49
|
-
/** Show the column editor / visibility UI. Preferred over `editColumns`. */
|
|
40
|
+
/** Show the column editor / visibility UI. */
|
|
50
41
|
enableColumnEditor?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Open the column editor when the table loads.
|
|
53
|
-
* @deprecated Prefer {@link enableColumnEditorInitOpen}
|
|
54
|
-
*/
|
|
55
|
-
editColumnsInitOpen?: boolean;
|
|
56
|
-
/** Open the column editor when the table loads. Preferred over `editColumnsInitOpen`. */
|
|
42
|
+
/** Open the column editor when the table loads. */
|
|
57
43
|
enableColumnEditorInitOpen?: boolean;
|
|
58
44
|
emptyStateRenderer?: EmptyStateRenderer;
|
|
59
45
|
enableHeaderEditing?: boolean;
|
|
46
|
+
/** Enable client-side pagination. */
|
|
47
|
+
enablePagination?: boolean;
|
|
60
48
|
enableRowSelection?: boolean;
|
|
61
49
|
/**
|
|
62
50
|
* Row selection mode when `enableRowSelection` is true.
|
|
@@ -102,6 +90,8 @@ export interface SimpleTableProps {
|
|
|
102
90
|
height?: string | number;
|
|
103
91
|
hideFooter?: boolean;
|
|
104
92
|
hideHeader?: boolean;
|
|
93
|
+
/** Highlight the hovered row. */
|
|
94
|
+
hoverRowBackground?: boolean;
|
|
105
95
|
icons?: IconsConfig;
|
|
106
96
|
includeHeadersInCSVExport?: boolean;
|
|
107
97
|
initialSortColumn?: string;
|
|
@@ -109,21 +99,20 @@ export interface SimpleTableProps {
|
|
|
109
99
|
isLoading?: boolean;
|
|
110
100
|
loadingStateRenderer?: LoadingStateRenderer;
|
|
111
101
|
maxHeight?: string | number;
|
|
102
|
+
/** Alternate column background. */
|
|
103
|
+
oddColumnBackground?: boolean;
|
|
104
|
+
/** Alternate odd/even row backgrounds. */
|
|
105
|
+
oddEvenRowBackground?: boolean;
|
|
112
106
|
onCellClick?: (props: CellClickProps) => void;
|
|
113
107
|
onCellEdit?: (props: CellChangeProps) => void;
|
|
114
|
-
onColumnOrderChange?: (newHeaders:
|
|
115
|
-
onColumnSelect?: (header:
|
|
108
|
+
onColumnOrderChange?: (newHeaders: ColumnDef[]) => void;
|
|
109
|
+
onColumnSelect?: (header: ColumnDef) => void;
|
|
116
110
|
onColumnVisibilityChange?: (visibilityState: ColumnVisibilityState) => void;
|
|
117
|
-
onColumnWidthChange?: (headers:
|
|
111
|
+
onColumnWidthChange?: (headers: ColumnDef[]) => void;
|
|
118
112
|
onFilterChange?: (filters: TableFilterState) => void;
|
|
119
|
-
/**
|
|
120
|
-
* Called once when the table is ready.
|
|
121
|
-
* @deprecated Prefer {@link onTableReady}
|
|
122
|
-
*/
|
|
123
|
-
onGridReady?: () => void;
|
|
124
|
-
/** Called once when the table is ready. Preferred over `onGridReady`. */
|
|
113
|
+
/** Called once when the table is ready. */
|
|
125
114
|
onTableReady?: () => void;
|
|
126
|
-
onHeaderEdit?: (header:
|
|
115
|
+
onHeaderEdit?: (header: ColumnDef, newLabel: string) => void;
|
|
127
116
|
infiniteScrollThreshold?: number;
|
|
128
117
|
onLoadMore?: () => void;
|
|
129
118
|
onNextPage?: OnNextPage;
|
|
@@ -148,35 +137,7 @@ export interface SimpleTableProps {
|
|
|
148
137
|
selectableCells?: boolean;
|
|
149
138
|
selectableColumns?: boolean;
|
|
150
139
|
serverSidePagination?: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Enable client-side pagination.
|
|
153
|
-
* @deprecated Prefer {@link enablePagination}
|
|
154
|
-
*/
|
|
155
|
-
shouldPaginate?: boolean;
|
|
156
|
-
/** Enable client-side pagination. Preferred over `shouldPaginate`. */
|
|
157
|
-
enablePagination?: boolean;
|
|
158
140
|
tableEmptyStateRenderer?: HTMLElement | string | null;
|
|
159
141
|
theme?: Theme;
|
|
160
142
|
totalRowCount?: number;
|
|
161
|
-
/**
|
|
162
|
-
* Highlight the hovered row.
|
|
163
|
-
* @deprecated Prefer {@link hoverRowBackground}
|
|
164
|
-
*/
|
|
165
|
-
useHoverRowBackground?: boolean;
|
|
166
|
-
/** Highlight the hovered row. Preferred over `useHoverRowBackground`. */
|
|
167
|
-
hoverRowBackground?: boolean;
|
|
168
|
-
/**
|
|
169
|
-
* Alternate column background.
|
|
170
|
-
* @deprecated Prefer {@link oddColumnBackground}
|
|
171
|
-
*/
|
|
172
|
-
useOddColumnBackground?: boolean;
|
|
173
|
-
/** Alternate column background. Preferred over `useOddColumnBackground`. */
|
|
174
|
-
oddColumnBackground?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Alternate odd/even row backgrounds.
|
|
177
|
-
* @deprecated Prefer {@link oddEvenRowBackground}
|
|
178
|
-
*/
|
|
179
|
-
useOddEvenRowBackground?: boolean;
|
|
180
|
-
/** Alternate odd/even row backgrounds. Preferred over `useOddEvenRowBackground`. */
|
|
181
|
-
oddEvenRowBackground?: boolean;
|
|
182
143
|
}
|
package/dist/types/TableAPI.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import UpdateDataProps from "./UpdateCellProps";
|
|
2
|
-
import
|
|
2
|
+
import ColumnDef, { Accessor } from "./ColumnDef";
|
|
3
3
|
import TableRow from "./TableRow";
|
|
4
4
|
import Row from "./Row";
|
|
5
5
|
import SortColumn, { SortDirection } from "./SortColumn";
|
|
@@ -20,7 +20,7 @@ export type TableAPI = {
|
|
|
20
20
|
setHeaderRename: (props: SetHeaderRenameProps) => void;
|
|
21
21
|
getVisibleRows: () => TableRow[];
|
|
22
22
|
getAllRows: () => TableRow[];
|
|
23
|
-
getHeaders: () =>
|
|
23
|
+
getHeaders: () => ColumnDef[];
|
|
24
24
|
exportToCSV: (props?: ExportToCSVProps) => void;
|
|
25
25
|
getSortState: () => SortColumn | null;
|
|
26
26
|
applySortState: (props?: {
|
|
@@ -52,7 +52,7 @@ export type TableAPI = {
|
|
|
52
52
|
/**
|
|
53
53
|
* Reset columns to the configured definitions: default order, widths, and
|
|
54
54
|
* visibility. All columns become visible again except those explicitly
|
|
55
|
-
* defined with `hide: true` in `
|
|
55
|
+
* defined with `hide: true` in `columns`, regardless of any runtime
|
|
56
56
|
* visibility changes made since mount.
|
|
57
57
|
*/
|
|
58
58
|
resetColumns: () => void;
|
|
@@ -79,7 +79,7 @@ export type TableAPI = {
|
|
|
79
79
|
setPivot: (config: PivotConfig | null) => void;
|
|
80
80
|
getPivot: () => PivotConfig | null;
|
|
81
81
|
/** Generated headers while pivot is active; otherwise current headers. */
|
|
82
|
-
getPivotHeaders: () =>
|
|
82
|
+
getPivotHeaders: () => ColumnDef[];
|
|
83
83
|
/** Post-pivot rows (pre-flatten) while pivot is active; otherwise source rows. */
|
|
84
84
|
getPivotedRows: () => Row[];
|
|
85
85
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnDef } from "..";
|
|
2
2
|
import TableRow from "./TableRow";
|
|
3
3
|
import { CumulativeHeightMap } from "../utils/infiniteScrollUtils";
|
|
4
4
|
interface TableBodyProps {
|
|
5
5
|
calculatedHeaderHeight: number;
|
|
6
6
|
heightMap?: CumulativeHeightMap;
|
|
7
7
|
partiallyVisibleRows: TableRow[];
|
|
8
|
-
pinnedLeftColumns:
|
|
8
|
+
pinnedLeftColumns: ColumnDef[];
|
|
9
9
|
pinnedLeftWidth: number;
|
|
10
|
-
pinnedRightColumns:
|
|
10
|
+
pinnedRightColumns: ColumnDef[];
|
|
11
11
|
pinnedRightWidth: number;
|
|
12
12
|
regularRows: TableRow[];
|
|
13
13
|
rowsToRender: TableRow[];
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import SortColumn from "./SortColumn";
|
|
2
|
-
import
|
|
2
|
+
import ColumnDef from "./ColumnDef";
|
|
3
3
|
export interface RefObject<T> {
|
|
4
4
|
current: T | null;
|
|
5
5
|
}
|
|
6
6
|
type TableHeaderProps = {
|
|
7
7
|
calculatedHeaderHeight: number;
|
|
8
8
|
centerHeaderRef: RefObject<HTMLDivElement | null>;
|
|
9
|
-
headers:
|
|
9
|
+
headers: ColumnDef[];
|
|
10
10
|
mainBodyWidth: number;
|
|
11
|
-
pinnedLeftColumns:
|
|
11
|
+
pinnedLeftColumns: ColumnDef[];
|
|
12
12
|
pinnedLeftWidth: number;
|
|
13
|
-
pinnedRightColumns:
|
|
13
|
+
pinnedRightColumns: ColumnDef[];
|
|
14
14
|
pinnedRightWidth: number;
|
|
15
15
|
sort: SortColumn | null;
|
|
16
16
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Pinned } from "./Pinned";
|
|
2
2
|
import SortColumn from "./SortColumn";
|
|
3
|
-
import {
|
|
3
|
+
import { ColumnDef } from "..";
|
|
4
4
|
import { ColumnIndices } from "../utils/columnIndicesUtils";
|
|
5
5
|
interface TableHeaderSectionProps {
|
|
6
6
|
calculatedHeaderHeight: number;
|
|
7
7
|
columnIndices: ColumnIndices;
|
|
8
8
|
handleScroll?: (event: UIEvent) => void;
|
|
9
|
-
headers:
|
|
9
|
+
headers: ColumnDef[];
|
|
10
10
|
leftOffset?: number;
|
|
11
11
|
maxDepth: number;
|
|
12
12
|
pinned?: Pinned;
|
package/dist/types/TableRow.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Row from "./Row";
|
|
2
2
|
import RowState from "./RowState";
|
|
3
|
-
import
|
|
3
|
+
import ColumnDef, { Accessor } from "./ColumnDef";
|
|
4
4
|
type TableRow = {
|
|
5
5
|
depth: number;
|
|
6
6
|
displayPosition: number;
|
|
@@ -29,7 +29,7 @@ type TableRow = {
|
|
|
29
29
|
isLoadingSkeleton?: boolean;
|
|
30
30
|
nestedTable?: {
|
|
31
31
|
parentRow: Row;
|
|
32
|
-
expandableHeader:
|
|
32
|
+
expandableHeader: ColumnDef;
|
|
33
33
|
childAccessor: Accessor;
|
|
34
34
|
calculatedHeight: number;
|
|
35
35
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import CellChangeProps from "./CellChangeProps";
|
|
2
|
-
import
|
|
2
|
+
import ColumnDef from "./ColumnDef";
|
|
3
3
|
import Row from "./Row";
|
|
4
4
|
import Cell from "./Cell";
|
|
5
5
|
type TableRowProps = {
|
|
6
6
|
currentRows: Row[];
|
|
7
7
|
draggedHeaderRef: {
|
|
8
|
-
current:
|
|
8
|
+
current: ColumnDef | null;
|
|
9
9
|
};
|
|
10
10
|
getBorderClass: (rowIndex: number, columnIndex: number) => string;
|
|
11
11
|
handleMouseDown: (props: Cell) => void;
|
|
12
12
|
handleMouseOver: (rowIndex: number, columnIndex: number) => void;
|
|
13
|
-
headers:
|
|
13
|
+
headers: ColumnDef[];
|
|
14
14
|
hoveredHeaderRef: {
|
|
15
|
-
current:
|
|
15
|
+
current: ColumnDef | null;
|
|
16
16
|
};
|
|
17
17
|
isSelected: (rowIndex: number, columnIndex: number) => boolean;
|
|
18
18
|
isInitialFocusedCell: (rowIndex: number, columnIndex: number) => boolean;
|
|
19
19
|
onCellEdit?: (props: CellChangeProps) => void;
|
|
20
|
-
onTableHeaderDragEnd: (newHeaders:
|
|
20
|
+
onTableHeaderDragEnd: (newHeaders: ColumnDef[]) => void;
|
|
21
21
|
onToggleGroup: (rowId: number) => void;
|
|
22
22
|
row: Row;
|
|
23
23
|
rowIndex: number;
|
|
24
|
-
|
|
24
|
+
enablePagination: boolean;
|
|
25
25
|
tableRef: {
|
|
26
26
|
current: HTMLDivElement | null;
|
|
27
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef from "../../types/ColumnDef";
|
|
2
2
|
import CellValue from "../../types/CellValue";
|
|
3
3
|
import { AbsoluteBodyCell, CellRenderContext } from "./types";
|
|
4
|
-
export declare const formatCellContent: (content: CellValue, header:
|
|
4
|
+
export declare const formatCellContent: (content: CellValue, header: ColumnDef, colIndex: number, row: any, rowIndex: number) => string | null;
|
|
5
5
|
export declare const createCellContent: (cell: AbsoluteBodyCell, context: CellRenderContext, contentSpan: HTMLElement) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef, { Accessor } from "../../types/ColumnDef";
|
|
2
2
|
import CellValue from "../../types/CellValue";
|
|
3
3
|
import { IconsConfig } from "../../types/IconsConfig";
|
|
4
4
|
import OnRowGroupExpandProps from "../../types/OnRowGroupExpandProps";
|
|
@@ -14,7 +14,7 @@ import type { NestedTableFactory } from "../nestedGridRowRenderer";
|
|
|
14
14
|
type SetStateAction<T> = T | ((prevState: T) => T);
|
|
15
15
|
type Dispatch<A> = (value: A) => void;
|
|
16
16
|
export interface AbsoluteBodyCell {
|
|
17
|
-
header:
|
|
17
|
+
header: ColumnDef;
|
|
18
18
|
row: Row;
|
|
19
19
|
rowIndex: number;
|
|
20
20
|
colIndex: number;
|
|
@@ -72,16 +72,16 @@ export interface CellRenderContext {
|
|
|
72
72
|
/** Keyboard active row id for focus styling */
|
|
73
73
|
activeRowId?: string | null;
|
|
74
74
|
cellUpdateFlash?: boolean;
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
oddColumnBackground?: boolean;
|
|
76
|
+
hoverRowBackground?: boolean;
|
|
77
77
|
/**
|
|
78
78
|
* Unique id for this table instance. Scopes the module-level row-hover cell
|
|
79
79
|
* map so multiple tables on one page with overlapping rowIds don't cross-hover.
|
|
80
80
|
*/
|
|
81
81
|
hoverScopeId: string;
|
|
82
|
-
|
|
82
|
+
oddEvenRowBackground?: boolean;
|
|
83
83
|
rowGrouping?: string[];
|
|
84
|
-
headers:
|
|
84
|
+
headers: ColumnDef[];
|
|
85
85
|
/**
|
|
86
86
|
* Accessor of the column whose body cells identify the row and should carry
|
|
87
87
|
* `role="rowheader"` (the first non-selection leaf column). Other data cells
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Cell from "../types/Cell";
|
|
2
|
-
import
|
|
2
|
+
import ColumnDef from "../types/ColumnDef";
|
|
3
3
|
import type TableRowType from "../types/TableRow";
|
|
4
4
|
interface CellRegistryEntry {
|
|
5
5
|
updateContent: (newValue: any) => void;
|
|
@@ -7,18 +7,18 @@ interface CellRegistryEntry {
|
|
|
7
7
|
/**
|
|
8
8
|
* Copies selected cells to clipboard in tab-separated format
|
|
9
9
|
*/
|
|
10
|
-
export declare const copySelectedCellsToClipboard: (selectedCells: Set<string>, leafHeaders:
|
|
10
|
+
export declare const copySelectedCellsToClipboard: (selectedCells: Set<string>, leafHeaders: ColumnDef[], tableRows: TableRowType[], copyHeadersToClipboard?: boolean) => string;
|
|
11
11
|
/**
|
|
12
12
|
* Pastes clipboard data into cells starting from the initial focused cell
|
|
13
13
|
*/
|
|
14
|
-
export declare const pasteClipboardDataToCells: (clipboardText: string, initialFocusedCell: Cell, leafHeaders:
|
|
14
|
+
export declare const pasteClipboardDataToCells: (clipboardText: string, initialFocusedCell: Cell, leafHeaders: ColumnDef[], tableRows: TableRowType[], onCellEdit?: (props: any) => void, cellRegistry?: Map<string, CellRegistryEntry>) => {
|
|
15
15
|
updatedCells: Set<string>;
|
|
16
16
|
warningCells: Set<string>;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Deletes content from selected cells (sets them to appropriate empty values)
|
|
20
20
|
*/
|
|
21
|
-
export declare const deleteSelectedCellsContent: (selectedCells: Set<string>, leafHeaders:
|
|
21
|
+
export declare const deleteSelectedCellsContent: (selectedCells: Set<string>, leafHeaders: ColumnDef[], tableRows: TableRowType[], onCellEdit?: (props: any) => void, cellRegistry?: Map<string, CellRegistryEntry>) => {
|
|
22
22
|
deletedCells: Set<string>;
|
|
23
23
|
warningCells: Set<string>;
|
|
24
24
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef, { Accessor } from "../types/ColumnDef";
|
|
2
2
|
import { Pinned } from "../types/Pinned";
|
|
3
3
|
import { RowId } from "../types/RowId";
|
|
4
4
|
export { isHeaderExcludedFromLayout } from "./headerLayoutUtils";
|
|
@@ -7,9 +7,9 @@ export declare const getCellId: ({ accessor, rowId }: {
|
|
|
7
7
|
rowId: RowId;
|
|
8
8
|
}) => string;
|
|
9
9
|
export declare const displayCell: ({ header, pinned, headers, collapsedHeaders, rootPinned, }: {
|
|
10
|
-
header:
|
|
10
|
+
header: ColumnDef;
|
|
11
11
|
pinned?: Pinned;
|
|
12
|
-
headers?:
|
|
12
|
+
headers?: ColumnDef[];
|
|
13
13
|
collapsedHeaders?: Set<Accessor>;
|
|
14
14
|
rootPinned?: Pinned;
|
|
15
15
|
}) => true | null;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef, { Accessor } from "../types/ColumnDef";
|
|
2
2
|
/**
|
|
3
3
|
* Find the parent header that contains the given child header
|
|
4
4
|
* Optimized using flattenAllHeaders for better performance
|
|
5
5
|
*/
|
|
6
|
-
export declare const findParentHeader: (headers:
|
|
6
|
+
export declare const findParentHeader: (headers: ColumnDef[], childAccessor: Accessor) => ColumnDef | null;
|
|
7
7
|
/**
|
|
8
8
|
* Check if a header should be hidden based on its parent's collapsed state
|
|
9
9
|
*/
|
|
10
|
-
export declare const shouldHideWhenParentCollapsed: (header:
|
|
10
|
+
export declare const shouldHideWhenParentCollapsed: (header: ColumnDef, headers: ColumnDef[], collapsedHeaders: Set<Accessor>) => boolean;
|
|
11
11
|
/**
|
|
12
12
|
* Get all child headers of a parent header (recursively)
|
|
13
13
|
* Uses flattenAllHeaders for consistency and better performance
|
|
14
14
|
*/
|
|
15
|
-
export declare const getAllChildHeaders: (header:
|
|
15
|
+
export declare const getAllChildHeaders: (header: ColumnDef) => ColumnDef[];
|
|
16
16
|
/**
|
|
17
17
|
* Check if a header has collapsible children
|
|
18
18
|
*/
|
|
19
|
-
export declare const hasCollapsibleChildren: (header:
|
|
19
|
+
export declare const hasCollapsibleChildren: (header: ColumnDef) => boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Number of visible leaf (bottom-level) columns a header spans, for
|
|
22
22
|
* `aria-colspan` on grouped/nested header cells. Leaf headers excluded from
|
|
@@ -24,9 +24,9 @@ export declare const hasCollapsibleChildren: (header: HeaderObject) => boolean;
|
|
|
24
24
|
* collapsed state are omitted so the announced span matches the columns
|
|
25
25
|
* actually rendered. Leaf headers return 1.
|
|
26
26
|
*/
|
|
27
|
-
export declare const getHeaderColspan: (header:
|
|
27
|
+
export declare const getHeaderColspan: (header: ColumnDef, rootHeaders: ColumnDef[], collapsedHeaders: Set<Accessor>) => number;
|
|
28
28
|
/**
|
|
29
29
|
* Get all leaf (bottom-level) headers that should be visible when a parent is collapsed
|
|
30
30
|
* Uses flattenHeaders for consistent leaf detection
|
|
31
31
|
*/
|
|
32
|
-
export declare const getVisibleLeafHeadersWhenCollapsed: (header:
|
|
32
|
+
export declare const getVisibleLeafHeadersWhenCollapsed: (header: ColumnDef) => ColumnDef[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef, { Accessor } from "../../types/ColumnDef";
|
|
2
2
|
import { ColumnVisibilityState } from "../../types/ColumnVisibilityTypes";
|
|
3
3
|
import { FlattenedHeader } from "../../types/FlattenedHeader";
|
|
4
4
|
import { PanelSection } from "../../types/PanelSection";
|
|
@@ -15,10 +15,10 @@ export type HoveredSeparator = {
|
|
|
15
15
|
panelSection: PanelSection;
|
|
16
16
|
index: number;
|
|
17
17
|
} | null;
|
|
18
|
-
export declare const findAndMarkParentsVisible: (headers:
|
|
19
|
-
export declare const areAllChildrenHidden: (children:
|
|
20
|
-
export declare const updateParentHeaders: (headers:
|
|
21
|
-
export declare const buildColumnVisibilityState: (headers:
|
|
18
|
+
export declare const findAndMarkParentsVisible: (headers: ColumnDef[], childAccessor: Accessor, visited?: Set<string>) => void;
|
|
19
|
+
export declare const areAllChildrenHidden: (children: ColumnDef[]) => boolean;
|
|
20
|
+
export declare const updateParentHeaders: (headers: ColumnDef[]) => void;
|
|
21
|
+
export declare const buildColumnVisibilityState: (headers: ColumnDef[]) => ColumnVisibilityState;
|
|
22
22
|
export declare const findClosestValidSeparatorIndex: ({ flattenedHeaders, draggingRow, hoveredRowIndex, isTopHalfOfRow, }: {
|
|
23
23
|
flattenedHeaders: FlattenedHeader[];
|
|
24
24
|
draggingRow: FlattenedHeader;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef from "../../types/ColumnDef";
|
|
2
2
|
import { ColumnEditorSearchFunction, ColumnEditorConfig } from "../../types/ColumnEditorConfig";
|
|
3
3
|
import { ColumnVisibilityState } from "../../types/ColumnVisibilityTypes";
|
|
4
4
|
import { IconsConfig } from "../../types/IconsConfig";
|
|
5
5
|
export interface CreateColumnEditorOptions {
|
|
6
6
|
columnEditorText: string;
|
|
7
|
-
|
|
8
|
-
headers:
|
|
7
|
+
enableColumnEditor: boolean;
|
|
8
|
+
headers: ColumnDef[];
|
|
9
9
|
open: boolean;
|
|
10
10
|
searchEnabled: boolean;
|
|
11
11
|
searchPlaceholder: string;
|
|
@@ -14,9 +14,9 @@ export interface CreateColumnEditorOptions {
|
|
|
14
14
|
icons?: IconsConfig;
|
|
15
15
|
essentialAccessors?: ReadonlySet<string>;
|
|
16
16
|
resetColumns?: () => void;
|
|
17
|
-
setHeaders: (headers:
|
|
17
|
+
setHeaders: (headers: ColumnDef[]) => void;
|
|
18
18
|
onColumnVisibilityChange?: (state: ColumnVisibilityState) => void;
|
|
19
|
-
onColumnOrderChange?: (headers:
|
|
19
|
+
onColumnOrderChange?: (headers: ColumnDef[]) => void;
|
|
20
20
|
setOpen: (open: boolean) => void;
|
|
21
21
|
}
|
|
22
22
|
export declare const createColumnEditor: (options: CreateColumnEditorOptions) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef from "../../types/ColumnDef";
|
|
2
2
|
import { ColumnEditorSearchFunction, ColumnEditorConfig } from "../../types/ColumnEditorConfig";
|
|
3
3
|
import { ColumnVisibilityState } from "../../types/ColumnVisibilityTypes";
|
|
4
4
|
import { IconsConfig } from "../../types/IconsConfig";
|
|
5
5
|
export interface CreateColumnEditorPopoutOptions {
|
|
6
|
-
headers:
|
|
6
|
+
headers: ColumnDef[];
|
|
7
7
|
open: boolean;
|
|
8
8
|
searchEnabled: boolean;
|
|
9
9
|
searchPlaceholder: string;
|
|
@@ -11,9 +11,9 @@ export interface CreateColumnEditorPopoutOptions {
|
|
|
11
11
|
columnEditorConfig: ColumnEditorConfig;
|
|
12
12
|
icons?: IconsConfig;
|
|
13
13
|
essentialAccessors?: ReadonlySet<string>;
|
|
14
|
-
setHeaders: (headers:
|
|
14
|
+
setHeaders: (headers: ColumnDef[]) => void;
|
|
15
15
|
onColumnVisibilityChange?: (state: ColumnVisibilityState) => void;
|
|
16
|
-
onColumnOrderChange?: (headers:
|
|
16
|
+
onColumnOrderChange?: (headers: ColumnDef[]) => void;
|
|
17
17
|
resetColumns?: () => void;
|
|
18
18
|
}
|
|
19
19
|
export declare const createColumnEditorPopout: (initialOptions: CreateColumnEditorPopoutOptions) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef from "../../types/ColumnDef";
|
|
2
2
|
import { ColumnEditorConfig } from "../../types/ColumnEditorConfig";
|
|
3
3
|
import { IconsConfig } from "../../types/IconsConfig";
|
|
4
4
|
import { FlattenedHeader, HoveredSeparator } from "./columnEditorUtils";
|
|
5
5
|
import { ColumnVisibilityState } from "../../types/ColumnVisibilityTypes";
|
|
6
6
|
import { PanelSection } from "../pinnedColumnUtils";
|
|
7
7
|
export interface CreateColumnEditorRowOptions {
|
|
8
|
-
allHeaders:
|
|
8
|
+
allHeaders: ColumnDef[];
|
|
9
9
|
clearHoverSeparator?: () => void;
|
|
10
10
|
depth: number;
|
|
11
11
|
doesAnyHeaderHaveChildren: boolean;
|
|
@@ -15,7 +15,7 @@ export interface CreateColumnEditorRowOptions {
|
|
|
15
15
|
expandedHeaders: Set<string>;
|
|
16
16
|
flattenedHeaders: FlattenedHeader[];
|
|
17
17
|
forceExpanded: boolean;
|
|
18
|
-
header:
|
|
18
|
+
header: ColumnDef;
|
|
19
19
|
hoveredSeparator: HoveredSeparator;
|
|
20
20
|
panelSection?: PanelSection;
|
|
21
21
|
rowIndex: number;
|
|
@@ -26,10 +26,10 @@ export interface CreateColumnEditorRowOptions {
|
|
|
26
26
|
/** Resolved table icons; `icons.drag` overrides the default column-editor drag handle. */
|
|
27
27
|
icons?: IconsConfig;
|
|
28
28
|
essentialAccessors?: ReadonlySet<string>;
|
|
29
|
-
headers:
|
|
30
|
-
setHeaders: (headers:
|
|
29
|
+
headers: ColumnDef[];
|
|
30
|
+
setHeaders: (headers: ColumnDef[]) => void;
|
|
31
31
|
onColumnVisibilityChange?: (state: ColumnVisibilityState) => void;
|
|
32
|
-
onColumnOrderChange?: (headers:
|
|
32
|
+
onColumnOrderChange?: (headers: ColumnDef[]) => void;
|
|
33
33
|
/** When set (e.g. after expand toggle), used with updateExpandIconState so the chevron animates like table cells. */
|
|
34
34
|
previousExpandedHeaders?: ReadonlySet<string>;
|
|
35
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ColumnDef, { Accessor } from "../types/ColumnDef";
|
|
2
2
|
export type ColumnIndices = Record<string, number>;
|
|
3
3
|
/**
|
|
4
4
|
* Calculates column indices for all headers to ensure consistent colIndex values
|
|
@@ -8,8 +8,8 @@ export type ColumnIndices = Record<string, number>;
|
|
|
8
8
|
* the same column index, which is needed for proper alignment in the grid.
|
|
9
9
|
*/
|
|
10
10
|
export declare function calculateColumnIndices({ headers, pinnedLeftColumns, pinnedRightColumns, collapsedHeaders, }: {
|
|
11
|
-
headers:
|
|
12
|
-
pinnedLeftColumns:
|
|
13
|
-
pinnedRightColumns:
|
|
11
|
+
headers: ColumnDef[];
|
|
12
|
+
pinnedLeftColumns: ColumnDef[];
|
|
13
|
+
pinnedRightColumns: ColumnDef[];
|
|
14
14
|
collapsedHeaders?: Set<Accessor>;
|
|
15
15
|
}): ColumnIndices;
|