@react-aria/table 3.14.2-nightly.4684 → 3.14.2-nightly.4691
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/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useTable.main.js +5 -3
- package/dist/useTable.main.js.map +1 -1
- package/dist/useTable.mjs +5 -3
- package/dist/useTable.module.js +5 -3
- package/dist/useTable.module.js.map +1 -1
- package/package.json +16 -16
- package/src/useTable.ts +23 -5
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridAria, GridProps, GridRowAria, GridRowProps, GridRowGroupAria } from "@react-aria/grid";
|
|
2
|
-
import { LayoutDelegate, DOMAttributes, FocusableElement
|
|
2
|
+
import { Key, LayoutDelegate, Rect, Size, DOMAttributes, FocusableElement } from "@react-types/shared";
|
|
3
3
|
import { RefObject } from "react";
|
|
4
4
|
import { TableState, TreeGridState, TableColumnResizeState } from "@react-stately/table";
|
|
5
5
|
import { GridNode } from "@react-types/grid";
|
|
@@ -8,6 +8,19 @@ import { ColumnSize } from "@react-types/table";
|
|
|
8
8
|
export interface AriaTableProps extends GridProps {
|
|
9
9
|
/** The layout object for the table. Computes what content is visible and how to position and style them. */
|
|
10
10
|
layoutDelegate?: LayoutDelegate;
|
|
11
|
+
/** @deprecated - Use layoutDelegate instead. */
|
|
12
|
+
layout?: DeprecatedLayout;
|
|
13
|
+
}
|
|
14
|
+
interface DeprecatedLayout {
|
|
15
|
+
getLayoutInfo(key: Key): DeprecatedLayoutInfo;
|
|
16
|
+
getContentSize(): Size;
|
|
17
|
+
virtualizer: DeprecatedVirtualizer;
|
|
18
|
+
}
|
|
19
|
+
interface DeprecatedLayoutInfo {
|
|
20
|
+
rect: Rect;
|
|
21
|
+
}
|
|
22
|
+
interface DeprecatedVirtualizer {
|
|
23
|
+
visibleRect: Rect;
|
|
11
24
|
}
|
|
12
25
|
/**
|
|
13
26
|
* Provides the behavior and accessibility implementation for a table component.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AEyBA,+BAAgC,SAAQ,SAAS;IAC/C,4GAA4G;IAC5G,cAAc,CAAC,EAAE,cAAc,CAAA;
|
|
1
|
+
{"mappings":";;;;;;;AEyBA,+BAAgC,SAAQ,SAAS;IAC/C,4GAA4G;IAC5G,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAA;CAC1B;AAED;IACE,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,oBAAoB,CAAC;IAC9C,cAAc,IAAI,IAAI,CAAC;IACvB,WAAW,EAAE,qBAAqB,CAAA;CACnC;AAED;IACE,IAAI,EAAE,IAAI,CAAA;CACX;AAED;IACE,WAAW,EAAE,IAAI,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,yBAAyB,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,QAAQ,CAkExI;AC/FD,4CAA4C,CAAC;IAC3C,2KAA2K;IAC3K,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IAClB,wHAAwH;IACxH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;IACE,+FAA+F;IAC/F,iBAAiB,EAAE,aAAa,CAAA;CACjC;AAED;;;;;GAKG;AACH,qCAAqC,CAAC,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CA8DlK;ACtED;;;;GAIG;AACH,4BAA4B,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAA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UAAU,EAAE,aAAa,CAAC;IAC1B,qCAAqC;IACrC,YAAY,EAAE,aAAa,CAAC;IAC5B,sDAAsD;IACtD,UAAU,EAAE,OAAO,CAAA;CACpB;AAED,4CAA4C,CAAC;IAC3C,2KAA2K;IAC3K,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACpB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;SAIK;IACL,UAAU,CAAC,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAChD,+BAA+B;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACvD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClD,iCAAiC;IACjC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,IAAI,CAAA;CACrD;AAED;;;;;GAKG;AACH,qCAAqC,CAAC,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,qBAAqB,CAoN9K;AC3PD,oCAAoC,gBAAgB,CAEnD;AAGD,YAAY,EAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC","sources":["packages/@react-aria/table/src/packages/@react-aria/table/src/utils.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/TableKeyboardDelegate.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTable.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnHeader.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableHeaderRow.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableCell.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableSelectionCheckbox.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/useTableColumnResize.ts","packages/@react-aria/table/src/packages/@react-aria/table/src/index.ts","packages/@react-aria/table/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useTable} from './useTable';\nexport {useTableColumnHeader} from './useTableColumnHeader';\nexport {useTableRow} from './useTableRow';\nexport {useTableHeaderRow} from './useTableHeaderRow';\nexport {useTableCell} from './useTableCell';\nexport {useTableSelectionCheckbox, useTableSelectAllCheckbox} from './useTableSelectionCheckbox';\nexport {useTableColumnResize} from './useTableColumnResize';\n\n// Workaround for a Parcel bug where re-exports don't work in the CommonJS output format...\n// export {useGridRowGroup as useTableRowGroup} from '@react-aria/grid';\nimport {GridRowGroupAria, useGridRowGroup} from '@react-aria/grid';\nexport function useTableRowGroup(): GridRowGroupAria {\n return useGridRowGroup();\n}\n\nexport type {AriaTableProps} from './useTable';\nexport type {GridAria, GridRowAria, GridRowProps} from '@react-aria/grid';\nexport type {AriaTableColumnHeaderProps, TableColumnHeaderAria} from './useTableColumnHeader';\nexport type {AriaTableCellProps, TableCellAria} from './useTableCell';\nexport type {TableHeaderRowAria} from './useTableHeaderRow';\nexport type {AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria, TableSelectAllCheckboxAria} from './useTableSelectionCheckbox';\nexport type {AriaTableColumnResizeProps, TableColumnResizeAria} from './useTableColumnResize';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/useTable.main.js
CHANGED
|
@@ -38,7 +38,7 @@ $parcel$export(module.exports, "useTable", () => $25d14c0f8fad722e$export$25bcea
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
41
|
-
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate } = props;
|
|
41
|
+
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate, layout: layout } = props;
|
|
42
42
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
43
43
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
44
44
|
let collator = (0, $aZ1Oy$reactariai18n.useCollator)({
|
|
@@ -54,7 +54,8 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
54
54
|
ref: ref,
|
|
55
55
|
direction: direction,
|
|
56
56
|
collator: collator,
|
|
57
|
-
layoutDelegate: layoutDelegate
|
|
57
|
+
layoutDelegate: layoutDelegate,
|
|
58
|
+
layout: layout
|
|
58
59
|
}), [
|
|
59
60
|
keyboardDelegate,
|
|
60
61
|
state.collection,
|
|
@@ -63,7 +64,8 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
63
64
|
ref,
|
|
64
65
|
direction,
|
|
65
66
|
collator,
|
|
66
|
-
layoutDelegate
|
|
67
|
+
layoutDelegate,
|
|
68
|
+
layout
|
|
67
69
|
]);
|
|
68
70
|
let id = (0, $aZ1Oy$reactariautils.useId)(props.id);
|
|
69
71
|
(0, $6acf696f746f932c$exports.gridIds).set(state, id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC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,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,kBAAkB,CAAA,GAAA,oBAAM,EAAE;YACX;QAAjB,IAAI,cAAa,iCAAA,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,IAAK,EAAE,GAAG,KAAK,qBAA7C,qDAAA,+BAAsD,SAAS;QAChF,OAAO,iBAAiB,SAAS,gBAAgB,MAAM,CAAC,CAAC,EAAE,cAAc,IAAI,CAAC,EAAE;wBAAC;QAAU,KAAK;IAClG,uDAAuD;IACvD,GAAG;QAAC;QAAe;QAAQ,MAAM,UAAU,CAAC,OAAO;KAAC;IAEpD,IAAI,mBAAmB,CAAA,GAAA,oCAAa,EAAE;IAEtC,uGAAuG;IACvG,CAAA,GAAA,qCAAc,EAAE;QACd,CAAA,GAAA,sCAAO,EAAE,iBAAiB,aAAa;IACzC,GAAG;QAAC;KAAgB;IAEpB,OAAO;QACL,WAAW,CAAA,GAAA,gCAAS,EAClB,WACA,kBACA;YACE,qDAAqD;YACrD,oBAAoB;gBAAC,gBAAgB,CAAC,mBAAmB;gBAAE,SAAS,CAAC,mBAAmB;aAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;QACjH;IAEJ;AACF","sources":["packages/@react-aria/table/src/useTable.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {GridAria, GridProps, useGrid} from '@react-aria/grid';\nimport {gridIds} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key, LayoutDelegate, Rect, Size} from '@react-types/shared';\nimport {mergeProps, useDescription, useId, useUpdateEffect} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {TableKeyboardDelegate} from './TableKeyboardDelegate';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableProps extends GridProps {\n /** The layout object for the table. Computes what content is visible and how to position and style them. */\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout\n}\n\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table component.\n * A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys,\n * and optionally supports row selection and sorting.\n * @param props - Props for the table.\n * @param state - State for the table, as returned by `useTableState`.\n * @param ref - The ref attached to the table element.\n */\nexport function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGridState<T>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n keyboardDelegate,\n isVirtualized,\n layoutDelegate,\n layout\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new TableKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n layoutDelegate,\n layout\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, layoutDelegate, layout]);\n let id = useId(props.id);\n gridIds.set(state, id);\n\n let {gridProps} = useGrid({\n ...props,\n id,\n keyboardDelegate: delegate\n }, state, ref);\n\n // Override to include header rows\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;\n }\n\n if (tableNestedRows() && 'expandedKeys' in state) {\n gridProps.role = 'treegrid';\n }\n\n let {column, direction: sortDirection} = state.sortDescriptor || {};\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription = useMemo(() => {\n let columnName = state.collection.columns.find(c => c.key === column)?.textValue;\n return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {columnName}) : undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [sortDirection, column, state.collection.columns]);\n\n let descriptionProps = useDescription(sortDescription);\n\n // Only announce after initial render, tabbing to the table will tell you the initial sort info already\n useUpdateEffect(() => {\n announce(sortDescription, 'assertive', 500);\n }, [sortDescription]);\n\n return {\n gridProps: mergeProps(\n gridProps,\n descriptionProps,\n {\n // merge sort description with long press information\n 'aria-describedby': [descriptionProps['aria-describedby'], gridProps['aria-describedby']].filter(Boolean).join(' ')\n }\n )\n };\n}\n"],"names":[],"version":3,"file":"useTable.main.js.map"}
|
package/dist/useTable.mjs
CHANGED
|
@@ -32,7 +32,7 @@ function $parcel$interopDefault(a) {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
35
|
-
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate } = props;
|
|
35
|
+
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate, layout: layout } = props;
|
|
36
36
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
37
37
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
38
38
|
let collator = (0, $dDeJM$useCollator)({
|
|
@@ -48,7 +48,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
48
48
|
ref: ref,
|
|
49
49
|
direction: direction,
|
|
50
50
|
collator: collator,
|
|
51
|
-
layoutDelegate: layoutDelegate
|
|
51
|
+
layoutDelegate: layoutDelegate,
|
|
52
|
+
layout: layout
|
|
52
53
|
}), [
|
|
53
54
|
keyboardDelegate,
|
|
54
55
|
state.collection,
|
|
@@ -57,7 +58,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
57
58
|
ref,
|
|
58
59
|
direction,
|
|
59
60
|
collator,
|
|
60
|
-
layoutDelegate
|
|
61
|
+
layoutDelegate,
|
|
62
|
+
layout
|
|
61
63
|
]);
|
|
62
64
|
let id = (0, $dDeJM$useId)(props.id);
|
|
63
65
|
(0, $2140fb2337097f2d$export$552312adfd451dab).set(state, id);
|
package/dist/useTable.module.js
CHANGED
|
@@ -32,7 +32,7 @@ function $parcel$interopDefault(a) {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
35
|
-
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate } = props;
|
|
35
|
+
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layoutDelegate: layoutDelegate, layout: layout } = props;
|
|
36
36
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
37
37
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
38
38
|
let collator = (0, $dDeJM$useCollator)({
|
|
@@ -48,7 +48,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
48
48
|
ref: ref,
|
|
49
49
|
direction: direction,
|
|
50
50
|
collator: collator,
|
|
51
|
-
layoutDelegate: layoutDelegate
|
|
51
|
+
layoutDelegate: layoutDelegate,
|
|
52
|
+
layout: layout
|
|
52
53
|
}), [
|
|
53
54
|
keyboardDelegate,
|
|
54
55
|
state.collection,
|
|
@@ -57,7 +58,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
57
58
|
ref,
|
|
58
59
|
direction,
|
|
59
60
|
collator,
|
|
60
|
-
layoutDelegate
|
|
61
|
+
layoutDelegate,
|
|
62
|
+
layout
|
|
61
63
|
]);
|
|
62
64
|
let id = (0, $dDeJM$useId)(props.id);
|
|
63
65
|
(0, $2140fb2337097f2d$export$552312adfd451dab).set(state, id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AA4CM,SAAS,0CAAY,KAAqB,EAAE,KAAuC,EAAE,GAAkC;IAC5H,IAAI,oBACF,gBAAgB,iBAChB,aAAa,kBACb,cAAc,UACd,MAAM,EACP,GAAG;IAEJ,0HAA0H;IAC1H,qFAAqF;IACrF,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,gBAAgB;IAC9D,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IAAM,oBAAoB,IAAI,CAAA,GAAA,yCAAoB,EAAE;YACzE,YAAY,MAAM,UAAU;YAC5B,cAAc,MAAM,YAAY;8BAChC;iBACA;uBACA;sBACA;4BACA;oBACA;QACF,IAAI;QAAC;QAAkB,MAAM,UAAU;QAAE,MAAM,YAAY;QAAE;QAAkB;QAAK;QAAW;QAAU;QAAgB;KAAO;IAChI,IAAI,KAAK,CAAA,GAAA,YAAI,EAAE,MAAM,EAAE;IACvB,CAAA,GAAA,yCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QACxB,GAAG,KAAK;YACR;QACA,kBAAkB;IACpB,GAAG,OAAO;IAEV,kCAAkC;IAClC,IAAI,eACF,SAAS,CAAC,gBAAgB,GAAG,MAAM,UAAU,CAAC,IAAI,GAAG,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM;IAGzF,IAAI,CAAA,GAAA,sBAAc,OAAO,kBAAkB,OACzC,UAAU,IAAI,GAAG;IAGnB,IAAI,UAAC,MAAM,EAAE,WAAW,aAAa,EAAC,GAAG,MAAM,cAAc,IAAI,CAAC;IAClE,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,kBAAkB,CAAA,GAAA,cAAM,EAAE;YACX;QAAjB,IAAI,cAAa,iCAAA,MAAM,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,IAAK,EAAE,GAAG,KAAK,qBAA7C,qDAAA,+BAAsD,SAAS;QAChF,OAAO,iBAAiB,SAAS,gBAAgB,MAAM,CAAC,CAAC,EAAE,cAAc,IAAI,CAAC,EAAE;wBAAC;QAAU,KAAK;IAClG,uDAAuD;IACvD,GAAG;QAAC;QAAe;QAAQ,MAAM,UAAU,CAAC,OAAO;KAAC;IAEpD,IAAI,mBAAmB,CAAA,GAAA,qBAAa,EAAE;IAEtC,uGAAuG;IACvG,CAAA,GAAA,sBAAc,EAAE;QACd,CAAA,GAAA,eAAO,EAAE,iBAAiB,aAAa;IACzC,GAAG;QAAC;KAAgB;IAEpB,OAAO;QACL,WAAW,CAAA,GAAA,iBAAS,EAClB,WACA,kBACA;YACE,qDAAqD;YACrD,oBAAoB;gBAAC,gBAAgB,CAAC,mBAAmB;gBAAE,SAAS,CAAC,mBAAmB;aAAC,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC;QACjH;IAEJ;AACF","sources":["packages/@react-aria/table/src/useTable.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {announce} from '@react-aria/live-announcer';\nimport {GridAria, GridProps, useGrid} from '@react-aria/grid';\nimport {gridIds} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key, LayoutDelegate, Rect, Size} from '@react-types/shared';\nimport {mergeProps, useDescription, useId, useUpdateEffect} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {TableKeyboardDelegate} from './TableKeyboardDelegate';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableProps extends GridProps {\n /** The layout object for the table. Computes what content is visible and how to position and style them. */\n layoutDelegate?: LayoutDelegate,\n /** @deprecated - Use layoutDelegate instead. */\n layout?: DeprecatedLayout\n}\n\ninterface DeprecatedLayout {\n getLayoutInfo(key: Key): DeprecatedLayoutInfo,\n getContentSize(): Size,\n virtualizer: DeprecatedVirtualizer\n}\n\ninterface DeprecatedLayoutInfo {\n rect: Rect\n}\n\ninterface DeprecatedVirtualizer {\n visibleRect: Rect\n}\n\n/**\n * Provides the behavior and accessibility implementation for a table component.\n * A table displays data in rows and columns and enables a user to navigate its contents via directional navigation keys,\n * and optionally supports row selection and sorting.\n * @param props - Props for the table.\n * @param state - State for the table, as returned by `useTableState`.\n * @param ref - The ref attached to the table element.\n */\nexport function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGridState<T>, ref: RefObject<HTMLElement | null>): GridAria {\n let {\n keyboardDelegate,\n isVirtualized,\n layoutDelegate,\n layout\n } = props;\n\n // By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).\n // When virtualized, the layout object will be passed in as a prop and override this.\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {direction} = useLocale();\n let disabledBehavior = state.selectionManager.disabledBehavior;\n let delegate = useMemo(() => keyboardDelegate || new TableKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n disabledBehavior,\n ref,\n direction,\n collator,\n layoutDelegate,\n layout\n }), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, layoutDelegate, layout]);\n let id = useId(props.id);\n gridIds.set(state, id);\n\n let {gridProps} = useGrid({\n ...props,\n id,\n keyboardDelegate: delegate\n }, state, ref);\n\n // Override to include header rows\n if (isVirtualized) {\n gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;\n }\n\n if (tableNestedRows() && 'expandedKeys' in state) {\n gridProps.role = 'treegrid';\n }\n\n let {column, direction: sortDirection} = state.sortDescriptor || {};\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n let sortDescription = useMemo(() => {\n let columnName = state.collection.columns.find(c => c.key === column)?.textValue;\n return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {columnName}) : undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [sortDirection, column, state.collection.columns]);\n\n let descriptionProps = useDescription(sortDescription);\n\n // Only announce after initial render, tabbing to the table will tell you the initial sort info already\n useUpdateEffect(() => {\n announce(sortDescription, 'assertive', 500);\n }, [sortDescription]);\n\n return {\n gridProps: mergeProps(\n gridProps,\n descriptionProps,\n {\n // merge sort description with long press information\n 'aria-describedby': [descriptionProps['aria-describedby'], gridProps['aria-describedby']].filter(Boolean).join(' ')\n }\n )\n };\n}\n"],"names":[],"version":3,"file":"useTable.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/table",
|
|
3
|
-
"version": "3.14.2-nightly.
|
|
3
|
+
"version": "3.14.2-nightly.4691+fabca84b9",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/grid": "3.9.2-nightly.
|
|
27
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
29
|
-
"@react-aria/live-announcer": "3.0.0-nightly.
|
|
30
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
31
|
-
"@react-aria/visually-hidden": "3.0.0-nightly.
|
|
32
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
33
|
-
"@react-stately/flags": "3.0.4-nightly.
|
|
34
|
-
"@react-stately/table": "3.11.9-nightly.
|
|
35
|
-
"@react-types/checkbox": "3.0.0-nightly.
|
|
36
|
-
"@react-types/grid": "3.2.7-nightly.
|
|
37
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
38
|
-
"@react-types/table": "3.9.6-nightly.
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.2979+fabca84b9",
|
|
26
|
+
"@react-aria/grid": "3.9.2-nightly.4691+fabca84b9",
|
|
27
|
+
"@react-aria/i18n": "3.0.0-nightly.2979+fabca84b9",
|
|
28
|
+
"@react-aria/interactions": "3.0.0-nightly.2979+fabca84b9",
|
|
29
|
+
"@react-aria/live-announcer": "3.0.0-nightly.2979+fabca84b9",
|
|
30
|
+
"@react-aria/utils": "3.0.0-nightly.2979+fabca84b9",
|
|
31
|
+
"@react-aria/visually-hidden": "3.0.0-nightly.2979+fabca84b9",
|
|
32
|
+
"@react-stately/collections": "3.0.0-nightly.2979+fabca84b9",
|
|
33
|
+
"@react-stately/flags": "3.0.4-nightly.4691+fabca84b9",
|
|
34
|
+
"@react-stately/table": "3.11.9-nightly.4691+fabca84b9",
|
|
35
|
+
"@react-types/checkbox": "3.0.0-nightly.2979+fabca84b9",
|
|
36
|
+
"@react-types/grid": "3.2.7-nightly.4691+fabca84b9",
|
|
37
|
+
"@react-types/shared": "3.0.0-nightly.2979+fabca84b9",
|
|
38
|
+
"@react-types/table": "3.9.6-nightly.4691+fabca84b9",
|
|
39
39
|
"@swc/helpers": "^0.5.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "fabca84b95c9c61f9062d5f1e66ebe2c920a2a5d"
|
|
49
49
|
}
|
package/src/useTable.ts
CHANGED
|
@@ -15,7 +15,7 @@ import {GridAria, GridProps, useGrid} from '@react-aria/grid';
|
|
|
15
15
|
import {gridIds} from './utils';
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
import intlMessages from '../intl/*.json';
|
|
18
|
-
import {LayoutDelegate} from '@react-types/shared';
|
|
18
|
+
import {Key, LayoutDelegate, Rect, Size} from '@react-types/shared';
|
|
19
19
|
import {mergeProps, useDescription, useId, useUpdateEffect} from '@react-aria/utils';
|
|
20
20
|
import {RefObject, useMemo} from 'react';
|
|
21
21
|
import {TableKeyboardDelegate} from './TableKeyboardDelegate';
|
|
@@ -25,7 +25,23 @@ import {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i
|
|
|
25
25
|
|
|
26
26
|
export interface AriaTableProps extends GridProps {
|
|
27
27
|
/** The layout object for the table. Computes what content is visible and how to position and style them. */
|
|
28
|
-
layoutDelegate?: LayoutDelegate
|
|
28
|
+
layoutDelegate?: LayoutDelegate,
|
|
29
|
+
/** @deprecated - Use layoutDelegate instead. */
|
|
30
|
+
layout?: DeprecatedLayout
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DeprecatedLayout {
|
|
34
|
+
getLayoutInfo(key: Key): DeprecatedLayoutInfo,
|
|
35
|
+
getContentSize(): Size,
|
|
36
|
+
virtualizer: DeprecatedVirtualizer
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface DeprecatedLayoutInfo {
|
|
40
|
+
rect: Rect
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface DeprecatedVirtualizer {
|
|
44
|
+
visibleRect: Rect
|
|
29
45
|
}
|
|
30
46
|
|
|
31
47
|
/**
|
|
@@ -40,7 +56,8 @@ export function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGr
|
|
|
40
56
|
let {
|
|
41
57
|
keyboardDelegate,
|
|
42
58
|
isVirtualized,
|
|
43
|
-
layoutDelegate
|
|
59
|
+
layoutDelegate,
|
|
60
|
+
layout
|
|
44
61
|
} = props;
|
|
45
62
|
|
|
46
63
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
@@ -55,8 +72,9 @@ export function useTable<T>(props: AriaTableProps, state: TableState<T> | TreeGr
|
|
|
55
72
|
ref,
|
|
56
73
|
direction,
|
|
57
74
|
collator,
|
|
58
|
-
layoutDelegate
|
|
59
|
-
|
|
75
|
+
layoutDelegate,
|
|
76
|
+
layout
|
|
77
|
+
}), [keyboardDelegate, state.collection, state.disabledKeys, disabledBehavior, ref, direction, collator, layoutDelegate, layout]);
|
|
60
78
|
let id = useId(props.id);
|
|
61
79
|
gridIds.set(state, id);
|
|
62
80
|
|