vaishu-react-comp 1.1.1 → 1.1.3
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 +2 -0
- package/lib/components/AddResourceButton/AddResourceButton.js +28 -15
- package/lib/components/AddResourceButton/AddResourceButton.js.map +1 -1
- package/lib/components/AppHeader/AppHeader.js +1 -1
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/types.d.ts +1 -0
- package/lib/components/AttachmentButton/AttachmentButton.js +4 -1
- package/lib/components/AttachmentButton/AttachmentButton.js.map +1 -1
- package/lib/components/AttachmentButton/types.d.ts +1 -0
- package/lib/components/AutoTruncateText/AutoTruncateText.d.ts +4 -0
- package/lib/components/AutoTruncateText/AutoTruncateText.js +41 -0
- package/lib/components/AutoTruncateText/AutoTruncateText.js.map +1 -0
- package/lib/components/AutoTruncateText/index.d.ts +1 -0
- package/lib/components/AutoTruncateText/index.js +2 -0
- package/lib/components/AutoTruncateText/index.js.map +1 -0
- package/lib/components/AutoTruncateText/resizeObserverService.d.ts +7 -0
- package/lib/components/AutoTruncateText/resizeObserverService.js +25 -0
- package/lib/components/AutoTruncateText/resizeObserverService.js.map +1 -0
- package/lib/components/AutoTruncateText/types.d.ts +8 -0
- package/lib/components/AutoTruncateText/types.js +2 -0
- package/lib/components/AutoTruncateText/types.js.map +1 -0
- package/lib/components/AutoTruncateText/useResizeSignal.d.ts +5 -0
- package/lib/components/AutoTruncateText/useResizeSignal.js +18 -0
- package/lib/components/AutoTruncateText/useResizeSignal.js.map +1 -0
- package/lib/components/BrowserTabs/BrowserTabs.d.ts +1 -1
- package/lib/components/BrowserTabs/BrowserTabs.js +11 -7
- package/lib/components/BrowserTabs/BrowserTabs.js.map +1 -1
- package/lib/components/BrowserTabs/types.d.ts +7 -0
- package/lib/components/Button/types.d.ts +1 -1
- package/lib/components/Charts/DonutChart/DonutChart.js +24 -16
- package/lib/components/Charts/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/Charts/DonutChart/type.d.ts +4 -1
- package/lib/components/ChatModalAi/ChatModalAi.js +11 -32
- package/lib/components/ChatModalAi/ChatModalAi.js.map +1 -1
- package/lib/components/ChatModalAi/types.d.ts +5 -0
- package/lib/components/ChipWithCount/ChipWithCount.js +4 -3
- package/lib/components/ChipWithCount/ChipWithCount.js.map +1 -1
- package/lib/components/ConditionalDropdown/ConditionalDropdown.js +2 -2
- package/lib/components/ConditionalDropdown/ConditionalDropdown.js.map +1 -1
- package/lib/components/ConnectingBranch/BranchComponents/MachineInstances.js +3 -2
- package/lib/components/ConnectingBranch/BranchComponents/MachineInstances.js.map +1 -1
- package/lib/components/ConnectingBranch/ConnectingBranch.js +6 -5
- package/lib/components/ConnectingBranch/ConnectingBranch.js.map +1 -1
- package/lib/components/ConnectingBranch/types.d.ts +2 -0
- package/lib/components/CreateVariable/CreateVariableSlider.js +3 -3
- package/lib/components/CreateVariable/CreateVariableSlider.js.map +1 -1
- package/lib/components/CreateVariable/types.d.ts +6 -2
- package/lib/components/DownloadClient/DownloadClient.js +1 -1
- package/lib/components/DownloadClient/DownloadClient.js.map +1 -1
- package/lib/components/Drawer/Drawer.js +13 -4
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Drawer/Types.d.ts +5 -0
- package/lib/components/EditLabel/EditLabel.d.ts +1 -1
- package/lib/components/EditLabel/EditLabel.js +6 -4
- package/lib/components/EditLabel/EditLabel.js.map +1 -1
- package/lib/components/EditLabel/types.d.ts +2 -0
- package/lib/components/Editor/Editor.js +1 -1
- package/lib/components/Editor/Editor.js.map +1 -1
- package/lib/components/Editor/constants.js +121 -40
- package/lib/components/Editor/constants.js.map +1 -1
- package/lib/components/Excel/ColorBarSelector/ColorBarSelector.d.ts +1 -1
- package/lib/components/Excel/ColorBarSelector/ColorBarSelector.js +5 -3
- package/lib/components/Excel/ColorBarSelector/ColorBarSelector.js.map +1 -1
- package/lib/components/Excel/Data.d.ts +89 -17
- package/lib/components/Excel/Data.js +420 -56
- package/lib/components/Excel/Data.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFile.js +2 -2
- package/lib/components/Excel/ExcelFile/ExcelFile.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js +96 -18
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.js +5 -3
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Cell.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.js +8 -8
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataEditor.js +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataEditor.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/EditableCell.js +20 -22
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/EditableCell.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.js +5 -4
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.js +45 -5
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.d.ts +16 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.js +14 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/actions.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.js +157 -28
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducer.js.map +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.js +10 -3
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.js.map +1 -1
- package/lib/components/Excel/ExcelToolBar/ExcelToolBar.js +8 -2
- package/lib/components/Excel/ExcelToolBar/ExcelToolBar.js.map +1 -1
- package/lib/components/Excel/Types.d.ts +2 -0
- package/lib/components/Excel/dataConversion.d.ts +2 -2
- package/lib/components/Excel/dataConversion.js +6 -2
- package/lib/components/Excel/dataConversion.js.map +1 -1
- package/lib/components/ExpandableMenu/ExpandableMenu.js +11 -10
- package/lib/components/ExpandableMenu/ExpandableMenu.js.map +1 -1
- package/lib/components/ExpandableMenu/types.d.ts +1 -0
- package/lib/components/HOC/LayoutWithDrawer/LayoutWithDrawer.d.ts +11 -0
- package/lib/components/HOC/LayoutWithDrawer/LayoutWithDrawer.js +7 -0
- package/lib/components/HOC/LayoutWithDrawer/LayoutWithDrawer.js.map +1 -0
- package/lib/components/HOC/LayoutWithDrawer/index.d.ts +1 -0
- package/lib/components/HOC/LayoutWithDrawer/index.js +2 -0
- package/lib/components/HOC/LayoutWithDrawer/index.js.map +1 -0
- package/lib/components/Icon/iconList.js +106 -0
- package/lib/components/Icon/iconList.js.map +1 -1
- package/lib/components/Loader/Loader.d.ts +5 -0
- package/lib/components/Loader/Loader.js +8 -0
- package/lib/components/Loader/Loader.js.map +1 -0
- package/lib/components/Loader/index.d.ts +1 -0
- package/lib/components/Loader/index.js +2 -0
- package/lib/components/Loader/index.js.map +1 -0
- package/lib/components/MachineInputField/MachineInputField.d.ts +1 -1
- package/lib/components/MachineInputField/MachineInputField.js +4 -1
- package/lib/components/MachineInputField/MachineInputField.js.map +1 -1
- package/lib/components/MachineInputField/types.d.ts +1 -0
- package/lib/components/MediaPreview/MediaPreview.js +1 -1
- package/lib/components/MediaPreview/MediaPreview.js.map +1 -1
- package/lib/components/MediaViewerModal/MediaViewerModal.js +2 -3
- package/lib/components/MediaViewerModal/MediaViewerModal.js.map +1 -1
- package/lib/components/MediaViewerModal/type.d.ts +2 -1
- package/lib/components/MenuOption/MenuOption.js +19 -18
- package/lib/components/MenuOption/MenuOption.js.map +1 -1
- package/lib/components/MiniModal/MiniModal.js +44 -27
- package/lib/components/MiniModal/MiniModal.js.map +1 -1
- package/lib/components/MiniModal/types.d.ts +1 -1
- package/lib/components/MultiSelect/Dropdown.js +2 -1
- package/lib/components/MultiSelect/Dropdown.js.map +1 -1
- package/lib/components/NLPInput/components/ChipsFolder/ChipsAccordion.js +1 -1
- package/lib/components/NLPInput/components/ChipsFolder/ChipsAccordion.js.map +1 -1
- package/lib/components/NetworkErrorBoundary/NetworkErrorBoundary.d.ts +5 -0
- package/lib/components/NetworkErrorBoundary/NetworkErrorBoundary.js +19 -0
- package/lib/components/NetworkErrorBoundary/NetworkErrorBoundary.js.map +1 -0
- package/lib/components/NetworkErrorBoundary/index.d.ts +1 -0
- package/lib/components/NetworkErrorBoundary/index.js +2 -0
- package/lib/components/NetworkErrorBoundary/index.js.map +1 -0
- package/lib/components/NetworkErrorBoundary/types.d.ts +33 -0
- package/lib/components/NetworkErrorBoundary/types.js +2 -0
- package/lib/components/NetworkErrorBoundary/types.js.map +1 -0
- package/lib/components/NoDataAvailable/NoDataAvailable.d.ts +5 -0
- package/lib/components/NoDataAvailable/NoDataAvailable.js +11 -0
- package/lib/components/NoDataAvailable/NoDataAvailable.js.map +1 -0
- package/lib/components/NoDataAvailable/index.d.ts +1 -0
- package/lib/components/NoDataAvailable/index.js +2 -0
- package/lib/components/NoDataAvailable/index.js.map +1 -0
- package/lib/components/NoDataAvailable/type.d.ts +3 -0
- package/lib/components/NoDataAvailable/type.js +2 -0
- package/lib/components/NoDataAvailable/type.js.map +1 -0
- package/lib/components/NoResultFound/NoResultFound.d.ts +14 -0
- package/lib/components/NoResultFound/NoResultFound.js +7 -0
- package/lib/components/NoResultFound/NoResultFound.js.map +1 -0
- package/lib/components/NoResultFound/index.d.ts +1 -0
- package/lib/components/NoResultFound/index.js +2 -0
- package/lib/components/NoResultFound/index.js.map +1 -0
- package/lib/components/PopUpModal/PopUpModal.d.ts +1 -2
- package/lib/components/PopUpModal/PopUpModal.js +4 -3
- package/lib/components/PopUpModal/PopUpModal.js.map +1 -1
- package/lib/components/PrePostTable/components/DraggableTableRow.js +4 -1
- package/lib/components/PrePostTable/components/DraggableTableRow.js.map +1 -1
- package/lib/components/PrePostTable/components/PrePostStepAccordions.js +14 -3
- package/lib/components/PrePostTable/components/PrePostStepAccordions.js.map +1 -1
- package/lib/components/PromptContainer/PromptContainer.js +1 -1
- package/lib/components/PromptContainer/PromptContainer.js.map +1 -1
- package/lib/components/RadioButton/RadioButton.js +2 -2
- package/lib/components/RadioButton/RadioButton.js.map +1 -1
- package/lib/components/RadioButton/radioButtonTypes.d.ts +8 -0
- package/lib/components/RadioGroup/RadioGroup.js +2 -2
- package/lib/components/RadioGroup/RadioGroup.js.map +1 -1
- package/lib/components/RadioGroup/radioGroupTypes.d.ts +8 -0
- package/lib/components/ScriptCommentModal/ScriptCommentModal.d.ts +4 -0
- package/lib/components/ScriptCommentModal/ScriptCommentModal.js +47 -0
- package/lib/components/ScriptCommentModal/ScriptCommentModal.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/ButtonActions.d.ts +5 -0
- package/lib/components/ScriptCommentModal/components/ButtonActions.js +8 -0
- package/lib/components/ScriptCommentModal/components/ButtonActions.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/CommentCount.d.ts +4 -0
- package/lib/components/ScriptCommentModal/components/CommentCount.js +7 -0
- package/lib/components/ScriptCommentModal/components/CommentCount.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/CommentDiscription.d.ts +5 -0
- package/lib/components/ScriptCommentModal/components/CommentDiscription.js +13 -0
- package/lib/components/ScriptCommentModal/components/CommentDiscription.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/CommentFooter.d.ts +5 -0
- package/lib/components/ScriptCommentModal/components/CommentFooter.js +9 -0
- package/lib/components/ScriptCommentModal/components/CommentFooter.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/CommentTitleText.d.ts +4 -0
- package/lib/components/ScriptCommentModal/components/CommentTitleText.js +7 -0
- package/lib/components/ScriptCommentModal/components/CommentTitleText.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/CommentsTitle.d.ts +4 -0
- package/lib/components/ScriptCommentModal/components/CommentsTitle.js +12 -0
- package/lib/components/ScriptCommentModal/components/CommentsTitle.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/DeleteComment.d.ts +3 -0
- package/lib/components/ScriptCommentModal/components/DeleteComment.js +15 -0
- package/lib/components/ScriptCommentModal/components/DeleteComment.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentIcon.d.ts +4 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentIcon.js +8 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentIcon.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentMessage.d.ts +3 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentMessage.js +7 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentMessage.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentPopup.d.ts +4 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentPopup.js +8 -0
- package/lib/components/ScriptCommentModal/components/DeleteCommentPopup.js.map +1 -0
- package/lib/components/ScriptCommentModal/components/FooterText.d.ts +5 -0
- package/lib/components/ScriptCommentModal/components/FooterText.js +8 -0
- package/lib/components/ScriptCommentModal/components/FooterText.js.map +1 -0
- package/lib/components/ScriptCommentModal/index.d.ts +1 -0
- package/lib/components/ScriptCommentModal/index.js +2 -0
- package/lib/components/ScriptCommentModal/index.js.map +1 -0
- package/lib/components/ScriptCommentModal/type.d.ts +59 -0
- package/lib/components/ScriptCommentModal/type.js +2 -0
- package/lib/components/ScriptCommentModal/type.js.map +1 -0
- package/lib/components/Select/Select.js +8 -7
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/components/Dropdown.js +107 -22
- package/lib/components/Select/components/Dropdown.js.map +1 -1
- package/lib/components/Select/components/types.d.ts +2 -0
- package/lib/components/Select/components/types.js.map +1 -1
- package/lib/components/Select/types.d.ts +9 -0
- package/lib/components/SelectionSwitcher/SelectionSwitcher.d.ts +5 -0
- package/lib/components/SelectionSwitcher/SelectionSwitcher.js +16 -0
- package/lib/components/SelectionSwitcher/SelectionSwitcher.js.map +1 -0
- package/lib/components/SelectionSwitcher/index.d.ts +1 -0
- package/lib/components/SelectionSwitcher/index.js +2 -0
- package/lib/components/SelectionSwitcher/index.js.map +1 -0
- package/lib/components/SelectionSwitcher/types.d.ts +13 -0
- package/lib/components/SelectionSwitcher/types.js +2 -0
- package/lib/components/SelectionSwitcher/types.js.map +1 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.js +3 -3
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.js.map +1 -1
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.js +22 -13
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.js.map +1 -1
- package/lib/components/SequentialConnectingBranch/types.d.ts +2 -1
- package/lib/components/SessionDropdown/SessionDropdown.js +4 -4
- package/lib/components/SessionDropdown/SessionDropdown.js.map +1 -1
- package/lib/components/SessionDropdown/type.d.ts +2 -0
- package/lib/components/SessionManager/SessionManager.js +3 -3
- package/lib/components/SessionManager/SessionManager.js.map +1 -1
- package/lib/components/StatusBadge/StatusBadge.d.ts +2 -1
- package/lib/components/StatusBadge/StatusBadge.js +3 -3
- package/lib/components/StatusBadge/StatusBadge.js.map +1 -1
- package/lib/components/StatusButton/StatusButton.d.ts +1 -1
- package/lib/components/StatusButton/StatusButton.js +3 -2
- package/lib/components/StatusButton/StatusButton.js.map +1 -1
- package/lib/components/StatusButton/types.d.ts +2 -1
- package/lib/components/StepsLandingTable/Components/StepGroupAccordions.js +8 -5
- package/lib/components/StepsLandingTable/Components/StepGroupAccordions.js.map +1 -1
- package/lib/components/StepsLandingTable/Components/StepInnerTable.js.map +1 -1
- package/lib/components/StepsLandingTable/Components/StepResultStats.js +21 -2
- package/lib/components/StepsLandingTable/Components/StepResultStats.js.map +1 -1
- package/lib/components/StepsLandingTable/Components/StepTableMainRow.js +6 -4
- package/lib/components/StepsLandingTable/Components/StepTableMainRow.js.map +1 -1
- package/lib/components/StepsLandingTable/Components/StepsTitle.js +20 -3
- package/lib/components/StepsLandingTable/Components/StepsTitle.js.map +1 -1
- package/lib/components/StepsLandingTable/Components/Types.d.ts +11 -6
- package/lib/components/StepsLandingTable/StepLandingTable.js.map +1 -1
- package/lib/components/StepsLandingTable/types.d.ts +2 -0
- package/lib/components/StorageUsageBar/StorageUsageBar.d.ts +4 -0
- package/lib/components/StorageUsageBar/StorageUsageBar.js +47 -0
- package/lib/components/StorageUsageBar/StorageUsageBar.js.map +1 -0
- package/lib/components/StorageUsageBar/index.d.ts +1 -0
- package/lib/components/StorageUsageBar/index.js +2 -0
- package/lib/components/StorageUsageBar/index.js.map +1 -0
- package/lib/components/StorageUsageBar/types.d.ts +7 -0
- package/lib/components/StorageUsageBar/types.js +2 -0
- package/lib/components/StorageUsageBar/types.js.map +1 -0
- package/lib/components/Table/Table.js +2 -2
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Table/Types.d.ts +2 -0
- package/lib/components/Table/components/SortableRow.js +29 -16
- package/lib/components/Table/components/SortableRow.js.map +1 -1
- package/lib/components/Table/components/VirtualizedRows.d.ts +1 -1
- package/lib/components/Table/components/VirtualizedRows.js +6 -2
- package/lib/components/Table/components/VirtualizedRows.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableBody.d.ts +1 -1
- package/lib/components/TableTreeFn/Components/TableBody.js +12 -7
- package/lib/components/TableTreeFn/Components/TableBody.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableCell.d.ts +1 -1
- package/lib/components/TableTreeFn/Components/TableCell.js +24 -19
- package/lib/components/TableTreeFn/Components/TableCell.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableHead.d.ts +1 -1
- package/lib/components/TableTreeFn/Components/TableHead.js +23 -29
- package/lib/components/TableTreeFn/Components/TableHead.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableRow.d.ts +1 -1
- package/lib/components/TableTreeFn/Components/TableRow.js +7 -2
- package/lib/components/TableTreeFn/Components/TableRow.js.map +1 -1
- package/lib/components/TableTreeFn/TableTreeFn.d.ts +1 -1
- package/lib/components/TableTreeFn/TableTreeFn.js +726 -241
- package/lib/components/TableTreeFn/TableTreeFn.js.map +1 -1
- package/lib/components/TableTreeFn/Utils/TableCell.d.ts +1 -0
- package/lib/components/TableTreeFn/Utils/TableCell.js +24 -0
- package/lib/components/TableTreeFn/Utils/TableCell.js.map +1 -0
- package/lib/components/TableTreeFn/Utils/addLastChild.d.ts +1 -1
- package/lib/components/TableTreeFn/Utils/addLastChild.js +2 -2
- package/lib/components/TableTreeFn/Utils/addLastChild.js.map +1 -1
- package/lib/components/TableTreeFn/Utils/addNewRow.js +6 -5
- package/lib/components/TableTreeFn/Utils/addNewRow.js.map +1 -1
- package/lib/components/TableTreeFn/Utils/formatDataCell.js +1 -1
- package/lib/components/TableTreeFn/Utils/formatDataCell.js.map +1 -1
- package/lib/components/TableTreeFn/Utils/updateParentSibling.d.ts +1 -1
- package/lib/components/TableTreeFn/Utils/updateParentSibling.js +7 -7
- package/lib/components/TableTreeFn/Utils/updateParentSibling.js.map +1 -1
- package/lib/components/TableTreeFn/index.d.ts +2 -0
- package/lib/components/TableTreeFn/index.js +2 -0
- package/lib/components/TableTreeFn/index.js.map +1 -1
- package/lib/components/TableTreeFn/types.d.ts +32 -12
- package/lib/components/TextEditor/TextEditor.js +101 -26
- package/lib/components/TextEditor/TextEditor.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +2 -2
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/types.d.ts +1 -0
- package/lib/components/TooltipService/TooltipService.d.ts +4 -0
- package/lib/components/TooltipService/TooltipService.js +164 -0
- package/lib/components/TooltipService/TooltipService.js.map +1 -0
- package/lib/components/TooltipService/index.d.ts +1 -0
- package/lib/components/TooltipService/index.js +2 -0
- package/lib/components/TooltipService/index.js.map +1 -0
- package/lib/components/Typography/Typography.js +2 -2
- package/lib/components/Typography/Typography.js.map +1 -1
- package/lib/components/Typography/types.d.ts +1 -0
- package/lib/components/ZoomControl/ZoomControl.d.ts +5 -0
- package/lib/components/ZoomControl/ZoomControl.js +22 -0
- package/lib/components/ZoomControl/ZoomControl.js.map +1 -0
- package/lib/components/ZoomControl/index.d.ts +1 -0
- package/lib/components/ZoomControl/index.js +2 -0
- package/lib/components/ZoomControl/index.js.map +1 -0
- package/lib/components/ZoomControl/types.d.ts +8 -0
- package/lib/components/ZoomControl/types.js +2 -0
- package/lib/components/ZoomControl/types.js.map +1 -0
- package/lib/hooks/useClickOutside.d.ts +4 -1
- package/lib/hooks/useClickOutside.js +7 -5
- package/lib/hooks/useClickOutside.js.map +1 -1
- package/lib/index.d.ts +5893 -3
- package/lib/index.js +48 -2
- package/lib/index.js.map +1 -1
- package/lib/styles.css +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/AddStepGroup/AddStepGroup.js +5 -2
- package/lib/utils/AddStepGroup/AddStepGroup.js.map +1 -1
- package/lib/utils/OnlineStatus/useOnlineStatus.d.ts +1 -0
- package/lib/utils/OnlineStatus/useOnlineStatus.js +20 -0
- package/lib/utils/OnlineStatus/useOnlineStatus.js.map +1 -0
- package/lib/utils/cleanAllTooltips/cleanAllTooltips.d.ts +1 -0
- package/lib/utils/cleanAllTooltips/cleanAllTooltips.js +8 -0
- package/lib/utils/cleanAllTooltips/cleanAllTooltips.js.map +1 -0
- package/lib/utils/converToCamelCase.d.ts +1 -0
- package/lib/utils/converToCamelCase.js +6 -0
- package/lib/utils/converToCamelCase.js.map +1 -0
- package/lib/utils/getTopVisibleNodeKey/getTopVisibleNodeKey.js +8 -9
- package/lib/utils/getTopVisibleNodeKey/getTopVisibleNodeKey.js.map +1 -1
- package/lib/utils/getTreeDetails/getTreeDetails.d.ts +1 -1
- package/lib/utils/getTreeDetails/getTreeDetails.js +37 -20
- package/lib/utils/getTreeDetails/getTreeDetails.js.map +1 -1
- package/lib/utils/handleTreeExpandAllCollapseAll/handleTreeExpandAllCollapseAll.js +1 -0
- package/lib/utils/handleTreeExpandAllCollapseAll/handleTreeExpandAllCollapseAll.js.map +1 -1
- package/lib/utils/handleTreeNodeSelect/handleTreeNodeSelect.d.ts +2 -2
- package/lib/utils/handleTreeNodeSelect/handleTreeNodeSelect.js +90 -257
- package/lib/utils/handleTreeNodeSelect/handleTreeNodeSelect.js.map +1 -1
- package/lib/validations/regex.d.ts +3 -1
- package/lib/validations/regex.js +4 -1
- package/lib/validations/regex.js.map +1 -1
- package/package.json +27 -15
|
@@ -1,242 +1,764 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
2
|
+
/* eslint-disable max-lines */
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, forwardRef, } from 'react';
|
|
4
|
+
import './TableTreeFn.scss';
|
|
5
5
|
import TableBody from './Components/TableBody';
|
|
6
|
-
import
|
|
7
|
-
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
6
|
+
import TableHead from './Components/TableHead';
|
|
8
7
|
import { debounce } from '../../utils/debounce/debounce';
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
9
|
+
const DEFAULT_COLUMN_WIDTH = 400;
|
|
10
|
+
const ROW_HEIGHT = 32;
|
|
11
|
+
const OVERSCAN = 6;
|
|
12
|
+
const ROOT_PARENT_ID = '__root__';
|
|
13
|
+
const insertNewNode = (treeData, newNode, rootNode) => {
|
|
14
|
+
if (!newNode?.sourceId || !newNode.action)
|
|
15
|
+
return treeData;
|
|
16
|
+
const { sourceId, action, value = '', error = '', label, type, options, selectedOption, confirmIconTooltip, cancelIconTooltip, payloadSourceId, } = newNode;
|
|
17
|
+
const fallbackParentId = newNode
|
|
18
|
+
?.parentId;
|
|
19
|
+
const fallbackHierarchy = newNode
|
|
20
|
+
?.hierarchy;
|
|
21
|
+
const convertedOptions = options?.map((option) => ({
|
|
22
|
+
label: option,
|
|
23
|
+
value: option,
|
|
24
|
+
}));
|
|
25
|
+
const convertedSelectedOption = selectedOption
|
|
26
|
+
? { label: selectedOption, value: selectedOption }
|
|
27
|
+
: undefined;
|
|
28
|
+
const nodeMap = new Map();
|
|
29
|
+
treeData.forEach((node) => nodeMap.set(node.key, node));
|
|
30
|
+
if (rootNode) {
|
|
31
|
+
nodeMap.set(rootNode.key, rootNode);
|
|
32
|
+
}
|
|
33
|
+
const sourceNode = nodeMap.get(sourceId);
|
|
34
|
+
let payloadSourceNode;
|
|
35
|
+
if (payloadSourceId) {
|
|
36
|
+
payloadSourceNode = nodeMap.get(payloadSourceId);
|
|
37
|
+
}
|
|
38
|
+
// For add-inside flows, backend can return navigateTo as a parent key or a
|
|
39
|
+
// key not present in the current page. Fallback to payload source when possible.
|
|
40
|
+
let effectiveSourceNode = sourceNode ?? (action === 'addInside' ? payloadSourceNode : undefined);
|
|
41
|
+
if (!effectiveSourceNode && action === 'addInside' && fallbackParentId) {
|
|
42
|
+
effectiveSourceNode = nodeMap.get(fallbackParentId);
|
|
43
|
+
}
|
|
44
|
+
const fallbackInsertAtEnd = action === 'addInside' && !effectiveSourceNode && treeData.length >= 0;
|
|
45
|
+
if (!effectiveSourceNode && !fallbackInsertAtEnd)
|
|
46
|
+
return treeData;
|
|
47
|
+
const updatedTreeData = [...treeData];
|
|
48
|
+
const sourceIndex = effectiveSourceNode
|
|
49
|
+
? treeData.findIndex((node) => node.key === effectiveSourceNode.key)
|
|
50
|
+
: -1;
|
|
51
|
+
let newNodeParentId = null;
|
|
52
|
+
let newNodeHierarchy = 0;
|
|
53
|
+
let insertionIndex = sourceIndex + 1;
|
|
54
|
+
switch (action) {
|
|
55
|
+
case 'addAbove': {
|
|
56
|
+
const sourceNodeForInsert = effectiveSourceNode;
|
|
57
|
+
if (!sourceNodeForInsert)
|
|
58
|
+
return treeData;
|
|
59
|
+
newNodeParentId = sourceNodeForInsert.parentId;
|
|
60
|
+
newNodeHierarchy = sourceNodeForInsert.hierarchy;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case 'addBelow': {
|
|
64
|
+
const sourceNodeForInsert = effectiveSourceNode;
|
|
65
|
+
if (!sourceNodeForInsert)
|
|
66
|
+
return treeData;
|
|
67
|
+
newNodeParentId =
|
|
68
|
+
payloadSourceNode?.parentId ?? sourceNodeForInsert.parentId;
|
|
69
|
+
newNodeHierarchy =
|
|
70
|
+
payloadSourceNode?.hierarchy ?? sourceNodeForInsert.hierarchy;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case 'addInside': {
|
|
74
|
+
if (fallbackInsertAtEnd) {
|
|
75
|
+
newNodeParentId =
|
|
76
|
+
fallbackParentId ?? payloadSourceId ?? sourceId ?? null;
|
|
77
|
+
newNodeHierarchy = fallbackHierarchy ?? 1;
|
|
78
|
+
insertionIndex = updatedTreeData.length;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
const parentNode = payloadSourceNode ?? effectiveSourceNode;
|
|
82
|
+
if (!parentNode)
|
|
83
|
+
return treeData;
|
|
84
|
+
newNodeParentId = parentNode.key;
|
|
85
|
+
newNodeHierarchy = (parentNode.hierarchy ?? 0) + 1;
|
|
86
|
+
// Keep add-inside input at the end of the current parent subtree.
|
|
87
|
+
const parentIndex = updatedTreeData.findIndex((node) => node.key === sourceId);
|
|
88
|
+
if (parentIndex !== -1) {
|
|
89
|
+
insertionIndex = parentIndex + 1;
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const newNodeBase = {
|
|
95
|
+
hierarchy: newNodeHierarchy,
|
|
96
|
+
parentId: newNodeParentId,
|
|
97
|
+
sourceId: effectiveSourceNode?.key ?? sourceId ?? payloadSourceId ?? 'new-node',
|
|
98
|
+
isNewNode: true,
|
|
99
|
+
key: 'new-node',
|
|
100
|
+
value,
|
|
101
|
+
error,
|
|
102
|
+
label,
|
|
103
|
+
type,
|
|
104
|
+
options: convertedOptions,
|
|
105
|
+
selectedOption: convertedSelectedOption,
|
|
106
|
+
confirmIconTooltip,
|
|
107
|
+
cancelIconTooltip,
|
|
108
|
+
};
|
|
109
|
+
switch (action) {
|
|
110
|
+
case 'addAbove':
|
|
111
|
+
updatedTreeData.splice(sourceIndex, 0, newNodeBase);
|
|
112
|
+
break;
|
|
113
|
+
case 'addBelow':
|
|
114
|
+
updatedTreeData.splice(sourceIndex + 1, 0, newNodeBase);
|
|
115
|
+
break;
|
|
116
|
+
case 'addInside':
|
|
117
|
+
updatedTreeData.splice(Math.max(0, insertionIndex), 0, newNodeBase);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
return updatedTreeData;
|
|
121
|
+
};
|
|
122
|
+
const prepareTreeRows = (treeData, rootNode) => {
|
|
123
|
+
if (!treeData?.length)
|
|
124
|
+
return [];
|
|
125
|
+
const nodeById = new Map();
|
|
126
|
+
const childrenByParent = new Map();
|
|
127
|
+
const siblingIndex = new Map();
|
|
128
|
+
const loadedCountsByParent = new Map();
|
|
129
|
+
if (rootNode && rootNode.key) {
|
|
130
|
+
nodeById.set(rootNode.key, rootNode);
|
|
131
|
+
}
|
|
132
|
+
treeData.forEach((node) => {
|
|
133
|
+
nodeById.set(node.key, node);
|
|
134
|
+
const parentKey = node.parentId ?? ROOT_PARENT_ID;
|
|
135
|
+
if (!childrenByParent.has(parentKey)) {
|
|
136
|
+
childrenByParent.set(parentKey, []);
|
|
137
|
+
loadedCountsByParent.set(parentKey, { container: 0, resource: 0 });
|
|
138
|
+
}
|
|
139
|
+
childrenByParent.get(parentKey)?.push(node);
|
|
140
|
+
const counts = loadedCountsByParent.get(parentKey);
|
|
141
|
+
if (counts) {
|
|
142
|
+
if (node.container) {
|
|
143
|
+
counts.container++;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
counts.resource++;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
childrenByParent.forEach((children) => {
|
|
151
|
+
children.forEach((child, index) => {
|
|
152
|
+
siblingIndex.set(child.key, index);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
const hasNextSibling = (node) => {
|
|
156
|
+
const parentKey = node.parentId ?? ROOT_PARENT_ID;
|
|
157
|
+
const siblings = childrenByParent.get(parentKey);
|
|
158
|
+
if (!siblings || siblings.length === 0)
|
|
159
|
+
return false;
|
|
160
|
+
const index = siblingIndex.get(node.key) ?? 0;
|
|
161
|
+
if (index < siblings.length - 1)
|
|
162
|
+
return true;
|
|
163
|
+
const parent = nodeById.get(parentKey);
|
|
164
|
+
const loadedCounts = loadedCountsByParent.get(parentKey);
|
|
165
|
+
if (parent && loadedCounts) {
|
|
166
|
+
const siblingContainerResources = siblings
|
|
167
|
+
.filter((node) => node.container)
|
|
168
|
+
.reduce((sum, node) => sum + (node.totalResourceCount ?? 0), 0);
|
|
169
|
+
const siblingDirectResourcesCount = siblings.filter((node) => !node.container).length;
|
|
170
|
+
const calculatedDirectResources = Math.max(0, (parent.totalResourceCount ?? 0) -
|
|
171
|
+
(siblingContainerResources + siblingDirectResourcesCount));
|
|
172
|
+
if (node.container) {
|
|
173
|
+
const hasMoreContainers = loadedCounts.container < (parent.subContainerCount ?? 0);
|
|
174
|
+
const hasResourcesFollowing = calculatedDirectResources > 0;
|
|
175
|
+
return hasMoreContainers || hasResourcesFollowing;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
return loadedCounts.resource < calculatedDirectResources;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
};
|
|
183
|
+
const buildParentSiblings = (node) => {
|
|
184
|
+
const hierarchy = node.hierarchy ?? 0;
|
|
185
|
+
if (hierarchy <= 0)
|
|
186
|
+
return [];
|
|
187
|
+
const path = [];
|
|
188
|
+
let current = node;
|
|
189
|
+
while (current) {
|
|
190
|
+
path.unshift(current);
|
|
191
|
+
if (!current.parentId)
|
|
192
|
+
break;
|
|
193
|
+
const parent = nodeById.get(current.parentId);
|
|
194
|
+
if (!parent)
|
|
195
|
+
break;
|
|
196
|
+
current = parent;
|
|
197
|
+
}
|
|
198
|
+
const flags = path.map((ancestor) => hasNextSibling(ancestor));
|
|
199
|
+
if (flags.length === hierarchy)
|
|
200
|
+
return flags;
|
|
201
|
+
if (flags.length > hierarchy)
|
|
202
|
+
return flags.slice(flags.length - hierarchy);
|
|
203
|
+
const padding = new Array(hierarchy - flags.length).fill(false);
|
|
204
|
+
return padding.concat(flags);
|
|
205
|
+
};
|
|
206
|
+
const resolveSelectedStatus = (node) => {
|
|
207
|
+
if (node.selectedStatus !== undefined)
|
|
208
|
+
return node.selectedStatus;
|
|
209
|
+
let current = node;
|
|
210
|
+
while (current?.parentId) {
|
|
211
|
+
const parent = nodeById.get(current.parentId);
|
|
212
|
+
if (!parent)
|
|
213
|
+
break;
|
|
214
|
+
if (parent.selectedStatus === 'completely')
|
|
215
|
+
return 'completely';
|
|
216
|
+
if (parent.selectedStatus === 'none')
|
|
217
|
+
return 'none';
|
|
218
|
+
current = parent;
|
|
219
|
+
}
|
|
220
|
+
if (rootNode?.selectedStatus === 'completely')
|
|
221
|
+
return 'completely';
|
|
222
|
+
if (rootNode?.selectedStatus === 'none')
|
|
223
|
+
return 'none';
|
|
224
|
+
return node.selectedStatus;
|
|
225
|
+
};
|
|
226
|
+
return treeData.map((node) => {
|
|
227
|
+
const nodeWithSiblings = node;
|
|
228
|
+
const finalParentSiblings = nodeWithSiblings.parentSiblings &&
|
|
229
|
+
nodeWithSiblings.parentSiblings.length > 0
|
|
230
|
+
? nodeWithSiblings.parentSiblings
|
|
231
|
+
: buildParentSiblings(node);
|
|
232
|
+
return {
|
|
233
|
+
...node,
|
|
234
|
+
lastChild: !hasNextSibling(node),
|
|
235
|
+
parentSiblings: finalParentSiblings,
|
|
236
|
+
selectedStatus: resolveSelectedStatus(node),
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
const TableTreeFn = forwardRef(({ treeData, columnsData, selected = [], select = null, onChange = () => { }, onClick = () => { }, onExpand = () => { }, loadMore = () => { }, tableBorder, height = 'calc(100vh - 134px)', newNode, onAddConfirm = () => { }, onAddCancel = () => { }, handleEditFieldError, loading = false, rootNode, pagination = true, selectedNode, tableHeaderBgColor = 'var(--border-color)', hideOnDisable = false, freezeColumns, addModuleInputWidth = 150, addModuleSelectWidth, onScroll, onScrollEnd, disableEditLabelConfirmIcon = false, transparentHeader = false, navigateTreeNode = null, handleRemoveNavigateTreeNode = () => { }, scrollThreshold = 128, showHeader = true, resetScroll = false, setResetScroll = () => { }, }, ref) => {
|
|
11
241
|
const [expanding, setExpanding] = useState(null);
|
|
12
|
-
const [scrollDirection, setScrollDirection] = useState(null);
|
|
13
|
-
const [
|
|
14
|
-
const [
|
|
15
|
-
const [maintainScrollPosition, setMaintainScrollPosition] = useState(null);
|
|
242
|
+
const [scrollDirection, setScrollDirection] = useState(null);
|
|
243
|
+
const [virtualRange, setVirtualRange] = useState({ start: 0, end: 20 });
|
|
244
|
+
const [newNodeEditable, setNewNodeEditable] = useState(false);
|
|
16
245
|
const containerRef = useRef(null);
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
246
|
+
const headerRef = useRef(null);
|
|
247
|
+
const headerHeightRef = useRef(0);
|
|
248
|
+
const loadingRef = useRef(loading);
|
|
249
|
+
const scrollDirectionRef = useRef(null);
|
|
250
|
+
const scrollRafRef = useRef(null);
|
|
251
|
+
const scrollPositionRef = useRef({ lastScrollTop: 0 });
|
|
252
|
+
const prevVisibleRowsRef = useRef([]);
|
|
253
|
+
const suppressScrollCancelUntilRef = useRef(0);
|
|
254
|
+
const debouncedScrollEndRef = useRef(null);
|
|
255
|
+
const expandTargetRef = useRef(null);
|
|
256
|
+
const expandingFallbackTimerRef = useRef(null);
|
|
257
|
+
const navigateAttemptsRef = useRef({ key: null, attempts: 0 });
|
|
258
|
+
const navigateClearTimerRef = useRef(null);
|
|
259
|
+
const getWidthInfo = (width, defaultWidth) => {
|
|
260
|
+
const w = width ?? defaultWidth;
|
|
261
|
+
const str = String(w);
|
|
262
|
+
if (str.endsWith('%')) {
|
|
263
|
+
return { value: parseFloat(str), unit: '%' };
|
|
264
|
+
}
|
|
265
|
+
return { value: parseFloat(str) || 0, unit: 'px' };
|
|
266
|
+
};
|
|
267
|
+
const columnMeta = useMemo(() => {
|
|
268
|
+
let stickyLeftPx = 0;
|
|
269
|
+
let stickyLeftPct = 0;
|
|
270
|
+
return columnsData.map((col, index) => {
|
|
271
|
+
const { value, unit } = getWidthInfo(col.width, DEFAULT_COLUMN_WIDTH);
|
|
272
|
+
const sticky = !!freezeColumns && index < freezeColumns;
|
|
273
|
+
const widthCss = unit === '%' ? `${value}%` : `${value}px`;
|
|
274
|
+
const leftCss = `calc(${stickyLeftPx}px + ${stickyLeftPct}%)`;
|
|
275
|
+
const meta = {
|
|
276
|
+
width: widthCss,
|
|
277
|
+
sticky,
|
|
278
|
+
left: leftCss,
|
|
279
|
+
zIndex: sticky ? 100 + (freezeColumns ?? 0) - index : 1,
|
|
280
|
+
};
|
|
281
|
+
if (sticky) {
|
|
282
|
+
if (unit === '%') {
|
|
283
|
+
stickyLeftPct += value;
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
stickyLeftPx += value;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return meta;
|
|
290
|
+
});
|
|
291
|
+
}, [columnsData, freezeColumns]);
|
|
292
|
+
const totalWidth = useMemo(() => {
|
|
293
|
+
let totalPx = 0;
|
|
294
|
+
let totalPct = 0;
|
|
295
|
+
columnsData.forEach((col) => {
|
|
296
|
+
const { value, unit } = getWidthInfo(col.width, DEFAULT_COLUMN_WIDTH);
|
|
297
|
+
if (unit === '%') {
|
|
298
|
+
totalPct += value;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
totalPx += value;
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
return `calc(${totalPx}px + ${totalPct}%)`;
|
|
305
|
+
}, [columnsData]);
|
|
306
|
+
const frozenColumnWidth = useMemo(() => {
|
|
307
|
+
if (!freezeColumns)
|
|
308
|
+
return '0px';
|
|
309
|
+
let totalPx = 0;
|
|
310
|
+
let totalPct = 0;
|
|
311
|
+
const frozenCols = columnMeta.slice(0, freezeColumns);
|
|
312
|
+
frozenCols.forEach((col) => {
|
|
313
|
+
const val = parseFloat(col.width) || 0;
|
|
314
|
+
if (col.width.endsWith('%')) {
|
|
315
|
+
totalPct += val;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
totalPx += val;
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
return `calc(${totalPx}px + ${totalPct}%)`;
|
|
322
|
+
}, [columnMeta, freezeColumns]);
|
|
323
|
+
const treeDataWithNewNode = useMemo(() => insertNewNode(treeData, newNode, rootNode?.node), [treeData, newNode, rootNode]);
|
|
324
|
+
const preparedRows = useMemo(() => prepareTreeRows(treeDataWithNewNode, rootNode?.node), [treeDataWithNewNode, rootNode?.node]);
|
|
325
|
+
const visiblePreparedRows = useMemo(() => preparedRows.filter((node) => !node.hide), [preparedRows]);
|
|
326
|
+
const preparedRowsByKey = useMemo(() => {
|
|
327
|
+
const map = new Map();
|
|
328
|
+
preparedRows.forEach((node) => map.set(node.key, node));
|
|
329
|
+
return map;
|
|
330
|
+
}, [preparedRows]);
|
|
331
|
+
const keyIndexMap = useMemo(() => {
|
|
332
|
+
const map = new Map();
|
|
333
|
+
visiblePreparedRows.forEach((node, index) => map.set(node.key, index));
|
|
334
|
+
return map;
|
|
335
|
+
}, [visiblePreparedRows]);
|
|
336
|
+
const clearExpanding = useCallback((targetKey) => {
|
|
337
|
+
setExpanding((current) => {
|
|
338
|
+
if (!current)
|
|
339
|
+
return current;
|
|
340
|
+
if (targetKey && current !== targetKey)
|
|
341
|
+
return current;
|
|
342
|
+
return null;
|
|
343
|
+
});
|
|
344
|
+
if (!targetKey || expandTargetRef.current?.key === targetKey) {
|
|
345
|
+
expandTargetRef.current = null;
|
|
346
|
+
}
|
|
347
|
+
if (expandingFallbackTimerRef.current) {
|
|
348
|
+
clearTimeout(expandingFallbackTimerRef.current);
|
|
349
|
+
expandingFallbackTimerRef.current = null;
|
|
350
|
+
}
|
|
351
|
+
}, []);
|
|
352
|
+
useEffect(() => {
|
|
353
|
+
loadingRef.current = loading;
|
|
354
|
+
}, [loading]);
|
|
355
|
+
useEffect(() => {
|
|
356
|
+
scrollDirectionRef.current = scrollDirection;
|
|
357
|
+
}, [scrollDirection]);
|
|
358
|
+
const updateScrollDirection = useCallback((direction) => {
|
|
359
|
+
scrollDirectionRef.current = direction;
|
|
360
|
+
setScrollDirection(direction);
|
|
361
|
+
}, []);
|
|
362
|
+
const updateVirtualRange = useCallback(() => {
|
|
363
|
+
const container = containerRef.current;
|
|
364
|
+
if (!container)
|
|
27
365
|
return;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
366
|
+
const headerHeight = headerHeightRef.current || 0;
|
|
367
|
+
const rowScrollTop = Math.max(0, container.scrollTop - headerHeight);
|
|
368
|
+
const viewportHeight = container.clientHeight - headerHeight;
|
|
369
|
+
let start = Math.floor(rowScrollTop / ROW_HEIGHT) - OVERSCAN;
|
|
370
|
+
let end = Math.ceil((rowScrollTop + viewportHeight) / ROW_HEIGHT) + OVERSCAN;
|
|
371
|
+
start = Math.max(0, start);
|
|
372
|
+
end = Math.min(visiblePreparedRows.length, end);
|
|
373
|
+
setVirtualRange((prev) => {
|
|
374
|
+
if (prev.start === start && prev.end === end)
|
|
375
|
+
return prev;
|
|
376
|
+
return { start, end };
|
|
377
|
+
});
|
|
378
|
+
}, [visiblePreparedRows.length]);
|
|
379
|
+
const scheduleRangeUpdate = useCallback(() => {
|
|
380
|
+
if (scrollRafRef.current !== null)
|
|
35
381
|
return;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
382
|
+
scrollRafRef.current = requestAnimationFrame(() => {
|
|
383
|
+
scrollRafRef.current = null;
|
|
384
|
+
updateVirtualRange();
|
|
385
|
+
});
|
|
386
|
+
}, [updateVirtualRange]);
|
|
40
387
|
const handleScroll = useCallback(() => {
|
|
41
388
|
const container = containerRef.current;
|
|
42
|
-
if (!container
|
|
389
|
+
if (!container)
|
|
43
390
|
return;
|
|
44
|
-
const now = Date.now();
|
|
45
391
|
const currentScrollTop = container.scrollTop;
|
|
46
|
-
const scrollHeight = container.scrollHeight;
|
|
47
|
-
const clientHeight = container.clientHeight;
|
|
48
|
-
// Scroll direction calculation
|
|
49
392
|
const direction = currentScrollTop > scrollPositionRef.current.lastScrollTop
|
|
50
393
|
? 'down'
|
|
51
394
|
: 'up';
|
|
52
|
-
scrollPositionRef.current =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
395
|
+
scrollPositionRef.current.lastScrollTop = currentScrollTop;
|
|
396
|
+
scheduleRangeUpdate();
|
|
397
|
+
onScroll?.();
|
|
398
|
+
debouncedScrollEndRef.current?.();
|
|
399
|
+
if (!pagination ||
|
|
400
|
+
loading ||
|
|
401
|
+
scrollDirectionRef.current ||
|
|
402
|
+
checkEmpty(treeData))
|
|
403
|
+
return;
|
|
404
|
+
const scrollHeight = container.scrollHeight;
|
|
405
|
+
const clientHeight = container.clientHeight;
|
|
62
406
|
const nearBottom = scrollHeight - (currentScrollTop + clientHeight) < scrollThreshold;
|
|
63
|
-
const nearTop = currentScrollTop < scrollThreshold;
|
|
64
407
|
if (direction === 'down' &&
|
|
65
408
|
nearBottom &&
|
|
66
|
-
!
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
409
|
+
!treeData[treeData.length - 1]?.lastResource) {
|
|
410
|
+
updateScrollDirection('below');
|
|
411
|
+
loadMore('below');
|
|
412
|
+
}
|
|
413
|
+
}, [
|
|
414
|
+
treeData,
|
|
415
|
+
pagination,
|
|
416
|
+
loading,
|
|
417
|
+
scrollDirection,
|
|
418
|
+
scrollThreshold,
|
|
419
|
+
scheduleRangeUpdate,
|
|
420
|
+
onScroll,
|
|
421
|
+
loadMore,
|
|
422
|
+
updateScrollDirection,
|
|
423
|
+
]);
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
if (loading || !pagination || checkEmpty(treeData))
|
|
426
|
+
return;
|
|
427
|
+
const firstNode = treeData[0];
|
|
428
|
+
const hasMoreAbove = !firstNode?.lastResource;
|
|
429
|
+
const { totalSubContainerCount = 0, totalResourceCount = 0 } = rootNode?.node || {};
|
|
430
|
+
const totalItems = totalSubContainerCount + totalResourceCount;
|
|
431
|
+
const isListTooShort = visiblePreparedRows.length < 10 &&
|
|
432
|
+
visiblePreparedRows.length < totalItems;
|
|
433
|
+
if (hasMoreAbove && isListTooShort) {
|
|
434
|
+
updateScrollDirection('above');
|
|
435
|
+
loadMore('above');
|
|
72
436
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
437
|
+
}, [
|
|
438
|
+
loading,
|
|
439
|
+
pagination,
|
|
440
|
+
treeData,
|
|
441
|
+
visiblePreparedRows.length,
|
|
442
|
+
rootNode,
|
|
443
|
+
loadMore,
|
|
444
|
+
updateScrollDirection,
|
|
445
|
+
]);
|
|
446
|
+
useLayoutEffect(() => {
|
|
447
|
+
const oldRows = prevVisibleRowsRef.current;
|
|
448
|
+
const newRows = visiblePreparedRows;
|
|
449
|
+
const container = containerRef.current;
|
|
450
|
+
if (resetScroll && container) {
|
|
451
|
+
container.scrollTop = 0;
|
|
452
|
+
scrollPositionRef.current.lastScrollTop = 0;
|
|
453
|
+
setResetScroll(false);
|
|
454
|
+
return;
|
|
81
455
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// this function will try to restore the scroll position after loading more data specially when loading more data above
|
|
97
|
-
const tryRestoreScroll = () => {
|
|
98
|
-
const allRows = Array.from(container.querySelectorAll('.ff-table-tree-row'));
|
|
99
|
-
let totalAddedHeight = 0;
|
|
100
|
-
for (let i = 0; i < addedRowsCount; i++) {
|
|
101
|
-
const height = allRows[i]?.getBoundingClientRect().height || 0;
|
|
102
|
-
totalAddedHeight += height;
|
|
456
|
+
else if (container && oldRows.length > 0 && newRows.length > 0) {
|
|
457
|
+
if (!loading) {
|
|
458
|
+
const lastScrollTop = scrollPositionRef.current.lastScrollTop;
|
|
459
|
+
const topVisibleIndex = Math.max(0, Math.floor(lastScrollTop / ROW_HEIGHT));
|
|
460
|
+
let oldIndex = -1;
|
|
461
|
+
let newIndex = -1;
|
|
462
|
+
for (let i = topVisibleIndex; i < oldRows.length; i++) {
|
|
463
|
+
const key = oldRows[i]?.key;
|
|
464
|
+
const foundNewIndex = keyIndexMap.get(key ?? '');
|
|
465
|
+
if (foundNewIndex !== undefined) {
|
|
466
|
+
oldIndex = i;
|
|
467
|
+
newIndex = foundNewIndex;
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
103
470
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
471
|
+
if (oldIndex === -1) {
|
|
472
|
+
for (let i = topVisibleIndex - 1; i >= 0; i--) {
|
|
473
|
+
const key = oldRows[i]?.key;
|
|
474
|
+
const foundNewIndex = keyIndexMap.get(key ?? '');
|
|
475
|
+
if (foundNewIndex !== undefined) {
|
|
476
|
+
oldIndex = i;
|
|
477
|
+
newIndex = foundNewIndex;
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
109
481
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
482
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
483
|
+
const deltaRows = newIndex - oldIndex;
|
|
484
|
+
const targetScrollTop = Math.max(0, lastScrollTop + deltaRows * ROW_HEIGHT);
|
|
485
|
+
if (container.scrollTop !== targetScrollTop) {
|
|
486
|
+
container.scrollTop = targetScrollTop;
|
|
487
|
+
scrollPositionRef.current.lastScrollTop = container.scrollTop;
|
|
488
|
+
updateVirtualRange();
|
|
489
|
+
}
|
|
113
490
|
}
|
|
114
491
|
else {
|
|
115
|
-
|
|
116
|
-
|
|
492
|
+
// FIX: Graceful Fallback
|
|
493
|
+
if (scrollDirection === 'above') {
|
|
494
|
+
// Only push to 0 if they specifically requested data ABOVE them
|
|
495
|
+
if (container.scrollTop !== 0) {
|
|
496
|
+
container.scrollTop = 0;
|
|
497
|
+
scrollPositionRef.current.lastScrollTop = 0;
|
|
498
|
+
updateVirtualRange();
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
// For all other cases (canceling an add, shrinking), just safely clamp the scroll
|
|
503
|
+
// so it doesn't point to empty space, but DO NOT force it to 0.
|
|
504
|
+
const headerHeight = headerHeightRef.current || 0;
|
|
505
|
+
const maxScrollTop = Math.max(0, newRows.length * ROW_HEIGHT -
|
|
506
|
+
(container.clientHeight - headerHeight));
|
|
507
|
+
if (container.scrollTop > maxScrollTop) {
|
|
508
|
+
container.scrollTop = maxScrollTop;
|
|
509
|
+
scrollPositionRef.current.lastScrollTop = maxScrollTop;
|
|
510
|
+
updateVirtualRange();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
117
513
|
}
|
|
118
|
-
|
|
119
|
-
|
|
514
|
+
if (scrollDirection) {
|
|
515
|
+
updateScrollDirection(null);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
120
518
|
}
|
|
519
|
+
prevVisibleRowsRef.current = newRows;
|
|
121
520
|
}, [
|
|
122
521
|
loading,
|
|
123
522
|
scrollDirection,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
523
|
+
keyIndexMap,
|
|
524
|
+
visiblePreparedRows,
|
|
525
|
+
updateScrollDirection,
|
|
526
|
+
updateVirtualRange,
|
|
527
|
+
resetScroll,
|
|
528
|
+
setResetScroll,
|
|
129
529
|
]);
|
|
130
|
-
// Attach scroll event listener for updated first node when we scroll
|
|
131
530
|
useEffect(() => {
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
531
|
+
const container = containerRef.current;
|
|
532
|
+
if (!container)
|
|
134
533
|
return;
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
534
|
+
const handleWheelAtTop = (event) => {
|
|
535
|
+
if (event.deltaY >= 0)
|
|
536
|
+
return;
|
|
537
|
+
if (!pagination || checkEmpty(treeData) || loadingRef.current)
|
|
538
|
+
return;
|
|
539
|
+
if (scrollDirectionRef.current)
|
|
540
|
+
return;
|
|
541
|
+
if (container.scrollTop > 1 || treeData[0]?.lastResource)
|
|
542
|
+
return;
|
|
543
|
+
updateScrollDirection('above');
|
|
544
|
+
loadMore('above');
|
|
141
545
|
};
|
|
142
|
-
|
|
546
|
+
container.addEventListener('wheel', handleWheelAtTop, { passive: true });
|
|
143
547
|
return () => {
|
|
144
|
-
|
|
145
|
-
debouncedOnScrollEnd.cancel();
|
|
548
|
+
container.removeEventListener('wheel', handleWheelAtTop);
|
|
146
549
|
};
|
|
147
|
-
}, [
|
|
550
|
+
}, [pagination, treeData, loadMore, updateScrollDirection]);
|
|
148
551
|
useEffect(() => {
|
|
552
|
+
const container = containerRef.current;
|
|
553
|
+
if (!container)
|
|
554
|
+
return;
|
|
555
|
+
debouncedScrollEndRef.current = onScrollEnd
|
|
556
|
+
? debounce(() => {
|
|
557
|
+
onScrollEnd?.();
|
|
558
|
+
}, 150)
|
|
559
|
+
: null;
|
|
560
|
+
container.addEventListener('scroll', handleScroll, { passive: true });
|
|
149
561
|
return () => {
|
|
150
|
-
|
|
151
|
-
|
|
562
|
+
container.removeEventListener('scroll', handleScroll);
|
|
563
|
+
debouncedScrollEndRef.current?.cancel();
|
|
564
|
+
};
|
|
565
|
+
}, [handleScroll, onScrollEnd]);
|
|
566
|
+
useEffect(() => {
|
|
567
|
+
const container = containerRef.current;
|
|
568
|
+
if (!container)
|
|
569
|
+
return;
|
|
570
|
+
const handleScrollCapture = (event) => {
|
|
571
|
+
if (Date.now() < suppressScrollCancelUntilRef.current) {
|
|
572
|
+
event.stopImmediatePropagation();
|
|
152
573
|
}
|
|
153
574
|
};
|
|
575
|
+
container.addEventListener('scroll', handleScrollCapture, {
|
|
576
|
+
passive: true,
|
|
577
|
+
capture: true,
|
|
578
|
+
});
|
|
579
|
+
return () => {
|
|
580
|
+
container.removeEventListener('scroll', handleScrollCapture, true);
|
|
581
|
+
};
|
|
154
582
|
}, []);
|
|
155
|
-
|
|
583
|
+
useEffect(() => {
|
|
584
|
+
const headerNode = headerRef.current;
|
|
585
|
+
if (!headerNode)
|
|
586
|
+
return;
|
|
587
|
+
const updateHeight = () => {
|
|
588
|
+
headerHeightRef.current = headerNode.getBoundingClientRect().height;
|
|
589
|
+
updateVirtualRange();
|
|
590
|
+
};
|
|
591
|
+
const resizeObserver = new ResizeObserver(updateHeight);
|
|
592
|
+
resizeObserver.observe(headerNode);
|
|
593
|
+
return () => resizeObserver.disconnect();
|
|
594
|
+
}, [updateVirtualRange]);
|
|
156
595
|
useLayoutEffect(() => {
|
|
157
|
-
if (!
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
596
|
+
if (!newNode || !containerRef.current)
|
|
597
|
+
return;
|
|
598
|
+
const container = containerRef.current;
|
|
599
|
+
const newNodeIndex = keyIndexMap.get('new-node');
|
|
600
|
+
if (newNodeIndex === undefined)
|
|
601
|
+
return;
|
|
602
|
+
const headerHeight = headerHeightRef.current || 0;
|
|
603
|
+
const viewportHeight = container.clientHeight - headerHeight;
|
|
604
|
+
if (viewportHeight <= 0)
|
|
605
|
+
return;
|
|
606
|
+
const rowTop = newNodeIndex * ROW_HEIGHT;
|
|
607
|
+
const rowBottom = rowTop + ROW_HEIGHT;
|
|
608
|
+
const rowScrollTop = Math.max(0, container.scrollTop - headerHeight);
|
|
609
|
+
const viewTop = rowScrollTop;
|
|
610
|
+
const viewBottom = rowScrollTop + viewportHeight;
|
|
611
|
+
let nextRowScrollTop = rowScrollTop;
|
|
612
|
+
if (rowTop < viewTop) {
|
|
613
|
+
nextRowScrollTop = rowTop;
|
|
171
614
|
}
|
|
172
|
-
else if (
|
|
173
|
-
|
|
615
|
+
else if (rowBottom > viewBottom) {
|
|
616
|
+
nextRowScrollTop = Math.max(0, rowBottom - viewportHeight);
|
|
174
617
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const container = containerRef.current;
|
|
181
|
-
if (node && container) {
|
|
182
|
-
// Store current scroll position
|
|
183
|
-
setMaintainScrollPosition(container.scrollTop);
|
|
184
|
-
// Calculate scroll position
|
|
185
|
-
const nodeRect = node.getBoundingClientRect();
|
|
186
|
-
const containerRect = container.getBoundingClientRect();
|
|
187
|
-
const scrollTop = container.scrollTop;
|
|
188
|
-
const nodeTop = nodeRect.top - containerRect.top + scrollTop;
|
|
189
|
-
const containerHeight = containerRect.height;
|
|
190
|
-
// Scroll to center the node
|
|
191
|
-
container.scrollTo({
|
|
192
|
-
top: nodeTop - containerHeight / 2 + nodeRect.height / 2,
|
|
193
|
-
behavior: 'smooth',
|
|
194
|
-
});
|
|
195
|
-
}
|
|
618
|
+
if (nextRowScrollTop !== rowScrollTop) {
|
|
619
|
+
suppressScrollCancelUntilRef.current = Date.now() + 300;
|
|
620
|
+
container.scrollTop = nextRowScrollTop + headerHeight;
|
|
621
|
+
scrollPositionRef.current.lastScrollTop = container.scrollTop;
|
|
622
|
+
updateVirtualRange();
|
|
196
623
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
|
|
624
|
+
const rafId = requestAnimationFrame(() => {
|
|
625
|
+
setNewNodeEditable(true);
|
|
626
|
+
});
|
|
627
|
+
return () => cancelAnimationFrame(rafId);
|
|
628
|
+
}, [newNode, keyIndexMap, updateVirtualRange]);
|
|
202
629
|
useEffect(() => {
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
|
|
630
|
+
if (!newNode) {
|
|
631
|
+
setNewNodeEditable(false);
|
|
632
|
+
}
|
|
633
|
+
}, [newNode]);
|
|
634
|
+
useLayoutEffect(() => {
|
|
635
|
+
if (!expanding || loading)
|
|
636
|
+
return;
|
|
637
|
+
const expected = expandTargetRef.current;
|
|
638
|
+
if (!expected || expected.key !== expanding) {
|
|
639
|
+
const rafId = requestAnimationFrame(() => {
|
|
640
|
+
clearExpanding(expanding);
|
|
641
|
+
});
|
|
642
|
+
return () => cancelAnimationFrame(rafId);
|
|
643
|
+
}
|
|
644
|
+
const updatedNode = preparedRowsByKey.get(expected.key);
|
|
645
|
+
if (!updatedNode) {
|
|
646
|
+
const rafId = requestAnimationFrame(() => {
|
|
647
|
+
clearExpanding(expected.key);
|
|
648
|
+
});
|
|
649
|
+
return () => cancelAnimationFrame(rafId);
|
|
206
650
|
}
|
|
207
|
-
|
|
208
|
-
|
|
651
|
+
if (Boolean(updatedNode.expanded) !== expected.expanded)
|
|
652
|
+
return;
|
|
653
|
+
const rafId = requestAnimationFrame(() => {
|
|
654
|
+
clearExpanding(expected.key);
|
|
655
|
+
});
|
|
656
|
+
return () => cancelAnimationFrame(rafId);
|
|
657
|
+
}, [preparedRowsByKey, expanding, loading, clearExpanding]);
|
|
209
658
|
useEffect(() => {
|
|
659
|
+
if (navigateAttemptsRef.current.key !== navigateTreeNode) {
|
|
660
|
+
navigateAttemptsRef.current = {
|
|
661
|
+
key: navigateTreeNode,
|
|
662
|
+
attempts: 0,
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
if (!navigateTreeNode && navigateClearTimerRef.current) {
|
|
666
|
+
clearTimeout(navigateClearTimerRef.current);
|
|
667
|
+
navigateClearTimerRef.current = null;
|
|
668
|
+
}
|
|
669
|
+
}, [navigateTreeNode]);
|
|
670
|
+
useLayoutEffect(() => {
|
|
671
|
+
if (!navigateTreeNode || newNode)
|
|
672
|
+
return;
|
|
210
673
|
const container = containerRef.current;
|
|
211
|
-
if (!container
|
|
674
|
+
if (!container)
|
|
212
675
|
return;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
676
|
+
const rowIndex = keyIndexMap.get(navigateTreeNode);
|
|
677
|
+
if (rowIndex !== undefined) {
|
|
678
|
+
navigateAttemptsRef.current = {
|
|
679
|
+
key: navigateTreeNode,
|
|
680
|
+
attempts: 0,
|
|
681
|
+
};
|
|
682
|
+
const headerHeight = headerHeightRef.current || 0;
|
|
683
|
+
const viewportHeight = Math.max(ROW_HEIGHT, container.clientHeight - headerHeight);
|
|
684
|
+
const rowCenter = rowIndex * ROW_HEIGHT + ROW_HEIGHT / 2;
|
|
685
|
+
const targetTop = Math.max(0, rowCenter - viewportHeight / 2) + headerHeight;
|
|
686
|
+
suppressScrollCancelUntilRef.current = Date.now() + 400;
|
|
687
|
+
container.scrollTo({
|
|
688
|
+
top: targetTop,
|
|
689
|
+
behavior: 'smooth',
|
|
690
|
+
});
|
|
691
|
+
scheduleRangeUpdate();
|
|
692
|
+
if (navigateClearTimerRef.current) {
|
|
693
|
+
clearTimeout(navigateClearTimerRef.current);
|
|
220
694
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (treeData.length > 0) {
|
|
226
|
-
previousTreeDataRef.current = treeData;
|
|
695
|
+
navigateClearTimerRef.current = setTimeout(() => {
|
|
696
|
+
handleRemoveNavigateTreeNode?.();
|
|
697
|
+
}, 350);
|
|
698
|
+
return;
|
|
227
699
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
700
|
+
if (loading || scrollDirection)
|
|
701
|
+
return;
|
|
702
|
+
const retryState = navigateAttemptsRef.current;
|
|
703
|
+
if (retryState.key !== navigateTreeNode) {
|
|
704
|
+
retryState.key = navigateTreeNode;
|
|
705
|
+
retryState.attempts = 0;
|
|
232
706
|
}
|
|
233
|
-
|
|
707
|
+
retryState.attempts += 1;
|
|
708
|
+
if (retryState.attempts > 30) {
|
|
709
|
+
handleRemoveNavigateTreeNode?.();
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (pagination && treeData[0]?.lastResource !== true) {
|
|
713
|
+
updateScrollDirection('above');
|
|
714
|
+
loadMore('above');
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (retryState.attempts > 2) {
|
|
718
|
+
handleRemoveNavigateTreeNode?.();
|
|
719
|
+
}
|
|
720
|
+
}, [
|
|
721
|
+
navigateTreeNode,
|
|
722
|
+
newNode,
|
|
723
|
+
keyIndexMap,
|
|
724
|
+
loading,
|
|
725
|
+
scrollDirection,
|
|
726
|
+
pagination,
|
|
727
|
+
treeData,
|
|
728
|
+
loadMore,
|
|
729
|
+
scheduleRangeUpdate,
|
|
730
|
+
handleRemoveNavigateTreeNode,
|
|
731
|
+
updateScrollDirection,
|
|
732
|
+
]);
|
|
234
733
|
const handleToggleExpand = useCallback((node) => {
|
|
235
734
|
if (expanding)
|
|
236
735
|
return;
|
|
736
|
+
const nextExpandedState = !node?.expanded;
|
|
237
737
|
setExpanding(node.key);
|
|
738
|
+
expandTargetRef.current = {
|
|
739
|
+
key: node.key,
|
|
740
|
+
expanded: nextExpandedState,
|
|
741
|
+
};
|
|
742
|
+
if (expandingFallbackTimerRef.current) {
|
|
743
|
+
clearTimeout(expandingFallbackTimerRef.current);
|
|
744
|
+
}
|
|
745
|
+
const fallbackStartedAt = Date.now();
|
|
746
|
+
const MAX_FALLBACK_WAIT_MS = 2000;
|
|
747
|
+
const FALLBACK_CHECK_INTERVAL_MS = 1000;
|
|
748
|
+
const ensureExpandCleanup = () => {
|
|
749
|
+
if (expandTargetRef.current?.key !== node.key)
|
|
750
|
+
return;
|
|
751
|
+
const isStillLoading = loadingRef.current;
|
|
752
|
+
const didTimeout = Date.now() - fallbackStartedAt >= MAX_FALLBACK_WAIT_MS;
|
|
753
|
+
if (isStillLoading && !didTimeout) {
|
|
754
|
+
expandingFallbackTimerRef.current = setTimeout(ensureExpandCleanup, FALLBACK_CHECK_INTERVAL_MS);
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
clearExpanding(node.key);
|
|
758
|
+
};
|
|
759
|
+
expandingFallbackTimerRef.current = setTimeout(ensureExpandCleanup, FALLBACK_CHECK_INTERVAL_MS);
|
|
238
760
|
onExpand?.(node);
|
|
239
|
-
}, [onExpand,
|
|
761
|
+
}, [expanding, onExpand, clearExpanding]);
|
|
240
762
|
const handleCheckBoxChange = useCallback((e, node) => {
|
|
241
763
|
if (expanding)
|
|
242
764
|
return;
|
|
@@ -247,69 +769,32 @@ showHeader = true, }, ref) => {
|
|
|
247
769
|
return;
|
|
248
770
|
onClick?.(e, node);
|
|
249
771
|
}, [onClick, expanding]);
|
|
250
|
-
const DEFAULT_COLUMN_WIDTH = 400;
|
|
251
|
-
const calculateFrozenWidth = (columnData, freezeColumns) => {
|
|
252
|
-
return columnData
|
|
253
|
-
.slice(0, freezeColumns)
|
|
254
|
-
.reduce((acc, col) => acc + parseInt(col.width || `${DEFAULT_COLUMN_WIDTH}`, 10), 0);
|
|
255
|
-
};
|
|
256
|
-
let frozenWidth;
|
|
257
|
-
if (freezeColumns) {
|
|
258
|
-
frozenWidth = calculateFrozenWidth(columnsData, freezeColumns);
|
|
259
|
-
}
|
|
260
|
-
// half visible, click on upward arrow functionality, page auto scrolling
|
|
261
772
|
useEffect(() => {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
newNode.sourceId === treeData[0]?.key) {
|
|
267
|
-
container.scrollTo({ top: 0, behavior: 'smooth' });
|
|
268
|
-
}
|
|
269
|
-
else if (newNode.action === 'addAbove' &&
|
|
270
|
-
newNode.sourceId === newNode.firstNodeKey) {
|
|
271
|
-
const newScrollTop = container.scrollTop - 64;
|
|
272
|
-
container.scrollTo({ top: newScrollTop, behavior: 'smooth' });
|
|
273
|
-
}
|
|
274
|
-
}, [newNode]);
|
|
275
|
-
useLayoutEffect(() => {
|
|
276
|
-
if (!navigateTreeNode)
|
|
277
|
-
return;
|
|
278
|
-
const container = containerRef.current;
|
|
279
|
-
if (!container)
|
|
280
|
-
return;
|
|
281
|
-
let retryCount = 0;
|
|
282
|
-
const maxRetries = 30;
|
|
283
|
-
const scrollToNode = () => {
|
|
284
|
-
const element = document.getElementById(navigateTreeNode);
|
|
285
|
-
if (element) {
|
|
286
|
-
setTimeout(() => {
|
|
287
|
-
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
288
|
-
handleRemoveNavigateTreeNode();
|
|
289
|
-
}, 200);
|
|
773
|
+
return () => {
|
|
774
|
+
if (scrollRafRef.current !== null) {
|
|
775
|
+
cancelAnimationFrame(scrollRafRef.current);
|
|
776
|
+
scrollRafRef.current = null;
|
|
290
777
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
retryCount++;
|
|
297
|
-
requestAnimationFrame(scrollToNode);
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
handleRemoveNavigateTreeNode();
|
|
301
|
-
}
|
|
778
|
+
if (expandingFallbackTimerRef.current) {
|
|
779
|
+
clearTimeout(expandingFallbackTimerRef.current);
|
|
780
|
+
}
|
|
781
|
+
if (navigateClearTimerRef.current) {
|
|
782
|
+
clearTimeout(navigateClearTimerRef.current);
|
|
302
783
|
}
|
|
303
784
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
'--
|
|
309
|
-
|
|
310
|
-
: '0px',
|
|
785
|
+
}, []);
|
|
786
|
+
const totalHeight = visiblePreparedRows.length * ROW_HEIGHT;
|
|
787
|
+
const visibleRows = visiblePreparedRows.slice(virtualRange.start, virtualRange.end);
|
|
788
|
+
return (_jsx("div", { className: "tree-table-wrapper-container table-tree-fn", children: _jsx("div", { className: "tree-table-fn-wrap", ref: ref, children: _jsx("div", { className: `table-fn-scrollable ${visiblePreparedRows.length ? '' : 'table-fn-empty'}`, ref: containerRef, style: {
|
|
789
|
+
'--table-height': visiblePreparedRows.length ? height : 'auto',
|
|
790
|
+
'--frozen-column-width': frozenColumnWidth,
|
|
311
791
|
border: tableBorder,
|
|
312
|
-
}, children: _jsxs("
|
|
792
|
+
}, children: _jsxs("div", { className: "tree-table-fn", style: { width: totalWidth }, children: [_jsx("div", { ref: headerRef, style: { position: 'sticky', top: 0, zIndex: 98 }, children: _jsx(TableHead, { columnsData: columnsData, columnMeta: columnMeta, totalWidth: totalWidth, rootNode: rootNode, onCheckBoxChange: handleCheckBoxChange, selected: selected, selectedNode: selectedNode, tableHeaderBgColor: tableHeaderBgColor, hideOnDisable: hideOnDisable, transparentHeader: transparentHeader, showHeader: showHeader }) }), _jsx(TableBody, { flattenedTreeData: visibleRows, columnsData: columnsData, columnMeta: columnMeta, totalWidth: totalWidth, rowHeight: ROW_HEIGHT, startIndex: virtualRange.start, totalHeight: totalHeight, selected: selected, select: select, onRowClick: handleRowClick, onToggleExpand: handleToggleExpand, onCheckBoxChange: handleCheckBoxChange, onAddConfirm: onAddConfirm, onAddCancel: onAddCancel, handleEditFieldError: handleEditFieldError, expanding: expanding, selectedNode: selectedNode, hideOnDisable: hideOnDisable, addModuleInputWidth: addModuleInputWidth, addModuleSelectWidth: addModuleSelectWidth, disableEditLabelConfirmIcon: disableEditLabelConfirmIcon, isEditable: newNode ? newNodeEditable : undefined, setIsEditable: newNode
|
|
793
|
+
? (id) => {
|
|
794
|
+
setNewNodeEditable(Boolean(id));
|
|
795
|
+
}
|
|
796
|
+
: undefined })] }) }) }) }));
|
|
313
797
|
});
|
|
798
|
+
TableTreeFn.displayName = 'TableTreeFn';
|
|
314
799
|
export default TableTreeFn;
|
|
315
800
|
//# sourceMappingURL=TableTreeFn.js.map
|