@carbon/ibm-products 2.41.1-canary.17 → 2.41.1-canary.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -190,6 +190,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
190
190
  listRef?: MutableRefObject<any>;
191
191
  handleResize?: () => void;
192
192
  onVirtualScroll?: (evt?: boolean) => void;
193
+ fetchMoreData?: () => void;
194
+ loadMoreThreshold?: number;
193
195
  }
194
196
  export interface ResizeHeaderProps {
195
197
  resizerProps?: ResizerProps;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useInfiniteScroll: (hooks: Hooks) => void;
1
9
  export default useInfiniteScroll;
2
- declare function useInfiniteScroll(hooks: any): void;
@@ -15,12 +15,13 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
15
15
  useResizeTable(hooks);
16
16
  var useInstance = function useInstance(instance) {
17
17
  var _tableElement;
18
- var isFetching = instance.isFetching,
19
- tableHeight = instance.tableHeight,
20
- innerListRef = instance.innerListRef,
21
- fetchMoreData = instance.fetchMoreData,
22
- tableId = instance.tableId,
23
- loadMoreThreshold = instance.loadMoreThreshold;
18
+ var _ref = instance,
19
+ isFetching = _ref.isFetching,
20
+ tableHeight = _ref.tableHeight,
21
+ innerListRef = _ref.innerListRef,
22
+ fetchMoreData = _ref.fetchMoreData,
23
+ tableId = _ref.tableId,
24
+ loadMoreThreshold = _ref.loadMoreThreshold;
24
25
  var tableElement;
25
26
  if (typeof document !== 'undefined') {
26
27
  tableElement = document.querySelector("#".concat(tableId));
@@ -33,9 +34,9 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
33
34
  leading: true,
34
35
  trailing: false
35
36
  }), [fetchMoreData]);
36
- var onScroll = function onScroll(_ref) {
37
- var scrollDirection = _ref.scrollDirection,
38
- scrollOffset = _ref.scrollOffset;
37
+ var onScroll = function onScroll(_ref2) {
38
+ var scrollDirection = _ref2.scrollDirection,
39
+ scrollOffset = _ref2.scrollOffset;
39
40
  if (innerListRef && innerListRef.current) {
40
41
  if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThresholdValue) {
41
42
  if (fetchMoreData) {
@@ -190,6 +190,8 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
190
190
  listRef?: MutableRefObject<any>;
191
191
  handleResize?: () => void;
192
192
  onVirtualScroll?: (evt?: boolean) => void;
193
+ fetchMoreData?: () => void;
194
+ loadMoreThreshold?: number;
193
195
  }
194
196
  export interface ResizeHeaderProps {
195
197
  resizerProps?: ResizerProps;
@@ -1,2 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { Hooks } from 'react-table';
8
+ declare const useInfiniteScroll: (hooks: Hooks) => void;
1
9
  export default useInfiniteScroll;
2
- declare function useInfiniteScroll(hooks: any): void;
@@ -23,12 +23,13 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
23
23
  useResizeTable["default"](hooks);
24
24
  var useInstance = function useInstance(instance) {
25
25
  var _tableElement;
26
- var isFetching = instance.isFetching,
27
- tableHeight = instance.tableHeight,
28
- innerListRef = instance.innerListRef,
29
- fetchMoreData = instance.fetchMoreData,
30
- tableId = instance.tableId,
31
- loadMoreThreshold = instance.loadMoreThreshold;
26
+ var _ref = instance,
27
+ isFetching = _ref.isFetching,
28
+ tableHeight = _ref.tableHeight,
29
+ innerListRef = _ref.innerListRef,
30
+ fetchMoreData = _ref.fetchMoreData,
31
+ tableId = _ref.tableId,
32
+ loadMoreThreshold = _ref.loadMoreThreshold;
32
33
  var tableElement;
33
34
  if (typeof document !== 'undefined') {
34
35
  tableElement = document.querySelector("#".concat(tableId));
@@ -41,9 +42,9 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
41
42
  leading: true,
42
43
  trailing: false
43
44
  }), [fetchMoreData]);
44
- var onScroll = function onScroll(_ref) {
45
- var scrollDirection = _ref.scrollDirection,
46
- scrollOffset = _ref.scrollOffset;
45
+ var onScroll = function onScroll(_ref2) {
46
+ var scrollDirection = _ref2.scrollDirection,
47
+ scrollOffset = _ref2.scrollOffset;
47
48
  if (innerListRef && innerListRef.current) {
48
49
  if (!isFetching && scrollDirection === 'forward' && scrollOffset + totalTableHeight >= innerListRef.current.clientHeight - loadMoreThresholdValue) {
49
50
  if (fetchMoreData) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.41.1-canary.17+d9bc09b97",
4
+ "version": "2.41.1-canary.18+0aa91978f",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -121,5 +121,5 @@
121
121
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
122
122
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
123
123
  },
124
- "gitHead": "d9bc09b974c0c2183b00c2584dda25bf3ec224fe"
124
+ "gitHead": "0aa91978fa9fdf3662c8f8caec9b699a5b96ff5c"
125
125
  }