@topconsultnpm/sdkui-react 6.20.0-dev1.71 → 6.20.0-dev1.73

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.
@@ -323,7 +323,7 @@ const TMContextMenu = ({ items, trigger = 'right', children, target, externalCon
323
323
  }
324
324
  }
325
325
  else {
326
- if (item.onClick || !keepOpenOnClick) {
326
+ if (!keepOpenOnClick) {
327
327
  handleClose();
328
328
  }
329
329
  }
@@ -1,8 +1,8 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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, svgToString, TMCommandsContextMenu, TMConditionalWrapper } from "../../helper";
5
+ import { formatBytes, Globalization, IconDashboard, IconFolder, IconHide, IconList, IconMenuVertical, IconRefresh, IconShow, SDKUI_Globals, SDKUI_Localizator, TMCommandsContextMenu, TMConditionalWrapper } from "../../helper";
6
6
  import TMTooltip from "./TMTooltip";
7
7
  import { TMColors } from "../../utils/theme";
8
8
  import TMPanel from "./TMPanel";
@@ -98,18 +98,18 @@ const TMFileManager = (props) => {
98
98
  const onBackCallback = useCallback(() => {
99
99
  setOpenDraftList(false);
100
100
  }, []);
101
- const toolbar = useMemo(() => _jsxs(_Fragment, { children: [_jsx(IconMenuVertical, { id: "TMPanel-FileManager-Commands-Header", color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: '#TMPanel-FileManager-Commands-Header', menuItems: [
102
- {
103
- icon: isLeftPanelCollapsed ? "eyeclose" : "eyeopen",
104
- onClick: () => setIsLeftPanelCollapsed(prev => !prev),
105
- text: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel,
106
- },
107
- {
108
- icon: svgToString(_jsx(IconRefresh, {})),
109
- onClick: async () => await refreshCallback(),
110
- text: SDKUI_Localizator.Refresh,
111
- },
112
- ], showEvent: "click" })] }), [isLeftPanelCollapsed]);
101
+ const toolbar = useMemo(() => _jsx(TMCommandsContextMenu, { target: '#TMPanel-FileManager-Commands-Header', menuItems: [
102
+ {
103
+ icon: isLeftPanelCollapsed ? _jsx(IconShow, {}) : _jsx(IconHide, {}),
104
+ onClick: () => setIsLeftPanelCollapsed(prev => !prev),
105
+ text: isLeftPanelCollapsed ? SDKUI_Localizator.ShowLeftPanel : SDKUI_Localizator.HideLeftPanel,
106
+ },
107
+ {
108
+ icon: _jsx(IconRefresh, {}),
109
+ onClick: async () => await refreshCallback(),
110
+ text: SDKUI_Localizator.Refresh,
111
+ },
112
+ ], showEvent: "click", children: _jsx(IconMenuVertical, { id: "TMPanel-FileManager-Commands-Header", color: 'white', cursor: 'pointer' }) }), [isLeftPanelCollapsed]);
113
113
  // Handle closing the context menu
114
114
  const closeTreeViewContextMenu = useCallback(() => {
115
115
  setTreeViewAnchor(null);
@@ -1,6 +1,6 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useMemo } from "react";
3
- import { IconMenuVertical, IconRefresh, SDKUI_Localizator, svgToString, TMCommandsContextMenu } from "../../../helper";
3
+ import { IconMenuVertical, IconRefresh, SDKUI_Localizator, TMCommandsContextMenu } from "../../../helper";
4
4
  import { DeviceType, useDeviceType } from "../../base/TMDeviceProvider";
5
5
  import { useTMPanelManagerContext } from "../../layout/panelManager/TMPanelManagerContext";
6
6
  import TMPanel from "../../base/TMPanel";
@@ -12,13 +12,13 @@ const TMDcmtTasks = (props) => {
12
12
  // This avoids unnecessary re-renders by only recalculating when deviceType changes.
13
13
  let isMobile = useMemo(() => { return deviceType === DeviceType.MOBILE; }, [deviceType]);
14
14
  const { togglePanelVisibility, toggleMaximize, countVisibleLeafPanels } = useTMPanelManagerContext();
15
- const toolbar = useMemo(() => _jsxs(_Fragment, { children: [_jsx(IconMenuVertical, { id: "TMTaksPanel-Commands-Header", color: 'white', cursor: 'pointer' }), _jsx(TMCommandsContextMenu, { target: '#TMTaksPanel-Commands-Header', showEvent: "click", menuItems: [
16
- {
17
- icon: svgToString(_jsx(IconRefresh, {})),
18
- onClick: async () => await getAllTasks(),
19
- text: SDKUI_Localizator.Refresh,
20
- },
21
- ] })] }), []);
15
+ const toolbar = useMemo(() => _jsx(TMCommandsContextMenu, { target: '#TMTaksPanel-Commands-Header', showEvent: "click", menuItems: [
16
+ {
17
+ icon: _jsx(IconRefresh, {}),
18
+ onClick: async () => await getAllTasks(),
19
+ text: SDKUI_Localizator.Refresh,
20
+ },
21
+ ], children: _jsx(IconMenuVertical, { id: "TMTaksPanel-Commands-Header", color: 'white', cursor: 'pointer' }) }), []);
22
22
  return _jsx("div", { style: { width: "100%", height: "100%", position: 'relative' }, children: _jsx(TMPanel, { title: SDKUI_Localizator.Widget_Activities, allowMaximize: !isMobile && countVisibleLeafPanels() > 1, onClose: countVisibleLeafPanels() > 1 ? () => togglePanelVisibility("tmDcmtTasks") : undefined, onMaximize: countVisibleLeafPanels() > 1 ? () => toggleMaximize("tmDcmtTasks") : undefined, toolbar: toolbar, children: _jsx(TMTasksPanelContent, { id: "dcmtTasks", taskContext: taskContext, allTasks: allTasks, getAllTasks: getAllTasks, deleteTaskByIdsCallback: deleteTaskByIdsCallback, addTaskCallback: addTaskCallback, editTaskCallback: editTaskCallback, handleNavigateToWGs: () => { return Promise.resolve(); }, handleNavigateToDossiers: () => { return Promise.resolve(); }, afterTaskSaved: afterTaskSaved }) }) });
23
23
  };
24
24
  export default TMDcmtTasks;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { HidingEvent } from "devextreme/ui/context_menu";
3
3
  interface TMCommandsContextMenuProps {
4
- target: string | Element | undefined;
4
+ target?: string | Element | undefined;
5
5
  menuItems: Array<any>;
6
6
  id?: string;
7
7
  showEvent?: string | {
@@ -9,6 +9,8 @@ interface TMCommandsContextMenuProps {
9
9
  name?: string;
10
10
  } | undefined;
11
11
  onHiding?: ((e: HidingEvent<any>) => void) | undefined;
12
+ trigger?: 'right' | 'left';
13
+ children?: React.ReactNode;
12
14
  }
13
- export declare const TMCommandsContextMenu: React.MemoExoticComponent<({ target, menuItems, id, showEvent, onHiding }: TMCommandsContextMenuProps) => import("react/jsx-runtime").JSX.Element>;
15
+ export declare const TMCommandsContextMenu: React.MemoExoticComponent<({ target, menuItems, id, showEvent, onHiding, trigger, children }: TMCommandsContextMenuProps) => import("react/jsx-runtime").JSX.Element>;
14
16
  export {};
@@ -1,6 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
- import { ContextMenu } from "devextreme-react";
4
- export const TMCommandsContextMenu = React.memo(({ target, menuItems, id, showEvent = 'contextmenu', onHiding }) => {
5
- return (_jsx(ContextMenu, { target: target, dataSource: menuItems, id: id, showEvent: showEvent, onHiding: onHiding }));
2
+ import React, { useMemo } from "react";
3
+ import { ContextMenu } from "../components/NewComponents/ContextMenu";
4
+ export const TMCommandsContextMenu = React.memo(({ target, menuItems, id, showEvent = 'contextmenu', onHiding, trigger = 'left', children }) => {
5
+ // Convert DevExtreme menu items format to TMContextMenu format
6
+ const convertedItems = useMemo(() => {
7
+ return menuItems.map(item => ({
8
+ name: item.text,
9
+ icon: item.icon,
10
+ onClick: item.onClick,
11
+ disabled: item.disabled,
12
+ beginGroup: item.beginGroup,
13
+ visible: item.visible,
14
+ }));
15
+ }, [menuItems]);
16
+ return (_jsx(ContextMenu, { target: typeof target === 'string' ? target : undefined, items: convertedItems, trigger: trigger, children: children }));
6
17
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.71",
3
+ "version": "6.20.0-dev1.73",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",