@firecms/core 3.0.0-canary.85 → 3.0.0-canary.87

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.umd.js CHANGED
@@ -9056,6 +9056,7 @@
9056
9056
  data,
9057
9057
  onResetPagination,
9058
9058
  onEndReached,
9059
+ endOffset = 600,
9059
9060
  rowHeight = 54,
9060
9061
  columns: columnsProp,
9061
9062
  onRowClick,
@@ -9075,7 +9076,8 @@
9075
9076
  style,
9076
9077
  className,
9077
9078
  endAdornment,
9078
- AddColumnComponent
9079
+ AddColumnComponent,
9080
+ debug
9079
9081
  }) {
9080
9082
  const sortByProperty = sortBy ? sortBy[0] : void 0;
9081
9083
  const currentSort = sortBy ? sortBy[1] : void 0;
@@ -9087,9 +9089,13 @@
9087
9089
  }, [columnsProp]);
9088
9090
  const [measureRef, bounds] = useMeasure();
9089
9091
  const onColumnResizeInternal = React.useCallback((params) => {
9092
+ if (debug)
9093
+ console.log("onColumnResizeInternal", params);
9090
9094
  setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
9091
9095
  }, [columns]);
9092
9096
  const onColumnResizeEndInternal = React.useCallback((params) => {
9097
+ if (debug)
9098
+ console.log("onColumnResizeEndInternal", params);
9093
9099
  setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
9094
9100
  if (onColumnResize) {
9095
9101
  onColumnResize(params);
@@ -9097,15 +9103,21 @@
9097
9103
  }, [columns, onColumnResize]);
9098
9104
  const filterRef = React.useRef();
9099
9105
  React.useEffect(() => {
9106
+ if (debug)
9107
+ console.log("Filter updated", filterInput);
9100
9108
  filterRef.current = filterInput;
9101
9109
  }, [filterInput]);
9102
9110
  const scrollToTop = React.useCallback(() => {
9111
+ if (debug)
9112
+ console.log("scrollToTop");
9103
9113
  endReachCallbackThreshold.current = 0;
9104
9114
  if (tableRef.current) {
9105
9115
  tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
9106
9116
  }
9107
9117
  }, []);
9108
9118
  const onColumnSort = React.useCallback((key) => {
9119
+ if (debug)
9120
+ console.log("onColumnSort", key);
9109
9121
  const isDesc = sortByProperty === key && currentSort === "desc";
9110
9122
  const isAsc = sortByProperty === key && currentSort === "asc";
9111
9123
  const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
@@ -9126,26 +9138,34 @@
9126
9138
  }
9127
9139
  scrollToTop();
9128
9140
  }, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
9129
- React.useCallback(() => {
9130
- endReachCallbackThreshold.current = 0;
9131
- if (onSortByUpdate)
9132
- onSortByUpdate(void 0);
9133
- }, [onSortByUpdate]);
9134
9141
  const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
9142
+ if (debug)
9143
+ console.log("maxScroll", maxScroll);
9135
9144
  const onEndReachedInternal = React.useCallback((scrollOffset) => {
9136
- if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + 600) {
9145
+ if (debug)
9146
+ console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
9147
+ if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
9137
9148
  endReachCallbackThreshold.current = scrollOffset;
9138
9149
  onEndReached();
9139
9150
  }
9140
9151
  }, [data?.length, onEndReached]);
9141
9152
  const onScroll = React.useCallback(({
9153
+ scrollDirection,
9142
9154
  scrollOffset,
9143
9155
  scrollUpdateWasRequested
9144
9156
  }) => {
9145
- if (!scrollUpdateWasRequested && scrollOffset >= maxScroll - 600)
9157
+ if (debug)
9158
+ console.log("onScroll", {
9159
+ scrollDirection,
9160
+ scrollOffset,
9161
+ scrollUpdateWasRequested
9162
+ });
9163
+ if (!scrollUpdateWasRequested && scrollOffset >= maxScroll - endOffset)
9146
9164
  onEndReachedInternal(scrollOffset);
9147
9165
  }, [maxScroll, onEndReachedInternal]);
9148
9166
  const onFilterUpdateInternal = React.useCallback((column, filterForProperty) => {
9167
+ if (debug)
9168
+ console.log("onFilterUpdateInternal", column, filterForProperty);
9149
9169
  endReachCallbackThreshold.current = 0;
9150
9170
  const filter = filterRef.current;
9151
9171
  let newFilterValue = filter ? { ...filter } : {};
@@ -9207,6 +9227,8 @@
9207
9227
  endAdornment,
9208
9228
  AddColumnComponent
9209
9229
  };
9230
+ if (debug)
9231
+ console.log("VirtualTable render", virtualListController);
9210
9232
  return /* @__PURE__ */ jsxRuntime.jsx(
9211
9233
  "div",
9212
9234
  {
@@ -9867,7 +9889,6 @@
9867
9889
  onEndReached: loadNextPage,
9868
9890
  onResetPagination: resetPagination,
9869
9891
  error: dataLoadingError,
9870
- paginationEnabled,
9871
9892
  onColumnResize,
9872
9893
  rowHeight: getRowHeight(size),
9873
9894
  loading: dataLoading,