@elyra/canvas 12.30.0 → 12.31.1
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.
- package/dist/{extends-7d4f15b6.js → _baseForOwn-ad2a8649.js} +3 -3
- package/dist/_baseForOwn-ad2a8649.js.map +1 -0
- package/dist/_baseForOwn-bfa77b3e.js +8 -0
- package/dist/_baseForOwn-bfa77b3e.js.map +1 -0
- package/dist/canvas-constants-187a30d5.js +2 -0
- package/dist/canvas-constants-187a30d5.js.map +1 -0
- package/dist/canvas-constants-5fb4e9b8.js +2 -0
- package/dist/canvas-constants-5fb4e9b8.js.map +1 -0
- package/dist/canvas-controller-53bd69c8.js +2 -0
- package/dist/canvas-controller-53bd69c8.js.map +1 -0
- package/dist/canvas-controller-9551a089.js +2 -0
- package/dist/canvas-controller-9551a089.js.map +1 -0
- package/dist/common-canvas-1c40c3df.js +2 -0
- package/dist/common-canvas-1c40c3df.js.map +1 -0
- package/dist/common-canvas-93c3f6a4.js +2 -0
- package/dist/common-canvas-93c3f6a4.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.es.js.map +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/common-canvas.js.map +1 -1
- package/dist/common-properties-02c52656.js +2 -0
- package/dist/common-properties-02c52656.js.map +1 -0
- package/dist/common-properties-df2350d5.js +2 -0
- package/dist/common-properties-df2350d5.js.map +1 -0
- package/dist/context-menu-wrapper-6c8f7928.js +2 -0
- package/dist/context-menu-wrapper-6c8f7928.js.map +1 -0
- package/dist/context-menu-wrapper-fc78153c.js +2 -0
- package/dist/context-menu-wrapper-fc78153c.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-15146f5e.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-6a3754ce.js.map → datarecord-metadata-v3-schema-15146f5e.js.map} +1 -1
- package/dist/datarecord-metadata-v3-schema-9994b9ee.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-ba1f2849.js.map → datarecord-metadata-v3-schema-9994b9ee.js.map} +1 -1
- package/dist/extends-093996c9.js +2 -0
- package/dist/extends-093996c9.js.map +1 -0
- package/dist/extends-1b35a664.js +2 -0
- package/dist/extends-1b35a664.js.map +1 -0
- package/dist/flexible-table-1f259bf6.js +2 -0
- package/dist/flexible-table-1f259bf6.js.map +1 -0
- package/dist/flexible-table-aa7a3125.js +2 -0
- package/dist/flexible-table-aa7a3125.js.map +1 -0
- package/dist/icon-c65ffd4c.js +2 -0
- package/dist/{icon-221bb2e5.js.map → icon-c65ffd4c.js.map} +1 -1
- package/dist/icon-e1c49d95.js +2 -0
- package/dist/{icon-ea917a08.js.map → icon-e1c49d95.js.map} +1 -1
- package/dist/index-27d84a2b.js +2 -0
- package/dist/{index-aee893ad.js.map → index-27d84a2b.js.map} +1 -1
- package/dist/index-6776fe83.js +2 -0
- package/dist/{index-92422c18.js.map → index-6776fe83.js.map} +1 -1
- package/dist/{isArrayLikeObject-f3b27f64.js → isArrayLikeObject-0cd02b77.js} +2 -2
- package/dist/{isArrayLikeObject-f3b27f64.js.map → isArrayLikeObject-0cd02b77.js.map} +1 -1
- package/dist/{isArrayLikeObject-a9c7973b.js → isArrayLikeObject-6a001191.js} +2 -2
- package/dist/{isArrayLikeObject-a9c7973b.js.map → isArrayLikeObject-6a001191.js.map} +1 -1
- package/dist/lib/canvas-controller.es.js +1 -1
- package/dist/lib/canvas-controller.js +1 -1
- package/dist/lib/canvas.es.js +1 -1
- package/dist/lib/canvas.js +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/context-menu.es.js.map +1 -1
- package/dist/lib/context-menu.js +1 -1
- package/dist/lib/context-menu.js.map +1 -1
- package/dist/lib/properties/field-picker.es.js +1 -1
- package/dist/lib/properties/field-picker.js +1 -1
- package/dist/lib/properties/flexible-table.es.js +1 -1
- package/dist/lib/properties/flexible-table.js +1 -1
- package/dist/lib/properties.es.js +1 -1
- package/dist/lib/properties.js +1 -1
- package/dist/styles/common-canvas.min.css +1 -1
- package/dist/styles/common-canvas.min.css.map +1 -1
- package/dist/toolbar-83b4d3d3.js +2 -0
- package/dist/toolbar-83b4d3d3.js.map +1 -0
- package/dist/toolbar-d7febd83.js +2 -0
- package/dist/toolbar-d7febd83.js.map +1 -0
- package/locales/common-canvas/locales/en.json +1 -0
- package/locales/common-canvas/locales/eo.json +1 -0
- package/package.json +3 -3
- package/src/color-picker/color-picker.scss +2 -2
- package/src/common-canvas/canvas-controller-menu-utils.js +328 -0
- package/src/common-canvas/canvas-controller.js +114 -283
- package/src/common-canvas/cc-contents.jsx +9 -1
- package/src/common-canvas/cc-context-menu.jsx +9 -6
- package/src/common-canvas/cc-context-toolbar.jsx +205 -0
- package/src/common-canvas/cc-text-toolbar.jsx +4 -3
- package/src/common-canvas/cc-toolbar.jsx +4 -4
- package/src/common-canvas/common-canvas-utils.js +0 -5
- package/src/common-canvas/common-canvas.scss +34 -4
- package/src/common-canvas/constants/canvas-constants.js +9 -1
- package/src/common-canvas/svg-canvas-d3.js +4 -0
- package/src/common-canvas/svg-canvas-renderer.js +174 -86
- package/src/common-canvas/svg-canvas-utils-textarea.js +1 -1
- package/src/common-properties/common-properties.jsx +3 -1
- package/src/common-properties/components/editor-form/editor-form.jsx +11 -7
- package/src/common-properties/components/editor-form/editor-form.scss +27 -4
- package/src/common-properties/components/flexible-table/flexible-table.jsx +6 -4
- package/src/common-properties/components/title-editor/title-editor.jsx +3 -1
- package/src/common-properties/components/title-editor/title-editor.scss +4 -0
- package/src/common-properties/components/virtualized-table/virtualized-table.jsx +8 -2
- package/src/common-properties/constants/constants.js +5 -0
- package/src/common-properties/panels/subtabs/subtabs.jsx +1 -0
- package/src/common-properties/panels/tearsheet/tearsheet.scss +1 -0
- package/src/common-properties/properties-controller.js +2 -1
- package/src/common-properties/properties-main/properties-main.jsx +4 -1
- package/src/common-properties/ui-conditions/condition-ops/greaterThan.js +1 -1
- package/src/common-properties/ui-conditions/condition-ops/isDateTime.js +1 -1
- package/src/common-properties/ui-conditions/condition-ops/isEmpty.js +1 -1
- package/src/common-properties/ui-conditions/condition-ops/isNotEmpty.js +1 -1
- package/src/common-properties/ui-conditions/condition-ops/lessThan.js +1 -1
- package/src/context-menu/common-context-menu.jsx +20 -23
- package/src/context-menu/context-menu-wrapper.jsx +13 -11
- package/src/object-model/config-utils.js +5 -1
- package/src/object-model/layout-dimensions.js +10 -2
- package/src/object-model/object-model.js +23 -3
- package/src/object-model/redux/canvas-store.js +8 -4
- package/src/object-model/redux/reducers/categories.js +12 -0
- package/src/object-model/redux/reducers/contextmenu.js +10 -3
- package/src/object-model/redux/reducers/palette.js +3 -0
- package/src/palette/palette-flyout-content-category.jsx +18 -15
- package/src/palette/palette-flyout-content.jsx +0 -15
- package/src/toolbar/toolbar-action-item.jsx +80 -10
- package/src/toolbar/toolbar-overflow-item.jsx +9 -9
- package/src/toolbar/toolbar.jsx +12 -1
- package/src/toolbar/toolbar.scss +41 -13
- package/stats.html +1 -1
- package/dist/_baseForOwn-7d4e8506.js +0 -2
- package/dist/_baseForOwn-7d4e8506.js.map +0 -1
- package/dist/_baseForOwn-d38b560e.js +0 -2
- package/dist/_baseForOwn-d38b560e.js.map +0 -1
- package/dist/canvas-constants-046e4126.js +0 -2
- package/dist/canvas-constants-046e4126.js.map +0 -1
- package/dist/canvas-constants-f4e65d4d.js +0 -2
- package/dist/canvas-constants-f4e65d4d.js.map +0 -1
- package/dist/canvas-controller-6fe261d9.js +0 -2
- package/dist/canvas-controller-6fe261d9.js.map +0 -1
- package/dist/canvas-controller-ea7d4a8f.js +0 -2
- package/dist/canvas-controller-ea7d4a8f.js.map +0 -1
- package/dist/common-canvas-2953ff65.js +0 -2
- package/dist/common-canvas-2953ff65.js.map +0 -1
- package/dist/common-canvas-fbd62592.js +0 -2
- package/dist/common-canvas-fbd62592.js.map +0 -1
- package/dist/common-properties-0df4ed36.js +0 -2
- package/dist/common-properties-0df4ed36.js.map +0 -1
- package/dist/common-properties-8409565f.js +0 -2
- package/dist/common-properties-8409565f.js.map +0 -1
- package/dist/datarecord-metadata-v3-schema-6a3754ce.js +0 -2
- package/dist/datarecord-metadata-v3-schema-ba1f2849.js +0 -2
- package/dist/en-7201b548.js +0 -2
- package/dist/en-7201b548.js.map +0 -1
- package/dist/en-a08356c8.js +0 -2
- package/dist/en-a08356c8.js.map +0 -1
- package/dist/extends-7d4f15b6.js.map +0 -1
- package/dist/extends-d144eab9.js +0 -7
- package/dist/extends-d144eab9.js.map +0 -1
- package/dist/flexible-table-3a78cdf3.js +0 -2
- package/dist/flexible-table-3a78cdf3.js.map +0 -1
- package/dist/flexible-table-6e801de4.js +0 -2
- package/dist/flexible-table-6e801de4.js.map +0 -1
- package/dist/icon-221bb2e5.js +0 -2
- package/dist/icon-ea917a08.js +0 -2
- package/dist/index-92422c18.js +0 -2
- package/dist/index-aee893ad.js +0 -2
- package/dist/toolbar-3fdd090b.js +0 -2
- package/dist/toolbar-3fdd090b.js.map +0 -1
- package/dist/toolbar-5437484a.js +0 -2
- package/dist/toolbar-5437484a.js.map +0 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2017-2023 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 { get } from "lodash";
|
|
18
|
+
import { LINK_SELECTION_NONE, SUPER_NODE } from "./constants/canvas-constants";
|
|
19
|
+
|
|
20
|
+
// Global constant to handle the canvas controller.
|
|
21
|
+
let cc = null;
|
|
22
|
+
|
|
23
|
+
// Returns a context menu definition for the source object passed in which
|
|
24
|
+
// is either the default menu or a customized one provided by the host app.
|
|
25
|
+
export default function getContextMenuDefiniton(source, canvasController) {
|
|
26
|
+
cc = canvasController;
|
|
27
|
+
|
|
28
|
+
const defMenu = createDefaultContextMenu(source);
|
|
29
|
+
let menuDefinition;
|
|
30
|
+
|
|
31
|
+
if (typeof cc.handlers.contextMenuHandler === "function") {
|
|
32
|
+
const menuCustom = cc.handlers.contextMenuHandler(source, defMenu);
|
|
33
|
+
if (menuCustom && menuCustom.length > 0) {
|
|
34
|
+
menuDefinition = menuCustom;
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
menuDefinition = defMenu;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// If we are NOT allowing editing actions (perhaps because we are showing a
|
|
41
|
+
// read-only canvas), remove any actions from the context menu that might
|
|
42
|
+
// alter the canvas objects.
|
|
43
|
+
if (menuDefinition && menuDefinition.length > 0 &&
|
|
44
|
+
cc.getCanvasConfig().enableEditingActions === false) {
|
|
45
|
+
menuDefinition = filterOutEditingActions(menuDefinition);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// We need to remove any unwanted dividers. These might be dividers at
|
|
49
|
+
// the top of the array that are there after editing actions have been
|
|
50
|
+
// removed or doubled-up dividers in the menu which might be there after
|
|
51
|
+
// removing editing actions or in the menu def returtned by the host app.
|
|
52
|
+
if (menuDefinition && menuDefinition.length > 0) {
|
|
53
|
+
menuDefinition = filterOutUnwantedDividers(menuDefinition);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return menuDefinition;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Returns a new menu based, on the menu passed in, where all actions that
|
|
60
|
+
// might alter the canvas have been removed.
|
|
61
|
+
const filterOutEditingActions = (menuDefinition) => {
|
|
62
|
+
const newMenuDefinition = [];
|
|
63
|
+
menuDefinition.forEach((menuEntry) => {
|
|
64
|
+
if (menuEntry.submenu) {
|
|
65
|
+
const newSubMenu = filterOutEditingActions(menuEntry.menu);
|
|
66
|
+
if (newSubMenu && newSubMenu.length > 0) {
|
|
67
|
+
menuEntry.menu = newSubMenu;
|
|
68
|
+
newMenuDefinition.push(menuEntry);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} else if (!isEditingAction(menuEntry.action)) {
|
|
72
|
+
newMenuDefinition.push(menuEntry);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
return newMenuDefinition;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Remove any doubled-up or leading dividers in the array.
|
|
79
|
+
const filterOutUnwantedDividers = (menuDef) => {
|
|
80
|
+
const newMenuDef = [];
|
|
81
|
+
let previousDivider = true;
|
|
82
|
+
menuDef.forEach((item) => {
|
|
83
|
+
if (item.divider) {
|
|
84
|
+
if (!previousDivider) {
|
|
85
|
+
newMenuDef.push(item);
|
|
86
|
+
previousDivider = true;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
newMenuDef.push(item);
|
|
90
|
+
previousDivider = false;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return newMenuDef;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Returns true if the action string passed in is one of the actions
|
|
97
|
+
// that would alter the canvas objects. This is useful for filtering
|
|
98
|
+
// out editing actions that should be unavailable with a read-only canvas.
|
|
99
|
+
const isEditingAction = (action) =>
|
|
100
|
+
action === "createComment" ||
|
|
101
|
+
action === "colorBackground" ||
|
|
102
|
+
action === "disconnectNode" ||
|
|
103
|
+
action === "setNodeLabelEditingMode" ||
|
|
104
|
+
action === "setCommentEditingMode" ||
|
|
105
|
+
action === "cut" ||
|
|
106
|
+
action === "copy" ||
|
|
107
|
+
action === "paste" ||
|
|
108
|
+
action === "undo" ||
|
|
109
|
+
action === "redo" ||
|
|
110
|
+
action === "deleteSelectedObjects" ||
|
|
111
|
+
action === "createSuperNode" ||
|
|
112
|
+
action === "createSuperNodeExternal" ||
|
|
113
|
+
action === "deconstructSuperNode" ||
|
|
114
|
+
action === "collapseSuperNodeInPlace" ||
|
|
115
|
+
action === "expandSuperNodeInPlace" ||
|
|
116
|
+
action === "convertSuperNodeExternalToLocal" ||
|
|
117
|
+
action === "convertSuperNodeLocalToExternal" ||
|
|
118
|
+
action === "deleteLink" ||
|
|
119
|
+
action === "saveToPalette"
|
|
120
|
+
;
|
|
121
|
+
|
|
122
|
+
// Returns a default context menu definition for the source object and canvas
|
|
123
|
+
// controller passed in.
|
|
124
|
+
const createDefaultContextMenu = (source) => {
|
|
125
|
+
let menuDefinition = [];
|
|
126
|
+
const menuForNonSelectedObj = cc.isContextMenuForNonSelectedObj(source);
|
|
127
|
+
|
|
128
|
+
// Select all & add comment: canvas only
|
|
129
|
+
if (source.type === "canvas") {
|
|
130
|
+
menuDefinition = menuDefinition.concat([
|
|
131
|
+
{ action: "createComment", label: getLabel("canvas.addComment"), toolbarItem: true },
|
|
132
|
+
{ action: "selectAll", label: getLabel("canvas.selectAll") },
|
|
133
|
+
{ divider: true }
|
|
134
|
+
]);
|
|
135
|
+
}
|
|
136
|
+
// Rename node
|
|
137
|
+
if (source.type === "node" && get(source, "targetObject.layout.labelEditable", false)) {
|
|
138
|
+
menuDefinition = menuDefinition.concat(
|
|
139
|
+
{ action: "setNodeLabelEditingMode", label: getLabel("node.renameNode"), toolbarItem: true }
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
// Edit comment
|
|
143
|
+
if (source.type === "comment") {
|
|
144
|
+
menuDefinition = menuDefinition.concat(
|
|
145
|
+
{ action: "setCommentEditingMode", label: getLabel("comment.editComment"), toolbarItem: true }
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
// Color objects
|
|
149
|
+
if (source.type === "comment" &&
|
|
150
|
+
get(cc, "contextMenuConfig.defaultMenuEntries.colorBackground", true)) {
|
|
151
|
+
menuDefinition = menuDefinition.concat(
|
|
152
|
+
{ action: "colorBackground", label: getLabel("comment.colorBackground") },
|
|
153
|
+
{ divider: true }
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
// Disconnect node
|
|
157
|
+
if (source.type === "node" || source.type === "comment") {
|
|
158
|
+
const objectAry = menuForNonSelectedObj ? [source.targetObject.id] : source.selectedObjectIds;
|
|
159
|
+
const linksFound = cc.objectModel.getAPIPipeline(source.pipelineId).getLinksContainingIds(objectAry);
|
|
160
|
+
if (linksFound.length > 0) {
|
|
161
|
+
menuDefinition = menuDefinition.concat(
|
|
162
|
+
{ action: "disconnectNode", label: getLabel("node.disconnectNode") },
|
|
163
|
+
{ divider: true }
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Edit submenu (cut, copy, paste)
|
|
168
|
+
if (source.type === "node" ||
|
|
169
|
+
source.type === "comment" ||
|
|
170
|
+
(source.type === "link" && cc.areDetachableLinksInUse()) ||
|
|
171
|
+
source.type === "canvas") {
|
|
172
|
+
const editSubMenu = createEditMenu(source, source.type === "canvas");
|
|
173
|
+
menuDefinition = menuDefinition.concat(
|
|
174
|
+
{ action: "clipboard", submenu: true, menu: editSubMenu, label: getLabel("node.editMenu") },
|
|
175
|
+
{ divider: true }
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
// Undo and redo
|
|
179
|
+
if (source.type === "canvas") {
|
|
180
|
+
menuDefinition = menuDefinition.concat(
|
|
181
|
+
{ action: "undo", label: getLabel("canvas.undo"), enable: cc.canUndo() },
|
|
182
|
+
{ action: "redo", label: getLabel("canvas.redo"), enable: cc.canRedo() },
|
|
183
|
+
{ divider: true }
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
// Delete objects
|
|
187
|
+
if (source.type === "node" || source.type === "comment" ||
|
|
188
|
+
(cc.getCanvasConfig().enableLinkSelection !== LINK_SELECTION_NONE && source.type === "link")) {
|
|
189
|
+
menuDefinition = menuDefinition.concat(
|
|
190
|
+
{ action: "deleteSelectedObjects", label: getLabel("canvas.deleteObject"), toolbarItem: true },
|
|
191
|
+
{ divider: true }
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
// Create supernode
|
|
195
|
+
if (source.type === "node" || source.type === "comment") {
|
|
196
|
+
if (get(cc, "contextMenuConfig.defaultMenuEntries.createSupernode", false) &&
|
|
197
|
+
(cc.areSelectedNodesContiguous() ||
|
|
198
|
+
get(cc, "contextMenuConfig.enableCreateSupernodeNonContiguous", false) ||
|
|
199
|
+
(menuForNonSelectedObj && source.type === "node"))) {
|
|
200
|
+
menuDefinition = menuDefinition.concat(
|
|
201
|
+
{ action: "createSuperNode", label: getLabel("node.createSupernode") }
|
|
202
|
+
);
|
|
203
|
+
if (cc.getCanvasConfig().enableExternalPipelineFlows) {
|
|
204
|
+
menuDefinition = menuDefinition.concat(
|
|
205
|
+
{ action: "createSuperNodeExternal", label: getLabel("node.createSupernodeExternal") }
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
menuDefinition = menuDefinition.concat(
|
|
209
|
+
{ divider: true }
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Supernode options - only applicable with a single supernode selected
|
|
214
|
+
// which is opened by the "canvas" (default) editor.
|
|
215
|
+
if (source.type === "node" &&
|
|
216
|
+
source.targetObject.type === SUPER_NODE &&
|
|
217
|
+
(source.selectedObjectIds.length === 1 || menuForNonSelectedObj) &&
|
|
218
|
+
(source.targetObject.open_with_tool === "canvas" || typeof source.targetObject.open_with_tool === "undefined")) {
|
|
219
|
+
// Deconstruct supernode
|
|
220
|
+
menuDefinition = menuDefinition.concat(
|
|
221
|
+
{ action: "deconstructSuperNode", label: getLabel("node.deconstructSupernode") },
|
|
222
|
+
{ divider: true }
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
// Collapse supernode
|
|
226
|
+
if (cc.isSuperNodeExpandedInPlace(source.targetObject.id, source.pipelineId)) {
|
|
227
|
+
menuDefinition = menuDefinition.concat(
|
|
228
|
+
{ action: "collapseSuperNodeInPlace", label: getLabel("node.collapseSupernodeInPlace") }
|
|
229
|
+
);
|
|
230
|
+
// Expand supernode
|
|
231
|
+
} else {
|
|
232
|
+
menuDefinition = menuDefinition.concat(
|
|
233
|
+
{ action: "expandSuperNodeInPlace", label: getLabel("node.expandSupernode") }
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Expand supernode to full page display
|
|
238
|
+
if (get(cc, "contextMenuConfig.defaultMenuEntries.displaySupernodeFullPage")) {
|
|
239
|
+
menuDefinition = menuDefinition.concat(
|
|
240
|
+
{ action: "displaySubPipeline", label: getLabel("node.displaySupernodeFullPage"), toolbarItem: true }
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
menuDefinition = menuDefinition.concat(
|
|
245
|
+
{ divider: true }
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
// Convert supernode
|
|
249
|
+
if (cc.getCanvasConfig().enableExternalPipelineFlows) {
|
|
250
|
+
// Convert External to Local
|
|
251
|
+
if (source.targetObject.subflow_ref.url) {
|
|
252
|
+
// Supernodes inside an external sub-flow cannot be made local.
|
|
253
|
+
if (!cc.isPipelineExternal(source.pipelineId)) {
|
|
254
|
+
menuDefinition = menuDefinition.concat(
|
|
255
|
+
{ action: "convertSuperNodeExternalToLocal", label: getLabel("node.convertSupernodeExternalToLocal") },
|
|
256
|
+
{ divider: true }
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
// Convert Local to External
|
|
260
|
+
} else {
|
|
261
|
+
menuDefinition = menuDefinition.concat(
|
|
262
|
+
{ action: "convertSuperNodeLocalToExternal", label: getLabel("node.convertSupernodeLocalToExternal") },
|
|
263
|
+
{ divider: true }
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Delete link
|
|
269
|
+
if (source.type === "link" &&
|
|
270
|
+
cc.getCanvasConfig().enableLinkSelection === LINK_SELECTION_NONE) {
|
|
271
|
+
menuDefinition = menuDefinition.concat(
|
|
272
|
+
{ action: "deleteLink", label: getLabel("canvas.deleteObject"), toolbarItem: true }
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
// Highlight submenu (Highlight Branch | Upstream | Downstream, Unhighlight)
|
|
276
|
+
if (source.type === "node") {
|
|
277
|
+
menuDefinition = menuDefinition.concat(
|
|
278
|
+
{ action: "highlight", submenu: true, menu: createHighlightSubMenu(source), label: getLabel("menu.highlight") }
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
if (source.type === "canvas") {
|
|
282
|
+
menuDefinition = menuDefinition.concat(
|
|
283
|
+
{ action: "unhighlight", label: getLabel("menu.unhighlight"), enable: cc.isHighlighted() }
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
if (source.type === "node" &&
|
|
287
|
+
get(cc, "contextMenuConfig.defaultMenuEntries.saveToPalette", false)) {
|
|
288
|
+
menuDefinition = menuDefinition.concat(
|
|
289
|
+
{ divider: true },
|
|
290
|
+
{ action: "saveToPalette", label: getLabel("node.saveToPalette") }
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return menuDefinition;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const createEditMenu = (source, includePaste) => {
|
|
298
|
+
const editSubMenu = [
|
|
299
|
+
{ action: "cut", label: getLabel("edit.cutSelection"), enable: source.selectedObjectIds.length > 0 },
|
|
300
|
+
{ action: "copy", label: getLabel("edit.copySelection"), enable: source.selectedObjectIds.length > 0 }
|
|
301
|
+
];
|
|
302
|
+
if (includePaste) {
|
|
303
|
+
editSubMenu.push({ action: "paste", label: getLabel("edit.pasteSelection"), enable: !cc.isClipboardEmpty() });
|
|
304
|
+
}
|
|
305
|
+
return editSubMenu;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
const createHighlightSubMenu = (source) => {
|
|
309
|
+
let highlightSubMenuDef = [
|
|
310
|
+
{ action: "highlightBranch", label: getLabel("menu.highlightBranch") },
|
|
311
|
+
{ action: "highlightUpstream", label: getLabel("menu.highlightUpstream") },
|
|
312
|
+
{ action: "highlightDownstream", label: getLabel("menu.highlightDownstream") }
|
|
313
|
+
];
|
|
314
|
+
highlightSubMenuDef.push({ divider: true });
|
|
315
|
+
highlightSubMenuDef = highlightSubMenuDef.concat(createUnhighlightMenu(source));
|
|
316
|
+
return highlightSubMenuDef;
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// This should only appear in menu if highlight is true.
|
|
320
|
+
const createUnhighlightMenu = (source) => {
|
|
321
|
+
const unhighlightSubMenu = [
|
|
322
|
+
{ action: "unhighlight", label: getLabel("menu.unhighlight"), enable: cc.isHighlighted() }
|
|
323
|
+
];
|
|
324
|
+
return unhighlightSubMenu;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Returns a label index by the key from the canvas controller.
|
|
328
|
+
const getLabel = (key) => cc.labelUtil.getLabel(key);
|