From 8ee0a61941e03c17da773a6c2b0de178f20a4e8c Mon Sep 17 00:00:00 2001 From: Daniela Buzatu Date: Fri, 24 Oct 2025 14:57:42 +0300 Subject: [PATCH 1/3] #39401 make `closeContextMenu` optional --- src/components/ContextMenu/IAction.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ContextMenu/IAction.ts b/src/components/ContextMenu/IAction.ts index 07b5d69..934bf7a 100644 --- a/src/components/ContextMenu/IAction.ts +++ b/src/components/ContextMenu/IAction.ts @@ -10,7 +10,7 @@ export interface IActionParam { } export interface IActionParamForRun extends IActionParam { - closeContextMenu: () => void, + closeContextMenu?: () => void, /** * By default the context menu closes immediately after the action is run From e76bad40b2d630e1ac189989c2d298506b57ac6e Mon Sep 17 00:00:00 2001 From: Daniela Buzatu Date: Mon, 27 Oct 2025 10:58:32 +0200 Subject: [PATCH 2/3] #39401 Small refactor: remove unnecessary IParamsForAction --- src/components/ContextMenu/ContextMenu.tsx | 12 ++---------- src/components/ContextMenu/IAction.ts | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/ContextMenu/ContextMenu.tsx b/src/components/ContextMenu/ContextMenu.tsx index 81c969f..5183610 100644 --- a/src/components/ContextMenu/ContextMenu.tsx +++ b/src/components/ContextMenu/ContextMenu.tsx @@ -1,21 +1,13 @@ import React from 'react'; -import { Menu, Popup, StrictPopupProps } from 'semantic-ui-react'; +import { Menu, Popup } from 'semantic-ui-react'; import { IAction, IActionParamForRun } from './IAction'; import { TestsAreDemoCheat, createTestids } from '@famiprog-foundation/tests-are-demo'; export type Point = { x: number, y: number }; - -type Position = StrictPopupProps["position"]; - -type IParamsForAction = { - selection: any[]; - position?: Position; - [key: string]: any; -} interface ContextMenuProps { actions: IAction[]; - paramsForAction: IParamsForAction; + paramsForAction: IActionParamForRun; /** * if undefined => the menu is closed else {x, y} position where the menu should open */ diff --git a/src/components/ContextMenu/IAction.ts b/src/components/ContextMenu/IAction.ts index 934bf7a..8b7638a 100644 --- a/src/components/ContextMenu/IAction.ts +++ b/src/components/ContextMenu/IAction.ts @@ -1,17 +1,24 @@ import React from "react" -import { IconProps, SemanticShorthandItem } from "semantic-ui-react" +import { IconProps, SemanticShorthandItem, StrictPopupProps } from "semantic-ui-react" import { Point } from "./ContextMenu" // TODO RM34271 let's get rid of IActionParamForRun. It overcomplicates the inheritance. We'll have here closeContextMenu() that won't do anything. // export interface IActionParam { // selection: S[] +type Position = StrictPopupProps["position"]; + export interface IActionParam { selection: any[] } export interface IActionParamForRun extends IActionParam { + /** + * Function to close the context menu. + * This is marked as optional because users will pass their actionParamForRun without this field. + * However, it will ALWAYS be populated internally by the ContextMenu component before being passed to action handlers. + */ closeContextMenu?: () => void, - + /** * By default the context menu closes immediately after the action is run * If the user wants to avoid the closing of the menu after action runs he needs to set this property to true @@ -23,6 +30,10 @@ export interface IActionParamForRun extends IActionParam { * It contains the mouse coordinates, obtained from onClick event of an action */ eventPoint?: Point + + position?: Position; + + [key: string]: any; } // TODO RM34271 CS: for the moment it's not clear why we need this. It's not used by the lib. And currently, the task of opening From 4a62b3565330333135ea9e061fbf50db44ae2666 Mon Sep 17 00:00:00 2001 From: Daniela Buzatu Date: Mon, 27 Oct 2025 11:00:47 +0200 Subject: [PATCH 3/3] #39401 CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd524a4..70a2762 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Unreleased +* [Make `IActionParamForRun.closeContextMenu` optional](https://github.com/flower-platform/react-timeline-10000/pull/104) + * [Change color used for BackgroundGradient](https://github.com/flower-platform/react-timeline-10000/pull/96) ## v2.10.0