@elyra/canvas 13.18.0 → 13.19.0

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.
Files changed (40) hide show
  1. package/dist/{canvas-controller-3167f316.js → canvas-controller-4d841ec9.js} +2 -2
  2. package/dist/{canvas-controller-3167f316.js.map → canvas-controller-4d841ec9.js.map} +1 -1
  3. package/dist/{canvas-controller-b094c53e.js → canvas-controller-792555e4.js} +2 -2
  4. package/dist/{canvas-controller-b094c53e.js.map → canvas-controller-792555e4.js.map} +1 -1
  5. package/dist/{common-canvas-5a9f57c1.js → common-canvas-1ac3023c.js} +2 -2
  6. package/dist/{common-canvas-5a9f57c1.js.map → common-canvas-1ac3023c.js.map} +1 -1
  7. package/dist/{common-canvas-90e4c9bc.js → common-canvas-9febc182.js} +2 -2
  8. package/dist/{common-canvas-90e4c9bc.js.map → common-canvas-9febc182.js.map} +1 -1
  9. package/dist/common-canvas.es.js +1 -1
  10. package/dist/common-canvas.js +1 -1
  11. package/dist/lib/canvas-controller.es.js +1 -1
  12. package/dist/lib/canvas-controller.js +1 -1
  13. package/dist/lib/canvas.es.js +1 -1
  14. package/dist/lib/canvas.js +1 -1
  15. package/dist/styles/common-canvas.min.css +1 -1
  16. package/dist/styles/common-canvas.min.css.map +1 -1
  17. package/locales/command-actions/locales/index.d.ts +18 -0
  18. package/locales/common-canvas/locales/index.d.ts +18 -0
  19. package/locales/common-properties/locales/index.d.ts +18 -0
  20. package/locales/notification-panel/locales/index.d.ts +18 -0
  21. package/locales/palette/locales/index.d.ts +18 -0
  22. package/locales/toolbar/locales/index.d.ts +18 -0
  23. package/package.json +13 -3
  24. package/src/common-canvas/canvas-controller.js +6 -1
  25. package/src/common-canvas/svg-canvas-renderer.js +34 -28
  26. package/src/toolbar/toolbar.scss +1 -2
  27. package/stats.html +1 -1
  28. package/types/common-canvas.ts +2944 -0
  29. package/types/common-properties-controller.ts +466 -0
  30. package/types/common-properties-schema-types/app-data-def-v3.ts +22 -0
  31. package/types/common-properties-schema-types/conditions-v3.ts +323 -0
  32. package/types/common-properties-schema-types/expression-info-v3.ts +172 -0
  33. package/types/common-properties-schema-types/function-list-v3.ts +97 -0
  34. package/types/common-properties-schema-types/operator-v3.ts +192 -0
  35. package/types/common-properties-schema-types/parameter-defs-v3.ts +73 -0
  36. package/types/common-properties-schema-types/uihints-v3.ts +709 -0
  37. package/types/common-properties.ts +416 -0
  38. package/types/index.d.ts +18 -0
  39. package/types/index.test-d.ts +204 -0
  40. package/types/sample-content.tsx +14 -0
