@topconsultnpm/sdkui-react 6.21.0-t5 → 6.21.0

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.
@@ -197,6 +197,7 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
197
197
  onClick: item.onClick,
198
198
  disabled: item.disabled,
199
199
  isPinned: isPinned,
200
+ visible: item.visible,
200
201
  });
201
202
  }
202
203
  // Recursively process submenus
@@ -321,7 +322,7 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
321
322
  }
322
323
  });
323
324
  }, [maxItems]);
324
- // Get current item state (disabled and onClick) from contextMenuItems
325
+ // Get current item state (disabled, onClick, visible) from contextMenuItems
325
326
  const getCurrentItemState = useCallback((itemId) => {
326
327
  const findInItems = (items) => {
327
328
  for (let i = 0; i < items.length; i++) {
@@ -341,7 +342,8 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
341
342
  const foundItem = findInItems(contextMenuItems);
342
343
  return {
343
344
  disabled: foundItem?.disabled,
344
- onClick: foundItem?.onClick
345
+ onClick: foundItem?.onClick,
346
+ visible: foundItem?.visible
345
347
  };
346
348
  }, [contextMenuItems]);
347
349
  // Remove trailing separators from items array
@@ -842,6 +844,14 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
842
844
  onClick: toggleOrientation,
843
845
  },
844
846
  ], trigger: "right", children: _jsx(S.GripHandle, { "$orientation": state.orientation, onMouseDown: handleMouseDown, onTouchStart: handleTouchStart, onDoubleClick: handleGripDoubleClick, children: _jsx(IconDraggableDots, {}) }) }), _jsx(S.Separator, { "$orientation": state.orientation }), state.items.map((item, index) => {
847
+ // Check visibility for non-separator items
848
+ if (!item.isSeparator) {
849
+ const currentState = getCurrentItemState(item.id);
850
+ // If contextMenuItems defines visible as false, don't render this item
851
+ if (currentState.visible === false) {
852
+ return null;
853
+ }
854
+ }
845
855
  // Handle separator items
846
856
  if (item.isSeparator) {
847
857
  return (_jsx(S.DraggableItem, { "$isDragging": state.draggedItemIndex === index, "$isDragOver": dragOverIndex === index && state.draggedItemIndex !== index, draggable: enableConfigMode, onDragStart: (e) => handleDragStart(e, index), onDragEnter: (e) => handleDragEnter(e, index), onDragOver: handleDragOver, onDragLeave: (e) => handleDragLeave(e, index), onDrop: (e) => handleDrop(e, index), onDragEnd: handleDragEnd, children: enableConfigMode ? (_jsx(ContextMenu, { items: getSeparatorRightClickMenuItems(index), trigger: "right", children: _jsx(S.ItemSeparator, { "$orientation": state.orientation, "$isConfigMode": false }) })) : (_jsx(S.ItemSeparator, { "$orientation": state.orientation, "$isConfigMode": false })) }, item.id));
@@ -9,6 +9,7 @@ export interface TMFloatingMenuItem {
9
9
  isSeparator?: boolean;
10
10
  isToggle?: boolean;
11
11
  staticItem?: React.ReactNode;
12
+ visible?: boolean;
12
13
  }
13
14
  export interface TMFloatingMenuBarProps {
14
15
  containerRef: React.RefObject<HTMLElement | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.21.0-t5",
3
+ "version": "6.21.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -39,7 +39,7 @@
39
39
  "lib"
40
40
  ],
41
41
  "dependencies": {
42
- "@topconsultnpm/sdk-ts": "6.21.0-t5",
42
+ "@topconsultnpm/sdk-ts": "6.21.0",
43
43
  "@zip.js/zip.js": "2.8.26",
44
44
  "buffer": "^6.0.3",
45
45
  "devextreme": "^25.2.6",