simple-table-core 3.8.7 → 3.8.9
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 +26 -0
- package/dist/cjs/src/core/rendering/RenderOrchestrator.d.ts +4 -0
- package/dist/cjs/src/core/rendering/TableRenderer.d.ts +4 -0
- package/dist/cjs/src/types/HandleResizeStartProps.d.ts +4 -0
- package/dist/cjs/src/types/HeaderObject.d.ts +5 -1
- package/dist/cjs/src/types/SimpleTableConfig.d.ts +7 -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 +4 -0
- package/dist/cjs/src/utils/headerWidthUtils.d.ts +0 -5
- package/dist/cjs/src/utils/resizeUtils/autoExpandResize.d.ts +14 -3
- package/dist/cjs/src/utils/resizeUtils/compensation.d.ts +7 -1
- package/dist/cjs/src/utils/resizeUtils/index.d.ts +6 -2
- package/dist/cjs/stories/tests/08-ColumnWidthTests.stories.d.ts +6 -2
- package/dist/cjs/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +8 -5
- package/dist/cjs/stories/tests/49-AutoWidthAutoExpandTests.stories.d.ts +151 -0
- package/dist/cjs/styles.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/src/core/SimpleTableVanilla.d.ts +26 -0
- package/dist/src/core/rendering/RenderOrchestrator.d.ts +4 -0
- package/dist/src/core/rendering/TableRenderer.d.ts +4 -0
- package/dist/src/types/HandleResizeStartProps.d.ts +4 -0
- package/dist/src/types/HeaderObject.d.ts +5 -1
- package/dist/src/types/SimpleTableConfig.d.ts +7 -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 +4 -0
- package/dist/src/utils/headerWidthUtils.d.ts +0 -5
- package/dist/src/utils/resizeUtils/autoExpandResize.d.ts +14 -3
- package/dist/src/utils/resizeUtils/compensation.d.ts +7 -1
- package/dist/src/utils/resizeUtils/index.d.ts +6 -2
- package/dist/stories/tests/08-ColumnWidthTests.stories.d.ts +6 -2
- package/dist/stories/tests/39-AutoExpandColumnsTests.stories.d.ts +8 -5
- package/dist/stories/tests/49-AutoWidthAutoExpandTests.stories.d.ts +151 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/base.css +0 -5
|
@@ -29,6 +29,16 @@ export declare class SimpleTableVanilla {
|
|
|
29
29
|
private autoSizeAccessors;
|
|
30
30
|
/** Accessors awaiting a content-fit measurement on the next render. */
|
|
31
31
|
private pendingAutoSize;
|
|
32
|
+
/**
|
|
33
|
+
* Natural (unexpanded) pixel width per leaf column, overriding the declared
|
|
34
|
+
* width: the measured content width for `width: "auto"` columns and the
|
|
35
|
+
* width the user explicitly set via drag-resize / double-click auto-fit.
|
|
36
|
+
* With autoExpandColumns these feed the shrink floors used during column
|
|
37
|
+
* resize — neighbors give up surplus (expanded) space but are never
|
|
38
|
+
* squeezed below their natural width; past that point the section
|
|
39
|
+
* overflows into horizontal scroll.
|
|
40
|
+
*/
|
|
41
|
+
private naturalWidths;
|
|
32
42
|
/** Guard against re-entrancy while the auto-size pass re-renders. */
|
|
33
43
|
private isAutoSizing;
|
|
34
44
|
private currentPage;
|
|
@@ -279,6 +289,17 @@ export declare class SimpleTableVanilla {
|
|
|
279
289
|
* every auto column's width.
|
|
280
290
|
*/
|
|
281
291
|
private getAutoSizeRows;
|
|
292
|
+
/**
|
|
293
|
+
* Shrink floors for auto-expand column resize, keyed by accessor. Each
|
|
294
|
+
* visible leaf's floor is its natural width — a user-set / content-measured
|
|
295
|
+
* override when present, else the pixel width declared in the column
|
|
296
|
+
* definitions — raised to at least its `minWidth` (or the global minimum).
|
|
297
|
+
* Flexible declarations (fr / % / unmeasured "auto") have no pixel natural,
|
|
298
|
+
* so they floor at `minWidth` alone.
|
|
299
|
+
*/
|
|
300
|
+
private getShrinkFloors;
|
|
301
|
+
/** Record user-set / measured widths as the columns' new natural widths. */
|
|
302
|
+
private recordNaturalWidths;
|
|
282
303
|
/** Immutably write measured pixel widths into the leaf headers. */
|
|
283
304
|
private applyMeasuredWidths;
|
|
284
305
|
/**
|
|
@@ -287,6 +308,11 @@ export declare class SimpleTableVanilla {
|
|
|
287
308
|
* measurement reads the just-rendered (provisional-width) DOM and the
|
|
288
309
|
* corrective render happens in the same synchronous task, so there is no
|
|
289
310
|
* visible width snap.
|
|
311
|
+
*
|
|
312
|
+
* With autoExpandColumns, the measured width becomes the column's natural
|
|
313
|
+
* width: the expand-only auto-scale pass in the corrective render stretches
|
|
314
|
+
* columns to fill surplus container space, or leaves them at natural width
|
|
315
|
+
* (horizontal scroll) when they don't fit.
|
|
290
316
|
*/
|
|
291
317
|
private maybeAutoSizeColumns;
|
|
292
318
|
/**
|
|
@@ -64,6 +64,10 @@ export interface RenderContext {
|
|
|
64
64
|
current: HTMLDivElement | null;
|
|
65
65
|
};
|
|
66
66
|
onRender: () => void;
|
|
67
|
+
/** Natural-width shrink floors (accessor -> px) for auto-expand column resize. */
|
|
68
|
+
getShrinkFloors?: () => Map<string, number>;
|
|
69
|
+
/** Persist user-set widths (drag / double-click auto-fit) as natural widths. */
|
|
70
|
+
onAutoExpandNaturalWidths?: (widths: Map<string, number>) => void;
|
|
67
71
|
pinnedLeftHeaderRef: {
|
|
68
72
|
current: HTMLDivElement | null;
|
|
69
73
|
};
|
|
@@ -59,6 +59,10 @@ export interface TableRendererDeps {
|
|
|
59
59
|
current: HTMLDivElement | null;
|
|
60
60
|
};
|
|
61
61
|
onRender: () => void;
|
|
62
|
+
/** Natural-width shrink floors (accessor -> px) for auto-expand column resize. */
|
|
63
|
+
getShrinkFloors?: () => Map<string, number>;
|
|
64
|
+
/** Persist user-set widths (drag / double-click auto-fit) as natural widths. */
|
|
65
|
+
onAutoExpandNaturalWidths?: (widths: Map<string, number>) => void;
|
|
62
66
|
pinnedLeftHeaderRef: {
|
|
63
67
|
current: HTMLDivElement | null;
|
|
64
68
|
};
|
|
@@ -12,10 +12,14 @@ export type HandleResizeStartProps = {
|
|
|
12
12
|
headers: HeaderObject[];
|
|
13
13
|
mainBodyRef: RefObject<HTMLDivElement>;
|
|
14
14
|
onColumnWidthChange?: (headers: HeaderObject[]) => void;
|
|
15
|
+
/** Persist the dragged column(s)' final widths as their natural widths (autoExpandColumns). */
|
|
16
|
+
onAutoExpandNaturalWidths?: (widths: Map<string, number>) => void;
|
|
15
17
|
pinnedLeftRef: RefObject<HTMLDivElement>;
|
|
16
18
|
pinnedRightRef: RefObject<HTMLDivElement>;
|
|
17
19
|
reverse: boolean;
|
|
18
20
|
setHeaders: (headers: HeaderObject[] | ((prev: HeaderObject[]) => HeaderObject[])) => void;
|
|
19
21
|
setIsResizing: (isResizing: boolean | ((prev: boolean) => boolean)) => void;
|
|
22
|
+
/** Natural-width shrink floors (accessor -> px) for compensating neighbors (autoExpandColumns). */
|
|
23
|
+
shrinkFloors?: Map<string, number>;
|
|
20
24
|
startWidth: number;
|
|
21
25
|
};
|
|
@@ -121,7 +121,11 @@ type HeaderObject = {
|
|
|
121
121
|
showWhen?: ShowWhen;
|
|
122
122
|
/**
|
|
123
123
|
* Column width. A number or px/fr/% string sets a fixed/proportional width.
|
|
124
|
-
* The special value `"auto"` sizes the column to fit its content (see
|
|
124
|
+
* The special value `"auto"` sizes the column to fit its content (see
|
|
125
|
+
* `autoSizeMode`). With `autoExpandColumns`, the fixed/measured width acts
|
|
126
|
+
* as the column's natural width: it can stretch to help fill surplus
|
|
127
|
+
* container space but is never squeezed narrower (the table scrolls
|
|
128
|
+
* horizontally instead).
|
|
125
129
|
*/
|
|
126
130
|
width: number | string;
|
|
127
131
|
maxWidth?: number | string;
|
|
@@ -22,6 +22,13 @@ import { AnimationsConfig } from "./AnimationsConfig";
|
|
|
22
22
|
import type { FooterPosition } from "./FooterPosition";
|
|
23
23
|
export interface SimpleTableConfig {
|
|
24
24
|
animations?: AnimationsConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Expand-only fill: when the columns' natural widths (declared px, or
|
|
27
|
+
* content-measured for `width: "auto"`) leave surplus container space,
|
|
28
|
+
* columns stretch proportionally to fill it (respecting `maxWidth`).
|
|
29
|
+
* Columns are never squeezed below their natural width — when they don't
|
|
30
|
+
* fit, the table scrolls horizontally instead.
|
|
31
|
+
*/
|
|
25
32
|
autoExpandColumns?: boolean;
|
|
26
33
|
canExpandRowGroup?: (row: Row) => boolean;
|
|
27
34
|
cellUpdateFlash?: boolean;
|
|
@@ -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) => HTMLElement | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
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) => string;
|
|
3
|
+
export declare const createHeaderCellElement: (cell: AbsoluteCell, context: HeaderRenderContext) => HTMLElement;
|
|
4
4
|
export declare const getLastHeaderIndex: (absoluteCells: AbsoluteCell[]) => number;
|
|
5
5
|
/** Replace sort/filter/collapse icons on an existing header cell, preserving label/drag handlers. */
|
|
6
6
|
export declare const refreshHeaderCellIcons: (cellElement: HTMLElement, header: AbsoluteCell["header"], context: HeaderRenderContext, colIndex: number) => void;
|
|
7
|
-
export declare const updateHeaderCellElement: (cellElement: HTMLElement, cell: AbsoluteCell, context: HeaderRenderContext
|
|
7
|
+
export declare const updateHeaderCellElement: (cellElement: HTMLElement, cell: AbsoluteCell, context: HeaderRenderContext) => void;
|
|
@@ -38,6 +38,10 @@ export interface HeaderRenderContext {
|
|
|
38
38
|
filters: TableFilterState;
|
|
39
39
|
forceUpdate: () => void;
|
|
40
40
|
getCollapsedHeaders?: () => Set<Accessor>; /** Get current collapsed headers (avoids stale closure in toggle handler). */
|
|
41
|
+
/** Natural-width shrink floors (accessor -> px) for auto-expand column resize. */
|
|
42
|
+
getShrinkFloors?: () => Map<string, number>;
|
|
43
|
+
/** Persist user-set widths (drag / double-click auto-fit) as natural widths. */
|
|
44
|
+
onAutoExpandNaturalWidths?: (widths: Map<string, number>) => void;
|
|
41
45
|
handleApplyFilter: (filter: FilterCondition) => void;
|
|
42
46
|
handleClearFilter: (accessor: Accessor) => void;
|
|
43
47
|
handleSelectAll?: (checked: boolean) => void;
|
|
@@ -62,11 +62,6 @@ export declare const getHeaderMinWidth: (header: HeaderObject) => number;
|
|
|
62
62
|
* Get all visible leaf headers from an array of headers
|
|
63
63
|
*/
|
|
64
64
|
export declare const getAllVisibleLeafHeaders: (headers: HeaderObject[], collapsedHeaders?: Set<Accessor>) => HeaderObject[];
|
|
65
|
-
/**
|
|
66
|
-
* Convert pixel-based widths to proportional fr units
|
|
67
|
-
* This is used when autoExpandColumns is enabled
|
|
68
|
-
*/
|
|
69
|
-
export declare const convertPixelWidthsToFr: (headers: HeaderObject[], collapsedHeaders?: Set<Accessor>) => HeaderObject[];
|
|
70
65
|
/**
|
|
71
66
|
* Calculate the optimal width for a column by measuring both header and cell content
|
|
72
67
|
* This is used for auto-sizing columns to fit their content (like Excel/Google Sheets)
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type HeaderObject from "../../types/HeaderObject";
|
|
2
2
|
import type { Pinned } from "../../types/Pinned";
|
|
3
3
|
/**
|
|
4
|
-
* Handle resize with autoExpandColumns enabled
|
|
5
|
-
*
|
|
4
|
+
* Handle resize with autoExpandColumns enabled.
|
|
5
|
+
*
|
|
6
|
+
* Neighbors compensate a growing column only down to their shrink floor (their
|
|
7
|
+
* natural width — declared, content-measured, or user-set). Once all
|
|
8
|
+
* neighbors are at their floor, the main section keeps growing past the
|
|
9
|
+
* container width and overflows into horizontal scroll instead of blocking
|
|
10
|
+
* the drag. Pinned sections cannot scroll their own content, so their growth
|
|
11
|
+
* stays capped by the neighbors' available surplus (plus the pinned-width
|
|
12
|
+
* policy cap).
|
|
6
13
|
*/
|
|
7
|
-
export declare const handleResizeWithAutoExpand: ({ childrenToResize, collapsedHeaders, containerWidth, delta, headers, initialWidthsMap, isParentResize, resizedHeader, reverse, rootPinned, sectionHeaders, sectionWidth, startWidth, }: {
|
|
14
|
+
export declare const handleResizeWithAutoExpand: ({ childrenToResize, collapsedHeaders, containerWidth, delta, headers, initialWidthsMap, isParentResize, resizedHeader, reverse, rootPinned, sectionHeaders, sectionWidth, sectionViewportWidth, shrinkFloors, startWidth, }: {
|
|
8
15
|
childrenToResize?: HeaderObject[] | undefined;
|
|
9
16
|
collapsedHeaders?: Set<string> | undefined;
|
|
10
17
|
containerWidth: number;
|
|
@@ -17,5 +24,9 @@ export declare const handleResizeWithAutoExpand: ({ childrenToResize, collapsedH
|
|
|
17
24
|
rootPinned: Pinned | undefined;
|
|
18
25
|
sectionHeaders: HeaderObject[];
|
|
19
26
|
sectionWidth: number;
|
|
27
|
+
/** Visible viewport width of the section (main: container minus pinned). 0 when unknown. */
|
|
28
|
+
sectionViewportWidth?: number | undefined;
|
|
29
|
+
/** Accessor -> natural width; the shrink floor for compensating neighbors. */
|
|
30
|
+
shrinkFloors?: Map<string, number> | undefined;
|
|
20
31
|
startWidth: number;
|
|
21
32
|
}) => void;
|
|
@@ -3,9 +3,15 @@ import type HeaderObject from "../../types/HeaderObject";
|
|
|
3
3
|
* Distribute compensation among columns proportionally based on available headroom
|
|
4
4
|
* Used in autoExpandColumns mode
|
|
5
5
|
* Positive compensation = shrink columns, Negative compensation = grow columns
|
|
6
|
+
*
|
|
7
|
+
* `shrinkFloors` (accessor -> px) sets each column's shrink floor — its natural
|
|
8
|
+
* width (declared, content-measured, or user-set). Columns give up only their
|
|
9
|
+
* surplus (expanded) space and are never squeezed below their natural width.
|
|
10
|
+
* Falls back to MIN_COLUMN_WIDTH when a column has no known floor.
|
|
6
11
|
*/
|
|
7
|
-
export declare const distributeCompensationProportionally: ({ columnsToShrink, totalCompensation, initialWidthsMap, }: {
|
|
12
|
+
export declare const distributeCompensationProportionally: ({ columnsToShrink, totalCompensation, initialWidthsMap, shrinkFloors, }: {
|
|
8
13
|
columnsToShrink: HeaderObject[];
|
|
9
14
|
totalCompensation: number;
|
|
10
15
|
initialWidthsMap: Map<string, number>;
|
|
16
|
+
shrinkFloors?: Map<string, number> | undefined;
|
|
11
17
|
}) => void;
|
|
@@ -4,7 +4,7 @@ import type { HandleResizeStartProps } from "../../types/HandleResizeStartProps"
|
|
|
4
4
|
/**
|
|
5
5
|
* Handler for when resize dragging starts
|
|
6
6
|
*/
|
|
7
|
-
export declare const handleResizeStart: ({ autoExpandColumns, collapsedHeaders, containerWidth, event, header, headers, mainBodyRef, onColumnWidthChange, reverse, setHeaders, setIsResizing, startWidth, }: HandleResizeStartProps) => void;
|
|
7
|
+
export declare const handleResizeStart: ({ autoExpandColumns, collapsedHeaders, containerWidth, event, header, headers, mainBodyRef, onColumnWidthChange, onAutoExpandNaturalWidths, reverse, setHeaders, setIsResizing, shrinkFloors, startWidth, }: HandleResizeStartProps) => void;
|
|
8
8
|
export type ApplyColumnAutoFitWithAutoExpandParams = {
|
|
9
9
|
collapsedHeaders: Set<Accessor>;
|
|
10
10
|
containerWidth: number;
|
|
@@ -13,10 +13,14 @@ export type ApplyColumnAutoFitWithAutoExpandParams = {
|
|
|
13
13
|
headerCellElement: HTMLElement | null;
|
|
14
14
|
headers: HeaderObject[];
|
|
15
15
|
mainBodyRef: HandleResizeStartProps["mainBodyRef"];
|
|
16
|
+
/** Persist the auto-fitted column(s)' widths as their natural widths. */
|
|
17
|
+
onAutoExpandNaturalWidths?: (widths: Map<string, number>) => void;
|
|
16
18
|
reverse: boolean;
|
|
19
|
+
/** Natural-width shrink floors (accessor -> px) for compensating neighbors. */
|
|
20
|
+
shrinkFloors?: Map<string, number>;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* Apply a one-shot "fit to content" width for a column while preserving autoExpand
|
|
20
24
|
* compensation (same redistribution rules as dragging the resize handle).
|
|
21
25
|
*/
|
|
22
|
-
export declare const applyColumnAutoFitWithAutoExpand: ({ header, headers, collapsedHeaders, containerWidth, mainBodyRef, reverse, headerCellElement, getTargetLeafWidth, }: ApplyColumnAutoFitWithAutoExpandParams) => void;
|
|
26
|
+
export declare const applyColumnAutoFitWithAutoExpand: ({ header, headers, collapsedHeaders, containerWidth, mainBodyRef, reverse, headerCellElement, getTargetLeafWidth, onAutoExpandNaturalWidths, shrinkFloors, }: ApplyColumnAutoFitWithAutoExpandParams) => void;
|
|
@@ -45,7 +45,9 @@ export declare const AutoExpandColumnsBasic: {
|
|
|
45
45
|
canvasElement: any;
|
|
46
46
|
}) => Promise<void>;
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
/** Expand-only: when declared widths exceed the container, columns keep their
|
|
49
|
+
* declared (natural) widths and the table scrolls horizontally — no squeeze. */
|
|
50
|
+
export declare const AutoExpandColumnsNeverSqueezesBelowDeclaredWidth: {
|
|
49
51
|
render: () => HTMLDivElement & {
|
|
50
52
|
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
51
53
|
};
|
|
@@ -53,7 +55,9 @@ export declare const AutoExpandColumnsIgnoresMinWidth: {
|
|
|
53
55
|
canvasElement: any;
|
|
54
56
|
}) => Promise<void>;
|
|
55
57
|
};
|
|
56
|
-
|
|
58
|
+
/** Expansion respects maxWidth: capped columns stop at their cap and the
|
|
59
|
+
* remaining surplus is redistributed to uncapped columns. */
|
|
60
|
+
export declare const AutoExpandColumnsRespectsMaxWidthOnExpand: {
|
|
57
61
|
render: () => HTMLDivElement & {
|
|
58
62
|
_table?: import("../../src/index").SimpleTableVanilla | undefined;
|
|
59
63
|
};
|
|
@@ -309,9 +309,10 @@ export declare const AutoExpandShrinkColumnToMinWidth: {
|
|
|
309
309
|
canvasElement: HTMLElement;
|
|
310
310
|
}) => Promise<void>;
|
|
311
311
|
};
|
|
312
|
-
/** Grow a column
|
|
313
|
-
*
|
|
314
|
-
|
|
312
|
+
/** Grow a column far past what siblings can absorb. Siblings shrink only down
|
|
313
|
+
* to their natural (declared) widths — never below — and the extra growth
|
|
314
|
+
* overflows the container into horizontal scroll. */
|
|
315
|
+
export declare const AutoExpandGrowPastSiblingFloorsOverflows: {
|
|
315
316
|
parameters: {
|
|
316
317
|
tags: string[];
|
|
317
318
|
};
|
|
@@ -360,8 +361,10 @@ export declare const AutoExpandDoubleClickResizePinned: {
|
|
|
360
361
|
canvasElement: HTMLElement;
|
|
361
362
|
}) => Promise<void>;
|
|
362
363
|
};
|
|
363
|
-
/**
|
|
364
|
-
|
|
364
|
+
/** The last main column keeps its resize handle under autoExpandColumns
|
|
365
|
+
* (growth past the container is now possible via horizontal overflow).
|
|
366
|
+
* Dragging it reclaims the left neighbor's expanded surplus first. */
|
|
367
|
+
export declare const AutoExpandLastMainColumnHasResizeHandle: {
|
|
365
368
|
parameters: {
|
|
366
369
|
tags: string[];
|
|
367
370
|
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO WIDTH + AUTO EXPAND COLUMNS TESTS
|
|
3
|
+
*
|
|
4
|
+
* Combined coverage for `width: "auto"` columns under `autoExpandColumns`
|
|
5
|
+
* (the expand-only model):
|
|
6
|
+
* - surplus: content-measured natural widths stretched proportionally to fill
|
|
7
|
+
* - deficit: natural widths kept, horizontal scroll, never squeezed
|
|
8
|
+
* - container resize crossing the fit threshold both ways (no compounding)
|
|
9
|
+
* - drag-resize into horizontal overflow and back out of it
|
|
10
|
+
* - neighbor shrink floors at the measured (natural) width during drags
|
|
11
|
+
* - maxWidth caps during expansion with surplus redistribution
|
|
12
|
+
* - pinned + auto + autoExpand layout
|
|
13
|
+
* - data updates and pagination page changes re-measuring auto columns
|
|
14
|
+
* - double-click auto-fit under the expand-or-scroll model
|
|
15
|
+
*/
|
|
16
|
+
import { SimpleTableVanilla } from "../../src/index";
|
|
17
|
+
import type { Meta } from "@storybook/html";
|
|
18
|
+
declare const meta: Meta;
|
|
19
|
+
export default meta;
|
|
20
|
+
/** Surplus: auto column is content-measured, then all columns stretch
|
|
21
|
+
* proportionally to fill the container. No horizontal scroll. */
|
|
22
|
+
export declare const AutoWidthSurplusStretchesToFill: {
|
|
23
|
+
parameters: {
|
|
24
|
+
tags: string[];
|
|
25
|
+
};
|
|
26
|
+
render: () => HTMLDivElement & {
|
|
27
|
+
_table?: SimpleTableVanilla | undefined;
|
|
28
|
+
};
|
|
29
|
+
play: ({ canvasElement }: {
|
|
30
|
+
canvasElement: HTMLElement;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
/** Deficit: the measured auto column plus fixed columns exceed the container.
|
|
34
|
+
* Nothing is squeezed — natural widths are kept and the table scrolls. */
|
|
35
|
+
export declare const AutoWidthDeficitScrollsNoSqueeze: {
|
|
36
|
+
parameters: {
|
|
37
|
+
tags: string[];
|
|
38
|
+
};
|
|
39
|
+
render: () => HTMLDivElement & {
|
|
40
|
+
_table?: SimpleTableVanilla | undefined;
|
|
41
|
+
};
|
|
42
|
+
play: ({ canvasElement }: {
|
|
43
|
+
canvasElement: HTMLElement;
|
|
44
|
+
}) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
/** Container resize across the fit threshold in both directions: shrink below
|
|
47
|
+
* the natural total (scroll, naturals kept), then grow back (re-expand).
|
|
48
|
+
* Widths must return to the original expanded values — no compounding. */
|
|
49
|
+
export declare const AutoWidthContainerResizeNoCompounding: {
|
|
50
|
+
parameters: {
|
|
51
|
+
tags: string[];
|
|
52
|
+
};
|
|
53
|
+
render: () => HTMLDivElement & {
|
|
54
|
+
_table?: SimpleTableVanilla | undefined;
|
|
55
|
+
};
|
|
56
|
+
play: ({ canvasElement }: {
|
|
57
|
+
canvasElement: HTMLElement;
|
|
58
|
+
}) => Promise<void>;
|
|
59
|
+
};
|
|
60
|
+
/** Drag a column into overflow (past the neighbors' natural floors), then drag
|
|
61
|
+
* it back: the freed space first swallows the overflow, then refills the
|
|
62
|
+
* neighbors, ending exactly full again. */
|
|
63
|
+
export declare const AutoExpandDragIntoOverflowAndBack: {
|
|
64
|
+
parameters: {
|
|
65
|
+
tags: string[];
|
|
66
|
+
};
|
|
67
|
+
render: () => HTMLDivElement & {
|
|
68
|
+
_table?: SimpleTableVanilla | undefined;
|
|
69
|
+
};
|
|
70
|
+
play: ({ canvasElement }: {
|
|
71
|
+
canvasElement: HTMLElement;
|
|
72
|
+
}) => Promise<void>;
|
|
73
|
+
};
|
|
74
|
+
/** During a drag, a `width: "auto"` neighbor gives up only its expanded
|
|
75
|
+
* surplus: it shrinks down to its measured content width and no further. */
|
|
76
|
+
export declare const AutoWidthNeighborFloorsAtMeasuredWidth: {
|
|
77
|
+
parameters: {
|
|
78
|
+
tags: string[];
|
|
79
|
+
};
|
|
80
|
+
render: () => HTMLDivElement & {
|
|
81
|
+
_table?: SimpleTableVanilla | undefined;
|
|
82
|
+
};
|
|
83
|
+
play: ({ canvasElement }: {
|
|
84
|
+
canvasElement: HTMLElement;
|
|
85
|
+
}) => Promise<void>;
|
|
86
|
+
};
|
|
87
|
+
/** During expansion, capped columns (including a measured auto column with
|
|
88
|
+
* maxWidth) stop at their cap; the surplus flows to the uncapped column. */
|
|
89
|
+
export declare const AutoWidthMaxWidthCapsExpansion: {
|
|
90
|
+
parameters: {
|
|
91
|
+
tags: string[];
|
|
92
|
+
};
|
|
93
|
+
render: () => HTMLDivElement & {
|
|
94
|
+
_table?: SimpleTableVanilla | undefined;
|
|
95
|
+
};
|
|
96
|
+
play: ({ canvasElement }: {
|
|
97
|
+
canvasElement: HTMLElement;
|
|
98
|
+
}) => Promise<void>;
|
|
99
|
+
};
|
|
100
|
+
/** A pinned-left auto column keeps its compact measured width (pinned sections
|
|
101
|
+
* don't stretch); the main section expands to fill the remaining space. */
|
|
102
|
+
export declare const AutoWidthPinnedAutoColumn: {
|
|
103
|
+
parameters: {
|
|
104
|
+
tags: string[];
|
|
105
|
+
};
|
|
106
|
+
render: () => HTMLDivElement & {
|
|
107
|
+
_table?: SimpleTableVanilla | undefined;
|
|
108
|
+
};
|
|
109
|
+
play: ({ canvasElement }: {
|
|
110
|
+
canvasElement: HTMLElement;
|
|
111
|
+
}) => Promise<void>;
|
|
112
|
+
};
|
|
113
|
+
/** A data update that grows the auto column's content past the container
|
|
114
|
+
* crosses from "expanded fill" into "natural widths + scroll". */
|
|
115
|
+
export declare const AutoWidthDataUpdateGrowsPastThreshold: {
|
|
116
|
+
parameters: {
|
|
117
|
+
tags: string[];
|
|
118
|
+
};
|
|
119
|
+
render: () => HTMLDivElement & {
|
|
120
|
+
_table?: SimpleTableVanilla | undefined;
|
|
121
|
+
};
|
|
122
|
+
play: ({ canvasElement }: {
|
|
123
|
+
canvasElement: HTMLElement;
|
|
124
|
+
}) => Promise<void>;
|
|
125
|
+
};
|
|
126
|
+
/** Pagination: each page re-measures the auto column against its own rows —
|
|
127
|
+
* a compact page fills the container, a long-content page overflows. */
|
|
128
|
+
export declare const AutoWidthPaginationRemeasuresPerPage: {
|
|
129
|
+
parameters: {
|
|
130
|
+
tags: string[];
|
|
131
|
+
};
|
|
132
|
+
render: () => HTMLDivElement & {
|
|
133
|
+
_table?: SimpleTableVanilla | undefined;
|
|
134
|
+
};
|
|
135
|
+
play: ({ canvasElement }: {
|
|
136
|
+
canvasElement: HTMLElement;
|
|
137
|
+
}) => Promise<void>;
|
|
138
|
+
};
|
|
139
|
+
/** Double-click auto-fit sets the column to its content width (its new natural
|
|
140
|
+
* width); the freed surplus flows to the neighbor and the table stays full. */
|
|
141
|
+
export declare const AutoWidthDoubleClickAutoFit: {
|
|
142
|
+
parameters: {
|
|
143
|
+
tags: string[];
|
|
144
|
+
};
|
|
145
|
+
render: () => HTMLDivElement & {
|
|
146
|
+
_table?: SimpleTableVanilla | undefined;
|
|
147
|
+
};
|
|
148
|
+
play: ({ canvasElement }: {
|
|
149
|
+
canvasElement: HTMLElement;
|
|
150
|
+
}) => Promise<void>;
|
|
151
|
+
};
|