@react-spectrum/table 3.17.10 → 3.18.0
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/import.mjs +2 -6
- package/dist/main.js +8 -12
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -6
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +14 -52
- package/src/index.ts +3 -18
- package/dist/DragPreview.main.js +0 -54
- package/dist/DragPreview.main.js.map +0 -1
- package/dist/DragPreview.mjs +0 -49
- package/dist/DragPreview.module.js +0 -49
- package/dist/DragPreview.module.js.map +0 -1
- package/dist/InsertionIndicator.main.js +0 -64
- package/dist/InsertionIndicator.main.js.map +0 -1
- package/dist/InsertionIndicator.mjs +0 -59
- package/dist/InsertionIndicator.module.js +0 -59
- package/dist/InsertionIndicator.module.js.map +0 -1
- package/dist/Nubbin.main.js +0 -62
- package/dist/Nubbin.main.js.map +0 -1
- package/dist/Nubbin.mjs +0 -53
- package/dist/Nubbin.module.js +0 -53
- package/dist/Nubbin.module.js.map +0 -1
- package/dist/Resizer.main.js +0 -150
- package/dist/Resizer.main.js.map +0 -1
- package/dist/Resizer.mjs +0 -144
- package/dist/Resizer.module.js +0 -144
- package/dist/Resizer.module.js.map +0 -1
- package/dist/RootDropIndicator.main.js +0 -57
- package/dist/RootDropIndicator.main.js.map +0 -1
- package/dist/RootDropIndicator.mjs +0 -48
- package/dist/RootDropIndicator.module.js +0 -48
- package/dist/RootDropIndicator.module.js.map +0 -1
- package/dist/TableView.main.js +0 -49
- package/dist/TableView.main.js.map +0 -1
- package/dist/TableView.mjs +0 -40
- package/dist/TableView.module.js +0 -40
- package/dist/TableView.module.js.map +0 -1
- package/dist/TableViewBase.main.js +0 -1239
- package/dist/TableViewBase.main.js.map +0 -1
- package/dist/TableViewBase.mjs +0 -1232
- package/dist/TableViewBase.module.js +0 -1232
- package/dist/TableViewBase.module.js.map +0 -1
- package/dist/TableViewLayout.main.js +0 -101
- package/dist/TableViewLayout.main.js.map +0 -1
- package/dist/TableViewLayout.mjs +0 -96
- package/dist/TableViewLayout.module.js +0 -96
- package/dist/TableViewLayout.module.js.map +0 -1
- package/dist/TableViewWrapper.main.js +0 -45
- package/dist/TableViewWrapper.main.js.map +0 -1
- package/dist/TableViewWrapper.mjs +0 -36
- package/dist/TableViewWrapper.module.js +0 -36
- package/dist/TableViewWrapper.module.js.map +0 -1
- package/dist/TreeGridTableView.main.js +0 -49
- package/dist/TreeGridTableView.main.js.map +0 -1
- package/dist/TreeGridTableView.mjs +0 -40
- package/dist/TreeGridTableView.module.js +0 -40
- package/dist/TreeGridTableView.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -14
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -16
- package/dist/ar-AE.module.js +0 -16
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -14
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -16
- package/dist/bg-BG.module.js +0 -16
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -14
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -16
- package/dist/cs-CZ.module.js +0 -16
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -14
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -16
- package/dist/da-DK.module.js +0 -16
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -14
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -16
- package/dist/de-DE.module.js +0 -16
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -14
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -16
- package/dist/el-GR.module.js +0 -16
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -14
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -16
- package/dist/en-US.module.js +0 -16
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -14
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -16
- package/dist/es-ES.module.js +0 -16
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -14
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -16
- package/dist/et-EE.module.js +0 -16
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -14
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -16
- package/dist/fi-FI.module.js +0 -16
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -14
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -16
- package/dist/fr-FR.module.js +0 -16
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -14
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -16
- package/dist/he-IL.module.js +0 -16
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -14
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -16
- package/dist/hr-HR.module.js +0 -16
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -14
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -16
- package/dist/hu-HU.module.js +0 -16
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -14
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -16
- package/dist/it-IT.module.js +0 -16
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -14
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -16
- package/dist/ja-JP.module.js +0 -16
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -14
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -16
- package/dist/ko-KR.module.js +0 -16
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -14
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -16
- package/dist/lt-LT.module.js +0 -16
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -14
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -16
- package/dist/lv-LV.module.js +0 -16
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -14
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -16
- package/dist/nb-NO.module.js +0 -16
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -14
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -16
- package/dist/nl-NL.module.js +0 -16
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -14
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -16
- package/dist/pl-PL.module.js +0 -16
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -14
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -16
- package/dist/pt-BR.module.js +0 -16
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -14
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -16
- package/dist/pt-PT.module.js +0 -16
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -14
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -16
- package/dist/ro-RO.module.js +0 -16
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -14
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -16
- package/dist/ru-RU.module.js +0 -16
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -14
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -16
- package/dist/sk-SK.module.js +0 -16
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -14
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -16
- package/dist/sl-SI.module.js +0 -16
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -14
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -16
- package/dist/sr-SP.module.js +0 -16
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -14
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -16
- package/dist/sv-SE.module.js +0 -16
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/table.0cdc494a.css +0 -992
- package/dist/table.0cdc494a.css.map +0 -1
- package/dist/table.11fc8462.css +0 -220
- package/dist/table.11fc8462.css.map +0 -1
- package/dist/table_css.main.js +0 -74
- package/dist/table_css.main.js.map +0 -1
- package/dist/table_css.mjs +0 -76
- package/dist/table_css.module.js +0 -76
- package/dist/table_css.module.js.map +0 -1
- package/dist/table_vars_css.main.js +0 -197
- package/dist/table_vars_css.main.js.map +0 -1
- package/dist/table_vars_css.mjs +0 -199
- package/dist/table_vars_css.module.js +0 -199
- package/dist/table_vars_css.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -14
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -16
- package/dist/tr-TR.module.js +0 -16
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -85
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -14
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -16
- package/dist/uk-UA.module.js +0 -16
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -14
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -16
- package/dist/zh-CN.module.js +0 -16
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -14
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -16
- package/dist/zh-TW.module.js +0 -16
- package/dist/zh-TW.module.js.map +0 -1
- package/src/DragPreview.tsx +0 -77
- package/src/InsertionIndicator.tsx +0 -62
- package/src/Nubbin.tsx +0 -28
- package/src/Resizer.tsx +0 -137
- package/src/RootDropIndicator.tsx +0 -40
- package/src/TableView.tsx +0 -44
- package/src/TableViewBase.tsx +0 -1569
- package/src/TableViewLayout.ts +0 -102
- package/src/TableViewWrapper.tsx +0 -103
- package/src/TreeGridTableView.tsx +0 -44
- package/src/cursors/Cur_MoveHorizontal_9_9.svg +0 -10
- package/src/cursors/Cur_MoveToLeft_9_9.svg +0 -10
- package/src/cursors/Cur_MoveToRight_9_9.svg +0 -10
- package/src/table.css +0 -235
|
@@ -1,1232 +0,0 @@
|
|
|
1
|
-
import {InsertionIndicator as $7ee9a922ee4e8032$export$2c0bab5914a9d088} from "./InsertionIndicator.module.js";
|
|
2
|
-
import $7lS7h$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
|
-
import {Nubbin as $cb7d341e8868d81d$export$d9658cdf8c86807} from "./Nubbin.module.js";
|
|
4
|
-
import {Resizer as $fc695d2eafc2b351$export$48a76196cafe3b93, ResizeStateContext as $fc695d2eafc2b351$export$b517d84d4ad20b24} from "./Resizer.module.js";
|
|
5
|
-
import {RootDropIndicator as $4e6fc36ba71ba405$export$d30a7814cfd4033e} from "./RootDropIndicator.module.js";
|
|
6
|
-
import {DragPreview as $daa6ead3d9d3506a$export$905ab40ac2179daa} from "./DragPreview.module.js";
|
|
7
|
-
import "./table.0cdc494a.css";
|
|
8
|
-
import $7lS7h$table_vars_cssmodulejs from "./table_vars_css.module.js";
|
|
9
|
-
import "./table.11fc8462.css";
|
|
10
|
-
import $7lS7h$table_cssmodulejs from "./table_css.module.js";
|
|
11
|
-
import {TableViewLayout as $5fb43af69b290859$export$725d101278f5a47b} from "./TableViewLayout.module.js";
|
|
12
|
-
import $7lS7h$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSmall";
|
|
13
|
-
import {Checkbox as $7lS7h$Checkbox} from "@react-spectrum/checkbox";
|
|
14
|
-
import $7lS7h$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
|
|
15
|
-
import $7lS7h$spectrumiconsuiChevronLeftMedium from "@spectrum-icons/ui/ChevronLeftMedium";
|
|
16
|
-
import $7lS7h$spectrumiconsuiChevronRightMedium from "@spectrum-icons/ui/ChevronRightMedium";
|
|
17
|
-
import {useStyleProps as $7lS7h$useStyleProps, useDOMRef as $7lS7h$useDOMRef, classNames as $7lS7h$classNames, useFocusableRef as $7lS7h$useFocusableRef, useUnwrapDOMRef as $7lS7h$useUnwrapDOMRef} from "@react-spectrum/utils";
|
|
18
|
-
import {useFocusRing as $7lS7h$useFocusRing, FocusScope as $7lS7h$FocusScope, FocusRing as $7lS7h$FocusRing} from "@react-aria/focus";
|
|
19
|
-
import {getInteractionModality as $7lS7h$getInteractionModality, usePress as $7lS7h$usePress, useHover as $7lS7h$useHover, isFocusVisible as $7lS7h$isFocusVisible} from "@react-aria/interactions";
|
|
20
|
-
import {mergeProps as $7lS7h$mergeProps, useLoadMore as $7lS7h$useLoadMore, nodeContains as $7lS7h$nodeContains, scrollIntoView as $7lS7h$scrollIntoView, scrollIntoViewport as $7lS7h$scrollIntoViewport, isAndroid as $7lS7h$isAndroid} from "@react-aria/utils";
|
|
21
|
-
import {MenuTrigger as $7lS7h$MenuTrigger, Menu as $7lS7h$Menu, Item as $7lS7h$Item} from "@react-spectrum/menu";
|
|
22
|
-
import {useVirtualizerState as $7lS7h$useVirtualizerState} from "@react-stately/virtualizer";
|
|
23
|
-
import {setScrollLeft as $7lS7h$setScrollLeft, ScrollView as $7lS7h$ScrollView, layoutInfoToStyle as $7lS7h$layoutInfoToStyle, VirtualizerItem as $7lS7h$VirtualizerItem} from "@react-aria/virtualizer";
|
|
24
|
-
import $7lS7h$spectrumiconsuiListGripper from "@spectrum-icons/ui/ListGripper";
|
|
25
|
-
import {ListKeyboardDelegate as $7lS7h$ListKeyboardDelegate} from "@react-aria/selection";
|
|
26
|
-
import {ProgressCircle as $7lS7h$ProgressCircle} from "@react-spectrum/progress";
|
|
27
|
-
import $7lS7h$react, {useContext as $7lS7h$useContext, useRef as $7lS7h$useRef, useEffect as $7lS7h$useEffect, useState as $7lS7h$useState, useMemo as $7lS7h$useMemo, useCallback as $7lS7h$useCallback} from "react";
|
|
28
|
-
import {useTableColumnResizeState as $7lS7h$useTableColumnResizeState} from "@react-stately/table";
|
|
29
|
-
import {TooltipTrigger as $7lS7h$TooltipTrigger, Tooltip as $7lS7h$Tooltip} from "@react-spectrum/tooltip";
|
|
30
|
-
import {useButton as $7lS7h$useButton} from "@react-aria/button";
|
|
31
|
-
import {useLocale as $7lS7h$useLocale, useLocalizedStringFormatter as $7lS7h$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
32
|
-
import {useProviderProps as $7lS7h$useProviderProps, useProvider as $7lS7h$useProvider} from "@react-spectrum/provider";
|
|
33
|
-
import {useTable as $7lS7h$useTable, useTableRowGroup as $7lS7h$useTableRowGroup, useTableColumnHeader as $7lS7h$useTableColumnHeader, useTableSelectAllCheckbox as $7lS7h$useTableSelectAllCheckbox, useTableRow as $7lS7h$useTableRow, useTableHeaderRow as $7lS7h$useTableHeaderRow, useTableCell as $7lS7h$useTableCell, useTableSelectionCheckbox as $7lS7h$useTableSelectionCheckbox} from "@react-aria/table";
|
|
34
|
-
import {VisuallyHidden as $7lS7h$VisuallyHidden, useVisuallyHidden as $7lS7h$useVisuallyHidden} from "@react-aria/visually-hidden";
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function $parcel$interopDefault(a) {
|
|
38
|
-
return a && a.__esModule ? a.default : a;
|
|
39
|
-
}
|
|
40
|
-
/*
|
|
41
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
42
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
43
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
44
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
45
|
-
*
|
|
46
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
47
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
48
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
49
|
-
* governing permissions and limitations under the License.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT = {
|
|
83
|
-
medium: 34,
|
|
84
|
-
large: 40
|
|
85
|
-
};
|
|
86
|
-
const $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH = {
|
|
87
|
-
medium: 38,
|
|
88
|
-
large: 46
|
|
89
|
-
};
|
|
90
|
-
const $bd013581c0a4b065$var$ROW_HEIGHTS = {
|
|
91
|
-
compact: {
|
|
92
|
-
medium: 32,
|
|
93
|
-
large: 40
|
|
94
|
-
},
|
|
95
|
-
regular: {
|
|
96
|
-
medium: 40,
|
|
97
|
-
large: 50
|
|
98
|
-
},
|
|
99
|
-
spacious: {
|
|
100
|
-
medium: 48,
|
|
101
|
-
large: 60
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH = {
|
|
105
|
-
medium: 38,
|
|
106
|
-
large: 48
|
|
107
|
-
};
|
|
108
|
-
const $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH = {
|
|
109
|
-
medium: 16,
|
|
110
|
-
large: 20
|
|
111
|
-
};
|
|
112
|
-
const $bd013581c0a4b065$var$LEVEL_OFFSET_WIDTH = {
|
|
113
|
-
medium: 16,
|
|
114
|
-
large: 20
|
|
115
|
-
};
|
|
116
|
-
const $bd013581c0a4b065$export$93e4b0b2cc49b648 = /*#__PURE__*/ (0, $7lS7h$react).createContext(null);
|
|
117
|
-
function $bd013581c0a4b065$export$3cb274deb6c2d854() {
|
|
118
|
-
return (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
119
|
-
}
|
|
120
|
-
const $bd013581c0a4b065$export$d288a7dd40372bc = /*#__PURE__*/ (0, $7lS7h$react).createContext(null);
|
|
121
|
-
function $bd013581c0a4b065$export$3f8f74b6bfd2c5df() {
|
|
122
|
-
return (0, $7lS7h$useContext)($bd013581c0a4b065$export$d288a7dd40372bc);
|
|
123
|
-
}
|
|
124
|
-
function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
125
|
-
var _dropState_target, _dragAndDropHooks_isVirtualDragging, _dragAndDropHooks_isVirtualDragging1;
|
|
126
|
-
props = (0, $7lS7h$useProviderProps)(props);
|
|
127
|
-
let { isQuiet: isQuiet, onAction: onAction, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, dragAndDropHooks: dragAndDropHooks, state: state } = props;
|
|
128
|
-
let isTableDraggable = !!(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.useDraggableCollectionState);
|
|
129
|
-
let isTableDroppable = !!(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.useDroppableCollectionState);
|
|
130
|
-
let dragHooksProvided = (0, $7lS7h$useRef)(isTableDraggable);
|
|
131
|
-
let dropHooksProvided = (0, $7lS7h$useRef)(isTableDroppable);
|
|
132
|
-
(0, $7lS7h$useEffect)(()=>{
|
|
133
|
-
if (process.env.NODE_ENV === 'production') return;
|
|
134
|
-
if (dragHooksProvided.current !== isTableDraggable) console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');
|
|
135
|
-
if (dropHooksProvided.current !== isTableDroppable) console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');
|
|
136
|
-
if ('expandedKeys' in state && (isTableDraggable || isTableDroppable)) console.warn('Drag and drop is not yet fully supported with expandable rows and may produce unexpected results.');
|
|
137
|
-
}, [
|
|
138
|
-
isTableDraggable,
|
|
139
|
-
isTableDroppable,
|
|
140
|
-
state
|
|
141
|
-
]);
|
|
142
|
-
let { styleProps: styleProps } = (0, $7lS7h$useStyleProps)(props);
|
|
143
|
-
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
144
|
-
// Starts when the user selects resize from the menu, ends when resizing ends
|
|
145
|
-
// used to control the visibility of the resizer Nubbin
|
|
146
|
-
let [isInResizeMode, setIsInResizeMode] = (0, $7lS7h$useState)(false);
|
|
147
|
-
// Starts when the resizer is actually moved
|
|
148
|
-
// entering resizing/exiting resizing doesn't trigger a render
|
|
149
|
-
// with table layout, so we need to track it here
|
|
150
|
-
let [, setIsResizing] = (0, $7lS7h$useState)(false);
|
|
151
|
-
let domRef = (0, $7lS7h$useDOMRef)(ref);
|
|
152
|
-
let headerRef = (0, $7lS7h$useRef)(null);
|
|
153
|
-
let bodyRef = (0, $7lS7h$useRef)(null);
|
|
154
|
-
let density = props.density || 'regular';
|
|
155
|
-
let layout = (0, $7lS7h$useMemo)(()=>new (0, $5fb43af69b290859$export$725d101278f5a47b)({
|
|
156
|
-
// If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
|
|
157
|
-
rowHeight: props.overflowMode === 'wrap' ? undefined : $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale],
|
|
158
|
-
estimatedRowHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale] : undefined,
|
|
159
|
-
headingHeight: props.overflowMode === 'wrap' ? undefined : $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale],
|
|
160
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale] : undefined
|
|
161
|
-
}), // don't recompute when state.collection changes, only used for initial value
|
|
162
|
-
[
|
|
163
|
-
props.overflowMode,
|
|
164
|
-
scale,
|
|
165
|
-
density
|
|
166
|
-
]);
|
|
167
|
-
let dragState = null;
|
|
168
|
-
let preview = (0, $7lS7h$useRef)(null);
|
|
169
|
-
if (isTableDraggable && dragAndDropHooks) {
|
|
170
|
-
dragState = dragAndDropHooks.useDraggableCollectionState({
|
|
171
|
-
collection: state.collection,
|
|
172
|
-
selectionManager: state.selectionManager,
|
|
173
|
-
preview: preview
|
|
174
|
-
});
|
|
175
|
-
dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
|
|
176
|
-
}
|
|
177
|
-
let DragPreview = dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.DragPreview;
|
|
178
|
-
let dropState = null;
|
|
179
|
-
let droppableCollection = null;
|
|
180
|
-
let isRootDropTarget = false;
|
|
181
|
-
if (isTableDroppable && dragAndDropHooks) {
|
|
182
|
-
dropState = dragAndDropHooks.useDroppableCollectionState({
|
|
183
|
-
collection: state.collection,
|
|
184
|
-
selectionManager: state.selectionManager
|
|
185
|
-
});
|
|
186
|
-
droppableCollection = dragAndDropHooks.useDroppableCollection({
|
|
187
|
-
keyboardDelegate: new (0, $7lS7h$ListKeyboardDelegate)({
|
|
188
|
-
collection: state.collection,
|
|
189
|
-
disabledKeys: state.selectionManager.disabledKeys,
|
|
190
|
-
ref: domRef,
|
|
191
|
-
layoutDelegate: layout
|
|
192
|
-
}),
|
|
193
|
-
dropTargetDelegate: layout
|
|
194
|
-
}, dropState, domRef);
|
|
195
|
-
isRootDropTarget = dropState.isDropTarget({
|
|
196
|
-
type: 'root'
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
let { gridProps: gridProps } = (0, $7lS7h$useTable)({
|
|
200
|
-
...props,
|
|
201
|
-
isVirtualized: true,
|
|
202
|
-
layoutDelegate: layout,
|
|
203
|
-
onRowAction: onAction,
|
|
204
|
-
scrollRef: bodyRef
|
|
205
|
-
}, state, domRef);
|
|
206
|
-
let [headerMenuOpen, setHeaderMenuOpen] = (0, $7lS7h$useState)(false);
|
|
207
|
-
let [headerRowHovered, setHeaderRowHovered] = (0, $7lS7h$useState)(false);
|
|
208
|
-
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
|
209
|
-
let renderWrapper = (0, $7lS7h$useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
210
|
-
var _parent_layoutInfo;
|
|
211
|
-
if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowGroup, {
|
|
212
|
-
key: reusableView.key,
|
|
213
|
-
layoutInfo: reusableView.layoutInfo,
|
|
214
|
-
parent: (_parent_layoutInfo = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo !== void 0 ? _parent_layoutInfo : null,
|
|
215
|
-
// Override the default role="rowgroup" with role="presentation",
|
|
216
|
-
// in favor or adding role="rowgroup" to the ScrollView with
|
|
217
|
-
// ref={bodyRef} in the TableVirtualizer below.
|
|
218
|
-
role: "presentation"
|
|
219
|
-
}, renderChildren(children));
|
|
220
|
-
var _parent_layoutInfo1;
|
|
221
|
-
if (reusableView.viewType === 'header') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeader, {
|
|
222
|
-
key: reusableView.key,
|
|
223
|
-
layoutInfo: reusableView.layoutInfo,
|
|
224
|
-
parent: (_parent_layoutInfo1 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo1 !== void 0 ? _parent_layoutInfo1 : null
|
|
225
|
-
}, renderChildren(children));
|
|
226
|
-
var _parent_layoutInfo2;
|
|
227
|
-
if (reusableView.viewType === 'row') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRow, {
|
|
228
|
-
key: reusableView.key,
|
|
229
|
-
item: reusableView.content,
|
|
230
|
-
layoutInfo: reusableView.layoutInfo,
|
|
231
|
-
parent: (_parent_layoutInfo2 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo2 !== void 0 ? _parent_layoutInfo2 : null
|
|
232
|
-
}, renderChildren(children));
|
|
233
|
-
var _parent_layoutInfo3;
|
|
234
|
-
if (reusableView.viewType === 'headerrow') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeaderRow, {
|
|
235
|
-
onHoverChange: setHeaderRowHovered,
|
|
236
|
-
key: reusableView.key,
|
|
237
|
-
layoutInfo: reusableView.layoutInfo,
|
|
238
|
-
parent: (_parent_layoutInfo3 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo3 !== void 0 ? _parent_layoutInfo3 : null,
|
|
239
|
-
item: reusableView.content
|
|
240
|
-
}, renderChildren(children));
|
|
241
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableCellWrapper, {
|
|
242
|
-
key: reusableView.key,
|
|
243
|
-
layoutInfo: reusableView.layoutInfo,
|
|
244
|
-
virtualizer: reusableView.virtualizer,
|
|
245
|
-
parent: parent
|
|
246
|
-
}, reusableView.rendered);
|
|
247
|
-
}, []);
|
|
248
|
-
let renderView = (0, $7lS7h$useCallback)((type, item)=>{
|
|
249
|
-
switch(type){
|
|
250
|
-
case 'header':
|
|
251
|
-
case 'rowgroup':
|
|
252
|
-
case 'section':
|
|
253
|
-
case 'row':
|
|
254
|
-
case 'headerrow':
|
|
255
|
-
return null;
|
|
256
|
-
case 'cell':
|
|
257
|
-
if (item.props.isSelectionCell) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableCheckboxCell, {
|
|
258
|
-
cell: item
|
|
259
|
-
});
|
|
260
|
-
if (item.props.isDragButtonCell) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableDragCell, {
|
|
261
|
-
cell: item
|
|
262
|
-
});
|
|
263
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableCell, {
|
|
264
|
-
cell: item
|
|
265
|
-
});
|
|
266
|
-
case 'placeholder':
|
|
267
|
-
// TODO: move to react-aria?
|
|
268
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
269
|
-
role: "gridcell",
|
|
270
|
-
"aria-colindex": item.index + 1,
|
|
271
|
-
"aria-colspan": item.colSpan != null && item.colSpan > 1 ? item.colSpan : undefined
|
|
272
|
-
});
|
|
273
|
-
case 'column':
|
|
274
|
-
if (item.props.isSelectionCell) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableSelectAllCell, {
|
|
275
|
-
column: item
|
|
276
|
-
});
|
|
277
|
-
if (item.props.isDragButtonCell) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableDragHeaderCell, {
|
|
278
|
-
column: item
|
|
279
|
-
});
|
|
280
|
-
// TODO: consider this case, what if we have hidden headers and a empty table
|
|
281
|
-
if (item.props.hideHeader) return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$TooltipTrigger), {
|
|
282
|
-
placement: "top",
|
|
283
|
-
trigger: "focus"
|
|
284
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableColumnHeader, {
|
|
285
|
-
column: item
|
|
286
|
-
}), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$Tooltip), {
|
|
287
|
-
placement: "top"
|
|
288
|
-
}, item.rendered));
|
|
289
|
-
if (item.props.allowsResizing && !item.hasChildNodes) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$ResizableTableColumnHeader, {
|
|
290
|
-
column: item
|
|
291
|
-
});
|
|
292
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableColumnHeader, {
|
|
293
|
-
column: item
|
|
294
|
-
});
|
|
295
|
-
case 'loader':
|
|
296
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$LoadingState, null);
|
|
297
|
-
case 'empty':
|
|
298
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$EmptyState, null);
|
|
299
|
-
}
|
|
300
|
-
return null;
|
|
301
|
-
}, []);
|
|
302
|
-
let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = (0, $7lS7h$useState)(false);
|
|
303
|
-
let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = (0, $7lS7h$useState)(false);
|
|
304
|
-
let viewport = (0, $7lS7h$useRef)({
|
|
305
|
-
x: 0,
|
|
306
|
-
y: 0,
|
|
307
|
-
width: 0,
|
|
308
|
-
height: 0
|
|
309
|
-
});
|
|
310
|
-
let onVisibleRectChange = (0, $7lS7h$useCallback)((e)=>{
|
|
311
|
-
if (viewport.current.width === e.width && viewport.current.height === e.height) return;
|
|
312
|
-
viewport.current = e;
|
|
313
|
-
if (bodyRef.current) {
|
|
314
|
-
setVerticalScollbarVisible(bodyRef.current.clientWidth + 2 < bodyRef.current.offsetWidth);
|
|
315
|
-
setHorizontalScollbarVisible(bodyRef.current.clientHeight + 2 < bodyRef.current.offsetHeight);
|
|
316
|
-
}
|
|
317
|
-
}, []);
|
|
318
|
-
let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7lS7h$useFocusRing)();
|
|
319
|
-
let isEmpty = state.collection.size === 0;
|
|
320
|
-
let onFocusedResizer = ()=>{
|
|
321
|
-
if (bodyRef.current && headerRef.current) bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
322
|
-
};
|
|
323
|
-
let onResizeStart = (0, $7lS7h$useCallback)((widths)=>{
|
|
324
|
-
setIsResizing(true);
|
|
325
|
-
propsOnResizeStart === null || propsOnResizeStart === void 0 ? void 0 : propsOnResizeStart(widths);
|
|
326
|
-
}, [
|
|
327
|
-
setIsResizing,
|
|
328
|
-
propsOnResizeStart
|
|
329
|
-
]);
|
|
330
|
-
let onResizeEnd = (0, $7lS7h$useCallback)((widths)=>{
|
|
331
|
-
setIsInResizeMode(false);
|
|
332
|
-
setIsResizing(false);
|
|
333
|
-
propsOnResizeEnd === null || propsOnResizeEnd === void 0 ? void 0 : propsOnResizeEnd(widths);
|
|
334
|
-
}, [
|
|
335
|
-
propsOnResizeEnd,
|
|
336
|
-
setIsInResizeMode,
|
|
337
|
-
setIsResizing
|
|
338
|
-
]);
|
|
339
|
-
let focusedKey = state.selectionManager.focusedKey;
|
|
340
|
-
let dropTargetKey = null;
|
|
341
|
-
if ((dropState === null || dropState === void 0 ? void 0 : (_dropState_target = dropState.target) === null || _dropState_target === void 0 ? void 0 : _dropState_target.type) === 'item') {
|
|
342
|
-
dropTargetKey = dropState.target.key;
|
|
343
|
-
if (dropState.target.dropPosition === 'before' && dropTargetKey !== state.collection.getFirstKey()) // Normalize to the "after" drop position since we only render those in the DOM.
|
|
344
|
-
// The exception to this is for the first row in the table, where we also render the "before" position.
|
|
345
|
-
dropTargetKey = state.collection.getKeyBefore(dropTargetKey);
|
|
346
|
-
}
|
|
347
|
-
let persistedKeys = (0, $7lS7h$useMemo)(()=>{
|
|
348
|
-
return new Set([
|
|
349
|
-
focusedKey,
|
|
350
|
-
dropTargetKey
|
|
351
|
-
].filter((k)=>k !== null));
|
|
352
|
-
}, [
|
|
353
|
-
focusedKey,
|
|
354
|
-
dropTargetKey
|
|
355
|
-
]);
|
|
356
|
-
let mergedProps = (0, $7lS7h$mergeProps)(isTableDroppable ? droppableCollection === null || droppableCollection === void 0 ? void 0 : droppableCollection.collectionProps : null, gridProps, focusProps);
|
|
357
|
-
if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
|
|
358
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$93e4b0b2cc49b648.Provider, {
|
|
359
|
-
value: {
|
|
360
|
-
state: state,
|
|
361
|
-
dragState: dragState,
|
|
362
|
-
dropState: dropState,
|
|
363
|
-
dragAndDropHooks: dragAndDropHooks,
|
|
364
|
-
isTableDraggable: isTableDraggable,
|
|
365
|
-
isTableDroppable: isTableDroppable,
|
|
366
|
-
layout: layout,
|
|
367
|
-
onResizeStart: onResizeStart,
|
|
368
|
-
onResize: props.onResize,
|
|
369
|
-
onResizeEnd: onResizeEnd,
|
|
370
|
-
headerRowHovered: headerRowHovered,
|
|
371
|
-
isInResizeMode: isInResizeMode,
|
|
372
|
-
setIsInResizeMode: setIsInResizeMode,
|
|
373
|
-
isEmpty: isEmpty,
|
|
374
|
-
onFocusedResizer: onFocusedResizer,
|
|
375
|
-
headerMenuOpen: headerMenuOpen,
|
|
376
|
-
setHeaderMenuOpen: setHeaderMenuOpen,
|
|
377
|
-
renderEmptyState: props.renderEmptyState
|
|
378
|
-
}
|
|
379
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableVirtualizer, {
|
|
380
|
-
...mergedProps,
|
|
381
|
-
...styleProps,
|
|
382
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table', `spectrum-Table--${density}`, {
|
|
383
|
-
'spectrum-Table--quiet': isQuiet,
|
|
384
|
-
'spectrum-Table--wrap': props.overflowMode === 'wrap',
|
|
385
|
-
'spectrum-Table--loadingMore': state.collection.body.props.loadingState === 'loadingMore',
|
|
386
|
-
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
387
|
-
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
388
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table'), styleProps.className),
|
|
389
|
-
tableState: state,
|
|
390
|
-
layout: layout,
|
|
391
|
-
collection: state.collection,
|
|
392
|
-
persistedKeys: persistedKeys,
|
|
393
|
-
renderView: renderView,
|
|
394
|
-
renderWrapper: renderWrapper,
|
|
395
|
-
onVisibleRectChange: onVisibleRectChange,
|
|
396
|
-
domRef: domRef,
|
|
397
|
-
headerRef: headerRef,
|
|
398
|
-
bodyRef: bodyRef,
|
|
399
|
-
isFocusVisible: isFocusVisible,
|
|
400
|
-
isVirtualDragging: (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging1 = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging1 === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging1.call(dragAndDropHooks)) || false,
|
|
401
|
-
isRootDropTarget: isRootDropTarget
|
|
402
|
-
}), DragPreview && isTableDraggable && dragAndDropHooks && dragState && /*#__PURE__*/ (0, $7lS7h$react).createElement(DragPreview, {
|
|
403
|
-
ref: preview
|
|
404
|
-
}, ()=>{
|
|
405
|
-
if (dragState.draggedKey == null) return null;
|
|
406
|
-
if (dragAndDropHooks.renderPreview) return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);
|
|
407
|
-
let itemCount = dragState.draggingKeys.size;
|
|
408
|
-
let maxWidth = bodyRef.current.getBoundingClientRect().width;
|
|
409
|
-
let height = $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale];
|
|
410
|
-
let itemText = state.collection.getTextValue(dragState.draggedKey);
|
|
411
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $daa6ead3d9d3506a$export$905ab40ac2179daa), {
|
|
412
|
-
itemText: itemText,
|
|
413
|
-
itemCount: itemCount,
|
|
414
|
-
height: height,
|
|
415
|
-
maxWidth: maxWidth
|
|
416
|
-
});
|
|
417
|
-
}));
|
|
418
|
-
}
|
|
419
|
-
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
420
|
-
function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
421
|
-
var _layout_getLayoutInfo;
|
|
422
|
-
let { tableState: tableState, layout: layout, collection: collection, persistedKeys: persistedKeys, renderView: renderView, renderWrapper: renderWrapper, domRef: domRef, bodyRef: bodyRef, headerRef: headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible: isFocusVisible, isVirtualDragging: isVirtualDragging, isRootDropTarget: isRootDropTarget, ...otherProps } = props;
|
|
423
|
-
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
424
|
-
let loadingState = collection.body.props.loadingState;
|
|
425
|
-
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
426
|
-
let onLoadMore = collection.body.props.onLoadMore;
|
|
427
|
-
let [tableWidth, setTableWidth] = (0, $7lS7h$useState)(0);
|
|
428
|
-
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
429
|
-
const getDefaultWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
430
|
-
if (hideHeader) {
|
|
431
|
-
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
432
|
-
return showDivider ? width + 1 : width;
|
|
433
|
-
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
434
|
-
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
435
|
-
}, [
|
|
436
|
-
scale
|
|
437
|
-
]);
|
|
438
|
-
const getDefaultMinWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
439
|
-
if (hideHeader) {
|
|
440
|
-
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
441
|
-
return showDivider ? width + 1 : width;
|
|
442
|
-
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
443
|
-
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
444
|
-
return 75;
|
|
445
|
-
}, [
|
|
446
|
-
scale
|
|
447
|
-
]);
|
|
448
|
-
let columnResizeState = (0, $7lS7h$useTableColumnResizeState)({
|
|
449
|
-
tableWidth: tableWidth,
|
|
450
|
-
getDefaultWidth: getDefaultWidth,
|
|
451
|
-
getDefaultMinWidth: getDefaultMinWidth
|
|
452
|
-
}, tableState);
|
|
453
|
-
let state = (0, $7lS7h$useVirtualizerState)({
|
|
454
|
-
layout: layout,
|
|
455
|
-
collection: collection,
|
|
456
|
-
renderView: renderView,
|
|
457
|
-
onVisibleRectChange (rect) {
|
|
458
|
-
if (bodyRef.current) {
|
|
459
|
-
bodyRef.current.scrollTop = rect.y;
|
|
460
|
-
(0, $7lS7h$setScrollLeft)(bodyRef.current, direction, rect.x);
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
persistedKeys: persistedKeys,
|
|
464
|
-
layoutOptions: (0, $7lS7h$useMemo)(()=>({
|
|
465
|
-
columnWidths: columnResizeState.columnWidths
|
|
466
|
-
}), [
|
|
467
|
-
columnResizeState.columnWidths
|
|
468
|
-
])
|
|
469
|
-
});
|
|
470
|
-
(0, $7lS7h$useLoadMore)({
|
|
471
|
-
isLoading: isLoading,
|
|
472
|
-
onLoadMore: onLoadMore,
|
|
473
|
-
scrollOffset: 1
|
|
474
|
-
}, bodyRef);
|
|
475
|
-
let onVisibleRectChange = (0, $7lS7h$useCallback)((rect)=>{
|
|
476
|
-
state.setVisibleRect(rect);
|
|
477
|
-
}, [
|
|
478
|
-
state
|
|
479
|
-
]);
|
|
480
|
-
let onVisibleRectChangeMemo = (0, $7lS7h$useCallback)((rect)=>{
|
|
481
|
-
setTableWidth(rect.width);
|
|
482
|
-
onVisibleRectChange(rect);
|
|
483
|
-
onVisibleRectChangeProp(rect);
|
|
484
|
-
}, [
|
|
485
|
-
onVisibleRectChange,
|
|
486
|
-
onVisibleRectChangeProp
|
|
487
|
-
]);
|
|
488
|
-
// this effect runs whenever the contentSize changes, it doesn't matter what the content size is
|
|
489
|
-
// only that it changes in a resize, and when that happens, we want to sync the body to the
|
|
490
|
-
// header scroll position
|
|
491
|
-
(0, $7lS7h$useEffect)(()=>{
|
|
492
|
-
if ((0, $7lS7h$getInteractionModality)() === 'keyboard' && headerRef.current && (0, $7lS7h$nodeContains)(headerRef.current, document.activeElement) && bodyRef.current) {
|
|
493
|
-
(0, $7lS7h$scrollIntoView)(headerRef.current, document.activeElement);
|
|
494
|
-
(0, $7lS7h$scrollIntoViewport)(document.activeElement, {
|
|
495
|
-
containingElement: domRef.current
|
|
496
|
-
});
|
|
497
|
-
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
498
|
-
}
|
|
499
|
-
}, [
|
|
500
|
-
state.contentSize,
|
|
501
|
-
headerRef,
|
|
502
|
-
bodyRef,
|
|
503
|
-
domRef
|
|
504
|
-
]);
|
|
505
|
-
let headerHeight = ((_layout_getLayoutInfo = layout.getLayoutInfo('header')) === null || _layout_getLayoutInfo === void 0 ? void 0 : _layout_getLayoutInfo.rect.height) || 0;
|
|
506
|
-
// Sync the scroll position from the table body to the header container.
|
|
507
|
-
let onScroll = (0, $7lS7h$useCallback)(()=>{
|
|
508
|
-
if (headerRef.current && bodyRef.current) headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
509
|
-
}, [
|
|
510
|
-
bodyRef,
|
|
511
|
-
headerRef
|
|
512
|
-
]);
|
|
513
|
-
let resizerPosition = columnResizeState.resizingColumn != null ? layout.getLayoutInfo(columnResizeState.resizingColumn).rect.maxX - 2 : 0;
|
|
514
|
-
let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
|
|
515
|
-
// this should be fine, every movement of the resizer causes a rerender
|
|
516
|
-
// scrolling can cause it to lag for a moment, but it's always updated
|
|
517
|
-
let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.maxX;
|
|
518
|
-
let shouldHardCornerResizeCorner = resizerAtEdge && resizerInVisibleRegion;
|
|
519
|
-
// minimize re-render caused on Resizers by memoing this
|
|
520
|
-
let resizingColumnWidth = columnResizeState.resizingColumn != null ? columnResizeState.getColumnWidth(columnResizeState.resizingColumn) : 0;
|
|
521
|
-
let resizingColumn = (0, $7lS7h$useMemo)(()=>({
|
|
522
|
-
width: resizingColumnWidth,
|
|
523
|
-
key: columnResizeState.resizingColumn
|
|
524
|
-
}), [
|
|
525
|
-
resizingColumnWidth,
|
|
526
|
-
columnResizeState.resizingColumn
|
|
527
|
-
]);
|
|
528
|
-
if (isVirtualDragging) otherProps.tabIndex = undefined;
|
|
529
|
-
let firstColumn = collection.columns[0];
|
|
530
|
-
let scrollPadding = 0;
|
|
531
|
-
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
|
|
532
|
-
let visibleViews = $bd013581c0a4b065$var$renderChildren(null, state.visibleViews, renderWrapper);
|
|
533
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$d288a7dd40372bc.Provider, {
|
|
534
|
-
value: resizingColumn
|
|
535
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusScope), null, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
536
|
-
...otherProps,
|
|
537
|
-
ref: domRef
|
|
538
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
539
|
-
role: "presentation",
|
|
540
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headWrapper'),
|
|
541
|
-
style: {
|
|
542
|
-
height: headerHeight,
|
|
543
|
-
overflow: 'hidden',
|
|
544
|
-
position: 'relative',
|
|
545
|
-
willChange: state.isScrolling ? 'scroll-position' : undefined,
|
|
546
|
-
scrollPaddingInlineStart: scrollPadding
|
|
547
|
-
},
|
|
548
|
-
ref: headerRef
|
|
549
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $fc695d2eafc2b351$export$b517d84d4ad20b24).Provider, {
|
|
550
|
-
value: columnResizeState
|
|
551
|
-
}, visibleViews[0])), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$ScrollView), {
|
|
552
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-body', {
|
|
553
|
-
'focus-ring': isFocusVisible,
|
|
554
|
-
'spectrum-Table-body--resizerAtTableEdge': shouldHardCornerResizeCorner
|
|
555
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-body', {
|
|
556
|
-
'react-spectrum-Table-body--dropTarget': !!isRootDropTarget
|
|
557
|
-
})),
|
|
558
|
-
// Firefox and Chrome make generic elements using CSS overflow 'scroll' or 'auto' tabbable,
|
|
559
|
-
// including them within the accessibility tree, which breaks the table structure in Firefox.
|
|
560
|
-
// Using tabIndex={-1} prevents the ScrollView from being tabbable, and using role="rowgroup"
|
|
561
|
-
// here and role="presentation" on the table body content fixes the table structure.
|
|
562
|
-
role: "rowgroup",
|
|
563
|
-
tabIndex: isVirtualDragging ? undefined : -1,
|
|
564
|
-
style: {
|
|
565
|
-
flex: 1,
|
|
566
|
-
scrollPaddingInlineStart: scrollPadding
|
|
567
|
-
},
|
|
568
|
-
innerStyle: {
|
|
569
|
-
overflow: 'visible'
|
|
570
|
-
},
|
|
571
|
-
ref: bodyRef,
|
|
572
|
-
contentSize: state.contentSize,
|
|
573
|
-
onVisibleRectChange: onVisibleRectChangeMemo,
|
|
574
|
-
onScrollStart: state.startScrolling,
|
|
575
|
-
onScrollEnd: state.endScrolling,
|
|
576
|
-
onScroll: onScroll
|
|
577
|
-
}, visibleViews[1], /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
578
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-bodyResizeIndicator'),
|
|
579
|
-
style: {
|
|
580
|
-
[direction === 'ltr' ? 'left' : 'right']: `${resizerPosition}px`,
|
|
581
|
-
height: `${Math.max(state.virtualizer.contentSize.height, state.virtualizer.visibleRect.height)}px`,
|
|
582
|
-
display: columnResizeState.resizingColumn ? 'block' : 'none'
|
|
583
|
-
}
|
|
584
|
-
})))));
|
|
585
|
-
}
|
|
586
|
-
function $bd013581c0a4b065$var$renderChildren(parent, views, renderWrapper) {
|
|
587
|
-
return views.map((view)=>{
|
|
588
|
-
return renderWrapper(parent, view, view.children ? Array.from(view.children) : [], (childViews)=>$bd013581c0a4b065$var$renderChildren(view, childViews, renderWrapper));
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
function $bd013581c0a4b065$var$useStyle(layoutInfo, parent) {
|
|
592
|
-
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
593
|
-
let style = (0, $7lS7h$layoutInfoToStyle)(layoutInfo, direction, parent);
|
|
594
|
-
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
595
|
-
return style;
|
|
596
|
-
}
|
|
597
|
-
function $bd013581c0a4b065$var$TableHeader({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
598
|
-
let { rowGroupProps: rowGroupProps } = (0, $7lS7h$useTableRowGroup)();
|
|
599
|
-
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
600
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
601
|
-
...rowGroupProps,
|
|
602
|
-
...otherProps,
|
|
603
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-head'),
|
|
604
|
-
style: style
|
|
605
|
-
}, children);
|
|
606
|
-
}
|
|
607
|
-
function $bd013581c0a4b065$var$TableColumnHeader(props) {
|
|
608
|
-
var _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
|
|
609
|
-
let { column: column } = props;
|
|
610
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
611
|
-
let { state: state, isEmpty: isEmpty } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
612
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
|
|
613
|
-
isDisabled: isEmpty
|
|
614
|
-
});
|
|
615
|
-
let columnProps = column.props;
|
|
616
|
-
(0, $7lS7h$useEffect)(()=>{
|
|
617
|
-
if (column.hasChildNodes && columnProps.allowsResizing && process.env.NODE_ENV !== 'production') console.warn(`Column key: ${column.key}. Columns with child columns don't allow resizing.`);
|
|
618
|
-
}, [
|
|
619
|
-
column.hasChildNodes,
|
|
620
|
-
column.key,
|
|
621
|
-
columnProps.allowsResizing
|
|
622
|
-
]);
|
|
623
|
-
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
624
|
-
node: column,
|
|
625
|
-
isVirtualized: true
|
|
626
|
-
}, state, ref);
|
|
627
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7lS7h$useHover)({
|
|
628
|
-
...props,
|
|
629
|
-
isDisabled: isEmpty
|
|
630
|
-
});
|
|
631
|
-
const allProps = [
|
|
632
|
-
columnHeaderProps,
|
|
633
|
-
hoverProps,
|
|
634
|
-
pressProps
|
|
635
|
-
];
|
|
636
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
637
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
638
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
639
|
-
...(0, $7lS7h$mergeProps)(...allProps),
|
|
640
|
-
ref: ref,
|
|
641
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCell', {
|
|
642
|
-
'is-active': isPressed,
|
|
643
|
-
'is-sortable': columnProps.allowsSorting,
|
|
644
|
-
'is-sorted-desc': ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === column.key && ((_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction) === 'descending',
|
|
645
|
-
'is-sorted-asc': ((_state_sortDescriptor2 = state.sortDescriptor) === null || _state_sortDescriptor2 === void 0 ? void 0 : _state_sortDescriptor2.column) === column.key && ((_state_sortDescriptor3 = state.sortDescriptor) === null || _state_sortDescriptor3 === void 0 ? void 0 : _state_sortDescriptor3.direction) === 'ascending',
|
|
646
|
-
'is-hovered': isHovered,
|
|
647
|
-
'spectrum-Table-cell--hideHeader': columnProps.hideHeader
|
|
648
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-cell', {
|
|
649
|
-
'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center' || column.colSpan > 1,
|
|
650
|
-
'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
|
|
651
|
-
}))
|
|
652
|
-
}, columnProps.allowsSorting && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiArrowDownSmall), {
|
|
653
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-sortedIcon')
|
|
654
|
-
}), columnProps.hideHeader ? /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VisuallyHidden), null, column.rendered) : /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
655
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCellContents')
|
|
656
|
-
}, column.rendered)));
|
|
657
|
-
}
|
|
658
|
-
let $bd013581c0a4b065$var$ForwardTableColumnHeaderButton = (props, ref)=>{
|
|
659
|
-
let { focusProps: focusProps, alignment: alignment, ...otherProps } = props;
|
|
660
|
-
let { isEmpty: isEmpty } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
661
|
-
let domRef = (0, $7lS7h$useFocusableRef)(ref);
|
|
662
|
-
let { buttonProps: buttonProps } = (0, $7lS7h$useButton)({
|
|
663
|
-
...otherProps,
|
|
664
|
-
elementType: 'div',
|
|
665
|
-
isDisabled: isEmpty
|
|
666
|
-
}, domRef);
|
|
667
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7lS7h$useHover)({
|
|
668
|
-
...otherProps,
|
|
669
|
-
isDisabled: isEmpty
|
|
670
|
-
});
|
|
671
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
672
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCellContents', {
|
|
673
|
-
'is-hovered': isHovered
|
|
674
|
-
}),
|
|
675
|
-
...hoverProps
|
|
676
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
677
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCellButton', {
|
|
678
|
-
'spectrum-Table-headCellButton--alignStart': alignment === 'start',
|
|
679
|
-
'spectrum-Table-headCellButton--alignCenter': alignment === 'center',
|
|
680
|
-
'spectrum-Table-headCellButton--alignEnd': alignment === 'end'
|
|
681
|
-
}),
|
|
682
|
-
...(0, $7lS7h$mergeProps)(buttonProps, focusProps),
|
|
683
|
-
ref: domRef
|
|
684
|
-
}, props.children));
|
|
685
|
-
};
|
|
686
|
-
let $bd013581c0a4b065$var$TableColumnHeaderButton = /*#__PURE__*/ (0, $7lS7h$react).forwardRef($bd013581c0a4b065$var$ForwardTableColumnHeaderButton);
|
|
687
|
-
function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
|
|
688
|
-
var _column_props, _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
|
|
689
|
-
let { column: column } = props;
|
|
690
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
691
|
-
let triggerRef = (0, $7lS7h$useRef)(null);
|
|
692
|
-
let resizingRef = (0, $7lS7h$useRef)(null);
|
|
693
|
-
let { state: state, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, headerRowHovered: headerRowHovered, setIsInResizeMode: setIsInResizeMode, isEmpty: isEmpty, isInResizeMode: isInResizeMode, headerMenuOpen: headerMenuOpen, setHeaderMenuOpen: setHeaderMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
694
|
-
let columnResizeState = (0, $7lS7h$useContext)((0, $fc695d2eafc2b351$export$b517d84d4ad20b24));
|
|
695
|
-
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
696
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
|
|
697
|
-
isDisabled: isEmpty
|
|
698
|
-
});
|
|
699
|
-
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
700
|
-
node: column,
|
|
701
|
-
isVirtualized: true
|
|
702
|
-
}, state, ref);
|
|
703
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7lS7h$useHover)({
|
|
704
|
-
...props,
|
|
705
|
-
isDisabled: isEmpty || headerMenuOpen
|
|
706
|
-
});
|
|
707
|
-
const allProps = [
|
|
708
|
-
columnHeaderProps,
|
|
709
|
-
pressProps,
|
|
710
|
-
hoverProps
|
|
711
|
-
];
|
|
712
|
-
let columnProps = column.props;
|
|
713
|
-
let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7lS7h$useFocusRing)();
|
|
714
|
-
const onMenuSelect = (key)=>{
|
|
715
|
-
switch(key){
|
|
716
|
-
case 'sort-asc':
|
|
717
|
-
state.sort(column.key, 'ascending');
|
|
718
|
-
break;
|
|
719
|
-
case 'sort-desc':
|
|
720
|
-
state.sort(column.key, 'descending');
|
|
721
|
-
break;
|
|
722
|
-
case 'resize':
|
|
723
|
-
columnResizeState.startResize(column.key);
|
|
724
|
-
setIsInResizeMode(true);
|
|
725
|
-
state.setKeyboardNavigationDisabled(true);
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
let allowsSorting = (_column_props = column.props) === null || _column_props === void 0 ? void 0 : _column_props.allowsSorting;
|
|
730
|
-
let items = (0, $7lS7h$useMemo)(()=>{
|
|
731
|
-
let options = [];
|
|
732
|
-
if (allowsSorting) {
|
|
733
|
-
options.push({
|
|
734
|
-
label: stringFormatter.format('sortAscending'),
|
|
735
|
-
id: 'sort-asc'
|
|
736
|
-
});
|
|
737
|
-
options.push({
|
|
738
|
-
label: stringFormatter.format('sortDescending'),
|
|
739
|
-
id: 'sort-desc'
|
|
740
|
-
});
|
|
741
|
-
}
|
|
742
|
-
options.push({
|
|
743
|
-
label: stringFormatter.format('resizeColumn'),
|
|
744
|
-
id: 'resize'
|
|
745
|
-
});
|
|
746
|
-
return options;
|
|
747
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
748
|
-
}, [
|
|
749
|
-
allowsSorting
|
|
750
|
-
]);
|
|
751
|
-
let resizingColumn = columnResizeState.resizingColumn;
|
|
752
|
-
let showResizer = !isEmpty && (headerRowHovered && (0, $7lS7h$getInteractionModality)() !== 'keyboard' || resizingColumn != null);
|
|
753
|
-
let alignment = 'start';
|
|
754
|
-
let menuAlign = 'start';
|
|
755
|
-
if (columnProps.align === 'center' || column.colSpan > 1) alignment = 'center';
|
|
756
|
-
else if (columnProps.align === 'end') {
|
|
757
|
-
alignment = 'end';
|
|
758
|
-
menuAlign = 'end';
|
|
759
|
-
}
|
|
760
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
761
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
762
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
763
|
-
...(0, $7lS7h$mergeProps)(...allProps),
|
|
764
|
-
ref: ref,
|
|
765
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCell', {
|
|
766
|
-
'is-active': isPressed,
|
|
767
|
-
'is-resizable': columnProps.allowsResizing,
|
|
768
|
-
'is-sortable': columnProps.allowsSorting,
|
|
769
|
-
'is-sorted-desc': ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === column.key && ((_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction) === 'descending',
|
|
770
|
-
'is-sorted-asc': ((_state_sortDescriptor2 = state.sortDescriptor) === null || _state_sortDescriptor2 === void 0 ? void 0 : _state_sortDescriptor2.column) === column.key && ((_state_sortDescriptor3 = state.sortDescriptor) === null || _state_sortDescriptor3 === void 0 ? void 0 : _state_sortDescriptor3.direction) === 'ascending',
|
|
771
|
-
'is-hovered': isHovered,
|
|
772
|
-
'focus-ring': isFocusVisible,
|
|
773
|
-
'spectrum-Table-cell--hideHeader': columnProps.hideHeader
|
|
774
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-cell', {
|
|
775
|
-
'react-spectrum-Table-cell--alignCenter': alignment === 'center',
|
|
776
|
-
'react-spectrum-Table-cell--alignEnd': alignment === 'end'
|
|
777
|
-
}))
|
|
778
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$MenuTrigger), {
|
|
779
|
-
onOpenChange: setHeaderMenuOpen,
|
|
780
|
-
align: menuAlign
|
|
781
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableColumnHeaderButton, {
|
|
782
|
-
alignment: alignment,
|
|
783
|
-
ref: triggerRef,
|
|
784
|
-
focusProps: focusProps
|
|
785
|
-
}, columnProps.allowsSorting && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiArrowDownSmall), {
|
|
786
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-sortedIcon')
|
|
787
|
-
}), columnProps.hideHeader ? /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VisuallyHidden), null, column.rendered) : /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
788
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headerCellText')
|
|
789
|
-
}, column.rendered), columnProps.allowsResizing && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiChevronDownMedium), {
|
|
790
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-menuChevron')
|
|
791
|
-
})), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$Menu), {
|
|
792
|
-
onAction: onMenuSelect,
|
|
793
|
-
minWidth: "size-2000",
|
|
794
|
-
items: items
|
|
795
|
-
}, (item)=>/*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$Item), null, item.label))), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $fc695d2eafc2b351$export$48a76196cafe3b93), {
|
|
796
|
-
ref: resizingRef,
|
|
797
|
-
column: column,
|
|
798
|
-
showResizer: showResizer,
|
|
799
|
-
onResizeStart: onResizeStart,
|
|
800
|
-
onResize: onResize,
|
|
801
|
-
onResizeEnd: onResizeEnd,
|
|
802
|
-
triggerRef: (0, $7lS7h$useUnwrapDOMRef)(triggerRef)
|
|
803
|
-
}), /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
804
|
-
"aria-hidden": true,
|
|
805
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-colResizeIndicator', {
|
|
806
|
-
'spectrum-Table-colResizeIndicator--visible': resizingColumn != null,
|
|
807
|
-
'spectrum-Table-colResizeIndicator--resizing': resizingColumn === column.key
|
|
808
|
-
})
|
|
809
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
810
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-colResizeNubbin', {
|
|
811
|
-
'spectrum-Table-colResizeNubbin--visible': isInResizeMode && resizingColumn === column.key
|
|
812
|
-
})
|
|
813
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $cb7d341e8868d81d$export$d9658cdf8c86807), null)))));
|
|
814
|
-
}
|
|
815
|
-
function $bd013581c0a4b065$var$TableSelectAllCell({ column: column }) {
|
|
816
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
817
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
818
|
-
let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
|
|
819
|
-
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
820
|
-
node: column,
|
|
821
|
-
isVirtualized: true
|
|
822
|
-
}, state, ref);
|
|
823
|
-
let { checkboxProps: checkboxProps } = (0, $7lS7h$useTableSelectAllCheckbox)(state);
|
|
824
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7lS7h$useHover)({});
|
|
825
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
826
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
827
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
828
|
-
...(0, $7lS7h$mergeProps)(columnHeaderProps, hoverProps),
|
|
829
|
-
ref: ref,
|
|
830
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCell', 'spectrum-Table-checkboxCell', {
|
|
831
|
-
'is-hovered': isHovered
|
|
832
|
-
})
|
|
833
|
-
}, /*
|
|
834
|
-
In single selection mode, the checkbox will be hidden.
|
|
835
|
-
So to avoid leaving a column header with no accessible content,
|
|
836
|
-
we use a VisuallyHidden component to include the aria-label from the checkbox,
|
|
837
|
-
which for single selection will be "Select."
|
|
838
|
-
*/ isSingleSelectionMode && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VisuallyHidden), null, checkboxProps['aria-label']), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$Checkbox), {
|
|
839
|
-
...checkboxProps,
|
|
840
|
-
"data-testid": "selectAll",
|
|
841
|
-
isEmphasized: true,
|
|
842
|
-
UNSAFE_style: isSingleSelectionMode ? {
|
|
843
|
-
visibility: 'hidden'
|
|
844
|
-
} : undefined,
|
|
845
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-checkbox')
|
|
846
|
-
})));
|
|
847
|
-
}
|
|
848
|
-
function $bd013581c0a4b065$var$TableDragHeaderCell({ column: column }) {
|
|
849
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
850
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
851
|
-
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
852
|
-
node: column,
|
|
853
|
-
isVirtualized: true
|
|
854
|
-
}, state, ref);
|
|
855
|
-
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
856
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
857
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
858
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
859
|
-
...columnHeaderProps,
|
|
860
|
-
ref: ref,
|
|
861
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCell', (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-headCell', 'react-spectrum-Table-dragButtonHeadCell'))
|
|
862
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VisuallyHidden), null, stringFormatter.format('drag'))));
|
|
863
|
-
}
|
|
864
|
-
function $bd013581c0a4b065$var$TableRowGroup({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
865
|
-
let { rowGroupProps: rowGroupProps } = (0, $7lS7h$useTableRowGroup)();
|
|
866
|
-
let { isTableDroppable: isTableDroppable } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
867
|
-
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
868
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
869
|
-
...rowGroupProps,
|
|
870
|
-
style: style,
|
|
871
|
-
...otherProps
|
|
872
|
-
}, isTableDroppable && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $4e6fc36ba71ba405$export$d30a7814cfd4033e), {
|
|
873
|
-
key: "root"
|
|
874
|
-
}), children);
|
|
875
|
-
}
|
|
876
|
-
function $bd013581c0a4b065$var$DragButton() {
|
|
877
|
-
let { dragButtonProps: dragButtonProps, dragButtonRef: dragButtonRef, isFocusVisibleWithin: isFocusVisibleWithin } = $bd013581c0a4b065$export$cd7c5802f9e21187();
|
|
878
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $7lS7h$useVisuallyHidden)();
|
|
879
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
880
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'focus-ring')
|
|
881
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
882
|
-
...dragButtonProps,
|
|
883
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-dragButton'),
|
|
884
|
-
style: !isFocusVisibleWithin ? {
|
|
885
|
-
...visuallyHiddenProps.style
|
|
886
|
-
} : {},
|
|
887
|
-
ref: dragButtonRef,
|
|
888
|
-
draggable: "true"
|
|
889
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiListGripper), {
|
|
890
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))))
|
|
891
|
-
})));
|
|
892
|
-
}
|
|
893
|
-
const $bd013581c0a4b065$var$TableRowContext = /*#__PURE__*/ (0, $7lS7h$react).createContext(null);
|
|
894
|
-
function $bd013581c0a4b065$export$cd7c5802f9e21187() {
|
|
895
|
-
return (0, $7lS7h$useContext)($bd013581c0a4b065$var$TableRowContext);
|
|
896
|
-
}
|
|
897
|
-
function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
898
|
-
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
|
|
899
|
-
// allowing for single swipe navigation between row drop indicator
|
|
900
|
-
_dragAndDropHooks_isVirtualDragging;
|
|
901
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
902
|
-
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
903
|
-
let isSelected = state.selectionManager.isSelected(item.key);
|
|
904
|
-
let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $7lS7h$useTableRow)({
|
|
905
|
-
node: item,
|
|
906
|
-
isVirtualized: true,
|
|
907
|
-
shouldSelectOnPressUp: isTableDraggable
|
|
908
|
-
}, state, ref);
|
|
909
|
-
let isDisabled = state.selectionManager.isDisabled(item.key);
|
|
910
|
-
let isInteractive = !isDisabled && (hasAction || allowsSelection || isTableDraggable);
|
|
911
|
-
let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
|
|
912
|
-
isDisabled: !isInteractive
|
|
913
|
-
});
|
|
914
|
-
// The row should show the focus background style when any cell inside it is focused.
|
|
915
|
-
// If the row itself is focused, then it should have a blue focus indicator on the left.
|
|
916
|
-
let { isFocusVisible: isFocusVisibleWithin, focusProps: focusWithinProps } = (0, $7lS7h$useFocusRing)({
|
|
917
|
-
within: true
|
|
918
|
-
});
|
|
919
|
-
let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $7lS7h$useFocusRing)();
|
|
920
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $7lS7h$useHover)({
|
|
921
|
-
isDisabled: !isInteractive
|
|
922
|
-
});
|
|
923
|
-
let isFirstRow = ((_state_collection_rows_find = state.collection.rows.find((row)=>row.level === 1)) === null || _state_collection_rows_find === void 0 ? void 0 : _state_collection_rows_find.key) === item.key;
|
|
924
|
-
let isLastRow = item.nextKey == null;
|
|
925
|
-
// Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
|
|
926
|
-
// border corners of the last row when selected.
|
|
927
|
-
let isFlushWithContainerBottom = false;
|
|
928
|
-
var _layout_virtualizer_visibleRect_height;
|
|
929
|
-
if (isLastRow) {
|
|
930
|
-
if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
|
|
931
|
-
}
|
|
932
|
-
let draggableItem = null;
|
|
933
|
-
if (isTableDraggable && dragAndDropHooks && dragState) {
|
|
934
|
-
draggableItem = dragAndDropHooks.useDraggableItem({
|
|
935
|
-
key: item.key,
|
|
936
|
-
hasDragButton: true
|
|
937
|
-
}, dragState);
|
|
938
|
-
if (isDisabled) draggableItem = null;
|
|
939
|
-
}
|
|
940
|
-
let isDropTarget = false;
|
|
941
|
-
let dropIndicator = null;
|
|
942
|
-
let dropIndicatorRef = (0, $7lS7h$useRef)(null);
|
|
943
|
-
if (isTableDroppable && dragAndDropHooks && dropState) {
|
|
944
|
-
let target = {
|
|
945
|
-
type: 'item',
|
|
946
|
-
key: item.key,
|
|
947
|
-
dropPosition: 'on'
|
|
948
|
-
};
|
|
949
|
-
isDropTarget = dropState.isDropTarget(target);
|
|
950
|
-
dropIndicator = dragAndDropHooks.useDropIndicator({
|
|
951
|
-
target: target
|
|
952
|
-
}, dropState, dropIndicatorRef);
|
|
953
|
-
}
|
|
954
|
-
let dragButtonRef = (0, $7lS7h$react).useRef(null);
|
|
955
|
-
let { buttonProps: dragButtonProps } = (0, $7lS7h$useButton)({
|
|
956
|
-
...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
|
|
957
|
-
elementType: 'div'
|
|
958
|
-
}, dragButtonRef);
|
|
959
|
-
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
960
|
-
let props = (0, $7lS7h$mergeProps)(rowProps, otherProps, {
|
|
961
|
-
style: style
|
|
962
|
-
}, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) ? {
|
|
963
|
-
tabIndex: null
|
|
964
|
-
} : null);
|
|
965
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $7lS7h$useVisuallyHidden)();
|
|
966
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowContext.Provider, {
|
|
967
|
-
value: {
|
|
968
|
-
dragButtonProps: dragButtonProps,
|
|
969
|
-
dragButtonRef: dragButtonRef,
|
|
970
|
-
isFocusVisibleWithin: isFocusVisibleWithin
|
|
971
|
-
}
|
|
972
|
-
}, isTableDroppable && isFirstRow && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7ee9a922ee4e8032$export$2c0bab5914a9d088), {
|
|
973
|
-
rowProps: props,
|
|
974
|
-
key: `${item.key}-before`,
|
|
975
|
-
target: {
|
|
976
|
-
key: item.key,
|
|
977
|
-
type: 'item',
|
|
978
|
-
dropPosition: 'before'
|
|
979
|
-
}
|
|
980
|
-
}), isTableDroppable && !(dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.isHidden) && /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
981
|
-
role: "row",
|
|
982
|
-
...visuallyHiddenProps
|
|
983
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
984
|
-
role: "gridcell"
|
|
985
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
986
|
-
role: "button",
|
|
987
|
-
...dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.dropIndicatorProps,
|
|
988
|
-
ref: dropIndicatorRef
|
|
989
|
-
}))), /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
990
|
-
...props,
|
|
991
|
-
ref: ref,
|
|
992
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-row', {
|
|
993
|
-
'is-active': isPressed,
|
|
994
|
-
'is-selected': isSelected,
|
|
995
|
-
'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
|
|
996
|
-
'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
|
|
997
|
-
'is-focused': isFocusVisibleWithin,
|
|
998
|
-
'focus-ring': isFocusVisible,
|
|
999
|
-
'is-hovered': isHovered,
|
|
1000
|
-
'is-disabled': isDisabled,
|
|
1001
|
-
'spectrum-Table-row--firstRow': isFirstRow,
|
|
1002
|
-
'spectrum-Table-row--lastRow': isLastRow,
|
|
1003
|
-
'spectrum-Table-row--isFlushBottom': isFlushWithContainerBottom
|
|
1004
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-row', {
|
|
1005
|
-
'react-spectrum-Table-row--dropTarget': isDropTarget
|
|
1006
|
-
}))
|
|
1007
|
-
}, children), isTableDroppable && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7ee9a922ee4e8032$export$2c0bab5914a9d088), {
|
|
1008
|
-
rowProps: props,
|
|
1009
|
-
key: `${item.key}-after`,
|
|
1010
|
-
target: {
|
|
1011
|
-
key: item.key,
|
|
1012
|
-
type: 'item',
|
|
1013
|
-
dropPosition: 'after'
|
|
1014
|
-
}
|
|
1015
|
-
}));
|
|
1016
|
-
}
|
|
1017
|
-
function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
|
|
1018
|
-
let { state: state, headerMenuOpen: headerMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1019
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
1020
|
-
let { rowProps: rowProps } = (0, $7lS7h$useTableHeaderRow)({
|
|
1021
|
-
node: item,
|
|
1022
|
-
isVirtualized: true
|
|
1023
|
-
}, state, ref);
|
|
1024
|
-
let { hoverProps: hoverProps } = (0, $7lS7h$useHover)({
|
|
1025
|
-
...props,
|
|
1026
|
-
isDisabled: headerMenuOpen
|
|
1027
|
-
});
|
|
1028
|
-
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
1029
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1030
|
-
...(0, $7lS7h$mergeProps)(rowProps, hoverProps),
|
|
1031
|
-
ref: ref,
|
|
1032
|
-
style: style
|
|
1033
|
-
}, children);
|
|
1034
|
-
}
|
|
1035
|
-
function $bd013581c0a4b065$var$TableDragCell({ cell: cell }) {
|
|
1036
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
1037
|
-
let { state: state, isTableDraggable: isTableDraggable } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1038
|
-
let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
|
|
1039
|
-
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
1040
|
-
node: cell,
|
|
1041
|
-
isVirtualized: true
|
|
1042
|
-
}, state, ref);
|
|
1043
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
1044
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
1045
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1046
|
-
...gridCellProps,
|
|
1047
|
-
ref: ref,
|
|
1048
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cell', {
|
|
1049
|
-
'is-disabled': isDisabled
|
|
1050
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-cell', 'react-spectrum-Table-dragButtonCell'))
|
|
1051
|
-
}, isTableDraggable && !isDisabled && /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$DragButton, null)));
|
|
1052
|
-
}
|
|
1053
|
-
function $bd013581c0a4b065$var$TableCheckboxCell({ cell: cell }) {
|
|
1054
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
1055
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1056
|
-
// The TableCheckbox should always render its disabled status if the row is disabled, regardless of disabledBehavior,
|
|
1057
|
-
// but the cell itself should not render its disabled styles if disabledBehavior="selection" because the row might have actions on it.
|
|
1058
|
-
let isSelectionDisabled = state.disabledKeys.has(cell.parentKey);
|
|
1059
|
-
let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
|
|
1060
|
-
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
1061
|
-
node: cell,
|
|
1062
|
-
isVirtualized: true
|
|
1063
|
-
}, state, ref);
|
|
1064
|
-
let { checkboxProps: checkboxProps } = (0, $7lS7h$useTableSelectionCheckbox)({
|
|
1065
|
-
key: cell.parentKey
|
|
1066
|
-
}, state);
|
|
1067
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
1068
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
1069
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1070
|
-
...gridCellProps,
|
|
1071
|
-
ref: ref,
|
|
1072
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cell', 'spectrum-Table-checkboxCell', {
|
|
1073
|
-
'is-disabled': isDisabled
|
|
1074
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-cell'))
|
|
1075
|
-
}, state.selectionManager.selectionMode !== 'none' && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$Checkbox), {
|
|
1076
|
-
...checkboxProps,
|
|
1077
|
-
isEmphasized: true,
|
|
1078
|
-
isDisabled: isSelectionDisabled,
|
|
1079
|
-
UNSAFE_className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-checkbox')
|
|
1080
|
-
})));
|
|
1081
|
-
}
|
|
1082
|
-
function $bd013581c0a4b065$var$TableCell({ cell: cell }) {
|
|
1083
|
-
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
1084
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1085
|
-
let isExpandableTable = 'expandedKeys' in state;
|
|
1086
|
-
let ref = (0, $7lS7h$useRef)(null);
|
|
1087
|
-
let columnProps = cell.column.props;
|
|
1088
|
-
let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
|
|
1089
|
-
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
1090
|
-
node: cell,
|
|
1091
|
-
isVirtualized: true
|
|
1092
|
-
}, state, ref);
|
|
1093
|
-
let { id: id, ...otherGridCellProps } = gridCellProps;
|
|
1094
|
-
let isFirstRowHeaderCell = state.collection.rowHeaderColumnKeys.keys().next().value === cell.column.key;
|
|
1095
|
-
let isRowExpandable = false;
|
|
1096
|
-
let showExpandCollapseButton = false;
|
|
1097
|
-
let levelOffset = 0;
|
|
1098
|
-
if ('expandedKeys' in state) {
|
|
1099
|
-
var _state_keyMap_get_props_UNSTABLE_childItems, _state_keyMap_get, _state_keyMap_get_props_children, _state_keyMap_get_props, _state_keyMap_get1;
|
|
1100
|
-
isRowExpandable = ((_state_keyMap_get = state.keyMap.get(cell.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : (_state_keyMap_get_props_UNSTABLE_childItems = _state_keyMap_get.props.UNSTABLE_childItems) === null || _state_keyMap_get_props_UNSTABLE_childItems === void 0 ? void 0 : _state_keyMap_get_props_UNSTABLE_childItems.length) > 0 || ((_state_keyMap_get1 = state.keyMap.get(cell.parentKey)) === null || _state_keyMap_get1 === void 0 ? void 0 : (_state_keyMap_get_props = _state_keyMap_get1.props) === null || _state_keyMap_get_props === void 0 ? void 0 : (_state_keyMap_get_props_children = _state_keyMap_get_props.children) === null || _state_keyMap_get_props_children === void 0 ? void 0 : _state_keyMap_get_props_children.length) > state.userColumnCount;
|
|
1101
|
-
showExpandCollapseButton = isFirstRowHeaderCell && isRowExpandable;
|
|
1102
|
-
// Offset based on level, and add additional offset if there is no expand/collapse button on a row
|
|
1103
|
-
levelOffset = (cell.level - 2) * $bd013581c0a4b065$var$LEVEL_OFFSET_WIDTH[scale] + (!showExpandCollapseButton ? $bd013581c0a4b065$var$LEVEL_OFFSET_WIDTH[scale] * 2 : 0);
|
|
1104
|
-
}
|
|
1105
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusRing), {
|
|
1106
|
-
focusRingClass: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'focus-ring')
|
|
1107
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1108
|
-
...otherGridCellProps,
|
|
1109
|
-
"aria-labelledby": id,
|
|
1110
|
-
ref: ref,
|
|
1111
|
-
style: isExpandableTable && isFirstRowHeaderCell ? {
|
|
1112
|
-
paddingInlineStart: levelOffset
|
|
1113
|
-
} : {},
|
|
1114
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cell', {
|
|
1115
|
-
'spectrum-Table-cell--divider': columnProps.showDivider && cell.column.nextKey !== null,
|
|
1116
|
-
'spectrum-Table-cell--hideHeader': columnProps.hideHeader,
|
|
1117
|
-
'spectrum-Table-cell--hasExpandCollapseButton': showExpandCollapseButton,
|
|
1118
|
-
'is-disabled': isDisabled
|
|
1119
|
-
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-cell', {
|
|
1120
|
-
'react-spectrum-Table-cell--alignStart': columnProps.align === 'start',
|
|
1121
|
-
'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center',
|
|
1122
|
-
'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
|
|
1123
|
-
}))
|
|
1124
|
-
}, showExpandCollapseButton && /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$ExpandableRowChevron, {
|
|
1125
|
-
cell: cell
|
|
1126
|
-
}), /*#__PURE__*/ (0, $7lS7h$react).createElement("span", {
|
|
1127
|
-
id: id,
|
|
1128
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cellContents')
|
|
1129
|
-
}, cell.rendered)));
|
|
1130
|
-
}
|
|
1131
|
-
function $bd013581c0a4b065$var$TableCellWrapper({ layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children }) {
|
|
1132
|
-
let { isTableDroppable: isTableDroppable, dropState: dropState } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1133
|
-
let isDropTarget = false;
|
|
1134
|
-
let isRootDroptarget = false;
|
|
1135
|
-
if (isTableDroppable && dropState) {
|
|
1136
|
-
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
1137
|
-
type: 'item',
|
|
1138
|
-
dropPosition: 'on',
|
|
1139
|
-
key: parent.content.key
|
|
1140
|
-
});
|
|
1141
|
-
isRootDroptarget = dropState.isDropTarget({
|
|
1142
|
-
type: 'root'
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VirtualizerItem), {
|
|
1146
|
-
layoutInfo: layoutInfo,
|
|
1147
|
-
virtualizer: virtualizer,
|
|
1148
|
-
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
1149
|
-
className: (0, $7lS7h$useMemo)(()=>(0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cellWrapper', (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), {
|
|
1150
|
-
'react-spectrum-Table-cellWrapper': !layoutInfo.estimatedSize,
|
|
1151
|
-
'react-spectrum-Table-cellWrapper--dropTarget': isDropTarget || isRootDroptarget
|
|
1152
|
-
})), [
|
|
1153
|
-
layoutInfo.estimatedSize,
|
|
1154
|
-
isDropTarget,
|
|
1155
|
-
isRootDroptarget
|
|
1156
|
-
])
|
|
1157
|
-
}, children);
|
|
1158
|
-
}
|
|
1159
|
-
function $bd013581c0a4b065$var$ExpandableRowChevron({ cell: cell }) {
|
|
1160
|
-
// TODO: move some/all of the chevron button setup into a separate hook?
|
|
1161
|
-
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
1162
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1163
|
-
let expandButtonRef = (0, $7lS7h$useRef)(null);
|
|
1164
|
-
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
1165
|
-
let isExpanded;
|
|
1166
|
-
if ('expandedKeys' in state) isExpanded = state.expandedKeys === 'all' || state.expandedKeys.has(cell.parentKey);
|
|
1167
|
-
// Will need to keep the chevron as a button for iOS VO at all times since VO doesn't focus the cell. Also keep as button if cellAction is defined by the user in the future
|
|
1168
|
-
let { buttonProps: buttonProps } = (0, $7lS7h$useButton)({
|
|
1169
|
-
// Desktop and mobile both toggle expansion of a native expandable row on mouse/touch up
|
|
1170
|
-
onPress: ()=>{
|
|
1171
|
-
state.toggleKey(cell.parentKey);
|
|
1172
|
-
if (!(0, $7lS7h$isFocusVisible)()) {
|
|
1173
|
-
state.selectionManager.setFocused(true);
|
|
1174
|
-
state.selectionManager.setFocusedKey(cell.parentKey);
|
|
1175
|
-
}
|
|
1176
|
-
},
|
|
1177
|
-
elementType: 'span',
|
|
1178
|
-
'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand')
|
|
1179
|
-
}, expandButtonRef);
|
|
1180
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("span", {
|
|
1181
|
-
...buttonProps,
|
|
1182
|
-
ref: expandButtonRef,
|
|
1183
|
-
// Override tabindex so that grid keyboard nav skips over it. Needs -1 so android talkback can actually "focus" it
|
|
1184
|
-
tabIndex: (0, $7lS7h$isAndroid)() ? -1 : undefined,
|
|
1185
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-expandButton', {
|
|
1186
|
-
'is-open': isExpanded
|
|
1187
|
-
})
|
|
1188
|
-
}, direction === 'ltr' ? /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiChevronRightMedium), null) : /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiChevronLeftMedium), null));
|
|
1189
|
-
}
|
|
1190
|
-
function $bd013581c0a4b065$var$LoadingState() {
|
|
1191
|
-
let { state: state } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1192
|
-
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
1193
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$CenteredWrapper, null, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$ProgressCircle), {
|
|
1194
|
-
isIndeterminate: true,
|
|
1195
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
|
|
1196
|
-
}));
|
|
1197
|
-
}
|
|
1198
|
-
function $bd013581c0a4b065$var$EmptyState() {
|
|
1199
|
-
let { renderEmptyState: renderEmptyState } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1200
|
-
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
1201
|
-
if (emptyState == null) return null;
|
|
1202
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$CenteredWrapper, null, emptyState);
|
|
1203
|
-
}
|
|
1204
|
-
function $bd013581c0a4b065$var$CenteredWrapper({ children: children }) {
|
|
1205
|
-
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1206
|
-
let rowProps;
|
|
1207
|
-
if ('expandedKeys' in state) {
|
|
1208
|
-
let topLevelRowCount = [
|
|
1209
|
-
...state.collection.body.childNodes
|
|
1210
|
-
].length;
|
|
1211
|
-
rowProps = {
|
|
1212
|
-
'aria-level': 1,
|
|
1213
|
-
'aria-posinset': topLevelRowCount + 1,
|
|
1214
|
-
'aria-setsize': topLevelRowCount + 1
|
|
1215
|
-
};
|
|
1216
|
-
} else rowProps = {
|
|
1217
|
-
'aria-rowindex': state.collection.headerRows.length + state.collection.size + 1
|
|
1218
|
-
};
|
|
1219
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1220
|
-
role: "row",
|
|
1221
|
-
...rowProps,
|
|
1222
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-centeredWrapper')
|
|
1223
|
-
}, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1224
|
-
role: "rowheader",
|
|
1225
|
-
"aria-colspan": state.collection.columns.length
|
|
1226
|
-
}, children));
|
|
1227
|
-
}
|
|
1228
|
-
const $bd013581c0a4b065$export$517e02184d273d69 = /*#__PURE__*/ (0, $7lS7h$react).forwardRef($bd013581c0a4b065$var$TableViewBase);
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
export {$bd013581c0a4b065$export$93e4b0b2cc49b648 as TableContext, $bd013581c0a4b065$export$3cb274deb6c2d854 as useTableContext, $bd013581c0a4b065$export$d288a7dd40372bc as VirtualizerContext, $bd013581c0a4b065$export$3f8f74b6bfd2c5df as useVirtualizerContext, $bd013581c0a4b065$export$cd7c5802f9e21187 as useTableRowContext, $bd013581c0a4b065$export$517e02184d273d69 as TableViewBase};
|
|
1232
|
-
//# sourceMappingURL=TableViewBase.module.js.map
|