qbs-react-grid 2.0.2 → 2.0.3

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/es/Table.d.ts CHANGED
@@ -96,9 +96,12 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
96
96
  virtualized?: boolean;
97
97
  /**Theme Change */
98
98
  dataTheme?: string;
99
+ /** Refresh Row */
100
+ refreshRow?: number;
99
101
  /** Tree table, the callback function in the expanded node */
100
102
  renderTreeToggle?: (expandButton: React.ReactNode, rowData?: Row, expanded?: boolean) => React.ReactNode;
101
103
  tableKey?: string;
104
+ infiniteLoading?: boolean;
102
105
  /** Customize what you can do to expand a zone */
103
106
  renderRowExpanded?: (rowData?: Row) => React.ReactNode;
104
107
  /** Custom row element */
@@ -123,6 +126,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
123
126
  onTouchMove?: (event: React.TouchEvent) => void;
124
127
  /** Callback for the `touchend` event. */
125
128
  onTouchEnd?: (event: React.TouchEvent) => void;
129
+ handleInfiniteScroll?: (value: number) => void;
126
130
  /**
127
131
  * Callback after table data update.
128
132
  * @deprecated use `shouldUpdateScroll` instead
@@ -132,6 +136,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
132
136
  y: number;
133
137
  }) => void) => void;
134
138
  tableBodyRef: React.RefObject<HTMLDivElement>;
139
+ wheelWrapperRef: React.RefObject<HTMLDivElement | null>;
135
140
  bodyRef?: (ref: HTMLElement) => void;
136
141
  }
137
142
  export interface TableInstance<Row, Key> extends React.FunctionComponent<TableProps<Row, Key>> {
package/es/Table.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- var _excluded = ["affixHeader", "children", "classPrefix", "className", "data", "defaultSortType", "width", "expandedRowKeys", "defaultExpandAllRows", "defaultExpandedRowKeys", "style", "id", "isTree", "hover", "bordered", "cellBordered", "wordWrap", "loading", "locale", "showHeader", "pagination", "paginationProps", "sortColumn", "rowHeight", "sortType", "headerHeight", "minHeight", "height", "autoHeight", "fillHeight", "rtl", "translate3d", "rowKey", "virtualized", "rowClassName", "rowExpandedHeight", "disabledScroll", "affixHorizontalScrollbar", "loadAnimation", "shouldUpdateScroll", "renderRow", "renderRowExpanded", "renderLoading", "renderEmpty", "onSortColumn", "onScroll", "renderTreeToggle", "onRowClick", "onRowContextMenu", "onExpandChange", "onTouchStart", "onTouchMove", "onTouchEnd", "dataTheme", "tableBodyHeight", "columns", "tableBodyRef", "tableKey"],
3
+ var _excluded = ["affixHeader", "children", "classPrefix", "className", "data", "defaultSortType", "width", "expandedRowKeys", "defaultExpandAllRows", "defaultExpandedRowKeys", "style", "id", "isTree", "hover", "bordered", "cellBordered", "wordWrap", "loading", "locale", "showHeader", "pagination", "paginationProps", "sortColumn", "rowHeight", "sortType", "headerHeight", "minHeight", "height", "autoHeight", "fillHeight", "rtl", "translate3d", "rowKey", "virtualized", "rowClassName", "rowExpandedHeight", "disabledScroll", "affixHorizontalScrollbar", "loadAnimation", "shouldUpdateScroll", "renderRow", "renderRowExpanded", "renderLoading", "renderEmpty", "onSortColumn", "onScroll", "renderTreeToggle", "onRowClick", "onRowContextMenu", "onExpandChange", "onTouchStart", "onTouchMove", "onTouchEnd", "dataTheme", "tableBodyHeight", "columns", "tableBodyRef", "tableKey", "handleInfiniteScroll", "infiniteLoading", "wheelWrapperRef"],
4
4
  _excluded2 = ["depth", "rowIndex"],
5
5
  _excluded3 = ["cellHeight"];
6
6
  import { getTranslateDOMPositionXY } from 'dom-lib/translateDOMPositionXY';
@@ -116,13 +116,15 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
116
116
  columns = props.columns,
117
117
  tableBodyRef = props.tableBodyRef,
118
118
  tableKey = props.tableKey,
119
+ handleInfiniteScroll = props.handleInfiniteScroll,
120
+ infiniteLoading = props.infiniteLoading,
121
+ wheelWrapperRef = props.wheelWrapperRef,
119
122
  rest = _objectWithoutPropertiesLoose(props, _excluded);
120
123
  var _useClassNames = useClassNames(classPrefix, typeof classPrefix !== 'undefined'),
121
124
  withClassPrefix = _useClassNames.withClassPrefix,
122
125
  mergeCls = _useClassNames.merge,
123
126
  prefix = _useClassNames.prefix;
124
127
  var childTableRef = useRef(null);
125
-
126
128
  // Use `forceUpdate` to force the component to re-render after manipulating the DOM.
127
129
  var _useReducer = useReducer(function (x) {
128
130
  return x + 1;
@@ -181,7 +183,6 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
181
183
  var affixHeaderWrapperRef = useRef(null);
182
184
  var headerWrapperRef = useRef(null);
183
185
  // const tableBodyRef = useRef<HTMLDivElement>(null);
184
- var wheelWrapperRef = useRef(null);
185
186
  var scrollbarXRef = useRef(null);
186
187
  var scrollbarYRef = useRef(null);
187
188
  var handleTableResizeChange = function handleTableResizeChange(_prevSize, event) {
@@ -293,7 +294,8 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
293
294
  onScroll: onScroll,
294
295
  onTouchStart: onTouchStart,
295
296
  onTouchMove: onTouchMove,
296
- onTouchEnd: onTouchEnd
297
+ onTouchEnd: onTouchEnd,
298
+ handleInfiniteScroll: handleInfiniteScroll
297
299
  }),
298
300
  isScrolling = _useScrollListener.isScrolling,
299
301
  isChildFocused = _useScrollListener.isChildFocused,
@@ -617,7 +619,9 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
617
619
  width: tableWidth.current
618
620
  },
619
621
  length: tableWidth.current,
620
- onScroll: onScrollHorizontal,
622
+ onScroll: function onScroll(delta) {
623
+ onScrollHorizontal(delta), console.log('onScrollHorizontal', delta);
624
+ },
621
625
  scrollLength: contentWidth.current,
622
626
  ref: scrollbarXRef
623
627
  }));
@@ -781,7 +785,9 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
781
785
  role: "rowgroup",
782
786
  className: prefix('body-row-wrapper'),
783
787
  style: bodyStyles,
784
- onScroll: onScrollBody
788
+ onScroll: function onScroll(e) {
789
+ onScrollBody === null || onScrollBody === void 0 ? void 0 : onScrollBody(e); // existing handler
790
+ }
785
791
  }, !loading && /*#__PURE__*/React.createElement("div", {
786
792
  style: wheelStyles,
787
793
  className: prefix('body-wheel-area'),
@@ -792,7 +798,12 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
792
798
  }) : null, visibleRows.current, bottomHideHeight ? /*#__PURE__*/React.createElement(Row, {
793
799
  style: bottomRowStyles,
794
800
  className: "virtualized"
795
- }) : null), /*#__PURE__*/React.createElement(EmptyMessage, {
801
+ }) : null, infiniteLoading && /*#__PURE__*/React.createElement("div", {
802
+ style: {
803
+ padding: 12,
804
+ textAlign: 'center'
805
+ }
806
+ }, /*#__PURE__*/React.createElement("span", null, "Loading more rows\u2026"))), /*#__PURE__*/React.createElement(EmptyMessage, {
796
807
  locale: locale,
797
808
  renderEmpty: renderEmpty,
798
809
  addPrefix: prefix,
@@ -22,6 +22,7 @@ import { SettingsIcon } from './utilities/icons';
22
22
  import '../../dist/css/qbs-react-grid.css';
23
23
  var CHECKBOX_LINE_HEIGHT = '36px';
24
24
  var COLUMN_WIDTH = 250;
25
+ var REFRESH_KEY = 0;
25
26
  var QbsTable = function QbsTable(_ref) {
26
27
  var _Object$keys;
27
28
  var handleColumnSort = _ref.handleColumnSort,
@@ -106,7 +107,12 @@ var QbsTable = function QbsTable(_ref) {
106
107
  _ref$isCustomTableCar = _ref.isCustomTableCardView,
107
108
  isCustomTableCardView = _ref$isCustomTableCar === void 0 ? false : _ref$isCustomTableCar,
108
109
  handleTableCardView = _ref.handleTableCardView,
109
- handleCustomCardLoader = _ref.handleCustomCardLoader;
110
+ handleCustomCardLoader = _ref.handleCustomCardLoader,
111
+ hasMoreData = _ref.hasMoreData,
112
+ loadMoreData = _ref.loadMoreData,
113
+ infiniteLoading = _ref.infiniteLoading,
114
+ _ref$infiniteScroll = _ref.infiniteScroll,
115
+ infiniteScroll = _ref$infiniteScroll === void 0 ? false : _ref$infiniteScroll;
110
116
  var _useState = useState(false),
111
117
  loading = _useState[0],
112
118
  setLoading = _useState[1];
@@ -129,6 +135,7 @@ var QbsTable = function QbsTable(_ref) {
129
135
  setTableViewToggle = _useState5[1];
130
136
  var isMobile = useResponsiveStore();
131
137
  var tableBodyRef = useRef(null);
138
+ var wheelWrapperRef = useRef(null);
132
139
  var handleSortColumn = useCallback(function (sortColumn, sortType) {
133
140
  setLoading(true);
134
141
  setTimeout(function () {
@@ -198,6 +205,7 @@ var QbsTable = function QbsTable(_ref) {
198
205
  }, [columns]);
199
206
  var handleColumnWidth = useCallback(function (newWidth, dataKey) {
200
207
  if (newWidth === undefined || dataKey === undefined) return;
208
+ REFRESH_KEY = REFRESH_KEY + 1;
201
209
  setColumns(function (prevColumns) {
202
210
  return prevColumns.map(function (column) {
203
211
  return column.field === dataKey ? _extends({}, column, {
@@ -544,6 +552,19 @@ var QbsTable = function QbsTable(_ref) {
544
552
  },
545
553
  // ✅ Fix: Type assertion to ReactElement[]
546
554
  [columns, dataTheme]);
555
+ var handleInfiniteScroll = function handleInfiniteScroll(scroll) {
556
+ if (!infiniteScroll) return;
557
+ var wrapper = wheelWrapperRef.current;
558
+ if (!wrapper || !hasMoreData || infiniteLoading) return;
559
+ var scrollTop = wrapper.scrollTop,
560
+ clientHeight = wrapper.clientHeight;
561
+ var scrollHeight = Math.abs(scroll) + (height - headerHeight);
562
+
563
+ // Trigger fetch when user scrolls within 100px of bottom
564
+ if (scrollTop + clientHeight >= scrollHeight - 70) {
565
+ loadMoreData === null || loadMoreData === void 0 ? void 0 : loadMoreData(); // fetch next page here
566
+ }
567
+ };
547
568
  return /*#__PURE__*/React.createElement("div", {
548
569
  className: "qbs-table " + classes.tableContainerClass,
549
570
  "data-theme": dataTheme
@@ -551,19 +572,23 @@ var QbsTable = function QbsTable(_ref) {
551
572
  className: "qbs-table-border-wrap"
552
573
  }, tableViewToggle ? /*#__PURE__*/React.createElement(Table, {
553
574
  height: autoHeight ? undefined : height,
554
- key: tableKey,
575
+ key: tableKey + REFRESH_KEY,
555
576
  tableKey: tableKey,
556
577
  data: data,
578
+ refreshRow: REFRESH_KEY,
557
579
  tableBodyRef: tableBodyRef,
558
580
  dataTheme: dataTheme,
559
581
  wordWrap: wordWrap,
582
+ wheelWrapperRef: wheelWrapperRef,
560
583
  autoHeight: autoHeight,
584
+ handleInfiniteScroll: handleInfiniteScroll,
561
585
  sortColumn: sortColumn,
562
586
  style: {
563
587
  position: 'relative'
564
588
  },
565
589
  sortType: sortType,
566
590
  onSortColumn: handleSortColumn,
591
+ infiniteLoading: infiniteLoading,
567
592
  onRowClick: onRowClick,
568
593
  tableBodyHeight: tableBodyHeight,
569
594
  cellBordered: cellBordered,
@@ -110,6 +110,7 @@ var QbsTable = function QbsTable(_ref) {
110
110
  setIsOpen = _useState4[1];
111
111
  var prevColumns = useRef(null);
112
112
  var tableBodyRef = useRef(null);
113
+ var wheelWrapperRef = useRef(null);
113
114
  var handleSortColumn = useCallback(function (sortColumn, sortType) {
114
115
  setLoading(true);
115
116
  setTimeout(function () {
@@ -418,6 +419,7 @@ var QbsTable = function QbsTable(_ref) {
418
419
  wordWrap: wordWrap,
419
420
  autoHeight: autoHeight,
420
421
  sortColumn: sortColumn,
422
+ wheelWrapperRef: wheelWrapperRef,
421
423
  style: {
422
424
  position: 'relative'
423
425
  },
@@ -127,6 +127,10 @@ export interface QbsTableProps {
127
127
  handleTableCardView?: (data: any) => React.ReactNode;
128
128
  isCustomTableCardView?: boolean;
129
129
  handleCustomCardLoader?: () => React.ReactNode;
130
+ hasMoreData?: boolean;
131
+ loadMoreData?: () => void;
132
+ infiniteScroll?: boolean;
133
+ infiniteLoading?: boolean;
130
134
  }
131
135
  export interface QbsTableToolbarProps {
132
136
  title?: string;
@@ -151,7 +151,6 @@ var useCellDescriptor = function useCellDescriptor(props) {
151
151
  if (treeCol) {
152
152
  hasCustomTreeCol = true;
153
153
  }
154
- console.log(columns);
155
154
  if ((columnChildren === null || columnChildren === void 0 ? void 0 : columnChildren.length) !== 2) {
156
155
  throw new Error("Component <HeaderCell> and <Cell> is required, column index: " + index + " ");
157
156
  }
@@ -31,6 +31,7 @@ interface ScrollListenerProps {
31
31
  onTouchStart?: (event: React.TouchEvent) => void;
32
32
  onTouchMove?: (event: React.TouchEvent) => void;
33
33
  onTouchEnd?: (event: React.TouchEvent) => void;
34
+ handleInfiniteScroll?: (value: number) => void;
34
35
  }
35
36
  /**
36
37
  * Add scroll, touch, and wheel monitoring events to the table,
@@ -68,7 +68,8 @@ var useScrollListener = function useScrollListener(props) {
68
68
  contentHeight = props.contentHeight,
69
69
  headerHeight = props.headerHeight,
70
70
  rtl = props.rtl,
71
- tableKey = props.tableKey;
71
+ tableKey = props.tableKey,
72
+ handleInfiniteScroll = props.handleInfiniteScroll;
72
73
  var wheelListener = useRef(null);
73
74
  var touchStartListener = useRef(null);
74
75
  var touchMoveListener = useRef(null);
@@ -130,6 +131,10 @@ var useScrollListener = function useScrollListener(props) {
130
131
  var x = Math.min(0, nextScrollX < minScrollX.current ? minScrollX.current : nextScrollX);
131
132
  setScrollX(x);
132
133
  setScrollY(y);
134
+ console.log(scrollY.current, contentHeight.current, nextScrollY, minScrollY.current, 'scrolllistner');
135
+ if (typeof handleInfiniteScroll === 'function' && deltaY !== 0 && !loading && Math.abs(y) + getTableHeight() >= contentHeight.current - 12) {
136
+ handleInfiniteScroll(scrollY.current);
137
+ }
133
138
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(Math.abs(x), Math.abs(y));
134
139
  if (virtualized) {
135
140
  // Add a state to the table during virtualized scrolling.
@@ -207,7 +212,6 @@ var useScrollListener = function useScrollListener(props) {
207
212
  if (!isTouching.current) {
208
213
  return;
209
214
  }
210
- console.log('handleTouchMove');
211
215
  var _event$touches$2 = event.touches[0],
212
216
  pageX = _event$touches$2.pageX,
213
217
  pageY = _event$touches$2.pageY;
package/lib/Table.d.ts CHANGED
@@ -96,9 +96,12 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
96
96
  virtualized?: boolean;
97
97
  /**Theme Change */
98
98
  dataTheme?: string;
99
+ /** Refresh Row */
100
+ refreshRow?: number;
99
101
  /** Tree table, the callback function in the expanded node */
100
102
  renderTreeToggle?: (expandButton: React.ReactNode, rowData?: Row, expanded?: boolean) => React.ReactNode;
101
103
  tableKey?: string;
104
+ infiniteLoading?: boolean;
102
105
  /** Customize what you can do to expand a zone */
103
106
  renderRowExpanded?: (rowData?: Row) => React.ReactNode;
104
107
  /** Custom row element */
@@ -123,6 +126,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
123
126
  onTouchMove?: (event: React.TouchEvent) => void;
124
127
  /** Callback for the `touchend` event. */
125
128
  onTouchEnd?: (event: React.TouchEvent) => void;
129
+ handleInfiniteScroll?: (value: number) => void;
126
130
  /**
127
131
  * Callback after table data update.
128
132
  * @deprecated use `shouldUpdateScroll` instead
@@ -132,6 +136,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
132
136
  y: number;
133
137
  }) => void) => void;
134
138
  tableBodyRef: React.RefObject<HTMLDivElement>;
139
+ wheelWrapperRef: React.RefObject<HTMLDivElement | null>;
135
140
  bodyRef?: (ref: HTMLElement) => void;
136
141
  }
137
142
  export interface TableInstance<Row, Key> extends React.FunctionComponent<TableProps<Row, Key>> {
package/lib/Table.js CHANGED
@@ -20,7 +20,7 @@ var _Row = _interopRequireDefault(require("./Row"));
20
20
  var _Scrollbar = _interopRequireDefault(require("./Scrollbar"));
21
21
  var _TableContext = _interopRequireDefault(require("./TableContext"));
22
22
  var _utils = require("./utils");
23
- var _excluded = ["affixHeader", "children", "classPrefix", "className", "data", "defaultSortType", "width", "expandedRowKeys", "defaultExpandAllRows", "defaultExpandedRowKeys", "style", "id", "isTree", "hover", "bordered", "cellBordered", "wordWrap", "loading", "locale", "showHeader", "pagination", "paginationProps", "sortColumn", "rowHeight", "sortType", "headerHeight", "minHeight", "height", "autoHeight", "fillHeight", "rtl", "translate3d", "rowKey", "virtualized", "rowClassName", "rowExpandedHeight", "disabledScroll", "affixHorizontalScrollbar", "loadAnimation", "shouldUpdateScroll", "renderRow", "renderRowExpanded", "renderLoading", "renderEmpty", "onSortColumn", "onScroll", "renderTreeToggle", "onRowClick", "onRowContextMenu", "onExpandChange", "onTouchStart", "onTouchMove", "onTouchEnd", "dataTheme", "tableBodyHeight", "columns", "tableBodyRef", "tableKey"],
23
+ var _excluded = ["affixHeader", "children", "classPrefix", "className", "data", "defaultSortType", "width", "expandedRowKeys", "defaultExpandAllRows", "defaultExpandedRowKeys", "style", "id", "isTree", "hover", "bordered", "cellBordered", "wordWrap", "loading", "locale", "showHeader", "pagination", "paginationProps", "sortColumn", "rowHeight", "sortType", "headerHeight", "minHeight", "height", "autoHeight", "fillHeight", "rtl", "translate3d", "rowKey", "virtualized", "rowClassName", "rowExpandedHeight", "disabledScroll", "affixHorizontalScrollbar", "loadAnimation", "shouldUpdateScroll", "renderRow", "renderRowExpanded", "renderLoading", "renderEmpty", "onSortColumn", "onScroll", "renderTreeToggle", "onRowClick", "onRowContextMenu", "onExpandChange", "onTouchStart", "onTouchMove", "onTouchEnd", "dataTheme", "tableBodyHeight", "columns", "tableBodyRef", "tableKey", "handleInfiniteScroll", "infiniteLoading", "wheelWrapperRef"],
24
24
  _excluded2 = ["depth", "rowIndex"],
25
25
  _excluded3 = ["cellHeight"];
26
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -123,13 +123,15 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
123
123
  columns = props.columns,
124
124
  tableBodyRef = props.tableBodyRef,
125
125
  tableKey = props.tableKey,
126
+ handleInfiniteScroll = props.handleInfiniteScroll,
127
+ infiniteLoading = props.infiniteLoading,
128
+ wheelWrapperRef = props.wheelWrapperRef,
126
129
  rest = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
127
130
  var _useClassNames = (0, _utils.useClassNames)(classPrefix, typeof classPrefix !== 'undefined'),
128
131
  withClassPrefix = _useClassNames.withClassPrefix,
129
132
  mergeCls = _useClassNames.merge,
130
133
  prefix = _useClassNames.prefix;
131
134
  var childTableRef = (0, _react.useRef)(null);
132
-
133
135
  // Use `forceUpdate` to force the component to re-render after manipulating the DOM.
134
136
  var _useReducer = (0, _react.useReducer)(function (x) {
135
137
  return x + 1;
@@ -188,7 +190,6 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
188
190
  var affixHeaderWrapperRef = (0, _react.useRef)(null);
189
191
  var headerWrapperRef = (0, _react.useRef)(null);
190
192
  // const tableBodyRef = useRef<HTMLDivElement>(null);
191
- var wheelWrapperRef = (0, _react.useRef)(null);
192
193
  var scrollbarXRef = (0, _react.useRef)(null);
193
194
  var scrollbarYRef = (0, _react.useRef)(null);
194
195
  var handleTableResizeChange = function handleTableResizeChange(_prevSize, event) {
@@ -300,7 +301,8 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
300
301
  onScroll: onScroll,
301
302
  onTouchStart: onTouchStart,
302
303
  onTouchMove: onTouchMove,
303
- onTouchEnd: onTouchEnd
304
+ onTouchEnd: onTouchEnd,
305
+ handleInfiniteScroll: handleInfiniteScroll
304
306
  }),
305
307
  isScrolling = _useScrollListener.isScrolling,
306
308
  isChildFocused = _useScrollListener.isChildFocused,
@@ -624,7 +626,9 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
624
626
  width: tableWidth.current
625
627
  },
626
628
  length: tableWidth.current,
627
- onScroll: onScrollHorizontal,
629
+ onScroll: function onScroll(delta) {
630
+ onScrollHorizontal(delta), console.log('onScrollHorizontal', delta);
631
+ },
628
632
  scrollLength: contentWidth.current,
629
633
  ref: scrollbarXRef
630
634
  }));
@@ -788,7 +792,9 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
788
792
  role: "rowgroup",
789
793
  className: prefix('body-row-wrapper'),
790
794
  style: bodyStyles,
791
- onScroll: onScrollBody
795
+ onScroll: function onScroll(e) {
796
+ onScrollBody === null || onScrollBody === void 0 ? void 0 : onScrollBody(e); // existing handler
797
+ }
792
798
  }, !loading && /*#__PURE__*/_react["default"].createElement("div", {
793
799
  style: wheelStyles,
794
800
  className: prefix('body-wheel-area'),
@@ -799,7 +805,12 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
799
805
  }) : null, visibleRows.current, bottomHideHeight ? /*#__PURE__*/_react["default"].createElement(_Row["default"], {
800
806
  style: bottomRowStyles,
801
807
  className: "virtualized"
802
- }) : null), /*#__PURE__*/_react["default"].createElement(_EmptyMessage["default"], {
808
+ }) : null, infiniteLoading && /*#__PURE__*/_react["default"].createElement("div", {
809
+ style: {
810
+ padding: 12,
811
+ textAlign: 'center'
812
+ }
813
+ }, /*#__PURE__*/_react["default"].createElement("span", null, "Loading more rows\u2026"))), /*#__PURE__*/_react["default"].createElement(_EmptyMessage["default"], {
803
814
  locale: locale,
804
815
  renderEmpty: renderEmpty,
805
816
  addPrefix: prefix,
@@ -28,6 +28,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
28
28
 
29
29
  var CHECKBOX_LINE_HEIGHT = '36px';
30
30
  var COLUMN_WIDTH = 250;
31
+ var REFRESH_KEY = 0;
31
32
  var QbsTable = function QbsTable(_ref) {
32
33
  var _Object$keys;
33
34
  var handleColumnSort = _ref.handleColumnSort,
@@ -112,7 +113,12 @@ var QbsTable = function QbsTable(_ref) {
112
113
  _ref$isCustomTableCar = _ref.isCustomTableCardView,
113
114
  isCustomTableCardView = _ref$isCustomTableCar === void 0 ? false : _ref$isCustomTableCar,
114
115
  handleTableCardView = _ref.handleTableCardView,
115
- handleCustomCardLoader = _ref.handleCustomCardLoader;
116
+ handleCustomCardLoader = _ref.handleCustomCardLoader,
117
+ hasMoreData = _ref.hasMoreData,
118
+ loadMoreData = _ref.loadMoreData,
119
+ infiniteLoading = _ref.infiniteLoading,
120
+ _ref$infiniteScroll = _ref.infiniteScroll,
121
+ infiniteScroll = _ref$infiniteScroll === void 0 ? false : _ref$infiniteScroll;
116
122
  var _useState = (0, _react.useState)(false),
117
123
  loading = _useState[0],
118
124
  setLoading = _useState[1];
@@ -135,6 +141,7 @@ var QbsTable = function QbsTable(_ref) {
135
141
  setTableViewToggle = _useState5[1];
136
142
  var isMobile = (0, _useResponsiveStore["default"])();
137
143
  var tableBodyRef = (0, _react.useRef)(null);
144
+ var wheelWrapperRef = (0, _react.useRef)(null);
138
145
  var handleSortColumn = (0, _react.useCallback)(function (sortColumn, sortType) {
139
146
  setLoading(true);
140
147
  setTimeout(function () {
@@ -204,6 +211,7 @@ var QbsTable = function QbsTable(_ref) {
204
211
  }, [columns]);
205
212
  var handleColumnWidth = (0, _react.useCallback)(function (newWidth, dataKey) {
206
213
  if (newWidth === undefined || dataKey === undefined) return;
214
+ REFRESH_KEY = REFRESH_KEY + 1;
207
215
  setColumns(function (prevColumns) {
208
216
  return prevColumns.map(function (column) {
209
217
  return column.field === dataKey ? (0, _extends2["default"])({}, column, {
@@ -550,6 +558,19 @@ var QbsTable = function QbsTable(_ref) {
550
558
  },
551
559
  // ✅ Fix: Type assertion to ReactElement[]
552
560
  [columns, dataTheme]);
561
+ var handleInfiniteScroll = function handleInfiniteScroll(scroll) {
562
+ if (!infiniteScroll) return;
563
+ var wrapper = wheelWrapperRef.current;
564
+ if (!wrapper || !hasMoreData || infiniteLoading) return;
565
+ var scrollTop = wrapper.scrollTop,
566
+ clientHeight = wrapper.clientHeight;
567
+ var scrollHeight = Math.abs(scroll) + (height - headerHeight);
568
+
569
+ // Trigger fetch when user scrolls within 100px of bottom
570
+ if (scrollTop + clientHeight >= scrollHeight - 70) {
571
+ loadMoreData === null || loadMoreData === void 0 ? void 0 : loadMoreData(); // fetch next page here
572
+ }
573
+ };
553
574
  return /*#__PURE__*/_react["default"].createElement("div", {
554
575
  className: "qbs-table " + classes.tableContainerClass,
555
576
  "data-theme": dataTheme
@@ -557,19 +578,23 @@ var QbsTable = function QbsTable(_ref) {
557
578
  className: "qbs-table-border-wrap"
558
579
  }, tableViewToggle ? /*#__PURE__*/_react["default"].createElement(_Table["default"], {
559
580
  height: autoHeight ? undefined : height,
560
- key: tableKey,
581
+ key: tableKey + REFRESH_KEY,
561
582
  tableKey: tableKey,
562
583
  data: data,
584
+ refreshRow: REFRESH_KEY,
563
585
  tableBodyRef: tableBodyRef,
564
586
  dataTheme: dataTheme,
565
587
  wordWrap: wordWrap,
588
+ wheelWrapperRef: wheelWrapperRef,
566
589
  autoHeight: autoHeight,
590
+ handleInfiniteScroll: handleInfiniteScroll,
567
591
  sortColumn: sortColumn,
568
592
  style: {
569
593
  position: 'relative'
570
594
  },
571
595
  sortType: sortType,
572
596
  onSortColumn: handleSortColumn,
597
+ infiniteLoading: infiniteLoading,
573
598
  onRowClick: onRowClick,
574
599
  tableBodyHeight: tableBodyHeight,
575
600
  cellBordered: cellBordered,
@@ -116,6 +116,7 @@ var QbsTable = function QbsTable(_ref) {
116
116
  setIsOpen = _useState4[1];
117
117
  var prevColumns = (0, _react.useRef)(null);
118
118
  var tableBodyRef = (0, _react.useRef)(null);
119
+ var wheelWrapperRef = (0, _react.useRef)(null);
119
120
  var handleSortColumn = (0, _react.useCallback)(function (sortColumn, sortType) {
120
121
  setLoading(true);
121
122
  setTimeout(function () {
@@ -424,6 +425,7 @@ var QbsTable = function QbsTable(_ref) {
424
425
  wordWrap: wordWrap,
425
426
  autoHeight: autoHeight,
426
427
  sortColumn: sortColumn,
428
+ wheelWrapperRef: wheelWrapperRef,
427
429
  style: {
428
430
  position: 'relative'
429
431
  },
@@ -127,6 +127,10 @@ export interface QbsTableProps {
127
127
  handleTableCardView?: (data: any) => React.ReactNode;
128
128
  isCustomTableCardView?: boolean;
129
129
  handleCustomCardLoader?: () => React.ReactNode;
130
+ hasMoreData?: boolean;
131
+ loadMoreData?: () => void;
132
+ infiniteScroll?: boolean;
133
+ infiniteLoading?: boolean;
130
134
  }
131
135
  export interface QbsTableToolbarProps {
132
136
  title?: string;
@@ -158,7 +158,6 @@ var useCellDescriptor = function useCellDescriptor(props) {
158
158
  if (treeCol) {
159
159
  hasCustomTreeCol = true;
160
160
  }
161
- console.log(columns);
162
161
  if ((columnChildren === null || columnChildren === void 0 ? void 0 : columnChildren.length) !== 2) {
163
162
  throw new Error("Component <HeaderCell> and <Cell> is required, column index: " + index + " ");
164
163
  }
@@ -31,6 +31,7 @@ interface ScrollListenerProps {
31
31
  onTouchStart?: (event: React.TouchEvent) => void;
32
32
  onTouchMove?: (event: React.TouchEvent) => void;
33
33
  onTouchEnd?: (event: React.TouchEvent) => void;
34
+ handleInfiniteScroll?: (value: number) => void;
34
35
  }
35
36
  /**
36
37
  * Add scroll, touch, and wheel monitoring events to the table,
@@ -72,7 +72,8 @@ var useScrollListener = function useScrollListener(props) {
72
72
  contentHeight = props.contentHeight,
73
73
  headerHeight = props.headerHeight,
74
74
  rtl = props.rtl,
75
- tableKey = props.tableKey;
75
+ tableKey = props.tableKey,
76
+ handleInfiniteScroll = props.handleInfiniteScroll;
76
77
  var wheelListener = (0, _react.useRef)(null);
77
78
  var touchStartListener = (0, _react.useRef)(null);
78
79
  var touchMoveListener = (0, _react.useRef)(null);
@@ -134,6 +135,10 @@ var useScrollListener = function useScrollListener(props) {
134
135
  var x = Math.min(0, nextScrollX < minScrollX.current ? minScrollX.current : nextScrollX);
135
136
  setScrollX(x);
136
137
  setScrollY(y);
138
+ console.log(scrollY.current, contentHeight.current, nextScrollY, minScrollY.current, 'scrolllistner');
139
+ if (typeof handleInfiniteScroll === 'function' && deltaY !== 0 && !loading && Math.abs(y) + getTableHeight() >= contentHeight.current - 12) {
140
+ handleInfiniteScroll(scrollY.current);
141
+ }
137
142
  onScroll === null || onScroll === void 0 ? void 0 : onScroll(Math.abs(x), Math.abs(y));
138
143
  if (virtualized) {
139
144
  // Add a state to the table during virtualized scrolling.
@@ -211,7 +216,6 @@ var useScrollListener = function useScrollListener(props) {
211
216
  if (!isTouching.current) {
212
217
  return;
213
218
  }
214
- console.log('handleTouchMove');
215
219
  var _event$touches$2 = event.touches[0],
216
220
  pageX = _event$touches$2.pageX,
217
221
  pageY = _event$touches$2.pageY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qbs-react-grid",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "A React table component",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -72,7 +72,7 @@
72
72
  "@commitlint/cli": "^13.1.0",
73
73
  "@commitlint/config-conventional": "^13.1.0",
74
74
  "@faker-js/faker": "^7.6.0",
75
- "@testing-library/react": "^13.4.0",
75
+ "@testing-library/react": "^16.2.0",
76
76
  "@types/lodash": "^4.14.165",
77
77
  "@types/prop-types": "^15.7.1",
78
78
  "@types/react": "^19.0.11",
@@ -97,7 +97,6 @@ const HeaderCell = React.forwardRef((props: HeaderCellProps, ref: React.Ref<HTML
97
97
  onSortColumn?.(sortKey ?? dataKey);
98
98
  }
99
99
  }, [dataKey, onSortColumn, sortable, sortKey]);
100
-
101
100
  const handleColumnResizeStart = useCallback(() => {
102
101
  onColumnResizeStart?.(columnWidth, left, !!fixed);
103
102
  }, [columnWidth, fixed, left, onColumnResizeStart]);
package/src/Table.tsx CHANGED
@@ -216,7 +216,8 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
216
216
 
217
217
  /**Theme Change */
218
218
  dataTheme?: string;
219
-
219
+ /** Refresh Row */
220
+ refreshRow?: number;
220
221
  /** Tree table, the callback function in the expanded node */
221
222
  renderTreeToggle?: (
222
223
  expandButton: React.ReactNode,
@@ -224,6 +225,7 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
224
225
  expanded?: boolean
225
226
  ) => React.ReactNode;
226
227
  tableKey?: string;
228
+ infiniteLoading?: boolean;
227
229
  /** Customize what you can do to expand a zone */
228
230
  renderRowExpanded?: (rowData?: Row) => React.ReactNode;
229
231
 
@@ -259,13 +261,16 @@ export interface TableProps<Row, Key> extends Omit<StandardProps, 'onScroll'> {
259
261
 
260
262
  /** Callback for the `touchend` event. */
261
263
  onTouchEnd?: (event: React.TouchEvent) => void;
262
-
264
+ handleInfiniteScroll?: (value: number) => void;
263
265
  /**
264
266
  * Callback after table data update.
265
267
  * @deprecated use `shouldUpdateScroll` instead
266
268
  **/
267
269
  onDataUpdated?: (nextData: Row[], scrollTo: (coord: { x: number; y: number }) => void) => void;
268
270
  tableBodyRef: React.RefObject<HTMLDivElement>;
271
+
272
+ wheelWrapperRef: React.RefObject<HTMLDivElement | null>;
273
+
269
274
  bodyRef?: (ref: HTMLElement) => void;
270
275
  }
271
276
 
@@ -340,6 +345,9 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
340
345
  columns,
341
346
  tableBodyRef,
342
347
  tableKey,
348
+ handleInfiniteScroll,
349
+ infiniteLoading,
350
+ wheelWrapperRef,
343
351
  ...rest
344
352
  } = props;
345
353
 
@@ -349,7 +357,6 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
349
357
  prefix
350
358
  } = useClassNames(classPrefix, typeof classPrefix !== 'undefined');
351
359
  const childTableRef = useRef<HTMLDivElement>(null);
352
-
353
360
  // Use `forceUpdate` to force the component to re-render after manipulating the DOM.
354
361
  const [, forceUpdate] = useReducer(x => x + 1, 0);
355
362
  const [expandedRowKeys, setExpandedRowKeys] = useControlled(
@@ -408,7 +415,6 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
408
415
  const affixHeaderWrapperRef = useRef<HTMLDivElement>(null);
409
416
  const headerWrapperRef = useRef<HTMLDivElement>(null);
410
417
  // const tableBodyRef = useRef<HTMLDivElement>(null);
411
- const wheelWrapperRef = useRef<HTMLDivElement>(null);
412
418
  const scrollbarXRef = useRef<ScrollbarInstance>(null);
413
419
  const scrollbarYRef = useRef<ScrollbarInstance>(null);
414
420
 
@@ -533,7 +539,8 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
533
539
  onScroll,
534
540
  onTouchStart,
535
541
  onTouchMove,
536
- onTouchEnd
542
+ onTouchEnd,
543
+ handleInfiniteScroll
537
544
  });
538
545
 
539
546
  const { headerCells, bodyCells, allColumnsWidth, hasCustomTreeCol } = useCellDescriptor({
@@ -953,7 +960,9 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
953
960
  tableId={id}
954
961
  style={{ width: tableWidth.current }}
955
962
  length={tableWidth.current}
956
- onScroll={onScrollHorizontal}
963
+ onScroll={delta => {
964
+ onScrollHorizontal(delta), console.log('onScrollHorizontal', delta);
965
+ }}
957
966
  scrollLength={contentWidth.current}
958
967
  ref={scrollbarXRef}
959
968
  />
@@ -1132,13 +1141,21 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
1132
1141
  role="rowgroup"
1133
1142
  className={prefix('body-row-wrapper')}
1134
1143
  style={bodyStyles}
1135
- onScroll={onScrollBody}
1144
+ onScroll={e => {
1145
+ onScrollBody?.(e); // existing handler
1146
+ }}
1136
1147
  >
1137
1148
  {!loading && (
1138
1149
  <div style={wheelStyles} className={prefix('body-wheel-area')} ref={wheelWrapperRef}>
1139
1150
  {topHideHeight ? <Row style={topRowStyles} className="virtualized" /> : null}
1140
1151
  {visibleRows.current}
1141
1152
  {bottomHideHeight ? <Row style={bottomRowStyles} className="virtualized" /> : null}
1153
+
1154
+ {infiniteLoading && (
1155
+ <div style={{ padding: 12, textAlign: 'center' }}>
1156
+ <span>Loading more rows…</span>
1157
+ </div>
1158
+ )}
1142
1159
  </div>
1143
1160
  )}
1144
1161
 
@@ -30,6 +30,7 @@ import '../../dist/css/qbs-react-grid.css';
30
30
 
31
31
  const CHECKBOX_LINE_HEIGHT = '36px';
32
32
  const COLUMN_WIDTH = 250;
33
+ let REFRESH_KEY = 0;
33
34
  const QbsTable: React.FC<QbsTableProps> = ({
34
35
  handleColumnSort,
35
36
  data,
@@ -91,7 +92,11 @@ const QbsTable: React.FC<QbsTableProps> = ({
91
92
  childDetailHeading = '',
92
93
  isCustomTableCardView = false,
93
94
  handleTableCardView,
94
- handleCustomCardLoader
95
+ handleCustomCardLoader,
96
+ hasMoreData,
97
+ loadMoreData,
98
+ infiniteLoading,
99
+ infiniteScroll = false
95
100
  }) => {
96
101
  const [loading, setLoading] = useState(false);
97
102
  const [columns, setColumns] = useState(propColumn);
@@ -102,6 +107,8 @@ const QbsTable: React.FC<QbsTableProps> = ({
102
107
  const [tableViewToggle, setTableViewToggle] = useState(tableView);
103
108
  const isMobile = useResponsiveStore();
104
109
  const tableBodyRef = useRef<HTMLDivElement>(null);
110
+ const wheelWrapperRef = useRef<HTMLDivElement>(null);
111
+
105
112
  const handleSortColumn = useCallback(
106
113
  (sortColumn: any, sortType: any) => {
107
114
  setLoading(true);
@@ -188,6 +195,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
188
195
 
189
196
  const handleColumnWidth = useCallback((newWidth?: number, dataKey?: any) => {
190
197
  if (newWidth === undefined || dataKey === undefined) return;
198
+ REFRESH_KEY = REFRESH_KEY + 1;
191
199
  setColumns(prevColumns =>
192
200
  prevColumns.map(column =>
193
201
  column.field === dataKey ? { ...column, colWidth: newWidth } : column
@@ -564,6 +572,20 @@ const QbsTable: React.FC<QbsTableProps> = ({
564
572
  [columns, dataTheme]
565
573
  );
566
574
 
575
+ const handleInfiniteScroll = (scroll: number) => {
576
+ if (!infiniteScroll) return;
577
+ const wrapper = wheelWrapperRef.current;
578
+ if (!wrapper || !hasMoreData || infiniteLoading) return;
579
+
580
+ const { scrollTop, clientHeight } = wrapper;
581
+ const scrollHeight = Math.abs(scroll) + (height - headerHeight);
582
+
583
+ // Trigger fetch when user scrolls within 100px of bottom
584
+ if (scrollTop + clientHeight >= scrollHeight - 70) {
585
+ loadMoreData?.(); // fetch next page here
586
+ }
587
+ };
588
+
567
589
  return (
568
590
  <div className={`qbs-table ${classes.tableContainerClass}`} data-theme={dataTheme}>
569
591
  {toolbar && <ToolBar {...toolbarProps} />}
@@ -571,17 +593,21 @@ const QbsTable: React.FC<QbsTableProps> = ({
571
593
  {tableViewToggle ? (
572
594
  <Table
573
595
  height={autoHeight ? undefined : height}
574
- key={tableKey}
596
+ key={tableKey + REFRESH_KEY}
575
597
  tableKey={tableKey}
576
598
  data={data}
599
+ refreshRow={REFRESH_KEY}
577
600
  tableBodyRef={tableBodyRef as React.RefObject<HTMLDivElement>}
578
601
  dataTheme={dataTheme}
579
602
  wordWrap={wordWrap}
603
+ wheelWrapperRef={wheelWrapperRef}
580
604
  autoHeight={autoHeight}
605
+ handleInfiniteScroll={handleInfiniteScroll}
581
606
  sortColumn={sortColumn}
582
607
  style={{ position: 'relative' }}
583
608
  sortType={sortType}
584
609
  onSortColumn={handleSortColumn}
610
+ infiniteLoading={infiniteLoading}
585
611
  onRowClick={onRowClick}
586
612
  tableBodyHeight={tableBodyHeight}
587
613
  cellBordered={cellBordered}
@@ -90,6 +90,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
90
90
  const [isOpen, setIsOpen] = useState(false);
91
91
  const prevColumns = useRef<any | null>(null);
92
92
  const tableBodyRef = useRef<HTMLDivElement>(null);
93
+ const wheelWrapperRef = useRef<HTMLDivElement>(null);
93
94
  const handleSortColumn = useCallback(
94
95
  (sortColumn: any, sortType: any) => {
95
96
  setLoading(true);
@@ -450,6 +451,7 @@ const QbsTable: React.FC<QbsTableProps> = ({
450
451
  wordWrap={wordWrap}
451
452
  autoHeight={autoHeight}
452
453
  sortColumn={sortColumn}
454
+ wheelWrapperRef={wheelWrapperRef}
453
455
  style={{ position: 'relative' }}
454
456
  sortType={sortType}
455
457
  onSortColumn={handleSortColumn}
@@ -130,6 +130,10 @@ export interface QbsTableProps {
130
130
  handleTableCardView?: (data: any) => React.ReactNode;
131
131
  isCustomTableCardView?: boolean;
132
132
  handleCustomCardLoader?: () => React.ReactNode;
133
+ hasMoreData?: boolean
134
+ loadMoreData?: ()=> void
135
+ infiniteScroll?: boolean
136
+ infiniteLoading?:boolean
133
137
  }
134
138
 
135
139
  export interface QbsTableToolbarProps {
@@ -205,7 +205,6 @@ const useCellDescriptor = <Row extends RowDataType>(
205
205
  if (treeCol) {
206
206
  hasCustomTreeCol = true;
207
207
  }
208
- console.log(columns);
209
208
 
210
209
  if (columnChildren?.length !== 2) {
211
210
  throw new Error(`Component <HeaderCell> and <Cell> is required, column index: ${index} `);
@@ -4,6 +4,7 @@ import scrollLeft from 'dom-lib/scrollLeft';
4
4
  import scrollTop from 'dom-lib/scrollTop';
5
5
  import WheelHandler from 'dom-lib/WheelHandler';
6
6
  import React, { useCallback, useEffect, useRef, useState } from 'react';
7
+
7
8
  import type { ListenerCallback, RowDataType } from '../@types/common';
8
9
  import { BEZIER, SCROLLBAR_WIDTH, TRANSITION_DURATION } from '../constants';
9
10
  import type { ScrollbarInstance } from '../Scrollbar';
@@ -50,6 +51,7 @@ interface ScrollListenerProps {
50
51
  onTouchStart?: (event: React.TouchEvent) => void;
51
52
  onTouchMove?: (event: React.TouchEvent) => void;
52
53
  onTouchEnd?: (event: React.TouchEvent) => void;
54
+ handleInfiniteScroll?: (value: number) => void;
53
55
  }
54
56
 
55
57
  /**
@@ -106,7 +108,8 @@ const useScrollListener = (props: ScrollListenerProps) => {
106
108
  contentHeight,
107
109
  headerHeight,
108
110
  rtl,
109
- tableKey
111
+ tableKey,
112
+ handleInfiniteScroll
110
113
  } = props;
111
114
 
112
115
  const wheelListener = useRef<ListenerCallback>(null);
@@ -186,6 +189,21 @@ const useScrollListener = (props: ScrollListenerProps) => {
186
189
 
187
190
  setScrollX(x);
188
191
  setScrollY(y);
192
+ console.log(
193
+ scrollY.current,
194
+ contentHeight.current,
195
+ nextScrollY,
196
+ minScrollY.current,
197
+ 'scrolllistner'
198
+ );
199
+ if (
200
+ typeof handleInfiniteScroll === 'function' &&
201
+ deltaY !== 0 &&
202
+ !loading &&
203
+ Math.abs(y) + getTableHeight() >= contentHeight.current - 12
204
+ ) {
205
+ handleInfiniteScroll(scrollY.current);
206
+ }
189
207
 
190
208
  onScroll?.(Math.abs(x), Math.abs(y));
191
209
 
@@ -297,7 +315,6 @@ const useScrollListener = (props: ScrollListenerProps) => {
297
315
  if (!isTouching.current) {
298
316
  return;
299
317
  }
300
- console.log('handleTouchMove');
301
318
 
302
319
  const { pageX, pageY } = event.touches[0];
303
320
  const deltaX = touchX.current - pageX;