@tap-payments/os-micro-frontend-shared 0.1.9-test.1 → 0.1.9-test.1-test.2

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.
Files changed (78) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +12 -12
  3. package/build/components/ActionMenu/style.d.ts +1 -1
  4. package/build/components/Chip/style.d.ts +1 -1
  5. package/build/components/CountBadge/style.d.ts +1 -1
  6. package/build/components/Dialog/style.d.ts +1 -1
  7. package/build/components/FlippingCard/style.d.ts +1 -1
  8. package/build/components/ImageWrapper/ImageWrapper.d.ts +1 -1
  9. package/build/components/JSONViewer/style.d.ts +2 -2
  10. package/build/components/SearchButton/styles.d.ts +3 -3
  11. package/build/components/StatusIcons/AuthIcons/style.d.ts +2 -2
  12. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +1 -1
  13. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +6 -6
  14. package/build/components/StatusIcons/SourceIcons/style.d.ts +1 -1
  15. package/build/components/TableCells/CustomCells/ActionCell/hooks/useActionCell.d.ts +1 -1
  16. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +2 -2
  17. package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +1 -1
  18. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +2 -2
  19. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +5 -5
  20. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +5 -5
  21. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +1 -1
  22. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +1 -1
  23. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +1 -1
  24. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +5 -5
  25. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +1 -1
  26. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +2 -2
  27. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +1 -1
  28. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +1 -1
  29. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +5 -5
  30. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +1 -1
  31. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +1 -1
  32. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +2 -2
  33. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +1 -1
  34. package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +1 -1
  35. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +1 -1
  36. package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +1 -1
  37. package/build/components/TableCells/CustomCells/SourceMergedCell/SourceMergedCell.js +1 -1
  38. package/build/components/TableCells/CustomCells/SourceMergedCell/style.d.ts +6 -6
  39. package/build/components/TableCells/CustomCells/SourceMergedCell/type.d.ts +1 -1
  40. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +6 -6
  41. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +5 -5
  42. package/build/components/TableCells/CustomCells/style.d.ts +1 -1
  43. package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +34 -174
  44. package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataSection.d.ts +32 -0
  45. package/build/components/VirtualTables/SheetViewVirtualTable/components/NoDataSection.js +30 -0
  46. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.d.ts +51 -0
  47. package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumnSection.js +20 -0
  48. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/SheetViewTableHeader.js +1 -1
  49. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeader/TableCell.js +1 -1
  50. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js +1 -1
  51. package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableNoData.js +1 -1
  52. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListSection.d.ts +34 -0
  53. package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualListSection.js +76 -0
  54. package/build/components/VirtualTables/SheetViewVirtualTable/components/index.d.ts +3 -0
  55. package/build/components/VirtualTables/SheetViewVirtualTable/components/index.js +3 -0
  56. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedWidths.d.ts +5 -0
  57. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedWidths.js +12 -0
  58. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSelection.d.ts +6 -0
  59. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSelection.js +17 -0
  60. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSharedItemSize.d.ts +10 -0
  61. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSharedItemSize.js +21 -0
  62. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSheetViewStates.d.ts +14 -0
  63. package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useSheetViewStates.js +20 -0
  64. package/build/components/VirtualTables/SheetViewVirtualTable/style.d.ts +0 -2
  65. package/build/components/VirtualTables/SheetViewVirtualTable/style.js +0 -10
  66. package/build/components/VirtualTables/VirtualTable/VirtualTable.d.ts +1 -1
  67. package/build/components/VirtualTables/VirtualTable/VirtualTable.js +19 -79
  68. package/build/components/VirtualTables/VirtualTable/VirtualTableList.d.ts +19 -0
  69. package/build/components/VirtualTables/VirtualTable/VirtualTableList.js +27 -0
  70. package/build/components/VirtualTables/VirtualTable/useVirtualTable.d.ts +31 -0
  71. package/build/components/VirtualTables/VirtualTable/useVirtualTable.js +70 -0
  72. package/build/components/VirtualTables/components/TableRow.js +1 -1
  73. package/build/components/VirtualTables/components/style.d.ts +1 -1
  74. package/build/components/Window/style.d.ts +2 -2
  75. package/build/types/table.d.ts +0 -1
  76. package/package.json +2 -2
  77. /package/build/components/VirtualTables/{utils/getSelectionStyles.d.ts → components/utils.d.ts} +0 -0
  78. /package/build/components/VirtualTables/{utils/getSelectionStyles.js → components/utils.js} +0 -0
