@react-spectrum/table 3.12.11-nightly.4649 → 3.12.11-nightly.4656
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/TableViewBase.main.js +113 -97
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +115 -99
- package/dist/TableViewBase.module.js +115 -99
- package/dist/TableViewBase.module.js.map +1 -1
- package/package.json +29 -29
- package/src/TableViewBase.tsx +157 -117
|
@@ -18,11 +18,11 @@ var $idLTj$reactspectrumutils = require("@react-spectrum/utils");
|
|
|
18
18
|
var $idLTj$reactariafocus = require("@react-aria/focus");
|
|
19
19
|
var $idLTj$reactariainteractions = require("@react-aria/interactions");
|
|
20
20
|
var $idLTj$reactspectrummenu = require("@react-spectrum/menu");
|
|
21
|
+
var $idLTj$reactstatelyvirtualizer = require("@react-stately/virtualizer");
|
|
21
22
|
var $idLTj$reactariavirtualizer = require("@react-aria/virtualizer");
|
|
22
23
|
var $idLTj$spectrumiconsuiListGripper = require("@spectrum-icons/ui/ListGripper");
|
|
23
24
|
var $idLTj$reactspectrumprogress = require("@react-spectrum/progress");
|
|
24
25
|
var $idLTj$react = require("react");
|
|
25
|
-
var $idLTj$reactstatelyvirtualizer = require("@react-stately/virtualizer");
|
|
26
26
|
var $idLTj$reactstatelytable = require("@react-stately/table");
|
|
27
27
|
var $idLTj$reactstatelylayout = require("@react-stately/layout");
|
|
28
28
|
var $idLTj$reactspectrumtooltip = require("@react-spectrum/tooltip");
|
|
@@ -145,7 +145,6 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
145
145
|
state
|
|
146
146
|
]);
|
|
147
147
|
let { styleProps: styleProps } = (0, $idLTj$reactspectrumutils.useStyleProps)(props);
|
|
148
|
-
let { direction: direction } = (0, $idLTj$reactariai18n.useLocale)();
|
|
149
148
|
let { scale: scale } = (0, $idLTj$reactspectrumprovider.useProvider)();
|
|
150
149
|
const getDefaultWidth = (0, $idLTj$react.useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
151
150
|
if (hideHeader) {
|
|
@@ -176,7 +175,6 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
176
175
|
let domRef = (0, $idLTj$reactspectrumutils.useDOMRef)(ref);
|
|
177
176
|
let headerRef = (0, $idLTj$react.useRef)();
|
|
178
177
|
let bodyRef = (0, $idLTj$react.useRef)();
|
|
179
|
-
let stringFormatter = (0, $idLTj$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($1a3d6ad53eb75d54$exports))), '@react-spectrum/table');
|
|
180
178
|
let density = props.density || 'regular';
|
|
181
179
|
let columnLayout = (0, $idLTj$react.useMemo)(()=>new (0, $idLTj$reactstatelytable.TableColumnLayout)({
|
|
182
180
|
getDefaultWidth: getDefaultWidth,
|
|
@@ -245,61 +243,43 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
245
243
|
...props,
|
|
246
244
|
isVirtualized: true,
|
|
247
245
|
layout: layout,
|
|
248
|
-
onRowAction: onAction
|
|
246
|
+
onRowAction: onAction,
|
|
247
|
+
scrollRef: bodyRef
|
|
249
248
|
}, state, domRef);
|
|
250
249
|
let [headerMenuOpen, setHeaderMenuOpen] = (0, $idLTj$react.useState)(false);
|
|
251
250
|
let [headerRowHovered, setHeaderRowHovered] = (0, $idLTj$react.useState)(false);
|
|
252
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
253
|
-
let style = (0, $idLTj$reactariavirtualizer.layoutInfoToStyle)(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
|
|
254
|
-
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
251
|
+
let renderWrapper = (0, $idLTj$react.useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
255
252
|
if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableRowGroup, {
|
|
256
253
|
key: reusableView.key,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}), renderChildren(children));
|
|
254
|
+
layoutInfo: reusableView.layoutInfo,
|
|
255
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
256
|
+
}, renderChildren(children));
|
|
261
257
|
if (reusableView.viewType === 'header') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableHeader, {
|
|
262
258
|
key: reusableView.key,
|
|
263
|
-
|
|
259
|
+
layoutInfo: reusableView.layoutInfo,
|
|
260
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
264
261
|
}, renderChildren(children));
|
|
265
262
|
if (reusableView.viewType === 'row') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableRow, {
|
|
266
263
|
key: reusableView.key,
|
|
267
264
|
item: reusableView.content,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
isTableDroppable: isTableDroppable,
|
|
271
|
-
isTableDraggable: isTableDraggable
|
|
265
|
+
layoutInfo: reusableView.layoutInfo,
|
|
266
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
272
267
|
}, renderChildren(children));
|
|
273
268
|
if (reusableView.viewType === 'headerrow') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableHeaderRow, {
|
|
274
269
|
onHoverChange: setHeaderRowHovered,
|
|
275
270
|
key: reusableView.key,
|
|
276
|
-
|
|
271
|
+
layoutInfo: reusableView.layoutInfo,
|
|
272
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
277
273
|
item: reusableView.content
|
|
278
274
|
}, renderChildren(children));
|
|
279
|
-
|
|
280
|
-
let isRootDroptarget;
|
|
281
|
-
if (isTableDroppable) {
|
|
282
|
-
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
283
|
-
type: 'item',
|
|
284
|
-
dropPosition: 'on',
|
|
285
|
-
key: parent.content.key
|
|
286
|
-
});
|
|
287
|
-
isRootDroptarget = dropState.isDropTarget({
|
|
288
|
-
type: 'root'
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariavirtualizer.VirtualizerItem), {
|
|
275
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableCellWrapper, {
|
|
292
276
|
key: reusableView.key,
|
|
293
277
|
layoutInfo: reusableView.layoutInfo,
|
|
294
278
|
virtualizer: reusableView.virtualizer,
|
|
295
|
-
parent: parent
|
|
296
|
-
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-cellWrapper', (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($4afcd54cfd94dbb9$exports))), {
|
|
297
|
-
'react-spectrum-Table-cellWrapper': !reusableView.layoutInfo.estimatedSize,
|
|
298
|
-
'react-spectrum-Table-cellWrapper--dropTarget': isDropTarget || isRootDroptarget
|
|
299
|
-
}))
|
|
279
|
+
parent: parent
|
|
300
280
|
}, reusableView.rendered);
|
|
301
|
-
};
|
|
302
|
-
let renderView = (type, item)=>{
|
|
281
|
+
}, []);
|
|
282
|
+
let renderView = (0, $idLTj$react.useCallback)((type, item)=>{
|
|
303
283
|
switch(type){
|
|
304
284
|
case 'header':
|
|
305
285
|
case 'rowgroup':
|
|
@@ -341,25 +321,17 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
341
321
|
placement: "top"
|
|
342
322
|
}, item.rendered));
|
|
343
323
|
if (item.props.allowsResizing && !item.hasChildNodes) return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$ResizableTableColumnHeader, {
|
|
344
|
-
tableRef: domRef,
|
|
345
324
|
column: item
|
|
346
325
|
});
|
|
347
326
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableColumnHeader, {
|
|
348
327
|
column: item
|
|
349
328
|
});
|
|
350
329
|
case 'loader':
|
|
351
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$
|
|
352
|
-
isIndeterminate: true,
|
|
353
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
|
|
354
|
-
}));
|
|
330
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$LoadingState, null);
|
|
355
331
|
case 'empty':
|
|
356
|
-
|
|
357
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
358
|
-
if (emptyState == null) return null;
|
|
359
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$CenteredWrapper, null, emptyState);
|
|
360
|
-
}
|
|
332
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$EmptyState, null);
|
|
361
333
|
}
|
|
362
|
-
};
|
|
334
|
+
}, []);
|
|
363
335
|
let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = (0, $idLTj$react.useState)(false);
|
|
364
336
|
let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = (0, $idLTj$react.useState)(false);
|
|
365
337
|
let viewport = (0, $idLTj$react.useRef)({
|
|
@@ -420,7 +392,8 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
420
392
|
isEmpty: isEmpty,
|
|
421
393
|
onFocusedResizer: onFocusedResizer,
|
|
422
394
|
headerMenuOpen: headerMenuOpen,
|
|
423
|
-
setHeaderMenuOpen: setHeaderMenuOpen
|
|
395
|
+
setHeaderMenuOpen: setHeaderMenuOpen,
|
|
396
|
+
renderEmptyState: props.renderEmptyState
|
|
424
397
|
}
|
|
425
398
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableVirtualizer, {
|
|
426
399
|
...mergedProps,
|
|
@@ -432,7 +405,9 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
432
405
|
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
433
406
|
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
434
407
|
}, (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($4afcd54cfd94dbb9$exports))), 'react-spectrum-Table'), styleProps.className),
|
|
435
|
-
layout
|
|
408
|
+
// This should be `tableLayout` rather than `layout` so it doesn't
|
|
409
|
+
// change objects and invalidate virtualizer.
|
|
410
|
+
layout: tableLayout,
|
|
436
411
|
collection: state.collection,
|
|
437
412
|
focusedKey: focusedKey,
|
|
438
413
|
renderView: renderView,
|
|
@@ -468,10 +443,6 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
468
443
|
let loadingState = collection.body.props.loadingState;
|
|
469
444
|
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
470
445
|
let onLoadMore = collection.body.props.onLoadMore;
|
|
471
|
-
let transitionDuration = 220;
|
|
472
|
-
if (isLoading) transitionDuration = 160;
|
|
473
|
-
if (layout.resizingColumn != null) // while resizing, prop changes should not cause animations
|
|
474
|
-
transitionDuration = 0;
|
|
475
446
|
let state = (0, $idLTj$reactstatelyvirtualizer.useVirtualizerState)({
|
|
476
447
|
layout: layout,
|
|
477
448
|
collection: collection,
|
|
@@ -481,44 +452,28 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
481
452
|
bodyRef.current.scrollTop = rect.y;
|
|
482
453
|
(0, $idLTj$reactariavirtualizer.setScrollLeft)(bodyRef.current, direction, rect.x);
|
|
483
454
|
},
|
|
484
|
-
|
|
455
|
+
persistedKeys: (0, $idLTj$react.useMemo)(()=>focusedKey ? new Set([
|
|
456
|
+
focusedKey
|
|
457
|
+
]) : new Set(), [
|
|
458
|
+
focusedKey
|
|
459
|
+
])
|
|
485
460
|
});
|
|
486
|
-
let scrollToItem = (0, $idLTj$react.useCallback)((key)=>{
|
|
487
|
-
let item = collection.getItem(key);
|
|
488
|
-
let column = collection.columns[0];
|
|
489
|
-
let virtualizer = state.virtualizer;
|
|
490
|
-
virtualizer.scrollToItem(key, {
|
|
491
|
-
duration: 0,
|
|
492
|
-
// Prevent scrolling to the top when clicking on column headers.
|
|
493
|
-
shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
|
|
494
|
-
// Offset scroll position by width of selection cell
|
|
495
|
-
// (which is sticky and will overlap the cell we're scrolling to).
|
|
496
|
-
offsetX: column.props.isSelectionCell || column.props.isDragButtonCell ? layout.getColumnWidth(column.key) : 0
|
|
497
|
-
});
|
|
498
|
-
// Sync the scroll positions of the column headers and the body so scrollIntoViewport can
|
|
499
|
-
// properly decide if the column is outside the viewport or not
|
|
500
|
-
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
501
|
-
}, [
|
|
502
|
-
collection,
|
|
503
|
-
bodyRef,
|
|
504
|
-
headerRef,
|
|
505
|
-
layout,
|
|
506
|
-
state.virtualizer
|
|
507
|
-
]);
|
|
508
461
|
let memoedVirtualizerProps = (0, $idLTj$react.useMemo)(()=>({
|
|
509
462
|
tabIndex: otherProps.tabIndex,
|
|
510
463
|
focusedKey: focusedKey,
|
|
511
|
-
scrollToItem: scrollToItem,
|
|
512
464
|
isLoading: isLoading,
|
|
513
465
|
onLoadMore: onLoadMore
|
|
514
466
|
}), [
|
|
515
467
|
otherProps.tabIndex,
|
|
516
468
|
focusedKey,
|
|
517
|
-
scrollToItem,
|
|
518
469
|
isLoading,
|
|
519
470
|
onLoadMore
|
|
520
471
|
]);
|
|
521
472
|
let { virtualizerProps: virtualizerProps, scrollViewProps: { onVisibleRectChange: onVisibleRectChange } } = (0, $idLTj$reactariavirtualizer.useVirtualizer)(memoedVirtualizerProps, state, domRef);
|
|
473
|
+
let onVisibleRectChangeMemo = (0, $idLTj$react.useMemo)(()=>(0, $idLTj$reactariautils.chain)(onVisibleRectChange, onVisibleRectChangeProp), [
|
|
474
|
+
onVisibleRectChange,
|
|
475
|
+
onVisibleRectChangeProp
|
|
476
|
+
]);
|
|
522
477
|
// this effect runs whenever the contentSize changes, it doesn't matter what the content size is
|
|
523
478
|
// only that it changes in a resize, and when that happens, we want to sync the body to the
|
|
524
479
|
// header scroll position
|
|
@@ -562,6 +517,9 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
562
517
|
let mergedProps = (0, $idLTj$reactariautils.mergeProps)(otherProps, virtualizerProps, isVirtualDragging && {
|
|
563
518
|
tabIndex: null
|
|
564
519
|
});
|
|
520
|
+
let firstColumn = collection.columns[0];
|
|
521
|
+
let scrollPadding = 0;
|
|
522
|
+
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = layout.getColumnWidth(firstColumn.key);
|
|
565
523
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$export$d288a7dd40372bc.Provider, {
|
|
566
524
|
value: resizingColumn
|
|
567
525
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariafocus.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
@@ -575,7 +533,7 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
575
533
|
overflow: 'hidden',
|
|
576
534
|
position: 'relative',
|
|
577
535
|
willChange: state.isScrolling ? 'scroll-position' : undefined,
|
|
578
|
-
|
|
536
|
+
scrollPaddingInlineStart: scrollPadding
|
|
579
537
|
},
|
|
580
538
|
ref: headerRef
|
|
581
539
|
}, state.visibleViews[0]), /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariavirtualizer.ScrollView), {
|
|
@@ -588,15 +546,15 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
588
546
|
})),
|
|
589
547
|
tabIndex: isVirtualDragging ? null : -1,
|
|
590
548
|
style: {
|
|
591
|
-
flex: 1
|
|
549
|
+
flex: 1,
|
|
550
|
+
scrollPaddingInlineStart: scrollPadding
|
|
592
551
|
},
|
|
593
552
|
innerStyle: {
|
|
594
|
-
overflow: 'visible'
|
|
595
|
-
transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
|
|
553
|
+
overflow: 'visible'
|
|
596
554
|
},
|
|
597
555
|
ref: bodyRef,
|
|
598
556
|
contentSize: state.contentSize,
|
|
599
|
-
onVisibleRectChange:
|
|
557
|
+
onVisibleRectChange: onVisibleRectChangeMemo,
|
|
600
558
|
onScrollStart: state.startScrolling,
|
|
601
559
|
onScrollEnd: state.endScrolling,
|
|
602
560
|
onScroll: onScroll
|
|
@@ -609,12 +567,20 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
609
567
|
}
|
|
610
568
|
})))));
|
|
611
569
|
}
|
|
612
|
-
function $e39c6de4eb69450d$var$
|
|
570
|
+
function $e39c6de4eb69450d$var$useStyle(layoutInfo, parent) {
|
|
571
|
+
let { direction: direction } = (0, $idLTj$reactariai18n.useLocale)();
|
|
572
|
+
let style = (0, $idLTj$reactariavirtualizer.layoutInfoToStyle)(layoutInfo, direction, parent);
|
|
573
|
+
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
574
|
+
return style;
|
|
575
|
+
}
|
|
576
|
+
function $e39c6de4eb69450d$var$TableHeader({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
613
577
|
let { rowGroupProps: rowGroupProps } = (0, $idLTj$reactariatable.useTableRowGroup)();
|
|
578
|
+
let style = $e39c6de4eb69450d$var$useStyle(layoutInfo, parent);
|
|
614
579
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
615
580
|
...rowGroupProps,
|
|
616
581
|
...otherProps,
|
|
617
|
-
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-head')
|
|
582
|
+
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-head'),
|
|
583
|
+
style: style
|
|
618
584
|
}, children);
|
|
619
585
|
}
|
|
620
586
|
function $e39c6de4eb69450d$var$TableColumnHeader(props) {
|
|
@@ -871,12 +837,17 @@ function $e39c6de4eb69450d$var$TableDragHeaderCell({ column: column }) {
|
|
|
871
837
|
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-headCell', (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($4afcd54cfd94dbb9$exports))), 'react-spectrum-Table-headCell', 'react-spectrum-Table-dragButtonHeadCell'))
|
|
872
838
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariavisuallyhidden.VisuallyHidden), null, stringFormatter.format('drag'))));
|
|
873
839
|
}
|
|
874
|
-
function $e39c6de4eb69450d$var$TableRowGroup({ children: children, ...otherProps }) {
|
|
840
|
+
function $e39c6de4eb69450d$var$TableRowGroup({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
875
841
|
let { rowGroupProps: rowGroupProps } = (0, $idLTj$reactariatable.useTableRowGroup)();
|
|
842
|
+
let { isTableDroppable: isTableDroppable } = (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$93e4b0b2cc49b648);
|
|
843
|
+
let style = $e39c6de4eb69450d$var$useStyle(layoutInfo, parent);
|
|
876
844
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
877
845
|
...rowGroupProps,
|
|
846
|
+
style: style,
|
|
878
847
|
...otherProps
|
|
879
|
-
},
|
|
848
|
+
}, isTableDroppable && /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $4a98adf416b1ae5d$exports.RootDropIndicator), {
|
|
849
|
+
key: "root"
|
|
850
|
+
}), children);
|
|
880
851
|
}
|
|
881
852
|
function $e39c6de4eb69450d$var$DragButton() {
|
|
882
853
|
let { dragButtonProps: dragButtonProps, dragButtonRef: dragButtonRef, isFocusVisibleWithin: isFocusVisibleWithin } = $e39c6de4eb69450d$export$cd7c5802f9e21187();
|
|
@@ -899,19 +870,18 @@ const $e39c6de4eb69450d$var$TableRowContext = /*#__PURE__*/ (0, ($parcel$interop
|
|
|
899
870
|
function $e39c6de4eb69450d$export$cd7c5802f9e21187() {
|
|
900
871
|
return (0, $idLTj$react.useContext)($e39c6de4eb69450d$var$TableRowContext);
|
|
901
872
|
}
|
|
902
|
-
function $e39c6de4eb69450d$var$TableRow({ item: item, children: children,
|
|
873
|
+
function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
903
874
|
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer;
|
|
904
875
|
let ref = (0, $idLTj$react.useRef)();
|
|
905
|
-
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, dragState: dragState, dropState: dropState } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
906
|
-
let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
|
|
907
|
-
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
908
|
-
let isDroppable = isTableDroppable && !isDisabled;
|
|
876
|
+
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
909
877
|
let isSelected = state.selectionManager.isSelected(item.key);
|
|
910
|
-
let { rowProps: rowProps } = (0, $idLTj$reactariatable.useTableRow)({
|
|
878
|
+
let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $idLTj$reactariatable.useTableRow)({
|
|
911
879
|
node: item,
|
|
912
880
|
isVirtualized: true,
|
|
913
881
|
shouldSelectOnPressUp: isTableDraggable
|
|
914
882
|
}, state, ref);
|
|
883
|
+
let isDisabled = !allowsSelection && !hasAction;
|
|
884
|
+
let isDroppable = isTableDroppable && !isDisabled;
|
|
915
885
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $idLTj$reactariainteractions.usePress)({
|
|
916
886
|
isDisabled: isDisabled
|
|
917
887
|
});
|
|
@@ -930,7 +900,7 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, hasAct
|
|
|
930
900
|
// border corners of the last row when selected.
|
|
931
901
|
let isFlushWithContainerBottom = false;
|
|
932
902
|
if (isLastRow) {
|
|
933
|
-
if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.
|
|
903
|
+
if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
|
|
934
904
|
}
|
|
935
905
|
let draggableItem;
|
|
936
906
|
if (isTableDraggable) {
|
|
@@ -962,7 +932,10 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, hasAct
|
|
|
962
932
|
...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
|
|
963
933
|
elementType: 'div'
|
|
964
934
|
}, dragButtonRef);
|
|
965
|
-
let
|
|
935
|
+
let style = $e39c6de4eb69450d$var$useStyle(layoutInfo, parent);
|
|
936
|
+
let props = (0, $idLTj$reactariautils.mergeProps)(rowProps, otherProps, {
|
|
937
|
+
style: style
|
|
938
|
+
}, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
|
|
966
939
|
// allowing for single swipe navigation between row drop indicator
|
|
967
940
|
(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
|
|
968
941
|
tabIndex: null
|
|
@@ -1022,7 +995,7 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, hasAct
|
|
|
1022
995
|
}
|
|
1023
996
|
}));
|
|
1024
997
|
}
|
|
1025
|
-
function $e39c6de4eb69450d$var$TableHeaderRow({ item: item, children: children,
|
|
998
|
+
function $e39c6de4eb69450d$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
|
|
1026
999
|
let { state: state, headerMenuOpen: headerMenuOpen } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1027
1000
|
let ref = (0, $idLTj$react.useRef)();
|
|
1028
1001
|
let { rowProps: rowProps } = (0, $idLTj$reactariatable.useTableHeaderRow)({
|
|
@@ -1033,6 +1006,7 @@ function $e39c6de4eb69450d$var$TableHeaderRow({ item: item, children: children,
|
|
|
1033
1006
|
...props,
|
|
1034
1007
|
isDisabled: headerMenuOpen
|
|
1035
1008
|
});
|
|
1009
|
+
let style = $e39c6de4eb69450d$var$useStyle(layoutInfo, parent);
|
|
1036
1010
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
1037
1011
|
...(0, $idLTj$reactariautils.mergeProps)(rowProps, hoverProps),
|
|
1038
1012
|
ref: ref,
|
|
@@ -1132,6 +1106,34 @@ function $e39c6de4eb69450d$var$TableCell({ cell: cell }) {
|
|
|
1132
1106
|
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-cellContents')
|
|
1133
1107
|
}, cell.rendered)));
|
|
1134
1108
|
}
|
|
1109
|
+
function $e39c6de4eb69450d$var$TableCellWrapper({ layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children }) {
|
|
1110
|
+
let { isTableDroppable: isTableDroppable, dropState: dropState } = (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$93e4b0b2cc49b648);
|
|
1111
|
+
let isDropTarget;
|
|
1112
|
+
let isRootDroptarget;
|
|
1113
|
+
if (isTableDroppable) {
|
|
1114
|
+
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
1115
|
+
type: 'item',
|
|
1116
|
+
dropPosition: 'on',
|
|
1117
|
+
key: parent.content.key
|
|
1118
|
+
});
|
|
1119
|
+
isRootDroptarget = dropState.isDropTarget({
|
|
1120
|
+
type: 'root'
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariavirtualizer.VirtualizerItem), {
|
|
1124
|
+
layoutInfo: layoutInfo,
|
|
1125
|
+
virtualizer: virtualizer,
|
|
1126
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
1127
|
+
className: (0, $idLTj$react.useMemo)(()=>(0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-cellWrapper', (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($4afcd54cfd94dbb9$exports))), {
|
|
1128
|
+
'react-spectrum-Table-cellWrapper': !layoutInfo.estimatedSize,
|
|
1129
|
+
'react-spectrum-Table-cellWrapper--dropTarget': isDropTarget || isRootDroptarget
|
|
1130
|
+
})), [
|
|
1131
|
+
layoutInfo.estimatedSize,
|
|
1132
|
+
isDropTarget,
|
|
1133
|
+
isRootDroptarget
|
|
1134
|
+
])
|
|
1135
|
+
}, children);
|
|
1136
|
+
}
|
|
1135
1137
|
function $e39c6de4eb69450d$var$ExpandableRowChevron({ cell: cell }) {
|
|
1136
1138
|
// TODO: move some/all of the chevron button setup into a separate hook?
|
|
1137
1139
|
let { direction: direction } = (0, $idLTj$reactariai18n.useLocale)();
|
|
@@ -1163,6 +1165,20 @@ function $e39c6de4eb69450d$var$ExpandableRowChevron({ cell: cell }) {
|
|
|
1163
1165
|
})
|
|
1164
1166
|
}, direction === 'ltr' ? /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, ($parcel$interopDefault($idLTj$spectrumiconsuiChevronRightMedium))), null) : /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, ($parcel$interopDefault($idLTj$spectrumiconsuiChevronLeftMedium))), null));
|
|
1165
1167
|
}
|
|
1168
|
+
function $e39c6de4eb69450d$var$LoadingState() {
|
|
1169
|
+
let { state: state } = (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$93e4b0b2cc49b648);
|
|
1170
|
+
let stringFormatter = (0, $idLTj$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($1a3d6ad53eb75d54$exports))), '@react-spectrum/table');
|
|
1171
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$CenteredWrapper, null, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactspectrumprogress.ProgressCircle), {
|
|
1172
|
+
isIndeterminate: true,
|
|
1173
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
|
|
1174
|
+
}));
|
|
1175
|
+
}
|
|
1176
|
+
function $e39c6de4eb69450d$var$EmptyState() {
|
|
1177
|
+
let { renderEmptyState: renderEmptyState } = (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$93e4b0b2cc49b648);
|
|
1178
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
1179
|
+
if (emptyState == null) return null;
|
|
1180
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$CenteredWrapper, null, emptyState);
|
|
1181
|
+
}
|
|
1166
1182
|
function $e39c6de4eb69450d$var$CenteredWrapper({ children: children }) {
|
|
1167
1183
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1168
1184
|
let rowProps;
|