@topconsultnpm/sdkui-react 6.19.0-dev2.5 → 6.19.0-dev2.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/lib/components/base/TMButton.d.ts +1 -0
  2. package/lib/components/base/TMButton.js +6 -6
  3. package/lib/components/base/TMCustomButton.d.ts +1 -1
  4. package/lib/components/base/TMCustomButton.js +83 -28
  5. package/lib/components/base/TMDataGridExportForm.d.ts +1 -1
  6. package/lib/components/base/TMDataGridExportForm.js +9 -3
  7. package/lib/components/base/TMFileManager.js +12 -3
  8. package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
  9. package/lib/components/base/TMFileManagerDataGridView.js +12 -3
  10. package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
  11. package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
  12. package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
  13. package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
  14. package/lib/components/base/TMModal.d.ts +2 -0
  15. package/lib/components/base/TMModal.js +13 -2
  16. package/lib/components/base/TMTooltip.d.ts +1 -1
  17. package/lib/components/base/TMTooltip.js +1 -1
  18. package/lib/components/base/TMWaitPanel.js +8 -2
  19. package/lib/components/choosers/TMDcmtTypeChooser.js +2 -2
  20. package/lib/components/choosers/TMMetadataChooser.d.ts +4 -1
  21. package/lib/components/choosers/TMMetadataChooser.js +31 -8
  22. package/lib/components/choosers/TMUserChooser.d.ts +4 -0
  23. package/lib/components/choosers/TMUserChooser.js +21 -5
  24. package/lib/components/editors/TMDateBox.d.ts +1 -1
  25. package/lib/components/editors/TMTextArea.d.ts +1 -0
  26. package/lib/components/editors/TMTextArea.js +43 -9
  27. package/lib/components/editors/TMTextBox.js +33 -3
  28. package/lib/components/editors/TMTextExpression.js +36 -28
  29. package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +28 -0
  30. package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +324 -0
  31. package/lib/components/features/assistant/ToppyHelpCenter.js +1 -1
  32. package/lib/components/features/assistant/ToppySpeechBubble.d.ts +8 -0
  33. package/lib/components/features/assistant/ToppySpeechBubble.js +53 -0
  34. package/lib/components/features/blog/TMBlogCommentForm.d.ts +2 -0
  35. package/lib/components/features/blog/TMBlogCommentForm.js +18 -6
  36. package/lib/components/features/documents/TMDcmtBlog.js +1 -1
  37. package/lib/components/features/documents/TMDcmtForm.js +313 -57
  38. package/lib/components/features/documents/TMDcmtPreview.js +45 -8
  39. package/lib/components/features/documents/TMRelationViewer.js +56 -23
  40. package/lib/components/features/search/TMSavedQuerySelector.js +1 -1
  41. package/lib/components/features/search/TMSearch.js +2 -2
  42. package/lib/components/features/search/TMSearchQueryEditor.js +1 -1
  43. package/lib/components/features/search/TMSearchQueryPanel.js +8 -25
  44. package/lib/components/features/search/TMSearchResult.js +94 -13
  45. package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +2 -1
  46. package/lib/components/features/search/TMSearchResultsMenuItems.js +97 -51
  47. package/lib/components/features/tasks/TMTaskForm.js +11 -5
  48. package/lib/components/features/tasks/TMTasksAgenda.js +4 -4
  49. package/lib/components/features/tasks/TMTasksCalendar.js +2 -2
  50. package/lib/components/features/tasks/TMTasksHeader.js +1 -1
  51. package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -1
  52. package/lib/components/features/tasks/TMTasksUtils.js +18 -3
  53. package/lib/components/features/tasks/TMTasksUtilsView.js +26 -4
  54. package/lib/components/features/tasks/TMTasksView.js +12 -6
  55. package/lib/components/features/workflow/TMWorkflowPopup.js +3 -3
  56. package/lib/components/features/workflow/diagram/DiagramItemForm.js +8 -3
  57. package/lib/components/forms/TMResultDialog.js +8 -2
  58. package/lib/components/forms/TMSaveForm.js +2 -2
  59. package/lib/components/grids/TMBlogsPost.d.ts +8 -3
  60. package/lib/components/grids/TMBlogsPost.js +73 -11
  61. package/lib/components/grids/TMBlogsPostUtils.d.ts +1 -0
  62. package/lib/components/grids/TMBlogsPostUtils.js +15 -3
  63. package/lib/components/grids/TMRecentsManager.js +1 -1
  64. package/lib/components/index.d.ts +2 -1
  65. package/lib/components/index.js +2 -1
  66. package/lib/components/layout/panelManager/TMPanelManagerContainer.d.ts +1 -0
  67. package/lib/components/layout/panelManager/TMPanelManagerContainer.js +2 -2
  68. package/lib/components/layout/panelManager/TMPanelManagerContext.js +0 -1
  69. package/lib/components/layout/panelManager/TMPanelManagerToolbar.js +2 -1
  70. package/lib/components/layout/panelManager/types.d.ts +1 -0
  71. package/lib/components/pages/TMPage.js +1 -1
  72. package/lib/components/settings/SettingsAppearance.js +5 -5
  73. package/lib/components/viewers/TMDataListItemViewer.d.ts +1 -1
  74. package/lib/components/viewers/TMMidViewer.d.ts +1 -1
  75. package/lib/components/viewers/TMTidViewer.d.ts +1 -1
  76. package/lib/helper/GlobalStyles.d.ts +2 -0
  77. package/lib/helper/GlobalStyles.js +10 -0
  78. package/lib/helper/Globalization.d.ts +1 -0
  79. package/lib/helper/Globalization.js +30 -0
  80. package/lib/helper/SDKUI_Localizator.d.ts +39 -2
  81. package/lib/helper/SDKUI_Localizator.js +392 -22
  82. package/lib/helper/TMCustomSearchBar.js +1 -1
  83. package/lib/helper/TMIcons.d.ts +4 -1
  84. package/lib/helper/TMIcons.js +13 -1
  85. package/lib/helper/TMUtils.d.ts +1 -4
  86. package/lib/helper/TMUtils.js +18 -23
  87. package/lib/helper/dcmtsHelper.d.ts +2 -1
  88. package/lib/helper/dcmtsHelper.js +56 -17
  89. package/lib/helper/helpers.js +5 -1
  90. package/lib/helper/index.d.ts +1 -0
  91. package/lib/helper/index.js +1 -0
  92. package/lib/hooks/useRelatedDocuments.js +35 -26
  93. package/lib/ts/types.d.ts +3 -1
  94. package/package.json +8 -8