@@ -0,0 +1,27 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { memo, useCallback } from 'react';
12
+ import AutoSizer from 'react-virtualized-auto-sizer';
13
+ import InfiniteLoader from 'react-window-infinite-loader';
14
+ import { TABLE_LIST_OVER_SCAN } from '../../../constants/index.js';
15
+ import ListItemWrapper from '../components/virtualScroll/ListItemWrapper';
16
+ import { StyledVirtualList } from '../components/style';
17
+ function VirtualTableList({ rowsLength, itemsCount, threshold, tableRowHeight, areAllRowsLoaded, isFetchingNextPage, loadMoreItems, itemData, areTotalRowsNotFillingHeight, scrollToIndex, setBackdropVisibility, listRef, }) {
18
+ const isItemLoaded = useCallback((index) => index < rowsLength, [rowsLength]);
19
+ const handleOnLoadMoreItems = useCallback(() => __awaiter(this, void 0, void 0, function* () {
20
+ if (areAllRowsLoaded || isFetchingNextPage)
21
+ return;
22
+ yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
23
+ }), [areAllRowsLoaded, isFetchingNextPage, loadMoreItems]);
24
+ const itemSizeForIndex = useCallback(() => tableRowHeight, [tableRowHeight]);
25
+ return (_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: isItemLoaded, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height, width }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: height || 0, width: width || 0, itemCount: itemsCount, itemSize: itemSizeForIndex, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: false, listRef: listRef }, { children: ListItemWrapper }))) }))) })));
26
+ }
27
+ export default memo(VirtualTableList);
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import type { VariableSizeList } from 'react-window';
3
+ import type { IVirtualTable } from '../../../types/index.js';
4
+ export type UseVirtualTableArgs = Pick<IVirtualTable, 'columns' | 'rows' | 'rowProps' | 'footerProps' | 'isLoading' | 'error' | 'isFetchingNextPage' | 'scrollToIndex' | 'areAllRowsLoaded' | 'loadMoreItems'>;
5
+ export declare function useVirtualTable({ columns, rows, rowProps, footerProps, isLoading, error, isFetchingNextPage, scrollToIndex, areAllRowsLoaded, loadMoreItems, }: Readonly<UseVirtualTableArgs>): {
6
+ isDelayedFetchingNextPage: boolean;
7
+ isError: boolean;
8
+ tableLoading: boolean;
9
+ tableError: boolean;
10
+ tableEmpty: boolean;
11
+ hasTimeoutError: boolean;
12
+ showNoDataView: boolean;
13
+ orderedColumns: import("../../../types/index.js").IColumnProps<any>[];
14
+ areTotalRowsNotFillingHeight: boolean;
15
+ itemsCount: number;
16
+ itemData: {
17
+ columns: any;
18
+ isLoading: boolean;
19
+ rows: any[];
20
+ rowProps: any;
21
+ scrollToIndex: number | undefined;
22
+ totalCount: number;
23
+ lastItemIndex: number;
24
+ isError: boolean;
25
+ areAllRowsLoaded: boolean;
26
+ };
27
+ listRef: import("react").RefObject<VariableSizeList<any>>;
28
+ showBackDrop: boolean;
29
+ setBackdropVisibility: (isVisible: boolean) => void;
30
+ loadMoreItemsSafe: () => Promise<void>;
31
+ };
@@ -0,0 +1,70 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
11
+ import memoize from 'memoize-one';
12
+ import { useDelayToSetValue } from '../../../hooks/index.js';
13
+ import { hasError, isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError } from '../../../utils/index.js';
14
+ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded) => ({
15
+ columns,
16
+ isLoading,
17
+ rows,
18
+ rowProps,
19
+ scrollToIndex,
20
+ totalCount,
21
+ lastItemIndex,
22
+ isError,
23
+ areAllRowsLoaded,
24
+ }));
25
+ export function useVirtualTable({ columns, rows, rowProps, footerProps, isLoading, error, isFetchingNextPage, scrollToIndex, areAllRowsLoaded = false, loadMoreItems, }) {
26
+ var _a;
27
+ const isDelayedFetchingNextPage = !!useDelayToSetValue({ value: isFetchingNextPage, delay: 1000 });
28
+ const [showBackDrop, setShowBackdrop] = useState(false);
29
+ const isError = hasError(error);
30
+ const tableLoading = isLoading !== null && isLoading !== void 0 ? isLoading : true;
31
+ const tableError = !isLoading && rows.length === 0 && isError && !isNotFoundError(error);
32
+ const tableEmpty = !isLoading && rows.length === 0;
33
+ const hasTimeoutError = isTimeoutError(error);
34
+ const lastItemIndex = rows.length - 1;
35
+ const shownColumns = useMemo(() => columns.filter((column) => !column.hidden), [columns]);
36
+ const orderedColumns = useMemo(() => shownColumns.slice().sort((a, b) => { var _a, _b; return ((_a = a === null || a === void 0 ? void 0 : a.order) !== null && _a !== void 0 ? _a : 1000000) - ((_b = b === null || b === void 0 ? void 0 : b.order) !== null && _b !== void 0 ? _b : 1000000); }), [shownColumns]);
37
+ const areTotalRowsNotFillingHeight = isHeightNotFullyFilledByRows(rows.length) && !tableLoading;
38
+ const itemsCount = isDelayedFetchingNextPage || (areAllRowsLoaded && !areTotalRowsNotFillingHeight) ? rows.length + 1 : rows.length;
39
+ const itemData = createItemData(orderedColumns, isDelayedFetchingNextPage, rows, rowProps, scrollToIndex, lastItemIndex, (_a = footerProps === null || footerProps === void 0 ? void 0 : footerProps.totalCount) !== null && _a !== void 0 ? _a : 0, isError, areAllRowsLoaded && !areTotalRowsNotFillingHeight);
40
+ const listRef = useRef(null);
41
+ useEffect(() => {
42
+ if (listRef.current && typeof listRef.current.resetAfterIndex === 'function') {
43
+ listRef.current.resetAfterIndex(0, true);
44
+ }
45
+ }, []);
46
+ const setBackdropVisibility = useCallback((isVisible) => {
47
+ setShowBackdrop(isVisible);
48
+ }, []);
49
+ const loadMoreItemsSafe = useCallback(() => __awaiter(this, void 0, void 0, function* () {
50
+ yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
51
+ }), [loadMoreItems]);
52
+ const showNoDataView = tableLoading || tableError || tableEmpty || hasTimeoutError;
53
+ return {
54
+ isDelayedFetchingNextPage,
55
+ isError,
56
+ tableLoading,
57
+ tableError,
58
+ tableEmpty,
59
+ hasTimeoutError,
60
+ showNoDataView,
61
+ orderedColumns,
62
+ areTotalRowsNotFillingHeight,
63
+ itemsCount,
64
+ itemData,
65
+ listRef,
66
+ showBackDrop,
67
+ setBackdropVisibility,
68
+ loadMoreItemsSafe,
69
+ };
70
+ }
@@ -3,7 +3,7 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { memo, useMemo } from 'react';
4
4
  import { areEqual } from 'react-window';
