@topconsultnpm/sdkui-react 6.19.0-test.1 → 6.19.0
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/assets/IconsS4t/add.svg +12 -12
- package/lib/assets/IconsS4t/aggiorna.svg +18 -18
- package/lib/assets/IconsS4t/bookmark.svg +42 -42
- package/lib/assets/IconsS4t/cancella.svg +15 -15
- package/lib/assets/IconsS4t/check-box.svg +19 -19
- package/lib/assets/IconsS4t/down-arrow-signBook.svg +40 -40
- package/lib/assets/IconsS4t/down.svg +28 -28
- package/lib/assets/IconsS4t/edit-file.svg +19 -19
- package/lib/assets/IconsS4t/edita.svg +32 -32
- package/lib/assets/IconsS4t/firma.svg +19 -19
- package/lib/assets/IconsS4t/icona_download.svg +16 -16
- package/lib/assets/IconsS4t/info.svg +51 -51
- package/lib/assets/IconsS4t/left.svg +20 -20
- package/lib/assets/IconsS4t/line.svg +40 -40
- package/lib/assets/IconsS4t/more.svg +19 -19
- package/lib/assets/IconsS4t/plus.svg +23 -23
- package/lib/assets/IconsS4t/printer.svg +49 -49
- package/lib/assets/IconsS4t/radio-on-button.svg +25 -25
- package/lib/assets/IconsS4t/rectangle.svg +41 -41
- package/lib/assets/IconsS4t/redo.svg +19 -19
- package/lib/assets/IconsS4t/right-arrow-signBook-finish.svg +40 -40
- package/lib/assets/IconsS4t/right-arrow-signBook.svg +40 -40
- package/lib/assets/IconsS4t/right.svg +22 -22
- package/lib/assets/IconsS4t/searchbar.svg +21 -21
- package/lib/assets/IconsS4t/text-box.svg +36 -36
- package/lib/assets/IconsS4t/tick.svg +8 -8
- package/lib/assets/IconsS4t/trash-white.svg +10 -10
- package/lib/assets/IconsS4t/undo.svg +19 -19
- package/lib/assets/IconsS4t/up.svg +32 -32
- package/lib/assets/IconsS4t/video-streaming.svg +2 -2
- package/lib/assets/IconsS4t/zoom-in.svg +58 -58
- package/lib/assets/IconsS4t/zoom-out.svg +56 -56
- package/lib/assets/icomoon.svg +96 -96
- package/lib/assets/italy.svg +16 -16
- package/lib/assets/six.svg +3 -3
- package/lib/assets/thumbnails/index.ts +39 -39
- package/lib/assets/topmedia-six.svg +65 -65
- package/lib/assets/topmeida-six-bianco.svg +65 -65
- package/lib/components/base/Styled.js +302 -302
- package/lib/components/base/TMAccordion.js +43 -43
- package/lib/components/base/TMAccordionNew.d.ts +28 -0
- package/lib/components/base/TMAccordionNew.js +326 -0
- package/lib/components/base/TMAreaManager.js +23 -23
- package/lib/components/base/TMButton.d.ts +1 -0
- package/lib/components/base/TMButton.js +136 -136
- package/lib/components/base/TMClosableList.js +46 -46
- package/lib/components/base/TMConfirm.js +20 -20
- package/lib/components/base/TMContextMenu.js +4 -4
- package/lib/components/base/TMContextMenuOLD.js +25 -25
- package/lib/components/base/TMCounterBar.js +32 -32
- package/lib/components/base/TMCounterContainer.js +30 -30
- package/lib/components/base/TMCustomButton.d.ts +1 -1
- package/lib/components/base/TMCustomButton.js +90 -35
- package/lib/components/base/TMDataGridExportForm.d.ts +1 -1
- package/lib/components/base/TMDataGridExportForm.js +9 -3
- package/lib/components/base/TMDropDownMenu.js +24 -24
- package/lib/components/base/TMFileManager.js +12 -3
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
- package/lib/components/base/TMFileManagerDataGridView.js +12 -3
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
- package/lib/components/base/TMFileManagerUtils.js +19 -19
- package/lib/components/base/TMFloatingToolbar.js +34 -34
- package/lib/components/base/TMLayout.js +44 -44
- package/lib/components/base/TMList.js +34 -34
- package/lib/components/base/TMModal.d.ts +2 -0
- package/lib/components/base/TMModal.js +79 -34
- package/lib/components/base/TMPanel.js +57 -57
- package/lib/components/base/TMPopUp.js +186 -117
- package/lib/components/base/TMProgressBar.js +20 -20
- package/lib/components/base/TMResizableMenu.js +28 -28
- package/lib/components/base/TMRightSidebar.js +40 -40
- package/lib/components/base/TMSpinner.js +121 -121
- package/lib/components/base/TMTab.js +11 -11
- package/lib/components/base/TMToggleButton.js +36 -36
- package/lib/components/base/TMToolbarCard.js +35 -35
- package/lib/components/base/TMTooltip.d.ts +1 -1
- package/lib/components/base/TMTooltip.js +1 -1
- package/lib/components/base/TMTreeView.js +16 -16
- package/lib/components/base/TMUserAvatar.js +7 -7
- package/lib/components/base/TMWaitPanel.js +30 -24
- package/lib/components/choosers/TMCultureIDPicker.js +35 -35
- package/lib/components/choosers/TMDataListItemChooser.js +1 -1
- package/lib/components/choosers/TMDataListItemPicker.js +54 -54
- package/lib/components/choosers/TMDcmtTypeChooser.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.js +5 -4
- package/lib/components/choosers/TMMetadataChooser.d.ts +4 -1
- package/lib/components/choosers/TMMetadataChooser.js +31 -8
- package/lib/components/choosers/TMUserChooser.d.ts +4 -0
- package/lib/components/choosers/TMUserChooser.js +21 -5
- package/lib/components/editors/TMCheckBox.js +24 -24
- package/lib/components/editors/TMDateBox.d.ts +1 -1
- package/lib/components/editors/TMDropDown.js +43 -43
- package/lib/components/editors/TMEditorStyled.js +71 -71
- package/lib/components/editors/TMHtmlContentDisplay.js +16 -16
- package/lib/components/editors/TMLocalizedTextBox.js +31 -31
- package/lib/components/editors/TMMetadataValues.js +71 -22
- package/lib/components/editors/TMRadioButton.js +39 -39
- package/lib/components/editors/TMSummary.js +39 -39
- package/lib/components/editors/TMTextArea.d.ts +1 -0
- package/lib/components/editors/TMTextArea.js +56 -22
- package/lib/components/editors/TMTextBox.js +53 -23
- package/lib/components/editors/TMTextExpression.js +36 -28
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +30 -0
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +482 -0
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +9 -0
- package/lib/components/features/assistant/ToppySpeechBubble.js +117 -0
- package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
- package/lib/components/features/blog/TMBlogCommentForm.js +21 -9
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +1 -0
- package/lib/components/features/documents/TMDcmtForm.js +331 -65
- package/lib/components/features/documents/TMDcmtIcon.js +17 -12
- package/lib/components/features/documents/TMDcmtPreview.js +75 -38
- package/lib/components/features/documents/TMFileUploader.js +21 -21
- package/lib/components/features/documents/TMRelationViewer.js +56 -23
- package/lib/components/features/search/TMSavedQuerySelector.js +53 -53
- package/lib/components/features/search/TMSearch.js +2 -2
- package/lib/components/features/search/TMSearchQueryEditor.js +14 -14
- package/lib/components/features/search/TMSearchQueryPanel.js +41 -59
- package/lib/components/features/search/TMSearchResult.js +256 -51
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.js +134 -0
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -2
- package/lib/components/features/search/TMSearchResultsMenuItems.js +94 -59
- package/lib/components/features/search/TMSignSettingsForm.d.ts +9 -0
- package/lib/components/features/search/TMSignSettingsForm.js +621 -0
- package/lib/components/features/search/TMTreeSelector.js +67 -67
- package/lib/components/features/search/TMViewHistoryDcmtForm.d.ts +18 -0
- package/lib/components/features/search/TMViewHistoryDcmtForm.js +215 -0
- package/lib/components/features/tasks/TMTaskForm.js +42 -36
- package/lib/components/features/tasks/TMTasksAgenda.js +4 -4
- package/lib/components/features/tasks/TMTasksCalendar.js +2 -2
- package/lib/components/features/tasks/TMTasksHeader.js +1 -1
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -1
- package/lib/components/features/tasks/TMTasksUtils.js +18 -3
- package/lib/components/features/tasks/TMTasksUtilsView.js +26 -4
- package/lib/components/features/tasks/TMTasksView.js +12 -6
- package/lib/components/features/wg/TMWGsCopyMoveForm.js +9 -9
- package/lib/components/features/workflow/TMWorkflowPopup.js +44 -44
- package/lib/components/features/workflow/diagram/ConnectionComponent.js +29 -29
- package/lib/components/features/workflow/diagram/ConnectionForm.js +10 -10
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +57 -57
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +40 -35
- package/lib/components/features/workflow/diagram/DiagramItemSvgContent.js +12 -12
- package/lib/components/features/workflow/diagram/RecipientList.js +39 -39
- package/lib/components/features/workflow/diagram/WFDiagram.js +317 -285
- package/lib/components/features/workflow/diagram/WorkitemRecipientsEditor.js +4 -4
- package/lib/components/forms/Login/Chooser.js +35 -35
- package/lib/components/forms/Login/Menu.js +22 -22
- package/lib/components/forms/Login/SelectBox.js +46 -46
- package/lib/components/forms/Login/TMLoginForm.js +14 -14
- package/lib/components/forms/Login/TextBox.js +57 -57
- package/lib/components/forms/TMResultDialog.js +8 -2
- package/lib/components/forms/TMSaveForm.js +3 -11
- package/lib/components/grids/TMBlogAttachments.d.ts +0 -14
- package/lib/components/grids/TMBlogAttachments.js +10 -5
- package/lib/components/grids/TMBlogsPost.d.ts +8 -3
- package/lib/components/grids/TMBlogsPost.js +100 -39
- package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
- package/lib/components/grids/TMBlogsPostUtils.js +32 -11
- package/lib/components/grids/TMRecentsManager.js +52 -52
- package/lib/components/grids/TMValidationItemsList.js +48 -48
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +2 -1
- package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
- package/lib/components/layout/panelManager/TMPanelManagerContainer.js +14 -14
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +0 -1
- package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +36 -35
- package/lib/components/layout/panelManager/types.d.ts +1 -0
- package/lib/components/pages/TMPage.js +1 -1
- package/lib/components/query/TMQueryEditor.js +17 -17
- package/lib/components/query/TMQuerySummary.d.ts +1 -0
- package/lib/components/query/TMQuerySummary.js +15 -15
- package/lib/components/settings/SettingsAppearance.js +9 -1
- package/lib/components/sidebar/TMCommandsPanel.js +10 -10
- package/lib/components/sidebar/TMHeader.js +307 -307
- package/lib/components/sidebar/TMSidebar.js +24 -24
- package/lib/components/sidebar/TMSidebarItem.js +21 -21
- package/lib/components/viewers/TMDataListItemViewer.d.ts +1 -1
- package/lib/components/viewers/TMMidViewer.d.ts +1 -1
- package/lib/components/viewers/TMTidViewer.d.ts +1 -1
- package/lib/components/wizard/TMStepIndicator.js +102 -102
- package/lib/components/wizard/TMWizard.js +29 -29
- package/lib/helper/GlobalStyles.d.ts +2 -0
- package/lib/helper/GlobalStyles.js +10 -0
- package/lib/helper/Globalization.d.ts +1 -0
- package/lib/helper/Globalization.js +30 -0
- package/lib/helper/SDKUI_Globals.d.ts +9 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +59 -2
- package/lib/helper/SDKUI_Localizator.js +617 -22
- package/lib/helper/TMCustomSearchBar.js +1 -1
- package/lib/helper/TMIcons.d.ts +6 -1
- package/lib/helper/TMIcons.js +22 -2
- package/lib/helper/TMToppyMessage.d.ts +1 -0
- package/lib/helper/TMToppyMessage.js +33 -32
- package/lib/helper/TMUtils.d.ts +42 -4
- package/lib/helper/TMUtils.js +227 -60
- package/lib/helper/cicoHelper.d.ts +31 -0
- package/lib/helper/cicoHelper.js +155 -0
- package/lib/helper/dcmtsHelper.d.ts +2 -1
- package/lib/helper/dcmtsHelper.js +56 -17
- package/lib/helper/helpers.d.ts +8 -1
- package/lib/helper/helpers.js +43 -21
- package/lib/helper/index.d.ts +1 -0
- package/lib/helper/index.js +1 -0
- package/lib/hooks/useDcmtOperations.d.ts +1 -1
- package/lib/hooks/useDcmtOperations.js +10 -6
- package/lib/hooks/useRelatedDocuments.js +35 -26
- package/lib/ts/types.d.ts +3 -1
- package/package.json +54 -54
- package/lib/components/features/assistant/ToppyHelpCenter.d.ts +0 -12
- package/lib/components/features/assistant/ToppyHelpCenter.js +0 -173
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AccessLevels, DcmtTypeDescriptor, FileDescriptor, UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { DcmtCheckoutInfo } from "./index";
|
|
4
|
+
import { DcmtInfo, DownloadModes, DownloadTypes } from "../ts/types";
|
|
5
|
+
export interface CheckInCheckOutInfo {
|
|
6
|
+
CICO: number;
|
|
7
|
+
CanCICO: AccessLevels;
|
|
8
|
+
CanDelChronology: AccessLevels;
|
|
9
|
+
UserID_MID: number;
|
|
10
|
+
Date_MID: number;
|
|
11
|
+
Ver_MID: number;
|
|
12
|
+
UserID_CanViewOrUpdate: AccessLevels;
|
|
13
|
+
Date_CanViewOrUpdate: AccessLevels;
|
|
14
|
+
Ver_CanViewOrUpdate: AccessLevels;
|
|
15
|
+
}
|
|
16
|
+
export declare const colors: {
|
|
17
|
+
MEDIUM_GREEN: string;
|
|
18
|
+
};
|
|
19
|
+
export interface CheckoutStatusResult {
|
|
20
|
+
isCheckedOut: boolean;
|
|
21
|
+
mode: 'editMode' | 'lockMode' | '';
|
|
22
|
+
version: number;
|
|
23
|
+
icon: React.ReactNode | null;
|
|
24
|
+
}
|
|
25
|
+
export declare const cicoIsEnabled: (dcmt: any, allUsers: Array<UserDescriptor>, dtd: DcmtTypeDescriptor | undefined) => {
|
|
26
|
+
cicoEnabled: boolean;
|
|
27
|
+
checkoutStatus: CheckoutStatusResult;
|
|
28
|
+
};
|
|
29
|
+
export declare const getCicoDownloadFileName: (originalFileName: string, fileItem: DcmtInfo | undefined, checkout: boolean, withTimestampAndExt: boolean) => string;
|
|
30
|
+
export declare const updateDcmtCheckoutItem: (item: DcmtCheckoutInfo, action?: "addOrUpdate" | "remove") => void;
|
|
31
|
+
export declare const downloadFilesCallback: (originalFileName: string, dcmt: Array<DcmtInfo>, checkout: boolean, downloadDcmtsAsync: (inputDcmts: Array<DcmtInfo> | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>) => Promise<void>;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AccessLevels, CICO_MetadataNames, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import TMTooltip from "../components/base/TMTooltip";
|
|
4
|
+
import { Globalization, SDKUI_Globals, SDKUI_Localizator } from "./index";
|
|
5
|
+
import { DownloadTypes } from "../ts/types";
|
|
6
|
+
export const colors = {
|
|
7
|
+
MEDIUM_GREEN: "#28a745",
|
|
8
|
+
};
|
|
9
|
+
const getCicoInfo = (dtd) => {
|
|
10
|
+
const cico = {
|
|
11
|
+
CICO: 0,
|
|
12
|
+
CanCICO: AccessLevels.No,
|
|
13
|
+
CanDelChronology: AccessLevels.No,
|
|
14
|
+
UserID_MID: 0,
|
|
15
|
+
Date_MID: 0,
|
|
16
|
+
Ver_MID: 0,
|
|
17
|
+
UserID_CanViewOrUpdate: AccessLevels.No,
|
|
18
|
+
Date_CanViewOrUpdate: AccessLevels.No,
|
|
19
|
+
Ver_CanViewOrUpdate: AccessLevels.No,
|
|
20
|
+
};
|
|
21
|
+
if (dtd === undefined)
|
|
22
|
+
return cico;
|
|
23
|
+
cico.CICO = dtd.cico ?? 0;
|
|
24
|
+
cico.CanCICO = dtd.perm?.canCICO ?? AccessLevels.No;
|
|
25
|
+
cico.CanDelChronology = dtd.perm?.canDelChron ?? AccessLevels.No;
|
|
26
|
+
const mdCheckout = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
27
|
+
if (mdCheckout) {
|
|
28
|
+
cico.UserID_MID = mdCheckout.fromMID;
|
|
29
|
+
cico.UserID_CanViewOrUpdate = (mdCheckout.perm?.canView == AccessLevels.Yes || mdCheckout.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
30
|
+
}
|
|
31
|
+
const mdDate = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
32
|
+
if (mdDate) {
|
|
33
|
+
cico.Date_MID = mdDate.fromMID;
|
|
34
|
+
cico.Date_CanViewOrUpdate = (mdDate.perm?.canView == AccessLevels.Yes || mdDate.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
35
|
+
}
|
|
36
|
+
const mdVer = dtd.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
37
|
+
if (mdVer) {
|
|
38
|
+
cico.Ver_MID = mdVer.fromMID;
|
|
39
|
+
cico.Ver_CanViewOrUpdate = (mdVer.perm?.canView == AccessLevels.Yes || mdVer.perm?.canUpdate == AccessLevels.Yes) ? AccessLevels.Yes : AccessLevels.No;
|
|
40
|
+
}
|
|
41
|
+
return cico;
|
|
42
|
+
};
|
|
43
|
+
const findCheckOutUserName = (allUsers, checkoutUserId) => {
|
|
44
|
+
let checkOutUser = allUsers.find(user => user.id === checkoutUserId);
|
|
45
|
+
return checkOutUser ? checkOutUser.name : '-';
|
|
46
|
+
};
|
|
47
|
+
export const cicoIsEnabled = (dcmt, allUsers, dtd) => {
|
|
48
|
+
if (dcmt === undefined || dtd === undefined) {
|
|
49
|
+
return {
|
|
50
|
+
cicoEnabled: false,
|
|
51
|
+
checkoutStatus: { isCheckedOut: false, mode: '', version: 1, icon: null }
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const cicoInfo = getCicoInfo(dtd);
|
|
55
|
+
const CICO_CheckoutUserID_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutUserID);
|
|
56
|
+
const CICO_CheckoutDate_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_CheckoutDate);
|
|
57
|
+
const CICO_Version_Meta = dtd?.metadata?.find(md => md.name === CICO_MetadataNames.CICO_Version);
|
|
58
|
+
const keyVersion = dcmt.TID + "_" + (CICO_Version_Meta?.id ?? 0);
|
|
59
|
+
const versionRaw = CICO_Version_Meta?.id ? dcmt[keyVersion] : undefined;
|
|
60
|
+
const version = (versionRaw != null && !isNaN(Number(versionRaw))) ? Number(versionRaw) : 1;
|
|
61
|
+
let checkoutStatus = { isCheckedOut: false, mode: '', version: version, icon: null, };
|
|
62
|
+
const userID = SDK_Globals.tmSession?.SessionDescr?.userID;
|
|
63
|
+
if (dcmt && CICO_CheckoutUserID_Meta?.id) {
|
|
64
|
+
const keyUserID = dcmt.TID + "_" + CICO_CheckoutUserID_Meta.id;
|
|
65
|
+
const checkoutUserIdValue = dcmt[keyUserID];
|
|
66
|
+
const checkoutUserId = Number(checkoutUserIdValue);
|
|
67
|
+
if (userID && checkoutUserIdValue && !isNaN(checkoutUserId) && checkoutUserId > 0) {
|
|
68
|
+
// editMode: l'utente corrente è quello che ha fatto il checkout
|
|
69
|
+
// lockMode: un altro utente ha fatto il checkout
|
|
70
|
+
const mode = (userID && userID === checkoutUserId) ? 'editMode' : 'lockMode';
|
|
71
|
+
// Recupera i dati aggiuntivi per il tooltip
|
|
72
|
+
const keyDate = dcmt.TID + "_" + (CICO_CheckoutDate_Meta?.id ?? 0);
|
|
73
|
+
const checkoutDate = CICO_CheckoutDate_Meta?.id ? dcmt[keyDate] : undefined;
|
|
74
|
+
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [mode === 'editMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), mode === 'lockMode' && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", findCheckOutUserName(allUsers, checkoutUserId), " (ID: ", checkoutUserId, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", version ?? 1] }) })] })] });
|
|
75
|
+
const icon = mode === 'editMode'
|
|
76
|
+
? _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }) })
|
|
77
|
+
: _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }) });
|
|
78
|
+
checkoutStatus = { isCheckedOut: true, mode: mode, icon: icon, version: version };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
cicoEnabled: cicoInfo.CICO === 1 && cicoInfo.CanCICO === AccessLevels.Yes,
|
|
83
|
+
checkoutStatus: checkoutStatus
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export const getCicoDownloadFileName = (originalFileName, fileItem, checkout, withTimestampAndExt) => {
|
|
87
|
+
// If no fileItem is provided, return an empty string immediately
|
|
88
|
+
if (fileItem === undefined)
|
|
89
|
+
return '';
|
|
90
|
+
// Retrieve the archiveID from the global session object
|
|
91
|
+
const archiveID = SDK_Globals.tmSession?.SessionDescr?.archiveID;
|
|
92
|
+
// Destructure the fileItem object into properties
|
|
93
|
+
const { DID, TID, FILEEXT } = fileItem;
|
|
94
|
+
// Determine the base name of the file (without its extension)
|
|
95
|
+
// If the file name contains '.', only take the substring before the last dot
|
|
96
|
+
const baseName = originalFileName.includes('.') ? originalFileName.substring(0, originalFileName.lastIndexOf('.')) : originalFileName;
|
|
97
|
+
// Construct a unique identifier for the file combining archiveID, baseName, tid, and did.
|
|
98
|
+
const fileIdentifier = `${archiveID}~${baseName}~${TID}~${DID}`;
|
|
99
|
+
// Determine the extension to append to the file name
|
|
100
|
+
const extension = withTimestampAndExt && FILEEXT ? `.${FILEEXT}` : '';
|
|
101
|
+
// Initialize an empty string for the timestamp (to be appended if needed)
|
|
102
|
+
let timestamp = '';
|
|
103
|
+
// If this is a checkout and timestamps should be added, generate a formatted timestamp
|
|
104
|
+
if (checkout && withTimestampAndExt) {
|
|
105
|
+
const now = new Date();
|
|
106
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
107
|
+
// Format the timestamp as YYYYMMDDHHMMSS and prefix with '~'
|
|
108
|
+
timestamp = `~${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
109
|
+
}
|
|
110
|
+
// Construct and return the final file name: [archiveID]~[name]~[tid]~[did]~[timestamp].[extension]
|
|
111
|
+
return `${checkout ? 'checkout~' : ''}${fileIdentifier}${timestamp}${extension}`;
|
|
112
|
+
};
|
|
113
|
+
export const updateDcmtCheckoutItem = (item, action = "addOrUpdate") => {
|
|
114
|
+
// Make a shallow copy of the global draft checkout items array to avoid direct mutation
|
|
115
|
+
const currentItems = [...SDKUI_Globals.userSettings.dcmtCheckoutInfo];
|
|
116
|
+
// Find the index of an existing item that has the same TID and DID as the new item
|
|
117
|
+
const index = currentItems.findIndex(i => i.TID === item.TID && i.DID === item.DID);
|
|
118
|
+
// If the action is to add a new item or update an existing one
|
|
119
|
+
if (action === "addOrUpdate") {
|
|
120
|
+
if (index >= 0) {
|
|
121
|
+
// If the item exists, overwrite it with the new values
|
|
122
|
+
currentItems[index] = item;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// If the item does not exist, push it into the array
|
|
126
|
+
currentItems.push(item);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else if (action === "remove" && index >= 0) { // If the action is to remove an item
|
|
130
|
+
// Remove the item from the array
|
|
131
|
+
currentItems.splice(index, 1);
|
|
132
|
+
}
|
|
133
|
+
// Update the global array with the modified copy
|
|
134
|
+
SDKUI_Globals.userSettings.dcmtCheckoutInfo = currentItems;
|
|
135
|
+
};
|
|
136
|
+
export const downloadFilesCallback = async (originalFileName, dcmt, checkout, downloadDcmtsAsync) => {
|
|
137
|
+
const files = [];
|
|
138
|
+
dcmt.forEach(file => {
|
|
139
|
+
if (file.TID && file.DID && file.FILEEXT) {
|
|
140
|
+
let fileName = getCicoDownloadFileName(originalFileName, file, checkout, true);
|
|
141
|
+
if (checkout) {
|
|
142
|
+
const newItem = {
|
|
143
|
+
TID: file.TID.toString(),
|
|
144
|
+
DID: file.DID.toString(),
|
|
145
|
+
checkoutFolder: "",
|
|
146
|
+
checkoutName: fileName
|
|
147
|
+
};
|
|
148
|
+
updateDcmtCheckoutItem(newItem, "addOrUpdate");
|
|
149
|
+
}
|
|
150
|
+
files.push({ TID: file.TID, DID: file.DID, FILEEXT: file.FILEEXT, fileName });
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
if (files.length > 0)
|
|
154
|
+
await downloadDcmtsAsync(files, DownloadTypes.Dcmt, "download");
|
|
155
|
+
};
|
|
@@ -4,4 +4,5 @@ export declare const hasDetailRelations: (mTID: number | undefined) => Promise<b
|
|
|
4
4
|
/** Check if dcmtType (mTID) has configured Master or Many-to-Many relations */
|
|
5
5
|
export declare const hasMasterRelations: (mTID: number | undefined) => Promise<boolean>;
|
|
6
6
|
export declare const isXMLFileExt: (fileExt: string | undefined) => boolean;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const getButtonAttributes: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, selectedItems: Array<any> | undefined) => Record<string, any> | undefined;
|
|
8
|
+
export declare const getSelectedItem: (args: string | undefined, formData: MetadataValueDescriptorEx[] | undefined, item: any) => Record<string, any> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RelationCacheService, RelationTypes } from "@topconsultnpm/sdk-ts";
|
|
1
|
+
import { RelationCacheService, RelationTypes, SDK_Globals } from "@topconsultnpm/sdk-ts";
|
|
2
2
|
/** Check if dcmtType (mTID) has configured Detail or Many-to-Many relations */
|
|
3
3
|
export const hasDetailRelations = async (mTID) => {
|
|
4
4
|
let allRelations = await RelationCacheService.GetAllAsync();
|
|
@@ -24,20 +24,59 @@ export const isXMLFileExt = (fileExt) => {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
/*utility functions for TMCustomButton*/
|
|
27
|
-
export const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
export const getButtonAttributes = (args, formData, selectedItems) => args && formData ? formDataMap(formData, args, selectedItems) : undefined;
|
|
28
|
+
const getSelectedItems = (selectedItems) => selectedItems && selectedItems.map(item => item["DID"]) || [];
|
|
29
|
+
export const getSelectedItem = (args, formData, item) => {
|
|
30
|
+
//converto item in formData
|
|
31
|
+
const formDataConverted = [];
|
|
32
|
+
for (const key in item) {
|
|
33
|
+
const md = formData?.find(md => `${item["TID"]}_${md.mid}` === key);
|
|
34
|
+
if (md) { // aggiungo solo i metadati
|
|
35
|
+
const name = md.md?.name || "";
|
|
36
|
+
formDataConverted.push({ md: { name: name }, value: item[key] });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return args && formDataConverted ?
|
|
40
|
+
formDataMap(formDataConverted, args, []) : undefined;
|
|
41
|
+
};
|
|
42
|
+
const formDataMap = (data, args, selectedItems) => {
|
|
43
|
+
const session = SDK_Globals.tmSession;
|
|
44
|
+
const sessionDescr = session?.SessionDescr;
|
|
45
|
+
const result = {};
|
|
46
|
+
// Helper per estrarre il valore di un campo
|
|
47
|
+
const getParamValue = (fieldName) => {
|
|
48
|
+
const md = data.find(md => md.md?.name === fieldName);
|
|
49
|
+
switch (fieldName) {
|
|
50
|
+
case 'SelectedDIDs': return getSelectedItems(selectedItems);
|
|
51
|
+
case 'AuthenticationMode': return sessionDescr?.authenticationMode ?? null;
|
|
52
|
+
case 'ArchiveID': return sessionDescr?.archiveID ?? null;
|
|
53
|
+
case 'CultureID': return sessionDescr?.cultureID ?? null;
|
|
54
|
+
case 'Domain': return sessionDescr?.domain ?? null;
|
|
55
|
+
case 'UserID': return sessionDescr?.userID ?? null;
|
|
56
|
+
case 'UserName': return sessionDescr?.userName ?? null;
|
|
57
|
+
case 'Session': return session ?? null;
|
|
58
|
+
default: return md?.value;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
// Regex per catturare: chiave=[...] o chiave={...} o {@campo}
|
|
62
|
+
const keyValueRegex = /(\w+)=\[([^\]]+)\]|(\w+)=\{@?([^}]+)\}|\{@([^}]+)\}/g;
|
|
63
|
+
for (const match of args.matchAll(keyValueRegex)) {
|
|
64
|
+
if (match[1]) {
|
|
65
|
+
// Formato: chiave=[{@campo} testo {@campo} ...]
|
|
66
|
+
const key = match[1];
|
|
67
|
+
const content = match[2].replace(/\{@([^}]+)\}/g, (_, fieldName) => data.find(md => md.md?.name === fieldName)?.value ?? '');
|
|
68
|
+
result[key] = content;
|
|
69
|
+
}
|
|
70
|
+
else if (match[3]) {
|
|
71
|
+
// Formato: chiave={@campo} o chiave={valore}
|
|
72
|
+
const key = match[3];
|
|
73
|
+
const value = match[4];
|
|
74
|
+
result[key] = value.startsWith('@') ? getParamValue(value.substring(1)) : value;
|
|
75
|
+
}
|
|
76
|
+
else if (match[5]) {
|
|
77
|
+
// Formato: {@campo}
|
|
78
|
+
result[match[5]] = getParamValue(match[5]);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
33
82
|
};
|
|
34
|
-
const formDataMap = (data) => data.reduce((acc, md) => {
|
|
35
|
-
const key = md.md?.name;
|
|
36
|
-
if (key && md.value)
|
|
37
|
-
acc[key] = md.value;
|
|
38
|
-
return acc;
|
|
39
|
-
}, {});
|
|
40
|
-
const splitArguments = (input) => Object.fromEntries(Array.from(input.matchAll(/@?(\w+)=([^;]+)/g), ([, key, value]) => [
|
|
41
|
-
key,
|
|
42
|
-
isNaN(Number(value)) ? value : Number(value),
|
|
43
|
-
]));
|
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const TABLET_WIDTH = 1024;
|
|
|
6
6
|
declare const MOBILE_WIDTH = 640;
|
|
7
7
|
declare const calcResponsiveDirection: (deviceType: DeviceType, desktopDir: "horizontal" | "vertical", tabletDir: "horizontal" | "vertical", mobileDir: "horizontal" | "vertical") => "horizontal" | "vertical";
|
|
8
8
|
declare const openApps: (appModule: AppModules, tmSession: ITopMediaSession, appRoutes?: any[]) => Promise<void>;
|
|
9
|
-
export declare const setSDK_GlobalsInfoAsync: (tms: ITopMediaSession | undefined) => Promise<ITopMediaSession>;
|
|
9
|
+
export declare const setSDK_GlobalsInfoAsync: (tms: ITopMediaSession | undefined) => Promise<ITopMediaSession | undefined>;
|
|
10
10
|
declare const calcResponsiveSizes: (deviceType: DeviceType | undefined, desktopSize: string, tabletSize: string, mobileSize: string) => string;
|
|
11
11
|
declare const getColor: (color: ColorsType) => string;
|
|
12
12
|
/**
|
|
@@ -20,6 +20,13 @@ export declare const truncateText: (text: string, maxLength: number) => string;
|
|
|
20
20
|
declare function genUniqueId(): string;
|
|
21
21
|
export declare const captionToDataField: (caption: string | undefined) => string;
|
|
22
22
|
export declare const getDataColumnName: (fromTID: number | undefined, dtColumn: DataColumnDescriptor | undefined) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Generates unique column keys handling duplicates by adding incremental suffixes.
|
|
25
|
+
* @param columns Array of DataColumnDescriptor
|
|
26
|
+
* @param fromTID The TID to use for column name generation
|
|
27
|
+
* @returns Array of unique column keys
|
|
28
|
+
*/
|
|
29
|
+
export declare const generateUniqueColumnKeys: (columns: DataColumnDescriptor[] | undefined, fromTID: number | undefined) => string[];
|
|
23
30
|
export declare const searchResultDescriptorToSimpleArray: (searchResult: SearchResultDescriptor | undefined) => any[] | undefined;
|
|
24
31
|
export declare const getCompleteMetadataName: (dcmtTypeName: string | undefined, metadataName: string | undefined) => string;
|
|
25
32
|
export declare const getQueryCountAsync: (qd: QueryDescriptor, showSpinner: boolean) => Promise<void>;
|
package/lib/helper/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Colors } from "../utils/theme";
|
|
3
3
|
import { ButtonNames, DeviceType, TMExceptionBoxManager, TMMessageBoxManager, TMSpinner } from "../components";
|
|
4
|
-
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SystemMIDs, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { AccessLevels, MetadataDataDomains, MetadataDataTypes, MetadataDescriptor, MetadataFormatDescriptor, MetadataFormats, MetadataPermission, SDK_Globals, SetGlobalsInfoAsync, SystemMIDs, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts";
|
|
5
5
|
import { Buffer } from 'buffer';
|
|
6
6
|
import { buildTypes, FileExtensionHandler, FormModes, moduleTypes } from "../ts";
|
|
7
7
|
import { SDKUI_Localizator } from "./SDKUI_Localizator";
|
|
@@ -37,22 +37,13 @@ const openApps = async (appModule, tmSession, appRoutes) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
export const setSDK_GlobalsInfoAsync = async (tms) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
SDK_Globals.tmSession.AutoRefresh = true;
|
|
47
|
-
if (SDK_Globals.license == undefined) {
|
|
48
|
-
try {
|
|
49
|
-
SDK_Globals.license = await tmSessionNew.NewLicenseEngine().RetrieveAsync();
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
TMExceptionBoxManager.show({ title: 'Errore caricamento licenza', exception: e });
|
|
53
|
-
}
|
|
40
|
+
try {
|
|
41
|
+
return await SetGlobalsInfoAsync(tms);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
TMExceptionBoxManager.show({ exception: e.message });
|
|
45
|
+
return undefined;
|
|
54
46
|
}
|
|
55
|
-
return tmSessionNew;
|
|
56
47
|
};
|
|
57
48
|
const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) => {
|
|
58
49
|
if (deviceType === DeviceType.DESKTOP)
|
|
@@ -171,16 +162,43 @@ export const getDataColumnName = (fromTID, dtColumn) => {
|
|
|
171
162
|
return MIDtoColName(tid, mid);
|
|
172
163
|
return `${tid}_${mid}`;
|
|
173
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Generates unique column keys handling duplicates by adding incremental suffixes.
|
|
167
|
+
* @param columns Array of DataColumnDescriptor
|
|
168
|
+
* @param fromTID The TID to use for column name generation
|
|
169
|
+
* @returns Array of unique column keys
|
|
170
|
+
*/
|
|
171
|
+
export const generateUniqueColumnKeys = (columns, fromTID) => {
|
|
172
|
+
if (!columns)
|
|
173
|
+
return [];
|
|
174
|
+
const usedKeys = {};
|
|
175
|
+
const uniqueKeys = [];
|
|
176
|
+
for (let i = 0; i < columns.length; i++) {
|
|
177
|
+
let baseKey = getDataColumnName(fromTID, columns[i]);
|
|
178
|
+
let key = baseKey;
|
|
179
|
+
// If key already exists, add incremental suffix
|
|
180
|
+
if (usedKeys[baseKey] !== undefined) {
|
|
181
|
+
usedKeys[baseKey]++;
|
|
182
|
+
key = `${baseKey}_${usedKeys[baseKey]}`;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
usedKeys[baseKey] = 0;
|
|
186
|
+
}
|
|
187
|
+
uniqueKeys.push(key);
|
|
188
|
+
}
|
|
189
|
+
return uniqueKeys;
|
|
190
|
+
};
|
|
174
191
|
export const searchResultDescriptorToSimpleArray = (searchResult) => {
|
|
175
|
-
|
|
192
|
+
// Generate unique keys for all columns
|
|
193
|
+
const uniqueKeys = generateUniqueColumnKeys(searchResult?.dtdResult?.columns, searchResult?.fromTID);
|
|
194
|
+
let result = searchResult?.dtdResult?.rows?.map((row, index) => {
|
|
176
195
|
let item = { rowIndex: index };
|
|
177
196
|
for (let i = 0; i < row.length; i++) {
|
|
178
|
-
|
|
179
|
-
let value = row[i];
|
|
180
|
-
item[key] = value;
|
|
197
|
+
item[uniqueKeys[i]] = row[i];
|
|
181
198
|
}
|
|
182
199
|
return item;
|
|
183
200
|
});
|
|
201
|
+
return result;
|
|
184
202
|
};
|
|
185
203
|
export const getCompleteMetadataName = (dcmtTypeName, metadataName) => `${dcmtTypeName}...${metadataName}`;
|
|
186
204
|
export const getQueryCountAsync = async (qd, showSpinner) => {
|
|
@@ -480,6 +498,9 @@ export const extensionHandler = (fileExt) => {
|
|
|
480
498
|
case 'xml.p7m.tsd': return FileExtensionHandler.READY_TO_SHOW;
|
|
481
499
|
case 'pdf': return FileExtensionHandler.READY_TO_SHOW;
|
|
482
500
|
case 'txt': return FileExtensionHandler.READY_TO_SHOW;
|
|
501
|
+
case 'config':
|
|
502
|
+
case 'cfg':
|
|
503
|
+
case 'json': return FileExtensionHandler.READY_TO_SHOW;
|
|
483
504
|
default: return FileExtensionHandler.NONE;
|
|
484
505
|
}
|
|
485
506
|
};
|
|
@@ -633,7 +654,8 @@ export const highlightText = (text, searchValue) => {
|
|
|
633
654
|
export const renderHighlightedText = (text, searchText, isSelected) => {
|
|
634
655
|
if (!searchText)
|
|
635
656
|
return text;
|
|
636
|
-
const
|
|
657
|
+
const escapedSearchText = searchText.trim().replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
658
|
+
const regex = new RegExp(`(${escapedSearchText})`, 'gi');
|
|
637
659
|
return text.split(regex).map((part, index) => regex.test(part) ? (_jsx("span", { style: { backgroundColor: isSelected ? '#6c9023' : 'yellow' }, children: part }, index)) : (part));
|
|
638
660
|
};
|
|
639
661
|
export function versionAndBuildtypeInfo(module) {
|
package/lib/helper/index.d.ts
CHANGED
package/lib/helper/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export declare function useDcmtOperations(): {
|
|
|
12
12
|
waitPanelTextSecondary: string;
|
|
13
13
|
waitPanelValueSecondary: number;
|
|
14
14
|
waitPanelMaxValueSecondary: number;
|
|
15
|
-
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined
|
|
15
|
+
downloadDcmtsAsync: (inputDcmts: DcmtInfo[] | undefined, downloadType?: DownloadTypes, downloadMode?: DownloadModes, onFileDownloaded?: (dcmtFile: File) => void, confirmAttachments?: (list: FileDescriptor[]) => Promise<string[] | undefined>, skipConfirmation?: boolean) => Promise<void>;
|
|
16
16
|
getDcmtFileAsync: (inputDcmt: DcmtInfo | undefined, rfo: RetrieveFileOptions, operationTitle: string, keepWaitPanelPrimary: boolean, bypassCache?: boolean) => Promise<{
|
|
17
17
|
file: File | undefined;
|
|
18
18
|
isFromCache: boolean;
|
|
@@ -20,12 +20,15 @@ export function useDcmtOperations() {
|
|
|
20
20
|
const [waitPanelValueSecondary, setWaitPanelValueSecondary] = useState(0);
|
|
21
21
|
const [waitPanelMaxValueSecondary, setWaitPanelMaxValueSecondary] = useState(0);
|
|
22
22
|
const { OpenFileDialog } = useFileDialog();
|
|
23
|
-
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded) => {
|
|
23
|
+
const _downloadDcmtsAsync = async (inputDcmts, downloadMode = "download", onFileDownloaded, skipConfirmation = false) => {
|
|
24
24
|
if (inputDcmts === undefined)
|
|
25
25
|
return;
|
|
26
26
|
if (inputDcmts.length <= 0)
|
|
27
27
|
return;
|
|
28
|
-
|
|
28
|
+
const fileExtLower = inputDcmts[0]?.FILEEXT?.toLowerCase();
|
|
29
|
+
const needsForceDownload = fileExtLower?.includes('p7m') || fileExtLower === 'msg';
|
|
30
|
+
const shouldShowConfirm = !skipConfirmation;
|
|
31
|
+
if (inputDcmts.length === 1 && shouldShowConfirm && (downloadMode === "openInNewWindow" || (downloadMode === "download" && needsForceDownload))) {
|
|
29
32
|
if (!inputDcmts[0].FILEEXT)
|
|
30
33
|
return;
|
|
31
34
|
let readyToShow = extensionHandler(inputDcmts[0].FILEEXT) === FileExtensionHandler.READY_TO_SHOW;
|
|
@@ -93,7 +96,8 @@ export function useDcmtOperations() {
|
|
|
93
96
|
else {
|
|
94
97
|
const alink2 = document.createElement('a');
|
|
95
98
|
alink2.href = fileURL;
|
|
96
|
-
|
|
99
|
+
const downloadFileName = inputDcmts[i].fileName ?? (inputDcmts[i].FILEEXT ? `${inputDcmts[i].DID}.${inputDcmts[i].FILEEXT}` : file?.name);
|
|
100
|
+
alink2.download = downloadFileName;
|
|
97
101
|
alink2.target = "_blank";
|
|
98
102
|
alink2.rel = "noreferrer";
|
|
99
103
|
alink2.click();
|
|
@@ -182,11 +186,11 @@ export function useDcmtOperations() {
|
|
|
182
186
|
TMExceptionBoxManager.show({ exception: err });
|
|
183
187
|
}
|
|
184
188
|
};
|
|
185
|
-
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", onFileDownloaded, confirmAttachments) => {
|
|
189
|
+
const downloadDcmtsAsync = async (inputDcmts, downloadType = DownloadTypes.Attachment, downloadMode = "download", onFileDownloaded, confirmAttachments, skipConfirmation = false) => {
|
|
186
190
|
switch (downloadType) {
|
|
187
|
-
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode, onFileDownloaded);
|
|
191
|
+
case DownloadTypes.Dcmt: return await _downloadDcmtsAsync(inputDcmts, downloadMode, onFileDownloaded, skipConfirmation);
|
|
188
192
|
case DownloadTypes.Attachment: return await _downloadAttachmentsAsync(inputDcmts, confirmAttachments);
|
|
189
|
-
default: return await _downloadDcmtsAsync(inputDcmts);
|
|
193
|
+
default: return await _downloadDcmtsAsync(inputDcmts, undefined, undefined, skipConfirmation);
|
|
190
194
|
}
|
|
191
195
|
};
|
|
192
196
|
const uploadDcmtsAsync = async (inputDcmts, operationTitle, operType, actionAfterOperationAsync) => {
|
|
@@ -195,9 +195,18 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
195
195
|
}
|
|
196
196
|
}, [selectedSearchResult?.fromTID]);
|
|
197
197
|
const getFocusedItem = useCallback(() => {
|
|
198
|
-
if (!focusedItem
|
|
198
|
+
if (!focusedItem)
|
|
199
199
|
return undefined;
|
|
200
|
-
|
|
200
|
+
if (currentSearchResults.length === 1) {
|
|
201
|
+
return { mdList: currentSearchResults[0].dtdResult?.rows?.[focusedItem?.rowIndex ?? 0], mids: currentSearchResults[0].selectMIDs ?? [] };
|
|
202
|
+
}
|
|
203
|
+
const matchingSearchResult = currentSearchResults.find(res => res.fromTID == focusedItem?.TID);
|
|
204
|
+
if (!matchingSearchResult)
|
|
205
|
+
return undefined;
|
|
206
|
+
return {
|
|
207
|
+
mdList: matchingSearchResult.dtdResult?.rows?.[focusedItem?.rowIndex ?? 0],
|
|
208
|
+
mids: matchingSearchResult.selectMIDs ?? []
|
|
209
|
+
};
|
|
201
210
|
}, [focusedItem, currentSearchResults]);
|
|
202
211
|
const fetchAssociatedValues = useCallback((mid) => {
|
|
203
212
|
let mdList = getFocusedItem();
|
|
@@ -222,8 +231,8 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
222
231
|
const showNoRelationsAlert = (type) => {
|
|
223
232
|
ShowAlert({
|
|
224
233
|
message: type === 'detail'
|
|
225
|
-
?
|
|
226
|
-
:
|
|
234
|
+
? SDKUI_Localizator.NoDetailDocumentFoundForArchiving
|
|
235
|
+
: SDKUI_Localizator.NoMasterDocumentFoundForArchiving,
|
|
227
236
|
mode: 'info',
|
|
228
237
|
title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
|
|
229
238
|
duration: 5000
|
|
@@ -232,8 +241,8 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
232
241
|
const showNoAssociationsAlert = (type) => {
|
|
233
242
|
ShowAlert({
|
|
234
243
|
message: type === 'detail'
|
|
235
|
-
?
|
|
236
|
-
:
|
|
244
|
+
? SDKUI_Localizator.NoMatchFoundForDetailDocuments
|
|
245
|
+
: SDKUI_Localizator.NoMatchFoundForMasterDocuments,
|
|
237
246
|
mode: 'info',
|
|
238
247
|
title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
|
|
239
248
|
duration: 5000
|
|
@@ -254,8 +263,8 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
254
263
|
if (dtd?.perm?.canArchive !== AccessLevelsEx.Yes && dtd?.perm?.canArchive !== AccessLevelsEx.Mixed) {
|
|
255
264
|
ShowAlert({
|
|
256
265
|
message: type === 'detail'
|
|
257
|
-
?
|
|
258
|
-
:
|
|
266
|
+
? SDKUI_Localizator.YouDoNotHavePermissionsToArchiveDetailDocumentsOfThisType
|
|
267
|
+
: SDKUI_Localizator.YouDoNotHavePermissionsToArchiveMasterDocumentsOfThisType,
|
|
259
268
|
mode: 'warning',
|
|
260
269
|
title: type === 'detail' ? SDKUI_Localizator.DcmtsDetail : SDKUI_Localizator.DcmtsMaster,
|
|
261
270
|
duration: 5000
|
|
@@ -365,10 +374,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
365
374
|
if (!focusedItem?.TID || !focusedItem?.DID) {
|
|
366
375
|
ShowAlert({
|
|
367
376
|
message: isPairing
|
|
368
|
-
?
|
|
369
|
-
:
|
|
377
|
+
? SDKUI_Localizator.NoDocumentSelectedForManyToManyMatching
|
|
378
|
+
: SDKUI_Localizator.NoDocumentSelectedForManyToManyUnmatching,
|
|
370
379
|
mode: 'warning',
|
|
371
|
-
title: isPairing ?
|
|
380
|
+
title: isPairing ? SDKUI_Localizator.MatchManyDocumentsManyToMany : SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
372
381
|
duration: 5000
|
|
373
382
|
});
|
|
374
383
|
return;
|
|
@@ -384,10 +393,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
384
393
|
if (!qd) {
|
|
385
394
|
ShowAlert({
|
|
386
395
|
message: isPairing
|
|
387
|
-
?
|
|
388
|
-
:
|
|
396
|
+
? SDKUI_Localizator.NoManyToManyMatchingRelationshipAssociatedWithRetrievalQuery
|
|
397
|
+
: SDKUI_Localizator.NoManyToManyUnmatchingRelationshipAssociatedWithRetrievalQuery,
|
|
389
398
|
mode: 'warning',
|
|
390
|
-
title: isPairing ?
|
|
399
|
+
title: isPairing ? SDKUI_Localizator.MatchManyDocumentsManyToMany : SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
391
400
|
duration: 5000
|
|
392
401
|
});
|
|
393
402
|
return;
|
|
@@ -490,9 +499,9 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
490
499
|
if (!isPairing) {
|
|
491
500
|
if (!pairedDocumentsResult?.dtdResult?.rows || pairedDocumentsResult.dtdResult.rows.length === 0) {
|
|
492
501
|
ShowAlert({
|
|
493
|
-
message:
|
|
502
|
+
message: SDKUI_Localizator.NoDocumentMatchFound,
|
|
494
503
|
mode: 'warning',
|
|
495
|
-
title:
|
|
504
|
+
title: SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
496
505
|
duration: 5000
|
|
497
506
|
});
|
|
498
507
|
return;
|
|
@@ -514,9 +523,9 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
514
523
|
const sq = await searchEngine.SearchByIDAsync(qd);
|
|
515
524
|
if (!sq?.dtdResult?.rows || sq.dtdResult.rows.length === 0) {
|
|
516
525
|
ShowAlert({
|
|
517
|
-
message:
|
|
526
|
+
message: SDKUI_Localizator.NoDcmtFound,
|
|
518
527
|
mode: 'warning',
|
|
519
|
-
title:
|
|
528
|
+
title: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
520
529
|
duration: 5000
|
|
521
530
|
});
|
|
522
531
|
openPairSearchModal(relation, targetTID, qd);
|
|
@@ -539,9 +548,9 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
539
548
|
};
|
|
540
549
|
if (filteredRows.length === 0) {
|
|
541
550
|
ShowAlert({
|
|
542
|
-
message:
|
|
551
|
+
message: SDKUI_Localizator.NoDocumentToMatch,
|
|
543
552
|
mode: 'warning',
|
|
544
|
-
title:
|
|
553
|
+
title: SDKUI_Localizator.MatchManyDocumentsManyToMany,
|
|
545
554
|
duration: 5000
|
|
546
555
|
});
|
|
547
556
|
openPairSearchModal(relation, targetTID, qd);
|
|
@@ -560,10 +569,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
560
569
|
if (!relations.some(r => r.relationType === RelationTypes.ManyToMany)) {
|
|
561
570
|
ShowAlert({
|
|
562
571
|
message: isPairing
|
|
563
|
-
?
|
|
564
|
-
:
|
|
572
|
+
? SDKUI_Localizator.NoManyToManyMatchingRelationshipDefined
|
|
573
|
+
: SDKUI_Localizator.NoManyToManyUnmatchingRelationshipDefined,
|
|
565
574
|
mode: 'warning',
|
|
566
|
-
title: isPairing ?
|
|
575
|
+
title: isPairing ? SDKUI_Localizator.MatchManyDocumentsManyToMany : SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
567
576
|
duration: 5000
|
|
568
577
|
});
|
|
569
578
|
return;
|
|
@@ -572,10 +581,10 @@ export const useRelatedDocuments = ({ selectedSearchResult, focusedItem, current
|
|
|
572
581
|
if (!manyToManyRels.some(r => r.masterTID === selectedSearchResult?.fromTID || r.detailTID === selectedSearchResult?.fromTID)) {
|
|
573
582
|
ShowAlert({
|
|
574
583
|
message: isPairing
|
|
575
|
-
?
|
|
576
|
-
:
|
|
584
|
+
? SDKUI_Localizator.NoManyToManyMatchingRelationshipDefinedForSelectedDocumentType
|
|
585
|
+
: SDKUI_Localizator.NoManyToManyUnmatchingRelationshipDefinedForSelectedDocumentType,
|
|
577
586
|
mode: 'warning',
|
|
578
|
-
title: isPairing ?
|
|
587
|
+
title: isPairing ? SDKUI_Localizator.MatchManyDocumentsManyToMany : SDKUI_Localizator.UnmatchManyDocumentsManyToMany,
|
|
579
588
|
duration: 5000
|
|
580
589
|
});
|
|
581
590
|
return;
|
package/lib/ts/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { FileFormats, ITopMediaSession, MetadataDescriptor, MetadataValueDescriptor, UserDescriptor, ValidationItem } from "@topconsultnpm/sdk-ts";
|
|
3
3
|
import { ITMEditorBase } from "../components/base/TMEditorBase";
|
|
4
|
-
import { IColumnProps } from "devextreme-react/
|
|
4
|
+
import { IColumnProps } from "devextreme-react/data-grid";
|
|
5
5
|
export declare enum FormModes {
|
|
6
6
|
None = 0,
|
|
7
7
|
Create = 1,
|
|
@@ -112,6 +112,7 @@ export type TaskContext = {
|
|
|
112
112
|
dossier?: {
|
|
113
113
|
id: number;
|
|
114
114
|
name: string;
|
|
115
|
+
origin?: string;
|
|
115
116
|
};
|
|
116
117
|
document?: {
|
|
117
118
|
tid: number;
|
|
@@ -172,6 +173,7 @@ export interface ITMSaveFormBaseProps {
|
|
|
172
173
|
customTooltipSaveButton?: string;
|
|
173
174
|
showBackButton?: boolean;
|
|
174
175
|
showUndoButton?: boolean;
|
|
176
|
+
showCloseButton?: boolean;
|
|
175
177
|
showWarningsCount?: boolean;
|
|
176
178
|
showErrorCount?: boolean;
|
|
177
179
|
hasNavigation?: boolean;
|