@@ -16,6 +16,7 @@ export interface ITMButton extends ITMEditorBase {
16
16
  padding?: string;
17
17
  showTooltip?: boolean;
18
18
  onClick?: VoidFunction;
19
+ onMouseDown?: (e: any) => any;
19
20
  }
20
21
  declare const TMButton: React.ForwardRefExoticComponent<ITMButton & React.RefAttributes<HTMLButtonElement>>;
21
22
  export default TMButton;
@@ -145,23 +145,23 @@ const StyledAdvancedButtonText = styled.div `
145
145
  padding: 5px;
146
146
  `;
147
147
  const TMButton = forwardRef((props, ref) => {
148
- const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { } } = props;
148
+ const { width, height, keyGesture, btnStyle = 'normal', advancedColor, advancedType = 'primary', color = 'primary', fontSize = FontSize.defaultFontSize, disabled = false, showTooltip = true, caption, icon, description, padding, elementStyle, onClick = () => { }, onMouseDown = () => { } } = props;
149
149
  const [isHovered, setIsHovered] = useState(false);
150
150
  const renderedButton = () => {
151
151
  if (btnStyle === 'normal') {
152
- return (_jsx(StyledNormalButton, { ref: ref, width: width, height: height, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: caption }));
152
+ return (_jsx(StyledNormalButton, { ref: ref, width: width, height: height, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
153
153
  }
154
154
  else if (btnStyle === 'toolbar') {
155
- return (_jsx(StyledToolbarButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: icon }));
155
+ return (_jsx(StyledToolbarButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: icon }));
156
156
  }
157
157
  else if (btnStyle === 'icon') {
158
- return (_jsx(StyledIconButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, children: icon }));
158
+ return (_jsx(StyledIconButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, padding: padding, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: icon }));
159
159
  }
160
160
  else if (btnStyle === 'advanced') {
161
- return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: caption })] }));
161
+ return (_jsxs(StyledAdvancedButton, { ref: ref, "$width": width ?? '90px', "$height": height ?? '30px', onMouseOver: () => !disabled && setIsHovered(true), onMouseOut: () => setIsHovered(false), "$isDisabled": disabled, "$isPrimaryOutline": advancedType === 'primary' && (advancedColor === 'primaryOutline' || color === 'primaryOutline'), onClick: () => !disabled && onClick?.(), onMouseDown: (e) => !disabled && onMouseDown?.(e), children: [_jsx(StyledAdvancedButtonIcon, { "$color": advancedColor, "$isVisible": isHovered, "$isDisabled": disabled, "$type": advancedType, children: icon }), _jsx(StyledAdvancedButtonText, { "$color": advancedColor, "$isDisabled": disabled, "$type": advancedType, children: caption })] }));
162
162
  }
