@7shifts/sous-chef 3.67.2-beta.1 → 3.67.2-beta.2
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
|
@@ -6474,7 +6474,8 @@ var AMOUNT_OF_SKELETON_ROWS = 10;
|
|
|
6474
6474
|
var initialValue = {
|
|
6475
6475
|
columns: [],
|
|
6476
6476
|
numberOfRows: 0,
|
|
6477
|
-
state: DATA_TABLE_STATES.SKELETON_LOADING
|
|
6477
|
+
state: DATA_TABLE_STATES.SKELETON_LOADING,
|
|
6478
|
+
tableId: ''
|
|
6478
6479
|
};
|
|
6479
6480
|
var Context$1 = React.createContext(initialValue);
|
|
6480
6481
|
var useDataTableContext = function useDataTableContext() {
|
|
@@ -6503,29 +6504,22 @@ var useTableHeaderHeight = function useTableHeaderHeight(tableRef, isShowingColu
|
|
|
6503
6504
|
return headerHeight;
|
|
6504
6505
|
};
|
|
6505
6506
|
|
|
6506
|
-
var useDetectFixedScroll = function useDetectFixedScroll(
|
|
6507
|
+
var useDetectFixedScroll = function useDetectFixedScroll() {
|
|
6507
6508
|
var _useState = React.useState(detectAlwaysShowScrollbars),
|
|
6508
6509
|
hasFixedScroll = _useState[0];
|
|
6509
6510
|
var _useState2 = React.useState(false),
|
|
6510
6511
|
hasScroll = _useState2[0],
|
|
6511
6512
|
setHasScroll = _useState2[1];
|
|
6513
|
+
var _useDataTableContext = useDataTableContext(),
|
|
6514
|
+
tableId = _useDataTableContext.tableId;
|
|
6512
6515
|
React.useLayoutEffect(function () {
|
|
6513
|
-
|
|
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);
|
|
6516
|
+
var content = document.querySelector("#" + tableId + "-content");
|
|
6522
6517
|
if (!content) {
|
|
6523
6518
|
return;
|
|
6524
6519
|
}
|
|
6525
|
-
console.log(4);
|
|
6526
6520
|
var hasScroll = content.scrollHeight > content.clientHeight;
|
|
6527
6521
|
setHasScroll(hasScroll);
|
|
6528
|
-
}, [setHasScroll,
|
|
6522
|
+
}, [setHasScroll, tableId]);
|
|
6529
6523
|
return hasScroll && hasFixedScroll;
|
|
6530
6524
|
};
|
|
6531
6525
|
|
|
@@ -6541,7 +6535,7 @@ var DataTableScrollFakeBorder = function DataTableScrollFakeBorder(_ref) {
|
|
|
6541
6535
|
isShowingColumns = _ref.isShowingColumns,
|
|
6542
6536
|
tableRef = _ref.tableRef;
|
|
6543
6537
|
var headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
6544
|
-
var hasFixedScroll = useDetectFixedScroll(
|
|
6538
|
+
var hasFixedScroll = useDetectFixedScroll();
|
|
6545
6539
|
var backgroundColor = useBackgroundColor();
|
|
6546
6540
|
return React__default["default"].createElement("div", {
|
|
6547
6541
|
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)),
|
|
@@ -9527,6 +9521,9 @@ var DataTable = function DataTable(_ref) {
|
|
|
9527
9521
|
var prevPaginationRef = React.useRef(false);
|
|
9528
9522
|
var RowItem = itemComponent || DataTableDefaultItemComponent;
|
|
9529
9523
|
var tableRef = React.useRef(null);
|
|
9524
|
+
var tableId = React.useMemo(function () {
|
|
9525
|
+
return "data-table-" + Math.floor(Math.random() * 1000000);
|
|
9526
|
+
}, []);
|
|
9530
9527
|
var conditionalStyles = {};
|
|
9531
9528
|
var isScrollableTable = !!maxHeight;
|
|
9532
9529
|
if (isScrollableTable) {
|
|
@@ -9583,7 +9580,8 @@ var DataTable = function DataTable(_ref) {
|
|
|
9583
9580
|
showActionMenu: state === DATA_TABLE_STATES.EMPTY ? false : showActionMenu,
|
|
9584
9581
|
numberOfRows: numberOfRows,
|
|
9585
9582
|
hasVerticalBorders: hasVerticalBorders,
|
|
9586
|
-
state: state
|
|
9583
|
+
state: state,
|
|
9584
|
+
tableId: tableId
|
|
9587
9585
|
}
|
|
9588
9586
|
}, React__default["default"].createElement("div", {
|
|
9589
9587
|
className: classnames__default["default"](styles$1a['data-table']),
|
|
@@ -9600,7 +9598,7 @@ var DataTable = function DataTable(_ref) {
|
|
|
9600
9598
|
}), React__default["default"].createElement("div", {
|
|
9601
9599
|
className: classnames__default["default"](styles$1a['data-table__content'], (_classNames = {}, _classNames[styles$1a['data-table__content--with-scroll']] = isScrollableTable, _classNames)),
|
|
9602
9600
|
style: conditionalStyles,
|
|
9603
|
-
|
|
9601
|
+
id: tableId + "-content"
|
|
9604
9602
|
}, state === DATA_TABLE_STATES.BACKGROUND_LOADING && React__default["default"].createElement("div", {
|
|
9605
9603
|
className: styles$1a['data-table__background-loading']
|
|
9606
9604
|
}, React__default["default"].createElement(Spinner, null)), React__default["default"].createElement("table", _extends({
|