@topconsultnpm/sdkui-react 6.19.0-dev2.18 → 6.19.0-dev2.19
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/components/base/TMFileManager.js +10 -1
- package/lib/components/base/TMFileManagerDataGridView.d.ts +2 -0
- package/lib/components/base/TMFileManagerDataGridView.js +11 -2
- package/lib/components/base/TMFileManagerThumbnailItems.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailItems.js +12 -2
- package/lib/components/base/TMFileManagerThumbnailsView.d.ts +2 -0
- package/lib/components/base/TMFileManagerThumbnailsView.js +2 -2
- package/lib/components/grids/TMBlogsPost.d.ts +1 -0
- package/lib/components/grids/TMBlogsPost.js +6 -1
- package/package.json +1 -1
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.d.ts +0 -4
- package/lib/components/NewComponents/ContextMenu/TMContextMenu.js +0 -187
- package/lib/components/NewComponents/ContextMenu/hooks.d.ts +0 -11
- package/lib/components/NewComponents/ContextMenu/hooks.js +0 -48
- package/lib/components/NewComponents/ContextMenu/index.d.ts +0 -2
- package/lib/components/NewComponents/ContextMenu/index.js +0 -1
- package/lib/components/NewComponents/ContextMenu/styles.d.ts +0 -27
- package/lib/components/NewComponents/ContextMenu/styles.js +0 -308
- package/lib/components/NewComponents/ContextMenu/types.d.ts +0 -26
- package/lib/components/NewComponents/ContextMenu/types.js +0 -1
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.d.ts +0 -4
- package/lib/components/NewComponents/FloatingMenuBar/TMFloatingMenuBar.js +0 -370
- package/lib/components/NewComponents/FloatingMenuBar/index.d.ts +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/index.js +0 -2
- package/lib/components/NewComponents/FloatingMenuBar/styles.d.ts +0 -38
- package/lib/components/NewComponents/FloatingMenuBar/styles.js +0 -267
- package/lib/components/NewComponents/FloatingMenuBar/types.d.ts +0 -30
- package/lib/components/NewComponents/FloatingMenuBar/types.js +0 -1
- 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
|
@@ -13,6 +13,7 @@ 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
|
|
@@ -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) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileItem } from './TMFileManagerUtils';
|
|
3
|
+
import { UserDescriptor } from '@topconsultnpm/sdk-ts';
|
|
3
4
|
export interface TMFileManagerThumbnailItemsProps {
|
|
4
5
|
items: Array<FileItem>;
|
|
6
|
+
allUsers: Array<UserDescriptor>;
|
|
5
7
|
paginatedItems: Array<FileItem>;
|
|
6
8
|
focusedFile: FileItem | undefined;
|
|
7
9
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
@@ -6,7 +6,7 @@ import TMTooltip from './TMTooltip';
|
|
|
6
6
|
import TMDcmtIcon from '../features/documents/TMDcmtIcon';
|
|
7
7
|
const TMFileManagerThumbnailItems = (props) => {
|
|
8
8
|
// Destructuring props for cleaner usage
|
|
9
|
-
const { items, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile, setDraftThumbViewAnchor } = props;
|
|
9
|
+
const { items, allUsers, paginatedItems, selectedFiles, searchText, userID, onDoubleClick, handleSelectedFiles, handleFocusedFile, setDraftThumbViewAnchor } = props;
|
|
10
10
|
// Ref for the scrollable container
|
|
11
11
|
const containerRef = useRef(null);
|
|
12
12
|
// Stores index of the last selected item for shift selection
|
|
@@ -112,6 +112,16 @@ const TMFileManagerThumbnailItems = (props) => {
|
|
|
112
112
|
setDraftThumbViewAnchor(e.currentTarget);
|
|
113
113
|
handleFocusedFile(item);
|
|
114
114
|
}, []);
|
|
115
|
+
const findCheckOutUserName = useCallback((item) => {
|
|
116
|
+
if (item.checkOutUserName) {
|
|
117
|
+
return item.checkOutUserName;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const checkOutUserID = item.checkOutUserID;
|
|
121
|
+
let checkOutUser = allUsers.find(user => user.id === checkOutUserID);
|
|
122
|
+
return checkOutUser ? checkOutUser.name : '-';
|
|
123
|
+
}
|
|
124
|
+
}, [allUsers]);
|
|
115
125
|
return _jsx("div", { style: { width: "100%", height: "100%" }, children: paginatedItems.map(item => {
|
|
116
126
|
const isSelected = selectedFiles?.map(file => file.id).includes(item.id) ?? false;
|
|
117
127
|
const checkoutDate = item.checkoutDate;
|
|
@@ -130,7 +140,7 @@ const TMFileManagerThumbnailItems = (props) => {
|
|
|
130
140
|
bgColor = isSelected ? colors.PRIMARY_BLUE : backgroundColors.lockMode;
|
|
131
141
|
bgHoverColor = isSelected ? colors.PRIMARY_BLUE : "#fff59d";
|
|
132
142
|
}
|
|
133
|
-
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), lockMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", item
|
|
143
|
+
const editLockTooltipText = _jsxs(_Fragment, { children: [_jsxs("div", { style: { textAlign: "center" }, children: [editMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-edit" }), SDKUI_Localizator.CurrentUserExtract] })), lockMode && (_jsxs(_Fragment, { children: [_jsx("i", { style: { fontSize: "18px", color: colors.MEDIUM_GREEN, fontWeight: "bold" }, className: "dx-icon-lock" }), SDKUI_Localizator.ExtractedFromOtherUser] }))] }), _jsx("hr", {}), _jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedBy }), ": ", findCheckOutUserName(item) ?? '-', " (ID: ", item.checkOutUserID, ")"] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.ExtractedOn }), ": ", Globalization.getDateTimeDisplayValue(item.checkoutDate?.toString())] })] }), _jsx("hr", {}), _jsx("ul", { children: _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Version }), ": ", item.version ?? 1] }) }), _jsx("hr", {}), _jsxs("ul", { children: [_jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.Type }), ": ", item.ext] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.CreationTime }), ": ", Globalization.getDateTimeDisplayValue(item.creationTime?.toString())] }), _jsxs("li", { children: ["- ", _jsx("span", { style: { fontWeight: 'bold' }, children: SDKUI_Localizator.LastUpdateTime }), ": ", Globalization.getDateTimeDisplayValue(item.lastUpdateTime?.toString())] })] })] })] });
|
|
134
144
|
const tooltipContent = (_jsxs("div", { style: { textAlign: 'left' }, children: [_jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "ID:" }), " ", item.id ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "DID:" }), " ", item.did ?? '-'] }), _jsxs("div", { children: [_jsx("span", { style: { fontWeight: 'bold' }, children: "TID:" }), " ", item.tid ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Name, ":"] }), " ", item.name ?? '-'] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Author, ":"] }), " ", item.updaterName ?? '-'] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Version, ":"] }), " ", item.version] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.Size, ":"] }), " ", formatBytes(item.size ?? 0)] }), _jsx("hr", {}), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.CreationTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.creationTime)] }), _jsxs("div", { children: [_jsxs("span", { style: { fontWeight: 'bold' }, children: [SDKUI_Localizator.LastUpdateTime, ":"] }), " ", Globalization.getDateTimeDisplayValue(item.lastUpdateTime)] })] }));
|
|
135
145
|
return _jsx(TMFileItemContainer, { className: "tm-file-manager-thumbnail-items", ref: containerRef, id: "tm-file-manager-thumbnail-item-" + item.id.toString(), "$backgroundColor": bgColor, "$bgHoverColor": bgHoverColor, "$textColor": textColor, onDoubleClick: () => onDoubleClickHandler(item), onContextMenu: (e) => onContextMenu(e, item), onClick: (e) => onClickHandler(e, item), tabIndex: 0, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', width: '100%' }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', flex: 1, minWidth: 0 }, children: [_jsxs("div", { style: { marginRight: '16px', flexShrink: 0 }, children: [_jsx(TMDcmtIcon, { tid: item.tid, did: item.did, fileExtension: item.ext, downloadMode: 'openInNewWindow', tooltipContent: tooltipContent }), editMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: !isSelected ? colors.MEDIUM_GREEN : '#fff', fontWeight: "bold" }, className: "dx-icon-edit" }) }), lockMode && _jsx(TMTooltip, { content: editLockTooltipText, children: _jsx("i", { style: { fontSize: "18px", color: !isSelected ? colors.MEDIUM_GREEN : '#fff', fontWeight: "bold" }, className: "dx-icon-lock" }) })] }), _jsxs("div", { style: { overflow: 'hidden', minWidth: 0 }, children: [_jsx("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block', fontSize: '1rem', fontWeight: "bold" }, children: _jsx(TMTooltip, { parentStyle: { overflow: 'hidden' }, childStyle: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block' }, children: renderHighlightedText(item.name, searchText, isSelected) }) }), _jsx("div", { style: { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', width: '100%', display: 'block', fontSize: 'calc(1rem - 1px)' }, children: formatBytes(item.size ?? 0) })] })] }), item.version && (_jsx("div", { style: { flexShrink: 0, marginLeft: '12px', whiteSpace: 'nowrap' }, children: _jsx(TMTooltip, { content: SDKUI_Localizator.Version, children: _jsx("div", { style: { border: "2px solid #28a745", backgroundColor: "#28a745", color: "#ffffff", borderRadius: '50%', width: '30px', height: '30px', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '12px', fontWeight: 'bold' }, children: item.version }) }) }))] }) }, "tm-file-manager-thumbnail-item-" + item.id);
|
|
136
146
|
}) });
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FileItem, TMFileManagerContextMenuItem } from "./TMFileManagerUtils";
|
|
3
|
+
import { UserDescriptor } from "@topconsultnpm/sdk-ts";
|
|
3
4
|
interface TMFileManagerThumbnailsViewProps {
|
|
4
5
|
items: Array<FileItem>;
|
|
6
|
+
allUsers: Array<UserDescriptor>;
|
|
5
7
|
focusedFile: FileItem | undefined;
|
|
6
8
|
handleFocusedFile: (fileItem: FileItem | undefined) => void;
|
|
7
9
|
selectedFiles: Array<FileItem>;
|
|
@@ -5,7 +5,7 @@ import { ContextMenu, Pagination, ScrollView } from "devextreme-react";
|
|
|
5
5
|
import TMFileManagerThumbnailItems from "./TMFileManagerThumbnailItems";
|
|
6
6
|
import { SDKUI_Localizator } from "../../helper";
|
|
7
7
|
const TMFileManagerThumbnailsView = (props) => {
|
|
8
|
-
const { items, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler, draftThumbViewAnchor, setDraftThumbViewAnchor } = props;
|
|
8
|
+
const { items, allUsers, focusedFile, handleFocusedFile, selectedFiles = [], handleSelectedFiles, fileContextMenuItems, searchText, userID, onDoubleClickHandler, draftThumbViewAnchor, setDraftThumbViewAnchor } = props;
|
|
9
9
|
const PAGE_SIZES = [TMFileManagerPageSize.Small, TMFileManagerPageSize.Medium, TMFileManagerPageSize.Large];
|
|
10
10
|
const initPageSize = TMFileManagerPageSize.Small;
|
|
11
11
|
const showPagination = (items?.length ?? 0) > initPageSize;
|
|
@@ -39,7 +39,7 @@ const TMFileManagerThumbnailsView = (props) => {
|
|
|
39
39
|
handleSelectedFiles?.([]);
|
|
40
40
|
};
|
|
41
41
|
return items.length > 0 ?
|
|
42
|
-
_jsxs("div", { style: { width: "100%", height: "100%" }, onContextMenu: onBackgroundContextMenu, children: [_jsx(ScrollView, { width: "100%", height: showPagination ? "calc(100% - 50px)" : "100%", useNative: true, direction: 'vertical', children: _jsx(TMFileManagerThumbnailItems, { items: items, paginatedItems: paginatedItems, focusedFile: focusedFile, selectedFiles: selectedFiles, userID: userID, searchText: searchText, handleFocusedFile: handleFocusedFile, handleSelectedFiles: handleSelectedFiles, onDoubleClick: handleItemDoubleClick, setDraftThumbViewAnchor: setDraftThumbViewAnchor }) }), showPagination && _jsx(Pagination, { height: "50px", showInfo: true, showNavigationButtons: true, allowedPageSizes: PAGE_SIZES, displayMode: 'compact', itemCount: items.length, pageIndex: pageIndex, pageSize: pageSize, onPageIndexChange: setPageIndex, onPageSizeChange: setPageSize }), draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] })
|
|
42
|
+
_jsxs("div", { style: { width: "100%", height: "100%" }, onContextMenu: onBackgroundContextMenu, children: [_jsx(ScrollView, { width: "100%", height: showPagination ? "calc(100% - 50px)" : "100%", useNative: true, direction: 'vertical', children: _jsx(TMFileManagerThumbnailItems, { items: items, allUsers: allUsers, paginatedItems: paginatedItems, focusedFile: focusedFile, selectedFiles: selectedFiles, userID: userID, searchText: searchText, handleFocusedFile: handleFocusedFile, handleSelectedFiles: handleSelectedFiles, onDoubleClick: handleItemDoubleClick, setDraftThumbViewAnchor: setDraftThumbViewAnchor }) }), showPagination && _jsx(Pagination, { height: "50px", showInfo: true, showNavigationButtons: true, allowedPageSizes: PAGE_SIZES, displayMode: 'compact', itemCount: items.length, pageIndex: pageIndex, pageSize: pageSize, onPageIndexChange: setPageIndex, onPageSizeChange: setPageSize }), draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] })
|
|
43
43
|
:
|
|
44
44
|
_jsxs("div", { onContextMenu: onBackgroundContextMenu, style: { width: "100%", height: "100%", display: 'flex', justifyContent: 'center', alignItems: 'center', marginTop: '10px' }, children: [SDKUI_Localizator.FolderIsEmpty, draftThumbViewAnchor && _jsx(ContextMenu, { id: 'fileViewContextMenuMobile', dataSource: fileContextMenuItems, target: draftThumbViewAnchor, onHiding: closeViewContextMenu })] });
|
|
45
45
|
};
|
|
@@ -74,6 +74,7 @@ interface TMBlogsPostProps {
|
|
|
74
74
|
externalBlogPost?: BlogPost;
|
|
75
75
|
/** Optional function to reset the external blog post */
|
|
76
76
|
resetExternalBlogPost?: () => void;
|
|
77
|
+
visible?: boolean;
|
|
77
78
|
allTasks?: Array<TaskDescriptor>;
|
|
78
79
|
getAllTasks?: () => Promise<void>;
|
|
79
80
|
deleteTaskByIdsCallback?: (deletedTaskIds: Array<number>) => Promise<void>;
|
|
@@ -30,7 +30,7 @@ const TMBlogsPost = (props) => {
|
|
|
30
30
|
isRestoreEnabled: false,
|
|
31
31
|
isRefreshEnabled: false,
|
|
32
32
|
isCreateContextualTask: false,
|
|
33
|
-
}, showFloatingCommentButton = false, showCommentFormCallback, showTaskFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, } = props;
|
|
33
|
+
}, showFloatingCommentButton = false, showCommentFormCallback, showTaskFormCallback, refreshCallback, showId, setShowId, refreshHomePageNews, markBlogAsRead, externalBlogPost, resetExternalBlogPost, visible = true, allTasks = [], getAllTasks, deleteTaskByIdsCallback, addTaskCallback, editTaskCallback, handleNavigateToWGs, handleNavigateToDossiers, } = props;
|
|
34
34
|
const { abortController, showWaitPanel, waitPanelTitle, showPrimary, waitPanelTextPrimary, waitPanelValuePrimary, waitPanelMaxValuePrimary, showSecondary, waitPanelTextSecondary, waitPanelValueSecondary, waitPanelMaxValueSecondary, downloadDcmtsAsync } = useDcmtOperations();
|
|
35
35
|
const bottomRef = useRef(null);
|
|
36
36
|
const containerRef = useRef(null);
|
|
@@ -222,6 +222,11 @@ const TMBlogsPost = (props) => {
|
|
|
222
222
|
if (setShowId)
|
|
223
223
|
setShowId(localShowId);
|
|
224
224
|
}, [localShowId]);
|
|
225
|
+
useEffect(() => {
|
|
226
|
+
if (!visible) {
|
|
227
|
+
closeContextMenu();
|
|
228
|
+
}
|
|
229
|
+
}, [visible]);
|
|
225
230
|
const toggleHeaderClick = () => {
|
|
226
231
|
setCurrentHeader(prevState => {
|
|
227
232
|
if (prevState === undefined) {
|
package/package.json
CHANGED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect } from 'react';
|
|
3
|
-
import * as S from './styles';
|
|
4
|
-
import { useIsMobile, useMenuPosition } from './hooks';
|
|
5
|
-
const TMContextMenu = ({ items, trigger = 'right', children }) => {
|
|
6
|
-
const [menuState, setMenuState] = useState({
|
|
7
|
-
visible: false,
|
|
8
|
-
position: { x: 0, y: 0 },
|
|
9
|
-
submenuStack: [items],
|
|
10
|
-
parentNames: [],
|
|
11
|
-
});
|
|
12
|
-
const [hoveredSubmenus, setHoveredSubmenus] = useState([]);
|
|
13
|
-
const isMobile = useIsMobile();
|
|
14
|
-
const menuRef = useRef(null);
|
|
15
|
-
const triggerRef = useRef(null);
|
|
16
|
-
const submenuTimeoutRef = useRef(null);
|
|
17
|
-
const { openLeft, openUp } = useMenuPosition(menuRef, menuState.position);
|
|
18
|
-
const handleClose = () => {
|
|
19
|
-
setMenuState(prev => ({
|
|
20
|
-
...prev,
|
|
21
|
-
visible: false,
|
|
22
|
-
submenuStack: [items],
|
|
23
|
-
parentNames: [],
|
|
24
|
-
}));
|
|
25
|
-
setHoveredSubmenus([]);
|
|
26
|
-
};
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!menuState.visible)
|
|
29
|
-
return;
|
|
30
|
-
const handleClickOutside = (event) => {
|
|
31
|
-
const target = event.target;
|
|
32
|
-
// Check if click is inside main menu
|
|
33
|
-
if (menuRef.current?.contains(target)) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
// Check if click is inside any submenu
|
|
37
|
-
const submenus = document.querySelectorAll('[data-submenu="true"]');
|
|
38
|
-
for (const submenu of Array.from(submenus)) {
|
|
39
|
-
if (submenu.contains(target)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Click is outside all menus, close them
|
|
44
|
-
handleClose();
|
|
45
|
-
};
|
|
46
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
47
|
-
document.addEventListener('touchstart', handleClickOutside);
|
|
48
|
-
return () => {
|
|
49
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
50
|
-
document.removeEventListener('touchstart', handleClickOutside);
|
|
51
|
-
};
|
|
52
|
-
}, [menuState.visible]);
|
|
53
|
-
const handleContextMenu = (e) => {
|
|
54
|
-
if (trigger === 'right') {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
setMenuState({
|
|
57
|
-
visible: true,
|
|
58
|
-
position: { x: e.clientX, y: e.clientY },
|
|
59
|
-
submenuStack: [items],
|
|
60
|
-
parentNames: [],
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const handleClick = (e) => {
|
|
65
|
-
if (trigger === 'left') {
|
|
66
|
-
e.preventDefault();
|
|
67
|
-
setMenuState({
|
|
68
|
-
visible: true,
|
|
69
|
-
position: { x: e.clientX, y: e.clientY },
|
|
70
|
-
submenuStack: [items],
|
|
71
|
-
parentNames: [],
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
const handleItemClick = (item) => {
|
|
76
|
-
if (item.disabled)
|
|
77
|
-
return;
|
|
78
|
-
// Always execute onClick if present
|
|
79
|
-
if (item.onClick) {
|
|
80
|
-
item.onClick();
|
|
81
|
-
}
|
|
82
|
-
if (item.submenu && item.submenu.length > 0) {
|
|
83
|
-
if (isMobile) {
|
|
84
|
-
// Mobile: Push submenu to stack
|
|
85
|
-
setMenuState(prev => ({
|
|
86
|
-
...prev,
|
|
87
|
-
submenuStack: [...prev.submenuStack, item.submenu],
|
|
88
|
-
parentNames: [...prev.parentNames, item.name],
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
// Desktop: Submenus are handled by hover, don't close menu
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
// No submenu: close menu after executing action
|
|
95
|
-
handleClose();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const handleBack = () => {
|
|
99
|
-
setMenuState(prev => ({
|
|
100
|
-
...prev,
|
|
101
|
-
submenuStack: prev.submenuStack.slice(0, -1),
|
|
102
|
-
parentNames: prev.parentNames.slice(0, -1),
|
|
103
|
-
}));
|
|
104
|
-
};
|
|
105
|
-
const handleMouseEnter = (item, event, depth = 0) => {
|
|
106
|
-
if (isMobile || !item.submenu || item.submenu.length === 0)
|
|
107
|
-
return;
|
|
108
|
-
if (submenuTimeoutRef.current) {
|
|
109
|
-
clearTimeout(submenuTimeoutRef.current);
|
|
110
|
-
submenuTimeoutRef.current = null;
|
|
111
|
-
}
|
|
112
|
-
const rect = event.currentTarget.getBoundingClientRect();
|
|
113
|
-
// Calculate if submenu should open upward based on available space
|
|
114
|
-
// Estimate submenu height: ~35px per item (accounting for smaller padding) + container padding
|
|
115
|
-
const estimatedSubmenuHeight = (item.submenu.length * 35) + 8;
|
|
116
|
-
const spaceBelow = window.innerHeight - rect.top;
|
|
117
|
-
const spaceAbove = rect.bottom;
|
|
118
|
-
// Open upward only if there's not enough space below AND there's more space above
|
|
119
|
-
const shouldOpenUp = spaceBelow < estimatedSubmenuHeight && spaceAbove > spaceBelow;
|
|
120
|
-
// Remove all submenus at this depth and deeper
|
|
121
|
-
setHoveredSubmenus(prev => {
|
|
122
|
-
const filtered = prev.filter(sub => sub.depth < depth);
|
|
123
|
-
if (!item.submenu)
|
|
124
|
-
return filtered;
|
|
125
|
-
return [
|
|
126
|
-
...filtered,
|
|
127
|
-
{
|
|
128
|
-
items: item.submenu,
|
|
129
|
-
parentRect: rect,
|
|
130
|
-
depth: depth,
|
|
131
|
-
openUp: shouldOpenUp,
|
|
132
|
-
}
|
|
133
|
-
];
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
const handleMouseLeave = (depth = 0) => {
|
|
137
|
-
if (isMobile)
|
|
138
|
-
return;
|
|
139
|
-
if (submenuTimeoutRef.current) {
|
|
140
|
-
clearTimeout(submenuTimeoutRef.current);
|
|
141
|
-
}
|
|
142
|
-
const targetDepth = depth;
|
|
143
|
-
submenuTimeoutRef.current = setTimeout(() => {
|
|
144
|
-
setHoveredSubmenus(prev => prev.filter(sub => sub.depth < targetDepth));
|
|
145
|
-
}, 300);
|
|
146
|
-
};
|
|
147
|
-
const handleSubmenuMouseEnter = () => {
|
|
148
|
-
if (submenuTimeoutRef.current) {
|
|
149
|
-
clearTimeout(submenuTimeoutRef.current);
|
|
150
|
-
submenuTimeoutRef.current = null;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
return () => {
|
|
155
|
-
if (submenuTimeoutRef.current) {
|
|
156
|
-
clearTimeout(submenuTimeoutRef.current);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
}, []);
|
|
160
|
-
const renderMenuItems = (menuItems, depth = 0) => {
|
|
161
|
-
return menuItems
|
|
162
|
-
.filter(item => item.visible !== false)
|
|
163
|
-
.map((item, idx) => {
|
|
164
|
-
const itemKey = `${item.name}-${idx}`.replaceAll(/\s+/g, '-');
|
|
165
|
-
const handleClick = (e) => {
|
|
166
|
-
if (item.disabled)
|
|
167
|
-
return;
|
|
168
|
-
e.stopPropagation();
|
|
169
|
-
handleItemClick(item);
|
|
170
|
-
};
|
|
171
|
-
const handleRightIconClick = (e) => {
|
|
172
|
-
e.stopPropagation();
|
|
173
|
-
// if (item.disabled) return;
|
|
174
|
-
item.onRightIconClick?.();
|
|
175
|
-
};
|
|
176
|
-
return (_jsxs(S.MenuItem, { "$disabled": item.disabled, "$hasSubmenu": !!item.submenu && item.submenu.length > 0, "$beginGroup": item.beginGroup, onMouseDown: handleClick, onMouseEnter: (e) => !isMobile && handleMouseEnter(item, e, depth + 1), onMouseLeave: () => !isMobile && handleMouseLeave(depth + 1), children: [_jsxs(S.MenuItemContent, { children: [item.icon && _jsx(S.IconWrapper, { children: item.icon }), _jsx(S.MenuItemName, { children: item.name })] }), item.rightIcon && item.onRightIconClick && (_jsx(S.RightIconButton, { onClick: handleRightIconClick, onMouseDown: (e) => e.stopPropagation(), "aria-label": `Action for ${item.name}`, children: item.rightIcon })), item.submenu && item.submenu.length > 0 && (_jsx(S.SubmenuIndicator, { "$isMobile": isMobile, children: isMobile ? '›' : '▸' }))] }, itemKey));
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
const currentMenu = menuState.submenuStack.at(-1) || items;
|
|
180
|
-
const currentParentName = menuState.parentNames.at(-1) || '';
|
|
181
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: triggerRef, onContextMenu: handleContextMenu, onClick: handleClick, onKeyDown: (e) => {
|
|
182
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
183
|
-
handleClick(e);
|
|
184
|
-
}
|
|
185
|
-
}, role: "button", tabIndex: 0, style: { display: 'inline-block' }, children: children }), menuState.visible && (_jsxs(_Fragment, { children: [_jsx(S.Overlay, { onClick: handleClose }), _jsxs(S.MenuContainer, { ref: menuRef, "$x": menuState.position.x, "$y": menuState.position.y, "$openLeft": openLeft, "$openUp": openUp, children: [isMobile && menuState.parentNames.length > 0 && (_jsxs(S.MobileMenuHeader, { children: [_jsx(S.BackButton, { onClick: handleBack, "aria-label": "Go back", children: "\u2190" }), _jsx(S.HeaderTitle, { children: currentParentName })] })), renderMenuItems(currentMenu, 0)] }), !isMobile && hoveredSubmenus.map((submenu, idx) => (_jsx(S.Submenu, { "$parentRect": submenu.parentRect, "$openUp": submenu.openUp, "data-submenu": "true", onMouseEnter: handleSubmenuMouseEnter, onMouseLeave: () => handleMouseLeave(submenu.depth), children: renderMenuItems(submenu.items, submenu.depth) }, `submenu-${submenu.depth}-${idx}`)))] }))] }));
|
|
186
|
-
};
|
|
187
|
-
export default TMContextMenu;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const useIsMobile: () => boolean;
|
|
2
|
-
export declare const useClickOutside: (callback: () => void) => import("react").RefObject<HTMLDivElement>;
|
|
3
|
-
interface Position {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const useMenuPosition: (menuRef: React.RefObject<HTMLDivElement | null>, position: Position) => {
|
|
8
|
-
openLeft: boolean;
|
|
9
|
-
openUp: boolean;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useRef } from 'react';
|
|
2
|
-
export const useIsMobile = () => {
|
|
3
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const checkMobile = () => {
|
|
6
|
-
const mobile = globalThis.innerWidth <= 768 || 'ontouchstart' in globalThis;
|
|
7
|
-
setIsMobile(mobile);
|
|
8
|
-
};
|
|
9
|
-
checkMobile();
|
|
10
|
-
window.addEventListener('resize', checkMobile);
|
|
11
|
-
return () => window.removeEventListener('resize', checkMobile);
|
|
12
|
-
}, []);
|
|
13
|
-
return isMobile;
|
|
14
|
-
};
|
|
15
|
-
export const useClickOutside = (callback) => {
|
|
16
|
-
const ref = useRef(null);
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const handleClick = (event) => {
|
|
19
|
-
if (ref.current && !ref.current.contains(event.target)) {
|
|
20
|
-
callback();
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
document.addEventListener('mousedown', handleClick);
|
|
24
|
-
document.addEventListener('touchstart', handleClick);
|
|
25
|
-
return () => {
|
|
26
|
-
document.removeEventListener('mousedown', handleClick);
|
|
27
|
-
document.removeEventListener('touchstart', handleClick);
|
|
28
|
-
};
|
|
29
|
-
}, [callback]);
|
|
30
|
-
return ref;
|
|
31
|
-
};
|
|
32
|
-
export const useMenuPosition = (menuRef, position) => {
|
|
33
|
-
const [adjustedPosition, setAdjustedPosition] = useState({ openLeft: false, openUp: false });
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!menuRef.current)
|
|
36
|
-
return;
|
|
37
|
-
const menuRect = menuRef.current.getBoundingClientRect();
|
|
38
|
-
const viewportWidth = window.innerWidth;
|
|
39
|
-
const viewportHeight = window.innerHeight;
|
|
40
|
-
const spaceRight = viewportWidth - position.x;
|
|
41
|
-
const spaceBottom = viewportHeight - position.y;
|
|
42
|
-
setAdjustedPosition({
|
|
43
|
-
openLeft: spaceRight < menuRect.width + 20,
|
|
44
|
-
openUp: spaceBottom < menuRect.height + 20,
|
|
45
|
-
});
|
|
46
|
-
}, [position, menuRef]);
|
|
47
|
-
return adjustedPosition;
|
|
48
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ContextMenu } from './TMContextMenu';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const MenuContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
2
|
-
$x: number;
|
|
3
|
-
$y: number;
|
|
4
|
-
$openLeft: boolean;
|
|
5
|
-
$openUp: boolean;
|
|
6
|
-
}>> & string;
|
|
7
|
-
export declare const MenuItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
|
-
$disabled?: boolean;
|
|
9
|
-
$hasSubmenu?: boolean;
|
|
10
|
-
$beginGroup?: boolean;
|
|
11
|
-
}>> & string;
|
|
12
|
-
export declare const MenuItemContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
|
-
export declare const IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
14
|
-
export declare const MenuItemName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
15
|
-
export declare const RightIconButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
16
|
-
export declare const SubmenuIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
17
|
-
$isMobile?: boolean;
|
|
18
|
-
}>> & string;
|
|
19
|
-
export declare const Submenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
20
|
-
$parentRect: DOMRect;
|
|
21
|
-
$openUp?: boolean;
|
|
22
|
-
}>> & string;
|
|
23
|
-
export declare const MobileMenuHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
24
|
-
export declare const BackButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
25
|
-
export declare const HeaderTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
26
|
-
export declare const MenuDivider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
27
|
-
export declare const Overlay: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|