163
163
  else {
164
- return (_jsx(StyledTextButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, children: caption }));
164
+ return (_jsx(StyledTextButton, { ref: ref, color: color, caption: caption, disabled: disabled, fontSize: fontSize, onClick: onClick, onMouseDown: (e) => !disabled && onMouseDown?.(e), children: caption }));
165
165
  }
166
166
  };
167
167
  const renderTooltip = () => {
@@ -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 | null;
10
+ declare const TMCustomButton: (props: TMCustomButtonProps) => false | import("react/jsx-runtime").JSX.Element;
11
11
  export default TMCustomButton;
@@ -1,13 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { SDK_Globals } from '@topconsultnpm/sdk-ts';
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 { processButtonAttributes } from '../../helper/dcmtsHelper';
5
+ import { SDKUI_Localizator, TMLayoutWaitingContainer } from '../..';
6
+ import { getButtonAttributes, getSelectedItem } from '../../helper/dcmtsHelper';
7
7
  const IframeContainer = styled.div `
8
8
  display: flex;
9
9
  height: 100%;
10
10
  flex-direction: column;
11
+ padding-left: 15px;
11
12
  `;
12
13
  const StyledIframe = styled.iframe `
13
14
  border: none;
@@ -17,47 +18,101 @@ 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 = processButtonAttributes(args, formData);
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 getTargetOrigin = (url) => {
24
- if (!url)
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(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
- // Timeout di sicurezza nel caso l'evento 'error' non venga chiamato
51
- const timeoutIframe = setTimeout(() => {
52
- if (loading)
53
- handleError();
54
- }, 5000); // 5 secondi
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
- }, [isModal, scriptUrl, onClose]);
61
- return isModal ? (_jsx(TMModal, { title: button.title, width: '60%', height: '60%', resizable: true, onClose: onClose, children: _jsxs(IframeContainer, { 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 })] }) })) : null;
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;
@@ -1,4 +1,4 @@
1
- import { IColumnProps } from 'devextreme-react/cjs/data-grid';
1
+ import { IColumnProps } from 'devextreme-react/data-grid';
2
2
  import { SearchResultDescriptor } from '@topconsultnpm/sdk-ts';
3
3
  export type FormatOption = {
4
4
  value: 'csv' | 'xlsx' | 'xls' | 'txt';
@@ -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 { valueToNameMap, captions } = exportDescriptionsForDataLists ? await buildValueToLabelMapFromDataColumns(columns) : { valueToNameMap: new Map(), captions: new Set() };
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.caption && captions.has(col.caption.toString())) {
86
- result = valueToNameMap.get(value) ?? value;
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) {
@@ -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/cjs/toolbar';
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.PreviewView : 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: {
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.checkOutUserName ?? '-', " (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())] })] })] })] });
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
  };
@@ -8,9 +8,11 @@ interface ITMModal {
8
8
  fontSize?: string;
9
9
  isModal?: boolean;
10
10
  resizable?: boolean;
11
+ expandable?: boolean;
11
12
  onClose?: () => void;
12
13
  hidePopup?: boolean;
13
14
  askClosingConfirm?: boolean;
15
+ showCloseButton?: boolean;
14
16
  }
15
17
  declare const TMModal: React.FC<ITMModal>;
16
18
  export default TMModal;
@@ -4,6 +4,7 @@ import { Popup } from 'devextreme-react';
4
4
  import styled from 'styled-components';
5
5
  import TMLayoutContainer, { TMCard, TMLayoutItem } from './TMLayout';
6
6
  import { FontSize, TMColors } from '../../utils/theme';
7
+ import { IconWindowMaximize, IconWindowMinimize, svgToString } from '../../helper';
7
8
  const StyledModal = styled.div `
8
9
  width: ${props => props.$width};
9
10
  height: ${props => props.$height};
@@ -38,11 +39,12 @@ const StyledModalContext = styled.div `
38
39
  overflow: auto;
39
40
  height: 100%;
40
41
  `;
41
- const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false }) => {
42
+ const TMModal = ({ resizable = true, expandable = false, isModal = true, title = '', toolbar, onClose, children, width = '100%', height = '100%', fontSize = FontSize.defaultFontSize, hidePopup = true, askClosingConfirm = false, showCloseButton = true }) => {
42
43
  const [initialWidth, setInitialWidth] = useState(width);
43
44
  const [initialHeight, setInitialHeight] = useState(height);
44
45
  const [showPopup, setShowPopup] = useState(false);
45
46
  const [isResizing, setIsResizing] = useState(false);
47
+ const [isFullScreen, setIsFullScreen] = useState(false);
46
48
  useEffect(() => {
47
49
  setShowPopup(isModal);
48
50
  }, [isModal]);
@@ -65,6 +67,15 @@ const TMModal = ({ resizable = true, isModal = true, title = '', toolbar, onClos
65
67
  setShowPopup(false);
66
68
  onClose && onClose();
67
69
  };
68
- return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { showCloseButton: true, animation: undefined, maxHeight: '95%', maxWidth: '95%', dragEnabled: !isResizing, resizeEnabled: resizable, width: initialWidth, height: initialHeight, title: title, visible: showPopup, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd, onHiding: onHiding, children: _jsxs(TMLayoutContainer, { children: [toolbar && (_jsx(TMLayoutItem, { height: "40px", children: _jsx(StyledModalToolbar, { children: toolbar }) })), _jsx(TMLayoutItem, { height: toolbar ? 'calc(100% - 50px)' : 'calc(100% - 10px)', children: _jsx(TMCard, { showBorder: false, padding: false, scrollY: true, children: children }) })] }) })) : (_jsxs(StyledModal, { "$isModal": isModal, className: "temp-modal", "$fontSize": fontSize, "$width": initialWidth, "$height": initialHeight, children: [toolbar ? _jsx(StyledModalToolbar, { children: toolbar }) : _jsx(_Fragment, {}), _jsx(StyledModalContext, { children: children })] })) }));
70
+ return (_jsx(_Fragment, { children: isModal ? (_jsx(Popup, { showCloseButton: showCloseButton, animation: undefined, maxHeight: '95%', maxWidth: '95%', dragEnabled: !isResizing, resizeEnabled: resizable, width: expandable && isFullScreen ? '95%' : initialWidth, height: expandable && isFullScreen ? '95%' : initialHeight, title: title, visible: showPopup, onResizeStart: handleResizeStart, onResizeEnd: handleResizeEnd, onHiding: onHiding, toolbarItems: expandable ? [
71
+ {
72
+ widget: 'dxButton',
73
+ location: 'after',
74
+ options: {
75
+ icon: isFullScreen ? svgToString(_jsx(IconWindowMinimize, {})) : svgToString(_jsx(IconWindowMaximize, {})),
76
+ onClick: () => setIsFullScreen(!isFullScreen)
77
+ }
78
+ }
79
+ ] : undefined, children: _jsxs(TMLayoutContainer, { children: [toolbar && (_jsx(TMLayoutItem, { height: "40px", children: _jsx(StyledModalToolbar, { children: toolbar }) })), _jsx(TMLayoutItem, { height: toolbar ? 'calc(100% - 50px)' : 'calc(100% - 10px)', children: _jsx(TMCard, { showBorder: false, padding: false, scrollY: true, children: children }) })] }) })) : (_jsxs(StyledModal, { "$isModal": isModal, className: "temp-modal", "$fontSize": fontSize, "$width": initialWidth, "$height": initialHeight, children: [toolbar ? _jsx(StyledModalToolbar, { children: toolbar }) : _jsx(_Fragment, {}), _jsx(StyledModalContext, { children: children })] })) }));
69
80
  };
