@topconsultnpm/sdkui-react 6.20.0-dev1.41 → 6.20.0-dev1.43

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.
@@ -118,7 +118,6 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
118
118
  onClick: item.onClick,
119
119
  disabled: item.disabled,
120
120
  isPinned: isPinned,
121
- originalMenuItem: item,
122
121
  });
123
122
  }
124
123
  // Recursively process submenus
@@ -236,6 +235,8 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
236
235
  setState(s => ({ ...s, isDragging: true }));
237
236
  };
238
237
  const handleGripDoubleClick = () => {
238
+ if (state.isConfigMode)
239
+ return;
239
240
  toggleOrientation();
240
241
  };
241
242
  const handleMouseMove = useCallback((e) => {
@@ -313,6 +314,58 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
313
314
  }
314
315
  });
315
316
  };
317
+ // Auto-reposition when entering edit mode to ensure Apply/Undo buttons are visible
318
+ useEffect(() => {
319
+ if (!state.isConfigMode || !floatingRef.current)
320
+ return;
321
+ requestAnimationFrame(() => {
322
+ if (!floatingRef.current)
323
+ return;
324
+ const floating = floatingRef.current.getBoundingClientRect();
325
+ let newX = state.position.x;
326
+ let newY = state.position.y;
327
+ let needsUpdate = false;
328
+ if (isConstrained && containerRef.current) {
329
+ const container = containerRef.current.getBoundingClientRect();
330
+ if (state.orientation === 'horizontal') {
331
+ if (state.position.x + floating.width > container.width) {
332
+ newX = Math.max(0, container.width - floating.width);
333
+ needsUpdate = true;
334
+ }
335
+ }
336
+ else {
337
+ if (state.position.y + floating.height > container.height) {
338
+ newY = Math.max(0, container.height - floating.height);
339
+ needsUpdate = true;
340
+ }
341
+ }
342
+ }
343
+ else {
344
+ if (state.orientation === 'horizontal') {
345
+ if (state.position.x + floating.width > window.innerWidth) {
346
+ newX = Math.max(0, window.innerWidth - floating.width - 10);
347
+ needsUpdate = true;
348
+ }
349
+ }
350
+ else {
351
+ if (state.position.y + floating.height > window.innerHeight) {
352
+ newY = Math.max(0, window.innerHeight - floating.height - 10);
353
+ needsUpdate = true;
354
+ }
355
+ }
356
+ }
357
+ if (needsUpdate) {
358
+ setState(s => ({
359
+ ...s,
360
+ position: { x: newX, y: newY },
361
+ }));
362
+ // Update snapshot position to the corrected position so Undo restores to visible position
363
+ if (stateSnapshot.current) {
364
+ stateSnapshot.current.position = { x: newX, y: newY };
365
+ }
366
+ }
367
+ });
368
+ }, [state.isConfigMode, state.orientation, isConstrained]);
316
369
  const handleUndo = () => {
317
370
  if (stateSnapshot.current) {
318
371
  setState(s => ({
@@ -320,7 +373,7 @@ const TMFloatingMenuBar = ({ containerRef, contextMenuItems = [], isConstrained
320
373
  items: [...stateSnapshot.current.items],
321
374
  orientation: stateSnapshot.current.orientation,
322
375
  position: { ...stateSnapshot.current.position },
323
- isConfigMode: true, // Stay in edit mode
376
+ isConfigMode: true,
324
377
  }));
325
378
  }
326
379
  };
@@ -6,7 +6,6 @@ export interface TMFloatingMenuItem {
6
6
  onClick: () => void;
7
7
  disabled?: boolean;
8
8
  isPinned?: boolean;
9
- originalMenuItem?: TMContextMenuItemProps;
10
9
  }
11
10
  export interface TMFloatingMenuBarProps {
12
11
  containerRef: React.RefObject<HTMLElement | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react",
3
- "version": "6.20.0-dev1.41",
3
+ "version": "6.20.0-dev1.43",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",