simple-table-core 3.9.2 → 3.9.3
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/rendering/SectionRenderer.d.ts +8 -0
- package/dist/cjs/src/utils/headerWidthUtils.d.ts +19 -13
- package/dist/cjs/stories/docs/Examples.stories.d.ts +17 -0
- package/dist/cjs/stories/{SimpleTable.stories.d.ts → docs/Features.stories.d.ts} +5 -16
- package/dist/cjs/stories/docs/GettingStarted.stories.d.ts +7 -0
- package/dist/cjs/stories/docs/storyArgs.d.ts +154 -0
- package/dist/cjs/stories/examples/RadioStationsExample.d.ts +3 -0
- package/dist/cjs/stories/tests/18-QuickFilterTests.stories.d.ts +19 -0
- package/dist/cjs/stories/tests/46-AutoSizeColumnsTests.stories.d.ts +16 -0
- package/dist/cjs/stories/utils.d.ts +15 -2
- package/dist/cjs/styles.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/src/core/rendering/SectionRenderer.d.ts +8 -0
- package/dist/src/utils/headerWidthUtils.d.ts +19 -13
- package/dist/stories/docs/Examples.stories.d.ts +17 -0
- package/dist/stories/{SimpleTable.stories.d.ts → docs/Features.stories.d.ts} +5 -16
- package/dist/stories/docs/GettingStarted.stories.d.ts +7 -0
- package/dist/stories/docs/storyArgs.d.ts +154 -0
- package/dist/stories/examples/RadioStationsExample.d.ts +3 -0
- package/dist/stories/tests/18-QuickFilterTests.stories.d.ts +19 -0
- package/dist/stories/tests/46-AutoSizeColumnsTests.stories.d.ts +16 -0
- package/dist/stories/utils.d.ts +15 -2
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/base.css +14 -1
|
@@ -107,5 +107,13 @@ export declare class SectionRenderer {
|
|
|
107
107
|
* currently knows about.
|
|
108
108
|
*/
|
|
109
109
|
private captureSnapshotConfig;
|
|
110
|
+
/**
|
|
111
|
+
* Tear down all body sections and forget them so a subsequent
|
|
112
|
+
* `renderBodySection` creates fresh nodes. Used when the empty-state path
|
|
113
|
+
* takes over the body container: clearing `innerHTML` alone leaves
|
|
114
|
+
* `renderedCells` pointing at detached nodes, so rows never remount when
|
|
115
|
+
* data returns (e.g. typing `-E` mid-filter briefly matches every row).
|
|
116
|
+
*/
|
|
117
|
+
releaseBodySections(): void;
|
|
110
118
|
cleanup(): void;
|
|
111
119
|
}
|
|
@@ -71,35 +71,41 @@ export declare const getAllVisibleLeafHeaders: (headers: HeaderObject[], collaps
|
|
|
71
71
|
* @returns The optimal width in pixels
|
|
72
72
|
*/
|
|
73
73
|
export declare const calculateHeaderContentWidth: (accessor: Accessor, options?: {
|
|
74
|
-
rows?: any[];
|
|
75
|
-
header?: HeaderObject;
|
|
76
|
-
maxWidth?: number;
|
|
74
|
+
rows?: any[] | undefined;
|
|
75
|
+
header?: HeaderObject | undefined;
|
|
76
|
+
maxWidth?: number | undefined;
|
|
77
77
|
/** Leading rows always measured (default AUTO_SIZE_HEAD_SAMPLE_SIZE) */
|
|
78
|
-
headSampleSize?: number;
|
|
78
|
+
headSampleSize?: number | undefined;
|
|
79
79
|
/** Rows sampled at an even stride across the rest (default AUTO_SIZE_STRIDED_SAMPLE_SIZE) */
|
|
80
|
-
stridedSampleSize?: number;
|
|
80
|
+
stridedSampleSize?: number | undefined;
|
|
81
81
|
/** Back-compat: when set, used as the head sample size (strided defaults to 0) */
|
|
82
|
-
sampleSize?: number;
|
|
82
|
+
sampleSize?: number | undefined;
|
|
83
83
|
/** Outlier clip percentile (default AUTO_SIZE_OUTLIER_PERCENTILE) */
|
|
84
|
-
outlierPercentile?: number;
|
|
84
|
+
outlierPercentile?: number | undefined;
|
|
85
85
|
/** Outlier clip threshold fraction (default AUTO_SIZE_OUTLIER_THRESHOLD) */
|
|
86
|
-
outlierThreshold?: number;
|
|
86
|
+
outlierThreshold?: number | undefined;
|
|
87
87
|
/** When "header", ignore cell content and fit the header label only */
|
|
88
|
-
autoSizeMode?: "content" | "header";
|
|
88
|
+
autoSizeMode?: "content" | "header" | undefined;
|
|
89
89
|
/** Theme passed to a custom cellRenderer during measurement */
|
|
90
90
|
theme?: any;
|
|
91
91
|
/** Scope `.st-cell-content` font/padding sampling to this table instance */
|
|
92
|
-
styleRoot?: ParentNode | null;
|
|
92
|
+
styleRoot?: ParentNode | null | undefined;
|
|
93
93
|
/**
|
|
94
94
|
* The table's resolved sort icon. Used to reserve space on sortable columns
|
|
95
95
|
* that are not currently sorted (the icon only exists on the active sort
|
|
96
96
|
* column), so sorting later does not push the label into ellipsis.
|
|
97
97
|
*/
|
|
98
|
-
sortIcon?: string | HTMLElement | SVGSVGElement;
|
|
98
|
+
sortIcon?: string | HTMLElement | SVGSVGElement | undefined;
|
|
99
99
|
/**
|
|
100
100
|
* The table's resolved expand/collapse icon. Used to reserve space on
|
|
101
101
|
* collapsible headers when the header cell is virtualized out of the
|
|
102
102
|
* horizontal band (so the icon is not in the DOM to measure directly).
|
|
103
103
|
*/
|
|
104
|
-
expandIcon?: string | HTMLElement | SVGSVGElement;
|
|
105
|
-
|
|
104
|
+
expandIcon?: string | HTMLElement | SVGSVGElement | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Called before a temporary measure host from `cellRenderer` is discarded.
|
|
107
|
+
* Framework adapters (React portals, Vue/Solid mounts) register on render;
|
|
108
|
+
* without this, autofit sampling leaks those registrations.
|
|
109
|
+
*/
|
|
110
|
+
onRendererHostDiscard?: ((host: HTMLElement) => void) | undefined;
|
|
111
|
+
} | undefined) => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs & Examples / Examples – product-style demos (domain datasets).
|
|
3
|
+
* Stories are listed alphabetically.
|
|
4
|
+
*/
|
|
5
|
+
import type { Meta, StoryObj } from "@storybook/html";
|
|
6
|
+
declare const meta: Meta;
|
|
7
|
+
export default meta;
|
|
8
|
+
export declare const Billing: StoryObj;
|
|
9
|
+
export declare const Clay: StoryObj;
|
|
10
|
+
export declare const Finance: StoryObj;
|
|
11
|
+
export declare const Infrastructure: StoryObj;
|
|
12
|
+
export declare const Leads: StoryObj;
|
|
13
|
+
export declare const Manufacturing: StoryObj;
|
|
14
|
+
export declare const Music: StoryObj;
|
|
15
|
+
export declare const MusicWindowScroll: StoryObj;
|
|
16
|
+
export declare const RadioStations: StoryObj;
|
|
17
|
+
export declare const Sales: StoryObj;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Docs & Examples
|
|
3
|
-
* Each story uses SimpleTableVanilla; example logic lives in stories/examples/.
|
|
2
|
+
* Docs & Examples / Features – capability demos, listed alphabetically.
|
|
4
3
|
*/
|
|
5
4
|
import type { Meta, StoryObj } from "@storybook/html";
|
|
6
5
|
declare const meta: Meta;
|
|
7
6
|
export default meta;
|
|
8
7
|
export declare const AdvancedSorting: StoryObj;
|
|
9
|
-
export declare const
|
|
8
|
+
export declare const Aggregate: StoryObj;
|
|
10
9
|
export declare const Alignment: StoryObj;
|
|
11
10
|
export declare const AutoExpandColumns: StoryObj;
|
|
12
|
-
export declare const BasicExample: StoryObj;
|
|
13
11
|
export declare const BasicRowGrouping: StoryObj;
|
|
14
|
-
export declare const BillingExample: StoryObj;
|
|
15
12
|
export declare const CSVExportFormatting: StoryObj;
|
|
16
13
|
export declare const CSVExportSingleRowChildren: StoryObj;
|
|
17
14
|
export declare const CellHighlighting: StoryObj;
|
|
18
15
|
export declare const CellRenderer: StoryObj;
|
|
19
16
|
export declare const Charts: StoryObj;
|
|
20
|
-
export declare const ClayExample: StoryObj;
|
|
21
17
|
export declare const ClipboardFormatting: StoryObj;
|
|
22
18
|
export declare const CollapsibleColumns: StoryObj;
|
|
23
19
|
export declare const ColumnVisibilityAPI: StoryObj;
|
|
@@ -32,21 +28,14 @@ export declare const EditableCells: StoryObj;
|
|
|
32
28
|
export declare const ExpansionControl: StoryObj;
|
|
33
29
|
export declare const ExternalFilter: StoryObj;
|
|
34
30
|
export declare const ExternalSort: StoryObj;
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const FinanceExample: StoryObj;
|
|
31
|
+
export declare const Filter: StoryObj;
|
|
37
32
|
export declare const HeaderInclusion: StoryObj;
|
|
38
33
|
export declare const HiddenColumns: StoryObj;
|
|
39
34
|
export declare const InfiniteScroll: StoryObj;
|
|
40
|
-
export declare const WindowInfiniteScroll: StoryObj;
|
|
41
|
-
export declare const InfrastructureExample: StoryObj;
|
|
42
|
-
export declare const LeadsExample: StoryObj;
|
|
43
35
|
export declare const LiveUpdates: StoryObj;
|
|
44
36
|
export declare const LoadingState: StoryObj;
|
|
45
|
-
export declare const ManufacturingExample: StoryObj;
|
|
46
|
-
export declare const MusicExample: StoryObj;
|
|
47
|
-
export declare const MusicWindowScroll: StoryObj;
|
|
48
|
-
export declare const NestedGrid: StoryObj;
|
|
49
37
|
export declare const NestedAccessor: StoryObj;
|
|
38
|
+
export declare const NestedGrid: StoryObj;
|
|
50
39
|
export declare const Pagination: StoryObj;
|
|
51
40
|
export declare const PaginationAPI: StoryObj;
|
|
52
41
|
export declare const PinnedColumns: StoryObj;
|
|
@@ -57,8 +46,8 @@ export declare const RowButtons: StoryObj;
|
|
|
57
46
|
export declare const RowGrouping: StoryObj;
|
|
58
47
|
export declare const RowHeight: StoryObj;
|
|
59
48
|
export declare const RowSelection: StoryObj;
|
|
60
|
-
export declare const SalesExample: StoryObj;
|
|
61
49
|
export declare const SelectableCells: StoryObj;
|
|
62
50
|
export declare const ServerSidePagination: StoryObj;
|
|
63
51
|
export declare const Theming: StoryObj;
|
|
64
52
|
export declare const Tooltip: StoryObj;
|
|
53
|
+
export declare const WindowInfiniteScroll: StoryObj;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Storybook args helper for Docs & Examples stories.
|
|
3
|
+
*/
|
|
4
|
+
import { type UniversalVanillaArgs } from "../vanillaStoryConfig";
|
|
5
|
+
export declare const storyArgs: (exampleDefaults?: Partial<UniversalVanillaArgs>) => {
|
|
6
|
+
args: {
|
|
7
|
+
autoExpandColumns?: boolean | undefined;
|
|
8
|
+
cellUpdateFlash?: boolean | undefined;
|
|
9
|
+
columnReordering?: boolean | undefined;
|
|
10
|
+
columnResizing?: boolean | undefined;
|
|
11
|
+
customTheme?: import("../../src").CustomThemeProps | undefined;
|
|
12
|
+
editColumns?: boolean | undefined;
|
|
13
|
+
editColumnsInitOpen?: boolean | undefined;
|
|
14
|
+
expandAll?: boolean | undefined;
|
|
15
|
+
externalFilterHandling?: boolean | undefined;
|
|
16
|
+
externalSortHandling?: boolean | undefined;
|
|
17
|
+
height?: string | undefined;
|
|
18
|
+
hideFooter?: boolean | undefined;
|
|
19
|
+
rowsPerPage?: number | undefined;
|
|
20
|
+
selectableCells?: boolean | undefined;
|
|
21
|
+
selectableColumns?: boolean | undefined;
|
|
22
|
+
shouldPaginate?: boolean | undefined;
|
|
23
|
+
theme?: import("../../src/types/Theme").default | undefined;
|
|
24
|
+
useHoverRowBackground?: boolean | undefined;
|
|
25
|
+
useOddColumnBackground?: boolean | undefined;
|
|
26
|
+
useOddEvenRowBackground?: boolean | undefined;
|
|
27
|
+
};
|
|
28
|
+
argTypes: {
|
|
29
|
+
theme: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "select";
|
|
32
|
+
};
|
|
33
|
+
options: string[];
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
useOddColumnBackground: {
|
|
37
|
+
control: {
|
|
38
|
+
type: "boolean";
|
|
39
|
+
};
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
useHoverRowBackground: {
|
|
43
|
+
control: {
|
|
44
|
+
type: "boolean";
|
|
45
|
+
};
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
useOddEvenRowBackground: {
|
|
49
|
+
control: {
|
|
50
|
+
type: "boolean";
|
|
51
|
+
};
|
|
52
|
+
description: string;
|
|
53
|
+
};
|
|
54
|
+
cellUpdateFlash: {
|
|
55
|
+
control: {
|
|
56
|
+
type: "boolean";
|
|
57
|
+
};
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
height: {
|
|
61
|
+
control: {
|
|
62
|
+
type: "text";
|
|
63
|
+
};
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
customTheme: {
|
|
67
|
+
control: {
|
|
68
|
+
type: "object";
|
|
69
|
+
};
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
autoExpandColumns: {
|
|
73
|
+
control: {
|
|
74
|
+
type: "boolean";
|
|
75
|
+
};
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
expandAll: {
|
|
79
|
+
control: {
|
|
80
|
+
type: "boolean";
|
|
81
|
+
};
|
|
82
|
+
description: string;
|
|
83
|
+
};
|
|
84
|
+
columnReordering: {
|
|
85
|
+
control: {
|
|
86
|
+
type: "boolean";
|
|
87
|
+
};
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
columnResizing: {
|
|
91
|
+
control: {
|
|
92
|
+
type: "boolean";
|
|
93
|
+
};
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
editColumns: {
|
|
97
|
+
control: {
|
|
98
|
+
type: "boolean";
|
|
99
|
+
};
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
editColumnsInitOpen: {
|
|
103
|
+
control: {
|
|
104
|
+
type: "boolean";
|
|
105
|
+
};
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
selectableCells: {
|
|
109
|
+
control: {
|
|
110
|
+
type: "boolean";
|
|
111
|
+
};
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
selectableColumns: {
|
|
115
|
+
control: {
|
|
116
|
+
type: "boolean";
|
|
117
|
+
};
|
|
118
|
+
description: string;
|
|
119
|
+
};
|
|
120
|
+
shouldPaginate: {
|
|
121
|
+
control: {
|
|
122
|
+
type: "boolean";
|
|
123
|
+
};
|
|
124
|
+
description: string;
|
|
125
|
+
};
|
|
126
|
+
hideFooter: {
|
|
127
|
+
control: {
|
|
128
|
+
type: "boolean";
|
|
129
|
+
};
|
|
130
|
+
description: string;
|
|
131
|
+
};
|
|
132
|
+
externalSortHandling: {
|
|
133
|
+
control: {
|
|
134
|
+
type: "boolean";
|
|
135
|
+
};
|
|
136
|
+
description: string;
|
|
137
|
+
};
|
|
138
|
+
externalFilterHandling: {
|
|
139
|
+
control: {
|
|
140
|
+
type: "boolean";
|
|
141
|
+
};
|
|
142
|
+
description: string;
|
|
143
|
+
};
|
|
144
|
+
rowsPerPage: {
|
|
145
|
+
control: {
|
|
146
|
+
type: "number";
|
|
147
|
+
min: number;
|
|
148
|
+
max: number;
|
|
149
|
+
step: number;
|
|
150
|
+
};
|
|
151
|
+
description: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
@@ -76,6 +76,25 @@ export declare const SmartModeQuotedPhrase: {
|
|
|
76
76
|
}) => Promise<void>;
|
|
77
77
|
};
|
|
78
78
|
export declare const SmartModeNegation: {
|
|
79
|
+
parameters: {
|
|
80
|
+
tags: string[];
|
|
81
|
+
};
|
|
82
|
+
render: () => HTMLDivElement & {
|
|
83
|
+
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
84
|
+
};
|
|
85
|
+
play: ({ canvasElement }: {
|
|
86
|
+
canvasElement: HTMLElement;
|
|
87
|
+
}) => Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Filtering through a brief empty state (0 matching rows) and back must remount
|
|
91
|
+
* body cells. Regression for empty-state scrollport takeover that left
|
|
92
|
+
* SectionRenderer holding detached body sections.
|
|
93
|
+
*/
|
|
94
|
+
export declare const QuickFilterRecoversAfterEmptyState: {
|
|
95
|
+
parameters: {
|
|
96
|
+
tags: string[];
|
|
97
|
+
};
|
|
79
98
|
render: () => HTMLDivElement & {
|
|
80
99
|
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
81
100
|
};
|
|
@@ -350,6 +350,22 @@ export declare const HorizontalScrollbarShowsWhenHeaderOverflowsEmptyState: {
|
|
|
350
350
|
canvasElement: HTMLElement;
|
|
351
351
|
}) => Promise<void>;
|
|
352
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* Empty tables still need a real body scrollport: wheel/trackpad over the
|
|
355
|
+
* "No rows to display" area (and the horizontal scrollbar) must scroll the
|
|
356
|
+
* headers. Replacing the body with a non-scrolling empty wrapper breaks that.
|
|
357
|
+
*/
|
|
358
|
+
export declare const EmptyStateBodyScrollSyncsWithHeader: {
|
|
359
|
+
parameters: {
|
|
360
|
+
tags: string[];
|
|
361
|
+
};
|
|
362
|
+
render: () => HTMLDivElement & {
|
|
363
|
+
_table?: SimpleTableVanilla | undefined;
|
|
364
|
+
};
|
|
365
|
+
play: ({ canvasElement }: {
|
|
366
|
+
canvasElement: HTMLElement;
|
|
367
|
+
}) => Promise<void>;
|
|
368
|
+
};
|
|
353
369
|
export declare const SamplingAndOutlierHelpers: {
|
|
354
370
|
parameters: {
|
|
355
371
|
tags: string[];
|
|
@@ -2,9 +2,22 @@
|
|
|
2
2
|
* Shared helpers for vanilla stories (examples and tests).
|
|
3
3
|
*/
|
|
4
4
|
import { SimpleTableVanilla } from "../src/index";
|
|
5
|
-
import type { HeaderObject, Row } from "../src/index";
|
|
5
|
+
import type { HeaderObject, Row, SimpleTableConfig } from "../src/index";
|
|
6
6
|
/** Instance type of the table (class is a value; use InstanceType<typeof C> for the type of instances). */
|
|
7
7
|
type TableInstance = InstanceType<typeof SimpleTableVanilla>;
|
|
8
|
+
/**
|
|
9
|
+
* Config passed through to {@link SimpleTableVanilla}, minus `defaultHeaders` /
|
|
10
|
+
* `rows` which are supplied as the first two arguments of
|
|
11
|
+
* {@link renderVanillaTable}.
|
|
12
|
+
*
|
|
13
|
+
* Keys are constrained to {@link SimpleTableConfig} so typos and misplaced
|
|
14
|
+
* props (e.g. top-level `rowHeight` instead of `customTheme.rowHeight`) fail
|
|
15
|
+
* at compile time. Values stay loose (`unknown`) so story callbacks that are
|
|
16
|
+
* slightly narrower than the public types still typecheck.
|
|
17
|
+
*/
|
|
18
|
+
export type RenderVanillaTableOptions = {
|
|
19
|
+
[K in keyof Omit<SimpleTableConfig, "defaultHeaders" | "rows">]?: unknown;
|
|
20
|
+
};
|
|
8
21
|
export interface RenderVanillaTableResult {
|
|
9
22
|
wrapper: HTMLDivElement & {
|
|
10
23
|
_table?: TableInstance;
|
|
@@ -13,7 +26,7 @@ export interface RenderVanillaTableResult {
|
|
|
13
26
|
tableContainer: HTMLDivElement;
|
|
14
27
|
table: TableInstance;
|
|
15
28
|
}
|
|
16
|
-
export declare function renderVanillaTable(headers: HeaderObject[], data: Row[], options?:
|
|
29
|
+
export declare function renderVanillaTable(headers: HeaderObject[], data: Row[], options?: RenderVanillaTableOptions): RenderVanillaTableResult;
|
|
17
30
|
export declare function addParagraph(wrapper: HTMLElement, text: string, beforeElement?: Element | null): HTMLParagraphElement;
|
|
18
31
|
export interface ControlPanelSection {
|
|
19
32
|
heading: string;
|