-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multi row select and context menu in Timegraph Component
changes made: - Support for adding context menu via signals - Support for making multiple selections in data tree of timegraph component - Added Signals to notify context menu selection and multi row selections This change will allow for a context menu to be added to the timegraph component based on the outputDescriptor id via a signal. The component also adds the ability to select multiple rows. The multi selections can be passed with the item clicked signal payload as well as through a rowSelectionsChanged signal. The end goal is to provide the timegraph views with the ability to make multi-row selections and perform some actions with the selections. Signed-off-by: Neel Gondalia ngondalia@blackberry.com
- Loading branch information
Showing
12 changed files
with
333 additions
and
21 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
packages/base/src/signals/context-menu-contributed-signal-payload.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*************************************************************************************** | ||
* Copyright (c) 2023 BlackBerry Limited and contributors. | ||
* | ||
* Licensed under the MIT license. See LICENSE file in the project root for details. | ||
***************************************************************************************/ | ||
import { OutputDescriptor } from 'tsp-typescript-client/lib/models/output-descriptor'; | ||
|
||
export interface MenuItem { | ||
id: string; | ||
label: string; | ||
} | ||
|
||
export interface SubMenu { | ||
label: string; | ||
items: MenuItem[]; | ||
submenu: SubMenu | undefined; | ||
} | ||
|
||
export interface ContextMenu { | ||
menuId: string; | ||
submenus: SubMenu[]; | ||
items: MenuItem[]; | ||
} | ||
|
||
export class ContextMenuContributedSignalPayload { | ||
private outputDescriptor: OutputDescriptor; | ||
private menu: ContextMenu; | ||
|
||
constructor(outputDescriptor: OutputDescriptor, menuItems: ContextMenu) { | ||
this.outputDescriptor = outputDescriptor; | ||
this.menu = menuItems; | ||
} | ||
|
||
public getOutputDescriptor(): OutputDescriptor { | ||
return this.outputDescriptor; | ||
} | ||
|
||
public getMenu(): ContextMenu { | ||
return this.menu; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/base/src/signals/context-menu-item-clicked-signal-payload.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*************************************************************************************** | ||
* Copyright (c) 2023 BlackBerry Limited and contributors. | ||
* | ||
* Licensed under the MIT license. See LICENSE file in the project root for details. | ||
***************************************************************************************/ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export class ContextMenuItemClickedSignalPayload { | ||
private itemId: string; | ||
private menuId: string; | ||
private props: { [key: string]: any }; | ||
|
||
constructor(itemId: string, menuId: string, props: { [key: string]: any }) { | ||
this.itemId = itemId; | ||
this.menuId = menuId; | ||
this.props = props; | ||
} | ||
|
||
public getMenuId(): string { | ||
return this.menuId; | ||
} | ||
|
||
public getItemId(): string { | ||
return this.itemId; | ||
} | ||
|
||
public getProps(): { [key: string]: any } { | ||
return this.props; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.