@tap-payments/os-micro-frontend-shared 0.1.103-test.117 → 0.1.103-test.119

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.
@@ -70,6 +70,7 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
70
70
  const createPinnedStartTable = useCallback((columnsData, fixedWidth) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: true, fixedWidth: fixedWidth, onScroll: scrollHandlers.start, listRef: pinnedStartVirtualListRef }), "pinned-start")), [stableTableProps, dynamicTableProps, scrollHandlers.start, pinnedStartVirtualListRef]);
71
71
  const createPinnedEndTable = useCallback((columnsData, fixedWidth) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: true, fixedWidth: fixedWidth, onScroll: scrollHandlers.end, listRef: pinnedEndVirtualListRef }), "pinned-end")), [stableTableProps, dynamicTableProps, scrollHandlers.end, pinnedEndVirtualListRef]);
72
72
  const createScrollableTable = useCallback((columnsData) => (_jsx(VirtualTable, Object.assign({ columnsData: columnsData }, stableTableProps, dynamicTableProps, { isPinned: false, onScroll: scrollHandlers.scrollable, listRef: scrollableVirtualListRef }), "scrollable")), [stableTableProps, dynamicTableProps, scrollHandlers.scrollable, scrollableVirtualListRef]);
73
+ console.log({ selectedCell, selectedColumn, selectedRow, selectedChip });
73
74
  const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
74
75
  switch (containerKey) {
75
76
  case 'pinnedStart':
@@ -23,7 +23,6 @@ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded,
23
23
  return (_jsx(InfiniteLoader, Object.assign({ isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref }, { children: ({ height, width }) => {
24
24
  const itemSize = (index) => getItemSize(index, height);
25
25
  const itemData = getItemData(columnsData, isPinned, height);
26
- console.log('itemData', itemData);
27
26
  return (_jsx(StyledVirtualList, Object.assign({ listRef: listRef, height: height, width: fixedWidth || width, itemCount: itemCount, itemSize: itemSize, itemData: itemData, onItemsRendered: onItemsRendered, overscanCount: overscanCount, setBackdropVisibility: setBackdropVisibility, scrollToIndex: scrollToIndex, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, useIsScrolling: true, onScroll: onScroll, clearBackdropVisibilityTimeout: clearBackdropVisibilityTimeout, style: {
28
27
  overflowX: isPinned ? 'hidden' : 'auto',
29
28
  paddingBottom: isPinned ? '25px' : '13px',
@@ -31,4 +30,21 @@ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded,
31
30
  } }, { children: ListItemWrapper })));
32
31
  } }))) })));
33
32
  }
34
- export default memo(VirtualTable);
33
+ export default memo(VirtualTable, (prevProps, nextProps) => {
34
+ var _a, _b, _c;
35
+ const propsToCompare = [
36
+ 'columnsData',
37
+ 'itemCount',
38
+ 'lastItemIndex',
39
+ 'areAllRowsLoaded',
40
+ 'isPinned',
41
+ 'fixedWidth',
42
+ 'scrollToIndex',
43
+ 'areTotalRowsNotFillingHeight',
44
+ 'overscanCount',
45
+ ];
46
+ const areCriticalPropsSame = propsToCompare.every((key) => prevProps[key] === nextProps[key]);
47
+ const areColumnsDataSame = ((_a = prevProps.columnsData) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.columnsData) === null || _b === void 0 ? void 0 : _b.length) &&
48
+ ((_c = prevProps.columnsData) === null || _c === void 0 ? void 0 : _c.every((col, index) => { var _a, _b, _c, _d; return col.id === ((_b = (_a = nextProps.columnsData) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.id) && col.width === ((_d = (_c = nextProps.columnsData) === null || _c === void 0 ? void 0 : _c[index]) === null || _d === void 0 ? void 0 : _d.width); }));
49
+ return areCriticalPropsSame && areColumnsDataSame;
50
+ });
@@ -52,10 +52,11 @@ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, is
52
52
  ];
53
53
  }, [isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount, isError, areAllRowsLoaded]);
54
54
  const commonItemDataSuffix = useMemo(() => [selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick], [selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick]);
55
- const getItemDataForContainer = useCallback((columnsData, isPinnedColumn, height) => {
56
- console.log('createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight)', columnsData, commonItemDataParams, isPinnedColumn, commonItemDataSuffix, height, rowHeight);
55
+ console.log('commonItemDataSuffix = useMemo', commonItemDataSuffix);
56
+ const getItemDataForContainer = (columnsData, isPinnedColumn, height) => {
57
+ console.log('getItemDataForContainer = useCallback', commonItemDataSuffix);
57
58
  return createItemData(columnsData, ...commonItemDataParams, isPinnedColumn, ...commonItemDataSuffix, height, rowHeight);
58
- }, [commonItemDataParams, commonItemDataSuffix, rowHeight]);
59
+ };
59
60
  return {
60
61
  getItemSize,
61
62
  getItemDataForContainer,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.103-test.117",
5
- "testVersion": 117,
4
+ "version": "0.1.103-test.119",
5
+ "testVersion": 119,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",