@react-spectrum/table 3.1.7-nightly.3271 → 3.2.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/main.js CHANGED
@@ -5,14 +5,12 @@ var $3fpzo$reactariautils = require("@react-aria/utils");
5
5
  var $3fpzo$reactspectrumcheckbox = require("@react-spectrum/checkbox");
6
6
  var $3fpzo$reactspectrumutils = require("@react-spectrum/utils");
7
7
  var $3fpzo$reactariafocus = require("@react-aria/focus");
8
- var $3fpzo$reactspectrummenu = require("@react-spectrum/menu");
9
8
  var $3fpzo$reactariavirtualizer = require("@react-aria/virtualizer");
10
9
  var $3fpzo$reactspectrumprogress = require("@react-spectrum/progress");
11
10
  var $3fpzo$react = require("react");
12
11
  var $3fpzo$reactstatelyvirtualizer = require("@react-stately/virtualizer");
13
12
  var $3fpzo$reactstatelylayout = require("@react-stately/layout");
14
13
  var $3fpzo$reactspectrumtooltip = require("@react-spectrum/tooltip");
15
- var $3fpzo$reactariabutton = require("@react-aria/button");
16
14
  var $3fpzo$reactariainteractions = require("@react-aria/interactions");
17
15
  var $3fpzo$reactariai18n = require("@react-aria/i18n");
18
16
  var $3fpzo$reactspectrumprovider = require("@react-spectrum/provider");
@@ -27,7 +25,7 @@ function $parcel$interopDefault(a) {
27
25
  }
28
26
 
29
27
  $parcel$export(module.exports, "Column", () => $4b0b515c47252574$export$816b5d811295e6bc);
30
- $parcel$export(module.exports, "TableView", () => $be8a9c035a82f788$export$b3c27e869d856b7);
28
+ $parcel$export(module.exports, "TableView", () => $26e105b1bd39d4b5$export$8790f9f1576000df);
31
29
  $parcel$export(module.exports, "TableHeader", () => $3fpzo$reactstatelytable.TableHeader);
32
30
  $parcel$export(module.exports, "TableBody", () => $3fpzo$reactstatelytable.TableBody);
33
31
  $parcel$export(module.exports, "Section", () => $3fpzo$reactstatelytable.Section);
@@ -218,10 +216,6 @@ $a89862f958371476$exports = {
218
216
 
219
217
 
220
218
 
221
-
222
-
223
-
224
-
225
219
  var $982885d0a34882ea$exports = {};
226
220
 
227
221
  $parcel$export($982885d0a34882ea$exports, "spectrum-Table", () => $982885d0a34882ea$export$455c59d2b5bafef0, (v) => $982885d0a34882ea$export$455c59d2b5bafef0 = v);
@@ -346,31 +340,6 @@ $982885d0a34882ea$export$d35bc1e505d1ebbf = "is-disabled_d0fc74";
346
340
  $982885d0a34882ea$export$53aa811f86efbfad = "is-next-selected_d0fc74";
347
341
 
348
342
 
349
-
350
-
351
- function $2877766f94c67a67$var$Resizer(props, ref) {
352
- const { item: item } = props;
353
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
354
- let { resizerProps: resizerProps } = $3fpzo$reactariatable.useTableColumnResize(state, item, ref);
355
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
356
- focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
357
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
358
- ref: ref,
359
- ...resizerProps,
360
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-columnResizer'),
361
- role: "separator",
362
- "aria-orientation": "vertical",
363
- "aria-label": "Resize column",
364
- "aria-labelledby": item.key,
365
- "aria-valuenow": state.getColumnWidth(item.key),
366
- "aria-valuemin": state.getColumnMinWidth(item.key),
367
- "aria-valuemax": state.getColumnMaxWidth(item.key)
368
- })));
369
- }
370
- const $2877766f94c67a67$export$48a76196cafe3b93 = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($2877766f94c67a67$var$Resizer);
371
-
372
-
373
-
374
343
  var $4afcd54cfd94dbb9$exports = {};
375
344
 
376
345
  $parcel$export($4afcd54cfd94dbb9$exports, "react-spectrum-Table", () => $4afcd54cfd94dbb9$export$8cc7e6e5f955c192, (v) => $4afcd54cfd94dbb9$export$8cc7e6e5f955c192 = v);
