@7shifts/sous-chef 3.67.2-beta.0 → 3.67.2-beta.1
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/index.js
CHANGED
|
@@ -6503,6 +6503,32 @@ var useTableHeaderHeight = function useTableHeaderHeight(tableRef, isShowingColu
|
|
|
6503
6503
|
return headerHeight;
|
|
6504
6504
|
};
|
|
6505
6505
|
|
|
6506
|
+
var useDetectFixedScroll = function useDetectFixedScroll(tableRef) {
|
|
6507
|
+
var _useState = React.useState(detectAlwaysShowScrollbars),
|
|
6508
|
+
hasFixedScroll = _useState[0];
|
|
6509
|
+
var _useState2 = React.useState(false),
|
|
6510
|
+
hasScroll = _useState2[0],
|
|
6511
|
+
setHasScroll = _useState2[1];
|
|
6512
|
+
React.useLayoutEffect(function () {
|
|
6513
|
+
console.log(1, tableRef);
|
|
6514
|
+
// Check if the table has a scrollbar
|
|
6515
|
+
if (!tableRef.current) {
|
|
6516
|
+
return;
|
|
6517
|
+
}
|
|
6518
|
+
console.log(2);
|
|
6519
|
+
// content should be the next element on tableRef.current that has the data-id="data-table-content"
|
|
6520
|
+
var content = tableRef.current.querySelector('[data-id="data-table-content"]');
|
|
6521
|
+
console.log(3);
|
|
6522
|
+
if (!content) {
|
|
6523
|
+
return;
|
|
6524
|
+
}
|
|
6525
|
+
console.log(4);
|
|
6526
|
+
var hasScroll = content.scrollHeight > content.clientHeight;
|
|
6527
|
+
setHasScroll(hasScroll);
|
|
6528
|
+
}, [setHasScroll, tableRef]);
|
|
6529
|
+
return hasScroll && hasFixedScroll;
|
|
6530
|
+
};
|
|
6531
|
+
|
|
6506
6532
|
/**
|
|
6507
6533
|
* This internal component is used to pass the impression the user is scrolling
|
|
6508
6534
|
* just the table content instead of the whole table.
|
|
@@ -6515,8 +6541,7 @@ var DataTableScrollFakeBorder = function DataTableScrollFakeBorder(_ref) {
|
|
|
6515
6541
|
isShowingColumns = _ref.isShowingColumns,
|
|
6516
6542
|
tableRef = _ref.tableRef;
|
|
6517
6543
|
var headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
6518
|
-
var
|
|
6519
|
-
hasFixedScroll = _useState[0];
|
|
6544
|
+
var hasFixedScroll = useDetectFixedScroll(tableRef);
|
|
6520
6545
|
var backgroundColor = useBackgroundColor();
|
|
6521
6546
|
return React__default["default"].createElement("div", {
|
|
6522
6547
|
className: classnames__default["default"](styles$19['data-table-scroll-fake-border'], (_classNames = {}, _classNames[styles$19['data-table-scroll-fake-border--top']] = placement === 'top', _classNames[styles$19['data-table-scroll-fake-border--bottom']] = placement === 'bottom', _classNames[styles$19['data-table-scroll-fake-border--fixed-scroll']] = hasFixedScroll, _classNames)),
|
|
@@ -9236,7 +9261,7 @@ var DataTableCoverShadow = function DataTableCoverShadow(_ref) {
|
|
|
9236
9261
|
isShowingColumns = _ref.isShowingColumns,
|
|
9237
9262
|
tableRef = _ref.tableRef;
|
|
9238
9263
|
var headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
9239
|
-
var _useState = React.useState(detectAlwaysShowScrollbars
|
|
9264
|
+
var _useState = React.useState(detectAlwaysShowScrollbars),
|
|
9240
9265
|
hasFixedScroll = _useState[0];
|
|
9241
9266
|
var SCROLL_SIZE = '15px';
|
|
9242
9267
|
var getHeaderHeight = function getHeaderHeight() {
|
|
@@ -9574,7 +9599,8 @@ var DataTable = function DataTable(_ref) {
|
|
|
9574
9599
|
isShowingColumns: !!isShowingColumns
|
|
9575
9600
|
}), React__default["default"].createElement("div", {
|
|
9576
9601
|
className: classnames__default["default"](styles$1a['data-table__content'], (_classNames = {}, _classNames[styles$1a['data-table__content--with-scroll']] = isScrollableTable, _classNames)),
|
|
9577
|
-
style: conditionalStyles
|
|
9602
|
+
style: conditionalStyles,
|
|
9603
|
+
"data-id": "data-table-content"
|
|
9578
9604
|
}, state === DATA_TABLE_STATES.BACKGROUND_LOADING && React__default["default"].createElement("div", {
|
|
9579
9605
|
className: styles$1a['data-table__background-loading']
|
|
9580
9606
|
}, React__default["default"].createElement(Spinner, null)), React__default["default"].createElement("table", _extends({
|