simple-table-core 3.8.0 → 3.8.2
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/cjs/src/core/SimpleTableVanilla.d.ts +7 -0
- package/dist/cjs/src/hooks/contentHeight.d.ts +1 -1
- package/dist/cjs/src/managers/AutoScaleManager.d.ts +8 -1
- package/dist/cjs/stories/tests/12-CellSelectionTests.stories.d.ts +15 -0
- package/dist/cjs/stories/tests/15-ColumnVisibilityTests.stories.d.ts +8 -0
- package/dist/cjs/stories/tests/22-LoadingStateTests.stories.d.ts +27 -3
- package/dist/cjs/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +10 -0
- package/dist/cjs/stories/tests/40-MaxHeightScrollTests.stories.d.ts +9 -0
- package/dist/cjs/stories/tests/47-DeferredHeadersTests.stories.d.ts +23 -0
- package/dist/index.es.js +1 -1
- package/dist/src/core/SimpleTableVanilla.d.ts +7 -0
- package/dist/src/hooks/contentHeight.d.ts +1 -1
- package/dist/src/managers/AutoScaleManager.d.ts +8 -1
- package/dist/stories/tests/12-CellSelectionTests.stories.d.ts +15 -0
- package/dist/stories/tests/15-ColumnVisibilityTests.stories.d.ts +8 -0
- package/dist/stories/tests/22-LoadingStateTests.stories.d.ts +27 -3
- package/dist/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +10 -0
- package/dist/stories/tests/40-MaxHeightScrollTests.stories.d.ts +9 -0
- package/dist/stories/tests/47-DeferredHeadersTests.stories.d.ts +23 -0
- package/package.json +1 -1
|
@@ -225,6 +225,13 @@ export declare class SimpleTableVanilla {
|
|
|
225
225
|
private isAutoSizeLeaf;
|
|
226
226
|
private computeAutoSizeAccessors;
|
|
227
227
|
private getAutoSizeStyleRoot;
|
|
228
|
+
/**
|
|
229
|
+
* Rows that content-fit ("auto") measurement should sample. With client-side
|
|
230
|
+
* pagination only the current page is rendered, so fit columns to the page's
|
|
231
|
+
* rows rather than the entire dataset — otherwise off-page values inflate
|
|
232
|
+
* every auto column's width.
|
|
233
|
+
*/
|
|
234
|
+
private getAutoSizeRows;
|
|
228
235
|
/** Immutably write measured pixel widths into the leaf headers. */
|
|
229
236
|
private applyMeasuredWidths;
|
|
230
237
|
/**
|
|
@@ -17,7 +17,7 @@ export interface ContentHeightConfig {
|
|
|
17
17
|
/**
|
|
18
18
|
* Converts a height value (string or number) to pixels
|
|
19
19
|
*/
|
|
20
|
-
export declare const convertHeightToPixels: (heightValue: string | number) => number;
|
|
20
|
+
export declare const convertHeightToPixels: (heightValue: string | number, container?: Element | null) => number;
|
|
21
21
|
/**
|
|
22
22
|
* Calculates the content height for the table.
|
|
23
23
|
* This is a pure function alternative to the useContentHeight hook.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import HeaderObject from "../types/HeaderObject";
|
|
1
|
+
import HeaderObject, { Accessor } from "../types/HeaderObject";
|
|
2
2
|
interface AutoScaleConfig {
|
|
3
3
|
autoExpandColumns: boolean;
|
|
4
4
|
containerWidth: number;
|
|
@@ -8,6 +8,13 @@ interface AutoScaleConfig {
|
|
|
8
8
|
current: HTMLDivElement | null;
|
|
9
9
|
};
|
|
10
10
|
isResizing?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Currently collapsed header accessors. Auto-scale must only account for the
|
|
13
|
+
* leaf columns that are actually visible for the current collapsed state —
|
|
14
|
+
* otherwise it sums the widths of hidden child columns and under-expands,
|
|
15
|
+
* leaving empty space on the right.
|
|
16
|
+
*/
|
|
17
|
+
collapsedHeaders?: Set<Accessor>;
|
|
11
18
|
}
|
|
12
19
|
type HeaderUpdateCallback = (headers: HeaderObject[]) => void;
|
|
13
20
|
export declare const applyAutoScaleToHeaders: (headers: HeaderObject[], options: AutoScaleConfig) => HeaderObject[];
|
|
@@ -131,6 +131,21 @@ export declare const CopySelectionWithoutHeaders: {
|
|
|
131
131
|
canvasElement: HTMLElement;
|
|
132
132
|
}) => Promise<void>;
|
|
133
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* Regression: with `selectableCells` enabled, the cell mousedown handler used to
|
|
136
|
+
* `preventDefault()` and start a cell selection even when the press landed on an
|
|
137
|
+
* <a> rendered inside the cell. That cancelled the link's native default (href
|
|
138
|
+
* navigation) and forced a body re-render that swallowed the pending click.
|
|
139
|
+
* A link inside a cell must stay clickable and must not trigger cell selection.
|
|
140
|
+
*/
|
|
141
|
+
export declare const LinkInsideCellStaysClickable: {
|
|
142
|
+
render: () => HTMLDivElement & {
|
|
143
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
144
|
+
};
|
|
145
|
+
play: ({ canvasElement }: {
|
|
146
|
+
canvasElement: HTMLElement;
|
|
147
|
+
}) => Promise<void>;
|
|
148
|
+
};
|
|
134
149
|
export declare const ShiftArrowExtendsSelection: {
|
|
135
150
|
render: () => HTMLDivElement & {
|
|
136
151
|
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
@@ -109,6 +109,14 @@ export declare const ExcludeFromRenderNotInColumnEditor: {
|
|
|
109
109
|
canvasElement: HTMLElement;
|
|
110
110
|
}) => Promise<void>;
|
|
111
111
|
};
|
|
112
|
+
export declare const ExcludeFromRenderDoesNotInflateRowWidth: {
|
|
113
|
+
render: () => HTMLDivElement & {
|
|
114
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
115
|
+
};
|
|
116
|
+
play: ({ canvasElement }: {
|
|
117
|
+
canvasElement: HTMLElement;
|
|
118
|
+
}) => Promise<void>;
|
|
119
|
+
};
|
|
112
120
|
export declare const ColumnEditorCustomText: {
|
|
113
121
|
render: () => HTMLDivElement & {
|
|
114
122
|
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Tests for isLoading prop - skeleton loaders in cells when data is loading.
|
|
4
4
|
*/
|
|
5
5
|
import type { Meta } from "@storybook/html";
|
|
6
|
+
import { SimpleTableVanilla } from "../../src/index";
|
|
6
7
|
declare const meta: Meta;
|
|
7
8
|
export default meta;
|
|
8
9
|
export declare const LoadingStateShowsSkeletons: {
|
|
9
10
|
render: () => HTMLDivElement & {
|
|
10
|
-
_table?:
|
|
11
|
+
_table?: SimpleTableVanilla | undefined;
|
|
11
12
|
};
|
|
12
13
|
play: ({ canvasElement }: {
|
|
13
14
|
canvasElement: HTMLElement;
|
|
@@ -15,7 +16,7 @@ export declare const LoadingStateShowsSkeletons: {
|
|
|
15
16
|
};
|
|
16
17
|
export declare const NotLoadingShowsData: {
|
|
17
18
|
render: () => HTMLDivElement & {
|
|
18
|
-
_table?:
|
|
19
|
+
_table?: SimpleTableVanilla | undefined;
|
|
19
20
|
};
|
|
20
21
|
play: ({ canvasElement }: {
|
|
21
22
|
canvasElement: HTMLElement;
|
|
@@ -23,7 +24,30 @@ export declare const NotLoadingShowsData: {
|
|
|
23
24
|
};
|
|
24
25
|
export declare const LoadingStateWithEmptyRows: {
|
|
25
26
|
render: () => HTMLDivElement & {
|
|
26
|
-
_table?:
|
|
27
|
+
_table?: SimpleTableVanilla | undefined;
|
|
28
|
+
};
|
|
29
|
+
play: ({ canvasElement }: {
|
|
30
|
+
canvasElement: HTMLElement;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Repro for the stale-cell bug. Body cells are keyed by `${rowId}-${accessor}`,
|
|
35
|
+
* where `rowId` comes from `getRowId`. When `getRowId` derives the id from row
|
|
36
|
+
* data, a row that is still loading has no id yet, so `getRowId` returns
|
|
37
|
+
* `undefined` (→ "undefined"). While `isLoading` is true the core renders a
|
|
38
|
+
* batch of skeleton rows that ALL collapse to the same cell id
|
|
39
|
+
* (`undefined-<accessor>`); only the last one is tracked in the rendered-cell
|
|
40
|
+
* registry, so the rest are orphaned in the DOM. Once the data resolves and
|
|
41
|
+
* `getRowId` returns a real id, the registry-driven cleanup removes only the
|
|
42
|
+
* tracked cell, leaving the orphaned skeleton cells underneath the real data
|
|
43
|
+
* cell indefinitely.
|
|
44
|
+
*
|
|
45
|
+
* After a single row resolves, the body should hold exactly one cell per
|
|
46
|
+
* column and no leftover loading skeletons.
|
|
47
|
+
*/
|
|
48
|
+
export declare const LoadingToLoadedRemovesStaleCells: {
|
|
49
|
+
render: () => HTMLDivElement & {
|
|
50
|
+
_table?: SimpleTableVanilla | undefined;
|
|
27
51
|
};
|
|
28
52
|
play: ({ canvasElement }: {
|
|
29
53
|
canvasElement: HTMLElement;
|
|
@@ -80,6 +80,16 @@ export declare const AutoExpandGroupedExpandCollapse: {
|
|
|
80
80
|
canvasElement: HTMLElement;
|
|
81
81
|
}) => Promise<void>;
|
|
82
82
|
};
|
|
83
|
+
export declare const AutoExpandCollapsibleColumnsFillContainer: {
|
|
84
|
+
tags: string[];
|
|
85
|
+
parameters: {
|
|
86
|
+
tags: string[];
|
|
87
|
+
};
|
|
88
|
+
render: () => HTMLElement;
|
|
89
|
+
play: ({ canvasElement }: {
|
|
90
|
+
canvasElement: HTMLElement;
|
|
91
|
+
}) => Promise<void>;
|
|
92
|
+
};
|
|
83
93
|
export declare const AutoExpandWithNestedGrouping: {
|
|
84
94
|
parameters: {
|
|
85
95
|
tags: string[];
|
|
@@ -26,3 +26,12 @@ export declare const MaxHeightNoScrollWhenContentFits: {
|
|
|
26
26
|
canvasElement: any;
|
|
27
27
|
}) => Promise<void>;
|
|
28
28
|
};
|
|
29
|
+
export declare const MaxHeightCalcScrolls: {
|
|
30
|
+
tags: string[];
|
|
31
|
+
render: () => HTMLDivElement & {
|
|
32
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
33
|
+
};
|
|
34
|
+
play: ({ canvasElement }: {
|
|
35
|
+
canvasElement: any;
|
|
36
|
+
}) => Promise<void>;
|
|
37
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEFERRED HEADERS TESTS
|
|
3
|
+
* Regression tests for populating `defaultHeaders` after mount (the table
|
|
4
|
+
* mounts with an empty header array, then `update({ defaultHeaders })` supplies
|
|
5
|
+
* the real columns — e.g. from an async fetch / useEffect).
|
|
6
|
+
*
|
|
7
|
+
* The header band must become visible once the columns arrive. Previously the
|
|
8
|
+
* DimensionManager kept maxHeaderDepth/calculatedHeaderHeight at 0 (computed
|
|
9
|
+
* from the empty mount-time headers), so the header row rendered at 0px height
|
|
10
|
+
* even though the body and the header cells existed.
|
|
11
|
+
*/
|
|
12
|
+
import type { Meta } from "@storybook/html";
|
|
13
|
+
import { SimpleTableVanilla } from "../../src/index";
|
|
14
|
+
declare const meta: Meta;
|
|
15
|
+
export default meta;
|
|
16
|
+
export declare const PopulateHeadersAfterMount: {
|
|
17
|
+
render: () => HTMLDivElement & {
|
|
18
|
+
_table?: SimpleTableVanilla | undefined;
|
|
19
|
+
};
|
|
20
|
+
play: ({ canvasElement }: {
|
|
21
|
+
canvasElement: HTMLElement;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
};
|