@topconsultnpm/sdkui-react-beta 6.13.38 → 6.13.40
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/base/TMPanel.js +29 -11
- package/lib/components/base/TMPanelManager.js +10 -10
- package/lib/components/base/TMPanelManagerToolbar.d.ts +6 -0
- package/lib/components/base/TMPanelManagerToolbar.js +25 -31
- package/lib/components/features/documents/TMDcmtBlog.js +4 -1
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.js +137 -146
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useEffect,
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
3
3
|
import styled from 'styled-components';
|
4
4
|
import { IconArrowLeft, IconClearButton, IconWindowMaximize, IconWindowMinimize, isPositiveNumber, SDKUI_Globals, SDKUI_Localizator } from '../../helper';
|
5
5
|
import TMButton from './TMButton';
|
@@ -68,7 +68,6 @@ const StyledPanelContent = styled.div `
|
|
68
68
|
const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '5px', keepActiveState = false, isVisible = true, onBack, onClose, onHeaderDoubleClick, onMaximize }) => {
|
69
69
|
const [isActive, setIsActive] = useState(false);
|
70
70
|
const [isMaximized, setIsMaximized] = useState(false);
|
71
|
-
const [minWidth, setMinWidth] = useState(undefined);
|
72
71
|
const titleRowRef = useRef(null);
|
73
72
|
// If keepActiveState is true, always force isActive to true
|
74
73
|
useEffect(() => {
|
@@ -83,11 +82,6 @@ const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColor
|
|
83
82
|
if (!keepActiveState)
|
84
83
|
setIsActive(false);
|
85
84
|
};
|
86
|
-
useLayoutEffect(() => {
|
87
|
-
if (titleRowRef.current) {
|
88
|
-
setMinWidth(titleRowRef.current.offsetWidth);
|
89
|
-
}
|
90
|
-
}, [title, displayedItemsCount, totalItems, onBack]);
|
91
85
|
// handler for external maximize management
|
92
86
|
const handleMaximize = () => {
|
93
87
|
setIsMaximized(prevState => {
|
@@ -99,7 +93,6 @@ const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColor
|
|
99
93
|
});
|
100
94
|
};
|
101
95
|
return (_jsxs(StyledPanelContainer, { "$isMaximized": onMaximize ? false : isMaximized, style: {
|
102
|
-
...(minWidth ? { minWidth } : {}),
|
103
96
|
visibility: isVisible ? 'visible' : 'hidden',
|
104
97
|
}, children: [showHeader &&
|
105
98
|
_jsx(StyledPanelHeader, { "$backgroundColor": backgroundColor, "$color": color, "$isActive": isActive, onDoubleClick: () => {
|
@@ -107,8 +100,26 @@ const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColor
|
|
107
100
|
onHeaderDoubleClick();
|
108
101
|
else
|
109
102
|
allowMaximize && handleMaximize();
|
110
|
-
}, tabIndex: -1, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, children: _jsxs("div", { style: {
|
111
|
-
|
103
|
+
}, tabIndex: -1, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, children: _jsxs("div", { style: {
|
104
|
+
display: 'flex',
|
105
|
+
flexDirection: 'row',
|
106
|
+
alignItems: 'center',
|
107
|
+
width: '100%',
|
108
|
+
minWidth: 0
|
109
|
+
}, children: [_jsxs("div", { ref: titleRowRef, style: {
|
110
|
+
display: 'flex',
|
111
|
+
flexDirection: 'row',
|
112
|
+
alignItems: 'center',
|
113
|
+
gap: '8px',
|
114
|
+
flex: 1,
|
115
|
+
minWidth: 0
|
116
|
+
}, children: [onBack &&
|
117
|
+
_jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconArrowLeft, {}), caption: SDKUI_Localizator.Back, onClick: onBack }), _jsx("div", { style: {
|
118
|
+
display: 'flex',
|
119
|
+
flexDirection: 'row',
|
120
|
+
alignItems: 'center',
|
121
|
+
overflow: 'hidden',
|
122
|
+
}, children: _jsxs("p", { style: {
|
112
123
|
whiteSpace: 'nowrap',
|
113
124
|
overflow: 'hidden',
|
114
125
|
textOverflow: 'ellipsis',
|
@@ -117,7 +128,14 @@ const TMPanel = ({ allowMaximize = true, color, backgroundColor, backgroundColor
|
|
117
128
|
? ` (${displayedItemsCount} / ${totalItems})`
|
118
129
|
: isPositiveNumber(totalItems)
|
119
130
|
? ` (${totalItems})`
|
120
|
-
: ''] }) })] }), _jsxs("div", { style: {
|
131
|
+
: ''] }) })] }), _jsxs("div", { style: {
|
132
|
+
display: 'flex',
|
133
|
+
flexDirection: 'row',
|
134
|
+
alignItems: 'center',
|
135
|
+
gap: '5px',
|
136
|
+
flexShrink: 0,
|
137
|
+
marginLeft: 10
|
138
|
+
}, children: [toolbar, allowMaximize && _jsx(TMButton, { color: 'primaryOutline', caption: isMaximized ? SDKUI_Localizator.Minimize : SDKUI_Localizator.Maximize, icon: isMaximized
|
121
139
|
? _jsx(IconWindowMinimize, { fontSize: 16 })
|
122
140
|
: _jsx(IconWindowMaximize, { fontSize: 16 }), btnStyle: 'icon', onClick: handleMaximize }), onClose && _jsx(TMButton, { color: 'primaryOutline', caption: SDKUI_Localizator.Close, icon: _jsx(IconClearButton, {}), btnStyle: 'icon', onClick: () => { setIsMaximized(false); onClose?.(); } })] })] }) }), _jsx(StyledPanelContent, { "$height": showHeader ? "calc(100% - 40px)" : "100%", "$padding": padding, "$backgroundColor": backgroundColorContainer ?? `#FFFFFF`, tabIndex: -1, onFocus: handleFocus, onBlur: handleBlur, onClick: handleFocus, children: children })] }));
|
123
141
|
};
|
@@ -82,7 +82,7 @@ const TMPanelManager = (props) => {
|
|
82
82
|
}
|
83
83
|
else if (maximizedPanelPath.length > 0) {
|
84
84
|
// If at least one panel is maximized, collapse all others to zero size
|
85
|
-
newState.set(panelId, { ...currentPanel, width: '0', height: '0' });
|
85
|
+
newState.set(panelId, { ...currentPanel, width: '0%', height: '0%' });
|
86
86
|
}
|
87
87
|
else {
|
88
88
|
// If no panels are maximized, restore their original dimensions
|
@@ -408,7 +408,7 @@ const TMPanelManager = (props) => {
|
|
408
408
|
panelRefs.current[fullId] = el;
|
409
409
|
}, style: panelStyle, children: [_jsx("div", { style: contentStyle, children: hasChildren
|
410
410
|
? renderPanels(panel.contentOptions.content, fullId, 'vertical')
|
411
|
-
: panel.contentOptions?.panelContainer ? _jsx(TMPanel, { title: panel.contentOptions.panelContainer.title, totalItems: panel.contentOptions.panelContainer.totalItems, displayedItemsCount: panel.contentOptions.panelContainer.displayedItemsCount, onClose: () => handleTogglePanel(fullId), onMaximize: () => handleToggleMaximize(fullId), onHeaderDoubleClick: () => handleToggleMaximize(fullId), allowMaximize: !isMobile, children: typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content })
|
411
|
+
: panel.contentOptions?.panelContainer ? _jsx(TMPanel, { title: panel.contentOptions.panelContainer.title, totalItems: panel.contentOptions.panelContainer.totalItems, displayedItemsCount: panel.contentOptions.panelContainer.displayedItemsCount, onBack: panel.contentOptions.panelContainer.onBack, onClose: () => handleTogglePanel(fullId), onMaximize: () => handleToggleMaximize(fullId), onHeaderDoubleClick: () => handleToggleMaximize(fullId), allowMaximize: !isMobile, children: typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content })
|
412
412
|
:
|
413
413
|
typeof panel.contentOptions.content === "function" ? panel.contentOptions.content(handleTogglePanel, handleToggleMaximize, handleVisibilityButton, handleDisableButton) : panel.contentOptions.content }), !isLastVisible && isActive && maximizedPanelPath.length === 0 && (_jsx("div", { style: {
|
414
414
|
cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize',
|
@@ -434,13 +434,13 @@ const TMPanelManager = (props) => {
|
|
434
434
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: isMobile ? 'column' : 'row', height: '100%', width: '100%', gap: gutters }, children: [_jsx("div", { style: {
|
435
435
|
display: 'flex',
|
436
436
|
flexGrow: 1,
|
437
|
-
width: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${showToolbar ? (isMobile ? 0 :
|
438
|
-
height: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${isMobile ?
|
437
|
+
width: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${showToolbar ? (isMobile ? 0 : 70) : 0}px)` : '0%',
|
438
|
+
height: isAtLeastOnePanelVisible(activeButtons) ? `calc(100% - ${isMobile ? 55 : 0}px)` : '0%',
|
439
439
|
visibility: isAtLeastOnePanelVisible(activeButtons) ? 'visible' : 'hidden',
|
440
440
|
flexDirection: 'row',
|
441
441
|
}, children: renderPanels(panels, '', 'horizontal') }), !isAtLeastOnePanelVisible(activeButtons) && (_jsxs("div", { style: {
|
442
|
-
width:
|
443
|
-
height:
|
442
|
+
width: `calc(100% - ${showToolbar ? (isMobile ? 0 : 70) : 0}px)`,
|
443
|
+
height: `calc(100% - ${isMobile ? 55 : 0}px)`,
|
444
444
|
display: 'flex',
|
445
445
|
flexDirection: 'column',
|
446
446
|
alignItems: 'center',
|
@@ -451,14 +451,14 @@ const TMPanelManager = (props) => {
|
|
451
451
|
color: '#555',
|
452
452
|
fontSize: '18px',
|
453
453
|
}, children: [_jsx(IconInfo, { style: { fontSize: 50 } }), _jsx("div", { children: SDKUI_Localizator.NoPanelSelected })] })), showToolbar && _jsx("div", { style: toolbarMode === 0 ? {
|
454
|
-
width: isMobile ? '100%' : '
|
455
|
-
height: isMobile ? '
|
454
|
+
width: isMobile ? '100%' : '50px',
|
455
|
+
height: isMobile ? '50px' : '100%',
|
456
456
|
borderLeft: '1px solid #ccc',
|
457
457
|
display: 'flex',
|
458
458
|
flexDirection: isMobile ? 'row' : 'column',
|
459
|
-
padding: '
|
459
|
+
padding: '10px',
|
460
460
|
boxSizing: 'border-box',
|
461
|
-
gap: '
|
461
|
+
gap: '10px',
|
462
462
|
backgroundColor: '#f9f9f9',
|
463
463
|
} : {
|
464
464
|
display: 'flex',
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { TMPanelEntry } from './TMPanelManagerUtils';
|
2
3
|
interface TNPanelManagerToolbarProps {
|
3
4
|
allPanels: Array<TMPanelEntry>;
|
@@ -15,3 +16,8 @@ interface TNPanelManagerToolbarProps {
|
|
15
16
|
}
|
16
17
|
declare const TMPanelManagerToolbar: (props: TNPanelManagerToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
17
18
|
export default TMPanelManagerToolbar;
|
19
|
+
export declare const StyledToolbarButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
20
|
+
$toolbarMode?: number;
|
21
|
+
$isActive?: boolean;
|
22
|
+
$isDisabled?: boolean;
|
23
|
+
}>> & string;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
3
|
+
import styled from 'styled-components';
|
3
4
|
import { useDeviceType, DeviceType } from './TMDeviceProvider';
|
4
5
|
import TMTooltip from './TMTooltip';
|
5
6
|
const TMPanelManagerToolbar = (props) => {
|
@@ -75,37 +76,8 @@ const TMPanelManagerToolbar = (props) => {
|
|
75
76
|
alignSelf: 'center',
|
76
77
|
} }, `sep-${p.fullId}`)) : null;
|
77
78
|
// Button JSX
|
78
|
-
const button = (_jsx(TMTooltip, { content: p.config.name, position: isMobile ? 'top' : 'left', children: _jsx("
|
79
|
-
handleClick(); },
|
80
|
-
display: 'flex',
|
81
|
-
alignItems: 'center',
|
82
|
-
justifyContent: 'center',
|
83
|
-
height: '40px',
|
84
|
-
width: '40px',
|
85
|
-
border: 'none',
|
86
|
-
borderRadius: '10px',
|
87
|
-
fontSize: '18px',
|
88
|
-
padding: '8px 10px',
|
89
|
-
color: '#fff',
|
90
|
-
transition: 'transform 0.2s ease, box-shadow 0.2s ease',
|
91
|
-
cursor: isToolbarDisabled ? 'not-allowed' : 'pointer',
|
92
|
-
opacity: isToolbarDisabled ? 0.6 : 1,
|
93
|
-
backgroundColor: isActive || p.config.toolbarOptions?.alwaysActiveColor ? '#81c784' : '#e57373',
|
94
|
-
} : {
|
95
|
-
display: 'flex',
|
96
|
-
alignItems: 'center',
|
97
|
-
justifyContent: 'center',
|
98
|
-
height: '32px',
|
99
|
-
width: '32px',
|
100
|
-
border: 'none',
|
101
|
-
borderRadius: '10px',
|
102
|
-
fontSize: '18px',
|
103
|
-
transition: 'transform 0.2s ease, box-shadow 0.2s ease',
|
104
|
-
cursor: isToolbarDisabled ? 'not-allowed' : 'pointer',
|
105
|
-
opacity: isToolbarDisabled ? 0.6 : 1,
|
106
|
-
color: isActive || p.config.toolbarOptions?.alwaysActiveColor ? '#005B97' : '#FFFFFF',
|
107
|
-
backgroundColor: isActive || p.config.toolbarOptions?.alwaysActiveColor ? '#FFFFFF' : 'transparent',
|
108
|
-
}, onMouseEnter: (e) => { if (!isToolbarDisabled) {
|
79
|
+
const button = (_jsx(TMTooltip, { content: p.config.name, position: isMobile ? 'top' : 'left', children: _jsx(StyledToolbarButton, { "$toolbarMode": toolbarMode, "$isActive": isActive || p.config.toolbarOptions?.alwaysActiveColor, "$isDisabled": isToolbarDisabled, disabled: isToolbarDisabled, onClick: () => { handleTogglePanel(p.fullId); if (handleClick)
|
80
|
+
handleClick(); }, onMouseEnter: (e) => { if (!isToolbarDisabled && toolbarMode === 0) {
|
109
81
|
e.currentTarget.style.transform = 'scale(1.1)';
|
110
82
|
} }, onMouseLeave: (e) => { e.currentTarget.style.transform = 'scale(1)'; }, children: typeof p.config.toolbarOptions?.icon === 'string' ? (_jsx("i", { className: `dx-icon dx-icon-${p.config.toolbarOptions?.icon}` })) : (p.config.toolbarOptions?.icon) }) }, p.fullId));
|
111
83
|
// Return separator first, then button
|
@@ -113,3 +85,25 @@ const TMPanelManagerToolbar = (props) => {
|
|
113
85
|
}) }));
|
114
86
|
};
|
115
87
|
export default TMPanelManagerToolbar;
|
88
|
+
export const StyledToolbarButton = styled.button `
|
89
|
+
display: flex;
|
90
|
+
align-items: center;
|
91
|
+
justify-content: center;
|
92
|
+
height: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '40px' : '32px')};
|
93
|
+
width: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '40px' : '32px')};
|
94
|
+
border: none;
|
95
|
+
border-radius: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '10px' : '8px')};
|
96
|
+
font-size: 18px;
|
97
|
+
padding: ${({ $toolbarMode }) => ($toolbarMode === 0 ? '8px 10px' : '0px')}; ;
|
98
|
+
color: #fff;
|
99
|
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
100
|
+
cursor: ${({ $isDisabled }) => ($isDisabled ? 'not-allowed' : 'pointer')};
|
101
|
+
opacity: ${({ $isDisabled }) => ($isDisabled ? 0.6 : 1)};
|
102
|
+
background: ${({ $toolbarMode, $isActive }) => $toolbarMode === 0
|
103
|
+
? ($isActive ? '#81c784' : '#e57373')
|
104
|
+
: ($isActive ? 'rgba(255,255,255,0.35)' : 'transparent')};
|
105
|
+
|
106
|
+
&:hover {
|
107
|
+
background: ${({ $toolbarMode, $isDisabled }) => $toolbarMode !== 0 && !$isDisabled ? 'rgba(255,255,255,0.35)' : undefined};
|
108
|
+
}
|
109
|
+
`;
|
@@ -5,6 +5,8 @@ import { SDK_Globals } from '@topconsultnpm/sdk-ts-beta';
|
|
5
5
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
6
6
|
import TMSpinner from '../../base/TMSpinner';
|
7
7
|
import TMBlogs from '../../grids/TMBlogs';
|
8
|
+
import { TMNothingToShow } from './TMDcmtPreview';
|
9
|
+
import { IconBoard } from '../../../helper';
|
8
10
|
const TMDcmtBlog = ({ tid, did }) => {
|
9
11
|
const [blogsDatasource, setBlogsDatasource] = useState([]);
|
10
12
|
useEffect(() => {
|
@@ -26,7 +28,8 @@ const TMDcmtBlog = ({ tid, did }) => {
|
|
26
28
|
TMSpinner.hide();
|
27
29
|
}
|
28
30
|
};
|
29
|
-
return (_jsx(StyledContainer, { children: _jsx(StyledSectionContainer, { style: { position: 'relative' }, children: _jsx(StyledBoardContainer, { children: _jsx(
|
31
|
+
return (_jsx(StyledContainer, { children: _jsx(StyledSectionContainer, { style: { position: 'relative' }, children: _jsx(StyledBoardContainer, { children: !did ? _jsx(TMNothingToShow, { text: 'Nessun documento selezionato.', secondText: 'Bacheca non disponibile.', icon: _jsx(IconBoard, { fontSize: 96 }) }) :
|
32
|
+
_jsx(TMBlogs, { id: "dcmt-blog", allData: blogsDatasource, showExtendedAttachments: false }) }) }) }));
|
30
33
|
};
|
31
34
|
export default TMDcmtBlog;
|
32
35
|
const StyledContainer = styled.div ` user-select: none; overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
@@ -169,7 +169,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
169
169
|
onSQDItemClick(sqd, setSQDAsync);
|
170
170
|
isMobile && handleTogglePanel('TMSearchQueryPanel');
|
171
171
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] });
|
172
|
-
const
|
172
|
+
const panelsConfig = [
|
173
173
|
{
|
174
174
|
id: 'TMTreeSelector',
|
175
175
|
name: SDK_Localizator.Trees,
|
@@ -243,7 +243,7 @@ const TMSearch = ({ inputTID, inputSqdID, isExpertMode = SDKUI_Globals.userSetti
|
|
243
243
|
},
|
244
244
|
},
|
245
245
|
];
|
246
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManager, { panels:
|
246
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: 'TMRecentsManager', toolbarMode: 1 }) }), searchResult.length > 0 &&
|
247
247
|
_jsx(TMSearchResult, { isVisible: currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync: async () => {
|
248
248
|
setSearchResult(await refreshLastSearch(lastQdSearched) ?? []);
|
249
249
|
}, onTaskCreateRequest: onTaskCreateRequest, onClose: () => { setCurrentSearchView(TMSearchViews.Search); } })] }));
|
@@ -4,7 +4,7 @@ import { SDK_Globals, DataColumnTypes, MetadataDataDomains, DataListViewModes, M
|
|
4
4
|
import styled from 'styled-components';
|
5
5
|
import { getCommandsMenuItems, getSelectedDcmtsOrFocused } from './TMSearchResultsMenuItems';
|
6
6
|
import { ContextMenu } from 'devextreme-react';
|
7
|
-
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator,
|
7
|
+
import { genUniqueId, IconShow, IconBoard, IconDcmtTypeSys, IconDetailDcmts, SDKUI_Localizator, IconDelete, IconRefresh, IconMenuVertical, IconDownload, IconSignature, deepCompare, getDataColumnName, searchResultDescriptorToSimpleArray, IconArchive, IconActivityLog, IconStar, IconFreeSearch, IconChevronDown, searchResultToMetadataValues, SDKUI_Globals, IconSearchCheck, IconBatchUpdate } from '../../../helper';
|
8
8
|
import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
|
9
9
|
import { useInputAttachmentsDialog, useInputCvtFormatDialog } from '../../../hooks/useInputDialog';
|
10
10
|
import { DcmtOperationTypes, FormModes, SearchResultContext, DownloadTypes } from '../../../ts';
|
@@ -25,7 +25,7 @@ import { TMSaveFormButtonPrevious, TMSaveFormButtonNext } from '../../forms/TMSa
|
|
25
25
|
import TMDataListItemViewer from '../../viewers/TMDataListItemViewer';
|
26
26
|
import TMTidViewer from '../../viewers/TMTidViewer';
|
27
27
|
import { hasDetailRelations, hasMasterRelations } from '../../../helper/dcmtsHelper';
|
28
|
-
import TMDcmtPreview
|
28
|
+
import TMDcmtPreview from '../documents/TMDcmtPreview';
|
29
29
|
import TMFloatingToolbar from '../../base/TMFloatingToolbar';
|
30
30
|
import { WorkFlowApproveRejectPopUp, WorkFlowOperationButtons, WorkFlowReAssignPopUp } from '../workflow/TMWorkflowPopup';
|
31
31
|
import TMMasterDetailDcmts from '../documents/TMMasterDetailDcmts';
|
@@ -33,12 +33,7 @@ import TMBatchUpdateForm from '../../features/documents/TMBatchUpdateForm';
|
|
33
33
|
import TMDcmtForm from '../documents/TMDcmtForm';
|
34
34
|
import TMDcmtBlog from '../documents/TMDcmtBlog';
|
35
35
|
import TMDcmtIcon from '../documents/TMDcmtIcon';
|
36
|
-
import
|
37
|
-
import TMCommandsPanel from '../../sidebar/TMCommandsPanel';
|
38
|
-
//#endregion region Interfaces, Types and Enums
|
39
|
-
//#region Styled Components
|
40
|
-
const StyledContainer = styled.div ` overflow: hidden; background-color: #ffffff; width: calc(100%); height: calc(100%); display: flex; gap: 10px; `;
|
41
|
-
//#endregion Styled Components
|
36
|
+
import TMPanelManager from '../../base/TMPanelManager';
|
42
37
|
//#region Internal Components
|
43
38
|
const CommandsContextMenu = React.memo(({ target, menuItems, allowPin }) => {
|
44
39
|
return (_jsx(ContextMenu, { showEvent: 'click', dataSource: menuItems, target: `${target}` }));
|
@@ -53,7 +48,6 @@ const orderByName = (array) => {
|
|
53
48
|
return 1;
|
54
49
|
} return 0; });
|
55
50
|
};
|
56
|
-
//#endregion Helper Methods
|
57
51
|
const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisible = true, searchResults = [], showSearchResultSidebar = true, showSelector = false, onClosePreviewPanel, showDcmtForm = false, showBoard = false, showPreview = false, title, showSysMetadata = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsync, onSelectedTIDChanged, onUpdate, onClose, onTaskCreateRequest }) => {
|
58
52
|
const [id, setID] = useState('');
|
59
53
|
const [showApprovePopup, setShowApprovePopup] = useState(false);
|
@@ -69,11 +63,6 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
69
63
|
const [isOpenMaster, setIsOpenMaster] = useState(false);
|
70
64
|
const [secondaryMasterDcmts, setSecondaryMasterDcmts] = useState([]);
|
71
65
|
const [isOpenDcmtForm, setIsOpenDcmtForm] = useState(false);
|
72
|
-
const [isOpenPreview, setIsOpenPreview] = useState(false);
|
73
|
-
const [isOpenSysMetadata, setIsOpenSysMetadata] = useState(false);
|
74
|
-
const [isOpenBoard, setIsOpenBoard] = useState(false);
|
75
|
-
const [isOpenDistinctValues, setIsOpenDistinctValues] = useState(false);
|
76
|
-
const [isOpenTags, setIsOpenTags] = useState(false);
|
77
66
|
const [currentTIDHasDetailRelations, setCurrentTIDHasDetailRelations] = useState();
|
78
67
|
const [currentTIDHasMasterRelations, setCurrentTIDHasMasterRelations] = useState();
|
79
68
|
const [isOpenBatchUpdate, setIsOpenBatchUpdate] = useState(false);
|
@@ -136,10 +125,10 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
136
125
|
fileExt: currentMetadataValues.find(o => o.mid == SystemMIDsAsNumber.FileExt)?.value
|
137
126
|
});
|
138
127
|
}, [currentMetadataValues]);
|
139
|
-
useEffect(() => { setIsOpenBoard(showBoard); }, [showBoard])
|
140
|
-
useEffect(() => { setIsOpenSysMetadata(showSysMetadata); }, [showSysMetadata])
|
128
|
+
// useEffect(() => { setIsOpenBoard(showBoard); }, [showBoard])
|
129
|
+
// useEffect(() => { setIsOpenSysMetadata(showSysMetadata); }, [showSysMetadata])
|
141
130
|
useEffect(() => { setIsOpenDcmtForm(showDcmtForm); }, [showDcmtForm]);
|
142
|
-
useEffect(() => { setIsOpenPreview(showPreview)
|
131
|
+
// useEffect(() => { setIsOpenPreview(showPreview) }, [showPreview])
|
143
132
|
const openFormHandler = (layoutMode) => { setIsOpenDcmtForm(true); setDcmtFormLayoutMode(layoutMode); };
|
144
133
|
const openTaskFormHandler = (value) => {
|
145
134
|
if (selectedItems.length > 1)
|
@@ -184,13 +173,6 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
184
173
|
}
|
185
174
|
return titleHeader;
|
186
175
|
};
|
187
|
-
const allowBackButton = () => {
|
188
|
-
if (context === SearchResultContext.METADATA_SEARCH)
|
189
|
-
return true;
|
190
|
-
if (deviceType !== DeviceType.MOBILE)
|
191
|
-
return false;
|
192
|
-
return splitterSize[0] === '0';
|
193
|
-
};
|
194
176
|
const onBack = () => {
|
195
177
|
if (isOpenBatchUpdate && isModifiedBatchUpdate) {
|
196
178
|
TMMessageBoxManager.show({
|
@@ -306,44 +288,7 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
306
288
|
}
|
307
289
|
setLastUpdateSearchTime(new Date(Date.now()));
|
308
290
|
};
|
309
|
-
const isOpenMiddlePanel = () => isOpenSysMetadata || isOpenBoard || isOpenTags || isOpenDistinctValues;
|
310
291
|
const getSelectionDcmtInfo = () => { return getSelectedDcmtsOrFocused(selectedItems, focusedItem); };
|
311
|
-
const getPrimarySplitterStartLayout = () => {
|
312
|
-
let size = ['100%', '0'];
|
313
|
-
if (deviceType !== DeviceType.MOBILE) {
|
314
|
-
if (isOpenPreview || isOpenMiddlePanel() || isOpenBatchUpdate) {
|
315
|
-
size = ['50%', '50%'];
|
316
|
-
}
|
317
|
-
}
|
318
|
-
else {
|
319
|
-
size = (isOpenPreview || isOpenMiddlePanel() || isOpenBatchUpdate) ? ['0', '100%'] : ['100%', '0'];
|
320
|
-
}
|
321
|
-
return size;
|
322
|
-
};
|
323
|
-
const getSecondarySplitterStartLayout = () => {
|
324
|
-
if (isOpenPreview && !isOpenMiddlePanel()) {
|
325
|
-
return ['0', '100%'];
|
326
|
-
}
|
327
|
-
if (!isOpenPreview && isOpenMiddlePanel()) {
|
328
|
-
return ['100%', '0'];
|
329
|
-
}
|
330
|
-
return ['40%', '60%'];
|
331
|
-
};
|
332
|
-
const closeMiddlePanel = () => {
|
333
|
-
setIsOpenBoard(false);
|
334
|
-
setIsOpenSysMetadata(false);
|
335
|
-
setIsOpenTags(false);
|
336
|
-
setIsOpenDistinctValues(false);
|
337
|
-
};
|
338
|
-
const titleText = () => {
|
339
|
-
if (isOpenTags)
|
340
|
-
return 'Tags';
|
341
|
-
if (isOpenSysMetadata)
|
342
|
-
return 'Metadati di sistema';
|
343
|
-
if (isOpenBoard)
|
344
|
-
return 'Bacheca';
|
345
|
-
return '';
|
346
|
-
};
|
347
292
|
const canNavigateHandler = (dir) => {
|
348
293
|
if (!focusedItem)
|
349
294
|
return false;
|
@@ -381,38 +326,6 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
381
326
|
}
|
382
327
|
};
|
383
328
|
const middlePanelToolbar = _jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: '10px' }, children: [_jsx(TMSaveFormButtonPrevious, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canPrev: canNavigateHandler('prev'), onPrev: () => onNavigateHandler('prev') }), _jsx(TMSaveFormButtonNext, { btnStyle: 'icon', isModified: false, iconColor: TMColors.default_background, formMode: FormModes.ReadOnly, canNext: canNavigateHandler('next'), onNext: () => onNavigateHandler('next') })] });
|
384
|
-
let notAvalableMsg = '';
|
385
|
-
let notAvalableIcon;
|
386
|
-
if (isOpenBoard) {
|
387
|
-
notAvalableMsg = 'Bacheca non disponibile.';
|
388
|
-
}
|
389
|
-
else if (isOpenTags) {
|
390
|
-
notAvalableMsg = 'Tags non disponibile.';
|
391
|
-
}
|
392
|
-
else if (isOpenDetails) {
|
393
|
-
notAvalableMsg = 'Documenti detail non disponibile.';
|
394
|
-
}
|
395
|
-
else if (isOpenMaster) {
|
396
|
-
notAvalableMsg = 'Documenti master non disponibile.';
|
397
|
-
}
|
398
|
-
else {
|
399
|
-
notAvalableMsg = 'Metadati di sistema non disponibile.';
|
400
|
-
}
|
401
|
-
if (isOpenBoard) {
|
402
|
-
notAvalableIcon = _jsx(IconBoard, { fontSize: 96 });
|
403
|
-
}
|
404
|
-
else if (isOpenTags) {
|
405
|
-
notAvalableIcon = _jsx(IconTag, { fontSize: 96 });
|
406
|
-
}
|
407
|
-
else if (isOpenDetails) {
|
408
|
-
notAvalableIcon = _jsx(IconDetails, { fontSize: 96 });
|
409
|
-
}
|
410
|
-
else if (isOpenMaster) {
|
411
|
-
notAvalableIcon = _jsx(IconCommand, { fontSize: 96 });
|
412
|
-
}
|
413
|
-
else {
|
414
|
-
notAvalableIcon = _jsx(IconDcmtTypeSys, { fontSize: 96 });
|
415
|
-
}
|
416
329
|
const handleAddItem = (tid, did) => {
|
417
330
|
let newItem = { TID: tid ?? 0, DID: did ?? 0 };
|
418
331
|
setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
|
@@ -422,66 +335,144 @@ const TMSearchResult = ({ context = SearchResultContext.METADATA_SEARCH, isVisib
|
|
422
335
|
};
|
423
336
|
if (!searchResults || searchResults.length <= 0)
|
424
337
|
return _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound })] });
|
425
|
-
const isPreviewDisabled = isOpenBatchUpdate || fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata;
|
426
|
-
const isBoardDisabled = isOpenBatchUpdate;
|
427
|
-
const isSysMetadataDisabled = isOpenBatchUpdate || !focusedItem?.DID;
|
428
|
-
const isDetailsDisabled = isOpenBatchUpdate || !focusedItem?.DID;
|
429
|
-
const isMasterDisabled = isOpenBatchUpdate || (!focusedItem?.DID && selectedItems.length <= 0);
|
430
338
|
const isMobile = deviceType === DeviceType.MOBILE;
|
431
|
-
|
339
|
+
const renderTMSearchResult = (handleTogglePanel) => _jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['25%', '75%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
340
|
+
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, onSelectionChanged: onSearchResultSelectionChanged }) })
|
341
|
+
:
|
342
|
+
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid
|
343
|
+
// allowMultipleSelection={allowMultipleSelection}
|
344
|
+
, {
|
345
|
+
// allowMultipleSelection={allowMultipleSelection}
|
346
|
+
inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
347
|
+
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt); } }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Firma e marca', icon: _jsx(IconSignature, { color: 'white' }), onClick: () => { ShowAlert({ message: "TODO Firma e marca ", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {})] });
|
348
|
+
const renderTMBlog = (handleTogglePanel) => _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID });
|
349
|
+
const renderTMSysMetadata = (handleTogglePanel) => _jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: true, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] });
|
350
|
+
const renderTMDcmtPreview = (handleTogglePanel) => _jsx(TMDcmtPreview, { onClose: () => { handleTogglePanel("TMDcmtPreview"); onClosePreviewPanel?.(); }, dcmtData: currentDcmt });
|
351
|
+
const renderTMBatchUpdate = (handleTogglePanel) => _jsx(TMBatchUpdateForm, { inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => { handleTogglePanel("TMBatchUpdate"); }, onSavedCallbackAsync: async () => {
|
352
|
+
setIsOpenBatchUpdate(false);
|
353
|
+
setIsModifiedBatchUpdate(false);
|
354
|
+
await refreshSelectionDataRowsAsync();
|
355
|
+
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } });
|
356
|
+
const panelsConfig = [
|
357
|
+
{
|
358
|
+
id: 'TMSearchResult',
|
359
|
+
name: SDKUI_Localizator.SearchResult,
|
360
|
+
toolbarOptions: { icon: _jsx(IconSearchCheck, { fontSize: 24 }), visible: true, isActive: true, orderNumber: 1 },
|
361
|
+
type: 'content',
|
362
|
+
contentOptions: {
|
363
|
+
visible: true,
|
364
|
+
height: '100%',
|
365
|
+
width: '20%',
|
366
|
+
content: renderTMSearchResult,
|
367
|
+
panelContainer: {
|
368
|
+
title: getTitleHeader(),
|
369
|
+
showHeader: showToolbarHeader,
|
370
|
+
allowMaximize: !isMobile,
|
371
|
+
onBack: !isClosable ? onBack : undefined,
|
372
|
+
onClose: isClosable ? onBack : undefined,
|
373
|
+
toolbar: _jsxs(_Fragment, { children: [context !== SearchResultContext.METADATA_SEARCH && fromDTD?.templateTID === TemplateTIDs.WF_WIApprView && _jsx(WorkFlowOperationButtons, { deviceType: deviceType, onApprove: () => setShowApprovePopup(true), onReject: () => setShowRejectPopup(true), onReAssign: () => setShowReAssignPopup(true), approveDisable: disable, rejectDisable: disable, reassignDisable: disable, infoDisable: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length !== 1 }), (dcmtsReturned != dcmtsFound) && _jsx("p", { style: { backgroundColor: `white`, color: TMColors.primaryColor, textAlign: 'center', padding: '1px 4px', borderRadius: '3px', display: 'flex' }, children: `${dcmtsReturned}/${dcmtsFound} restituiti` }), context === SearchResultContext.FAVORITES_AND_RECENTS &&
|
374
|
+
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-header-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })
|
375
|
+
},
|
376
|
+
},
|
377
|
+
},
|
378
|
+
{
|
379
|
+
id: 'TMBlog',
|
380
|
+
name: SDKUI_Localizator.BlogCase,
|
381
|
+
toolbarOptions: { icon: _jsx(IconBoard, { fontSize: 24 }), disabled: !focusedItem?.DID, visible: true, isActive: false, orderNumber: 2 },
|
382
|
+
type: 'content',
|
383
|
+
contentOptions: {
|
384
|
+
visible: true,
|
385
|
+
height: '100%',
|
386
|
+
width: '20%',
|
387
|
+
content: renderTMBlog,
|
388
|
+
panelContainer: {
|
389
|
+
title: SDKUI_Localizator.BlogCase,
|
390
|
+
allowMaximize: !isMobile,
|
391
|
+
toolbar: middlePanelToolbar
|
392
|
+
},
|
393
|
+
},
|
394
|
+
},
|
395
|
+
{
|
396
|
+
id: 'TMSysMetadata',
|
397
|
+
name: SDKUI_Localizator.MetadataSystem,
|
398
|
+
toolbarOptions: { icon: _jsx(IconDcmtTypeSys, { fontSize: 24 }), visible: true, disabled: !focusedItem?.DID, isActive: false, orderNumber: 3 },
|
399
|
+
type: 'content',
|
400
|
+
contentOptions: {
|
401
|
+
visible: true,
|
402
|
+
height: '100%',
|
403
|
+
width: '20%',
|
404
|
+
content: renderTMSysMetadata,
|
405
|
+
panelContainer: {
|
406
|
+
title: SDKUI_Localizator.MetadataSystem,
|
407
|
+
allowMaximize: !isMobile,
|
408
|
+
toolbar: middlePanelToolbar
|
409
|
+
},
|
410
|
+
},
|
411
|
+
},
|
412
|
+
{
|
413
|
+
id: 'TMDcmtPreview',
|
414
|
+
name: SDKUI_Localizator.PreviewDocument,
|
415
|
+
toolbarOptions: { icon: _jsx(IconShow, { fontSize: 24 }), disabled: !focusedItem?.DID && fromDTD?.archiveConstraint === ArchiveConstraints.OnlyMetadata, visible: true, isActive: true, orderNumber: 4 },
|
416
|
+
type: 'content',
|
417
|
+
contentOptions: {
|
418
|
+
visible: true,
|
419
|
+
height: '100%',
|
420
|
+
width: '20%',
|
421
|
+
content: renderTMDcmtPreview,
|
422
|
+
},
|
423
|
+
},
|
424
|
+
{
|
425
|
+
id: 'TMBatchUpdate',
|
426
|
+
name: SDKUI_Localizator.BatchUpdate,
|
427
|
+
toolbarOptions: { icon: _jsx(IconBatchUpdate, { fontSize: 24 }), visible: true, isActive: false, orderNumber: 5 },
|
428
|
+
type: 'content',
|
429
|
+
contentOptions: {
|
430
|
+
visible: true,
|
431
|
+
height: '100%',
|
432
|
+
width: '20%',
|
433
|
+
content: renderTMBatchUpdate,
|
434
|
+
},
|
435
|
+
},
|
436
|
+
{
|
437
|
+
id: 'showMaster',
|
438
|
+
name: SDKUI_Localizator.DcmtsMaster,
|
439
|
+
toolbarOptions: {
|
440
|
+
icon: _jsx(IconDetailDcmts, { fontSize: 24 }),
|
441
|
+
visible: !!currentTIDHasMasterRelations,
|
442
|
+
disabled: (!focusedItem?.DID && selectedItems.length <= 0),
|
443
|
+
isActive: !!currentTIDHasMasterRelations,
|
444
|
+
orderNumber: 6,
|
445
|
+
beginGroup: true
|
446
|
+
},
|
447
|
+
type: 'button',
|
448
|
+
buttonOptions: {
|
449
|
+
onClick: () => { setIsOpenMaster(true); },
|
450
|
+
},
|
451
|
+
},
|
452
|
+
{
|
453
|
+
id: 'showDetails',
|
454
|
+
name: SDKUI_Localizator.DcmtsDetail,
|
455
|
+
toolbarOptions: {
|
456
|
+
icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)', fontSize: 24 }),
|
457
|
+
visible: !!currentTIDHasDetailRelations,
|
458
|
+
disabled: !focusedItem?.DID,
|
459
|
+
isActive: !!currentTIDHasDetailRelations,
|
460
|
+
orderNumber: 7,
|
461
|
+
},
|
462
|
+
type: 'button',
|
463
|
+
buttonOptions: {
|
464
|
+
onClick: () => { setIsOpenDetails(true); },
|
465
|
+
},
|
466
|
+
},
|
467
|
+
];
|
468
|
+
return (_jsxs(StyledMultiViewPanel, { "$isVisible": isVisible, children: [_jsx(StyledMultiViewPanel, { "$isVisible": !isOpenDcmtForm && !isOpenDetails && !isOpenMaster, style: {
|
432
469
|
display: 'flex',
|
433
470
|
flexDirection: isMobile ? 'column' : 'row',
|
434
471
|
justifyContent: 'space-between',
|
435
472
|
gap: SDKUI_Globals.userSettings.themeSettings.gutters,
|
436
473
|
width: '100%',
|
437
474
|
height: '100%',
|
438
|
-
}, children:
|
439
|
-
_jsx("div", { style: { display: 'flex', alignItems: 'center', gap: '5px' }, children: _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconDelete, { color: 'white' }), caption: "Rimuovi da " + (selectedSearchResult?.category === "Favorites" ? '"Preferiti"' : '"Recenti"'), disabled: getSelectedDcmtsOrFocused(selectedItems, focusedItem).length <= 0, onClick: removeDcmtFromFavsOrRecents }) }), _jsx(TMButton, { btnStyle: 'icon', icon: _jsx(IconRefresh, { color: 'white' }), caption: SDKUI_Localizator.Refresh, onClick: onRefreshSearchAsync }), _jsx(IconMenuVertical, { id: `commands-header-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-header-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] }), onBack: !isClosable && !isMobile && allowBackButton() ? onBack : undefined, onClose: isClosable && allowBackButton() ? onBack : undefined, title: getTitleHeader(), showHeader: showToolbarHeader, children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['25%', '75%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
440
|
-
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, onSelectionChanged: onSearchResultSelectionChanged }) })
|
441
|
-
:
|
442
|
-
_jsx(_Fragment, {}), _jsxs(TMLayoutItem, { children: [_jsx(TMSearchResultGrid
|
443
|
-
// allowMultipleSelection={allowMultipleSelection}
|
444
|
-
, {
|
445
|
-
// allowMultipleSelection={allowMultipleSelection}
|
446
|
-
inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], lastUpdateSearchTime: lastUpdateSearchTime, onDblClick: () => openFormHandler(LayoutModes.Update), onContextMenuPreparing: onContextMenuPreparing, onSelectionChanged: (items) => { setSelectedItems(items); }, onVisibleItemChanged: setVisibleItems, onFocusedItemChanged: setFocusedItem }), allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE &&
|
447
|
-
_jsxs(TMFloatingToolbar, { backgroundColor: TMColors.primaryColor, initialLeft: '10px', initialTop: 'calc(100% - 75px)', children: [fromDTD?.perm?.canRetrieveFile === AccessLevels.Yes && _jsx(TMButton, { btnStyle: 'icon', caption: "Download file", disabled: fromDTD?.perm?.canRetrieveFile !== AccessLevels.Yes, icon: _jsx(IconDownload, { color: 'white' }), onClick: () => { downloadDcmtsAsync(getSelectedDcmtsOrFocused(selectedItems, focusedItem), DownloadTypes.Dcmt); } }), _jsx(TMButton, { btnStyle: 'icon', caption: 'Firma e marca', icon: _jsx(IconSignature, { color: 'white' }), onClick: () => { ShowAlert({ message: "TODO Firma e marca ", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), _jsx(IconMenuVertical, { id: `commands-floating-${id}`, color: 'white', cursor: 'pointer' }), _jsx(CommandsContextMenu, { target: `#commands-floating-${id}`, menuItems: getCommandsMenuItems(fromDTD, selectedItems, focusedItem, context, showFloatingBar, setShowFloatingBar, openFormHandler, downloadDcmtsAsync, runOperationAsync, onRefreshSearchAsync, refreshSelectionDataRowsAsync, onRefreshAfterAddDcmtToFavs, confirmFormat, openConfirmAttachmentsDialog, openTaskFormHandler, openDetailDcmtsFormHandler, openMasterDcmtsFormHandler, openBatchUpdateFormHandler) })] })] })] }), showApprovePopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 0, onClose: () => setShowApprovePopup(false) }), showRejectPopup && _jsx(WorkFlowApproveRejectPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), op: 1, onClose: () => setShowRejectPopup(false) }), showReAssignPopup && _jsx(WorkFlowReAssignPopUp, { deviceType: deviceType, onUpdate: onUpdate, selectedItems: getSelectedDcmtsOrFocused(selectedItems, focusedItem), onClose: () => setShowReAssignPopup(false) })] }), _jsx(ConfirmFormatDialog, {}), _jsx(ConfirmAttachmentsDialog, {})] }) }), isOpenBatchUpdate ?
|
448
|
-
_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMBatchUpdateForm, { inputDcmts: getSelectionDcmtInfo(), TID: focusedItem ? focusedItem?.TID : selectedItems[0]?.TID, DID: focusedItem ? focusedItem?.DID : selectedItems[0]?.DID, onBack: () => setIsOpenBatchUpdate(false), onSavedCallbackAsync: async () => {
|
449
|
-
setIsOpenBatchUpdate(false);
|
450
|
-
setIsModifiedBatchUpdate(false);
|
451
|
-
await refreshSelectionDataRowsAsync();
|
452
|
-
}, onStatusChanged: (isModified) => { setIsModifiedBatchUpdate(isModified); } }) })
|
453
|
-
:
|
454
|
-
isOpenPreview || isOpenMiddlePanel()
|
455
|
-
? _jsx(TMLayoutItem, { children: _jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: SDKUI_Globals.userSettings.themeSettings.gutters, separatorActiveColor: 'transparent', separatorColor: 'transparent', showSeparator: deviceType !== DeviceType.MOBILE && (isOpenPreview && isOpenMiddlePanel()), start: getSecondarySplitterStartLayout(), min: ['0', '0'], children: [isOpenMiddlePanel()
|
456
|
-
? _jsx(TMLayoutItem, { children: _jsx(TMPanel, { padding: '0',
|
457
|
-
// color={TMColors.primaryColor}
|
458
|
-
// backgroundColor={`${TMColors.primaryColor}25`}
|
459
|
-
title: titleText(), toolbar: middlePanelToolbar, onClose: () => closeMiddlePanel(), children: (!focusedItem?.DID)
|
460
|
-
?
|
461
|
-
_jsx(TMNothingToShow, { text: 'Nessun documento selezionato.', secondText: notAvalableMsg, icon: notAvalableIcon })
|
462
|
-
:
|
463
|
-
_jsxs(StyledContainer, { children: [isOpenBoard && _jsx(TMDcmtBlog, { tid: focusedItem?.TID, did: focusedItem?.DID }), isOpenSysMetadata &&
|
464
|
-
_jsx(TMMetadataValues, { layoutMode: LayoutModes.Update, openChooserBySingleClick: !isOpenDistinctValues, TID: focusedItem?.TID, isReadOnly: true, deviceType: deviceType, metadataValues: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), metadataValuesOrig: currentMetadataValues.filter(o => (o.mid != undefined && o.mid <= 100)), validationItems: [] })] }) }) })
|
465
|
-
: _jsx(_Fragment, {}), isOpenPreview
|
466
|
-
? _jsx(TMLayoutItem, { children: _jsx(TMDcmtPreview, { onClose: () => { setIsOpenPreview(false); onClosePreviewPanel?.(); }, dcmtData: currentDcmt }) })
|
467
|
-
: _jsx(_Fragment, {})] }) })
|
468
|
-
: _jsx(_Fragment, {})] }) }) }), showSearchResultSidebar && _jsx(TMCommandsPanel, { isMobile: deviceType === DeviceType.MOBILE, items: [
|
469
|
-
...(isMobile ? [{ icon: _jsx(IconArrowLeft, {}), onClick: !isClosable && allowBackButton() ? onBack : undefined }] : []),
|
470
|
-
{ icon: _jsx(IconShow, {}), selected: isOpenPreview, disabled: isPreviewDisabled, onClick: () => { if (!isPreviewDisabled)
|
471
|
-
setIsOpenPreview(!isOpenPreview); } },
|
472
|
-
{ icon: _jsx(IconBoard, {}), selected: isOpenBoard, disabled: isBoardDisabled, onClick: () => { if (!isBoardDisabled) {
|
473
|
-
closeMiddlePanel();
|
474
|
-
setIsOpenBoard(!isOpenBoard);
|
475
|
-
} } },
|
476
|
-
{ icon: _jsx(IconDcmtTypeSys, {}), selected: isOpenSysMetadata, disabled: isSysMetadataDisabled, onClick: () => { if (!isSysMetadataDisabled) {
|
477
|
-
closeMiddlePanel();
|
478
|
-
setIsOpenSysMetadata(!isOpenSysMetadata);
|
479
|
-
} } },
|
480
|
-
...(currentTIDHasMasterRelations ? [{ icon: _jsx(IconDetailDcmts, {}), selected: isOpenMaster, disabled: isMasterDisabled, onClick: () => { if (!isMasterDisabled)
|
481
|
-
setIsOpenMaster(!isOpenMaster); } }] : []),
|
482
|
-
...(currentTIDHasDetailRelations ? [{ icon: _jsx(IconDetailDcmts, { transform: 'scale(-1, 1)' }), selected: isOpenDetails, disabled: isDetailsDisabled, onClick: () => { if (!isDetailsDisabled)
|
483
|
-
setIsOpenDetails(!isOpenDetails); } }] : []),
|
484
|
-
] })] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
475
|
+
}, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMPanelManager, { panels: panelsConfig, initialMobilePanelId: 'TMSearchResult', showToolbar: showSearchResultSidebar, toolbarMode: 1 }) }) }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDetails, children: isOpenDetails && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, isForMaster: false, inputDcmts: getSelectionDcmtInfo(), allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenDetails(false) }) }), _jsxs(StyledMultiViewPanel, { "$isVisible": isOpenMaster, children: [isOpenMaster && _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: getSelectionDcmtInfo(), isForMaster: true, allowNavigation: focusedItem && selectedItems.length <= 0, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onBack: () => setIsOpenMaster(false), appendMasterDcmts: handleAddItem }), secondaryMasterDcmts.length > 0 && secondaryMasterDcmts.map((dcmt, index) => {
|
485
476
|
return (_jsx(StyledModalContainer, { style: { backgroundColor: 'white' }, children: _jsx(TMMasterDetailDcmts, { deviceType: deviceType, inputDcmts: [dcmt], isForMaster: true, allowNavigation: false, onBack: () => handleRemoveItem(dcmt.TID, dcmt.DID), appendMasterDcmts: handleAddItem }) }, `${index}-${dcmt.DID}`));
|
486
477
|
})] }), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: isOpenDcmtForm && _jsx(TMDcmtForm, { TID: focusedItem?.TID, DID: focusedItem?.DID, layoutMode: dcmtFormLayoutMode, showPreview: deviceType !== DeviceType.MOBILE, count: visibleItems.length, itemIndex: visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1, canNext: canNavigateHandler('next'), canPrev: canNavigateHandler('prev'), onNext: () => onNavigateHandler('next'), onPrev: () => onNavigateHandler('prev'), onClose: () => { setIsOpenDcmtForm(false); }, onSavedAsyncCallback: async (tid, did) => { await refreshFocusedDataRowAsync(tid, did, true); } }) })] }));
|
487
478
|
};
|