@react-spectrum/table 3.5.1-nightly.3611 → 3.5.1-nightly.3621
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.css +1 -1
- package/dist/main.js +30 -37
- package/dist/main.js.map +1 -1
- package/dist/module.js +30 -37
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +27 -27
- package/src/Nubbin.tsx +5 -7
- package/src/Resizer.tsx +4 -3
- package/src/TableView.tsx +7 -6
package/dist/module.js
CHANGED
|
@@ -487,11 +487,6 @@ function $cb7d341e8868d81d$export$d9658cdf8c86807() {
|
|
|
487
487
|
height: "16",
|
|
488
488
|
viewBox: "0 0 16 16"
|
|
489
489
|
}, /*#__PURE__*/ (0, $gyhAV$react).createElement("g", {
|
|
490
|
-
id: "Group_175838",
|
|
491
|
-
"data-name": "Group 175838"
|
|
492
|
-
}, /*#__PURE__*/ (0, $gyhAV$react).createElement("g", {
|
|
493
|
-
id: "Ellipse_10104",
|
|
494
|
-
"data-name": "Ellipse 10104",
|
|
495
490
|
fill: "var(--spectrum-global-color-blue-600)",
|
|
496
491
|
stroke: "var(--spectrum-global-color-blue-600)",
|
|
497
492
|
strokeWidth: "2"
|
|
@@ -505,9 +500,7 @@ function $cb7d341e8868d81d$export$d9658cdf8c86807() {
|
|
|
505
500
|
cy: "8",
|
|
506
501
|
r: "7",
|
|
507
502
|
fill: "none"
|
|
508
|
-
}))
|
|
509
|
-
id: "Path_104166",
|
|
510
|
-
"data-name": "Path 104166",
|
|
503
|
+
})), /*#__PURE__*/ (0, $gyhAV$react).createElement("path", {
|
|
511
504
|
d: "M-2106-7380.263v5l2.5-2.551Z",
|
|
512
505
|
transform: "translate(2116 7385.763)",
|
|
513
506
|
fill: "#fff",
|
|
@@ -515,8 +508,6 @@ function $cb7d341e8868d81d$export$d9658cdf8c86807() {
|
|
|
515
508
|
strokeLinejoin: "round",
|
|
516
509
|
strokeWidth: "2"
|
|
517
510
|
}), /*#__PURE__*/ (0, $gyhAV$react).createElement("path", {
|
|
518
|
-
id: "Path_104167",
|
|
519
|
-
"data-name": "Path 104167",
|
|
520
511
|
d: "M-2106-7380.263v5l2.5-2.551Z",
|
|
521
512
|
transform: "translate(-2100 -7369.763) rotate(180)",
|
|
522
513
|
fill: "#fff",
|
|
@@ -841,7 +832,7 @@ function $d14697b14e638114$export$3f8f74b6bfd2c5df() {
|
|
|
841
832
|
}
|
|
842
833
|
function $d14697b14e638114$var$TableView(props, ref) {
|
|
843
834
|
props = (0, $gyhAV$useProviderProps)(props);
|
|
844
|
-
let { isQuiet: isQuiet , onAction: onAction , onResizeEnd: propsOnResizeEnd } = props;
|
|
835
|
+
let { isQuiet: isQuiet , onAction: onAction , onResizeStart: propsOnResizeStart , onResizeEnd: propsOnResizeEnd } = props;
|
|
845
836
|
let { styleProps: styleProps } = (0, $gyhAV$useStyleProps)(props);
|
|
846
837
|
let [showSelectionCheckboxes, setShowSelectionCheckboxes] = (0, $gyhAV$useState)(props.selectionStyle !== "highlight");
|
|
847
838
|
let { direction: direction } = (0, $gyhAV$useLocale)();
|
|
@@ -1027,10 +1018,12 @@ function $d14697b14e638114$var$TableView(props, ref) {
|
|
|
1027
1018
|
if (e.pointerType === "keyboard") lastResizeInteractionModality.current = e.pointerType;
|
|
1028
1019
|
else lastResizeInteractionModality.current = undefined;
|
|
1029
1020
|
};
|
|
1030
|
-
let onResizeStart = (0, $gyhAV$useCallback)(()=>{
|
|
1021
|
+
let onResizeStart = (0, $gyhAV$useCallback)((widths)=>{
|
|
1031
1022
|
setIsResizing(true);
|
|
1023
|
+
propsOnResizeStart === null || propsOnResizeStart === void 0 ? void 0 : propsOnResizeStart(widths);
|
|
1032
1024
|
}, [
|
|
1033
|
-
setIsResizing
|
|
1025
|
+
setIsResizing,
|
|
1026
|
+
propsOnResizeStart
|
|
1034
1027
|
]);
|
|
1035
1028
|
let onResizeEnd = (0, $gyhAV$useCallback)((widths)=>{
|
|
1036
1029
|
setIsInResizeMode(false);
|
|
@@ -1082,7 +1075,7 @@ function $d14697b14e638114$var$TableView(props, ref) {
|
|
|
1082
1075
|
}
|
|
1083
1076
|
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
1084
1077
|
function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: collection , lastResizeInteractionModality: lastResizeInteractionModality , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , headerRef: headerRef , onVisibleRectChange: onVisibleRectChangeProp , isFocusVisible: isFocusVisible , ...otherProps }) {
|
|
1085
|
-
var
|
|
1078
|
+
var _layout_getLayoutInfo;
|
|
1086
1079
|
let { direction: direction } = (0, $gyhAV$useLocale)();
|
|
1087
1080
|
let loadingState = collection.body.props.loadingState;
|
|
1088
1081
|
let isLoading = loadingState === "loading" || loadingState === "loadingMore";
|
|
@@ -1122,8 +1115,8 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
|
|
|
1122
1115
|
// header scroll position
|
|
1123
1116
|
(0, $gyhAV$useEffect)(()=>{
|
|
1124
1117
|
if (lastResizeInteractionModality.current === "keyboard" && headerRef.current.contains(document.activeElement)) {
|
|
1125
|
-
var
|
|
1126
|
-
(
|
|
1118
|
+
var _document_activeElement, _document_activeElement_scrollIntoView;
|
|
1119
|
+
(_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : (_document_activeElement_scrollIntoView = _document_activeElement.scrollIntoView) === null || _document_activeElement_scrollIntoView === void 0 ? void 0 : _document_activeElement_scrollIntoView.call(_document_activeElement, {
|
|
1127
1120
|
block: "nearest",
|
|
1128
1121
|
inline: "nearest"
|
|
1129
1122
|
});
|
|
@@ -1135,7 +1128,7 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
|
|
|
1135
1128
|
bodyRef,
|
|
1136
1129
|
lastResizeInteractionModality
|
|
1137
1130
|
]);
|
|
1138
|
-
let headerHeight = ((
|
|
1131
|
+
let headerHeight = ((_layout_getLayoutInfo = layout.getLayoutInfo("header")) === null || _layout_getLayoutInfo === void 0 ? void 0 : _layout_getLayoutInfo.rect.height) || 0;
|
|
1139
1132
|
let visibleRect = state.virtualizer.visibleRect;
|
|
1140
1133
|
// Sync the scroll position from the table body to the header container.
|
|
1141
1134
|
let onScroll = (0, $gyhAV$useCallback)(()=>{
|
|
@@ -1172,7 +1165,7 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
|
|
|
1172
1165
|
let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
|
|
1173
1166
|
// this should be fine, every movement of the resizer causes a rerender
|
|
1174
1167
|
// scrolling can cause it to lag for a moment, but it's always updated
|
|
1175
|
-
let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.
|
|
1168
|
+
let resizerInVisibleRegion = resizerPosition < state.virtualizer.visibleRect.maxX;
|
|
1176
1169
|
let shouldHardCornerResizeCorner = resizerAtEdge && resizerInVisibleRegion;
|
|
1177
1170
|
// minimize re-render caused on Resizers by memoing this
|
|
1178
1171
|
let resizingColumnWidth = layout.getColumnWidth(layout.resizingColumn);
|
|
@@ -1238,9 +1231,9 @@ function $d14697b14e638114$var$TableHeader({ children: children , ...otherProps
|
|
|
1238
1231
|
}, children);
|
|
1239
1232
|
}
|
|
1240
1233
|
function $d14697b14e638114$var$TableColumnHeader(props) {
|
|
1241
|
-
var
|
|
1234
|
+
var _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
|
|
1242
1235
|
let { column: column } = props;
|
|
1243
|
-
let
|
|
1236
|
+
let ref = (0, $gyhAV$useRef)(null);
|
|
1244
1237
|
let { state: state , isEmpty: isEmpty } = $d14697b14e638114$export$3cb274deb6c2d854();
|
|
1245
1238
|
let { pressProps: pressProps , isPressed: isPressed } = (0, $gyhAV$usePress)({
|
|
1246
1239
|
isDisabled: isEmpty
|
|
@@ -1249,7 +1242,7 @@ function $d14697b14e638114$var$TableColumnHeader(props) {
|
|
|
1249
1242
|
let { columnHeaderProps: columnHeaderProps } = (0, $gyhAV$useTableColumnHeader)({
|
|
1250
1243
|
node: column,
|
|
1251
1244
|
isVirtualized: true
|
|
1252
|
-
}, state,
|
|
1245
|
+
}, state, ref);
|
|
1253
1246
|
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $gyhAV$useHover)({
|
|
1254
1247
|
...props,
|
|
1255
1248
|
isDisabled: isEmpty
|
|
@@ -1263,13 +1256,13 @@ function $d14697b14e638114$var$TableColumnHeader(props) {
|
|
|
1263
1256
|
focusRingClass: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "focus-ring")
|
|
1264
1257
|
}, /*#__PURE__*/ (0, $gyhAV$react).createElement("div", {
|
|
1265
1258
|
...(0, $gyhAV$mergeProps)(...allProps),
|
|
1266
|
-
ref:
|
|
1259
|
+
ref: ref,
|
|
1267
1260
|
className: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "spectrum-Table-headCell", {
|
|
1268
1261
|
"is-active": isPressed,
|
|
1269
1262
|
"is-resizable": columnProps.allowsResizing,
|
|
1270
1263
|
"is-sortable": columnProps.allowsSorting,
|
|
1271
|
-
"is-sorted-desc": ((
|
|
1272
|
-
"is-sorted-asc": ((
|
|
1264
|
+
"is-sorted-desc": ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === column.key && ((_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction) === "descending",
|
|
1265
|
+
"is-sorted-asc": ((_state_sortDescriptor2 = state.sortDescriptor) === null || _state_sortDescriptor2 === void 0 ? void 0 : _state_sortDescriptor2.column) === column.key && ((_state_sortDescriptor3 = state.sortDescriptor) === null || _state_sortDescriptor3 === void 0 ? void 0 : _state_sortDescriptor3.direction) === "ascending",
|
|
1273
1266
|
"is-hovered": isHovered,
|
|
1274
1267
|
"spectrum-Table-cell--hideHeader": columnProps.hideHeader
|
|
1275
1268
|
}, (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports))), "react-spectrum-Table-cell", {
|
|
@@ -1308,9 +1301,9 @@ let $d14697b14e638114$var$_TableColumnHeaderButton = (props, ref)=>{
|
|
|
1308
1301
|
};
|
|
1309
1302
|
let $d14697b14e638114$var$TableColumnHeaderButton = /*#__PURE__*/ (0, $gyhAV$react).forwardRef($d14697b14e638114$var$_TableColumnHeaderButton);
|
|
1310
1303
|
function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
|
|
1311
|
-
var
|
|
1304
|
+
var _column_props, _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
|
|
1312
1305
|
let { column: column } = props;
|
|
1313
|
-
let
|
|
1306
|
+
let ref = (0, $gyhAV$useRef)(null);
|
|
1314
1307
|
let triggerRef = (0, $gyhAV$useRef)(null);
|
|
1315
1308
|
let resizingRef = (0, $gyhAV$useRef)(null);
|
|
1316
1309
|
let { state: state , layout: layout , onResizeStart: onResizeStart , onResize: onResize , onResizeEnd: onResizeEnd , headerRowHovered: headerRowHovered , setIsInResizeMode: setIsInResizeMode , isEmpty: isEmpty , onFocusedResizer: onFocusedResizer , onMoveResizer: onMoveResizer , isInResizeMode: isInResizeMode , headerMenuOpen: headerMenuOpen , setHeaderMenuOpen: setHeaderMenuOpen } = $d14697b14e638114$export$3cb274deb6c2d854();
|
|
@@ -1321,7 +1314,7 @@ function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
|
|
|
1321
1314
|
let { columnHeaderProps: columnHeaderProps } = (0, $gyhAV$useTableColumnHeader)({
|
|
1322
1315
|
node: column,
|
|
1323
1316
|
isVirtualized: true
|
|
1324
|
-
}, state,
|
|
1317
|
+
}, state, ref);
|
|
1325
1318
|
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $gyhAV$useHover)({
|
|
1326
1319
|
...props,
|
|
1327
1320
|
isDisabled: isEmpty || headerMenuOpen
|
|
@@ -1347,7 +1340,7 @@ function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
|
|
|
1347
1340
|
break;
|
|
1348
1341
|
}
|
|
1349
1342
|
};
|
|
1350
|
-
let allowsSorting = (
|
|
1343
|
+
let allowsSorting = (_column_props = column.props) === null || _column_props === void 0 ? void 0 : _column_props.allowsSorting;
|
|
1351
1344
|
let items = (0, $gyhAV$useMemo)(()=>{
|
|
1352
1345
|
let options = [
|
|
1353
1346
|
allowsSorting ? {
|
|
@@ -1407,13 +1400,13 @@ function $d14697b14e638114$var$ResizableTableColumnHeader(props) {
|
|
|
1407
1400
|
focusRingClass: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "focus-ring")
|
|
1408
1401
|
}, /*#__PURE__*/ (0, $gyhAV$react).createElement("div", {
|
|
1409
1402
|
...(0, $gyhAV$mergeProps)(...allProps),
|
|
1410
|
-
ref:
|
|
1403
|
+
ref: ref,
|
|
1411
1404
|
className: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "spectrum-Table-headCell", {
|
|
1412
1405
|
"is-active": isPressed,
|
|
1413
1406
|
"is-resizable": columnProps.allowsResizing,
|
|
1414
1407
|
"is-sortable": columnProps.allowsSorting,
|
|
1415
|
-
"is-sorted-desc": ((
|
|
1416
|
-
"is-sorted-asc": ((
|
|
1408
|
+
"is-sorted-desc": ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === column.key && ((_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction) === "descending",
|
|
1409
|
+
"is-sorted-asc": ((_state_sortDescriptor2 = state.sortDescriptor) === null || _state_sortDescriptor2 === void 0 ? void 0 : _state_sortDescriptor2.column) === column.key && ((_state_sortDescriptor3 = state.sortDescriptor) === null || _state_sortDescriptor3 === void 0 ? void 0 : _state_sortDescriptor3.direction) === "ascending",
|
|
1417
1410
|
"is-hovered": isHovered,
|
|
1418
1411
|
"focus-ring": isFocusVisible,
|
|
1419
1412
|
"spectrum-Table-cell--hideHeader": columnProps.hideHeader
|
|
@@ -1497,8 +1490,8 @@ function $d14697b14e638114$var$TableRowGroup({ children: children , ...otherProp
|
|
|
1497
1490
|
}, children);
|
|
1498
1491
|
}
|
|
1499
1492
|
function $d14697b14e638114$var$TableRow({ item: item , children: children , hasActions: hasActions , ...otherProps }) {
|
|
1500
|
-
var
|
|
1501
|
-
let
|
|
1493
|
+
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer;
|
|
1494
|
+
let ref = (0, $gyhAV$useRef)();
|
|
1502
1495
|
let { state: state , layout: layout } = $d14697b14e638114$export$3cb274deb6c2d854();
|
|
1503
1496
|
let allowsInteraction = state.selectionManager.selectionMode !== "none" || hasActions;
|
|
1504
1497
|
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
@@ -1506,7 +1499,7 @@ function $d14697b14e638114$var$TableRow({ item: item , children: children , hasA
|
|
|
1506
1499
|
let { rowProps: rowProps } = (0, $gyhAV$useTableRow)({
|
|
1507
1500
|
node: item,
|
|
1508
1501
|
isVirtualized: true
|
|
1509
|
-
}, state,
|
|
1502
|
+
}, state, ref);
|
|
1510
1503
|
let { pressProps: pressProps , isPressed: isPressed } = (0, $gyhAV$usePress)({
|
|
1511
1504
|
isDisabled: isDisabled
|
|
1512
1505
|
});
|
|
@@ -1520,17 +1513,17 @@ function $d14697b14e638114$var$TableRow({ item: item , children: children , hasA
|
|
|
1520
1513
|
isDisabled: isDisabled
|
|
1521
1514
|
});
|
|
1522
1515
|
let props = (0, $gyhAV$mergeProps)(rowProps, otherProps, focusWithinProps, focusProps, hoverProps, pressProps);
|
|
1523
|
-
let isFirstRow = ((
|
|
1516
|
+
let isFirstRow = ((_state_collection_rows_find = state.collection.rows.find((row)=>row.level === 1)) === null || _state_collection_rows_find === void 0 ? void 0 : _state_collection_rows_find.key) === item.key;
|
|
1524
1517
|
let isLastRow = item.nextKey == null;
|
|
1525
1518
|
// Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
|
|
1526
1519
|
// border corners of the last row when selected.
|
|
1527
1520
|
let isFlushWithContainerBottom = false;
|
|
1528
1521
|
if (isLastRow) {
|
|
1529
|
-
if (((
|
|
1522
|
+
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.getVisibleRect().height)) isFlushWithContainerBottom = true;
|
|
1530
1523
|
}
|
|
1531
1524
|
return /*#__PURE__*/ (0, $gyhAV$react).createElement("div", {
|
|
1532
1525
|
...props,
|
|
1533
|
-
ref:
|
|
1526
|
+
ref: ref,
|
|
1534
1527
|
className: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "spectrum-Table-row", {
|
|
1535
1528
|
"is-active": isPressed,
|
|
1536
1529
|
"is-selected": isSelected,
|