@topconsultnpm/sdkui-react 6.21.0-dev2.2 → 6.21.0-dev2.21

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.
Files changed (42) hide show
  1. package/lib/components/base/TMAccordionNew.d.ts +1 -0
  2. package/lib/components/base/TMAccordionNew.js +6 -5
  3. package/lib/components/base/TMAreaManager.js +19 -3
  4. package/lib/components/base/TMPanel.d.ts +7 -4
  5. package/lib/components/base/TMPanel.js +54 -26
  6. package/lib/components/choosers/TMDistinctValues.js +35 -21
  7. package/lib/components/editors/TMDateBox.js +4 -2
  8. package/lib/components/editors/TMFormulaEditor.d.ts +2 -0
  9. package/lib/components/editors/TMFormulaEditor.js +75 -21
  10. package/lib/components/editors/TMMetadataValues.js +2 -1
  11. package/lib/components/editors/TMRadioButton.js +2 -1
  12. package/lib/components/editors/TMTextArea.d.ts +2 -0
  13. package/lib/components/editors/TMTextArea.js +6 -3
  14. package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
  15. package/lib/components/features/documents/TMDcmtForm.js +40 -10
  16. package/lib/components/features/documents/TMDcmtFormActionButtons.js +17 -2
  17. package/lib/components/features/documents/TMDcmtPreview.d.ts +1 -0
  18. package/lib/components/features/documents/TMDcmtPreview.js +2 -2
  19. package/lib/components/features/documents/TMDcmtTasks.d.ts +1 -0
  20. package/lib/components/features/documents/TMDcmtTasks.js +2 -2
  21. package/lib/components/features/search/TMSavedQuerySelector.d.ts +2 -2
  22. package/lib/components/features/search/TMSavedQuerySelector.js +3 -2
  23. package/lib/components/features/search/TMSearch.d.ts +2 -1
  24. package/lib/components/features/search/TMSearch.js +15 -9
  25. package/lib/components/features/search/TMSearchQueryPanel.js +1 -1
  26. package/lib/components/features/search/TMSearchResult.js +56 -14
  27. package/lib/components/features/search/TMViewHistoryDcmt.js +1 -2
  28. package/lib/components/features/workflow/diagram/queryDescriptorParser.js +3 -6
  29. package/lib/components/grids/TMBlogAttachments.d.ts +1 -0
  30. package/lib/components/grids/TMBlogAttachments.js +38 -12
  31. package/lib/components/grids/TMBlogsPost.js +7 -1
  32. package/lib/components/grids/TMBlogsPostUtils.js +11 -17
  33. package/lib/components/pages/TMPage.js +3 -1
  34. package/lib/helper/GlobalStyles.js +6 -0
  35. package/lib/helper/SDKUI_Localizator.d.ts +48 -0
  36. package/lib/helper/SDKUI_Localizator.js +482 -0
  37. package/lib/helper/TMPdfViewer.js +25 -24
  38. package/lib/hooks/useDataUserIdItem.js +6 -4
  39. package/lib/hooks/useDocumentOperations.d.ts +1 -0
  40. package/lib/hooks/useDocumentOperations.js +8 -6
  41. package/lib/hooks/useForm.js +3 -0
  42. package/package.json +54 -54
