@topconsultnpm/sdkui-react 6.20.0-dev2.6 → 6.20.0-dev2.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +3 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +7 -5
- package/lib/components/base/Styled.d.ts +4 -1
- package/lib/components/base/Styled.js +11 -3
- package/lib/components/base/TMTreeView.d.ts +3 -1
- package/lib/components/base/TMTreeView.js +64 -21
- package/lib/components/choosers/TMDataListItemEditor.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemEditor.js +130 -0
- package/lib/components/choosers/TMDataListItemFields.d.ts +11 -0
- package/lib/components/choosers/TMDataListItemFields.js +61 -0
- package/lib/components/choosers/TMDataListItemPicker.d.ts +1 -0
- package/lib/components/choosers/TMDataListItemPicker.js +178 -18
- package/lib/components/choosers/TMDynDataListItemChooser.js +11 -6
- package/lib/components/choosers/TMImageIDChooser.d.ts +16 -0
- package/lib/components/choosers/TMImageIDChooser.js +53 -0
- package/lib/components/choosers/TMMetadataChooser.js +1 -1
- package/lib/components/editors/TMDateBox.js +1 -1
- package/lib/components/editors/TMHtmlEditor.js +1 -1
- package/lib/components/editors/TMLocalizedTextBox.d.ts +1 -0
- package/lib/components/editors/TMLocalizedTextBox.js +3 -3
- package/lib/components/editors/TMMetadataValues.js +3 -1
- package/lib/components/editors/TMTextBox.js +9 -10
- package/lib/components/features/archive/TMArchive.js +29 -42
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +3 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +42 -36
- package/lib/components/features/documents/TMDcmtForm.js +193 -45
- package/lib/components/features/documents/TMDcmtPreview.js +2 -1
- package/lib/components/features/documents/TMDcmtTasks.d.ts +3 -1
- package/lib/components/features/documents/TMDcmtTasks.js +2 -2
- package/lib/components/features/documents/TMFileUploader.js +5 -2
- package/lib/components/features/documents/TMMasterDetailDcmts.js +68 -84
- package/lib/components/features/documents/TMRelationViewer.d.ts +7 -1
- package/lib/components/features/documents/TMRelationViewer.js +395 -78
- package/lib/components/features/search/TMSearchResult.d.ts +1 -0
- package/lib/components/features/search/TMSearchResult.js +46 -77
- package/lib/components/features/search/TMSearchResultsMenuItems.js +2 -2
- package/lib/components/features/tasks/TMTaskForm.d.ts +1 -0
- package/lib/components/features/tasks/TMTaskForm.js +61 -193
- package/lib/components/features/tasks/TMTaskFormUtils.d.ts +80 -0
- package/lib/components/features/tasks/TMTaskFormUtils.js +559 -0
- package/lib/components/features/tasks/TMTasksUtils.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksUtils.js +46 -16
- package/lib/components/features/tasks/TMTasksUtilsView.d.ts +0 -7
- package/lib/components/features/tasks/TMTasksUtilsView.js +7 -14
- package/lib/components/features/tasks/TMTasksView.js +5 -3
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +20 -3
- package/lib/components/features/workflow/TMWorkflowPopup.js +14 -92
- package/lib/components/features/workflow/diagram/ConnectionComponent.d.ts +1 -0
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +6 -2
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/WFDiagram.js +75 -5
- package/lib/components/forms/Login/TMLoginForm.js +1 -1
- package/lib/components/forms/TMSaveForm.js +61 -13
- package/lib/components/grids/TMBlogsPost.js +8 -8
- package/lib/components/grids/TMBlogsPostUtils.js +2 -2
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +3 -2
- package/lib/components/pages/TMPage.js +4 -0
- package/lib/components/query/TMQueryEditor.d.ts +1 -0
- package/lib/components/query/TMQueryEditor.js +2 -2
- package/lib/helper/Enum_Localizator.js +5 -0
- package/lib/helper/GlobalStyles.js +3 -0
- package/lib/helper/SDKUI_Globals.d.ts +8 -0
- package/lib/helper/SDKUI_Globals.js +12 -0
- package/lib/helper/SDKUI_Localizator.d.ts +17 -3
- package/lib/helper/SDKUI_Localizator.js +162 -22
- package/lib/helper/TMIcons.d.ts +2 -1
- package/lib/helper/TMIcons.js +4 -1
- package/lib/helper/TMUtils.d.ts +23 -0
- package/lib/helper/TMUtils.js +66 -3
- package/lib/helper/helpers.d.ts +6 -2
- package/lib/helper/helpers.js +24 -8
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/helper/queryHelper.js +1 -1
- package/lib/hooks/useBetaFeatures.d.ts +1 -0
- package/lib/hooks/useBetaFeatures.js +41 -0
- package/lib/hooks/useDcmtOperations.js +14 -2
- package/lib/hooks/useRelatedDocuments.js +34 -11
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +11 -11
package/lib/helper/helpers.js
CHANGED
|
@@ -7,6 +7,28 @@ import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts"
|
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
8
8
|
import ReactDOMServer from "react-dom/server";
|
|
9
9
|
import { DeepCompareHelper } from "./DeepCompareHelper";
|
|
10
|
+
const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
|
|
11
|
+
if (deviceType === DeviceType.DESKTOP)
|
|
12
|
+
return desktopSize;
|
|
13
|
+
if (deviceType === DeviceType.TABLET)
|
|
14
|
+
return tabletSize;
|
|
15
|
+
return mobileSize;
|
|
16
|
+
};
|
|
17
|
+
const taskModalSizes = (deviceType, formMode) => {
|
|
18
|
+
switch (formMode) {
|
|
19
|
+
case FormModes.Create:
|
|
20
|
+
case FormModes.Duplicate:
|
|
21
|
+
return {
|
|
22
|
+
width: calcResponsiveSizes(deviceType, '500px', '90%', '95%'),
|
|
23
|
+
height: calcResponsiveSizes(deviceType, '600px', '90%', '95%'),
|
|
24
|
+
};
|
|
25
|
+
default:
|
|
26
|
+
return {
|
|
27
|
+
width: calcResponsiveSizes(deviceType, '670px', '90%', '95%'),
|
|
28
|
+
height: calcResponsiveSizes(deviceType, '770px', '90%', '95%'),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
10
32
|
//#region Responsive Helpers
|
|
11
33
|
const TABLET_WIDTH = 1024;
|
|
12
34
|
const MOBILE_WIDTH = 640;
|
|
@@ -50,13 +72,6 @@ export const setSDK_GlobalsInfoAsync = async (tms) => {
|
|
|
50
72
|
return undefined;
|
|
51
73
|
}
|
|
52
74
|
};
|
|
53
|
-
const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
|
|
54
|
-
if (deviceType === DeviceType.DESKTOP)
|
|
55
|
-
return desktopSize;
|
|
56
|
-
if (deviceType === DeviceType.TABLET)
|
|
57
|
-
return tabletSize;
|
|
58
|
-
return mobileSize;
|
|
59
|
-
};
|
|
60
75
|
//#endregion
|
|
61
76
|
const getColor = (color) => {
|
|
62
77
|
let c = '';
|
|
@@ -540,6 +555,7 @@ export const getMoreInfoTasksForDocument = (allTasks, TID, DID) => {
|
|
|
540
555
|
return [];
|
|
541
556
|
return allTasks.filter(task => isTaskMoreInfo(task.name) &&
|
|
542
557
|
task.state !== Task_States.Completed &&
|
|
558
|
+
task.state !== Task_States.Closed &&
|
|
543
559
|
task.iD1?.toString() === TID.toString() &&
|
|
544
560
|
task.iD2?.toString() === DID.toString());
|
|
545
561
|
};
|
|
@@ -616,7 +632,7 @@ export function calcIsModified(formData, formDataOrig) {
|
|
|
616
632
|
return JSON.stringify(formData) !== JSON.stringify(formDataOrig);
|
|
617
633
|
}
|
|
618
634
|
//#endregion
|
|
619
|
-
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
635
|
+
export { openApps, calcResponsiveDirection, calcResponsiveSizes, taskModalSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
|
620
636
|
export function moduleVersion(module) {
|
|
621
637
|
switch (module) {
|
|
622
638
|
case moduleTypes.SDK: return SDK_Globals.sdkVersion ?? '0.0.0';
|
package/lib/helper/index.d.ts
CHANGED
package/lib/helper/index.js
CHANGED
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useBetaFeatures: () => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
3
|
+
import { SDKUI_Globals } from '../helper';
|
|
4
|
+
import { ShowAlert } from '../components';
|
|
5
|
+
export const useBetaFeatures = () => {
|
|
6
|
+
const tmSession = SDK_Globals.tmSession;
|
|
7
|
+
const archiveId = tmSession?.SessionDescr?.archiveID;
|
|
8
|
+
const userId = tmSession?.SessionDescr?.userID;
|
|
9
|
+
const isBetaFeaturesEnabled = useMemo(() => {
|
|
10
|
+
return SDKUI_Globals.userSettings.devSettings?.betaFeatures === 1;
|
|
11
|
+
}, [archiveId, userId]);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const handleBetaFeaturesShortcut = (e) => {
|
|
14
|
+
if (e.ctrlKey && e.altKey && e.key.toLowerCase() === 'y') {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
e.stopImmediatePropagation();
|
|
18
|
+
const currentValue = SDKUI_Globals.userSettings.devSettings?.betaFeatures;
|
|
19
|
+
const isCurrentlyEnabled = currentValue === 1;
|
|
20
|
+
if (isCurrentlyEnabled) {
|
|
21
|
+
SDKUI_Globals.userSettings.devSettings = undefined;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
SDKUI_Globals.userSettings.devSettings = { betaFeatures: 1 };
|
|
25
|
+
}
|
|
26
|
+
const status = isCurrentlyEnabled ? 'disabilitato' : 'abilitato';
|
|
27
|
+
ShowAlert({
|
|
28
|
+
message: `Beta features ${status}! Saranno ${status === 'abilitato' ? 'disponibili' : 'nascoste'} al prossimo login.`,
|
|
29
|
+
mode: 'info',
|
|
30
|
+
duration: 5000,
|
|
31
|
+
title: 'Beta Features'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
globalThis.addEventListener('keydown', handleBetaFeaturesShortcut);
|
|
36
|
+
return () => {
|
|
37
|
+
globalThis.removeEventListener('keydown', handleBetaFeaturesShortcut);
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
return isBetaFeaturesEnabled;
|
|
41
|
+
};
|
|
@@ -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
|
|
100
|
-
alink2.download =
|
|
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
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from './hooks/useResizeObserver';
|
|
|
10
10
|
export * from './hooks/useWorkflowApprove';
|
|
11
11
|
export * from './hooks/useRelatedDocuments';
|
|
12
12
|
export * from './hooks/useSettingsFeedback';
|
|
13
|
+
export * from './hooks/useBetaFeatures';
|
|
13
14
|
export * from './services';
|
|
14
15
|
import config from 'devextreme/core/config';
|
|
15
16
|
// DevExtreme License Key (valid for v25.2 and earlier versions)
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topconsultnpm/sdkui-react",
|
|
3
|
-
"version": "6.20.0-dev2.
|
|
3
|
+
"version": "6.20.0-dev2.61",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\"
|
|
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
|
|
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
|
-
"
|
|
44
|
-
"react-pdf": "^10.3.0",
|
|
45
|
-
"htmlparser2": "^10.0.0",
|
|
43
|
+
"@topconsultnpm/sdk-ts": "6.20.0-dev2.14",
|
|
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
|
-
"
|
|
46
|
+
"devextreme-react": "25.2.4",
|
|
47
|
+
"exceljs": "^4.4.0",
|
|
48
|
+
"htmlparser2": "^10.0.0",
|
|
51
49
|
"pdfjs-dist": "5.4.296",
|
|
52
|
-
"
|
|
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
|
+
}
|