5
5
  import { StyledCell, StyledTableRow } from './style';
6
- import { getSelectionStyles } from '../utils/getSelectionStyles';
6
+ import { getSelectionStyles } from './utils';
7
7
  function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = null, selectedColumn = null, onCellClick, isLastRow = false, }) {
8
8
  const renderCell = (column) => {
9
9
  const { render, format, selector } = column;
@@ -114,7 +114,7 @@ export declare const ActionIcon: import("@emotion/styled").StyledComponent<{
114
114
  "aria-description"?: string | undefined;
115
115
  "aria-details"?: string | undefined;
116
116
  "aria-disabled"?: (boolean | "false" | "true") | undefined;
117
- "aria-dropeffect"?: "none" | "copy" | "link" | "move" | "execute" | "popup" | undefined;
117
+ "aria-dropeffect"?: "none" | "link" | "copy" | "move" | "execute" | "popup" | undefined;
118
118
  "aria-errormessage"?: string | undefined;
119
119
  "aria-expanded"?: (boolean | "false" | "true") | undefined;
120
120
  "aria-flowto"?: string | undefined;
@@ -70,7 +70,7 @@ export declare const ContentWrapper: import("@emotion/styled").StyledComponent<{
70
70
  "aria-description"?: string | undefined;
71
71
  "aria-details"?: string | undefined;
72
72
  "aria-disabled"?: (boolean | "false" | "true") | undefined;
73
- "aria-dropeffect"?: "none" | "copy" | "link" | "move" | "execute" | "popup" | undefined;
73
+ "aria-dropeffect"?: "none" | "link" | "copy" | "move" | "execute" | "popup" | undefined;
74
74
  "aria-errormessage"?: string | undefined;
75
75
  "aria-expanded"?: (boolean | "false" | "true") | undefined;
76
76
  "aria-flowto"?: string | undefined;
@@ -337,7 +337,7 @@ export declare const AppContainerContainer: import("@emotion/styled").StyledComp
337
337
  "aria-description"?: string | undefined;
338
338
  "aria-details"?: string | undefined;
339
339
  "aria-disabled"?: (boolean | "false" | "true") | undefined;
340
- "aria-dropeffect"?: "none" | "copy" | "link" | "move" | "execute" | "popup" | undefined;
340
+ "aria-dropeffect"?: "none" | "link" | "copy" | "move" | "execute" | "popup" | undefined;
341
341
  "aria-errormessage"?: string | undefined;
342
342
  "aria-expanded"?: (boolean | "false" | "true") | undefined;
343
343
  "aria-flowto"?: string | undefined;
@@ -126,7 +126,6 @@ export interface IVirtualTable<R = any> {
126
126
  width: string | number;
127
127
  };
128
128
  dragControls?: DragControls;
129
- isSheetView?: boolean;
130
129
  }
131
130
  export type ColumnFilterValues = Record<string, string | string[] | Record<string, boolean> | {
132
131
  phone: string;
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.9-test.1",
5
- "testVersion": 1,
4
+ "version": "0.1.9-test.1-test.2",
5
+ "testVersion": 2,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",