@topconsultnpm/sdkui-react 6.19.0-test.1 → 6.19.0-test2
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/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 +62 -21
- 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 +471 -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.js +321 -62
- 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 +52 -52
- 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 +40 -58
- package/lib/components/features/search/TMSearchResult.js +160 -35
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -1
- package/lib/components/features/search/TMSearchResultsMenuItems.js +117 -60
- 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 +66 -66
- 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 +51 -51
- 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 +2 -0
- package/lib/helper/SDKUI_Globals.js +9 -1
- package/lib/helper/SDKUI_Localizator.d.ts +50 -2
- package/lib/helper/SDKUI_Localizator.js +502 -22
- package/lib/helper/TMCustomSearchBar.js +1 -1
- package/lib/helper/TMIcons.d.ts +4 -1
- package/lib/helper/TMIcons.js +14 -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/dcmtsHelper.d.ts +2 -1
- package/lib/helper/dcmtsHelper.js +56 -17
- package/lib/helper/helpers.d.ts +1 -1
- package/lib/helper/helpers.js +12 -17
- 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
|
@@ -2,38 +2,38 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import TMTooltip from './TMTooltip';
|
|
4
4
|
/* Styled container component that holds all counter items */
|
|
5
|
-
const Container = styled.div `
|
|
6
|
-
background: ${({ bgColor }) => bgColor || 'linear-gradient(to right, #f8f9fa, #e9ecef)'};
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
width: 100%;
|
|
10
|
-
padding: 4px 8px;
|
|
11
|
-
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.1);
|
|
12
|
-
gap: 8px;
|
|
5
|
+
const Container = styled.div `
|
|
6
|
+
background: ${({ bgColor }) => bgColor || 'linear-gradient(to right, #f8f9fa, #e9ecef)'};
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
padding: 4px 8px;
|
|
11
|
+
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.1);
|
|
12
|
+
gap: 8px;
|
|
13
13
|
`;
|
|
14
14
|
/* Styled counter item component with customizable styles */
|
|
15
|
-
const Counter = styled.div `
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
border-right: 1px solid rgba(211, 211, 211, 0.5);
|
|
19
|
-
padding: 4px 10px;
|
|
20
|
-
gap: 8px;
|
|
21
|
-
transition: all 0.3s ease-in-out;
|
|
22
|
-
background: ${({ color }) => color || 'rgba(255, 255, 255, 0.6)'};
|
|
23
|
-
|
|
24
|
-
&:last-child {
|
|
25
|
-
border-right: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
svg {
|
|
29
|
-
color: ${({ textColor }) => textColor || '#495057'};
|
|
30
|
-
transition: color 0.3s ease-in-out;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
span {
|
|
34
|
-
color: ${({ textColor }) => textColor || '#495057'};
|
|
35
|
-
transition: color 0.3s ease-in-out;
|
|
36
|
-
}
|
|
15
|
+
const Counter = styled.div `
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
border-right: 1px solid rgba(211, 211, 211, 0.5);
|
|
19
|
+
padding: 4px 10px;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
transition: all 0.3s ease-in-out;
|
|
22
|
+
background: ${({ color }) => color || 'rgba(255, 255, 255, 0.6)'};
|
|
23
|
+
|
|
24
|
+
&:last-child {
|
|
25
|
+
border-right: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
svg {
|
|
29
|
+
color: ${({ textColor }) => textColor || '#495057'};
|
|
30
|
+
transition: color 0.3s ease-in-out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
span {
|
|
34
|
+
color: ${({ textColor }) => textColor || '#495057'};
|
|
35
|
+
transition: color 0.3s ease-in-out;
|
|
36
|
+
}
|
|
37
37
|
`;
|
|
38
38
|
/* Enum for possible counter item keys */
|
|
39
39
|
export var CounterItemKey;
|
|
@@ -7,5 +7,5 @@ type TMCustomButtonProps = {
|
|
|
7
7
|
selectedItems?: Array<any>;
|
|
8
8
|
onClose?: () => void;
|
|
9
9
|
};
|
|
10
|
-
declare const TMCustomButton: (props: TMCustomButtonProps) => import("react/jsx-runtime").JSX.Element
|
|
10
|
+
declare const TMCustomButton: (props: TMCustomButtonProps) => false | import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export default TMCustomButton;
|
|
@@ -1,63 +1,118 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState, useMemo } from 'react';
|
|
4
3
|
import TMModal from './TMModal';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { SDKUI_Localizator, TMLayoutWaitingContainer } from '../..';
|
|
6
|
+
import { getButtonAttributes, getSelectedItem } from '../../helper/dcmtsHelper';
|
|
7
|
+
const IframeContainer = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
height: 100%;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
padding-left: 15px;
|
|
11
12
|
`;
|
|
12
|
-
const StyledIframe = styled.iframe `
|
|
13
|
-
border: none;
|
|
14
|
-
flex: 1;
|
|
13
|
+
const StyledIframe = styled.iframe `
|
|
14
|
+
border: none;
|
|
15
|
+
flex: 1;
|
|
15
16
|
`;
|
|
16
17
|
const TMCustomButton = (props) => {
|
|
17
18
|
const { button, isModal = true, formData, selectedItems, onClose } = props;
|
|
18
19
|
const { appName: scriptUrl, arguments: args } = button;
|
|
19
20
|
const iframeRef = useRef(null);
|
|
20
|
-
const attributes =
|
|
21
|
+
const attributes = useMemo(() => getButtonAttributes(args, formData, selectedItems), [args, formData, selectedItems]);
|
|
22
|
+
const RunOnce = button.mode === "RunOnce";
|
|
21
23
|
const [loading, setLoading] = useState(true);
|
|
22
24
|
const [error, setError] = useState(false);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
+
const selectedItemsCount = selectedItems?.length || 0;
|
|
26
|
+
// Stati per il wait panel
|
|
27
|
+
const [showWaitPanel, setShowWaitPanel] = useState(selectedItemsCount > 0 && !RunOnce);
|
|
28
|
+
const [waitPanelText, setWaitPanelText] = useState(SDKUI_Localizator.CustomButtonActions.replaceParams(1, selectedItemsCount));
|
|
29
|
+
const [waitPanelValue, setWaitPanelValue] = useState(0);
|
|
30
|
+
const [waitPanelMaxValue, setWaitPanelMaxValue] = useState(selectedItemsCount);
|
|
31
|
+
const [abortController, setAbortController] = useState(undefined);
|
|
32
|
+
const targetOrigin = useMemo(() => {
|
|
33
|
+
if (!scriptUrl)
|
|
25
34
|
return '*';
|
|
26
35
|
try {
|
|
27
|
-
const urlObj = new URL(
|
|
36
|
+
const urlObj = new URL(scriptUrl);
|
|
28
37
|
return urlObj.origin;
|
|
29
38
|
}
|
|
30
39
|
catch {
|
|
31
40
|
return '*';
|
|
32
41
|
}
|
|
33
|
-
};
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (iframeRef.current?.contentWindow) {
|
|
36
|
-
const mergedAttributes = { ...attributes, selectedItems: selectedItems };
|
|
37
|
-
iframeRef.current.contentWindow.postMessage({
|
|
38
|
-
"options": mergedAttributes,
|
|
39
|
-
"selectedItems": selectedItems,
|
|
40
|
-
"session": SDK_Globals.tmSession
|
|
41
|
-
}, getTargetOrigin(scriptUrl));
|
|
42
|
-
}
|
|
43
|
-
clearTimeout(timeoutIframe);
|
|
44
|
-
}, [loading, error, scriptUrl, attributes]);
|
|
42
|
+
}, [scriptUrl]);
|
|
45
43
|
const handleLoad = () => setLoading(false);
|
|
46
44
|
const handleError = () => {
|
|
47
45
|
setLoading(false);
|
|
48
46
|
setError(true);
|
|
49
47
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
const executeSequentially = async (controller) => {
|
|
49
|
+
if (!selectedItems)
|
|
50
|
+
return;
|
|
51
|
+
for (const [index, item] of selectedItems.entries()) {
|
|
52
|
+
if (controller.signal.aborted)
|
|
53
|
+
break;
|
|
54
|
+
setWaitPanelText(SDKUI_Localizator.CustomButtonActions.replaceParams(index + 1, selectedItemsCount));
|
|
55
|
+
setWaitPanelValue(index);
|
|
56
|
+
// Attendi che l'iframe sia pronto e invia il messaggio
|
|
57
|
+
await new Promise((resolve) => {
|
|
58
|
+
const checkIframe = setInterval(() => {
|
|
59
|
+
if (iframeRef.current?.contentWindow) {
|
|
60
|
+
clearInterval(checkIframe);
|
|
61
|
+
//devo convertire item in formData
|
|
62
|
+
const processedItem = getSelectedItem(args, formData, item);
|
|
63
|
+
postMessageIframe(processedItem);
|
|
64
|
+
// Attendi prima di passare al prossimo
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
setWaitPanelValue(index + 1);
|
|
67
|
+
resolve();
|
|
68
|
+
}, 500);
|
|
69
|
+
}
|
|
70
|
+
}, 100);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
setShowWaitPanel(false);
|
|
74
|
+
onClose?.();
|
|
75
|
+
};
|
|
76
|
+
const postMessageIframe = (data) => {
|
|
77
|
+
console.log("TMCustomButton - postMessageIframe - data:", data);
|
|
78
|
+
if (iframeRef.current?.contentWindow) {
|
|
79
|
+
iframeRef.current.contentWindow.postMessage({ "options": data }, targetOrigin);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (loading || error)
|
|
84
|
+
return;
|
|
85
|
+
//if(error) clearTimeout(timeoutIframe);
|
|
86
|
+
if (!RunOnce && selectedItemsCount > 0) {
|
|
87
|
+
// esegui per ogni item selezionato
|
|
88
|
+
const controller = new AbortController();
|
|
89
|
+
controller.signal.addEventListener('abort', () => {
|
|
90
|
+
setShowWaitPanel(false);
|
|
91
|
+
onClose?.();
|
|
92
|
+
});
|
|
93
|
+
setAbortController(controller);
|
|
94
|
+
setWaitPanelMaxValue(selectedItemsCount);
|
|
95
|
+
executeSequentially(controller);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// Modalità RunOnce: invia dati all'iframe quando è caricato
|
|
99
|
+
postMessageIframe(attributes);
|
|
100
|
+
if (!RunOnce) {
|
|
101
|
+
//chiudo l'iframe dopo 2 secondi
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
onClose?.();
|
|
104
|
+
}, 2000);
|
|
105
|
+
}
|
|
106
|
+
//clearTimeout(timeoutIframe);
|
|
107
|
+
}
|
|
108
|
+
}, [loading, error, RunOnce]);
|
|
55
109
|
useEffect(() => {
|
|
56
|
-
if (!isModal && scriptUrl) {
|
|
110
|
+
if (!isModal && RunOnce && scriptUrl) {
|
|
57
111
|
window.open(scriptUrl, '_blank');
|
|
58
112
|
onClose?.();
|
|
59
113
|
}
|
|
60
|
-
}, [
|
|
61
|
-
|
|
114
|
+
}, []);
|
|
115
|
+
const iframeContent = (_jsxs(IframeContainer, { style: !RunOnce ? { visibility: 'hidden' } : {}, children: [error && _jsx("div", { children: "Si \u00E8 verificato un errore nel caricamento del contenuto." }), !error && _jsx(StyledIframe, { ref: iframeRef, loading: 'lazy', onLoad: handleLoad, onError: handleError, src: scriptUrl })] }));
|
|
116
|
+
return isModal && RunOnce ? (_jsx(TMModal, { title: button.title, width: '60%', height: '70%', resizable: true, expandable: true, onClose: onClose, children: iframeContent })) : !RunOnce && (_jsxs(_Fragment, { children: [_jsx(TMLayoutWaitingContainer, { showWaitPanel: showWaitPanel, waitPanelTitle: SDKUI_Localizator.CustomButtonAction, showWaitPanelPrimary: true, waitPanelTextPrimary: waitPanelText, waitPanelValuePrimary: waitPanelValue, waitPanelMaxValuePrimary: waitPanelMaxValue, showWaitPanelSecondary: false, isCancelable: true, abortController: abortController, children: undefined }), iframeContent] }));
|
|
62
117
|
};
|
|
63
118
|
export default TMCustomButton;
|
|
@@ -64,7 +64,7 @@ const TMDataGridExportForm = (props) => {
|
|
|
64
64
|
// Retrieve columns from the search result, or use an empty array if not available
|
|
65
65
|
const columns = searchResult?.dtdResult?.columns ?? [];
|
|
66
66
|
// If exportDescriptionsForDataLists is true, build a map of values to labels for the columns; otherwise use an empty Map
|
|
67
|
-
const
|
|
67
|
+
const valueToNameMap = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : new Map();
|
|
68
68
|
// Create a Set from selectedRowKeys for efficient lookup
|
|
69
69
|
const selectedSet = new Set(selectedRowKeys);
|
|
70
70
|
// If exporting only selected rows, filter the dataSource accordingly; otherwise use the full dataSource
|
|
@@ -82,8 +82,14 @@ const TMDataGridExportForm = (props) => {
|
|
|
82
82
|
const getValue = (col, value) => {
|
|
83
83
|
// Replace raw value with corresponding label from the map if applicable
|
|
84
84
|
let result = value;
|
|
85
|
-
if (exportDescriptionsForDataLists && col.
|
|
86
|
-
|
|
85
|
+
if (exportDescriptionsForDataLists && col.dataField && valueToNameMap.size > 0) {
|
|
86
|
+
const mapForField = valueToNameMap.get(col.dataField);
|
|
87
|
+
if (mapForField) {
|
|
88
|
+
result = mapForField.get(value) ?? value;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
result = value;
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
// If the column is a datetime type, attempt to format it as a locale date string
|
|
89
95
|
if (col.dataType === 'datetime' && result) {
|
|
@@ -4,31 +4,31 @@ import styled from 'styled-components';
|
|
|
4
4
|
import ContextMenu from 'devextreme-react/context-menu';
|
|
5
5
|
import { FontSize, TMColors } from '../../utils/theme';
|
|
6
6
|
import { genUniqueId } from '../../helper';
|
|
7
|
-
const StyledContent = styled.div `
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
border-radius: ${props => props.$borderRadius};
|
|
10
|
-
color: ${props => props.$color};
|
|
11
|
-
/* background-color: ${props => props.$backgroundColor}; */
|
|
12
|
-
background-color: transparent;
|
|
13
|
-
opacity: ${props => props.$disabled ? 0.4 : 1};
|
|
14
|
-
pointer-events: ${props => props.$disabled ? 'none' : ''};
|
|
15
|
-
user-select: none;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
|
|
19
|
-
&:focus {
|
|
20
|
-
outline: none;
|
|
21
|
-
border-bottom: ${props => props.$disabled ? '' : '2px solid'};
|
|
22
|
-
border-bottom-color: ${TMColors.primary};
|
|
23
|
-
}
|
|
7
|
+
const StyledContent = styled.div `
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
border-radius: ${props => props.$borderRadius};
|
|
10
|
+
color: ${props => props.$color};
|
|
11
|
+
/* background-color: ${props => props.$backgroundColor}; */
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
opacity: ${props => props.$disabled ? 0.4 : 1};
|
|
14
|
+
pointer-events: ${props => props.$disabled ? 'none' : ''};
|
|
15
|
+
user-select: none;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
|
|
19
|
+
&:focus {
|
|
20
|
+
outline: none;
|
|
21
|
+
border-bottom: ${props => props.$disabled ? '' : '2px solid'};
|
|
22
|
+
border-bottom-color: ${TMColors.primary};
|
|
23
|
+
}
|
|
24
24
|
`;
|
|
25
|
-
const StyledMenuItem = styled.div `
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
justify-content: space-between;
|
|
29
|
-
gap: 6px;
|
|
30
|
-
width: 100%;
|
|
31
|
-
font-size: ${FontSize.defaultFontSize};
|
|
25
|
+
const StyledMenuItem = styled.div `
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: space-between;
|
|
29
|
+
gap: 6px;
|
|
30
|
+
width: 100%;
|
|
31
|
+
font-size: ${FontSize.defaultFontSize};
|
|
32
32
|
`;
|
|
33
33
|
const TMDropDownMenu = forwardRef(({ content, items, disabled = false, color = TMColors.text_normal, backgroundColor = TMColors.default_background, borderRadius, onMenuShown }, ref) => {
|
|
34
34
|
const [id, setID] = useState('');
|
|
@@ -8,11 +8,12 @@ import { TMColors } from "../../utils/theme";
|
|
|
8
8
|
import TMPanel from "./TMPanel";
|
|
9
9
|
import { TMSplitterLayout } from "./TMLayout";
|
|
10
10
|
import { ContextMenu, TreeView } from "devextreme-react";
|
|
11
|
-
import Toolbar, { Item as ToolbarItem } from 'devextreme-react/
|
|
11
|
+
import Toolbar, { Item as ToolbarItem } from 'devextreme-react/toolbar';
|
|
12
12
|
import TMButton from "./TMButton";
|
|
13
13
|
import { TMSearchBar } from "../sidebar/TMHeader";
|
|
14
14
|
import TMFileManagerThumbnailsView from "./TMFileManagerThumbnailsView";
|
|
15
15
|
import TMFileManagerDataGridView from "./TMFileManagerDataGridView";
|
|
16
|
+
import { UserListCacheService } from "@topconsultnpm/sdk-ts";
|
|
16
17
|
const TMFileManager = (props) => {
|
|
17
18
|
// Destructure props
|
|
18
19
|
const {
|
|
@@ -44,6 +45,14 @@ const TMFileManager = (props) => {
|
|
|
44
45
|
const [droppedFiles, setDroppedFiles] = useState([]);
|
|
45
46
|
// State to track whether a file drag operation is in progress
|
|
46
47
|
const [isDragging, setIsDragging] = useState(false);
|
|
48
|
+
const [allUsers, setAllUsers] = useState([]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const fetchAllUsers = async () => {
|
|
51
|
+
const users = await UserListCacheService.GetAllAsync();
|
|
52
|
+
setAllUsers(users ?? []);
|
|
53
|
+
};
|
|
54
|
+
fetchAllUsers();
|
|
55
|
+
}, []);
|
|
47
56
|
// useEffect runs whenever `treeFs` changes
|
|
48
57
|
useEffect(() => {
|
|
49
58
|
// Initialize an empty array to hold tree view directory data
|
|
@@ -198,7 +207,7 @@ const TMFileManager = (props) => {
|
|
|
198
207
|
width: "100%",
|
|
199
208
|
height: "100%",
|
|
200
209
|
...(isMobile && { display: openDraftList ? 'block' : 'none', transition: "opacity 0.3s ease-in-out" }),
|
|
201
|
-
}, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [!showPanel && _jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel, btnStyle: 'toolbar', color: 'primaryOutline', icon: isLeftPanelCollapsed ? _jsx(IconHide, {}) : _jsx(IconShow, {}), onClick: () => setIsLeftPanelCollapsed(prev => !prev) }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.
|
|
210
|
+
}, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [!showPanel && _jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel, btnStyle: 'toolbar', color: 'primaryOutline', icon: isLeftPanelCollapsed ? _jsx(IconHide, {}) : _jsx(IconShow, {}), onClick: () => setIsLeftPanelCollapsed(prev => !prev) }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMButton, { caption: viewMode === 'details' ? SDKUI_Localizator.CompactView : SDKUI_Localizator.DetailsView, btnStyle: 'toolbar', color: 'primaryOutline', icon: viewMode === 'details' ? _jsx(IconDashboard, {}) : _jsx(IconList, {}), onClick: toggleViewMode }) }), _jsx(ToolbarItem, { location: "before", children: _jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '200px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, style: {
|
|
202
211
|
width: "100%",
|
|
203
212
|
height: "calc(100% - 40px)",
|
|
204
213
|
position: "relative",
|
|
@@ -219,6 +228,6 @@ const TMFileManager = (props) => {
|
|
|
219
228
|
pointerEvents: "none",
|
|
220
229
|
backdropFilter: "blur(3px)",
|
|
221
230
|
textShadow: "0 2px 4px rgba(0,0,0,0.5)"
|
|
222
|
-
}, children: SDKUI_Localizator.DropFileToShare }), viewMode === 'thumbnails' && _jsx(TMFileManagerThumbnailsView, { items: filteredFileItems ?? [], focusedFile: focusedFile, handleFocusedFile: handleFocusedFile, selectedFiles: selectedFiles, handleSelectedFiles: handleSelectedFiles, fileContextMenuItems: fileContextMenuItems, searchText: searchText, userID: userID, draftThumbViewAnchor: draftThumbViewAnchor, setDraftThumbViewAnchor: setDraftThumbViewAnchor, onDoubleClickHandler: onDoubleClickHandler }), viewMode === 'details' && _jsx(TMFileManagerDataGridView, { items: filteredFileItems ?? [], focusedFile: focusedFile, handleFocusedFile: handleFocusedFile, selectedFiles: selectedFiles, handleSelectedFiles: handleSelectedFiles, fileContextMenuItems: fileContextMenuItems, searchText: searchText, userID: userID, onDoubleClickHandler: onDoubleClickHandler })] })] })] }) }) });
|
|
231
|
+
}, children: SDKUI_Localizator.DropFileToShare }), viewMode === 'thumbnails' && _jsx(TMFileManagerThumbnailsView, { items: filteredFileItems ?? [], allUsers: allUsers, focusedFile: focusedFile, handleFocusedFile: handleFocusedFile, selectedFiles: selectedFiles, handleSelectedFiles: handleSelectedFiles, fileContextMenuItems: fileContextMenuItems, searchText: searchText, userID: userID, draftThumbViewAnchor: draftThumbViewAnchor, setDraftThumbViewAnchor: setDraftThumbViewAnchor, onDoubleClickHandler: onDoubleClickHandler }), viewMode === 'details' && _jsx(TMFileManagerDataGridView, { items: filteredFileItems ?? [], allUsers: allUsers, focusedFile: focusedFile, handleFocusedFile: handleFocusedFile, selectedFiles: selectedFiles, handleSelectedFiles: handleSelectedFiles, fileContextMenuItems: fileContextMenuItems, searchText: searchText, userID: userID, onDoubleClickHandler: onDoubleClickHandler })] })] })] }) }) });
|
|
223
232
|
};
|
|
224
233
|
export default TMFileManager;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FileItem, TMFileManagerContextMenuItem } from "./TMFileManagerUtils";
|
|
2
|
+
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
2
3
|
interface TMFileManagerDataGridViewProps {
|
|
3
4
|
items: Array<FileItem>;
|
|
5
|
+
allUsers: Array<UserDescriptor>;
|
|
4
6
|
focusedFile: FileItem | undefined;
|
|
5
7
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
6
8
|
selectedFiles: Array<FileItem>;
|
|
@@ -5,7 +5,7 @@ import TMDataGrid from "./TMDataGrid";
|
|
|
5
5
|
import TMDcmtIcon from "../features/documents/TMDcmtIcon";
|
|
6
6
|
import TMTooltip from "./TMTooltip";
|
|
7
7
|
const TMFileManagerDataGridView = (props) => {
|
|
8
|
-
const { items, focusedFile, handleFocusedFile, selectedFiles, handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler } = props;
|
|
8
|
+
const { items, allUsers, focusedFile, handleFocusedFile, selectedFiles, handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler } = props;
|
|
9
9
|
// State hook to store the currently focused row key, initially set to undefined
|
|
10
10
|
const [focusedRowKey, setFocusedRowKey] = useState(focusedFile?.id);
|
|
11
11
|
// State to store selected row keys
|
|
@@ -16,6 +16,15 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
setSelectedRowKeys(selectedFiles.map(selectedFile => selectedFile.id));
|
|
18
18
|
}, [selectedFiles]);
|
|
19
|
+
const findCheckOutUserName = useCallback((checkOutUserName, checkOutUserID) => {
|
|
20
|
+
if (checkOutUserName) {
|
|
21
|
+
return checkOutUserName;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
let checkOutUser = allUsers.find(user => user.id === checkOutUserID);
|
|
25
|
+
return checkOutUser ? checkOutUser.name : '-';
|
|
26
|
+
}
|
|
27
|
+
}, [allUsers]);
|
|
19
28
|
// DataGrid Callback
|
|
20
29
|
// Handles focus change in the data grid
|
|
21
30
|
const onFocusedRowChanged = useCallback((e) => {
|
|
@@ -58,7 +67,7 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
58
67
|
const checkoutUsedId = checkOutUserID;
|
|
59
68
|
const editMode = checkoutDate && checkoutUsedId && userID && userID === checkoutUsedId;
|
|
60
69
|
const lockMode = checkoutDate && checkoutUsedId && userID && userID !== checkoutUsedId;
|
|
61
|
-
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), lockMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", 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 }), ": ", checkOutUserName ?? '-', " (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] }) }), _jsx("hr", {}), _jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Type }), ": ", ext] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.CreationTime }), ": ", Globalization.getDateTimeDisplayValue(creationTime?.toString())] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.LastUpdateTime }), ": ", Globalization.getDateTimeDisplayValue(lastUpdateTime?.toString())] })] })] })] });
|
|
70
|
+
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), lockMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: "#28a745", 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(checkOutUserName, 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] }) }), _jsx("hr", {}), _jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Type }), ": ", ext] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.CreationTime }), ": ", Globalization.getDateTimeDisplayValue(creationTime?.toString())] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.LastUpdateTime }), ": ", Globalization.getDateTimeDisplayValue(lastUpdateTime?.toString())] })] })] })] });
|
|
62
71
|
return _jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: "4px" }, children: [editMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-edit" }) }), lockMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: "#28a745", fontWeight: "bold" }, className: "dx-icon-lock" }) }), renderHighlightedText(cellData.value, searchText, false)] });
|
|
63
72
|
}, [searchText]);
|
|
64
73
|
const cellExtRender = useCallback((cellData) => {
|
|
@@ -87,6 +96,6 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
87
96
|
{ dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
|
|
88
97
|
];
|
|
89
98
|
}, [searchText]);
|
|
90
|
-
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty });
|
|
99
|
+
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty }, items.length);
|
|
91
100
|
};
|
|
92
101
|
export default TMFileManagerDataGridView;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileItem } from './TMFileManagerUtils';
|
|
3
|
+
import { UserDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
4
|
export interface TMFileManagerThumbnailItemsProps {
|
|
4
5
|
items: Array<FileItem>;
|
|
6
|
+
allUsers: Array<UserDescriptor>;
|
|
5
7
|
paginatedItems: Array<FileItem>;
|
|
6
8
|
focusedFile: FileItem | undefined;
|
|
7
9
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
@@ -6,7 +6,7 @@ import TMTooltip from './TMTooltip';
|
|
|
6
6
|
import TMDcmtIcon from '../features/documents/TMDcmtIcon';
|
|
7
7
|
const TMFileManagerThumbnailItems = (props) => {
|
|
8
8
|
// Destructuring props for cleaner usage
|
|
9
|
-
const { items, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile, setDraftThumbViewAnchor } = props;
|
|
9
|
+
const { items, allUsers, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile, setDraftThumbViewAnchor } = props;
|
|
10
10
|
// Ref for the scrollable container
|
|
11
11
|
const containerRef = useRef(null);
|
|
12
12
|
// Stores index of the last selected item for shift selection
|
|
@@ -112,6 +112,16 @@ const TMFileManagerThumbnailItems = (props) => {
|
|
|
112
112
|
setDraftThumbViewAnchor(e.currentTarget);
|
|
113
113
|
handleFocusedFile(item);
|
|
114
114
|
}, []);
|
|
115
|
+
const findCheckOutUserName = useCallback((item) => {
|
|
116
|
+
if (item.checkOutUserName) {
|
|
117
|
+
return item.checkOutUserName;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const checkOutUserID = item.checkOutUserID;
|
|
121
|
+
let checkOutUser = allUsers.find(user => user.id === checkOutUserID);
|
|
122
|
+
return checkOutUser ? checkOutUser.name : '-';
|
|
123
|
+
}
|
|
124
|
+
}, [allUsers]);
|
|
115
125
|
return _jsx("div", { style: { width: "100%", height: "100%" }, children: paginatedItems.map(item => {
|
|
116
126
|
const isSelected = selectedFiles?.map(file => file.id).includes(item.id) ?? false;
|
|
117
127
|
const checkoutDate = item.checkoutDate;
|
|
@@ -130,7 +140,7 @@ const TMFileManagerThumbnailItems = (props) => {
|
|
|
130
140
|
bgColor = isSelected ? colors.PRIMARY_BLUE : backgroundColors.lockMode;
|
|
131
141
|
bgHoverColor = isSelected ? colors.PRIMARY_BLUE : "#fff59d";
|
|
132
142
|
}
|
|
133
|
-
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), 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 }), ": ", item
|
|
143
|
+
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), 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(item) ?? '-', " (ID: ", item.checkOutUserID, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(item.checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", item.version ?? 1] }) }), _jsx("hr", {}), _jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Type }), ": ", item.ext] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.CreationTime }), ": ", Globalization.getDateTimeDisplayValue(item.creationTime?.toString())] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.LastUpdateTime }), ": ", Globalization.getDateTimeDisplayValue(item.lastUpdateTime?.toString())] })] })] })] });
|
|
134
144
|
const tooltipContent = (_jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "ID:" }), " ", item.id ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "DID:" }), " ", item.did ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "TID:" }), " ", item.tid ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Name, ":"] }), " ", item.name ?? '-'] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Author, ":"] }), " ", item.updaterName ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Version, ":"] }), " ", item.version] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Size, ":"] }), " ", formatBytes(item.size ?? 0)] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.CreationTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.creationTime)] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.LastUpdateTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.lastUpdateTime)] })] }));
|
|
135
145
|
return _jsx(TMFileItemContainer, { className: "tm-file-manager-thumbnail-items", ref: containerRef, id: "tm-file-manager-thumbnail-item-" + item.id.toString(), "$backgroundColor": bgColor, "$bgHoverColor": bgHoverColor, "$textColor": textColor, onDoubleClick: () => onDoubleClickHandler(item), onContextMenu: (e) => onContextMenu(e, item), onClick: (e) => onClickHandler(e, item), tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', flex: 1, minWidth: 0 }, children: [_jsxs("div", { style: { marginRight: '16px', flexShrink: 0 }, children: [_jsx(TMDcmtIcon, { tid: item.tid, did: item.did, fileExtension: item.ext, downloadMode: 'openInNewWindow', tooltipContent: tooltipContent }), editMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: !isSelected ? colors.MEDIUM_GREEN : '#fff', fontWeight: "bold" }, className: "dx-icon-edit" }) }), lockMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: !isSelected ? colors.MEDIUM_GREEN : '#fff', fontWeight: "bold" }, className: "dx-icon-lock" }) })] }), _jsxs("div", { style: { overflow: 'hidden', minWidth: 0 }, children: [_jsx("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block', fontSize: '1rem', fontWeight: "bold" }, children: _jsx(TMTooltip, { parentStyle: { overflow: 'hidden' }, childStyle: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block' }, children: renderHighlightedText(item.name, searchText, isSelected) }) }), _jsx("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block', fontSize: 'calc(1rem - 1px)' }, children: formatBytes(item.size ?? 0) })] })] }), item.version && (_jsx("div", { style: { flexShrink: 0, marginLeft: '12px', whiteSpace: 'nowrap' }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: _jsx("div", { style: { border: "2px solid #28a745", backgroundColor: "#28a745", color: "#ffffff", borderRadius: '50%', width: '30px', height: '30px', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '12px', fontWeight: 'bold' }, children: item.version }) }) }))] }) }, "tm-file-manager-thumbnail-item-" + item.id);
|
|
136
146
|
}) });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FileItem, TMFileManagerContextMenuItem } from "./TMFileManagerUtils";
|
|
3
|
+
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
4
|
interface TMFileManagerThumbnailsViewProps {
|
|
4
5
|
items: Array<FileItem>;
|
|
6
|
+
allUsers: Array<UserDescriptor>;
|
|
5
7
|
focusedFile: FileItem | undefined;
|
|
6
8
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
7
9
|
selectedFiles: Array<FileItem>;
|
|
@@ -5,7 +5,7 @@ import { ContextMenu, Pagination, ScrollView } from "devextreme-react";
|
|
|
5
5
|
import TMFileManagerThumbnailItems from "./TMFileManagerThumbnailItems";
|
|
6
6
|
import { SDKUI_Localizator } from "../../helper";
|
|
7
7
|
const TMFileManagerThumbnailsView = (props) => {
|
|
8
|
-
const { items, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler, draftThumbViewAnchor, setDraftThumbViewAnchor } = props;
|
|
8
|
+
const { items, allUsers, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler, draftThumbViewAnchor, setDraftThumbViewAnchor } = props;
|
|
9
9
|
const PAGE_SIZES = [TMFileManagerPageSize.Small, TMFileManagerPageSize.Medium, TMFileManagerPageSize.Large];
|
|
10
10
|
const initPageSize = TMFileManagerPageSize.Small;
|
|
11
11
|
const showPagination = (items?.length ?? 0) > initPageSize;
|
|
@@ -39,7 +39,7 @@ const TMFileManagerThumbnailsView = (props) => {
|
|
|
39
39
|
handleSelectedFiles?.([]);
|
|
40
40
|
};
|
|
41
41
|
return items.length > 0 ?
|
|
42
|
-
_jsxs("div", { style: { width: "100%", height: "100%" }, onContextMenu: onBackgroundContextMenu, children: [_jsx(ScrollView, { width: "100%", height: showPagination ? "calc(100% - 50px)" : "100%", useNative: true, direction: 'vertical', children: _jsx(TMFileManagerThumbnailItems, { items: items, paginatedItems: paginatedItems, focusedFile: focusedFile, selectedFiles: selectedFiles, userID: userID, searchText: searchText, handleFocusedFile: handleFocusedFile, handleSelectedFiles: handleSelectedFiles, onDoubleClick: handleItemDoubleClick, setDraftThumbViewAnchor: setDraftThumbViewAnchor }) }), showPagination && _jsx(Pagination, { height: "50px", showInfo: true, showNavigationButtons: true, allowedPageSizes: PAGE_SIZES, displayMode: 'compact', itemCount: items.length, pageIndex: pageIndex, pageSize: pageSize, onPageIndexChange: setPageIndex, onPageSizeChange: setPageSize }), draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] })
|
|
42
|
+
_jsxs("div", { style: { width: "100%", height: "100%" }, onContextMenu: onBackgroundContextMenu, children: [_jsx(ScrollView, { width: "100%", height: showPagination ? "calc(100% - 50px)" : "100%", useNative: true, direction: 'vertical', children: _jsx(TMFileManagerThumbnailItems, { items: items, allUsers: allUsers, paginatedItems: paginatedItems, focusedFile: focusedFile, selectedFiles: selectedFiles, userID: userID, searchText: searchText, handleFocusedFile: handleFocusedFile, handleSelectedFiles: handleSelectedFiles, onDoubleClick: handleItemDoubleClick, setDraftThumbViewAnchor: setDraftThumbViewAnchor }) }), showPagination && _jsx(Pagination, { height: "50px", showInfo: true, showNavigationButtons: true, allowedPageSizes: PAGE_SIZES, displayMode: 'compact', itemCount: items.length, pageIndex: pageIndex, pageSize: pageSize, onPageIndexChange: setPageIndex, onPageSizeChange: setPageSize }), draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] })
|
|
43
43
|
:
|
|
44
44
|
_jsxs("div", { onContextMenu: onBackgroundContextMenu, style: { width: "100%", height: "100%", display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: '10px' }, children: [SDKUI_Localizator.FolderIsEmpty, draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] });
|
|
45
45
|
};
|
|
@@ -15,25 +15,25 @@ export const colors = {
|
|
|
15
15
|
LIGHT_YELLOW: "#fff9c4",
|
|
16
16
|
MEDIUM_GREEN: "#28a745",
|
|
17
17
|
};
|
|
18
|
-
export const TMFileItemContainer = styled.div `
|
|
19
|
-
border: 1px solid #ddd;
|
|
20
|
-
border-radius: 8px;
|
|
21
|
-
background-color: ${({ $backgroundColor }) => $backgroundColor ?? colors.LIGHT_GRAY};
|
|
22
|
-
color: ${({ $textColor }) => $textColor ?? colors.BLACK};
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
margin: 10px 5px;
|
|
25
|
-
padding: 8px;
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
min-width: 100px;
|
|
29
|
-
gap: 4px;
|
|
30
|
-
&:hover {
|
|
31
|
-
background-color: ${({ $bgHoverColor }) => $bgHoverColor ?? '#e0e0e0'};
|
|
32
|
-
border-color: #999;
|
|
33
|
-
}
|
|
34
|
-
&:focus {
|
|
35
|
-
outline: none;
|
|
36
|
-
}
|
|
18
|
+
export const TMFileItemContainer = styled.div `
|
|
19
|
+
border: 1px solid #ddd;
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
background-color: ${({ $backgroundColor }) => $backgroundColor ?? colors.LIGHT_GRAY};
|
|
22
|
+
color: ${({ $textColor }) => $textColor ?? colors.BLACK};
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
margin: 10px 5px;
|
|
25
|
+
padding: 8px;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
min-width: 100px;
|
|
29
|
+
gap: 4px;
|
|
30
|
+
&:hover {
|
|
31
|
+
background-color: ${({ $bgHoverColor }) => $bgHoverColor ?? '#e0e0e0'};
|
|
32
|
+
border-color: #999;
|
|
33
|
+
}
|
|
34
|
+
&:focus {
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
37
|
`;
|
|
38
38
|
// Function to find a specific file or folder based on its ID (used for finding nested items)
|
|
39
39
|
export const findFileItems = (items, id) => {
|