@tap-payments/os-micro-frontend-shared 0.1.96-test.24 → 0.1.96-test.25
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/AmountInput/AmountInput.d.ts +14 -0
- package/build/components/AmountInput/AmountInput.js +43 -0
- package/build/components/AmountInput/index.d.ts +2 -0
- package/build/components/AmountInput/index.js +2 -0
- package/build/components/AmountInput/style.d.ts +8 -0
- package/build/components/AmountInput/style.js +30 -0
- package/build/components/AppServices/AppServices.js +2 -0
- package/build/components/BackgroundAnimation/BackgroundAnimation.js +28 -0
- package/build/components/BackgroundAnimation/Blob/Blob.js +2 -0
- package/build/components/Chip/style.js +1 -0
- package/build/components/ColorPicker/HexaFields.js +4 -0
- package/build/components/ColorPicker/style.js +1 -1
- package/build/components/Dialog/style.js +1 -0
- package/build/components/DisplayAmount/DisplayAmount.d.ts +10 -0
- package/build/components/DisplayAmount/DisplayAmount.js +22 -0
- package/build/components/DisplayAmount/index.d.ts +2 -0
- package/build/components/DisplayAmount/index.js +2 -0
- package/build/components/DisplayAmount/style.d.ts +5 -0
- package/build/components/DisplayAmount/style.js +14 -0
- package/build/components/Dropdown2/style.js +2 -0
- package/build/components/ErrorToast/ErrorToast.d.ts +3 -0
- package/build/components/ErrorToast/ErrorToast.js +7 -0
- package/build/components/ErrorToast/index.d.ts +2 -0
- package/build/components/ErrorToast/index.js +2 -0
- package/build/components/ErrorToast/style.d.ts +9 -0
- package/build/components/ErrorToast/style.js +33 -0
- package/build/components/ErrorToast/type.d.ts +10 -0
- package/build/components/ErrorToast/type.js +1 -0
- package/build/components/HeatMap/constant.js +1 -1
- package/build/components/InputBase/AmountInputBase/CurrencyList/style.js +3 -0
- package/build/components/InputBase/PhoneInputBase/CountriesList/CountriesList.js +1 -1
- package/build/components/InputBase/PhoneInputBase/CountriesList/style.js +3 -0
- package/build/components/InputBase/SelectBase/SelectBase.js +1 -0
- package/build/components/InputBase/SelectBase/SelectBaseMultiple.js +3 -0
- package/build/components/InputBase/SelectBase/style.js +3 -2
- package/build/components/InputNumber/InputNumber.js +2 -0
- package/build/components/Inputs/Input/style.js +6 -2
- package/build/components/Inputs/Select/Select.js +1 -0
- package/build/components/Inputs/Select/style.js +3 -2
- package/build/components/JSONViewer/JSONViewer.js +10 -2
- package/build/components/JSONViewer/context/Provider.js +2 -0
- package/build/components/LanguageDropdown/LanguageDropdown.d.ts +6 -0
- package/build/components/LanguageDropdown/LanguageDropdown.js +24 -0
- package/build/components/LanguageDropdown/index.d.ts +2 -0
- package/build/components/LanguageDropdown/index.js +2 -0
- package/build/components/LanguageDropdown/style.d.ts +6 -0
- package/build/components/LanguageDropdown/style.js +5 -0
- package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.d.ts +10 -0
- package/build/components/LeftPeekRightExpandingChip/LeftPeekRightExpandingChip.js +14 -1
- package/build/components/LeftPeekRightExpandingChip/style.js +1 -0
- package/build/components/LeftPeekRightExpandingChip/useLeftPeekRightExpandingChip.js +30 -2
- package/build/components/MFWidgetLoader/MFWidgetLoader.js +3 -3
- package/build/components/MultiSelectStatusButton/MultiSelectStatusButton.js +3 -0
- package/build/components/NestedDropdown/Dropdown.js +3 -0
- package/build/components/RFH/Inputs/FormInput/FormInput.js +1 -0
- package/build/components/RFH/Inputs/MultiSelect/MultiSelect.js +1 -0
- package/build/components/RangeCalender/RangeCalender.js +1 -0
- package/build/components/RangeCalender/components/RangeDatepicker/RangeDatepicker.js +3 -1
- package/build/components/RangeCalender/style.js +1 -1
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.d.ts +32 -0
- package/build/components/RightLeftExpandingCenterChip/RightLeftExpandingCenterChip.js +36 -2
- package/build/components/RightLeftExpandingCenterChip/style.js +25 -4
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.d.ts +5 -0
- package/build/components/RightLeftExpandingCenterChip/useRightLeftExpandingCenterChip.js +53 -1
- package/build/components/ScrollLoader/ScrollLoader.js +2 -1
- package/build/components/SearchListInput/SearchListInput.d.ts +10 -0
- package/build/components/SearchListInput/SearchListInput.js +20 -0
- package/build/components/SearchListInput/index.d.ts +2 -0
- package/build/components/SearchListInput/index.js +2 -0
- package/build/components/SearchListInput/style.d.ts +7 -0
- package/build/components/SearchListInput/style.js +15 -0
- package/build/components/StatusButton/StatusButton.js +11 -3
- package/build/components/StatusButton/constant.js +3 -1
- package/build/components/StatusButton/style.d.ts +2 -1
- package/build/components/StatusButton/type.d.ts +13 -1
- package/build/components/StatusIcons/AuthIcons/constants.js +5 -0
- package/build/components/StatusIcons/AuthorizationAutoIcons/CaptureAutoIcon.js +11 -0
- package/build/components/StatusIcons/AuthorizationAutoIcons/VoidAutoIcon.js +11 -0
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/ApplicationStatusCell.js +3 -1
- package/build/components/TableCells/CustomCells/BankCell/BankCell.js +2 -2
- package/build/components/TableCells/CustomCells/BrandCell/BrandCell.js +1 -0
- package/build/components/TableCells/CustomCells/DateCell/DateCell.js +2 -2
- package/build/components/TableCells/CustomCells/EntityCell/EntityCell.js +4 -3
- package/build/components/TableCells/CustomCells/EntityCell/style.d.ts +0 -3
- package/build/components/TableCells/CustomCells/EntityCell/style.js +2 -22
- package/build/components/TableCells/CustomCells/ReferenceCell/ReferenceCell.js +3 -1
- package/build/components/TableCells/CustomCells/RefundStatusCell/components/RefundStateIcon.js +1 -0
- package/build/components/TableCells/CustomCells/SalesChannelCell/SalesChannelCell.js +4 -3
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +2 -1
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.js +5 -6
- package/build/components/TableCells/CustomCells/SegmentsCell/SegmentsCell.js +3 -1
- package/build/components/TableCells/CustomCells/SourceMergedCell/SourceMergedCell.js +7 -1
- package/build/components/TableCells/CustomCells/StatusCell/StatusCell.js +1 -0
- package/build/components/TableCells/CustomCells/WalletCell/WalletCell.js +3 -3
- package/build/components/TableView/CustomViews.js +2 -0
- package/build/components/TableView/TableView.js +1 -0
- package/build/components/Timepicker/Timepicker.js +1 -0
- package/build/components/Timepicker/utils.js +9 -5
- package/build/components/ToggleView/index.d.ts +1 -1
- package/build/components/ToggleView/index.js +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +11 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js +5 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +6 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/usePinnedColumns.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableData.js +1 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +2 -0
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +3 -2
- package/build/components/VirtualTables/SheetViewVirtualTable/style.js +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +12 -2
- package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.js +6 -1
- package/build/components/VirtualTables/components/ColumnFilter/Inputs/Inputs.js +1 -0
- package/build/components/VirtualTables/components/TableFooter/TableFooter.js +9 -0
- package/build/components/VirtualTables/components/TableRow.js +5 -0
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapper.js +2 -0
- package/build/components/VirtualTables/components/virtualScroll/ListItemWrapperWithCard.js +2 -0
- package/build/components/VirtualTables/components/virtualScroll/VirtualScrollList.js +16 -1
- package/build/components/Widget/style.js +1 -0
- package/build/components/Window/style.js +1 -0
- package/build/components/index.d.ts +10 -6
- package/build/components/index.js +10 -6
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +6 -0
- package/build/constants/server.js +1 -0
- package/build/constants/table/cell/authorizationTableCellWidth.d.ts +6 -6
- package/build/constants/table/cell/authorizationTableCellWidth.js +6 -6
- package/build/constants/table/cell/chargeTableCellWidth.d.ts +6 -6
- package/build/constants/table/cell/chargeTableCellWidth.js +6 -6
- package/build/constants/table/cell/destinationsTableCellWidth.d.ts +5 -5
- package/build/constants/table/cell/destinationsTableCellWidth.js +5 -5
- package/build/constants/table/cell/refundTableCellWidth.d.ts +7 -7
- package/build/constants/table/cell/refundTableCellWidth.js +7 -7
- package/build/constants/table/cell/terminalsTableCellWidth.d.ts +3 -3
- package/build/constants/table/cell/terminalsTableCellWidth.js +3 -3
- package/build/hooks/useCountdown.js +4 -0
- package/build/hooks/useStickyHeaderShadow.js +6 -0
- package/build/types/entity.d.ts +5 -0
- package/build/utils/api.js +3 -0
- package/build/utils/array.js +5 -1
- package/build/utils/billing.js +1 -0
- package/build/utils/country.d.ts +1 -1
- package/build/utils/country.js +2 -1
- package/build/utils/currency.js +6 -0
- package/build/utils/date.d.ts +5 -0
- package/build/utils/date.js +31 -3
- package/build/utils/encrypt.js +3 -1
- package/build/utils/error.js +2 -0
- package/build/utils/freshdesk.js +2 -0
- package/build/utils/geography.js +1 -1
- package/build/utils/localStorage.js +7 -0
- package/build/utils/merchant.js +3 -0
- package/build/utils/number.d.ts +2 -0
- package/build/utils/number.js +8 -0
- package/build/utils/segment.js +1 -0
- package/build/utils/string.d.ts +7 -0
- package/build/utils/string.js +10 -0
- package/build/utils/style.d.ts +11 -0
- package/build/utils/style.js +28 -0
- package/build/utils/table.js +1 -1
- package/build/utils/url.js +2 -0
- package/package.json +2 -2
|
@@ -34,7 +34,7 @@ export const ChannelTextWrapper = styled('div')(() => ({
|
|
|
34
34
|
justifyContent: 'center',
|
|
35
35
|
paddingInline: '4px',
|
|
36
36
|
}));
|
|
37
|
-
export const salesChannelAnimation = (index, xDelta) => ({
|
|
37
|
+
export const salesChannelAnimation = (index, xDelta, isLastChannel) => ({
|
|
38
38
|
start: {
|
|
39
39
|
x: index * 6,
|
|
40
40
|
transition: {
|
|
@@ -43,12 +43,11 @@ export const salesChannelAnimation = (index, xDelta) => ({
|
|
|
43
43
|
ease: 'easeIn',
|
|
44
44
|
},
|
|
45
45
|
},
|
|
46
|
-
animate: {
|
|
47
|
-
x: xDelta ? index * xDelta : index * 39,
|
|
48
|
-
transition: {
|
|
46
|
+
animate: Object.assign({ x: xDelta ? index * xDelta : index * 39, transition: {
|
|
49
47
|
duration: 0.3,
|
|
50
48
|
type: 'tween',
|
|
51
49
|
ease: 'easeOut',
|
|
52
|
-
},
|
|
53
|
-
|
|
50
|
+
} }, (isLastChannel && {
|
|
51
|
+
boxShadow: '7px 0px 8px 0px #F2F2F2',
|
|
52
|
+
})),
|
|
54
53
|
});
|
|
@@ -38,7 +38,9 @@ function SegmentsCell(_a) {
|
|
|
38
38
|
}, borderColor: "transparent" })) })) }), `${segment.name}-${index}`));
|
|
39
39
|
}), [segments, isTextShown, theme]);
|
|
40
40
|
const referenceSourcesCount = (ReferenceSources === null || ReferenceSources === void 0 ? void 0 : ReferenceSources.length) || 0;
|
|
41
|
-
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
41
|
+
return (_jsx(TableCell, Object.assign({}, props, { children: _jsx(StyledSourceCell, { children: referenceSourcesCount > 0 ? (_jsx(ReferenceSourcesContainer, Object.assign({ layout: true, className: "reference-sources-container", whileHover: "animate",
|
|
42
|
+
// animate when state changes
|
|
43
|
+
animate: isTooltipOpen ? 'animate' : 'start', sourcesCount: referenceSourcesCount, variants: { animate: { width: referenceSourcesCount * (6 + 32) } }, style: {
|
|
42
44
|
zIndex: 29,
|
|
43
45
|
} }, { children: ReferenceSources }))) : null }) })));
|
|
44
46
|
}
|
|
@@ -20,19 +20,24 @@ function SourceMergedCell(_a) {
|
|
|
20
20
|
const iconsList = useMemo(() => icons.filter((icon) => Boolean(icon.icon)), [icons]);
|
|
21
21
|
const [isHovering, setIsHovering] = useState(false);
|
|
22
22
|
const centerIconIndex = Math.max(centerIconKey ? iconsList.findIndex((icon) => icon.key === centerIconKey) : 0, 0);
|
|
23
|
+
// Create refs for each icon to measure their actual widths
|
|
23
24
|
const iconRefs = useRef([]);
|
|
24
25
|
const [iconMeasurements, setIconMeasurements] = useState(new Map());
|
|
26
|
+
// For sheet mode, always show all icons inline
|
|
25
27
|
const isSheetMode = tableMode === 'sheet';
|
|
28
|
+
// Measure icons after render and on table mode change
|
|
26
29
|
useEffect(() => {
|
|
27
30
|
if (isSheetMode)
|
|
28
|
-
return;
|
|
31
|
+
return; // Skip measurements for sheet mode as we don't need hover animations
|
|
29
32
|
setTimeout(() => {
|
|
30
33
|
const tableMode = isTextShown ? 'text' : 'default';
|
|
31
34
|
const newMeasurements = new Map();
|
|
32
35
|
iconRefs.current.forEach((ref, index) => {
|
|
33
36
|
if (ref) {
|
|
34
37
|
const width = ref.getBoundingClientRect().width;
|
|
38
|
+
// Get existing measurements or create new
|
|
35
39
|
const existingMeasurement = iconMeasurements.get(index) || { default: 0, text: 0 };
|
|
40
|
+
// Update only the current table mode's measurement
|
|
36
41
|
newMeasurements.set(index, Object.assign(Object.assign({}, existingMeasurement), { [tableMode]: width }));
|
|
37
42
|
}
|
|
38
43
|
});
|
|
@@ -59,6 +64,7 @@ function SourceMergedCell(_a) {
|
|
|
59
64
|
if (!icon)
|
|
60
65
|
return;
|
|
61
66
|
const tableMode = isTextShown ? 'text' : 'default';
|
|
67
|
+
// To keep x position of each icon while hovering consistent
|
|
62
68
|
const xHoverPosition = getIconXTranslation({
|
|
63
69
|
iconsList: iconsList.map((iconObj, i) => {
|
|
64
70
|
const measurements = iconMeasurements.get(i);
|
|
@@ -28,6 +28,7 @@ function StatusCell(_a) {
|
|
|
28
28
|
} }, { children: _jsx(StatusContainer, Object.assign({ initial: "initial", whileHover: "hover", animate: "start" }, { children: statusesList.map((status, index) => {
|
|
29
29
|
if (!status)
|
|
30
30
|
return;
|
|
31
|
+
// To keep x position of each icon while hovering consistent
|
|
31
32
|
const xHoverPosition = (index - centerIconIndex) * xGapValue;
|
|
32
33
|
const isIconAfterCenterIcon = index > centerIconIndex;
|
|
33
34
|
const isIconBeforeCenterIcon = index < centerIconIndex;
|
|
@@ -14,16 +14,16 @@ import Tooltip from '../../../Tooltip';
|
|
|
14
14
|
import CountryFlag from '../../../CountryFlag';
|
|
15
15
|
import { TableCell } from '../../../TableCells';
|
|
16
16
|
import { walletIcon } from '../../../../constants/index.js';
|
|
17
|
-
import {
|
|
17
|
+
import { getCountryNameByISO } from '../../../../utils/index.js';
|
|
18
18
|
import { WalletCellContainer, WalletIcon, WalletIdContainer, WalletWrapper } from './style';
|
|
19
19
|
import { GeographyBox, StatusIconWrapper } from '../style';
|
|
20
20
|
function WalletCell(_a) {
|
|
21
21
|
var { walletId, country, showCountry = true } = _a, props = __rest(_a, ["walletId", "country", "showCountry"]);
|
|
22
|
-
const icon = country && (_jsx(Tooltip, Object.assign({ title:
|
|
22
|
+
const icon = country && (_jsx(Tooltip, Object.assign({ title: getCountryNameByISO(country) }, { children: _jsx(CountryFlag, { code: country, sx: { padding: '1px' } }) })));
|
|
23
23
|
return (_jsx(TableCell, Object.assign({ style: {
|
|
24
24
|
textAlign: 'center',
|
|
25
25
|
overflow: 'visible',
|
|
26
|
-
} }, props, { children: _jsxs(WalletCellContainer, { children: [showCountry && (_jsx(StatusIconWrapper, { children: _jsx(Tooltip, Object.assign({ title: country ?
|
|
26
|
+
} }, props, { children: _jsxs(WalletCellContainer, { children: [showCountry && (_jsx(StatusIconWrapper, { children: _jsx(Tooltip, Object.assign({ title: country ? getCountryNameByISO(country) : '' }, { children: _jsx(GeographyBox, Object.assign({ sx: {
|
|
27
27
|
visibility: 'visible',
|
|
28
28
|
}, variant: undefined }, { children: icon })) })) })), _jsxs(WalletWrapper, { children: [_jsx(WalletIcon, { src: walletIcon, alt: "wallet-icon" }), walletId && _jsxs(WalletIdContainer, { children: ["\u00B7\u00B7\u00B7\u00B7 ", walletId === null || walletId === void 0 ? void 0 : walletId.substring(((walletId === null || walletId === void 0 ? void 0 : walletId.length) || 0) - 4)] })] })] }) })));
|
|
29
29
|
}
|
|
@@ -6,6 +6,7 @@ import { Reorder } from 'framer-motion';
|
|
|
6
6
|
import Box from '@mui/material/Box';
|
|
7
7
|
import Menu from '@mui/material/Menu';
|
|
8
8
|
import { useTheme } from '@mui/material/styles';
|
|
9
|
+
// import MenuItem from '@components/NestedDropdown/MenuItem'
|
|
9
10
|
import { downArrowIcon } from '../../constants/index.js';
|
|
10
11
|
import { ButtonStyled, ListStyled, DropdownStyled } from './style';
|
|
11
12
|
import { NestedMenuItem as MenuItem } from '../NestedDropdown';
|
|
@@ -52,6 +53,7 @@ function CustomViews({ open, onSelect, setTableViews: setColumns, tableViews, an
|
|
|
52
53
|
setColumns === null || setColumns === void 0 ? void 0 : setColumns(newMenuItems || []);
|
|
53
54
|
}, onSelect: (selectedChild, parentName) => {
|
|
54
55
|
handleUnSelectColumn(selectedChild[0]);
|
|
56
|
+
// modifySelectedColumns(selectedChild)
|
|
55
57
|
const newMenuItems = columns === null || columns === void 0 ? void 0 : columns.map((menuItem) => {
|
|
56
58
|
var _a;
|
|
57
59
|
if (menuItem.name === parentName) {
|
|
@@ -29,6 +29,7 @@ function TableView({ onViewChange, setIsViewVisible, setTableViews, tableViews,
|
|
|
29
29
|
const onClose = () => {
|
|
30
30
|
setAnchorViewEl(null);
|
|
31
31
|
setIsViewVisible(false);
|
|
32
|
+
// to be removed
|
|
32
33
|
setSelectedViewInfo({ label: 'Default', id: 'default' });
|
|
33
34
|
};
|
|
34
35
|
const handleSelectedViewInfo = (selected) => {
|
|
@@ -25,6 +25,7 @@ export function TimePicker({ onChange, defaultTime, enableRealTimeChange }) {
|
|
|
25
25
|
};
|
|
26
26
|
const onClose = () => {
|
|
27
27
|
setAnchorEl(null);
|
|
28
|
+
// Return the 12-hour format with period to match the Time type
|
|
28
29
|
onChange === null || onChange === void 0 ? void 0 : onChange({ hour: hours, minute: minutes, period: period });
|
|
29
30
|
};
|
|
30
31
|
const onClickPeriod = (selectedPeriod) => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
// Convert 24-hour format to 12-hour format properly
|
|
1
2
|
export const convertTo12Hour = (hour24) => {
|
|
2
3
|
if (hour24 === 0)
|
|
3
|
-
return 12;
|
|
4
|
+
return 12; // Midnight (0) becomes 12 AM
|
|
4
5
|
if (hour24 <= 12)
|
|
5
|
-
return hour24;
|
|
6
|
-
return hour24 - 12;
|
|
6
|
+
return hour24; // 1-12 stays the same
|
|
7
|
+
return hour24 - 12; // 13-23 becomes 1-11
|
|
7
8
|
};
|
|
9
|
+
// Get the period (AM/PM) from 24-hour format
|
|
8
10
|
export const getPeriodFrom24Hour = (hour24) => {
|
|
9
11
|
return hour24 >= 12 ? 'PM' : 'AM';
|
|
10
12
|
};
|
|
@@ -13,12 +15,14 @@ export const getDefaultHour = () => {
|
|
|
13
15
|
const currentHour = new Date().getHours();
|
|
14
16
|
return convertTo12Hour(currentHour);
|
|
15
17
|
};
|
|
18
|
+
// Convert 12-hour format back to 24-hour format correctly
|
|
16
19
|
export const convertTo24Hour = (hour12, period) => {
|
|
17
20
|
if (period === 'AM' && hour12 === 12) {
|
|
18
|
-
return 0;
|
|
21
|
+
return 0; // 12 AM = 0 hours
|
|
19
22
|
}
|
|
20
23
|
else if (period === 'PM' && hour12 !== 12) {
|
|
21
|
-
return hour12 + 12;
|
|
24
|
+
return hour12 + 12; // 1-11 PM = 13-23 hours
|
|
22
25
|
}
|
|
26
|
+
// 12 PM stays as 12 hours, 1-11 AM stays the same
|
|
23
27
|
return hour12;
|
|
24
28
|
};
|
|
@@ -7,7 +7,9 @@ import { SheetViewVirtualTableWrapper } from './style';
|
|
|
7
7
|
import { usePinnedColumns, useSynchronizedScroll, useTableState, useTableData, useVirtualTableContainer, usePinnedColumnsWidths } from './hooks';
|
|
8
8
|
import { PinnedColumn, MainTable, LoadingMainTable, NoDataView, VirtualTable } from './components';
|
|
9
9
|
function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, rowHeight = 28, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableTitle, onStartDrag, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, overscanCount, }) {
|
|
10
|
+
// Custom hooks for state management
|
|
10
11
|
const { selectedCell, selectedColumn, selectedRow, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick, handleChipClick, selectedChip, } = useTableState();
|
|
12
|
+
// Table data processing
|
|
11
13
|
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
|
|
12
14
|
rows,
|
|
13
15
|
isLoading,
|
|
@@ -15,9 +17,13 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
15
17
|
isFetchingNextPage,
|
|
16
18
|
areAllRowsLoaded,
|
|
17
19
|
});
|
|
20
|
+
// Column management
|
|
18
21
|
const { pinnedStartColumns, pinnedEndColumns, handleColumnPin, pinnedStartColumnsData, pinnedEndColumnsData, unpinnedColumnsData, orderedColumns, lastColumnId, } = usePinnedColumns(columns, isPinnable, onColumnPin);
|
|
22
|
+
// Scroll synchronization
|
|
19
23
|
const { pinnedStartVirtualListRef, scrollableVirtualListRef, pinnedEndVirtualListRef, handleScroll } = useSynchronizedScroll();
|
|
24
|
+
// Column width calculations
|
|
20
25
|
const { pinnedStartColumnsWidth, pinnedEndColumnsWidth } = usePinnedColumnsWidths(pinnedStartColumnsData, pinnedEndColumnsData);
|
|
26
|
+
// Virtual table container logic
|
|
21
27
|
const { getItemSize, getItemDataForContainer } = useVirtualTableContainer({
|
|
22
28
|
rowHeight,
|
|
23
29
|
areAllRowsLoaded,
|
|
@@ -84,6 +90,10 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
84
90
|
};
|
|
85
91
|
const commonPropsWithTableStates = Object.assign(Object.assign({}, baseCommonProps), { hasTimeoutError,
|
|
86
92
|
tableLoading });
|
|
87
|
-
return (_jsxs(_Fragment, { children: [_jsx(SheetViewTableContainer, { children: showNoDataView ? (tableLoading ? (
|
|
93
|
+
return (_jsxs(_Fragment, { children: [_jsx(SheetViewTableContainer, { children: showNoDataView ? (tableLoading ? (
|
|
94
|
+
// Show same table structure with pinned columns during loading, but with skeleton rows
|
|
95
|
+
_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(LoadingMainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns }, commonPropsWithTableStates)), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) : (
|
|
96
|
+
// Non-loading error states
|
|
97
|
+
_jsx(NoDataView, Object.assign({ tableLoading: tableLoading, tableError: tableError, tableEmpty: tableEmpty, hasTimeoutError: hasTimeoutError, orderedColumns: orderedColumns, error: error, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps }, baseCommonProps)))) : (_jsxs(SheetViewVirtualTableWrapper, { children: [pinnedStartColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "start", columnsData: pinnedStartColumnsData, columnsWidth: pinnedStartColumnsWidth, pinnedColumnsList: pinnedStartColumns, hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates))), _jsx(MainTable, Object.assign({ hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, unpinnedColumnsData: unpinnedColumnsData, pinnedStartColumns: pinnedStartColumns, pinnedEndColumns: pinnedEndColumns, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)), pinnedEndColumnsData.length > 0 && (_jsx(PinnedColumn, Object.assign({ position: "end", columnsData: pinnedEndColumnsData, columnsWidth: pinnedEndColumnsWidth, pinnedColumnsList: [...pinnedStartColumns, ...pinnedEndColumns], hasPinnedStart: pinnedStartColumnsData.length > 0, hasPinnedEnd: pinnedEndColumnsData.length > 0, createVirtualTableContainer: createVirtualTableContainer }, commonPropsWithTableStates)))] })) }), _jsx(TableFooter, Object.assign({ "data-testid": "SheetViewVirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
88
98
|
}
|
|
89
99
|
export default memo(SheetViewVirtualTable);
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableHeaderCell.js
CHANGED
|
@@ -28,11 +28,13 @@ function SheetViewTableHeaderCell({ column: { header, id, align, headerStyle, so
|
|
|
28
28
|
setColumnFilterEl(cellRef.current);
|
|
29
29
|
};
|
|
30
30
|
const handleCellClick = (event) => {
|
|
31
|
+
// Only fire column click when clicking on the cell itself, not on child elements
|
|
31
32
|
if (event.target === event.currentTarget) {
|
|
32
33
|
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(colIndex, event, pinned);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
const handleHeaderInnerClick = (event) => {
|
|
37
|
+
// Prevent event bubbling to parent cell
|
|
36
38
|
event.stopPropagation();
|
|
37
39
|
onOpenFilterDropdown();
|
|
38
40
|
};
|
package/build/components/VirtualTables/SheetViewVirtualTable/components/SheetViewTableLoading.js
CHANGED
|
@@ -16,6 +16,7 @@ const Wrapper = styled('section')(({ isLoaded = false, isPinned = false }) => ({
|
|
|
16
16
|
}));
|
|
17
17
|
function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoading = false, rowsCount = 13, isPinned = false, }) {
|
|
18
18
|
const [maxAllowedRows, setMaxAllowedRows] = useState(() => {
|
|
19
|
+
// Use provided rowsCount or calculate initial value
|
|
19
20
|
return rowsCount || Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 15);
|
|
20
21
|
});
|
|
21
22
|
useEffect(() => {
|
|
@@ -23,6 +24,7 @@ function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoa
|
|
|
23
24
|
setMaxAllowedRows(rowsCount);
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
27
|
+
// Calculate rows that fit in the available container height
|
|
26
28
|
const calculateRowsForContainer = () => {
|
|
27
29
|
var _a;
|
|
28
30
|
const wrapperElement = document.querySelector('[data-testid="SheetViewTableLoading"]');
|
|
@@ -30,13 +32,14 @@ function SheetViewTableLoading({ columns, isLoaded = false, animationType, isLoa
|
|
|
30
32
|
return Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 25);
|
|
31
33
|
}
|
|
32
34
|
const containerHeight = ((_a = wrapperElement.parentElement) === null || _a === void 0 ? void 0 : _a.clientHeight) || 0;
|
|
33
|
-
const rowHeight = SHEET_VIEW_TABLE_ROW_HEIGHT;
|
|
34
|
-
const headerHeight = 40;
|
|
35
|
+
const rowHeight = SHEET_VIEW_TABLE_ROW_HEIGHT; // Standard row height for SheetView
|
|
36
|
+
const headerHeight = 40; // Approximate header height
|
|
35
37
|
const availableHeight = containerHeight - headerHeight;
|
|
36
38
|
if (availableHeight <= 0) {
|
|
37
39
|
return Math.min(calculateMaxAllowedRows(isLoaded, isLoading), 25);
|
|
38
40
|
}
|
|
39
41
|
const calculatedRows = Math.floor(availableHeight / rowHeight);
|
|
42
|
+
// Ensure we have at least 3 rows for loading state, but cap at a reasonable maximum
|
|
40
43
|
return Math.max(3, Math.min(calculatedRows + 2, 25));
|
|
41
44
|
};
|
|
42
45
|
const rows = calculateRowsForContainer();
|
|
@@ -20,10 +20,14 @@ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded,
|
|
|
20
20
|
return;
|
|
21
21
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
22
22
|
});
|
|
23
|
-
return (
|
|
23
|
+
return (
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
_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
26
|
const itemSize = (index) => getItemSize(index, height);
|
|
25
27
|
const itemData = getItemData(columnsData, isPinned, height);
|
|
26
|
-
return (
|
|
28
|
+
return (
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
_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: {
|
|
27
31
|
overflowX: isPinned ? 'hidden' : 'auto',
|
|
28
32
|
paddingBottom: isPinned ? '25px' : '13px',
|
|
29
33
|
backgroundColor: isPinned ? 'transparent' : '#F6F8FACC',
|
|
@@ -9,6 +9,7 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
9
9
|
if (!isPinnable)
|
|
10
10
|
return [];
|
|
11
11
|
const userPinned = columns.filter((c) => c.pinned === 'end').map((c) => c.id);
|
|
12
|
+
// Automatically pin the last column to the end if no end-pinned columns exist
|
|
12
13
|
const visibleColumns = columns.filter((column) => !column.hidden);
|
|
13
14
|
const lastColumn = visibleColumns[visibleColumns.length - 1];
|
|
14
15
|
if (userPinned.length === 0 && lastColumn && !lastColumn.pinned && !lastColumn.isDefaultPinned) {
|
|
@@ -43,6 +44,7 @@ export const usePinnedColumns = (columns, isPinnable, onColumnPin) => {
|
|
|
43
44
|
const start = shownColumns.filter((column) => pinnedStartColumns.includes(column.id));
|
|
44
45
|
const end = shownColumns.filter((column) => pinnedEndColumns.includes(column.id));
|
|
45
46
|
const unpinned = shownColumns.filter((column) => !pinnedStartColumns.includes(column.id) && !pinnedEndColumns.includes(column.id));
|
|
47
|
+
// Sort arrays by order and preserve original column properties including width
|
|
46
48
|
const sortedStart = start.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); });
|
|
47
49
|
const sortedEnd = end.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); });
|
|
48
50
|
const sortedUnpinned = unpinned.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); });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { useDelayToSetValue } from '../../../../hooks/index.js';
|
|
3
3
|
import { isHeightNotFullyFilledByRows, isNotFoundError, isTimeoutError, hasError } from '../../../../utils/index.js';
|
|
4
|
+
// Type guard to check if error is AxiosError
|
|
4
5
|
const isAxiosError = (error) => {
|
|
5
6
|
return error !== null && 'isAxiosError' in error && error.isAxiosError === true;
|
|
6
7
|
};
|
|
@@ -21,6 +21,7 @@ export const useTableState = () => {
|
|
|
21
21
|
}, [selectedChip, setSelectedChip, setSelectedCell, setSelectedRow]);
|
|
22
22
|
const handleCellClick = useCallback((rowIndex, columnIndex, event, pinnedType) => {
|
|
23
23
|
event.stopPropagation();
|
|
24
|
+
// If clicking on any cell in the pinned start section, select the entire row
|
|
24
25
|
if (pinnedType === 'start' && columnIndex === 0) {
|
|
25
26
|
setSelectedRow((prev) => (prev === rowIndex ? null : rowIndex));
|
|
26
27
|
setSelectedCell(null);
|
|
@@ -28,6 +29,7 @@ export const useTableState = () => {
|
|
|
28
29
|
setSelectedChip(null);
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
32
|
+
// Otherwise, handle normal cell selection
|
|
31
33
|
const cellKey = `${pinnedType !== null && pinnedType !== void 0 ? pinnedType : 'default'}-${rowIndex}-${columnIndex}`;
|
|
32
34
|
setSelectedCell((prev) => (prev === cellKey ? null : cellKey));
|
|
33
35
|
setSelectedColumn(null);
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js
CHANGED
|
@@ -27,10 +27,11 @@ export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, is
|
|
|
27
27
|
const getItemSize = useCallback((index, height) => {
|
|
28
28
|
const isLastRow = areAllRowsLoaded && index === rows.length;
|
|
29
29
|
if (isLastRow) {
|
|
30
|
+
// Calculate remaining height: total height - (number of data rows * row height)
|
|
30
31
|
const usedHeight = rows.length * rowHeight;
|
|
31
32
|
const remainingHeight = height - usedHeight;
|
|
32
|
-
const minimumLastRowHeight = rowHeight * 2;
|
|
33
|
-
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
33
|
+
const minimumLastRowHeight = rowHeight * 2; // Minimum height is 2x rowHeight
|
|
34
|
+
return Math.max(remainingHeight, minimumLastRowHeight); // Ensure minimum 2x row height
|
|
34
35
|
}
|
|
35
36
|
return rowHeight;
|
|
36
37
|
}, [areAllRowsLoaded, rows.length, rowHeight]);
|
|
@@ -67,7 +67,7 @@ const PinnedColumnBase = styled('div')(({ theme }) => ({
|
|
|
67
67
|
backgroundColor: theme.palette.primary.light,
|
|
68
68
|
borderTop: '1px solid #F2F2F2',
|
|
69
69
|
borderBottom: '1px solid #F2F2F2',
|
|
70
|
-
overflow: 'hidden',
|
|
70
|
+
overflow: 'hidden', // Ensure border radius is applied properly
|
|
71
71
|
}));
|
|
72
72
|
export const PinnedStartColumnWrapper = styled(PinnedColumnBase)({
|
|
73
73
|
boxShadow: '4px 0px 24px 0px #00000014',
|
|
@@ -58,6 +58,7 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
58
58
|
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, isSheetView);
|
|
59
59
|
const tableRowHeight = isSheetView ? SHEET_VIEW_TABLE_ROW_HEIGHT : TABLE_ROW_HEIGHT;
|
|
60
60
|
const listRef = useRef(null);
|
|
61
|
+
// Reset row heights when isSheetView or tableRowHeight changes
|
|
61
62
|
useEffect(() => {
|
|
62
63
|
if (listRef.current && typeof listRef.current.resetAfterIndex === 'function') {
|
|
63
64
|
listRef.current.resetAfterIndex(0, true);
|
|
@@ -68,11 +69,16 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
68
69
|
setShowBackdrop(isVisible);
|
|
69
70
|
};
|
|
70
71
|
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
// TODO: start index and stop index are not working as expected
|
|
73
|
+
// console.log('startIndex', startIndex, 'stopIndex', stopIndex,
|
|
74
|
+
// 'rows.length', rows.length)
|
|
71
75
|
if (areAllRowsLoaded)
|
|
72
76
|
return;
|
|
73
77
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
74
78
|
});
|
|
75
|
-
return (
|
|
79
|
+
return (
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, 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: () => tableRowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN, isSheetView: isSheetView, listRef: listRef }, { children: ListItemWrapper }))) }), `${footerProps === null || footerProps === void 0 ? void 0 : footerProps.maximized}-${isMinimized}`)) })));
|
|
76
82
|
}, [
|
|
77
83
|
isMinimized,
|
|
78
84
|
footerProps === null || footerProps === void 0 ? void 0 : footerProps.maximized,
|
|
@@ -91,6 +97,10 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
91
97
|
return (_jsxs(_Fragment, { children: [_jsxs(TableContainer, { children: [_jsx(StyledTableBox, Object.assign({ as: "main", id: "table-box-container", "aria-labelledby": "table-box-container", "data-testid": "VirtualTable_StyledTableBox", "data-title": tableTitle, "data-direction": theme.direction, "data-are-all-rows-loaded": !!areAllRowsLoaded, "data-is-fetching-next-page": !!isFetchingNextPage, "data-scroll-to-index": scrollToIndex, "data-is-loading": !!isLoading, "data-is-error": !!isError, "data-is-error-timeout": !!hasTimeoutError, "data-table-mode": tableMode, height: "100%", dir: theme.direction, showNoDataView: showNoDataView }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: Object.assign({}, tableBodyStyles) }, { children: [showHeader && (_jsx(TableHeader, { "data-testid": "VirtualTable_TableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: orderedColumns, headerProps: headerProps, showBackDrop: showBackDrop, isSheetView: isSheetView })), showNoDataView ? (_jsx(TableNoData, { error: error, tableEmpty: tableEmpty, isTimeoutError: hasTimeoutError, tableError: tableError, tableLoading: tableLoading, orderedColumns: orderedColumns, triggerDataRefetch: triggerDataRefetch, footerProps: footerProps })) : (_jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
92
98
|
width: '100%',
|
|
93
99
|
minWidth: 'fit-content',
|
|
94
|
-
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "VirtualTable_StyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderTableContainer })) })))] })) })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem
|
|
100
|
+
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "VirtualTable_StyledBox", hidePadding: true, className: "list-wrapper" }, { children: renderTableContainer })) })))] })) })), !showNoDataView && areTotalRowsNotFillingHeight && !isFetchingNextPage && (_jsx(TableLastItem
|
|
101
|
+
// rows height + header height
|
|
102
|
+
, {
|
|
103
|
+
// rows height + header height
|
|
104
|
+
height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
95
105
|
}
|
|
96
106
|
export default memo(VirtualTable);
|
|
@@ -57,11 +57,16 @@ function VirtualTableWithCard({ rows, threshold = TABLE_THRESHOLD, rowProps, foo
|
|
|
57
57
|
setShowBackdrop(isVisible);
|
|
58
58
|
};
|
|
59
59
|
const handleOnLoadMoreItems = () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
// TODO: start index and stop index are not working as expected
|
|
61
|
+
// console.log('startIndex', startIndex, 'stopIndex', stopIndex,
|
|
62
|
+
// 'rows.length', rows.length)
|
|
60
63
|
if (areAllRowsLoaded)
|
|
61
64
|
return;
|
|
62
65
|
yield (loadMoreItems === null || loadMoreItems === void 0 ? void 0 : loadMoreItems());
|
|
63
66
|
});
|
|
64
|
-
return (
|
|
67
|
+
return (
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
_jsx(InfiniteLoader, Object.assign({ "data-testid": "VirtualTable_InfiniteLoader", isItemLoaded: (index) => index !== lastItemIndex, itemCount: itemsCount, loadMoreItems: handleOnLoadMoreItems, threshold: threshold }, { children: ({ onItemsRendered, ref }) => (_jsx(Box, Object.assign({ sx: { height: `${tableHeight - (tableHeaderHeight !== null && tableHeaderHeight !== void 0 ? tableHeaderHeight : 0)}px` }, id: "auto-sizer-wrapper" }, { children: _jsx(AutoSizer, Object.assign({ ref: ref, "data-testid": "VirtualTable_AutoSizer" }, { children: ({ height: h, width: w }) => (_jsx(StyledVirtualList, Object.assign({ "data-testid": "VirtualTable_VirtualList", useIsScrolling: true, className: "list", itemData: itemData, height: h || 0, width: w || 0, itemCount: itemsCount, itemSize: () => rowHeight, onItemsRendered: onItemsRendered, setBackdropVisibility: setBackdropVisibility, areTotalRowsNotFillingHeight: areTotalRowsNotFillingHeight, scrollToIndex: scrollToIndex, overscanCount: TABLE_LIST_OVER_SCAN }, { children: ListItemWrapperWithCard }))) })) }))) })));
|
|
65
70
|
}, [
|
|
66
71
|
error,
|
|
67
72
|
isLoading,
|
|
@@ -8,6 +8,7 @@ import { grayCloseIcon, searchIcon } from '../../../../../constants/index.js';
|
|
|
8
8
|
import { Wrapper, Text, InputStyled, InputsWrapper, ClearButton, ClearWrapper } from './style';
|
|
9
9
|
import { CancelButton, Footer, OkayButton } from '../style';
|
|
10
10
|
function Inputs({ onCloseDropdown, filter: { options = [], onConfirm, data, isOnlyOneFilter, onClearFilterFields, wrapperSx } }) {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
const [values, setValues] = useState({});
|
|
12
13
|
useEffect(() => {
|
|
13
14
|
setValues((options || []).reduce((acc, { apiKey }) => { var _a; return (Object.assign(Object.assign({}, acc), { [apiKey]: (_a = data === null || data === void 0 ? void 0 : data[apiKey]) !== null && _a !== void 0 ? _a : '' })); }, {}));
|
|
@@ -17,6 +17,15 @@ import { StyledFooter, Label, Title, ValueWrapper, EngravingLine } from './style
|
|
|
17
17
|
function TableFooter(_a) {
|
|
18
18
|
var { totalCount, showBackDrop = false, showSeparator, sandboxMode, maximized, children } = _a, other = __rest(_a, ["totalCount", "showBackDrop", "showSeparator", "sandboxMode", "maximized", "children"]);
|
|
19
19
|
const { t } = useTranslation();
|
|
20
|
+
// const min = 10000
|
|
21
|
+
// const max = 50000
|
|
22
|
+
// const average = 30000
|
|
23
|
+
// const sum = 100000
|
|
24
|
+
// const currency = 'SAR'
|
|
25
|
+
// const { integerAmount: minIntegerAmount, decimalAmount: minDecimalAmount } = formatAmount(min)
|
|
26
|
+
// const { integerAmount: maxIntegerAmount, decimalAmount: maxDecimalAmount } = formatAmount(max)
|
|
27
|
+
// const { integerAmount: averageIntegerAmount, decimalAmount: averageDecimalAmount } = formatAmount(average)
|
|
28
|
+
// const { integerAmount: sumIntegerAmount, decimalAmount: sumDecimalAmount } = formatAmount(sum)
|
|
20
29
|
return (_jsxs(StyledFooter, Object.assign({ component: "footer", "data-testid": "TableFooter", maximized: maximized !== null && maximized !== void 0 ? maximized : false, sandboxMode: sandboxMode, showBackDrop: showBackDrop, areTotalRowsNotFillingHeight: !!showSeparator }, other, { children: [showSeparator && _jsx(EngravingLine, {}), totalCount || totalCount === 0 ? (_jsxs(Label, Object.assign({ sx: { gap: '6px', cursor: 'text' } }, { children: [_jsx(Title, { children: t('count') }), _jsx(ValueWrapper, { children: formatNumber(totalCount || 0) })] }))) : null, children] })));
|
|
21
30
|
}
|
|
22
31
|
export default React.memo(TableFooter);
|
|
@@ -38,14 +38,19 @@ function TableRow({ row, columns, index, rowProps, isSheetView, selectedCell = n
|
|
|
38
38
|
isRowSelected,
|
|
39
39
|
isLastRow,
|
|
40
40
|
});
|
|
41
|
+
// Determine if this cell should be treated as first/last for border radius
|
|
41
42
|
const isFirstColumn = column.id === columns[0].id;
|
|
42
43
|
const isLastColumn = column.id === columns[columns.length - 1].id;
|
|
44
|
+
// For scrollable table, adjust first/last based on pinned tables
|
|
43
45
|
let effectiveFirst = isFirstColumn;
|
|
44
46
|
let effectiveLast = isLastColumn;
|
|
45
47
|
if (!column.pinned) {
|
|
48
|
+
// If there are pinned start columns, scrollable table shouldn't have left border radius
|
|
46
49
|
effectiveFirst = isFirstColumn && column.pinned !== 'start';
|
|
50
|
+
// If there are pinned end columns, scrollable table shouldn't have right border radius
|
|
47
51
|
effectiveLast = isLastColumn && column.pinned !== 'end';
|
|
48
52
|
}
|
|
53
|
+
// Handle border styling for row selection
|
|
49
54
|
const rowSelectionBorderStyles = isRowSelected
|
|
50
55
|
? getRowSelectionBorderStyles({
|
|
51
56
|
effectiveFirst,
|
|
@@ -39,6 +39,7 @@ export const LastRowContent = React.memo(({ isLoadingRow, isSheetView, columns,
|
|
|
39
39
|
}
|
|
40
40
|
return _jsx(StyledParagraph, Object.assign({ "data-testid": "ListItemWrapper_lastRowContent" }, { children: t('allRecordsHaveBeenSuccessfullyLoaded') }));
|
|
41
41
|
});
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
43
|
const createRowClickHandler = (row, onRowClick) => (e) => {
|
|
43
44
|
var _a;
|
|
44
45
|
(_a = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
@@ -58,6 +59,7 @@ function ListItemWrapper(_a) {
|
|
|
58
59
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
59
60
|
const isLoadedRow = index <= newLoadedRowsEndIndex;
|
|
60
61
|
const rowClickHandler = React.useCallback(() => createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
|
|
62
|
+
// Memoize the row props object
|
|
61
63
|
const memoizedRowProps = React.useMemo(() => (Object.assign(Object.assign({ showShadowHighlight: scrollToIndex === index, showLoadedStyle: isLoadedRow }, rowProps), { onClick: rowClickHandler })), [scrollToIndex, index, isLoadedRow, rowProps, rowClickHandler]);
|
|
62
64
|
const renderSheetViewLoadingRow = React.useCallback((lastRowContent) => {
|
|
63
65
|
return (_jsx(Box, Object.assign({ sx: {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
import TableRowWithCard from '../TableRowWithCard';
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
const createRowClickHandler = (row, onRowClick) => (e) => {
|
|
6
7
|
var _a;
|
|
7
8
|
(_a = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _a === void 0 ? void 0 : _a.call(e);
|
|
@@ -19,6 +20,7 @@ function ListItemWrapperWithCard({ index, style, data: { renderedScrollTopRef, r
|
|
|
19
20
|
const isLoadingRow = isLoading && index === lastItemIndex + 1;
|
|
20
21
|
const isLoadedRow = index <= newLoadedRowsEndIndex;
|
|
21
22
|
const rowClickHandler = React.useCallback(createRowClickHandler(row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick), [row, rowProps === null || rowProps === void 0 ? void 0 : rowProps.onRowClick]);
|
|
23
|
+
// Memoize the row props object
|
|
22
24
|
const memoizedRowProps = React.useMemo(() => (Object.assign(Object.assign({ showShadowHighlight: scrollToIndex === index, showLoadedStyle: isLoadedRow }, rowProps), { onClick: rowClickHandler })), [scrollToIndex, index, isLoadedRow, rowProps, rowClickHandler, isLoadingRow, areAllRowsLoaded, lastItemIndex]);
|
|
23
25
|
const memoizedListItemComponent = React.useMemo(() => _jsx(TableRowWithCard, { index: index, row: row, renderCardComponent: renderCardComponent, rowProps: memoizedRowProps }, `row-${index}`), [index, row, memoizedRowProps]);
|
|
24
26
|
return (_jsx("div", Object.assign({ "data-testid": "ListCardWrapper", style: Object.assign(Object.assign({}, style), { top: Number(style.top) - renderedScrollTopRef.current, willChange: 'top' }) }, { children: _jsx(StyledItemWrapper, Object.assign({ "data-testid": "ListCardWrapper_StyledItemWrapper" }, { children: memoizedListItemComponent })) })));
|
|
@@ -22,10 +22,21 @@ const VirtualScrollList = React.forwardRef((_a, ref) => {
|
|
|
22
22
|
setBackdropVisibility,
|
|
23
23
|
clearBackdropVisibilityTimeout,
|
|
24
24
|
});
|
|
25
|
+
// renderedScrollTopRef - when render is started (listRef.current.scrollTo is called)
|
|
26
|
+
// this ref holds scrollTop position which has been passed to scrollTo function
|
|
27
|
+
// scrollTopRef - this is scrollTop from last onScroll event.
|
|
28
|
+
// onScroll can be fired when render is still in progress. So scrollTop will be just saved
|
|
29
|
+
// When scroll will end, saved scrollTop will be used to start new render.
|
|
30
|
+
// Subsequent onScroll will overwrite this number, as we will not render intermediate scroll states
|
|
31
|
+
// scrollLocked - is true, when render has been started.
|
|
32
|
+
// This is used to now start several renders simulaneously
|
|
33
|
+
// listRef - VariableSizeList ref to call scrollTo method
|
|
25
34
|
const renderedScrollTopRef = useRef(0);
|
|
26
35
|
const scrollTopRef = useRef(undefined);
|
|
27
36
|
const scrollLocked = useRef(false);
|
|
37
|
+
// Use external ref if provided, otherwise create local
|
|
28
38
|
const internalListRef = useRef(null);
|
|
39
|
+
// If ref is provided, use it; else use externalListRef; else use internalListRef
|
|
29
40
|
const listRef = ref || externalListRef || internalListRef;
|
|
30
41
|
const scrollTo = useCallback(() => {
|
|
31
42
|
var _a, _b;
|
|
@@ -59,6 +70,10 @@ const VirtualScrollList = React.forwardRef((_a, ref) => {
|
|
|
59
70
|
onScroll === null || onScroll === void 0 ? void 0 : onScroll(props);
|
|
60
71
|
scrollLocked.current = scrollTo();
|
|
61
72
|
}, [scrollTo, onScroll]);
|
|
62
|
-
return (_jsx(VirtualScrollOuterProvider, Object.assign({ value: handleScroll }, { children: _jsx(VariableSizeList, Object.assign({ ref: listRef, "data-testid": "VirtualScrollList", itemData: itemDataInternal,
|
|
73
|
+
return (_jsx(VirtualScrollOuterProvider, Object.assign({ value: handleScroll }, { children: _jsx(VariableSizeList, Object.assign({ ref: listRef, "data-testid": "VirtualScrollList", itemData: itemDataInternal,
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
outerElementType: VirtualScrollOuter,
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
innerElementType: VirtualScrollInner }, restProps, { onScroll: handleOnScroll }, { children: children })) })));
|
|
63
78
|
});
|
|
64
79
|
export default VirtualScrollList;
|
|
@@ -12,7 +12,8 @@ export { default as Checkbox } from './Checkbox';
|
|
|
12
12
|
export { default as Dialog, DialogToolbar } from './Dialog';
|
|
13
13
|
export { default as Tooltip } from './Tooltip';
|
|
14
14
|
export * from './RFH';
|
|
15
|
-
export { VirtualTable, TableRowLoading, TableHeader as VirtualTableHeader,
|
|
15
|
+
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, ListItemWrapperWithCard, RowErrorState, StyledItemWrapper, TableRow, TableRowLoadingWithCard, TableRowWithCard, VirtualScrollInner, VirtualScrollList, VirtualScrollOuter, VirtualTableWithCard, Inputs, List, ColumnFilter, StyledCell, TableFooter, TableError, } from './VirtualTables';
|
|
16
17
|
export { default as SheetViewVirtualTable } from './VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable';
|
|
17
18
|
export { default as Widget, ListItem, WidgetHeader, WidgetList } from './Widget';
|
|
18
19
|
export { default as TapLogo } from './TapLogo';
|
|
@@ -108,10 +109,13 @@ export { default as LazyImage } from './LazyImage';
|
|
|
108
109
|
export { default as AmountStatusChip, type AmountStatusChipProps } from './AmountStatusChip';
|
|
109
110
|
export { default as AuthenticationTypeChip, type AuthenticationTypeChipProps } from './AuthenticationTypeChip';
|
|
110
111
|
export * from './LazyImage';
|
|
111
|
-
export { default as
|
|
112
|
-
export
|
|
113
|
-
export { default as ToggleView } from './ToggleView';
|
|
114
|
-
export
|
|
112
|
+
export { default as SearchListInput } from './SearchListInput';
|
|
113
|
+
export { default as ErrorToast } from './ErrorToast';
|
|
114
|
+
export { default as ToggleView, type ToggleViewsValues, ToggleViews } from './ToggleView';
|
|
115
|
+
export { default as LanguageDropdown } from './LanguageDropdown';
|
|
116
|
+
export { default as DisplayAmount } from './DisplayAmount';
|
|
117
|
+
export { default as AmountInput } from './AmountInput';
|
|
115
118
|
export { default as AppServicesBar } from './AppServicesBar';
|
|
116
119
|
export * from './AppServicesBar';
|
|
117
|
-
export { default as
|
|
120
|
+
export { default as ListLayout } from './ListLayout';
|
|
121
|
+
export * from './ListLayout';
|