@topconsultnpm/sdkui-react 6.20.0-dev1.13 → 6.20.0-dev1.131
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/Toppy-help-center.png +0 -0
- package/lib/assets/headergradient.svg +87 -0
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +322 -30
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +8 -1
- package/lib/components/NewComponents/ContextMenu/hooks.js +80 -8
- package/lib/components/NewComponents/ContextMenu/index.d.ts +3 -0
- package/lib/components/NewComponents/ContextMenu/index.js +2 -0
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +9 -1
- package/lib/components/NewComponents/ContextMenu/styles.js +146 -47
- package/lib/components/NewComponents/ContextMenu/types.d.ts +22 -3
- package/lib/components/NewComponents/ContextMenu/useLongPress.d.ts +21 -0
- package/lib/components/NewComponents/ContextMenu/useLongPress.js +112 -0
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +620 -125
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +25 -5
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +215 -59
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +12 -3
- package/lib/components/base/TMAccordionNew.js +35 -14
- package/lib/components/base/TMButton.js +6 -0
- package/lib/components/base/TMClosableList.js +4 -0
- package/lib/components/base/TMCustomButton.js +61 -17
- package/lib/components/base/TMDataGrid.d.ts +7 -4
- package/lib/components/base/TMDataGrid.js +153 -11
- package/lib/components/base/TMDropDownMenu.js +21 -18
- package/lib/components/base/TMFileManager.d.ts +4 -3
- package/lib/components/base/TMFileManager.js +32 -24
- package/lib/components/base/TMFileManagerDataGridView.d.ts +3 -2
- package/lib/components/base/TMFileManagerDataGridView.js +1 -11
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +7 -1
- package/lib/components/base/TMFileManagerThumbnailItems.js +5 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +17 -4
- package/lib/components/base/TMFileManagerThumbnailsView.js +18 -6
- package/lib/components/base/TMFileManagerUtils.d.ts +0 -12
- package/lib/components/base/TMListView.js +33 -15
- package/lib/components/base/TMPanel.d.ts +1 -1
- package/lib/components/base/TMPanel.js +4 -2
- package/lib/components/base/TMPopUp.js +6 -0
- package/lib/components/base/TMToolbarCard.js +2 -0
- package/lib/components/base/TMTreeView.d.ts +2 -1
- package/lib/components/base/TMTreeView.js +33 -26
- package/lib/components/choosers/TMDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMDcmtTypeChooser.d.ts +1 -0
- package/lib/components/choosers/TMDcmtTypeChooser.js +11 -3
- package/lib/components/choosers/TMDistinctValues.js +2 -2
- package/lib/components/choosers/TMDynDataListItemChooser.d.ts +2 -0
- package/lib/components/choosers/TMDynDataListItemChooser.js +8 -2
- package/lib/components/choosers/TMInvoiceRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMMetadataChooser.d.ts +2 -0
- package/lib/components/choosers/TMMetadataChooser.js +19 -4
- package/lib/components/choosers/TMOrderRetrieveFormats.js +1 -1
- package/lib/components/choosers/TMUserChooser.d.ts +2 -5
- package/lib/components/choosers/TMUserChooser.js +33 -47
- package/lib/components/editors/TMCheckBox.js +2 -0
- package/lib/components/editors/TMDateBox.js +18 -9
- package/lib/components/editors/TMEditorStyled.js +7 -0
- package/lib/components/editors/TMLocalizedTextBox.d.ts +3 -1
- package/lib/components/editors/TMLocalizedTextBox.js +16 -14
- package/lib/components/editors/TMMetadataEditor.d.ts +1 -0
- package/lib/components/editors/TMMetadataEditor.js +4 -4
- package/lib/components/editors/TMMetadataTextBox.d.ts +9 -0
- package/lib/components/editors/TMMetadataTextBox.js +92 -0
- package/lib/components/editors/TMMetadataValues.d.ts +2 -0
- package/lib/components/editors/TMMetadataValues.js +26 -8
- package/lib/components/editors/TMRadioButton.js +2 -0
- package/lib/components/editors/TMTextArea.js +18 -30
- package/lib/components/editors/TMTextBox.d.ts +1 -1
- package/lib/components/editors/TMTextBox.js +29 -4
- package/lib/components/editors/TMTextExpression.js +6 -91
- package/lib/components/features/archive/TMArchive.js +2 -2
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.d.ts +15 -0
- package/lib/components/features/assistant/TMToppyDraggableHelpCenter.js +462 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.d.ts +11 -0
- package/lib/components/features/assistant/TMToppySpeechBubble.js +126 -0
- package/lib/components/features/documents/TMDcmtBlog.js +1 -1
- package/lib/components/features/documents/TMDcmtForm.d.ts +14 -2
- package/lib/components/features/documents/TMDcmtForm.js +576 -292
- package/lib/components/features/documents/TMDcmtPreview.js +42 -155
- package/lib/components/features/documents/TMDcmtTasks.js +9 -9
- package/lib/components/features/documents/TMMasterDetailDcmts.js +38 -53
- package/lib/components/features/documents/TMRelationViewer.d.ts +1 -1
- package/lib/components/features/documents/TMRelationViewer.js +2 -2
- package/lib/components/features/search/TMDcmtCheckoutInfoForm.d.ts +8 -0
- package/lib/components/features/search/{TMSearchResultCheckoutInfoForm.js → TMDcmtCheckoutInfoForm.js} +2 -2
- package/lib/components/features/search/TMSavedQuerySelector.js +72 -67
- package/lib/components/features/search/TMSearch.d.ts +3 -0
- package/lib/components/features/search/TMSearch.js +50 -11
- package/lib/components/features/search/TMSearchQueryEditor.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryEditor.js +10 -10
- package/lib/components/features/search/TMSearchQueryPanel.d.ts +1 -0
- package/lib/components/features/search/TMSearchQueryPanel.js +40 -25
- package/lib/components/features/search/TMSearchResult.d.ts +3 -0
- package/lib/components/features/search/TMSearchResult.js +370 -252
- package/lib/components/features/search/TMSearchResultsMenuItems.d.ts +3 -3
- package/lib/components/features/search/TMSearchResultsMenuItems.js +227 -171
- package/lib/components/features/search/TMSignSettingsForm.js +1 -1
- package/lib/components/features/search/TMSignatureInfoContent.d.ts +6 -0
- package/lib/components/features/search/TMSignatureInfoContent.js +140 -0
- package/lib/components/features/search/TMViewHistoryDcmt.js +47 -52
- package/lib/components/features/tasks/TMTaskForm.js +75 -25
- package/lib/components/features/tasks/TMTasksAgenda.d.ts +3 -1
- package/lib/components/features/tasks/TMTasksAgenda.js +48 -9
- package/lib/components/features/tasks/TMTasksCalendar.d.ts +2 -0
- package/lib/components/features/tasks/TMTasksCalendar.js +19 -7
- package/lib/components/features/tasks/TMTasksUtils.d.ts +2 -2
- package/lib/components/features/tasks/TMTasksUtils.js +57 -37
- package/lib/components/features/tasks/TMTasksView.js +28 -19
- package/lib/components/features/workflow/TMWorkflowPopup.d.ts +33 -2
- package/lib/components/features/workflow/TMWorkflowPopup.js +140 -34
- package/lib/components/features/workflow/diagram/DiagramItemComponent.d.ts +2 -0
- package/lib/components/features/workflow/diagram/DiagramItemComponent.js +14 -7
- package/lib/components/features/workflow/diagram/DiagramItemForm.js +1 -1
- package/lib/components/features/workflow/diagram/RecipientList.js +3 -2
- package/lib/components/features/workflow/diagram/WFDiagram.d.ts +4 -0
- package/lib/components/features/workflow/diagram/WFDiagram.js +164 -13
- package/lib/components/forms/Login/LoginValidatorService.d.ts +2 -0
- package/lib/components/forms/Login/LoginValidatorService.js +7 -2
- package/lib/components/forms/Login/TMLoginForm.js +35 -7
- package/lib/components/forms/TMChooserForm.js +1 -1
- package/lib/components/grids/TMBlogsPost.js +56 -31
- package/lib/components/grids/TMRecentsManager.js +20 -10
- package/lib/components/grids/TMValidationItemsList.js +6 -0
- package/lib/components/index.d.ts +6 -3
- package/lib/components/index.js +6 -3
- package/lib/components/layout/panelManager/TMPanelManagerContext.js +13 -5
- package/lib/components/query/TMQueryEditor.d.ts +6 -1
- package/lib/components/query/TMQueryEditor.js +105 -101
- package/lib/components/settings/SettingsAppearance.d.ts +2 -1
- package/lib/components/settings/SettingsAppearance.js +99 -30
- package/lib/components/sidebar/TMHeader.js +11 -7
- package/lib/components/sidebar/TMSidebar.d.ts +0 -1
- package/lib/components/sidebar/TMSidebar.js +16 -44
- package/lib/components/sidebar/TMSidebarItem.js +36 -17
- package/lib/components/viewers/TMDataListItemViewer.d.ts +2 -1
- package/lib/components/viewers/TMDataListItemViewer.js +35 -71
- package/lib/components/viewers/TMDataUserIdItemViewer.d.ts +8 -0
- package/lib/components/viewers/TMDataUserIdItemViewer.js +39 -0
- package/lib/css/tm-sdkui.css +1 -1
- package/lib/helper/SDKUI_Globals.d.ts +22 -0
- package/lib/helper/SDKUI_Globals.js +10 -1
- package/lib/helper/SDKUI_Localizator.d.ts +21 -3
- package/lib/helper/SDKUI_Localizator.js +196 -10
- package/lib/helper/TMCommandsContextMenu.d.ts +4 -2
- package/lib/helper/TMCommandsContextMenu.js +15 -4
- package/lib/helper/TMIcons.d.ts +4 -0
- package/lib/helper/TMIcons.js +13 -3
- package/lib/helper/TMPdfViewer.d.ts +8 -0
- package/lib/helper/TMPdfViewer.js +373 -0
- package/lib/helper/TMToppyMessage.js +4 -0
- package/lib/helper/checkinCheckoutManager.d.ts +31 -1
- package/lib/helper/checkinCheckoutManager.js +112 -30
- package/lib/helper/devextremeCustomMessages.d.ts +30 -0
- package/lib/helper/devextremeCustomMessages.js +30 -0
- package/lib/helper/helpers.d.ts +30 -2
- package/lib/helper/helpers.js +132 -4
- package/lib/helper/index.d.ts +2 -0
- package/lib/helper/index.js +2 -0
- package/lib/helper/queryHelper.d.ts +2 -2
- package/lib/helper/queryHelper.js +80 -24
- package/lib/helper/workItemsHelper.d.ts +6 -0
- package/lib/helper/workItemsHelper.js +230 -0
- package/lib/hooks/useCheckInOutOperations.d.ts +28 -0
- package/lib/hooks/useCheckInOutOperations.js +223 -0
- package/lib/hooks/useDataListItem.d.ts +12 -0
- package/lib/hooks/useDataListItem.js +132 -0
- package/lib/hooks/useDataUserIdItem.d.ts +10 -0
- package/lib/hooks/useDataUserIdItem.js +96 -0
- package/lib/hooks/useFloatingBarPinnedItems.d.ts +11 -0
- package/lib/hooks/useFloatingBarPinnedItems.js +54 -0
- package/lib/hooks/useMetadataExpression.d.ts +19 -0
- package/lib/hooks/useMetadataExpression.js +99 -0
- package/lib/hooks/useSettingsFeedback.d.ts +11 -0
- package/lib/hooks/useSettingsFeedback.js +38 -0
- package/lib/hooks/useWorkflowApprove.d.ts +4 -0
- package/lib/hooks/useWorkflowApprove.js +14 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/services/platform_services.d.ts +3 -3
- package/lib/ts/types.d.ts +61 -1
- package/lib/utils/theme.d.ts +1 -1
- package/lib/utils/theme.js +1 -1
- package/package.json +8 -6
- package/lib/components/NewComponents/Notification/Notification.d.ts +0 -4
- package/lib/components/NewComponents/Notification/Notification.js +0 -60
- package/lib/components/NewComponents/Notification/NotificationContainer.d.ts +0 -8
- package/lib/components/NewComponents/Notification/NotificationContainer.js +0 -33
- package/lib/components/NewComponents/Notification/index.d.ts +0 -2
- package/lib/components/NewComponents/Notification/index.js +0 -2
- package/lib/components/NewComponents/Notification/styles.d.ts +0 -21
- package/lib/components/NewComponents/Notification/styles.js +0 -180
- package/lib/components/NewComponents/Notification/types.d.ts +0 -18
- package/lib/components/NewComponents/Notification/types.js +0 -1
- package/lib/components/base/TMContextMenu.d.ts +0 -25
- package/lib/components/base/TMContextMenu.js +0 -109
- package/lib/components/base/TMContextMenuOLD.d.ts +0 -26
- package/lib/components/base/TMContextMenuOLD.js +0 -56
- package/lib/components/base/TMFloatingToolbar.d.ts +0 -9
- package/lib/components/base/TMFloatingToolbar.js +0 -101
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.d.ts +0 -30
- package/lib/components/features/assistant/ToppyDraggableHelpCenter.js +0 -482
- package/lib/components/features/assistant/ToppySpeechBubble.d.ts +0 -9
- package/lib/components/features/assistant/ToppySpeechBubble.js +0 -117
- package/lib/components/features/search/TMSearchResultCheckoutInfoForm.d.ts +0 -8
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { extractTextsFromDirectory, findFileItems, setFolderTreeViewItems } from "./TMFileManagerUtils";
|
|
4
4
|
import { DeviceType, useDeviceType } from "./TMDeviceProvider";
|
|
5
|
-
import { formatBytes, Globalization, IconDashboard, IconFolder, IconHide, IconList, IconMenuVertical, IconRefresh, IconShow, SDKUI_Globals, SDKUI_Localizator,
|
|
5
|
+
import { formatBytes, Globalization, IconDashboard, IconFolder, IconHide, IconList, IconMenuVertical, IconRefresh, IconShow, SDKUI_Globals, SDKUI_Localizator, TMCommandsContextMenu, TMConditionalWrapper } from "../../helper";
|
|
6
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
6
7
|
import TMTooltip from "./TMTooltip";
|
|
7
8
|
import { TMColors } from "../../utils/theme";
|
|
8
9
|
import TMPanel from "./TMPanel";
|
|
9
10
|
import { TMSplitterLayout } from "./TMLayout";
|
|
10
|
-
import {
|
|
11
|
+
import { TreeView } from "devextreme-react";
|
|
11
12
|
import Toolbar, { Item as ToolbarItem } from 'devextreme-react/toolbar';
|
|
12
13
|
import TMButton from "./TMButton";
|
|
13
14
|
import { TMSearchBar } from "../sidebar/TMHeader";
|
|
@@ -29,12 +30,12 @@ const TMFileManager = (props) => {
|
|
|
29
30
|
const [viewMode, setViewMode] = useState(initialViewMode ?? 'details');
|
|
30
31
|
// State to store transformed directory data for file manager
|
|
31
32
|
const [treeViewData, setTreeViewData] = useState([]);
|
|
32
|
-
// State to store the
|
|
33
|
-
const [
|
|
33
|
+
// State to store the tree view context menu control
|
|
34
|
+
const [treeViewContextMenuControl, setTreeViewContextMenuControl] = useState({ visible: false, position: { x: 0, y: 0 } });
|
|
34
35
|
// State to store the filtered file items after search or filtering
|
|
35
36
|
const [filteredFileItems, setFilteredFileItems] = useState([]);
|
|
36
|
-
// State to store the
|
|
37
|
-
const [
|
|
37
|
+
// State to store the thumbnails view context menu control
|
|
38
|
+
const [thumbViewContextMenuControl, setThumbViewContextMenuControl] = useState({ visible: false, position: { x: 0, y: 0 } });
|
|
38
39
|
// State to store the search text entered by the user
|
|
39
40
|
const [searchText, setSearchText] = useState('');
|
|
40
41
|
// State to control the collapse/expand of the left panel
|
|
@@ -98,21 +99,21 @@ const TMFileManager = (props) => {
|
|
|
98
99
|
const onBackCallback = useCallback(() => {
|
|
99
100
|
setOpenDraftList(false);
|
|
100
101
|
}, []);
|
|
101
|
-
const toolbar = useMemo(() =>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
const toolbar = useMemo(() => _jsx(TMCommandsContextMenu, { target: '#TMPanel-FileManager-Commands-Header', menuItems: [
|
|
103
|
+
{
|
|
104
|
+
icon: isLeftPanelCollapsed ? _jsx(IconShow, {}) : _jsx(IconHide, {}),
|
|
105
|
+
onClick: () => setIsLeftPanelCollapsed(prev => !prev),
|
|
106
|
+
text: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
icon: _jsx(IconRefresh, {}),
|
|
110
|
+
onClick: async () => await refreshCallback(),
|
|
111
|
+
text: SDKUI_Localizator.Refresh,
|
|
112
|
+
},
|
|
113
|
+
], showEvent: "click", children: _jsx(IconMenuVertical, { id: "TMPanel-FileManager-Commands-Header", color: 'white', cursor: 'pointer' }) }), [isLeftPanelCollapsed]);
|
|
113
114
|
// Handle closing the context menu
|
|
114
115
|
const closeTreeViewContextMenu = useCallback(() => {
|
|
115
|
-
|
|
116
|
+
setTreeViewContextMenuControl(prev => ({ ...prev, visible: false }));
|
|
116
117
|
}, []);
|
|
117
118
|
const handleTreeViewItemClick = useCallback((e) => {
|
|
118
119
|
if (!e)
|
|
@@ -161,7 +162,10 @@ const TMFileManager = (props) => {
|
|
|
161
162
|
if (event === undefined)
|
|
162
163
|
return;
|
|
163
164
|
event.preventDefault();
|
|
164
|
-
|
|
165
|
+
setTreeViewContextMenuControl({
|
|
166
|
+
visible: true,
|
|
167
|
+
position: { x: event.clientX, y: event.clientY }
|
|
168
|
+
});
|
|
165
169
|
handleFocusedFolder?.(undefined);
|
|
166
170
|
}, []);
|
|
167
171
|
const onItemTreeViewContextMenu = useCallback((contextMenuEvent) => {
|
|
@@ -198,11 +202,15 @@ const TMFileManager = (props) => {
|
|
|
198
202
|
const handleDragLeave = (e) => {
|
|
199
203
|
setIsDragging(false);
|
|
200
204
|
};
|
|
201
|
-
return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "32%", isLeftPanelCollapsed ? '100%' : "68%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { style: {
|
|
205
|
+
return _jsx(TMPanel, { title: SDKUI_Localizator.Drafts, totalItems: dcmtsFound ?? 0, showHeader: showPanel, onBack: (isMobile && openDraftList) ? onBackCallback : undefined, onClose: onClosePanel, allowMaximize: !isMobile ? allowMaximize : false, onMaximize: !isMobile ? onMaximizePanel : undefined, onHeaderDoubleClick: !isMobile ? onMaximizePanel : undefined, toolbar: toolbar, children: _jsx("div", { style: { flexDirection: "column", height: "100%", width: "100%", }, children: _jsxs(TMConditionalWrapper, { condition: !isMobile, wrapper: children => _jsx("div", { style: { display: "flex", flexGrow: 1, height: "100%" }, children: _jsx(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "32%", isLeftPanelCollapsed ? '100%' : "68%"], children: children }, "TMWGs-panels-treeView") }), children: [_jsxs("div", { id: "file-manager-tree-view-container", style: {
|
|
202
206
|
height: "100%",
|
|
203
207
|
width: "100%",
|
|
204
208
|
...(isMobile && { display: openDraftList ? 'none' : 'block', transition: "opacity 0.3s ease-in-out" }),
|
|
205
|
-
}, onContextMenu: onBackgroundTreeViewContextMenu, children: [_jsx(TreeView, { height: "100%", width: "100%", useNativeScrolling: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick, onItemContextMenu: onItemTreeViewContextMenu }),
|
|
209
|
+
}, onContextMenu: onBackgroundTreeViewContextMenu, children: [_jsx(TreeView, { height: "100%", width: "100%", useNativeScrolling: SDKUI_Globals.userSettings?.themeSettings.gridSettings.useNativeScrollbar === 1, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick, onItemContextMenu: onItemTreeViewContextMenu }), _jsx(TMContextMenu, { items: folderContextMenuItems, target: "#file-manager-tree-view-container", externalControl: {
|
|
210
|
+
visible: treeViewContextMenuControl.visible,
|
|
211
|
+
position: treeViewContextMenuControl.position,
|
|
212
|
+
onClose: closeTreeViewContextMenu
|
|
213
|
+
} })] }), _jsxs("div", { style: {
|
|
206
214
|
backgroundColor: "#fff",
|
|
207
215
|
width: "100%",
|
|
208
216
|
height: "100%",
|
|
@@ -228,6 +236,6 @@ const TMFileManager = (props) => {
|
|
|
228
236
|
pointerEvents: "none",
|
|
229
237
|
backdropFilter: "blur(3px)",
|
|
230
238
|
textShadow: "0 2px 4px rgba(0,0,0,0.5)"
|
|
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,
|
|
239
|
+
}, 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, thumbViewContextMenuControl: thumbViewContextMenuControl, setThumbViewContextMenuControl: setThumbViewContextMenuControl, 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 })] })] })] }) }) });
|
|
232
240
|
};
|
|
233
241
|
export default TMFileManager;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { FileItem
|
|
1
|
+
import { FileItem } from "./TMFileManagerUtils";
|
|
2
2
|
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
|
+
import { TMContextMenuItemProps } from "../NewComponents/ContextMenu/types";
|
|
3
4
|
interface TMFileManagerDataGridViewProps {
|
|
4
5
|
items: Array<FileItem>;
|
|
5
6
|
allUsers: Array<UserDescriptor>;
|
|
@@ -7,7 +8,7 @@ interface TMFileManagerDataGridViewProps {
|
|
|
7
8
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
8
9
|
selectedFiles: Array<FileItem>;
|
|
9
10
|
handleSelectedFiles: (fileItems: Array<FileItem>) => void;
|
|
10
|
-
fileContextMenuItems: Array<
|
|
11
|
+
fileContextMenuItems: Array<TMContextMenuItemProps>;
|
|
11
12
|
searchText: string;
|
|
12
13
|
userID?: number;
|
|
13
14
|
onDoubleClickHandler?: (fileItem: FileItem | undefined) => void;
|
|
@@ -48,16 +48,6 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
48
48
|
if (onDoubleClickHandler)
|
|
49
49
|
onDoubleClickHandler(e.data);
|
|
50
50
|
}, [onDoubleClickHandler]);
|
|
51
|
-
const onContextMenuPreparing = (e) => {
|
|
52
|
-
if (e === undefined)
|
|
53
|
-
return;
|
|
54
|
-
if (e.target === 'content') {
|
|
55
|
-
if (handleFocusedFile && e.row)
|
|
56
|
-
handleFocusedFile(e.row.data);
|
|
57
|
-
e.items = e.items || [];
|
|
58
|
-
e.items = fileContextMenuItems ? [...fileContextMenuItems] : [];
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
51
|
const cellDefaultRender = useCallback((cellData) => {
|
|
62
52
|
const value = cellData.value ?? '';
|
|
63
53
|
return renderHighlightedText(value.toString(), searchText, false);
|
|
@@ -96,6 +86,6 @@ const TMFileManagerDataGridView = (props) => {
|
|
|
96
86
|
{ dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
|
|
97
87
|
];
|
|
98
88
|
}, [searchText]);
|
|
99
|
-
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick,
|
|
89
|
+
return _jsx(TMDataGrid, { dataSource: items ?? [], dataColumns: dataColumns, focusedRowKey: focusedRowKey, selectedRowKeys: selectedRowKeys, onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onCellDblClick: onCellDblClick, customContextMenuItems: fileContextMenuItems, showSearchPanel: false, noDataText: SDKUI_Localizator.FolderIsEmpty }, items.length);
|
|
100
90
|
};
|
|
101
91
|
export default TMFileManagerDataGridView;
|
|
@@ -10,7 +10,13 @@ export interface TMFileManagerThumbnailItemsProps {
|
|
|
10
10
|
selectedFiles: Array<FileItem>;
|
|
11
11
|
handleSelectedFiles: (fileItems: Array<FileItem>) => void;
|
|
12
12
|
searchText: string;
|
|
13
|
-
|
|
13
|
+
setThumbViewContextMenuControl: React.Dispatch<React.SetStateAction<{
|
|
14
|
+
visible: boolean;
|
|
15
|
+
position: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
}>>;
|
|
14
20
|
onDoubleClick?: (file: FileItem) => void;
|
|
15
21
|
userID?: number;
|
|
16
22
|
}
|
|
@@ -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, allUsers, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile,
|
|
9
|
+
const { items, allUsers, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile, setThumbViewContextMenuControl } = 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
|
|
@@ -109,7 +109,10 @@ const TMFileManagerThumbnailItems = (props) => {
|
|
|
109
109
|
// Right-click to open context menu and set focus
|
|
110
110
|
const onContextMenu = useCallback((e, item) => {
|
|
111
111
|
e.preventDefault();
|
|
112
|
-
|
|
112
|
+
setThumbViewContextMenuControl({
|
|
113
|
+
visible: true,
|
|
114
|
+
position: { x: e.clientX, y: e.clientY }
|
|
115
|
+
});
|
|
113
116
|
handleFocusedFile(item);
|
|
114
117
|
}, []);
|
|
115
118
|
const findCheckOutUserName = useCallback((item) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FileItem
|
|
2
|
+
import { FileItem } from "./TMFileManagerUtils";
|
|
3
3
|
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
4
|
+
import { TMContextMenuItemProps } from '../NewComponents/ContextMenu/types';
|
|
4
5
|
interface TMFileManagerThumbnailsViewProps {
|
|
5
6
|
items: Array<FileItem>;
|
|
6
7
|
allUsers: Array<UserDescriptor>;
|
|
@@ -8,12 +9,24 @@ interface TMFileManagerThumbnailsViewProps {
|
|
|
8
9
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
9
10
|
selectedFiles: Array<FileItem>;
|
|
10
11
|
handleSelectedFiles: (fileItems: Array<FileItem>) => void;
|
|
11
|
-
fileContextMenuItems: Array<
|
|
12
|
+
fileContextMenuItems: Array<TMContextMenuItemProps>;
|
|
12
13
|
searchText: string;
|
|
13
14
|
userID?: number;
|
|
14
15
|
onDoubleClickHandler?: (fileItem: FileItem | undefined) => void;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
thumbViewContextMenuControl: {
|
|
17
|
+
visible: boolean;
|
|
18
|
+
position: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
setThumbViewContextMenuControl: React.Dispatch<React.SetStateAction<{
|
|
24
|
+
visible: boolean;
|
|
25
|
+
position: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
}>>;
|
|
17
30
|
}
|
|
18
31
|
declare const TMFileManagerThumbnailsView: (props: TMFileManagerThumbnailsViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
32
|
export default TMFileManagerThumbnailsView;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useState } from "react";
|
|
3
3
|
import { TMFileManagerPageSize } from "./TMFileManagerUtils";
|
|
4
|
-
import {
|
|
4
|
+
import { Pagination, ScrollView } from "devextreme-react";
|
|
5
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
5
6
|
import TMFileManagerThumbnailItems from "./TMFileManagerThumbnailItems";
|
|
6
7
|
import { SDKUI_Localizator } from "../../helper";
|
|
7
8
|
const TMFileManagerThumbnailsView = (props) => {
|
|
8
|
-
const { items, allUsers, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler,
|
|
9
|
+
const { items, allUsers, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler, thumbViewContextMenuControl, setThumbViewContextMenuControl } = props;
|
|
9
10
|
const PAGE_SIZES = [TMFileManagerPageSize.Small, TMFileManagerPageSize.Medium, TMFileManagerPageSize.Large];
|
|
10
11
|
const initPageSize = TMFileManagerPageSize.Small;
|
|
11
12
|
const showPagination = (items?.length ?? 0) > initPageSize;
|
|
@@ -26,7 +27,7 @@ const TMFileManagerThumbnailsView = (props) => {
|
|
|
26
27
|
}, []);
|
|
27
28
|
// Handle closing the context menu
|
|
28
29
|
const closeViewContextMenu = useCallback(() => {
|
|
29
|
-
|
|
30
|
+
setThumbViewContextMenuControl(prev => ({ ...prev, visible: false }));
|
|
30
31
|
}, []);
|
|
31
32
|
const onBackgroundContextMenu = (event) => {
|
|
32
33
|
if (event === undefined)
|
|
@@ -34,13 +35,24 @@ const TMFileManagerThumbnailsView = (props) => {
|
|
|
34
35
|
if (event.target.closest('.tm-file-manager-thumbnail-items'))
|
|
35
36
|
return;
|
|
36
37
|
event.preventDefault();
|
|
37
|
-
|
|
38
|
+
setThumbViewContextMenuControl({
|
|
39
|
+
visible: true,
|
|
40
|
+
position: { x: event.clientX, y: event.clientY }
|
|
41
|
+
});
|
|
38
42
|
handleFocusedFile?.(undefined);
|
|
39
43
|
handleSelectedFiles?.([]);
|
|
40
44
|
};
|
|
41
45
|
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, allUsers: allUsers, paginatedItems: paginatedItems, focusedFile: focusedFile, selectedFiles: selectedFiles, userID: userID, searchText: searchText, handleFocusedFile: handleFocusedFile, handleSelectedFiles: handleSelectedFiles, onDoubleClick: handleItemDoubleClick,
|
|
46
|
+
_jsxs("div", { id: "file-manager-thumbnails-view", 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, setThumbViewContextMenuControl: setThumbViewContextMenuControl }) }), 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 }), _jsx(TMContextMenu, { items: fileContextMenuItems, target: "#file-manager-thumbnails-view", externalControl: {
|
|
47
|
+
visible: thumbViewContextMenuControl.visible,
|
|
48
|
+
position: thumbViewContextMenuControl.position,
|
|
49
|
+
onClose: closeViewContextMenu
|
|
50
|
+
} })] })
|
|
43
51
|
:
|
|
44
|
-
_jsxs("div", { onContextMenu: onBackgroundContextMenu, style: { width: "100%", height: "100%", display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: '10px' }, children: [SDKUI_Localizator.FolderIsEmpty,
|
|
52
|
+
_jsxs("div", { id: "file-manager-thumbnails-view-empty", onContextMenu: onBackgroundContextMenu, style: { width: "100%", height: "100%", display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: '10px' }, children: [SDKUI_Localizator.FolderIsEmpty, _jsx(TMContextMenu, { items: fileContextMenuItems, target: "#file-manager-thumbnails-view-empty", externalControl: {
|
|
53
|
+
visible: thumbViewContextMenuControl.visible,
|
|
54
|
+
position: thumbViewContextMenuControl.position,
|
|
55
|
+
onClose: closeViewContextMenu
|
|
56
|
+
} })] });
|
|
45
57
|
};
|
|
46
58
|
export default TMFileManagerThumbnailsView;
|
|
@@ -19,18 +19,6 @@ export interface FileItem {
|
|
|
19
19
|
size?: number;
|
|
20
20
|
version?: number;
|
|
21
21
|
}
|
|
22
|
-
export interface TMFileManagerContextMenuItem {
|
|
23
|
-
text: string;
|
|
24
|
-
icon: string;
|
|
25
|
-
onClick?: (param?: any) => void;
|
|
26
|
-
operationType?: 'singleRow' | 'multiRow';
|
|
27
|
-
disabled?: boolean;
|
|
28
|
-
id?: string;
|
|
29
|
-
items?: Array<TMFileManagerContextMenuItem>;
|
|
30
|
-
beginGroup?: boolean;
|
|
31
|
-
tooltip?: string;
|
|
32
|
-
visible?: boolean;
|
|
33
|
-
}
|
|
34
22
|
export interface TMFileManagerTreeViewDirectory {
|
|
35
23
|
id: number;
|
|
36
24
|
text: string;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { ObjectClasses } from '@topconsultnpm/sdk-ts';
|
|
5
|
-
import TMContextMenu
|
|
5
|
+
import TMContextMenu from '../NewComponents/ContextMenu/TMContextMenu';
|
|
6
6
|
import { IconApply, IconCloseCircle, IconColumns, IconDown, IconHide, IconShow, IconUp, IconVisible } from '../../helper/TMIcons';
|
|
7
7
|
import { TMSearchBar } from '../sidebar/TMHeader';
|
|
8
8
|
import TMTooltip from './TMTooltip';
|
|
@@ -26,9 +26,17 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
|
26
26
|
const [isFocused, setIsFocused] = useState(false);
|
|
27
27
|
const [showOrderMenu, setShowOrderMenu] = useState(false);
|
|
28
28
|
const [showOrderOptions, setShowOrderOptions] = useState(false);
|
|
29
|
+
const [contextMenuVisible, setContextMenuVisible] = useState(false);
|
|
30
|
+
const [contextMenuPosition, setContextMenuPosition] = useState({ x: 0, y: 0 });
|
|
31
|
+
const [orderMenuVisible, setOrderMenuVisible] = useState(false);
|
|
32
|
+
const [orderMenuPosition, setOrderMenuPosition] = useState({ x: 0, y: 0 });
|
|
29
33
|
useEffect(() => { setCurrentDataSource(dataSource); }, [dataSource]);
|
|
30
|
-
const openContextMenu = (e) => {
|
|
31
|
-
|
|
34
|
+
const openContextMenu = (e) => {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
setIsFocused(true);
|
|
37
|
+
setContextMenuVisible(true);
|
|
38
|
+
setContextMenuPosition({ x: e.clientX, y: e.clientY });
|
|
39
|
+
};
|
|
32
40
|
useEffect(() => { if (orderBy) {
|
|
33
41
|
setOrderedBy(orderBy);
|
|
34
42
|
} }, [orderBy]);
|
|
@@ -235,10 +243,10 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
|
235
243
|
for (let key of searchKeys) {
|
|
236
244
|
arr.push({
|
|
237
245
|
disabled: !localShowId && key === exprKey,
|
|
238
|
-
|
|
239
|
-
onItemClick: () => { setOrderedBy(key); setShowOrderOptions(false); },
|
|
246
|
+
onClick: () => { setOrderedBy(key); setShowOrderOptions(false); setOrderMenuVisible(false); },
|
|
240
247
|
icon: _jsx(IconColumns, { fontSize: 16 }),
|
|
241
|
-
|
|
248
|
+
name: key,
|
|
249
|
+
rightIconProps: key === orderedBy ? { icon: _jsx(IconApply, { fontSize: 14, color: 'gray' }) } : undefined
|
|
242
250
|
});
|
|
243
251
|
}
|
|
244
252
|
}
|
|
@@ -328,16 +336,16 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
|
328
336
|
if (showSearch === undefined) {
|
|
329
337
|
items.push({
|
|
330
338
|
icon: localShowSearch ? _jsx(IconHide, { fontSize: 16 }) : _jsx(IconShow, { fontSize: 16 }),
|
|
331
|
-
|
|
332
|
-
|
|
339
|
+
onClick: () => setLocalShowSearch(!localShowSearch),
|
|
340
|
+
name: localShowSearch ? SDKUI_Localizator.HideSearch : SDKUI_Localizator.ShowSearch
|
|
333
341
|
});
|
|
334
342
|
}
|
|
335
343
|
// Add ID menu item only if showId prop is undefined
|
|
336
344
|
if (showId === undefined) {
|
|
337
345
|
items.push({
|
|
338
346
|
icon: localShowId ? _jsx(IconHide, { fontSize: 16 }) : _jsx(IconShow, { fontSize: 16 }),
|
|
339
|
-
|
|
340
|
-
|
|
347
|
+
onClick: () => setLocalShowId(!localShowId),
|
|
348
|
+
name: localShowId ? SDKUI_Localizator.ID_Hide : SDKUI_Localizator.ID_Show,
|
|
341
349
|
});
|
|
342
350
|
}
|
|
343
351
|
// Add order menu item only if grouping length is zero
|
|
@@ -345,21 +353,31 @@ const TMListView = ({ customGroupingHeaders, headerBackGroundColor, header, show
|
|
|
345
353
|
items.push({
|
|
346
354
|
icon: showOrderMenu ? _jsx(IconHide, { fontSize: 16 }) : _jsx(IconShow, { fontSize: 16 }),
|
|
347
355
|
disabled: searchKeys.length === 0,
|
|
348
|
-
|
|
349
|
-
|
|
356
|
+
onClick: () => setShowOrderMenu(!showOrderMenu),
|
|
357
|
+
name: showOrderMenu ? 'Nascondi menu di ordinamento' : 'Mostra menu di ordinamento'
|
|
350
358
|
});
|
|
351
359
|
}
|
|
352
360
|
return items;
|
|
353
361
|
};
|
|
354
362
|
const contextMenuItems = generateContextMenuItems(localShowSearch, localShowId, showOrderMenu, grouping, searchKeys);
|
|
355
|
-
return (_jsxs(StyledListViewContainer, { ref: contRef, onContextMenu: openContextMenu, children: [
|
|
356
|
-
|
|
363
|
+
return (_jsxs(StyledListViewContainer, { ref: contRef, onContextMenu: openContextMenu, children: [contextMenuItems.length > 0 && (_jsx(TMContextMenu, { items: contextMenuItems, externalControl: {
|
|
364
|
+
visible: contextMenuVisible,
|
|
365
|
+
position: contextMenuPosition,
|
|
366
|
+
onClose: () => setContextMenuVisible(false)
|
|
367
|
+
} })), showOrderOptions && orderRef.current && (_jsx(TMContextMenu, { items: orderMenuItems(), externalControl: {
|
|
368
|
+
visible: orderMenuVisible || showOrderOptions,
|
|
369
|
+
position: {
|
|
370
|
+
x: orderRef.current.getBoundingClientRect().left,
|
|
371
|
+
y: orderRef.current.getBoundingClientRect().top - (searchKeys.length * 30) - 10
|
|
372
|
+
},
|
|
373
|
+
onClose: () => { setOrderMenuVisible(false); setShowOrderOptions(false); }
|
|
374
|
+
} })), header && _jsx("div", { style: { width: '100%', height: '40px', backgroundColor: headerBackGroundColor ?? `${customColor}30`, marginBottom: '3px', display: 'flex', alignItems: 'center' }, children: header }), localShowSearch &&
|
|
357
375
|
_jsx(StyledSearchContainer, { children: _jsxs(StyledSearchContainer, { children: [_jsx(TMSearchBar, { marginLeft: '0px', maxWidth: '300px', searchValue: searchValue, onSearchValueChanged: (e) => setSearchValue(e) }), _jsx(TMTooltip, { content: 'Nascondi ricerca', children: _jsx(IconCloseCircle, { style: { cursor: 'pointer' }, color: 'red', fontSize: 14, onClick: () => { setSearchValue(''); setLocalShowSearch(false); } }) })] }) }), _jsx("div", { ref: listRef, onClick: () => setIsFocused(true), style: { width: '100%', overflow: 'auto', height: listHeight() }, children: currentDataSource.length > 0 ?
|
|
358
376
|
grouping.length === 0 ? memoList : groupedMemoList :
|
|
359
377
|
searchValue.length > 0 ? _jsx("div", { style: { width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: "No data found" }) :
|
|
360
378
|
_jsx("div", { style: { width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center' }, children: "No data" }) }), (searchValue.length > 0 || showOrderMenu) &&
|
|
361
379
|
_jsxs(StyledListViewFooter, { "$bgColor": `${customColor}20`, children: [showOrderMenu &&
|
|
362
|
-
_jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("div", { style: { width: 'max-content' }, children: "Ordinato per" }), _jsx("div", { ref: orderRef, onClick: () => { setShowOrderOptions(!showOrderOptions); }, style: { cursor: 'pointer', fontWeight: 'bold' }, children: orderedBy.length > 0 ? orderedBy : 'Nulla' }), orderedBy.length > 0 && _jsxs(TMTooltip, { content: orderDir ? 'ASC' : 'DESC', children: [" ", orderDir ? _jsx(IconUp, { style: { cursor: 'pointer' }, onClick: () => setOrderDir(false), fontSize: 14 }) : _jsx(IconDown, { style: { cursor: 'pointer' }, onClick: () => setOrderDir(true), fontSize: 14 }), " "] }), _jsx(TMTooltip, { content: 'Annulla ordinamento', children: _jsx(IconCloseCircle, { style: { cursor: 'pointer' }, color: 'red', fontSize: 14, onClick: () => { setOrderedBy(''); setShowOrderMenu(false); setShowOrderOptions(false); } }) })] }), searchValue.length > 0 && _jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', justifyContent: 'flex-end', gap: 5 }, children: [_jsx(TMTooltip, { content: 'Visibili', children: _jsx(IconVisible, { fontSize: 14 }) }), currentDataSource.length] })] })] }));
|
|
380
|
+
_jsxs("div", { style: { width: 'max-content', display: 'flex', alignItems: 'center', gap: 5 }, children: [_jsx("div", { style: { width: 'max-content' }, children: "Ordinato per" }), _jsx("div", { ref: orderRef, onClick: () => { setShowOrderOptions(!showOrderOptions); setOrderMenuVisible(!orderMenuVisible); }, style: { cursor: 'pointer', fontWeight: 'bold' }, children: orderedBy.length > 0 ? orderedBy : 'Nulla' }), orderedBy.length > 0 && _jsxs(TMTooltip, { content: orderDir ? 'ASC' : 'DESC', children: [" ", orderDir ? _jsx(IconUp, { style: { cursor: 'pointer' }, onClick: () => setOrderDir(false), fontSize: 14 }) : _jsx(IconDown, { style: { cursor: 'pointer' }, onClick: () => setOrderDir(true), fontSize: 14 }), " "] }), _jsx(TMTooltip, { content: 'Annulla ordinamento', children: _jsx(IconCloseCircle, { style: { cursor: 'pointer' }, color: 'red', fontSize: 14, onClick: () => { setOrderedBy(''); setShowOrderMenu(false); setShowOrderOptions(false); } }) })] }), searchValue.length > 0 && _jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', justifyContent: 'flex-end', gap: 5 }, children: [_jsx(TMTooltip, { content: 'Visibili', children: _jsx(IconVisible, { fontSize: 14 }) }), currentDataSource.length] })] })] }));
|
|
363
381
|
};
|
|
364
382
|
export default TMListView;
|
|
365
383
|
export const CustomListViewHeader = (props) => {
|
|
@@ -65,6 +65,8 @@ const StyledPanelContent = styled.div `
|
|
|
65
65
|
justify-content: space-between;
|
|
66
66
|
position: relative;
|
|
67
67
|
user-select: none;
|
|
68
|
+
-webkit-touch-callout: none;
|
|
69
|
+
-webkit-user-select: none;
|
|
68
70
|
outline: none;
|
|
69
71
|
&:focus {
|
|
70
72
|
outline: none;
|
|
@@ -133,7 +135,7 @@ onActivate, onBack, onClose, onHeaderDoubleClick, onMaximize, onActiveChanged },
|
|
|
133
135
|
};
|
|
134
136
|
return (_jsxs(StyledPanelContainer, { ref: panelRef, "$isMaximized": onMaximize ? false : isMaximized, style: {
|
|
135
137
|
visibility: isVisible ? 'visible' : 'hidden',
|
|
136
|
-
}, tabIndex: -1, onFocus: !isControlled ? handleFocusUncontrolled : undefined, onBlur: !isControlled ? handleBlurUncontrolled : undefined, onClick: handleActivation, children: [showHeader &&
|
|
138
|
+
}, tabIndex: -1, onFocus: !isControlled ? handleFocusUncontrolled : undefined, onBlur: !isControlled ? handleBlurUncontrolled : undefined, onClick: handleActivation, onContextMenu: (e) => e.preventDefault(), children: [showHeader &&
|
|
137
139
|
_jsx(StyledPanelHeader, { "$backgroundColor": backgroundColor, "$color": color, "$isActive": currentIsActive, onDoubleClick: () => {
|
|
138
140
|
if (onHeaderDoubleClick)
|
|
139
141
|
onHeaderDoubleClick();
|
|
@@ -158,7 +160,7 @@ onActivate, onBack, onClose, onHeaderDoubleClick, onMaximize, onActiveChanged },
|
|
|
158
160
|
flexDirection: 'row',
|
|
159
161
|
alignItems: 'center',
|
|
160
162
|
overflow: 'hidden',
|
|
161
|
-
}, children: _jsxs("
|
|
163
|
+
}, children: _jsxs("div", { style: {
|
|
162
164
|
whiteSpace: 'nowrap',
|
|
163
165
|
overflow: 'hidden',
|
|
164
166
|
textOverflow: 'ellipsis',
|
|
@@ -31,6 +31,8 @@ const StyledExeptionToolbar = styled.div `
|
|
|
31
31
|
gap: 5px;
|
|
32
32
|
padding: 5px;
|
|
33
33
|
user-select: none;
|
|
34
|
+
-webkit-touch-callout: none;
|
|
35
|
+
-webkit-user-select: none;
|
|
34
36
|
border-top: 1px solid #f3f3f3;
|
|
35
37
|
/* background-color: ${TMColors.primary_container}; */
|
|
36
38
|
background-color: white;
|
|
@@ -45,6 +47,8 @@ const StyledMessageToolbar = styled.div `
|
|
|
45
47
|
gap: clamp(2px, 1vw, 5px);
|
|
46
48
|
padding: clamp(3px, 1vw, 5px);
|
|
47
49
|
user-select: none;
|
|
50
|
+
-webkit-touch-callout: none;
|
|
51
|
+
-webkit-user-select: none;
|
|
48
52
|
border-top: 1px solid #f3f3f3;
|
|
49
53
|
background-color: #ffffff;
|
|
50
54
|
z-index: 1;
|
|
@@ -69,6 +73,8 @@ const TabContextContainer = styled.div `
|
|
|
69
73
|
border-radius: 5px;
|
|
70
74
|
overflow: auto;
|
|
71
75
|
user-select: none;
|
|
76
|
+
-webkit-touch-callout: none;
|
|
77
|
+
-webkit-user-select: none;
|
|
72
78
|
position: relative;
|
|
73
79
|
`;
|
|
74
80
|
const StyledAppVersionText = styled.p `
|
|
@@ -42,6 +42,8 @@ const StyledSearchCardContent = styled.div `
|
|
|
42
42
|
|
|
43
43
|
position: relative;
|
|
44
44
|
user-select: none;
|
|
45
|
+
-webkit-touch-callout: none;
|
|
46
|
+
-webkit-user-select: none;
|
|
45
47
|
`;
|
|
46
48
|
const TMToolbarCard = ({ items = [], onItemClick, selectedItem, showPanel, color = TMColors.colorHeader, backgroundColor = TMColors.backgroundColorHeader, backgroundColorContainer, children, showHeader = true, title, totalItems, displayedItemsCount, toolbar, padding = '3px', onBack, onClose, onHeaderDoubleClick }) => {
|
|
47
49
|
return (_jsxs(StyledSearchCard, { children: [showHeader && _jsx(StyledSearchCardHeader, { "$backgroundColor": backgroundColor, "$color": color, onDoubleClick: () => { if (onHeaderDoubleClick)
|
|
@@ -22,10 +22,11 @@ interface ITMTreeViewProps<T extends ITMTreeItem> {
|
|
|
22
22
|
onNodeUpdate?: (updatedNode: T) => void;
|
|
23
23
|
onDataChanged?: (items: T[]) => void;
|
|
24
24
|
shouldDelayFocusOnEvent?: (node: T, event: React.MouseEvent) => boolean;
|
|
25
|
+
autoSelectChildren?: boolean;
|
|
25
26
|
itemsPerPage?: number;
|
|
26
27
|
showLoadMoreButton?: boolean;
|
|
27
28
|
}
|
|
28
|
-
declare const TMTreeView: <T extends ITMTreeItem>({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, itemsPerPage, showLoadMoreButton }: ITMTreeViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare const TMTreeView: <T extends ITMTreeItem>({ dataSource, focusedItem, selectedItems, allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, autoSelectChildren, itemsPerPage, showLoadMoreButton }: ITMTreeViewProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export default TMTreeView;
|
|
30
31
|
export declare const StyledTreeNode: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
31
32
|
$isSelected?: boolean;
|
|
@@ -3,7 +3,7 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { IconChevronDown, IconChevronRight } from '../../helper';
|
|
5
5
|
import TMButton from './TMButton';
|
|
6
|
-
const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, itemsPerPage = 100, showLoadMoreButton = true }) => {
|
|
6
|
+
const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMultipleSelection, onDataChanged, calculateItemsForNode, itemRender, onNodeUpdate, onFocusedItemChanged, onSelectionChanged, shouldDelayFocusOnEvent, autoSelectChildren = true, itemsPerPage = 100, showLoadMoreButton = true }) => {
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
const handleKeyDown = (event) => {
|
|
9
9
|
if (!focusedItem)
|
|
@@ -187,47 +187,51 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
187
187
|
};
|
|
188
188
|
let newSelectedItems;
|
|
189
189
|
if (checked) {
|
|
190
|
-
if (node.isContainer) {
|
|
191
|
-
// Quando selezioni un container, aggiungi il container stesso + tutti i figli
|
|
190
|
+
if (node.isContainer && autoSelectChildren) {
|
|
191
|
+
// Quando selezioni un container, aggiungi il container stesso + tutti i figli (se autoSelectChildren è true)
|
|
192
192
|
const allChildren = flattenTree(node.items || []);
|
|
193
193
|
newSelectedItems = [...selectedItems, node, ...allChildren];
|
|
194
194
|
}
|
|
195
195
|
else if (!selectedItems.some(item => item.key === node.key)) {
|
|
196
|
-
// Quando selezioni un figlio, aggiungi il
|
|
196
|
+
// Quando selezioni un figlio o un container con autoSelectChildren=false, aggiungi solo il nodo
|
|
197
197
|
newSelectedItems = [...selectedItems, node];
|
|
198
|
-
// Verifica se selezionando questo figlio sono ora selezionati tutti i figli del parent
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
// Verifica se selezionando questo figlio sono ora selezionati tutti i figli del parent (solo se autoSelectChildren è true)
|
|
199
|
+
if (autoSelectChildren) {
|
|
200
|
+
const parentsToAdd = findAndCheckParents(dataSource, node, newSelectedItems);
|
|
201
|
+
newSelectedItems = [...newSelectedItems, ...parentsToAdd];
|
|
202
|
+
}
|
|
201
203
|
}
|
|
202
204
|
else {
|
|
203
205
|
newSelectedItems = selectedItems;
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
|
-
else if (node.isContainer) {
|
|
207
|
-
// Quando deselezioni un container, rimuovi il container stesso + tutti i figli
|
|
208
|
+
else if (node.isContainer && autoSelectChildren) {
|
|
209
|
+
// Quando deselezioni un container, rimuovi il container stesso + tutti i figli (solo se autoSelectChildren è true)
|
|
208
210
|
const childKeys = flattenTree(node.items || []).map(item => item.key);
|
|
209
211
|
newSelectedItems = selectedItems.filter(item => item.key !== node.key && !childKeys.includes(item.key));
|
|
210
212
|
}
|
|
211
213
|
else {
|
|
212
|
-
// Quando deselezioni un figlio, rimuovi il
|
|
214
|
+
// Quando deselezioni un figlio o un container con autoSelectChildren=false, rimuovi solo il nodo
|
|
213
215
|
newSelectedItems = selectedItems.filter(item => item.key !== node.key);
|
|
214
|
-
// Se il figlio apparteneva a un parent che era selezionato, rimuovi anche il parent
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
216
|
+
// Se il figlio apparteneva a un parent che era selezionato, rimuovi anche il parent (solo se autoSelectChildren è true)
|
|
217
|
+
if (autoSelectChildren && !node.isContainer) {
|
|
218
|
+
const removeParentContainers = (items) => {
|
|
219
|
+
const parentsToRemove = [];
|
|
220
|
+
items.forEach(item => {
|
|
221
|
+
if (item.isContainer && item.items) {
|
|
222
|
+
const childKeys = flattenTree(item.items).map(child => child.key);
|
|
223
|
+
if (childKeys.includes(node.key)) {
|
|
224
|
+
parentsToRemove.push(item.key);
|
|
225
|
+
}
|
|
226
|
+
// Ricorsione per parent annidati
|
|
227
|
+
parentsToRemove.push(...removeParentContainers(item.items));
|
|
222
228
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
const parentsToRemove = removeParentContainers(dataSource);
|
|
230
|
-
newSelectedItems = newSelectedItems.filter(item => !parentsToRemove.includes(item.key));
|
|
229
|
+
});
|
|
230
|
+
return parentsToRemove;
|
|
231
|
+
};
|
|
232
|
+
const parentsToRemove = removeParentContainers(dataSource);
|
|
233
|
+
newSelectedItems = newSelectedItems.filter(item => !parentsToRemove.includes(item.key));
|
|
234
|
+
}
|
|
231
235
|
}
|
|
232
236
|
onSelectionChanged?.(newSelectedItems);
|
|
233
237
|
};
|
|
@@ -252,6 +256,9 @@ const TMTreeView = ({ dataSource = [], focusedItem, selectedItems = [], allowMul
|
|
|
252
256
|
// setTreeData(prevData => collapseAll(prevData));
|
|
253
257
|
// };
|
|
254
258
|
const isIndeterminate = (node) => {
|
|
259
|
+
// Lo stato indeterminate ha senso solo quando autoSelectChildren è true
|
|
260
|
+
if (!autoSelectChildren)
|
|
261
|
+
return false;
|
|
255
262
|
if (!node.isContainer || !node.items)
|
|
256
263
|
return false;
|
|
257
264
|
const childKeys = flattenTree(node.items).map(item => item.key);
|
|
@@ -8,6 +8,8 @@ interface ITMDataListItemChooserProps extends ITMChooserProps {
|
|
|
8
8
|
values?: string[];
|
|
9
9
|
/** Visualizza il bordo */
|
|
10
10
|
showBorder?: boolean;
|
|
11
|
+
/** Funzione per aggiornare lo stato di apertura della modale */
|
|
12
|
+
updateIsModalOpen?: (isOpen: boolean) => void;
|
|
11
13
|
}
|
|
12
14
|
declare const TMDataListItemChooser: React.FunctionComponent<ITMDataListItemChooserProps>;
|
|
13
15
|
export default TMDataListItemChooser;
|