@elyra/canvas 12.42.0 → 12.44.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.
- package/dist/{canvas-constants-ff5cf88e.js → canvas-constants-089e7830.js} +2 -2
- package/dist/{canvas-constants-ff5cf88e.js.map → canvas-constants-089e7830.js.map} +1 -1
- package/dist/{canvas-constants-13b58448.js → canvas-constants-69e90162.js} +2 -2
- package/dist/{canvas-constants-13b58448.js.map → canvas-constants-69e90162.js.map} +1 -1
- package/dist/canvas-controller-3e6b8ce4.js +2 -0
- package/dist/canvas-controller-3e6b8ce4.js.map +1 -0
- package/dist/canvas-controller-c6274fad.js +2 -0
- package/dist/canvas-controller-c6274fad.js.map +1 -0
- package/dist/{canvas-logger-295dafe4.js → canvas-logger-6f4b2551.js} +2 -2
- package/dist/{canvas-logger-295dafe4.js.map → canvas-logger-6f4b2551.js.map} +1 -1
- package/dist/{canvas-logger-e07a0b4a.js → canvas-logger-ab9d9048.js} +2 -2
- package/dist/{canvas-logger-e07a0b4a.js.map → canvas-logger-ab9d9048.js.map} +1 -1
- package/dist/common-canvas-6ed21ab6.js +2 -0
- package/dist/common-canvas-6ed21ab6.js.map +1 -0
- package/dist/common-canvas-8abf016c.js +2 -0
- package/dist/common-canvas-8abf016c.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-88377242.js +2 -0
- package/dist/common-properties-88377242.js.map +1 -0
- package/dist/common-properties-b295acc8.js +2 -0
- package/dist/common-properties-b295acc8.js.map +1 -0
- package/dist/context-menu-wrapper-949393c7.js +2 -0
- package/dist/context-menu-wrapper-949393c7.js.map +1 -0
- package/dist/context-menu-wrapper-f62dfcdb.js +2 -0
- package/dist/context-menu-wrapper-f62dfcdb.js.map +1 -0
- package/dist/{createClass-440000a3.js → createClass-02596015.js} +2 -2
- package/dist/createClass-02596015.js.map +1 -0
- package/dist/createClass-155bf7da.js +2 -0
- package/dist/createClass-155bf7da.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-07d18e19.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-98ec66e9.js.map → datarecord-metadata-v3-schema-07d18e19.js.map} +1 -1
- package/dist/datarecord-metadata-v3-schema-df939dd1.js +2 -0
- package/dist/{datarecord-metadata-v3-schema-dba0b214.js.map → datarecord-metadata-v3-schema-df939dd1.js.map} +1 -1
- package/dist/defineProperty-ad55dbff.js +2 -0
- package/dist/{defineProperty-3dc7d8d0.js.map → defineProperty-ad55dbff.js.map} +1 -1
- package/dist/{defineProperty-6d406743.js → defineProperty-bcc9968d.js} +2 -2
- package/dist/{defineProperty-6d406743.js.map → defineProperty-bcc9968d.js.map} +1 -1
- package/dist/flexible-table-c6a8b402.js +2 -0
- package/dist/{flexible-table-7c7de0f9.js.map → flexible-table-c6a8b402.js.map} +1 -1
- package/dist/flexible-table-f7b294a0.js +2 -0
- package/dist/{flexible-table-35e9922a.js.map → flexible-table-f7b294a0.js.map} +1 -1
- package/dist/{icon-9edff40c.js → icon-56b27c4f.js} +2 -2
- package/dist/{icon-9edff40c.js.map → icon-56b27c4f.js.map} +1 -1
- package/dist/{icon-e622f99b.js → icon-8ec2f0ec.js} +2 -2
- package/dist/{icon-e622f99b.js.map → icon-8ec2f0ec.js.map} +1 -1
- package/dist/index-01cbacf9.js +2 -0
- package/dist/{index-e2f8a935.js.map → index-01cbacf9.js.map} +1 -1
- package/dist/index-79543d41.js +2 -0
- package/dist/{index-94fec521.js.map → index-79543d41.js.map} +1 -1
- package/dist/inherits-42ae8426.js +2 -0
- package/dist/inherits-42ae8426.js.map +1 -0
- package/dist/inherits-75817f22.js +2 -0
- package/dist/inherits-75817f22.js.map +1 -0
- package/dist/isArrayLikeObject-04f333a5.js +1 -1
- package/dist/isArrayLikeObject-04f333a5.js.map +1 -1
- package/dist/isArrayLikeObject-7a30aa4b.js +1 -1
- package/dist/isArrayLikeObject-7a30aa4b.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/command-stack.es.js +1 -1
- package/dist/lib/command-stack.es.js.map +1 -1
- package/dist/lib/command-stack.js +1 -1
- package/dist/lib/command-stack.js.map +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/context-menu.js +1 -1
- package/dist/lib/properties/clem.es.js +2 -0
- package/dist/lib/properties/clem.es.js.map +1 -0
- package/dist/lib/properties/clem.js +2 -0
- package/dist/lib/properties/clem.js.map +1 -0
- 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/getPythonHints.es.js +2 -0
- package/dist/lib/properties/getPythonHints.es.js.map +1 -0
- package/dist/lib/properties/getPythonHints.js +2 -0
- package/dist/lib/properties/getPythonHints.js.map +1 -0
- package/dist/lib/properties.es.js +1 -1
- package/dist/lib/properties.js +1 -1
- package/dist/lib/tooltip.es.js +1 -1
- package/dist/lib/tooltip.es.js.map +1 -1
- package/dist/lib/tooltip.js +1 -1
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/styles/common-canvas.min.css +1 -1
- package/dist/styles/common-canvas.min.css.map +1 -1
- package/dist/toolbar-235dfb9d.js +2 -0
- package/dist/toolbar-235dfb9d.js.map +1 -0
- package/dist/toolbar-6607e35c.js +2 -0
- package/dist/toolbar-6607e35c.js.map +1 -0
- package/package.json +3 -3
- package/rollup.config.js +2 -0
- package/src/color-picker/color-picker.jsx +5 -1
- package/src/common-canvas/canvas-controller.js +56 -1
- package/src/common-canvas/cc-central-items.jsx +0 -4
- package/src/common-canvas/cc-toolbar.jsx +35 -13
- package/src/common-canvas/common-canvas-utils.js +73 -2
- package/src/common-canvas/common-canvas.scss +8 -8
- package/src/common-canvas/constants/canvas-constants.js +1 -0
- package/src/common-canvas/svg-canvas-d3.scss +3 -2
- package/src/common-canvas/svg-canvas-renderer.js +184 -94
- package/src/common-canvas/svg-canvas-utils-external.js +1 -1
- package/src/common-canvas/svg-canvas-utils-links.js +28 -32
- package/src/common-canvas/svg-canvas-utils-nodes.js +5 -13
- package/src/common-properties/components/field-picker/field-picker.jsx +4 -0
- package/src/common-properties/controls/checkbox/checkbox.scss +0 -1
- package/src/common-properties/controls/expression/expression.jsx +3 -5
- package/src/common-properties/controls/expression/languages/python-hint.js +18 -30
- package/src/common-properties/controls/expression/languages/r-hint.js +16 -8
- package/src/common-properties/index.js +4 -2
- package/src/icons/icon.scss +1 -1
- package/src/index.js +2 -2
- package/src/notification-panel/notification-panel.jsx +82 -56
- package/src/notification-panel/notification-panel.scss +42 -40
- package/src/object-model/config-utils.js +2 -2
- package/src/object-model/layout-dimensions.js +82 -87
- package/src/object-model/object-model-utils.js +271 -0
- package/src/object-model/object-model.js +47 -245
- package/src/object-model/redux/reducers/canvasinfo.js +7 -11
- package/src/object-model/redux/reducers/canvastoolbar.js +5 -6
- package/src/palette/palette-dialog-topbar.jsx +27 -38
- package/src/palette/palette-flyout-content-category.jsx +25 -6
- package/src/palette/palette.scss +8 -40
- package/src/toolbar/index.js +18 -0
- package/src/toolbar/toolbar-action-item.jsx +42 -11
- package/src/toolbar/toolbar-button-item.jsx +49 -21
- package/src/toolbar/toolbar-divider-item.jsx +1 -1
- package/src/toolbar/toolbar-overflow-item.jsx +14 -6
- package/src/toolbar/toolbar-sub-menu-item.jsx +6 -5
- package/src/toolbar/toolbar-sub-menu.jsx +4 -6
- package/src/toolbar/toolbar-sub-panel.jsx +31 -18
- package/src/toolbar/toolbar-sub-utils.js +21 -12
- package/src/toolbar/toolbar.jsx +83 -26
- package/src/toolbar/toolbar.scss +47 -47
- package/src/tooltip/tooltip.jsx +56 -10
- package/stats.html +1 -1
- package/assets/images/palette/close_32.svg +0 -1
- package/assets/images/palette/palette_close.svg +0 -4
- package/assets/images/palette/palette_grid_deselected.svg +0 -2
- package/assets/images/palette/palette_grid_hover.svg +0 -2
- package/assets/images/palette/palette_grid_selected.svg +0 -2
- package/assets/images/palette/palette_list_deselected.svg +0 -1
- package/assets/images/palette/palette_list_hover.svg +0 -1
- package/assets/images/palette/palette_list_selected.svg +0 -1
- package/assets/images/palette/palette_open.svg +0 -4
- package/assets/images/zoom_to_fit.svg +0 -8
- package/dist/canvas-controller-a53943e4.js +0 -2
- package/dist/canvas-controller-a53943e4.js.map +0 -1
- package/dist/canvas-controller-cb1d7420.js +0 -2
- package/dist/canvas-controller-cb1d7420.js.map +0 -1
- package/dist/common-canvas-42027a3f.js +0 -2
- package/dist/common-canvas-42027a3f.js.map +0 -1
- package/dist/common-canvas-f758ff42.js +0 -2
- package/dist/common-canvas-f758ff42.js.map +0 -1
- package/dist/common-properties-2e1b7ec7.js +0 -2
- package/dist/common-properties-2e1b7ec7.js.map +0 -1
- package/dist/common-properties-5e8870e3.js +0 -2
- package/dist/common-properties-5e8870e3.js.map +0 -1
- package/dist/context-menu-wrapper-49f9a1af.js +0 -2
- package/dist/context-menu-wrapper-49f9a1af.js.map +0 -1
- package/dist/context-menu-wrapper-5d6a399f.js +0 -2
- package/dist/context-menu-wrapper-5d6a399f.js.map +0 -1
- package/dist/createClass-440000a3.js.map +0 -1
- package/dist/createClass-5ca26865.js +0 -2
- package/dist/createClass-5ca26865.js.map +0 -1
- package/dist/datarecord-metadata-v3-schema-98ec66e9.js +0 -2
- package/dist/datarecord-metadata-v3-schema-dba0b214.js +0 -2
- package/dist/defineProperty-3dc7d8d0.js +0 -2
- package/dist/flexible-table-35e9922a.js +0 -2
- package/dist/flexible-table-7c7de0f9.js +0 -2
- package/dist/index-94fec521.js +0 -2
- package/dist/index-e2f8a935.js +0 -2
- package/dist/inherits-226dfdb2.js +0 -2
- package/dist/inherits-226dfdb2.js.map +0 -1
- package/dist/inherits-41673c87.js +0 -2
- package/dist/inherits-41673c87.js.map +0 -1
- package/dist/toolbar-6acda0a2.js +0 -2
- package/dist/toolbar-6acda0a2.js.map +0 -1
- package/dist/toolbar-d5647da2.js +0 -2
- package/dist/toolbar-d5647da2.js.map +0 -1
- package/src/palette/palette-dialog-topbar-three-way-icon.jsx +0 -82
|
@@ -31,6 +31,8 @@ class PaletteFlyoutContentCategory extends React.Component {
|
|
|
31
31
|
this.onMouseOver = this.onMouseOver.bind(this);
|
|
32
32
|
this.onMouseLeave = this.onMouseLeave.bind(this);
|
|
33
33
|
this.categoryClicked = this.categoryClicked.bind(this);
|
|
34
|
+
this.categoryKeyPressed = this.categoryKeyPressed.bind(this);
|
|
35
|
+
this.setPaletteCategory = this.setPaletteCategory.bind(this);
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
onMouseOver(ev) {
|
|
@@ -93,12 +95,22 @@ class PaletteFlyoutContentCategory extends React.Component {
|
|
|
93
95
|
return content;
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
setPaletteCategory(isOpen) {
|
|
99
|
+
if (isOpen) {
|
|
100
|
+
this.props.canvasController.closePaletteCategory(this.props.category.id);
|
|
101
|
+
} else {
|
|
102
|
+
this.props.canvasController.openPaletteCategory(this.props.category.id);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
96
106
|
// Returns the category object for a regular category.
|
|
97
107
|
getRenderCategory() {
|
|
98
108
|
const titleObj = this.getTitleObj();
|
|
99
109
|
const content = this.getContent();
|
|
100
110
|
return (
|
|
101
|
-
<AccordionItem title={titleObj} open={this.props.category.is_open}
|
|
111
|
+
<AccordionItem title={titleObj} open={this.props.category.is_open}
|
|
112
|
+
onKeyDown={this.categoryKeyPressed}
|
|
113
|
+
>
|
|
102
114
|
{content}
|
|
103
115
|
</AccordionItem>
|
|
104
116
|
);
|
|
@@ -116,7 +128,7 @@ class PaletteFlyoutContentCategory extends React.Component {
|
|
|
116
128
|
onMouseOver={this.onMouseOver}
|
|
117
129
|
onMouseLeave={this.onMouseLeave}
|
|
118
130
|
>
|
|
119
|
-
<div className="palette-flyout-category-item">
|
|
131
|
+
<div className="palette-flyout-category-item" tabIndex={-1}>
|
|
120
132
|
{itemImage}
|
|
121
133
|
{itemText}
|
|
122
134
|
</div></div>
|
|
@@ -196,10 +208,17 @@ class PaletteFlyoutContentCategory extends React.Component {
|
|
|
196
208
|
// a category is opened.
|
|
197
209
|
evt.stopPropagation();
|
|
198
210
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
211
|
+
this.setPaletteCategory(this.props.category.is_open);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
categoryKeyPressed(evt) {
|
|
215
|
+
if (evt.target.className === "bx--accordion__heading") {
|
|
216
|
+
if (evt.code === "Enter" || evt.code === "Space") {
|
|
217
|
+
evt.preventDefault();
|
|
218
|
+
evt.stopPropagation();
|
|
219
|
+
|
|
220
|
+
this.setPaletteCategory(this.props.category.is_open);
|
|
221
|
+
}
|
|
203
222
|
}
|
|
204
223
|
}
|
|
205
224
|
|
package/src/palette/palette.scss
CHANGED
|
@@ -99,11 +99,17 @@ $palette-search-container-height: 41px;
|
|
|
99
99
|
/* This stops it being dragged incorrectly.*/
|
|
100
100
|
user-select: none;
|
|
101
101
|
width: 100%;
|
|
102
|
+
outline: none; // Turn outline off and use carbon style for focus below.
|
|
102
103
|
|
|
103
104
|
&:hover {
|
|
104
105
|
background-color: $ui-03;
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
&:focus {
|
|
109
|
+
border-color: $interactive-03;
|
|
110
|
+
box-shadow: inset 0 0 0 2px $interactive-03;
|
|
111
|
+
}
|
|
112
|
+
|
|
107
113
|
.palette-list-item-category-label {
|
|
108
114
|
@include carbon--type-style("caption-01");
|
|
109
115
|
width: 100%;
|
|
@@ -414,47 +420,9 @@ $palette-search-container-height: 41px;
|
|
|
414
420
|
}
|
|
415
421
|
|
|
416
422
|
.palette-dialog-topbar {
|
|
417
|
-
height:
|
|
418
|
-
padding: 10px;
|
|
423
|
+
height: 41px;
|
|
419
424
|
background-color: $ui-03;
|
|
420
425
|
border-bottom: $palette-border-width solid $palette-border-color;
|
|
421
|
-
|
|
422
|
-
.left-navbar {
|
|
423
|
-
height: 20px;
|
|
424
|
-
float: left;
|
|
425
|
-
vertical-align: middle;
|
|
426
|
-
/* Prevent elements from being selectable */
|
|
427
|
-
/* This stops it being dragged incorrectly.*/
|
|
428
|
-
user-select: none;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
.right-navbar {
|
|
432
|
-
height: 20px;
|
|
433
|
-
float: right;
|
|
434
|
-
vertical-align: middle;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
.secondary-action {
|
|
438
|
-
margin-left: 10px;
|
|
439
|
-
display: inline-block;
|
|
440
|
-
cursor: pointer;
|
|
441
|
-
width: 20px;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.close-icon svg {
|
|
445
|
-
fill: $interactive-02;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.palette-three-way-icon-div {
|
|
449
|
-
margin-left: 5px;
|
|
450
|
-
display: inline-block;
|
|
451
|
-
cursor: pointer;
|
|
452
|
-
width: 20px;
|
|
453
|
-
height: 20px;
|
|
454
|
-
/* Prevent elements from being selectable */
|
|
455
|
-
/* This stops it being dragged incorrectly.*/
|
|
456
|
-
user-select: none;
|
|
457
|
-
}
|
|
458
426
|
}
|
|
459
427
|
|
|
460
428
|
.palette-dialog-content {
|
|
@@ -466,7 +434,7 @@ $palette-search-container-height: 41px;
|
|
|
466
434
|
}
|
|
467
435
|
|
|
468
436
|
.palette-dialog-categories {
|
|
469
|
-
background-color: $ui-
|
|
437
|
+
background-color: $ui-01;
|
|
470
438
|
width: 130px;
|
|
471
439
|
min-width: 130px; /* Set a min-width to ensure space for the scroll bar when it is displayed */
|
|
472
440
|
border-right: $palette-border-width solid $palette-border-color;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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 Toolbar from "./toolbar.jsx";
|
|
18
|
+
export default Toolbar;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -67,39 +67,62 @@ class ToolbarActionItem extends React.Component {
|
|
|
67
67
|
|
|
68
68
|
// Called by toolbar.jsx
|
|
69
69
|
isEnabled() {
|
|
70
|
-
return this.props.actionObj.enable;
|
|
70
|
+
return this.props.actionObj.enable || this.props.actionObj.jsx;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Called by toolbar.jsx and internally
|
|
74
|
+
isSubAreaDisplayed() {
|
|
75
|
+
if (this.props.actionObj.setExtIsSubAreaDisplayed &&
|
|
76
|
+
typeof this.props.actionObj.extIsSubAreaDisplayed !== "undefined") {
|
|
77
|
+
return this.props.actionObj.extIsSubAreaDisplayed;
|
|
78
|
+
}
|
|
79
|
+
return this.state.subAreaDisplayed;
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
clickOutside(evt) {
|
|
74
|
-
if (this.
|
|
83
|
+
if (this.isSubAreaDisplayed()) {
|
|
75
84
|
const items = document.getElementsByClassName(this.generateActionName());
|
|
76
85
|
const isOver = items && items.length > 0 ? items[0].contains(evt.target) : false;
|
|
77
86
|
|
|
78
|
-
if (!isOver) {
|
|
87
|
+
if (!isOver && !this.props.actionObj.leaveSubAreaOpenOnClickOutside) {
|
|
79
88
|
this.closeSubArea();
|
|
80
89
|
}
|
|
81
90
|
}
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
openSubArea() {
|
|
94
|
+
// If host app is controlling display of the sub-area call it to say
|
|
95
|
+
// sub-area is closing.
|
|
96
|
+
if (this.props.actionObj.setExtIsSubAreaDisplayed) {
|
|
97
|
+
this.props.actionObj.setExtIsSubAreaDisplayed(true);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
85
100
|
this.setState({ subAreaDisplayed: true });
|
|
86
101
|
}
|
|
87
102
|
|
|
88
103
|
closeSubArea(checkCloseSubAreaOnClick) {
|
|
89
104
|
if (!checkCloseSubAreaOnClick || this.props.actionObj.closeSubAreaOnClick) {
|
|
105
|
+
// If host app is controlling display of the sub-area call it to say
|
|
106
|
+
// sub-area is closing.
|
|
107
|
+
if (this.props.actionObj.setExtIsSubAreaDisplayed) {
|
|
108
|
+
this.props.actionObj.setExtIsSubAreaDisplayed(false);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
90
111
|
this.setState({ subAreaDisplayed: false });
|
|
91
112
|
}
|
|
92
113
|
}
|
|
93
114
|
|
|
94
115
|
actionClickHandler(evt) {
|
|
95
116
|
if (this.props.actionObj.subMenu || this.props.actionObj.subPanel) {
|
|
96
|
-
if (this.
|
|
117
|
+
if (this.isSubAreaDisplayed()) {
|
|
97
118
|
document.removeEventListener("click", this.clickOutside, false);
|
|
98
119
|
this.closeSubArea();
|
|
99
120
|
this.props.setToolbarFocusAction(this.props.actionObj.action);
|
|
100
121
|
|
|
101
122
|
} else {
|
|
102
123
|
document.addEventListener("click", this.clickOutside, false);
|
|
124
|
+
this.props.closeAnyOpenSubArea();
|
|
125
|
+
this.props.setToolbarFocusAction(this.props.actionObj.action);
|
|
103
126
|
this.openSubArea();
|
|
104
127
|
}
|
|
105
128
|
|
|
@@ -118,7 +141,7 @@ class ToolbarActionItem extends React.Component {
|
|
|
118
141
|
// supPanel field OR a sub-menu which is a list of options which is created
|
|
119
142
|
// from the array of items the caller passes in the subMenu field.
|
|
120
143
|
generateSubArea() {
|
|
121
|
-
const actionItemRect = this.divRef.current.getBoundingClientRect();
|
|
144
|
+
const actionItemRect = this.divRef.current ? this.divRef.current.getBoundingClientRect() : null;
|
|
122
145
|
|
|
123
146
|
if (this.props.actionObj.subPanel) {
|
|
124
147
|
return (
|
|
@@ -169,9 +192,10 @@ class ToolbarActionItem extends React.Component {
|
|
|
169
192
|
"toolbar-item-selected": actionObj.isSelected
|
|
170
193
|
},
|
|
171
194
|
kindAsClass,
|
|
172
|
-
actionName
|
|
195
|
+
actionName,
|
|
196
|
+
this.props.actionObj.className);
|
|
173
197
|
|
|
174
|
-
const subArea = this.
|
|
198
|
+
const subArea = this.isSubAreaDisplayed() ? this.generateSubArea() : null;
|
|
175
199
|
|
|
176
200
|
return (
|
|
177
201
|
<div ref={this.divRef} className={itemClassName} data-toolbar-action={actionObj.action} data-toolbar-item
|
|
@@ -184,9 +208,9 @@ class ToolbarActionItem extends React.Component {
|
|
|
184
208
|
tooltipDirection={this.props.tooltipDirection}
|
|
185
209
|
instanceId={this.props.instanceId}
|
|
186
210
|
isInMenu={false}
|
|
187
|
-
subAreaDisplayed={this.
|
|
211
|
+
subAreaDisplayed={this.isSubAreaDisplayed()}
|
|
188
212
|
actionClickHandler={this.actionClickHandler}
|
|
189
|
-
buttonFocusAction={this.
|
|
213
|
+
buttonFocusAction={this.isSubAreaDisplayed() ? null : this.props.toolbarFocusAction}
|
|
190
214
|
isFocusInToolbar={this.props.isFocusInToolbar}
|
|
191
215
|
size={this.props.size}
|
|
192
216
|
/>
|
|
@@ -217,12 +241,18 @@ ToolbarActionItem.propTypes = {
|
|
|
217
241
|
className: PropTypes.string,
|
|
218
242
|
textContent: PropTypes.string,
|
|
219
243
|
isSelected: PropTypes.bool,
|
|
244
|
+
setExtIsSubAreaDisplayed: PropTypes.func,
|
|
245
|
+
extIsSubAreaDisplayed: PropTypes.bool,
|
|
220
246
|
kind: PropTypes.string,
|
|
221
247
|
closeSubAreaOnClick: PropTypes.bool,
|
|
248
|
+
leaveSubAreaOpenOnClickOutside: PropTypes.bool,
|
|
222
249
|
subMenu: PropTypes.array,
|
|
223
250
|
subPanel: PropTypes.any,
|
|
224
251
|
subPanelData: PropTypes.object,
|
|
225
|
-
jsx: PropTypes.
|
|
252
|
+
jsx: PropTypes.oneOfType([
|
|
253
|
+
PropTypes.object,
|
|
254
|
+
PropTypes.func
|
|
255
|
+
]),
|
|
226
256
|
tooltip: PropTypes.oneOfType([
|
|
227
257
|
PropTypes.string,
|
|
228
258
|
PropTypes.object,
|
|
@@ -237,6 +267,7 @@ ToolbarActionItem.propTypes = {
|
|
|
237
267
|
toolbarFocusAction: PropTypes.string,
|
|
238
268
|
setToolbarFocusAction: PropTypes.func,
|
|
239
269
|
isFocusInToolbar: PropTypes.bool,
|
|
270
|
+
closeAnyOpenSubArea: PropTypes.func,
|
|
240
271
|
size: PropTypes.oneOf(["md", "sm"])
|
|
241
272
|
};
|
|
242
273
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -21,9 +21,6 @@ import Tooltip from "../tooltip/tooltip.jsx";
|
|
|
21
21
|
import ArrangeHorizontally from "./../../assets/images/arrange_horizontally.svg";
|
|
22
22
|
import ArrangeVertically from "./../../assets/images/arrange_vertically.svg";
|
|
23
23
|
import ToggleNotificationPanel from "./../../assets/images/notification_counter_icon.svg";
|
|
24
|
-
import PaletteClose from "./../../assets/images/palette/palette_close.svg";
|
|
25
|
-
import PaletteOpen from "./../../assets/images/palette/palette_open.svg";
|
|
26
|
-
import ZoomToFit from "./../../assets/images/zoom_to_fit.svg";
|
|
27
24
|
|
|
28
25
|
import { Button } from "carbon-components-react";
|
|
29
26
|
import SVG from "react-inlinesvg";
|
|
@@ -31,14 +28,15 @@ import classNames from "classnames";
|
|
|
31
28
|
import { StopFilledAlt16, Play16, Undo16, Redo16, Chat16, ChatOff16, Result16,
|
|
32
29
|
Cut16, Copy16, Paste16, Edit16, ColorPalette16, Maximize16, Minimize16,
|
|
33
30
|
Launch16, AddComment16, TrashCan16, ZoomIn16, ZoomOut16,
|
|
34
|
-
ChevronRight16, ChevronDown16, ChevronUp16
|
|
31
|
+
ChevronRight16, ChevronDown16, ChevronUp16,
|
|
32
|
+
CenterToFit16, OpenPanelFilledLeft16 } from "@carbon/icons-react";
|
|
35
33
|
import { TOOLBAR_STOP, TOOLBAR_RUN, TOOLBAR_UNDO, TOOLBAR_REDO,
|
|
36
34
|
TOOLBAR_CUT, TOOLBAR_COPY, TOOLBAR_PASTE, TOOLBAR_CLIPBOARD,
|
|
37
35
|
TOOLBAR_CREATE_COMMENT, TOOLBAR_CREATE_AUTO_COMMENT, TOOLBAR_COLOR_BACKGROUND,
|
|
38
36
|
TOOLBAR_DELETE_SELECTED_OBJECTS, TOOLBAR_DELETE_LINK,
|
|
39
37
|
TOOLBAR_ZOOM_IN, TOOLBAR_ZOOM_OUT, TOOLBAR_ZOOM_FIT,
|
|
40
38
|
TOOLBAR_ARRANGE_HORIZONALLY, TOOLBAR_ARRANGE_VERTICALLY,
|
|
41
|
-
TOOLBAR_OPEN_PALETTE, TOOLBAR_CLOSE_PALETTE, TOOLBAR_TOGGLE_NOTIFICATION_PANEL,
|
|
39
|
+
TOOLBAR_OPEN_PALETTE, TOOLBAR_CLOSE_PALETTE, TOOLBAR_TOGGLE_PALETTE, TOOLBAR_TOGGLE_NOTIFICATION_PANEL,
|
|
42
40
|
TOOLBAR_SHOW_COMMENTS, TOOLBAR_HIDE_COMMENTS,
|
|
43
41
|
TOOLBAR_EXPAND_SUPERNODE_IN_PLACE, TOOLBAR_COLLAPSE_SUPERNODE_IN_PLACE,
|
|
44
42
|
TOOLBAR_EXPAND_SUPERNODE_FULL_PAGE, TOOLBAR_SET_NODE_LABEL_EDIT, TOOLBAR_SET_COMMENT_EDIT_MODE }
|
|
@@ -54,6 +52,14 @@ class ToolbarButtonItem extends React.Component {
|
|
|
54
52
|
componentDidUpdate() {
|
|
55
53
|
if (this.props.isFocusInToolbar &&
|
|
56
54
|
this.props.buttonFocusAction === this.props.actionObj.action) {
|
|
55
|
+
// If a Jsx object was provided, the class of the component should have
|
|
56
|
+
// been set to toolbar-jsx-obj.
|
|
57
|
+
const jsxItem = this.buttonRef.current.querySelector(".toolbar-jsx-obj");
|
|
58
|
+
if (jsxItem) {
|
|
59
|
+
jsxItem.focus();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
this.buttonRef.current.focus();
|
|
58
64
|
}
|
|
59
65
|
}
|
|
@@ -105,17 +111,20 @@ class ToolbarButtonItem extends React.Component {
|
|
|
105
111
|
return <ZoomIn16 disabled={disabled} />;
|
|
106
112
|
case (TOOLBAR_ZOOM_OUT):
|
|
107
113
|
return <ZoomOut16 disabled={disabled} />;
|
|
108
|
-
|
|
109
114
|
case (TOOLBAR_ZOOM_FIT):
|
|
110
|
-
return <
|
|
115
|
+
return <CenterToFit16 disabled={disabled} />;
|
|
116
|
+
case (TOOLBAR_OPEN_PALETTE):
|
|
117
|
+
return <OpenPanelFilledLeft16 disabled={disabled} />;
|
|
118
|
+
case (TOOLBAR_CLOSE_PALETTE):
|
|
119
|
+
return <OpenPanelFilledLeft16 disabled={disabled} />;
|
|
120
|
+
case (TOOLBAR_TOGGLE_PALETTE):
|
|
121
|
+
return <OpenPanelFilledLeft16 disabled={disabled} />;
|
|
122
|
+
|
|
123
|
+
// Non-carbon icons
|
|
111
124
|
case (TOOLBAR_ARRANGE_HORIZONALLY):
|
|
112
125
|
return <SVG src={ArrangeHorizontally} disabled={disabled} />;
|
|
113
126
|
case (TOOLBAR_ARRANGE_VERTICALLY):
|
|
114
127
|
return <SVG src={ArrangeVertically} disabled={disabled} />;
|
|
115
|
-
case (TOOLBAR_OPEN_PALETTE):
|
|
116
|
-
return <SVG src={PaletteOpen} disabled={disabled} />;
|
|
117
|
-
case (TOOLBAR_CLOSE_PALETTE):
|
|
118
|
-
return <SVG src={PaletteClose} disabled={disabled} />;
|
|
119
128
|
case (TOOLBAR_TOGGLE_NOTIFICATION_PANEL):
|
|
120
129
|
return <SVG src={ToggleNotificationPanel} disabled={disabled} />;
|
|
121
130
|
|
|
@@ -169,7 +178,7 @@ class ToolbarButtonItem extends React.Component {
|
|
|
169
178
|
return null;
|
|
170
179
|
}
|
|
171
180
|
|
|
172
|
-
|
|
181
|
+
generateRegularItem(actionObj) {
|
|
173
182
|
let labelBefore = null;
|
|
174
183
|
let labelAfter = null;
|
|
175
184
|
|
|
@@ -188,7 +197,6 @@ class ToolbarButtonItem extends React.Component {
|
|
|
188
197
|
|
|
189
198
|
const itemContentClassName = classNames(
|
|
190
199
|
"toolbar-item-content",
|
|
191
|
-
actionObj.className ? actionObj.className : null,
|
|
192
200
|
{ "overflow": this.props.isInMenu, "disabled": !actionObj.enable, "default": !actionObj.kind });
|
|
193
201
|
|
|
194
202
|
// If no 'kind' is set, use ghost and then override colors using the "default" class in innerDivClassName.
|
|
@@ -264,6 +272,26 @@ class ToolbarButtonItem extends React.Component {
|
|
|
264
272
|
);
|
|
265
273
|
}
|
|
266
274
|
|
|
275
|
+
// Creates a <div> containing the JSX in the actionObj.jsx field, wrapped in a tooltip
|
|
276
|
+
// <div>, for display as an action item in the toolbar. The jsx field can be just
|
|
277
|
+
// regular JSX OR a function that returns JSX. If the application has provided a
|
|
278
|
+
// function we call it, passing in the tabIndex that the component in the JSX should
|
|
279
|
+
// use, based on whether it is focused or not.
|
|
280
|
+
generateJsxItem(actionObj) {
|
|
281
|
+
let content = null;
|
|
282
|
+
if (typeof actionObj.jsx === "function") {
|
|
283
|
+
const tabIndex = this.props.buttonFocusAction === actionObj.action ? 0 : -1;
|
|
284
|
+
content = actionObj.jsx(tabIndex);
|
|
285
|
+
} else {
|
|
286
|
+
content = actionObj.jsx;
|
|
287
|
+
}
|
|
288
|
+
const jsx = this.wrapInTooltip(content);
|
|
289
|
+
const div = (<div ref={this.buttonRef}>{jsx}</div>);
|
|
290
|
+
|
|
291
|
+
return div;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
267
295
|
wrapInTooltip(content) {
|
|
268
296
|
if (!this.props.isInMenu && (this.showLabelAsTip(this.props.actionObj) || this.props.actionObj.tooltip)) {
|
|
269
297
|
const tip = this.props.actionObj.tooltip ? this.props.actionObj.tooltip : this.props.actionObj.label;
|
|
@@ -296,13 +324,10 @@ class ToolbarButtonItem extends React.Component {
|
|
|
296
324
|
|
|
297
325
|
render() {
|
|
298
326
|
const actionObj = this.props.actionObj;
|
|
299
|
-
let divContent = null;
|
|
300
327
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
divContent = this.generateButton(actionObj);
|
|
305
|
-
}
|
|
328
|
+
const divContent = actionObj.jsx
|
|
329
|
+
? this.generateJsxItem(actionObj)
|
|
330
|
+
: this.generateRegularItem(actionObj);
|
|
306
331
|
|
|
307
332
|
return divContent;
|
|
308
333
|
}
|
|
@@ -333,7 +358,10 @@ ToolbarButtonItem.propTypes = {
|
|
|
333
358
|
subMenu: PropTypes.array,
|
|
334
359
|
subPanel: PropTypes.any,
|
|
335
360
|
subPanelData: PropTypes.object,
|
|
336
|
-
jsx: PropTypes.
|
|
361
|
+
jsx: PropTypes.oneOfType([
|
|
362
|
+
PropTypes.object,
|
|
363
|
+
PropTypes.func
|
|
364
|
+
]),
|
|
337
365
|
tooltip: PropTypes.oneOfType([
|
|
338
366
|
PropTypes.string,
|
|
339
367
|
PropTypes.object,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -35,7 +35,7 @@ class ToolbarOverflowItem extends React.Component {
|
|
|
35
35
|
this.uuid = uuid4();
|
|
36
36
|
this.toggleExtendedMenu = this.toggleExtendedMenu.bind(this);
|
|
37
37
|
this.clickOutside = this.clickOutside.bind(this);
|
|
38
|
-
this.
|
|
38
|
+
this.closeSubArea = this.closeSubArea.bind(this);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
componentDidUpdate() {
|
|
@@ -55,7 +55,13 @@ class ToolbarOverflowItem extends React.Component {
|
|
|
55
55
|
return this.props.action;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
// Called by toolbar.jsx
|
|
59
|
+
isSubAreaDisplayed() {
|
|
60
|
+
return this.state.showExtendedMenu;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Called by toolbar.jsx and internally
|
|
64
|
+
closeSubArea() {
|
|
59
65
|
this.setState({ showExtendedMenu: false });
|
|
60
66
|
}
|
|
61
67
|
|
|
@@ -84,11 +90,12 @@ class ToolbarOverflowItem extends React.Component {
|
|
|
84
90
|
if (this.state.showExtendedMenu) {
|
|
85
91
|
document.removeEventListener("click", this.clickOutside, false);
|
|
86
92
|
this.props.setOverflowIndex(null); // Clear the indexes
|
|
87
|
-
this.
|
|
93
|
+
this.closeSubArea();
|
|
88
94
|
this.props.setToolbarFocusAction(this.props.action); // This will not set focus on this item
|
|
89
95
|
|
|
90
96
|
} else {
|
|
91
97
|
document.addEventListener("click", this.clickOutside, false);
|
|
98
|
+
this.props.closeAnyOpenSubArea();
|
|
92
99
|
this.props.setOverflowIndex(this.props.index);
|
|
93
100
|
this.openSubMenu();
|
|
94
101
|
this.props.setToolbarFocusAction(this.props.action);
|
|
@@ -117,7 +124,7 @@ class ToolbarOverflowItem extends React.Component {
|
|
|
117
124
|
subMenuActions={this.props.subMenuActions}
|
|
118
125
|
instanceId={this.props.instanceId}
|
|
119
126
|
toolbarActionHandler={this.props.toolbarActionHandler}
|
|
120
|
-
closeSubArea={this.
|
|
127
|
+
closeSubArea={this.closeSubArea}
|
|
121
128
|
setToolbarFocusAction={this.props.setToolbarFocusAction}
|
|
122
129
|
actionItemRect={actionItemRect}
|
|
123
130
|
expandDirection={"vertical"}
|
|
@@ -168,7 +175,8 @@ ToolbarOverflowItem.propTypes = {
|
|
|
168
175
|
containingDivId: PropTypes.string,
|
|
169
176
|
toolbarFocusAction: PropTypes.string,
|
|
170
177
|
setToolbarFocusAction: PropTypes.func,
|
|
171
|
-
isFocusInToolbar: PropTypes.bool
|
|
178
|
+
isFocusInToolbar: PropTypes.bool,
|
|
179
|
+
closeAnyOpenSubArea: PropTypes.func
|
|
172
180
|
};
|
|
173
181
|
|
|
174
182
|
export default ToolbarOverflowItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2017-
|
|
2
|
+
* Copyright 2017-2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -62,9 +62,9 @@ class ToolbarSubMenuItem extends React.Component {
|
|
|
62
62
|
clickOutside(evt) {
|
|
63
63
|
if (this.state.subAreaDisplayed) {
|
|
64
64
|
const items = document.getElementsByClassName(this.generateActionName());
|
|
65
|
-
const isOver = items
|
|
65
|
+
const isOver = items?.length > 0 ? items[0].contains(evt.target) : false;
|
|
66
66
|
|
|
67
|
-
if (!isOver) {
|
|
67
|
+
if (!isOver && !this.props.actionObj.leaveSubAreaOpenOnClickOutside) {
|
|
68
68
|
this.closeSubArea();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -93,14 +93,14 @@ class ToolbarSubMenuItem extends React.Component {
|
|
|
93
93
|
} else {
|
|
94
94
|
evt.stopPropagation();
|
|
95
95
|
if (this.props.isInCascadeMenu) {
|
|
96
|
-
this.props.closeParentSubArea();
|
|
96
|
+
this.props.closeParentSubArea(true); // true = close only if closeSubAreaOnClick is checked
|
|
97
97
|
this.props.setSubMenuFocus();
|
|
98
98
|
|
|
99
99
|
} else if (this.props.isInOverflowMenu) {
|
|
100
100
|
this.props.setSubMenuFocus(this.props.actionObj.action);
|
|
101
101
|
|
|
102
102
|
} else {
|
|
103
|
-
this.props.closeParentSubArea();
|
|
103
|
+
this.props.closeParentSubArea(true); // true = close only if closeSubAreaOnClick is checked
|
|
104
104
|
this.props.setToolbarFocusAction(); // Resets the toolbar focus action
|
|
105
105
|
}
|
|
106
106
|
this.props.toolbarActionHandler(this.props.actionObj.action, evt);
|
|
@@ -210,6 +210,7 @@ ToolbarSubMenuItem.propTypes = {
|
|
|
210
210
|
isSelected: PropTypes.bool,
|
|
211
211
|
kind: PropTypes.string,
|
|
212
212
|
closeSubAreaOnClick: PropTypes.bool,
|
|
213
|
+
leaveSubAreaOpenOnClickOutside: PropTypes.bool,
|
|
213
214
|
subMenu: PropTypes.array,
|
|
214
215
|
subPanel: PropTypes.any,
|
|
215
216
|
subPanelData: PropTypes.object,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2024 Elyra Authors
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -35,8 +35,6 @@ class ToolbarSubMenu extends React.Component {
|
|
|
35
35
|
focusAction: "subarea"
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
this.areaRef = React.createRef();
|
|
39
|
-
|
|
40
38
|
this.onKeyDown = this.onKeyDown.bind(this);
|
|
41
39
|
this.setFocusAction = this.setFocusAction.bind(this);
|
|
42
40
|
this.setSubMenuFocus = this.setSubMenuFocus.bind(this);
|
|
@@ -143,7 +141,7 @@ class ToolbarSubMenu extends React.Component {
|
|
|
143
141
|
const focusableActions = [];
|
|
144
142
|
|
|
145
143
|
for (let i = 0; i < this.props.subMenuActions.length; i++) {
|
|
146
|
-
if (this.props.subMenuActions[i].enable) {
|
|
144
|
+
if (this.props.subMenuActions[i].enable || this.props.subMenuActions[i].jsx) {
|
|
147
145
|
focusableActions.push(this.props.subMenuActions[i]);
|
|
148
146
|
}
|
|
149
147
|
}
|
|
@@ -224,7 +222,7 @@ class ToolbarSubMenu extends React.Component {
|
|
|
224
222
|
this.subMenuItems = this.generateSubMenuItems();
|
|
225
223
|
|
|
226
224
|
return (
|
|
227
|
-
<div ref={this.areaRef} style={style} className={"toolbar-popover-list submenu"}
|
|
225
|
+
<div ref={(ref) => (this.areaRef = ref)} style={style} className={"toolbar-popover-list submenu"}
|
|
228
226
|
tabIndex={-1} onKeyDown={this.onKeyDown}
|
|
229
227
|
>
|
|
230
228
|
{this.subMenuItems}
|
|
@@ -242,7 +240,7 @@ ToolbarSubMenu.propTypes = {
|
|
|
242
240
|
closeSubArea: PropTypes.func,
|
|
243
241
|
setToolbarFocusAction: PropTypes.func,
|
|
244
242
|
setSubMenuFocus: PropTypes.func,
|
|
245
|
-
actionItemRect: PropTypes.object
|
|
243
|
+
actionItemRect: PropTypes.object,
|
|
246
244
|
expandDirection: PropTypes.string.isRequired,
|
|
247
245
|
containingDivId: PropTypes.string,
|
|
248
246
|
parentSelector: PropTypes.string,
|