@@ -0,0 +1,2944 @@
1
+ /*
2
+ * Copyright 2025 Elyra Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import React, { ComponentClass, FunctionComponent, ReactNode } from "react";
18
+
19
+ import {
20
+ // Pipeline flow
21
+ PipelineFlowDef,
22
+ PipelineDef,
23
+ NodeTypeDef,
24
+ NodeDecorationDef,
25
+ LinkDecorationDef,
26
+ // Shared declarations
27
+ ZoomObjectDef,
28
+ MessageDef,
29
+ // Palette
30
+ PipelineFlowPalette,
31
+ CategoryDef,
32
+ // Canvas Info
33
+ CanvasInfo,
34
+ CanvasPipeline,
35
+ CanvasNode,
36
+ CanvasSupernode,
37
+ CanvasPorts,
38
+ CanvasBoundPorts,
39
+ CanvasComment,
40
+ CanvasLink,
41
+ CanvasCommentLink,
42
+ CanvasNodeLink,
43
+ CanvasAssociationLink
44
+ } from "@elyra/pipeline-schemas/types";
45
+
46
+ export {
47
+ // Pipeline flow
48
+ PipelineFlowDef,
49
+ PipelineFlowUiDef,
50
+ PipelineDef,
51
+ PipelineUiDef,
52
+ NodeTypeDef,
53
+ NodeUiDef,
54
+ ExecutionNodeDef,
55
+ SupernodeDef,
56
+ BindingEntryNodeDef,
57
+ BindingExitNodeDef,
58
+ ModelNodeDef,
59
+ PortsDef,
60
+ PortDef,
61
+ BoundPortsDef,
62
+ BoundPortDef,
63
+ PortUiDef,
64
+ NodeDecorationDef,
65
+ LinkDecorationDef,
66
+ ImageDecorationDef,
67
+ LabelDecorationDef,
68
+ ShapeDecorationDef,
69
+ JsxDecorationDef,
70
+ DecorationSharedProperties,
71
+ NodeLinkDef,
72
+ NodeLinkUiDef,
73
+ AssociationLinkDef,
74
+ CommentLinkDef,
75
+ CommentDef,
76
+ AppDataDef,
77
+ // Shared declarations
78
+ ZoomObjectDef,
79
+ MessageDef,
80
+ RuntimeDef,
81
+ RuntimeUiDef,
82
+ ParamsetRef,
83
+ CommonPipelineConnectionDef,
84
+ CommonPipelineDataAssetDef,
85
+ RecordSchema,
86
+ Field,
87
+ Metadata,
88
+ // Palette
89
+ PipelineFlowPalette,
90
+ CategoryDef,
91
+ // Canvas info
92
+ CanvasInfo,
93
+ CanvasPipeline,
94
+ CanvasNode,
95
+ CanvasExecutionNode,
96
+ CanvasSupernode,
97
+ CanvasBindingEntryNode,
98
+ CanvasBindingExitNode,
99
+ CanvasPorts,
100
+ CanvasPort,
101
+ CanvasBoundPorts,
102
+ CanvasBoundPort,
103
+ CanvasModelNode,
104
+ CanvasComment,
105
+ CanvasLink,
106
+ CanvasCommentLink,
107
+ CanvasNodeLink,
108
+ CanvasAssociationLink
109
+ } from "@elyra/pipeline-schemas/types";
110
+
111
+
112
+ // The 'setPipelineFlow' function has problems with some of the fields imported
113
+ // from JSON. So this creates a PipelineFlow that allows validation.
114
+ type RelaxedPipeline = Omit<PipelineDef, 'nodes'> & {
115
+ nodes: unknown[]
116
+ }
117
+
118
+ export type RelaxedPipelineFlow = Omit<PipelineFlowDef, 'version' | 'json_schema' | 'pipelines'> & {
119
+ version: string;
120
+ json_schema: string;
121
+ pipelines: RelaxedPipeline[]
122
+ }
123
+
124
+ // The 'setPipelineFlowPalette' function has problems with some of the fields imported
125
+ // from JSON. So this creates a PipelineFlowPalette that allows validation.
126
+ export type RelaxedPipelineFlowPalette = Omit<PipelineFlowPalette, 'version' | 'categories'> & {
127
+ version?: string;
128
+ categories?: unknown[];
129
+ }
130
+
131
+ // Create and export Decoration here because json2ts doesn't create this even
132
+ // though the JSON schema uses the "oneOf" keyword. This seems to be because
133
+ // the decoration definitions are in a child schema of pipeline-flow-v3-schema.json.
134
+ export type Decoration = NodeDecorationDef | LinkDecorationDef;
135
+
136
+ // These positions enumerations can be used to position elements relative to
137
+ // a node or link. The values here should match those in the JSON schema files.
138
+ // I could not find away to encode them in the JSON schema so they would get
139
+ // generated as below.
140
+ export type NodePosition =
141
+ | "topLeft"
142
+ | "middleLeft"
143
+ | "bottomLeft"
144
+ | "topCenter"
145
+ | "middleCenter"
146
+ | "bottomCenter"
147
+ | "topRight"
148
+ | "middleRight"
149
+ | "bottomRight";
150
+
151
+ export type LinkPosition = "source" | "middle" | "target";
152
+
153
+
154
+ export type ContextMenuEntry = ContextMenuDivider | ContextMenuItem;
155
+
156
+ export interface ContextMenuDivider {
157
+ divider: true;
158
+ }
159
+
160
+ /** Existing internal common canvas actions */
161
+ type InternalAction =
162
+ | "selectAll"
163
+ | "cut"
164
+ | "copy"
165
+ | "paste"
166
+ | "undo"
167
+ | "redo"
168
+ | "createSupernode"
169
+ | "expandSupernode"
170
+ | "collapseSupernode"
171
+ | "deleteSelectedObjects"
172
+ | "createComment"
173
+ | "deleteLink"
174
+ | "disconnectNode"
175
+ | "highlightBranch"
176
+ | "highlightDownstream"
177
+ | "highlightUpstream"
178
+ | "unhighlight";
179
+
180
+ export interface ContextMenuItem {
181
+ action: InternalAction | string | "colorBackground";
182
+ label: string;
183
+ icon?: string | ReactNode;
184
+ enable?: boolean;
185
+ submenu?: boolean;
186
+ menu?: ContextMenuEntry[];
187
+ toolbarItem?: boolean;
188
+ };
189
+
190
+
191
+ export interface StyleSpec {
192
+ body?: {
193
+ default?: string;
194
+ hover?: string;
195
+ };
196
+ image?: {
197
+ default: string;
198
+ };
199
+ label?: {
200
+ default: string;
201
+ };
202
+ selection_outline?: {
203
+ default: string;
204
+ };
205
+ }
206
+
207
+ export interface AncestorPipeline {
208
+ pipelineId: string;
209
+ label?: string;
210
+ supernodeId?: string;
211
+ parentPipelineId?: string;
212
+ }
213
+
214
+ export interface PipelineObjectStyle {
215
+ style: StyleSpec;
216
+ pipelineId: string;
217
+ objId: string;
218
+ }
219
+
220
+
221
+ /** https://elyra-ai.github.io/canvas/03.04.05-notification-messages/ */
222
+ export type NotificationMsgType =
223
+ | "info"
224
+ | "success"
225
+ | "warning"
226
+ | "error"
227
+ | ""
228
+ | undefined
229
+ | null;
230
+
231
+ export interface NotificationMsg {
232
+ id: string;
233
+ type: NotificationMsgType;
234
+ title?: string | ReactNode;
235
+ content?: string | ReactNode;
236
+ timestamp?: string;
237
+ callback?: (id: string) => void;
238
+ closeMessage?: string | ReactNode;
239
+ }
240
+
241
+ /**
242
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/ *
243
+ * The application can programmatically perform most of the actions
244
+ * that the user can do in Common Canvas by calling the Canvas Controller API.
245
+ *
246
+ * Note: See this section for differences between the structure of objects
247
+ * in the API and the schema:
248
+ * https://elyra-ai.github.io/canvas/03.04.02-api-object-structure/
249
+ *
250
+ * In most cases within the API, the pipelineId parameter is optional.
251
+ * If pipelineId is omitted, the method will default to the pipeline that
252
+ * is currently displayed in the main canvas viewport.
253
+ *
254
+ * Warning 1: Do not alter the IDs of objects that currently exist on the
255
+ * canvas. Changing object IDs can cause internal problems, in particular
256
+ * with the command stack.
257
+ *
258
+ * Warning 2: When using external pipeline flows, Pipeline IDs must be
259
+ * globally unique identifiers.
260
+ */
261
+ export declare class CanvasController {
262
+ /**
263
+ * Loads the pipelineFlow document provided into common-canvas and displays it.
264
+ * The document must conform to the pipelineFlow schema as documented in the
265
+ * elyra-ai pipeline-schemas repo. Documents conforming to older versions may be
266
+ * provided, but they will be upgraded to the most recent version.
267
+ */
268
+ setPipelineFlow(
269
+ pipelineFlow: PipelineFlowDef | RelaxedPipelineFlow,
270
+ ): void;
271
+
272
+ /**
273
+ * Clears the pipeline flow and displays an empty canvas.
274
+ */
275
+ clearPipelineFlow(): void;
276
+
277
+ /**
278
+ * @returns the current pipelineFlow document in the latest version of the
279
+ * pipelineFlow schema as documented in the elyra-ai pipeline-schemas repo.
280
+ */
281
+ getPipelineFlow(): PipelineFlowDef;
282
+
283
+ /**
284
+ * Returns the current pipelineFlow document ID.
285
+ * @returns the pipeline flow ID.
286
+ */
287
+ getPipelineFlowId(): string;
288
+
289
+ /**
290
+ * Returns the ID of the primary pipeline from the pipelineFlow.
291
+ * @returns the ID of the primary pipeline.
292
+ */
293
+ getPrimaryPipelineId(): string;
294
+
295
+ /**
296
+ * Returns the external pipeline flow for the url passed in. The external
297
+ * flow must have been loaded through some common canvas action for this
298
+ * method to be able to return anything.
299
+ * @param url
300
+ * @returns the pipeline flow ID.
301
+ */
302
+ getExternalPipelineFlow(url: string): PipelineFlowDef;
303
+
304
+ /**
305
+ * Returns the internal format of all canvas data stored in memory by
306
+ * common-canvas. Nodes, comments and links are returned in the internal
307
+ * format.
308
+ * @returns the canvas objects in the internal canvas-info format
309
+ */
310
+ getCanvasInfo(): CanvasInfo;
311
+
312
+ /**
313
+ * Returns an array of ancestor pipelines from the primary pipeline to
314
+ * the pipeline indicated by the ID passed in.
315
+ * @param pipelineId
316
+ * @returns the IDs of the ancestor pipeline of the pipeline ID passed in.
317
+ */
318
+ getAncestorPipelineIds(pipelineId: string): AncestorPipeline[];
319
+
320
+ /**
321
+ * Removes all styles from nodes, comments and links. See the setObjectsStyle
322
+ * and setLinkStyle methods for details on setting styles.
323
+ * @param temporary - boolean that indicates whether temporary or permanent
324
+ * styles should be removed.
325
+ */
326
+ removeAllStyles(temporary: boolean): void;
327
+
328
+ /**
329
+ * Specifies the new styles for objects that are not highlighted during
330
+ * branch highlighting.
331
+ * @param newStyle - is a style specification object
332
+ */
333
+ setSubdueStyle(newStyle: StyleSpec): void;
334
+
335
+ /**
336
+ * ## Pipeline methods
337
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#pipeline-methods
338
+ */
339
+
340
+ /**
341
+ * Returns the canvas info pipeline object for the pipeline Id passed in.
342
+ * @param pipelineId
343
+ * @returns the pipeline object for the pipeline Id passed in.
344
+ */
345
+ getPipeline(pipelineId: string): CanvasPipeline;
346
+
347
+ /**
348
+ * Returns the ID of the pipeline object which is currently on display
349
+ * in the canvas. Typically, this is the primary pipeline but will be
350
+ * different if the user has navigated into one or more supernodes; in
351
+ * which case it will be the ID of the pipeline at the level in the
352
+ * supernode hierarchy that is currently on display.
353
+ * @returns a pipeline ID for the currently displayed pipeline.
354
+ */
355
+ getCurrentPipelineId(): string;
356
+
357
+ /**
358
+ * Returns truthy if the pipeline is external (that is it is part of an
359
+ * external pipeline flow). Otherwise, return falsy to indicate the pipeline
360
+ * is local.
361
+ * @param pipelineId
362
+ * @returns a boolean to indicate whether the pipeline is external ot local
363
+ */
364
+ isPipelineExternal(pipelineId: string): boolean;
365
+
366
+ /**
367
+ * Returns the messages for all the nodes in the pipeline ID passed in.
368
+ * @param pipelineId - Optional. The ID of the pipeline.
369
+ * Defaults to the currently displayed pipeline.
370
+ * @returns An array of messages.
371
+ */
372
+ getFlowMessages(pipelineId: string): MessageDef[];
373
+
374
+ /**
375
+ * Indicates whether the nodes have a message or not.
376
+ * @param includeMsgType - can be either "error" or "warning"
377
+ * @param pipelineId - Optional. The ID of the pipeline.
378
+ * Defaults to the currently displayed pipeline.
379
+ * @returns a boolean to indicate whether there are any messages of
380
+ * includeMsgsType for the nodes in the pipeline identified
381
+ * by the pipeline ID passed in.
382
+ */
383
+ isFlowValid(includeMsgType: "error" | "warning", pipelineId: string): boolean;
384
+
385
+ /**
386
+ * Rearranges the nodes in the canvas in the direction specified for the
387
+ * pipeline ID passed in.
388
+ * @param layoutDirection - can be "horizontal" or "vertical"
389
+ * @param pipelineId - Optional. The ID of the pipeline.
390
+ * Defaults to the currently displayed pipeline.
391
+ */
392
+ autoLayout(layoutDirection: "horizontal" | "vertical", pipelineId: string): void;
393
+
394
+ /**
395
+ * ## Palette methods
396
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#palette-methods
397
+ */
398
+
399
+ /**
400
+ * Loads the palette data as described in the palette schema in
401
+ * elyra-ai pipeline-schemas repo. Any version can be loaded and it will be
402
+ * upgraded to the latest version.
403
+ * @param A palette containing nodes in the pipeline flow format.
404
+ */
405
+ setPipelineFlowPalette(
406
+ palette: RelaxedPipelineFlowPalette | PipelineFlowPalette
407
+ ): void;
408
+
409
+ /**
410
+ * Clears the palette data from common-canvas.
411
+ */
412
+ clearPaletteData(): void;
413
+
414
+ /**
415
+ * Sets the loading text of the category. If set to a non-empty string the
416
+ * category will show an InlineLoading control in the palette category div
417
+ * with this text as the label. If set to falsey the palette category
418
+ * will display as normal.
419
+ * @param categoryId
420
+ * @param loadingText
421
+ */
422
+ setCategoryLoadingText(categoryId: string, loadingText: string): void;
423
+
424
+ /**
425
+ * Sets the empty text of the category. If set to a non-empty string and the
426
+ * category does not have any nodes, the palette will show a warning icon with
427
+ * this text as a message under the category title when the category is opened.
428
+ * This message will not be displayed if the field is set to falsey or if
429
+ * nodetypes are added to the category.
430
+ * @param categoryId
431
+ * @param emptyText
432
+ */
433
+ setCategoryEmptyText(categoryId: string, emptyText: string): void;
434
+
435
+ /**
436
+ * Adds a new node into the palette:
437
+ * @param nodeTypeObj - must conform to the style of node used by the palette as
438
+ * described in the pipeline flow . See objects in nodeTypes array in the
439
+ * palette schema:
440
+ * https://github.com/elyra-ai/pipeline-schemas/blob/main/common-canvas/palette/palette-v3-schema.json
441
+ * @param categoryId - is the name of the palette category where the node will be
442
+ * added. If the category doesn't exist it will be created.
443
+ * @param categoryLabel - Is an optional param. If a new category is created it will
444
+ * be displayed with this label.
445
+ * @param categoryDescription - Is an optional param. If a new category is created
446
+ * it will be displayed with this description.
447
+ * @param categoryImage - Is an optional param. The image displayed for the category provided as a
448
+ * reference to an image or the image itself.
449
+ */
450
+ addNodeTypeToPalette(
451
+ nodeTypeObj: NodeTypeDef,
452
+ categoryId: string,
453
+ categoryLabel?: string,
454
+ categoryDescription?: string,
455
+ categoryImage?: string
456
+ ): void;
457
+
458
+ /**
459
+ * Adds an array of new node into the palette:
460
+ * @param nodeTypeObjs - an array of nodetypes that must conform to the style of
461
+ * nodes used by the palette as described in the palette schema. See objects
462
+ * in nodeTypes array in the palette schema:
463
+ * https://github.com/elyra-ai/pipeline-schemas/blob/main/common-canvas/palette/palette-v3-schema.json
464
+ * @param categoryId - is the ID of the palette category where the node will be
465
+ * added. If the category doesn't exist it will be created.
466
+ * @param categoryLabel - is an optional param. If a new category is created it will
467
+ * be displayed with this label.
468
+ * @param categoryDescription - Is an optional param. If a new category is created
469
+ * it will be displayed with this description.
470
+ * @param categoryImage - Is an optional param. The image displayed for the category provided as a
471
+ * reference to an image or the image itself.
472
+ */
473
+ addNodeTypesToPalette(
474
+ nodeTypeObjs: NodeTypeDef[],
475
+ categoryId: string,
476
+ categoryLabel?: string,
477
+ categoryDescription?: string,
478
+ categoryImage?: string
479
+ ): void;
480
+
481
+ /**
482
+ * Removes nodetypes from a palette category
483
+ * @param selObjectIds - an array of object IDs to identify the nodetypes to be
484
+ * @param categoryId - the ID of teh category from which the nodes will be removed
485
+ */
486
+ removeNodesFromPalette(selObjectIds: string[], categoryId: string): void;
487
+
488
+ /**
489
+ * @returns the palette data document which will conform to the latest version
490
+ * of the palette schema.
491
+ */
492
+ getPaletteData(): PipelineFlowPalette;
493
+
494
+ /**
495
+ * @param operatorId - ID of the operator for this node
496
+ * @returns the palette node identified by the operator ID passed in.
497
+ */
498
+ getPaletteNode(operatorId: string): NodeTypeDef;
499
+
500
+ /**
501
+ * @param nodeId - ID of the node
502
+ * @returns the palette node identified by the node ID passed in.
503
+ */
504
+ getPaletteNodeById(nodeId: string): NodeTypeDef;
505
+
506
+ /**
507
+ * Returns the cateory that the node identified by the operatorId is in.
508
+ * @param operatorId - ID of the operator for this node
509
+ * @returns the category of the palette node identified by the operator passed in
510
+ */
511
+ getCategoryForNode(operatorId: string): CategoryDef;
512
+
513
+ /**
514
+ * Converts a node template from the format use in the palette (that conforms
515
+ * to the pipeline flow schema) to the internal node format.
516
+ * @param nodeTemplate - A node object conforming to the pipeline flow schema
517
+ * @returns a node object conforming to the Canvas Info schema.
518
+ */
519
+ convertNodeTemplate(nodeTemplate: NodeTypeDef): CanvasNode;
520
+
521
+ /** Opens the palette category identified by the category ID passed in.
522
+ * @param categoryId - ID of the category
523
+ */
524
+ openPaletteCategory(categoryId: string): void;
525
+
526
+ /** Closes the palette category idetified by the category ID passed in.
527
+ * @param categoryId - ID of the category
528
+ */
529
+ closePaletteCategory(categoryId: string): void;
530
+
531
+ /** Opens all the palette categories. */
532
+ openAllPaletteCategories(): void;
533
+
534
+ /** Closes all the palette categories. */
535
+ closeAllPaletteCategories(): void;
536
+
537
+ /** Returns true or false to indicate whether a palette category is open or not.
538
+ * @param categoryId - ID of the category
539
+ */
540
+ isPaletteCategoryOpen(categoryId: string): boolean;
541
+
542
+ /**
543
+ * ## Selection methods
544
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#selections-methods
545
+ */
546
+
547
+ /**
548
+ * Sets the currently selected objects replacing any current selections.
549
+ * Selected objects can only be in one pipeline. If this parameter is omitted
550
+ * it is assumed the selections will be for objects in the 'top-level' pipeline
551
+ * being displayed.
552
+ * @param newSelections - An array of object IDs for nodes and/or comments
553
+ * @param pipelineId - Optional. The ID of the pipeline where the objects exist.
554
+ */
555
+ setSelections(
556
+ newSelections: string[],
557
+ pipelineId?: string
558
+ ): void;
559
+ /**
560
+ * Clears all the current selections from the canvas.
561
+ */
562
+ clearSelections(): void;
563
+
564
+ /**
565
+ * Selects all the objects on the canvas.
566
+ */
567
+ selectAll(): void;
568
+
569
+ /**
570
+ * De-selects all the objects in a pipeline.
571
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
572
+ * Defaults to the currently displayed pipeline.
573
+ */
574
+ deselectAll(pipelineId: string): void;
575
+
576
+ /**
577
+ * @returns an array of the IDs of the currently selected objects.
578
+ */
579
+ getSelectedObjectIds(): string[];
580
+
581
+ /**
582
+ * Returns the selected nodes for the currently displayed pipeline.
583
+ * @returns the currently selected nodes.
584
+ */
585
+ getSelectedNodes(): CanvasNode[];
586
+
587
+ /**
588
+ * Returns the selected comments for the currently displayed pipeline.
589
+ * @returns the currently selected comments.
590
+ */
591
+ getSelectedComments(): CanvasComment[];
592
+
593
+ /**
594
+ * Returns the ID of the pipeline in which the currently selected objects
595
+ * exist. Only one pipeline may contain selected objects.
596
+ * @returns a pipeline ID
597
+ */
598
+ getSelectedPipelineId(): string;
599
+
600
+ /**
601
+ * Deletes all currently selected objects.
602
+ */
603
+ deleteSelectedObjects(): void;
604
+
605
+ /**
606
+ * Returnd true if the currently selected objects are all linked together.
607
+ * This is used when deciding to creating a supernode.
608
+ * @returns true if nodes are linked
609
+ */
610
+ areSelectedNodesContiguous(): boolean;
611
+
612
+ /**
613
+ * ## Notification messages methods
614
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#notification-messages-methods
615
+ */
616
+
617
+ /**
618
+ * Overwrites the array of notification messages shown in the notification panel.
619
+ * @param newMessages - An array of messages (see `getNotificationMessages`)
620
+ */
621
+ setNotificationMessages(newMessages: NotificationMsg[]): void;
622
+
623
+ /**
624
+ * Deletes all notification messages shown in the notification panel.
625
+ */
626
+ clearNotificationMessages(): void;
627
+
628
+ /**
629
+ * Removes notification messages from the notification panel specified
630
+ * by the array of message IDs passed in.
631
+ * @param ids - array of IDs
632
+ */
633
+ deleteNotificationMessages(ids: string[]): void;
634
+
635
+ /**
636
+ * Returns the array of current notification messages. If the messageType is
637
+ * provided only messages of that type will be returned. If messageType is
638
+ * not provided, all messages will be returned. The format of a notification
639
+ * message is an object with these fields:
640
+ * {
641
+ * "id": string (Required),
642
+ * "type" : enum, oneOf ["info", "success", "warning", "error"] (Required),
643
+ * "callback": function, the callback function when a message is clicked (Required),
644
+ * "title": string (Optional),
645
+ * "content": string, html, JSX Object (Optional),
646
+ * "timestamp": string (Optional),
647
+ * "closeMessage": string (Optional)
648
+ * }
649
+ * @param messageType - Optional. A type of notification message.
650
+ * @returns An Array of notificaiton messages
651
+ */
652
+ getNotificationMessages(messageType?: NotificationMsgType): NotificationMsg[];
653
+
654
+ /**
655
+ *
656
+ * Returns the maximum notification message type present in the current set
657
+ * of notification messages. For this: ("error" > "warning" > "success" > "info")
658
+ * @returns `"info" | "success" | "warning" | "error";`
659
+ */
660
+ getNotificationMessagesMaxType(): NotificationMsgType;
661
+
662
+ /**
663
+ * ## Node and Comment methods
664
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#node-and-comment-methods
665
+ */
666
+
667
+ /**
668
+ * Moves the objects identified in the data object which must be in the
669
+ * pipeline identified by the pipeline ID.
670
+ * @param data - An object containing the node IDs to move and the X Y offsets
671
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
672
+ * Defaults to the currently displayed pipeline.
673
+ */
674
+ moveObjects(
675
+ data: {
676
+ nodes: string[];
677
+ offsetX: number;
678
+ offsetY: number;
679
+ },
680
+ pipelineId?: string
681
+ ): void;
682
+
683
+ /**
684
+ * Deletes the objects specified in objectIds array.
685
+ * @param objectIds - An array of node and comment IDs
686
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
687
+ * Defaults to the currently displayed pipeline.
688
+ */
689
+ deleteObjects(
690
+ objectIds: string[],
691
+ pipelineId?: string
692
+ ): void;
693
+
694
+ /**
695
+ * Removes the links to and from the objects specified in the objectIds array.
696
+ * @param objectIds - An array of node and comment IDs
697
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
698
+ * Defaults to the currently displayed pipeline.
699
+ */
700
+ disconnectObjects(
701
+ objectIds: string[],
702
+ pipelineId?: string
703
+ ): void;
704
+
705
+ /**
706
+ * Deletes the object specified by the ID in the pipeline specified by
707
+ * pipeline ID.
708
+ * @param id - The ID of the object to be deleted.
709
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
710
+ * Defaults to the currently displayed pipeline.
711
+ */
712
+ deleteObject(id: string, pipelineId: string): void;
713
+
714
+ /**
715
+ * Sets the style of the objects specified by pipelineObjectIds to be
716
+ * the newStyle which will be either temporary or permanent.
717
+ * @deprecated Use classes to style objects instead of style specs.
718
+ *
719
+ * @param pipelineObjectIds: This identified the objects to be styles. It is a
720
+ * javascript object like this:
721
+ *
722
+ * ```javascript
723
+ * {
724
+ * <pipelineID_1>: [
725
+ * <objectID_1_1>,
726
+ * <objectID_1_2>
727
+ * ],
728
+ * <pipelineID_2>: [
729
+ * <objectID_2_1>,
730
+ * <objectID_2_2>
731
+ * ]
732
+ * }
733
+ * ```
734
+ *
735
+ * @param newStyle - This is a style specification. See the wiki for details.
736
+ * @param temporary - A boolean to indicate if the style is serialized when
737
+ * getPipelineFlow() method is called or not.
738
+ */
739
+ setObjectsStyle(
740
+ pipelineObjectIds: Record<string, string[]>,
741
+ newStyle: StyleSpec,
742
+ temporary: boolean
743
+ ): void;
744
+
745
+ /**
746
+ * Sets the styles of multiple objects at once.
747
+ * @deprecated Use classes to style objects instead of style specs.
748
+ *
749
+ * @param pipelineObjStyles - Specified the objects and the styles each should be
750
+ * set to. It is a javascript array like this:
751
+ *
752
+ * ```javascript
753
+ * [
754
+ * { pipelineId: <pipelineId>, objId: <objectId>, style: <style_spec>},
755
+ * { pipelineId: <pipelineId>, objId: <objectId>, style: <style_spec>},
756
+ * { pipelineId: <pipelineId>, objId: <objectId>, style: <style_spec>}
757
+ * ]
758
+ * ```
759
+ * @param temporary - A boolean to indicate if the styles are serialized when
760
+ * getPipelineFlow() method is called or not.
761
+ */
762
+ setObjectsMultiStyle(
763
+ pipelineObjStyles: PipelineObjectStyle[],
764
+ temporary: boolean
765
+ ): void;
766
+
767
+ /**
768
+ * ## Node methods
769
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#node-methods
770
+ */
771
+
772
+ /**
773
+ * Returns an array of nodes for the pipeline specified by the pipelineId.
774
+ * @param pipelineId - Optional. The ID of the pipeline.
775
+ * Defaults to the currently displayed pipeline.
776
+ */
777
+ getNodes(pipelineId?: string): CanvasNode[];
778
+
779
+ /**
780
+ * Returns a new node created from the data parameter in the pipeline
781
+ * identified by the pipelineId.
782
+ * @param data - An object containing
783
+ *
784
+ * `nodeTemplate` - a node template from the palette. The nodeTemplate
785
+ * can be retrieved from the palette using with Canvas
786
+ * Controller methods: getPaletteNode or getPaletteNodeById.
787
+ *
788
+ * `offsetX` - the x coordinate of the new node
789
+ *
790
+ * `offsetY` - the y coordinate of the new node
791
+ *
792
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
793
+ * Defaults to the currently displayed pipeline.
794
+ */
795
+ createNode(
796
+ data: {
797
+ nodeTemplate: NodeTypeDef;
798
+ offsetX: number;
799
+ offsetY: number;
800
+ },
801
+ pipelineId?: string
802
+ ): CanvasNode;
803
+
804
+ /**
805
+ * Adds a new node into the pipeline specified by the pipelineId.
806
+ * @param A node that complied withe canvas info format
807
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
808
+ * Defaults to the currently displayed pipeline.
809
+ */
810
+ addNode(node: CanvasNode, pipelineId?: string): void;
811
+
812
+ /**
813
+ * Creates a node using the data parameter provided in the pipeline specified
814
+ * by pipelineId and adds the command to the command stack (so the user can
815
+ * undo/redo the command). This will also cause the beforeEditActionHandler
816
+ * and editActionHandler callbacks to be called.
817
+ * If pipelineId is omitted the node will be created in the current
818
+ * "top-level" pipeline.
819
+ * @deprectaed Use the editActionHandler call directly instead
820
+ * @param data - An object containing
821
+ *
822
+ * `nodeTemplate` - a node template from the palette. The nodeTemplate
823
+ * can be retrieved from the palette using with Canvas
824
+ * Controller methods: getPaletteNode or getPaletteNodeById.
825
+ *
826
+ * `offsetX` - the x coordinate of the new node
827
+ *
828
+ * `offsetY` - the y coordinate of the new node
829
+ *
830
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
831
+ * Defaults to the currently displayed pipeline.
832
+ */
833
+ createNodeCommand(
834
+ data: {
835
+ nodeTemplate: NodeTypeDef;
836
+ offsetX: number;
837
+ offsetY: number;
838
+ },
839
+ pipelineId?: string
840
+ ): void;
841
+
842
+ /**
843
+ * Deletes the node specified.
844
+ * @param nodeId - The ID of the node
845
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
846
+ * Defaults to the currently displayed pipeline.
847
+ */
848
+ deleteNode(nodeId: string, pipelineId?: string): void;
849
+
850
+ /**
851
+ * Sets the node properties
852
+ * @param nodeId - The ID of the node
853
+ * @param properties - An object containing properties to be over the node
854
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
855
+ * Defaults to the currently displayed pipeline.
856
+ */
857
+ setNodeProperties(
858
+ nodeId: string,
859
+ properties: Omit<Partial<CanvasNode>, "id">,
860
+ pipelineId?: string
861
+ ): void;
862
+ /**
863
+ * Sets the node parameters
864
+ * @param nodeId - The ID of the node
865
+ * @param parameters - An array of parameters
866
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
867
+ * Defaults to the currently displayed pipeline.
868
+ */
869
+ setNodeParameters(
870
+ nodeId: string,
871
+ parameters: Record<string, unknown>[],
872
+ pipelineId?: string
873
+ ): void;
874
+
875
+ /**
876
+ * Sets the node UI parameters
877
+ * @param nodeId - The ID of the node
878
+ * @param uiParameters - An array of UI parameters
879
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
880
+ * Defaults to the currently displayed pipeline.
881
+ */
882
+ setNodeUiParameters(
883
+ nodeId: string,
884
+ uiParameters: Record<string, unknown>[],
885
+ pipelineId?: string
886
+ ): void;
887
+
888
+ /**
889
+ * Sets the node messages
890
+ * @param nodeId - The ID of the node
891
+ * @param messages - An array of messages
892
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
893
+ * Defaults to the currently displayed pipeline.
894
+ */
895
+ setNodeMessages(
896
+ nodeId: string,
897
+ messages: MessageDef[],
898
+ pipelineId?: string
899
+ ): void;
900
+
901
+ /**
902
+ * Sets a single message on a node
903
+ * @param nodeId - The ID of the node
904
+ * @param message - A message
905
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
906
+ * Defaults to the currently displayed pipeline.
907
+ */
908
+ setNodeMessage(
909
+ nodeId: string,
910
+ message: MessageDef,
911
+ pipelineId?: string
912
+ ): void;
913
+
914
+ /**
915
+ * Sets the label for a node
916
+ * @param nodeId - The ID of the node
917
+ * @param newLabel - The new label
918
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
919
+ * Defaults to the currently displayed pipeline.
920
+ */
921
+ setNodeLabel(
922
+ nodeId: string,
923
+ newLabel: string,
924
+ pipelineId?: string
925
+ ): void;
926
+
927
+ /**
928
+ * Sets the class name to newClassName of the nodes identified by nodeIds
929
+ * array in the pipeline specified by pipeline ID. The class name will be
930
+ * applied to the nodes' group (<g>) element in the DOM.
931
+ * @param nodeIds - An array of node IDs
932
+ * @param newClassName - New class string. Can be a space separated list of classes.
933
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
934
+ * Defaults to the currently displayed pipeline.
935
+ */
936
+ setNodesClassName(
937
+ nodeIds: string[],
938
+ newClassName: string,
939
+ pipelineId?: string
940
+ ): void;
941
+
942
+ /**
943
+ * Sets the decorations on a node. The decorations array passed in
944
+ * will replace any decorations currently applied to the node.
945
+ * @param nodeId - The ID of the node
946
+ * @param newDecorations - An array of decorations.
947
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
948
+ * Defaults to the currently displayed pipeline.
949
+ */
950
+ setNodeDecorations(
951
+ nodeId: string,
952
+ newDecorations: Decoration[],
953
+ pipelineId?: string
954
+ ): void;
955
+
956
+ /**
957
+ * Sets the input ports on a node. The inputs array of ports provided will
958
+ * replace any input ports for a node.
959
+ * @param nodeId - The ID of the node
960
+ * @param inputs - An array of input port objects.
961
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
962
+ * Defaults to the currently displayed pipeline.
963
+ */
964
+ setNodeInputPorts(
965
+ nodeId: string,
966
+ inputs: CanvasPorts | CanvasBoundPorts,
967
+ pipelineId?: string
968
+ ): void;
969
+
970
+ /**
971
+ * Sets the output ports on a node. The outputs array of ports provided will
972
+ * replace any output ports for a node.
973
+ * @param nodeId - The ID of the node
974
+ * @param outputs - An array of output port objects.
975
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
976
+ * Defaults to the currently displayed pipeline.
977
+ */
978
+ setNodeOutputPorts(
979
+ nodeId: string,
980
+ outputs: CanvasPorts | CanvasBoundPorts,
981
+ pipelineId?: string
982
+ ): void;
983
+
984
+ /**
985
+ * Sets the decorations of multiple nodes at once. The decorations array
986
+ * passed in will replace any decorations currently applied to the nodes.
987
+ * @param pipelineNodeDecorations - Specifies the nodes and their decorations.
988
+ * It is a JavaScript array like this:
989
+ *
990
+ * ```javascript
991
+ * [
992
+ * { pipelineId: <pipelineId>, nodeId: <nodeId>, decorations: <decoration_spec_array>},
993
+ * { pipelineId: <pipelineId>, nodeId: <nodeId>, decorations: <decoration_spec_array>},
994
+ * { pipelineId: <pipelineId>, nodeId: <nodeId>, decorations: <decoration_spec_array>}
995
+ * ]
996
+ * ```
997
+ */
998
+ setNodesMultiDecorations(
999
+ pipelineNodeDecorations: {
1000
+ pipelineId: string;
1001
+ nodeId: string;
1002
+ decorations: Decoration[];
1003
+ }[]
1004
+ ): void;
1005
+
1006
+ /**
1007
+ * Sets the input port label on a node
1008
+ * @param nodeId - The ID of the node
1009
+ * @param portId - The ID of the input port
1010
+ * @param newLabel - The label
1011
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1012
+ * Defaults to the currently displayed pipeline.
1013
+ */
1014
+ setInputPortLabel(
1015
+ nodeId: string,
1016
+ portId: string,
1017
+ newLabel: string,
1018
+ pipelineId?: string
1019
+ ): void;
1020
+
1021
+ /**
1022
+ * Sets the output port label on a node
1023
+ * @param nodeId - The ID of the node
1024
+ * @param portId - The ID of the output port
1025
+ * @param newLabel - The label
1026
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1027
+ * Defaults to the currently displayed pipeline.
1028
+ */
1029
+ setOutputPortLabel(
1030
+ nodeId: string,
1031
+ portId: string,
1032
+ newLabel: string,
1033
+ pipelineId?: string
1034
+ ): void;
1035
+
1036
+ /**
1037
+ * Gets a node that conforms to the CanvasNode format.
1038
+ * @param nodeId - The ID of the node
1039
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1040
+ * Defaults to the currently displayed pipeline.
1041
+ * @returns A node conforming to the canvas info format. null if not found.
1042
+ */
1043
+ getNode(
1044
+ nodeId: string,
1045
+ pipelineId?: string
1046
+ ): CanvasNode | null;
1047
+
1048
+ /**
1049
+ * Gets the UI parameters for a node
1050
+ * @param nodeId - The ID of the node
1051
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1052
+ * Defaults to the currently displayed pipeline.
1053
+ */
1054
+ getNodeUiParameters(
1055
+ nodeId: string,
1056
+ pipelineId?: string
1057
+ ): Record<string, unknown>[];
1058
+
1059
+ /**
1060
+ * Gets the supernodes for a pipeline.
1061
+ * @param pipelineId - Optional. The ID of the pipeline.
1062
+ * Defaults to the currently displayed pipeline.
1063
+ */
1064
+ getSupernodes(
1065
+ pipelineId: string
1066
+ ): CanvasSupernode[];
1067
+
1068
+ /**
1069
+ * Returns the supernode that references the given pipelineId.
1070
+ * @param pipelineId - The ID of a pipeline
1071
+ * @returns supernode that has a subflow_ref to the given pipelineId.
1072
+ */
1073
+ getSupernodeObjReferencing(
1074
+ pipelineId: string
1075
+ ): CanvasSupernode;
1076
+
1077
+ /**
1078
+ * Gets the messages for a node
1079
+ * @param nodeId - The ID of the node
1080
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1081
+ * Defaults to the currently displayed pipeline.
1082
+ * @returns An array of messages from the node or null if node not found.
1083
+ */
1084
+ getNodeMessages(
1085
+ nodeId: string,
1086
+ pipelineId?: string
1087
+ ): MessageDef[] | null;
1088
+
1089
+ /**
1090
+ * Gets the array of input ports for the node or null if the node ID is
1091
+ * not recognized.
1092
+ * @param nodeId - The ID of the node
1093
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1094
+ * Defaults to the currently displayed pipeline.
1095
+ * @returns An array of canvas ports or canvas bound ports.
1096
+ */
1097
+ getNodeInputPorts(
1098
+ nodeId: string,
1099
+ pipelineId?: string
1100
+ ): CanvasPorts | CanvasBoundPorts | null;
1101
+
1102
+ /**
1103
+ * Gets the array of output ports for the node or null if the node ID is
1104
+ * not recognized.
1105
+ * @param nodeId - The ID of the node
1106
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1107
+ * Defaults to the currently displayed pipeline.
1108
+ * @returns An array of canvas ports or canvas bound ports.
1109
+ */
1110
+ getNodeOutputPorts(
1111
+ nodeId: string,
1112
+ pipelineId?: string
1113
+ ): CanvasPorts | CanvasBoundPorts | null;
1114
+
1115
+ /**
1116
+ * Gets a message for a specific control for a node
1117
+ * @param nodeId - The ID of the node
1118
+ * @param controlName - The control name
1119
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1120
+ * Defaults to the currently displayed pipeline.
1121
+ * @returns A message.
1122
+ */
1123
+ getNodeMessage(
1124
+ nodeId: string,
1125
+ controlName: string,
1126
+ pipelineId?: string
1127
+ ): MessageDef | null;
1128
+
1129
+ /**
1130
+ * Gets an array of decorations for a node
1131
+ * @param nodeId - The ID of the node
1132
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1133
+ * Defaults to the currently displayed pipeline.
1134
+ * @returns An array of decorations.
1135
+ */
1136
+ getNodeDecorations(
1137
+ nodeId: string,
1138
+ pipelineId?: string
1139
+ ): Decoration[] | null;
1140
+
1141
+ /**
1142
+ * Gets the class name associated with the node specified by nodeId in the
1143
+ * pipeline specified by pipelineId.
1144
+ * @param nodeId - The ID of the node
1145
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1146
+ * Defaults to the currently displayed pipeline.
1147
+ * @returns A class name string. Can be a space separated list of classes.
1148
+ */
1149
+ getNodeClassName(
1150
+ nodeId: string,
1151
+ pipelineId?: string
1152
+ ): string;
1153
+
1154
+ /**
1155
+ * Gets the style specification (see Wiki) for a node
1156
+ * @param nodeId - The ID of the node
1157
+ * @param temporary - A boolean to indicate if the style is serialized when
1158
+ * getPipelineFlow() method is called or not.
1159
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1160
+ * Defaults to the currently displayed pipeline.
1161
+ * @returns A style specification.
1162
+ */
1163
+ getNodeStyle(
1164
+ nodeId: string,
1165
+ temporary: boolean,
1166
+ pipelineId?: string
1167
+ ): StyleSpec;
1168
+
1169
+ /**
1170
+ * Returns an array of nodes that are for the branch(es) that the nodes,
1171
+ * identified by the node IDs passed in, are within.
1172
+ * @param nodeIds - An array of node Ids
1173
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
1174
+ * Defaults to the currently displayed pipeline.
1175
+ * @returns An array of CanvasNode objects
1176
+ */
1177
+ getBranchNodes(
1178
+ nodeIds: string[],
1179
+ pipelineId?: string
1180
+ ): CanvasNode[];
1181
+
1182
+ /**
1183
+ * Returns an array of nodes that are upstream from the nodes
1184
+ * identified by the node IDs passed in.
1185
+ * @param nodeIds - An array of node Ids
1186
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
1187
+ * Defaults to the currently displayed pipeline.
1188
+ * @returns An array of CanvasNode objects
1189
+ */
1190
+ getUpstreamNodes(
1191
+ nodeIds: string[],
1192
+ pipelineId?: string
1193
+ ): CanvasNode[];
1194
+
1195
+ /**
1196
+ * Returns an array of nodes that are downstream from the nodes
1197
+ * identified by the node IDs passed in.
1198
+ * @param nodeIds - An array of node Ids
1199
+ * @param pipelineId - Optional. The ID of the pipeline of the nodes.
1200
+ * Defaults to the currently displayed pipeline.
1201
+ * @returns An array of CanvasNode objects
1202
+ */
1203
+ getDownstreamNodes(
1204
+ nodeIds: string[],
1205
+ pipelineId?: string
1206
+ ): CanvasNode[];
1207
+
1208
+ /**
1209
+ * Returns a boolean to indicate whether the supernode is expanded in place.
1210
+ * @param nodeId - The ID of the node
1211
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1212
+ * Defaults to the currently displayed pipeline.
1213
+ * @returns A boolean to indicate whether the supernode is expanded in place.
1214
+ */
1215
+ isSuperNodeExpandedInPlace(
1216
+ nodeId: string,
1217
+ pipelineId?: string
1218
+ ): boolean;
1219
+
1220
+ /**
1221
+ * Sets the label, for the node identified, to edit mode, provided the node
1222
+ * label is editable. This allows the user to edite the label text.
1223
+ * @param nodeId - The ID of the node
1224
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1225
+ * Defaults to the currently displayed pipeline.
1226
+ */
1227
+ setNodeLabelEditingMode(
1228
+ nodeId: string,
1229
+ pipelineId?: string
1230
+ ): void;
1231
+
1232
+ /**
1233
+ * Sets the decoration label, for the decoration in the node identified, to edit
1234
+ * mode, provided the node label is editable. This allows the user to edit the
1235
+ * label text.
1236
+ * @param decId - The ID of the decoration.
1237
+ * @param nodeId - The ID of the node.
1238
+ * @param pipelineId - Optional. The ID of the pipeline of the node.
1239
+ * Defaults to the currently displayed pipeline.
1240
+ */
1241
+ setNodeDecorationLabelEditingMode(
1242
+ decId: string,
1243
+ nodeId: string,
1244
+ pipelineId?: string
1245
+ ): void;
1246
+
1247
+ /**
1248
+ * ## Comment methods
1249
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#comment-methods
1250
+ */
1251
+
1252
+ /**
1253
+ * Returns the comments from the pipeline.
1254
+ * @param pipelineId - Optional. The ID of the pipeline of the comments.
1255
+ * Defaults to the currently displayed pipeline.
1256
+ * @returns An array of comments conforming to the canvas info format.
1257
+ */
1258
+ getComments(
1259
+ pipelineId?: string
1260
+ ): CanvasComment[];
1261
+
1262
+ /**
1263
+ * Returns a comment from the pipeline.
1264
+ * @param comId - The ID of the comment
1265
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1266
+ * Defaults to the currently displayed pipeline.
1267
+ * @returns A comment conforming to the canvas info format. null if not found.
1268
+ */
1269
+ getComment(
1270
+ comId: string,
1271
+ pipelineId?: string
1272
+ ): CanvasComment | null;
1273
+
1274
+ /**
1275
+ * Returns a position object which indicates the position of where a new
1276
+ * comment should be placed in a situation where the mouse position cannot be
1277
+ * used (e.g. the toolbar button was clicked).
1278
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1279
+ * Defaults to the currently displayed pipeline.
1280
+ * @returns A comment position with canvas coordinates.
1281
+
1282
+ */
1283
+ getNewCommentPosition(
1284
+ pipelineId?: string
1285
+ ): { x: number; y: number };
1286
+
1287
+ /**
1288
+ * Creates a comment for the pipeline.
1289
+ * @param source - Source data for comment creation.
1290
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1291
+ * Defaults to the currently displayed pipeline.
1292
+ * @returns A comment conforming to the canvas info format.
1293
+ */
1294
+ /* An interface for creating a comment. mousePos is the canvas coordinate
1295
+ * position of the comment, selectedObjectIds is an array of objectsIDs. For
1296
+ * each node identified by an ID in the array a link will be added from the
1297
+ * comment to that node.
1298
+ */
1299
+ createComment(
1300
+ source: {
1301
+ mousePos: {
1302
+ x: number;
1303
+ y: number;
1304
+ };
1305
+ contentType?: null | "markdown" | "WYSIWYG";
1306
+ formats?: {
1307
+ field: string;
1308
+ value?: string;
1309
+ }[];
1310
+ selectedObjectIds?: string[];
1311
+ },
1312
+ pipelineId?: string
1313
+ ): CanvasComment;
1314
+
1315
+ /**
1316
+ * Adds a comment to the pipeline.
1317
+ * @param data - a comment conforming to the canvas info format
1318
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1319
+ * Defaults to the currently displayed pipeline.
1320
+ */
1321
+ addComment(
1322
+ data: CanvasComment,
1323
+ pipelineId?: string
1324
+ ): void;
1325
+
1326
+ /**
1327
+ * Edits a comment with the data.
1328
+ * @param commentProperties - properties to overwrite the comment
1329
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1330
+ * Defaults to the currently displayed pipeline.
1331
+ */
1332
+ editComment(
1333
+ properties: Omit<Partial<CanvasComment>, "id">,
1334
+ pipelineId?: string
1335
+ ): void;
1336
+
1337
+ /**
1338
+ * Sets the properties in the comment identified by the commentId. The
1339
+ * commentProperties is an object containing one or more properties that will
1340
+ * replace the corresponding properties in the comment. For example: if
1341
+ * commentProperties is { x_pos: 50, y_pos: 70 } the comment
1342
+ * will be set to that position.
1343
+ * @param commentId - the ID of teh comment to update
1344
+ * @param properties - properties to overwrite the comment
1345
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1346
+ * Defaults to the currently displayed pipeline.
1347
+ */
1348
+ setCommentProperties(
1349
+ commentId: string,
1350
+ properties: Omit<Partial<CanvasComment>, "id">,
1351
+ pipelineId?: string
1352
+ ): void;
1353
+
1354
+ /**
1355
+ * Sets the class name to newClassName of the comments identified by commentIds
1356
+ * array in the pipeline specified by pipeline ID. The class name will be
1357
+ * applied to the comments' group (<g>) element in the DOM.
1358
+ * @param commentIds - An array of comment IDs.
1359
+ * @param newClassName - New class name. Can be a space separated list of classes.
1360
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1361
+ * Defaults to the currently displayed pipeline.
1362
+ */
1363
+ setCommentsClassName(
1364
+ commentIds: string[],
1365
+ newClassName: string,
1366
+ pipelineId?: string
1367
+ ): void;
1368
+
1369
+ /**
1370
+ * Deletes a comment
1371
+ * @param commentId - The ID of the comment
1372
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1373
+ * Defaults to the currently displayed pipeline.
1374
+ */
1375
+ deleteComment(
1376
+ commentId: string,
1377
+ pipelineId?: string
1378
+ ): void;
1379
+
1380
+ /**
1381
+ * Gets the class name associated with the comment specified by commentId in the
1382
+ * pipeline specified by pipelineId.
1383
+ * @param commentId - The ID of the comment
1384
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1385
+ * Defaults to the currently displayed pipeline.
1386
+ * @returns A class name string. Can be a space separated list of classes.
1387
+ */
1388
+ getCommentClassName(
1389
+ commentId: string,
1390
+ pipelineId?: string
1391
+ ): void;
1392
+
1393
+ /**
1394
+ * Gets the style spcification for a comment
1395
+ * @param commentId - The ID of the comment
1396
+ * @param temporary - A boolean to indicate if the style is serialized when
1397
+ * getPipelineFlow() method is called or not.
1398
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1399
+ * Defaults to the currently displayed pipeline.
1400
+ * @returns A style specification.
1401
+ */
1402
+ getCommentStyle(
1403
+ commentId: string,
1404
+ temporary: boolean,
1405
+ pipelineId?: string
1406
+ ): StyleSpec;
1407
+
1408
+ /** Hides all comments on the canvas. */
1409
+ hideComments(): void;
1410
+
1411
+ /**
1412
+ * Shows all comments on the canvas - if they were previously hiding.
1413
+ */
1414
+ showComments(): void;
1415
+
1416
+ /**
1417
+ * Returns true if comments are currently hiding.
1418
+ * @returns Boolean. true indicates comments are hiding.
1419
+ */
1420
+ isHidingComments(): boolean;
1421
+
1422
+ /**
1423
+ * Sets the comment identified, to edit mode so the user can
1424
+ * edit the comment.
1425
+ * @param commentId - The ID of the comment
1426
+ * @param pipelineId - Optional. The ID of the pipeline of the comment.
1427
+ * Defaults to the currently displayed pipeline.
1428
+ */
1429
+ setCommentEditingMode(
1430
+ commentId: string,
1431
+ pipelineId?: string
1432
+ ): void;
1433
+
1434
+ /**
1435
+ * Link methods
1436
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#link-methods
1437
+ */
1438
+
1439
+ /**
1440
+ * Gets a link
1441
+ * @param linkId - The ID of the link
1442
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1443
+ * Defaults to the currently displayed pipeline.
1444
+ * @returns A link object that conforms to the canvas info format.
1445
+ */
1446
+ getLink(
1447
+ linkId: string,
1448
+ pipelineId?: string
1449
+ ): CanvasLink;
1450
+
1451
+ /**
1452
+ * Gets an array of links
1453
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1454
+ * Defaults to the currently displayed pipeline.
1455
+ * @returns An array a link objects that conform to the canvas info format.
1456
+ */
1457
+ getLinks(
1458
+ pipelineId?: string
1459
+ ): CanvasLink[];
1460
+
1461
+ /**
1462
+ * Sets the properties in the link identified by the linkId. The
1463
+ * linkProperties is an object containing one or more properties that will
1464
+ * replace the corresponding properties in the link.
1465
+ * @param linkId - The ID of the link
1466
+ * @param properties - The properties to set in the link.
1467
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1468
+ * Defaults to the currently displayed pipeline.
1469
+ */
1470
+ setLinkProperties(
1471
+ linkId: string,
1472
+ properties: Omit<Partial<CanvasLink>, "id">,
1473
+ pipelineId?: string
1474
+ ): void;
1475
+
1476
+ /**
1477
+ * Sets the source properties in the data link identified by the linkId. The
1478
+ * srcNodeId and srcNodePortId will be set to the values provided. If
1479
+ * srcNodePortId is set to null the current srcNodePortId will be removed
1480
+ * from the link. Also, if the link has a srcPos property (because its
1481
+ * source end is detached) that will be removed.
1482
+ * @param linkId - The ID of the link
1483
+ * @param srcNodeId - The new source node ID.
1484
+ * @param srcNodePortId - The new port ID for the source node.
1485
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1486
+ * Defaults to the currently displayed pipeline.
1487
+ */
1488
+ setNodeDataLinkSrcInfo(
1489
+ linkId: string,
1490
+ srcNodeId: string,
1491
+ srcNodePortId: string,
1492
+ pipelineId?: string
1493
+ ): void;
1494
+
1495
+ /**
1496
+ * Sets the target properties in the data link identified by the linkId. The
1497
+ * trgNodeId and trgNodePortId will be set to the values provided. If
1498
+ * trgNodePortId is set to null the current trgNodePortId will be removed
1499
+ * from the link. Also, if the link has a trgPos property (because its
1500
+ * target end is detached) that will be removed.
1501
+ * @param linkId - The ID of the link
1502
+ * @param trgNodeId - The new target node ID.
1503
+ * @param trgNodePortId - The new port ID for the target node.
1504
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1505
+ * Defaults to the currently displayed pipeline.
1506
+ */
1507
+ setNodeDataLinkTrgInfo(
1508
+ linkId: string,
1509
+ trgNodeId: string,
1510
+ trgNodePortId: string,
1511
+ pipelineId?: string
1512
+ ): void;
1513
+
1514
+ /**
1515
+ * Returns a node to node data link
1516
+ * @param srcNodeId - The ID of the source node
1517
+ * @param srcNodePortId - The ID of the source node port
1518
+ * @param trgNodeId - The ID of the target node
1519
+ * @param trgNodePortId - The ID of the target node port
1520
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1521
+ * Defaults to the currently displayed pipeline.
1522
+ * @returns A link object in the canvas info format. null if not found.
1523
+ */
1524
+ getNodeDataLinkFromInfo(
1525
+ srcNodeId: string,
1526
+ srcNodePortId: string,
1527
+ trgNodeId: string,
1528
+ trgNodePortId: string,
1529
+ pipelineId?: string
1530
+ ): CanvasLink | null;
1531
+
1532
+ /**
1533
+ * Returns a comment to node link
1534
+ * @param commentId - The ID of the comment
1535
+ * @param nodeId - The ID of the node
1536
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1537
+ * Defaults to the currently displayed pipeline.
1538
+ * @returns A link object in the canvas info format.
1539
+ */
1540
+ getCommentLinkFromInfo(
1541
+ commentId: string,
1542
+ nodeId: string,
1543
+ pipelineId?: string
1544
+ ): CanvasLink;
1545
+
1546
+ /**
1547
+ * Gets a node to node association link
1548
+ * @param nodeId1 - The ID of one of the associated nodes
1549
+ * @param nodeId2 - The ID of the other associated nodes
1550
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1551
+ * Defaults to the currently displayed pipeline.
1552
+ * @returns A link object in the canvas info format.
1553
+ */
1554
+ getNodeAssocLinkFromInfo(
1555
+ nodeId1: string,
1556
+ nodeId2: string,
1557
+ pipelineId?: string
1558
+ ): CanvasLink;
1559
+
1560
+ /**
1561
+ * Adds links to a pipeline
1562
+ * @param linkList - An array of links
1563
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1564
+ * Defaults to the currently displayed pipeline.
1565
+ */
1566
+ addLinks(
1567
+ linkList: CanvasLink[],
1568
+ pipelineId?: string
1569
+ ): void;
1570
+
1571
+ /**
1572
+ * Deletes a link
1573
+ * @param source - The link to delete
1574
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1575
+ * Defaults to the currently displayed pipeline.
1576
+ */
1577
+ deleteLink(
1578
+ link: CanvasLink,
1579
+ pipelineId?: string
1580
+ ): void;
1581
+
1582
+ /**
1583
+ * Creates node to node links of type "nodeLink". One link will be created
1584
+ * between each node in the nodes array and each node in the targetNodes
1585
+ * array. Link IDs will be automatically generated for the created links.
1586
+ * Note: if an ID needs to be provided for the link this method can only
1587
+ * be called for one link at a time.
1588
+ * @param data - Object describing the links to create.
1589
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1590
+ * Defaults to the currently displayed pipeline.
1591
+ */
1592
+ createNodeLinks(
1593
+ data: {
1594
+ id?: string;
1595
+ type: "nodeLink"
1596
+ nodes: {
1597
+ id?: string;
1598
+ portId?: string;
1599
+ srcPos?: {
1600
+ x_pos: number;
1601
+ y_pos: number;
1602
+ };
1603
+ }[];
1604
+ targetNodes: {
1605
+ id?: string;
1606
+ portId?: string;
1607
+ trgPos?: {
1608
+ x_pos: number;
1609
+ y_pos: number;
1610
+ };
1611
+ }[],
1612
+ class_name?: string;
1613
+ linkName?: string;
1614
+ },
1615
+ pipelineId?: string
1616
+ ): CanvasNodeLink[];
1617
+
1618
+ createNodeLinks(
1619
+ data: {
1620
+ id?: string;
1621
+ type: "associationLink"
1622
+ nodes: {
1623
+ id?: string;
1624
+ portId?: string;
1625
+ srcPos?: {
1626
+ x_pos: number;
1627
+ y_pos: number;
1628
+ };
1629
+ }[];
1630
+ targetNodes: {
1631
+ id?: string;
1632
+ portId?: string;
1633
+ trgPos?: {
1634
+ x_pos: number;
1635
+ y_pos: number;
1636
+ };
1637
+ }[],
1638
+ class_name?: string;
1639
+ linkName?: string;
1640
+ },
1641
+ pipelineId?: string
1642
+ ): CanvasAssociationLink[];
1643
+
1644
+
1645
+ /**
1646
+ * Creates comment links of type "commentLink". One link will be created
1647
+ * between each comment in the nodes array and each node in the targetNodes
1648
+ * array. Link IDs will be automatically generated for the created links.
1649
+ * Note: if an ID needs to be provided for the link this method can only
1650
+ * be called for one link at a time.
1651
+ * @param data - Data describing the links
1652
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1653
+ * Defaults to the currently displayed pipeline.
1654
+ */
1655
+ createCommentLinks(
1656
+ data: {
1657
+ id?: string;
1658
+ nodes: {
1659
+ id?: string;
1660
+ }[];
1661
+ targetNodes: {
1662
+ id?: string;
1663
+ }[],
1664
+ class_name?: string;
1665
+ },
1666
+ pipelineId?: string
1667
+ ): CanvasCommentLink[];
1668
+
1669
+ /**
1670
+ * Sets the class name to newClassName of the links identified by linkIds
1671
+ * array in the pipeline specified by pipeline ID. The class name will be
1672
+ * applied to the links' group (<g>) element in the DOM.
1673
+ * @param linkIds - An arry of link IDs
1674
+ * @param newClassName - New class string. Can be a space separated list of classes.
1675
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1676
+ * Defaults to the currently displayed pipeline.
1677
+ */
1678
+ setLinksClassName(
1679
+ linkIds: string[],
1680
+ newClassName: string,
1681
+ pipelineId?: string
1682
+ ): void;
1683
+
1684
+ /**
1685
+ * Sets the style of the links specified by pipelineLinkIds to be
1686
+ * the newStyle which will be either temporary or permanent.
1687
+ * @param pipelineLinkIds - This identifies the objects to be styles. It is a
1688
+ * javascript object like this:
1689
+ * {
1690
+ * <pipelineID_1>: [
1691
+ * <linkID_1_1>,
1692
+ * <linkID_1_2>
1693
+ * ],
1694
+ * <pipelineID_2>: [
1695
+ * <linkID_2_1>,
1696
+ * <linkID_2_2>
1697
+ * ]
1698
+ * }
1699
+ * @param newStyle - This is a style specification.
1700
+ * @param temporary - A boolean to indicate if the style is serialized when
1701
+ * getPipelineFlow() method is called or not.
1702
+ */
1703
+ setLinksStyle(
1704
+ pipelineLinkIds: Record<string, string[]>,
1705
+ newStyle: StyleSpec,
1706
+ temporary: boolean
1707
+ ): void;
1708
+
1709
+ /**
1710
+ * Sets the styles of multiple links at once.
1711
+ * @param pipelineObjStyles - Specified the links and the styles each should be
1712
+ * set to. It is a javascript array like this:
1713
+ * [
1714
+ * { pipelineId: <pipelineId>, objId: <linkId>, style: <style_spec>},
1715
+ * { pipelineId: <pipelineId>, objId: <linkId>, style: <style_spec>},
1716
+ * { pipelineId: <pipelineId>, objId: <linkId>, style: <style_spec>}
1717
+ * ]
1718
+ * @param temporary - A boolean to indicate if the styles are serialized when
1719
+ * getPipelineFlow() method is called or not.
1720
+ */
1721
+ setLinksMultiStyle(
1722
+ pipelineObjStyles: PipelineObjectStyle[],
1723
+ temporary: boolean
1724
+ ): void;
1725
+
1726
+ /**
1727
+ * Gets the class name associated with the link specified by linkId in the
1728
+ * pipeline specified by pipelineId.
1729
+ * @param linkIds - A link ID.
1730
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1731
+ * Defaults to the currently displayed pipeline.
1732
+ * @returns A class name string. Can be a space separated list of classes.
1733
+ */
1734
+ getLinkClassName(
1735
+ linkId: string,
1736
+ pipelineId?: string
1737
+ ): void;
1738
+
1739
+ /**
1740
+ * Returns the style specification for a link.
1741
+ * @param linkId - A link ID.
1742
+ * @param temporary - A boolean to indicate if the style is serialized when
1743
+ * getPipelineFlow() method is called or not.
1744
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1745
+ * Defaults to the currently displayed pipeline.
1746
+ * @returns The style specification for the link.
1747
+ */
1748
+ getLinkStyle(
1749
+ linkId: string,
1750
+ temporary: boolean,
1751
+ pipelineId?: string
1752
+ ): StyleSpec;
1753
+
1754
+ /**
1755
+ * Sets the decorations on a link. The decorations array passed in
1756
+ * will replace any decorations currently applied to the link.
1757
+ * @param linkId - The ID of the link
1758
+ * @param newDecorations - An array of decorations.
1759
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1760
+ * Defaults to the currently displayed pipeline.
1761
+ */
1762
+ setLinkDecorations(
1763
+ linkId: string,
1764
+ newDecorations: Decoration[],
1765
+ pipelineId?: string
1766
+ ): void;
1767
+
1768
+ /**
1769
+ * Sets the decorations of multiple links at once. The decorations array
1770
+ * passed in will replace any decorations currently applied to the links.
1771
+ * @param pipelineLinkDecorations - Specifies the links and their decorations.
1772
+ *
1773
+ * ```javascript
1774
+ * It is a javascript array like this:
1775
+ * [
1776
+ * { pipelineId: <pipelineId>, linkId: <linkId>, decorations: <decoration_spec_array>},
1777
+ * { pipelineId: <pipelineId>, linkId: <linkId>, decorations: <decoration_spec_array>},
1778
+ * { pipelineId: <pipelineId>, linkId: <linkId>, decorations: <decoration_spec_array>}
1779
+ * ]
1780
+ * ```
1781
+ */
1782
+ setLinksMultiDecorations(
1783
+ pipelineLinkDecorations: {
1784
+ pipelineId: string;
1785
+ linkId: string;
1786
+ decorations: Decoration[];
1787
+ }[]
1788
+ ): void;
1789
+
1790
+ /**
1791
+ * Gets an array of decorations for a link
1792
+ * @param linkId - The ID of the link
1793
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1794
+ * Defaults to the currently displayed pipeline.
1795
+ * @returns An array of decorations
1796
+ */
1797
+ getLinkDecorations(
1798
+ linkId: string,
1799
+ pipelineId?: string
1800
+ ): Decoration[];
1801
+
1802
+ /**
1803
+ * Sets the decoration label, for the decoration in the link identified, to edit
1804
+ * mode provided the link label is editable. This allows the user to edit the
1805
+ * label text.
1806
+ * @param decId - The ID of the label decoration on the link.
1807
+ * @param linkId - The ID of the link
1808
+ * @param pipelineId - Optional. The ID of the pipeline of the link.
1809
+ * Defaults to the currently displayed pipeline.
1810
+ */
1811
+ setLinkDecorationLabelEditingMode(
1812
+ decId: string,
1813
+ linkId: string,
1814
+ pipelineId?: string
1815
+ ): void;
1816
+
1817
+ /**
1818
+ * Breadcrumbs methods
1819
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#breadcrumbs-methods
1820
+ */
1821
+
1822
+ /**
1823
+ * Returns the current array of breadcrumbs. There will one breadcrumb object
1824
+ * for each level of supernode that the user has navigated into. This array
1825
+ * can be used to display breadcrumbs to the user to show where they are
1826
+ * within the navigation hierarchy within Common Canvas.
1827
+ * @returns An array of breadcrumb objects
1828
+ */
1829
+ getBreadcrumbs(): { pipelineId?: string; pipelineFlowId?: string }[];
1830
+
1831
+ /**
1832
+ * Returns the breadcrumb for teh currently displayed pipeline.
1833
+ * @returns The last breadcrumb which represents the level with supernode
1834
+ * hierarchy that the user has currently navigated to.
1835
+ */
1836
+ getCurrentBreadcrumb(): { pipelineId?: string; pipelineFlowId?: string };
1837
+
1838
+ /**
1839
+ * ## Branch highlight methods
1840
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#branch-highlight-methods
1841
+ */
1842
+
1843
+ /**
1844
+ * Highlights the branch(s) (both upstream and downstream) from the node
1845
+ * IDs passed in and returns the highlighted object Ids.
1846
+ * @param nodeIds - An array of node Ids
1847
+ * @param pipelineId - The ID of the pipeline of the nodes.
1848
+ */
1849
+ highlightBranch(
1850
+ nodeIds: string[],
1851
+ pipelineId: string
1852
+ ): string[];
1853
+
1854
+ /**
1855
+ * Highlights the upstream nodes from the node IDs passed in
1856
+ * and returns the highlighted object Ids.
1857
+ * @param nodeIds - An array of node Ids
1858
+ * @param pipelineId - The ID of the pipeline of the nodes.
1859
+ */
1860
+ highlightUpstream(
1861
+ nodeIds: string[],
1862
+ pipelineId: string
1863
+ ): string[];
1864
+
1865
+ /**
1866
+ * Highlights the downstream nodes from the node IDs passed in
1867
+ * and returns highlighted object Ids.
1868
+ * @param nodeIds - An array of node Ids
1869
+ * @param pipelineId - The ID of the pipeline
1870
+ */
1871
+ highlightDownstream(
1872
+ nodeIds: string[],
1873
+ pipelineId: string
1874
+ ): string[];
1875
+
1876
+ /**
1877
+ * ## Logging methods
1878
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#logging-methods
1879
+ */
1880
+
1881
+ /**
1882
+ * @returns a Boolean to indicate whether canvas logging is switched on or off.
1883
+ */
1884
+ getLoggingState(): boolean;
1885
+
1886
+ /**
1887
+ * Sets canvas logging based on the Boolean passed in.
1888
+ * @param state - true to switch on Common Canvas logging to the console.
1889
+ */
1890
+ setLoggingState(state: boolean): void;
1891
+
1892
+ /**
1893
+ * Palette methods
1894
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#palette-methods_1
1895
+ */
1896
+
1897
+ /**
1898
+ * Opens the palette
1899
+ */
1900
+ openPalette(): void;
1901
+
1902
+ /**
1903
+ * Closes the palette
1904
+ */
1905
+ closePalette(): void;
1906
+
1907
+ /**
1908
+ * @returns a Boolean to indicate whether the palette is open or not. If the
1909
+ * narrow palette feature is being used (enableNarrowPalette in config), true
1910
+ * indicates that the wide palette is being displayed.
1911
+ */
1912
+ isPaletteOpen(): boolean;
1913
+
1914
+ /**
1915
+ * ## Context menu methods
1916
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#context-menu-methods
1917
+ */
1918
+
1919
+ /**
1920
+ * Opens the context menu or the context toolbar if config property
1921
+ * enableContextToolbar is set to true.
1922
+ * @param menuDef - the definition of the context menu or context toolbar
1923
+ * @param source - additional information about the menu
1924
+ */
1925
+ openContextMenu(
1926
+ menuDef: ContextMenuEntry[],
1927
+ source?: {
1928
+ cmPos?: {
1929
+ x: number;
1930
+ y: number;
1931
+ }
1932
+ }
1933
+ ): void;
1934
+
1935
+ /**
1936
+ * Closes the context menu
1937
+ */
1938
+ closeContextMenu(): void;
1939
+
1940
+ /**
1941
+ * ## Notification panel methods
1942
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#notification-panel-methods
1943
+ */
1944
+
1945
+ /**
1946
+ * Opens the notification panel
1947
+ */
1948
+ openNotificationPanel(): void;
1949
+
1950
+ /**
1951
+ * Closes the notification panel
1952
+ */
1953
+ closeNotificationPanel(): void;
1954
+
1955
+ /**
1956
+ * Either opens or closes the notifictaion panel based on its current status
1957
+ */
1958
+ toggleNotificationPanel(): void;
1959
+
1960
+ /**
1961
+ * Right flyout methods
1962
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#right-flyout-methods
1963
+ */
1964
+
1965
+ /**
1966
+ * @returns a boolean to indicate if the right flyout is open or not
1967
+ */
1968
+ isRightFlyoutOpen(): boolean;
1969
+
1970
+ /**
1971
+ * Top panel methods
1972
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#top-panel-methods
1973
+ */
1974
+
1975
+ /**
1976
+ * @returns a boolean to indicate if the top panel is open or not
1977
+ */
1978
+ isTopPanelOpen(): boolean;
1979
+
1980
+ /**
1981
+ * ## Bottom panel methods
1982
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#bottom-panel-methods
1983
+ */
1984
+
1985
+ /**
1986
+ * @returns a boolean to indicate if the bottom panel is open or not
1987
+ */
1988
+ isBottomPanelOpen(): boolean;
1989
+
1990
+ /**
1991
+ * Sets the height of the bottom panel in pixels. This can be called
1992
+ * immediately after the CanvasController has been created, if the bottom
1993
+ * panel should be displayed at a specific height when it first opens.
1994
+ * @param height - height in pixels
1995
+ */
1996
+ setBottomPanelHeight(
1997
+ height: number
1998
+ ): void;
1999
+
2000
+ /**
2001
+ * ## Canvas/pipeline navigation methods
2002
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#canvaspipeline-navigation-methods
2003
+ */
2004
+
2005
+ /**
2006
+ * Displays a pipeline (identified by the pipelineId passed in). This must be
2007
+ * one of the pipelines referenced by the current set of breadcrumbs. It
2008
+ * cannot be used to open a new pipeline outside the current set of breadcruumbs.
2009
+ * @param pipelineId - The ID of the pipeline to display
2010
+ */
2011
+ displaySubPipeline(
2012
+ pipelineId: string
2013
+ ): void;
2014
+
2015
+ /**
2016
+ * Displays a pipeline for the supernode (identified by the supernodeId
2017
+ * parameter) in the pipeline (identified by the pipelineId parameter). For
2018
+ * correct breadcrumb generation this pipeline should be the one in the last
2019
+ * of the current set of breadcrumbs. That is, the pipeline currently shown
2020
+ * "full page" in the canvas.
2021
+ * @param supernodeId - The ID of the supernode to display
2022
+ * @param pipelineId - The ID of the pipeline to display
2023
+ */
2024
+ displaySubPipelineForSupernode(
2025
+ supernodeId: string,
2026
+ pipelineId: string
2027
+ ): void;
2028
+
2029
+ /**
2030
+ * Displays full-page the previous pipeline from the one currently being displayed.
2031
+ */
2032
+ displayPreviousPipeline(): void;
2033
+
2034
+ /**
2035
+ * Command Stack interaction methods
2036
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#command-stack-interaction-methods
2037
+ */
2038
+
2039
+ /**
2040
+ * Adds the command object to the command stack which will cause the
2041
+ * do() method of the command to be called.
2042
+ */
2043
+ do(
2044
+ command: {
2045
+ do(): void;
2046
+ undo(): void;
2047
+ redo(): void;
2048
+ getLabel(): string;
2049
+ getFocusObject(): "CanvasFocus" | object;
2050
+ }
2051
+ ): void;
2052
+
2053
+ /**
2054
+ * Calls the undo() method of the next available command on the command
2055
+ * stack that can be undone, if one is available.
2056
+ */
2057
+ undo(): void;
2058
+
2059
+ /**
2060
+ * Undoes a number of commands on the command stack as indicated by the
2061
+ * 'count' parameter. If 'count' is bigger than the number of undoable commands
2062
+ * on the stack, all undoable commands currently on the command stack
2063
+ * will be undone. Uses the editActionHandler method which will cause
2064
+ * the app's editActionHandler to be called.
2065
+ */
2066
+ undoMulti(count: number): void;
2067
+
2068
+ /**
2069
+ * Calls the redo() method of the next available command on the command
2070
+ * stack that can be redone, if one is available.
2071
+ */
2072
+ redo(): void;
2073
+
2074
+ /**
2075
+ * Redoes a number of commands on the command stack as indicated by the
2076
+ * 'count' parameter. If 'count' is bigger than the number of redoable commands
2077
+ * on the stack, all redoable commands currently on the command stack
2078
+ * will be redone. Uses the editActionHandler method which will cause
2079
+ * the app's editActionHandler to be called.
2080
+ * @param count - The number of commands to redo
2081
+ */
2082
+ redoMulti(count: number): void;
2083
+
2084
+ /**
2085
+ * Returns true if there is a command on the command stack
2086
+ * available to be undone.
2087
+ * @returns A boolean that indicates if there is a command to undo.
2088
+ */
2089
+ canUndo(): boolean;
2090
+
2091
+ /**
2092
+ * Returns true if there is a command on the command stack
2093
+ * available to be redone.
2094
+ * @returns A boolean that ndicates if there is a command to redo.
2095
+ */
2096
+ canRedo(): boolean;
2097
+
2098
+ /**
2099
+ * Returns a string which is the label that descibes the next undoable
2100
+ * command.
2101
+ * @returns A label that descibes the next undoable command.
2102
+ */
2103
+ getUndoLabel(): string;
2104
+
2105
+ /**
2106
+ * Returns a string which is the label that descibes the next redoable
2107
+ * command.
2108
+ * @returns A label that descibes the next redoable command.
2109
+ */
2110
+ getRedoLabel(): string;
2111
+
2112
+ /**
2113
+ * Returns an array of all undoable commands currently on the command stack.
2114
+ * @returns A array of commands.
2115
+ */
2116
+ getAllUndoCommands(): object[];
2117
+
2118
+ /**
2119
+ * Returns an array of all redoable commands currently on the command stack.
2120
+ * @returns A array of commands.
2121
+ */
2122
+ getAllRedoCommands(): object[];
2123
+
2124
+ /**
2125
+ * Clears the command stack of all currently stored commands.
2126
+ */
2127
+ clearCommandStack(): void;
2128
+
2129
+ /**
2130
+ * ## Zoom methods
2131
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/#zoom-methods
2132
+ */
2133
+
2134
+ /**
2135
+ * Centers the canvas contents and zooms in
2136
+ */
2137
+ zoomIn(): void;
2138
+
2139
+ /**
2140
+ * Centers the canvas contents and zooms out
2141
+ */
2142
+ zoomOut(): void;
2143
+
2144
+ /**
2145
+ * Zooms the canvas contents to fit within the viewport
2146
+ */
2147
+ zoomToFit(): void;
2148
+
2149
+ /**
2150
+ * Changes the zoom amounts for the canvas. This method does not alter the
2151
+ * pipelineFlow document. zoomObject is an object with three fields:
2152
+ * @param zoomObject - A zoom object
2153
+ */
2154
+ zoomTo(
2155
+ zoomObject: ZoomObjectDef
2156
+ ): void;
2157
+
2158
+ /**
2159
+ * Increments the translation of the canvas by the x and y increment
2160
+ * amounts. The optional animateTime parameter can be provided to animate the
2161
+ * movement of the canvas. It is a time for the animation in milliseconds.
2162
+ * If omitted the movement happens immediately.
2163
+ * @param x - X coordinate amount.
2164
+ * @param y - Y coordinate amount.
2165
+ * @param animateTime - Amount if miniseconds for the trasition.
2166
+ */
2167
+ translateBy(
2168
+ x: number,
2169
+ y: number,
2170
+ animateTime: number
2171
+ ): void;
2172
+
2173
+ /**
2174
+ * @returns the current zoom object for the currently displayed canvas or null
2175
+ * if the canvas is not yet rendered for the first time.
2176
+ */
2177
+ getZoom(): ZoomObjectDef | null;
2178
+
2179
+ /**
2180
+ * Returns a zoom object required to pan the objects (nodes and/or comments)
2181
+ * identified by the objectIds array to 'reveal' the objects in the viewport.
2182
+ * The zoom object returned can be provided to the CanvasController.zoomTo()
2183
+ * method to perform the zoom/pan action.
2184
+ * If the xPos and yPos variables are provided it will return a zoom object
2185
+ * to pan the objects to a location specified by a percentage offset of the
2186
+ * viewport width and height respectively.
2187
+ * If the xPos and yPos parameters are undefined (omitted) and all the
2188
+ * objects are fully within the canvas viewport, it will return null.
2189
+ * This can be used to detect whether the objects are fully visible or not.
2190
+ * Otherwise it will return a zoom object which can be used to pan the
2191
+ * objects into the viewport so they appear at the nearest side of the
2192
+ * viewport to where they are currently positioned.
2193
+ *
2194
+ * @param objectIds - An array of nodes and/or comment IDs.
2195
+ * @param xPos - Optional. Can be set to percentage offset of the viewport width.
2196
+ * @param yPos - Optional. Can be set to percentage offset of the viewport height.
2197
+ * @returns a ZoomObject or null
2198
+ */
2199
+ getZoomToReveal(
2200
+ objectIds: string[],
2201
+ xPos?: number,
2202
+ yPos?: number
2203
+ ): ZoomObjectDef | null;
2204
+
2205
+ /**
2206
+ * Clears any saved zoom values stored in local storage. This means
2207
+ * newly opened flows will appear with the default zoom. This method
2208
+ * is only applicable when the `enableSaveZoom` config parameter is
2209
+ * set to "LocalStorage".
2210
+ */
2211
+ clearSavedZoomValues(): void;
2212
+ }
2213
+
2214
+ /*
2215
+ * Port object used to define display properties of an input or output port
2216
+ * For example, either:
2217
+ * { type: "circle" } // Can also be "circleWithArrow"
2218
+ * or
2219
+ * { type: "image", src: "path/picture.svg", width: 10, height: 10 }
2220
+ * or
2221
+ * { type: "jsx", src: (<FaceCool />), width: 16, height: 16 }
2222
+ */
2223
+ export type PortDisplay =
2224
+ | {
2225
+ type: "circle" | "circleWithArrow";
2226
+ }
2227
+ | { type: "image"; src: string; width: number; height: number }
2228
+ | {
2229
+ type: "jsx";
2230
+ src: ReactNode;
2231
+ width: number;
2232
+ height: number;
2233
+ };
2234
+
2235
+ /**
2236
+ * https://elyra-ai.github.io/canvas/03.06.01-node-customization/#default-values-for-node-layout-properties
2237
+ */
2238
+ export interface NodeLayout {
2239
+ /**
2240
+ * Default node sizes. The height might be overridden for nodes with more ports
2241
+ * than will fit in the default size.
2242
+ */
2243
+ defaultNodeWidth: number;
2244
+ defaultNodeHeight: number;
2245
+
2246
+ /**
2247
+ * A space separated list of classes that will be added to the group <g>
2248
+ * DOM element for the node.
2249
+ */
2250
+ className: string;
2251
+
2252
+ /**
2253
+ * Displays the node outline shape underneath the image and label.
2254
+ */
2255
+ nodeShapeDisplay: boolean;
2256
+
2257
+ /**
2258
+ * Displays the external object specified, as the body of the node
2259
+ */
2260
+ nodeExternalObject: FunctionComponent<any> | ComponentClass<any>;
2261
+
2262
+ /**
2263
+ * Default node shape. Can be "rectangle" or "port-arcs"
2264
+ */
2265
+ nodeShape: "port-arcs" | "rectangle";
2266
+
2267
+ /**
2268
+ * SVG path strings to define the body shape of your node and its
2269
+ * selection highlighting. If set to null the paths will be set by
2270
+ * default based on the nodeShape setting. If a function is provided,
2271
+ * it is called with the node as a parameter and must return the SVG
2272
+ * path string for that node. This can be used for drawing a new path
2273
+ * string when the node is resized.
2274
+ */
2275
+ bodyPath: null | string | ((node: CanvasNode) => string);
2276
+ selectionPath: null | string | ((node: CanvasNode) => string);
2277
+
2278
+ /**
2279
+ * Display image
2280
+ */
2281
+ imageDisplay: boolean;
2282
+ imageWidth: number;
2283
+ imageHeight: number;
2284
+
2285
+ /**
2286
+ * Image position
2287
+ */
2288
+ imagePosition: "topLeft";
2289
+ imagePosX: number;
2290
+ imagePosY: number;
2291
+
2292
+ /** Display label */
2293
+ labelDisplay: boolean;
2294
+
2295
+ /**
2296
+ * Label dimensions
2297
+ */
2298
+ labelWidth: number;
2299
+ labelHeight: number;
2300
+
2301
+ /**
2302
+ * Label position
2303
+ */
2304
+ labelPosition: "topLeft";
2305
+ labelPosX: number;
2306
+ labelPosY: number;
2307
+
2308
+ /**
2309
+ * Label appearance propeties
2310
+ */
2311
+ labelEditable: false;
2312
+ labelAlign: "left" | "center";
2313
+ labelSingleLine: boolean; /* false allow multi-line labels */
2314
+ labelOutline: boolean;
2315
+ labelMaxCharacters: boolean; /* null allows unlimited characters */
2316
+ labelAllowReturnKey: boolean; /* true allows line feed to be inserted into label */
2317
+
2318
+ /**
2319
+ * An array of decorations to be applied to the node. For details see:
2320
+ * https://elyra-ai.github.io/canvas/03.04.01-decorations/
2321
+ * These are added to the node at run time and will not be saved into
2322
+ * the pipeline flow.
2323
+ */
2324
+ decorations: NodeDecorationDef[];
2325
+
2326
+ /**
2327
+ * Positions and dimensions for 9 enumerated default decorator positions.
2328
+ * decoratorWidth and decoratorHeight are the dimensions of the outline
2329
+ * rectangle and decoratorPadding is the padding for the image within the
2330
+ * outline rectangle.
2331
+ * @deprecated Specify position info in the decoration itself.
2332
+ */
2333
+ decoratorTopY: number;
2334
+ decoratorMiddleY: number;
2335
+ decoratorBottomY: number;
2336
+ decoratorLeftX: number;
2337
+ decoratorCenterX: number;
2338
+ decoratorRightX: number;
2339
+
2340
+ /**
2341
+ * Default width, height and padding for image decorators
2342
+ */
2343
+ decoratorWidth: number;
2344
+ decoratorHeight: number;
2345
+ decoratorPadding: number;
2346
+
2347
+ /**
2348
+ * Default width and height for label decorators
2349
+ */
2350
+ decoratorLabelWidth: 80;
2351
+ decoratorLabelHeight: 15;
2352
+
2353
+ /**
2354
+ * Display drop shadow under and round the nodes
2355
+ */
2356
+ dropShadow: boolean;
2357
+
2358
+ /**
2359
+ * The gap between a node and its selection highlight rectangle
2360
+ */
2361
+ nodeHighlightGap: number;
2362
+
2363
+ /**
2364
+ * The size of the node sizing area that extends around the node, over
2365
+ * which the mouse pointer will change to the sizing arrows.
2366
+ */
2367
+ nodeSizingArea: number;
2368
+
2369
+ /**
2370
+ * Error indicator dimensions
2371
+ */
2372
+ errorPosition: "topLeft";
2373
+ errorXPos: number;
2374
+ errorYPos: number;
2375
+ errorWidth: number;
2376
+ errorHeight: number;
2377
+
2378
+ /**
2379
+ * When sizing a supernode this decides the size of the corner area for
2380
+ * diagonal sizing.
2381
+ */
2382
+ nodeCornerResizeArea: number;
2383
+
2384
+ /**
2385
+ * What point to draw the data links from and to when enableLinkType is set
2386
+ * to "Straight". Possible values are "image_center" or "node_center".
2387
+ */
2388
+ drawNodeLinkLineFromTo: "node_center" | "image_center";
2389
+
2390
+ /**
2391
+ * What point to draw the comment to node link line to. Possible values
2392
+ * are "image_center" or "node_center".
2393
+ */
2394
+ drawCommentLinkLineTo: "node_center" | "image_center";
2395
+
2396
+ /**
2397
+ * This is the size of the horizontal line protruding from the
2398
+ * port on the source node when drawing an elbow or straight connection line.
2399
+ */
2400
+ minInitialLine: number;
2401
+
2402
+ /**
2403
+ * For the elbow connection type with nodes with multiple output ports,
2404
+ * this is used to increment the minInitialLine so that connection lines
2405
+ * do not overlap each other when they turn up or down after the elbow.
2406
+ */
2407
+ minInitialLineIncrement: number;
2408
+
2409
+ /**
2410
+ * This is the minimum size of the horizontal line entering the
2411
+ * target port on the target node when drawing an Elbow connection line.
2412
+ */
2413
+ minFinalLine: number;
2414
+
2415
+ /**
2416
+ * Display input ports.
2417
+ */
2418
+ inputPortDisplay: boolean;
2419
+
2420
+ /*
2421
+ * An array of elements to control display of input ports.
2422
+ * The order of the elements corresponds to the order of ports in the
2423
+ * inputs array for the node. If there are more input ports than elements
2424
+ * in the array, the last element will be used for all remaining ports.
2425
+ */
2426
+ inputPortDisplayObjects: PortDisplay[];
2427
+
2428
+ /**
2429
+ * Indicates whether multiple input ports should be automatically
2430
+ * positioned (true) or positioned based on the contents of
2431
+ * inputPortPositions array (false).
2432
+ */
2433
+ inputPortAutoPosition: boolean;
2434
+
2435
+ /**
2436
+ * An array of input port positions. Each element is structured like
2437
+ * this: { x_pos: 5, y_pos: 10, pos: "topLeft" }. x_pos and y_pos are
2438
+ * offsets from the pos point on the node.
2439
+ * The order of the elements corresponds to the order of ports in the
2440
+ * inputs array for the node. If there are more input ports than elements
2441
+ * in the array, the last element will be used for all remaining ports.
2442
+ */
2443
+ inputPortPositions: { x_pos: number; y_pos: number; pos: NodePosition }[];
2444
+
2445
+ /**
2446
+ * An array of elements to control display of input port guide objects.
2447
+ * That is the object drawn at the end of a new link as it is being dragged.
2448
+ * The order of the elements corresponds to the order of ports in the
2449
+ * inputs array for the node. If there are more input ports than elements
2450
+ * in the array, the last element will be used for all remaining ports.
2451
+ */
2452
+ inputPortGuideObjects: PortDisplay[];
2453
+
2454
+ /**
2455
+ * Display output ports.
2456
+ */
2457
+ outputPortDisplay: boolean;
2458
+
2459
+ /**
2460
+ * An array of elements to control display of output ports.
2461
+ * The order of the elements corresponds to the order of ports in the
2462
+ * outputs array for the node. If there are more output ports than elements
2463
+ * in the array, the last element will be used for all remaining ports.
2464
+ */
2465
+ outputPortDisplayObjects: PortDisplay[];
2466
+
2467
+ /**
2468
+ * Indicates whether multiple output ports should be automatically
2469
+ * positioned (true) or positioned based on the contents of
2470
+ * outputPortPositions array (false).
2471
+ */
2472
+ outputPortAutoPosition: boolean;
2473
+
2474
+ /**
2475
+ * An array of output port positions. Each element is structured like
2476
+ * this: { x_pos: 5, y_pos: 10, pos: "topRight" }. x_pos and y_pos are
2477
+ * offsets from the pos point on the node.
2478
+ * The order of the elements corresponds to the order of ports in the
2479
+ * outputs array for the node. If there are more output ports than elements
2480
+ * in the array, the last element will be used for all remaining ports.
2481
+ */
2482
+ outputPortPositions: { x_pos: number; y_pos: number; pos: NodePosition }[];
2483
+
2484
+ /**
2485
+ * An array of elements to control display of output port guide objects.
2486
+ * That is the object drawn at the end of a new link as it is being dragged.
2487
+ * The order of the elements corresponds to the order of ports in the
2488
+ * outputs array for the node. If there are more output ports than elements
2489
+ * in the array, the last element will be used for all remaining ports.
2490
+ */
2491
+ outputPortGuideObjects: PortDisplay[];
2492
+
2493
+ /**
2494
+ * Automatically increases the node size to accommodate its ports so both
2495
+ * input and output ports can be shown within the dimensions of
2496
+ * the node.
2497
+ */
2498
+ autoSizeNode: boolean;
2499
+
2500
+ /**
2501
+ * Radius of either the input or output ports when they are set to "circle"
2502
+ */
2503
+ portRadius: number;
2504
+
2505
+ /**
2506
+ * Size of an offset above and below the set of port arcs.
2507
+ */
2508
+ portArcOffset: number;
2509
+
2510
+ /**
2511
+ * Radius of an imaginary circle around the port. This controls the
2512
+ * spacing of ports and the size of port arcs when nodeShape is set to
2513
+ * port-arcs.
2514
+ */
2515
+ portArcRadius: number;
2516
+
2517
+ /**
2518
+ * Spacing between the port arcs around the ports.
2519
+ */
2520
+ portArcSpacing: number;
2521
+
2522
+ /**
2523
+ * Position of the context toolbar relative to the node. Some adjustment
2524
+ * will be made to account for the width of the toolbar.
2525
+ */
2526
+ contextToolbarPosition: NodePosition;
2527
+
2528
+ /**
2529
+ * Display of vertical ellipsis to show context menu
2530
+ */
2531
+ ellipsisDisplay: boolean;
2532
+ ellipsisPosition: "topLeft";
2533
+ ellipsisWidth: number;
2534
+ ellipsisHeight: number;
2535
+ ellipsisPosX: number;
2536
+ ellipsisPosY: number;
2537
+ ellipsisHoverAreaPadding: number;
2538
+ }
2539
+
2540
+ /**
2541
+ * https://elyra-ai.github.io/canvas/03.02.01-canvas-config/
2542
+ */
2543
+ export interface CanvasConfig {
2544
+ enableInteractionType?: "Mouse" | "Carbon" | "Trackpad";
2545
+ enableNodeFormatType?: "Horizontal" | "Vertical";
2546
+ enableLinkType?: "Curve" | "Elbow" | "Straight" | "Parallax";
2547
+ enableLinkDirection?: "LeftRight" | "RightLeft" |"TopBottom" | "BottomTop";
2548
+ enableLinkSelection?: "None" | "LinkOnly" | "Handles" | "Detachable";
2549
+ enableLinkReplaceOnNewConnection?: boolean;
2550
+ enableInternalObjectModel?: boolean;
2551
+ enablePaletteLayout?: "Dialog" | "Flyout" | "None";
2552
+ enableToolbarLayout?: "Top" | "None";
2553
+ enableResizableNodes?: boolean;
2554
+ enableInsertNodeDroppedOnLink?: boolean;
2555
+ enableRightFlyoutUnderToolbar?: boolean;
2556
+ enablePositionNodeOnRightFlyoutOpen?: boolean;
2557
+ enableHighlightUnavailableNodes?: boolean;
2558
+ enableHighlightNodeOnNewLinkDrag?: boolean;
2559
+ enableAutoLinkOnlyFromSelNodes?: boolean;
2560
+ enableSingleClickAddFromPalette?: boolean;
2561
+ enableExternalPipelineFlows?: boolean;
2562
+ enableMoveNodesOnSupernodeResize?: boolean;
2563
+ enableDisplayFullLabelOnHover?: boolean;
2564
+ enableSingleOutputPortDisplay?: boolean;
2565
+ enableDragWithoutSelect?: boolean;
2566
+ enableDragToMoveSizeNodesComments?: boolean;
2567
+ enableEditingActions?: boolean;
2568
+ enableStateTag?: "None" | "ReadOnly" | "Locked";
2569
+ enableDropZoneOnExternalDrag?: boolean;
2570
+ enableNodeLayout?: Partial<NodeLayout>;
2571
+ enableSaveZoom?: "LocalStorage" | "None" | "PipelineFlow";
2572
+ enablePanIntoViewOnOpen?: boolean;
2573
+ enableZoomIntoSubFlows?: boolean;
2574
+ enableSnapToGridType?: "During" | "None" | "After";
2575
+ enableSnapToGridX?: string;
2576
+ enableSnapToGridY?: string;
2577
+ enableAutoLayoutVerticalSpacing?: string;
2578
+ enableAutoLayoutHorizontalSpacing?: string;
2579
+ enableAssocLinkCreation?: boolean;
2580
+ enableAssocLinkType?: "Straight" | "RightSideCurve";
2581
+ enableBrowserEditMenu?: boolean;
2582
+ enableNarrowPalette?: boolean;
2583
+ enableContextToolbar?: boolean;
2584
+ enableRightFlyoutDragToResize?: boolean;
2585
+ enableFocusOnMount?: boolean;
2586
+ emptyCanvasContent?: ReactNode;
2587
+ dropZoneCanvasContent?: ReactNode;
2588
+ schemaValidation?: boolean;
2589
+ tipConfig?: {
2590
+ palette?: boolean;
2591
+ nodes?: boolean;
2592
+ ports?: boolean;
2593
+ links?: boolean;
2594
+ decorations?: boolean;
2595
+ stateTag?: boolean;
2596
+ };
2597
+ enableSelfRefLinks?: boolean;
2598
+ enableRaiseNodesToTopOnHover?: boolean;
2599
+ enableLinkMethod?: "Ports" | "Freeform";
2600
+ /**
2601
+ * @deprecated
2602
+ */
2603
+ enableStraightLinksAsFreeform?: boolean;
2604
+ enableLinksOverNodes?: boolean;
2605
+ enableMarkdownInComments?: boolean;
2606
+ enablePaletteHeader?: ReactNode;
2607
+ /**
2608
+ * @deprecated
2609
+ */
2610
+ paletteInitialState?: boolean;
2611
+ enableKeyboardNavigation?: boolean;
2612
+ enableParentClass?: string;
2613
+ enableImageDisplay?: "SVGInline" | "LoadSVGToDefs" | "SVGAsImage";
2614
+ enableLeftFlyoutUnderToolbar?: boolean;
2615
+ }
2616
+
2617
+ /**
2618
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/#toolbar-action-object-definition
2619
+ */
2620
+ export interface ToolbarActionItem {
2621
+ action?: string;
2622
+ label?: string | ReactNode;
2623
+ enable?: boolean;
2624
+ iconEnabled?: string | ReactNode;
2625
+ iconDisabled?: string | ReactNode;
2626
+ incLabelWithIcon?: "no" | "before" | "after";
2627
+ kind?: "default" | "primary" | "danger" | "secondary" | "tertiary" | "ghost";
2628
+ tooltip?: string | ReactNode;
2629
+ isSelected?: boolean;
2630
+ className?: string;
2631
+ textContent?: string;
2632
+ }
2633
+
2634
+ /**
2635
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/#sub-area-properties
2636
+ */
2637
+ export interface ToolbarSubMenuItem extends ToolbarActionItem {
2638
+ subMenu: ToolbarActionItem[];
2639
+ closeSubAreaOnClick?: boolean;
2640
+ }
2641
+
2642
+ /**
2643
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/#sub-area-properties
2644
+ */
2645
+ export interface ToolbarSubPanelItem extends ToolbarActionItem {
2646
+ subPanel: React.FC | React.ComponentClass;
2647
+ subPanelData?: unknown;
2648
+ purpose?: "single" | "dual";
2649
+ closeSubAreaOnClick?: boolean;
2650
+ }
2651
+
2652
+ /**
2653
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/#toolbar-divider-object-definition
2654
+ */
2655
+ export interface ToolbarDivider {
2656
+ divider: true;
2657
+ }
2658
+
2659
+ export interface ToolbarJsxItem {
2660
+ action: string;
2661
+ jsx: (tabIndex: number) => ReactNode;
2662
+ tooltip?: string | ReactNode;
2663
+ }
2664
+
2665
+ /**
2666
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/
2667
+ */
2668
+ export interface ToolbarConfig {
2669
+ leftBar?: (
2670
+ | ToolbarActionItem
2671
+ | ToolbarSubPanelItem
2672
+ | ToolbarSubMenuItem
2673
+ | ToolbarDivider
2674
+ | ToolbarJsxItem
2675
+ )[];
2676
+ rightBar?: (
2677
+ | ToolbarActionItem
2678
+ | ToolbarSubPanelItem
2679
+ | ToolbarSubMenuItem
2680
+ | ToolbarDivider
2681
+ | ToolbarJsxItem
2682
+ )[];
2683
+ overrideAutoEnableDisable?: boolean;
2684
+ }
2685
+
2686
+ /**
2687
+ * @deprecated
2688
+ */
2689
+ export type DeprecatedToolbarConfig = (
2690
+ | ToolbarActionItem
2691
+ | ToolbarSubPanelItem
2692
+ | ToolbarSubMenuItem
2693
+ | ToolbarDivider
2694
+ | ToolbarJsxItem
2695
+ )[];
2696
+
2697
+ /**
2698
+ * https://elyra-ai.github.io/canvas/03.02.03-notification-config/
2699
+ */
2700
+ export interface NotificationConfig {
2701
+ action: string;
2702
+ label: string;
2703
+ enable?: boolean;
2704
+ notificationHeader?: string;
2705
+ notificationSubtitle?: string;
2706
+ emptyMessage: string;
2707
+ clearAllMessage?: string;
2708
+ keepOpen?: boolean;
2709
+ clearAllCallback?: () => void;
2710
+ secondaryButtonLabel?: string;
2711
+ secondaryButtonCallback?: () => void;
2712
+ secondaryButtonDisabled?: boolean;
2713
+ }
2714
+
2715
+ export interface CtxMenuConfig {
2716
+ enableCreateSupernodeNonContiguous?: boolean;
2717
+ defaultMenuEntries?: {
2718
+ saveToPalette?: boolean;
2719
+ createSupernode?: boolean;
2720
+ displaySupernodeFullPage?: boolean;
2721
+ colorBackground?: boolean;
2722
+ };
2723
+ }
2724
+
2725
+ export interface KeyboardConfig {
2726
+ actions: {
2727
+ delete?: boolean;
2728
+ undo?: boolean;
2729
+ redo?: boolean;
2730
+ selectAll?: boolean;
2731
+ cutToClipboard?: boolean;
2732
+ copyToClipboard?: boolean;
2733
+ pasteFromClipboard?: boolean;
2734
+ };
2735
+ }
2736
+
2737
+ export type CtxMenuHandlerSource =
2738
+ | {
2739
+ type: "node";
2740
+ targetObject: CanvasNode;
2741
+ selectedObjectIds: string[];
2742
+ mousePos: { x: string; y: string };
2743
+ }
2744
+ | {
2745
+ type: "input_port" | "output_port" | "link" | "comment";
2746
+ targetObject: Record<string, unknown>;
2747
+ selectedObjectIds: string[];
2748
+ mousePos: { x: string; y: string };
2749
+ }
2750
+ | {
2751
+ type: "canvas";
2752
+ selectedObjectIds: string[];
2753
+ mousePos: { x: string; y: string };
2754
+ };
2755
+
2756
+ export interface EditActionData {
2757
+ editType:
2758
+ | "createComment"
2759
+ | "createNode"
2760
+ | "moveObjects"
2761
+ | "linkNodes"
2762
+ | "linkComment"
2763
+ | "resizeObjects"
2764
+ | "editComment"
2765
+ | "expandSuperNodeInPlace"
2766
+ | "displaySubPipeline"
2767
+ | "displayPreviousPipeline"
2768
+ | string;
2769
+ editSource: "contextmenu" | "toolbar" | "keyboard" | "canvas" | "api" | "controller";
2770
+ selectedObjects: Record<string, unknown>[];
2771
+ /** @deprecated */
2772
+ selectedObjectIds: string[];
2773
+ [key: string]: unknown;
2774
+ }
2775
+
2776
+ export type EditActionCommand = unknown;
2777
+
2778
+ export type ClickActionSource =
2779
+ | {
2780
+ clickType: "DOUBLE_CLICK" | "SINGLE_CLICK" | "SINGLE_CLICK_CONTEXTMENU";
2781
+ objectType: "node" | "comment" | "canvas" | "region";
2782
+ id?: string;
2783
+ selectedObjectIds: string[];
2784
+ }
2785
+ | {
2786
+ clickType: "DOUBLE_CLICK" | "SINGLE_CLICK" | "SINGLE_CLICK_CONTEXTMENU";
2787
+ objectType: "port";
2788
+ id: string;
2789
+ selectedObjectIds: string[];
2790
+ nodeId: string;
2791
+ };
2792
+
2793
+ export type GeneratorAction =
2794
+ | "create_node"
2795
+ | "create_comment"
2796
+ | "create_node_link"
2797
+ | "create_comment_link"
2798
+ | "clone_node"
2799
+ | "clone_comment"
2800
+ | "clone_node_link"
2801
+ | "clone_comment_link";
2802
+
2803
+ export interface GeneratorActionCreateNode {
2804
+ label: string;
2805
+ description: string;
2806
+ operator_id_ref: string;
2807
+ type: "model_node";
2808
+ image: string;
2809
+ input_ports: {
2810
+ id: "inPort" | "outPort";
2811
+ label: "Input Port";
2812
+ cardinality: {
2813
+ min: number;
2814
+ max: number;
2815
+ };
2816
+ }[];
2817
+ output_ports: [];
2818
+ }
2819
+
2820
+ export type GeneratorData = GeneratorActionCreateNode | null;
2821
+
2822
+ export interface SelectionChangeHandlerData {
2823
+ selection: string[];
2824
+ selectedLinks: CanvasLink[];
2825
+ selectedNodes: NodeTypeDef[];
2826
+ selectedComments: CanvasLink[];
2827
+ addedLinks: CanvasLink[];
2828
+ addedNodes: NodeTypeDef[];
2829
+ addedComments: unknown[];
2830
+ deselectedLinks: CanvasLink[];
2831
+ deselectedNodes: NodeTypeDef[];
2832
+ deselectedComments: unknown[];
2833
+ selectedPipelineId: string;
2834
+ }
2835
+
2836
+ export interface CommonCanvasProps {
2837
+ /**
2838
+ * https://elyra-ai.github.io/canvas/03.04-canvas-controller/
2839
+ */
2840
+ canvasController: CanvasController;
2841
+
2842
+ /**
2843
+ * https://elyra-ai.github.io/canvas/03.02.01-canvas-config/
2844
+ */
2845
+ config?: CanvasConfig;
2846
+
2847
+ /**
2848
+ * https://elyra-ai.github.io/canvas/03.02.02-toolbar-config/
2849
+ */
2850
+ toolbarConfig?: ToolbarConfig | DeprecatedToolbarConfig;
2851
+
2852
+ /**
2853
+ * https://elyra-ai.github.io/canvas/03.02.03-notification-config/
2854
+ */
2855
+ notificationConfig?: NotificationConfig;
2856
+
2857
+ /**
2858
+ * https://elyra-ai.github.io/canvas/03.02.04-context-menu-config/
2859
+ */
2860
+ contextMenuConfig?: CtxMenuConfig;
2861
+
2862
+ /**
2863
+ * https://elyra-ai.github.io/canvas/03.02.05-keyboard-config/
2864
+ */
2865
+ keyboardConfig?: KeyboardConfig;
2866
+
2867
+ /**
2868
+ * https://elyra-ai.github.io/canvas/03.03.01-context-menu-handler/
2869
+ */
2870
+ contextMenuHandler?: (
2871
+ source: CtxMenuHandlerSource,
2872
+ defaultMenu: ContextMenuEntry[]
2873
+ ) => ContextMenuEntry[];
2874
+
2875
+ /**
2876
+ * https://elyra-ai.github.io/canvas/03.03.02-before-edit-action-handler/
2877
+ */
2878
+ beforeEditActionHandler?: (
2879
+ data: EditActionData,
2880
+ command: EditActionCommand
2881
+ ) => EditActionData | void;
2882
+
2883
+ /**
2884
+ * https://elyra-ai.github.io/canvas/03.03.03-edit-action-handler/
2885
+ */
2886
+ editActionHandler?: (
2887
+ data: EditActionData,
2888
+ command: EditActionCommand
2889
+ ) => void;
2890
+
2891
+ /**
2892
+ * https://elyra-ai.github.io/canvas/03.03.09-click-action-handler/
2893
+ */
2894
+ clickActionHandler?: (source: ClickActionSource) => void;
2895
+
2896
+ /**
2897
+ * https://elyra-ai.github.io/canvas/03.03.05-decoration-action-handler/
2898
+ */
2899
+ decorationActionHandler?: (
2900
+ object: Record<string, unknown>,
2901
+ id: string,
2902
+ pipelineId: string
2903
+ ) => void;
2904
+
2905
+ /**
2906
+ * https://elyra-ai.github.io/canvas/03.03.04-layout-handler/
2907
+ */
2908
+ layoutHandler?: (data: CanvasNode) => Record<string, unknown>;
2909
+
2910
+ /*
2911
+ * https://elyra-ai.github.io/canvas/03.03.06-tip-handler/
2912
+ */
2913
+ tipHandler?: (
2914
+ tipType: string,
2915
+ data: Record<string, unknown>
2916
+ ) => string | ReactNode | null;
2917
+
2918
+ /**
2919
+ * https://elyra-ai.github.io/canvas/03.03.07-id-generator-handler/
2920
+ */
2921
+ idGeneratorHandler?: (action: GeneratorAction, data?: GeneratorData) => void;
2922
+
2923
+ /**
2924
+ * https://elyra-ai.github.io/canvas/03.03.08-selection-change-handler/
2925
+ */
2926
+ selectionChangeHandler?: (data: SelectionChangeHandlerData) => void;
2927
+
2928
+ /**
2929
+ * https://elyra-ai.github.io/canvas/03.03.10-action-label-handler/
2930
+ */
2931
+ actionLabelHandler?: (action: GeneratorAction) => string | null | void;
2932
+
2933
+ /**
2934
+ * https://elyra-ai.github.io/canvas/01.09.10-panels/
2935
+ */
2936
+ showRightFlyout?: boolean;
2937
+ rightFlyoutContent?: ReactNode | FunctionComponent;
2938
+ showTopPanel?: boolean;
2939
+ topPanelContent?: ReactNode | FunctionComponent;
2940
+ showBottomPanel?: boolean;
2941
+ bottomPanelContent?: ReactNode | FunctionComponent;
2942
+ }
2943
+
2944
+ export declare class CommonCanvas extends React.Component<CommonCanvasProps> {}