70
81
  export default TMModal;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ITooltipOptions } from 'devextreme-react/cjs/tooltip';
2
+ import { ITooltipOptions } from 'devextreme-react/tooltip';
3
3
  import { Position } from 'devextreme/common';
4
4
  import { PositionConfig } from 'devextreme/animation/position';
5
5
  interface ITMTooltipProps extends ITooltipOptions {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
- import { Tooltip } from 'devextreme-react/cjs/tooltip';
3
+ import { Tooltip } from 'devextreme-react/tooltip';
4
4
  import { genUniqueId } from '../../helper';
5
5
  import { DeviceType, useDeviceType } from './TMDeviceProvider';
6
6
  const TMTooltip = ({ children, position, content, hideAfterDelay, parentStyle, childStyle }) => {
@@ -33,8 +33,14 @@ const StyledProgressText = styled.p ` font-weight: bold; color: #333; margin: 0;
33
33
  const StyledMessage = styled.p ` color: #666; font-size: 0.9em; margin-top: 10px; `;
34
34
  const StyledAbortButton = styled.button ` background: #ff4d4d; color: white; border: none; border-radius: 5px; padding: 10px 20px; font-size: 1em; cursor: pointer; margin-top: 20px; &:hover { background: #ff6666; } `;
35
35
  export const TMWaitPanel = (props) => {
36
- let progressValue1 = 100 * (((props.valuePrimary ?? 0) / (props.maxValuePrimary ?? 0)) || 0);
37
- let progressValue2 = 100 * (((props.valueSecondary ?? 0) / (props.maxValueSecondary ?? 0)) || 0);
36
+ const calculateProgress = (value = 0, maxValue = 0) => {
37
+ if (maxValue === 0)
38
+ return 0;
39
+ const progress = (value / maxValue) * 100;
40
+ return Number.isFinite(progress) ? progress : 0;
41
+ };
42
+ let progressValue1 = calculateProgress(props.valuePrimary, props.maxValuePrimary);
43
+ let progressValue2 = calculateProgress(props.valueSecondary, props.maxValueSecondary);
38
44
  return (_jsx(StyledWaitPanelOverlay, { children: _jsxs(StyledWaitPanel, { "$height": (props.showPrimary && props.showSecondary) ? '350px' : '250px', children: [_jsx(StyledTitle, { children: props.title }), props.showPrimary &&
39
45
  _jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue1.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue1.toFixed(2), "%"] }), _jsx(StyledMessage, { children: props.textPrimary })] }), props.showSecondary &&
40
46
  _jsxs("div", { style: { width: '100%', height: '100px' }, children: [_jsx(StyledProgressBarContainer, { children: _jsx(StyledProgressBar, { style: { width: `${progressValue2.toFixed(2)}%` } }) }), _jsxs(StyledProgressText, { children: [progressValue2.toFixed(2), "%"] }), _jsx(StyledMessage, { children: props.textSecondary })] }), props.isCancelable && _jsx(StyledAbortButton, { onClick: () => props.onAbortClick?.(props.abortController), children: SDKUI_Localizator.Abort })] }) }));
