@economic/taco 2.64.1-table-flickering.0 → 2.64.1-test-1.0

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/taco.css CHANGED
@@ -1623,6 +1623,10 @@ table[data-taco^='table'] tbody tr[data-row-create] td {
1623
1623
  table[data-taco^='table'] tbody tr[data-row-create] td button {
1624
1624
  @apply -mt-[3px];
1625
1625
  }
1626
+
1627
+ table[data-taco='table3'] td [data-taco='combobox'] {
1628
+ display: inline;
1629
+ }
1626
1630
  [data-taco='card-content'] > [data-taco='chart-wrapper']:not(:has([data-taco='chart-donut'], [data-taco='chart-pie'])) {
1627
1631
  @apply w-full;
1628
1632
  }
package/dist/taco.js CHANGED
@@ -37818,6 +37818,15 @@ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIn
37818
37818
  virtualiser.measure();
37819
37819
  }
37820
37820
  }, [expandedState]);
37821
+ React__default.useEffect(() => {
37822
+ const totalSize2 = virtualiser.getTotalSize();
37823
+ console.log("before measuring totalSize", totalSize2);
37824
+ virtualiser.measure();
37825
+ setTimeout(() => {
37826
+ const totalSize3 = virtualiser.getTotalSize();
37827
+ console.log("after measuring totalSize", totalSize3);
37828
+ }, 1e3);
37829
+ }, [tableMeta.fontSize.size, tableMeta.rowHeight.height, JSON.stringify(table.getState().sorting), rows.length]);
37821
37830
  const totalSize = virtualiser.getTotalSize();
37822
37831
  const virtualItems = virtualiser.getVirtualItems();
37823
37832
  const scrollToIndex = React__default.useCallback(
@@ -38428,6 +38437,21 @@ function Cell$2(props) {
38428
38437
  }
38429
38438
  return /* @__PURE__ */ React__default.createElement(CellRenderer, { ...cellProps });
38430
38439
  }
38440
+ const useResizeObserver$1 = (ref, enabled = true) => {
38441
+ const [size2, setSize] = React__default.useState();
38442
+ React__default.useEffect(() => {
38443
+ if (!ref.current || !enabled) {
38444
+ return () => void 0;
38445
+ }
38446
+ const observer = new ResizeObserver((entries) => {
38447
+ const entry = entries[0];
38448
+ setSize({ height: entry.contentRect.height, width: entry.contentRect.width });
38449
+ });
38450
+ observer.observe(ref.current);
38451
+ return () => observer.disconnect();
38452
+ }, [enabled]);
38453
+ return size2;
38454
+ };
38431
38455
  const DisplayRow = React__default.memo(function DisplayRow2(props) {
38432
38456
  var _a, _b, _c;
38433
38457
  const { children, cellRenderer: CellRenderer, index: index2, measureRow, row, table, ...otherAttributes } = props;
@@ -38522,12 +38546,14 @@ const DisplayRow = React__default.memo(function DisplayRow2(props) {
38522
38546
  }
38523
38547
  const ref = React__default.useRef(null);
38524
38548
  const expansionRef = React__default.useRef(null);
38549
+ const rowSize = useResizeObserver$1(ref, true);
38550
+ const expandedRowSize = useResizeObserver$1(expansionRef, !!expandedRow);
38525
38551
  React__default.useEffect(() => {
38526
38552
  var _a2, _b2;
38527
38553
  const rowHeight = ((_a2 = ref.current) == null ? void 0 : _a2.getBoundingClientRect().height) ?? 0;
38528
38554
  const expansionHeight = ((_b2 = expansionRef.current) == null ? void 0 : _b2.getBoundingClientRect().height) ?? 0;
38529
38555
  measureRow(rowHeight + expansionHeight);
38530
- }, [expansionRef.current]);
38556
+ }, [rowSize, expandedRowSize, measureRow]);
38531
38557
  const className = clsx("group/row", otherAttributes.className, {
38532
38558
  "hover:cursor-grab": tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== "function",
38533
38559
  "hover:cursor-pointer": typeof attributes.onClick === "function"
@@ -88395,16 +88421,19 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
88395
88421
  const _lastUsedSearch = React__default.useRef();
88396
88422
  async function loadPage(pageIndex, sorting, filters, hiddenColumns, search) {
88397
88423
  const hasDataChanged = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || JSON.stringify(hiddenColumns) !== JSON.stringify(_lastUsedHiddenColumns.current) || search !== _lastUsedSearch.current;
88398
- const isAlreadyLoadedOrLoading = _pendingPageRequests.current[pageIndex] || data.cache[pageIndex] && data.cache[pageIndex][0];
88399
- if (!hasDataChanged && isAlreadyLoadedOrLoading) {
88400
- return;
88401
- }
88402
88424
  if (hasDataChanged) {
88403
88425
  _lastUsedSorting.current = sorting;
88404
88426
  _lastUsedFilters.current = filters;
88405
88427
  _lastUsedSearch.current = search;
88406
88428
  _lastUsedHiddenColumns.current = hiddenColumns;
88407
88429
  _pendingPageRequests.current = {};
88430
+ } else {
88431
+ if (_pendingPageRequests.current[pageIndex]) {
88432
+ return;
88433
+ }
88434
+ if (data.cache[pageIndex] && data.cache[pageIndex][0]) {
88435
+ return;
88436
+ }
88408
88437
  }
88409
88438
  const dataKey = getDataKey(sorting, filters, hiddenColumns, search);
88410
88439
  _pendingPageRequests.current[pageIndex] = dataKey;
@@ -88450,7 +88479,6 @@ function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_
88450
88479
  delete _pendingPageRequests.current[pageIndex];
88451
88480
  });
88452
88481
  } catch {
88453
- delete _pendingPageRequests.current[pageIndex];
88454
88482
  }
88455
88483
  }
88456
88484
  const loadAll = async (sorting, filters, hiddenColumns, search) => {
@@ -88560,14 +88588,12 @@ function getCurrentPage(currentPages) {
88560
88588
  return currentPages[middle];
88561
88589
  }
88562
88590
  function getDirection(pageIndex, currentPages) {
88563
- if (!currentPages.length) {
88564
- return void 0;
88565
- }
88566
- if (pageIndex === currentPages[currentPages.length - 1] + 1) {
88567
- return "forward";
88568
- }
88569
- if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
88570
- return "backward";
88591
+ if (currentPages.length) {
88592
+ if (pageIndex === currentPages[currentPages.length - 1] + 1) {
88593
+ return "forward";
88594
+ } else if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
88595
+ return "backward";
88596
+ }
88571
88597
  }
88572
88598
  return void 0;
88573
88599
  }