@topconsultnpm/sdkui-react 6.22.0-dev2.9 → 6.22.0-t2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +1 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +45 -43
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +1 -1
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +67 -60
- package/lib/components/base/Styled.d.ts +93 -77
- package/lib/components/base/TMCounterBar.d.ts +2 -2
- package/lib/components/base/TMCounterContainer.d.ts +2 -1
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMDataGrid.d.ts +2 -0
- package/lib/components/base/TMDataGrid.js +260 -8
- package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
- package/lib/components/base/TMEditorBase.d.ts +2 -0
- package/lib/components/base/TMFileManager.d.ts +2 -1
- package/lib/components/base/TMFileManager.js +5 -3
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.js +11 -2
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +19 -9
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
- package/lib/components/base/TMFileManagerUtils.d.ts +6 -6
- package/lib/components/base/TMFileManagerUtils.js +37 -1
- package/lib/components/base/TMLayout.d.ts +4 -4
- package/lib/components/base/TMList.d.ts +2 -1
- package/lib/components/base/TMListView.d.ts +1 -1
- package/lib/components/base/TMModal.d.ts +11 -0
- package/lib/components/base/TMModal.js +47 -13
- package/lib/components/base/TMPanel.d.ts +6 -0
- package/lib/components/base/TMPanel.js +138 -25
- package/lib/components/base/TMPopUp.js +3 -0
- package/lib/components/base/TMSpinner.d.ts +2 -1
- package/lib/components/base/TMTab.d.ts +4 -3
- package/lib/components/base/TMTooltip.d.ts +2 -1
- package/lib/components/base/TMTooltip.js +24 -8
- package/lib/components/base/TMTreeView.d.ts +14 -8
- package/lib/components/base/TMTreeView.js +108 -67
- package/lib/components/base/TMUserAvatar.d.ts +2 -1
- package/lib/components/base/TMVilViewer.d.ts +2 -1
- package/lib/components/base/TMWaitPanel.d.ts +3 -2
- package/lib/components/choosers/TMDcmtTypeChooser.js +4 -3
- package/lib/components/choosers/TMDistinctValues.d.ts +9 -7
- package/lib/components/choosers/TMDistinctValues.js +149 -142
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMQuickSearchInfo.d.ts +13 -0
- package/lib/components/choosers/TMQuickSearchInfo.js +279 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.d.ts +16 -0
- package/lib/components/choosers/TMQuickSearchSettingsForm.js +94 -0
- package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
- package/lib/components/choosers/TMSelectedValuesSummary.d.ts +13 -0
- package/lib/components/choosers/TMSelectedValuesSummary.js +91 -0
- package/lib/components/choosers/TMUserChooser.d.ts +2 -2
- package/lib/components/editors/TMDropDown.d.ts +3 -0
- package/lib/components/editors/TMDropDown.js +197 -5
- package/lib/components/editors/TMEditorStyled.d.ts +20 -42
- package/lib/components/editors/TMFormulaEditor.d.ts +1 -1
- package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
- package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
- package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
- package/lib/components/features/archive/TMArchive.js +17 -3
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
- package/lib/components/features/documents/TMBatchUpdateForm.js +19 -5
- package/lib/components/features/documents/TMDcmtBlog.d.ts +3 -0
- package/lib/components/features/documents/TMDcmtBlog.js +4 -4
- package/lib/components/features/documents/TMDcmtForm.d.ts +7 -0
- package/lib/components/features/documents/TMDcmtForm.js +178 -51
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +12 -1
- package/lib/components/features/documents/TMDcmtFormActionButtons.js +77 -7
- package/lib/components/features/documents/TMDcmtIcon.d.ts +2 -1
- package/lib/components/features/documents/TMDcmtIcon.js +5 -3
- package/lib/components/features/documents/TMDcmtPreview.d.ts +8 -6
- package/lib/components/features/documents/TMDcmtPreview.js +10 -6
- package/lib/components/features/documents/TMDcmtTasks.d.ts +2 -1
- package/lib/components/features/documents/TMDragDropOverlay.d.ts +1 -1
- package/lib/components/features/documents/TMMasterDetailDcmts.js +95 -33
- package/lib/components/features/documents/TMMasterInfoFields.d.ts +20 -0
- package/lib/components/features/documents/TMMasterInfoFields.js +186 -0
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +3 -3
- package/lib/components/features/documents/TMMergeToPdfForm.js +30 -5
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.d.ts +46 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsForm.js +323 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.d.ts +370 -0
- package/lib/components/features/documents/TMMultiMasterDetailDcmtsUtils.js +283 -0
- package/lib/components/features/documents/TMRelationViewer.d.ts +14 -1
- package/lib/components/features/documents/TMRelationViewer.js +69 -20
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +2 -1
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSearch.js +77 -11
- package/lib/components/features/search/TMSearchQueryEditor.js +5 -3
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +13 -3
- package/lib/components/features/search/TMSearchQueryPanel.js +141 -67
- package/lib/components/features/search/TMSearchResult.d.ts +16 -0
- package/lib/components/features/search/TMSearchResult.js +429 -108
- package/lib/components/features/search/TMSearchResultFloatingActionButton.d.ts +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +2 -1
- package/lib/components/features/search/TMTreeSelector.js +109 -64
- package/lib/components/features/search/TMViewHistoryDcmt.d.ts +2 -1
- package/lib/components/features/tasks/TMTaskForm.d.ts +1 -1
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +10 -10
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksHeader.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksPanelContent.d.ts +1 -1
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +5 -5
- package/lib/components/features/tasks/TMTasksView.d.ts +1 -1
- package/lib/components/features/wg/TMWGsCopyMoveForm.d.ts +3 -2
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +18 -7
- package/lib/components/features/workflow/TMWorkflowPopup.js +8 -4
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.d.ts +3 -1
- package/lib/components/forms/Login/ChangePasswordInputs.d.ts +3 -1
- package/lib/components/forms/Login/Chooser.d.ts +2 -2
- package/lib/components/forms/TMChooserForm.d.ts +2 -1
- package/lib/components/forms/TMSaveForm.d.ts +4 -4
- package/lib/components/grids/TMBlogAttachments.d.ts +2 -1
- package/lib/components/grids/TMBlogAttachments.js +13 -2
- package/lib/components/grids/TMBlogHeader.d.ts +1 -1
- package/lib/components/grids/TMBlogHeader.js +5 -1
- package/lib/components/grids/TMBlogsPost.d.ts +3 -1
- package/lib/components/grids/TMBlogsPost.js +31 -4
- package/lib/components/grids/TMBlogsPostUtils.d.ts +10 -9
- package/lib/components/grids/TMBlogsPostUtils.js +14 -3
- package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +3 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +24 -14
- package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +68 -93
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +5 -6
- package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.js +2 -2
- package/lib/components/layout/panelManager/types.d.ts +3 -0
- package/lib/components/layout/panelManager/utils.js +13 -11
- package/lib/components/pages/TMPage.d.ts +1 -1
- package/lib/components/query/TMQueryEditor.d.ts +14 -10
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
- package/lib/components/sidebar/TMCommandsPanel.d.ts +4 -4
- package/lib/components/sidebar/TMHeader.d.ts +3 -3
- package/lib/components/sidebar/TMHeader.js +30 -20
- package/lib/components/viewers/TMDataListItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +3 -2
- package/lib/components/viewers/TMMidViewer.d.ts +2 -2
- package/lib/components/viewers/TMMidViewer.js +4 -1
- package/lib/components/viewers/TMTidViewer.d.ts +2 -2
- package/lib/components/viewers/TMTidViewer.js +86 -25
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/devextreme-license.d.ts +1 -0
- package/lib/devextreme-license.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +110 -0
- package/lib/helper/SDKUI_Globals.js +151 -0
- package/lib/helper/SDKUI_Localizator.d.ts +44 -0
- package/lib/helper/SDKUI_Localizator.js +440 -0
- package/lib/helper/TMAppUpdatedModal.d.ts +2 -0
- package/lib/helper/TMAppUpdatedModal.js +134 -0
- package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
- package/lib/helper/TMIcons.d.ts +280 -279
- package/lib/helper/TMIcons.js +3 -0
- package/lib/helper/TMPdfViewer.d.ts +2 -1
- package/lib/helper/TMToppyMessage.d.ts +2 -2
- package/lib/helper/TMUtils.d.ts +23 -4
- package/lib/helper/TMUtils.js +24 -2
- package/lib/helper/dataGridSearchHelper.d.ts +28 -0
- package/lib/helper/dataGridSearchHelper.js +51 -0
- package/lib/helper/dcmtsHelper.d.ts +20 -0
- package/lib/helper/dcmtsHelper.js +58 -1
- package/lib/helper/helpers.d.ts +12 -1
- package/lib/helper/helpers.js +25 -1
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +6 -1
- package/lib/helper/queryHelper.js +8 -3
- package/lib/hooks/tmDistinctValuesGridHelper.d.ts +16 -0
- package/lib/hooks/tmDistinctValuesGridHelper.js +31 -0
- package/lib/hooks/useArchiveListForm.d.ts +39 -0
- package/lib/hooks/useArchiveListForm.js +46 -0
- package/lib/hooks/useCaseFlowApprove.d.ts +56 -0
- package/lib/hooks/useCaseFlowApprove.js +157 -0
- package/lib/hooks/useDataUserIdItem.d.ts +1 -0
- package/lib/hooks/useDataUserIdItem.js +1 -0
- package/lib/hooks/useDocumentOperations.d.ts +4 -0
- package/lib/hooks/useDocumentOperations.js +52 -10
- package/lib/hooks/useInputDialog.d.ts +2 -1
- package/lib/hooks/useMultiMasterDetailDcmts.d.ts +113 -0
- package/lib/hooks/useMultiMasterDetailDcmts.js +760 -0
- package/lib/hooks/useRelatedDocuments.d.ts +1 -0
- package/lib/hooks/useRelatedDocuments.js +22 -27
- package/lib/hooks/useShowDossiersV5.d.ts +12 -0
- package/lib/hooks/useShowDossiersV5.js +37 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.d.ts +18 -0
- package/lib/hooks/useTMDistinctValuesMetadataDisplay.js +103 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.d.ts +49 -0
- package/lib/hooks/useTMDistinctValuesQuickSearch.js +307 -0
- package/lib/hooks/useTMDistinctValuesSelection.d.ts +42 -0
- package/lib/hooks/useTMDistinctValuesSelection.js +103 -0
- package/lib/hooks/useTMDistinctValuesSource.d.ts +29 -0
- package/lib/hooks/useTMDistinctValuesSource.js +105 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +5 -2
- package/lib/services/caseflow/CaseFlowService.d.ts +236 -0
- package/lib/services/caseflow/CaseFlowService.js +693 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.d.ts +28 -0
- package/lib/services/caseflow/CaseFlowTemplateCacheService.js +121 -0
- package/lib/services/caseflow/caseFlowNameCache.d.ts +32 -0
- package/lib/services/caseflow/caseFlowNameCache.js +116 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.d.ts +61 -0
- package/lib/services/caseflow/caseFlowWorkItemUtils.js +113 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/index.js +4 -0
- package/lib/services/platform_services.d.ts +4 -3
- package/package.json +9 -5
|
@@ -24,11 +24,9 @@ import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
|
24
24
|
import TMMetadataSorterForm from './TMMetadataSorterForm';
|
|
25
25
|
import TMMetadataOutputForm from './TMMetadataOutputForm';
|
|
26
26
|
import TMTooltip from '../../base/TMTooltip';
|
|
27
|
-
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned }) => {
|
|
27
|
+
const TMSearchQueryPanel = ({ isSearchViewOnScreen = true, fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned, onRefreshRequested, onDcmtTypeReloaded }) => {
|
|
28
28
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
29
29
|
const [qd, setQd] = useState();
|
|
30
|
-
const [shouldSearch, setShouldSearch] = useState(false);
|
|
31
|
-
const [isQueryPanelActive, setIsQueryPanelActive] = useState(false);
|
|
32
30
|
const [lastQdParams, setLastQdParams] = useState([]);
|
|
33
31
|
const [dcmtTypesList, setDcmtTypesList] = useState([]);
|
|
34
32
|
const [showSqdForm, setShowSqdForm] = useState(false);
|
|
@@ -44,10 +42,32 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
44
42
|
const deviceType = useDeviceType();
|
|
45
43
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
46
44
|
let initialMaxItems = deviceType === DeviceType.MOBILE ? 8 : 12;
|
|
45
|
+
const tmPanelRef = useRef(null);
|
|
46
|
+
// Contenitore del form: l'Invio avvia la ricerca solo se il focus si trova al suo interno
|
|
47
|
+
const contentRef = useRef(null);
|
|
48
|
+
// Passando nella vista risultati si prenota il focus, che verrà ripreso al rientro nella ricerca
|
|
49
|
+
const shouldRefocusOnReturnRef = useRef(false);
|
|
47
50
|
const appliedInputMidsRef = useRef(null);
|
|
48
51
|
const pendingMidsRef = useRef(null);
|
|
49
|
-
//
|
|
50
|
-
const
|
|
52
|
+
// Impedisce ricerche sovrapposte (doppio Invio, o Invio mentre la precedente e' ancora in corso)
|
|
53
|
+
const isSearchingRef = useRef(false);
|
|
54
|
+
// Snapshot letti da runSearch al momento dell'esecuzione: evitano di cercare con dati stantii
|
|
55
|
+
const qdRef = useRef(undefined);
|
|
56
|
+
const showAdvancedSearchRef = useRef(false);
|
|
57
|
+
const searchAsyncRef = useRef();
|
|
58
|
+
const reloadMetadataAsyncRef = useRef();
|
|
59
|
+
// Tornando dalla vista risultati il pannello dei metadati di ricerca riprende il focus,
|
|
60
|
+
// così è lui quello evidenziato: prendendo il focus gli altri pannelli ricevono l'onBlur e si disattivano
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!isSearchViewOnScreen) {
|
|
63
|
+
shouldRefocusOnReturnRef.current = true;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!shouldRefocusOnReturnRef.current)
|
|
67
|
+
return;
|
|
68
|
+
shouldRefocusOnReturnRef.current = false;
|
|
69
|
+
tmPanelRef.current?.focusPanel();
|
|
70
|
+
}, [isSearchViewOnScreen]);
|
|
51
71
|
useEffect(() => {
|
|
52
72
|
if (!SQD)
|
|
53
73
|
return;
|
|
@@ -120,39 +140,6 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
120
140
|
setQd({ ...qd, where: newWhere });
|
|
121
141
|
setShowAllMdWhere(true);
|
|
122
142
|
}, [qd, fromDTD, inputMids]);
|
|
123
|
-
// Eseguire la ricerca quando shouldSearch è true e qd è definito
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
if (shouldSearch && qd) {
|
|
126
|
-
const executeSearch = async () => {
|
|
127
|
-
// Legge e consuma il flag "accoda" impostato dall'azione secondaria del bottone Ricerca
|
|
128
|
-
const append = appendNextSearchRef.current;
|
|
129
|
-
appendNextSearchRef.current = false;
|
|
130
|
-
await searchAsync(qd, showAdvancedSearch, append);
|
|
131
|
-
setShouldSearch(false); // Resetta il trigger dopo la ricerca
|
|
132
|
-
};
|
|
133
|
-
executeSearch();
|
|
134
|
-
}
|
|
135
|
-
}, [shouldSearch, qd, showAdvancedSearch]);
|
|
136
|
-
// Se il pannello è attivo e non ci sono modali aperti, rimuove il focus e avvia la ricerca
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const handleKeyDown = (e) => {
|
|
139
|
-
if (isQueryPanelActive && !modalIsOpen) {
|
|
140
|
-
if (e.key === 'Enter') {
|
|
141
|
-
e.preventDefault();
|
|
142
|
-
// Disattiva l'elemento attivo per forzare l'onBlur
|
|
143
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
144
|
-
document.activeElement.blur();
|
|
145
|
-
}
|
|
146
|
-
// Attiva il flag di ricerca. L'useEffect sopra gestirà l'attesa di qd.
|
|
147
|
-
setShouldSearch(true);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
152
|
-
return () => {
|
|
153
|
-
window.removeEventListener('keydown', handleKeyDown);
|
|
154
|
-
};
|
|
155
|
-
}, [isQueryPanelActive, modalIsOpen]);
|
|
156
143
|
const setDataAsync = async (sqd) => {
|
|
157
144
|
let newSqd = (sqd?.id == 1) ? sqd : await SavedQueryCacheService.GetAsync(sqd?.id);
|
|
158
145
|
let newQd = SearchEngine.NormalizeQueryDescriptor(newSqd?.qd);
|
|
@@ -184,11 +171,92 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
184
171
|
let results = [];
|
|
185
172
|
if (searchResult?.result)
|
|
186
173
|
results.push(searchResult?.result);
|
|
187
|
-
// Before notifying onSearchComplete, let's set the panel to NOT active
|
|
188
|
-
setIsQueryPanelActive(false);
|
|
189
174
|
onSearchCompleted?.(results, searchResult?.qd, append);
|
|
190
175
|
}
|
|
191
176
|
};
|
|
177
|
+
// Tra l'apertura della ricerca e il click su Ricerca la lista dei metadati del tipo documento può essere
|
|
178
|
+
// cambiata (metadati aggiunti o rimossi lato amministrazione): prima di cercare si rileggono dal server.
|
|
179
|
+
// I valori digitati restano, mentre i filtri sui metadati non più disponibili vengono scartati.
|
|
180
|
+
// Restituisce il qd con cui eseguire la ricerca.
|
|
181
|
+
const reloadMetadataAsync = async (qdInput) => {
|
|
182
|
+
if (!qdInput?.from?.tid)
|
|
183
|
+
return qdInput;
|
|
184
|
+
let dcmtTypes;
|
|
185
|
+
try {
|
|
186
|
+
TMSpinner.show({ description: `${SDKUI_Localizator.Loading} ...`, backgroundColor: 'transparent' });
|
|
187
|
+
dcmtTypes = await getDcmtTypesByQdAsync(qdInput, true);
|
|
188
|
+
}
|
|
189
|
+
finally {
|
|
190
|
+
TMSpinner.hide();
|
|
191
|
+
}
|
|
192
|
+
// Rilettura non riuscita: si cerca con i metadati che si hanno, senza scartare nulla
|
|
193
|
+
if (dcmtTypes.length <= 0)
|
|
194
|
+
return qdInput;
|
|
195
|
+
setDcmtTypesList(dcmtTypes);
|
|
196
|
+
const reloadedFromDTD = dcmtTypes.find(o => o.id === qdInput.from?.tid);
|
|
197
|
+
if (reloadedFromDTD)
|
|
198
|
+
onDcmtTypeReloaded?.(reloadedFromDTD);
|
|
199
|
+
const { qd: newQd, removedCount } = dropUnavailableMetadataFromQd(qdInput, dcmtTypes);
|
|
200
|
+
if (removedCount <= 0)
|
|
201
|
+
return qdInput;
|
|
202
|
+
setQd(newQd);
|
|
203
|
+
return newQd;
|
|
204
|
+
};
|
|
205
|
+
// Allineati a ogni render: runSearch li legge quando esegue, non quando viene creata
|
|
206
|
+
qdRef.current = qd;
|
|
207
|
+
showAdvancedSearchRef.current = showAdvancedSearch;
|
|
208
|
+
searchAsyncRef.current = searchAsync;
|
|
209
|
+
reloadMetadataAsyncRef.current = reloadMetadataAsync;
|
|
210
|
+
// Unico punto di avvio della ricerca: bottone Ricerca, Ricerca e accoda e tasto Invio passano tutti da qui
|
|
211
|
+
const runSearch = useCallback((append) => {
|
|
212
|
+
if (isSearchingRef.current)
|
|
213
|
+
return;
|
|
214
|
+
isSearchingRef.current = true;
|
|
215
|
+
// Toglie il focus per far committare il valore del campo in editing
|
|
216
|
+
if (document.activeElement instanceof HTMLElement)
|
|
217
|
+
document.activeElement.blur();
|
|
218
|
+
// Alcuni editor committano il valore in modo asincrono: si attende un tick prima di leggere il qd definitivo
|
|
219
|
+
setTimeout(async () => {
|
|
220
|
+
try {
|
|
221
|
+
// I metadati si rileggono a ogni ricerca: si cerca sempre sulla lista aggiornata
|
|
222
|
+
const qdToSearch = await reloadMetadataAsyncRef.current?.(qdRef.current) ?? qdRef.current;
|
|
223
|
+
await searchAsyncRef.current?.(qdToSearch, showAdvancedSearchRef.current, append);
|
|
224
|
+
}
|
|
225
|
+
catch (ex) {
|
|
226
|
+
TMExceptionBoxManager.show({ exception: ex });
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
isSearchingRef.current = false;
|
|
230
|
+
}
|
|
231
|
+
}, 0);
|
|
232
|
+
}, []);
|
|
233
|
+
// I dialoghi (TMModal/chooser) escono da contentRef perche' DevExtreme Popup li rende in un portale su document.body:
|
|
234
|
+
// il controllo di contenimento li esclude gia'. Questi flag coprono il caso in cui il focus sia sul contenitore del pannello.
|
|
235
|
+
// NB: si usano solo flag locali affidabili, non modalIsOpen, che resterebbe a true se un chooser venisse smontato senza onClose.
|
|
236
|
+
const isAnyDialogOpen = showFiltersConfig || showOutputConfig || showMetadataSorterForm || showSqdForm || showDistinctValuesPanel;
|
|
237
|
+
// L'Invio avvia SEMPRE la ricerca quando il focus e' nel form di ricerca (o sul pannello che lo contiene).
|
|
238
|
+
// Il criterio e' il contenimento nel DOM, non uno stato di "pannello attivo" che puo' desincronizzarsi.
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
const handleKeyDown = (e) => {
|
|
241
|
+
if (e.key !== 'Enter' || e.repeat)
|
|
242
|
+
return;
|
|
243
|
+
if (isAnyDialogOpen)
|
|
244
|
+
return;
|
|
245
|
+
const content = contentRef.current;
|
|
246
|
+
const target = e.target;
|
|
247
|
+
if (!content || !target)
|
|
248
|
+
return;
|
|
249
|
+
const isInsideForm = content.contains(target);
|
|
250
|
+
// Al rientro dai risultati il focus e' sul contenitore del pannello, che e' antenato del form
|
|
251
|
+
const isPanelContainer = target !== document.body && target !== document.documentElement && target.contains(content);
|
|
252
|
+
if (!isInsideForm && !isPanelContainer)
|
|
253
|
+
return;
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
runSearch(false);
|
|
256
|
+
};
|
|
257
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
258
|
+
return () => { window.removeEventListener('keydown', handleKeyDown); };
|
|
259
|
+
}, [isAnyDialogOpen, runSearch]);
|
|
192
260
|
const updateIsModalOpen = useCallback((isOpen) => {
|
|
193
261
|
setModalIsOpen(isOpen);
|
|
194
262
|
}, []);
|
|
@@ -215,36 +283,15 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
215
283
|
}
|
|
216
284
|
}
|
|
217
285
|
};
|
|
218
|
-
const handleSearchButtonClick = useCallback(
|
|
219
|
-
|
|
220
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
221
|
-
document.activeElement.blur();
|
|
222
|
-
}
|
|
223
|
-
// Ricerca normale: azzera l'eventuale flag accoda e avvia
|
|
224
|
-
appendNextSearchRef.current = false;
|
|
225
|
-
setShouldSearch(true);
|
|
226
|
-
}, []);
|
|
227
|
-
const handleSearchAndAppendClick = useCallback(() => {
|
|
228
|
-
// Propagazione blur
|
|
229
|
-
if (document.activeElement instanceof HTMLElement) {
|
|
230
|
-
document.activeElement.blur();
|
|
231
|
-
}
|
|
232
|
-
// Ricerca e accoda: imposta il flag consumato da executeSearch
|
|
233
|
-
appendNextSearchRef.current = true;
|
|
234
|
-
setShouldSearch(true);
|
|
235
|
-
}, []);
|
|
286
|
+
const handleSearchButtonClick = useCallback(() => { runSearch(false); }, [runSearch]);
|
|
287
|
+
const handleSearchAndAppendClick = useCallback(() => { runSearch(true); }, [runSearch]);
|
|
236
288
|
const searchButtonSecondaryActions = useMemo(() => [{
|
|
237
289
|
name: SDKUI_Localizator.SearchAndAppend,
|
|
238
290
|
icon: _jsx(IconSearch, {}),
|
|
239
291
|
onClick: handleSearchAndAppendClick
|
|
240
292
|
}], [handleSearchAndAppendClick]);
|
|
241
293
|
const handleQdChanged = useCallback((newQd) => {
|
|
242
|
-
|
|
243
|
-
setQd(newQd);
|
|
244
|
-
}
|
|
245
|
-
}, []);
|
|
246
|
-
const handlePanelActiveChanged = useCallback((isActive) => {
|
|
247
|
-
setIsQueryPanelActive(isActive);
|
|
294
|
+
setQd(prev => deepCompare(prev, newQd) ? prev : newQd);
|
|
248
295
|
}, []);
|
|
249
296
|
const handleAdvancedMenuClick = useCallback((e) => {
|
|
250
297
|
if (e.button === AdvancedMenuButtons.DistinctValues) {
|
|
@@ -342,10 +389,10 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
342
389
|
return false;
|
|
343
390
|
return qd?.orderBy && qd.orderBy.length > 0;
|
|
344
391
|
}, [showAdvancedSearch, qd?.orderBy]);
|
|
345
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack,
|
|
346
|
-
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false
|
|
392
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMPanel, { ref: tmPanelRef, title: fromDTD?.nameLoc ?? SDKUI_Localizator.Search_Metadata, allowMaximize: allowMaximize, onMaximize: onMaximizePanel, onHeaderDoubleClick: onMaximizePanel, onBack: onBack, onRefresh: (!SQD || showSqdForm) ? undefined : onRefreshRequested, toolbar: _jsx(_Fragment, { children: (SQD && !showSqdForm) ?
|
|
393
|
+
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false }) })
|
|
347
394
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
348
|
-
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: showSqdForm ? 'none' : 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
395
|
+
? _jsxs("div", { ref: contentRef, onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: showSqdForm ? 'none' : 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
349
396
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged, updateIsModalOpen: updateIsModalOpen })
|
|
350
397
|
: _jsx(TMSearchQueryEditor, { qd: qd, dcmtTypesList: dcmtTypesList, isExpertMode: isExpertMode, showAllMdWhere: showAllMdWhere, onQdChanged: handleQdChanged, onFocusedMetadataChanged: setFocusedTidMid, onAdvancedMenuClick: handleAdvancedMenuClick, updateIsModalOpen: updateIsModalOpen }), shouldShowOutputBadges && qd?.select && qd.select.length > 0 && (_jsxs(StyledSelectBadgesContainer, { children: [_jsxs(StyledSelectLabel, { children: [SDK_Localizator.QuerySelect, ":"] }), _jsx(StyledSelectBadgesWrapper, { children: (() => {
|
|
351
398
|
const selectItems = qd.select ?? [];
|
|
@@ -403,6 +450,33 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
403
450
|
} })] }));
|
|
404
451
|
};
|
|
405
452
|
export default TMSearchQueryPanel;
|
|
453
|
+
/** Scarta dal qd filtri, colonne e ordinamenti sui metadati non più esistenti o non più accessibili, in base
|
|
454
|
+
* alla lista dei metadati appena riletta dal server. I valori digitati su quelli ancora presenti si mantengono. */
|
|
455
|
+
const dropUnavailableMetadataFromQd = (qdInput, dcmtTypes) => {
|
|
456
|
+
const metadataOf = (tid) => dcmtTypes.find(o => o.id === tid)?.metadata;
|
|
457
|
+
// Un tipo documento non riletto non è verificabile: i suoi item si mantengono così come sono.
|
|
458
|
+
// Sui metadati di sistema si verifica solo l'esistenza: i loro permessi non li rendono inutilizzabili.
|
|
459
|
+
const isStillAvailable = (tid, mid, isUsable) => {
|
|
460
|
+
const metadata = metadataOf(tid);
|
|
461
|
+
if (!metadata || metadata.length <= 0 || mid == undefined)
|
|
462
|
+
return true;
|
|
463
|
+
const md = metadata.find(o => o.id === mid);
|
|
464
|
+
if (!md)
|
|
465
|
+
return false;
|
|
466
|
+
return md.isSystem == 1 || isUsable(md);
|
|
467
|
+
};
|
|
468
|
+
const canSearch = (md) => md.perm?.canSearch != AccessLevels.No;
|
|
469
|
+
const canOutput = (md) => !(md.perm?.canView == AccessLevels.No && md.perm?.canUpdate == AccessLevels.No);
|
|
470
|
+
const where = qdInput.where?.filter(o => isStillAvailable(o.tid, o.mid, canSearch)) ?? [];
|
|
471
|
+
const select = qdInput.select?.filter(o => isStillAvailable(o.tid, o.mid, canOutput)) ?? [];
|
|
472
|
+
const orderBy = qdInput.orderBy?.filter(o => isStillAvailable(o.tid, o.mid, canOutput)) ?? [];
|
|
473
|
+
const removedCount = ((qdInput.where?.length ?? 0) - where.length)
|
|
474
|
+
+ ((qdInput.select?.length ?? 0) - select.length)
|
|
475
|
+
+ ((qdInput.orderBy?.length ?? 0) - orderBy.length);
|
|
476
|
+
let qd = new QueryDescriptor();
|
|
477
|
+
qd.init({ ...qdInput, where: where, select: select, orderBy: orderBy });
|
|
478
|
+
return { qd: qd, removedCount: removedCount };
|
|
479
|
+
};
|
|
406
480
|
const searchByQdAsync = async (qdInput, searchParams) => {
|
|
407
481
|
let result;
|
|
408
482
|
let qdSearch;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, HomeBlogPost, ObjectRef, SearchResultDescriptor, TaskDescriptor, WorkingGroupDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
3
|
import { IntesiCertificateData } from '../../../helper';
|
|
4
|
+
import { ITMCounterContainerProps } from '../../base/TMCounterContainer';
|
|
4
5
|
import { DcmtInfo, IGraphometricManagerProp, SearchResultContext, TaskContext } from '../../../ts';
|
|
5
6
|
import { TMSearchResultFloatingActionConfig } from './TMSearchResultFloatingActionButton';
|
|
6
7
|
export declare const getSearchResultCountersSingleCategory: (searchResults: SearchResultDescriptor[]) => string;
|
|
@@ -25,6 +26,8 @@ interface ITMSearchResultProps {
|
|
|
25
26
|
showSelector?: boolean;
|
|
26
27
|
showToolbarHeader?: boolean;
|
|
27
28
|
showBackButton?: boolean;
|
|
29
|
+
backCaption?: string;
|
|
30
|
+
showToolbarCloseButton?: boolean;
|
|
28
31
|
disableAccordionIfSingleCategory?: boolean;
|
|
29
32
|
enablePinIcons?: boolean;
|
|
30
33
|
editPdfForm?: boolean;
|
|
@@ -33,10 +36,23 @@ interface ITMSearchResultProps {
|
|
|
33
36
|
showToppyDraggableHelpCenter?: boolean;
|
|
34
37
|
toppyHelpCenterUsePortal?: boolean;
|
|
35
38
|
showNoDcmtFoundMessage?: boolean;
|
|
39
|
+
showCounterConfig?: boolean;
|
|
40
|
+
/** Mostra in testa alla griglia la colonna con le azioni di riga (modifica, duplica, cancella) */
|
|
41
|
+
showActionsColumn?: boolean;
|
|
42
|
+
/** Rende compatto il paginatore della griglia: utile quando il risultato è dentro pannelli bassi (es. accordion) */
|
|
43
|
+
compactPager?: boolean;
|
|
44
|
+
/** Sostituisce l'azione "duplica" della colonna di riga, che passa qui la riga cliccata: il menu contestuale resta invariato. I valori di riga della griglia sono stringhe */
|
|
45
|
+
onRowDuplicateRequest?: (rowData: {
|
|
46
|
+
TID?: number | string;
|
|
47
|
+
DID?: number | string;
|
|
48
|
+
FILEEXT?: string;
|
|
49
|
+
}) => void;
|
|
50
|
+
counterConfig?: ITMCounterContainerProps;
|
|
36
51
|
onClose?: () => void;
|
|
37
52
|
openInOffice?: (selectedDcmtsOrFocused: Array<DcmtInfo>) => Promise<void>;
|
|
38
53
|
onWFOperationCompleted?: () => Promise<void>;
|
|
39
54
|
onSelectedTIDChanged?: (TID: number) => void;
|
|
55
|
+
onSelectedTIDCleared?: () => void;
|
|
40
56
|
onRefreshSearchAsyncDatagrid?: () => Promise<void>;
|
|
41
57
|
onRefreshAfterAddDcmtToFavs?: () => void;
|
|
42
58
|
onFileOpened?: (blob: File | undefined) => void;
|