@topconsultnpm/sdkui-react-beta 6.11.35 → 6.11.36
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.
|
@@ -29,8 +29,11 @@ export interface FileItem {
|
|
|
29
29
|
ext?: string;
|
|
30
30
|
creationTime?: Date;
|
|
31
31
|
lastUpdateTime?: Date;
|
|
32
|
+
updaterID?: number;
|
|
33
|
+
updaterName?: string;
|
|
32
34
|
description?: string;
|
|
33
35
|
checkOutUserID?: number;
|
|
36
|
+
checkOutUserName?: string;
|
|
34
37
|
checkoutDate?: Date | null;
|
|
35
38
|
size?: number;
|
|
36
39
|
version?: number;
|
|
@@ -57,6 +60,8 @@ export interface TMFileManagerProps {
|
|
|
57
60
|
folder: Array<TMFileManagerContextMenuItem>;
|
|
58
61
|
file: Array<TMFileManagerContextMenuItem>;
|
|
59
62
|
};
|
|
63
|
+
/** Selected Folder */
|
|
64
|
+
selectedFolder: FileItem | undefined;
|
|
60
65
|
/** Array of selected files */
|
|
61
66
|
selectedFiles?: Array<FileItem>;
|
|
62
67
|
/** The currently focused file */
|
|
@@ -17,15 +17,13 @@ export var TMFileManagerPageSize;
|
|
|
17
17
|
})(TMFileManagerPageSize || (TMFileManagerPageSize = {}));
|
|
18
18
|
const TMFileManager = (props) => {
|
|
19
19
|
// Destructure the treeFs prop to get the root file system
|
|
20
|
-
const { treeFs, selectedFiles, focusedFile, handleSelectedFiles, handleFocusedFile, handleSelectedFolder, viewMode: initialViewMode, contextMenuItems, onDoubleClickHandler,
|
|
20
|
+
const { treeFs, selectedFolder, selectedFiles, focusedFile, handleSelectedFiles, handleFocusedFile, handleSelectedFolder, viewMode: initialViewMode, contextMenuItems, onDoubleClickHandler, thumbnailsViewItemComponent, handleDropFileCallback } = props;
|
|
21
21
|
// State to manage the current view mode ('thumbnails' or 'details')
|
|
22
22
|
const [viewMode, setViewMode] = useState(initialViewMode ?? 'thumbnails');
|
|
23
23
|
// State to store the search text entered by the user
|
|
24
24
|
const [searchText, setSearchText] = useState('');
|
|
25
25
|
// State to store transformed directory data for file manager
|
|
26
26
|
const [treeViewData, setTreeViewData] = useState([]);
|
|
27
|
-
// State to store the currently selected folder item
|
|
28
|
-
const [selectedFolder, setSelectedFolder] = useState(undefined);
|
|
29
27
|
// State to store the filtered file items after search or filtering
|
|
30
28
|
const [filteredFileItems, setFilteredFileItems] = useState([]);
|
|
31
29
|
// State to control the collapse/expand of the left panel
|
|
@@ -35,13 +33,11 @@ const TMFileManager = (props) => {
|
|
|
35
33
|
// State to track whether a file drag operation is in progress
|
|
36
34
|
const [isDragging, setIsDragging] = useState(false);
|
|
37
35
|
// State to store context menu items for file manager actions
|
|
38
|
-
const [menuItems, setMenuItems] = useState([]);
|
|
36
|
+
const [menuItems, setMenuItems] = useState({ folder: [], file: [] });
|
|
39
37
|
// State to manage the anchor element for context menu positioning
|
|
40
38
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
41
|
-
// Effect to initialize the context menu items when the component mounts or contextMenuItems change
|
|
42
39
|
useEffect(() => {
|
|
43
|
-
|
|
44
|
-
setMenuItems(contextMenuItems?.file);
|
|
40
|
+
setMenuItems(contextMenuItems ?? { folder: [], file: [] });
|
|
45
41
|
}, [contextMenuItems]);
|
|
46
42
|
const onTreeViewContextMenu = (event) => {
|
|
47
43
|
if (event === undefined)
|
|
@@ -49,7 +45,7 @@ const TMFileManager = (props) => {
|
|
|
49
45
|
event.preventDefault();
|
|
50
46
|
setAnchorEl(event.currentTarget);
|
|
51
47
|
const items = contextMenuItems ?? { folder: [], file: [] };
|
|
52
|
-
setMenuItems(items
|
|
48
|
+
setMenuItems(items);
|
|
53
49
|
};
|
|
54
50
|
const onViewContextMenu = (event) => {
|
|
55
51
|
if (event === undefined)
|
|
@@ -57,7 +53,7 @@ const TMFileManager = (props) => {
|
|
|
57
53
|
event.preventDefault();
|
|
58
54
|
setAnchorEl(event.currentTarget);
|
|
59
55
|
const items = contextMenuItems ?? { folder: [], file: [] };
|
|
60
|
-
setMenuItems(items
|
|
56
|
+
setMenuItems(items);
|
|
61
57
|
};
|
|
62
58
|
// Handle closing the context menu
|
|
63
59
|
const closeContextMenu = useCallback(() => {
|
|
@@ -89,10 +85,16 @@ const TMFileManager = (props) => {
|
|
|
89
85
|
useEffect(() => {
|
|
90
86
|
const extractedTexts = extractTextsFromDirectory(treeViewData);
|
|
91
87
|
// Reset the selected file item if its name is not found in the extracted texts.
|
|
92
|
-
if (selectedFolder
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
if (selectedFolder)
|
|
89
|
+
if (!extractedTexts.includes(selectedFolder.name)) {
|
|
90
|
+
handleSelectedFolder?.(undefined);
|
|
91
|
+
setIsLeftPanelCollapsed(false);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// update selectedFolder
|
|
95
|
+
const item = selectedFolder.id === treeFs.id ? treeFs : findFileItems(treeFs.items, selectedFolder.id);
|
|
96
|
+
handleSelectedFolder?.(item);
|
|
97
|
+
}
|
|
96
98
|
}, [treeViewData]);
|
|
97
99
|
useEffect(() => {
|
|
98
100
|
// Filter items whenever searchText or selectedFolder changes
|
|
@@ -125,14 +127,14 @@ const TMFileManager = (props) => {
|
|
|
125
127
|
});
|
|
126
128
|
};
|
|
127
129
|
// Function to find a specific file or folder based on its ID (used for finding nested items)
|
|
128
|
-
const findFileItems = (items,
|
|
130
|
+
const findFileItems = (items, id) => {
|
|
129
131
|
for (let item of items) {
|
|
130
|
-
if (item.id ===
|
|
132
|
+
if (item.id === id) {
|
|
131
133
|
return item; // Return the found item
|
|
132
134
|
}
|
|
133
135
|
// Recursively search in sub-items if any
|
|
134
136
|
if (item.items) {
|
|
135
|
-
const found = findFileItems(item.items,
|
|
137
|
+
const found = findFileItems(item.items, id);
|
|
136
138
|
if (found) {
|
|
137
139
|
return found; // Return the found item from recursive call
|
|
138
140
|
}
|
|
@@ -143,7 +145,7 @@ const TMFileManager = (props) => {
|
|
|
143
145
|
// Render each TreeView item (directories) with custom styling/icons
|
|
144
146
|
const renderTreeViewItem = (itemData) => {
|
|
145
147
|
const isSelected = selectedFolder && selectedFolder.id === itemData.id;
|
|
146
|
-
return (_jsxs("div", { style: {
|
|
148
|
+
return (_jsxs("div", { style: { whiteSpace: "nowrap" }, className: isSelected ? 'treeview-selected-item-manager' : '', children: [_jsx(IconFolder, { style: { marginRight: 5, color: '#e6c200' } }), itemData.text, " (", itemData.subFileFolderCount, ")"] }));
|
|
147
149
|
};
|
|
148
150
|
// Function to handle item click event in the TreeView
|
|
149
151
|
const handleTreeViewItemClick = (e) => {
|
|
@@ -151,7 +153,6 @@ const TMFileManager = (props) => {
|
|
|
151
153
|
return;
|
|
152
154
|
const clickedItemId = e.itemData.id;
|
|
153
155
|
const item = clickedItemId === treeFs.id ? treeFs : findFileItems(treeFs.items, clickedItemId);
|
|
154
|
-
setSelectedFolder(item);
|
|
155
156
|
handleSelectedFolder?.(item);
|
|
156
157
|
handleFocusedFile?.(undefined);
|
|
157
158
|
handleSelectedFiles?.([]);
|
|
@@ -172,7 +173,6 @@ const TMFileManager = (props) => {
|
|
|
172
173
|
if (handleDropFileCallback)
|
|
173
174
|
handleDropFileCallback(files);
|
|
174
175
|
};
|
|
175
|
-
// Prevent default behavior (i.e., preventing the page from navigating)
|
|
176
176
|
const handleDragOver = (e) => {
|
|
177
177
|
e.preventDefault();
|
|
178
178
|
setIsDragging(true);
|
|
@@ -186,7 +186,7 @@ const TMFileManager = (props) => {
|
|
|
186
186
|
display: "flex",
|
|
187
187
|
flexGrow: 1,
|
|
188
188
|
height: "calc(100% - 40px)"
|
|
189
|
-
}, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "50%", isLeftPanelCollapsed ? '100%' : "50%"], children: [_jsxs("div", { style: { height: "100%", width: "100%" }, onContextMenu: onTreeViewContextMenu, children: [_jsx(TreeView, { style: { marginTop: "10px" }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }), anchorEl && _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%" }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_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: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onContextMenu: onViewContextMenu, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { items: filteredFileItems, selectedFiles: selectedFiles, contextMenuItems: contextMenuItems?.file, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, thumbnailsViewItemComponent: thumbnailsViewItemComponent }), viewMode === 'details' && _jsx(DetailsView, { items: filteredFileItems, contextMenuItems: contextMenuItems?.file, selectedFiles: selectedFiles, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler }), anchorEl && _jsx(ContextMenu, { dataSource: menuItems, target: anchorEl, onHiding: closeContextMenu })] })] })] }, "TMWGs-panels-treeView") })] });
|
|
189
|
+
}, children: _jsxs(TMSplitterLayout, { direction: 'horizontal', showSeparator: true, separatorColor: 'transparent', separatorActiveColor: 'transparent', min: ['0', '0'], start: [isLeftPanelCollapsed ? '0%' : "50%", isLeftPanelCollapsed ? '100%' : "50%"], children: [_jsxs("div", { style: { height: "100%", width: "100%" }, onContextMenu: onTreeViewContextMenu, children: [_jsx(TreeView, { style: { marginTop: "10px" }, dataSource: treeViewData, displayExpr: "text", itemRender: renderTreeViewItem, onItemClick: handleTreeViewItemClick }), anchorEl && _jsx(ContextMenu, { dataSource: menuItems.folder, target: anchorEl, onHiding: closeContextMenu })] }), _jsxs("div", { style: { backgroundColor: "#fff", width: "100%", height: "100%" }, children: [_jsxs(Toolbar, { style: { backgroundColor: '#f4f4f4', height: "40px", paddingLeft: "5px", paddingRight: '5px' }, children: [_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: '160px', searchValue: searchText, onSearchValueChanged: (e) => handleSearchChange(e) }) })] }), _jsxs("div", { onDrop: handleDrop, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onContextMenu: onViewContextMenu, style: { width: "100%", height: "calc(100% - 40px)", border: isDragging ? '2px solid red' : '2px solid transparent' }, children: [viewMode === 'thumbnails' && _jsx(ThumbnailsView, { items: filteredFileItems, selectedFiles: selectedFiles, contextMenuItems: contextMenuItems?.file, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler, thumbnailsViewItemComponent: thumbnailsViewItemComponent }), viewMode === 'details' && _jsx(DetailsView, { items: filteredFileItems, contextMenuItems: contextMenuItems?.file, selectedFiles: selectedFiles, focusedFile: focusedFile, handleSelectedFiles: handleSelectedFiles, handleFocusedFile: handleFocusedFile, onDoubleClickHandler: onDoubleClickHandler }), anchorEl && _jsx(ContextMenu, { dataSource: menuItems.file, target: anchorEl, onHiding: closeContextMenu })] })] })] }, "TMWGs-panels-treeView") })] });
|
|
190
190
|
};
|
|
191
191
|
export default TMFileManager;
|
|
192
192
|
const DetailsView = (props) => {
|
|
@@ -231,6 +231,7 @@ const DetailsView = (props) => {
|
|
|
231
231
|
{ dataField: "name", caption: SDKUI_Localizator.Name },
|
|
232
232
|
{ dataField: "version", caption: SDKUI_Localizator.Version },
|
|
233
233
|
{ dataField: "size", caption: SDKUI_Localizator.Size, cellRender: (cellData) => formatBytes(cellData.data.size ?? 0) },
|
|
234
|
+
{ dataField: "updaterName", caption: SDKUI_Localizator.Author },
|
|
234
235
|
{ dataField: "lastUpdateTime", caption: SDKUI_Localizator.LastUpdateTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
|
|
235
236
|
{ dataField: "creationTime", caption: SDKUI_Localizator.CreationTime, dataType: 'datetime', format: 'dd/MM/yyyy HH:mm', cellRender: cellDatetimeRender },
|
|
236
237
|
], focusedRowKey: focusedFile?.id, selectedRowKeys: selectedFiles?.map(file => file.id), onFocusedRowChanged: onFocusedRowChanged, onSelectionChanged: onSelectionChanged, onRowDblClick: onRowDblClick, onContextMenuPreparing: onContextMenuPreparing, showSearchPanel: false, showRowLines: SDKUI_Globals.dataGridShowRowLines, showColumnLines: SDKUI_Globals.dataGridShowColumnLines })) : _jsx("div", { style: { width: "100%", height: "100%", display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: '10px' }, children: SDKUI_Localizator.FolderIsEmpty });
|
|
@@ -34,6 +34,7 @@ export declare class SDKUI_Localizator {
|
|
|
34
34
|
static get AuthMode(): "Authentifizierungsmodus" | "Authentication mode" | "Modo de autenticación" | "Mode d'authentification" | "Modo de autenticação" | "Modalità di autenticazione";
|
|
35
35
|
static get AuthMode_OnBehalfOf(): string;
|
|
36
36
|
static get AuthMode_WindowsViaTopMedia(): "Windows-Authentifizierung über TopMedia" | "Windows authentication via TopMedia" | "Autenticación de Windows a través de TopMedia" | "Authentification Windows via TopMedia" | "Autenticação Windows via TopMedia" | "Autenticazione Windows tramite TopMedia";
|
|
37
|
+
static get Author(): string;
|
|
37
38
|
static get Back(): "Zurück" | "Back" | "Atrás" | "Dos" | "Voltar" | "Indietro";
|
|
38
39
|
static get BatchUpdate(): "Mehrfachbearbeitung" | "Multiple modification" | "Modificación múltiple" | "Modifie multiple" | "Editar múltipla" | "Modifica multipla";
|
|
39
40
|
static get BlogCase(): "Anschlagbrett" | "Blog board" | "Tablón" | "Tableau d'affichage" | "Bakeca" | "Bacheca";
|
|
@@ -289,6 +289,16 @@ export class SDKUI_Localizator {
|
|
|
289
289
|
default: return "Autenticazione Windows tramite TopMedia";
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
+
static get Author() {
|
|
293
|
+
switch (this._cultureID) {
|
|
294
|
+
case CultureIDs.De_DE: return "Autor";
|
|
295
|
+
case CultureIDs.En_US: return "Author";
|
|
296
|
+
case CultureIDs.Es_ES: return "Autor";
|
|
297
|
+
case CultureIDs.Fr_FR: return "Auteur";
|
|
298
|
+
case CultureIDs.Pt_PT: return "Autor";
|
|
299
|
+
default: return "Autore";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
292
302
|
static get Back() {
|
|
293
303
|
switch (this._cultureID) {
|
|
294
304
|
case CultureIDs.De_DE: return "Zurück";
|