@@ -400,20 +369,6 @@ $4afcd54cfd94dbb9$export$8bffb31c98aaf8d5 = "react-spectrum-Table-centeredWrappe
400
369
 
401
370
 
402
371
 
403
-
404
-
405
-
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
-
416
-
417
372
 
418
373
 
419
374
 
@@ -467,7 +422,7 @@ function $26e105b1bd39d4b5$var$TableView_DEPRECATED(props, ref) {
467
422
  let formatMessage = $3fpzo$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($a89862f958371476$exports)));
468
423
  let { scale: scale } = $3fpzo$reactspectrumprovider.useProvider();
469
424
  let density = props.density || 'regular';
470
- let layout = $3fpzo$react.useMemo(()=>new $3fpzo$reactstatelylayout.TableLayout_DEPRECATED({
425
+ let layout = $3fpzo$react.useMemo(()=>new $3fpzo$reactstatelylayout.TableLayout({
471
426
  // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
472
427
  rowHeight: props.overflowMode === 'wrap' ? null : $26e105b1bd39d4b5$var$ROW_HEIGHTS[density][scale],
473
428
  estimatedRowHeight: props.overflowMode === 'wrap' ? $26e105b1bd39d4b5$var$ROW_HEIGHTS[density][scale] : null,
@@ -922,613 +877,6 @@ function $26e105b1bd39d4b5$var$CenteredWrapper({ children: children }) {
922
877
 
923
878
 
924
879
 
925
-
926
-
927
-
928
-
929
-
930
-
931
-
932
- const $be8a9c035a82f788$var$DEFAULT_HEADER_HEIGHT = {
933
- medium: 34,
934
- large: 40
935
- };
936
- const $be8a9c035a82f788$var$DEFAULT_HIDE_HEADER_CELL_WIDTH = {
937
- medium: 36,
938
- large: 44
939
- };
940
- const $be8a9c035a82f788$var$ROW_HEIGHTS = {
941
- compact: {
942
- medium: 32,
943
- large: 40
944
- },
945
- regular: {
946
- medium: 40,
947
- large: 50
948
- },
949
- spacious: {
950
- medium: 48,
951
- large: 60
952
- }
953
- };
954
- const $be8a9c035a82f788$var$SELECTION_CELL_DEFAULT_WIDTH = {
955
- medium: 38,
956
- large: 48
957
- };
958
- const $be8a9c035a82f788$var$TableContext = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createContext(null);
959
- function $be8a9c035a82f788$export$3cb274deb6c2d854() {
960
- return $3fpzo$react.useContext($be8a9c035a82f788$var$TableContext);
961
- }
962
- function $be8a9c035a82f788$var$TableView(props, ref) {
963
- props = $3fpzo$reactspectrumprovider.useProviderProps(props);
964
- let { isQuiet: isQuiet , onAction: onAction } = props;
965
- let { styleProps: styleProps } = $3fpzo$reactspectrumutils.useStyleProps(props);
966
- let [showSelectionCheckboxes, setShowSelectionCheckboxes] = $3fpzo$react.useState(props.selectionStyle !== 'highlight');
967
- let { scale: scale } = $3fpzo$reactspectrumprovider.useProvider();
968
- const getDefaultWidth = $3fpzo$react.useCallback(({ hideHeader: hideHeader , isSelectionCell: isSelectionCell , showDivider: showDivider })=>{
969
- if (hideHeader) {
970
- let width = $be8a9c035a82f788$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
971
- return showDivider ? width + 1 : width;
972
- } else if (isSelectionCell) return $be8a9c035a82f788$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
973
- }, [
974
- scale
975
- ]);
976
- let state = $3fpzo$reactstatelytable.useTableState({
977
- ...props,
978
- showSelectionCheckboxes: showSelectionCheckboxes,
979
- selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle',
980
- getDefaultWidth: getDefaultWidth
981
- });
982
- // If the selection behavior changes in state, we need to update showSelectionCheckboxes here due to the circular dependency...
983
- let shouldShowCheckboxes = state.selectionManager.selectionBehavior !== 'replace';
984
- if (shouldShowCheckboxes !== showSelectionCheckboxes) setShowSelectionCheckboxes(shouldShowCheckboxes);
985
- let domRef = $3fpzo$reactspectrumutils.useDOMRef(ref);
986
- let bodyRef = $3fpzo$react.useRef();
987
- let formatMessage = $3fpzo$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($a89862f958371476$exports)));
988
- let density = props.density || 'regular';
989
- let layout = $3fpzo$react.useMemo(()=>new $3fpzo$reactstatelylayout.TableLayout({
990
- // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
991
- rowHeight: props.overflowMode === 'wrap' ? null : $be8a9c035a82f788$var$ROW_HEIGHTS[density][scale],
992
- estimatedRowHeight: props.overflowMode === 'wrap' ? $be8a9c035a82f788$var$ROW_HEIGHTS[density][scale] : null,
993
- headingHeight: props.overflowMode === 'wrap' ? null : $be8a9c035a82f788$var$DEFAULT_HEADER_HEIGHT[scale],
994
- estimatedHeadingHeight: props.overflowMode === 'wrap' ? $be8a9c035a82f788$var$DEFAULT_HEADER_HEIGHT[scale] : null
995
- })
996
- , [
997
- props.overflowMode,
998
- scale,
999
- density
1000
- ]);
1001
- let { direction: direction } = $3fpzo$reactariai18n.useLocale();
1002
- layout.collection = state.collection;
1003
- layout.getColumnWidth = state.getColumnWidth;
1004
- let { gridProps: gridProps } = $3fpzo$reactariatable.useTable({
1005
- ...props,
1006
- isVirtualized: true,
1007
- layout: layout,
1008
- onRowAction: onAction
1009
- }, state, domRef);
1010
- let renderWrapper = (parent, reusableView, children, renderChildren)=>{
1011
- let style = $3fpzo$reactariavirtualizer.layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
1012
- if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
1013
- if (reusableView.viewType === 'rowgroup') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableRowGroup, {
1014
- key: reusableView.key,
1015
- style: style
1016
- }, renderChildren(children)));
1017
- if (reusableView.viewType === 'header') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableHeader, {
1018
- key: reusableView.key,
1019
- style: style
1020
- }, renderChildren(children)));
1021
- if (reusableView.viewType === 'row') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableRow, {
1022
- key: reusableView.key,
1023
- item: reusableView.content,
1024
- style: style,
1025
- hasActions: onAction
1026
- }, renderChildren(children)));
1027
- if (reusableView.viewType === 'headerrow') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableHeaderRow, {
1028
- key: reusableView.key,
1029
- style: style,
1030
- item: reusableView.content
1031
- }, renderChildren(children)));
1032
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavirtualizer.VirtualizerItem, {
1033
- key: reusableView.key,
1034
- reusableView: reusableView,
1035
- parent: parent,
1036
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cellWrapper', $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), {
1037
- 'react-spectrum-Table-cellWrapper': !reusableView.layoutInfo.estimatedSize
1038
- }))
1039
- }));
1040
- };
1041
- let renderView = (type, item)=>{
1042
- switch(type){
1043
- case 'header':
1044
- case 'rowgroup':
1045
- case 'section':
1046
- case 'row':
1047
- case 'headerrow':
1048
- return null;
1049
- case 'cell':
1050
- if (item.props.isSelectionCell) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableCheckboxCell, {
1051
- cell: item
1052
- }));
1053
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableCell, {
1054
- cell: item
1055
- }));
1056
- case 'placeholder':
1057
- // TODO: move to react-aria?
1058
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1059
- role: "gridcell",
1060
- "aria-colindex": item.index + 1,
1061
- "aria-colspan": item.colspan > 1 ? item.colspan : null
1062
- }));
1063
- case 'column':
1064
- if (item.props.isSelectionCell) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableSelectAllCell, {
1065
- column: item
1066
- }));
1067
- if (item.props.hideHeader) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumtooltip.TooltipTrigger, {
1068
- placement: "top",
1069
- trigger: "focus"
1070
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableColumnHeader, {
1071
- column: item
1072
- }), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumtooltip.Tooltip, {
1073
- placement: "top"
1074
- }, item.rendered)));
1075
- if (item.props.allowsResizing) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$ResizableTableColumnHeader, {
1076
- item: item,
1077
- state: state
1078
- }));
1079
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableColumnHeader, {
1080
- column: item
1081
- }));
1082
- case 'loader':
1083
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$CenteredWrapper, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumprogress.ProgressCircle, {
1084
- isIndeterminate: true,
1085
- "aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
1086
- })));
1087
- case 'empty':
1088
- {
1089
- let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
1090
- if (emptyState == null) return null;
1091
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$CenteredWrapper, null, emptyState));
1092
- }
1093
- }
1094
- };
1095
- let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = $3fpzo$react.useState(false);
1096
- let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = $3fpzo$react.useState(false);
1097
- let viewport = $3fpzo$react.useRef({
1098
- x: 0,
1099
- y: 0,
1100
- width: 0,
1101
- height: 0
1102
- });
1103
- let onVisibleRectChange = $3fpzo$react.useCallback((e)=>{
1104
- if (viewport.current.width === e.width && viewport.current.height === e.height) return;
1105
- viewport.current = e;
1106
- if (bodyRef.current) {
1107
- setVerticalScollbarVisible(bodyRef.current.clientWidth + 2 < bodyRef.current.offsetWidth);
1108
- setHorizontalScollbarVisible(bodyRef.current.clientHeight + 2 < bodyRef.current.offsetHeight);
1109
- }
1110
- }, []);
1111
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableContext.Provider, {
1112
- value: {
1113
- state: state,
1114
- layout: layout
1115
- }
1116
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableVirtualizer, {
1117
- ...gridProps,
1118
- ...styleProps,
1119
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table', `spectrum-Table--${density}`, {
1120
- 'spectrum-Table--quiet': isQuiet,
1121
- 'spectrum-Table--wrap': props.overflowMode === 'wrap',
1122
- 'spectrum-Table--loadingMore': state.collection.body.props.loadingState === 'loadingMore',
1123
- 'spectrum-Table--resizingColumn': state.isResizingColumn,
1124
- 'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
1125
- 'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
1126
- }, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table')),
1127
- layout: layout,
1128
- collection: state.collection,
1129
- focusedKey: state.selectionManager.focusedKey,
1130
- renderView: renderView,
1131
- renderWrapper: renderWrapper,
1132
- setTableWidth: state.setTableWidth,
1133
- onVisibleRectChange: onVisibleRectChange,
1134
- domRef: domRef,
1135
- bodyRef: bodyRef,
1136
- getColumnWidth: state.getColumnWidth
1137
- })));
1138
- }
1139
- // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
1140
- function $be8a9c035a82f788$var$TableVirtualizer({ layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , setTableWidth: setTableWidth , getColumnWidth: getColumnWidth , onVisibleRectChange: onVisibleRectChangeProp , ...otherProps }) {
1141
- var ref;
1142
- let { direction: direction } = $3fpzo$reactariai18n.useLocale();
1143
- let headerRef = $3fpzo$react.useRef();
1144
- let loadingState = collection.body.props.loadingState;
1145
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
1146
- let onLoadMore = collection.body.props.onLoadMore;
1147
- let state = $3fpzo$reactstatelyvirtualizer.useVirtualizerState({
1148
- layout: layout,
1149
- collection: collection,
1150
- renderView: renderView,
1151
- renderWrapper: renderWrapper,
1152
- onVisibleRectChange (rect) {
1153
- bodyRef.current.scrollTop = rect.y;
1154
- $3fpzo$reactariavirtualizer.setScrollLeft(bodyRef.current, direction, rect.x);
1155
- },
1156
- transitionDuration: isLoading ? 160 : 220
1157
- });
1158
- let { virtualizerProps: virtualizerProps } = $3fpzo$reactariavirtualizer.useVirtualizer({
1159
- focusedKey: focusedKey,
1160
- scrollToItem (key) {
1161
- let item = collection.getItem(key);
1162
- let column = collection.columns[0];
1163
- state.virtualizer.scrollToItem(key, {
1164
- duration: 0,
1165
- // Prevent scrolling to the top when clicking on column headers.
1166
- shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
1167
- // Offset scroll position by width of selection cell
1168
- // (which is sticky and will overlap the cell we're scrolling to).
1169
- offsetX: column.props.isSelectionCell ? layout.getColumnWidth(column.key) : 0
1170
- });
1171
- }
1172
- }, state, domRef);
1173
- // If columnwidths change, need to relayout.
1174
- $3fpzo$reactariautils.useLayoutEffect(()=>{
1175
- state.virtualizer.relayoutNow({
1176
- sizeChanged: true
1177
- });
1178
- }, [
1179
- getColumnWidth,
1180
- state.virtualizer
1181
- ]);
1182
- let headerHeight = ((ref = layout.getLayoutInfo('header')) === null || ref === void 0 ? void 0 : ref.rect.height) || 0;
1183
- let visibleRect = state.virtualizer.visibleRect;
1184
- // Sync the scroll position from the table body to the header container.
1185
- let onScroll = $3fpzo$react.useCallback(()=>{
1186
- headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
1187
- }, [
1188
- bodyRef
1189
- ]);
1190
- let onVisibleRectChange = $3fpzo$react.useCallback((rect)=>{
1191
- // setting the table width will recalculate column widths which we only want to do once the virtualizer is done initializing
1192
- if (state.virtualizer.contentSize.height > 0) setTableWidth(rect.width);
1193
- state.setVisibleRect(rect);
1194
- if (!isLoading && onLoadMore) {
1195
- let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
1196
- if (rect.y > scrollOffset) onLoadMore();
1197
- }
1198
- }, [
1199
- onLoadMore,
1200
- isLoading,
1201
- state.setVisibleRect,
1202
- state.virtualizer
1203
- ]);
1204
- $3fpzo$reactariautils.useLayoutEffect(()=>{
1205
- if (!isLoading && onLoadMore && !state.isAnimating) {
1206
- if (state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
1207
- }
1208
- }, [
1209
- state.contentSize,
1210
- state.virtualizer,
1211
- state.isAnimating,
1212
- onLoadMore,
1213
- isLoading
1214
- ]);
1215
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1216
- ...$3fpzo$reactariautils.mergeProps(otherProps, virtualizerProps),
1217
- ref: domRef
1218
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1219
- role: "presentation",
1220
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headWrapper'),
1221
- style: {
1222
- width: visibleRect.width,
1223
- height: headerHeight,
1224
- overflow: 'hidden',
1225
- position: 'relative',
1226
- willChange: state.isScrolling ? 'scroll-position' : '',
1227
- transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
1228
- },
1229
- ref: headerRef
1230
- }, state.visibleViews[0]), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavirtualizer.ScrollView, {
1231
- role: "presentation",
1232
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-body'),
1233
- style: {
1234
- flex: 1
1235
- },
1236
- innerStyle: {
1237
- overflow: 'visible',
1238
- transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
1239
- },
1240
- ref: bodyRef,
1241
- contentSize: state.contentSize,
1242
- onVisibleRectChange: $3fpzo$reactariautils.chain(onVisibleRectChange, onVisibleRectChangeProp),
1243
- onScrollStart: state.startScrolling,
1244
- onScrollEnd: state.endScrolling,
1245
- onScroll: onScroll
1246
- }, state.visibleViews[1])));
1247
- }
1248
- function $be8a9c035a82f788$var$TableHeader({ children: children , ...otherProps }) {
1249
- let { rowGroupProps: rowGroupProps } = $3fpzo$reactariatable.useTableRowGroup();
1250
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1251
- ...rowGroupProps,
1252
- ...otherProps,
1253
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-head')
1254
- }, children));
1255
- }
1256
- function $be8a9c035a82f788$var$TableColumnHeader(props) {
1257
- var ref, ref1, ref2, ref3;
1258
- let { column: column } = props;
1259
- let ref4 = $3fpzo$react.useRef();
1260
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1261
- let { columnHeaderProps: columnHeaderProps } = $3fpzo$reactariatable.useTableColumnHeader({
1262
- node: column,
1263
- isVirtualized: true
1264
- }, state, ref4);
1265
- let { buttonProps: buttonProps } = $3fpzo$reactariabutton.useButton({
1266
- ...props,
1267
- elementType: 'div'
1268
- }, ref4);
1269
- let columnProps = column.props;
1270
- if (columnProps.width && columnProps.allowsResizing) throw new Error('Controlled state is not yet supported with column resizing. Please use defaultWidth for uncontrolled column resizing or remove the allowsResizing prop.');
1271
- let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
1272
- });
1273
- const allProps = [
1274
- columnHeaderProps,
1275
- hoverProps
1276
- ];
1277
- if (columnProps.allowsResizing) allProps.push(buttonProps);
1278
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
1279
- focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
1280
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1281
- ...$3fpzo$reactariautils.mergeProps(...allProps),
1282
- ref: ref4,
1283
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCell', {
1284
- 'is-resizable': columnProps.allowsResizing,
1285
- 'is-sortable': columnProps.allowsSorting,
1286
- 'is-sorted-desc': ((ref = state.sortDescriptor) === null || ref === void 0 ? void 0 : ref.column) === column.key && ((ref1 = state.sortDescriptor) === null || ref1 === void 0 ? void 0 : ref1.direction) === 'descending',
1287
- 'is-sorted-asc': ((ref2 = state.sortDescriptor) === null || ref2 === void 0 ? void 0 : ref2.column) === column.key && ((ref3 = state.sortDescriptor) === null || ref3 === void 0 ? void 0 : ref3.direction) === 'ascending',
1288
- 'is-hovered': isHovered,
1289
- 'spectrum-Table-cell--hideHeader': columnProps.hideHeader
1290
- }, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell', {
1291
- 'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center' || column.colspan > 1,
1292
- 'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
1293
- }))
1294
- }, columnProps.hideHeader ? /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavisuallyhidden.VisuallyHidden, null, column.rendered) : /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1295
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCellContents')
1296
- }, column.rendered), columnProps.allowsSorting && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement(($parcel$interopDefault($3fpzo$spectrumiconsuiArrowDownSmall)), {
1297
- UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-sortedIcon')
1298
- }))));
1299
- }
1300
- function $be8a9c035a82f788$var$ResizableTableColumnHeader({ item: item , state: state }) {
1301
- var ref, ref5;
1302
- let ref6 = $3fpzo$react.useRef();
1303
- const onMenuSelect = (key)=>{
1304
- switch(key){
1305
- case `${item.key}-sort-asc`:
1306
- state.sort(item.key, 'ascending');
1307
- break;
1308
- case `${item.key}-sort-desc`:
1309
- state.sort(item.key, 'descending');
1310
- break;
1311
- case `${item.key}-resize`:
1312
- // focusResizer, needs timeout so that it happens after the animation timeout for menu close
1313
- setTimeout(()=>{
1314
- $3fpzo$reactariafocus.focusSafely(ref6.current);
1315
- }, 360);
1316
- break;
1317
- }
1318
- };
1319
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement(($parcel$interopDefault($3fpzo$react)).Fragment, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.MenuTrigger, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableColumnHeader, {
1320
- column: item
1321
- }), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Menu, {
1322
- onAction: onMenuSelect,
1323
- minWidth: "size-2000"
1324
- }, ((ref = item.props) === null || ref === void 0 ? void 0 : ref.allowsSorting) && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Item, {
1325
- key: `${item.key}-sort-asc`
1326
- }, "Sort Ascending"), ((ref5 = item.props) === null || ref5 === void 0 ? void 0 : ref5.allowsSorting) && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Item, {
1327
- key: `${item.key}-sort-desc`
1328
- }, "Sort Descending"), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Item, {
1329
- key: `${item.key}-resize`
1330
- }, "Resize column"))), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($2877766f94c67a67$export$48a76196cafe3b93, {
1331
- ref: ref6,
1332
- item: item
1333
- })));
1334
- }
1335
- function $be8a9c035a82f788$var$TableSelectAllCell({ column: column }) {
1336
- let ref = $3fpzo$react.useRef();
1337
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1338
- let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
1339
- let { columnHeaderProps: columnHeaderProps } = $3fpzo$reactariatable.useTableColumnHeader({
1340
- node: column,
1341
- isVirtualized: true
1342
- }, state, ref);
1343
- let { checkboxProps: checkboxProps } = $3fpzo$reactariatable.useTableSelectAllCheckbox(state);
1344
- let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
1345
- });
1346
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
1347
- focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
1348
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1349
- ...$3fpzo$reactariautils.mergeProps(columnHeaderProps, hoverProps),
1350
- ref: ref,
1351
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCell', 'spectrum-Table-checkboxCell', {
1352
- 'is-hovered': isHovered
1353
- })
1354
- }, /*
1355
- In single selection mode, the checkbox will be hidden.
1356
- So to avoid leaving a column header with no accessible content,
1357
- we use a VisuallyHidden component to include the aria-label from the checkbox,
1358
- which for single selection will be "Select."
1359
- */ isSingleSelectionMode && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavisuallyhidden.VisuallyHidden, null, checkboxProps['aria-label']), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumcheckbox.Checkbox, {
1360
- ...checkboxProps,
1361
- isDisabled: isSingleSelectionMode,
1362
- isEmphasized: true,
1363
- UNSAFE_style: isSingleSelectionMode ? {
1364
- visibility: 'hidden'
1365
- } : undefined,
1366
- UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-checkbox')
1367
- }))));
1368
- }
1369
- function $be8a9c035a82f788$var$TableRowGroup({ children: children , ...otherProps }) {
1370
- let { rowGroupProps: rowGroupProps } = $3fpzo$reactariatable.useTableRowGroup();
1371
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1372
- ...rowGroupProps,
1373
- ...otherProps
1374
- }, children));
1375
- }
1376
- function $be8a9c035a82f788$var$TableRow({ item: item , children: children , hasActions: hasActions , ...otherProps }) {
1377
- var ref, ref7, ref8;
1378
- let ref9 = $3fpzo$react.useRef();
1379
- let { state: state , layout: layout } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1380
- let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
1381
- let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
1382
- let isSelected = state.selectionManager.isSelected(item.key);
1383
- let { rowProps: rowProps } = $3fpzo$reactariatable.useTableRow({
1384
- node: item,
1385
- isVirtualized: true
1386
- }, state, ref9);
1387
- let { pressProps: pressProps , isPressed: isPressed } = $3fpzo$reactariainteractions.usePress({
1388
- isDisabled: isDisabled
1389
- });
1390
- // The row should show the focus background style when any cell inside it is focused.
1391
- // If the row itself is focused, then it should have a blue focus indicator on the left.
1392
- let { isFocusVisible: isFocusVisibleWithin , focusProps: focusWithinProps } = $3fpzo$reactariafocus.useFocusRing({
1393
- within: true
1394
- });
1395
- let { isFocusVisible: isFocusVisible , focusProps: focusProps } = $3fpzo$reactariafocus.useFocusRing();
1396
- let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
1397
- isDisabled: isDisabled
1398
- });
1399
- let props = $3fpzo$reactariautils.mergeProps(rowProps, otherProps, focusWithinProps, focusProps, hoverProps, pressProps);
1400
- let isFirstRow = ((ref = state.collection.rows.find((row)=>row.level === 1
1401
- )) === null || ref === void 0 ? void 0 : ref.key) === item.key;
1402
- let isLastRow = item.nextKey == null;
1403
- // Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
1404
- // border corners of the last row when selected.
1405
- let isFlushWithContainerBottom = false;
1406
- if (isLastRow) {
1407
- if (((ref7 = layout.getContentSize()) === null || ref7 === void 0 ? void 0 : ref7.height) >= ((ref8 = layout.virtualizer) === null || ref8 === void 0 ? void 0 : ref8.getVisibleRect().height)) isFlushWithContainerBottom = true;
1408
- }
1409
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1410
- ...props,
1411
- ref: ref9,
1412
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-row', {
1413
- 'is-active': isPressed,
1414
- 'is-selected': isSelected,
1415
- 'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
1416
- 'is-next-selected': state.selectionManager.isSelected(item.nextKey),
1417
- 'is-focused': isFocusVisibleWithin,
1418
- 'focus-ring': isFocusVisible,
1419
- 'is-hovered': isHovered,
1420
- 'is-disabled': isDisabled,
1421
- 'spectrum-Table-row--firstRow': isFirstRow,
1422
- 'spectrum-Table-row--lastRow': isLastRow,
1423
- 'spectrum-Table-row--isFlushBottom': isFlushWithContainerBottom
1424
- })
1425
- }, children));
1426
- }
1427
- function $be8a9c035a82f788$var$TableHeaderRow({ item: item , children: children , style: style }) {
1428
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1429
- let ref = $3fpzo$react.useRef();
1430
- let { rowProps: rowProps } = $3fpzo$reactariatable.useTableHeaderRow({
1431
- node: item,
1432
- isVirtualized: true
1433
- }, state, ref);
1434
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1435
- ...rowProps,
1436
- ref: ref,
1437
- style: style
1438
- }, children));
1439
- }
1440
- function $be8a9c035a82f788$var$TableCheckboxCell({ cell: cell }) {
1441
- let ref = $3fpzo$react.useRef();
1442
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1443
- let isDisabled = state.disabledKeys.has(cell.parentKey);
1444
- let { gridCellProps: gridCellProps } = $3fpzo$reactariatable.useTableCell({
1445
- node: cell,
1446
- isVirtualized: true
1447
- }, state, ref);
1448
- let { checkboxProps: checkboxProps } = $3fpzo$reactariatable.useTableSelectionCheckbox({
1449
- key: cell.parentKey
1450
- }, state);
1451
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
1452
- focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
1453
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1454
- ...gridCellProps,
1455
- ref: ref,
1456
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cell', 'spectrum-Table-checkboxCell', {
1457
- 'is-disabled': isDisabled
1458
- }, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell'))
1459
- }, state.selectionManager.selectionMode !== 'none' && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumcheckbox.Checkbox, {
1460
- ...checkboxProps,
1461
- isEmphasized: true,
1462
- isDisabled: isDisabled,
1463
- UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-checkbox')
1464
- }))));
1465
- }
1466
- function $be8a9c035a82f788$var$TableCell({ cell: cell }) {
1467
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1468
- let ref = $3fpzo$react.useRef();
1469
- let columnProps = cell.column.props;
1470
- let isDisabled = state.disabledKeys.has(cell.parentKey);
1471
- let { gridCellProps: gridCellProps } = $3fpzo$reactariatable.useTableCell({
1472
- node: cell,
1473
- isVirtualized: true
1474
- }, state, ref);
1475
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
1476
- focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
1477
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1478
- ...gridCellProps,
1479
- ref: ref,
1480
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cell', {
1481
- 'spectrum-Table-cell--divider': columnProps.showDivider && cell.column.nextKey !== null,
1482
- 'spectrum-Table-cell--hideHeader': columnProps.hideHeader,
1483
- 'is-disabled': isDisabled
1484
- }, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell', {
1485
- 'react-spectrum-Table-cell--alignStart': columnProps.align === 'start',
1486
- 'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center',
1487
- 'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
1488
- }))
1489
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("span", {
1490
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cellContents')
1491
- }, cell.rendered))));
1492
- }
1493
- function $be8a9c035a82f788$var$CenteredWrapper({ children: children }) {
1494
- let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
1495
- return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1496
- role: "row",
1497
- "aria-rowindex": state.collection.headerRows.length + state.collection.size + 1,
1498
- className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-centeredWrapper')
1499
- }, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
1500
- role: "rowheader",
1501
- "aria-colspan": state.collection.columns.length
1502
- }, children)));
1503
- }
1504
- /**
1505
- * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
1506
- */ const $be8a9c035a82f788$var$_TableView = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($be8a9c035a82f788$var$TableView);
1507
- /*
1508
- When ready to remove this feature flag, you can remove this whole section of code, delete the _DEPRECATED files, and just replace the export with the _TableView above.
1509
- */ function $be8a9c035a82f788$var$FeatureFlaggedTableView(props, ref10) {
1510
- let state = $3fpzo$reactstatelytable.useTableState({
1511
- ...props
1512
- });
1513
- const someColumnsAllowResizing = state.collection.columns.some((c)=>{
1514
- var ref;
1515
- return (ref = c.props) === null || ref === void 0 ? void 0 : ref.allowsResizing;
1516
- });
1517
- if (someColumnsAllowResizing) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$_TableView, {
1518
- ...props,
1519
- ref: ref10
1520
- }));
1521
- else return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$export$8790f9f1576000df, {
1522
- ...props,
1523
- ref: ref10
1524
- }));
1525
- }
1526
- /**
1527
- * Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
1528
- */ const $be8a9c035a82f788$export$b3c27e869d856b7 = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($be8a9c035a82f788$var$FeatureFlaggedTableView);
1529
-
1530
-
1531
-
1532
880
  // Override TS for Column to support spectrum specific props.
1533
881
  const $4b0b515c47252574$export$816b5d811295e6bc = $3fpzo$reactstatelytable.Column;
1534
882