-
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 [email protected]
- Loading branch information
Showing
13 changed files
with
449 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) 2024 BlackBerry Limited and contributors. | ||
* | ||
* Licensed under the MIT license. See LICENSE file in the project root for details. | ||
***************************************************************************************/ | ||
export interface MenuItem { | ||
id: string; | ||
label: string; | ||
// Parent Menu that this item belongs to - undefined indicates root menu item | ||
parentMenuId?: string; | ||
} | ||
|
||
export interface SubMenu { | ||
id: string; | ||
label: string; | ||
items: MenuItem[]; | ||
submenu: SubMenu | undefined; | ||
} | ||
|
||
export interface ContextMenuItems { | ||
submenus: SubMenu[]; | ||
items: MenuItem[]; | ||
} | ||
|
||
export class ContextMenuContributedSignalPayload { | ||
private outputDescriptorId: string; | ||
private menuItems: ContextMenuItems; | ||
|
||
constructor(descriptorId: string, menuItems: ContextMenuItems) { | ||
this.outputDescriptorId = descriptorId; | ||
this.menuItems = menuItems; | ||
} | ||
|
||
public getOutputDescriptorId(): string { | ||
return this.outputDescriptorId; | ||
} | ||
|
||
public getMenuItems(): ContextMenuItems { | ||
return this.menuItems; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
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,35 @@ | ||
/*************************************************************************************** | ||
* Copyright (c) 2024 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 outputDescriptorId: string; | ||
private itemId: string; | ||
private parentMenuId: string | undefined; | ||
private props: { [key: string]: any }; | ||
|
||
constructor(descriptorId: string, itemId: string, props: { [key: string]: any }, parentMenuId?: string) { | ||
this.outputDescriptorId = descriptorId; | ||
this.itemId = itemId; | ||
this.props = props; | ||
this.parentMenuId = parentMenuId; | ||
} | ||
|
||
public getOutputDescriptorId(): string { | ||
return this.outputDescriptorId; | ||
} | ||
|
||
public getItemId(): string { | ||
return this.itemId; | ||
} | ||
|
||
public getProps(): { [key: string]: any } { | ||
return this.props; | ||
} | ||
|
||
public getParentMenuId(): string | undefined { | ||
return this.parentMenuId; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/base/src/signals/row-selections-changed-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,33 @@ | ||
/*************************************************************************************** | ||
* Copyright (c) 2024 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 RowSelectionsChangedSignalPayload { | ||
private traceId: string; | ||
private outputDescriptorId: string; | ||
private rows: { id: number; parentId?: number; metadata?: { [key: string]: any } }[]; | ||
|
||
constructor( | ||
traceId: string, | ||
descriptorId: string, | ||
rows: { id: number; parentId?: number; metadata?: { [key: string]: any } }[] | ||
) { | ||
this.outputDescriptorId = descriptorId; | ||
this.traceId = traceId; | ||
this.rows = rows; | ||
} | ||
|
||
public getOutputDescriptorId(): string { | ||
return this.outputDescriptorId; | ||
} | ||
|
||
public getTraceId(): string { | ||
return this.traceId; | ||
} | ||
|
||
public getRows(): { id: number; parentId?: number; metadata?: { [key: string]: any } }[] { | ||
return this.rows; | ||
} | ||
} |
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.