@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.modern.js
CHANGED
|
@@ -6603,7 +6603,8 @@ const AMOUNT_OF_SKELETON_ROWS = 10;
|
|
|
6603
6603
|
const initialValue = {
|
|
6604
6604
|
columns: [],
|
|
6605
6605
|
numberOfRows: 0,
|
|
6606
|
-
state: DATA_TABLE_STATES.SKELETON_LOADING
|
|
6606
|
+
state: DATA_TABLE_STATES.SKELETON_LOADING,
|
|
6607
|
+
tableId: ''
|
|
6607
6608
|
};
|
|
6608
6609
|
const Context$1 = createContext(initialValue);
|
|
6609
6610
|
const useDataTableContext = () => {
|
|
@@ -6630,26 +6631,20 @@ const useTableHeaderHeight = (tableRef, isShowingColumns) => {
|
|
|
6630
6631
|
return headerHeight;
|
|
6631
6632
|
};
|
|
6632
6633
|
|
|
6633
|
-
const useDetectFixedScroll =
|
|
6634
|
+
const useDetectFixedScroll = () => {
|
|
6634
6635
|
const [hasFixedScroll] = useState(detectAlwaysShowScrollbars);
|
|
6635
6636
|
const [hasScroll, setHasScroll] = useState(false);
|
|
6637
|
+
const {
|
|
6638
|
+
tableId
|
|
6639
|
+
} = useDataTableContext();
|
|
6636
6640
|
useLayoutEffect(() => {
|
|
6637
|
-
|
|
6638
|
-
// Check if the table has a scrollbar
|
|
6639
|
-
if (!tableRef.current) {
|
|
6640
|
-
return;
|
|
6641
|
-
}
|
|
6642
|
-
console.log(2);
|
|
6643
|
-
// content should be the next element on tableRef.current that has the data-id="data-table-content"
|
|
6644
|
-
const content = tableRef.current.querySelector('[data-id="data-table-content"]');
|
|
6645
|
-
console.log(3);
|
|
6641
|
+
const content = document.querySelector(`#${tableId}-content`);
|
|
6646
6642
|
if (!content) {
|
|
6647
6643
|
return;
|
|
6648
6644
|
}
|
|
6649
|
-
console.log(4);
|
|
6650
6645
|
const hasScroll = content.scrollHeight > content.clientHeight;
|
|
6651
6646
|
setHasScroll(hasScroll);
|
|
6652
|
-
}, [setHasScroll,
|
|
6647
|
+
}, [setHasScroll, tableId]);
|
|
6653
6648
|
return hasScroll && hasFixedScroll;
|
|
6654
6649
|
};
|
|
6655
6650
|
|
|
@@ -6665,7 +6660,7 @@ const DataTableScrollFakeBorder = ({
|
|
|
6665
6660
|
tableRef
|
|
6666
6661
|
}) => {
|
|
6667
6662
|
const headerHeight = useTableHeaderHeight(tableRef, isShowingColumns);
|
|
6668
|
-
const hasFixedScroll = useDetectFixedScroll(
|
|
6663
|
+
const hasFixedScroll = useDetectFixedScroll();
|
|
6669
6664
|
const backgroundColor = useBackgroundColor();
|
|
6670
6665
|
return React__default.createElement("div", {
|
|
6671
6666
|
className: classnames(styles$19['data-table-scroll-fake-border'], {
|
|
@@ -9707,6 +9702,7 @@ const DataTable = _ref => {
|
|
|
9707
9702
|
const prevPaginationRef = useRef(false);
|
|
9708
9703
|
const RowItem = itemComponent || DataTableDefaultItemComponent;
|
|
9709
9704
|
const tableRef = useRef(null);
|
|
9705
|
+
const tableId = useMemo(() => `data-table-${Math.floor(Math.random() * 1000000)}`, []);
|
|
9710
9706
|
let conditionalStyles = {};
|
|
9711
9707
|
const isScrollableTable = !!maxHeight;
|
|
9712
9708
|
if (isScrollableTable) {
|
|
@@ -9763,7 +9759,8 @@ const DataTable = _ref => {
|
|
|
9763
9759
|
showActionMenu: state === DATA_TABLE_STATES.EMPTY ? false : showActionMenu,
|
|
9764
9760
|
numberOfRows,
|
|
9765
9761
|
hasVerticalBorders,
|
|
9766
|
-
state
|
|
9762
|
+
state,
|
|
9763
|
+
tableId
|
|
9767
9764
|
}
|
|
9768
9765
|
}, React__default.createElement("div", {
|
|
9769
9766
|
className: classnames(styles$1a['data-table']),
|
|
@@ -9782,7 +9779,7 @@ const DataTable = _ref => {
|
|
|
9782
9779
|
[styles$1a['data-table__content--with-scroll']]: isScrollableTable
|
|
9783
9780
|
}),
|
|
9784
9781
|
style: conditionalStyles,
|
|
9785
|
-
|
|
9782
|
+
id: `${tableId}-content`
|
|
9786
9783
|
}, state === DATA_TABLE_STATES.BACKGROUND_LOADING && React__default.createElement("div", {
|
|
9787
9784
|
className: styles$1a['data-table__background-loading']
|
|
9788
9785
|
}, React__default.createElement(Spinner, null)), React__default.createElement("table", _extends({
|