@@ -15,7 +15,7 @@ export const useDataUserIdItem = () => {
15
15
  if (userIDs.size === 0)
16
16
  return;
17
17
  try {
18
- const results = await Promise.all(Array.from(userIDs).map(id => UserListCacheService.GetAsync(id).then(user => ({ id, user }))
18
+ const results = await Promise.all(Array.from(userIDs).filter(id => id > 0).map(id => UserListCacheService.GetAsync(id).then(user => ({ id, user }))
19
19
  .catch(() => ({ id, user: undefined }))));
20
20
  const newCache = new Map();
21
21
  results.forEach(({ id, user }) => {
@@ -70,17 +70,19 @@ export const useDataUserIdItem = () => {
70
70
  * @returns Elemento React per visualizzare l'utente
71
71
  */
72
72
  const renderUserIdViewer = useCallback((userId, showIcon = false, showTitile = true) => {
73
- const ud = userId && userId > 0 ? getUserItem(userId) : undefined;
73
+ const ud = userId !== undefined && userId > 0 ? getUserItem(userId) : undefined;
74
74
  const getIcon = () => {
75
75
  if (!showIcon)
76
76
  return null;
77
- if (!userId)
77
+ if (userId === undefined)
78
78
  return null;
79
79
  return ud ? _jsx(TMUserIcon, { ud: ud }) : _jsx("span", { title: showTitile ? SDKUI_Localizator.ValueNotPresent : undefined, style: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(IconWarning, { color: TMColors.warning }) });
80
80
  };
81
81
  const getDescription = () => {
82
- if (!userId)
82
+ if (userId == null)
83
83
  return undefined;
84
+ if (userId === 0)
85
+ return SDKUI_Localizator.SystemUser;
84
86
  return ud ? getCompleteUserName(ud.domain, ud.name) : userId.toString() ?? SDKUI_Localizator.NoneSelection;
85
87
  };
86
88
  return (_jsxs("span", { style: { display: 'inline-flex', alignItems: 'center', gap: '4px', lineHeight: 1 }, children: [getIcon(), _jsx("span", { style: { lineHeight: 'normal' }, children: getDescription() })] }));
@@ -110,6 +110,7 @@ export interface UseDocumentOperationsResult {
110
110
  isOpenBatchUpdate: boolean;
111
111
  isModifiedBatchUpdate: boolean;
112
112
  updateBatchUpdateForm: (value: boolean) => void;
113
+ closeDcmtFormHandler: () => void;
113
114
  handleSignApprove: () => void;
114
115
  showSearchTMDatagrid: boolean;
115
116
  showExportForm: boolean;
@@ -182,6 +182,9 @@ export const useDocumentOperations = (props) => {
182
182
  setIsOpenDcmtForm(isOpen);
183
183
  setDcmtFormLayoutMode(layoutMode);
184
184
  };
185
+ const closeDcmtFormHandler = () => {
186
+ setIsOpenDcmtForm(false);
187
+ };
185
188
  const handleAddItem = (tid, did) => {
186
189
  let newItem = { TID: tid ?? 0, DID: did ?? 0 };
187
190
  setSecondaryMasterDcmts((prevItems) => [...prevItems, newItem]);
@@ -542,12 +545,10 @@ export const useDocumentOperations = (props) => {
542
545
  const firstDoc = selectedDcmtInfos?.[0];
543
546
  // Check if the selected document is a PDF
544
547
  const isPdf = firstDoc?.FILEEXT?.toLowerCase() === "pdf";
545
- // Check if the document has been signed
546
- const isSigned = firstDoc?.ISSIGNED === 1;
547
548
  // Check if the user has permission to substitute files
548
549
  const canSubstitute = dtd?.perm?.canSubstFile === AccessLevels.Yes;
549
550
  // Determine whether the menu item should be disabled
550
- const isDisabled = !canSubstitute || isDisabledForSingleRow() || !isPdf || isSigned;
551
+ const isDisabled = !canSubstitute || isDisabledForSingleRow() || !isPdf;
551
552
  return {
552
553
  id: 'pdf-ed',
553
554
  icon: _jsx(IconEdit, {}),
@@ -975,7 +976,7 @@ export const useDocumentOperations = (props) => {
975
976
  };
976
977
  const handleWFOperationCompleted = async () => {
977
978
  await onWFOperationCompleted?.();
978
- if (context !== SearchResultContext.DCMT_FORM && !showMoreInfoPopup) {
979
+ if (!showMoreInfoPopup) {
979
980
  onCloseDcmtForm?.();
980
981
  }
981
982
  };
@@ -1128,7 +1129,7 @@ export const useDocumentOperations = (props) => {
1128
1129
  };
1129
1130
  const renderFloatingBar = (floatingBarContainerRef && floatingBarContainerRef.current && allowFloatingBar && showFloatingBar && deviceType !== DeviceType.MOBILE) ? (_jsx(TMFloatingMenuBar, { containerRef: floatingBarContainerRef, contextMenuItems: operationItems(), isConstrained: true, defaultPosition: { x: 1, y: 88 }, defaultPinnedItems: ['rel-det', 'rel-mst', 'dl'], defaultOrientation: 'horizontal', hasContextMenu: false, pinnedItemIds: pinnedItemIds, onPinChange: setPinnedItemIds })) : null;
1130
1131
  const renderDcmtOperations = (_jsxs(_Fragment, { children: [(showExportForm && searchResult && dataColumns && dataSource && selectedRowKeys) && (_jsx(TMDataGridExportForm, { dataColumns: dataColumns, dataSource: dataSource, selectedRowKeys: selectedRowKeys, onCloseExportForm: () => setShowExportForm(false), searchResult: searchResult })), _jsx(StyledMultiViewPanel, { "$isVisible": isOpenDcmtForm, children: ((isOpenDcmtForm && focusedItem?.TID !== undefined && focusedItem?.DID !== undefined) &&
1131
- _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID !== undefined), titleModal: dtd?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, layoutMode: dcmtFormLayoutMode, count: visibleItems?.length, itemIndex: visibleItems ? visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1 : undefined, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onClose: () => { (false); onDcmtFormOpenChange(false, LayoutModes.Update); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: onSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showDcmtFormSidebar, datagridUtility: {
1132
+ _jsx(TMDcmtForm, { isModal: openDcmtFormAsModal || (dcmtFormLayoutMode === LayoutModes.Ark && focusedItem?.DID !== undefined), titleModal: dtd?.name ?? '', TID: focusedItem.TID, DID: focusedItem.DID, allowButtonsRefs: true, showTodoDcmtForm: showTodoDcmtForm, layoutMode: dcmtFormLayoutMode, count: visibleItems?.length, itemIndex: visibleItems ? visibleItems.findIndex(o => o.rowIndex === focusedItem?.rowIndex) + 1 : undefined, canNext: canNavigateHandler ? canNavigateHandler('next') : false, canPrev: canNavigateHandler ? canNavigateHandler('prev') : false, onNext: () => onNavigateHandler && onNavigateHandler('next'), onPrev: () => onNavigateHandler && onNavigateHandler('prev'), onClose: () => { (false); onDcmtFormOpenChange(false, LayoutModes.Update); }, onWFOperationCompleted: onWFOperationCompleted, onTaskCreateRequest: onTaskCreateRequest, onSavedAsyncCallback: onSavedAsyncCallback, openS4TViewer: openS4TViewer, onOpenS4TViewerRequest: onOpenS4TViewerRequest, onOpenPdfEditorRequest: onOpenPdfEditorRequest, openFileUploaderPdfEditor: openFileUploaderPdfEditor, onReferenceClick: onReferenceClick, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, moreInfoTasks: getMoreInfoTasksForDocument(allTasks, focusedItem?.TID, focusedItem?.DID), showDcmtFormSidebar: showDcmtFormSidebar, datagridUtility: {
1132
1133
  onRefreshSearchAsyncDatagrid,
1133
1134
  onRefreshDataRowsAsync,
1134
1135
  refreshFocusedDataRowAsync,
@@ -1148,7 +1149,7 @@ export const useDocumentOperations = (props) => {
1148
1149
  setArchiveRelatedDcmtFormTID(undefined);
1149
1150
  setArchiveRelatedDcmtFormMids([]);
1150
1151
  await onRefreshSearchAsyncDatagrid?.();
1151
- }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar, openFileUploaderPdfEditor: openFileUploaderPdfEditor }), showRelatedDcmtsChooser &&
1152
+ }, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: handleNavigateToWGs, handleNavigateToDossiers: handleNavigateToDossiers, showDcmtFormSidebar: showDcmtFormSidebar, openFileUploaderPdfEditor: openFileUploaderPdfEditor, showTodoDcmtForm: showTodoDcmtForm }), showRelatedDcmtsChooser &&
1152
1153
  _jsx(TMChooserForm, { dataSource: relatedDcmtsChooserDataSource, onChoose: async (selectedRelation) => {
1153
1154
  try {
1154
1155
  setShowRelatedDcmtsChooser(false);
@@ -1209,6 +1210,7 @@ export const useDocumentOperations = (props) => {
1209
1210
  isOpenBatchUpdate,
1210
1211
  isModifiedBatchUpdate,
1211
1212
  updateBatchUpdateForm,
1213
+ closeDcmtFormHandler,
1212
1214
  handleSignApprove,
1213
1215
  checkoutInfo: {
1214
1216
  showHistory,
@@ -101,6 +101,9 @@ export function useSaveForm(formMode, id, sfo, validator, onSaved, onStatusChang
101
101
  newId = await saveCustomAsync();
102
102
  else
103
103
  newId = await setDataAsync?.(formMode, formData, ...args);
104
+ if (newId <= 0) {
105
+ return;
106
+ }
104
107
  let newData;
105
108
  if (sfo.loadDataAfterSave)
106
109
  newData = await loadDataAsync(newId, FormModes.Update);
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
1
  {
2
- "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-dev2.2",
4
- "description": "",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" \u0026\u0026 exit 1",
7
- "clean": "powershell Remove-Item lib/ -recurse",
8
- "copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
9
- "tm-build": "npm run clean \u0026\u0026 tsc \u0026\u0026 npm run copy-files",
10
- "tm-watch": "tsc -w",
11
- "tm-publish": "npm publish --tag latest",
12
- "tm-publish_wl": "npm publish",
13
- "storybook": "storybook dev -p 6006",
14
- "build-storybook": "storybook build"
15
- },
16
- "author": "TopConsult",
17
- "license": "ISC",
18
- "devDependencies": {
19
- "@chromatic-com/storybook": "^5.1.2",
20
- "@storybook/addon-docs": "^10.3.5",
21
- "@storybook/addon-onboarding": "^10.3.5",
22
- "@storybook/react-vite": "^10.3.5",
23
- "@types/htmlparser2": "^3.10.7",
24
- "@types/node": "^24.12.2",
25
- "@types/react": "^18.3.3",
26
- "@types/react-dom": "^18.3.3",
27
- "copyfiles": "^2.4.1",
28
- "esbuild": "^0.25.0",
29
- "react": "^18.3.1",
30
- "react-dom": "^18.3.1",
31
- "storybook": "^10.3.5",
32
- "typescript": "^5.9.3",
33
- "vite": "^6.1.1"
34
- },
35
- "main": "dist/cjs/index.js",
36
- "types": "./index.d.ts",
37
- "module": "lib/esm/index.js",
38
- "files": [
39
- "dist",
40
- "lib"
41
- ],
42
- "dependencies": {
43
- "react-router-dom": "^6.15.0",
44
- "react-pdf": "^10.4.1",
45
- "htmlparser2": "^10.0.0",
46
- "buffer": "^6.0.3",
47
- "@topconsultnpm/sdk-ts": "6.21.0-t1",
48
- "exceljs": "^4.4.0",
49
- "devextreme": "^25.2.6",
50
- "styled-components": "^6.1.1",
51
- "devextreme-react": "^25.2.6"
52
- },
53
- "overrides": {
54
- "esbuild": "^0.25.0"
55
- }
2
+ "name": "@topconsultnpm/sdkui-react",
3
+ "version": "6.21.0-dev2.21",
4
+ "description": "",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
+ "clean": "powershell Remove-Item lib/ -recurse",
8
+ "copy-files": "copyfiles -u 1 src/assets/*.* src/assets/ImageLibrary/*.* src/assets/thumbnails/*.* src/assets/IconsS4t/*.* src/assets/Metadata/*.* src/css/tm-sdkui.css lib/",
9
+ "tm-build": "npm run clean && tsc && npm run copy-files",
10
+ "tm-watch": "tsc -w",
11
+ "tm-publish": "npm publish --tag latest",
12
+ "tm-publish_wl": "npm publish",
13
+ "storybook": "storybook dev -p 6006",
14
+ "build-storybook": "storybook build"
15
+ },
16
+ "author": "TopConsult",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@chromatic-com/storybook": "^5.1.2",
20
+ "@storybook/addon-docs": "^10.3.5",
21
+ "@storybook/addon-onboarding": "^10.3.5",
22
+ "@storybook/react-vite": "^10.3.5",
23
+ "@types/htmlparser2": "^3.10.7",
24
+ "@types/node": "^24.12.2",
25
+ "@types/react": "^18.3.3",
26
+ "@types/react-dom": "^18.3.3",
27
+ "copyfiles": "^2.4.1",
28
+ "esbuild": "^0.25.0",
29
+ "react": "^18.3.1",
30
+ "react-dom": "^18.3.1",
31
+ "storybook": "^10.3.5",
32
+ "typescript": "^5.9.3",
33
+ "vite": "^6.1.1"
34
+ },
35
+ "main": "dist/cjs/index.js",
36
+ "types": "./index.d.ts",
37
+ "module": "lib/esm/index.js",
38
+ "files": [
39
+ "dist",
40
+ "lib"
41
+ ],
42
+ "dependencies": {
43
+ "@topconsultnpm/sdk-ts": "6.21.0-dev2.2",
44
+ "buffer": "^6.0.3",
45
+ "devextreme": "^25.2.6",
46
+ "devextreme-react": "^25.2.6",
47
+ "exceljs": "^4.4.0",
48
+ "htmlparser2": "^10.0.0",
49
+ "react-pdf": "^10.4.1",
50
+ "react-router-dom": "^6.15.0",
51
+ "styled-components": "^6.1.1"
52
+ },
53
+ "overrides": {
54
+ "esbuild": "^0.25.0"
55
+ }
56
56
  }