@react-aria/table 3.13.6-nightly.4555 → 3.13.6-nightly.4558
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/TableKeyboardDelegate.main.js +132 -0
- package/dist/TableKeyboardDelegate.main.js.map +1 -0
- package/dist/TableKeyboardDelegate.mjs +127 -0
- package/dist/TableKeyboardDelegate.module.js +127 -0
- package/dist/TableKeyboardDelegate.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +8 -779
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +15 -786
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -779
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useTable.main.js +111 -0
- package/dist/useTable.main.js.map +1 -0
- package/dist/useTable.mjs +106 -0
- package/dist/useTable.module.js +106 -0
- package/dist/useTable.module.js.map +1 -0
- package/dist/useTableCell.main.js +36 -0
- package/dist/useTableCell.main.js.map +1 -0
- package/dist/useTableCell.mjs +31 -0
- package/dist/useTableCell.module.js +31 -0
- package/dist/useTableCell.module.js.map +1 -0
- package/dist/useTableColumnHeader.main.js +93 -0
- package/dist/useTableColumnHeader.main.js.map +1 -0
- package/dist/useTableColumnHeader.mjs +88 -0
- package/dist/useTableColumnHeader.module.js +88 -0
- package/dist/useTableColumnHeader.module.js.map +1 -0
- package/dist/useTableColumnResize.main.js +216 -0
- package/dist/useTableColumnResize.main.js.map +1 -0
- package/dist/useTableColumnResize.mjs +211 -0
- package/dist/useTableColumnResize.module.js +211 -0
- package/dist/useTableColumnResize.module.js.map +1 -0
- package/dist/useTableHeaderRow.main.js +32 -0
- package/dist/useTableHeaderRow.main.js.map +1 -0
- package/dist/useTableHeaderRow.mjs +27 -0
- package/dist/useTableHeaderRow.module.js +27 -0
- package/dist/useTableHeaderRow.module.js.map +1 -0
- package/dist/useTableRow.main.js +80 -0
- package/dist/useTableRow.main.js.map +1 -0
- package/dist/useTableRow.mjs +75 -0
- package/dist/useTableRow.module.js +75 -0
- package/dist/useTableRow.module.js.map +1 -0
- package/dist/useTableSelectionCheckbox.main.js +56 -0
- package/dist/useTableSelectionCheckbox.main.js.map +1 -0
- package/dist/useTableSelectionCheckbox.mjs +50 -0
- package/dist/useTableSelectionCheckbox.module.js +50 -0
- package/dist/useTableSelectionCheckbox.module.js.map +1 -0
- package/dist/utils.main.js +43 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +35 -0
- package/dist/utils.module.js +35 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +17 -17
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var $6acf696f746f932c$exports = require("./utils.main.js");
|
|
2
|
+
var $6RVcf$reactstatelycollections = require("@react-stately/collections");
|
|
3
|
+
var $6RVcf$reactariautils = require("@react-aria/utils");
|
|
4
|
+
var $6RVcf$reactariagrid = require("@react-aria/grid");
|
|
5
|
+
var $6RVcf$reactstatelyflags = require("@react-stately/flags");
|
|
6
|
+
var $6RVcf$reactariai18n = require("@react-aria/i18n");
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function $parcel$export(e, n, v, s) {
|
|
10
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
$parcel$export(module.exports, "useTableRow", () => $10b2115217af7c93$export$7f2f6ae19e707aa5);
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
*
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
* governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const $10b2115217af7c93$var$EXPANSION_KEYS = {
|
|
31
|
+
expand: {
|
|
32
|
+
ltr: "ArrowRight",
|
|
33
|
+
rtl: "ArrowLeft"
|
|
34
|
+
},
|
|
35
|
+
"collapse": {
|
|
36
|
+
ltr: "ArrowLeft",
|
|
37
|
+
rtl: "ArrowRight"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function $10b2115217af7c93$export$7f2f6ae19e707aa5(props, state, ref) {
|
|
41
|
+
let { node: node, isVirtualized: isVirtualized } = props;
|
|
42
|
+
let { rowProps: rowProps, ...states } = (0, $6RVcf$reactariagrid.useGridRow)(props, state, ref);
|
|
43
|
+
let { direction: direction } = (0, $6RVcf$reactariai18n.useLocale)();
|
|
44
|
+
if (isVirtualized && !((0, $6RVcf$reactstatelyflags.tableNestedRows)() && "expandedKeys" in state)) rowProps["aria-rowindex"] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
|
|
45
|
+
else delete rowProps["aria-rowindex"];
|
|
46
|
+
let treeGridRowProps = {};
|
|
47
|
+
if ((0, $6RVcf$reactstatelyflags.tableNestedRows)() && "expandedKeys" in state) {
|
|
48
|
+
let treeNode = state.keyMap.get(node.key);
|
|
49
|
+
if (treeNode != null) {
|
|
50
|
+
var _treeNode_props, _treeNode_props_children, _treeNode_props1;
|
|
51
|
+
let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
|
|
52
|
+
treeGridRowProps = {
|
|
53
|
+
onKeyDown: (e)=>{
|
|
54
|
+
if (e.key === $10b2115217af7c93$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
|
|
55
|
+
state.toggleKey(treeNode.key);
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
} else if (e.key === $10b2115217af7c93$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
|
|
58
|
+
state.toggleKey(treeNode.key);
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node.key) : undefined,
|
|
63
|
+
"aria-level": treeNode.level,
|
|
64
|
+
"aria-posinset": treeNode.indexOfType + 1,
|
|
65
|
+
"aria-setsize": treeNode.level > 1 ? (0, $6RVcf$reactstatelycollections.getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $6RVcf$reactstatelycollections.getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
let linkProps = states.hasAction ? (0, $6RVcf$reactariautils.getSyntheticLinkProps)(node.props) : {};
|
|
70
|
+
return {
|
|
71
|
+
rowProps: {
|
|
72
|
+
...(0, $6RVcf$reactariautils.mergeProps)(rowProps, treeGridRowProps, linkProps),
|
|
73
|
+
"aria-labelledby": (0, $6acf696f746f932c$exports.getRowLabelledBy)(state, node.key)
|
|
74
|
+
},
|
|
75
|
+
...states
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=useTableRow.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAgC;IAC9H,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,+BAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAE1B,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,wCAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,2BAA2B;SAE5G,OAAO,QAAQ,CAAC,gBAAgB;IAGlC,IAAI,mBAAgD,CAAC;IACrD,IAAI,CAAA,GAAA,wCAAc,OAAO,kBAAkB,OAAO;QAChD,IAAI,WAAW,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG;QACxC,IAAI,YAAY,MAAM;gBACD,iBAAuC,0BAAA;YAA1D,IAAI,eAAe,EAAA,kBAAA,SAAS,KAAK,cAAd,sCAAA,gBAAgB,mBAAmB,KAAI,EAAA,mBAAA,SAAS,KAAK,cAAd,wCAAA,2BAAA,iBAAgB,QAAQ,cAAxB,+CAAA,yBAA0B,MAAM,IAAG,MAAM,eAAe;YAClH,mBAAmB;gBACjB,WAAW,CAAC;oBACV,IAAI,AAAC,EAAE,GAAG,KAAK,oCAAc,CAAC,SAAS,CAAC,UAAU,IAAK,MAAM,gBAAgB,CAAC,UAAU,KAAK,SAAS,GAAG,IAAI,gBAAgB,MAAM,YAAY,KAAK,SAAS,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG;wBAClM,MAAM,SAAS,CAAC,SAAS,GAAG;wBAC5B,EAAE,eAAe;oBACnB,OAAO,IAAI,AAAC,EAAE,GAAG,KAAK,oCAAc,CAAC,WAAW,CAAC,UAAU,IAAK,MAAM,gBAAgB,CAAC,UAAU,KAAK,SAAS,GAAG,IAAI,gBAAiB,CAAA,MAAM,YAAY,KAAK,SAAS,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,GAAG,CAAA,GAAI;wBAC5M,MAAM,SAAS,CAAC,SAAS,GAAG;wBAC5B,EAAE,eAAe;oBACnB;gBACF;gBACA,iBAAiB,eAAe,MAAM,YAAY,KAAK,SAAS,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI;gBACnG,cAAc,SAAS,KAAK;gBAC5B,iBAAiB,SAAS,WAAW,GAAG;gBACxC,gBAAgB,SAAS,KAAK,GAAG,IAC/B,AAAC,CAAA,GAAA,0CAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAA,+BAAA,SAAU,SAAS,EAAE,UAAU,EAAkB,WAAW,GAAG,IAC7F,AAAC,CAAA,GAAA,0CAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAkB,WAAW,GAAG;YACvG;QACF;IACF;IAEA,IAAI,YAAY,OAAO,SAAS,GAAG,CAAA,GAAA,2CAAoB,EAAE,KAAK,KAAK,IAAI,CAAC;IACxE,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,gCAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport {getSyntheticLinkProps, mergeProps} from '@react-aria/utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': treeNode.indexOfType + 1,\n 'aria-setsize': treeNode.level > 1 ?\n (getLastItem(state.keyMap.get(treeNode?.parentKey).childNodes) as GridNode<T>).indexOfType + 1 :\n (getLastItem(state.keyMap.get(state.collection.body.key).childNodes) as GridNode<T>).indexOfType + 1\n };\n }\n }\n\n let linkProps = states.hasAction ? getSyntheticLinkProps(node.props) : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.main.js.map"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.mjs";
|
|
2
|
+
import {getLastItem as $2K6sg$getLastItem} from "@react-stately/collections";
|
|
3
|
+
import {getSyntheticLinkProps as $2K6sg$getSyntheticLinkProps, mergeProps as $2K6sg$mergeProps} from "@react-aria/utils";
|
|
4
|
+
import {useGridRow as $2K6sg$useGridRow} from "@react-aria/grid";
|
|
5
|
+
import {tableNestedRows as $2K6sg$tableNestedRows} from "@react-stately/flags";
|
|
6
|
+
import {useLocale as $2K6sg$useLocale} from "@react-aria/i18n";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
10
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
15
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
16
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
|
+
* governing permissions and limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $b2db214c022798eb$var$EXPANSION_KEYS = {
|
|
25
|
+
expand: {
|
|
26
|
+
ltr: "ArrowRight",
|
|
27
|
+
rtl: "ArrowLeft"
|
|
28
|
+
},
|
|
29
|
+
"collapse": {
|
|
30
|
+
ltr: "ArrowLeft",
|
|
31
|
+
rtl: "ArrowRight"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
|
|
35
|
+
let { node: node, isVirtualized: isVirtualized } = props;
|
|
36
|
+
let { rowProps: rowProps, ...states } = (0, $2K6sg$useGridRow)(props, state, ref);
|
|
37
|
+
let { direction: direction } = (0, $2K6sg$useLocale)();
|
|
38
|
+
if (isVirtualized && !((0, $2K6sg$tableNestedRows)() && "expandedKeys" in state)) rowProps["aria-rowindex"] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
|
|
39
|
+
else delete rowProps["aria-rowindex"];
|
|
40
|
+
let treeGridRowProps = {};
|
|
41
|
+
if ((0, $2K6sg$tableNestedRows)() && "expandedKeys" in state) {
|
|
42
|
+
let treeNode = state.keyMap.get(node.key);
|
|
43
|
+
if (treeNode != null) {
|
|
44
|
+
var _treeNode_props, _treeNode_props_children, _treeNode_props1;
|
|
45
|
+
let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
|
|
46
|
+
treeGridRowProps = {
|
|
47
|
+
onKeyDown: (e)=>{
|
|
48
|
+
if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
|
|
49
|
+
state.toggleKey(treeNode.key);
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
} else if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
|
|
52
|
+
state.toggleKey(treeNode.key);
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node.key) : undefined,
|
|
57
|
+
"aria-level": treeNode.level,
|
|
58
|
+
"aria-posinset": treeNode.indexOfType + 1,
|
|
59
|
+
"aria-setsize": treeNode.level > 1 ? (0, $2K6sg$getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $2K6sg$getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
let linkProps = states.hasAction ? (0, $2K6sg$getSyntheticLinkProps)(node.props) : {};
|
|
64
|
+
return {
|
|
65
|
+
rowProps: {
|
|
66
|
+
...(0, $2K6sg$mergeProps)(rowProps, treeGridRowProps, linkProps),
|
|
67
|
+
"aria-labelledby": (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
|
|
68
|
+
},
|
|
69
|
+
...states
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export {$b2db214c022798eb$export$7f2f6ae19e707aa5 as useTableRow};
|
|
75
|
+
//# sourceMappingURL=useTableRow.mjs.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.module.js";
|
|
2
|
+
import {getLastItem as $2K6sg$getLastItem} from "@react-stately/collections";
|
|
3
|
+
import {getSyntheticLinkProps as $2K6sg$getSyntheticLinkProps, mergeProps as $2K6sg$mergeProps} from "@react-aria/utils";
|
|
4
|
+
import {useGridRow as $2K6sg$useGridRow} from "@react-aria/grid";
|
|
5
|
+
import {tableNestedRows as $2K6sg$tableNestedRows} from "@react-stately/flags";
|
|
6
|
+
import {useLocale as $2K6sg$useLocale} from "@react-aria/i18n";
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
10
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
15
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
16
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
|
+
* governing permissions and limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $b2db214c022798eb$var$EXPANSION_KEYS = {
|
|
25
|
+
expand: {
|
|
26
|
+
ltr: "ArrowRight",
|
|
27
|
+
rtl: "ArrowLeft"
|
|
28
|
+
},
|
|
29
|
+
"collapse": {
|
|
30
|
+
ltr: "ArrowLeft",
|
|
31
|
+
rtl: "ArrowRight"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
|
|
35
|
+
let { node: node, isVirtualized: isVirtualized } = props;
|
|
36
|
+
let { rowProps: rowProps, ...states } = (0, $2K6sg$useGridRow)(props, state, ref);
|
|
37
|
+
let { direction: direction } = (0, $2K6sg$useLocale)();
|
|
38
|
+
if (isVirtualized && !((0, $2K6sg$tableNestedRows)() && "expandedKeys" in state)) rowProps["aria-rowindex"] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
|
|
39
|
+
else delete rowProps["aria-rowindex"];
|
|
40
|
+
let treeGridRowProps = {};
|
|
41
|
+
if ((0, $2K6sg$tableNestedRows)() && "expandedKeys" in state) {
|
|
42
|
+
let treeNode = state.keyMap.get(node.key);
|
|
43
|
+
if (treeNode != null) {
|
|
44
|
+
var _treeNode_props, _treeNode_props_children, _treeNode_props1;
|
|
45
|
+
let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
|
|
46
|
+
treeGridRowProps = {
|
|
47
|
+
onKeyDown: (e)=>{
|
|
48
|
+
if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
|
|
49
|
+
state.toggleKey(treeNode.key);
|
|
50
|
+
e.stopPropagation();
|
|
51
|
+
} else if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
|
|
52
|
+
state.toggleKey(treeNode.key);
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node.key) : undefined,
|
|
57
|
+
"aria-level": treeNode.level,
|
|
58
|
+
"aria-posinset": treeNode.indexOfType + 1,
|
|
59
|
+
"aria-setsize": treeNode.level > 1 ? (0, $2K6sg$getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $2K6sg$getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
let linkProps = states.hasAction ? (0, $2K6sg$getSyntheticLinkProps)(node.props) : {};
|
|
64
|
+
return {
|
|
65
|
+
rowProps: {
|
|
66
|
+
...(0, $2K6sg$mergeProps)(rowProps, treeGridRowProps, linkProps),
|
|
67
|
+
"aria-labelledby": (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
|
|
68
|
+
},
|
|
69
|
+
...states
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export {$b2db214c022798eb$export$7f2f6ae19e707aa5 as useTableRow};
|
|
75
|
+
//# sourceMappingURL=useTableRow.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAcD,MAAM,uCAAiB;IACrB,QAAQ;QACN,KAAK;QACL,KAAK;IACP;IACA,YAAY;QACV,KAAK;QACL,KAAK;IACP;AACF;AAOO,SAAS,0CAAe,KAAsB,EAAE,KAAuC,EAAE,GAAgC;IAC9H,IAAI,QAAC,IAAI,iBAAE,aAAa,EAAC,GAAG;IAC5B,IAAI,YAAC,QAAQ,EAAE,GAAG,QAAO,GAAG,CAAA,GAAA,iBAAS,EAAwC,OAAO,OAAO;IAC3F,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAE1B,IAAI,iBAAiB,CAAE,CAAA,CAAA,GAAA,sBAAc,OAAO,kBAAkB,KAAI,GAChE,QAAQ,CAAC,gBAAgB,GAAG,KAAK,KAAK,GAAG,IAAI,MAAM,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,2BAA2B;SAE5G,OAAO,QAAQ,CAAC,gBAAgB;IAGlC,IAAI,mBAAgD,CAAC;IACrD,IAAI,CAAA,GAAA,sBAAc,OAAO,kBAAkB,OAAO;QAChD,IAAI,WAAW,MAAM,MAAM,CAAC,GAAG,CAAC,KAAK,GAAG;QACxC,IAAI,YAAY,MAAM;gBACD,iBAAuC,0BAAA;YAA1D,IAAI,eAAe,EAAA,kBAAA,SAAS,KAAK,cAAd,sCAAA,gBAAgB,mBAAmB,KAAI,EAAA,mBAAA,SAAS,KAAK,cAAd,wCAAA,2BAAA,iBAAgB,QAAQ,cAAxB,+CAAA,yBAA0B,MAAM,IAAG,MAAM,eAAe;YAClH,mBAAmB;gBACjB,WAAW,CAAC;oBACV,IAAI,AAAC,EAAE,GAAG,KAAK,oCAAc,CAAC,SAAS,CAAC,UAAU,IAAK,MAAM,gBAAgB,CAAC,UAAU,KAAK,SAAS,GAAG,IAAI,gBAAgB,MAAM,YAAY,KAAK,SAAS,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG;wBAClM,MAAM,SAAS,CAAC,SAAS,GAAG;wBAC5B,EAAE,eAAe;oBACnB,OAAO,IAAI,AAAC,EAAE,GAAG,KAAK,oCAAc,CAAC,WAAW,CAAC,UAAU,IAAK,MAAM,gBAAgB,CAAC,UAAU,KAAK,SAAS,GAAG,IAAI,gBAAiB,CAAA,MAAM,YAAY,KAAK,SAAS,MAAM,YAAY,CAAC,GAAG,CAAC,SAAS,GAAG,CAAA,GAAI;wBAC5M,MAAM,SAAS,CAAC,SAAS,GAAG;wBAC5B,EAAE,eAAe;oBACnB;gBACF;gBACA,iBAAiB,eAAe,MAAM,YAAY,KAAK,SAAS,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI;gBACnG,cAAc,SAAS,KAAK;gBAC5B,iBAAiB,SAAS,WAAW,GAAG;gBACxC,gBAAgB,SAAS,KAAK,GAAG,IAC/B,AAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAA,+BAAA,SAAU,SAAS,EAAE,UAAU,EAAkB,WAAW,GAAG,IAC7F,AAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,MAAM,CAAC,GAAG,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAkB,WAAW,GAAG;YACvG;QACF;IACF;IAEA,IAAI,YAAY,OAAO,SAAS,GAAG,CAAA,GAAA,4BAAoB,EAAE,KAAK,KAAK,IAAI,CAAC;IACxE,OAAO;QACL,UAAU;YACR,GAAG,CAAA,GAAA,iBAAS,EAAE,UAAU,kBAAkB,UAAU;YACpD,mBAAmB,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,GAAG;QACrD;QACA,GAAG,MAAM;IACX;AACF","sources":["packages/@react-aria/table/src/useTableRow.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 {FocusableElement} from '@react-types/shared';\nimport {getLastItem} from '@react-stately/collections';\nimport {getRowLabelledBy} from './utils';\nimport {getSyntheticLinkProps, mergeProps} from '@react-aria/utils';\nimport type {GridNode} from '@react-types/grid';\nimport {GridRowAria, GridRowProps, useGridRow} from '@react-aria/grid';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TableCollection} from '@react-types/table';\nimport {tableNestedRows} from '@react-stately/flags';\nimport {TableState, TreeGridState} from '@react-stately/table';\nimport {useLocale} from '@react-aria/i18n';\n\nconst EXPANSION_KEYS = {\n expand: {\n ltr: 'ArrowRight',\n rtl: 'ArrowLeft'\n },\n 'collapse': {\n ltr: 'ArrowLeft',\n rtl: 'ArrowRight'\n }\n};\n\n/**\n * Provides the behavior and accessibility implementation for a row in a table.\n * @param props - Props for the row.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableRow<T>(props: GridRowProps<T>, state: TableState<T> | TreeGridState<T>, ref: RefObject<FocusableElement>): GridRowAria {\n let {node, isVirtualized} = props;\n let {rowProps, ...states} = useGridRow<T, TableCollection<T>, TableState<T>>(props, state, ref);\n let {direction} = useLocale();\n\n if (isVirtualized && !(tableNestedRows() && 'expandedKeys' in state)) {\n rowProps['aria-rowindex'] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based\n } else {\n delete rowProps['aria-rowindex'];\n }\n\n let treeGridRowProps: HTMLAttributes<HTMLElement> = {};\n if (tableNestedRows() && 'expandedKeys' in state) {\n let treeNode = state.keyMap.get(node.key);\n if (treeNode != null) {\n let hasChildRows = treeNode.props?.UNSTABLE_childItems || treeNode.props?.children?.length > state.userColumnCount;\n treeGridRowProps = {\n onKeyDown: (e) => {\n if ((e.key === EXPANSION_KEYS['expand'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== 'all' && !state.expandedKeys.has(treeNode.key)) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n } else if ((e.key === EXPANSION_KEYS['collapse'][direction]) && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === 'all' || state.expandedKeys.has(treeNode.key))) {\n state.toggleKey(treeNode.key);\n e.stopPropagation();\n }\n },\n 'aria-expanded': hasChildRows ? state.expandedKeys === 'all' || state.expandedKeys.has(node.key) : undefined,\n 'aria-level': treeNode.level,\n 'aria-posinset': treeNode.indexOfType + 1,\n 'aria-setsize': treeNode.level > 1 ?\n (getLastItem(state.keyMap.get(treeNode?.parentKey).childNodes) as GridNode<T>).indexOfType + 1 :\n (getLastItem(state.keyMap.get(state.collection.body.key).childNodes) as GridNode<T>).indexOfType + 1\n };\n }\n }\n\n let linkProps = states.hasAction ? getSyntheticLinkProps(node.props) : {};\n return {\n rowProps: {\n ...mergeProps(rowProps, treeGridRowProps, linkProps),\n 'aria-labelledby': getRowLabelledBy(state, node.key)\n },\n ...states\n };\n}\n"],"names":[],"version":3,"file":"useTableRow.module.js.map"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var $6acf696f746f932c$exports = require("./utils.main.js");
|
|
2
|
+
var $7ff3f66df3873a5e$exports = require("./intlStrings.main.js");
|
|
3
|
+
var $jX14I$reactariagrid = require("@react-aria/grid");
|
|
4
|
+
var $jX14I$reactariai18n = require("@react-aria/i18n");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "useTableSelectionCheckbox", () => $0b394e4562ac57c9$export$16ea7f650bd7c1bb);
|
|
16
|
+
$parcel$export(module.exports, "useTableSelectAllCheckbox", () => $0b394e4562ac57c9$export$1003db6a7e384b99);
|
|
17
|
+
/*
|
|
18
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
+
* governing permissions and limitations under the License.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
function $0b394e4562ac57c9$export$16ea7f650bd7c1bb(props, state) {
|
|
32
|
+
let { key: key } = props;
|
|
33
|
+
const { checkboxProps: checkboxProps } = (0, $jX14I$reactariagrid.useGridSelectionCheckbox)(props, state);
|
|
34
|
+
return {
|
|
35
|
+
checkboxProps: {
|
|
36
|
+
...checkboxProps,
|
|
37
|
+
"aria-labelledby": `${checkboxProps.id} ${(0, $6acf696f746f932c$exports.getRowLabelledBy)(state, key)}`
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function $0b394e4562ac57c9$export$1003db6a7e384b99(state) {
|
|
42
|
+
let { isEmpty: isEmpty, isSelectAll: isSelectAll, selectionMode: selectionMode } = state.selectionManager;
|
|
43
|
+
const stringFormatter = (0, $jX14I$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), "@react-aria/table");
|
|
44
|
+
return {
|
|
45
|
+
checkboxProps: {
|
|
46
|
+
"aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
|
|
47
|
+
isSelected: isSelectAll,
|
|
48
|
+
isDisabled: selectionMode !== "multiple" || state.collection.size === 0,
|
|
49
|
+
isIndeterminate: !isEmpty && !isSelectAll,
|
|
50
|
+
onChange: ()=>state.selectionManager.toggleSelectAll()
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=useTableSelectionCheckbox.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,6CAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,0CAAe,EAAE,OAAO,KAAK,CAAC;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.main.js.map"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.mjs";
|
|
2
|
+
import $iIuaM$intlStringsmodulejs from "./intlStrings.mjs";
|
|
3
|
+
import {useGridSelectionCheckbox as $iIuaM$useGridSelectionCheckbox} from "@react-aria/grid";
|
|
4
|
+
import {useLocalizedStringFormatter as $iIuaM$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $2a795c53a101c542$export$16ea7f650bd7c1bb(props, state) {
|
|
25
|
+
let { key: key } = props;
|
|
26
|
+
const { checkboxProps: checkboxProps } = (0, $iIuaM$useGridSelectionCheckbox)(props, state);
|
|
27
|
+
return {
|
|
28
|
+
checkboxProps: {
|
|
29
|
+
...checkboxProps,
|
|
30
|
+
"aria-labelledby": `${checkboxProps.id} ${(0, $2140fb2337097f2d$export$85069b70317f543)(state, key)}`
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function $2a795c53a101c542$export$1003db6a7e384b99(state) {
|
|
35
|
+
let { isEmpty: isEmpty, isSelectAll: isSelectAll, selectionMode: selectionMode } = state.selectionManager;
|
|
36
|
+
const stringFormatter = (0, $iIuaM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($iIuaM$intlStringsmodulejs))), "@react-aria/table");
|
|
37
|
+
return {
|
|
38
|
+
checkboxProps: {
|
|
39
|
+
"aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
|
|
40
|
+
isSelected: isSelectAll,
|
|
41
|
+
isDisabled: selectionMode !== "multiple" || state.collection.size === 0,
|
|
42
|
+
isIndeterminate: !isEmpty && !isSelectAll,
|
|
43
|
+
onChange: ()=>state.selectionManager.toggleSelectAll()
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export {$2a795c53a101c542$export$16ea7f650bd7c1bb as useTableSelectionCheckbox, $2a795c53a101c542$export$1003db6a7e384b99 as useTableSelectAllCheckbox};
|
|
50
|
+
//# sourceMappingURL=useTableSelectionCheckbox.mjs.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {getRowLabelledBy as $2140fb2337097f2d$export$85069b70317f543} from "./utils.module.js";
|
|
2
|
+
import $iIuaM$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
|
+
import {useGridSelectionCheckbox as $iIuaM$useGridSelectionCheckbox} from "@react-aria/grid";
|
|
4
|
+
import {useLocalizedStringFormatter as $iIuaM$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
function $2a795c53a101c542$export$16ea7f650bd7c1bb(props, state) {
|
|
25
|
+
let { key: key } = props;
|
|
26
|
+
const { checkboxProps: checkboxProps } = (0, $iIuaM$useGridSelectionCheckbox)(props, state);
|
|
27
|
+
return {
|
|
28
|
+
checkboxProps: {
|
|
29
|
+
...checkboxProps,
|
|
30
|
+
"aria-labelledby": `${checkboxProps.id} ${(0, $2140fb2337097f2d$export$85069b70317f543)(state, key)}`
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function $2a795c53a101c542$export$1003db6a7e384b99(state) {
|
|
35
|
+
let { isEmpty: isEmpty, isSelectAll: isSelectAll, selectionMode: selectionMode } = state.selectionManager;
|
|
36
|
+
const stringFormatter = (0, $iIuaM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($iIuaM$intlStringsmodulejs))), "@react-aria/table");
|
|
37
|
+
return {
|
|
38
|
+
checkboxProps: {
|
|
39
|
+
"aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
|
|
40
|
+
isSelected: isSelectAll,
|
|
41
|
+
isDisabled: selectionMode !== "multiple" || state.collection.size === 0,
|
|
42
|
+
isIndeterminate: !isEmpty && !isSelectAll,
|
|
43
|
+
onChange: ()=>state.selectionManager.toggleSelectAll()
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export {$2a795c53a101c542$export$16ea7f650bd7c1bb as useTableSelectionCheckbox, $2a795c53a101c542$export$1003db6a7e384b99 as useTableSelectAllCheckbox};
|
|
50
|
+
//# sourceMappingURL=useTableSelectionCheckbox.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AA+BM,SAAS,0CAA6B,KAAsC,EAAE,KAAoB;IACvG,IAAI,OAAC,GAAG,EAAC,GAAG;IACZ,MAAM,iBAAC,aAAa,EAAC,GAAG,CAAA,GAAA,+BAAuB,EAAE,OAAO;IAExD,OAAO;QACL,eAAe;YACb,GAAG,aAAa;YAChB,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAA,GAAA,wCAAe,EAAE,OAAO,KAAK,CAAC;QAC1E;IACF;AACF;AAOO,SAAS,0CAA6B,KAAoB;IAC/D,IAAI,WAAC,OAAO,eAAE,WAAW,iBAAE,aAAa,EAAC,GAAG,MAAM,gBAAgB;IAClE,MAAM,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAElE,OAAO;QACL,eAAe;YACb,cAAc,gBAAgB,MAAM,CAAC,kBAAkB,WAAW,WAAW;YAC7E,YAAY;YACZ,YAAY,kBAAkB,cAAc,MAAM,UAAU,CAAC,IAAI,KAAK;YACtE,iBAAiB,CAAC,WAAW,CAAC;YAC9B,UAAU,IAAM,MAAM,gBAAgB,CAAC,eAAe;QACxD;IACF;AACF","sources":["packages/@react-aria/table/src/useTableSelectionCheckbox.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 {AriaCheckboxProps} from '@react-types/checkbox';\nimport {getRowLabelledBy} from './utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\nimport {useGridSelectionCheckbox} from '@react-aria/grid';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTableSelectionCheckboxProps {\n /** A unique key for the checkbox. */\n key: Key\n}\n\nexport interface TableSelectionCheckboxAria {\n /** Props for the row selection checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\nexport interface TableSelectAllCheckboxAria {\n /** Props for the select all checkbox element. */\n checkboxProps: AriaCheckboxProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a selection checkbox in a table.\n * @param props - Props for the selection checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectionCheckbox<T>(props: AriaTableSelectionCheckboxProps, state: TableState<T>): TableSelectionCheckboxAria {\n let {key} = props;\n const {checkboxProps} = useGridSelectionCheckbox(props, state);\n\n return {\n checkboxProps: {\n ...checkboxProps,\n 'aria-labelledby': `${checkboxProps.id} ${getRowLabelledBy(state, key)}`\n }\n };\n}\n\n/**\n * Provides the behavior and accessibility implementation for the select all checkbox in a table.\n * @param props - Props for the select all checkbox.\n * @param state - State of the table, as returned by `useTableState`.\n */\nexport function useTableSelectAllCheckbox<T>(state: TableState<T>): TableSelectAllCheckboxAria {\n let {isEmpty, isSelectAll, selectionMode} = state.selectionManager;\n const stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/table');\n\n return {\n checkboxProps: {\n 'aria-label': stringFormatter.format(selectionMode === 'single' ? 'select' : 'selectAll'),\n isSelected: isSelectAll,\n isDisabled: selectionMode !== 'multiple' || state.collection.size === 0,\n isIndeterminate: !isEmpty && !isSelectAll,\n onChange: () => state.selectionManager.toggleSelectAll()\n }\n };\n}\n"],"names":[],"version":3,"file":"useTableSelectionCheckbox.module.js.map"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "gridIds", () => $6acf696f746f932c$export$552312adfd451dab);
|
|
7
|
+
$parcel$export(module.exports, "getColumnHeaderId", () => $6acf696f746f932c$export$37cd4213f2ad742e);
|
|
8
|
+
$parcel$export(module.exports, "getCellId", () => $6acf696f746f932c$export$19baff3266315d44);
|
|
9
|
+
$parcel$export(module.exports, "getRowLabelledBy", () => $6acf696f746f932c$export$85069b70317f543);
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/ const $6acf696f746f932c$export$552312adfd451dab = new WeakMap();
|
|
21
|
+
function $6acf696f746f932c$var$normalizeKey(key) {
|
|
22
|
+
if (typeof key === "string") return key.replace(/\s*/g, "");
|
|
23
|
+
return "" + key;
|
|
24
|
+
}
|
|
25
|
+
function $6acf696f746f932c$export$37cd4213f2ad742e(state, columnKey) {
|
|
26
|
+
let gridId = $6acf696f746f932c$export$552312adfd451dab.get(state);
|
|
27
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
28
|
+
return `${gridId}-${$6acf696f746f932c$var$normalizeKey(columnKey)}`;
|
|
29
|
+
}
|
|
30
|
+
function $6acf696f746f932c$export$19baff3266315d44(state, rowKey, columnKey) {
|
|
31
|
+
let gridId = $6acf696f746f932c$export$552312adfd451dab.get(state);
|
|
32
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
33
|
+
return `${gridId}-${$6acf696f746f932c$var$normalizeKey(rowKey)}-${$6acf696f746f932c$var$normalizeKey(columnKey)}`;
|
|
34
|
+
}
|
|
35
|
+
function $6acf696f746f932c$export$85069b70317f543(state, rowKey) {
|
|
36
|
+
// A row is labelled by it's row headers.
|
|
37
|
+
return [
|
|
38
|
+
...state.collection.rowHeaderColumnKeys
|
|
39
|
+
].map((columnKey)=>$6acf696f746f932c$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=utils.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,WAAW,CAAC;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,WAAW,CAAC;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ const $2140fb2337097f2d$export$552312adfd451dab = new WeakMap();
|
|
12
|
+
function $2140fb2337097f2d$var$normalizeKey(key) {
|
|
13
|
+
if (typeof key === "string") return key.replace(/\s*/g, "");
|
|
14
|
+
return "" + key;
|
|
15
|
+
}
|
|
16
|
+
function $2140fb2337097f2d$export$37cd4213f2ad742e(state, columnKey) {
|
|
17
|
+
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
18
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
19
|
+
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
20
|
+
}
|
|
21
|
+
function $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey) {
|
|
22
|
+
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
23
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
24
|
+
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(rowKey)}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
25
|
+
}
|
|
26
|
+
function $2140fb2337097f2d$export$85069b70317f543(state, rowKey) {
|
|
27
|
+
// A row is labelled by it's row headers.
|
|
28
|
+
return [
|
|
29
|
+
...state.collection.rowHeaderColumnKeys
|
|
30
|
+
].map((columnKey)=>$2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$2140fb2337097f2d$export$552312adfd451dab as gridIds, $2140fb2337097f2d$export$37cd4213f2ad742e as getColumnHeaderId, $2140fb2337097f2d$export$19baff3266315d44 as getCellId, $2140fb2337097f2d$export$85069b70317f543 as getRowLabelledBy};
|
|
35
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ const $2140fb2337097f2d$export$552312adfd451dab = new WeakMap();
|
|
12
|
+
function $2140fb2337097f2d$var$normalizeKey(key) {
|
|
13
|
+
if (typeof key === "string") return key.replace(/\s*/g, "");
|
|
14
|
+
return "" + key;
|
|
15
|
+
}
|
|
16
|
+
function $2140fb2337097f2d$export$37cd4213f2ad742e(state, columnKey) {
|
|
17
|
+
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
18
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
19
|
+
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
20
|
+
}
|
|
21
|
+
function $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey) {
|
|
22
|
+
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
23
|
+
if (!gridId) throw new Error("Unknown grid");
|
|
24
|
+
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(rowKey)}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
25
|
+
}
|
|
26
|
+
function $2140fb2337097f2d$export$85069b70317f543(state, rowKey) {
|
|
27
|
+
// A row is labelled by it's row headers.
|
|
28
|
+
return [
|
|
29
|
+
...state.collection.rowHeaderColumnKeys
|
|
30
|
+
].map((columnKey)=>$2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export {$2140fb2337097f2d$export$552312adfd451dab as gridIds, $2140fb2337097f2d$export$37cd4213f2ad742e as getColumnHeaderId, $2140fb2337097f2d$export$19baff3266315d44 as getCellId, $2140fb2337097f2d$export$85069b70317f543 as getRowLabelledBy};
|
|
35
|
+
//# sourceMappingURL=utils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAE3B,SAAS,mCAAa,GAAQ;IAC5B,IAAI,OAAO,QAAQ,UACjB,OAAO,IAAI,OAAO,CAAC,QAAQ;IAG7B,OAAO,KAAK;AACd;AAEO,SAAS,0CAAqB,KAAoB,EAAE,SAAc;IACvE,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,WAAW,CAAC;AAC/C;AAEO,SAAS,0CAAa,KAAoB,EAAE,MAAW,EAAE,SAAc;IAC5E,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,CAAC,QACH,MAAM,IAAI,MAAM;IAGlB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,mCAAa,QAAQ,CAAC,EAAE,mCAAa,WAAW,CAAC;AACvE;AAEO,SAAS,yCAAoB,KAAoB,EAAE,MAAW;IACnE,yCAAyC;IACzC,OAAO;WAAI,MAAM,UAAU,CAAC,mBAAmB;KAAC,CAAC,GAAG,CAAC,CAAA,YACnD,0CAAU,OAAO,QAAQ,YACzB,IAAI,CAAC;AACT","sources":["packages/@react-aria/table/src/utils.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 {Key} from '@react-types/shared';\nimport {TableState} from '@react-stately/table';\n\nexport const gridIds = new WeakMap<TableState<unknown>, string>();\n\nfunction normalizeKey(key: Key): string {\n if (typeof key === 'string') {\n return key.replace(/\\s*/g, '');\n }\n\n return '' + key;\n}\n\nexport function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(columnKey)}`;\n}\n\nexport function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key) {\n let gridId = gridIds.get(state);\n if (!gridId) {\n throw new Error('Unknown grid');\n }\n\n return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;\n}\n\nexport function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {\n // A row is labelled by it's row headers.\n return [...state.collection.rowHeaderColumnKeys].map(columnKey =>\n getCellId(state, rowKey, columnKey)\n ).join(' ');\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/dist/zh-CN.mjs
CHANGED
package/dist/zh-TW.mjs
CHANGED