@topconsultnpm/sdkui-react 6.20.0-dev2.3 → 6.20.0-dev2.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.
Files changed (29) hide show
  1. package/lib/components/base/Styled.d.ts +1 -0
  2. package/lib/components/base/Styled.js +10 -2
  3. package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
  4. package/lib/components/choosers/TMMetadataChooser.js +1 -1
  5. package/lib/components/editors/TMMetadataValues.js +3 -1
  6. package/lib/components/features/archive/TMArchive.js +29 -42
  7. package/lib/components/features/documents/TMDcmtForm.js +121 -37
  8. package/lib/components/features/documents/TMDcmtPreview.js +2 -1
  9. package/lib/components/features/documents/TMMasterDetailDcmts.js +1 -1
  10. package/lib/components/features/search/TMSearchResult.d.ts +1 -0
  11. package/lib/components/features/search/TMSearchResult.js +44 -95
  12. package/lib/components/features/search/TMSearchResultsMenuItems.js +2 -2
  13. package/lib/components/features/workflow/TMWorkflowPopup.d.ts +2 -1
  14. package/lib/components/features/workflow/TMWorkflowPopup.js +2 -1
  15. package/lib/components/forms/Login/TMLoginForm.js +1 -1
  16. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
  17. package/lib/components/query/TMQueryEditor.d.ts +1 -0
  18. package/lib/components/query/TMQueryEditor.js +2 -2
  19. package/lib/helper/GlobalStyles.js +3 -0
  20. package/lib/helper/SDKUI_Globals.d.ts +7 -0
  21. package/lib/helper/SDKUI_Globals.js +59 -0
  22. package/lib/helper/SDKUI_Localizator.d.ts +1 -0
  23. package/lib/helper/SDKUI_Localizator.js +10 -0
  24. package/lib/helper/TMUtils.d.ts +18 -0
  25. package/lib/helper/TMUtils.js +58 -0
  26. package/lib/helper/queryHelper.js +1 -1
  27. package/lib/hooks/useDcmtOperations.js +14 -2
  28. package/lib/hooks/useRelatedDocuments.js +34 -11
  29. package/package.json +11 -11
@@ -445,3 +445,61 @@ export const getAppModuleGradient = (appModuleID) => {
445
445
  return 'linear-gradient(270deg, #46B5A2 16%, #3BAABC 34%, #3BAABC 34%, #3681AD 54%, #3368A5 72%, #2F549D 88%, #304F99 100%)';
446
446
  }
447
447
  };
448
+ export const getPanelManagerToolbarColor = (appModuleID) => {
449
+ switch (appModuleID) {
450
+ case AppModules.SURFER:
451
+ return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
452
+ case AppModules.DESIGNER:
453
+ return '#482234';
454
+ case AppModules.ORCHESTRATOR:
455
+ return '#1d6f42';
456
+ default:
457
+ return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
458
+ }
459
+ };
460
+ export const getSearchToolbarVisibility = (appModuleID) => {
461
+ switch (appModuleID) {
462
+ case AppModules.SURFER:
463
+ return {
464
+ tmSearchResult: true,
465
+ tmBlog: true,
466
+ tmSysMetadata: true,
467
+ tmDcmtPreview: true,
468
+ tmFullTextSearch: true,
469
+ };
470
+ case AppModules.DESIGNER:
471
+ case AppModules.ORCHESTRATOR:
472
+ default:
473
+ return {
474
+ tmSearchResult: true,
475
+ tmBlog: false,
476
+ tmSysMetadata: false,
477
+ tmDcmtPreview: false,
478
+ tmFullTextSearch: false,
479
+ };
480
+ }
481
+ };
482
+ export const getDcmtFormToolbarVisibility = (appModuleID) => {
483
+ switch (appModuleID) {
484
+ case AppModules.SURFER:
485
+ return {
486
+ tmDcmtForm: true,
487
+ tmBlog: true,
488
+ tmSysMetadata: true,
489
+ tmDcmtPreview: true,
490
+ tmWF: true,
491
+ tmDcmtTasks: true,
492
+ };
493
+ case AppModules.DESIGNER:
494
+ case AppModules.ORCHESTRATOR:
495
+ default:
496
+ return {
497
+ tmDcmtForm: true,
498
+ tmBlog: false,
499
+ tmSysMetadata: true,
500
+ tmDcmtPreview: true,
501
+ tmWF: false,
502
+ tmDcmtTasks: false,
503
+ };
504
+ }
505
+ };
@@ -49,7 +49,7 @@ export const IsParametricQuery = (qd) => {
49
49
  return false;
50
50
  };
