@tap-payments/os-micro-frontend-shared 0.1.96-test.7 → 0.1.97-test.101
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/ActionMenu/style.d.ts +1 -1
- package/build/components/AppServices/AppServices.d.ts +5 -11
- package/build/components/AppServices/AppServices.js +18 -16
- package/build/components/AppServices/ServiceItem.d.ts +4 -2
- package/build/components/AppServices/ServiceItem.js +4 -2
- package/build/components/SearchButton/styles.d.ts +1 -1
- package/build/components/Toolbar/style.d.ts +0 -6
- package/build/components/Toolbar/style.js +0 -5
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.d.ts +1 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/SheetViewVirtualTable.js +39 -19
- package/build/components/VirtualTables/SheetViewVirtualTable/components/MainTable.js +25 -3
- package/build/components/VirtualTables/SheetViewVirtualTable/components/PinnedColumn.js +27 -4
- package/build/components/VirtualTables/SheetViewVirtualTable/components/VirtualTable.js +18 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useTableState.js +15 -3
- package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js +8 -4
- package/build/components/VirtualTables/VirtualTable/VirtualTable.d.ts +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +2 -2
- package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.d.ts +1 -1
- package/build/components/VirtualTables/VirtualTableWithCard/VirtualTableWithCard.js +2 -2
- package/build/components/VirtualTables/optimization/AnimationOptimizations.d.ts +26 -0
- package/build/components/VirtualTables/optimization/AnimationOptimizations.js +86 -0
- package/build/components/index.d.ts +0 -6
- package/build/components/index.js +0 -6
- package/build/constants/apps.d.ts +38 -3
- package/build/constants/apps.js +16 -5
- package/build/types/apps.d.ts +1 -54
- package/build/types/table.d.ts +1 -1
- package/package.json +7 -30
- package/build/components/AppServicesBar/AppServicesBar.d.ts +0 -26
- package/build/components/AppServicesBar/AppServicesBar.js +0 -18
- package/build/components/AppServicesBar/index.d.ts +0 -3
- package/build/components/AppServicesBar/index.js +0 -3
- package/build/components/AppServicesBar/style.d.ts +0 -4
- package/build/components/AppServicesBar/style.js +0 -6
- package/build/components/ListLayout/ListLayout.d.ts +0 -10
- package/build/components/ListLayout/ListLayout.js +0 -20
- package/build/components/ListLayout/index.d.ts +0 -2
- package/build/components/ListLayout/index.js +0 -2
- package/build/components/ListLayout/styles.d.ts +0 -4
- package/build/components/ListLayout/styles.js +0 -8
- package/build/components/ToggleView/ToggleView.d.ts +0 -16
- package/build/components/ToggleView/ToggleView.js +0 -32
- package/build/components/ToggleView/ToggleWrapper.d.ts +0 -4
- package/build/components/ToggleView/ToggleWrapper.js +0 -8
- package/build/components/ToggleView/index.d.ts +0 -3
- package/build/components/ToggleView/index.js +0 -3
- package/build/components/ToggleView/style.d.ts +0 -14
- package/build/components/ToggleView/style.js +0 -31
- package/build/components/ToggleView/types.d.ts +0 -6
- package/build/components/ToggleView/types.js +0 -6
|
@@ -15,7 +15,7 @@ export declare const Charge: import("@emotion/styled").StyledComponent<import("@
|
|
|
15
15
|
export declare const DropDownChargeGapColumn: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
16
|
export declare const StyledAmount: import("@emotion/styled").StyledComponent<Pick<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
17
17
|
ref?: ((instance: HTMLInputElement | null) => void) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
18
|
-
}, "width" | "height" | "hidden" | "type" | "color" | "content" | "translate" | "
|
|
18
|
+
}, "width" | "height" | "hidden" | "type" | "color" | "content" | "translate" | "value" | "list" | "form" | "slot" | "style" | "title" | "name" | "ref" | "pattern" | "key" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "multiple" | "autoComplete" | "readOnly" | "required" | "max" | "src" | "alt" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "min" | "accept" | "capture" | "checked" | "formEncType" | "minLength"> & {
|
|
19
19
|
allowDecimals?: boolean | undefined;
|
|
20
20
|
allowNegativeValue?: boolean | undefined;
|
|
21
21
|
id?: string | undefined;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { AppDetails, UserApp } from '../../types/index.js';
|
|
3
3
|
import { ServiceItemProps } from './ServiceItem';
|
|
4
4
|
interface AppServicesProps extends Pick<ServiceItemProps, 'onClickServiceItem'> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
appCode: string;
|
|
9
|
-
dimensions: {
|
|
10
|
-
width: string | number;
|
|
11
|
-
};
|
|
12
|
-
pathname: string;
|
|
13
|
-
onChangeServiceCode?: (serviceCode: string) => void;
|
|
5
|
+
appInfo: AppDetails;
|
|
6
|
+
userApp?: UserApp;
|
|
7
|
+
onChangeAppServiceCode?: (serviceCode: string) => void;
|
|
14
8
|
}
|
|
15
|
-
declare function AppServices({
|
|
9
|
+
declare function AppServices({ appInfo, userApp, onChangeAppServiceCode, onClickServiceItem }: AppServicesProps): import("react/jsx-runtime").JSX.Element;
|
|
16
10
|
declare const _default: React.MemoExoticComponent<typeof AppServices>;
|
|
17
11
|
export default _default;
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { memo, useEffect, useRef, useState, useMemo } from 'react';
|
|
3
3
|
import { Box } from '@mui/material';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { useLocation } from 'react-router';
|
|
5
6
|
import { StyledIconForDropDown, StyledMenuTitle, StyledOption, StyledSelect, StyledSelectComponent } from '../index.js';
|
|
6
7
|
import { APP_CODES, blackHeadingDownArrow, blueHeadingDropdownArrow } from '../../constants/index.js';
|
|
7
8
|
import { getNameText } from '../../utils/index.js';
|
|
@@ -10,20 +11,21 @@ import { Wrapper } from './style';
|
|
|
10
11
|
const selectedIcon = (props) => {
|
|
11
12
|
return (_jsx(StyledIconForDropDown, { src: props.className.includes('MuiSelect-iconOpen') ? blueHeadingDropdownArrow : blackHeadingDownArrow, alt: "dropdown" }));
|
|
12
13
|
};
|
|
13
|
-
function AppServices({
|
|
14
|
+
function AppServices({ appInfo, userApp, onChangeAppServiceCode, onClickServiceItem }) {
|
|
14
15
|
const [initServicesWidth, setInitServicesWidth] = useState(0);
|
|
15
16
|
const [isDropdown, setIsDropdown] = useState(false);
|
|
16
17
|
const [selectedOption, setSelectedOption] = useState('');
|
|
17
18
|
const servicesRef = useRef(null);
|
|
18
19
|
const [openDropdown, setOpenDropdown] = React.useState(false);
|
|
20
|
+
const pathname = useLocation();
|
|
19
21
|
const { i18n } = useTranslation();
|
|
20
|
-
const
|
|
21
|
-
var _a;
|
|
22
|
-
if (appCode === APP_CODES.account.code) {
|
|
23
|
-
return (_a =
|
|
22
|
+
const services = useMemo(() => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
if (appInfo.appCode === APP_CODES.account.code) {
|
|
25
|
+
return (_a = userApp === null || userApp === void 0 ? void 0 : userApp.app_services.filter((service) => service.code === APP_CODES.account.services.account.code)) !== null && _a !== void 0 ? _a : [];
|
|
24
26
|
}
|
|
25
|
-
return
|
|
26
|
-
}, [appCode,
|
|
27
|
+
return (_b = userApp === null || userApp === void 0 ? void 0 : userApp.app_services) !== null && _b !== void 0 ? _b : [];
|
|
28
|
+
}, [appInfo.appCode, userApp === null || userApp === void 0 ? void 0 : userApp.app_services]);
|
|
27
29
|
const handleChange = (event) => {
|
|
28
30
|
setSelectedOption(event.target.value);
|
|
29
31
|
};
|
|
@@ -32,8 +34,8 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
32
34
|
};
|
|
33
35
|
const activeTabTitle = useMemo(() => {
|
|
34
36
|
var _a, _b;
|
|
35
|
-
return getNameText((_b = (_a =
|
|
36
|
-
}, [pathname,
|
|
37
|
+
return getNameText((_b = (_a = services.filter((service) => service.code.toLowerCase() === decodeURIComponent(appInfo.serviceCode).toLowerCase())) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.name, i18n.language);
|
|
38
|
+
}, [pathname, appInfo.serviceCode]);
|
|
37
39
|
useEffect(() => {
|
|
38
40
|
setSelectedOption(activeTabTitle);
|
|
39
41
|
}, [activeTabTitle]);
|
|
@@ -45,14 +47,14 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
45
47
|
setInitServicesWidth(((_a = servicesRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) + iconSize + iconGap + iconMargin);
|
|
46
48
|
}, []);
|
|
47
49
|
useEffect(() => {
|
|
48
|
-
setIsDropdown(Number(dimensions.width) < initServicesWidth + 10);
|
|
49
|
-
}, [dimensions.width
|
|
50
|
-
const navigateToService = (
|
|
51
|
-
|
|
50
|
+
setIsDropdown(Number(appInfo === null || appInfo === void 0 ? void 0 : appInfo.dimensions.width) < initServicesWidth + 10);
|
|
51
|
+
}, [appInfo === null || appInfo === void 0 ? void 0 : appInfo.dimensions.width]);
|
|
52
|
+
const navigateToService = (serviceCode) => {
|
|
53
|
+
onChangeAppServiceCode === null || onChangeAppServiceCode === void 0 ? void 0 : onChangeAppServiceCode(serviceCode);
|
|
52
54
|
setOpenDropdown(false);
|
|
53
55
|
};
|
|
54
56
|
const renderValue = (selected) => _jsx(StyledSelectComponent, { children: selected });
|
|
55
|
-
return (_jsxs(Wrapper, Object.assign({ maximized: isMaximized }, { children: [
|
|
57
|
+
return (_jsxs(Wrapper, Object.assign({ maximized: appInfo.isMaximized }, { children: [services.length && !isDropdown && (_jsx(Box, Object.assign({ ref: servicesRef, display: "flex", gap: "8px", flexDirection: "row", sx: { userSelect: 'none' } }, { children: services.map((service, idx) => (_jsx(ServiceItem, { appInfo: appInfo, onClickServiceItem: onClickServiceItem, navigateToMenuItem: navigateToService, name: getNameText(service.name, i18n.language) || '', code: service.code }, `service-item-${service.code}-${idx}`))) }))), services.length && isDropdown && (_jsx(StyledSelect, Object.assign({ open: openDropdown, onClick: handleOpenDropdown, displayEmpty: true, inputProps: { 'aria-label': 'Without label' }, MenuProps: {
|
|
56
58
|
anchorOrigin: {
|
|
57
59
|
vertical: 40,
|
|
58
60
|
horizontal: 83,
|
|
@@ -72,7 +74,7 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
72
74
|
paddingTop: '0px !important',
|
|
73
75
|
paddingBottom: '0px !important',
|
|
74
76
|
},
|
|
75
|
-
} }, { children: services.map((service
|
|
77
|
+
} }, { children: services.map((service) => {
|
|
76
78
|
var _a;
|
|
77
79
|
if (((_a = getNameText(service.name, i18n.language)) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.toLowerCase())) {
|
|
78
80
|
return null;
|
|
@@ -81,7 +83,7 @@ function AppServices({ isMaximized, serviceCode, dimensions, appCode, services,
|
|
|
81
83
|
e.preventDefault();
|
|
82
84
|
e.stopPropagation();
|
|
83
85
|
navigateToService(service.code);
|
|
84
|
-
} }, { children: _jsx(StyledMenuTitle, { children: getNameText(service.name, i18n.language) }) })
|
|
86
|
+
} }, { children: _jsx(StyledMenuTitle, { children: getNameText(service.name, i18n.language) }) })));
|
|
85
87
|
}) })))] })));
|
|
86
88
|
}
|
|
87
89
|
export default memo(AppServices);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { AppDetails } from '../../types/index.js';
|
|
2
3
|
export interface ServiceItemProps {
|
|
3
|
-
|
|
4
|
+
appInfo: AppDetails;
|
|
4
5
|
isDropdown?: boolean;
|
|
5
6
|
name: string;
|
|
6
7
|
code: string;
|
|
8
|
+
onDropdownClick?: () => void;
|
|
7
9
|
navigateToMenuItem: (serviceCode: string) => void;
|
|
8
10
|
onClickServiceItem?: (code: string) => void;
|
|
9
11
|
}
|
|
10
|
-
declare function ServiceItem({ isDropdown, name, code,
|
|
12
|
+
declare function ServiceItem({ isDropdown, name, code, appInfo, onDropdownClick, navigateToMenuItem, onClickServiceItem }: ServiceItemProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
declare const _default: import("react").MemoExoticComponent<typeof ServiceItem>;
|
|
12
14
|
export default _default;
|
|
@@ -5,7 +5,7 @@ import { DropdownMenu, Icon } from '../index.js';
|
|
|
5
5
|
import { isInsightService } from '../../utils/index.js';
|
|
6
6
|
import { homeIcon, newWindowIcon } from '../../constants/index.js';
|
|
7
7
|
import { ServiceItemStyled } from './style';
|
|
8
|
-
function ServiceItem({ isDropdown = false, name, code,
|
|
8
|
+
function ServiceItem({ isDropdown = false, name, code, appInfo, onDropdownClick, navigateToMenuItem, onClickServiceItem }) {
|
|
9
9
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
10
10
|
const { t } = useTranslation();
|
|
11
11
|
const open = Boolean(anchorEl);
|
|
@@ -13,7 +13,7 @@ function ServiceItem({ isDropdown = false, name, code, activeCode, navigateToMen
|
|
|
13
13
|
setAnchorEl(null);
|
|
14
14
|
};
|
|
15
15
|
const isHomeService = isInsightService(code);
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsx(ServiceItemStyled, Object.assign({ isDropdown: isDropdown, className:
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(ServiceItemStyled, Object.assign({ isDropdown: isDropdown, className: appInfo.serviceCode.toLowerCase() === code.toLowerCase() ? 'active' : '', onClick: (e) => {
|
|
17
17
|
e.preventDefault();
|
|
18
18
|
e.stopPropagation();
|
|
19
19
|
navigateToMenuItem(code);
|
|
@@ -31,6 +31,8 @@ function ServiceItem({ isDropdown = false, name, code, activeCode, navigateToMen
|
|
|
31
31
|
e.stopPropagation();
|
|
32
32
|
onClickServiceItem === null || onClickServiceItem === void 0 ? void 0 : onClickServiceItem(code);
|
|
33
33
|
handleClose();
|
|
34
|
+
if (onDropdownClick)
|
|
35
|
+
onDropdownClick();
|
|
34
36
|
},
|
|
35
37
|
},
|
|
36
38
|
] })] }));
|
|
@@ -9,12 +9,12 @@ export declare const StyledInput: import("@emotion/styled").StyledComponent<{
|
|
|
9
9
|
color?: string | undefined;
|
|
10
10
|
content?: string | undefined;
|
|
11
11
|
translate?: "yes" | "no" | undefined;
|
|
12
|
-
name?: string | undefined;
|
|
13
12
|
value?: string | number | readonly string[] | undefined;
|
|
14
13
|
list?: string | undefined;
|
|
15
14
|
form?: string | undefined;
|
|
16
15
|
slot?: string | undefined;
|
|
17
16
|
title?: string | undefined;
|
|
17
|
+
name?: string | undefined;
|
|
18
18
|
className?: string | undefined;
|
|
19
19
|
pattern?: string | undefined;
|
|
20
20
|
defaultChecked?: boolean | undefined;
|
|
@@ -13,12 +13,6 @@ export declare const StyledHeaderWrapper: import("@emotion/styled").StyledCompon
|
|
|
13
13
|
maximized?: boolean | undefined;
|
|
14
14
|
isDragging?: boolean | undefined;
|
|
15
15
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
-
export declare const StyledAppHeaderWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
17
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
18
|
-
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
19
|
-
sandboxMode?: boolean | undefined;
|
|
20
|
-
isDragging?: boolean | undefined;
|
|
21
|
-
}, {}, {}>;
|
|
22
16
|
export declare const ToolbarStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
23
17
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
24
18
|
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
@@ -44,11 +44,6 @@ export const StyledHeaderWrapper = styled('div', {
|
|
|
44
44
|
})), (isDragging && {
|
|
45
45
|
cursor: 'move',
|
|
46
46
|
})), { margin: 0 })));
|
|
47
|
-
export const StyledAppHeaderWrapper = styled(Box, {
|
|
48
|
-
shouldForwardProp: (prop) => prop !== 'maximized' && prop !== 'isDragging',
|
|
49
|
-
})(({ isDragging }) => (Object.assign(Object.assign({}, (isDragging && {
|
|
50
|
-
cursor: 'move',
|
|
51
|
-
})), { margin: 0 })));
|
|
52
47
|
export const ToolbarStyled = styled(Box, {
|
|
53
48
|
shouldForwardProp: (props) => props !== 'maximized' && props !== 'isHovered',
|
|
54
49
|
})(({ theme, maximized }) => (Object.assign(Object.assign({ height: 32, position: 'relative', display: 'flex', width: '100%', justifyContent: 'center', transition: 'all 0.5s ease-in-out', borderTopLeftRadius: '12px', borderTopRightRadius: '12px' }, (maximized && {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ISheetViewVirtualTable } from './types';
|
|
3
|
-
declare function SheetViewVirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableTitle,
|
|
3
|
+
declare function SheetViewVirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, rowHeight, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableTitle, dragControls, onColumnPin, clearBackdropVisibilityTimeout, isPinnable, tableMode, overscanCount, }: Readonly<ISheetViewVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof SheetViewVirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback } from 'react';
|
|
2
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
3
3
|
import { SHEET_VIEW_TABLE_THRESHOLD } from '../../../constants/index.js';
|
|
4
4
|
import TableFooter from '../components/TableFooter/TableFooter';
|
|
5
5
|
import { SheetViewTableContainer } from '../components/style';
|
|
6
6
|
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
|
-
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,
|
|
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, dragControls, onColumnPin, clearBackdropVisibilityTimeout = 100, isPinnable = false, tableMode, overscanCount, }) {
|
|
10
10
|
const { selectedCell, selectedColumn, selectedRow, showBackDrop, setShowBackdrop, handleCellClick, handleColumnClick, handleChipClick, selectedChip, } = useTableState();
|
|
11
11
|
const { isError, tableLoading, tableError, tableEmpty, hasTimeoutError, showNoDataView, lastItemIndex, areTotalRowsNotFillingHeight, itemsCount, isDelayedFetchingNextPage, } = useTableData({
|
|
12
12
|
rows,
|
|
@@ -35,32 +35,52 @@ function SheetViewVirtualTable({ columns, rows, threshold = SHEET_VIEW_TABLE_THR
|
|
|
35
35
|
handleChipClick,
|
|
36
36
|
});
|
|
37
37
|
const onPointerDown = (e) => {
|
|
38
|
-
|
|
38
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
const scrollHandlers = useMemo(() => ({
|
|
41
|
+
start: (scrollProps) => handleScroll(scrollProps, 'start'),
|
|
42
|
+
end: (scrollProps) => handleScroll(scrollProps, 'end'),
|
|
43
|
+
scrollable: (scrollProps) => handleScroll(scrollProps, 'scrollable'),
|
|
44
|
+
}), [handleScroll]);
|
|
45
|
+
const stableTableProps = useMemo(() => ({
|
|
46
|
+
itemCount: itemsCount,
|
|
47
|
+
lastItemIndex,
|
|
48
|
+
areAllRowsLoaded,
|
|
49
|
+
loadMoreItems,
|
|
50
|
+
threshold,
|
|
51
|
+
areTotalRowsNotFillingHeight,
|
|
52
|
+
clearBackdropVisibilityTimeout,
|
|
53
|
+
overscanCount,
|
|
54
|
+
}), [
|
|
48
55
|
itemsCount,
|
|
49
56
|
lastItemIndex,
|
|
50
57
|
areAllRowsLoaded,
|
|
51
58
|
loadMoreItems,
|
|
52
59
|
threshold,
|
|
53
|
-
getItemSize,
|
|
54
|
-
getItemDataForContainer,
|
|
55
|
-
scrollToIndex,
|
|
56
60
|
areTotalRowsNotFillingHeight,
|
|
57
61
|
clearBackdropVisibilityTimeout,
|
|
58
|
-
|
|
59
|
-
setShowBackdrop,
|
|
60
|
-
pinnedStartVirtualListRef,
|
|
61
|
-
pinnedEndVirtualListRef,
|
|
62
|
-
scrollableVirtualListRef,
|
|
62
|
+
overscanCount,
|
|
63
63
|
]);
|
|
64
|
+
const dynamicTableProps = useMemo(() => ({
|
|
65
|
+
getItemSize,
|
|
66
|
+
getItemData: getItemDataForContainer,
|
|
67
|
+
scrollToIndex,
|
|
68
|
+
setBackdropVisibility: setShowBackdrop,
|
|
69
|
+
}), [getItemSize, getItemDataForContainer, scrollToIndex, setShowBackdrop]);
|
|
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
|
+
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
|
+
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
|
+
const createVirtualTableContainer = useCallback((columnsData, containerKey, isPinned = false, fixedWidth) => {
|
|
74
|
+
switch (containerKey) {
|
|
75
|
+
case 'pinnedStart':
|
|
76
|
+
return createPinnedStartTable(columnsData, fixedWidth);
|
|
77
|
+
case 'pinnedEnd':
|
|
78
|
+
return createPinnedEndTable(columnsData, fixedWidth);
|
|
79
|
+
case 'scrollable':
|
|
80
|
+
default:
|
|
81
|
+
return createScrollableTable(columnsData);
|
|
82
|
+
}
|
|
83
|
+
}, [createPinnedStartTable, createPinnedEndTable, createScrollableTable]);
|
|
64
84
|
const baseCommonProps = {
|
|
65
85
|
showHeader,
|
|
66
86
|
columnsSorting,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
4
|
import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
|
|
5
5
|
import { MainTableWrapper, UnpinnedTableHeaderWrapper } from '../style';
|
|
@@ -7,9 +7,31 @@ import SheetViewTableHeader from './SheetViewTableHeader';
|
|
|
7
7
|
import SheetViewTableLoading from './SheetViewTableLoading';
|
|
8
8
|
function MainTable({ hasPinnedStart, hasPinnedEnd, unpinnedColumnsData, showHeader, columnsSorting, onColumnSort, headerProps, showBackDrop, pinnedStartColumns, pinnedEndColumns, onColumnPin, isPinnable, lastColumnId, selectedColumn, onColumnClick, tableTitle, areAllRowsLoaded, isFetchingNextPage, scrollToIndex, isLoading, isError, hasTimeoutError, tableMode, showNoDataView, tableBodyStyles, tableLoading, createVirtualTableContainer, }) {
|
|
9
9
|
const theme = useTheme();
|
|
10
|
-
|
|
10
|
+
const allPinnedColumns = useMemo(() => [...pinnedStartColumns, ...pinnedEndColumns], [pinnedStartColumns, pinnedEndColumns]);
|
|
11
|
+
const memoizedTableBodyStyles = useMemo(() => (Object.assign(Object.assign({}, tableBodyStyles), { display: 'flex', flexDirection: 'column', height: '100%' })), [tableBodyStyles]);
|
|
12
|
+
return (_jsx(MainTableWrapper, Object.assign({ hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }, { children: _jsx(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_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, scrollable: true }, { children: _jsxs(TableWrapper, Object.assign({ "data-testid": "SheetViewVirtualTable_TableWrapper", showNoDataView: showNoDataView, sx: memoizedTableBodyStyles }, { children: [showHeader && (_jsx(UnpinnedTableHeaderWrapper, { children: _jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_UnpinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: unpinnedColumnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: allPinnedColumns, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: "scrollable", hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd }) })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
11
13
|
width: '100%',
|
|
12
14
|
minWidth: 'fit-content',
|
|
13
15
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_ScrollableStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": "SheetViewVirtualTable_TableLoading", columns: unpinnedColumnsData, isLoading: true, isPinned: false })) : (createVirtualTableContainer(unpinnedColumnsData, 'scrollable', false)) })) }))] })) })) })));
|
|
14
16
|
}
|
|
15
|
-
export default memo(MainTable)
|
|
17
|
+
export default memo(MainTable, (prevProps, nextProps) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19
|
+
const criticalProps = [
|
|
20
|
+
'hasPinnedStart',
|
|
21
|
+
'hasPinnedEnd',
|
|
22
|
+
'showHeader',
|
|
23
|
+
'showBackDrop',
|
|
24
|
+
'tableLoading',
|
|
25
|
+
'showNoDataView',
|
|
26
|
+
'isLoading',
|
|
27
|
+
'isError',
|
|
28
|
+
'hasTimeoutError',
|
|
29
|
+
'tableMode',
|
|
30
|
+
];
|
|
31
|
+
const areCriticalPropsSame = criticalProps.every((prop) => prevProps[prop] === nextProps[prop]);
|
|
32
|
+
const areColumnsDataSame = ((_a = prevProps.unpinnedColumnsData) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.unpinnedColumnsData) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
33
|
+
((_c = prevProps.unpinnedColumnsData) === null || _c === void 0 ? void 0 : _c.every((col, index) => { var _a, _b; return col.id === ((_b = (_a = nextProps.unpinnedColumnsData) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.id); }));
|
|
34
|
+
const arePinnedColumnsSame = ((_d = prevProps.pinnedStartColumns) === null || _d === void 0 ? void 0 : _d.length) === ((_e = nextProps.pinnedStartColumns) === null || _e === void 0 ? void 0 : _e.length) &&
|
|
35
|
+
((_f = prevProps.pinnedEndColumns) === null || _f === void 0 ? void 0 : _f.length) === ((_g = nextProps.pinnedEndColumns) === null || _g === void 0 ? void 0 : _g.length);
|
|
36
|
+
return areCriticalPropsSame && areColumnsDataSame && arePinnedColumnsSame;
|
|
37
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useMemo } from 'react';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
4
|
import { StyledTableBox, TableWrapper, StyledBox } from '../../components/style';
|
|
5
5
|
import { PinnedStartColumnWrapper, PinnedEndColumnWrapper } from '../style';
|
|
@@ -9,12 +9,35 @@ function PinnedColumn({ position, columnsData, columnsWidth, pinnedColumnsList,
|
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
if (columnsData.length === 0)
|
|
11
11
|
return null;
|
|
12
|
-
const Wrapper
|
|
13
|
-
|
|
12
|
+
const { Wrapper, containerKey } = useMemo(() => {
|
|
13
|
+
const key = position === 'start' ? 'pinnedStart' : 'pinnedEnd';
|
|
14
|
+
return {
|
|
15
|
+
Wrapper: position === 'start' ? PinnedStartColumnWrapper : PinnedEndColumnWrapper,
|
|
16
|
+
containerKey: key,
|
|
17
|
+
};
|
|
18
|
+
}, [position]);
|
|
14
19
|
return (_jsx(Wrapper, { children: _jsxs(StyledTableBox, Object.assign({ as: "main", id: "sheet-table-box-container", "aria-labelledby": "sheet-table-box-container", "data-testid": "SheetViewVirtualTable_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: [showHeader && (_jsx(SheetViewTableHeader, { "data-testid": "SheetViewVirtualTable_PinnedTableHeader", columnsSorting: columnsSorting, onColumnSort: onColumnSort, columns: columnsData, headerProps: headerProps, showBackDrop: showBackDrop, pinnedColumns: pinnedColumnsList, onColumnPin: onColumnPin, isPinnable: isPinnable, lastColumnId: lastColumnId, selectedColumn: selectedColumn, onColumnClick: onColumnClick, tablePosition: position === 'start' ? 'pinnedStart' : 'pinnedEnd', hasPinnedStart: hasPinnedStart, hasPinnedEnd: hasPinnedEnd })), _jsx(TableWrapper, Object.assign({ "data-testid": "VirtualTable_TableWrapper", sx: {
|
|
15
20
|
width: '100%',
|
|
16
21
|
minWidth: 'fit-content',
|
|
17
22
|
overflowX: 'hidden',
|
|
18
23
|
} }, { children: _jsx(StyledBox, Object.assign({ "data-testid": "SheetViewVirtualTable_PinnedStyledBox", hidePadding: true, className: "list-wrapper" }, { children: tableLoading ? (_jsx(SheetViewTableLoading, { "data-testid": `SheetViewVirtualTable_PinnedTableLoading_${position}`, columns: columnsData, isLoading: true, isPinned: true })) : (createVirtualTableContainer(columnsData, containerKey, true, columnsWidth)) })) }))] })) }));
|
|
19
24
|
}
|
|
20
|
-
export default memo(PinnedColumn)
|
|
25
|
+
export default memo(PinnedColumn, (prevProps, nextProps) => {
|
|
26
|
+
var _a, _b, _c, _d, _e, _f;
|
|
27
|
+
const criticalProps = [
|
|
28
|
+
'position',
|
|
29
|
+
'columnsWidth',
|
|
30
|
+
'showHeader',
|
|
31
|
+
'showBackDrop',
|
|
32
|
+
'tableLoading',
|
|
33
|
+
'showNoDataView',
|
|
34
|
+
'hasPinnedStart',
|
|
35
|
+
'hasPinnedEnd',
|
|
36
|
+
];
|
|
37
|
+
const areCriticalPropsSame = criticalProps.every((prop) => prevProps[prop] === nextProps[prop]);
|
|
38
|
+
const areColumnsDataSame = ((_a = prevProps.columnsData) === null || _a === void 0 ? void 0 : _a.length) === ((_b = nextProps.columnsData) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
39
|
+
((_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); }));
|
|
40
|
+
const arePinnedColumnsSame = ((_d = prevProps.pinnedColumnsList) === null || _d === void 0 ? void 0 : _d.length) === ((_e = nextProps.pinnedColumnsList) === null || _e === void 0 ? void 0 : _e.length) &&
|
|
41
|
+
((_f = prevProps.pinnedColumnsList) === null || _f === void 0 ? void 0 : _f.every((col, index) => { var _a; return col === ((_a = nextProps.pinnedColumnsList) === null || _a === void 0 ? void 0 : _a[index]); }));
|
|
42
|
+
return areCriticalPropsSame && areColumnsDataSame && arePinnedColumnsSame;
|
|
43
|
+
});
|
|
@@ -30,4 +30,21 @@ function VirtualTable({ columnsData, itemCount, lastItemIndex, areAllRowsLoaded,
|
|
|
30
30
|
} }, { children: ListItemWrapper })));
|
|
31
31
|
} }))) })));
|
|
32
32
|
}
|
|
33
|
-
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
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
1
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
2
2
|
export const useTableState = () => {
|
|
3
3
|
const [selectedCell, setSelectedCell] = useState(null);
|
|
4
4
|
const [selectedColumn, setSelectedColumn] = useState(null);
|
|
@@ -48,7 +48,7 @@ export const useTableState = () => {
|
|
|
48
48
|
setSelectedChip(null);
|
|
49
49
|
setSelectedRow(null);
|
|
50
50
|
}, []);
|
|
51
|
-
|
|
51
|
+
const tableStateAPI = useMemo(() => ({
|
|
52
52
|
selectedCell,
|
|
53
53
|
selectedColumn,
|
|
54
54
|
selectedRow,
|
|
@@ -59,5 +59,17 @@ export const useTableState = () => {
|
|
|
59
59
|
handleCellClick,
|
|
60
60
|
handleColumnClick,
|
|
61
61
|
resetSelection,
|
|
62
|
-
}
|
|
62
|
+
}), [
|
|
63
|
+
selectedCell,
|
|
64
|
+
selectedColumn,
|
|
65
|
+
selectedRow,
|
|
66
|
+
showBackDrop,
|
|
67
|
+
selectedChip,
|
|
68
|
+
setShowBackdrop,
|
|
69
|
+
handleChipClick,
|
|
70
|
+
handleCellClick,
|
|
71
|
+
handleColumnClick,
|
|
72
|
+
resetSelection,
|
|
73
|
+
]);
|
|
74
|
+
return tableStateAPI;
|
|
63
75
|
};
|
package/build/components/VirtualTables/SheetViewVirtualTable/hooks/useVirtualTableContainer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useMemo } from 'react';
|
|
1
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
2
2
|
import memoize from 'memoize-one';
|
|
3
3
|
const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToIndex, lastItemIndex, totalCount, isError, areAllRowsLoaded, isPinned, selectedCell, selectedColumn, selectedRow, selectedChip, onCellClick, onChipClick, containerHeight, rowHeight) => ({
|
|
4
4
|
columns,
|
|
@@ -24,16 +24,20 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
24
24
|
rowHeight,
|
|
25
25
|
}));
|
|
26
26
|
export const useVirtualTableContainer = ({ rowHeight, areAllRowsLoaded, rows, isDelayedFetchingNextPage, rowProps, scrollToIndex, footerProps, isError, selectedCell, selectedColumn, selectedRow, selectedChip, handleCellClick, handleChipClick, }) => {
|
|
27
|
+
const stableRowsLength = useRef(rows.length);
|
|
28
|
+
if (stableRowsLength.current !== rows.length) {
|
|
29
|
+
stableRowsLength.current = rows.length;
|
|
30
|
+
}
|
|
27
31
|
const getItemSize = useCallback((index, height) => {
|
|
28
|
-
const isLastRow = areAllRowsLoaded && index ===
|
|
32
|
+
const isLastRow = areAllRowsLoaded && index === stableRowsLength.current;
|
|
29
33
|
if (isLastRow) {
|
|
30
|
-
const usedHeight =
|
|
34
|
+
const usedHeight = stableRowsLength.current * rowHeight;
|
|
31
35
|
const remainingHeight = height - usedHeight;
|
|
32
36
|
const minimumLastRowHeight = rowHeight * 2;
|
|
33
37
|
return Math.max(remainingHeight, minimumLastRowHeight);
|
|
34
38
|
}
|
|
35
39
|
return rowHeight;
|
|
36
|
-
}, [areAllRowsLoaded,
|
|
40
|
+
}, [areAllRowsLoaded, rowHeight]);
|
|
37
41
|
const commonItemDataParams = useMemo(() => {
|
|
38
42
|
var _a;
|
|
39
43
|
return [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IVirtualTable } from '../../../types/index.js';
|
|
3
|
-
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle,
|
|
3
|
+
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, dragControls, isSheetView, isMinimized, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -34,11 +34,11 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
34
34
|
areAllRowsLoaded,
|
|
35
35
|
isSheetView,
|
|
36
36
|
}));
|
|
37
|
-
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle,
|
|
37
|
+
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, dragControls, isSheetView = false, isMinimized, }) {
|
|
38
38
|
var _a;
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const onPointerDown = (e) => {
|
|
41
|
-
|
|
41
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
42
42
|
};
|
|
43
43
|
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
44
44
|
value: isFetchingNextPage,
|
|
@@ -8,6 +8,6 @@ export interface VirtualTableWithCardProps extends Omit<IVirtualTable, 'showHead
|
|
|
8
8
|
tableHeight: number;
|
|
9
9
|
tableHeaderHeight?: number;
|
|
10
10
|
}
|
|
11
|
-
declare function VirtualTableWithCard({ rows, threshold, rowProps, footerProps, rowHeight, isLoading, error, tableHeader, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, renderCardComponent, cardLoadingComponent, tableHeight, tableHeaderHeight, noDataComponent,
|
|
11
|
+
declare function VirtualTableWithCard({ rows, threshold, rowProps, footerProps, rowHeight, isLoading, error, tableHeader, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, renderCardComponent, cardLoadingComponent, tableHeight, tableHeaderHeight, noDataComponent, dragControls, }: VirtualTableWithCardProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTableWithCard>;
|
|
13
13
|
export default _default;
|
|
@@ -32,11 +32,11 @@ const createItemData = memoize((isLoading, rows, rowProps, scrollToIndex, lastIt
|
|
|
32
32
|
areAllRowsLoaded,
|
|
33
33
|
renderCardComponent,
|
|
34
34
|
}));
|
|
35
|
-
function VirtualTableWithCard({ rows, threshold = TABLE_THRESHOLD, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, tableHeader, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, renderCardComponent, cardLoadingComponent, tableHeight, tableHeaderHeight, noDataComponent,
|
|
35
|
+
function VirtualTableWithCard({ rows, threshold = TABLE_THRESHOLD, rowProps, footerProps, rowHeight = TABLE_ROW_HEIGHT, isLoading, error, tableHeader, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, renderCardComponent, cardLoadingComponent, tableHeight, tableHeaderHeight, noDataComponent, dragControls, }) {
|
|
36
36
|
var _a;
|
|
37
37
|
const theme = useTheme();
|
|
38
38
|
const onPointerDown = (e) => {
|
|
39
|
-
|
|
39
|
+
dragControls === null || dragControls === void 0 ? void 0 : dragControls.start(e);
|
|
40
40
|
};
|
|
41
41
|
const isDelayedFetchingNextPage = useDelayToSetValue({
|
|
42
42
|
value: isFetchingNextPage,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useAnimationOptimization: (isAnimating: boolean) => ((callback: () => void) => void) | null;
|
|
3
|
+
export declare const OptimizedAnimatedCell: import("react").MemoExoticComponent<({ children, isAnimating, ...props }: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
isAnimating: boolean;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
+
export declare const animationStyles: {
|
|
9
|
+
slideIn: {
|
|
10
|
+
transform: string;
|
|
11
|
+
transition: string;
|
|
12
|
+
};
|
|
13
|
+
slideOut: {
|
|
14
|
+
transform: string;
|
|
15
|
+
transition: string;
|
|
16
|
+
};
|
|
17
|
+
fadeIn: {
|
|
18
|
+
opacity: number;
|
|
19
|
+
transition: string;
|
|
20
|
+
};
|
|
21
|
+
fadeOut: {
|
|
22
|
+
opacity: number;
|
|
23
|
+
transition: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const useScrollOptimization: () => boolean;
|