Skip to content

Commit db5cab8

Browse files
tomlynsrikant-ch5
authored andcommitted
#2388 Expand and export InternalAction type (#2389)
Signed-off-by: CTomlyn <[email protected]>
1 parent 5b5d546 commit db5cab8

File tree

2 files changed

+71
-19
lines changed

2 files changed

+71
-19
lines changed

canvas_modules/common-canvas/types/common-canvas.ts

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,67 @@ export interface ContextMenuDivider {
162162
}
163163

164164
/** Existing internal common canvas actions */
165-
type InternalAction =
165+
export type InternalAction =
166166
| "selectAll"
167+
| "deselectAll"
168+
| "zoomIn"
169+
| "zoomOut"
170+
| "zoomToFit"
171+
| "commentsToggle"
172+
| "commentsHide"
173+
| "commentsShow"
174+
| "setCommentEditingMode"
175+
| "setNodeLabelEditingMode"
176+
| "setZoom"
177+
| "togglePalette"
178+
| "openPalette"
179+
| "closePalette"
180+
| "toggleNotificationPanel"
181+
| "openNotificationPanel"
182+
| "closeNotificationPanel"
183+
| "loadPipelineFlow"
184+
| "createNode"
185+
| "createNodeOnLink"
186+
| "createNodeAttachLinks"
187+
| "createAutoNode"
188+
| "createComment"
189+
| "createWYSIWYGComment"
190+
| "createAutoComment"
191+
| "createAutoWYSIWYGComment"
192+
| "insertNodeIntoLink"
193+
| "attachNodeToLinks"
194+
| "moveObjects"
195+
| "resizeObjects"
196+
| "setObjectsStyle"
197+
| "setLinksStyle"
198+
| "updateLink"
199+
| "editComment"
200+
| "editDecorationLabel"
201+
| "linkNodes"
202+
| "linkNodesAndReplace"
203+
| "linkComment"
204+
| "createDetachedLink"
205+
| "colorSelectedObjects"
206+
| "deleteSelectedObjects"
207+
| "displaySubPipeline"
208+
| "displayPreviousPipeline"
209+
| "arrangeHorizontally"
210+
| "arrangeVertically"
211+
| "createSuperNode"
212+
| "createSuperNodeExternal"
213+
| "deconstructSuperNode"
214+
| "expandSuperNodeInPlace"
215+
| "collapseSuperNodeInPlace"
216+
| "convertSuperNodeExternalToLocal"
217+
| "convertSuperNodeLocalToExternal"
218+
| "deleteLink"
219+
| "disconnectNode"
220+
| "saveToPalette"
167221
| "cut"
168222
| "copy"
169223
| "paste"
170224
| "undo"
171225
| "redo"
172-
| "createSupernode"
173-
| "expandSupernode"
174-
| "collapseSupernode"
175-
| "deleteSelectedObjects"
176-
| "createComment"
177-
| "deleteLink"
178-
| "disconnectNode"
179226
| "highlightBranch"
180227
| "highlightDownstream"
181228
| "highlightUpstream"
@@ -2629,7 +2676,7 @@ export interface CanvasConfig {
26292676
* https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/#toolbar-action-object-definition
26302677
*/
26312678
export interface ToolbarActionItem {
2632-
action?: string;
2679+
action?: string | InternalAction;
26332680
label?: string | ReactNode;
26342681
enable?: boolean;
26352682
iconEnabled?: string | ReactNode;

docs/pages/03.11-internal-actions.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
Internal actions can be generated by the user either:
44

55
* Clicking a toolbar button or
6-
* Clicking an option in a context menu or context toobar or
7-
* Pressing a keyboard shortcut key(s) or
8-
* Doing some direct manipulation like dragging one or more objects
6+
* Clicking an option in a context menu or context toolbar or
7+
* Pressing keyboard shortcut key(s) or
8+
* Performing direct manipulation like dragging one or more objects on the canvas
99

10-
Some actions can be generated from different sources. For example, the `deleteSelectedObjects` action can be generated by the user:
10+
Some internal actions can be generated in multiple different ways. For example, the `deleteSelectedObjects` action can be generated by the user:
1111

1212
* Clicking the trash can icon in the toolbar or
1313
* Pressing the Delete key or
14-
* Clicking the Delete option in a context menu.
14+
* Clicking the Delete option in a context menu or context toolbar.
1515

16-
In each case, the action generates calls to the [beforeEditActionHandler](03.03.02-before-edit-action-handler.md) callback and then the [editActionHandler](03.03.03-edit-action-handler.md) callback. For each callback, the `editType` field of the first parameter will be set to one of the actions listed below.
16+
In each case, the action generates a call to the [beforeEditActionHandler](03.03.02-before-edit-action-handler.md) callback and then the [editActionHandler](03.03.03-edit-action-handler.md) callback. For each callback, the `editType` field of the first parameter will be set to one of the actions listed below.
1717

1818
These are the intenal actions:
1919

@@ -27,7 +27,7 @@ These are the intenal actions:
2727
| insertNodeIntoLink | Inserts a node from the canvas into the link it was dropped on |
2828
| attachNodeToLinks | Attaches a node to one or more detached links it was dropped on |
2929
| setNodeLabel | Sets the node label |
30-
| setNodeLabelEditingMode | Puts a node label into eiting mode |
30+
| setNodeLabelEditingMode | Puts a node label into editing mode |
3131
| disconnectNode | Removes all links to the selected node |
3232
| **Supernodes** | |
3333
| createSuperNode | Creates an internal supernode |
@@ -54,6 +54,7 @@ These are the intenal actions:
5454
| colorSelectedObjects | Colors the background of the selected objects |
5555
| deleteSelectedObjects | Deletes the selected objects |
5656
| selectAll | Selects all canvas objects |
57+
| deselectAll | Deselects all canvas objects |
5758
| **Links** | |
5859
| updateLink | Updates the link info for detached links |
5960
| editComment | Changes the comment text, position and dimension info |
@@ -64,7 +65,7 @@ These are the intenal actions:
6465
| setLinksStyle | Sets the style property of one or more links |
6566
| deleteLink | Deletes a link |
6667
| **Decorations** | |
67-
| editDecorationLabel | Puts a label decoration into edit mode |
68+
| editDecorationLabel | Puts a label decoration into editing mode |
6869
| **Arrange nodes** | |
6970
| arrangeHorizontally | Arranges the nodes across the page from left to right |
7071
| arrangeVertically | Arranges the nodes down the page from top to bottom |
@@ -97,7 +98,11 @@ These are the intenal actions:
9798

9899
## Action names with built in icons
99100

100-
If you use any of the following action names, Common Canvas will automatically display an appropriate Carbon icon for that action either if it appears as a button in the toolbar or if it appears in the overflow menu.
101+
If you use any of the following action names, Common Canvas will automatically display an appropriate Carbon icon for that action if the action is for:
102+
103+
* a button in the canvas toolbar or an item in its overflow menu or
104+
* a button in the context toolbar or an item in its overflow menu.
105+
101106

102107
| Action | Carbon Icon |
103108
|--------------------------|---------------------|
@@ -121,7 +126,7 @@ If you use any of the following action names, Common Canvas will automatically d
121126
| zoomIn | ZoomIn |
122127
| zoomOut | ZoomOut |
123128
| zoomToFit | CenterToFit |
124-
| arrangeHorizontally | ArrangeHorizont |
129+
| arrangeHorizontally | ArrangeHorizontal |
125130
| arrangeVertically | ArrangeVertical |
126131
| toggleNotificationPanel | NotificationCounter |
127132
| paletteOpen | OpenPanelFilledLeft |

0 commit comments

Comments
 (0)