@tap-payments/os-micro-frontend-shared 0.1.136-test.1 → 0.1.136-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.
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts +2 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js +40 -45
- package/build/components/index.d.ts +7 -2
- package/build/components/index.js +10 -2
- package/package.json +2 -2
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const usePerformanceOptimizations: (columns: readonly IColumnProp
|
|
|
5
5
|
visibleColumns: IColumnProps<any>[];
|
|
6
6
|
totalWidth: number;
|
|
7
7
|
columnCount: number;
|
|
8
|
-
firstColumnId: string | number | symbol
|
|
9
|
-
lastColumnId: string | number | symbol
|
|
8
|
+
firstColumnId: string | number | symbol;
|
|
9
|
+
lastColumnId: string | number | symbol;
|
|
10
10
|
};
|
|
11
11
|
};
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePerformanceOptimizations.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import { useMemo, useRef } from 'react';
|
|
2
|
-
import { isEqual, pick, has, sumBy, first, last, forEach } from 'lodash';
|
|
3
2
|
// Deep comparison helper for filter data
|
|
4
|
-
const areFilterDataEqual = (
|
|
5
|
-
if (
|
|
3
|
+
const areFilterDataEqual = (data1, data2) => {
|
|
4
|
+
if (data1 === data2)
|
|
6
5
|
return true;
|
|
7
|
-
if (!
|
|
6
|
+
if (!data1 || !data2)
|
|
8
7
|
return false;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return Object.assign(Object.assign({}, baseProps), conditionalProps);
|
|
25
|
-
};
|
|
26
|
-
const props1 = getComparableProps(filter1);
|
|
27
|
-
const props2 = getComparableProps(filter2);
|
|
28
|
-
// Use lodash's deep equality check instead of manual comparison
|
|
29
|
-
return isEqual(props1, props2);
|
|
8
|
+
const keys1 = Object.keys(data1);
|
|
9
|
+
const keys2 = Object.keys(data2);
|
|
10
|
+
if (keys1.length !== keys2.length)
|
|
11
|
+
return false;
|
|
12
|
+
return keys1.every((key) => {
|
|
13
|
+
const val1 = data1[key];
|
|
14
|
+
const val2 = data2[key];
|
|
15
|
+
if (Array.isArray(val1) && Array.isArray(val2)) {
|
|
16
|
+
return val1.length === val2.length && val1.every((v, i) => v === val2[i]);
|
|
17
|
+
}
|
|
18
|
+
if (typeof val1 === 'object' && typeof val2 === 'object' && val1 && val2) {
|
|
19
|
+
return JSON.stringify(val1) === JSON.stringify(val2);
|
|
20
|
+
}
|
|
21
|
+
return val1 === val2;
|
|
22
|
+
});
|
|
30
23
|
};
|
|
31
24
|
export const usePerformanceOptimizations = (columns) => {
|
|
32
25
|
// Create stable column references to prevent unnecessary re-renders
|
|
@@ -38,9 +31,10 @@ export const usePerformanceOptimizations = (columns) => {
|
|
|
38
31
|
if (isFirstRenderRef.current) {
|
|
39
32
|
isFirstRenderRef.current = false;
|
|
40
33
|
stableColumnsRef.current = [...columns];
|
|
41
|
-
// Initialize filter tracking
|
|
42
|
-
forEach(
|
|
43
|
-
|
|
34
|
+
// Initialize filter tracking
|
|
35
|
+
columns.forEach((col) => {
|
|
36
|
+
var _a;
|
|
37
|
+
filterChangeTrackingRef.current.set(col.id, (_a = col.filter) === null || _a === void 0 ? void 0 : _a.data);
|
|
44
38
|
});
|
|
45
39
|
return stableColumnsRef.current;
|
|
46
40
|
}
|
|
@@ -48,23 +42,24 @@ export const usePerformanceOptimizations = (columns) => {
|
|
|
48
42
|
const structurallyChanged = columns.length !== stableColumnsRef.current.length ||
|
|
49
43
|
columns.some((col, index) => {
|
|
50
44
|
const prevCol = stableColumnsRef.current[index];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
console.log({ colFilter: col.filter, prevColFilter: prevCol === null || prevCol === void 0 ? void 0 : prevCol.filter });
|
|
46
|
+
return (!prevCol ||
|
|
47
|
+
col.id !== prevCol.id ||
|
|
48
|
+
col.width !== prevCol.width ||
|
|
49
|
+
col.pinned !== prevCol.pinned ||
|
|
50
|
+
col.hidden !== prevCol.hidden ||
|
|
51
|
+
col.order !== prevCol.order);
|
|
57
52
|
});
|
|
58
|
-
// Check for filter-only changes
|
|
53
|
+
// Check for filter-only changes
|
|
59
54
|
const columnsWithFilterChanges = new Set();
|
|
60
|
-
forEach(
|
|
55
|
+
columns.forEach((col) => {
|
|
56
|
+
var _a;
|
|
61
57
|
const colId = col.id;
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
if (!areFilterDataEqual(prevFilter, currentFilter)) {
|
|
58
|
+
const prevFilterData = filterChangeTrackingRef.current.get(colId);
|
|
59
|
+
const currentFilterData = (_a = col.filter) === null || _a === void 0 ? void 0 : _a.data;
|
|
60
|
+
if (!areFilterDataEqual(prevFilterData, currentFilterData)) {
|
|
66
61
|
columnsWithFilterChanges.add(colId);
|
|
67
|
-
filterChangeTrackingRef.current.set(colId,
|
|
62
|
+
filterChangeTrackingRef.current.set(colId, currentFilterData);
|
|
68
63
|
}
|
|
69
64
|
});
|
|
70
65
|
// Only update if there are structural changes or filter changes
|
|
@@ -91,18 +86,18 @@ export const usePerformanceOptimizations = (columns) => {
|
|
|
91
86
|
}
|
|
92
87
|
return stableColumnsRef.current;
|
|
93
88
|
}, [columns]);
|
|
94
|
-
// Memoize frequently used column calculations
|
|
89
|
+
// Memoize frequently used column calculations
|
|
95
90
|
const columnMetrics = useMemo(() => {
|
|
96
91
|
var _a, _b;
|
|
97
92
|
const visibleColumns = stableColumns.filter((col) => !col.hidden);
|
|
98
|
-
const totalWidth =
|
|
93
|
+
const totalWidth = visibleColumns.reduce((sum, col) => sum + +((col === null || col === void 0 ? void 0 : col.width) || 100), 0);
|
|
99
94
|
const columnCount = visibleColumns.length;
|
|
100
95
|
return {
|
|
101
96
|
visibleColumns,
|
|
102
97
|
totalWidth,
|
|
103
98
|
columnCount,
|
|
104
|
-
firstColumnId: (_a =
|
|
105
|
-
lastColumnId: (_b =
|
|
99
|
+
firstColumnId: (_a = visibleColumns[0]) === null || _a === void 0 ? void 0 : _a.id,
|
|
100
|
+
lastColumnId: (_b = visibleColumns[columnCount - 1]) === null || _b === void 0 ? void 0 : _b.id,
|
|
106
101
|
};
|
|
107
102
|
}, [stableColumns]);
|
|
108
103
|
return {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { default as AccordionAdapter } from './AccordionAdapter';
|
|
2
2
|
export { default as ActionMenu, ActionMenuDropDown, ActionMenuItem, type ActionMenuProps } from './ActionMenu';
|
|
3
3
|
export { default as ActivityAreaChart, type ActivityAreaChartProps, type ChartDataPoint, ChartTooltip, type ChartTooltipProps, LoadingChart, type PayloadItem, } from './ActivityAreaChart';
|
|
4
|
-
export { default as AppWindowWrapper, type AccountHeaderProps, AccountHeaderTitle, AppWindowHeader, type AppWindowHeaderProps, type AppWindowHeaderBaseProps, AppWindow, type AccountHeaderTitleProps, type AppWindowProps, type WindowProps, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter,
|
|
4
|
+
export { default as AppWindowWrapper, type AccountHeaderProps, AccountHeaderTitle, AppWindowHeader, type AppWindowHeaderProps, type AppWindowHeaderBaseProps, AppWindow, type AccountHeaderTitleProps, type AppWindowProps, type WindowProps, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter, // used account , leads
|
|
5
|
+
StyledHideButton, StyledMenuLink, // used account only
|
|
6
|
+
StyledSubmitButton, // used account , leads
|
|
7
|
+
SubmitButtonWrapper, } from './AppWindowWrapper';
|
|
5
8
|
export { default as BackgroundAnimation, type BlobGradient, type Blob } from './BackgroundAnimation';
|
|
6
9
|
export { default as Button, PlusButton, StyledButton } from './Button';
|
|
7
10
|
export { default as Calender, type CalenderProps, type DateObject } from './Calender';
|
|
@@ -13,7 +16,9 @@ export { default as Dialog, DialogToolbar } from './Dialog';
|
|
|
13
16
|
export { default as Tooltip } from './Tooltip';
|
|
14
17
|
export * from './RFH';
|
|
15
18
|
export { VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, // To not to be confused/conflicted with the other seperated `components/TableHeader`
|
|
16
|
-
TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent,
|
|
19
|
+
TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, // used src\features\shared\MerchantsDropdown\MerchantsDropdown.tsx only
|
|
20
|
+
ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, // used src\features\shared\Account\UserDetailsContent\components\TableCell\TableCell.tsx only
|
|
21
|
+
TableFooter, TableError, } from './VirtualTables';
|
|
17
22
|
export { default as SheetViewVirtualTable } from './VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable';
|
|
18
23
|
export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
|
|
19
24
|
export { default as TapLogo } from './TapLogo';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export { default as AccordionAdapter } from './AccordionAdapter';
|
|
2
2
|
export { default as ActionMenu, ActionMenuDropDown, ActionMenuItem } from './ActionMenu';
|
|
3
3
|
export { default as ActivityAreaChart, ChartTooltip, LoadingChart, } from './ActivityAreaChart';
|
|
4
|
-
export { default as AppWindowWrapper, AccountHeaderTitle, AppWindowHeader, AppWindow, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter,
|
|
4
|
+
export { default as AppWindowWrapper, AccountHeaderTitle, AppWindowHeader, AppWindow, AppWindowContext, AppWindowContextProvider, LEFT_SIDEBAR, RIGHT_SIDEBAR, VIEWER_HEIGHT, VIEWER_WIDTH, animationDuration, StyledFooter, // used account , leads
|
|
5
|
+
StyledHideButton, StyledMenuLink, // used account only
|
|
6
|
+
StyledSubmitButton, // used account , leads
|
|
7
|
+
SubmitButtonWrapper, // used account , leads
|
|
8
|
+
} from './AppWindowWrapper';
|
|
5
9
|
export { default as BackgroundAnimation } from './BackgroundAnimation';
|
|
6
10
|
export { default as Button, PlusButton, StyledButton } from './Button';
|
|
7
11
|
export { default as Calender } from './Calender';
|
|
@@ -13,7 +17,9 @@ export { default as Dialog, DialogToolbar } from './Dialog';
|
|
|
13
17
|
export { default as Tooltip } from './Tooltip';
|
|
14
18
|
export * from './RFH';
|
|
15
19
|
export { VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader, // To not to be confused/conflicted with the other seperated `components/TableHeader`
|
|
16
|
-
TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent,
|
|
20
|
+
TableLastItem, TableLoading, TableLoadingWithCard, TableNoData, TableNoDataWithCard, LastRowContent, // used src\features\shared\MerchantsDropdown\MerchantsDropdown.tsx only
|
|
21
|
+
ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, // used src\features\shared\Account\UserDetailsContent\components\TableCell\TableCell.tsx only
|
|
22
|
+
TableFooter, TableError, } from './VirtualTables';
|
|
17
23
|
export { default as SheetViewVirtualTable } from './VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable';
|
|
18
24
|
export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
|
|
19
25
|
export { default as TapLogo } from './TapLogo';
|
|
@@ -29,6 +35,7 @@ export { default as WindowSideBar, TITLE_BAR_HEIGHT } from './WindowSideBar';
|
|
|
29
35
|
export { default as WindowAppIcon } from './WindowAppIcon';
|
|
30
36
|
export { default as Window } from './Window';
|
|
31
37
|
export * from './ToolbarIcon';
|
|
38
|
+
// StyledHeaderWrapper used src\features\AppWindow\components\AppWindowHeader\AppWindowHeader.tsx only
|
|
32
39
|
export { default as Toolbar, StyledHeaderWrapper, StyledHeaderWrapperStyled } from './Toolbar';
|
|
33
40
|
export { default as ToggleButtons } from './ToggleButtons';
|
|
34
41
|
export { default as Text } from './Text';
|
|
@@ -59,6 +66,7 @@ export * from './Inputs';
|
|
|
59
66
|
export { default as JSONViewer, FooterButton, JSONTitleBar, JsonViewerDialogContext, JSONViewerList, useJsonViewerContext, JsonViewerDialogContextProvider, } from './JSONViewer';
|
|
60
67
|
export { default as Loader } from './Loader';
|
|
61
68
|
export { default as MUIThemeProvider } from './MUIThemeProvider';
|
|
69
|
+
// ImageWrapper used src\features\shared\Account\BrandDetails\components\AppsIcons\AppsIcons.tsx only
|
|
62
70
|
export { default as ImageWrapper } from './ImageWrapper';
|
|
63
71
|
export { default as Input } from './Input';
|
|
64
72
|
export { default as IconGallery } from './IconGallery';
|
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.136-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.136-test.2",
|
|
5
|
+
"testVersion": 2,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|