0) {
+ if (!this.disallowEmptySelection && (this.state.selectedKeys === 'all' || this.state.selectedKeys.size > 0)) {
this.state.setSelectedKeys(new Selection());
}
}
diff --git a/packages/@react-stately/table/src/Cell.ts b/packages/@react-stately/table/src/Cell.ts
index 96508501684..64ee306d81f 100644
--- a/packages/@react-stately/table/src/Cell.ts
+++ b/packages/@react-stately/table/src/Cell.ts
@@ -32,6 +32,9 @@ Cell.getCollectionNode = function* getCollectionNode(props: CellProps): Gener
};
};
+/**
+ * A Cell represents the value of a single Column within a Table Row.
+ */
// We don't want getCollectionNode to show up in the type definition
let _Cell = Cell as (props: CellProps) => JSX.Element;
export {_Cell as Cell};
diff --git a/packages/@react-stately/table/src/Column.ts b/packages/@react-stately/table/src/Column.ts
index c6ec42cba7c..fa7836d769d 100644
--- a/packages/@react-stately/table/src/Column.ts
+++ b/packages/@react-stately/table/src/Column.ts
@@ -68,6 +68,11 @@ Column.getCollectionNode = function* getCollectionNode(props: ColumnProps,
updateContext(context);
};
+/**
+ * A Column represents a field of each item within a Table. Columns may also contain nested
+ * Column elements to represent column groups. Nested columns can be statically defined as
+ * children, or dynamically generated using a function based on the `childColumns` prop.
+ */
// We don't want getCollectionNode to show up in the type definition
let _Column = Column as (props: ColumnProps) => JSX.Element;
export {_Column as Column};
diff --git a/packages/@react-stately/table/src/Row.ts b/packages/@react-stately/table/src/Row.ts
index 3267e4fa871..1bb56474226 100644
--- a/packages/@react-stately/table/src/Row.ts
+++ b/packages/@react-stately/table/src/Row.ts
@@ -74,6 +74,11 @@ Row.getCollectionNode = function* getCollectionNode(props: RowProps, context:
};
};
+/**
+ * A Row represents a single item in a Table and contains Cell elements for each column.
+ * Cells can be statically defined as children, or generated dynamically using a function
+ * based on the columns defined in the TableHeader.
+ */
// We don't want getCollectionNode to show up in the type definition
let _Row = Row as (props: RowProps) => JSX.Element;
export {_Row as Row};
diff --git a/packages/@react-stately/table/src/TableBody.ts b/packages/@react-stately/table/src/TableBody.ts
index 5a43c088e81..e5d37f734d3 100644
--- a/packages/@react-stately/table/src/TableBody.ts
+++ b/packages/@react-stately/table/src/TableBody.ts
@@ -29,7 +29,7 @@ TableBody.getCollectionNode = function* getCollectionNode(props: TableBodyPro
if (!items) {
throw new Error('props.children was a function but props.items is missing');
}
-
+
for (let item of items) {
yield {
type: 'item',
@@ -52,6 +52,10 @@ TableBody.getCollectionNode = function* getCollectionNode(props: TableBodyPro
};
};
+/**
+ * A TableBody is a container for the Row elements of a Table. Rows can be statically defined
+ * as children, or generated dynamically using a function based on the data passed to the `items` prop.
+ */
// We don't want getCollectionNode to show up in the type definition
let _TableBody = TableBody as (props: TableBodyProps) => JSX.Element;
export {_TableBody as TableBody};
diff --git a/packages/@react-stately/table/src/TableHeader.ts b/packages/@react-stately/table/src/TableHeader.ts
index 6ac282c155d..b56befa7523 100644
--- a/packages/@react-stately/table/src/TableHeader.ts
+++ b/packages/@react-stately/table/src/TableHeader.ts
@@ -45,6 +45,10 @@ TableHeader.getCollectionNode = function* getCollectionNode(props: TableHeade
}
};
+/**
+ * A TableHeader is a container for the Column elements in a Table. Columns can be statically defined
+ * as children, or generated dynamically using a function based on the data passed to the `columns` prop.
+ */
// We don't want getCollectionNode to show up in the type definition
let _TableHeader = TableHeader as (props: TableHeaderProps) => JSX.Element;
export {_TableHeader as TableHeader};
diff --git a/packages/@react-types/table/src/index.d.ts b/packages/@react-types/table/src/index.d.ts
index b71ff6f3f69..388d2040ad9 100644
--- a/packages/@react-types/table/src/index.d.ts
+++ b/packages/@react-types/table/src/index.d.ts
@@ -59,8 +59,13 @@ export interface ColumnProps {
/** The minimum width of the column. */
minWidth?: number | string,
/** The maximum width of the column. */
- maxWidth?: number | string
+ maxWidth?: number | string,
// defaultWidth?: number | string
+ /** Whether the column allows sorting. */
+ allowsSorting?: boolean,
+ /** Whether a column is a [row header](https://www.w3.org/TR/wai-aria-1.1/#rowheader) and should be announced by assistive technology during row navigation. */
+ isRowHeader?: boolean
+
}
// TODO: how to support these in CollectionBuilder...
@@ -70,12 +75,8 @@ export interface SpectrumColumnProps extends ColumnProps {
* @default 'start'
*/
align?: 'start' | 'center' | 'end',
- /** Whether the column allows sorting. */
- allowsSorting?: boolean,
// /** Whether the column should stick to the viewport when scrolling. */
// isSticky?: boolean, // shouldStick?? Not implemented yet?
- /** Whether a column is a [row header](https://www.w3.org/TR/wai-aria-1.1/#rowheader) and should be announced by assistive technology during row navigation. */
- isRowHeader?: boolean,
/** Whether the column should render a divider between it and the next column. */
showDivider?: boolean,
/**