@@ -23,7 +23,7 @@ const TMDcmtTypeChooser = ({ tmSession, dataSource, disabled, backgroundColor, f
23
23
  export default TMDcmtTypeChooser;
24
24
  const cellRenderIcon = (data) => _jsx(TMDcmtTypeIcon, { dtd: data.data });
25
25
  const cellRenderNameAndDesc = (data) => _jsx("p", { style: { textAlign: 'left', color: data.data.isView ? 'red' : '' }, children: data.value });
26
- export const TMDcmtTypeChooserForm = ({ tmSession, allowMultipleSelection, width, height, selectedIDs, dataSource, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, accessFilter = 'all', filter, onClose, onChoose }) => {
26
+ export const TMDcmtTypeChooserForm = ({ tmSession, allowMultipleSelection, width, height, selectedIDs, dataSource, ShowOnlyDcmtTypes, ShowOnlySAP, filterTemplateTID, accessFilter = 'all', startWithShowOnlySelectedItems = true, filter, onClose, onChoose }) => {
27
27
  const isPermitted = (accessLevel) => accessLevel === AccessLevelsEx.Yes || accessLevel === AccessLevelsEx.Mixed;
28
28
  const getItems = async (refreshCache) => {
29
29
  let tms = tmSession ?? SDK_Globals.tmSession;
@@ -57,5 +57,5 @@ export const TMDcmtTypeChooserForm = ({ tmSession, allowMultipleSelection, width
57
57
  return false;
58
58
  return true;
59
59
  };
60
- return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, width: width, height: height, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
60
+ return (_jsx(TMChooserForm, { title: SDK_Localizator.ListDcmtTypeOrView, allowMultipleSelection: allowMultipleSelection, hasShowOnlySelectedItems: true, startWithShowOnlySelectedItems: startWithShowOnlySelectedItems, width: width, height: height, selectedIDs: selectedIDs, cellRenderIcon: cellRenderIcon, cellRenderNameAndDesc: cellRenderNameAndDesc, dataSource: dataSource, getItems: getItems, onClose: onClose, onChoose: (IDs) => onChoose?.(IDs) }));
61
61
  };
@@ -2,6 +2,9 @@ import React from 'react';
2
2
  import { MetadataDescriptor, QueryDescriptor, ValidationItem } from '@topconsultnpm/sdk-ts';
3
3
  import { ITMChooserFormProps, ITMChooserProps, TID_MID } from '../../ts';
4
4
  import { TID_Alias } from '../../helper/queryHelper';
5
+ type MetadataDescriptorWithKey = MetadataDescriptor & {
6
+ uniqueKey: string;
7
+ };
5
8
  interface ITMMetadataChooserProps extends ITMChooserProps {
6
9
  /** Allows you to view system metadata */
7
10
  allowSysMetadata?: boolean;
@@ -32,7 +35,7 @@ interface ITMMetadataChooserProps extends ITMChooserProps {
32
35
  }
33
36
  declare const TMMetadataChooser: React.FunctionComponent<ITMMetadataChooserProps>;
34
37
  export default TMMetadataChooser;
35
- interface ITMMetadataChooserFormProps extends ITMChooserFormProps<MetadataDescriptor> {
38
+ interface ITMMetadataChooserFormProps extends ITMChooserFormProps<MetadataDescriptorWithKey> {
36
39
  /** Allows you to view system metadata */
37
40
  allowSysMetadata?: boolean;
38
41
  /** TIDs of document types to retrieve metadata from */