@topconsultnpm/sdkui-react 6.22.0-dev2.9 → 6.22.0-dev3.10
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/components/NewComponents/ContextMenu/TMContextMenu.js +3 -3
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +1 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +14 -14
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +6 -6
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +31 -31
- package/lib/components/base/Styled.d.ts +4 -4
- package/lib/components/base/Styled.js +7 -5
- package/lib/components/base/TMAccordionNew.js +7 -7
- package/lib/components/base/TMAlert.d.ts +32 -32
- package/lib/components/base/TMAreaManager.js +1 -1
- package/lib/components/base/TMButton.js +4 -4
- package/lib/components/base/TMClosableList.js +3 -3
- package/lib/components/base/TMCustomButton.js +1 -1
- package/lib/components/base/TMDataGrid.d.ts +4 -0
- package/lib/components/base/TMDataGrid.js +292 -12
- package/lib/components/base/TMDropDownMenu.js +1 -1
- package/lib/components/base/TMEditorBase.d.ts +2 -0
- package/lib/components/base/TMFileManager.js +5 -3
- package/lib/components/base/TMFileManagerDataGridView.js +12 -3
- package/lib/components/base/TMFileManagerThumbnailItems.js +20 -10
- package/lib/components/base/TMFileManagerUtils.d.ts +4 -2
- package/lib/components/base/TMFileManagerUtils.js +37 -1
- package/lib/components/base/TMLayout.d.ts +2 -2
- package/lib/components/base/TMLayout.js +3 -3
- package/lib/components/base/TMList.js +1 -1
- package/lib/components/base/TMListView.js +3 -3
- package/lib/components/base/TMModal.d.ts +11 -0
- package/lib/components/base/TMModal.js +47 -13
- package/lib/components/base/TMPanel.d.ts +6 -0
- package/lib/components/base/TMPanel.js +141 -28
- package/lib/components/base/TMPopUp.js +5 -2
- package/lib/components/base/TMResizableMenu.js +2 -2
- package/lib/components/base/TMRightSidebar.js +1 -1
- package/lib/components/base/TMShowAllOrMaxItemsButton.js +1 -1
- package/lib/components/base/TMSpinner.js +2 -2
- package/lib/components/base/TMTab.js +2 -2
- package/lib/components/base/TMTabControl.d.ts +101 -0
- package/lib/components/base/TMTabControl.js +653 -0
- package/lib/components/base/TMToggleButton.js +2 -2
- package/lib/components/base/TMToolbarCard.js +3 -3
- package/lib/components/base/TMTooltip.d.ts +2 -1
- package/lib/components/base/TMTooltip.js +24 -8
- package/lib/components/base/TMTreeView.js +123 -70
- package/lib/components/base/TMWaitPanel.js +2 -2
- package/lib/components/choosers/TMCultureIDPicker.js +2 -2
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.js +2 -2
- package/lib/components/choosers/TMDcmtTypeChooser.js +5 -4
- package/lib/components/choosers/TMDiskChooser.js +1 -1
- package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
- package/lib/components/choosers/TMDistinctValues.js +157 -141
- package/lib/components/choosers/TMDynDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMImageIDChooser.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +3 -3
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +12 -0
- package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
- package/lib/components/choosers/TMRelationChooser.js +1 -1
- package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
- package/lib/components/choosers/TMSelectedValuesSummary.js +89 -0
- package/lib/components/choosers/TMUserChooser.js +1 -1
- package/lib/components/editors/TMCheckBox.js +1 -1
- package/lib/components/editors/TMDropDown.d.ts +3 -0
- package/lib/components/editors/TMDropDown.js +197 -5
- package/lib/components/editors/TMEditorStyled.d.ts +10 -10
- package/lib/components/editors/TMFormulaEditor.js +1 -1
- package/lib/components/editors/TMHtmlContentDisplay.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.js +1 -1
- package/lib/components/editors/TMMetadataValues.js +6 -6
- package/lib/components/editors/TMRadioButton.js +2 -2
- package/lib/components/editors/TMSummary.js +3 -3
- package/lib/components/editors/TMTextArea.js +3 -3
- package/lib/components/editors/TMTextBox.js +3 -3
- package/lib/components/editors/TMTextExpression.js +1 -1
- package/lib/components/features/archive/TMArchive.js +17 -3
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +2 -2
- package/lib/components/features/assistant/TMToppySpeechBubble.js +1 -1
- package/lib/components/features/documents/TMBatchUpdateForm.js +20 -6
- package/lib/components/features/documents/TMCopyToFolderForm.js +61 -22
- package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
- package/lib/components/features/documents/TMDcmtBlog.js +4 -4
- package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtForm.js +181 -54
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +11 -0
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +79 -9
- package/lib/components/features/documents/TMDcmtIcon.js +5 -3
- package/lib/components/features/documents/TMDcmtPreview.js +12 -8
- package/lib/components/features/documents/TMDownloadRelationViewerSection.js +1 -1
- package/lib/components/features/documents/TMFileUploader.js +3 -3
- package/lib/components/features/documents/TMMasterDetailDcmts.js +116 -34
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +19 -0
- package/lib/components/features/documents/TMMasterInfoFields.js +184 -0
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +1 -2
- package/lib/components/features/documents/TMMergeToPdfForm.js +42 -10
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +45 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +321 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +24 -3
- package/lib/components/features/documents/TMRelationViewer.js +110 -52
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +1 -1
- package/lib/components/features/search/TMMetadataOutputForm.js +1 -1
- package/lib/components/features/search/TMMetadataSorterForm.js +1 -1
- package/lib/components/features/search/TMSavedQuerySelector.js +2 -2
- package/lib/components/features/search/TMSearch.d.ts +1 -2
- package/lib/components/features/search/TMSearch.js +146 -21
- package/lib/components/features/search/TMSearchQueryEditor.js +7 -5
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +4 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +142 -68
- package/lib/components/features/search/TMSearchResult.d.ts +16 -0
- package/lib/components/features/search/TMSearchResult.js +439 -110
- package/lib/components/features/search/TMSignatureInfoContent.js +1 -1
- package/lib/components/features/search/TMTreeSelector.js +121 -70
- package/lib/components/features/tasks/TMTaskForm.js +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.js +3 -3
- package/lib/components/features/tasks/TMTasksAgenda.js +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.js +1 -1
- package/lib/components/features/tasks/TMTasksHeader.js +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.js +1 -1
- package/lib/components/features/tasks/TMTasksView.js +7 -13
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +1 -1
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +10 -0
- package/lib/components/features/workflow/TMWorkflowPopup.js +9 -5
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +3 -3
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +4 -4
- package/lib/components/forms/Login/Menu.js +1 -1
- package/lib/components/forms/Login/OTPReader.js +1 -1
- package/lib/components/forms/Login/PasswordStrengthChecker.js +1 -1
- package/lib/components/forms/Login/RapidAccessLogin.js +2 -2
- package/lib/components/forms/Login/RecoverPasswordFlow.js +2 -2
- package/lib/components/forms/Login/SelectBox.js +1 -1
- package/lib/components/forms/Login/StepIndicator.js +1 -1
- package/lib/components/forms/Login/TMLoginForm.js +7 -7
- package/lib/components/forms/Login/TextBox.js +1 -1
- package/lib/components/forms/TMApplyForm.js +3 -3
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +3 -3
- package/lib/components/grids/TMBlogAttachments.js +14 -3
- package/lib/components/grids/TMBlogHeader.js +5 -1
- package/lib/components/grids/TMBlogsPost.d.ts +2 -0
- package/lib/components/grids/TMBlogsPost.js +31 -4
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +15 -4
- package/lib/components/grids/TMRecentsManager.js +4 -4
- package/lib/components/grids/TMValidationItemsList.js +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +25 -15
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +1 -1
- package/lib/components/layout/panelManager/TMPanelWrapper.js +3 -3
- package/lib/components/layout/panelManager/types.d.ts +3 -0
- package/lib/components/layout/panelManager/utils.js +13 -11
- package/lib/components/pages/TMPage.js +1 -1
- package/lib/components/query/TMQueryCountButton.js +1 -1
- package/lib/components/query/TMQueryEditor.js +7 -7
- package/lib/components/sidebar/TMCommandsPanel.js +1 -1
- package/lib/components/sidebar/TMHeader.js +36 -26
- package/lib/components/sidebar/TMSidebar.js +1 -1
- package/lib/components/sidebar/TMSidebarItem.js +1 -1
- package/lib/components/viewers/TMMidViewer.js +6 -3
- package/lib/components/viewers/TMTidViewer.js +89 -28
- package/lib/components/wizard/TMStepIndicator.js +3 -3
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/devextreme-license.d.ts +1 -0
- package/lib/devextreme-license.js +3 -0
- package/lib/helper/Enum_Localizator.d.ts +4 -4
- package/lib/helper/Globalization.d.ts +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +110 -0
- package/lib/helper/SDKUI_Globals.js +151 -0
- package/lib/helper/SDKUI_Localizator.d.ts +735 -687
- package/lib/helper/SDKUI_Localizator.js +480 -0
- package/lib/helper/TMAppUpdatedModal.d.ts +1 -0
- package/lib/helper/TMAppUpdatedModal.js +134 -0
- package/lib/helper/TMIcons.d.ts +1 -0
- package/lib/helper/TMIcons.js +4 -3
- package/lib/helper/TMPdfViewer.js +1 -1
- package/lib/helper/TMToppyMessage.js +1 -1
- package/lib/helper/TMUtils.d.ts +13 -0
- package/lib/helper/TMUtils.js +25 -3
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +1 -1
- package/lib/helper/dataGridSearchHelper.d.ts +28 -0
- package/lib/helper/dataGridSearchHelper.js +51 -0
- package/lib/helper/dcmtsHelper.d.ts +20 -0
- package/lib/helper/dcmtsHelper.js +58 -1
- package/lib/helper/helpers.d.ts +12 -1
- package/lib/helper/helpers.js +27 -3
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +6 -1
- package/lib/helper/queryHelper.js +8 -3
- package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
- package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
- package/lib/hooks/useArchiveListForm.d.ts +39 -0
- package/lib/hooks/useArchiveListForm.js +46 -0
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/hooks/useDataUserIdItem.d.ts +1 -0
- package/lib/hooks/useDataUserIdItem.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +7 -0
- package/lib/hooks/useDcmtOperations.js +141 -71
- package/lib/hooks/useDocumentOperations.d.ts +4 -0
- package/lib/hooks/useDocumentOperations.js +53 -11
- package/lib/hooks/useInputDialog.js +1 -1
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +113 -0
- package/lib/hooks/useMultiMasterDetailDcmts.js +760 -0
- package/lib/hooks/useQueryParametersDialog.js +1 -1
- package/lib/hooks/useRelatedDocuments.d.ts +1 -0
- package/lib/hooks/useRelatedDocuments.js +22 -27
- package/lib/hooks/useShowDossiersV5.d.ts +12 -0
- package/lib/hooks/useShowDossiersV5.js +37 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
- package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
- package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
- package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
- package/lib/hooks/useTMDistinctValuesSource.js +105 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -2
- package/lib/services/caseflow/CaseFlowService.d.ts +247 -0
- package/lib/services/caseflow/CaseFlowService.js +720 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/lib/services/platform_services.d.ts +4 -4
- package/package.json +16 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import TMRightSidebar from './TMRightSidebar';
|
|
4
4
|
import { IconArrowLeft, SDKUI_Localizator } from '../../helper';
|
|
@@ -46,8 +46,8 @@ const StyledSearchCardContent = styled.div `
|
|
|
46
46
|
-webkit-user-select: none;
|
|
47
47
|
`;
|
|
48
48
|
const TMToolbarCard = ({ items = [], onItemClick, selectedItem, showPanel, color = TMColors.colorHeader, backgroundColor = TMColors.backgroundColorHeader, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '3px', onBack, onClose, onHeaderDoubleClick }) => {
|
|
49
|
-
return (_jsxs(StyledSearchCard, { children: [showHeader && _jsx(StyledSearchCardHeader, {
|
|
50
|
-
onHeaderDoubleClick(); }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx("div", { style: { backgroundColor: 'white', minWidth: '24px', minHeight: '24px', borderRadius: '24px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconArrowLeft, { color: TMColors.primaryColor }) }), caption: SDKUI_Localizator.Back, onClick: onBack }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("p", { children: title }), Boolean(displayedItemsCount && displayedItemsCount > 0) && (_jsxs(_Fragment, { children: [_jsx(StyledBadge, {
|
|
49
|
+
return (_jsxs(StyledSearchCard, { children: [showHeader && _jsx(StyledSearchCardHeader, { $backgroundColor: backgroundColor, $color: color, onDoubleClick: () => { if (onHeaderDoubleClick)
|
|
50
|
+
onHeaderDoubleClick(); }, children: _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '8px' }, children: [onBack && _jsx(TMButton, { btnStyle: 'icon', icon: _jsx("div", { style: { backgroundColor: 'white', minWidth: '24px', minHeight: '24px', borderRadius: '24px', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: _jsx(IconArrowLeft, { color: TMColors.primaryColor }) }), caption: SDKUI_Localizator.Back, onClick: onBack }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: [_jsx("p", { children: title }), Boolean(displayedItemsCount && displayedItemsCount > 0) && (_jsxs(_Fragment, { children: [_jsx(StyledBadge, { $backgroundColor: '#679CE8', children: displayedItemsCount }), Boolean(totalItems && totalItems > 0) && _jsx("span", { children: "\u00A0\u00A0/\u00A0" })] })), Boolean(totalItems && totalItems > 0) && _jsx(StyledBadge, { $backgroundColor: '#679CE8', children: totalItems })] })] }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', gap: '5px' }, children: [toolbar, onClose && _jsx(TMButton, { color: 'primaryOutline', caption: SDKUI_Localizator.Close, icon: _jsx("i", { className: 'dx-icon-remove', style: { color: "white" } }), btnStyle: 'icon', onClick: () => onClose?.() })] })] }) }), _jsxs(StyledSearchCardContent, { $height: showHeader ? "calc(100% - 35px)" : "100%", $padding: padding, $backgroundColor: backgroundColorContainer ?? `${TMColors.backgroundColorHeader}12`, children: [_jsx("div", { style: { width: items.length > 0 ? 'calc(100% - 30px)' : '100%' }, children: children }), items.length > 0 &&
|
|
51
51
|
_jsx(TMRightSidebar, { items: items, onItemClick: onItemClick, selectedItem: selectedItem, showPanel: showPanel })] })] }));
|
|
52
52
|
};
|
|
53
53
|
export default TMToolbarCard;
|
|
@@ -9,6 +9,7 @@ interface ITMTooltipProps extends ITooltipOptions {
|
|
|
9
9
|
hideAfterDelay?: boolean;
|
|
10
10
|
parentStyle?: React.CSSProperties;
|
|
11
11
|
childStyle?: React.CSSProperties;
|
|
12
|
+
allowContentInteraction?: boolean;
|
|
12
13
|
}
|
|
13
|
-
declare const TMTooltip: ({ children, position, content, hideAfterDelay, parentStyle, childStyle }: ITMTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const TMTooltip: ({ children, position, content, hideAfterDelay, parentStyle, childStyle, allowContentInteraction }: ITMTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export default TMTooltip;
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { Tooltip } from 'devextreme-react/tooltip';
|
|
4
4
|
import { genUniqueId } from '../../helper';
|
|
5
5
|
import { DeviceType, useDeviceType } from './TMDeviceProvider';
|
|
6
|
-
|
|
6
|
+
/** Tempo per spostare il mouse dall'elemento al contenuto del tooltip, quando è interattivo */
|
|
7
|
+
const HIDE_DELAY_MS = 400;
|
|
8
|
+
const TMTooltip = ({ children, position, content, hideAfterDelay, parentStyle, childStyle, allowContentInteraction = false }) => {
|
|
7
9
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
8
|
-
const [id
|
|
9
|
-
|
|
10
|
+
const [id] = useState(() => genUniqueId());
|
|
11
|
+
const hideTimerRef = useRef();
|
|
10
12
|
useEffect(() => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
const hide = () => setShowTooltip(false);
|
|
14
|
+
window.addEventListener('click', hide);
|
|
15
|
+
return () => window.removeEventListener('click', hide);
|
|
13
16
|
}, []);
|
|
17
|
+
useEffect(() => { return () => clearTimeout(hideTimerRef.current); }, []);
|
|
14
18
|
const deviceType = useDeviceType();
|
|
15
|
-
|
|
19
|
+
const cancelHide = () => clearTimeout(hideTimerRef.current);
|
|
20
|
+
const show = () => { cancelHide(); setShowTooltip(true); };
|
|
21
|
+
const hide = () => {
|
|
22
|
+
cancelHide();
|
|
23
|
+
if (!allowContentInteraction) {
|
|
24
|
+
setShowTooltip(false);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
hideTimerRef.current = setTimeout(() => setShowTooltip(false), HIDE_DELAY_MS);
|
|
28
|
+
};
|
|
29
|
+
return (_jsxs("div", { style: parentStyle, children: [_jsx("div", { id: `idContainerTooltip${id}`, style: { display: 'flex', alignItems: 'center', height: 'max-content', width: 'max-content', ...childStyle }, onMouseEnter: show, onMouseLeave: hide, onTouchStart: show, onClick: () => { if (deviceType === DeviceType.DESKTOP || !hideAfterDelay)
|
|
16
30
|
return; setTimeout(() => { setShowTooltip(false); }, 1500); }, onTouchEnd: () => { if (deviceType === DeviceType.DESKTOP || !hideAfterDelay)
|
|
17
31
|
return; setTimeout(() => { setShowTooltip(false); }, 1500); }, children: children }), content &&
|
|
18
|
-
_jsx(Tooltip, { target: `#idContainerTooltip${id}`, hideOnOutsideClick: true, visible: showTooltip, position: position ?? 'bottom', onHidden: () => setShowTooltip(false), children:
|
|
32
|
+
_jsx(Tooltip, { target: `#idContainerTooltip${id}`, hideOnOutsideClick: true, visible: showTooltip, position: position ?? 'bottom', onHidden: () => setShowTooltip(false), children: allowContentInteraction
|
|
33
|
+
? _jsx("div", { style: { pointerEvents: 'all' }, onMouseEnter: cancelHide, onMouseLeave: hide, children: content })
|
|
34
|
+
: content })] }));
|
|
19
35
|
};
|
|
20
36
|
export default TMTooltip;
|
|
@@ -20,7 +20,7 @@ const VirtualRowComponent = memo(({ ariaAttributes, index, style, flattenedItems
|
|
|
20
20
|
minWidth: '100%',
|
|
21
21
|
paddingRight: 10,
|
|
22
22
|
boxSizing: 'border-box'
|
|
23
|
-
}, children: _jsxs(StyledTreeNode, {
|
|
23
|
+
}, children: _jsxs(StyledTreeNode, { $isSelected: isSelected, children: [_jsx("div", { style: {
|
|
24
24
|
display: 'flex',
|
|
25
25
|
alignItems: 'center',
|
|
26
26
|
justifyContent: 'center',
|
|
@@ -54,13 +54,16 @@ const VirtualRowComponent = memo(({ ariaAttributes, index, style, flattenedItems
|
|
|
54
54
|
return prevItem === nextItem;
|
|
55
55
|
const prevNode = prevItem.node;
|
|
56
56
|
const nextNode = nextItem.node;
|
|
57
|
-
// Controlla se questa riga specifica è cambiata
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// Controlla se questa riga specifica è cambiata: confronta l'identità del nodo (non i soli
|
|
58
|
+
// campi key/expanded) per non lasciare visualizzato un nodo obsoleto. Gli handler non servono:
|
|
59
|
+
// hanno identità stabile e leggono lo stato dalle ref.
|
|
60
|
+
return (prevNode === nextNode &&
|
|
60
61
|
prevItem.depth === nextItem.depth &&
|
|
61
62
|
(prevNode.key === prevProps.focusedItemKey) === (nextNode.key === nextProps.focusedItemKey) &&
|
|
62
63
|
prevProps.selectedItemKeys.has(prevNode.key) === nextProps.selectedItemKeys.has(nextNode.key) &&
|
|
63
|
-
prevProps.allowMultipleSelection === nextProps.allowMultipleSelection
|
|
64
|
+
prevProps.allowMultipleSelection === nextProps.allowMultipleSelection &&
|
|
65
|
+
prevProps.itemRender === nextProps.itemRender &&
|
|
66
|
+
prevProps.onItemContextMenu === nextProps.onItemContextMenu);
|
|
64
67
|
});
|
|
65
68
|
const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, onItemContextMenu, autoSelectChildren = true, itemsPerPage = 100, showLoadMoreButton = true, enableVirtualization = false }) => {
|
|
66
69
|
// Altezza fissa per ogni riga nella virtualizzazione
|
|
@@ -71,12 +74,35 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
71
74
|
// Ref per selectedItems - permette alle callback memoizzate di accedere sempre al valore più recente
|
|
72
75
|
const selectedItemsRef = useRef(selectedItems);
|
|
73
76
|
selectedItemsRef.current = selectedItems;
|
|
77
|
+
// Ref per props e callback usate dagli handler: una riga virtualizzata memoizzata conserva le
|
|
78
|
+
// props del render precedente, quindi gli handler non devono catturare lo stato nella closure.
|
|
79
|
+
const dataSourceRef = useRef(dataSource);
|
|
80
|
+
dataSourceRef.current = dataSource;
|
|
81
|
+
const autoSelectChildrenRef = useRef(autoSelectChildren);
|
|
82
|
+
autoSelectChildrenRef.current = autoSelectChildren;
|
|
83
|
+
const calculateItemsForNodeRef = useRef(calculateItemsForNode);
|
|
84
|
+
calculateItemsForNodeRef.current = calculateItemsForNode;
|
|
85
|
+
const onNodeUpdateRef = useRef(onNodeUpdate);
|
|
86
|
+
onNodeUpdateRef.current = onNodeUpdate;
|
|
87
|
+
const onDataChangedRef = useRef(onDataChanged);
|
|
88
|
+
onDataChangedRef.current = onDataChanged;
|
|
89
|
+
const onFocusedItemChangedRef = useRef(onFocusedItemChanged);
|
|
90
|
+
onFocusedItemChangedRef.current = onFocusedItemChanged;
|
|
91
|
+
const onSelectionChangedRef = useRef(onSelectionChanged);
|
|
92
|
+
onSelectionChangedRef.current = onSelectionChanged;
|
|
93
|
+
const shouldDelayFocusOnEventRef = useRef(shouldDelayFocusOnEvent);
|
|
94
|
+
shouldDelayFocusOnEventRef.current = shouldDelayFocusOnEvent;
|
|
74
95
|
// Ref per handleCheckboxChange - permette all'useEffect di accedere alla funzione prima che sia definita
|
|
75
96
|
const handleCheckboxChangeRef = useRef(() => { });
|
|
76
97
|
// Filtra gli items da mostrare in base alla paginazione (definito prima per essere usato da flattenTreeWithDepth)
|
|
77
98
|
const getVisibleItems = useCallback((node) => {
|
|
78
99
|
if (!node.items)
|
|
79
100
|
return [];
|
|
101
|
+
// Con la virtualizzazione react-window renderizza già solo le righe visibili:
|
|
102
|
+
// la paginazione nasconderebbe gli items oltre itemsPerPage senza renderizzare
|
|
103
|
+
// il paginatore, presente solo nel render standard (renderTree).
|
|
104
|
+
if (enableVirtualization)
|
|
105
|
+
return node.items;
|
|
80
106
|
const totalItems = node.items.length;
|
|
81
107
|
// Se non c'è paginazione attiva o gli items sono pochi, mostra tutti
|
|
82
108
|
if (totalItems <= itemsPerPage || !showLoadMoreButton) {
|
|
@@ -87,7 +113,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
87
113
|
const startIndex = currentPage * itemsPerPage;
|
|
88
114
|
const endIndex = startIndex + itemsPerPage;
|
|
89
115
|
return node.items.slice(startIndex, endIndex);
|
|
90
|
-
}, [itemsPerPage, showLoadMoreButton]);
|
|
116
|
+
}, [itemsPerPage, showLoadMoreButton, enableVirtualization]);
|
|
91
117
|
// Misura le dimensioni del container per react-window
|
|
92
118
|
useEffect(() => {
|
|
93
119
|
if (!enableVirtualization || !containerRef.current)
|
|
@@ -121,15 +147,26 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
121
147
|
return [];
|
|
122
148
|
return flattenTreeWithDepth(dataSource);
|
|
123
149
|
}, [enableVirtualization, dataSource, flattenTreeWithDepth]);
|
|
150
|
+
// Chiave dell'ultimo elemento verso cui si è effettivamente scrollato.
|
|
151
|
+
// Evita di ripetere lo scroll quando cambia solo la struttura dell'albero
|
|
152
|
+
// (es. espansione di un nodo) a parità di elemento focalizzato.
|
|
153
|
+
const lastScrolledKeyRef = useRef(undefined);
|
|
124
154
|
// Scroll verso l'elemento focalizzato quando cambia (navigazione con frecce)
|
|
125
155
|
useEffect(() => {
|
|
126
|
-
if (!focusedItem?.key)
|
|
156
|
+
if (!focusedItem?.key) {
|
|
157
|
+
lastScrolledKeyRef.current = undefined;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// Focus invariato: l'effect è stato rieseguito solo perché l'albero è cambiato
|
|
161
|
+
// (espansione/collasso di un nodo). La posizione di scroll non va toccata.
|
|
162
|
+
if (lastScrolledKeyRef.current === focusedItem.key)
|
|
127
163
|
return;
|
|
128
164
|
if (enableVirtualization) {
|
|
129
165
|
// Lista virtualizzata: usa scrollToRow per garantire che l'elemento sia visibile
|
|
130
166
|
const index = flattenedItems.findIndex(item => item.node.key === focusedItem.key);
|
|
131
167
|
if (index >= 0 && listRef.current) {
|
|
132
168
|
listRef.current.scrollToRow({ index, align: 'smart' });
|
|
169
|
+
lastScrolledKeyRef.current = focusedItem.key;
|
|
133
170
|
}
|
|
134
171
|
}
|
|
135
172
|
else {
|
|
@@ -138,6 +175,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
138
175
|
const element = containerRef.current.querySelector(`[data-node-key="${focusedItem.key}"]`);
|
|
139
176
|
if (element) {
|
|
140
177
|
element.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
178
|
+
lastScrolledKeyRef.current = focusedItem.key;
|
|
141
179
|
}
|
|
142
180
|
}
|
|
143
181
|
}
|
|
@@ -211,7 +249,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
211
249
|
const currentIndex = flatList.findIndex(item => item.key === currentItem.key);
|
|
212
250
|
return flatList[currentIndex - 1] || null;
|
|
213
251
|
};
|
|
214
|
-
const flattenTree = (nodes) => {
|
|
252
|
+
const flattenTree = useCallback((nodes) => {
|
|
215
253
|
let flatList = [];
|
|
216
254
|
nodes.forEach(node => {
|
|
217
255
|
if (!node.hidden) {
|
|
@@ -222,45 +260,57 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
222
260
|
}
|
|
223
261
|
});
|
|
224
262
|
return flatList;
|
|
225
|
-
};
|
|
226
|
-
const
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
if (node.key === key) {
|
|
230
|
-
if (node.expanded) {
|
|
231
|
-
// Collassa il nodo
|
|
232
|
-
const updatedNode = { ...node, expanded: false };
|
|
233
|
-
onNodeUpdate?.(updatedNode);
|
|
234
|
-
return updatedNode;
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
// Espandi il nodo
|
|
238
|
-
let newItems = node.items;
|
|
239
|
-
// Solo se calculateItemsForNode è definito E (ctrl è premuto O non è già caricato)
|
|
240
|
-
if (calculateItemsForNode && (ctrlKey || !node.isLoaded)) {
|
|
241
|
-
// Se ctrl è premuto, passa un nodo con isLoaded resettato per forzare il refresh
|
|
242
|
-
const nodeForCalculation = ctrlKey ? { ...node, isLoaded: false } : node;
|
|
243
|
-
newItems = await calculateItemsForNode(nodeForCalculation);
|
|
244
|
-
const updatedNode = { ...node, expanded: true, items: newItems, isLoaded: true };
|
|
245
|
-
onNodeUpdate?.(updatedNode);
|
|
246
|
-
return updatedNode;
|
|
247
|
-
}
|
|
248
|
-
// Altrimenti usa semplicemente gli items esistenti
|
|
249
|
-
return { ...node, expanded: true };
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (node.items) {
|
|
253
|
-
const updatedItems = await updateNodeRecursively(node.items);
|
|
254
|
-
return { ...node, items: updatedItems };
|
|
255
|
-
}
|
|
263
|
+
}, []);
|
|
264
|
+
const findNodeByKey = useCallback((nodes, key) => {
|
|
265
|
+
for (const node of nodes) {
|
|
266
|
+
if (node.key === key)
|
|
256
267
|
return node;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
if (node.items) {
|
|
269
|
+
const found = findNodeByKey(node.items, key);
|
|
270
|
+
if (found)
|
|
271
|
+
return found;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return null;
|
|
275
|
+
}, []);
|
|
276
|
+
const handleNodeToggle = useCallback(async (key, ctrlKey) => {
|
|
277
|
+
// dataSourceRef è letta alla chiamata, non alla creazione della closure
|
|
278
|
+
const target = findNodeByKey(dataSourceRef.current, key);
|
|
279
|
+
if (!target)
|
|
280
|
+
return;
|
|
281
|
+
const calculateItems = calculateItemsForNodeRef.current;
|
|
282
|
+
let updatedNode;
|
|
283
|
+
if (target.expanded) {
|
|
284
|
+
// Collassa il nodo
|
|
285
|
+
updatedNode = { ...target, expanded: false };
|
|
286
|
+
onNodeUpdateRef.current?.(updatedNode);
|
|
287
|
+
}
|
|
288
|
+
else if (calculateItems && (ctrlKey || !target.isLoaded)) {
|
|
289
|
+
// Espandi il nodo caricando gli items.
|
|
290
|
+
// Solo se calculateItemsForNode è definito E (ctrl è premuto O non è già caricato).
|
|
291
|
+
// Se ctrl è premuto, passa un nodo con isLoaded resettato per forzare il refresh.
|
|
292
|
+
const nodeForCalculation = ctrlKey ? { ...target, isLoaded: false } : target;
|
|
293
|
+
const newItems = await calculateItems(nodeForCalculation);
|
|
294
|
+
updatedNode = { ...target, expanded: true, items: newItems, isLoaded: true };
|
|
295
|
+
onNodeUpdateRef.current?.(updatedNode);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
// Altrimenti usa semplicemente gli items esistenti
|
|
299
|
+
updatedNode = { ...target, expanded: true };
|
|
300
|
+
}
|
|
301
|
+
// Rimpiazzo sull'albero riletto dopo l'await: non sovrascrive i toggle fatti durante la fetch
|
|
302
|
+
let replaced = false;
|
|
303
|
+
const replaceNode = (nodes) => nodes.map(node => {
|
|
304
|
+
if (!replaced && node.key === key) {
|
|
305
|
+
replaced = true;
|
|
306
|
+
return updatedNode;
|
|
307
|
+
}
|
|
308
|
+
if (node.items)
|
|
309
|
+
return { ...node, items: replaceNode(node.items) };
|
|
310
|
+
return node;
|
|
262
311
|
});
|
|
263
|
-
|
|
312
|
+
onDataChangedRef.current?.(replaceNode(dataSourceRef.current));
|
|
313
|
+
}, [findNodeByKey]);
|
|
264
314
|
// Ref per distinguere click singolo/doppio sulla riga (esempio TMDcmtIcon)
|
|
265
315
|
const clickTimeoutRef = useRef(null);
|
|
266
316
|
const lastClickedNodeKeyRef = useRef(undefined);
|
|
@@ -271,7 +321,8 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
271
321
|
return;
|
|
272
322
|
}
|
|
273
323
|
// Se shouldDelayFocusOnEvent non è fornita, il comportamento predefinito è il focus immediato (false)
|
|
274
|
-
const
|
|
324
|
+
const shouldDelay = shouldDelayFocusOnEventRef.current;
|
|
325
|
+
const delayFocus = shouldDelay ? shouldDelay(node, e) : false;
|
|
275
326
|
// Reset del timer se il click è su un nodo diverso dal precedente
|
|
276
327
|
if (lastClickedNodeKeyRef.current && lastClickedNodeKeyRef.current !== node.key) {
|
|
277
328
|
if (clickTimeoutRef.current) {
|
|
@@ -287,7 +338,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
287
338
|
// Primo click: imposta il timer per il focus
|
|
288
339
|
lastClickedNodeKeyRef.current = node.key;
|
|
289
340
|
clickTimeoutRef.current = setTimeout(() => {
|
|
290
|
-
|
|
341
|
+
onFocusedItemChangedRef.current?.(node);
|
|
291
342
|
clickTimeoutRef.current = null;
|
|
292
343
|
lastClickedNodeKeyRef.current = undefined;
|
|
293
344
|
}, 200);
|
|
@@ -302,12 +353,14 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
302
353
|
clickTimeoutRef.current = null;
|
|
303
354
|
lastClickedNodeKeyRef.current = undefined;
|
|
304
355
|
}
|
|
305
|
-
|
|
356
|
+
onFocusedItemChangedRef.current?.(node); // Chiama onFocusedItemChanged immediatamente
|
|
306
357
|
}
|
|
307
|
-
}, [
|
|
358
|
+
}, []);
|
|
308
359
|
const handleCheckboxChange = useCallback((node, checked) => {
|
|
309
|
-
// Usa
|
|
360
|
+
// Usa le ref per accedere sempre ai valori più recenti
|
|
310
361
|
const currentSelectedItems = selectedItemsRef.current;
|
|
362
|
+
const currentDataSource = dataSourceRef.current;
|
|
363
|
+
const autoSelect = autoSelectChildrenRef.current;
|
|
311
364
|
// Funzione helper per trovare il parent di un nodo e verificare se tutti i suoi figli sono selezionati
|
|
312
365
|
const findAndCheckParents = (items, targetNode, currentSelection) => {
|
|
313
366
|
const parentsToAdd = [];
|
|
@@ -341,7 +394,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
341
394
|
};
|
|
342
395
|
let newSelectedItems;
|
|
343
396
|
if (checked) {
|
|
344
|
-
if (node.isContainer &&
|
|
397
|
+
if (node.isContainer && autoSelect) {
|
|
345
398
|
// Quando selezioni un container, aggiungi il container stesso + tutti i figli (se autoSelectChildren è true)
|
|
346
399
|
const allChildren = flattenTree(node.items || []);
|
|
347
400
|
// Rimuovi eventuali duplicati: filtra gli elementi già presenti nella selezione
|
|
@@ -353,8 +406,8 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
353
406
|
// Quando selezioni un figlio o un container con autoSelectChildren=false, aggiungi solo il nodo
|
|
354
407
|
newSelectedItems = [...currentSelectedItems, node];
|
|
355
408
|
// Verifica se selezionando questo figlio sono ora selezionati tutti i figli del parent (solo se autoSelectChildren è true)
|
|
356
|
-
if (
|
|
357
|
-
const parentsToAdd = findAndCheckParents(
|
|
409
|
+
if (autoSelect) {
|
|
410
|
+
const parentsToAdd = findAndCheckParents(currentDataSource, node, newSelectedItems);
|
|
358
411
|
newSelectedItems = [...newSelectedItems, ...parentsToAdd];
|
|
359
412
|
}
|
|
360
413
|
}
|
|
@@ -362,7 +415,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
362
415
|
newSelectedItems = currentSelectedItems;
|
|
363
416
|
}
|
|
364
417
|
}
|
|
365
|
-
else if (node.isContainer &&
|
|
418
|
+
else if (node.isContainer && autoSelect) {
|
|
366
419
|
// Quando deselezioni un container, rimuovi il container stesso + tutti i figli (solo se autoSelectChildren è true)
|
|
367
420
|
const childKeys = flattenTree(node.items || []).map(item => item.key);
|
|
368
421
|
newSelectedItems = currentSelectedItems.filter(item => item.key !== node.key && !childKeys.includes(item.key));
|
|
@@ -371,7 +424,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
371
424
|
// Quando deselezioni un figlio o un container con autoSelectChildren=false, rimuovi solo il nodo
|
|
372
425
|
newSelectedItems = currentSelectedItems.filter(item => item.key !== node.key);
|
|
373
426
|
// Se il figlio apparteneva a un parent che era selezionato, rimuovi anche il parent (solo se autoSelectChildren è true)
|
|
374
|
-
if (
|
|
427
|
+
if (autoSelect && !node.isContainer) {
|
|
375
428
|
const removeParentContainers = (items) => {
|
|
376
429
|
const parentsToRemove = [];
|
|
377
430
|
items.forEach(item => {
|
|
@@ -386,26 +439,26 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
386
439
|
});
|
|
387
440
|
return parentsToRemove;
|
|
388
441
|
};
|
|
389
|
-
const parentsToRemove = removeParentContainers(
|
|
442
|
+
const parentsToRemove = removeParentContainers(currentDataSource);
|
|
390
443
|
newSelectedItems = newSelectedItems.filter(item => !parentsToRemove.includes(item.key));
|
|
391
444
|
}
|
|
392
445
|
}
|
|
393
|
-
|
|
394
|
-
}, [
|
|
446
|
+
onSelectionChangedRef.current?.(newSelectedItems);
|
|
447
|
+
}, [flattenTree]);
|
|
395
448
|
// Aggiorna la ref con l'ultima versione di handleCheckboxChange
|
|
396
449
|
handleCheckboxChangeRef.current = handleCheckboxChange;
|
|
397
|
-
const hasPartialChildSelection = (node) => {
|
|
450
|
+
const hasPartialChildSelection = useCallback((node) => {
|
|
398
451
|
// Lo stato indeterminate ha senso solo quando autoSelectChildren è true
|
|
399
|
-
if (!
|
|
452
|
+
if (!autoSelectChildrenRef.current)
|
|
400
453
|
return false;
|
|
401
454
|
if (!node.isContainer || !node.items)
|
|
402
455
|
return false;
|
|
403
456
|
const childKeys = flattenTree(node.items).map(item => item.key);
|
|
404
|
-
const selectedChildKeys =
|
|
457
|
+
const selectedChildKeys = selectedItemsRef.current.map(item => item.key);
|
|
405
458
|
const selectedCount = childKeys.filter(key => selectedChildKeys.includes(key)).length;
|
|
406
459
|
return selectedCount > 0 && selectedCount < childKeys.length;
|
|
407
|
-
};
|
|
408
|
-
const hasVisibleItems = (node) => {
|
|
460
|
+
}, [flattenTree]);
|
|
461
|
+
const hasVisibleItems = useCallback((node) => {
|
|
409
462
|
// If node has explicit isExpandible value, use that
|
|
410
463
|
if (node.isExpandible !== undefined) {
|
|
411
464
|
return node.isExpandible;
|
|
@@ -416,14 +469,14 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
416
469
|
if (node.items.length <= 0)
|
|
417
470
|
return false;
|
|
418
471
|
return node.items.filter(o => !o.hidden).length > 0;
|
|
419
|
-
};
|
|
472
|
+
}, []);
|
|
420
473
|
// Gestisce il cambio di pagina per un nodo
|
|
421
474
|
const handlePageChange = useCallback((nodeKey, newPage) => {
|
|
422
475
|
const updateNodePage = (nodes) => {
|
|
423
476
|
return nodes.map(node => {
|
|
424
477
|
if (node.key === nodeKey) {
|
|
425
478
|
const updatedNode = { ...node, currentPage: newPage };
|
|
426
|
-
|
|
479
|
+
onNodeUpdateRef.current?.(updatedNode);
|
|
427
480
|
return updatedNode;
|
|
428
481
|
}
|
|
429
482
|
if (node.items) {
|
|
@@ -432,9 +485,9 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
432
485
|
return node;
|
|
433
486
|
});
|
|
434
487
|
};
|
|
435
|
-
const updatedData = updateNodePage(
|
|
436
|
-
|
|
437
|
-
}, [
|
|
488
|
+
const updatedData = updateNodePage(dataSourceRef.current);
|
|
489
|
+
onDataChangedRef.current?.(updatedData);
|
|
490
|
+
}, []);
|
|
438
491
|
// Verifica se c'è bisogno del paginatore
|
|
439
492
|
const needsPagination = useCallback((node) => {
|
|
440
493
|
if (!showLoadMoreButton || !node.items)
|
|
@@ -448,7 +501,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
448
501
|
return Math.ceil(node.items.length / itemsPerPage);
|
|
449
502
|
}, [itemsPerPage]);
|
|
450
503
|
const renderTree = useCallback((nodes) => {
|
|
451
|
-
return nodes.map(node => !node.hidden && (_jsxs("div", { style: { width: 'fit-content', minWidth: '100%', margin: 0, padding: 0 }, children: [_jsxs(StyledTreeNode, {
|
|
504
|
+
return nodes.map(node => !node.hidden && (_jsxs("div", { style: { width: 'fit-content', minWidth: '100%', margin: 0, padding: 0 }, children: [_jsxs(StyledTreeNode, { $isSelected: node.key === focusedItem?.key, "data-node-key": node.key, children: [_jsx("div", { style: {
|
|
452
505
|
display: 'flex',
|
|
453
506
|
alignItems: 'center',
|
|
454
507
|
justifyContent: 'center',
|
|
@@ -474,7 +527,7 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
474
527
|
onItemContextMenu(node, e);
|
|
475
528
|
}
|
|
476
529
|
}, children: itemRender(node) })] }), node.expanded && node.items && (_jsxs("div", { style: { paddingLeft: 20, width: 'fit-content', minWidth: '100%' }, children: [renderTree(getVisibleItems(node)), needsPagination(node) && (_jsxs(StyledStickyPaginator, { children: [_jsx(TMButton, { btnStyle: 'icon', onClick: () => handlePageChange(node.key, (node.currentPage ?? 0) - 1), showTooltip: false, caption: "\u25C4", icon: _jsx(IconArrowLeft, { color: 'white' }), disabled: (node.currentPage ?? 0) <= 0 }), _jsx("span", { style: { fontSize: '11px', whiteSpace: 'nowrap', fontWeight: 500, overflow: 'hidden', textOverflow: 'ellipsis', minWidth: 0, color: 'white' }, children: SDKUI_Localizator.PaginationInfo.replaceParams((node.currentPage ?? 0) + 1, getTotalPages(node), node.items?.length ?? 0) }), _jsx(TMButton, { btnStyle: 'icon', onClick: () => handlePageChange(node.key, (node.currentPage ?? 0) + 1), showTooltip: false, caption: "\u25BA", icon: _jsx(IconArrowRight, { color: 'white' }), disabled: (node.currentPage ?? 0) >= getTotalPages(node) - 1 })] }))] }))] }, node.key)));
|
|
477
|
-
}, [handleNodeClick, handleNodeToggle, handleCheckboxChange, focusedItem, selectedItems, allowMultipleSelection, getVisibleItems, needsPagination, handlePageChange, getTotalPages, onItemContextMenu]);
|
|
530
|
+
}, [handleNodeClick, handleNodeToggle, handleCheckboxChange, hasVisibleItems, hasPartialChildSelection, itemRender, focusedItem, selectedItems, allowMultipleSelection, getVisibleItems, needsPagination, handlePageChange, getTotalPages, onItemContextMenu]);
|
|
478
531
|
// Calcola selectedItemKeys ad ogni render per garantire sincronizzazione con selectedItems
|
|
479
532
|
const selectedItemKeys = new Set(selectedItems.map(s => s.key));
|
|
480
533
|
// Memoizza rowPropsData per evitare re-render della List
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import TMLayoutContainer from './TMLayout';
|
|
@@ -46,7 +46,7 @@ export const TMWaitPanel = (props) => {
|
|
|
46
46
|
};
|
|
47
47
|
let progressValue1 = calculateProgress(valuePrimary, maxValuePrimary);
|
|
48
48
|
let progressValue2 = calculateProgress(valueSecondary, maxValueSecondary);
|
|
49
|
-
return (_jsx(StyledWaitPanelOverlay, {
|
|
49
|
+
return (_jsx(StyledWaitPanelOverlay, { $useHighZIndex: useHighZIndex, children: _jsxs(StyledWaitPanel, { children: [_jsx(StyledTitle, { children: title }), showPrimary &&
|
|
50
50
|
_jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue1.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue1.toFixed(2), "%"] }), _jsx(StyledMessage, { children: textPrimary })] }), showSecondary &&
|
|
51
51
|
_jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue2.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue2.toFixed(2), "%"] }), _jsx(StyledMessage, { children: textSecondary })] }), isCancelable && _jsx(StyledAbortButton, { onClick: () => onAbortClick?.(abortController), children: SDKUI_Localizator.Abort })] }) }));
|
|
52
52
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { IconSearch, SDKUI_Localizator } from '../../helper';
|
|
@@ -64,7 +64,7 @@ const TMCultureIDPicker = ({ selectedValue, onSelectCultureID, placeHolder, widt
|
|
|
64
64
|
const isPlaceholder = selectedValue === placeHolder;
|
|
65
65
|
return (_jsxs(StyledDivHorizontal, { style: { width: '100%', color: isPlaceholder ? '#a9a9a9' : 'inherit' }, children: [selectedValue && _jsx("img", { src: getCultureIDImg(selectedValue), alt: "Lang", width: 16, height: 16, style: { marginRight: '8px' } }), selectedValue && _jsx("p", { children: getCultureIDName(selectedValue) })] }));
|
|
66
66
|
};
|
|
67
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: true, hasValue: selectedValue !== undefined, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowPicker(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, openEditorOnSummaryClick: openChooserBySingleClick, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showPicker && _jsx(TMModal, { title: label || SDKUI_Localizator.Select, onClose: () => setShowPicker(false), isModal: true, width: "450px", height: "255px", children: _jsx(PickerContainer, { children: _jsx(ItemsContainer, { children: CULTUREIDs_DATASOURCE.map(item => (_jsxs(CultureItem, {
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { width: width, icon: icon, buttons: buttons, readOnly: readOnly, backgroundColor: backgroundColor, showBorder: true, hasValue: selectedValue !== undefined, showClearButton: showClearButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => !readOnly && setShowPicker(true), elementStyle: elementStyle, isModifiedWhen: isModifiedWhen, label: label, openEditorOnSummaryClick: openChooserBySingleClick, template: renderTemplate(), onClearClick: showClearButton ? () => { onValueChanged?.([]); } : undefined, validationItems: validationItems }), showPicker && _jsx(TMModal, { title: label || SDKUI_Localizator.Select, onClose: () => setShowPicker(false), isModal: true, width: "450px", height: "255px", children: _jsx(PickerContainer, { children: _jsx(ItemsContainer, { children: CULTUREIDs_DATASOURCE.map(item => (_jsxs(CultureItem, { $isSelected: item.value === selectedValue, onClick: () => {
|
|
68
68
|
onSelectCultureID(item.value);
|
|
69
69
|
setShowPicker(false);
|
|
70
70
|
}, children: [_jsx(FlagIcon, { children: item.icon }), _jsx("span", { children: item.display })] }, item.value))) }) }) })] }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { SDK_Localizator, DataListCacheService } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { StyledDivHorizontal } from '../base/Styled';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import styled, { keyframes } from 'styled-components';
|
|
4
4
|
import { DataListCacheService, SDK_Localizator, ObjectClasses, JobTypes } from '@topconsultnpm/sdk-ts';
|
|
@@ -255,6 +255,6 @@ const TMDataListItemPicker = ({ dataListID, selectedValue, onItemSelect, onItemE
|
|
|
255
255
|
if (!dataList || !items || items.length === 0) {
|
|
256
256
|
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: dataList ? `${SDK_Localizator.DataList}: ${dataList.name}` : SDKUI_Localizator.NoDataToDisplay }), _jsx(ItemsContainer, { children: allowEdit && (_jsxs(AddButton, { onClick: handleCreateNew, children: ["+ ", SDKUI_Localizator.NewMale] })) }), !allowEdit && _jsx("p", { children: SDKUI_Localizator.NoDataToDisplay })] }));
|
|
257
257
|
}
|
|
258
|
-
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: `${SDK_Localizator.DataList}: ${dataList.name}` }), _jsxs(ItemsContainer, { children: [items.map((item, index) => (_jsxs(ItemWrapper, { children: [_jsxs(StatusItem, {
|
|
258
|
+
return (_jsxs(PickerContainer, { children: [_jsx(Label, { children: `${SDK_Localizator.DataList}: ${dataList.name}` }), _jsxs(ItemsContainer, { children: [items.map((item, index) => (_jsxs(ItemWrapper, { children: [_jsxs(StatusItem, { $isSelected: item.value === selectedValue, $index: index, onClick: () => onItemSelect(item), onDoubleClick: () => allowEdit && handleEdit(item), children: [item.imageID && _jsx(TMImageLibrary, { imageID: item.imageID }), _jsx("span", { children: item.name })] }), allowEdit && (_jsx(DeleteButton, { onClick: (e) => handleDelete(item, e), title: SDKUI_Localizator.Delete || 'Delete', "aria-label": "Delete item", children: _jsx(IconDelete, { fontSize: 16 }) }))] }, item.value))), allowEdit && (_jsxs(AddButton, { onClick: handleCreateNew, children: ["+ ", SDKUI_Localizator.NewMale] }))] }), _jsx(TMDataListItemEditor, { isOpen: showEditDialog, item: editingItem, isCreating: isCreating, onClose: handleCloseDialog, onSave: handleSave })] }));
|
|
259
259
|
};
|
|
260
260
|
export default TMDataListItemPicker;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { AccessLevelsEx, DcmtTypeListCacheService, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import TMSpinner from '../base/TMSpinner';
|
|
5
5
|
import { IconSearch, SDKUI_Localizator } from '../../helper';
|
|
6
|
+
import { FontSize } from '../../utils/theme';
|
|
6
7
|
import { StyledDivHorizontal } from '../base/Styled';
|
|
7
8
|
import TMTidViewer, { TMDcmtTypeIcon } from '../viewers/TMTidViewer';
|
|
8
9
|
import TMSummary from '../editors/TMSummary';
|
|
9
10
|
import TMChooserForm from '../forms/TMChooserForm';
|
|
10
|
-
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, filter, accessFilter = 'all', showEditButton = true, borderRadius = '4px', buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged, updateIsModalOpen }) => {
|
|
11
|
+
const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, icon, filter, accessFilter = 'all', showEditButton = true, borderRadius = '4px', fontSize = FontSize.defaultFontSize, buttons = [], placeHolder = `<${SDKUI_Localizator.NoneSelection}>`, openEditorOnSummaryClick, showBorder = true, showId = false, elementStyle, allowMultipleSelection, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, values, isModifiedWhen, label, width, height, showClearButton = false, validationItems = [], onValueChanged, updateIsModalOpen }) => {
|
|
11
12
|
const [showChooser, setShowChooser] = useState(false);
|
|
12
13
|
useEffect(() => {
|
|
13
14
|
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} - ${SDK_Localizator.ListDcmtTypeOrView} ...` });
|
|
@@ -15,9 +16,9 @@ const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, f
|
|
|
15
16
|
DcmtTypeListCacheService.GetFromTIDsAsync(values, false, tms).then(() => { TMSpinner.hide(); });
|
|
16
17
|
}, [values]);
|
|
17
18
|
const renderTemplate = () => {
|
|
18
|
-
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMTidViewer, { tmSession: tmSession, tid: values[0], showIcon: true, showId: showId, noneSelectionText: placeHolder }), values && values.length > 1 && _jsx("p", { style: { marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
19
|
+
return (_jsxs(StyledDivHorizontal, { style: { width: 'max-content', height: '100%' }, children: [values && _jsx(TMTidViewer, { tmSession: tmSession, tid: values[0], color: 'inherit', showIcon: true, showId: showId, noneSelectionText: placeHolder }), values && values.length > 1 && _jsx("p", { style: { margin: 0, marginLeft: '10px' }, children: `(+${values.length - 1} ${values.length == 2 ? 'altro' : 'altri'})` })] }));
|
|
19
20
|
};
|
|
20
|
-
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMSummary, { backgroundColor: backgroundColor, icon: icon, disabled: disabled, fontSize: fontSize, buttons: buttons, showBorder: showBorder, borderRadius: borderRadius, hasValue: values && values.length > 0, showClearButton: showClearButton, showEditButton: showEditButton, iconEditButton: _jsx(IconSearch, { fontSize: 16 }), onEditorClick: () => {
|
|
21
22
|
if (!disabled) {
|
|
22
23
|
setShowChooser(true);
|
|
23
24
|
updateIsModalOpen?.(true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import { StyledDivHorizontal } from '../base/Styled';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LayoutModes } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { TMDistinctValuesEventArgs } from '../../hooks/useTMDistinctValuesSelection';
|
|
3
4
|
interface ITMDistinctValues {
|
|
4
5
|
tid: number | undefined;
|
|
5
6
|
mid: number | undefined;
|
|
@@ -8,14 +9,15 @@ interface ITMDistinctValues {
|
|
|
8
9
|
allowAppendMode?: boolean;
|
|
9
10
|
showHeader?: boolean;
|
|
10
11
|
isModal?: boolean;
|
|
11
|
-
onSelectionChanged?: (e:
|
|
12
|
+
onSelectionChanged?: (e: TMDistinctValuesEventArgs) => void;
|
|
12
13
|
onClosePanelCallback?: () => void;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Pannello da cui si preleva il valore di un campo del form scegliendolo fra quelli già archiviati.
|
|
17
|
+
*
|
|
18
|
+
* Le due sorgenti (valori distinti del metadato e ricerca rapida su una ricerca salvata) stanno in due hook
|
|
19
|
+
* dedicati che espongono la stessa interfaccia (righe, colonne, conteggi): qui restano la composizione,
|
|
20
|
+
* la scelta della sorgente da mostrare e il render.
|
|
21
|
+
*/
|
|
20
22
|
declare const TMDistinctValues: React.FC<ITMDistinctValues>;
|
|
21
23
|
export default TMDistinctValues;
|