@topconsultnpm/sdkui-react 6.20.0-dev1.11 → 6.20.0-dev1.110
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/assets/Toppy-help-center.png +0 -0
- package/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +285 -28
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +8 -1
- package/lib/components/NewComponents/ContextMenu/hooks.js +80 -8
- package/lib/components/NewComponents/ContextMenu/index.d.ts +3 -0
- package/lib/components/NewComponents/ContextMenu/index.js +2 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +9 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +157 -37
- package/lib/components/NewComponents/ContextMenu/types.d.ts +14 -1
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +563 -112
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +21 -5
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +210 -58
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +8 -2
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +153 -11
- package/lib/components/base/TMDropDownMenu.js +19 -18
- package/lib/components/base/TMFileManager.d.ts +4 -3
- package/lib/components/base/TMFileManager.js +32 -24
- package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
- package/lib/components/base/TMFileManagerDataGridView.js +1 -11
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
- package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
- package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
- package/lib/components/base/TMListView.js +33 -15
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +1 -1
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.js +8 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +0 -5
- package/lib/components/choosers/TMUserChooser.js +25 -45
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.js +23 -5
- package/lib/components/editors/TMTextArea.js +18 -30
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +6 -3
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +460 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
- package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
- package/lib/components/features/documents/TMDcmtForm.js +457 -206
- package/lib/components/features/documents/TMDcmtPreview.js +44 -110
- package/lib/components/features/documents/TMDcmtTasks.js +9 -9
- package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.d.ts +3 -0
- package/lib/components/features/search/TMSearch.js +50 -11
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +29 -21
- package/lib/components/features/search/TMSearchResult.d.ts +3 -0
- package/lib/components/features/search/TMSearchResult.js +208 -250
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +205 -169
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +2 -2
- package/lib/components/features/tasks/TMTaskForm.js +20 -1
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +43 -36
- package/lib/components/features/tasks/TMTasksView.js +28 -19
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +139 -34
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +12 -7
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +34 -6
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +56 -31
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/index.d.ts +6 -3
- package/lib/components/index.js +6 -3
- package/lib/components/query/TMQueryEditor.d.ts +2 -1
- package/lib/components/query/TMQueryEditor.js +92 -92
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/settings/SettingsAppearance.js +99 -30
- package/lib/components/sidebar/TMHeader.js +7 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +34 -17
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +22 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +17 -1
- package/lib/helper/SDKUI_Localizator.js +167 -1
- package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
- package/lib/helper/TMCommandsContextMenu.js +15 -4
- package/lib/helper/TMIcons.d.ts +4 -0
- package/lib/helper/TMIcons.js +13 -3
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/checkinCheckoutManager.d.ts +31 -1
- package/lib/helper/checkinCheckoutManager.js +112 -30
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +28 -1
- package/lib/helper/helpers.js +130 -3
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +1 -1
- package/lib/helper/queryHelper.js +33 -3
- package/lib/helper/workItemsHelper.d.ts +6 -0
- package/lib/helper/workItemsHelper.js +230 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +132 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/services/platform_services.d.ts +3 -3
- package/lib/ts/types.d.ts +61 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +7 -4
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/base/TMContextMenu.d.ts +0 -25
- package/lib/components/base/TMContextMenu.js +0 -109
- package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
- package/lib/components/base/TMContextMenuOLD.js +0 -56
- package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
- package/lib/components/base/TMFloatingToolbar.js +0 -101
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
- package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -3,8 +3,8 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { SharingModes, SDK_Globals, SDK_Localizator } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import { LocalizeSharingModes } from '../../../helper/Enum_Localizator';
|
|
6
|
-
import
|
|
7
|
-
import { SDKUI_Localizator, Globalization,
|
|
6
|
+
import TMContextMenu from '../../NewComponents/ContextMenu/TMContextMenu';
|
|
7
|
+
import { SDKUI_Localizator, Globalization, IconStar, IconDelete, IconDashboard, IconSavedQuery, IconApply, IconInfo, IconCloseOutline } from '../../../helper';
|
|
8
8
|
import { TMColors } from '../../../utils/theme';
|
|
9
9
|
import ShowAlert from '../../base/TMAlert';
|
|
10
10
|
import { TMMessageBoxManager, ButtonNames, TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
@@ -81,45 +81,38 @@ export const getTooltipBySqd = (sqd) => {
|
|
|
81
81
|
return (_jsxs("div", { style: { textAlign: "left", fontSize: '1rem', color: TMColors.primaryColor }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: 10 }, children: [_jsx(IconSavedQuery, { color: getSharingModeColor(sqd.sharingMode), fontSize: 20, style: { flexShrink: 0 } }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs("div", { children: ["ID: ", sqd.id] }), _jsxs("div", { children: ["Master TID: ", sqd.masterTID] }), sqd.description && _jsx("div", { children: `${SDKUI_Localizator.Description}: ${sqd.description}` })] })] }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.OwnerName, ": ", sqd.ownerName, " (", sqd.ownerID, ")"] }), _jsx("div", { children: LocalizeSharingModes(sqd.sharingMode) }), _jsxs("div", { children: ["Default: ", sqd.isDefault == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Filtro semplice", ": ", sqd.isEasyWhere == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsxs("div", { children: ["Esegui ricerca immediatamente", ": ", sqd.runSearchWhenSelected == 1 ? SDKUI_Localizator.Yes : SDKUI_Localizator.No] }), _jsx("hr", {}), _jsxs("div", { children: [SDKUI_Localizator.CreationTime, ": ", Globalization.getDateTimeDisplayValue(sqd.creationTime)] }), _jsxs("div", { children: [SDKUI_Localizator.LastUpdateTime, ": ", Globalization.getDateTimeDisplayValue(sqd.lastUpdateTime)] })] }));
|
|
82
82
|
};
|
|
83
83
|
const initialSQDsMaxItems = 12;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
] : [])
|
|
109
|
-
], target: `#sqd-item-${sqd.id}`, onItemClick: (e) => {
|
|
110
|
-
if (e.itemIndex == 0)
|
|
111
|
-
setDefaultAsync?.(sqd);
|
|
112
|
-
else if (e.itemIndex == 1)
|
|
113
|
-
deleteAsync?.(sqd);
|
|
114
|
-
else if (e.itemIndex == 2)
|
|
115
|
-
favManageAsync?.(sqd);
|
|
116
|
-
} });
|
|
84
|
+
const getContextMenuItems = (sqd, manageDefault, isMobile, deleteAsync, setDefaultAsync, favManageAsync, setInfoSQD) => [
|
|
85
|
+
...(manageDefault ? [{
|
|
86
|
+
name: SDKUI_Localizator.SetAsDefault2,
|
|
87
|
+
icon: _jsx(IconStar, { color: 'rgb(248, 215, 117)' }),
|
|
88
|
+
onClick: () => setDefaultAsync(sqd)
|
|
89
|
+
}] : []),
|
|
90
|
+
{
|
|
91
|
+
name: SDKUI_Localizator.Delete,
|
|
92
|
+
disabled: (sqd.id == 1),
|
|
93
|
+
icon: _jsx(IconDelete, {}),
|
|
94
|
+
onClick: () => deleteAsync(sqd)
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: SDKUI_Localizator.AddToHomePage,
|
|
98
|
+
disabled: (sqd.id == 1),
|
|
99
|
+
icon: _jsx(IconDashboard, {}),
|
|
100
|
+
onClick: () => favManageAsync?.(sqd)
|
|
101
|
+
},
|
|
102
|
+
...(isMobile ? [{
|
|
103
|
+
name: SDKUI_Localizator.About,
|
|
104
|
+
icon: _jsx(IconInfo, { color: TMColors.info }),
|
|
105
|
+
onClick: () => { setInfoSQD?.(sqd); }
|
|
106
|
+
}] : [])
|
|
107
|
+
];
|
|
117
108
|
const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch = true, height, manageDefault = true, onItemClick, onDeleted, onFavoritesAdded, onRefreshData }) => {
|
|
118
109
|
const [dataSource, setDataSource] = useState([]);
|
|
119
110
|
const [selectedItem, setSelectedItem] = useState();
|
|
120
111
|
const [searchText, setSearchText] = useState('');
|
|
121
112
|
const [showAllRoot, setShowAllRoot] = useState(false);
|
|
122
113
|
const [infoSQD, setInfoSQD] = useState();
|
|
114
|
+
// Context menu state
|
|
115
|
+
const [contextMenuState, setContextMenuState] = useState({ visible: false, position: { x: 0, y: 0 }, sqd: null });
|
|
123
116
|
const deviceType = useDeviceType();
|
|
124
117
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
125
118
|
const panelRef = useOutsideClick(() => {
|
|
@@ -187,40 +180,52 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
|
|
|
187
180
|
overflow: 'auto'
|
|
188
181
|
}, children: dataSource.slice(0, showAllRoot || searchText.length > 0 ? dataSource.length : initialSQDsMaxItems).filter(o => searchText.length <= 0 || (searchText.length > 0 && o.name?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())) || o.description?.toLocaleLowerCase().includes(searchText.toLocaleLowerCase())).map((sqd, index) => {
|
|
189
182
|
const isCurrent = selectedItem?.id == sqd.id;
|
|
190
|
-
return (
|
|
183
|
+
return (_jsx(StyledSqdItem, { id: `sqd-item-${sqd.id}`, "$isMobile": isMobile, onClick: () => {
|
|
191
184
|
setSelectedItem(sqd);
|
|
192
185
|
onItemClick?.(sqd);
|
|
193
|
-
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
186
|
+
}, onContextMenu: (e) => {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
e.stopPropagation();
|
|
189
|
+
setContextMenuState({
|
|
190
|
+
visible: true,
|
|
191
|
+
position: { x: e.clientX, y: e.clientY },
|
|
192
|
+
sqd: sqd
|
|
193
|
+
});
|
|
194
|
+
}, children: _jsxs(StyledDivHorizontal, { style: { alignItems: 'center', gap: 8, width: '100%' }, children: [!isMobile && (_jsx("span", { className: "info-icon", style: {
|
|
195
|
+
marginRight: 4,
|
|
196
|
+
display: 'flex',
|
|
197
|
+
alignItems: 'center'
|
|
198
|
+
}, children: _jsx(TMTooltip, { content: getTooltipBySqd(sqd), children: _jsx(IconInfo, { color: TMColors.primaryColor }) }) })), _jsxs("div", { style: {
|
|
199
|
+
flex: 1,
|
|
200
|
+
display: 'flex',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
justifyContent: 'center',
|
|
203
|
+
minWidth: 0
|
|
204
|
+
}, children: [_jsx("p", { style: {
|
|
205
|
+
fontSize: '1rem',
|
|
206
|
+
fontWeight: sqd.id === 1 ? 600 : 'normal',
|
|
207
|
+
whiteSpace: 'nowrap',
|
|
208
|
+
overflow: 'hidden',
|
|
209
|
+
textOverflow: 'ellipsis',
|
|
210
|
+
color: TMColors.primaryColor,
|
|
211
|
+
paddingRight: '15px'
|
|
212
|
+
}, children: sqd.name }), manageDefault && sqd.isDefault == 1 && _jsx(IconStar, { fontSize: 16, color: 'rgb(248, 215, 117)' })] }), _jsx("span", { style: {
|
|
213
|
+
width: 24,
|
|
214
|
+
height: 24,
|
|
215
|
+
borderRadius: 24,
|
|
216
|
+
display: 'flex',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
justifyContent: 'center',
|
|
219
|
+
fontSize: '1rem',
|
|
220
|
+
fontWeight: 'bold',
|
|
221
|
+
marginLeft: 8,
|
|
222
|
+
visibility: isCurrent ? 'visible' : 'hidden'
|
|
223
|
+
}, children: _jsx(IconApply, { fontSize: 24, color: 'green' }) })] }) }, sqd.id));
|
|
223
224
|
}) }), dataSource.length > initialSQDsMaxItems && searchText.length <= 0 &&
|
|
224
|
-
_jsx("div", { style: { display: 'flex', justifyContent: 'flex-end', padding: '10px', position: 'relative' }, children: _jsx(TMShowAllOrMaxItemsButton, { showAll: showAllRoot, dataSourceLength: dataSource.length, onClick: () => { setShowAllRoot(!showAllRoot); } }) }),
|
|
225
|
+
_jsx("div", { style: { display: 'flex', justifyContent: 'flex-end', padding: '10px', position: 'relative' }, children: _jsx(TMShowAllOrMaxItemsButton, { showAll: showAllRoot, dataSourceLength: dataSource.length, onClick: () => { setShowAllRoot(!showAllRoot); } }) }), _jsx(TMContextMenu, { target: "[id^='sqd-item-']", items: contextMenuState.sqd ? getContextMenuItems(contextMenuState.sqd, manageDefault, isMobile, deleteSQDAsync, setDefaultSQDAsync, favManageSQDAsync, setInfoSQD) : [], externalControl: {
|
|
226
|
+
visible: contextMenuState.visible,
|
|
227
|
+
position: contextMenuState.position,
|
|
228
|
+
onClose: () => setContextMenuState(prev => ({ ...prev, visible: false, sqd: null }))
|
|
229
|
+
} }), _jsxs(StyledOffCanvasPanel, { ref: panelRef, "$isOpen": isMobile && infoSQD !== undefined, children: [_jsxs(StyledDivHorizontal, { style: { gap: 10, padding: '10px 8px', width: '100%', alignItems: 'center' }, children: [_jsx("p", { style: { fontSize: '1.1rem', fontWeight: 'bold' }, children: `${SDK_Localizator.SavedQuery} - ${SDKUI_Localizator.About}` }), _jsx(IconCloseOutline, { style: { marginLeft: 'auto', cursor: 'pointer' }, onClick: () => setInfoSQD(undefined) })] }), getTooltipBySqd(infoSQD)] })] }));
|
|
225
230
|
});
|
|
226
231
|
export default TMSavedQuerySelector;
|
|
@@ -23,10 +23,13 @@ interface ITMSearchProps {
|
|
|
23
23
|
onFileOpened?: (dcmtFile: File | undefined) => void;
|
|
24
24
|
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
25
25
|
openWGsCopyMoveForm?: (mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void;
|
|
26
|
+
editPdfForm?: boolean;
|
|
26
27
|
openEditPdf?: (documents: Array<DcmtInfo>) => void;
|
|
27
28
|
openS4TViewer?: boolean;
|
|
28
29
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, onRefreshSearchAsync?: (() => Promise<void>)) => void;
|
|
29
30
|
showTodoDcmtForm?: boolean;
|
|
31
|
+
showToppyDraggableHelpCenter?: boolean;
|
|
32
|
+
toppyHelpCenterUsePortal?: boolean;
|
|
30
33
|
openInOffice?: (selectedDcmtsOrFocused: Array<DcmtInfo>) => Promise<void>;
|
|
31
34
|
passToArchiveCallback?: (outputMids: Array<{
|
|
32
35
|
mid: number;
|
|
@@ -11,14 +11,15 @@ import TMRecentsManager from '../../grids/TMRecentsManager';
|
|
|
11
11
|
import { SearchResultContext } from '../../../ts';
|
|
12
12
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
13
13
|
import { StyledMultiViewPanel } from '../../base/Styled';
|
|
14
|
-
import {
|
|
14
|
+
import { useTMPanelManagerContext } from '../../layout/panelManager/TMPanelManagerContext';
|
|
15
15
|
import TMPanelManagerContainer from '../../layout/panelManager/TMPanelManagerContainer';
|
|
16
|
+
import { TMPanelManagerWithPersistenceProvider } from '../../layout/panelManager/TMPanelManagerWithPersistenceProvider';
|
|
16
17
|
var TMSearchViews;
|
|
17
18
|
(function (TMSearchViews) {
|
|
18
19
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
19
20
|
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
|
20
21
|
})(TMSearchViews || (TMSearchViews = {}));
|
|
21
|
-
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
22
|
+
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, openEditPdf, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
22
23
|
const [allSQDs, setAllSQDs] = useState([]);
|
|
23
24
|
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
|
24
25
|
const [currentSQD, setCurrentSQD] = useState();
|
|
@@ -31,6 +32,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
31
32
|
const [currentSQDMode, setCurrentSQDMode] = useState(1);
|
|
32
33
|
const [lastQdSearched, setLastQdSearched] = useState();
|
|
33
34
|
const [showSearchResults, setShowSearchResults] = useState(true);
|
|
35
|
+
const [maxDcmtsToBeReturned, setMaxDcmtsToBeReturned] = useState(SDKUI_Globals.userSettings.searchSettings?.maxDcmtsToBeReturned ?? 1000);
|
|
34
36
|
const deviceType = useDeviceType();
|
|
35
37
|
useEffect(() => {
|
|
36
38
|
if (onCurrentTIDChangedCallback) {
|
|
@@ -54,6 +56,12 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
}, [inputSqdID]);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const newMaxDcmtsToBeReturned = SDKUI_Globals.userSettings.searchSettings?.maxDcmtsToBeReturned ?? 1000;
|
|
61
|
+
if (newMaxDcmtsToBeReturned !== maxDcmtsToBeReturned) {
|
|
62
|
+
setMaxDcmtsToBeReturned(newMaxDcmtsToBeReturned);
|
|
63
|
+
}
|
|
64
|
+
}, [SDKUI_Globals.userSettings.searchSettings?.maxDcmtsToBeReturned]);
|
|
57
65
|
useEffect(() => {
|
|
58
66
|
setSearchResult([]);
|
|
59
67
|
if (!currentTID || currentTID <= 0) {
|
|
@@ -125,8 +133,12 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
125
133
|
setCurrentMruTID(0);
|
|
126
134
|
};
|
|
127
135
|
const onSQDItemClick = useCallback(async (sqd, setSqdAsync) => {
|
|
136
|
+
// Forza ricaricamento completo se la query è già selezionata
|
|
137
|
+
if (sqd.id === currentSQD?.id) {
|
|
138
|
+
await setSqdAsync(undefined);
|
|
139
|
+
}
|
|
128
140
|
await setSqdAsync(sqd);
|
|
129
|
-
}, []);
|
|
141
|
+
}, [currentSQD]);
|
|
130
142
|
const onSQDDeleted = useCallback(async (sqd, sqdToBeSet, setSqdAsync) => {
|
|
131
143
|
await loadDataSQDsAsync(true, sqd.masterTID);
|
|
132
144
|
if (sqdToBeSet)
|
|
@@ -134,6 +146,9 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
134
146
|
}, []);
|
|
135
147
|
const onRefreshSearchAsync = async () => {
|
|
136
148
|
try {
|
|
149
|
+
if (lastQdSearched) {
|
|
150
|
+
lastQdSearched.maxDcmtsToBeReturned = maxDcmtsToBeReturned;
|
|
151
|
+
}
|
|
137
152
|
const newResult = (await refreshLastSearch(lastQdSearched)) ?? [];
|
|
138
153
|
setSearchResult(newResult);
|
|
139
154
|
}
|
|
@@ -141,15 +156,16 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
141
156
|
console.error("Error refreshing search:", error);
|
|
142
157
|
}
|
|
143
158
|
};
|
|
144
|
-
const isMobile = deviceType === DeviceType.
|
|
159
|
+
const isMobile = deviceType === DeviceType.MOBILE;
|
|
160
|
+
const isTabletOrMobile = deviceType === DeviceType.TABLET || deviceType === DeviceType.MOBILE;
|
|
145
161
|
// --- JSX WRAPPERS ---
|
|
146
|
-
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile:
|
|
162
|
+
const tmTreeSelectorElement = useMemo(() => _jsx(TMTreeSelectorWrapper, { isMobile: isTabletOrMobile, onSelectedTIDChanged: (tid) => {
|
|
147
163
|
setCurrentTID(tid);
|
|
148
164
|
if (tid && mruTIDs.includes(tid))
|
|
149
165
|
setCurrentMruTID(tid);
|
|
150
166
|
else
|
|
151
167
|
setCurrentMruTID(0);
|
|
152
|
-
} }), [
|
|
168
|
+
} }), [isTabletOrMobile, mruTIDs]);
|
|
153
169
|
const tmRecentsManagerElement = useMemo(() => _jsx(TMRecentsManagerWrapper, { mruTIDs: mruTIDs, currentMruTID: currentMruTID, deviceType: deviceType, onSelectedTID: (tid) => {
|
|
154
170
|
setCurrentMruTID(tid);
|
|
155
171
|
setCurrentTID(tid);
|
|
@@ -158,7 +174,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
158
174
|
SDKUI_Globals.userSettings.searchSettings.mruTIDs = newMruTIDS;
|
|
159
175
|
setMruTIDs(newMruTIDS);
|
|
160
176
|
} }), [mruTIDs, currentMruTID, deviceType]);
|
|
161
|
-
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
|
|
177
|
+
const tmSearchQueryPanelElement = useMemo(() => _jsx(TMSearchQueryPanelWrapper, { passToArchiveCallback: passToArchiveCallback, isExpertMode: isExpertMode, showBackToResultButton: searchResult.length > 0, fromDTD: fromDTD, SQD: currentSQD, inputMids: inputMids, maxDcmtsToBeReturned: maxDcmtsToBeReturned, onBackToResult: () => { setCurrentSearchView(TMSearchViews.Result); }, onSearchCompleted: (searchResult, qd) => {
|
|
162
178
|
setSearchResult(searchResult);
|
|
163
179
|
if (searchResult.length <= 0)
|
|
164
180
|
return;
|
|
@@ -174,12 +190,35 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
174
190
|
}, onSqdSaved: async (newSqd) => {
|
|
175
191
|
await loadDataSQDsAsync(true, newSqd.masterTID);
|
|
176
192
|
await setSQDAsync(newSqd);
|
|
177
|
-
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids]);
|
|
193
|
+
} }), [fromDTD, showSearchResults, setShowSearchResults, currentSQD, isExpertMode, mruTIDs, searchResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned]);
|
|
178
194
|
const tmSavedQuerySelectorElement = useMemo(() => _jsxs(TabPanel, { width: "100%", height: "100%", showNavButtons: true, repaintChangesOnly: true, selectedIndex: currentSQDMode, onSelectedIndexChange: (index) => setCurrentSQDMode(index), children: [(currentTID || currentSQD) ? _jsx(Item, { title: fromDTD?.nameLoc, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: false, items: filteredByTIDSQDs, selectedId: currentSQD?.id, onRefreshData: () => { loadDataSQDsAsync(true); }, onItemClick: (sqd) => {
|
|
179
195
|
onSQDItemClick(sqd, setSQDAsync);
|
|
180
196
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? filteredByTIDSQDs.find(o => o.id == 1) : currentSQD, setSQDAsync) }) }) : _jsx(_Fragment, {}), _jsx(Item, { title: SDKUI_Localizator.AllFemale, children: _jsx(TMSavedQuerySelectorWrapper, { allowShowSearch: true, items: allSQDs, manageDefault: false, onItemClick: (sqd) => {
|
|
181
197
|
onSQDItemClick(sqd, setSQDAsync);
|
|
182
198
|
}, onDeleted: (sqd) => onSQDDeleted(sqd, sqd.id == currentSQD?.id ? undefined : currentSQD, setSQDAsync) }) })] }), [currentSQDMode, currentTID, currentSQD, fromDTD, filteredByTIDSQDs, allSQDs]);
|
|
199
|
+
// Returns the current panelLayout from user settings, falling back to an empty object if not present.
|
|
200
|
+
const getPanelLayoutSetting = () => {
|
|
201
|
+
return SDKUI_Globals.userSettings.searchSettings.panelLayout ?? {};
|
|
202
|
+
};
|
|
203
|
+
// Checks whether a persisted panel layout exists and is not empty.
|
|
204
|
+
const hasSavedLayout = () => {
|
|
205
|
+
const panelLayout = getPanelLayoutSetting();
|
|
206
|
+
return Object.keys(panelLayout).length > 0;
|
|
207
|
+
};
|
|
208
|
+
// Persists the current panel states into user settings. Each panel must contain: visible, width and height.
|
|
209
|
+
const persistPanelStates = (state) => {
|
|
210
|
+
if (!state || Object.keys(state).length === 0)
|
|
211
|
+
return;
|
|
212
|
+
SDKUI_Globals.userSettings.searchSettings.panelLayout = {
|
|
213
|
+
...state
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
// Retrieves the persisted panel layout. Returns undefined on mobile devices.
|
|
217
|
+
const getPersistedPanelStates = () => {
|
|
218
|
+
if (isMobile)
|
|
219
|
+
return undefined;
|
|
220
|
+
return getPanelLayoutSetting();
|
|
221
|
+
};
|
|
183
222
|
// --- PANEL DEFINITIONS ---
|
|
184
223
|
const allInitialPanelVisibility = {
|
|
185
224
|
'TMTreeSelector': true,
|
|
@@ -219,7 +258,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
219
258
|
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
|
|
220
259
|
}
|
|
221
260
|
], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
|
|
222
|
-
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(
|
|
261
|
+
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsync: onRefreshSearchAsync, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, openEditPdf: openEditPdf, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
223
262
|
};
|
|
224
263
|
export default TMSearch;
|
|
225
264
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
@@ -238,11 +277,11 @@ const TMRecentsManagerWrapper = ({ mruTIDs, currentMruTID, deviceType, onSelecte
|
|
|
238
277
|
onDeletedTID?.(tid);
|
|
239
278
|
} }));
|
|
240
279
|
};
|
|
241
|
-
const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback, inputMids }) => {
|
|
280
|
+
const TMSearchQueryPanelWrapper = ({ fromDTD, SQD, isExpertMode, showBackToResultButton, onSearchCompleted, onSqdSaved, onBackToResult, passToArchiveCallback, inputMids, maxDcmtsToBeReturned }) => {
|
|
242
281
|
const { setPanelVisibilityById, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
243
282
|
const deviceType = useDeviceType();
|
|
244
283
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
245
|
-
return (_jsx(TMSearchQueryPanel, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, inputMids: inputMids, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback }));
|
|
284
|
+
return (_jsx(TMSearchQueryPanel, { onClosePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => setPanelVisibilityById('TMSearchQueryPanel', false) : undefined, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onMaximizePanel: (!isMobile && countVisibleLeafPanels() > 1) ? () => toggleMaximize("TMSearchQueryPanel") : undefined, isExpertMode: isExpertMode, fromDTD: fromDTD, SQD: SQD, inputMids: inputMids, onSearchCompleted: onSearchCompleted, onSqdSaved: onSqdSaved, showBackToResultButton: showBackToResultButton, onBackToResult: onBackToResult, passToArchiveCallback: passToArchiveCallback, maxDcmtsToBeReturned: maxDcmtsToBeReturned }));
|
|
246
285
|
};
|
|
247
286
|
const TMSavedQuerySelectorWrapper = ({ items, selectedId, allowShowSearch, manageDefault, onRefreshData, onItemClick, onDeleted }) => {
|
|
248
287
|
const { setPanelVisibilityById } = useTMPanelManagerContext();
|
|
@@ -20,6 +20,7 @@ interface ITMSearchQueryPanelProps {
|
|
|
20
20
|
mid: number;
|
|
21
21
|
value: string;
|
|
22
22
|
}>, tid?: number) => void;
|
|
23
|
+
maxDcmtsToBeReturned?: number;
|
|
23
24
|
}
|
|
24
25
|
declare const TMSearchQueryPanel: React.FunctionComponent<ITMSearchQueryPanelProps>;
|
|
25
26
|
export default TMSearchQueryPanel;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { PlatformObjectValidator, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { PlatformObjectValidator, QueryDescriptor, WhereItem, SDK_Localizator, OrderByItem, SelectItem, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import TMSearchQueryEditor from './TMSearchQueryEditor';
|
|
6
|
-
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight, IconMenuCAArchive, getListMaxItems } from '../../../helper';
|
|
6
|
+
import { getDcmtTypesByQdAsync, SDKUI_Localizator, getQD, IconMenuVertical, IconAddCircleOutline, IconEdit, IconEasy, IconAdvanced, deepCompare, IconSearch, IconClear, getDefaultOperator, prepareQdForSearchAsync, IsParametricQuery, SDKUI_Globals, IconArrowRight, IconMenuCAArchive, getListMaxItems, DEFAULT_MAX_DCMTS_TO_BE_RETURNED } from '../../../helper';
|
|
7
7
|
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
|
8
8
|
import { FormModes } from '../../../ts';
|
|
9
9
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -11,7 +11,6 @@ import { StyledModalContainer } from '../../base/Styled';
|
|
|
11
11
|
import ShowAlert from '../../base/TMAlert';
|
|
12
12
|
import TMButton from '../../base/TMButton';
|
|
13
13
|
import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
|
|
14
|
-
import TMDropDownMenu from '../../base/TMDropDownMenu';
|
|
15
14
|
import { TMExceptionBoxManager } from '../../base/TMPopUp';
|
|
16
15
|
import TMSpinner from '../../base/TMSpinner';
|
|
17
16
|
import TMPanel from '../../base/TMPanel';
|
|
@@ -19,9 +18,10 @@ import TMDistinctValues from '../../choosers/TMDistinctValues';
|
|
|
19
18
|
import { TMMetadataChooserForm } from '../../choosers/TMMetadataChooser';
|
|
20
19
|
import TMQueryEditor from '../../query/TMQueryEditor';
|
|
21
20
|
import TMSavedQueryForm from './TMSavedQueryForm';
|
|
21
|
+
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
22
22
|
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
|
23
23
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
24
|
-
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback }) => {
|
|
24
|
+
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned }) => {
|
|
25
25
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
26
26
|
const [qd, setQd] = useState();
|
|
27
27
|
const [shouldSearch, setShouldSearch] = useState(false);
|
|
@@ -50,25 +50,32 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
50
50
|
useEffect(() => {
|
|
51
51
|
pendingMidsRef.current = inputMids ?? null;
|
|
52
52
|
}, [inputMids]);
|
|
53
|
+
// Gestisce inizializzazione/aggiornamento QD: crea nuovo QD se cambia TID, altrimenti aggiorna solo maxDcmtsToBeReturned se cambiato
|
|
53
54
|
useEffect(() => {
|
|
54
55
|
if (!fromDTD)
|
|
55
56
|
return;
|
|
56
|
-
// Reset
|
|
57
|
+
// Reset della ref quando cambia il TID per permettere la riapplicazione dei filtri sul nuovo tipo documento
|
|
57
58
|
appliedInputMidsRef.current = null;
|
|
58
59
|
const initQd = async () => {
|
|
59
|
-
//
|
|
60
|
+
// Caso 1: QD non esiste o è per un TID diverso → crea nuovo QD completo
|
|
60
61
|
if (!qd || qd.from?.tid !== fromDTD.id) {
|
|
61
|
-
const newQd = await getQD(fromDTD.id, false);
|
|
62
|
+
const newQd = await getQD(fromDTD.id, false, maxDcmtsToBeReturned ?? DEFAULT_MAX_DCMTS_TO_BE_RETURNED);
|
|
62
63
|
if (newQd) {
|
|
63
64
|
setQd(newQd);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
67
|
+
// Caso 2: TID invariato ma maxDcmtsToBeReturned cambiato → aggiorna solo quella proprietà
|
|
68
|
+
else if (qd.maxDcmtsToBeReturned !== maxDcmtsToBeReturned) {
|
|
69
|
+
const updatedQd = new QueryDescriptor();
|
|
70
|
+
updatedQd.init({ ...qd, maxDcmtsToBeReturned: maxDcmtsToBeReturned ?? DEFAULT_MAX_DCMTS_TO_BE_RETURNED });
|
|
71
|
+
setQd(updatedQd);
|
|
72
|
+
}
|
|
66
73
|
};
|
|
67
74
|
initQd();
|
|
68
|
-
}, [fromDTD?.id]);
|
|
75
|
+
}, [fromDTD?.id, maxDcmtsToBeReturned]);
|
|
69
76
|
// Apply inputMids when qd is ready and matches fromDTD
|
|
70
77
|
useEffect(() => {
|
|
71
|
-
if (!qd || !fromDTD || qd.from?.tid !== fromDTD.id)
|
|
78
|
+
if (!qd || !fromDTD || qd.from?.tid !== fromDTD.id || qd.maxDcmtsToBeReturned !== maxDcmtsToBeReturned)
|
|
72
79
|
return;
|
|
73
80
|
const midsToApply = pendingMidsRef.current;
|
|
74
81
|
if (!midsToApply || midsToApply.length === 0)
|
|
@@ -177,7 +184,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
177
184
|
if (show)
|
|
178
185
|
setQd({ ...qd, where: qd?.where?.filter(o => PlatformObjectValidator.WhereItemHasValues(o)) });
|
|
179
186
|
else {
|
|
180
|
-
let qdEasy = SQD?.qd ?? await getQD(fromDTD?.id, false);
|
|
187
|
+
let qdEasy = SQD?.qd ?? await getQD(fromDTD?.id, false, maxDcmtsToBeReturned ?? 1000);
|
|
181
188
|
if (qdEasy && qd?.where) {
|
|
182
189
|
for (const wi of qd.where) {
|
|
183
190
|
let wiEasy = qdEasy.where?.find(o => o.mid == wi.mid);
|
|
@@ -299,20 +306,21 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
299
306
|
}
|
|
300
307
|
setQd({ ...qd, orderBy: newOrderBy });
|
|
301
308
|
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
309
|
+
const contextMenuItems = useMemo(() => [
|
|
310
|
+
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
311
|
+
{ icon: _jsx(IconAddCircleOutline, {}), name: SDKUI_Localizator.SavedQueryNew, beginGroup: showBackToResultButton, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
312
|
+
{ icon: _jsx(IconEdit, {}), name: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
313
|
+
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, name: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
314
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, beginGroup: true, onClick: () => { setShowFiltersConfig(true); } },
|
|
315
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
316
|
+
{ icon: _jsx(IconEdit, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
317
|
+
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, name: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
318
|
+
], [showBackToResultButton, showAdvancedSearch, SQD, onBackToResult, openSqdForm, changeAdvancedSearchAsync, setShowFiltersConfig, setShowOutputConfig, setShowOrderByConfig, handlePassToArchive]);
|
|
302
319
|
const captionText = showAllMdWhere ? SDKUI_Localizator.ShowLess : SDKUI_Localizator.ShowAll;
|
|
303
320
|
let maxItems = getListMaxItems(deviceType ?? DeviceType.DESKTOP);
|
|
304
321
|
const diff = (qd?.where?.length ?? 0) - maxItems;
|
|
305
322
|
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onActiveChanged: handlePanelActiveChanged, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
306
|
-
_jsx(
|
|
307
|
-
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), text: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
308
|
-
{ icon: _jsx(IconAddCircleOutline, {}), beginGroup: true, text: SDKUI_Localizator.SavedQueryNew, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
309
|
-
{ icon: _jsx(IconEdit, {}), text: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
310
|
-
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, text: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
311
|
-
{ icon: _jsx(IconEdit, {}), beginGroup: true, text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, onClick: () => { setShowFiltersConfig(true); } },
|
|
312
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
313
|
-
{ icon: _jsx(IconEdit, {}), text: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowOrderByConfig(true); } },
|
|
314
|
-
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, text: SDKUI_Localizator.PassToArchive, onClick: handlePassToArchive }
|
|
315
|
-
], onMenuShown: () => setIsQueryPanelActive(true) })
|
|
323
|
+
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }) })
|
|
316
324
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
317
325
|
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
318
326
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged })
|
|
@@ -37,6 +37,7 @@ interface ITMSearchResultProps {
|
|
|
37
37
|
onFileOpened?: (blob: File | undefined) => void;
|
|
38
38
|
onTaskCreateRequest?: (taskContext: TaskContext, onTaskCreated?: (task?: TaskDescriptor) => void) => void;
|
|
39
39
|
openWGsCopyMoveForm?: (mode: "copyToWgDraft" | "copyToWgArchivedDoc", dcmtTypeDescriptor: DcmtTypeDescriptor, documents: Array<DcmtInfo>) => void;
|
|
40
|
+
editPdfForm?: boolean;
|
|
40
41
|
openEditPdf?: (documents: Array<DcmtInfo>) => void;
|
|
41
42
|
openCommentFormCallback?: (documents: Array<DcmtInfo>) => void;
|
|
42
43
|
openAddDocumentForm?: () => void;
|
|
@@ -47,6 +48,8 @@ interface ITMSearchResultProps {
|
|
|
47
48
|
value: string;
|
|
48
49
|
}>, tid?: number) => void;
|
|
49
50
|
showTodoDcmtForm?: boolean;
|
|
51
|
+
showToppyDraggableHelpCenter?: boolean;
|
|
52
|
+
toppyHelpCenterUsePortal?: boolean;
|
|
50
53
|
onReferenceClick?: (ref: ObjectRef) => void;
|
|
51
54
|
}
|
|
52
55
|
declare const TMSearchResult: React.FC<ITMSearchResultProps>;
|