@topconsultnpm/sdkui-react 6.21.0-dev1.3 → 6.21.0-dev1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/base/TMAreaManager.js +28 -11
- package/lib/components/base/TMPanel.js +1 -0
- package/lib/components/choosers/TMUserChooser.js +3 -1
- package/lib/components/editors/TMFormulaEditor.js +15 -3
- package/lib/components/features/archive/TMArchive.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.js +12 -8
- package/lib/components/features/documents/TMFileUploader.d.ts +1 -1
- package/lib/components/features/documents/TMFileUploader.js +3 -3
- package/lib/components/features/documents/TMMasterDetailDcmts.js +74 -21
- package/lib/components/features/documents/TMRelationViewer.d.ts +6 -1
- package/lib/components/features/documents/TMRelationViewer.js +44 -7
- package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
- package/lib/components/features/search/TMSearch.d.ts +1 -0
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchResult.d.ts +1 -0
- package/lib/components/features/search/TMSearchResult.js +18 -4
- package/lib/components/features/search/TMViewHistoryDcmt.js +6 -0
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +5 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +7 -1
- package/lib/components/features/workflow/diagram/xmlParser.js +13 -14
- package/lib/components/forms/Login/TMLoginForm.js +15 -5
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/pages/TMPage.js +4 -2
- package/lib/components/query/TMQueryCountButton.d.ts +11 -0
- package/lib/components/query/TMQueryCountButton.js +32 -0
- package/lib/components/query/TMQueryEditor.js +41 -4
- package/lib/components/query/TMQuerySummary.js +3 -2
- package/lib/helper/SDKUI_Globals.d.ts +2 -0
- package/lib/helper/TMUtils.d.ts +1 -0
- package/lib/helper/TMUtils.js +12 -0
- package/lib/helper/checkinCheckoutManager.d.ts +1 -1
- package/lib/helper/checkinCheckoutManager.js +18 -4
- package/lib/hooks/useDcmtOperations.d.ts +1 -0
- package/lib/hooks/useDcmtOperations.js +75 -4
- package/lib/hooks/useDocumentOperations.d.ts +1 -0
- package/lib/hooks/useDocumentOperations.js +15 -10
- package/lib/hooks/useForm.js +20 -14
- package/lib/hooks/useInputDialog.d.ts +2 -0
- package/lib/hooks/useInputDialog.js +34 -0
- package/lib/hooks/useQueryParametersDialog.js +5 -5
- package/package.json +55 -55
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
|
|
4
|
-
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo } from '../../../helper';
|
|
3
|
+
import { DcmtTypeListCacheService, SDK_Globals, DataColumnTypes, MetadataFormats, SystemMIDs, MetadataDataDomains, RelationCacheService, RelationTypes, UserListCacheService } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { genUniqueId, IconFolder, IconBackhandIndexPointingRight, IconCircleInfo, getDcmtCicoStatus } from '../../../helper';
|
|
5
5
|
import { TMColors } from '../../../utils/theme';
|
|
6
6
|
import { StyledDivHorizontal, StyledBadge } from '../../base/Styled';
|
|
7
7
|
import TMTreeView from '../../base/TMTreeView';
|
|
@@ -136,7 +136,7 @@ export const searchResultToDataSource = async (searchResult, hideSysMetadata) =>
|
|
|
136
136
|
}
|
|
137
137
|
return output;
|
|
138
138
|
};
|
|
139
|
-
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, }) => {
|
|
139
|
+
const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndicator = true, allowShowZeroDcmts = true, initialShowZeroDcmts = false, allowedTIDs, allowMultipleSelection = false, focusedItem, selectedItems, onFocusedItemChanged, onSelectedItemsChanged, onDocumentDoubleClick, customItemRender, customDocumentStyle, customMainContainerContent, customDocumentContent, showMetadataNames = false, maxDepthLevel = 2, invertMasterNavigation = true, additionalStaticItems, showMainDocument = true, labelMainContainer, onNoRelationsFound, onItemContextMenu, focusedItemFormData = [] }) => {
|
|
140
140
|
// State
|
|
141
141
|
const [dcmtTypes, setDcmtTypes] = useState([]);
|
|
142
142
|
const [treeData, setTreeData] = useState([]);
|
|
@@ -160,6 +160,16 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
160
160
|
const userInteractedWithStaticItemsRef = React.useRef(false);
|
|
161
161
|
// Ref to track the last inputKey for which we set the focused item
|
|
162
162
|
const lastFocusedInputRef = React.useRef('');
|
|
163
|
+
// State for all users (used for checkout status display)
|
|
164
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
165
|
+
// Load all users for checkout status resolution
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
const fetchAllUsers = async () => {
|
|
168
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
169
|
+
setAllUsers(users ?? []);
|
|
170
|
+
};
|
|
171
|
+
fetchAllUsers();
|
|
172
|
+
}, []);
|
|
163
173
|
/**
|
|
164
174
|
* Generate a stable key from inputDcmts to detect real changes
|
|
165
175
|
*/
|
|
@@ -234,6 +244,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
234
244
|
dcmtDetails.push({
|
|
235
245
|
tid: tid,
|
|
236
246
|
did: did,
|
|
247
|
+
dtd: dtd,
|
|
237
248
|
isLogDel: isLogDel,
|
|
238
249
|
key: `${tid}_${did}_${searchResult.relationID}_${mTID}_${mDID}_${rowGUID}`,
|
|
239
250
|
isDcmt: true,
|
|
@@ -247,7 +258,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
247
258
|
expanded: false,
|
|
248
259
|
hidden: false,
|
|
249
260
|
name: row?.SYS_Abstract?.value || row?.SYS_SUBJECT?.value || `Documento ${did}`,
|
|
250
|
-
fileExt: row?.FILEEXT?.value
|
|
261
|
+
fileExt: row?.FILEEXT?.value,
|
|
251
262
|
// Note: Recursive loading on expansion is handled by calculateItemsForNode
|
|
252
263
|
});
|
|
253
264
|
}
|
|
@@ -260,7 +271,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
260
271
|
console.error('❌ Error loading detail documents:', error);
|
|
261
272
|
}
|
|
262
273
|
return items;
|
|
263
|
-
}, [allowedTIDs]);
|
|
274
|
+
}, [allowedTIDs, focusedItemFormData, focusedItem?.dtd?.id]);
|
|
264
275
|
/**
|
|
265
276
|
* Recursively retrieve master documents
|
|
266
277
|
*/
|
|
@@ -319,6 +330,7 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
319
330
|
dcmtMasters.push({
|
|
320
331
|
tid: tid,
|
|
321
332
|
did: did,
|
|
333
|
+
dtd: dtd,
|
|
322
334
|
isLogDel: isLogDel,
|
|
323
335
|
key: `${tid}_${did}_${searchResult.relationID}_${dTID}_${dDID}_${rowGUID}`,
|
|
324
336
|
isDcmt: true,
|
|
@@ -609,12 +621,14 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
609
621
|
name: docRow?.SYS_Abstract?.value || docRow?.SYS_SUBJECT?.value || `Documento ${isForMaster ? 'Dettaglio' : 'Master'}`,
|
|
610
622
|
tid: dcmt.TID,
|
|
611
623
|
did: dcmt.DID,
|
|
624
|
+
dtd: dtd,
|
|
612
625
|
isDcmt: true,
|
|
613
626
|
isContainer: false,
|
|
614
627
|
expanded: false,
|
|
615
628
|
isZero: dcmt.DID === 0,
|
|
616
629
|
isMaster: !isForMaster,
|
|
617
630
|
isLoaded: true,
|
|
631
|
+
isLogDel: docRow?.ISLOGDEL?.value,
|
|
618
632
|
hidden: false,
|
|
619
633
|
values: docRow,
|
|
620
634
|
searchResult: result ? [result] : [],
|
|
@@ -1080,8 +1094,31 @@ const TMRelationViewer = ({ inputDcmts, isForMaster = false, showCurrentDcmtIndi
|
|
|
1080
1094
|
const metadataContent = customDocumentContent
|
|
1081
1095
|
? customDocumentContent(item, defaultMetadataContent || _jsx(_Fragment, {}))
|
|
1082
1096
|
: defaultMetadataContent;
|
|
1083
|
-
|
|
1084
|
-
|
|
1097
|
+
// Calculate checkout status for non-root documents
|
|
1098
|
+
let checkoutStatusIcon = null;
|
|
1099
|
+
if (item.values && item.dtd) {
|
|
1100
|
+
// Convert item.values to flat format expected by getDcmtCicoStatus
|
|
1101
|
+
const flatValues = {};
|
|
1102
|
+
if (item.values) {
|
|
1103
|
+
for (const key of Object.keys(item.values)) {
|
|
1104
|
+
const entry = item.values[key];
|
|
1105
|
+
if (entry?.md?.id && item.tid) {
|
|
1106
|
+
// Create TID_MID key format for metadata
|
|
1107
|
+
flatValues[`${item.tid}_${entry.md.id}`] = entry.value;
|
|
1108
|
+
}
|
|
1109
|
+
// Also add direct key for system properties
|
|
1110
|
+
flatValues[key] = entry?.value;
|
|
1111
|
+
}
|
|
1112
|
+
flatValues.TID = item.tid;
|
|
1113
|
+
flatValues.DID = item.did;
|
|
1114
|
+
}
|
|
1115
|
+
const { checkoutStatus } = getDcmtCicoStatus(flatValues, allUsers, item.dtd);
|
|
1116
|
+
if (checkoutStatus.isCheckedOut && checkoutStatus.icon) {
|
|
1117
|
+
checkoutStatusIcon = checkoutStatus.icon;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return (_jsxs("div", { onDoubleClick: handleDoubleClick, style: documentStyle, children: [item.did && item.tid && showCurrentDcmtIndicator && inputDcmts?.some(d => d.DID === item.did && d.TID === item.tid) ? _jsx(IconBackhandIndexPointingRight, { fontSize: 22, overflow: 'visible' }) : _jsx(_Fragment, {}), item.values && (_jsx(TMDcmtIcon, { tid: item.values?.TID?.value, did: item.values?.DID?.value, fileExtension: item.values?.FILEEXT?.value, fileCount: item.values?.FILECOUNT?.value, isLexProt: item.values?.IsLexProt?.value, isMail: item.values?.ISMAIL?.value, isShared: item.values?.ISSHARED?.value, isSigned: item.values?.ISSIGNED?.value, downloadMode: 'openInNewWindow' })), checkoutStatusIcon, metadataContent] }));
|
|
1121
|
+
}, [onDocumentDoubleClick, showCurrentDcmtIndicator, inputDcmts, customMainContainerContent, customDocumentStyle, customDocumentContent, showMetadataNames, showMainDocument, focusedItemFormData, focusedItem?.dtd, allUsers]);
|
|
1085
1122
|
/**
|
|
1086
1123
|
* Wrapper renderer that handles custom rendering if provided
|
|
1087
1124
|
*/
|
|
@@ -201,7 +201,7 @@ const TMSavedQuerySelector = React.memo(({ items, selectedId, allowShowSearch =
|
|
|
201
201
|
alignItems: 'center',
|
|
202
202
|
justifyContent: 'center',
|
|
203
203
|
minWidth: 0
|
|
204
|
-
}, children: [_jsx("p", { style: {
|
|
204
|
+
}, children: [_jsx("p", { title: sqd.name, style: {
|
|
205
205
|
fontSize: '1rem',
|
|
206
206
|
fontWeight: sqd.id === 1 ? 600 : 'normal',
|
|
207
207
|
whiteSpace: 'nowrap',
|
|
@@ -27,6 +27,7 @@ interface ITMSearchProps {
|
|
|
27
27
|
openS4TViewer?: boolean;
|
|
28
28
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: (() => Promise<void>)) => void;
|
|
29
29
|
onOpenPdfEditorRequest?: ((dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void);
|
|
30
|
+
openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
30
31
|
showTodoDcmtForm?: boolean;
|
|
31
32
|
showToppyDraggableHelpCenter?: boolean;
|
|
32
33
|
toppyHelpCenterUsePortal?: boolean;
|
|
@@ -19,7 +19,7 @@ var TMSearchViews;
|
|
|
19
19
|
TMSearchViews[TMSearchViews["Search"] = 0] = "Search";
|
|
20
20
|
TMSearchViews[TMSearchViews["Result"] = 1] = "Result";
|
|
21
21
|
})(TMSearchViews || (TMSearchViews = {}));
|
|
22
|
-
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
22
|
+
const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, openInOffice, isVisible, inputTID, inputSqdID, inputMids, isExpertMode = SDKUI_Globals.userSettings.advancedSettings.expertMode === 1, floatingActionConfig, onFileOpened, onRefreshAfterAddDcmtToFavs, onTaskCreateRequest, openWGsCopyMoveForm, editPdfForm = false, openS4TViewer, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, showTodoDcmtForm, showToppyDraggableHelpCenter = true, toppyHelpCenterUsePortal = false, passToArchiveCallback, onCurrentTIDChangedCallback, onlyShowSearchQueryPanel, onReferenceClick }) => {
|
|
23
23
|
const [allSQDs, setAllSQDs] = useState([]);
|
|
24
24
|
const [filteredByTIDSQDs, setFilteredByTIDSQDs] = useState([]);
|
|
25
25
|
const [currentSQD, setCurrentSQD] = useState();
|
|
@@ -258,7 +258,7 @@ const TMSearch = ({ allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTask
|
|
|
258
258
|
toolbarOptions: { icon: _jsx(IconSavedQuery, { fontSize: 24 }), visible: true, orderNumber: 4, isActive: allInitialPanelVisibility['TMSavedQuerySelector'] }
|
|
259
259
|
}
|
|
260
260
|
], [tmTreeSelectorElement, showSearchResults, tmRecentsManagerElement, tmSearchQueryPanelElement, tmSavedQuerySelectorElement, fromDTD, mruTIDs]);
|
|
261
|
-
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsyncDatagrid: onRefreshSearchAsyncDatagrid, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
261
|
+
return (_jsxs(_Fragment, { children: [showSearchResults ? _jsx(StyledMultiViewPanel, { "$isVisible": currentSearchView === TMSearchViews.Search, children: _jsx(TMPanelManagerWithPersistenceProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'TMRecentsManager', isPersistenceEnabled: !isMobile ? hasSavedLayout() : false, persistPanelStates: !isMobile ? (state) => persistPanelStates(state) : undefined, persistedPanelStates: getPersistedPanelStates(), children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true, minPanelSizePx: !isMobile ? 250 : 150 }) }) }) : tmSearchQueryPanelElement, showSearchResults && _jsx(TMSearchResult, { isVisible: isVisible && currentSearchView === TMSearchViews.Result, context: SearchResultContext.METADATA_SEARCH, searchResults: searchResult, floatingActionConfig: floatingActionConfig, onRefreshAfterAddDcmtToFavs: onRefreshAfterAddDcmtToFavs, openInOffice: openInOffice, onRefreshSearchAsyncDatagrid: onRefreshSearchAsyncDatagrid, onClose: () => { onlyShowSearchQueryPanel ? setShowSearchResults(false) : setCurrentSearchView(TMSearchViews.Search); }, onFileOpened: onFileOpened, onTaskCreateRequest: onTaskCreateRequest, openWGsCopyMoveForm: openWGsCopyMoveForm, editPdfForm: editPdfForm, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, passToArchiveCallback: passToArchiveCallback, onSelectedTIDChanged: onCurrentTIDChangedCallback, showTodoDcmtForm: showTodoDcmtForm, showToppyDraggableHelpCenter: showToppyDraggableHelpCenter, toppyHelpCenterUsePortal: toppyHelpCenterUsePortal, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers })] }));
|
|
262
262
|
};
|
|
263
263
|
export default TMSearch;
|
|
264
264
|
const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
|
|
@@ -45,6 +45,7 @@ interface ITMSearchResultProps {
|
|
|
45
45
|
}>, tid?: number) => void;
|
|
46
46
|
onOpenS4TViewerRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
|
|
47
47
|
onOpenPdfEditorRequest?: (dcmtInfo: Array<DcmtInfo>, refreshDocumentPreview?: () => Promise<void>) => void;
|
|
48
|
+
openFileUploaderPdfEditor?: (fromDTD?: DcmtTypeDescriptor, file?: File | null, handleFile?: (file: File) => void) => void;
|
|
48
49
|
openCommentFormCallback?: (documents: Array<DcmtInfo>) => void;
|
|
49
50
|
openAddDocumentForm?: () => void;
|
|
50
51
|
allTasks?: Array<TaskDescriptor>;
|
|
@@ -56,7 +56,7 @@ groupId, searchResults = [], context = SearchResultContext.METADATA_SEARCH, titl
|
|
|
56
56
|
// Boolean flags to enable/disable features
|
|
57
57
|
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
|
-
openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openCommentFormCallback, openAddDocumentForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest, passToArchiveCallback, onReferenceClick,
|
|
59
|
+
openInOffice, onRefreshAfterAddDcmtToFavs, onRefreshSearchAsyncDatagrid, onSelectedTIDChanged, onWFOperationCompleted, onClose, onFileOpened, onTaskCreateRequest, openWGsCopyMoveForm, openCommentFormCallback, openAddDocumentForm, onOpenS4TViewerRequest, onOpenPdfEditorRequest, openFileUploaderPdfEditor, passToArchiveCallback, onReferenceClick,
|
|
60
60
|
// Tasks
|
|
61
61
|
allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback,
|
|
62
62
|
// Navigation
|
|
@@ -346,12 +346,13 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
346
346
|
openWGsCopyMoveForm,
|
|
347
347
|
onOpenS4TViewerRequest,
|
|
348
348
|
onOpenPdfEditorRequest,
|
|
349
|
+
openFileUploaderPdfEditor,
|
|
349
350
|
// Task related
|
|
350
351
|
onTaskCreateRequest,
|
|
351
352
|
openTaskFormHandler,
|
|
352
353
|
},
|
|
353
354
|
});
|
|
354
|
-
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, 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;
|
|
355
|
+
const { isOpenDcmtForm, openFormHandler, dcmtFormLayoutMode, onDcmtFormOpenChange, showSearchTMDatagrid, showExportForm, isOpenBatchUpdate, isModifiedBatchUpdate, updateBatchUpdateForm, handleSignApprove, checkoutInfo: { showCicoWaitPanel, cicoWaitPanelTitle, showCicoPrimaryProgress, cicoPrimaryProgressText, cicoPrimaryProgressValue, cicoPrimaryProgressMax, }, dcmtOperations: { abortController, showWaitPanel, showPrimary, waitPanelTitle, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync, runOperationAsync, FileSourceDialog, }, relatedDocumentsInfo: { isOpenDetails, isOpenMaster, checkRelatedDcmtsArchiveCapability, checkManyToManyCapability, }, toppyOperations: { showApprovePopup, showRejectPopup, showReAssignPopup, showMoreInfoPopup, updateShowApprovePopup, updateShowRejectPopup, updateShowReAssignPopup, updateShowMoreInfoPopup } } = features;
|
|
355
356
|
const deviceType = useDeviceType();
|
|
356
357
|
const isMobile = deviceType === DeviceType.MOBILE;
|
|
357
358
|
const selectedDocs = getSelectedDcmtsOrFocused(selectedItems, focusedItem);
|
|
@@ -657,6 +658,7 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
657
658
|
}
|
|
658
659
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', width: '100%' }, children: [_jsx("div", { style: { padding: '10px', overflow: 'auto', flex: 1 }, children: _jsx("div", { dangerouslySetInnerHTML: { __html: ftExplanation } }) }), _jsxs(StyledIndexingInfoSection, { children: [_jsxs(StyledIndexingToggle, { onClick: handleToggleIndexingInfo, disabled: loadingIndexingInfo, children: [_jsx(StyledLeftContent, { children: _jsx("span", { children: SDKUI_Localizator.IndexingInformation }) }), _jsx(StyledRightContent, { children: _jsx(StyledChevron, { "$isOpen": showIndexingInfo, children: "\u25BC" }) })] }), showIndexingInfo && indexingInfo && (_jsxs(StyledIndexingInfoBox, { children: [_jsx("div", { dangerouslySetInnerHTML: { __html: indexingInfo } }), loadingIndexingInfo && (_jsxs("div", { style: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', background: 'rgba(255, 255, 255, 0.9)', padding: '10px', borderRadius: '4px', boxShadow: '0 2px 8px rgba(0,0,0,0.15)' }, children: [SDKUI_Localizator.Loading, "..."] }))] }))] })] }));
|
|
659
660
|
}, [selectedSearchResult, focusedItem, indexingInfo, showIndexingInfo, loadingIndexingInfo]);
|
|
661
|
+
const isBoardDisabled = useMemo(() => fromDTD?.hasBlog !== 1, [fromDTD?.hasBlog]);
|
|
660
662
|
const allInitialPanelVisibility = {
|
|
661
663
|
'tmSearchResult': true,
|
|
662
664
|
'tmBlog': false,
|
|
@@ -725,9 +727,9 @@ handleNavigateToWGs, handleNavigateToDossiers, }) => {
|
|
|
725
727
|
width: '100%',
|
|
726
728
|
height: '100%',
|
|
727
729
|
}, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showCicoWaitPanel, showWaitPanelPrimary: showCicoPrimaryProgress, waitPanelTitle: cicoWaitPanelTitle, waitPanelTextPrimary: cicoPrimaryProgressText, waitPanelValuePrimary: cicoPrimaryProgressValue, waitPanelMaxValuePrimary: cicoPrimaryProgressMax, isCancelable: true, abortController: abortControllerLocal, children: (groupId && groupId.length > 0) ?
|
|
728
|
-
_jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })
|
|
730
|
+
_jsxs(_Fragment, { children: [_jsx(PanelDisabledStateHandler, { isBoardDisabled: isBoardDisabled }), _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", parentId: groupId, showToolbar: showSearchResultSidebar })] })
|
|
729
731
|
:
|
|
730
|
-
|
|
732
|
+
_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] }));
|
|
731
733
|
};
|
|
732
734
|
export default TMSearchResult;
|
|
733
735
|
const TMSearchResultGrid = ({ openInOffice, fromDTD, operationItems, allUsers, inputFocusedItem, allowMultipleSelection = true, showExportForm = false, onFocusedItemChanged, onDownloadDcmtsAsync, onVisibleItemChanged, inputSelectedItems = [], lastUpdateSearchTime, searchResult, onSelectionChanged, onDblClick, showSearchTMDatagrid, updateDataColumnsFromDataGrid, updateDataSourceFromDataGrid, updateSelectedRowKeysFromDataGrid }) => {
|
|
@@ -1237,6 +1239,18 @@ const TMSearchResultSelector = ({ searchResults = [], disableAccordionIfSingleCa
|
|
|
1237
1239
|
return (_jsx(TMAccordionNew, { groups: accordionGroups, selectedItem: selectedResult, onSelectedItemChange: (result) => handleSelect(result) }));
|
|
1238
1240
|
};
|
|
1239
1241
|
//#endregion TMSearchResultSelector
|
|
1242
|
+
const PanelDisabledStateHandler = ({ isBoardDisabled }) => {
|
|
1243
|
+
const { setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility } = useTMPanelManagerContext();
|
|
1244
|
+
useEffect(() => {
|
|
1245
|
+
// Aggiorna lo stato disabled del bottone toolbar
|
|
1246
|
+
setToolbarButtonDisabled('tmBlog', isBoardDisabled);
|
|
1247
|
+
// Chiude il pannello solo se è attualmente visibile e deve essere disabilitato
|
|
1248
|
+
if (isBoardDisabled && panelVisibility['tmBlog']) {
|
|
1249
|
+
setPanelVisibilityById('tmBlog', false);
|
|
1250
|
+
}
|
|
1251
|
+
}, [isBoardDisabled, setPanelVisibilityById, setToolbarButtonDisabled, panelVisibility]);
|
|
1252
|
+
return null;
|
|
1253
|
+
};
|
|
1240
1254
|
const TMDcmtPreviewWrapper = ({ refreshPreviewTrigger, currentDcmt, isVisible }) => {
|
|
1241
1255
|
const { setPanelVisibilityById, toggleMaximize, isResizingActive, countVisibleLeafPanels } = useTMPanelManagerContext();
|
|
1242
1256
|
const deviceType = useDeviceType();
|
|
@@ -87,6 +87,12 @@ const TMViewHistoryDcmt = (props) => {
|
|
|
87
87
|
IsSigned: row.IsSigned ? row.IsSigned.toString() === '1' : false,
|
|
88
88
|
};
|
|
89
89
|
});
|
|
90
|
+
// Sort by LastUpdateTime ascending
|
|
91
|
+
historyFileItems.sort((a, b) => {
|
|
92
|
+
const dateA = a.LastUpdateTime ? new Date(a.LastUpdateTime).getTime() : 0;
|
|
93
|
+
const dateB = b.LastUpdateTime ? new Date(b.LastUpdateTime).getTime() : 0;
|
|
94
|
+
return dateA - dateB;
|
|
95
|
+
});
|
|
90
96
|
return historyFileItems;
|
|
91
97
|
}
|
|
92
98
|
return [];
|
|
@@ -70,7 +70,11 @@ const ButtonsContainer = styled.div `
|
|
|
70
70
|
`;
|
|
71
71
|
const SET_RULE_DATASOURCE = [
|
|
72
72
|
{ value: WorkItemSetRules.Ands_AND_Ors, display: "Ands_AND_Ors" },
|
|
73
|
-
{ value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" }
|
|
73
|
+
{ value: WorkItemSetRules.Ands_OR_Ors, display: "Ands_OR_Ors" },
|
|
74
|
+
{ value: WorkItemSetRules.Ands_AND_Ors_AssignModeOrs, display: "Ands_AND_Ors_AssignModeOrs" },
|
|
75
|
+
{ value: WorkItemSetRules.Ands_OR_Ors_AssignModeOrs, display: "Ands_OR_Ors_AssignModeOrs" },
|
|
76
|
+
{ value: WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds, display: "Ands_AND_Ors_WaitForAllAnds" },
|
|
77
|
+
{ value: WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds, display: "Ands_OR_Ors_WaitForAllAnds" }
|
|
74
78
|
];
|
|
75
79
|
const SEVERITY_DATASOURCE = [
|
|
76
80
|
{ value: Severities.Critical, display: "Critical" },
|
|
@@ -341,6 +341,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
341
341
|
const isUndoingRedoing = useRef(false);
|
|
342
342
|
const initialDiagramRef = useRef(null);
|
|
343
343
|
const notifiedXmlRef = useRef(null);
|
|
344
|
+
const serializationGenRef = useRef(0);
|
|
344
345
|
const svgRef = useRef(null);
|
|
345
346
|
const containerRef = useRef(null);
|
|
346
347
|
const [isDrawingConnection, setIsDrawingConnection] = useState(false);
|
|
@@ -430,10 +431,15 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
430
431
|
setHistoryIndex(newHistory.length);
|
|
431
432
|
}
|
|
432
433
|
setWfDiagram(newDiagram);
|
|
434
|
+
const currentGen = ++serializationGenRef.current;
|
|
433
435
|
(async () => {
|
|
434
436
|
try {
|
|
435
437
|
// await è necessario per attendere il risultato stringa
|
|
436
438
|
const newXml = await serializeWfDiagramToXml(newDiagram);
|
|
439
|
+
// Ignora serializzazioni obsolete: se nel frattempo è partita una nuova serializzazione,
|
|
440
|
+
// questa è vecchia e non deve sovrascrivere il risultato più recente.
|
|
441
|
+
if (currentGen !== serializationGenRef.current)
|
|
442
|
+
return;
|
|
437
443
|
notifiedXmlRef.current = newXml;
|
|
438
444
|
// Chiama il callback per notificare TMWFEditor
|
|
439
445
|
// L'invio dell'XML al genitore avviene solo a serializzazione completata.
|
|
@@ -449,7 +455,7 @@ const WFDiagram = ({ xmlDiagramString, currentSetID, allowEdit = true, onDiagram
|
|
|
449
455
|
catch (e) {
|
|
450
456
|
TMExceptionBoxManager.show({ exception: e });
|
|
451
457
|
}
|
|
452
|
-
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly]);
|
|
458
|
+
}, [wfDiagramHistory, historyIndex, isUndoingRedoing, setWfDiagramHistory, setHistoryIndex, setWfDiagram, isReadOnly, onDiagramChange]);
|
|
453
459
|
const handleUndo = useCallback(() => {
|
|
454
460
|
if (isReadOnly)
|
|
455
461
|
return;
|
|
@@ -67,14 +67,13 @@ export const getSeveritiesNumber = (severity) => {
|
|
|
67
67
|
};
|
|
68
68
|
export const getWorkItemSetRulesNumber = (setRule) => {
|
|
69
69
|
switch (setRule) {
|
|
70
|
-
case WorkItemSetRules.Ands_AND_Ors:
|
|
71
|
-
|
|
72
|
-
case WorkItemSetRules.
|
|
73
|
-
|
|
74
|
-
case WorkItemSetRules.
|
|
75
|
-
|
|
76
|
-
default:
|
|
77
|
-
return 0;
|
|
70
|
+
case WorkItemSetRules.Ands_AND_Ors: return 0;
|
|
71
|
+
case WorkItemSetRules.Ands_OR_Ors: return 1;
|
|
72
|
+
case WorkItemSetRules.Ands_AND_Ors_AssignModeOrs: return 2;
|
|
73
|
+
case WorkItemSetRules.Ands_OR_Ors_AssignModeOrs: return 3;
|
|
74
|
+
case WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds: return 4;
|
|
75
|
+
case WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds: return 5;
|
|
76
|
+
default: return 0;
|
|
78
77
|
}
|
|
79
78
|
};
|
|
80
79
|
export const getWFAppTypesNumber = (appType) => {
|
|
@@ -147,12 +146,12 @@ const mapSeverity = (severityValue) => {
|
|
|
147
146
|
// Funzione helper per mappare i valori numerici di WorkItemSetRules
|
|
148
147
|
const mapWorkItemSetRules = (ruleValue) => {
|
|
149
148
|
switch (ruleValue) {
|
|
150
|
-
case 0:
|
|
151
|
-
|
|
152
|
-
case
|
|
153
|
-
|
|
154
|
-
case
|
|
155
|
-
|
|
149
|
+
case 0: return WorkItemSetRules.Ands_AND_Ors;
|
|
150
|
+
case 1: return WorkItemSetRules.Ands_OR_Ors;
|
|
151
|
+
case 2: return WorkItemSetRules.Ands_AND_Ors_AssignModeOrs;
|
|
152
|
+
case 3: return WorkItemSetRules.Ands_OR_Ors_AssignModeOrs;
|
|
153
|
+
case 4: return WorkItemSetRules.Ands_AND_Ors_WaitForAllAnds;
|
|
154
|
+
case 5: return WorkItemSetRules.Ands_OR_Ors_WaitForAllAnds;
|
|
156
155
|
default:
|
|
157
156
|
console.warn(`Valore WorkItemSetRules sconosciuto: ${ruleValue}. Ritorno WorkItemSetRules.Ands_AND_Ors.`);
|
|
158
157
|
return WorkItemSetRules.Ands_AND_Ors;
|
|
@@ -328,8 +328,8 @@ const TMLoginForm = (props) => {
|
|
|
328
328
|
const nextStepHandler = async () => {
|
|
329
329
|
if (!endpoint || (!dcmtArchive && !manualArchiveID))
|
|
330
330
|
return;
|
|
331
|
-
if (loginStep === 1 &&
|
|
332
|
-
const isValid = await
|
|
331
|
+
if (loginStep === 1 && manualArchiveID) {
|
|
332
|
+
const isValid = await fetchManualArchiveByIdAsync();
|
|
333
333
|
if (!isValid)
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
@@ -359,17 +359,27 @@ const TMLoginForm = (props) => {
|
|
|
359
359
|
return;
|
|
360
360
|
setLoginStep(prev => prev - 1);
|
|
361
361
|
}, [loginStep]);
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
/** Retrieves and sets the archive descriptor from server using the manually entered ID. */
|
|
363
|
+
const fetchManualArchiveByIdAsync = async () => {
|
|
364
|
+
// Early exit if session or manual archive ID is not available
|
|
365
|
+
if (!tmSession || !manualArchiveID) {
|
|
366
|
+
setDcmtArchive(undefined);
|
|
364
367
|
return false;
|
|
368
|
+
}
|
|
369
|
+
;
|
|
365
370
|
try {
|
|
366
371
|
TMSpinner.show({ description: '' });
|
|
372
|
+
// Create archive engine and retrieve archive descriptor by ID
|
|
367
373
|
const archiveEngine = tmSession.NewArchiveEngine();
|
|
368
|
-
await archiveEngine.RetrieveAsync(manualArchiveID);
|
|
374
|
+
const result = await archiveEngine.RetrieveAsync(manualArchiveID);
|
|
375
|
+
// Update state with retrieved archive if valid
|
|
376
|
+
setDcmtArchive(result);
|
|
369
377
|
return true;
|
|
370
378
|
}
|
|
371
379
|
catch (e) {
|
|
380
|
+
// Display error to user if retrieval fails
|
|
372
381
|
TMExceptionBoxManager.show({ exception: e });
|
|
382
|
+
setDcmtArchive(undefined);
|
|
373
383
|
return false;
|
|
374
384
|
}
|
|
375
385
|
finally {
|
|
@@ -62,6 +62,7 @@ export { default as TMBlogAttachments } from './grids/TMBlogAttachments';
|
|
|
62
62
|
export { default as TMBlogCommentForm } from './features/blog/TMBlogCommentForm';
|
|
63
63
|
export * from './query/TMQueryEditor';
|
|
64
64
|
export * from './query/TMQuerySummary';
|
|
65
|
+
export * from './query/TMQueryCountButton';
|
|
65
66
|
export { default as TMToppyDraggableHelpCenter } from './features/assistant/TMToppyDraggableHelpCenter';
|
|
66
67
|
export * from './features/documents/TMDcmtForm';
|
|
67
68
|
export * from './features/documents/TMDcmtIcon';
|
package/lib/components/index.js
CHANGED
|
@@ -68,6 +68,7 @@ export { default as TMBlogCommentForm } from './features/blog/TMBlogCommentForm'
|
|
|
68
68
|
//query
|
|
69
69
|
export * from './query/TMQueryEditor';
|
|
70
70
|
export * from './query/TMQuerySummary';
|
|
71
|
+
export * from './query/TMQueryCountButton';
|
|
71
72
|
//assistant
|
|
72
73
|
export { default as TMToppyDraggableHelpCenter } from './features/assistant/TMToppyDraggableHelpCenter';
|
|
73
74
|
//documents
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useState, useEffect } from "react";
|
|
3
3
|
import { SDK_Globals, ObjectClasses, ResultTypes } from "@topconsultnpm/sdk-ts";
|
|
4
4
|
import DataGrid, { Column, GroupPanel, Grouping, HeaderFilter, LoadPanel, Pager, Paging, Scrolling, SearchPanel, Selection } from "devextreme-react/data-grid";
|
|
@@ -215,7 +215,9 @@ const TMPage = ({ id, objClass = ObjectClasses.None, listDisabled = false, lastR
|
|
|
215
215
|
return;
|
|
216
216
|
setSelectedItems([row.data]);
|
|
217
217
|
setShowList(false);
|
|
218
|
-
}, showColumnLines: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines) === 1, showRowLines: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines) === 1, onSelectionChanged: (e) => { setSelectedItems(e.selectedRowsData); onSelectionChanged?.(e.selectedRowsData); }, children: [_jsx(GroupPanel, { visible: !!(deviceType !== DeviceType.MOBILE && showAllColumns) }), _jsx(SearchPanel, { visible: false }), _jsx(Grouping, { autoExpandAll: false }), _jsx(HeaderFilter, { visible: true }), _jsx(Selection, { mode: "multiple", showCheckBoxesMode: "onClick", selectAllMode: 'allPages' }), _jsx(Scrolling, { mode: "standard", useNative: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar) === 1 }), _jsx(Paging, { pageSize: 25 }), _jsx(Pager, { visible: true, showInfo: true, showNavigationButtons: true }), _jsx(LoadPanel, { enabled: true }), _jsx(Column, { width: 20, cellRender: cellRenderObjectIcon }), _jsx(Column, { width: 'auto', visible: showId, dataField: "id", caption: "ID" }), _jsx(Column, { width: 250, dataField: "name", caption: SDKUI_Localizator.Name, sortOrder: "asc" }),
|
|
218
|
+
}, showColumnLines: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.showColumnLines) === 1, showRowLines: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.showRowLines) === 1, onSelectionChanged: (e) => { setSelectedItems(e.selectedRowsData); onSelectionChanged?.(e.selectedRowsData); }, children: [_jsx(GroupPanel, { visible: !!(deviceType !== DeviceType.MOBILE && showAllColumns) }), _jsx(SearchPanel, { visible: false }), _jsx(Grouping, { autoExpandAll: false }), _jsx(HeaderFilter, { visible: true }), _jsx(Selection, { mode: "multiple", showCheckBoxesMode: "onClick", selectAllMode: 'allPages' }), _jsx(Scrolling, { mode: "standard", useNative: Number(SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar) === 1 }), _jsx(Paging, { pageSize: 25 }), _jsx(Pager, { visible: true, showInfo: true, showNavigationButtons: true }), _jsx(LoadPanel, { enabled: true }), _jsx(Column, { width: 20, cellRender: cellRenderObjectIcon }), _jsx(Column, { width: 'auto', visible: showId, dataField: "id", caption: "ID" }), _jsx(Column, { width: 250, dataField: "name", caption: SDKUI_Localizator.Name, sortOrder: "asc" }), objClass == ObjectClasses.User ?
|
|
219
|
+
_jsxs(_Fragment, { children: [_jsx(Column, { width: 'auto', dataField: "type", caption: SDKUI_Localizator.Type }), _jsx(Column, { width: 'auto', dataField: "fn", caption: SDKUI_Localizator.User_FirstName }), _jsx(Column, { width: 'auto', dataField: "ln", caption: SDKUI_Localizator.User_LastName })] })
|
|
220
|
+
: _jsx(_Fragment, {}), _jsx(Column, { width: 250, visible: objClass == ObjectClasses.User ? true : showAllColumns, dataField: "description", caption: SDKUI_Localizator.Description }), customColumns?.map((item, index) => { return React.cloneElement(item, { key: index, visible: showAllColumns }); }), _jsx(Column, { width: 'auto', visible: showAllColumns, dataField: "ownerID", caption: SDKUI_Localizator.OwnerID }), _jsx(Column, { width: 'auto', visible: showAllColumns, dataField: "ownerName", caption: SDKUI_Localizator.OwnerName }), _jsx(Column, { width: 'auto', dataType: "date", format: Globalization.getDateDisplayFormat(), visible: showAllColumns, dataField: "creationTime", caption: SDKUI_Localizator.CreationTime }), _jsx(Column, { width: 'auto', dataType: "date", format: Globalization.getDateDisplayFormat(), visible: showAllColumns, dataField: "lastUpdateTime", caption: SDKUI_Localizator.LastUpdateTime })] })] }), detailInsteadOfContent ??
|
|
219
221
|
_jsx(TMLayoutItem, { children: selectedItems.length == 1 || formMode == FormModes.Create || formMode == FormModes.Duplicate ?
|
|
220
222
|
_jsx(TMToolbarCard, { onBack: deviceType === DeviceType.MOBILE ? () => setShowList(true) : undefined, title: calcSaveFormTitle(objName, formMode, selectedItems.length == 0 ? -1 : selectedItems[0].id, detailTitlePathKeys), children: getDetailFormWithProps() })
|
|
221
223
|
:
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QueryDescriptor, QueryParameterDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
interface ITMQueryCountButton {
|
|
4
|
+
qd?: QueryDescriptor;
|
|
5
|
+
lastparams: QueryParameterDescriptor[] | undefined;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
showSpinner: boolean;
|
|
8
|
+
onLastQueryParamsChanged?: (params: QueryParameterDescriptor[]) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const TMQueryCountButton: React.FunctionComponent<ITMQueryCountButton>;
|
|
11
|
+
export default TMQueryCountButton;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import TMButton from '../base/TMButton';
|
|
3
|
+
import { getQueryCountAsync, IconCount, IsParametricQuery, SDKUI_Localizator } from '../../helper';
|
|
4
|
+
import { useQueryParametersDialog } from '../../hooks/useQueryParametersDialog';
|
|
5
|
+
const TMQueryCountButton = ({ qd, lastparams, disabled, showSpinner, onLastQueryParamsChanged }) => {
|
|
6
|
+
const [confirmQueryParams, ConfirmQueryParamsDialog] = useQueryParametersDialog();
|
|
7
|
+
const getQueryCountLocalAsync = async () => {
|
|
8
|
+
if (qd == undefined)
|
|
9
|
+
return;
|
|
10
|
+
let qdLocal = { ...qd };
|
|
11
|
+
const whereCopy = qdLocal.where?.map((curItem) => ({ ...curItem }));
|
|
12
|
+
if (IsParametricQuery(qd)) {
|
|
13
|
+
const qdParams = await confirmQueryParams(qdLocal, lastparams);
|
|
14
|
+
if (!qdParams || qdParams.length <= 0)
|
|
15
|
+
return;
|
|
16
|
+
for (const qpd of qdParams) {
|
|
17
|
+
let wi = whereCopy?.find(o => o.value1 == qpd.name);
|
|
18
|
+
if (wi)
|
|
19
|
+
wi.value1 = wi.value1?.replace(wi.value1, !qpd.value ? '' : qpd.value.toString());
|
|
20
|
+
else {
|
|
21
|
+
wi = whereCopy?.find(o => o.value2 == qpd.name);
|
|
22
|
+
if (wi)
|
|
23
|
+
wi.value2 = wi.value2?.replace(wi.value2, !qpd.value ? '' : qpd.value.toString());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
onLastQueryParamsChanged?.(qdParams ?? []);
|
|
27
|
+
}
|
|
28
|
+
await getQueryCountAsync({ ...qdLocal, where: whereCopy }, showSpinner);
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Count, icon: _jsx(IconCount, {}), disabled: disabled, onClick: async () => await getQueryCountLocalAsync() }), _jsx(ConfirmQueryParamsDialog, {})] }));
|
|
31
|
+
};
|
|
32
|
+
export default TMQueryCountButton;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import { SDK_Localizator, AccessLevels, OnJoinItem, JoinTypes, PlatformObjectValidator, MetadataDataDomains, DcmtTypeListCacheService, JoinItem, MetadataDataTypes, OrderByItem, QueryFunctions, QueryOperators, ResultTypes, SelectItem, SDK_Globals, UserListCacheService, WhereItem, SearchEngine, SelectItemVisibilities, DataListCacheService, QueryValidatorOptions, TMPropertyNames, AppModules, LayoutModes } from '@topconsultnpm/sdk-ts';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import Accordion, { Item } from 'devextreme-react/accordion';
|
|
6
|
-
import { SDKUI_Localizator, IconSearch,
|
|
6
|
+
import { SDKUI_Localizator, IconSearch, calcIsModified, IconClear, IconAddCircleOutline, IconDotsVerticalCircleOutline, IconHide, IconShow, IconDraggabledots, genUniqueId, LocalizeQueryOperators, LocalizeQueryFunctions, LocalizeQueryJoinTypes, IconArchiveDoc, IconArrowRight, SDKUI_Globals } from '../../helper';
|
|
7
7
|
import { displayMetadataValue, getDcmtTypesByQdAsync, getTIDsByQd, IsParametricQuery, prepareQdForSearchAsync } from '../../helper/queryHelper';
|
|
8
8
|
import { useOutsideClick } from '../../hooks/useOutsideClick';
|
|
9
9
|
import { FormModes, SearchResultContext } from '../../ts';
|
|
@@ -30,6 +30,7 @@ import TMMetadataEditor from '../editors/TMMetadataEditor';
|
|
|
30
30
|
import { ContextMenu } from '../NewComponents/ContextMenu';
|
|
31
31
|
import { useQueryParametersDialog } from '../../hooks/useQueryParametersDialog';
|
|
32
32
|
import TMSearchResult from '../features/search/TMSearchResult';
|
|
33
|
+
import TMQueryCountButton from './TMQueryCountButton';
|
|
33
34
|
export const StyledRowItem = styled.div ` display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin-bottom: 5px; gap: 3px; `;
|
|
34
35
|
export const StyledItemWrapper = styled.div ` border-radius: ${props => props.$borderRadius ?? '4px'}; padding: 4px; font-size: 1rem; user-select: none; width: max-content; `;
|
|
35
36
|
export const StyledAccordionItemContainer = styled.div ` width: 100%; padding: 2px; display: flex; flex-direction: column; overflow-x: auto; align-items: flex-start; margin-left: 5px; gap: 3px; max-height: 300px; `;
|
|
@@ -242,6 +243,35 @@ const TMQueryEditor = ({ formMode, inputData, onQDChanged, isExpertMode, showDis
|
|
|
242
243
|
curJoinItem.on = onJoinCopy;
|
|
243
244
|
setFormData({ ...formData, join: joinCopy });
|
|
244
245
|
};
|
|
246
|
+
const onChange_OnJoinItem_Or = (or, index, indexOn) => {
|
|
247
|
+
const joinCopy = formData?.join?.map((ji) => { return { ...ji }; }) ?? [];
|
|
248
|
+
let curJoinItem = joinCopy[index];
|
|
249
|
+
const onJoinCopy = curJoinItem.on?.map((curItem, curIndex) => {
|
|
250
|
+
if (indexOn != curIndex)
|
|
251
|
+
return curItem;
|
|
252
|
+
let newOn = new OnJoinItem();
|
|
253
|
+
newOn.init({ ...curItem, or: or });
|
|
254
|
+
return newOn;
|
|
255
|
+
});
|
|
256
|
+
curJoinItem.on = onJoinCopy;
|
|
257
|
+
setFormData({ ...formData, join: joinCopy });
|
|
258
|
+
};
|
|
259
|
+
const onChange_OnJoinItem_Brackets = (value, isLeft, index, indexOn) => {
|
|
260
|
+
const joinCopy = formData?.join?.map((ji) => { return { ...ji }; }) ?? [];
|
|
261
|
+
let curJoinItem = joinCopy[index];
|
|
262
|
+
const onJoinCopy = curJoinItem.on?.map((curItem, curIndex) => {
|
|
263
|
+
if (indexOn != curIndex)
|
|
264
|
+
return curItem;
|
|
265
|
+
let newOn = new OnJoinItem();
|
|
266
|
+
if (isLeft)
|
|
267
|
+
newOn.init({ ...curItem, leftBrackets: value });
|
|
268
|
+
else
|
|
269
|
+
newOn.init({ ...curItem, rightBrackets: value });
|
|
270
|
+
return newOn;
|
|
271
|
+
});
|
|
272
|
+
curJoinItem.on = onJoinCopy;
|
|
273
|
+
setFormData({ ...formData, join: joinCopy });
|
|
274
|
+
};
|
|
245
275
|
const getJoinTypesMenuItems = (index) => {
|
|
246
276
|
let items = [
|
|
247
277
|
{ name: LocalizeQueryJoinTypes(JoinTypes.InnerJoin), onClick: () => onChange_JoinItem_JoinType(JoinTypes.InnerJoin, index) },
|
|
@@ -703,7 +733,7 @@ const TMQueryEditor = ({ formMode, inputData, onQDChanged, isExpertMode, showDis
|
|
|
703
733
|
}
|
|
704
734
|
};
|
|
705
735
|
// #endregion
|
|
706
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: async () => await onSearchAsync(formData) }), _jsx(
|
|
736
|
+
return (_jsxs(_Fragment, { children: [_jsxs(TMApplyForm, { isModal: false, formMode: formMode, isModified: calcIsModified(formData, formDataOrig), exception: exception, validationItems: validationItems, hasNavigation: false, customToolbarElements: _jsxs(_Fragment, { children: [_jsx(TMButton, { btnStyle: 'toolbar', caption: SDKUI_Localizator.Search, color: 'tertiary', icon: _jsx(IconSearch, {}), disabled: errorsCount > 0, onClick: async () => await onSearchAsync(formData) }), _jsx(TMQueryCountButton, { qd: { ...formData }, lastparams: lastQdParams, onLastQueryParamsChanged: (params) => { setLastQdParams(params); }, disabled: errorsCount > 0, showSpinner: true }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Passa ad archiviazione", icon: _jsx(IconArchiveDoc, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Passa ad archiviazione", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } }), SDK_Globals.tmSession?.SessionDescr?.appModuleID == AppModules.SURFER && _jsx(TMButton, { caption: "Vai a risultato", icon: _jsx(IconArrowRight, {}), btnStyle: 'toolbar', fontSize: '1.3rem', onClick: () => { ShowAlert({ message: "TODO Vai a risultato", mode: 'info', title: `${"TODO"}`, duration: 3000 }); } })] }), showToolbar: showToolbar, showApply: showApply, showUndo: showUndo, showBack: showBack, onApply: () => applyData(), onClose: () => onClose?.(), onUndo: () => setFormData(formDataOrig), children: [_jsxs(Accordion, { elementAttr: { class: 'tm-query-dx-accordion' }, height: height, multiple: true, collapsible: true, repaintChangesOnly: true, deferRendering: false, animationDuration: 0, onContentReady: (e) => {
|
|
707
737
|
let items = e.component.option("items");
|
|
708
738
|
if (items && items.length > 0) {
|
|
709
739
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -739,7 +769,10 @@ const TMQueryEditor = ({ formMode, inputData, onQDChanged, isExpertMode, showDis
|
|
|
739
769
|
setFormData({ ...formData, join: joinCopy });
|
|
740
770
|
}
|
|
741
771
|
}
|
|
742
|
-
] }), _jsx(
|
|
772
|
+
] }), _jsx(TMQdDropDownMenu, { disabled: indexOn == 0, color: 'green', content: _jsx("div", { style: { fontSize: '1rem' }, children: onItem.or ? 'OR' : 'AND' }), items: [
|
|
773
|
+
{ name: 'AND', onClick: () => onChange_OnJoinItem_Or(false, index, indexOn) },
|
|
774
|
+
{ name: 'OR', onClick: () => onChange_OnJoinItem_Or(true, index, indexOn) }
|
|
775
|
+
] }), _jsx(TMQdEditableItem, { value: onItem.leftBrackets, allowedPattern: /\(/g, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_OnJoinItem_Brackets(value, true, index, indexOn); } }), _jsx(TMMetadataChooser, { disabled: isReadOnly, showEditButton: false, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: onItem.leftTID, alias: onItem.leftAlias }), qd: formData, values: onItem.leftTID ? [{ tid: onItem.leftTID, mid: onItem.leftMID, aliasTID: onItem.leftAlias }] : [], onValueChanged: (values) => { values.length > 0 && onChange_OnJoinMetadatoLeft(values[0], index, indexOn); }, updateIsModalOpen: updateIsModalOpen }), _jsx(TMQdDropDownMenu, { backgroundColor: colorOperator, color: 'green', borderRadius: borderRadius, content: _jsx(StyledItemWrapper, { children: LocalizeQueryOperators(onItem.operator) }), items: [] }), _jsx(TMMetadataChooser, { disabled: isReadOnly, showEditButton: false, getColorIndex: getColorIndex, showCompleteMetadataName: showCompleteMetadataName, openEditorOnSummaryClick: true, showBorder: false, borderRadius: borderRadius, showId: showId, backgroundColor: getColorIndex({ tid: onItem.rightTID, alias: onItem.rightAlias }), qd: formData, values: onItem.rightTID ? [{ tid: onItem.rightTID, mid: onItem.rightMID, aliasTID: onItem.rightAlias }] : [], onValueChanged: (values) => { values.length > 0 && onChange_OnJoinMetadatoRight(values[0], index, indexOn); }, updateIsModalOpen: updateIsModalOpen }), _jsx(TMQdEditableItem, { value: onItem.rightBrackets, allowedPattern: /\)/g, backgroundColor: colorBrackets, onValueChanged: (value) => { onChange_OnJoinItem_Brackets(value, false, index, indexOn); } })] }, indexOn));
|
|
743
776
|
})] }, `${ji.tid}_${index}`));
|
|
744
777
|
}), _jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.join) })] }) }) }), canShowSelect && _jsx(Item, { title: SDK_Localizator.QuerySelect, titleRender: (tabItemProps) => renderAccordionTitle(tabItemProps, selectCount, validationItems.filter((o) => o.PropertyName == TMPropertyNames.select)), children: _jsx(StyledAccordionItemContainer, { children: _jsxs(StyledAccordionItemContent, { "$disabled": isReadOnly, children: [_jsx(TMVilViewer, { vil: validationItems.filter((o) => o.PropertyName === TMPropertyNames.select) }), (!formData?.select || formData?.select.length <= 0) && !isReadOnly &&
|
|
745
778
|
_jsxs(StyledRowItem, { children: [_jsx(TMButton, { btnStyle: 'normal', disabled: !formData?.from?.tid, caption: SDKUI_Localizator.Add, onClick: onAdd_SelectItem }), dcmtTypesList.length == 1
|
|
@@ -795,7 +828,11 @@ const TMQdEditableItem = ({ value, placeHolder, width, backgroundColor, allowedP
|
|
|
795
828
|
return (_jsx("div", { ref: ref, children: isComponentVisible ?
|
|
796
829
|
_jsx(TMTextBox, { elementStyle: { marginLeft: '5px', marginRight: '5px' }, width: width ?? '50px', autoFocus: true, value: value ?? '', onValueChanged: handleTextBoxValueChanged, allowedPattern: allowedPattern })
|
|
797
830
|
:
|
|
798
|
-
_jsx(StyledItemWrapper, { onClick: () => setIsComponentVisible(true), style: {
|
|
831
|
+
_jsx(StyledItemWrapper, { onClick: () => setIsComponentVisible(true), style: {
|
|
832
|
+
backgroundColor: backgroundColor,
|
|
833
|
+
cursor: 'pointer',
|
|
834
|
+
minHeight: '24px'
|
|
835
|
+
}, children: value ?? placeHolder }) }));
|
|
799
836
|
};
|
|
800
837
|
const TMQdWhereItemValue = ({ whereItem, index, queryParamsDynDataList, onlyEditing = false, onValueChanged, onCascadeRefreshDynDataLists, updateIsModalOpen }) => {
|
|
801
838
|
let EditingModes;
|