@7shifts/sous-chef 3.67.2-beta.0 → 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,6 +6504,25 @@ var useTableHeaderHeight = function useTableHeaderHeight(tableRef, isShowingColu
|
|
|
6503
6504
|
return headerHeight;
|
|
6504
6505
|
};
|
|
6505
6506
|
|
|
6507
|
+
var useDetectFixedScroll = function useDetectFixedScroll() {
|
|
6508
|
+
var _useState = React.useState(detectAlwaysShowScrollbars),
|
|
6509
|
+
hasFixedScroll = _useState[0];
|
|
6510
|
+
var _useState2 = React.useState(false),
|
|
6511
|
+
hasScroll = _useState2[0],
|
|
6512
|
+
setHasScroll = _useState2[1];
|
|
6513
|
+
var _useDataTableContext = useDataTableContext(),
|
|
6514
|
+
tableId = _useDataTableContext.tableId;
|
|
6515
|
+
React.useLayoutEffect(function () {
|
|
6516
|
+
var content = document.querySelector("#" + tableId + "-content");
|
|
6517
|
+
if (!content) {
|
|
6518
|
+
return;
|
|
6519
|
+
}
|
|
6520
|
+
var hasScroll = content.scrollHeight > content.clientHeight;
|
|
6521
|
+
setHasScroll(hasScroll);
|
|
6522
|
+
}, [setHasScroll, tableId]);
|
|
6523
|
+
return hasScroll && hasFixedScroll;
|
|
6524
|
+
};
|
|
6525
|
+
|
|
6506
6526
|
/**
|
|
6507
6527
|
* This internal component is used to pass the impression the user is scrolling
|
|
6508
6528
|
* just the table content instead of the whole table.
|
|
@@ -6515,8 +6535,7 @@ var DataTableScrollFakeBorder = function DataTableScrollFakeBorder(_ref) {
|
|
|
6515
6535
|
isShowingColumns = _ref.isShowingColumns,
|
|
6516
6536
|
tableRef = _ref.tableRef;
|
|
6517
6537
|
var headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
6518
|
-
var
|
|
6519
|
-
hasFixedScroll = _useState[0];
|
|
6538
|
+
var hasFixedScroll = useDetectFixedScroll();
|
|
6520
6539
|
var backgroundColor = useBackgroundColor();
|
|
6521
6540
|
return React__default["default"].createElement("div", {
|
|
6522
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)),
|
|
@@ -9236,7 +9255,7 @@ var DataTableCoverShadow = function DataTableCoverShadow(_ref) {
|
|
|
9236
9255
|
isShowingColumns = _ref.isShowingColumns,
|
|
9237
9256
|
tableRef = _ref.tableRef;
|
|
9238
9257
|
var headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
9239
|
-
var _useState = React.useState(detectAlwaysShowScrollbars
|
|
9258
|
+
var _useState = React.useState(detectAlwaysShowScrollbars),
|
|
9240
9259
|
hasFixedScroll = _useState[0];
|
|
9241
9260
|
var SCROLL_SIZE = '15px';
|
|
9242
9261
|
var getHeaderHeight = function getHeaderHeight() {
|
|
@@ -9502,6 +9521,9 @@ var DataTable = function DataTable(_ref) {
|
|
|
9502
9521
|
var prevPaginationRef = React.useRef(false);
|
|
9503
9522
|
var RowItem = itemComponent || DataTableDefaultItemComponent;
|
|
9504
9523
|
var tableRef = React.useRef(null);
|
|
9524
|
+
var tableId = React.useMemo(function () {
|
|
9525
|
+
return "data-table-" + Math.floor(Math.random() * 1000000);
|
|
9526
|
+
}, []);
|
|
9505
9527
|
var conditionalStyles = {};
|
|
9506
9528
|
var isScrollableTable = !!maxHeight;
|
|
9507
9529
|
if (isScrollableTable) {
|
|
@@ -9558,7 +9580,8 @@ var DataTable = function DataTable(_ref) {
|
|
|
9558
9580
|
showActionMenu: state === DATA_TABLE_STATES.EMPTY ? false : showActionMenu,
|
|
9559
9581
|
numberOfRows: numberOfRows,
|
|
9560
9582
|
hasVerticalBorders: hasVerticalBorders,
|
|
9561
|
-
state: state
|
|
9583
|
+
state: state,
|
|
9584
|
+
tableId: tableId
|
|
9562
9585
|
}
|
|
9563
9586
|
}, React__default["default"].createElement("div", {
|
|
9564
9587
|
className: classnames__default["default"](styles$1a['data-table']),
|
|
@@ -9574,7 +9597,8 @@ var DataTable = function DataTable(_ref) {
|
|
|
9574
9597
|
isShowingColumns: !!isShowingColumns
|
|
9575
9598
|
}), React__default["default"].createElement("div", {
|
|
9576
9599
|
className: classnames__default["default"](styles$1a['data-table__content'], (_classNames = {}, _classNames[styles$1a['data-table__content--with-scroll']] = isScrollableTable, _classNames)),
|
|
9577
|
-
style: conditionalStyles
|
|
9600
|
+
style: conditionalStyles,
|
|
9601
|
+
id: tableId + "-content"
|
|
9578
9602
|
}, state === DATA_TABLE_STATES.BACKGROUND_LOADING && React__default["default"].createElement("div", {
|
|
9579
9603
|
className: styles$1a['data-table__background-loading']
|
|
9580
9604
|
}, React__default["default"].createElement(Spinner, null)), React__default["default"].createElement("table", _extends({
|