@topconsultnpm/sdkui-react 6.22.0-dev3.11 → 6.22.0-dev3.13
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/features/search/TMSearchResult.d.ts +5 -0
- package/lib/components/features/search/TMSearchResult.js +4 -3
- package/lib/hooks/useDocumentOperations.d.ts +1 -0
- package/lib/hooks/useDocumentOperations.js +2 -2
- package/lib/hooks/usePreventFileDrop.js +9 -0
- package/package.json +1 -1
|
@@ -23,6 +23,11 @@ interface ITMSearchResultProps {
|
|
|
23
23
|
openDcmtFormAsModal?: boolean;
|
|
24
24
|
showSearchResultSidebar?: boolean;
|
|
25
25
|
showDcmtFormSidebar?: boolean;
|
|
26
|
+
/** Mostra accanto alla griglia il selettore dei tipi documento trovati:
|
|
27
|
+
* su desktop sono affiancati (30/70),
|
|
28
|
+
* su mobile si naviga a step tra selettore e risultati.
|
|
29
|
+
* Se il risultato ha un solo tipo documento il selettore resta chiuso
|
|
30
|
+
* e lo spazio va tutto alla griglia, riapribile dal menu "Altro" */
|
|
26
31
|
showSelector?: boolean;
|
|
27
32
|
showToolbarHeader?: boolean;
|
|
28
33
|
showBackButton?: boolean;
|
|
@@ -362,6 +362,7 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
|
|
|
362
362
|
allowRelations,
|
|
363
363
|
showTodoDcmtForm,
|
|
364
364
|
graphometricManager,
|
|
365
|
+
showSelector,
|
|
365
366
|
},
|
|
366
367
|
tasks: {
|
|
367
368
|
allTasks: allTasks,
|
|
@@ -621,11 +622,11 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
|
|
|
621
622
|
}, [currentMetadataValues]);
|
|
622
623
|
const getTitleHeader = () => {
|
|
623
624
|
let counters = (showSelector && disableAccordionIfSingleCategory && searchResults.length > 1) ? getSearchResultCountersSingleCategory(searchResults) : "";
|
|
624
|
-
if (title)
|
|
625
|
-
return title + counters;
|
|
626
625
|
// Nome del tipo documento selezionato, accodato al titolo
|
|
627
626
|
const selectedDcmtTypeName = selectedSearchResult?.fromName ?? (searchResults?.length === 1 ? searchResults[0]?.fromName : undefined);
|
|
628
627
|
const withSelectedDcmtTypeName = (baseTitle) => selectedDcmtTypeName ? `${baseTitle} - ${selectedDcmtTypeName}` : baseTitle;
|
|
628
|
+
if (title)
|
|
629
|
+
return withSelectedDcmtTypeName(title) + counters;
|
|
629
630
|
let titleHeader = withSelectedDcmtTypeName('Ricerca per metadati');
|
|
630
631
|
switch (context) {
|
|
631
632
|
case SearchResultContext.MASTER_DETAIL:
|
|
@@ -770,7 +771,7 @@ handleNavigateToWGs, handleNavigateToDossiers, fetchRemoteCertificates, graphome
|
|
|
770
771
|
const tmSearchResult = useMemo(() => (!searchResults || searchResults.length <= 0)
|
|
771
772
|
? _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', height: '100%', width: '100%' }, children: [_jsx(IconBoard, { fontSize: 96 }), showNoDcmtFoundMessage && _jsx("div", { style: { fontSize: "15px", marginTop: "10px" }, children: SDKUI_Localizator.NoDcmtFound }), openAddDocumentForm && _jsx("div", { style: { marginTop: "10px" }, children: _jsx(TMButton, { fontSize: "15px", icon: _jsx("i", { className: 'dx-icon-share' }), caption: SDKUI_Localizator.Share, onClick: openAddDocumentForm }) })] })
|
|
772
773
|
:
|
|
773
|
-
_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 && !isSteppedLayout && !isSelectorCollapsed, start: splitterSizes, children: [showSelector ?
|
|
774
|
+
_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: isSteppedLayout ? 'hidden' : 'visible', separatorSize: Gutters.getGutters(), separatorActiveColor: 'transparent', separatorColor: 'transparent', min: ['0', '0'], showSeparator: showSelector && !isSteppedLayout && !isSelectorCollapsed, start: splitterSizes, children: [showSelector ?
|
|
774
775
|
_jsx(TMLayoutItem, { children: _jsx(TMSearchResultSelector, { searchResults: currentSearchResults, disableAccordionIfSingleCategory: disableAccordionIfSingleCategory, selectedTID: selectedSearchResultTID, selectedSearchResult: selectedSearchResult, autoSelectFirst: !isMobile || hasSingleDcmtType, onSelectionChanged: onSearchResultSelectionChanged }) })
|
|
775
776
|
:
|
|
776
777
|
_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, dcmtsReturned: dcmtsReturned, dcmtsFound: dcmtsFound, showCounterConfig: showCounterConfig, counterConfig: counterConfig, showActionsColumn: showActionsColumn, compactPager: compactPager, onRowActionRequest: requestRowAction }) })] }), 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: () => {
|
|
@@ -63,6 +63,7 @@ export interface UIConfigProps {
|
|
|
63
63
|
toppyHelpCenterUsePortal?: boolean;
|
|
64
64
|
inputDcmtFormLayoutMode?: LayoutModes;
|
|
65
65
|
graphometricManager?: IGraphometricManagerProp;
|
|
66
|
+
showSelector?: boolean;
|
|
66
67
|
}
|
|
67
68
|
export interface TasksProps {
|
|
68
69
|
allTasks?: Array<TaskDescriptor>;
|
|
@@ -86,7 +86,7 @@ export const useDocumentOperations = (props) => {
|
|
|
86
86
|
const { dataColumns, dataSource, selectedRowKeys, } = exportData ?? {};
|
|
87
87
|
const { visibleItems = [], onRefreshSearchAsyncDatagrid, onRefreshDataRowsAsync, refreshFocusedDataRowAsync, onRefreshBlogDatagrid, onRefreshPreviewDatagrid, refreshOperationsTrigger = 0, onRefreshOperationsDatagrid, } = datagridUtility ?? {};
|
|
88
88
|
const { approvalVID, dcmtDataRowForCicoStatus, selectedDcmtSearchResultRelations, dcmtTIDHasDetailRelations = false, dcmtTIDHasMasterRelations = false, updateCurrentDcmt, onCloseDcmtForm, onRefreshBlogForm, onRefreshPreviewForm, taskFormDialogComponent, s4TViewerDialogComponent } = dcmtUtility ?? {};
|
|
89
|
-
const { floatingBarContainerRef, customButtonsLayout, workingGroupContext, openS4TViewer = false, openDcmtFormAsModal = false, showDcmtFormSidebar = true, allowFloatingBar = true, enablePinIcons = true, allowRelations = true, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, editPdfForm = false, inputDcmtFormLayoutMode = LayoutModes.Update, graphometricManager, } = uiConfig;
|
|
89
|
+
const { floatingBarContainerRef, customButtonsLayout, workingGroupContext, openS4TViewer = false, openDcmtFormAsModal = false, showDcmtFormSidebar = true, allowFloatingBar = true, enablePinIcons = true, allowRelations = true, showTodoDcmtForm = false, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, editPdfForm = false, inputDcmtFormLayoutMode = LayoutModes.Update, graphometricManager, showSelector = false, } = uiConfig;
|
|
90
90
|
const { allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback } = tasks;
|
|
91
91
|
const {
|
|
92
92
|
// Refresh operations (data consistency)
|
|
@@ -1073,7 +1073,7 @@ export const useDocumentOperations = (props) => {
|
|
|
1073
1073
|
]
|
|
1074
1074
|
};
|
|
1075
1075
|
};
|
|
1076
|
-
const canToggleDcmtTypesSelection = !isMobile &&
|
|
1076
|
+
const canToggleDcmtTypesSelection = !isMobile && showSelector && currentSearchResults?.length === 1;
|
|
1077
1077
|
const otherOperationsMenuItem = () => {
|
|
1078
1078
|
return {
|
|
1079
1079
|
id: 'oth',
|
|
@@ -2,7 +2,12 @@ import { useEffect } from "react";
|
|
|
2
2
|
const usePreventFileDrop = (allowedDropZones) => {
|
|
3
3
|
useEffect(() => {
|
|
4
4
|
const isOverAllowedZone = (event) => allowedDropZones.some((ref) => ref.current?.contains(event.target));
|
|
5
|
+
// Il blocco vale solo per i file trascinati da fuori: i drag interni all'applicazione
|
|
6
|
+
// (riordino di metadati, colonne, tab, ...) devono restare liberi di completarsi
|
|
7
|
+
const isFileDrag = (event) => event.dataTransfer?.types?.includes("Files") === true;
|
|
5
8
|
const handleDragOver = (event) => {
|
|
9
|
+
if (!isFileDrag(event))
|
|
10
|
+
return;
|
|
6
11
|
if (isOverAllowedZone(event)) {
|
|
7
12
|
// Riafferma "copy" ad ogni dragover: altrimenti un "none"
|
|
8
13
|
// impostato mentre si era fuori zona resta e mostra "not-allowed"
|
|
@@ -17,6 +22,8 @@ const usePreventFileDrop = (allowedDropZones) => {
|
|
|
17
22
|
}
|
|
18
23
|
};
|
|
19
24
|
const handleDragEnter = (event) => {
|
|
25
|
+
if (!isFileDrag(event))
|
|
26
|
+
return;
|
|
20
27
|
if (isOverAllowedZone(event)) {
|
|
21
28
|
document.body.style.cursor = "default";
|
|
22
29
|
}
|
|
@@ -28,6 +35,8 @@ const usePreventFileDrop = (allowedDropZones) => {
|
|
|
28
35
|
document.body.style.cursor = "default";
|
|
29
36
|
};
|
|
30
37
|
const handleDrop = (event) => {
|
|
38
|
+
if (!isFileDrag(event))
|
|
39
|
+
return;
|
|
31
40
|
if (!isOverAllowedZone(event)) {
|
|
32
41
|
event.preventDefault();
|
|
33
42
|
document.body.style.cursor = "default";
|