@react-spectrum/table 3.12.11-nightly.4674 → 3.12.11-nightly.4681
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/InsertionIndicator.main.js +1 -1
- package/dist/InsertionIndicator.main.js.map +1 -1
- package/dist/InsertionIndicator.mjs +1 -1
- package/dist/InsertionIndicator.module.js +1 -1
- package/dist/InsertionIndicator.module.js.map +1 -1
- package/dist/Resizer.main.js +4 -1
- package/dist/Resizer.main.js.map +1 -1
- package/dist/Resizer.mjs +5 -3
- package/dist/Resizer.module.js +5 -3
- package/dist/Resizer.module.js.map +1 -1
- package/dist/RootDropIndicator.main.js +1 -1
- package/dist/RootDropIndicator.main.js.map +1 -1
- package/dist/RootDropIndicator.mjs +1 -1
- package/dist/RootDropIndicator.module.js +1 -1
- package/dist/RootDropIndicator.module.js.map +1 -1
- package/dist/TableViewBase.main.js +80 -75
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +82 -77
- package/dist/TableViewBase.module.js +82 -77
- package/dist/TableViewBase.module.js.map +1 -1
- package/package.json +32 -31
- package/src/InsertionIndicator.tsx +1 -1
- package/src/Resizer.tsx +8 -4
- package/src/RootDropIndicator.tsx +1 -1
- package/src/TableViewBase.tsx +110 -84
package/dist/TableViewBase.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {InsertionIndicator as $7ee9a922ee4e8032$export$2c0bab5914a9d088} from "./InsertionIndicator.mjs";
|
|
2
2
|
import $7lS7h$intlStringsmodulejs from "./intlStrings.mjs";
|
|
3
3
|
import {Nubbin as $cb7d341e8868d81d$export$d9658cdf8c86807} from "./Nubbin.mjs";
|
|
4
|
-
import {Resizer as $fc695d2eafc2b351$export$48a76196cafe3b93} from "./Resizer.mjs";
|
|
4
|
+
import {Resizer as $fc695d2eafc2b351$export$48a76196cafe3b93, ResizeStateContext as $fc695d2eafc2b351$export$b517d84d4ad20b24} from "./Resizer.mjs";
|
|
5
5
|
import {RootDropIndicator as $4e6fc36ba71ba405$export$d30a7814cfd4033e} from "./RootDropIndicator.mjs";
|
|
6
6
|
import {DragPreview as $daa6ead3d9d3506a$export$905ab40ac2179daa} from "./DragPreview.mjs";
|
|
7
7
|
import "./vars.42570ef3.css";
|
|
@@ -9,7 +9,6 @@ import $7lS7h$table_vars_cssmodulejs from "./table_vars_css.mjs";
|
|
|
9
9
|
import "./table.b13eee90.css";
|
|
10
10
|
import $7lS7h$table_cssmodulejs from "./table_css.mjs";
|
|
11
11
|
import $7lS7h$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSmall";
|
|
12
|
-
import {mergeProps as $7lS7h$mergeProps, chain as $7lS7h$chain, scrollIntoView as $7lS7h$scrollIntoView, scrollIntoViewport as $7lS7h$scrollIntoViewport, isAndroid as $7lS7h$isAndroid} from "@react-aria/utils";
|
|
13
12
|
import {Checkbox as $7lS7h$Checkbox} from "@react-spectrum/checkbox";
|
|
14
13
|
import $7lS7h$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
|
|
15
14
|
import $7lS7h$spectrumiconsuiChevronLeftMedium from "@spectrum-icons/ui/ChevronLeftMedium";
|
|
@@ -17,14 +16,16 @@ import $7lS7h$spectrumiconsuiChevronRightMedium from "@spectrum-icons/ui/Chevron
|
|
|
17
16
|
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
17
|
import {useFocusRing as $7lS7h$useFocusRing, FocusScope as $7lS7h$FocusScope, FocusRing as $7lS7h$FocusRing} from "@react-aria/focus";
|
|
19
18
|
import {getInteractionModality as $7lS7h$getInteractionModality, usePress as $7lS7h$usePress, useHover as $7lS7h$useHover, isFocusVisible as $7lS7h$isFocusVisible} from "@react-aria/interactions";
|
|
19
|
+
import {mergeProps as $7lS7h$mergeProps, scrollIntoView as $7lS7h$scrollIntoView, scrollIntoViewport as $7lS7h$scrollIntoViewport, isAndroid as $7lS7h$isAndroid} from "@react-aria/utils";
|
|
20
20
|
import {MenuTrigger as $7lS7h$MenuTrigger, Menu as $7lS7h$Menu, Item as $7lS7h$Item} from "@react-spectrum/menu";
|
|
21
21
|
import {useVirtualizerState as $7lS7h$useVirtualizerState} from "@react-stately/virtualizer";
|
|
22
22
|
import {setScrollLeft as $7lS7h$setScrollLeft, useVirtualizer as $7lS7h$useVirtualizer, ScrollView as $7lS7h$ScrollView, layoutInfoToStyle as $7lS7h$layoutInfoToStyle, VirtualizerItem as $7lS7h$VirtualizerItem} from "@react-aria/virtualizer";
|
|
23
23
|
import $7lS7h$spectrumiconsuiListGripper from "@spectrum-icons/ui/ListGripper";
|
|
24
|
+
import {ListKeyboardDelegate as $7lS7h$ListKeyboardDelegate} from "@react-aria/selection";
|
|
24
25
|
import {ProgressCircle as $7lS7h$ProgressCircle} from "@react-spectrum/progress";
|
|
25
|
-
import $7lS7h$react, {useContext as $7lS7h$useContext, useRef as $7lS7h$useRef, useEffect as $7lS7h$useEffect,
|
|
26
|
-
import {TableColumnLayout as $7lS7h$TableColumnLayout} from "@react-stately/table";
|
|
26
|
+
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";
|
|
27
27
|
import {TableLayout as $7lS7h$TableLayout} from "@react-stately/layout";
|
|
28
|
+
import {useTableColumnResizeState as $7lS7h$useTableColumnResizeState} from "@react-stately/table";
|
|
28
29
|
import {TooltipTrigger as $7lS7h$TooltipTrigger, Tooltip as $7lS7h$Tooltip} from "@react-spectrum/tooltip";
|
|
29
30
|
import {useButton as $7lS7h$useButton} from "@react-aria/button";
|
|
30
31
|
import {useLocale as $7lS7h$useLocale, useLocalizedStringFormatter as $7lS7h$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
@@ -75,6 +76,7 @@ function $parcel$interopDefault(a) {
|
|
|
75
76
|
|
|
76
77
|
|
|
77
78
|
|
|
79
|
+
|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
const $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT = {
|
|
@@ -138,25 +140,6 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
138
140
|
]);
|
|
139
141
|
let { styleProps: styleProps } = (0, $7lS7h$useStyleProps)(props);
|
|
140
142
|
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
141
|
-
const getDefaultWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
142
|
-
if (hideHeader) {
|
|
143
|
-
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
144
|
-
return showDivider ? width + 1 : width;
|
|
145
|
-
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
146
|
-
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
147
|
-
}, [
|
|
148
|
-
scale
|
|
149
|
-
]);
|
|
150
|
-
const getDefaultMinWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
151
|
-
if (hideHeader) {
|
|
152
|
-
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
153
|
-
return showDivider ? width + 1 : width;
|
|
154
|
-
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
155
|
-
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
156
|
-
return 75;
|
|
157
|
-
}, [
|
|
158
|
-
scale
|
|
159
|
-
]);
|
|
160
143
|
// Starts when the user selects resize from the menu, ends when resizing ends
|
|
161
144
|
// used to control the visibility of the resizer Nubbin
|
|
162
145
|
let [isInResizeMode, setIsInResizeMode] = (0, $7lS7h$useState)(false);
|
|
@@ -165,44 +148,23 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
165
148
|
// with table layout, so we need to track it here
|
|
166
149
|
let [, setIsResizing] = (0, $7lS7h$useState)(false);
|
|
167
150
|
let domRef = (0, $7lS7h$useDOMRef)(ref);
|
|
168
|
-
let headerRef = (0, $7lS7h$useRef)();
|
|
169
|
-
let bodyRef = (0, $7lS7h$useRef)();
|
|
151
|
+
let headerRef = (0, $7lS7h$useRef)(undefined);
|
|
152
|
+
let bodyRef = (0, $7lS7h$useRef)(undefined);
|
|
170
153
|
let density = props.density || 'regular';
|
|
171
|
-
let
|
|
172
|
-
getDefaultWidth: getDefaultWidth,
|
|
173
|
-
getDefaultMinWidth: getDefaultMinWidth
|
|
174
|
-
}), [
|
|
175
|
-
getDefaultWidth,
|
|
176
|
-
getDefaultMinWidth
|
|
177
|
-
]);
|
|
178
|
-
let tableLayout = (0, $7lS7h$useMemo)(()=>new (0, $7lS7h$TableLayout)({
|
|
154
|
+
let layout = (0, $7lS7h$useMemo)(()=>new (0, $7lS7h$TableLayout)({
|
|
179
155
|
// If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
|
|
180
156
|
rowHeight: props.overflowMode === 'wrap' ? null : $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale],
|
|
181
157
|
estimatedRowHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$ROW_HEIGHTS[density][scale] : null,
|
|
182
158
|
headingHeight: props.overflowMode === 'wrap' ? null : $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale],
|
|
183
159
|
estimatedHeadingHeight: props.overflowMode === 'wrap' ? $bd013581c0a4b065$var$DEFAULT_HEADER_HEIGHT[scale] : null,
|
|
184
|
-
|
|
185
|
-
|
|
160
|
+
scrollContainer: 'body',
|
|
161
|
+
enableEmptyState: true
|
|
186
162
|
}), // don't recompute when state.collection changes, only used for initial value
|
|
187
163
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
188
164
|
[
|
|
189
165
|
props.overflowMode,
|
|
190
166
|
scale,
|
|
191
|
-
density
|
|
192
|
-
columnLayout
|
|
193
|
-
]);
|
|
194
|
-
// Use a proxy so that a new object is created for each render so that alternate instances aren't affected by mutation.
|
|
195
|
-
// This can be thought of as equivalent to `{…tableLayout, tableState: state}`, but works with classes as well.
|
|
196
|
-
let layout = (0, $7lS7h$useMemo)(()=>{
|
|
197
|
-
let proxy = new Proxy(tableLayout, {
|
|
198
|
-
get (target, prop, receiver) {
|
|
199
|
-
return prop === 'tableState' ? state : Reflect.get(target, prop, receiver);
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
return proxy;
|
|
203
|
-
}, [
|
|
204
|
-
state,
|
|
205
|
-
tableLayout
|
|
167
|
+
density
|
|
206
168
|
]);
|
|
207
169
|
let dragState;
|
|
208
170
|
let preview = (0, $7lS7h$useRef)(null);
|
|
@@ -224,7 +186,12 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
224
186
|
selectionManager: state.selectionManager
|
|
225
187
|
});
|
|
226
188
|
droppableCollection = dragAndDropHooks.useDroppableCollection({
|
|
227
|
-
keyboardDelegate:
|
|
189
|
+
keyboardDelegate: new (0, $7lS7h$ListKeyboardDelegate)({
|
|
190
|
+
collection: state.collection,
|
|
191
|
+
disabledKeys: state.selectionManager.disabledKeys,
|
|
192
|
+
ref: domRef,
|
|
193
|
+
layoutDelegate: layout
|
|
194
|
+
}),
|
|
228
195
|
dropTargetDelegate: layout
|
|
229
196
|
}, dropState, domRef);
|
|
230
197
|
isRootDropTarget = dropState.isDropTarget({
|
|
@@ -234,12 +201,13 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
234
201
|
let { gridProps: gridProps } = (0, $7lS7h$useTable)({
|
|
235
202
|
...props,
|
|
236
203
|
isVirtualized: true,
|
|
237
|
-
|
|
204
|
+
layoutDelegate: layout,
|
|
238
205
|
onRowAction: onAction,
|
|
239
206
|
scrollRef: bodyRef
|
|
240
207
|
}, state, domRef);
|
|
241
208
|
let [headerMenuOpen, setHeaderMenuOpen] = (0, $7lS7h$useState)(false);
|
|
242
209
|
let [headerRowHovered, setHeaderRowHovered] = (0, $7lS7h$useState)(false);
|
|
210
|
+
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
|
243
211
|
let renderWrapper = (0, $7lS7h$useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
244
212
|
if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowGroup, {
|
|
245
213
|
key: reusableView.key,
|
|
@@ -401,9 +369,8 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
401
369
|
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
402
370
|
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
403
371
|
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table'), styleProps.className),
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
layout: tableLayout,
|
|
372
|
+
tableState: state,
|
|
373
|
+
layout: layout,
|
|
407
374
|
collection: state.collection,
|
|
408
375
|
focusedKey: focusedKey,
|
|
409
376
|
renderView: renderView,
|
|
@@ -434,11 +401,37 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
434
401
|
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
435
402
|
function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
436
403
|
var _layout_getLayoutInfo;
|
|
437
|
-
let { layout: layout, collection: collection, focusedKey: focusedKey, renderView: renderView, renderWrapper: renderWrapper, domRef: domRef, bodyRef: bodyRef, headerRef: headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible: isFocusVisible, isVirtualDragging: isVirtualDragging, isRootDropTarget: isRootDropTarget, ...otherProps } = props;
|
|
404
|
+
let { tableState: tableState, layout: layout, collection: collection, focusedKey: focusedKey, renderView: renderView, renderWrapper: renderWrapper, domRef: domRef, bodyRef: bodyRef, headerRef: headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible: isFocusVisible, isVirtualDragging: isVirtualDragging, isRootDropTarget: isRootDropTarget, ...otherProps } = props;
|
|
438
405
|
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
439
406
|
let loadingState = collection.body.props.loadingState;
|
|
440
407
|
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
441
408
|
let onLoadMore = collection.body.props.onLoadMore;
|
|
409
|
+
let [tableWidth, setTableWidth] = (0, $7lS7h$useState)(0);
|
|
410
|
+
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
411
|
+
const getDefaultWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
412
|
+
if (hideHeader) {
|
|
413
|
+
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
414
|
+
return showDivider ? width + 1 : width;
|
|
415
|
+
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
416
|
+
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
417
|
+
}, [
|
|
418
|
+
scale
|
|
419
|
+
]);
|
|
420
|
+
const getDefaultMinWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
421
|
+
if (hideHeader) {
|
|
422
|
+
let width = $bd013581c0a4b065$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
423
|
+
return showDivider ? width + 1 : width;
|
|
424
|
+
} else if (isSelectionCell) return $bd013581c0a4b065$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
425
|
+
else if (isDragButtonCell) return $bd013581c0a4b065$var$DRAG_BUTTON_CELL_DEFAULT_WIDTH[scale];
|
|
426
|
+
return 75;
|
|
427
|
+
}, [
|
|
428
|
+
scale
|
|
429
|
+
]);
|
|
430
|
+
let columnResizeState = (0, $7lS7h$useTableColumnResizeState)({
|
|
431
|
+
tableWidth: tableWidth,
|
|
432
|
+
getDefaultWidth: getDefaultWidth,
|
|
433
|
+
getDefaultMinWidth: getDefaultMinWidth
|
|
434
|
+
}, tableState);
|
|
442
435
|
let state = (0, $7lS7h$useVirtualizerState)({
|
|
443
436
|
layout: layout,
|
|
444
437
|
collection: collection,
|
|
@@ -452,6 +445,11 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
452
445
|
focusedKey
|
|
453
446
|
]) : new Set(), [
|
|
454
447
|
focusedKey
|
|
448
|
+
]),
|
|
449
|
+
layoutOptions: (0, $7lS7h$useMemo)(()=>({
|
|
450
|
+
columnWidths: columnResizeState.columnWidths
|
|
451
|
+
}), [
|
|
452
|
+
columnResizeState.columnWidths
|
|
455
453
|
])
|
|
456
454
|
});
|
|
457
455
|
let memoedVirtualizerProps = (0, $7lS7h$useMemo)(()=>({
|
|
@@ -466,7 +464,11 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
466
464
|
onLoadMore
|
|
467
465
|
]);
|
|
468
466
|
let { virtualizerProps: virtualizerProps, scrollViewProps: { onVisibleRectChange: onVisibleRectChange } } = (0, $7lS7h$useVirtualizer)(memoedVirtualizerProps, state, domRef);
|
|
469
|
-
let onVisibleRectChangeMemo = (0, $7lS7h$
|
|
467
|
+
let onVisibleRectChangeMemo = (0, $7lS7h$useCallback)((rect)=>{
|
|
468
|
+
setTableWidth(rect.width);
|
|
469
|
+
onVisibleRectChange(rect);
|
|
470
|
+
onVisibleRectChangeProp(rect);
|
|
471
|
+
}, [
|
|
470
472
|
onVisibleRectChange,
|
|
471
473
|
onVisibleRectChangeProp
|
|
472
474
|
]);
|
|
@@ -495,27 +497,27 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
495
497
|
bodyRef,
|
|
496
498
|
headerRef
|
|
497
499
|
]);
|
|
498
|
-
let resizerPosition = layout.
|
|
500
|
+
let resizerPosition = columnResizeState.resizingColumn != null ? layout.getLayoutInfo(columnResizeState.resizingColumn).rect.maxX - 2 : 0;
|
|
499
501
|
let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
|
|
500
502
|
// this should be fine, every movement of the resizer causes a rerender
|
|
501
503
|
// scrolling can cause it to lag for a moment, but it's always updated
|
|
502
504
|
let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.maxX;
|
|
503
505
|
let shouldHardCornerResizeCorner = resizerAtEdge && resizerInVisibleRegion;
|
|
504
506
|
// minimize re-render caused on Resizers by memoing this
|
|
505
|
-
let resizingColumnWidth =
|
|
507
|
+
let resizingColumnWidth = columnResizeState.resizingColumn != null ? columnResizeState.getColumnWidth(columnResizeState.resizingColumn) : 0;
|
|
506
508
|
let resizingColumn = (0, $7lS7h$useMemo)(()=>({
|
|
507
509
|
width: resizingColumnWidth,
|
|
508
|
-
key:
|
|
510
|
+
key: columnResizeState.resizingColumn
|
|
509
511
|
}), [
|
|
510
512
|
resizingColumnWidth,
|
|
511
|
-
|
|
513
|
+
columnResizeState.resizingColumn
|
|
512
514
|
]);
|
|
513
515
|
let mergedProps = (0, $7lS7h$mergeProps)(otherProps, virtualizerProps, isVirtualDragging && {
|
|
514
516
|
tabIndex: null
|
|
515
517
|
});
|
|
516
518
|
let firstColumn = collection.columns[0];
|
|
517
519
|
let scrollPadding = 0;
|
|
518
|
-
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding =
|
|
520
|
+
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
|
|
519
521
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$d288a7dd40372bc.Provider, {
|
|
520
522
|
value: resizingColumn
|
|
521
523
|
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusScope), null, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
@@ -532,7 +534,9 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
532
534
|
scrollPaddingInlineStart: scrollPadding
|
|
533
535
|
},
|
|
534
536
|
ref: headerRef
|
|
535
|
-
},
|
|
537
|
+
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $fc695d2eafc2b351$export$b517d84d4ad20b24).Provider, {
|
|
538
|
+
value: columnResizeState
|
|
539
|
+
}, state.visibleViews[0])), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$ScrollView), {
|
|
536
540
|
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-body', {
|
|
537
541
|
'focus-ring': isFocusVisible,
|
|
538
542
|
'spectrum-Table-body--resizerAtTableEdge': shouldHardCornerResizeCorner
|
|
@@ -563,7 +567,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
563
567
|
style: {
|
|
564
568
|
[direction === 'ltr' ? 'left' : 'right']: `${resizerPosition}px`,
|
|
565
569
|
height: `${Math.max(state.virtualizer.contentSize.height, state.virtualizer.visibleRect.height)}px`,
|
|
566
|
-
display:
|
|
570
|
+
display: columnResizeState.resizingColumn ? 'block' : 'none'
|
|
567
571
|
}
|
|
568
572
|
})))));
|
|
569
573
|
}
|
|
@@ -669,7 +673,8 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
|
|
|
669
673
|
let ref = (0, $7lS7h$useRef)(null);
|
|
670
674
|
let triggerRef = (0, $7lS7h$useRef)(null);
|
|
671
675
|
let resizingRef = (0, $7lS7h$useRef)(null);
|
|
672
|
-
let { state: state,
|
|
676
|
+
let { state: state, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, headerRowHovered: headerRowHovered, setIsInResizeMode: setIsInResizeMode, isEmpty: isEmpty, isInResizeMode: isInResizeMode, headerMenuOpen: headerMenuOpen, setHeaderMenuOpen: setHeaderMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
677
|
+
let columnResizeState = (0, $7lS7h$useContext)((0, $fc695d2eafc2b351$export$b517d84d4ad20b24));
|
|
673
678
|
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
674
679
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
|
|
675
680
|
isDisabled: isEmpty
|
|
@@ -698,7 +703,7 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
|
|
|
698
703
|
state.sort(column.key, 'descending');
|
|
699
704
|
break;
|
|
700
705
|
case 'resize':
|
|
701
|
-
|
|
706
|
+
columnResizeState.startResize(column.key);
|
|
702
707
|
setIsInResizeMode(true);
|
|
703
708
|
state.setKeyboardNavigationDisabled(true);
|
|
704
709
|
break;
|
|
@@ -725,7 +730,7 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
|
|
|
725
730
|
}, [
|
|
726
731
|
allowsSorting
|
|
727
732
|
]);
|
|
728
|
-
let resizingColumn =
|
|
733
|
+
let resizingColumn = columnResizeState.resizingColumn;
|
|
729
734
|
let showResizer = !isEmpty && (headerRowHovered && (0, $7lS7h$getInteractionModality)() !== 'keyboard' || resizingColumn != null);
|
|
730
735
|
let alignment = 'start';
|
|
731
736
|
let menuAlign = 'start';
|
|
@@ -790,7 +795,7 @@ function $bd013581c0a4b065$var$ResizableTableColumnHeader(props) {
|
|
|
790
795
|
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $cb7d341e8868d81d$export$d9658cdf8c86807), null)))));
|
|
791
796
|
}
|
|
792
797
|
function $bd013581c0a4b065$var$TableSelectAllCell({ column: column }) {
|
|
793
|
-
let ref = (0, $7lS7h$useRef)();
|
|
798
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
794
799
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
795
800
|
let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
|
|
796
801
|
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
@@ -822,7 +827,7 @@ function $bd013581c0a4b065$var$TableSelectAllCell({ column: column }) {
|
|
|
822
827
|
})));
|
|
823
828
|
}
|
|
824
829
|
function $bd013581c0a4b065$var$TableDragHeaderCell({ column: column }) {
|
|
825
|
-
let ref = (0, $7lS7h$useRef)();
|
|
830
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
826
831
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
827
832
|
let { columnHeaderProps: columnHeaderProps } = (0, $7lS7h$useTableColumnHeader)({
|
|
828
833
|
node: column,
|
|
@@ -872,7 +877,7 @@ function $bd013581c0a4b065$export$cd7c5802f9e21187() {
|
|
|
872
877
|
}
|
|
873
878
|
function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
874
879
|
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer;
|
|
875
|
-
let ref = (0, $7lS7h$useRef)();
|
|
880
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
876
881
|
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
877
882
|
let isSelected = state.selectionManager.isSelected(item.key);
|
|
878
883
|
let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $7lS7h$useTableRow)({
|
|
@@ -914,7 +919,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
|
|
|
914
919
|
let droppableItem;
|
|
915
920
|
let isDropTarget;
|
|
916
921
|
let dropIndicator;
|
|
917
|
-
let dropIndicatorRef = (0, $7lS7h$useRef)();
|
|
922
|
+
let dropIndicatorRef = (0, $7lS7h$useRef)(undefined);
|
|
918
923
|
if (isTableDroppable) {
|
|
919
924
|
let target = {
|
|
920
925
|
type: 'item',
|
|
@@ -927,7 +932,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
|
|
|
927
932
|
target: target
|
|
928
933
|
}, dropState, dropIndicatorRef);
|
|
929
934
|
}
|
|
930
|
-
let dragButtonRef = (0, $7lS7h$react).useRef();
|
|
935
|
+
let dragButtonRef = (0, $7lS7h$react).useRef(undefined);
|
|
931
936
|
let { buttonProps: dragButtonProps } = (0, $7lS7h$useButton)({
|
|
932
937
|
...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
|
|
933
938
|
elementType: 'div'
|
|
@@ -997,7 +1002,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layout
|
|
|
997
1002
|
}
|
|
998
1003
|
function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
|
|
999
1004
|
let { state: state, headerMenuOpen: headerMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1000
|
-
let ref = (0, $7lS7h$useRef)();
|
|
1005
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
1001
1006
|
let { rowProps: rowProps } = (0, $7lS7h$useTableHeaderRow)({
|
|
1002
1007
|
node: item,
|
|
1003
1008
|
isVirtualized: true
|
|
@@ -1014,7 +1019,7 @@ function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children,
|
|
|
1014
1019
|
}, children);
|
|
1015
1020
|
}
|
|
1016
1021
|
function $bd013581c0a4b065$var$TableDragCell({ cell: cell }) {
|
|
1017
|
-
let ref = (0, $7lS7h$useRef)();
|
|
1022
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
1018
1023
|
let { state: state, isTableDraggable: isTableDraggable } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1019
1024
|
let isDisabled = state.disabledKeys.has(cell.parentKey);
|
|
1020
1025
|
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
@@ -1032,7 +1037,7 @@ function $bd013581c0a4b065$var$TableDragCell({ cell: cell }) {
|
|
|
1032
1037
|
}, isTableDraggable && !isDisabled && /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$DragButton, null)));
|
|
1033
1038
|
}
|
|
1034
1039
|
function $bd013581c0a4b065$var$TableCheckboxCell({ cell: cell }) {
|
|
1035
|
-
let ref = (0, $7lS7h$useRef)();
|
|
1040
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
1036
1041
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1037
1042
|
let isDisabled = state.disabledKeys.has(cell.parentKey);
|
|
1038
1043
|
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
@@ -1061,7 +1066,7 @@ function $bd013581c0a4b065$var$TableCell({ cell: cell }) {
|
|
|
1061
1066
|
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
1062
1067
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1063
1068
|
let isExpandableTable = 'expandedKeys' in state;
|
|
1064
|
-
let ref = (0, $7lS7h$useRef)();
|
|
1069
|
+
let ref = (0, $7lS7h$useRef)(undefined);
|
|
1065
1070
|
let columnProps = cell.column.props;
|
|
1066
1071
|
let isDisabled = state.disabledKeys.has(cell.parentKey);
|
|
1067
1072
|
let { gridCellProps: gridCellProps } = (0, $7lS7h$useTableCell)({
|
|
@@ -1138,7 +1143,7 @@ function $bd013581c0a4b065$var$ExpandableRowChevron({ cell: cell }) {
|
|
|
1138
1143
|
// TODO: move some/all of the chevron button setup into a separate hook?
|
|
1139
1144
|
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
1140
1145
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1141
|
-
let expandButtonRef = (0, $7lS7h$useRef)();
|
|
1146
|
+
let expandButtonRef = (0, $7lS7h$useRef)(undefined);
|
|
1142
1147
|
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
1143
1148
|
let isExpanded;
|
|
1144
1149
|
if ('expandedKeys' in state) isExpanded = state.expandedKeys === 'all' || state.expandedKeys.has(cell.parentKey);
|