51
51
  export const addHiddenSelectItem = (select, tid, mid) => {
52
- if (select.findIndex(o => o.mid == mid) >= 0)
52
+ if (select.findIndex(o => o.tid == tid && o.mid == mid) >= 0)
53
53
  return;
54
54
  let si = new SelectItem();
55
55
  si.tid = tid;
@@ -8,6 +8,18 @@ import { useFileDialog } from './useInputDialog';
8
8
  import { isXMLFileExt } from '../helper/dcmtsHelper';
9
9
  import { ShowConfirm } from '../components/base/TMConfirm';
10
10
  let abortController = new AbortController();
11
+ const downloadCountMap = new Map();
12
+ const getDownloadFileName = (fileName) => {
13
+ const firstDot = fileName.indexOf('.');
14
+ const lastDot = fileName.lastIndexOf('.');
15
+ if (firstDot === -1 || firstDot === lastDot)
16
+ return fileName;
17
+ const count = downloadCountMap.get(fileName) ?? 0;
18
+ downloadCountMap.set(fileName, count + 1);
19
+ if (count === 0)
20
+ return fileName;
21
+ return `${fileName.slice(0, firstDot)}(${count})${fileName.slice(firstDot)}`;
22
+ };
11
23
  export function useDcmtOperations() {
12
24
  const [showWaitPanel, setShowWaitPanel] = useState(false);
13
25
  const [waitPanelTitle, setWaitPanelTitle] = useState('');
@@ -96,8 +108,8 @@ export function useDcmtOperations() {
96
108
  else {
97
109
  const alink2 = document.createElement('a');
98
110
  alink2.href = fileURL;
99
- const downloadFileName = inputDcmts[i].fileName ?? (inputDcmts[i].FILEEXT ? `${inputDcmts[i].DID}.${inputDcmts[i].FILEEXT}` : file?.name);
100
- alink2.download = downloadFileName;
111
+ const baseFileName = inputDcmts[i].fileName ?? (inputDcmts[i].FILEEXT ? `${inputDcmts[i].DID}.${inputDcmts[i].FILEEXT}` : file?.name);
112
+ alink2.download = getDownloadFileName(baseFileName);
101
113
  alink2.target = "_blank";
102
114
  alink2.rel = "noreferrer";
103
115
  alink2.click();
@@ -225,9 +225,6 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
225
225
  const filterRelationsWithAssociations = (relations) => {
226
226
  return relations.filter(rel => rel.associations && rel.associations.length > 0);
227
227
  };
228
- const getRelatedDcmt = async (relation, type) => {
229
- return await DcmtTypeListCacheService.GetAsync(type === 'detail' ? relation.detailTID : relation.masterTID);
230
- };
231
228
  const showNoRelationsAlert = (type) => {
232
229
  ShowAlert({
233
230
  message: type === 'detail'
@@ -282,6 +279,26 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
282
279
  TMExceptionBoxManager.show({ exception: error });
283
280
  }
284
281
  }, [mapAssociationsToMids]);
282
+ const filterRelationsByPermission = async (relations, type) => {
283
+ const dataSourcePromises = relations.map(async (rel) => {
284
+ const targetTID = type === 'detail' ? rel.detailTID : rel.masterTID;
285
+ const dtd = await DcmtTypeListCacheService.GetWithNotGrantedAsync(targetTID, undefined);
286
+ const hasPermission = dtd?.perm?.canArchive === AccessLevelsEx.Yes || dtd?.perm?.canArchive === AccessLevelsEx.Mixed;
287
+ return { id: rel?.id, name: dtd?.name, hasPermission, relation: rel };
288
+ });
289
+ const allResults = await Promise.all(dataSourcePromises);
290
+ return allResults.filter(r => r.hasPermission);
291
+ };
292
+ const showNoPermissionAlert = (type) => {
293
+ ShowAlert({
294
+ message: type === 'detail'
295
+ ? SDKUI_Localizator.YouDoNotHavePermissionsToArchiveDetailDocumentsOfThisType
296
+ : SDKUI_Localizator.YouDoNotHavePermissionsToArchiveMasterDocumentsOfThisType,
297
+ mode: 'warning',
298
+ title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
299
+ duration: 5000
300
+ });
301
+ };
285
302
  const archiveRelatedDocuments = useCallback(async (tid, type) => {
286
303
  try {
287
304
  TMSpinner.show({ description: SDKUI_Localizator.Loading });
@@ -300,14 +317,20 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
300
317
  }
301
318
  setRelatedDcmts(withAssociations);
302
319
  if (withAssociations.length > 1) {
303
- const dataSourcePromises = withAssociations.map(async (rel) => {
304
- const relatedDcmt = await getRelatedDcmt(rel, type);
305
- return { id: rel?.id, name: relatedDcmt?.name };
306
- });
307
- const dataSource = await Promise.all(dataSourcePromises);
308
- setRelatedDcmtsChooserDataSource(dataSource);
309
- setArchiveType(type);
310
- setShowRelatedDcmtsChooser(true);
320
+ const permittedResults = await filterRelationsByPermission(withAssociations, type);
321
+ if (permittedResults.length === 0) {
322
+ showNoPermissionAlert(type);
323
+ return;
324
+ }
325
+ if (permittedResults.length === 1) {
326
+ await archiveRelatedDcmtHandler(permittedResults[0].relation, type);
327
+ }
328
+ else {
329
+ const dataSource = permittedResults.map(r => ({ id: r.id, name: r.name }));
330
+ setRelatedDcmtsChooserDataSource(dataSource);
331
+ setArchiveType(type);
332
+ setShowRelatedDcmtsChooser(true);
333
+ }
311
334
  }
312
335
  else {
313
336
  await archiveRelatedDcmtHandler(withAssociations[0], type);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev2.3",
3
+ "version": "6.20.0-dev2.31",
4
4
  "description": "",
5
5
  "scripts": {
6
- "test": "echo \"Error: no test specified\" \u0026\u0026 exit 1",
6
+ "test": "echo \"Error: no test specified\" && exit 1",
7
7
  "clean": "powershell Remove-Item lib/ -recurse",
8
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",
9
+ "tm-build": "npm run clean && tsc && npm run copy-files",
10
10
  "tm-watch": "tsc -w",
11
11
  "tm-publish": "npm publish --tag latest",
12
12
  "tm-publish_wl": "npm publish",
@@ -40,18 +40,18 @@
40
40
  "lib"
41
41
  ],
42
42
  "dependencies": {
43
- "react-router-dom": "^6.15.0",
44
- "react-pdf": "^10.3.0",
45
- "htmlparser2": "^10.0.0",
43
+ "@topconsultnpm/sdk-ts": "6.20.0-dev2.8",
46
44
  "buffer": "^6.0.3",
47
- "@topconsultnpm/sdk-ts": "6.20.0-test1",
48
- "exceljs": "^4.4.0",
49
45
  "devextreme": "25.2.4",
50
- "styled-components": "^6.1.1",
46
+ "devextreme-react": "25.2.4",
47
+ "exceljs": "^4.4.0",
48
+ "htmlparser2": "^10.0.0",
51
49
  "pdfjs-dist": "5.4.296",
52
- "devextreme-react": "25.2.4"
50
+ "react-pdf": "^10.3.0",
51
+ "react-router-dom": "^6.15.0",
52
+ "styled-components": "^6.1.1"
53
53
  },
54
54
  "overrides": {
55
55
  "esbuild": "^0.25.0"
56
56
  }
57
- }
57
+ }