pixel-react 1.21.15 → 1.21.18
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/lib/ComponentProps/TreeNodeProps.d.ts +12 -0
- package/lib/components/NoResultFound/NoResultFound.d.ts +1 -0
- package/lib/components/NoResultFound/NoResultFound.js +1 -1
- package/lib/components/NoResultFound/NoResultFound.js.map +1 -1
- package/lib/components/OverviewModal/overviewModal.js +4 -4
- package/lib/components/OverviewModal/overviewModal.js.map +1 -1
- package/lib/components/OverviewModal/types.d.ts +27 -26
- package/lib/components/Table/EditComponent.js +6 -6
- package/lib/components/Table/EditComponent.js.map +1 -1
- package/lib/components/Table/NoDataContent.js +1 -1
- package/lib/components/Table/NoDataContent.js.map +1 -1
- package/lib/components/Table/Table.js +155 -78
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Table/Types.d.ts +11 -6
- package/lib/components/Table/components/SortableRow.d.ts +1 -1
- package/lib/components/Table/components/SortableRow.js +60 -69
- package/lib/components/Table/components/SortableRow.js.map +1 -1
- package/lib/components/Table/components/TableHeader.js +20 -15
- package/lib/components/Table/components/TableHeader.js.map +1 -1
- package/lib/components/Table/components/VirtualizedRows.d.ts +1 -1
- package/lib/components/Table/components/VirtualizedRows.js +32 -17
- package/lib/components/Table/components/VirtualizedRows.js.map +1 -1
- package/lib/components/Table/utils/TableCell.d.ts +2 -0
- package/lib/components/Table/utils/TableCell.js +27 -0
- package/lib/components/Table/utils/TableCell.js.map +1 -0
- package/lib/components/Table/utils/virtualization.d.ts +10 -3
- package/lib/components/Table/utils/virtualization.js +40 -13
- package/lib/components/Table/utils/virtualization.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableHead.js +1 -1
- package/lib/components/TableTreeFn/Components/TableHead.js.map +1 -1
- package/lib/components/TableTreeFn/TableTreeFn.js +23 -25
- package/lib/components/TableTreeFn/TableTreeFn.js.map +1 -1
- package/lib/components/TableWithAccordion/TableWithAccordion.js +38 -13
- package/lib/components/TableWithAccordion/TableWithAccordion.js.map +1 -1
- package/lib/components/TableWithAccordion/types.d.ts +2 -2
- package/lib/index.d.ts +54 -32
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/styles.css +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/TreeNavigateUtils/getNavigateToKey.d.ts +1 -1
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.d.ts +8 -0
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.js +263 -0
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.js.map +1 -0
- package/lib/utils/getTopVisibleNodeKey/getTopVisibleNodeKey.d.ts +1 -1
- package/lib/utils/getTreeDetails/getTreeDetails.d.ts +1 -1
- package/lib/utils/handleTreeExpandAllCollapseAll/handleTreeExpandAllCollapseAll.d.ts +1 -1
- package/lib/utils/handleTreeNodeExpandCollapse/handleTreeNodeExpandCollapse.d.ts +1 -1
- package/lib/utils/handleTreeNodeSelect/handleTreeNodeSelect.d.ts +1 -1
- package/lib/utils/toggleShowHideEntity/toggleShowHideEntity.d.ts +1 -1
- package/package.json +2 -2
|
@@ -81,4 +81,16 @@ export type TreeNodeProps = {
|
|
|
81
81
|
includeIteration?: boolean;
|
|
82
82
|
totalConditionCount?: number;
|
|
83
83
|
reRunStep?: boolean;
|
|
84
|
+
liveURL?: string;
|
|
85
|
+
isRunning?: boolean;
|
|
86
|
+
deviceInfo?: {
|
|
87
|
+
name?: string;
|
|
88
|
+
brand?: string;
|
|
89
|
+
platform?: string;
|
|
90
|
+
version?: string;
|
|
91
|
+
appName?: string;
|
|
92
|
+
appId?: string;
|
|
93
|
+
type?: string;
|
|
94
|
+
subType?: string;
|
|
95
|
+
};
|
|
84
96
|
};
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import './NoResultFound.scss';
|
|
3
3
|
import Icon from '../Icon';
|
|
4
4
|
import Typography from '../Typography';
|
|
5
|
-
const NoResultFound = ({ text = ' No Results Found', iconName = 'no_license_found', fontSize = '24px', textAlign = 'left', direction = 'column', iconWidth = 120, iconHeight = 120, fontWeight = 'semi-bold', }) => (_jsx("article", { className: "no_results_container", children: _jsxs("div", { className: `no_results_container__${direction}`, children: [_jsx(Icon, { name: iconName, width: iconWidth, height: iconHeight }), _jsx("div", { children: _jsx(Typography, { as: "div", fontSize: fontSize, lineHeight: "36px", fontWeight: fontWeight, color: "var(--text-color)", textAlign: textAlign, children: text }) })] }) }));
|
|
5
|
+
const NoResultFound = ({ text = ' No Results Found', iconName = 'no_license_found', fontSize = '24px', textAlign = 'left', direction = 'column', iconWidth = 120, iconHeight = 120, fontWeight = 'semi-bold', marginTop = '0px', }) => (_jsx("article", { className: "no_results_container", children: _jsxs("div", { className: `no_results_container__${direction}`, style: { marginTop: marginTop }, children: [_jsx(Icon, { name: iconName, width: iconWidth, height: iconHeight }), _jsx("div", { children: _jsx(Typography, { as: "div", fontSize: fontSize, lineHeight: "36px", fontWeight: fontWeight, color: "var(--text-color)", textAlign: textAlign, children: text }) })] }) }));
|
|
6
6
|
export default NoResultFound;
|
|
7
7
|
//# sourceMappingURL=NoResultFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoResultFound.js","sourceRoot":"","sources":["../../../src/components/NoResultFound/NoResultFound.tsx"],"names":[],"mappings":";AAEA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"NoResultFound.js","sourceRoot":"","sources":["../../../src/components/NoResultFound/NoResultFound.tsx"],"names":[],"mappings":";AAEA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AAavC,MAAM,aAAa,GAAoB,CAAC,EACtC,IAAI,GAAG,mBAAmB,EAC1B,QAAQ,GAAG,kBAAkB,EAC7B,QAAQ,GAAG,MAAM,EACjB,SAAS,GAAG,MAAM,EAClB,SAAS,GAAG,QAAQ,EACpB,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,UAAU,GAAG,WAAW,EACxB,SAAS,GAAG,KAAK,GAClB,EAAE,EAAE,CAAC,CACJ,kBAAS,SAAS,EAAC,sBAAsB,YACvC,eACE,SAAS,EAAE,yBAAyB,SAAS,EAAE,EAC/C,KAAK,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,aAE/B,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAI,EAC9D,wBACE,KAAC,UAAU,IACT,EAAE,EAAC,KAAK,EACR,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAC,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAC,mBAAmB,EACzB,SAAS,EAAE,SAAS,YAEnB,IAAI,GACM,GACT,IACF,GACE,CACX,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -6,7 +6,7 @@ import Icon from '../Icon';
|
|
|
6
6
|
import Typography from '../Typography';
|
|
7
7
|
import './overviewModal.scss';
|
|
8
8
|
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
9
|
-
const OverviewModal = ({ isOpen, onClose, isMaximized, width = '800px', height = '432px', header, children, zIndex = 999, icons, downloadFileIcon = false, showHeader = true, top = '0', overlay = true, downloadHandler, multiData = [], setSelectedVideo, customStyle, }) => {
|
|
9
|
+
const OverviewModal = ({ isOpen, onClose, isMaximized, width = '800px', height = '432px', header, children, zIndex = 999, icons, downloadFileIcon = false, showHeader = true, top = '0', overlay = true, downloadHandler, multiData = [], setSelectedVideo, customStyle, isIframe = false, }) => {
|
|
10
10
|
const [videos, setVideos] = useState(multiData);
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
if (!checkEmpty(multiData)) {
|
|
@@ -40,7 +40,7 @@ const OverviewModal = ({ isOpen, onClose, isMaximized, width = '800px', height =
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
const modalContent = (_jsx("div", { className: "ff-overview-modal-overlay", style: {
|
|
43
|
-
background: overlay ? 'var(--
|
|
43
|
+
background: overlay ? 'var(--modal-background-color)' : undefined,
|
|
44
44
|
zIndex,
|
|
45
45
|
}, children: _jsxs("div", { className: classNames('ff-overview-modal-container', {
|
|
46
46
|
'ff-overview-maximized-container': isMaximized,
|
|
@@ -51,13 +51,13 @@ const OverviewModal = ({ isOpen, onClose, isMaximized, width = '800px', height =
|
|
|
51
51
|
'--modal-top': top,
|
|
52
52
|
}, children: [showHeader && (_jsxs("div", { className: "ff-overview-modal-header", children: [header, _jsxs("div", { className: "ff-overview-modal-icons", children: [downloadFileIcon && (_jsx(Icon, { width: 16, height: 16, name: "download_file", onClick: downloadHandler })), icons] })] })), _jsx("div", { className: classNames('ff-overview-modal-body', {
|
|
53
53
|
'ff-overview-modal-body--centered': isEmptyData,
|
|
54
|
-
}), children: !isEmptyData ? (_jsx("div", { className: `image-grid${singleClass}`, children: videos.map((video, idx) => (_jsxs("div", { className: "ff-overview-modal-image-item", children: [_jsx("video", { src: video.src, autoPlay: true, muted: true, playsInline: true, preload: "auto", controls: false, onEnded: () => handleVideoEnd(idx), className: "ff-overview-modal-video", children: "Your browser does not support the video tag." }), _jsxs("div", { className: "ff-overview-modal-image-name", children: [_jsx(Icon, { name: video.icon }), _jsxs(Typography, { children: [video.machineName, " - ", video.scriptName] })] }), _jsx(Icon, { width: 16, height: 16, className: "ff-overview-modal-image-action", name: "maximize_new", onClick: () => {
|
|
54
|
+
}), children: !isEmptyData ? (_jsx("div", { className: `image-grid${singleClass}`, children: videos.map((video, idx) => (_jsxs("div", { className: "ff-overview-modal-image-item", children: [isIframe ? (_jsx("iframe", { src: video.src, className: "ff-overview-modal-video", height: '100%', width: '100%' })) : (_jsx("video", { src: video.src, autoPlay: true, muted: true, playsInline: true, preload: "auto", controls: false, onEnded: () => handleVideoEnd(idx), className: "ff-overview-modal-video", children: "Your browser does not support the video tag." })), _jsxs("div", { className: "ff-overview-modal-image-name", children: [_jsx(Icon, { name: video.icon || '' }), _jsxs(Typography, { children: [video.machineName, " - ", video.scriptName] })] }), _jsx(Icon, { width: 16, height: 16, className: "ff-overview-modal-image-action", name: "maximize_new", onClick: () => {
|
|
55
55
|
const clickedVideo = {
|
|
56
56
|
currentVideoData: { ...video, clickedAt: Date.now() },
|
|
57
57
|
allVideoData: videos,
|
|
58
58
|
};
|
|
59
59
|
setSelectedVideo?.(clickedVideo);
|
|
60
|
-
} }), _jsxs(Typography, { color: "var(--ff-chip-bg)", className: "ff-overview-modal-scripts", children: [video.currentScripts, "/", video.totalScripts] })] }, idx))) })) : (children) })] }) }));
|
|
60
|
+
} }), _jsxs(Typography, { color: "var(--ff-chip-bg)", className: "ff-overview-modal-scripts", children: [video.currentScripts, "/", video.totalScripts] })] }, `${video.src}-${idx}`))) })) : (children) })] }) }));
|
|
61
61
|
return ReactDOM.createPortal(modalContent, document.body);
|
|
62
62
|
};
|
|
63
63
|
export default OverviewModal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overviewModal.js","sourceRoot":"","sources":["../../../src/components/OverviewModal/overviewModal.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,MAAM,aAAa,GAAiC,CAAC,EACnD,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,MAAM,EACN,QAAQ,EACR,MAAM,GAAG,GAAG,EACZ,KAAK,EACL,gBAAgB,GAAG,KAAK,EACxB,UAAU,GAAG,IAAI,EACjB,GAAG,GAAG,GAAG,EACT,OAAO,GAAG,IAAI,EACd,eAAe,EACf,SAAS,GAAG,EAAE,EACd,gBAAgB,EAChB,WAAW,
|
|
1
|
+
{"version":3,"file":"overviewModal.js","sourceRoot":"","sources":["../../../src/components/OverviewModal/overviewModal.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAE/D,MAAM,aAAa,GAAiC,CAAC,EACnD,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,MAAM,EACN,QAAQ,EACR,MAAM,GAAG,GAAG,EACZ,KAAK,EACL,gBAAgB,GAAG,KAAK,EACxB,UAAU,GAAG,IAAI,EACjB,GAAG,GAAG,GAAG,EACT,OAAO,GAAG,IAAI,EACd,eAAe,EACf,SAAS,GAAG,EAAE,EACd,gBAAgB,EAChB,WAAW,EACX,QAAQ,GAAG,KAAK,GACjB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,SAAS,CAAC,SAAS,CAAC,CAAC;QACvB,CAAC;IACH,CAAC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CAAC,IAAI,IAAI,EAAE,GAAI,EAChC,MAAC,UAAU,eACR,KAAK,CAAC,WAAW,SAAK,KAAK,CAAC,UAAU,IAC5B,IACT,EAEN,KAAC,IAAI,IACH,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,SAAS,EAAC,gCAAgC,EAC1C,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,GAAG,EAAE;wCACZ,MAAM,YAAY,GAAG;4CACnB,gBAAgB,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;4CACrD,YAAY,EAAE,MAAM;yCACrB,CAAC;wCACF,gBAAgB,EAAE,CAAC,YAAY,CAAC,CAAC;oCACnC,CAAC,GACD,EAEF,MAAC,UAAU,IACT,KAAK,EAAC,mBAAmB,EACzB,SAAS,EAAC,2BAA2B,aAEpC,KAAK,CAAC,cAAc,OAAG,KAAK,CAAC,YAAY,IAC/B,KA3CoC,GAAG,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CA4ClE,CACP,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACG,IACF,GACF,CACP,CAAC;IAEF,OAAO,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -11,41 +11,42 @@ export interface OverviewModalProps {
|
|
|
11
11
|
onMaximizeToggle?: () => void;
|
|
12
12
|
showHeader: boolean;
|
|
13
13
|
top?: string;
|
|
14
|
+
isIframe?: boolean;
|
|
14
15
|
overlay?: boolean;
|
|
15
16
|
downloadHandler: () => void;
|
|
16
17
|
zIndex?: number;
|
|
17
18
|
customStyle?: React.CSSProperties;
|
|
18
19
|
multiData?: Array<{
|
|
19
|
-
machineName
|
|
20
|
-
scriptName
|
|
21
|
-
icon
|
|
20
|
+
machineName?: string;
|
|
21
|
+
scriptName?: string;
|
|
22
|
+
icon?: string;
|
|
22
23
|
src: string;
|
|
23
|
-
alt
|
|
24
|
-
runId
|
|
25
|
-
currentScripts
|
|
26
|
-
totalScripts
|
|
24
|
+
alt?: string;
|
|
25
|
+
runId?: string;
|
|
26
|
+
currentScripts?: number;
|
|
27
|
+
totalScripts?: number;
|
|
27
28
|
}>;
|
|
28
29
|
setSelectedVideo?: (video: {
|
|
29
|
-
currentVideoData
|
|
30
|
-
machineName
|
|
31
|
-
scriptName
|
|
32
|
-
icon
|
|
33
|
-
src
|
|
34
|
-
alt
|
|
35
|
-
runId
|
|
36
|
-
currentScripts
|
|
37
|
-
totalScripts
|
|
38
|
-
clickedAt
|
|
30
|
+
currentVideoData?: {
|
|
31
|
+
machineName?: string;
|
|
32
|
+
scriptName?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
src?: string;
|
|
35
|
+
alt?: string;
|
|
36
|
+
runId?: string;
|
|
37
|
+
currentScripts?: number;
|
|
38
|
+
totalScripts?: number;
|
|
39
|
+
clickedAt?: number;
|
|
39
40
|
};
|
|
40
|
-
allVideoData
|
|
41
|
-
machineName
|
|
42
|
-
scriptName
|
|
43
|
-
icon
|
|
44
|
-
src
|
|
45
|
-
alt
|
|
46
|
-
runId
|
|
47
|
-
currentScripts
|
|
48
|
-
totalScripts
|
|
41
|
+
allVideoData?: Array<{
|
|
42
|
+
machineName?: string;
|
|
43
|
+
scriptName?: string;
|
|
44
|
+
icon?: string;
|
|
45
|
+
src?: string;
|
|
46
|
+
alt?: string;
|
|
47
|
+
runId?: string;
|
|
48
|
+
currentScripts?: number;
|
|
49
|
+
totalScripts?: number;
|
|
49
50
|
}>;
|
|
50
51
|
}) => void;
|
|
51
52
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import './Table.scss';
|
|
4
4
|
import Typography from '../Typography';
|
|
5
5
|
import Select from '../Select';
|
|
6
|
-
import
|
|
7
|
-
import '
|
|
6
|
+
import Button from '../Button';
|
|
7
|
+
import { Form } from '../..';
|
|
8
8
|
const ifFailedOptionList = [
|
|
9
9
|
{
|
|
10
10
|
label: 'Mark this script as Failed and continue dependant script execution',
|
|
@@ -32,15 +32,15 @@ const EditComponent = ({ rowData, rowIndex, handleSave, handleCancel, }) => {
|
|
|
32
32
|
const [initialFormState] = useState({
|
|
33
33
|
ifFailed: '',
|
|
34
34
|
});
|
|
35
|
-
return (_jsxs("section", { className:
|
|
36
|
-
return (_jsxs("div", { className:
|
|
35
|
+
return (_jsxs("section", { className: "ff-table-edit-depends", children: [_jsxs("header", { className: "ff-table-edit-depends-header", children: [_jsx("div", { children: _jsxs(Typography, { color: "var(--nlp-option-color)", lineHeight: "18px", children: [rowIndex, ".", rowData?.name] }) }), _jsx("div", { className: "ff-table-edit-depends-header-link", children: _jsx(Typography, { children: "Go to script", color: "var(--nlp-color)", fontWeight: "semi-bold" }) })] }), _jsx(Form, { onSubmit: handleSave, defaultValues: initialFormState, children: ({ register, setValue, formState: { errors }, watch, trigger }) => {
|
|
36
|
+
return (_jsxs("div", { className: "ff-table-edit-depends-form", children: [_jsx(Select, { label: "if Failed", optionsList: ifFailedOptionList, ...register('ifFailed'), onChange: (option) => {
|
|
37
37
|
setValue('ifFailed', option.label);
|
|
38
38
|
}, errorMsg: errors.ifFailed?.message, optionZIndex: 9999, selectedOption: {
|
|
39
39
|
label: watch('ifFailed'),
|
|
40
40
|
value: watch('ifFailed'),
|
|
41
41
|
}, onBlur: () => {
|
|
42
42
|
trigger('ifFailed');
|
|
43
|
-
} }), _jsxs("div", { className:
|
|
43
|
+
} }), _jsxs("div", { className: "ff-table-edit-depends-form-button", children: [_jsx(Button, { variant: "tertiary", children: "Cancel", onClick: handleCancel }), _jsx(Button, { variant: "primary", type: "submit", children: "Update" })] })] }));
|
|
44
44
|
} })] }));
|
|
45
45
|
};
|
|
46
46
|
export default EditComponent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditComponent.js","sourceRoot":"","sources":["../../../src/components/Table/EditComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"EditComponent.js","sourceRoot":"","sources":["../../../src/components/Table/EditComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,cAAc,CAAC;AAGtB,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,MAAM,kBAAkB,GAAG;IACzB;QACE,KAAK,EAAE,oEAAoE;QAC3E,KAAK,EAAE,oEAAoE;KAC5E;IACD;QACE,KAAK,EACH,qEAAqE;QACvE,KAAK,EACH,qEAAqE;KACxE;IACD;QACE,KAAK,EAAE,gEAAgE;QACvE,KAAK,EAAE,gEAAgE;KACxE;IACD;QACE,KAAK,EAAE,8DAA8D;QACrE,KAAK,EAAE,8DAA8D;KACtE;IACD;QACE,KAAK,EAAE,wDAAwD;QAC/D,KAAK,EAAE,wDAAwD;KAChE;CACF,CAAC;AACF,gBAAgB;AAChB,MAAM,aAAa,GAAG,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,UAAU,EACV,YAAY,GACR,EAAE,EAAE;IACR,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAa;QAC9C,QAAQ,EAAE,EAAE;KACb,CAAC,CAAC;IAEH,OAAO,CACL,mBAAS,SAAS,EAAC,uBAAuB,aACxC,kBAAQ,SAAS,EAAC,8BAA8B,aAC9C,wBACE,MAAC,UAAU,IAAC,KAAK,EAAC,yBAAyB,EAAC,UAAU,EAAC,MAAM,aAC1D,QAAQ,OAAG,OAAO,EAAE,IAAI,IACd,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3
|
import Icon from '../Icon';
|
|
4
4
|
import Typography from '../Typography';
|
|
5
5
|
const NoDataContent = () => {
|
|
6
|
-
return (_jsxs("div", { className: "no_data_message", children: [_jsx(Icon, { name: "no_license_found", width: 120, height: 115 }), _jsx(Typography, { fontSize: "24px", lineHeight: "36px", fontWeight: "bold", children: "No Results Found" })] }));
|
|
6
|
+
return (_jsxs("div", { className: "ff-no_data_message", children: [_jsx(Icon, { name: "no_license_found", width: 120, height: 115 }), _jsx(Typography, { fontSize: "24px", lineHeight: "36px", fontWeight: "bold", children: "No Results Found" })] }));
|
|
7
7
|
};
|
|
8
8
|
export default NoDataContent;
|
|
9
9
|
//# sourceMappingURL=NoDataContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoDataContent.js","sourceRoot":"","sources":["../../../src/components/Table/NoDataContent.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"NoDataContent.js","sourceRoot":"","sources":["../../../src/components/Table/NoDataContent.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AACtB,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,MAAM,aAAa,GAAO,GAAG,EAAE;IAC7B,OAAO,CACL,eAAK,SAAS,EAAC,oBAAoB,aACjC,KAAC,IAAI,IAAC,IAAI,EAAC,kBAAkB,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAI,EACzD,KAAC,UAAU,IAAC,QAAQ,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,iCAElD,IACT,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import './Table.scss';
|
|
3
|
-
import { isFunction } from '../../assets/utils/functionUtils';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
3
|
import { useEffect, useRef, useState, useCallback, useMemo, useImperativeHandle, forwardRef, } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { closestCorners, DndContext } from '@dnd-kit/core';
|
|
5
|
+
import { SortableContext, verticalListSortingStrategy, } from '@dnd-kit/sortable';
|
|
6
|
+
import classNames from 'classnames';
|
|
8
7
|
import TableHeader from './components/TableHeader';
|
|
9
8
|
import VirtualizedRows from './components/VirtualizedRows';
|
|
9
|
+
import { BUFFER_SIZE, DEFAULT_ROW_HEIGHT } from './utils/constants';
|
|
10
|
+
import { isFunction } from './utils/TableCell';
|
|
11
|
+
import { binarySearch, calculateFrozenWidth, getTableGridTemplate, } from './utils/virtualization';
|
|
10
12
|
import { debounce } from '../../utils/debounce/debounce';
|
|
11
|
-
import { closestCorners, DndContext } from '@dnd-kit/core';
|
|
12
|
-
import { SortableContext, verticalListSortingStrategy, } from '@dnd-kit/sortable';
|
|
13
13
|
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
14
|
-
const
|
|
14
|
+
const HEADER_HEIGHT = 34;
|
|
15
|
+
const Table = forwardRef(({ data = [], columns = [], headerType, withCheckbox = false, onSelect, allSelected, partialSelected = false, withFixedHeader = true, borderWithRadius = false, headerCheckboxDisabled = false, noDataContent, height = '100%', className = '', tableHeadClass = '', tableBodyRowClass = '', headerTextColor, tableDataTextColor, headerIconName = '', headerIconOnClick = () => { }, draggable = false, tableRef = null, isRowCheckBoxDisable, isRowDisabled = true, tableHeaderZindex = 99, freezeColumns, headerIconTooltipTitle, onDragEnd, loadMore, editMode = '', editComponent, accordionContent, getAccordionStatus = () => false, selectedNode = { key: '', selected: '' }, uniqueRowIdForAccordion, openAccordionId, }, ref) => {
|
|
15
16
|
const containerRef = useRef(null);
|
|
17
|
+
const headerRef = useRef(null);
|
|
18
|
+
const firstNodeRef = useRef(null);
|
|
19
|
+
const lastNodeRef = useRef(null);
|
|
16
20
|
const totalRows = data.length;
|
|
17
21
|
const setContainerRef = (node) => {
|
|
18
22
|
containerRef.current = node;
|
|
@@ -27,69 +31,152 @@ const Table = forwardRef(({ data = [], columns = [], headerType, withCheckbox =
|
|
|
27
31
|
};
|
|
28
32
|
const [scrollTop, setScrollTop] = useState(0);
|
|
29
33
|
const [containerHeight, setContainerHeight] = useState(0);
|
|
30
|
-
|
|
34
|
+
const [headerHeight, setHeaderHeight] = useState(HEADER_HEIGHT);
|
|
35
|
+
const stickyHeaderZIndex = tableHeaderZindex + 2;
|
|
31
36
|
const rowHeightsMap = useRef({});
|
|
32
|
-
// This version number triggers the re-calculation of the virtual list
|
|
33
37
|
const [heightVersion, setHeightVersion] = useState(0);
|
|
34
|
-
|
|
38
|
+
const tableGridTemplate = useMemo(() => getTableGridTemplate(columns, freezeColumns), [columns, freezeColumns]);
|
|
39
|
+
const getSortableRowId = useCallback((row, index) => row?._id ?? row?.id ?? index, []);
|
|
40
|
+
const getAccordionRowId = useCallback((row) => row?.id ??
|
|
41
|
+
row?._id ??
|
|
42
|
+
(uniqueRowIdForAccordion ? row?.[uniqueRowIdForAccordion] : undefined), [uniqueRowIdForAccordion]);
|
|
43
|
+
const rowIndexMap = useMemo(() => {
|
|
44
|
+
const map = new Map();
|
|
45
|
+
data.forEach((row, index) => {
|
|
46
|
+
map.set(getSortableRowId(row, index), index);
|
|
47
|
+
const accordionRowId = getAccordionRowId(row);
|
|
48
|
+
if (accordionRowId !== undefined && accordionRowId !== null) {
|
|
49
|
+
map.set(accordionRowId, index);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return map;
|
|
53
|
+
}, [data, getAccordionRowId, getSortableRowId]);
|
|
54
|
+
const sortableItems = useMemo(() => data.map((row, index) => getSortableRowId(row, index)), [data, getSortableRowId]);
|
|
35
55
|
useEffect(() => {
|
|
56
|
+
rowHeightsMap.current = {};
|
|
36
57
|
setHeightVersion((version) => version + 1);
|
|
37
58
|
}, [data]);
|
|
38
|
-
//
|
|
59
|
+
// Accordion content is mounted once at table level to preserve its state.
|
|
60
|
+
const accordionContainerRef = useRef(null);
|
|
61
|
+
const [accordionHeight, setAccordionHeight] = useState(0);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const el = accordionContainerRef.current;
|
|
64
|
+
if (!el || !accordionContent)
|
|
65
|
+
return;
|
|
66
|
+
const ro = new ResizeObserver(([entry]) => {
|
|
67
|
+
const h = entry?.contentRect.height ?? 0;
|
|
68
|
+
setAccordionHeight((prev) => (Math.abs(h - prev) > 1 ? h : prev));
|
|
69
|
+
});
|
|
70
|
+
ro.observe(el);
|
|
71
|
+
return () => ro.disconnect();
|
|
72
|
+
}, [accordionContent]);
|
|
73
|
+
const openAccordionIndex = useMemo(() => {
|
|
74
|
+
if (!accordionContent)
|
|
75
|
+
return -1;
|
|
76
|
+
if (openAccordionId !== undefined) {
|
|
77
|
+
return openAccordionId === null
|
|
78
|
+
? -1
|
|
79
|
+
: (rowIndexMap.get(openAccordionId) ?? -1);
|
|
80
|
+
}
|
|
81
|
+
return data.findIndex((row) => {
|
|
82
|
+
const rowId = getAccordionRowId(row);
|
|
83
|
+
return rowId !== undefined && rowId !== null
|
|
84
|
+
? Boolean(getAccordionStatus(rowId))
|
|
85
|
+
: false;
|
|
86
|
+
});
|
|
87
|
+
}, [
|
|
88
|
+
accordionContent,
|
|
89
|
+
data,
|
|
90
|
+
getAccordionRowId,
|
|
91
|
+
getAccordionStatus,
|
|
92
|
+
openAccordionId,
|
|
93
|
+
rowIndexMap,
|
|
94
|
+
]);
|
|
39
95
|
useEffect(() => {
|
|
40
96
|
const container = containerRef.current;
|
|
41
97
|
if (!container)
|
|
42
98
|
return;
|
|
43
99
|
setContainerHeight(container.clientHeight);
|
|
44
100
|
const observer = new ResizeObserver((entries) => {
|
|
45
|
-
for (
|
|
46
|
-
// Use contentRect for the container
|
|
101
|
+
for (const entry of entries) {
|
|
47
102
|
const newHeight = entry.contentRect.height;
|
|
48
|
-
|
|
49
|
-
setContainerHeight(newHeight);
|
|
50
|
-
}
|
|
103
|
+
setContainerHeight((prev) => Math.abs(newHeight - prev) > 1 ? newHeight : prev);
|
|
51
104
|
}
|
|
52
105
|
});
|
|
53
106
|
observer.observe(container);
|
|
54
|
-
return () =>
|
|
55
|
-
|
|
56
|
-
|
|
107
|
+
return () => observer.disconnect();
|
|
108
|
+
}, []);
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
const header = headerRef.current;
|
|
111
|
+
if (!header)
|
|
112
|
+
return;
|
|
113
|
+
const updateHeaderHeight = () => {
|
|
114
|
+
const measuredHeight = header.getBoundingClientRect().height;
|
|
115
|
+
setHeaderHeight((prev) => Math.abs(measuredHeight - prev) > 1 ? measuredHeight : prev);
|
|
57
116
|
};
|
|
58
|
-
|
|
117
|
+
updateHeaderHeight();
|
|
118
|
+
const observer = new ResizeObserver(updateHeaderHeight);
|
|
119
|
+
observer.observe(header);
|
|
120
|
+
return () => observer.disconnect();
|
|
121
|
+
}, [columns]);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const container = containerRef.current;
|
|
124
|
+
const firstNode = firstNodeRef.current;
|
|
125
|
+
const lastNode = lastNodeRef.current;
|
|
126
|
+
if (!container || !firstNode || !lastNode || !data.length || !loadMore) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const observer = new IntersectionObserver((entries) => {
|
|
130
|
+
entries.forEach((entry) => {
|
|
131
|
+
if (!entry.isIntersecting)
|
|
132
|
+
return;
|
|
133
|
+
const direction = entry.target === lastNode ? 'below' : 'above';
|
|
134
|
+
loadMore(direction);
|
|
135
|
+
});
|
|
136
|
+
}, {
|
|
137
|
+
root: container,
|
|
138
|
+
rootMargin: '8px',
|
|
139
|
+
threshold: 0.1,
|
|
140
|
+
});
|
|
141
|
+
observer.observe(firstNode);
|
|
142
|
+
observer.observe(lastNode);
|
|
143
|
+
return () => observer.disconnect();
|
|
144
|
+
}, [data.length, loadMore]);
|
|
59
145
|
const handleScroll = useCallback((e) => {
|
|
60
|
-
// Use requestAnimationFrame for scroll updates if scrolling feels jittery,
|
|
61
|
-
// generally direct state update is fine for React 18+ automatic batching.
|
|
62
146
|
setScrollTop(e.currentTarget.scrollTop);
|
|
63
147
|
}, []);
|
|
64
|
-
|
|
65
|
-
// If 100 rows mount, this ensures we only re-calculate layout ONCE after 20ms.
|
|
66
|
-
const commitHeightUpdates = useMemo(() => debounce(() => {
|
|
148
|
+
const commitHeightUpdates = useRef(debounce(() => {
|
|
67
149
|
setHeightVersion((prev) => prev + 1);
|
|
68
|
-
}, 20)
|
|
150
|
+
}, 20)).current;
|
|
69
151
|
const updateRowHeight = useCallback((index, height) => {
|
|
70
152
|
const currentHeight = rowHeightsMap.current[index];
|
|
71
|
-
// Only schedule update if height changed by > 1px
|
|
72
153
|
if (currentHeight === undefined ||
|
|
73
154
|
Math.abs(currentHeight - height) > 1) {
|
|
74
|
-
// 1. Update the Ref (Synchronous, cheap)
|
|
75
155
|
rowHeightsMap.current[index] = height;
|
|
76
|
-
// 2. Trigger the Debounced Re-render (Asynchronous)
|
|
77
156
|
commitHeightUpdates();
|
|
78
157
|
}
|
|
79
158
|
}, [commitHeightUpdates]);
|
|
80
|
-
// --- PERFORMANCE FIX 3: Calculate Cumulative Heights from Ref ---
|
|
81
159
|
const { cumulativeHeights, totalContentHeight } = useMemo(() => {
|
|
82
160
|
let cumulative = 0;
|
|
83
161
|
const heights = [0];
|
|
84
162
|
for (let i = 0; i < totalRows; i++) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
163
|
+
const rowHeight = rowHeightsMap.current[i] ?? DEFAULT_ROW_HEIGHT;
|
|
164
|
+
cumulative += rowHeight;
|
|
165
|
+
// Inject accordion space right after the open row
|
|
166
|
+
if (i === openAccordionIndex && accordionHeight > 0) {
|
|
167
|
+
cumulative += accordionHeight;
|
|
168
|
+
}
|
|
88
169
|
heights.push(cumulative);
|
|
89
170
|
}
|
|
90
171
|
return { cumulativeHeights: heights, totalContentHeight: cumulative };
|
|
91
|
-
}, [totalRows, heightVersion]);
|
|
92
|
-
|
|
172
|
+
}, [totalRows, heightVersion, openAccordionIndex, accordionHeight]);
|
|
173
|
+
const accordionScrollTop = useMemo(() => {
|
|
174
|
+
if (openAccordionIndex === -1)
|
|
175
|
+
return 0;
|
|
176
|
+
const rowTop = cumulativeHeights[openAccordionIndex] ?? 0;
|
|
177
|
+
const rowHeight = rowHeightsMap.current[openAccordionIndex] ?? DEFAULT_ROW_HEIGHT;
|
|
178
|
+
return headerHeight + rowTop + rowHeight;
|
|
179
|
+
}, [openAccordionIndex, cumulativeHeights, headerHeight]);
|
|
93
180
|
const visibleState = useMemo(() => {
|
|
94
181
|
if (containerHeight === 0 || totalRows === 0) {
|
|
95
182
|
return {
|
|
@@ -101,22 +188,20 @@ const Table = forwardRef(({ data = [], columns = [], headerType, withCheckbox =
|
|
|
101
188
|
};
|
|
102
189
|
}
|
|
103
190
|
const startIdxPlusOne = binarySearch(cumulativeHeights, scrollTop + 1);
|
|
104
|
-
|
|
191
|
+
const startIndex = startIdxPlusOne > 0 ? startIdxPlusOne - 1 : 0;
|
|
105
192
|
const endIdxPlusOne = binarySearch(cumulativeHeights, scrollTop + containerHeight);
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
193
|
+
const endIndex = endIdxPlusOne - 1;
|
|
194
|
+
const bufferedStart = Math.max(0, startIndex - BUFFER_SIZE);
|
|
195
|
+
const bufferedEnd = Math.min(totalRows - 1, endIndex + BUFFER_SIZE);
|
|
109
196
|
const paddingTop = cumulativeHeights[bufferedStart];
|
|
110
|
-
// Ensure we don't access out of bounds
|
|
111
197
|
const nextHeight = cumulativeHeights[bufferedEnd + 1];
|
|
112
198
|
const paddingBottom = totalContentHeight -
|
|
113
199
|
(nextHeight !== undefined ? nextHeight : totalContentHeight);
|
|
114
|
-
// Slicing data is cheap
|
|
115
200
|
return {
|
|
116
201
|
startIndex: bufferedStart,
|
|
117
202
|
endIndex: bufferedEnd,
|
|
118
|
-
paddingTop
|
|
119
|
-
paddingBottom
|
|
203
|
+
paddingTop,
|
|
204
|
+
paddingBottom,
|
|
120
205
|
visibleRows: data.slice(bufferedStart, bufferedEnd + 1),
|
|
121
206
|
};
|
|
122
207
|
}, [scrollTop, containerHeight, totalRows, cumulativeHeights, data]);
|
|
@@ -126,71 +211,50 @@ const Table = forwardRef(({ data = [], columns = [], headerType, withCheckbox =
|
|
|
126
211
|
frozenWidth = calculateFrozenWidth(columns, freezeColumns);
|
|
127
212
|
}
|
|
128
213
|
const handleOnclick = useCallback((column, row) => {
|
|
129
|
-
|
|
214
|
+
const { onClick, accessor } = column;
|
|
130
215
|
if (onClick && isFunction(onClick)) {
|
|
131
216
|
onClick(accessor, row);
|
|
132
217
|
}
|
|
133
218
|
}, []);
|
|
134
219
|
const onSelectClick = useCallback((e, item) => {
|
|
135
|
-
if (onSelect)
|
|
220
|
+
if (onSelect)
|
|
136
221
|
onSelect(e, item);
|
|
137
|
-
}
|
|
138
222
|
}, [onSelect]);
|
|
139
|
-
// --- START OF NEW AUTOSCROLL LOGIC ---
|
|
140
|
-
/**
|
|
141
|
-
* Calculates the scroll position and imperatively scrolls the table to the row with the given ID.
|
|
142
|
-
* @param rowId The ID or _id of the row to scroll to.
|
|
143
|
-
*/
|
|
144
223
|
const scrollToRow = useCallback((rowId) => {
|
|
145
|
-
|
|
146
|
-
// You MUST verify this value matches your actual TableHeader height.
|
|
147
|
-
const FIXED_HEADER_HEIGHT = 50;
|
|
148
|
-
const targetIndex = data.findIndex((row) => row.id === rowId || row._id === rowId);
|
|
224
|
+
const targetIndex = rowIndexMap.get(rowId) ?? -1;
|
|
149
225
|
if (targetIndex === -1 ||
|
|
150
226
|
!containerRef.current ||
|
|
151
|
-
cumulativeHeights.length === 0)
|
|
227
|
+
cumulativeHeights.length === 0)
|
|
152
228
|
return;
|
|
153
|
-
}
|
|
154
229
|
const container = containerRef.current;
|
|
155
230
|
const targetRowTop = cumulativeHeights[targetIndex];
|
|
156
231
|
const targetRowBottom = cumulativeHeights[targetIndex + 1];
|
|
157
|
-
|
|
158
|
-
// Scrolls the row down by the header height to bring it into full view.
|
|
159
|
-
let adjustedScrollPosition = Math.max(0, targetRowTop - FIXED_HEADER_HEIGHT);
|
|
232
|
+
let adjustedScrollPosition = Math.max(0, targetRowTop - headerHeight);
|
|
160
233
|
const currentScrollTop = container.scrollTop;
|
|
161
234
|
const currentScrollBottom = container.scrollTop + container.clientHeight;
|
|
162
|
-
if (targetRowTop >= currentScrollTop +
|
|
163
|
-
targetRowBottom <= currentScrollBottom)
|
|
235
|
+
if (targetRowTop >= currentScrollTop + headerHeight &&
|
|
236
|
+
targetRowBottom <= currentScrollBottom)
|
|
164
237
|
return;
|
|
165
|
-
}
|
|
166
|
-
// --- 3. Edge Case: Preventing Overscrolling to the Bottom ---
|
|
167
|
-
// Find the maximum possible scrollTop value (total height minus viewport height).
|
|
168
238
|
const maxScrollTop = Math.max(0, totalContentHeight - container.clientHeight);
|
|
169
|
-
// Clamp the adjusted position to ensure we don't scroll past the content end.
|
|
170
239
|
adjustedScrollPosition = Math.min(adjustedScrollPosition, maxScrollTop);
|
|
171
|
-
// --- 4. Perform the Scroll ---
|
|
172
240
|
container.scrollTop = adjustedScrollPosition;
|
|
173
241
|
setScrollTop(adjustedScrollPosition);
|
|
174
|
-
}, [
|
|
175
|
-
// 5. Expose the scroll function to the parent component via the ref
|
|
242
|
+
}, [cumulativeHeights, headerHeight, rowIndexMap, totalContentHeight]);
|
|
176
243
|
useImperativeHandle(ref, () => ({
|
|
177
|
-
|
|
178
|
-
scrollToRow: scrollToRow,
|
|
179
|
-
// You can expose other methods or the containerRef here if needed
|
|
244
|
+
scrollToRow,
|
|
180
245
|
}));
|
|
181
|
-
// --- END OF NEW AUTOSCROLL LOGIC ---
|
|
182
246
|
const handleDragEnd = (event) => {
|
|
183
247
|
const { active, over } = event;
|
|
184
248
|
if (!over || active.id === over.id)
|
|
185
249
|
return;
|
|
186
|
-
const oldIndex =
|
|
187
|
-
const newIndex =
|
|
250
|
+
const oldIndex = rowIndexMap.get(active.id) ?? -1;
|
|
251
|
+
const newIndex = rowIndexMap.get(over.id) ?? -1;
|
|
188
252
|
if (oldIndex === -1 || newIndex === -1)
|
|
189
253
|
return;
|
|
190
254
|
if (onDragEnd)
|
|
191
255
|
onDragEnd(oldIndex, newIndex);
|
|
192
256
|
};
|
|
193
|
-
return (_jsx(DndContext, { collisionDetection: closestCorners, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { disabled: !draggable, items:
|
|
257
|
+
return (_jsx(DndContext, { collisionDetection: closestCorners, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { disabled: !draggable, items: sortableItems, strategy: verticalListSortingStrategy, children: _jsxs("div", { ref: setContainerRef, style: {
|
|
194
258
|
height,
|
|
195
259
|
overflow: 'auto',
|
|
196
260
|
position: 'relative',
|
|
@@ -198,10 +262,23 @@ const Table = forwardRef(({ data = [], columns = [], headerType, withCheckbox =
|
|
|
198
262
|
'--frozen-column-width': freezeColumns
|
|
199
263
|
? `${frozenWidth}px`
|
|
200
264
|
: '0px',
|
|
265
|
+
'--table-grid-template': tableGridTemplate,
|
|
201
266
|
}, id: "ff-table-scroll-container", className: classNames('ff-table-scroll-container', {
|
|
202
|
-
'ff-table-fixed-header': withFixedHeader,
|
|
203
267
|
'ff-table-container--border-radius': borderWithRadius,
|
|
204
|
-
}, className), onScroll: handleScroll, children: [_jsxs("
|
|
268
|
+
}, className), onScroll: handleScroll, children: [_jsxs("div", { className: "ff-table-container", children: [_jsx("div", { ref: headerRef, className: classNames({
|
|
269
|
+
'ff-table-fixed-header': withFixedHeader,
|
|
270
|
+
}), style: {
|
|
271
|
+
'--table-header-z-index': stickyHeaderZIndex,
|
|
272
|
+
}, children: _jsx(TableHeader, { columns: columns, freezeColumns: freezeColumns, headerType: headerType, tableHeadClass: tableHeadClass, headerTextColor: headerTextColor, headerCheckboxDisabled: headerCheckboxDisabled, withCheckbox: withCheckbox, allSelected: allSelected, partialSelected: partialSelected, headerIconName: headerIconName, headerIconOnClick: headerIconOnClick, headerIconTooltipTitle: headerIconTooltipTitle, tableHeaderZindex: stickyHeaderZIndex, onSelectClick: onSelectClick, withFixedHeader: withFixedHeader }) }), _jsxs("div", { className: "ff-table-body", children: [_jsx("div", { ref: firstNodeRef, id: "ff-table-first-node", className: "ff-table-first-node" }), _jsx(VirtualizedRows, { paddingTop: paddingTop ?? 0, paddingBottom: paddingBottom, columnsLength: columns.length, visibleRows: visibleRows, startIndex: startIndex, columns: columns, tableBodyRowClass: tableBodyRowClass, handleOnclick: handleOnclick, tableDataTextColor: tableDataTextColor, withCheckbox: withCheckbox, onSelectClick: onSelectClick, isRowCheckBoxDisable: isRowCheckBoxDisable, isRowDisabled: isRowDisabled, freezeColumns: freezeColumns, frozenWidth: frozenWidth, updateRowHeight: updateRowHeight, draggable: draggable, editMode: editMode, editComponent: editComponent, selectedNode: selectedNode, openAccordionIndex: openAccordionIndex, accordionHeight: accordionHeight }), _jsx("div", { ref: lastNodeRef, id: "ff-table-last-node", className: "ff-table-last-node" })] }), accordionContent && (_jsx("div", { ref: accordionContainerRef, style: {
|
|
273
|
+
display: openAccordionIndex !== -1 ? 'block' : 'none',
|
|
274
|
+
position: 'absolute',
|
|
275
|
+
top: accordionScrollTop,
|
|
276
|
+
left: 0,
|
|
277
|
+
width: '100%',
|
|
278
|
+
zIndex: 20,
|
|
279
|
+
backgroundColor: 'var(--background-color)',
|
|
280
|
+
}, children: accordionContent }))] }), checkEmpty(data) && (_jsx("div", { className: "ff-no-data-content", style: { height: `calc(${height} - 50px)` }, children: noDataContent }))] }) }) }));
|
|
205
281
|
});
|
|
282
|
+
Table.displayName = 'Table';
|
|
206
283
|
export default Table;
|
|
207
284
|
//# sourceMappingURL=Table.js.map
|