@topconsultnpm/sdkui-react 6.21.0-dev1.30 → 6.21.0-dev1.31
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.
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import FileManager, { Column, Details, ItemView, Permissions, Notifications, ContextMenu, Toolbar, Item } from 'devextreme-react/file-manager';
|
|
4
|
-
import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals } from '@topconsultnpm/sdk-ts';
|
|
4
|
+
import { FileDescriptor, FileFormats, FileTransferModes, SDK_Localizator, SDK_Globals, AppModules } from '@topconsultnpm/sdk-ts';
|
|
5
5
|
import CustomFileSystemProvider from 'devextreme/file_management/custom_provider';
|
|
6
6
|
import FileSystemError from "devextreme/file_management/error";
|
|
7
7
|
import Button from "devextreme/ui/button";
|
|
8
8
|
import { alert, confirm } from "devextreme/ui/dialog";
|
|
9
9
|
import { loadMessages } from 'devextreme/localization';
|
|
10
|
-
import { Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
|
|
10
|
+
import { getFileManagerFolderColor, Globalization, IconAll, IconCloud, IconFolder, IconFolderForCSS, IconSelected, SDKUI_Localizator, svgToString } from '../../helper';
|
|
11
11
|
import { TMExceptionBoxManager } from './TMPopUp';
|
|
12
12
|
import ShowAlert from './TMAlert';
|
|
13
13
|
import { TMLayoutWaitingContainer } from './TMWaitPanel';
|
|
14
14
|
import TMCounterContainer, { CounterItemKey } from './TMCounterContainer';
|
|
15
15
|
import { IconPdf, IconTxt, IconXls, IconDocx, IconImage, IconZip, IconXml, IconMp4, IconEmail, IconPpt, IconSigned, IconExe, IconHtml, IconDwg, IconDicom, IconSlddrw } from '../../assets/thumbnails';
|
|
16
|
-
import { TMColors } from '../../utils/theme';
|
|
17
16
|
import styled from 'styled-components';
|
|
18
17
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
19
18
|
export class TMFileSystemItem {
|
|
@@ -25,8 +24,10 @@ export class TMFileSystemItem {
|
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
let abortController = new AbortController();
|
|
28
|
-
const
|
|
29
|
-
const
|
|
27
|
+
const generateSvgDataUrl = (color) => {
|
|
28
|
+
const svgString = encodeURIComponent(renderToStaticMarkup(_jsx(IconFolderForCSS, { fill: color })));
|
|
29
|
+
return `data:image/svg+xml,${svgString}`;
|
|
30
|
+
};
|
|
30
31
|
const StyledFileManagerWrapper = styled.div `
|
|
31
32
|
.dx-filemanager .dx-treeview-item .dx-icon-folder {
|
|
32
33
|
display: none !important;
|
|
@@ -44,7 +45,7 @@ const StyledFileManagerWrapper = styled.div `
|
|
|
44
45
|
width: 20px;
|
|
45
46
|
height: 20px;
|
|
46
47
|
transform: translateY(-50%);
|
|
47
|
-
background-image: url("${
|
|
48
|
+
background-image: url("${props => generateSvgDataUrl(props.$folderColor)}");
|
|
48
49
|
background-size: contain;
|
|
49
50
|
background-repeat: no-repeat;
|
|
50
51
|
display: inline-block;
|
|
@@ -647,7 +648,7 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
647
648
|
};
|
|
648
649
|
const customizeIcon = useCallback((fileSystemItem) => {
|
|
649
650
|
if (fileSystemItem.isDirectory) {
|
|
650
|
-
return svgToString(_jsx(IconFolder, { fontSize: 20, color:
|
|
651
|
+
return svgToString(_jsx(IconFolder, { fontSize: 20, color: getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER) }));
|
|
651
652
|
}
|
|
652
653
|
else {
|
|
653
654
|
const fileExtension = fileSystemItem.getFileExtension();
|
|
@@ -738,11 +739,12 @@ const TMAreaManager = (props = { selectionMode: 'multiple', isPathChooser: false
|
|
|
738
739
|
alert(`"${e.name}" ${SDKUI_Localizator.FolderExist}`, SDKUI_Localizator.Attention);
|
|
739
740
|
}
|
|
740
741
|
};
|
|
741
|
-
|
|
742
|
+
const folderColor = getFileManagerFolderColor(SDK_Globals.tmSession?.SessionDescr?.appModuleID ?? AppModules.SURFER);
|
|
743
|
+
return (_jsx(TMLayoutWaitingContainer, { direction: 'vertical', showWaitPanel: showWaitPanel, showWaitPanelPrimary: showPrimary, showWaitPanelSecondary: showSecondary, waitPanelTitle: waitPanelTitle, waitPanelTextPrimary: waitPanelTextPrimary, waitPanelValuePrimary: waitPanelValuePrimary, waitPanelMaxValuePrimary: waitPanelMaxValuePrimary, waitPanelTextSecondary: waitPanelTextSecondary, waitPanelValueSecondary: waitPanelValueSecondary, waitPanelMaxValueSecondary: waitPanelMaxValueSecondary, isCancelable: true, abortController: abortController, children: _jsxs(StyledFileManagerWrapper, { "$folderColor": folderColor, style: { width: "100%", height: "100%" }, children: [_jsxs(FileManager, { width: props.width, ref: fileManagerRef, height: `calc(${props.height} - 30px)`, onItemMoving: onItemCopying, onItemCopying: onItemCopying, onFileUploading: onFileUploading, fileSystemProvider: areaProvider, customizeThumbnail: customizeIcon, rootFolderName: SDK_Localizator.Areas, onSelectionChanged: onSelectionChanged, onDirectoryCreating: onDirectoryCreating, onFocusedItemChanged: onFocusedItemChanged, onSelectedFileOpened: onSelectedFileOpened, onContextMenuItemClick: onContextMenuItemClick,
|
|
742
744
|
/* onItemMoved={() => setCounter(counter => counter + 1)}
|
|
743
745
|
onItemCopied={() => setCounter(counter => counter + 1)}
|
|
744
746
|
onItemDeleted={() => setCounter(counter => counter - 1)}
|
|
745
747
|
onFileUploaded={() => setCounter(counter => counter + 1)} */
|
|
746
|
-
onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }),
|
|
748
|
+
onCurrentDirectoryChanged: onCurrentDirectoryChanged, selectionMode: props.selectionMode === 'single' ? 'single' : selectionMode, children: [_jsxs(Toolbar, { children: [_jsx(Item, { name: "showNavPane", visible: true }), _jsx(Item, { name: "create", visible: true }), _jsx(Item, { name: "upload", visible: true }), _jsx(Item, { name: "separator", location: 'after' }), _jsx(Item, { name: "switchView", visible: true }), _jsx(Item, { name: "refresh", visible: true })] }), _jsx(ContextMenu, { items: ["create", "upload", "rename", "move", "copy", "delete", "refresh", "download"] }), _jsx(Permissions, { copy: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, move: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, create: focusedFileSystemItem && focusedFileSystemItem.name !== "", upload: focusedFileSystemItem && focusedFileSystemItem.name !== "", rename: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, delete: focusedFileSystemItem && focusedFileSystemItem.name !== "" && getSubFolder(focusedFileSystemItem.path).length > 0, download: true }), _jsx(ItemView, { children: _jsxs(Details, { children: [_jsx(Column, { dataField: "thumbnail", cssClass: 'file-thumbnail' }, "thumbnail"), _jsx(Column, { dataField: "name", caption: SDKUI_Localizator.Name }, "name"), _jsx(Column, { dataField: 'size', width: '120px', alignment: 'center', dataType: 'number', caption: SDKUI_Localizator.File_Size }, "size"), _jsx(Column, { dataField: 'dateModified', width: '160px', alignment: 'center', dataType: 'datetime', caption: SDKUI_Localizator.Date_Modified }, "dateModified")] }) }), _jsx(Notifications, { showPopup: true, showPanel: true })] }), _jsx("div", { style: { width: "100%", height: "30px", overflowY: "hidden" }, children: _jsx(TMCounterContainer, { items: counterValues }) })] }) }));
|
|
747
749
|
};
|
|
748
750
|
export default TMAreaManager;
|
package/lib/helper/TMUtils.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare const parseSignatureConfiguration: (did: number, informationSign:
|
|
|
41
41
|
export declare const convertSearchResultDescriptorToFileItems: (documents: Array<SearchResultDescriptor>) => Array<FileItem>;
|
|
42
42
|
export declare const getAppModuleGradient: (appModuleID: AppModules) => string;
|
|
43
43
|
export declare const getPanelManagerToolbarColor: (appModuleID: AppModules) => string;
|
|
44
|
+
export declare const getFileManagerFolderColor: (appModuleID: AppModules) => string;
|
|
44
45
|
type SearchToolbarVisibility = {
|
|
45
46
|
tmSearchResult: boolean;
|
|
46
47
|
tmBlog: boolean;
|
package/lib/helper/TMUtils.js
CHANGED
|
@@ -374,6 +374,18 @@ export const getPanelManagerToolbarColor = (appModuleID) => {
|
|
|
374
374
|
return 'transparent linear-gradient(90deg, #CCE0F4 0%, #7EC1E7 14%, #39A6DB 28%, #1E9CD7 35%, #0075BE 78%, #005B97 99%) 0% 0% no-repeat padding-box';
|
|
375
375
|
}
|
|
376
376
|
};
|
|
377
|
+
export const getFileManagerFolderColor = (appModuleID) => {
|
|
378
|
+
switch (appModuleID) {
|
|
379
|
+
case AppModules.SURFER:
|
|
380
|
+
return '#2559a5';
|
|
381
|
+
case AppModules.DESIGNER:
|
|
382
|
+
return '#482234';
|
|
383
|
+
case AppModules.ORCHESTRATOR:
|
|
384
|
+
return '#1d6f42';
|
|
385
|
+
default:
|
|
386
|
+
return '#2559a5';
|
|
387
|
+
}
|
|
388
|
+
};
|
|
377
389
|
export const getSearchToolbarVisibility = (appModuleID) => {
|
|
378
390
|
switch (appModuleID) {
|
|
379
391
|
case AppModules.SURFER:
|