@react-types/table 3.3.4-nightly.3608 → 3.3.4-nightly.3617
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/package.json +4 -4
- package/src/index.d.ts +20 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-types/table",
|
|
3
|
-
"version": "3.3.4-nightly.
|
|
3
|
+
"version": "3.3.4-nightly.3617+6b51339cc",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"url": "https://github.com/adobe/react-spectrum"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@react-types/grid": "3.1.6-nightly.
|
|
13
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
12
|
+
"@react-types/grid": "3.1.6-nightly.3617+6b51339cc",
|
|
13
|
+
"@react-types/shared": "3.0.0-nightly.1917+6b51339cc"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "6b51339cca0b8344507d3c8e81e7ad05d6e75f9b"
|
|
22
22
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ import {AriaLabelingProps, AsyncLoadable, CollectionChildren, DOMProps, LoadingS
|
|
|
14
14
|
import {GridCollection, GridNode} from '@react-types/grid';
|
|
15
15
|
import {Key, ReactElement, ReactNode} from 'react';
|
|
16
16
|
|
|
17
|
+
/** Widths that result in a constant pixel value for the same Table width. */
|
|
18
|
+
export type ColumnStaticSize = number | `${number}` | `${number}%`; // match regex: /^(\d+)(?=%$)/
|
|
19
|
+
/** Widths that change size in relation to the remaining space and in ratio to other dynamic columns. */
|
|
20
|
+
export type ColumnDynamicSize = `${number}fr`; // match regex: /^(\d+)(?=fr$)/
|
|
21
|
+
/** All possible sizes a column can be assigned. */
|
|
22
|
+
export type ColumnSize = ColumnStaticSize | ColumnDynamicSize;
|
|
23
|
+
|
|
17
24
|
export interface TableProps<T> extends MultipleSelection, Sortable {
|
|
18
25
|
/** The elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows. */
|
|
19
26
|
children: [ReactElement<TableHeaderProps<T>>, ReactElement<TableBodyProps<T>>],
|
|
@@ -40,14 +47,15 @@ export interface SpectrumTableProps<T> extends TableProps<T>, SpectrumSelectionP
|
|
|
40
47
|
onAction?: (key: Key) => void,
|
|
41
48
|
/**
|
|
42
49
|
* Handler that is called when a user performs a column resize.
|
|
43
|
-
*
|
|
50
|
+
* Can be used with the width property on columns to put the column widths into
|
|
51
|
+
* a controlled state.
|
|
44
52
|
*/
|
|
45
|
-
|
|
53
|
+
onResize?: (widths: Map<Key, ColumnSize>) => void,
|
|
46
54
|
/**
|
|
47
|
-
* Handler that is called
|
|
48
|
-
*
|
|
55
|
+
* Handler that is called after a user performs a column resize.
|
|
56
|
+
* Can be used to store the widths of columns for another future session.
|
|
49
57
|
*/
|
|
50
|
-
|
|
58
|
+
onResizeEnd?: (widths: Map<Key, ColumnSize>) => void
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
export interface TableHeaderProps<T> {
|
|
@@ -67,20 +75,14 @@ export interface ColumnProps<T> {
|
|
|
67
75
|
/** A list of child columns used when dynamically rendering nested child columns. */
|
|
68
76
|
childColumns?: T[],
|
|
69
77
|
/** The width of the column. */
|
|
70
|
-
width?:
|
|
78
|
+
width?: ColumnSize | null,
|
|
71
79
|
/** The minimum width of the column. */
|
|
72
|
-
minWidth?:
|
|
80
|
+
minWidth?: ColumnStaticSize | null,
|
|
73
81
|
/** The maximum width of the column. */
|
|
74
|
-
maxWidth?:
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
defaultWidth?: number | string,
|
|
80
|
-
/**
|
|
81
|
-
* Whether the column allows resizing.
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
82
|
+
maxWidth?: ColumnStaticSize | null,
|
|
83
|
+
/** The default width of the column. */
|
|
84
|
+
defaultWidth?: ColumnSize | null,
|
|
85
|
+
/** Whether the column allows resizing. */
|
|
84
86
|
allowsResizing?: boolean,
|
|
85
87
|
/** Whether the column allows sorting. */
|
|
86
88
|
allowsSorting?: boolean,
|
|
@@ -141,7 +143,7 @@ export type CellElement = ReactElement<CellProps>;
|
|
|
141
143
|
export type CellRenderer = (columnKey: Key) => CellElement;
|
|
142
144
|
|
|
143
145
|
export interface TableCollection<T> extends GridCollection<T> {
|
|
144
|
-
// TODO perhaps elaborate on this? maybe not clear
|
|
146
|
+
// TODO perhaps elaborate on this? maybe not clear enough, essentially returns the table header rows (e.g. in a tiered headers table, will return the nodes containing the top tier column, next tier, etc)
|
|
145
147
|
/** A list of header row nodes in the table. */
|
|
146
148
|
headerRows: GridNode<T>[],
|
|
147
149
|
/** A list of column nodes in the table. */
|