@topconsultnpm/sdkui-react 6.21.0-t2 → 6.21.0-t3
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 +22 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +4 -4
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +6 -6
- package/lib/components/base/Styled.d.ts +1 -1
- package/lib/components/base/TMAreaManager.js +11 -0
- 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.js +12 -2
- package/lib/components/base/TMDataGridExportForm.d.ts +2 -1
- package/lib/components/base/TMDataGridExportForm.js +19 -8
- package/lib/components/base/TMFileManager.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -1
- package/lib/components/base/TMFileManagerDataGridView.js +4 -4
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +1 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +3 -3
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +1 -1
- package/lib/components/base/TMFileManagerUtils.d.ts +7 -0
- package/lib/components/base/TMFileManagerUtils.js +14 -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.js +2 -2
- package/lib/components/base/TMPopUp.d.ts +1 -0
- package/lib/components/base/TMPopUp.js +59 -2
- package/lib/components/base/TMSpinner.d.ts +5 -2
- package/lib/components/base/TMSpinner.js +33 -6
- package/lib/components/base/TMTab.d.ts +4 -3
- package/lib/components/base/TMTooltip.d.ts +1 -1
- package/lib/components/base/TMTreeView.d.ts +1 -1
- package/lib/components/base/TMTreeView.js +12 -15
- 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 +5 -2
- package/lib/components/base/TMWaitPanel.js +8 -6
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +1 -1
- package/lib/components/choosers/TMDynDataListItemChooser.js +6 -1
- package/lib/components/choosers/TMGroupChooser.js +1 -1
- package/lib/components/choosers/TMInvoiceRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMOrderRetrieveFormats.d.ts +2 -1
- package/lib/components/choosers/TMRelationChooser.d.ts +3 -3
- package/lib/components/choosers/TMUserChooser.d.ts +2 -2
- package/lib/components/editors/TMEditorStyled.d.ts +6 -6
- package/lib/components/editors/TMFormulaEditor.d.ts +2 -1
- package/lib/components/editors/TMFormulaEditor.js +98 -49
- package/lib/components/editors/TMHtmlContentDisplay.d.ts +2 -1
- package/lib/components/editors/TMHtmlEditor.d.ts +2 -1
- package/lib/components/editors/TMMetadataEditor.js +6 -2
- package/lib/components/editors/TMMetadataValues.js +23 -6
- package/lib/components/editors/TMTreeDropDown.d.ts +1 -1
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +1 -1
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -1
- package/lib/components/features/blog/TMBlogCommentForm.js +5 -2
- package/lib/components/features/documents/TMCopyToFolderForm.js +46 -24
- package/lib/components/features/documents/TMDcmtForm.js +19 -9
- package/lib/components/features/documents/TMDcmtFormActionButtons.d.ts +1 -1
- package/lib/components/features/documents/TMDcmtIcon.d.ts +2 -1
- package/lib/components/features/documents/TMDcmtIcon.js +1 -1
- package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -1
- 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.d.ts +0 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +4 -5
- package/lib/components/features/documents/TMMergeToPdfForm.d.ts +0 -2
- package/lib/components/features/documents/TMMergeToPdfForm.js +26 -10
- package/lib/components/features/documents/TMRelationViewer.js +8 -3
- package/lib/components/features/documents/copyAndMergeDcmtsShared.d.ts +0 -13
- package/lib/components/features/documents/copyAndMergeDcmtsShared.js +1 -39
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +2 -1
- package/lib/components/features/search/TMMetadataOutputForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataOutputForm.js +225 -0
- package/lib/components/features/search/TMMetadataSorterForm.d.ts +18 -0
- package/lib/components/features/search/TMMetadataSorterForm.js +243 -0
- package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
- package/lib/components/features/search/TMSearch.d.ts +0 -2
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchQueryEditor.js +14 -8
- package/lib/components/features/search/TMSearchQueryPanel.js +249 -58
- package/lib/components/features/search/TMSearchResult.d.ts +1 -2
- package/lib/components/features/search/TMSearchResult.js +40 -20
- 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/TMViewHistoryDcmt.d.ts +2 -1
- package/lib/components/features/search/TMViewHistoryDcmt.js +1 -1
- package/lib/components/features/search/metadataFormHelper.d.ts +16 -0
- package/lib/components/features/search/metadataFormHelper.js +77 -0
- 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 +8 -7
- package/lib/components/forms/Login/Chooser.d.ts +2 -2
- package/lib/components/forms/Login/TMLoginForm.js +15 -3
- 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 +2 -2
- package/lib/components/grids/TMBlogHeader.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.d.ts +1 -1
- package/lib/components/grids/TMBlogsPost.js +5 -3
- package/lib/components/grids/TMBlogsPostUtils.d.ts +10 -9
- package/lib/components/grids/TMBlogsPostUtils.js +3 -1
- package/lib/components/grids/TMValidationItemsList.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContext.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.d.ts +1 -1
- package/lib/components/layout/panelManager/TMPanelManagerWithPersistenceProvider.d.ts +2 -2
- package/lib/components/layout/panelManager/TMPanelWrapper.d.ts +2 -2
- package/lib/components/pages/TMPage.d.ts +1 -1
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/sidebar/TMAboutApp.d.ts +2 -1
- package/lib/components/sidebar/TMHeader.d.ts +3 -3
- 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/TMTidViewer.d.ts +2 -2
- package/lib/components/wizard/TMWizard.d.ts +1 -0
- package/lib/components/wizard/TMWizard.js +5 -3
- package/lib/helper/Enum_Localizator.js +1 -0
- package/lib/helper/MergePdfManager.d.ts +45 -0
- package/lib/helper/MergePdfManager.js +148 -0
- package/lib/helper/SDKUI_Globals.js +2 -1
- package/lib/helper/SDKUI_Localizator.d.ts +6 -0
- package/lib/helper/SDKUI_Localizator.js +60 -0
- package/lib/helper/TMCommandsContextMenu.d.ts +1 -1
- package/lib/helper/TMIcons.d.ts +278 -278
- package/lib/helper/TMPdfViewer.d.ts +2 -1
- package/lib/helper/TMToppyMessage.d.ts +2 -2
- package/lib/helper/TMUtils.d.ts +24 -20
- package/lib/helper/TMUtils.js +55 -0
- package/lib/helper/checkinCheckoutManager.d.ts +4 -3
- package/lib/helper/checkinCheckoutManager.js +29 -11
- package/lib/helper/helpers.d.ts +3 -2
- package/lib/helper/helpers.js +1 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +4 -3
- package/lib/hooks/useDataUserIdItem.js +1 -1
- package/lib/hooks/useDcmtOperations.d.ts +18 -1
- package/lib/hooks/useDcmtOperations.js +235 -24
- package/lib/hooks/useDocumentOperations.d.ts +0 -2
- package/lib/hooks/useDocumentOperations.js +27 -10
- package/lib/hooks/useInputDialog.d.ts +2 -1
- package/lib/hooks/useRelatedDocuments.js +4 -4
- package/lib/services/platform_services.d.ts +7 -6
- package/lib/ts/types.d.ts +2 -1
- package/lib/ts/types.js +1 -0
- package/package.json +14 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { PlatformObjectValidator, QueryDescriptor, WhereItem, SDK_Localizator,
|
|
3
|
+
import { PlatformObjectValidator, QueryDescriptor, WhereItem, SDK_Localizator, SelectItemVisibilities, SDK_Globals, SavedQueryCacheService, SearchEngine, QueryOperators, AccessLevelsEx, AccessLevels } 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, DEFAULT_MAX_DCMTS_TO_BE_RETURNED } 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, IconSortAsc, IconSortDesc, IconFilter, IconColumns, IconSort } from '../../../helper';
|
|
7
7
|
import { useQueryParametersDialog } from '../../../hooks/useQueryParametersDialog';
|
|
8
8
|
import { FormModes } from '../../../ts';
|
|
9
9
|
import { TMColors } from '../../../utils/theme';
|
|
@@ -21,6 +21,9 @@ import TMSavedQueryForm from './TMSavedQueryForm';
|
|
|
21
21
|
import { ContextMenu } from '../../NewComponents/ContextMenu';
|
|
22
22
|
import { AdvancedMenuButtons } from '../../editors/TMMetadataValues';
|
|
23
23
|
import TMToppyMessage from '../../../helper/TMToppyMessage';
|
|
24
|
+
import TMMetadataSorterForm from './TMMetadataSorterForm';
|
|
25
|
+
import TMMetadataOutputForm from './TMMetadataOutputForm';
|
|
26
|
+
import TMTooltip from '../../base/TMTooltip';
|
|
24
27
|
const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, SQD, inputMids, onSearchCompleted, onSqdSaved, onBack, onClosePanel, allowMaximize = true, onMaximizePanel, onBackToResult, passToArchiveCallback, maxDcmtsToBeReturned }) => {
|
|
25
28
|
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
26
29
|
const [qd, setQd] = useState();
|
|
@@ -34,7 +37,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
34
37
|
const [showAdvancedSearch, setShowAdvancedSearch] = useState(false);
|
|
35
38
|
const [showFiltersConfig, setShowFiltersConfig] = useState(false);
|
|
36
39
|
const [showOutputConfig, setShowOutputConfig] = useState(false);
|
|
37
|
-
const [
|
|
40
|
+
const [showMetadataSorterForm, setShowMetadataSorterForm] = useState(false);
|
|
38
41
|
const [showDistinctValuesPanel, setShowDistinctValuesPanel] = useState(false);
|
|
39
42
|
const [focusedTidMid, setFocusedTidMid] = useState();
|
|
40
43
|
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
@@ -162,7 +165,7 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
162
165
|
newWi.init({ ...curItem, value1: undefined, value2: undefined });
|
|
163
166
|
return newWi;
|
|
164
167
|
});
|
|
165
|
-
setQd({ ...qd, where: newWhere });
|
|
168
|
+
setQd({ ...qd, where: newWhere, orderBy: [] });
|
|
166
169
|
};
|
|
167
170
|
const searchAsync = async (qdInput, isAdvancedSearch) => {
|
|
168
171
|
onSearchCompleted?.([], undefined); // reset results
|
|
@@ -266,70 +269,84 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
266
269
|
setQd({ ...qd, where: newWhere });
|
|
267
270
|
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
268
271
|
const handleCloseOutputConfig = useCallback(() => setShowOutputConfig(false), []);
|
|
269
|
-
const handleChooseOutput = useCallback((tid_mids) => {
|
|
270
|
-
if (!fromDTD?.metadata)
|
|
271
|
-
return;
|
|
272
|
-
if (!tid_mids)
|
|
273
|
-
return;
|
|
274
|
-
// copia dei SelectItems senza i rimossi
|
|
275
|
-
let newSelect = qd?.select?.filter(item => tid_mids?.some(tm => tm.mid == item.mid)) ?? [];
|
|
276
|
-
// aggiungiamo i nuovi
|
|
277
|
-
for (const tm of tid_mids.filter(tm => !qd?.select?.some(item => item.mid == tm.mid))) {
|
|
278
|
-
let md = fromDTD?.metadata.find(o => o.id == tm.mid);
|
|
279
|
-
let si = new SelectItem();
|
|
280
|
-
si.visibility = SelectItemVisibilities.Visible;
|
|
281
|
-
si.tid = SQD?.masterTID;
|
|
282
|
-
si.mid = md?.id;
|
|
283
|
-
let indexMD = 0;
|
|
284
|
-
for (const m of fromDTD?.metadata ?? []) {
|
|
285
|
-
if (m.id == si.mid)
|
|
286
|
-
break;
|
|
287
|
-
if (newSelect.findIndex(o => o.mid == m.id && o.tid == SQD?.masterTID) < 0)
|
|
288
|
-
continue;
|
|
289
|
-
indexMD++;
|
|
290
|
-
}
|
|
291
|
-
newSelect.splice(indexMD, 0, si);
|
|
292
|
-
}
|
|
293
|
-
setQd({ ...qd, select: newSelect });
|
|
294
|
-
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
295
|
-
const handleCloseOrderByConfig = useCallback(() => setShowOrderByConfig(false), []);
|
|
296
|
-
const handleChooseOrderBy = useCallback((tid_mids) => {
|
|
297
|
-
if (!fromDTD?.metadata)
|
|
298
|
-
return;
|
|
299
|
-
if (!tid_mids)
|
|
300
|
-
return;
|
|
301
|
-
// copia dei OrderByItems senza i rimossi
|
|
302
|
-
let newOrderBy = qd?.orderBy?.filter(item => tid_mids?.some(tm => tm.mid == item.mid)) ?? [];
|
|
303
|
-
// aggiungiamo i nuovi
|
|
304
|
-
for (const tm of tid_mids.filter(tm => !qd?.orderBy?.some(item => item.mid == tm.mid))) {
|
|
305
|
-
let md = fromDTD?.metadata.find(o => o.id == tm.mid);
|
|
306
|
-
let oi = new OrderByItem();
|
|
307
|
-
oi.tid = SQD?.masterTID;
|
|
308
|
-
oi.mid = md?.id;
|
|
309
|
-
oi.asc = true;
|
|
310
|
-
newOrderBy.push(oi);
|
|
311
|
-
}
|
|
312
|
-
setQd({ ...qd, orderBy: newOrderBy });
|
|
313
|
-
}, [qd, fromDTD?.metadata, SQD?.masterTID]);
|
|
314
272
|
const contextMenuItems = useMemo(() => [
|
|
315
273
|
...(showBackToResultButton ? [{ icon: _jsx(IconArrowRight, {}), name: "Vai a risultato", onClick: () => { onBackToResult?.(); } }] : []),
|
|
316
274
|
{ icon: _jsx(IconAddCircleOutline, {}), name: SDKUI_Localizator.SavedQueryNew, beginGroup: showBackToResultButton, onClick: () => { openSqdForm(FormModes.Create); } },
|
|
317
275
|
{ icon: _jsx(IconEdit, {}), name: SDKUI_Localizator.SavedQueryUpdate, disabled: (SQD && SQD.id == 1), onClick: () => { openSqdForm(FormModes.Update); } },
|
|
318
276
|
{ icon: showAdvancedSearch ? _jsx(IconEasy, {}) : _jsx(IconAdvanced, {}), beginGroup: true, name: showAdvancedSearch ? SDKUI_Localizator.Search_Easy : SDKUI_Localizator.Search_Advanced, onClick: () => { changeAdvancedSearchAsync(!showAdvancedSearch); } },
|
|
319
|
-
{ icon: _jsx(
|
|
320
|
-
{ icon: _jsx(
|
|
321
|
-
{ icon: _jsx(
|
|
277
|
+
{ icon: _jsx(IconFilter, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryWhere}`, beginGroup: true, onClick: () => { setShowFiltersConfig(true); } },
|
|
278
|
+
{ icon: _jsx(IconColumns, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QuerySelect}`, onClick: () => { setShowOutputConfig(true); } },
|
|
279
|
+
{ icon: _jsx(IconSort, {}), name: `${SDKUI_Localizator.Configure} - ${SDK_Localizator.QueryOrderBy}`, onClick: () => { setShowMetadataSorterForm(true); } },
|
|
322
280
|
{ icon: _jsx(IconMenuCAArchive, { viewBox: '11 11.5 26 27', fontSize: 16, strokeWidth: 2, color: 'black' }), beginGroup: true, name: SDKUI_Localizator.PassToArchive, disabled: fromDTD?.perm?.canArchive !== AccessLevelsEx.Yes && fromDTD?.perm?.canArchive !== AccessLevelsEx.Mixed, onClick: handlePassToArchive }
|
|
323
|
-
], [showBackToResultButton, showAdvancedSearch, SQD, onBackToResult, openSqdForm, changeAdvancedSearchAsync, setShowFiltersConfig, setShowOutputConfig,
|
|
281
|
+
], [showBackToResultButton, showAdvancedSearch, SQD, onBackToResult, openSqdForm, changeAdvancedSearchAsync, setShowFiltersConfig, setShowOutputConfig, handlePassToArchive, fromDTD?.perm?.canArchive]);
|
|
324
282
|
const captionText = showAllMdWhere ? SDKUI_Localizator.ShowLess : SDKUI_Localizator.ShowAll;
|
|
325
283
|
let maxItems = getListMaxItems(deviceType ?? DeviceType.DESKTOP);
|
|
326
284
|
const diff = (qd?.where?.length ?? 0) - maxItems;
|
|
285
|
+
// Calcola se mostrare i badges di output
|
|
286
|
+
// Non mostrare se: modalità avanzata, tutti i metadati selezionati, o tutti tranne quelli di sistema
|
|
287
|
+
const shouldShowOutputBadges = useMemo(() => {
|
|
288
|
+
// In modalità avanzata non mostrare mai i badges di output
|
|
289
|
+
if (showAdvancedSearch)
|
|
290
|
+
return false;
|
|
291
|
+
if (!qd?.select || qd.select.length === 0)
|
|
292
|
+
return false;
|
|
293
|
+
if (!fromDTD?.metadata)
|
|
294
|
+
return true;
|
|
295
|
+
// Filtra i metadati disponibili per output (stessa logica usata in TMMetadataOutputForm)
|
|
296
|
+
const availableOutputMetadata = fromDTD.metadata.filter(o => o.perm?.canView === AccessLevels.Yes || o.perm?.canUpdate === AccessLevels.Yes);
|
|
297
|
+
// Metadati non di sistema disponibili per output
|
|
298
|
+
const availableNonSystemMetadata = availableOutputMetadata.filter(o => o.isSystem !== 1);
|
|
299
|
+
const selectedCount = qd.select.length;
|
|
300
|
+
const totalAvailable = availableOutputMetadata.length;
|
|
301
|
+
const totalNonSystem = availableNonSystemMetadata.length;
|
|
302
|
+
// Non mostrare se sono selezionati tutti i metadati disponibili
|
|
303
|
+
if (selectedCount === totalAvailable)
|
|
304
|
+
return false;
|
|
305
|
+
// Non mostrare se sono selezionati tutti i metadati non di sistema
|
|
306
|
+
// (verifica che tutti quelli selezionati siano non di sistema e che siano tutti)
|
|
307
|
+
const selectedMids = new Set(qd.select.map(s => s.mid));
|
|
308
|
+
const allSelectedAreNonSystem = qd.select.every(s => {
|
|
309
|
+
const md = fromDTD.metadata?.find(m => m.id === s.mid);
|
|
310
|
+
return md && md.isSystem !== 1;
|
|
311
|
+
});
|
|
312
|
+
const allNonSystemAreSelected = availableNonSystemMetadata.every(m => selectedMids.has(m.id));
|
|
313
|
+
if (allSelectedAreNonSystem && allNonSystemAreSelected && selectedCount === totalNonSystem) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
return true;
|
|
317
|
+
}, [showAdvancedSearch, qd?.select, fromDTD?.metadata]);
|
|
318
|
+
// In modalità avanzata non mostrare i badges di ordinamento
|
|
319
|
+
const shouldShowOrderByBadges = useMemo(() => {
|
|
320
|
+
if (showAdvancedSearch)
|
|
321
|
+
return false;
|
|
322
|
+
return qd?.orderBy && qd.orderBy.length > 0;
|
|
323
|
+
}, [showAdvancedSearch, qd?.orderBy]);
|
|
327
324
|
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) ?
|
|
328
325
|
_jsx(ContextMenu, { items: contextMenuItems, trigger: "left", children: _jsx(TMButton, { btnStyle: 'icon', caption: 'Altro', icon: _jsx(IconMenuVertical, { color: 'white' }), showTooltip: false, onClick: () => setIsQueryPanelActive(true) }) })
|
|
329
326
|
: _jsx(_Fragment, {}) }), children: [_jsx(ConfirmQueryParamsDialog, {}), SQD
|
|
330
327
|
? _jsxs("div", { onContextMenu: (e) => e.preventDefault(), style: { height: '100%', width: '100%', position: 'relative', display: showSqdForm ? 'none' : 'flex', flexDirection: 'column', gap: 5 }, children: [showAdvancedSearch
|
|
331
328
|
? _jsx(TMQueryEditor, { formMode: FormModes.Update, showToolbar: false, inputData: qd, validateSelect: true, showApply: false, onQDChanged: handleQdChanged, updateIsModalOpen: updateIsModalOpen })
|
|
332
|
-
: _jsx(TMSearchQueryEditor, { qd: qd, dcmtTypesList: dcmtTypesList, isExpertMode: isExpertMode, showAllMdWhere: showAllMdWhere, onQdChanged: handleQdChanged, onFocusedMetadataChanged: setFocusedTidMid, onAdvancedMenuClick: handleAdvancedMenuClick, updateIsModalOpen: updateIsModalOpen }), _jsxs("
|
|
329
|
+
: _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: (() => {
|
|
330
|
+
const selectItems = qd.select ?? [];
|
|
331
|
+
const maxVisible = isMobile ? 1 : 2;
|
|
332
|
+
const visibleItems = selectItems.slice(0, maxVisible);
|
|
333
|
+
const hiddenCount = selectItems.length - maxVisible;
|
|
334
|
+
return (_jsxs(_Fragment, { children: [visibleItems.map((si, index) => {
|
|
335
|
+
const md = fromDTD?.metadata?.find(m => m.id === si.mid);
|
|
336
|
+
const mdName = md?.nameLoc ?? md?.name ?? `MID ${si.mid}`;
|
|
337
|
+
return (_jsxs(StyledSelectBadge, { children: [_jsx(IconColumns, { fontSize: 12 }), _jsx("span", { className: "badge-name", children: mdName })] }, `${si.tid}-${si.mid}-${index}`));
|
|
338
|
+
}), hiddenCount > 0 && (_jsxs(StyledSelectBadgeMore, { onClick: () => setShowOutputConfig(true), children: ["+", hiddenCount] }))] }));
|
|
339
|
+
})() }), _jsx(StyledSelectEditButton, { title: SDKUI_Localizator.Configure, onClick: () => setShowOutputConfig(true), children: _jsx(IconEdit, { fontSize: 16 }) })] })), shouldShowOrderByBadges && qd?.orderBy && qd.orderBy.length > 0 && (_jsxs(StyledOrderByBadgesContainer, { children: [_jsxs(StyledOrderByLabel, { children: [qd.orderBy.length === 1 ? SDKUI_Localizator.SortBy : SDKUI_Localizator.SortByPlural, ":"] }), _jsx(StyledOrderByBadgesWrapper, { children: (() => {
|
|
340
|
+
const orderByItems = qd.orderBy ?? [];
|
|
341
|
+
const maxVisible = isMobile ? 1 : 2;
|
|
342
|
+
const visibleItems = orderByItems.slice(0, maxVisible);
|
|
343
|
+
const hiddenCount = orderByItems.length - maxVisible;
|
|
344
|
+
return (_jsxs(_Fragment, { children: [visibleItems.map((obi, index) => {
|
|
345
|
+
const md = fromDTD?.metadata?.find(m => m.id === obi.mid);
|
|
346
|
+
const mdName = md?.nameLoc ?? md?.name ?? `MID ${obi.mid}`;
|
|
347
|
+
return (_jsxs(StyledOrderByBadge, { children: [_jsx(TMTooltip, { content: obi.asc !== false ? SDKUI_Localizator.ValueAscending : SDKUI_Localizator.ValueDescending, children: obi.asc !== false ? (_jsx(IconSortAsc, { fontSize: 12 })) : (_jsx(IconSortDesc, { fontSize: 12 })) }), _jsx("span", { className: "badge-name", children: mdName })] }, `${obi.tid}-${obi.mid}-${index}`));
|
|
348
|
+
}), hiddenCount > 0 && (_jsxs(StyledOrderByBadgeMore, { onClick: () => setShowMetadataSorterForm(true), children: ["+", hiddenCount] }))] }));
|
|
349
|
+
})() }), _jsx(StyledOrderByEditButton, { title: SDKUI_Localizator.Configure, onClick: () => setShowMetadataSorterForm(true), children: _jsx(IconEdit, { fontSize: 16 }) })] })), _jsxs("div", { style: {
|
|
333
350
|
display: 'flex',
|
|
334
351
|
flexWrap: 'wrap',
|
|
335
352
|
justifyContent: 'center',
|
|
@@ -338,8 +355,12 @@ const TMSearchQueryPanel = ({ fromDTD, showBackToResultButton, isExpertMode = SD
|
|
|
338
355
|
width: '100%'
|
|
339
356
|
}, children: [_jsx(TMButton, { btnStyle: 'advanced', icon: _jsx(IconSearch, {}), showTooltip: false, width: '90px', caption: SDKUI_Localizator.Search, advancedColor: '#4A96D2', onClick: handleSearchButtonClick }), _jsx(TMButton, { width: '90px', btnStyle: 'advanced', advancedType: 'primary', showTooltip: false, caption: SDKUI_Localizator.Clear, icon: _jsx(IconClear, {}), advancedColor: 'white', color: 'primaryOutline', onClick: clearFilters }), (!showAdvancedSearch && qd?.where && qd.where.length > initialMaxItems) && (_jsx(TMButton, { width: '120px', btnStyle: isMobile ? 'icon' : 'advanced', advancedColor: TMColors.button_primary, caption: captionText, showTooltip: false, icon: isMobile ? (_jsx("div", { children: _jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` }) })) : (_jsx("p", { children: showAllMdWhere ? `-${diff}` : `+${diff}` })), onClick: () => setShowAllMdWhere(!showAllMdWhere) }))] }), showFiltersConfig &&
|
|
340
357
|
_jsx(TMMetadataChooserForm, { allowMultipleSelection: true, height: '500px', width: '600px', allowSysMetadata: true, filterMetadata: (o => o.perm?.canSearch === AccessLevels.Yes), qd: qd, selectedIDs: qd?.where?.map((w) => ({ tid: w.tid, mid: w.mid })), onClose: handleCloseFiltersConfig, onChoose: handleChooseFilters }), showOutputConfig &&
|
|
341
|
-
_jsx(
|
|
342
|
-
|
|
358
|
+
_jsx(TMMetadataOutputForm, { qd: qd, selectedSelectItems: qd?.select, allowSysMetadata: true, filterMetadata: (o => o.perm?.canView === AccessLevels.Yes || o.perm?.canUpdate === AccessLevels.Yes), onClose: handleCloseOutputConfig, onChoose: (selectItems) => {
|
|
359
|
+
setQd({ ...qd, select: selectItems });
|
|
360
|
+
} }), showMetadataSorterForm &&
|
|
361
|
+
_jsx(TMMetadataSorterForm, { qd: qd, selectedOrderByItems: qd?.orderBy, allowSysMetadata: true, filterMetadata: (o => o.perm?.canView === AccessLevels.Yes || o.perm?.canUpdate === AccessLevels.Yes), onClose: () => setShowMetadataSorterForm(false), onChoose: (orderByItems) => {
|
|
362
|
+
setQd({ ...qd, orderBy: orderByItems });
|
|
363
|
+
} })] })
|
|
343
364
|
:
|
|
344
365
|
_jsx(TMToppyMessage, { message: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch, titleTooltip: SDKUI_Localizator.DcmtTypeSelectOrQuickSearch }), showSqdForm &&
|
|
345
366
|
_jsx(StyledModalContainer, { style: { backgroundColor: `${TMColors.backgroundColorHeader}12` }, children: _jsx(TMSavedQueryForm, { height: '50%', width: '50%', id: formModeSqdForm === FormModes.Create ? -1 : SQD?.id, title: 'Ricerca rapida', formMode: formModeSqdForm, showBackButton: true, qd: qd, isAdvancedSearch: showAdvancedSearch, isModal: false, onClose: () => { setShowSqdForm(false); }, onSaved: onSqdSaved }) })] }), showDistinctValuesPanel &&
|
|
@@ -415,6 +436,174 @@ export const refreshLastSearch = async (qd) => {
|
|
|
415
436
|
}
|
|
416
437
|
return searchResults;
|
|
417
438
|
};
|
|
439
|
+
// =============================================================================
|
|
440
|
+
// STYLED COMPONENTS per i badge degli ordinamenti
|
|
441
|
+
// =============================================================================
|
|
442
|
+
const StyledOrderByBadgesContainer = styled.div `
|
|
443
|
+
display: flex;
|
|
444
|
+
flex-wrap: wrap;
|
|
445
|
+
align-items: center;
|
|
446
|
+
gap: 8px;
|
|
447
|
+
padding: 6px 10px;
|
|
448
|
+
margin: 1px 0;
|
|
449
|
+
background: linear-gradient(135deg, rgba(74, 150, 210, 0.08) 0%, rgba(37, 89, 165, 0.08) 100%);
|
|
450
|
+
border-radius: 8px;
|
|
451
|
+
border: 1px solid rgba(74, 150, 210, 0.2);
|
|
452
|
+
`;
|
|
453
|
+
const StyledOrderByLabel = styled.span `
|
|
454
|
+
font-size: 0.82rem;
|
|
455
|
+
font-weight: 600;
|
|
456
|
+
color: #4A96D2;
|
|
457
|
+
white-space: nowrap;
|
|
458
|
+
`;
|
|
459
|
+
const StyledOrderByBadgesWrapper = styled.div `
|
|
460
|
+
display: flex;
|
|
461
|
+
flex-wrap: wrap;
|
|
462
|
+
gap: 6px;
|
|
463
|
+
align-items: center;
|
|
464
|
+
flex: 1;
|
|
465
|
+
`;
|
|
466
|
+
const StyledOrderByBadge = styled.div `
|
|
467
|
+
display: inline-flex;
|
|
468
|
+
align-items: center;
|
|
469
|
+
gap: 4px;
|
|
470
|
+
padding: 3px 8px;
|
|
471
|
+
background: white;
|
|
472
|
+
border: 1px solid #d1d9e6;
|
|
473
|
+
border-radius: 16px;
|
|
474
|
+
font-size: 0.82rem;
|
|
475
|
+
color: #333;
|
|
476
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
477
|
+
|
|
478
|
+
.badge-name {
|
|
479
|
+
max-width: 120px;
|
|
480
|
+
overflow: hidden;
|
|
481
|
+
text-overflow: ellipsis;
|
|
482
|
+
white-space: nowrap;
|
|
483
|
+
|
|
484
|
+
@media (max-width: 600px) {
|
|
485
|
+
max-width: 80px;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
`;
|
|
489
|
+
const StyledOrderByBadgeMore = styled.div `
|
|
490
|
+
display: inline-flex;
|
|
491
|
+
align-items: center;
|
|
492
|
+
justify-content: center;
|
|
493
|
+
padding: 3px 10px;
|
|
494
|
+
background: linear-gradient(135deg, #4A96D2 0%, #2559A5 100%);
|
|
495
|
+
border: none;
|
|
496
|
+
border-radius: 16px;
|
|
497
|
+
font-size: 0.82rem;
|
|
498
|
+
font-weight: 600;
|
|
499
|
+
color: white;
|
|
500
|
+
cursor: pointer;
|
|
501
|
+
transition: all 0.2s ease;
|
|
502
|
+
|
|
503
|
+
&:hover {
|
|
504
|
+
transform: scale(1.05);
|
|
505
|
+
box-shadow: 0 2px 6px rgba(74, 150, 210, 0.4);
|
|
506
|
+
}
|
|
507
|
+
`;
|
|
508
|
+
const StyledOrderByEditButton = styled.div `
|
|
509
|
+
display: flex;
|
|
510
|
+
align-items: center;
|
|
511
|
+
justify-content: center;
|
|
512
|
+
width: 28px;
|
|
513
|
+
height: 28px;
|
|
514
|
+
border-radius: 4px;
|
|
515
|
+
color: #4A96D2;
|
|
516
|
+
cursor: pointer;
|
|
517
|
+
transition: all 0.2s ease;
|
|
518
|
+
|
|
519
|
+
&:hover {
|
|
520
|
+
background-color: rgba(74, 150, 210, 0.15);
|
|
521
|
+
}
|
|
522
|
+
`;
|
|
523
|
+
// =============================================================================
|
|
524
|
+
// STYLED COMPONENTS per i badge degli output (select) - colore verde/teal
|
|
525
|
+
// =============================================================================
|
|
526
|
+
const StyledSelectBadgesContainer = styled.div `
|
|
527
|
+
display: flex;
|
|
528
|
+
flex-wrap: wrap;
|
|
529
|
+
align-items: center;
|
|
530
|
+
gap: 8px;
|
|
531
|
+
padding: 6px 10px;
|
|
532
|
+
margin: 1px 0;
|
|
533
|
+
background: linear-gradient(135deg, rgba(46, 125, 50, 0.08) 0%, rgba(27, 94, 32, 0.08) 100%);
|
|
534
|
+
border-radius: 8px;
|
|
535
|
+
border: 1px solid rgba(46, 125, 50, 0.2);
|
|
536
|
+
`;
|
|
537
|
+
const StyledSelectLabel = styled.span `
|
|
538
|
+
font-size: 0.82rem;
|
|
539
|
+
font-weight: 600;
|
|
540
|
+
color: #2E7D32;
|
|
541
|
+
white-space: nowrap;
|
|
542
|
+
`;
|
|
543
|
+
const StyledSelectBadgesWrapper = styled.div `
|
|
544
|
+
display: flex;
|
|
545
|
+
flex-wrap: wrap;
|
|
546
|
+
gap: 6px;
|
|
547
|
+
align-items: center;
|
|
548
|
+
flex: 1;
|
|
549
|
+
`;
|
|
550
|
+
const StyledSelectBadge = styled.div `
|
|
551
|
+
display: inline-flex;
|
|
552
|
+
align-items: center;
|
|
553
|
+
gap: 4px;
|
|
554
|
+
padding: 3px 8px;
|
|
555
|
+
background: white;
|
|
556
|
+
border: 1px solid #c8e6c9;
|
|
557
|
+
border-radius: 16px;
|
|
558
|
+
font-size: 0.82rem;
|
|
559
|
+
color: #333;
|
|
560
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
|
561
|
+
|
|
562
|
+
.badge-name {
|
|
563
|
+
max-width: 120px;
|
|
564
|
+
overflow: hidden;
|
|
565
|
+
text-overflow: ellipsis;
|
|
566
|
+
white-space: nowrap;
|
|
567
|
+
|
|
568
|
+
@media (max-width: 600px) {
|
|
569
|
+
max-width: 80px;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
`;
|
|
573
|
+
const StyledSelectBadgeMore = styled.div `
|
|
574
|
+
display: inline-flex;
|
|
575
|
+
align-items: center;
|
|
576
|
+
justify-content: center;
|
|
577
|
+
padding: 3px 10px;
|
|
578
|
+
background: linear-gradient(135deg, #43A047 0%, #2E7D32 100%);
|
|
579
|
+
border: none;
|
|
580
|
+
border-radius: 16px;
|
|
581
|
+
font-size: 0.82rem;
|
|
582
|
+
font-weight: 600;
|
|
583
|
+
color: white;
|
|
584
|
+
cursor: pointer;
|
|
585
|
+
transition: all 0.2s ease;
|
|
586
|
+
|
|
587
|
+
&:hover {
|
|
588
|
+
transform: scale(1.05);
|
|
589
|
+
box-shadow: 0 2px 6px rgba(46, 125, 50, 0.4);
|
|
590
|
+
}
|
|
591
|
+
`;
|
|
592
|
+
const StyledSelectEditButton = styled.div `
|
|
593
|
+
display: flex;
|
|
594
|
+
align-items: center;
|
|
595
|
+
justify-content: center;
|
|
596
|
+
width: 28px;
|
|
597
|
+
height: 28px;
|
|
598
|
+
border-radius: 4px;
|
|
599
|
+
color: #2E7D32;
|
|
600
|
+
cursor: pointer;
|
|
601
|
+
transition: all 0.2s ease;
|
|
602
|
+
|
|
603
|
+
&:hover {
|
|
604
|
+
background-color: rgba(46, 125, 50, 0.15);
|
|
605
|
+
}
|
|
606
|
+
`;
|
|
418
607
|
export const StyledToppyTextContainer = styled.div `
|
|
419
608
|
padding: 22px 8px;
|
|
420
609
|
width: 100%;
|
|
@@ -433,11 +622,13 @@ export const StyledToppyText = styled.p `
|
|
|
433
622
|
font-size: 1rem;
|
|
434
623
|
user-select: none;
|
|
435
624
|
-webkit-touch-callout: none;
|
|
436
|
-
|
|
625
|
+
-webkit-user-select: none;
|
|
626
|
+
-moz-user-select: none;
|
|
627
|
+
-ms-user-select: none;
|
|
437
628
|
margin: 0;
|
|
438
629
|
display: -webkit-box;
|
|
439
630
|
-webkit-box-orient: vertical;
|
|
440
|
-
-webkit-line-clamp: 3;
|
|
631
|
+
-webkit-line-clamp: 3;
|
|
441
632
|
overflow: hidden;
|
|
442
633
|
text-overflow: ellipsis;
|
|
443
634
|
white-space: normal;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DcmtTypeDescriptor, HomeBlogPost, ObjectRef, SearchResultDescriptor, TaskDescriptor, WorkingGroupDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
-
import { MergePdfManagerType } from '../../../helper';
|
|
4
3
|
import { DcmtInfo, SearchResultContext, TaskContext } from '../../../ts';
|
|
5
4
|
import { TMSearchResultFloatingActionConfig } from './TMSearchResultFloatingActionButton';
|
|
6
5
|
export declare const getSearchResultCountersSingleCategory: (searchResults: SearchResultDescriptor[]) => string;
|
|
@@ -13,6 +12,7 @@ interface ITMSearchResultProps {
|
|
|
13
12
|
floatingActionConfig?: TMSearchResultFloatingActionConfig;
|
|
14
13
|
workingGroupContext?: WorkingGroupDescriptor;
|
|
15
14
|
inputDID?: number;
|
|
15
|
+
autoFocusFirstRow?: boolean;
|
|
16
16
|
formAutoOpen?: boolean;
|
|
17
17
|
allowFloatingBar?: boolean;
|
|
18
18
|
allowRelations?: boolean;
|
|
@@ -32,7 +32,6 @@ interface ITMSearchResultProps {
|
|
|
32
32
|
showToppyDraggableHelpCenter?: boolean;
|
|
33
33
|
toppyHelpCenterUsePortal?: boolean;
|
|
34
34
|
showNoDcmtFoundMessage?: boolean;
|
|
35
|
-
mergePdfManager?: MergePdfManagerType;
|
|
36
35
|
onClose?: () => void;
|
|
37
36
|
openInOffice?: (selectedDcmtsOrFocused: Array<DcmtInfo>) => Promise<void>;
|
|
38
37
|
onWFOperationCompleted?: () => Promise<void>;
|
|
@@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { LoadIndicator } from 'devextreme-react';
|
|
5
5
|
import { AppModules, DataColumnTypes, DataListViewModes, DcmtTypeListCacheService, LayoutCacheService, LayoutModes, MetadataDataDomains, MetadataFormats, SDK_Globals, SystemMIDsAsNumber, UserListCacheService, } from '@topconsultnpm/sdk-ts';
|
|
6
|
-
import { deepCompare, generateUniqueColumnKeys, genUniqueId, getSearchToolbarVisibility, IconBoard, IconDcmtTypeSys, IconDelete, IconMenuVertical, IconPlatform, IconRefresh, IconSearchCheck, IconShow, isApprovalWorkflowView, isSign4TopEnabled, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, SDKUI_Globals, SDKUI_Localizator
|
|
6
|
+
import { deepCompare, generateUniqueColumnKeys, genUniqueId, getSearchToolbarVisibility, IconBoard, IconDcmtTypeSys, IconDelete, IconMenuVertical, IconPlatform, IconRefresh, IconSearchCheck, IconShow, isApprovalWorkflowView, isSign4TopEnabled, searchResultDescriptorToSimpleArray, searchResultToMetadataValues, SDKUI_Globals, SDKUI_Localizator } from '../../../helper';
|
|
7
7
|
import { getDcmtCicoStatus } from '../../../helper/checkinCheckoutManager';
|
|
8
8
|
import { DcmtOperationTypes, SearchResultContext, } from '../../../ts';
|
|
9
9
|
import { Gutters } from '../../../utils/theme';
|
|
@@ -54,7 +54,7 @@ const TMSearchResult = ({
|
|
|
54
54
|
// Data
|
|
55
55
|
groupId, searchResults = [], context = SearchResultContext.METADATA_SEARCH, title, selectedSearchResultTID, floatingActionConfig, workingGroupContext = undefined, inputDID,
|
|
56
56
|
// Boolean flags to enable/disable features
|
|
57
|
-
formAutoOpen, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, disableAccordionIfSingleCategory = false, editPdfForm = false, openS4TViewer = false, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, enablePinIcons = true,
|
|
57
|
+
autoFocusFirstRow = true, formAutoOpen, isVisible = true, allowRelations = true, openDcmtFormAsModal = false, showSearchResultSidebar = true, showDcmtFormSidebar = true, showSelector = false, isClosable = false, allowFloatingBar = true, showToolbarHeader = true, showBackButton = true, disableAccordionIfSingleCategory = false, editPdfForm = false, openS4TViewer = false, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, showNoDcmtFoundMessage = true, enablePinIcons = true,
|
|
58
58
|
// Callbacks (optional)
|
|
59
59
|
openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openCommentFormCallback, openAddDocumentForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, passToArchiveCallback, onReferenceClick,
|
|
60
60
|
// Tasks
|
|
@@ -63,6 +63,11 @@ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCa
|
|
|
63
63
|
handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
64
64
|
// Ref for the floating bar container (used to position the floating action buttons)
|
|
65
65
|
const floatingBarContainerRef = useRef(null);
|
|
66
|
+
// Ref per tracciare se autoFocusFirstRow=false deve bloccare l'auto-focus.
|
|
67
|
+
// Resta true finché l'utente non clicca manualmente sulla griglia per selezionare una riga.
|
|
68
|
+
// Quando l'utente seleziona manualmente, il ref viene settato a false e il focus automatico
|
|
69
|
+
// torna al comportamento normale.
|
|
70
|
+
const isFirstAutoFocusRef = useRef(true);
|
|
66
71
|
// ID state to force remount of components
|
|
67
72
|
const [id, setID] = useState('');
|
|
68
73
|
// Document type descriptor of the currently document
|
|
@@ -139,6 +144,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
};
|
|
147
|
+
// Handler unico per tutte le azioni utente che cambiano il focus (click, navigazione, etc.).
|
|
148
|
+
// Resetta isFirstAutoFocusRef perché da questo momento autoFocusFirstRow non deve più essere considerato.
|
|
149
|
+
const handleFocusedItemChangedFromGrid = useCallback((item) => {
|
|
150
|
+
isFirstAutoFocusRef.current = false;
|
|
151
|
+
setFocusedItem(item);
|
|
152
|
+
}, []);
|
|
142
153
|
const onNavigateHandler = (dir) => {
|
|
143
154
|
let index = -1;
|
|
144
155
|
if (visibleItems && focusedItem) {
|
|
@@ -146,10 +157,10 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
146
157
|
}
|
|
147
158
|
switch (dir) {
|
|
148
159
|
case 'next':
|
|
149
|
-
|
|
160
|
+
handleFocusedItemChangedFromGrid(visibleItems[index + 1]);
|
|
150
161
|
break;
|
|
151
162
|
default:
|
|
152
|
-
|
|
163
|
+
handleFocusedItemChangedFromGrid(visibleItems[index - 1]);
|
|
153
164
|
break;
|
|
154
165
|
}
|
|
155
166
|
};
|
|
@@ -361,7 +372,6 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
361
372
|
onTaskCreateRequest,
|
|
362
373
|
openTaskFormHandler,
|
|
363
374
|
},
|
|
364
|
-
mergePdfManager,
|
|
365
375
|
});
|
|
366
376
|
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, closeDcmtFormHandler, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
367
377
|
const deviceType = useDeviceType();
|
|
@@ -379,6 +389,9 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
379
389
|
updateBatchUpdateForm(false);
|
|
380
390
|
closeDcmtFormHandler();
|
|
381
391
|
setCurrentSearchResults(searchResults);
|
|
392
|
+
// Resetta il ref quando arrivano nuovi risultati di ricerca,
|
|
393
|
+
// così la logica autoFocusFirstRow=false si riapplica per ogni nuova ricerca
|
|
394
|
+
isFirstAutoFocusRef.current = true;
|
|
382
395
|
if (searchResults.length <= 0) {
|
|
383
396
|
setSelectedSearchResult(undefined);
|
|
384
397
|
return;
|
|
@@ -414,6 +427,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
414
427
|
});
|
|
415
428
|
checkRelatedDcmtsArchiveCapability();
|
|
416
429
|
checkManyToManyCapability();
|
|
430
|
+
// se autoFocusFirstRow è false, non selezionare automaticamente la prima riga del nuovo risultato della ricerca
|
|
431
|
+
// Il ref resta true finché l'utente non clicca manualmente sulla griglia
|
|
432
|
+
if (autoFocusFirstRow === false && isFirstAutoFocusRef.current) {
|
|
433
|
+
setFocusedItem(undefined);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
417
436
|
// Ricava il nuovo dataSource
|
|
418
437
|
const newDataSource = searchResultDescriptorToSimpleArray(selectedSearchResult);
|
|
419
438
|
// Se esiste almeno una riga, seleziona la prima
|
|
@@ -421,6 +440,12 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
421
440
|
}, [selectedSearchResult, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability]);
|
|
422
441
|
// Quando inputDID è fornito e i dati della griglia sono pronti, seleziona il documento corrispondente
|
|
423
442
|
useEffect(() => {
|
|
443
|
+
// Se autoFocusFirstRow è false, non selezionare automaticamente la riga corrispondente a inputDID
|
|
444
|
+
// Il ref resta true finché l'utente non clicca manualmente sulla griglia
|
|
445
|
+
if (autoFocusFirstRow === false && isFirstAutoFocusRef.current) {
|
|
446
|
+
setFocusedItem(undefined);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
424
449
|
if (!inputDID || visibleItems.length === 0)
|
|
425
450
|
return;
|
|
426
451
|
const targetItem = visibleItems.find((item) => item.DID == inputDID);
|
|
@@ -468,8 +493,10 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
468
493
|
onOpenS4TViewerRequest?.([{ TID: focusedItem.TID, DID: focusedItem.DID }]);
|
|
469
494
|
}, [openS4TViewer, inputDID, focusedItem, fromDTD]);
|
|
470
495
|
useEffect(() => {
|
|
471
|
-
if (!focusedItem)
|
|
496
|
+
if (!focusedItem) {
|
|
497
|
+
setCurrentDcmt(undefined);
|
|
472
498
|
return;
|
|
499
|
+
}
|
|
473
500
|
if (!fromDTD)
|
|
474
501
|
return;
|
|
475
502
|
let dtd = searchResults.length > 1 ? searchResults.find(res => res.fromTID == focusedItem?.TID)?.dtdResult : searchResults[0]?.dtdResult;
|
|
@@ -636,7 +663,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
636
663
|
_jsxs(_Fragment, { children: [_jsxs(TMLayoutItem, { height: '100%', children: [_jsxs("div", { ref: floatingBarContainerRef, style: { position: 'relative', height: '100%', width: '100%' }, children: [_jsxs(TMSplitterLayout, { direction: 'horizontal', overflow: 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && deviceType !== DeviceType.MOBILE, start: showSelector ? deviceType !== DeviceType.MOBILE ? ['30%', '70%'] : splitterSize : ['0%', '100%'], children: [showSelector ?
|
|
637
664
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || currentSearchResults.length === 1, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
638
665
|
:
|
|
639
|
-
_jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged:
|
|
666
|
+
_jsx(_Fragment, {}), _jsx(TMLayoutItem, { children: _jsx(TMSearchResultGrid, { openInOffice: openInOffice, fromDTD: fromDTD, operationItems: operationItems, allUsers: allUsers, inputFocusedItem: focusedItem, inputSelectedItems: selectedItems, showExportForm: showExportForm, onFocusedItemChanged: handleFocusedItemChangedFromGrid, onDownloadDcmtsAsync: async (inputDcmts, downloadType, downloadMode, _y, confirmAttachments) => await downloadDcmtsAsync({ inputDcmts, downloadType, downloadMode, onFileDownloaded: onFileOpened, confirmAttachments }), lastUpdateSearchTime: lastUpdateSearchTime, searchResult: searchResults.length > 1 ? selectedSearchResult : searchResults[0], onSelectionChanged: (items) => { setSelectedItems(items); }, onDblClick: () => openFormHandler(LayoutModes.Update), showSearchTMDatagrid: showSearchTMDatagrid, onVisibleItemChanged: setVisibleItems, updateDataColumnsFromDataGrid: updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid: updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid: updateSelectedRowKeysFromDataGrid, disableAutoFocus: autoFocusFirstRow === false && isFirstAutoFocusRef.current }) })] }), renderFloatingBar] }), _jsx(TMToppyDraggableHelpCenter, { usePortal: toppyHelpCenterUsePortal, isVisible: isToppyHelpCenterVisible, content: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: _jsx(WorkFlowOperationButtons, { dtd: fromDTD, deviceType: deviceType, onApprove: () => {
|
|
640
667
|
updateShowApprovePopup(true);
|
|
641
668
|
}, onSignApprove: () => {
|
|
642
669
|
handleSignApprove();
|
|
@@ -827,7 +854,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
827
854
|
_jsxs(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmSearchResult', children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] }) }) }) }), renderDcmtOperations] }));
|
|
828
855
|
};
|
|
829
856
|
export default TMSearchResult;
|
|
830
|
-
const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
|
|
857
|
+
const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid, disableAutoFocus = false }) => {
|
|
831
858
|
const [dataSource, setDataSource] = useState();
|
|
832
859
|
const [columns, setColumns] = useState([]);
|
|
833
860
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
@@ -851,6 +878,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
851
878
|
const { loadDataListsAsync, renderDataListCell, dataListsCache } = useDataListItem();
|
|
852
879
|
const { loadUsersAsync, renderUserIdViewer, usersCache } = useDataUserIdItem();
|
|
853
880
|
useEffect(() => {
|
|
881
|
+
// Sincronizza focusedItem con inputFocusedItem dal padre
|
|
854
882
|
if (deepCompare(inputFocusedItem, focusedItem))
|
|
855
883
|
return;
|
|
856
884
|
setFocusedItem(inputFocusedItem);
|
|
@@ -1125,8 +1153,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1125
1153
|
// Previene l'errore E1047 quando il filtro riferisce campi non più presenti nelle nuove colonne.
|
|
1126
1154
|
const oldFields = columns.map(c => c.dataField);
|
|
1127
1155
|
const newFields = cols.map(c => c.dataField);
|
|
1128
|
-
const columnsChanged = oldFields.length !== newFields.length ||
|
|
1129
|
-
oldFields.some((f, i) => f !== newFields[i]);
|
|
1156
|
+
const columnsChanged = oldFields.length !== newFields.length || oldFields.some((f, i) => f !== newFields[i]);
|
|
1130
1157
|
if (columnsChanged) {
|
|
1131
1158
|
const gridInstance = dataGridRef.current?.instance();
|
|
1132
1159
|
if (gridInstance) {
|
|
@@ -1144,7 +1171,6 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1144
1171
|
useEffect(() => {
|
|
1145
1172
|
let newDataSource = searchResultDescriptorToSimpleArray(searchResult);
|
|
1146
1173
|
setDataSource(newDataSource);
|
|
1147
|
-
// setFocusedItem(newDataSource?.find(o => o?.rowIndex === focusedItem?.rowIndex));
|
|
1148
1174
|
}, [lastUpdateSearchTime]);
|
|
1149
1175
|
// Handles selection change in the data grid
|
|
1150
1176
|
const handleSelectionChange = useCallback((e) => {
|
|
@@ -1155,14 +1181,9 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1155
1181
|
}, [onSelectionChanged]);
|
|
1156
1182
|
// Handles focus change in the data grid
|
|
1157
1183
|
const handleFocusedRowChange = useCallback((e) => {
|
|
1158
|
-
//
|
|
1159
|
-
// if (e.row === undefined) { setFocusedItem(undefined); return; }
|
|
1160
|
-
// setFocusedItem(e.row.data);
|
|
1184
|
+
// Non bloccare mai questo handler: è chiamato quando l'utente clicca su una riga
|
|
1161
1185
|
onFocusedItemChanged?.(e.row?.data);
|
|
1162
|
-
}, [
|
|
1163
|
-
// useEffect(() => {
|
|
1164
|
-
// onFocusedItemChanged?.(focusedItem)
|
|
1165
|
-
// }, [focusedItem])
|
|
1186
|
+
}, [onFocusedItemChanged]);
|
|
1166
1187
|
// Handler for double-click row event
|
|
1167
1188
|
const onRowDblClick = useCallback((e) => {
|
|
1168
1189
|
if (onDblClick === undefined)
|
|
@@ -1183,7 +1204,6 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1183
1204
|
});
|
|
1184
1205
|
return;
|
|
1185
1206
|
}
|
|
1186
|
-
// setFocusedItem(e.data);
|
|
1187
1207
|
onFocusedItemChanged?.(e.data);
|
|
1188
1208
|
onDblClick();
|
|
1189
1209
|
}, [onDblClick]);
|
|
@@ -1213,7 +1233,7 @@ const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, i
|
|
|
1213
1233
|
setVisibleItems(visibleData);
|
|
1214
1234
|
}, []);
|
|
1215
1235
|
useEffect(() => { onVisibleItemChanged?.(visibleItems); }, [visibleItems]);
|
|
1216
|
-
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: { show: true } })] });
|
|
1236
|
+
return _jsxs("div", { style: { width: "100%", height: "100%" }, children: [!isDataGridReady && (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%', gap: '10px' }, children: [_jsx(LoadIndicator, { height: 60, width: 60 }), _jsx("div", { children: SDKUI_Localizator.Loading })] })), isDataGridReady && _jsx(TMDataGrid, { ref: dataGridRef, id: "tm-search-result", keyExpr: "rowIndex", dataColumns: dataColumns, dataSource: dataSource, repaintChangesOnly: true, selectedRowKeys: selectedRowKeys, focusedRowKey: disableAutoFocus ? undefined : Number(focusedItem?.rowIndex ?? 0), showSearchPanel: showSearchTMDatagrid, showFilterPanel: true, sorting: { mode: "multiple" }, selection: { mode: allowMultipleSelection ? 'multiple' : 'single' }, pageSize: pageSize, onSelectionChanged: handleSelectionChange, onFocusedRowChanged: handleFocusedRowChange, onRowDblClick: onRowDblClick, onContentReady: onContentReady, showHeaderColumnChooser: true, onKeyDown: onKeyDown, customContextMenuItems: operationItems, counterConfig: { show: true } })] });
|
|
1217
1237
|
};
|
|
1218
1238
|
//#region TMSearchResultSelector
|
|
1219
1239
|
const StyledItemTemplate = styled.div `
|
|
@@ -12,5 +12,5 @@ interface TMSearchResultFloatingActionButtonProps {
|
|
|
12
12
|
selectedDcmtsOrFocused: Array<DcmtInfo>;
|
|
13
13
|
config: TMSearchResultFloatingActionConfig;
|
|
14
14
|
}
|
|
15
|
-
export declare const TMSearchResultFloatingActionButton: (props: TMSearchResultFloatingActionButtonProps) =>
|
|
15
|
+
export declare const TMSearchResultFloatingActionButton: (props: TMSearchResultFloatingActionButtonProps) => React.JSX.Element;
|
|
16
16
|
export default TMSearchResultFloatingActionButton;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { DcmtInfo } from "../../../ts";
|
|
2
3
|
interface TMSignatureInfoContentProps {
|
|
3
4
|
inputDcmt: DcmtInfo;
|
|
4
5
|
}
|
|
5
|
-
declare const TMSignatureInfoContent: (props: TMSignatureInfoContentProps) =>
|
|
6
|
+
declare const TMSignatureInfoContent: (props: TMSignatureInfoContentProps) => React.JSX.Element | null;
|
|
6
7
|
export default TMSignatureInfoContent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { DcmtInfo } from "../../../ts/types";
|
|
2
3
|
import { DeviceType } from "../../base/TMDeviceProvider";
|
|
3
4
|
import { DcmtTypeDescriptor, HomeBlogPost, TaskDescriptor } from "@topconsultnpm/sdk-ts";
|
|
@@ -14,5 +15,5 @@ interface TMViewHistoryDcmtProps {
|
|
|
14
15
|
handleNavigateToWGs?: (value: HomeBlogPost | number) => Promise<void>;
|
|
15
16
|
handleNavigateToDossiers?: (value: HomeBlogPost | number) => Promise<void>;
|
|
16
17
|
}
|
|
17
|
-
declare const TMViewHistoryDcmt: (props: TMViewHistoryDcmtProps) =>
|
|
18
|
+
declare const TMViewHistoryDcmt: (props: TMViewHistoryDcmtProps) => React.JSX.Element;
|
|
18
19
|
export default TMViewHistoryDcmt;
|