@elyra/canvas 12.26.0 → 12.27.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/{canvas-controller-df16f0fa.js → canvas-controller-01c28c3a.js} +2 -2
- package/dist/canvas-controller-01c28c3a.js.map +1 -0
- package/dist/{canvas-controller-fefee807.js → canvas-controller-fc5bee30.js} +2 -2
- package/dist/canvas-controller-fc5bee30.js.map +1 -0
- package/dist/canvas-logger-27d3180d.js.map +1 -1
- package/dist/canvas-logger-bb537fb3.js.map +1 -1
- package/dist/common-canvas-4f99983f.js +2 -0
- package/dist/common-canvas-4f99983f.js.map +1 -0
- package/dist/common-canvas-e1879d85.js +2 -0
- package/dist/common-canvas-e1879d85.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-9a5037f4.js +2 -0
- package/dist/common-properties-9a5037f4.js.map +1 -0
- package/dist/common-properties-cae41b08.js +2 -0
- package/dist/common-properties-cae41b08.js.map +1 -0
- package/dist/datarecord-metadata-v3-schema-6a3754ce.js.map +1 -1
- package/dist/datarecord-metadata-v3-schema-ba1f2849.js.map +1 -1
- package/dist/{extends-841b39ac.js → extends-86f8d713.js} +2 -2
- package/dist/extends-86f8d713.js.map +1 -0
- package/dist/{extends-a9c1b4cd.js → extends-de3127ea.js} +2 -2
- package/dist/extends-de3127ea.js.map +1 -0
- package/dist/flexible-table-d68c24c6.js +2 -0
- package/dist/flexible-table-d68c24c6.js.map +1 -0
- package/dist/flexible-table-f14863ac.js +2 -0
- package/dist/flexible-table-f14863ac.js.map +1 -0
- package/dist/icon-63afae46.js +2 -0
- package/dist/icon-63afae46.js.map +1 -0
- package/dist/icon-94bf4b86.js +2 -0
- package/dist/icon-94bf4b86.js.map +1 -0
- package/dist/{index-5d62eee8.js → index-5c0ad9bb.js} +2 -2
- package/dist/{index-5d62eee8.js.map → index-5c0ad9bb.js.map} +1 -1
- package/dist/{index-c8a96051.js → index-fc1b32b4.js} +2 -2
- package/dist/{index-c8a96051.js.map → index-fc1b32b4.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.map +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.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/lib/tooltip.es.js.map +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-96922752.js → toolbar-393d299e.js} +2 -2
- package/dist/{toolbar-c8779b93.js.map → toolbar-393d299e.js.map} +1 -1
- package/dist/{toolbar-c8779b93.js → toolbar-91001066.js} +2 -2
- package/dist/{toolbar-96922752.js.map → toolbar-91001066.js.map} +1 -1
- package/locales/command-actions/locales/de.json +1 -1
- package/locales/command-actions/locales/es.json +9 -9
- package/locales/command-actions/locales/fr.json +9 -9
- package/locales/command-actions/locales/it.json +9 -9
- package/locales/command-actions/locales/ja.json +1 -1
- package/locales/command-actions/locales/ko.json +1 -1
- package/locales/command-actions/locales/pt-br.json +9 -9
- package/locales/command-actions/locales/sv.json +1 -1
- package/locales/command-actions/locales/zh-CN.json +1 -1
- package/locales/command-actions/locales/zh-TW.json +1 -1
- package/locales/common-canvas/locales/de.json +2 -1
- package/locales/common-canvas/locales/es.json +1 -0
- package/locales/common-canvas/locales/fr.json +2 -1
- package/locales/common-canvas/locales/it.json +2 -1
- package/locales/common-canvas/locales/ja.json +2 -1
- package/locales/common-canvas/locales/ko.json +2 -1
- package/locales/common-canvas/locales/pt-br.json +4 -3
- package/locales/common-canvas/locales/sv.json +1 -0
- package/locales/common-canvas/locales/zh-CN.json +2 -1
- package/locales/common-canvas/locales/zh-TW.json +2 -1
- package/locales/common-properties/locales/de.json +11 -7
- package/locales/common-properties/locales/en.json +3 -3
- package/locales/common-properties/locales/eo.json +3 -3
- package/locales/common-properties/locales/es.json +11 -7
- package/locales/common-properties/locales/fr.json +8 -4
- package/locales/common-properties/locales/it.json +8 -4
- package/locales/common-properties/locales/ja.json +7 -3
- package/locales/common-properties/locales/ko.json +8 -4
- package/locales/common-properties/locales/pt-br.json +10 -6
- package/locales/common-properties/locales/sv.json +7 -3
- package/locales/common-properties/locales/zh-CN.json +9 -5
- package/locales/common-properties/locales/zh-TW.json +7 -3
- package/locales/notification-panel/locales/en.json +3 -0
- package/locales/notification-panel/locales/eo.json +3 -0
- package/locales/palette/locales/it.json +2 -2
- package/locales/toolbar/locales/it.json +2 -2
- package/package.json +1 -1
- package/src/common-canvas/canvas-controller.js +10 -1
- package/src/common-canvas/cc-central-items.jsx +5 -1
- package/src/common-canvas/cc-top-panel.jsx +66 -0
- package/src/common-canvas/common-canvas.jsx +6 -2
- package/src/common-canvas/common-canvas.scss +26 -7
- package/src/common-canvas/svg-canvas-d3.scss +0 -4
- package/src/common-canvas/svg-canvas-renderer.js +23 -13
- package/src/common-properties/common-properties.jsx +5 -3
- package/src/common-properties/components/control-item/control-item.jsx +4 -3
- package/src/common-properties/components/control-item/control-item.scss +1 -0
- package/src/common-properties/components/editor-form/editor-form.jsx +1 -0
- package/src/common-properties/components/virtualized-table/virtualized-table.jsx +11 -9
- package/src/common-properties/constants/constants.js +2 -2
- package/src/common-properties/controls/dropdown/dropdown.jsx +3 -3
- package/src/common-properties/form/ControlInfo.js +0 -3
- package/src/common-properties/form/EditorForm.js +2 -3
- package/src/common-properties/form/ParameterInfo.js +1 -18
- package/src/common-properties/panels/subtabs/subtabs.jsx +1 -0
- package/src/common-properties/panels/tearsheet/tearsheet.jsx +1 -0
- package/src/common-properties/properties-main/properties-main.jsx +7 -6
- package/src/notification-panel/notification-panel.jsx +19 -3
- package/src/notification-panel/notification-panel.scss +5 -5
- package/src/object-model/object-model.js +13 -1
- package/src/object-model/redux/canvas-store.js +10 -3
- package/src/object-model/redux/reducers/toppanel.js +29 -0
- package/src/tooltip/tooltip.scss +1 -0
- package/stats.html +1 -1
- package/dist/canvas-controller-df16f0fa.js.map +0 -1
- package/dist/canvas-controller-fefee807.js.map +0 -1
- package/dist/common-canvas-55d075fe.js +0 -2
- package/dist/common-canvas-55d075fe.js.map +0 -1
- package/dist/common-canvas-e8a7a840.js +0 -2
- package/dist/common-canvas-e8a7a840.js.map +0 -1
- package/dist/common-properties-97261017.js +0 -2
- package/dist/common-properties-97261017.js.map +0 -1
- package/dist/common-properties-f596260f.js +0 -2
- package/dist/common-properties-f596260f.js.map +0 -1
- package/dist/extends-841b39ac.js.map +0 -1
- package/dist/extends-a9c1b4cd.js.map +0 -1
- package/dist/flexible-table-d4bd5c25.js +0 -2
- package/dist/flexible-table-d4bd5c25.js.map +0 -1
- package/dist/flexible-table-f7b58f99.js +0 -2
- package/dist/flexible-table-f7b58f99.js.map +0 -1
- package/dist/icon-4a6f3dad.js +0 -2
- package/dist/icon-4a6f3dad.js.map +0 -1
- package/dist/icon-f6f2bffc.js +0 -2
- package/dist/icon-f6f2bffc.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as t}from"../createClass-be661622.js";import{_ as n,a as o,b as r,c}from"../getPrototypeOf-3751add9.js";import i from"react";import{_ as a,C as l}from"../canvas-constants-ba465147.js";import{_ as u}from"../extends-
|
|
1
|
+
import{_ as e,a as t}from"../createClass-be661622.js";import{_ as n,a as o,b as r,c}from"../getPrototypeOf-3751add9.js";import i from"react";import{_ as a,C as l}from"../canvas-constants-ba465147.js";import{_ as u}from"../extends-de3127ea.js";import{MenuItem as s,SubMenu as d}from"react-contextmenu";import{I as m}from"../icon-94bf4b86.js";import{L as f}from"../canvas-logger-27d3180d.js";import"react-inlinesvg";import"@carbon/icons-react";function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,c=o(e);if(t){var i=o(this).constructor;n=Reflect.construct(c,arguments,i)}else n=c.apply(this,arguments);return r(this,n)}}var h=function(o){n(a,o);var r=p(a);function a(t){var n;return e(this,a),(n=r.call(this,t)).logger=new f("CC-ContextMenu"),n.onClick=n.onClick.bind(c(n)),n}return t(a,[{key:"onClick",value:function(e){var t=e.target.dataset.color;this.props.clickActionHandler(t)}},{key:"render",value:function(){return this.logger.log("render"),i.createElement("div",{className:"color-picker-panel",onClick:this.onClick},i.createElement("div",{tabIndex:"0","data-color":"bkg-col-white-0",className:"color-picker-item white-0"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-yellow-20",className:"color-picker-item yellow-20"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-gray-20",className:"color-picker-item gray-20"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-green-20",className:"color-picker-item green-20"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-teal-20",className:"color-picker-item teal-20"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-cyan-20",className:"color-picker-item cyan-20"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-red-50",className:"color-picker-item red-50"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-orange-40",className:"color-picker-item orange-40"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-gray-50",className:"color-picker-item gray-50"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-green-50",className:"color-picker-item green-50"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-teal-50",className:"color-picker-item teal-50"}),i.createElement("div",{tabIndex:"0","data-color":"bkg-col-cyan-50",className:"color-picker-item cyan-50"}))}}]),a}(i.Component);function v(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,c=o(e);if(t){var i=o(this).constructor;n=Reflect.construct(c,arguments,i)}else n=c.apply(this,arguments);return r(this,n)}}var k=function(o){n(f,o);var r=v(f);function f(t){var n;return e(this,f),(n=r.call(this,t)).state={},n.itemSelected=n.itemSelected.bind(c(n)),n.colorClicked=n.colorClicked.bind(c(n)),n}return t(f,[{key:"onContextMenu",value:function(e){e.preventDefault()}},{key:"itemSelected",value:function(e,t){this.props.contextHandler(e),t&&t.stopPropagation()}},{key:"colorClicked",value:function(e){this.props.contextHandler("colorSelectedObjects",{color:e})}},{key:"calculateMenuSize",value:function(e){for(var t=0,n=0;n<e.length;++n){e[n].divider&&t++}return{height:30*(e.length-t)+1*t,width:160}}},{key:"calculateMenuPos",value:function(e,t,n){var o={x:e.x,y:e.y};return e.y+t.height>n.height&&(o.y=n.height-t.height-5,o.y<0&&(o.y=0)),e.x+t.width>n.width&&(o.x-=t.width),o.x+=1,o.y+=1,o}},{key:"areAllSubmenuItemsDisabled",value:function(e){var t=0,n=0;return e.forEach((function(e){e.divider||t++,!1===e.enable&&n++})),n===t}},{key:"buildMenu",value:function(e,t,n,o){for(var r={className:"contextmenu-divider"},c=[],a=0,l=!1,d=0;d<e.length;++d){var m=e[d].divider,f=e[d].submenu;if(m)l||(c.push(i.createElement(s,{attributes:r,key:d+1,onClick:function(){},divider:!0})),a+=1,l=!0);else if(f)if(l=!1,"colorPicker"===e[d].menu){var p={width:160,height:50},h=this.buildColorPickerPanel(),v=this.buildSubMenu(e,d,h,a,n,t,p,o,!1);c.push(v),a+=30}else{var k={disabled:this.areAllSubmenuItemsDisabled(e[d].menu)},y=this.calculateMenuSize(e[d].menu),b=this.buildMenu(e[d].menu,t,n,o),g=this.buildSubMenu(e,d,b,a,n,t,y,o,k);c.push(g),a+=30}else{l=!1;var x={disabled:!1===e[d].enable};c.push(i.createElement(s,u({onClick:this.itemSelected.bind(null,e[d].action),key:d+1},x),e[d].label)),a+=30}}return c}},{key:"buildColorPickerPanel",value:function(){return i.createElement(h,a({clickActionHandler:this.colorPickHandler},"clickActionHandler",this.colorClicked))}},{key:"buildSubMenu",value:function(e,t,n,o,r,c,a,s,f){var p=this.buildRtlState(r,c,a,s),h=this.buildSubMenuPosStyle(o,r,a,s),v=i.createElement(m,{type:l.CHEVRONARROWS.RIGHT,disabled:!1,className:"react-contextmenu-submenu-icon"}),k=i.createElement("div",null,e[t].label,v," ");return i.createElement(d,u({title:k,key:t+1,className:"contextmenu-submenu",rtl:p},f),i.createElement("div",{key:t+1,style:h,className:"context-menu-popover"},n))}},{key:"buildRtlState",value:function(e,t,n,o){return e.x+t.width+n.width>o.right}},{key:"buildSubMenuPosStyle",value:function(e,t,n,o){var r=o.bottom-(t.y+e+n.height);return{top:(r>0?0:r-5)+"px"}}},{key:"render",value:function(){var e=this.calculateMenuSize(this.props.menuDefinition),t=this.calculateMenuPos(this.props.mousePos,e,this.props.canvasRect),n={left:t.x+"px",top:t.y+"px"},o=this.buildMenu(this.props.menuDefinition,e,t,this.props.canvasRect);return i.createElement("div",{id:"context-menu-popover",className:"context-menu-popover",style:n,onContextMenu:this.onContextMenu},o)}}]),f}(i.Component);function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,c=o(e);if(t){var i=o(this).constructor;n=Reflect.construct(c,arguments,i)}else n=c.apply(this,arguments);return r(this,n)}}var b=function(o){n(a,o);var r=y(a);function a(t){var n;return e(this,a),(n=r.call(this,t)).state={},n.contextMenuClicked=n.contextMenuClicked.bind(c(n)),n.handleClickOutside=n.handleClickOutside.bind(c(n)),n}return t(a,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0)}},{key:"getCanvasRect",value:function(){var e=document.getElementById(this.props.containingDivId).getBoundingClientRect();return{top:0,bottom:e.bottom-e.top,left:0,right:e.right-e.left,height:e.height,width:e.width}}},{key:"handleClickOutside",value:function(e){e.ctrlKey?e.stopPropagation():this.isOverContextMenu(e)||this.isOverEllipsisButton(e)||(this.props.stopPropagation&&e.stopPropagation(),this.props.closeContextMenu())}},{key:"isOverContextMenu",value:function(e){var t=document.getElementById("context-menu-popover");return!t||t.contains(e.target)}},{key:"isOverEllipsisButton",value:function(e){for(var t=document.getElementsByClassName("d3-node-ellipsis-group"),n=!1,o=0;o<t.length;o++)!1===n&&t[o].contains(e.target)&&(n=!0);return n}},{key:"contextMenuClicked",value:function(e,t){this.props.contextMenuActionHandler(e,t)}},{key:"render",value:function(){return i.createElement(k,{contextHandler:this.contextMenuClicked,menuDefinition:this.props.contextMenuDef,canvasRect:this.getCanvasRect(),mousePos:this.props.contextMenuPos})}}]),a}(i.Component);export{b as default};
|
|
2
2
|
//# sourceMappingURL=context-menu.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.es.js","sources":["../../src/color-picker/color-picker-panel.jsx","../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.jsx"],"sourcesContent":["/*\n * Copyright 2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport Logger from \"../logging/canvas-logger.js\";\n\n\nclass ColorPickerPanel extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.logger = new Logger(\"CC-ContextMenu\");\n\n\t\tthis.onClick = this.onClick.bind(this);\n\t}\n\n\tonClick(evt) {\n\t\tconst color = evt.target.dataset.color;\n\t\tthis.props.clickActionHandler(color);\n\t}\n\n\trender() {\n\t\tthis.logger.log(\"render\");\n\t\treturn (\n\t\t\t<div className=\"color-picker-panel\" onClick={this.onClick}>\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-white-0\"} className=\"color-picker-item white-0\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-yellow-20\"} className=\"color-picker-item yellow-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-20\"} className=\"color-picker-item gray-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-20\"} className=\"color-picker-item green-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-20\"} className=\"color-picker-item teal-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-20\"} className=\"color-picker-item cyan-20\" />\n\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-red-50\"} className=\"color-picker-item red-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-orange-40\"} className=\"color-picker-item orange-40\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-50\"} className=\"color-picker-item gray-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-50\"} className=\"color-picker-item green-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-50\"} className=\"color-picker-item teal-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-50\"} className=\"color-picker-item cyan-50\" />\n\t\t\t</div>);\n\t}\n}\n\nColorPickerPanel.propTypes = {\n\tclickActionHandler: PropTypes.func.isRequired,\n\tcloseMenu: PropTypes.func\n};\n\nexport default ColorPickerPanel;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-empty-function: [\"error\", { \"allow\": [\"arrowFunctions\"] }] */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { MenuItem, SubMenu } from \"react-contextmenu\";\nimport Icon from \"../icons/icon.jsx\";\nimport { CONTEXT_MENU_CARBON_ICONS } from \"../common-canvas/constants/canvas-constants\";\nimport ColorPickerPanel from \"../color-picker/color-picker-panel.jsx\";\n\n// context-menu sizing\nconst CONTEXT_MENU_WIDTH = 160; // see context-menu.css .react-context-menu margin\nconst CONTEXT_MENU_LINK_HEIGHT = 30; // see context-menu.css .react-context-menu-item height\nconst CONTEXT_MENU_DIVIDER_HEIGHT = 1; // see context-menu.css .react-context-menu-item height\nconst EXTRA_OFFSET = 5; // Extra offset for vertical menu positioning\n\n\nclass CommonContextMenu extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\t\tthis.itemSelected = this.itemSelected.bind(this);\n\t\tthis.colorClicked = this.colorClicked.bind(this);\n\t}\n\n\tonContextMenu(e) {\n\t\te.preventDefault();\n\t}\n\n\titemSelected(data, selectedEvent) {\n\t\tthis.props.contextHandler(data);\n\t\t// This stops the canvasClicked function from being fired which would\n\t\t// clear any current selections.\n\t\tif (selectedEvent) {\n\t\t\tselectedEvent.stopPropagation();\n\t\t}\n\t}\n\n\tcolorClicked(color) {\n\t\tthis.props.contextHandler(\"colorSelectedObjects\", { color });\n\t}\n\n\tcalculateMenuSize(menu) {\n\t\tvar numDividers = 0;\n\t\tfor (let i = 0; i < menu.length; ++i) {\n\t\t\tconst divider = menu[i].divider;\n\t\t\tif (divider) {\n\t\t\t\tnumDividers++;\n\t\t\t}\n\t\t}\n\n\t\tvar menuSize = {\n\t\t\theight: ((menu.length - numDividers) * CONTEXT_MENU_LINK_HEIGHT) + (numDividers * CONTEXT_MENU_DIVIDER_HEIGHT),\n\t\t\twidth: CONTEXT_MENU_WIDTH\n\t\t};\n\n\t\treturn menuSize;\n\t}\n\n\t// Returns a new position and the canvas rectangle for the context menu based on the current\n\t// mouse position and whether the menu would appear outside the edges of the page.\n\tcalculateMenuPos(mousePos, menuSize, canvasRect) {\n\t\tconst menuPos = { x: mousePos.x, y: mousePos.y };\n\n\t\t// Reposition contextMenu if it will show off the bottom of the page\n\t\tif (mousePos.y + menuSize.height > canvasRect.height) {\n\t\t\tmenuPos.y = canvasRect.height - menuSize.height - EXTRA_OFFSET; // Move up by extra offset so it looks nice\n\n\t\t\t// If repositioning the menu would push it off the top of the page\n\t\t\t// (in very short browser windows) position it at the top.\n\t\t\tif (menuPos.y < 0) {\n\t\t\t\tmenuPos.y = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Reposition contextMenu if it will show off the right of the page\n\t\tif (mousePos.x + menuSize.width > canvasRect.width) {\n\t\t\tmenuPos.x -= menuSize.width;\n\t\t}\n\n\t\t// Add a pixel to x and y because on Chrome without this the context menu\n\t\t// appears with the top corner of the first menu item under the mouse\n\t\t// cursor. This highlights the first menu item (which looks weird) and, if\n\t\t// the first item is a cascade menu, automatically opens the sub-menu.\n\t\tmenuPos.x += 1;\n\t\tmenuPos.y += 1;\n\n\t\treturn menuPos;\n\t}\n\n\tareAllSubmenuItemsDisabled(submenuItems) {\n\t\tlet itemCount = 0;\n\t\tlet disabledCount = 0;\n\t\tsubmenuItems.forEach(function(submenuItem) {\n\t\t\tif (!submenuItem.divider) {\n\t\t\t\titemCount++;\n\t\t\t}\n\t\t\tif (submenuItem.enable === false) {\n\t\t\t\tdisabledCount++;\n\t\t\t}\n\t\t});\n\t\treturn disabledCount === itemCount;\n\t}\n\n\tbuildMenu(menuDefinition, menuSize, menuPos, canvasRect) {\n\t\tconst customDivider = {\n\t\t\tclassName: \"contextmenu-divider\"\n\t\t};\n\n\t\tconst menuItems = [];\n\n\t\tlet runningYPos = 0;\n\t\t// Records if we have just displayed a divider. This is useful because we\n\t\t// only want to display one divider if there is a divider element\n\t\t// immediately after another divider element in the menuDefintion array.\n\t\tlet previousDivider = false;\n\n\t\tfor (let i = 0; i < menuDefinition.length; ++i) {\n\t\t\tconst divider = menuDefinition[i].divider;\n\t\t\tconst submenu = menuDefinition[i].submenu;\n\n\t\t\tif (divider) {\n\t\t\t\tif (!previousDivider) {\n\t\t\t\t\tmenuItems.push(<MenuItem attributes={customDivider} key={i + 1} onClick={() => {}} divider />);\n\t\t\t\t\trunningYPos += CONTEXT_MENU_DIVIDER_HEIGHT;\n\t\t\t\t\tpreviousDivider = true;\n\t\t\t\t}\n\n\t\t\t} else if (submenu) {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tif (menuDefinition[i].menu === \"colorPicker\") {\n\t\t\t\t\tconst disabled = false;\n\t\t\t\t\tconst subMenuSize = { width: CONTEXT_MENU_WIDTH, height: 50 };\n\t\t\t\t\tconst subMenuContent = this.buildColorPickerPanel();\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\n\t\t\t\t} else {\n\t\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\t\tconst subMenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\t\tconst subMenuContent = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tconst disabled = { disabled: menuDefinition[i].enable === false };\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<MenuItem onClick={this.itemSelected.bind(null, menuDefinition[i].action)} key={i + 1} {...disabled}>\n\t\t\t\t\t\t{menuDefinition[i].label}\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t}\n\t\t}\n\t\treturn menuItems;\n\t}\n\n\tbuildColorPickerPanel() {\n\t\treturn (\n\t\t\t<ColorPickerPanel clickActionHandler={this.colorPickHandler} clickActionHandler={this.colorClicked} />\n\t\t);\n\t}\n\n\tbuildSubMenu(menuDefinition, index, subMenuContent, runningYPos, menuPos,\n\t\tmenuSize, subMenuSize, canvasRect, disabled) {\n\t\tconst rtl = this.buildRtlState(menuPos, menuSize, subMenuSize, canvasRect);\n\t\tconst subMenuPosStyle = this.buildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect);\n\n\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\tconst menuItem = <div>{menuDefinition[index].label}{icon} </div>;\n\n\t\treturn (\n\t\t\t<SubMenu title={menuItem} key={index + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t<div key={index + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t{subMenuContent}\n\t\t\t\t</div>\n\t\t\t</SubMenu>\n\t\t);\n\t}\n\n\t// Returns a boolean to indicate whether the submenu should appear on the\n\t// right of the context menu (rtl === false) or on the left of the context\n\t// menu (rtl === true).\n\tbuildRtlState(menuPos, menuSize, subMenuSize, canvasRect) {\n\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\treturn (menuPos.x + menuSize.width + subMenuSize.width > canvasRect.right);\n\n\t}\n\n\t// Returns a style object that can be applied to the sub-menu to adjust\n\t// its vertical (y) position. This may be necessary if the submenu is tall\n\t// enough that it would be displayed off the bottom of the canvas area.\n\tbuildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect) {\n\t\t// Does the submenu go below the bottom of the viewport?\n\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + subMenuSize.height);\n\n\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t// submenu up fully into the view port.\n\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\tconst subMenuPosStyle = {\n\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t};\n\t\treturn subMenuPosStyle;\n\t}\n\n\trender() {\n\t\t// Reposition contextMenu so that it does not show off the screen\n\t\tconst menuSize = this.calculateMenuSize(this.props.menuDefinition);\n\t\tconst menuPos = this.calculateMenuPos(this.props.mousePos, menuSize, this.props.canvasRect);\n\t\tconst posStyle = {\n\t\t\tleft: menuPos.x + \"px\",\n\t\t\ttop: menuPos.y + \"px\"\n\t\t};\n\n\t\tconst menuItems = this.buildMenu(this.props.menuDefinition, menuSize, menuPos, this.props.canvasRect);\n\n\t\treturn (\n\t\t\t<div id=\"context-menu-popover\" className=\"context-menu-popover\" style={posStyle} onContextMenu={this.onContextMenu}>\n\t\t\t\t{menuItems}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nCommonContextMenu.propTypes = {\n\tcontextHandler: PropTypes.func.isRequired,\n\tmenuDefinition: PropTypes.array.isRequired,\n\tcanvasRect: PropTypes.object.isRequired,\n\tmousePos: PropTypes.object.isRequired\n};\n\nexport default CommonContextMenu;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport CommonContextMenu from \"./common-context-menu.jsx\";\n\nexport default class ContextMenuWrapper extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\n\t\tthis.contextMenuClicked = this.contextMenuClicked.bind(this);\n\t\tthis.handleClickOutside = this.handleClickOutside.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\tdocument.addEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tdocument.removeEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\t// Returns an object that describes the dimensions of a rectangle for the\n\t// canvas div with coordinates based on the top left corner of the div. This\n\t// will match the coordinates for the mouse position where the user clicked,\n\t// which is specified in this.props.contextMenuPos object.\n\tgetCanvasRect() {\n\t\tconst containingDiv = document.getElementById(this.props.containingDivId);\n\t\tconst clientRect = containingDiv.getBoundingClientRect();\n\t\tconst canvasRect = {\n\t\t\ttop: 0,\n\t\t\tbottom: clientRect.bottom - clientRect.top,\n\t\t\tleft: 0,\n\t\t\tright: clientRect.right - clientRect.left,\n\t\t\theight: clientRect.height,\n\t\t\twidth: clientRect.width\n\t\t};\n\n\t\treturn canvasRect;\n\t}\n\n\thandleClickOutside(e) {\n\t\t// On Safari, when a user is displaying the context menu with a ctrl-click\n\t\t// (which is a supported context menu gesture on the Mac) a secondary click\n\t\t// event is emmitted which is received here with the ctrlKey field enabled.\n\t\t// So we ignore that event otherwse, if we continue, the context menu will\n\t\t// be closed.\n\t\tif (e.ctrlKey) {\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\t// If the click was anywhere outside the context menu and\n\t\t// the ellipsis button we just close the menu.\n\t\tif (!this.isOverContextMenu(e) && !this.isOverEllipsisButton(e)) {\n\t\t\t// This stop propagation is needed in common canvas so that selected nodes will\n\t\t\t// remain selected even after clicking outside the context menu to close the menu.\n\t\t\tif (this.props.stopPropagation) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t\tthis.props.closeContextMenu();\n\t\t}\n\t}\n\n\t// Retruns true if the event occurred over the context menu.\n\tisOverContextMenu(e) {\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\treturn !domNode || domNode.contains(e.target);\n\t}\n\n\t// Returns true if the event occurred over the ellipsis button. Typically\n\t// there will be only one ellipsis button on the canvas, since they are only\n\t// displayed on hover, but in some test cicumstances there might be more\n\t// than one.\n\tisOverEllipsisButton(e) {\n\t\tconst ellipsisNodes = document.getElementsByClassName(\"d3-node-ellipsis-group\");\n\t\tlet state = false;\n\t\tfor (let i = 0; i < ellipsisNodes.length; i++) {\n\t\t\tif (state === false && ellipsisNodes[i].contains(e.target)) {\n\t\t\t\tstate = true;\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t}\n\n\tcontextMenuClicked(action, param) {\n\t\tthis.props.contextMenuActionHandler(action, param);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<CommonContextMenu\n\t\t\t\tcontextHandler={this.contextMenuClicked}\n\t\t\t\tmenuDefinition={this.props.contextMenuDef}\n\t\t\t\tcanvasRect={this.getCanvasRect()}\n\t\t\t\tmousePos={this.props.contextMenuPos}\n\t\t\t/>\n\t\t);\n\t}\n}\n\nContextMenuWrapper.propTypes = {\n\tcontextMenuDef: PropTypes.array.isRequired,\n\tcontainingDivId: PropTypes.string.isRequired,\n\tcontextMenuPos: PropTypes.object.isRequired,\n\tcontextMenuActionHandler: PropTypes.func.isRequired,\n\tcloseContextMenu: PropTypes.func.isRequired,\n\tstopPropagation: PropTypes.bool\n};\n"],"names":["_inherits","props","_classCallCheck","_this","logger","Logger","onClick","bind","_createClass","key","value","evt","color","target","dataset","this","clickActionHandler","log","React","className","tabIndex","Component","state","itemSelected","colorClicked","e","preventDefault","data","selectedEvent","contextHandler","stopPropagation","menu","numDividers","i","length","divider","height","width","mousePos","menuSize","canvasRect","menuPos","x","y","submenuItems","itemCount","disabledCount","forEach","submenuItem","enable","menuDefinition","customDivider","menuItems","runningYPos","previousDivider","submenu","push","MenuItem","attributes","subMenuSize","subMenuContent","buildColorPickerPanel","subMenu","buildSubMenu","disabled","areAllSubmenuItemsDisabled","calculateMenuSize","buildMenu","action","label","ColorPickerPanel","colorPickHandler","index","rtl","buildRtlState","subMenuPosStyle","buildSubMenuPosStyle","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","SubMenu","title","style","right","bottom","top","calculateMenuPos","posStyle","left","id","onContextMenu","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","ctrlKey","isOverContextMenu","isOverEllipsisButton","closeContextMenu","domNode","contains","ellipsisNodes","getElementsByClassName","param","contextMenuActionHandler","CommonContextMenu","contextMenuDef","getCanvasRect","contextMenuPos"],"mappings":"i2BAkBiD,kBAG3BA,OAAA,WACrB,WAAYC,GAAO,MAIqB,OAJrBC,WAClBC,cAAMF,IACDG,OAAS,IAAIC,EAAO,kBAEzBF,EAAKG,QAAUH,EAAKG,QAAQC,aA0B5B,OAzBAC,MAAAC,cAAAC,MAED,SAAQC,GACP,IAAMC,EAAQ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ExF,oBAAAC,MACA,WACC,IACM2F,EADgBH,SAASI,eAAevF,KAAKd,MAAMsG,iBACxBC,wBAUjC,MATmB,CAClBf,IAAK,EACLD,OAAQa,EAAWb,OAASa,EAAWZ,IACvCG,KAAM,EACNL,MAAOc,EAAWd,MAAQc,EAAWT,KACrCxD,OAAQiE,EAAWjE,OACnBC,MAAOgE,EAAWhE,UAInB5B,yBAAAC,MAED,SAAmBe,GAMdA,EAAEgF,QACLhF,EAAEK,kBAMEf,KAAK2F,kBAAkBjF,IAAOV,KAAK4F,qBAAqBlF,KAGxDV,KAAKd,MAAM6B,iBACdL,EAAEK,kBAEHf,KAAKd,MAAM2G,uBAIbnG,wBAAAC,MACA,SAAkBe,GACjB,IAAMoF,EAAUX,SAASI,eAAe,wBACxC,OAAQO,GAAWA,EAAQC,SAASrF,EAAEZ,WAMvCJ,2BAAAC,MACA,SAAqBe,GAGpB,IAFA,IAAMsF,EAAgBb,SAASc,uBAAuB,0BAClD1F,GAAQ,EACHW,EAAI,EAAGA,EAAI8E,EAAc7E,OAAQD,KAC3B,IAAVX,GAAmByF,EAAc9E,GAAG6E,SAASrF,EAAEZ,UAClDS,GAAQ,GAGV,OAAOA,KACPb,yBAAAC,MAED,SAAmB0D,EAAQ6C,GAC1BlG,KAAKd,MAAMiH,yBAAyB9C,EAAQ6C,MAC5CxG,aAAAC,MAED,WACC,OACCQ,gBAACiG,GACAtF,eAAgBd,KAAKiF,mBACrB9C,eAAgBnC,KAAKd,MAAMmH,eAC3B5E,WAAYzB,KAAKsG,gBACjB/E,SAAUvB,KAAKd,MAAMqH,sBAGvB,EA7F8CpG,EAAMG"}
|
|
1
|
+
{"version":3,"file":"context-menu.es.js","sources":["../../src/color-picker/color-picker-panel.jsx","../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.jsx"],"sourcesContent":["/*\n * Copyright 2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport Logger from \"../logging/canvas-logger.js\";\n\n\nclass ColorPickerPanel extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.logger = new Logger(\"CC-ContextMenu\");\n\n\t\tthis.onClick = this.onClick.bind(this);\n\t}\n\n\tonClick(evt) {\n\t\tconst color = evt.target.dataset.color;\n\t\tthis.props.clickActionHandler(color);\n\t}\n\n\trender() {\n\t\tthis.logger.log(\"render\");\n\t\treturn (\n\t\t\t<div className=\"color-picker-panel\" onClick={this.onClick}>\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-white-0\"} className=\"color-picker-item white-0\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-yellow-20\"} className=\"color-picker-item yellow-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-20\"} className=\"color-picker-item gray-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-20\"} className=\"color-picker-item green-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-20\"} className=\"color-picker-item teal-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-20\"} className=\"color-picker-item cyan-20\" />\n\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-red-50\"} className=\"color-picker-item red-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-orange-40\"} className=\"color-picker-item orange-40\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-50\"} className=\"color-picker-item gray-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-50\"} className=\"color-picker-item green-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-50\"} className=\"color-picker-item teal-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-50\"} className=\"color-picker-item cyan-50\" />\n\t\t\t</div>);\n\t}\n}\n\nColorPickerPanel.propTypes = {\n\tclickActionHandler: PropTypes.func.isRequired,\n\tcloseMenu: PropTypes.func\n};\n\nexport default ColorPickerPanel;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-empty-function: [\"error\", { \"allow\": [\"arrowFunctions\"] }] */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { MenuItem, SubMenu } from \"react-contextmenu\";\nimport Icon from \"../icons/icon.jsx\";\nimport { CONTEXT_MENU_CARBON_ICONS } from \"../common-canvas/constants/canvas-constants\";\nimport ColorPickerPanel from \"../color-picker/color-picker-panel.jsx\";\n\n// context-menu sizing\nconst CONTEXT_MENU_WIDTH = 160; // see context-menu.css .react-context-menu margin\nconst CONTEXT_MENU_LINK_HEIGHT = 30; // see context-menu.css .react-context-menu-item height\nconst CONTEXT_MENU_DIVIDER_HEIGHT = 1; // see context-menu.css .react-context-menu-item height\nconst EXTRA_OFFSET = 5; // Extra offset for vertical menu positioning\n\n\nclass CommonContextMenu extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\t\tthis.itemSelected = this.itemSelected.bind(this);\n\t\tthis.colorClicked = this.colorClicked.bind(this);\n\t}\n\n\tonContextMenu(e) {\n\t\te.preventDefault();\n\t}\n\n\titemSelected(data, selectedEvent) {\n\t\tthis.props.contextHandler(data);\n\t\t// This stops the canvasClicked function from being fired which would\n\t\t// clear any current selections.\n\t\tif (selectedEvent) {\n\t\t\tselectedEvent.stopPropagation();\n\t\t}\n\t}\n\n\tcolorClicked(color) {\n\t\tthis.props.contextHandler(\"colorSelectedObjects\", { color });\n\t}\n\n\tcalculateMenuSize(menu) {\n\t\tvar numDividers = 0;\n\t\tfor (let i = 0; i < menu.length; ++i) {\n\t\t\tconst divider = menu[i].divider;\n\t\t\tif (divider) {\n\t\t\t\tnumDividers++;\n\t\t\t}\n\t\t}\n\n\t\tvar menuSize = {\n\t\t\theight: ((menu.length - numDividers) * CONTEXT_MENU_LINK_HEIGHT) + (numDividers * CONTEXT_MENU_DIVIDER_HEIGHT),\n\t\t\twidth: CONTEXT_MENU_WIDTH\n\t\t};\n\n\t\treturn menuSize;\n\t}\n\n\t// Returns a new position and the canvas rectangle for the context menu based on the current\n\t// mouse position and whether the menu would appear outside the edges of the page.\n\tcalculateMenuPos(mousePos, menuSize, canvasRect) {\n\t\tconst menuPos = { x: mousePos.x, y: mousePos.y };\n\n\t\t// Reposition contextMenu if it will show off the bottom of the page\n\t\tif (mousePos.y + menuSize.height > canvasRect.height) {\n\t\t\tmenuPos.y = canvasRect.height - menuSize.height - EXTRA_OFFSET; // Move up by extra offset so it looks nice\n\n\t\t\t// If repositioning the menu would push it off the top of the page\n\t\t\t// (in very short browser windows) position it at the top.\n\t\t\tif (menuPos.y < 0) {\n\t\t\t\tmenuPos.y = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Reposition contextMenu if it will show off the right of the page\n\t\tif (mousePos.x + menuSize.width > canvasRect.width) {\n\t\t\tmenuPos.x -= menuSize.width;\n\t\t}\n\n\t\t// Add a pixel to x and y because on Chrome without this the context menu\n\t\t// appears with the top corner of the first menu item under the mouse\n\t\t// cursor. This highlights the first menu item (which looks weird) and, if\n\t\t// the first item is a cascade menu, automatically opens the sub-menu.\n\t\tmenuPos.x += 1;\n\t\tmenuPos.y += 1;\n\n\t\treturn menuPos;\n\t}\n\n\tareAllSubmenuItemsDisabled(submenuItems) {\n\t\tlet itemCount = 0;\n\t\tlet disabledCount = 0;\n\t\tsubmenuItems.forEach(function(submenuItem) {\n\t\t\tif (!submenuItem.divider) {\n\t\t\t\titemCount++;\n\t\t\t}\n\t\t\tif (submenuItem.enable === false) {\n\t\t\t\tdisabledCount++;\n\t\t\t}\n\t\t});\n\t\treturn disabledCount === itemCount;\n\t}\n\n\tbuildMenu(menuDefinition, menuSize, menuPos, canvasRect) {\n\t\tconst customDivider = {\n\t\t\tclassName: \"contextmenu-divider\"\n\t\t};\n\n\t\tconst menuItems = [];\n\n\t\tlet runningYPos = 0;\n\t\t// Records if we have just displayed a divider. This is useful because we\n\t\t// only want to display one divider if there is a divider element\n\t\t// immediately after another divider element in the menuDefintion array.\n\t\tlet previousDivider = false;\n\n\t\tfor (let i = 0; i < menuDefinition.length; ++i) {\n\t\t\tconst divider = menuDefinition[i].divider;\n\t\t\tconst submenu = menuDefinition[i].submenu;\n\n\t\t\tif (divider) {\n\t\t\t\tif (!previousDivider) {\n\t\t\t\t\tmenuItems.push(<MenuItem attributes={customDivider} key={i + 1} onClick={() => {}} divider />);\n\t\t\t\t\trunningYPos += CONTEXT_MENU_DIVIDER_HEIGHT;\n\t\t\t\t\tpreviousDivider = true;\n\t\t\t\t}\n\n\t\t\t} else if (submenu) {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tif (menuDefinition[i].menu === \"colorPicker\") {\n\t\t\t\t\tconst disabled = false;\n\t\t\t\t\tconst subMenuSize = { width: CONTEXT_MENU_WIDTH, height: 50 };\n\t\t\t\t\tconst subMenuContent = this.buildColorPickerPanel();\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\n\t\t\t\t} else {\n\t\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\t\tconst subMenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\t\tconst subMenuContent = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tconst disabled = { disabled: menuDefinition[i].enable === false };\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<MenuItem onClick={this.itemSelected.bind(null, menuDefinition[i].action)} key={i + 1} {...disabled}>\n\t\t\t\t\t\t{menuDefinition[i].label}\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t}\n\t\t}\n\t\treturn menuItems;\n\t}\n\n\tbuildColorPickerPanel() {\n\t\treturn (\n\t\t\t<ColorPickerPanel clickActionHandler={this.colorPickHandler} clickActionHandler={this.colorClicked} />\n\t\t);\n\t}\n\n\tbuildSubMenu(menuDefinition, index, subMenuContent, runningYPos, menuPos,\n\t\tmenuSize, subMenuSize, canvasRect, disabled) {\n\t\tconst rtl = this.buildRtlState(menuPos, menuSize, subMenuSize, canvasRect);\n\t\tconst subMenuPosStyle = this.buildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect);\n\n\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\tconst menuItem = <div>{menuDefinition[index].label}{icon} </div>;\n\n\t\treturn (\n\t\t\t<SubMenu title={menuItem} key={index + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t<div key={index + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t{subMenuContent}\n\t\t\t\t</div>\n\t\t\t</SubMenu>\n\t\t);\n\t}\n\n\t// Returns a boolean to indicate whether the submenu should appear on the\n\t// right of the context menu (rtl === false) or on the left of the context\n\t// menu (rtl === true).\n\tbuildRtlState(menuPos, menuSize, subMenuSize, canvasRect) {\n\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\treturn (menuPos.x + menuSize.width + subMenuSize.width > canvasRect.right);\n\n\t}\n\n\t// Returns a style object that can be applied to the sub-menu to adjust\n\t// its vertical (y) position. This may be necessary if the submenu is tall\n\t// enough that it would be displayed off the bottom of the canvas area.\n\tbuildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect) {\n\t\t// Does the submenu go below the bottom of the viewport?\n\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + subMenuSize.height);\n\n\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t// submenu up fully into the view port.\n\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\tconst subMenuPosStyle = {\n\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t};\n\t\treturn subMenuPosStyle;\n\t}\n\n\trender() {\n\t\t// Reposition contextMenu so that it does not show off the screen\n\t\tconst menuSize = this.calculateMenuSize(this.props.menuDefinition);\n\t\tconst menuPos = this.calculateMenuPos(this.props.mousePos, menuSize, this.props.canvasRect);\n\t\tconst posStyle = {\n\t\t\tleft: menuPos.x + \"px\",\n\t\t\ttop: menuPos.y + \"px\"\n\t\t};\n\n\t\tconst menuItems = this.buildMenu(this.props.menuDefinition, menuSize, menuPos, this.props.canvasRect);\n\n\t\treturn (\n\t\t\t<div id=\"context-menu-popover\" className=\"context-menu-popover\" style={posStyle} onContextMenu={this.onContextMenu}>\n\t\t\t\t{menuItems}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nCommonContextMenu.propTypes = {\n\tcontextHandler: PropTypes.func.isRequired,\n\tmenuDefinition: PropTypes.array.isRequired,\n\tcanvasRect: PropTypes.object.isRequired,\n\tmousePos: PropTypes.object.isRequired\n};\n\nexport default CommonContextMenu;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport CommonContextMenu from \"./common-context-menu.jsx\";\n\nexport default class ContextMenuWrapper extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\n\t\tthis.contextMenuClicked = this.contextMenuClicked.bind(this);\n\t\tthis.handleClickOutside = this.handleClickOutside.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\tdocument.addEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tdocument.removeEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\t// Returns an object that describes the dimensions of a rectangle for the\n\t// canvas div with coordinates based on the top left corner of the div. This\n\t// will match the coordinates for the mouse position where the user clicked,\n\t// which is specified in this.props.contextMenuPos object.\n\tgetCanvasRect() {\n\t\tconst containingDiv = document.getElementById(this.props.containingDivId);\n\t\tconst clientRect = containingDiv.getBoundingClientRect();\n\t\tconst canvasRect = {\n\t\t\ttop: 0,\n\t\t\tbottom: clientRect.bottom - clientRect.top,\n\t\t\tleft: 0,\n\t\t\tright: clientRect.right - clientRect.left,\n\t\t\theight: clientRect.height,\n\t\t\twidth: clientRect.width\n\t\t};\n\n\t\treturn canvasRect;\n\t}\n\n\thandleClickOutside(e) {\n\t\t// On Safari, when a user is displaying the context menu with a ctrl-click\n\t\t// (which is a supported context menu gesture on the Mac) a secondary click\n\t\t// event is emmitted which is received here with the ctrlKey field enabled.\n\t\t// So we ignore that event otherwse, if we continue, the context menu will\n\t\t// be closed.\n\t\tif (e.ctrlKey) {\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\t// If the click was anywhere outside the context menu and\n\t\t// the ellipsis button we just close the menu.\n\t\tif (!this.isOverContextMenu(e) && !this.isOverEllipsisButton(e)) {\n\t\t\t// This stop propagation is needed in common canvas so that selected nodes will\n\t\t\t// remain selected even after clicking outside the context menu to close the menu.\n\t\t\tif (this.props.stopPropagation) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t\tthis.props.closeContextMenu();\n\t\t}\n\t}\n\n\t// Retruns true if the event occurred over the context menu.\n\tisOverContextMenu(e) {\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\treturn !domNode || domNode.contains(e.target);\n\t}\n\n\t// Returns true if the event occurred over the ellipsis button. Typically\n\t// there will be only one ellipsis button on the canvas, since they are only\n\t// displayed on hover, but in some test cicumstances there might be more\n\t// than one.\n\tisOverEllipsisButton(e) {\n\t\tconst ellipsisNodes = document.getElementsByClassName(\"d3-node-ellipsis-group\");\n\t\tlet state = false;\n\t\tfor (let i = 0; i < ellipsisNodes.length; i++) {\n\t\t\tif (state === false && ellipsisNodes[i].contains(e.target)) {\n\t\t\t\tstate = true;\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t}\n\n\tcontextMenuClicked(action, param) {\n\t\tthis.props.contextMenuActionHandler(action, param);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<CommonContextMenu\n\t\t\t\tcontextHandler={this.contextMenuClicked}\n\t\t\t\tmenuDefinition={this.props.contextMenuDef}\n\t\t\t\tcanvasRect={this.getCanvasRect()}\n\t\t\t\tmousePos={this.props.contextMenuPos}\n\t\t\t/>\n\t\t);\n\t}\n}\n\nContextMenuWrapper.propTypes = {\n\tcontextMenuDef: PropTypes.array.isRequired,\n\tcontainingDivId: PropTypes.string.isRequired,\n\tcontextMenuPos: PropTypes.object.isRequired,\n\tcontextMenuActionHandler: PropTypes.func.isRequired,\n\tcloseContextMenu: PropTypes.func.isRequired,\n\tstopPropagation: PropTypes.bool\n};\n"],"names":["_React$Component","_inherits","ColorPickerPanel","_super","_createSuper","props","_this","_classCallCheck","call","logger","Logger","onClick","bind","_assertThisInitialized","_createClass","key","value","evt","color","target","dataset","this","clickActionHandler","log","React","createElement","className","tabIndex","Component","CommonContextMenu","state","itemSelected","colorClicked","e","preventDefault","data","selectedEvent","contextHandler","stopPropagation","menu","numDividers","i","length","divider","height","width","mousePos","menuSize","canvasRect","menuPos","x","y","submenuItems","itemCount","disabledCount","forEach","submenuItem","enable","menuDefinition","customDivider","menuItems","runningYPos","previousDivider","submenu","push","MenuItem","attributes","subMenuSize","subMenuContent","buildColorPickerPanel","subMenu","buildSubMenu","disabled","areAllSubmenuItemsDisabled","calculateMenuSize","buildMenu","_extends","action","label","_defineProperty","colorPickHandler","index","rtl","buildRtlState","subMenuPosStyle","buildSubMenuPosStyle","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","SubMenu","title","style","right","bottom","top","calculateMenuPos","posStyle","left","id","onContextMenu","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","ctrlKey","isOverContextMenu","isOverEllipsisButton","closeContextMenu","domNode","contains","ellipsisNodes","getElementsByClassName","param","contextMenuActionHandler","contextMenuDef","getCanvasRect","contextMenuPos"],"mappings":"i2BAkBiD,eAG3BA,GAAAC,EAAAC,EAAAF,GAAA,IAAAG,EAA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AStF,EAAEd,WAMvCJ,2BAAAC,MACA,SAAqBiB,GAGpB,IAFA,IAAMuF,EAAgBb,SAASc,uBAAuB,0BAClD3F,GAAQ,EACHW,EAAI,EAAGA,EAAI+E,EAAc9E,OAAQD,KAC3B,IAAVX,GAAmB0F,EAAc/E,GAAG8E,SAAStF,EAAEd,UAClDW,GAAQ,GAGV,OAAOA,KACPf,yBAAAC,MAED,SAAmB6D,EAAQ6C,GAC1BrG,KAAKhB,MAAMsH,yBAAyB9C,EAAQ6C,MAC5C3G,aAAAC,MAED,WACC,OACCQ,EAAAC,cAACI,GACAQ,eAAgBhB,KAAKoF,mBACrB/C,eAAgBrC,KAAKhB,MAAMuH,eAC3B5E,WAAY3B,KAAKwG,gBACjB/E,SAAUzB,KAAKhB,MAAMyH,qBAGvBtB,CAAA,EA7F8ChF,EAAMI"}
|
package/dist/lib/context-menu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../createClass-826941b3.js"),t=require("../getPrototypeOf-1e698126.js"),n=require("react"),r=require("../canvas-constants-07dbe4b7.js"),o=require("../extends-
|
|
1
|
+
"use strict";var e=require("../createClass-826941b3.js"),t=require("../getPrototypeOf-1e698126.js"),n=require("react"),r=require("../canvas-constants-07dbe4b7.js"),o=require("../extends-86f8d713.js"),i=require("react-contextmenu"),l=require("../icon-63afae46.js"),c=require("../canvas-logger-bb537fb3.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("react-inlinesvg"),require("@carbon/icons-react");var u=a(n);function s(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=t._getPrototypeOf(e);if(n){var i=t._getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return t._possibleConstructorReturn(this,r)}}var d=function(n){t._inherits(o,n);var r=s(o);function o(n){var i;return e._classCallCheck(this,o),(i=r.call(this,n)).logger=new c.Logger("CC-ContextMenu"),i.onClick=i.onClick.bind(t._assertThisInitialized(i)),i}return e._createClass(o,[{key:"onClick",value:function(e){var t=e.target.dataset.color;this.props.clickActionHandler(t)}},{key:"render",value:function(){return this.logger.log("render"),u.default.createElement("div",{className:"color-picker-panel",onClick:this.onClick},u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-white-0",className:"color-picker-item white-0"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-yellow-20",className:"color-picker-item yellow-20"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-gray-20",className:"color-picker-item gray-20"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-green-20",className:"color-picker-item green-20"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-teal-20",className:"color-picker-item teal-20"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-cyan-20",className:"color-picker-item cyan-20"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-red-50",className:"color-picker-item red-50"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-orange-40",className:"color-picker-item orange-40"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-gray-50",className:"color-picker-item gray-50"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-green-50",className:"color-picker-item green-50"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-teal-50",className:"color-picker-item teal-50"}),u.default.createElement("div",{tabIndex:"0","data-color":"bkg-col-cyan-50",className:"color-picker-item cyan-50"}))}}]),o}(u.default.Component);function f(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=t._getPrototypeOf(e);if(n){var i=t._getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return t._possibleConstructorReturn(this,r)}}var h=function(n){t._inherits(a,n);var c=f(a);function a(n){var r;return e._classCallCheck(this,a),(r=c.call(this,n)).state={},r.itemSelected=r.itemSelected.bind(t._assertThisInitialized(r)),r.colorClicked=r.colorClicked.bind(t._assertThisInitialized(r)),r}return e._createClass(a,[{key:"onContextMenu",value:function(e){e.preventDefault()}},{key:"itemSelected",value:function(e,t){this.props.contextHandler(e),t&&t.stopPropagation()}},{key:"colorClicked",value:function(e){this.props.contextHandler("colorSelectedObjects",{color:e})}},{key:"calculateMenuSize",value:function(e){for(var t=0,n=0;n<e.length;++n){e[n].divider&&t++}return{height:30*(e.length-t)+1*t,width:160}}},{key:"calculateMenuPos",value:function(e,t,n){var r={x:e.x,y:e.y};return e.y+t.height>n.height&&(r.y=n.height-t.height-5,r.y<0&&(r.y=0)),e.x+t.width>n.width&&(r.x-=t.width),r.x+=1,r.y+=1,r}},{key:"areAllSubmenuItemsDisabled",value:function(e){var t=0,n=0;return e.forEach((function(e){e.divider||t++,!1===e.enable&&n++})),n===t}},{key:"buildMenu",value:function(e,t,n,r){for(var l={className:"contextmenu-divider"},c=[],a=0,s=!1,d=0;d<e.length;++d){var f=e[d].divider,h=e[d].submenu;if(f)s||(c.push(u.default.createElement(i.MenuItem,{attributes:l,key:d+1,onClick:function(){},divider:!0})),a+=1,s=!0);else if(h)if(s=!1,"colorPicker"===e[d].menu){var p={width:160,height:50},m=this.buildColorPickerPanel(),v=this.buildSubMenu(e,d,m,a,n,t,p,r,!1);c.push(v),a+=30}else{var k={disabled:this.areAllSubmenuItemsDisabled(e[d].menu)},y=this.calculateMenuSize(e[d].menu),b=this.buildMenu(e[d].menu,t,n,r),g=this.buildSubMenu(e,d,b,a,n,t,y,r,k);c.push(g),a+=30}else{s=!1;var C={disabled:!1===e[d].enable};c.push(u.default.createElement(i.MenuItem,o._extends({onClick:this.itemSelected.bind(null,e[d].action),key:d+1},C),e[d].label)),a+=30}}return c}},{key:"buildColorPickerPanel",value:function(){return u.default.createElement(d,r._defineProperty({clickActionHandler:this.colorPickHandler},"clickActionHandler",this.colorClicked))}},{key:"buildSubMenu",value:function(e,t,n,c,a,s,d,f,h){var p=this.buildRtlState(a,s,d,f),m=this.buildSubMenuPosStyle(c,a,d,f),v=u.default.createElement(l.Icon,{type:r.CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT,disabled:!1,className:"react-contextmenu-submenu-icon"}),k=u.default.createElement("div",null,e[t].label,v," ");return u.default.createElement(i.SubMenu,o._extends({title:k,key:t+1,className:"contextmenu-submenu",rtl:p},h),u.default.createElement("div",{key:t+1,style:m,className:"context-menu-popover"},n))}},{key:"buildRtlState",value:function(e,t,n,r){return e.x+t.width+n.width>r.right}},{key:"buildSubMenuPosStyle",value:function(e,t,n,r){var o=r.bottom-(t.y+e+n.height);return{top:(o>0?0:o-5)+"px"}}},{key:"render",value:function(){var e=this.calculateMenuSize(this.props.menuDefinition),t=this.calculateMenuPos(this.props.mousePos,e,this.props.canvasRect),n={left:t.x+"px",top:t.y+"px"},r=this.buildMenu(this.props.menuDefinition,e,t,this.props.canvasRect);return u.default.createElement("div",{id:"context-menu-popover",className:"context-menu-popover",style:n,onContextMenu:this.onContextMenu},r)}}]),a}(u.default.Component);function p(e){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=t._getPrototypeOf(e);if(n){var i=t._getPrototypeOf(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.apply(this,arguments);return t._possibleConstructorReturn(this,r)}}var m=function(n){t._inherits(o,n);var r=p(o);function o(n){var i;return e._classCallCheck(this,o),(i=r.call(this,n)).state={},i.contextMenuClicked=i.contextMenuClicked.bind(t._assertThisInitialized(i)),i.handleClickOutside=i.handleClickOutside.bind(t._assertThisInitialized(i)),i}return e._createClass(o,[{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleClickOutside,!0)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("click",this.handleClickOutside,!0)}},{key:"getCanvasRect",value:function(){var e=document.getElementById(this.props.containingDivId).getBoundingClientRect();return{top:0,bottom:e.bottom-e.top,left:0,right:e.right-e.left,height:e.height,width:e.width}}},{key:"handleClickOutside",value:function(e){e.ctrlKey?e.stopPropagation():this.isOverContextMenu(e)||this.isOverEllipsisButton(e)||(this.props.stopPropagation&&e.stopPropagation(),this.props.closeContextMenu())}},{key:"isOverContextMenu",value:function(e){var t=document.getElementById("context-menu-popover");return!t||t.contains(e.target)}},{key:"isOverEllipsisButton",value:function(e){for(var t=document.getElementsByClassName("d3-node-ellipsis-group"),n=!1,r=0;r<t.length;r++)!1===n&&t[r].contains(e.target)&&(n=!0);return n}},{key:"contextMenuClicked",value:function(e,t){this.props.contextMenuActionHandler(e,t)}},{key:"render",value:function(){return u.default.createElement(h,{contextHandler:this.contextMenuClicked,menuDefinition:this.props.contextMenuDef,canvasRect:this.getCanvasRect(),mousePos:this.props.contextMenuPos})}}]),o}(u.default.Component);module.exports=m;
|
|
2
2
|
//# sourceMappingURL=context-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.js","sources":["../../src/color-picker/color-picker-panel.jsx","../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.jsx"],"sourcesContent":["/*\n * Copyright 2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport Logger from \"../logging/canvas-logger.js\";\n\n\nclass ColorPickerPanel extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.logger = new Logger(\"CC-ContextMenu\");\n\n\t\tthis.onClick = this.onClick.bind(this);\n\t}\n\n\tonClick(evt) {\n\t\tconst color = evt.target.dataset.color;\n\t\tthis.props.clickActionHandler(color);\n\t}\n\n\trender() {\n\t\tthis.logger.log(\"render\");\n\t\treturn (\n\t\t\t<div className=\"color-picker-panel\" onClick={this.onClick}>\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-white-0\"} className=\"color-picker-item white-0\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-yellow-20\"} className=\"color-picker-item yellow-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-20\"} className=\"color-picker-item gray-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-20\"} className=\"color-picker-item green-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-20\"} className=\"color-picker-item teal-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-20\"} className=\"color-picker-item cyan-20\" />\n\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-red-50\"} className=\"color-picker-item red-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-orange-40\"} className=\"color-picker-item orange-40\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-50\"} className=\"color-picker-item gray-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-50\"} className=\"color-picker-item green-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-50\"} className=\"color-picker-item teal-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-50\"} className=\"color-picker-item cyan-50\" />\n\t\t\t</div>);\n\t}\n}\n\nColorPickerPanel.propTypes = {\n\tclickActionHandler: PropTypes.func.isRequired,\n\tcloseMenu: PropTypes.func\n};\n\nexport default ColorPickerPanel;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-empty-function: [\"error\", { \"allow\": [\"arrowFunctions\"] }] */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { MenuItem, SubMenu } from \"react-contextmenu\";\nimport Icon from \"../icons/icon.jsx\";\nimport { CONTEXT_MENU_CARBON_ICONS } from \"../common-canvas/constants/canvas-constants\";\nimport ColorPickerPanel from \"../color-picker/color-picker-panel.jsx\";\n\n// context-menu sizing\nconst CONTEXT_MENU_WIDTH = 160; // see context-menu.css .react-context-menu margin\nconst CONTEXT_MENU_LINK_HEIGHT = 30; // see context-menu.css .react-context-menu-item height\nconst CONTEXT_MENU_DIVIDER_HEIGHT = 1; // see context-menu.css .react-context-menu-item height\nconst EXTRA_OFFSET = 5; // Extra offset for vertical menu positioning\n\n\nclass CommonContextMenu extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\t\tthis.itemSelected = this.itemSelected.bind(this);\n\t\tthis.colorClicked = this.colorClicked.bind(this);\n\t}\n\n\tonContextMenu(e) {\n\t\te.preventDefault();\n\t}\n\n\titemSelected(data, selectedEvent) {\n\t\tthis.props.contextHandler(data);\n\t\t// This stops the canvasClicked function from being fired which would\n\t\t// clear any current selections.\n\t\tif (selectedEvent) {\n\t\t\tselectedEvent.stopPropagation();\n\t\t}\n\t}\n\n\tcolorClicked(color) {\n\t\tthis.props.contextHandler(\"colorSelectedObjects\", { color });\n\t}\n\n\tcalculateMenuSize(menu) {\n\t\tvar numDividers = 0;\n\t\tfor (let i = 0; i < menu.length; ++i) {\n\t\t\tconst divider = menu[i].divider;\n\t\t\tif (divider) {\n\t\t\t\tnumDividers++;\n\t\t\t}\n\t\t}\n\n\t\tvar menuSize = {\n\t\t\theight: ((menu.length - numDividers) * CONTEXT_MENU_LINK_HEIGHT) + (numDividers * CONTEXT_MENU_DIVIDER_HEIGHT),\n\t\t\twidth: CONTEXT_MENU_WIDTH\n\t\t};\n\n\t\treturn menuSize;\n\t}\n\n\t// Returns a new position and the canvas rectangle for the context menu based on the current\n\t// mouse position and whether the menu would appear outside the edges of the page.\n\tcalculateMenuPos(mousePos, menuSize, canvasRect) {\n\t\tconst menuPos = { x: mousePos.x, y: mousePos.y };\n\n\t\t// Reposition contextMenu if it will show off the bottom of the page\n\t\tif (mousePos.y + menuSize.height > canvasRect.height) {\n\t\t\tmenuPos.y = canvasRect.height - menuSize.height - EXTRA_OFFSET; // Move up by extra offset so it looks nice\n\n\t\t\t// If repositioning the menu would push it off the top of the page\n\t\t\t// (in very short browser windows) position it at the top.\n\t\t\tif (menuPos.y < 0) {\n\t\t\t\tmenuPos.y = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Reposition contextMenu if it will show off the right of the page\n\t\tif (mousePos.x + menuSize.width > canvasRect.width) {\n\t\t\tmenuPos.x -= menuSize.width;\n\t\t}\n\n\t\t// Add a pixel to x and y because on Chrome without this the context menu\n\t\t// appears with the top corner of the first menu item under the mouse\n\t\t// cursor. This highlights the first menu item (which looks weird) and, if\n\t\t// the first item is a cascade menu, automatically opens the sub-menu.\n\t\tmenuPos.x += 1;\n\t\tmenuPos.y += 1;\n\n\t\treturn menuPos;\n\t}\n\n\tareAllSubmenuItemsDisabled(submenuItems) {\n\t\tlet itemCount = 0;\n\t\tlet disabledCount = 0;\n\t\tsubmenuItems.forEach(function(submenuItem) {\n\t\t\tif (!submenuItem.divider) {\n\t\t\t\titemCount++;\n\t\t\t}\n\t\t\tif (submenuItem.enable === false) {\n\t\t\t\tdisabledCount++;\n\t\t\t}\n\t\t});\n\t\treturn disabledCount === itemCount;\n\t}\n\n\tbuildMenu(menuDefinition, menuSize, menuPos, canvasRect) {\n\t\tconst customDivider = {\n\t\t\tclassName: \"contextmenu-divider\"\n\t\t};\n\n\t\tconst menuItems = [];\n\n\t\tlet runningYPos = 0;\n\t\t// Records if we have just displayed a divider. This is useful because we\n\t\t// only want to display one divider if there is a divider element\n\t\t// immediately after another divider element in the menuDefintion array.\n\t\tlet previousDivider = false;\n\n\t\tfor (let i = 0; i < menuDefinition.length; ++i) {\n\t\t\tconst divider = menuDefinition[i].divider;\n\t\t\tconst submenu = menuDefinition[i].submenu;\n\n\t\t\tif (divider) {\n\t\t\t\tif (!previousDivider) {\n\t\t\t\t\tmenuItems.push(<MenuItem attributes={customDivider} key={i + 1} onClick={() => {}} divider />);\n\t\t\t\t\trunningYPos += CONTEXT_MENU_DIVIDER_HEIGHT;\n\t\t\t\t\tpreviousDivider = true;\n\t\t\t\t}\n\n\t\t\t} else if (submenu) {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tif (menuDefinition[i].menu === \"colorPicker\") {\n\t\t\t\t\tconst disabled = false;\n\t\t\t\t\tconst subMenuSize = { width: CONTEXT_MENU_WIDTH, height: 50 };\n\t\t\t\t\tconst subMenuContent = this.buildColorPickerPanel();\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\n\t\t\t\t} else {\n\t\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\t\tconst subMenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\t\tconst subMenuContent = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tconst disabled = { disabled: menuDefinition[i].enable === false };\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<MenuItem onClick={this.itemSelected.bind(null, menuDefinition[i].action)} key={i + 1} {...disabled}>\n\t\t\t\t\t\t{menuDefinition[i].label}\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t}\n\t\t}\n\t\treturn menuItems;\n\t}\n\n\tbuildColorPickerPanel() {\n\t\treturn (\n\t\t\t<ColorPickerPanel clickActionHandler={this.colorPickHandler} clickActionHandler={this.colorClicked} />\n\t\t);\n\t}\n\n\tbuildSubMenu(menuDefinition, index, subMenuContent, runningYPos, menuPos,\n\t\tmenuSize, subMenuSize, canvasRect, disabled) {\n\t\tconst rtl = this.buildRtlState(menuPos, menuSize, subMenuSize, canvasRect);\n\t\tconst subMenuPosStyle = this.buildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect);\n\n\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\tconst menuItem = <div>{menuDefinition[index].label}{icon} </div>;\n\n\t\treturn (\n\t\t\t<SubMenu title={menuItem} key={index + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t<div key={index + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t{subMenuContent}\n\t\t\t\t</div>\n\t\t\t</SubMenu>\n\t\t);\n\t}\n\n\t// Returns a boolean to indicate whether the submenu should appear on the\n\t// right of the context menu (rtl === false) or on the left of the context\n\t// menu (rtl === true).\n\tbuildRtlState(menuPos, menuSize, subMenuSize, canvasRect) {\n\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\treturn (menuPos.x + menuSize.width + subMenuSize.width > canvasRect.right);\n\n\t}\n\n\t// Returns a style object that can be applied to the sub-menu to adjust\n\t// its vertical (y) position. This may be necessary if the submenu is tall\n\t// enough that it would be displayed off the bottom of the canvas area.\n\tbuildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect) {\n\t\t// Does the submenu go below the bottom of the viewport?\n\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + subMenuSize.height);\n\n\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t// submenu up fully into the view port.\n\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\tconst subMenuPosStyle = {\n\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t};\n\t\treturn subMenuPosStyle;\n\t}\n\n\trender() {\n\t\t// Reposition contextMenu so that it does not show off the screen\n\t\tconst menuSize = this.calculateMenuSize(this.props.menuDefinition);\n\t\tconst menuPos = this.calculateMenuPos(this.props.mousePos, menuSize, this.props.canvasRect);\n\t\tconst posStyle = {\n\t\t\tleft: menuPos.x + \"px\",\n\t\t\ttop: menuPos.y + \"px\"\n\t\t};\n\n\t\tconst menuItems = this.buildMenu(this.props.menuDefinition, menuSize, menuPos, this.props.canvasRect);\n\n\t\treturn (\n\t\t\t<div id=\"context-menu-popover\" className=\"context-menu-popover\" style={posStyle} onContextMenu={this.onContextMenu}>\n\t\t\t\t{menuItems}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nCommonContextMenu.propTypes = {\n\tcontextHandler: PropTypes.func.isRequired,\n\tmenuDefinition: PropTypes.array.isRequired,\n\tcanvasRect: PropTypes.object.isRequired,\n\tmousePos: PropTypes.object.isRequired\n};\n\nexport default CommonContextMenu;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport CommonContextMenu from \"./common-context-menu.jsx\";\n\nexport default class ContextMenuWrapper extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\n\t\tthis.contextMenuClicked = this.contextMenuClicked.bind(this);\n\t\tthis.handleClickOutside = this.handleClickOutside.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\tdocument.addEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tdocument.removeEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\t// Returns an object that describes the dimensions of a rectangle for the\n\t// canvas div with coordinates based on the top left corner of the div. This\n\t// will match the coordinates for the mouse position where the user clicked,\n\t// which is specified in this.props.contextMenuPos object.\n\tgetCanvasRect() {\n\t\tconst containingDiv = document.getElementById(this.props.containingDivId);\n\t\tconst clientRect = containingDiv.getBoundingClientRect();\n\t\tconst canvasRect = {\n\t\t\ttop: 0,\n\t\t\tbottom: clientRect.bottom - clientRect.top,\n\t\t\tleft: 0,\n\t\t\tright: clientRect.right - clientRect.left,\n\t\t\theight: clientRect.height,\n\t\t\twidth: clientRect.width\n\t\t};\n\n\t\treturn canvasRect;\n\t}\n\n\thandleClickOutside(e) {\n\t\t// On Safari, when a user is displaying the context menu with a ctrl-click\n\t\t// (which is a supported context menu gesture on the Mac) a secondary click\n\t\t// event is emmitted which is received here with the ctrlKey field enabled.\n\t\t// So we ignore that event otherwse, if we continue, the context menu will\n\t\t// be closed.\n\t\tif (e.ctrlKey) {\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\t// If the click was anywhere outside the context menu and\n\t\t// the ellipsis button we just close the menu.\n\t\tif (!this.isOverContextMenu(e) && !this.isOverEllipsisButton(e)) {\n\t\t\t// This stop propagation is needed in common canvas so that selected nodes will\n\t\t\t// remain selected even after clicking outside the context menu to close the menu.\n\t\t\tif (this.props.stopPropagation) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t\tthis.props.closeContextMenu();\n\t\t}\n\t}\n\n\t// Retruns true if the event occurred over the context menu.\n\tisOverContextMenu(e) {\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\treturn !domNode || domNode.contains(e.target);\n\t}\n\n\t// Returns true if the event occurred over the ellipsis button. Typically\n\t// there will be only one ellipsis button on the canvas, since they are only\n\t// displayed on hover, but in some test cicumstances there might be more\n\t// than one.\n\tisOverEllipsisButton(e) {\n\t\tconst ellipsisNodes = document.getElementsByClassName(\"d3-node-ellipsis-group\");\n\t\tlet state = false;\n\t\tfor (let i = 0; i < ellipsisNodes.length; i++) {\n\t\t\tif (state === false && ellipsisNodes[i].contains(e.target)) {\n\t\t\t\tstate = true;\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t}\n\n\tcontextMenuClicked(action, param) {\n\t\tthis.props.contextMenuActionHandler(action, param);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<CommonContextMenu\n\t\t\t\tcontextHandler={this.contextMenuClicked}\n\t\t\t\tmenuDefinition={this.props.contextMenuDef}\n\t\t\t\tcanvasRect={this.getCanvasRect()}\n\t\t\t\tmousePos={this.props.contextMenuPos}\n\t\t\t/>\n\t\t);\n\t}\n}\n\nContextMenuWrapper.propTypes = {\n\tcontextMenuDef: PropTypes.array.isRequired,\n\tcontainingDivId: PropTypes.string.isRequired,\n\tcontextMenuPos: PropTypes.object.isRequired,\n\tcontextMenuActionHandler: PropTypes.func.isRequired,\n\tcloseContextMenu: PropTypes.func.isRequired,\n\tstopPropagation: PropTypes.bool\n};\n"],"names":["_inherits","props","_classCallCheck","_this","logger","Logger","onClick","bind","_createClass","key","value","evt","color","target","dataset","this","clickActionHandler","log","React","className","tabIndex","Component","state","itemSelected","colorClicked","e","preventDefault","data","selectedEvent","contextHandler","stopPropagation","menu","numDividers","i","length","divider","height","width","mousePos","menuSize","canvasRect","menuPos","x","y","submenuItems","itemCount","disabledCount","forEach","submenuItem","enable","menuDefinition","customDivider","menuItems","runningYPos","previousDivider","submenu","push","MenuItem","attributes","subMenuSize","subMenuContent","buildColorPickerPanel","subMenu","buildSubMenu","disabled","areAllSubmenuItemsDisabled","calculateMenuSize","buildMenu","action","label","ColorPickerPanel","colorPickHandler","index","rtl","buildRtlState","subMenuPosStyle","buildSubMenuPosStyle","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","SubMenu","title","style","right","bottom","top","calculateMenuPos","posStyle","left","id","onContextMenu","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","ctrlKey","isOverContextMenu","isOverEllipsisButton","closeContextMenu","domNode","contains","ellipsisNodes","getElementsByClassName","param","contextMenuActionHandler","CommonContextMenu","contextMenuDef","getCanvasRect","contextMenuPos"],"mappings":"i6BAkBiD,kBAG3BA,iBAAA,WACrB,WAAYC,GAAO,MAIqB,OAJrBC,2BAClBC,cAAMF,IACDG,OAAS,IAAIC,SAAO,kBAEzBF,EAAKG,QAAUH,EAAKG,QAAQC,oCA0B5B,OAzBAC,mBAAAC,cAAAC,MAED,SAAQC,GACP,IAAMC,EAAQD,EAAIE,OAAOC,QAAQF,MACjCG,KAAKd,MAAMe,mBAAmBJ,MAC9BH,aAAAC,MAED,WAEC,OADAK,KAAKX,OAAOa,IAAI,UAEfC,+BAAKC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OAAQa,EAAWb,OAASa,EAAWZ,IACvCG,KAAM,EACNL,MAAOc,EAAWd,MAAQc,EAAWT,KACrCxD,OAAQiE,EAAWjE,OACnBC,MAAOgE,EAAWhE,UAInB5B,yBAAAC,MAED,SAAmBe,GAMdA,EAAEgF,QACLhF,EAAEK,kBAMEf,KAAK2F,kBAAkBjF,IAAOV,KAAK4F,qBAAqBlF,KAGxDV,KAAKd,MAAM6B,iBACdL,EAAEK,kBAEHf,KAAKd,MAAM2G,uBAIbnG,wBAAAC,MACA,SAAkBe,GACjB,IAAMoF,EAAUX,SAASI,eAAe,wBACxC,OAAQO,GAAWA,EAAQC,SAASrF,EAAEZ,WAMvCJ,2BAAAC,MACA,SAAqBe,GAGpB,IAFA,IAAMsF,EAAgBb,SAASc,uBAAuB,0BAClD1F,GAAQ,EACHW,EAAI,EAAGA,EAAI8E,EAAc7E,OAAQD,KAC3B,IAAVX,GAAmByF,EAAc9E,GAAG6E,SAASrF,EAAEZ,UAClDS,GAAQ,GAGV,OAAOA,KACPb,yBAAAC,MAED,SAAmB0D,EAAQ6C,GAC1BlG,KAAKd,MAAMiH,yBAAyB9C,EAAQ6C,MAC5CxG,aAAAC,MAED,WACC,OACCQ,wBAACiG,GACAtF,eAAgBd,KAAKiF,mBACrB9C,eAAgBnC,KAAKd,MAAMmH,eAC3B5E,WAAYzB,KAAKsG,gBACjB/E,SAAUvB,KAAKd,MAAMqH,sBAGvB,EA7F8CpG,UAAMG"}
|
|
1
|
+
{"version":3,"file":"context-menu.js","sources":["../../src/color-picker/color-picker-panel.jsx","../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.jsx"],"sourcesContent":["/*\n * Copyright 2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport Logger from \"../logging/canvas-logger.js\";\n\n\nclass ColorPickerPanel extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.logger = new Logger(\"CC-ContextMenu\");\n\n\t\tthis.onClick = this.onClick.bind(this);\n\t}\n\n\tonClick(evt) {\n\t\tconst color = evt.target.dataset.color;\n\t\tthis.props.clickActionHandler(color);\n\t}\n\n\trender() {\n\t\tthis.logger.log(\"render\");\n\t\treturn (\n\t\t\t<div className=\"color-picker-panel\" onClick={this.onClick}>\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-white-0\"} className=\"color-picker-item white-0\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-yellow-20\"} className=\"color-picker-item yellow-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-20\"} className=\"color-picker-item gray-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-20\"} className=\"color-picker-item green-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-20\"} className=\"color-picker-item teal-20\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-20\"} className=\"color-picker-item cyan-20\" />\n\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-red-50\"} className=\"color-picker-item red-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-orange-40\"} className=\"color-picker-item orange-40\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-gray-50\"} className=\"color-picker-item gray-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-green-50\"} className=\"color-picker-item green-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-teal-50\"} className=\"color-picker-item teal-50\" />\n\t\t\t\t<div tabIndex=\"0\" data-color={\"bkg-col-cyan-50\"} className=\"color-picker-item cyan-50\" />\n\t\t\t</div>);\n\t}\n}\n\nColorPickerPanel.propTypes = {\n\tclickActionHandler: PropTypes.func.isRequired,\n\tcloseMenu: PropTypes.func\n};\n\nexport default ColorPickerPanel;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-empty-function: [\"error\", { \"allow\": [\"arrowFunctions\"] }] */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { MenuItem, SubMenu } from \"react-contextmenu\";\nimport Icon from \"../icons/icon.jsx\";\nimport { CONTEXT_MENU_CARBON_ICONS } from \"../common-canvas/constants/canvas-constants\";\nimport ColorPickerPanel from \"../color-picker/color-picker-panel.jsx\";\n\n// context-menu sizing\nconst CONTEXT_MENU_WIDTH = 160; // see context-menu.css .react-context-menu margin\nconst CONTEXT_MENU_LINK_HEIGHT = 30; // see context-menu.css .react-context-menu-item height\nconst CONTEXT_MENU_DIVIDER_HEIGHT = 1; // see context-menu.css .react-context-menu-item height\nconst EXTRA_OFFSET = 5; // Extra offset for vertical menu positioning\n\n\nclass CommonContextMenu extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\t\tthis.itemSelected = this.itemSelected.bind(this);\n\t\tthis.colorClicked = this.colorClicked.bind(this);\n\t}\n\n\tonContextMenu(e) {\n\t\te.preventDefault();\n\t}\n\n\titemSelected(data, selectedEvent) {\n\t\tthis.props.contextHandler(data);\n\t\t// This stops the canvasClicked function from being fired which would\n\t\t// clear any current selections.\n\t\tif (selectedEvent) {\n\t\t\tselectedEvent.stopPropagation();\n\t\t}\n\t}\n\n\tcolorClicked(color) {\n\t\tthis.props.contextHandler(\"colorSelectedObjects\", { color });\n\t}\n\n\tcalculateMenuSize(menu) {\n\t\tvar numDividers = 0;\n\t\tfor (let i = 0; i < menu.length; ++i) {\n\t\t\tconst divider = menu[i].divider;\n\t\t\tif (divider) {\n\t\t\t\tnumDividers++;\n\t\t\t}\n\t\t}\n\n\t\tvar menuSize = {\n\t\t\theight: ((menu.length - numDividers) * CONTEXT_MENU_LINK_HEIGHT) + (numDividers * CONTEXT_MENU_DIVIDER_HEIGHT),\n\t\t\twidth: CONTEXT_MENU_WIDTH\n\t\t};\n\n\t\treturn menuSize;\n\t}\n\n\t// Returns a new position and the canvas rectangle for the context menu based on the current\n\t// mouse position and whether the menu would appear outside the edges of the page.\n\tcalculateMenuPos(mousePos, menuSize, canvasRect) {\n\t\tconst menuPos = { x: mousePos.x, y: mousePos.y };\n\n\t\t// Reposition contextMenu if it will show off the bottom of the page\n\t\tif (mousePos.y + menuSize.height > canvasRect.height) {\n\t\t\tmenuPos.y = canvasRect.height - menuSize.height - EXTRA_OFFSET; // Move up by extra offset so it looks nice\n\n\t\t\t// If repositioning the menu would push it off the top of the page\n\t\t\t// (in very short browser windows) position it at the top.\n\t\t\tif (menuPos.y < 0) {\n\t\t\t\tmenuPos.y = 0;\n\t\t\t}\n\t\t}\n\n\t\t// Reposition contextMenu if it will show off the right of the page\n\t\tif (mousePos.x + menuSize.width > canvasRect.width) {\n\t\t\tmenuPos.x -= menuSize.width;\n\t\t}\n\n\t\t// Add a pixel to x and y because on Chrome without this the context menu\n\t\t// appears with the top corner of the first menu item under the mouse\n\t\t// cursor. This highlights the first menu item (which looks weird) and, if\n\t\t// the first item is a cascade menu, automatically opens the sub-menu.\n\t\tmenuPos.x += 1;\n\t\tmenuPos.y += 1;\n\n\t\treturn menuPos;\n\t}\n\n\tareAllSubmenuItemsDisabled(submenuItems) {\n\t\tlet itemCount = 0;\n\t\tlet disabledCount = 0;\n\t\tsubmenuItems.forEach(function(submenuItem) {\n\t\t\tif (!submenuItem.divider) {\n\t\t\t\titemCount++;\n\t\t\t}\n\t\t\tif (submenuItem.enable === false) {\n\t\t\t\tdisabledCount++;\n\t\t\t}\n\t\t});\n\t\treturn disabledCount === itemCount;\n\t}\n\n\tbuildMenu(menuDefinition, menuSize, menuPos, canvasRect) {\n\t\tconst customDivider = {\n\t\t\tclassName: \"contextmenu-divider\"\n\t\t};\n\n\t\tconst menuItems = [];\n\n\t\tlet runningYPos = 0;\n\t\t// Records if we have just displayed a divider. This is useful because we\n\t\t// only want to display one divider if there is a divider element\n\t\t// immediately after another divider element in the menuDefintion array.\n\t\tlet previousDivider = false;\n\n\t\tfor (let i = 0; i < menuDefinition.length; ++i) {\n\t\t\tconst divider = menuDefinition[i].divider;\n\t\t\tconst submenu = menuDefinition[i].submenu;\n\n\t\t\tif (divider) {\n\t\t\t\tif (!previousDivider) {\n\t\t\t\t\tmenuItems.push(<MenuItem attributes={customDivider} key={i + 1} onClick={() => {}} divider />);\n\t\t\t\t\trunningYPos += CONTEXT_MENU_DIVIDER_HEIGHT;\n\t\t\t\t\tpreviousDivider = true;\n\t\t\t\t}\n\n\t\t\t} else if (submenu) {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tif (menuDefinition[i].menu === \"colorPicker\") {\n\t\t\t\t\tconst disabled = false;\n\t\t\t\t\tconst subMenuSize = { width: CONTEXT_MENU_WIDTH, height: 50 };\n\t\t\t\t\tconst subMenuContent = this.buildColorPickerPanel();\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\n\t\t\t\t} else {\n\t\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\t\tconst subMenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\t\tconst subMenuContent = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\n\t\t\t\t\tconst subMenu = this.buildSubMenu(\n\t\t\t\t\t\tmenuDefinition, i, subMenuContent, runningYPos, menuPos, menuSize, subMenuSize, canvasRect, disabled);\n\t\t\t\t\tmenuItems.push(subMenu);\n\n\t\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tpreviousDivider = false;\n\t\t\t\tconst disabled = { disabled: menuDefinition[i].enable === false };\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<MenuItem onClick={this.itemSelected.bind(null, menuDefinition[i].action)} key={i + 1} {...disabled}>\n\t\t\t\t\t\t{menuDefinition[i].label}\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\t\t\t}\n\t\t}\n\t\treturn menuItems;\n\t}\n\n\tbuildColorPickerPanel() {\n\t\treturn (\n\t\t\t<ColorPickerPanel clickActionHandler={this.colorPickHandler} clickActionHandler={this.colorClicked} />\n\t\t);\n\t}\n\n\tbuildSubMenu(menuDefinition, index, subMenuContent, runningYPos, menuPos,\n\t\tmenuSize, subMenuSize, canvasRect, disabled) {\n\t\tconst rtl = this.buildRtlState(menuPos, menuSize, subMenuSize, canvasRect);\n\t\tconst subMenuPosStyle = this.buildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect);\n\n\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\tconst menuItem = <div>{menuDefinition[index].label}{icon} </div>;\n\n\t\treturn (\n\t\t\t<SubMenu title={menuItem} key={index + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t<div key={index + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t{subMenuContent}\n\t\t\t\t</div>\n\t\t\t</SubMenu>\n\t\t);\n\t}\n\n\t// Returns a boolean to indicate whether the submenu should appear on the\n\t// right of the context menu (rtl === false) or on the left of the context\n\t// menu (rtl === true).\n\tbuildRtlState(menuPos, menuSize, subMenuSize, canvasRect) {\n\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\treturn (menuPos.x + menuSize.width + subMenuSize.width > canvasRect.right);\n\n\t}\n\n\t// Returns a style object that can be applied to the sub-menu to adjust\n\t// its vertical (y) position. This may be necessary if the submenu is tall\n\t// enough that it would be displayed off the bottom of the canvas area.\n\tbuildSubMenuPosStyle(runningYPos, menuPos, subMenuSize, canvasRect) {\n\t\t// Does the submenu go below the bottom of the viewport?\n\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + subMenuSize.height);\n\n\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t// submenu up fully into the view port.\n\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\tconst subMenuPosStyle = {\n\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t};\n\t\treturn subMenuPosStyle;\n\t}\n\n\trender() {\n\t\t// Reposition contextMenu so that it does not show off the screen\n\t\tconst menuSize = this.calculateMenuSize(this.props.menuDefinition);\n\t\tconst menuPos = this.calculateMenuPos(this.props.mousePos, menuSize, this.props.canvasRect);\n\t\tconst posStyle = {\n\t\t\tleft: menuPos.x + \"px\",\n\t\t\ttop: menuPos.y + \"px\"\n\t\t};\n\n\t\tconst menuItems = this.buildMenu(this.props.menuDefinition, menuSize, menuPos, this.props.canvasRect);\n\n\t\treturn (\n\t\t\t<div id=\"context-menu-popover\" className=\"context-menu-popover\" style={posStyle} onContextMenu={this.onContextMenu}>\n\t\t\t\t{menuItems}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nCommonContextMenu.propTypes = {\n\tcontextHandler: PropTypes.func.isRequired,\n\tmenuDefinition: PropTypes.array.isRequired,\n\tcanvasRect: PropTypes.object.isRequired,\n\tmousePos: PropTypes.object.isRequired\n};\n\nexport default CommonContextMenu;\n","/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport CommonContextMenu from \"./common-context-menu.jsx\";\n\nexport default class ContextMenuWrapper extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {};\n\n\t\tthis.contextMenuClicked = this.contextMenuClicked.bind(this);\n\t\tthis.handleClickOutside = this.handleClickOutside.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\tdocument.addEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tdocument.removeEventListener(\"click\", this.handleClickOutside, true);\n\t}\n\n\t// Returns an object that describes the dimensions of a rectangle for the\n\t// canvas div with coordinates based on the top left corner of the div. This\n\t// will match the coordinates for the mouse position where the user clicked,\n\t// which is specified in this.props.contextMenuPos object.\n\tgetCanvasRect() {\n\t\tconst containingDiv = document.getElementById(this.props.containingDivId);\n\t\tconst clientRect = containingDiv.getBoundingClientRect();\n\t\tconst canvasRect = {\n\t\t\ttop: 0,\n\t\t\tbottom: clientRect.bottom - clientRect.top,\n\t\t\tleft: 0,\n\t\t\tright: clientRect.right - clientRect.left,\n\t\t\theight: clientRect.height,\n\t\t\twidth: clientRect.width\n\t\t};\n\n\t\treturn canvasRect;\n\t}\n\n\thandleClickOutside(e) {\n\t\t// On Safari, when a user is displaying the context menu with a ctrl-click\n\t\t// (which is a supported context menu gesture on the Mac) a secondary click\n\t\t// event is emmitted which is received here with the ctrlKey field enabled.\n\t\t// So we ignore that event otherwse, if we continue, the context menu will\n\t\t// be closed.\n\t\tif (e.ctrlKey) {\n\t\t\te.stopPropagation();\n\t\t\treturn;\n\t\t}\n\n\t\t// If the click was anywhere outside the context menu and\n\t\t// the ellipsis button we just close the menu.\n\t\tif (!this.isOverContextMenu(e) && !this.isOverEllipsisButton(e)) {\n\t\t\t// This stop propagation is needed in common canvas so that selected nodes will\n\t\t\t// remain selected even after clicking outside the context menu to close the menu.\n\t\t\tif (this.props.stopPropagation) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t\tthis.props.closeContextMenu();\n\t\t}\n\t}\n\n\t// Retruns true if the event occurred over the context menu.\n\tisOverContextMenu(e) {\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\treturn !domNode || domNode.contains(e.target);\n\t}\n\n\t// Returns true if the event occurred over the ellipsis button. Typically\n\t// there will be only one ellipsis button on the canvas, since they are only\n\t// displayed on hover, but in some test cicumstances there might be more\n\t// than one.\n\tisOverEllipsisButton(e) {\n\t\tconst ellipsisNodes = document.getElementsByClassName(\"d3-node-ellipsis-group\");\n\t\tlet state = false;\n\t\tfor (let i = 0; i < ellipsisNodes.length; i++) {\n\t\t\tif (state === false && ellipsisNodes[i].contains(e.target)) {\n\t\t\t\tstate = true;\n\t\t\t}\n\t\t}\n\t\treturn state;\n\t}\n\n\tcontextMenuClicked(action, param) {\n\t\tthis.props.contextMenuActionHandler(action, param);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<CommonContextMenu\n\t\t\t\tcontextHandler={this.contextMenuClicked}\n\t\t\t\tmenuDefinition={this.props.contextMenuDef}\n\t\t\t\tcanvasRect={this.getCanvasRect()}\n\t\t\t\tmousePos={this.props.contextMenuPos}\n\t\t\t/>\n\t\t);\n\t}\n}\n\nContextMenuWrapper.propTypes = {\n\tcontextMenuDef: PropTypes.array.isRequired,\n\tcontainingDivId: PropTypes.string.isRequired,\n\tcontextMenuPos: PropTypes.object.isRequired,\n\tcontextMenuActionHandler: PropTypes.func.isRequired,\n\tcloseContextMenu: PropTypes.func.isRequired,\n\tstopPropagation: PropTypes.bool\n};\n"],"names":["_React$Component","_inherits","ColorPickerPanel","_super","_createSuper","props","_this","_classCallCheck","call","logger","Logger","onClick","bind","_assertThisInitialized","_createClass","key","value","evt","color","target","dataset","this","clickActionHandler","log","React","createElement","className","tabIndex","Component","CommonContextMenu","state","itemSelected","colorClicked","e","preventDefault","data","selectedEvent","contextHandler","stopPropagation","menu","numDividers","i","length","divider","height","width","mousePos","menuSize","canvasRect","menuPos","x","y","submenuItems","itemCount","disabledCount","forEach","submenuItem","enable","menuDefinition","customDivider","menuItems","runningYPos","previousDivider","submenu","push","MenuItem","attributes","subMenuSize","subMenuContent","buildColorPickerPanel","subMenu","buildSubMenu","disabled","areAllSubmenuItemsDisabled","calculateMenuSize","buildMenu","_extends","action","label","_defineProperty","colorPickHandler","index","rtl","buildRtlState","subMenuPosStyle","buildSubMenuPosStyle","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","SubMenu","title","style","right","bottom","top","calculateMenuPos","posStyle","left","id","onContextMenu","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","ctrlKey","isOverContextMenu","isOverEllipsisButton","closeContextMenu","domNode","contains","ellipsisNodes","getElementsByClassName","param","contextMenuActionHandler","contextMenuDef","getCanvasRect","contextMenuPos"],"mappings":"i6BAkBiD,eAG3BA,GAAAC,YAAAC,EAAAF,GAAA,IAAAG,EAAAC,EAAAF,GACrB,SAAAA,EAAYG,GAAO,IAAAC,EAIqB,OAJrBC,uBAAAL,IAClBI,EAAAH,EAAAK,UAAMH,IACDI,OAAS,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,GAAQ,EACHW,EAAI,EAAGA,EAAI+E,EAAc9E,OAAQD,KAC3B,IAAVX,GAAmB0F,EAAc/E,GAAG8E,SAAStF,EAAEd,UAClDW,GAAQ,GAGV,OAAOA,KACPf,yBAAAC,MAED,SAAmB6D,EAAQ6C,GAC1BrG,KAAKhB,MAAMsH,yBAAyB9C,EAAQ6C,MAC5C3G,aAAAC,MAED,WACC,OACCQ,UAAAC,cAACI,GACAQ,eAAgBhB,KAAKoF,mBACrB/C,eAAgBrC,KAAKhB,MAAMuH,eAC3B5E,WAAY3B,KAAKwG,gBACjB/E,SAAUzB,KAAKhB,MAAMyH,qBAGvBtB,CAAA,EA7F8ChF,UAAMI"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{F as default}from"../../index-
|
|
1
|
+
export{F as default}from"../../index-5c0ad9bb.js";import"../../createClass-be661622.js";import"../../getPrototypeOf-3751add9.js";import"../../isArrayLikeObject-a9c7973b.js";import"../../flexible-table-d68c24c6.js";import"../../extends-de3127ea.js";import"react";import"react-intl";import"react-dom";import"carbon-components-react";import"../../_baseForOwn-d38b560e.js";import"react-virtualized";import"react-draggable";import"@carbon/icons-react";import"../tooltip.es.js";import"react-portal";import"uuid";import"react-resize-detector";import"../../canvas-constants-ba465147.js";import"../../en-7201b548.js";import"../../icon-94bf4b86.js";import"react-inlinesvg";
|
|
2
2
|
//# sourceMappingURL=field-picker.es.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../index-
|
|
1
|
+
"use strict";var e=require("../../index-fc1b32b4.js");require("../../createClass-826941b3.js"),require("../../getPrototypeOf-1e698126.js"),require("../../isArrayLikeObject-f3b27f64.js"),require("../../flexible-table-f14863ac.js"),require("../../extends-86f8d713.js"),require("react"),require("react-intl"),require("react-dom"),require("carbon-components-react"),require("../../_baseForOwn-7d4e8506.js"),require("react-virtualized"),require("react-draggable"),require("@carbon/icons-react"),require("../tooltip.js"),require("react-portal"),require("uuid"),require("react-resize-detector"),require("../../canvas-constants-07dbe4b7.js"),require("../../en-a08356c8.js"),require("../../icon-63afae46.js"),require("react-inlinesvg"),module.exports=e.FieldPicker;
|
|
2
2
|
//# sourceMappingURL=field-picker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{F as t}from"../../flexible-table-
|
|
1
|
+
import{F as t}from"../../flexible-table-d68c24c6.js";export{F as default}from"../../flexible-table-d68c24c6.js";import"../../extends-de3127ea.js";import"../../createClass-be661622.js";import"../../getPrototypeOf-3751add9.js";import"../../isArrayLikeObject-a9c7973b.js";import"react";import"react-intl";import"react-dom";import"carbon-components-react";import"../../_baseForOwn-d38b560e.js";import"react-virtualized";import"react-draggable";import"@carbon/icons-react";import"../tooltip.es.js";import"react-portal";import"uuid";import"react-resize-detector";
|
|
2
2
|
//# sourceMappingURL=flexible-table.es.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../flexible-table-
|
|
1
|
+
"use strict";var e=require("../../flexible-table-f14863ac.js");require("../../extends-86f8d713.js"),require("../../createClass-826941b3.js"),require("../../getPrototypeOf-1e698126.js"),require("../../isArrayLikeObject-f3b27f64.js"),require("react"),require("react-intl"),require("react-dom"),require("carbon-components-react"),require("../../_baseForOwn-7d4e8506.js"),require("react-virtualized"),require("react-draggable"),require("@carbon/icons-react"),require("../tooltip.js"),require("react-portal"),require("uuid"),require("react-resize-detector"),module.exports=e.FlexibleTable;
|
|
2
2
|
//# sourceMappingURL=flexible-table.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{c as CommonProperties,P as PropertiesController}from"../common-properties-
|
|
1
|
+
export{c as CommonProperties,P as PropertiesController}from"../common-properties-9a5037f4.js";export{F as FlexibleTable}from"../flexible-table-d68c24c6.js";export{F as FieldPicker}from"../index-5c0ad9bb.js";import"../createClass-be661622.js";import"../getPrototypeOf-3751add9.js";import"react";import"../en-7201b548.js";import"../isArrayLikeObject-a9c7973b.js";import"../datarecord-metadata-v3-schema-ba1f2849.js";import"carbon-components-react";import"../extends-de3127ea.js";import"react-portal";import"react-redux";import"@carbon/icons-react";import"react-dom";import"../icon-94bf4b86.js";import"react-inlinesvg";import"../canvas-constants-ba465147.js";import"uuid";import"./tooltip.es.js";import"redux";import"seedrandom";import"./command-stack.es.js";import"immutable";import"react-intl";import"date-fns";import"prop-types";import"../toolbar-91001066.js";import"react-resize-detector";import"react-codemirror2";import"jsonschema";import"../_baseForOwn-d38b560e.js";import"react-virtualized";import"react-draggable";
|
|
2
2
|
//# sourceMappingURL=properties.es.js.map
|
package/dist/lib/properties.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../common-properties-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../common-properties-cae41b08.js"),r=require("../flexible-table-f14863ac.js"),i=require("../index-fc1b32b4.js");require("../createClass-826941b3.js"),require("../getPrototypeOf-1e698126.js"),require("react"),require("../en-a08356c8.js"),require("../isArrayLikeObject-f3b27f64.js"),require("../datarecord-metadata-v3-schema-6a3754ce.js"),require("carbon-components-react"),require("../extends-86f8d713.js"),require("react-portal"),require("react-redux"),require("@carbon/icons-react"),require("react-dom"),require("../icon-63afae46.js"),require("react-inlinesvg"),require("../canvas-constants-07dbe4b7.js"),require("uuid"),require("./tooltip.js"),require("redux"),require("seedrandom"),require("./command-stack.js"),require("immutable"),require("react-intl"),require("date-fns"),require("prop-types"),require("../toolbar-393d299e.js"),require("react-resize-detector"),require("react-codemirror2"),require("jsonschema"),require("../_baseForOwn-7d4e8506.js"),require("react-virtualized"),require("react-draggable"),exports.CommonProperties=e.commonProperties,exports.PropertiesController=e.PropertiesController,exports.FlexibleTable=r.FlexibleTable,exports.FieldPicker=i.FieldPicker;
|
|
2
2
|
//# sourceMappingURL=properties.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.es.js","sources":["../../src/tooltip/tooltip.jsx"],"sourcesContent":["/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/*\n\tThis code is a modified version from portal-common-api for the Elyra canvas tooltips\n*/\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Portal } from \"react-portal\";\nimport { Link } from \"carbon-components-react\";\n\nclass ToolTip extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tisTooltipVisible: false\n\t\t};\n\n\t\tthis.pendingTooltip = null;\n\t\tthis.hideTooltipOnScrollAndResize = this.hideTooltipOnScrollAndResize.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\twindow.addEventListener(\"scroll\", this.hideTooltipOnScrollAndResize, true);\n\t\twindow.addEventListener(\"resize\", this.hideTooltipOnScrollAndResize, true);\n\t\tif (this.props.targetObj) {\n\t\t\tthis.setTooltipVisible(true);\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\twindow.removeEventListener(\"scroll\", this.hideTooltipOnScrollAndResize, true);\n\t\twindow.removeEventListener(\"resize\", this.hideTooltipOnScrollAndResize, true);\n\t\tif (this.pendingTooltip) {\n\t\t\tclearTimeout(this.pendingTooltip);\n\t\t}\n\t}\n\n\tsetTooltipVisible(visible) {\n\t\t// clear the display timer if set\n\t\tif (!this.showTooltip() || (!visible && this.pendingTooltip)) {\n\t\t\tclearTimeout(this.pendingTooltip);\n\t\t\tthis.pendingTooltip = null;\n\t\t\tthis.setState({\n\t\t\t\tisTooltipVisible: false\n\t\t\t});\n\t\t}\n\n\n\t\tif (this.showTooltip()) {\n\t\t\tconst tooltip = document.querySelector(\"[data-id='\" + this.props.id + \"']\");\n\t\t\tthis.pendingTooltip = null;\n\t\t\tthis.setState({\n\t\t\t\tisTooltipVisible: visible\n\t\t\t});\n\t\t\t// updates the tooltip display\n\t\t\tif (visible) {\n\t\t\t\tlet tooltipTrigger = null;\n\t\t\t\tif (this.props.targetObj) {\n\t\t\t\t\ttooltipTrigger = this.props.targetObj;\n\t\t\t\t} else {\n\t\t\t\t\ttooltipTrigger = document.querySelector(\"[data-id='\" + this.props.id + \"-trigger']\");\n\t\t\t\t}\n\t\t\t\tif (tooltipTrigger && tooltip) {\n\t\t\t\t\tthis.updateTooltipLayout(tooltip, tooltipTrigger, tooltip.getAttribute(\"direction\"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgetStyleValue(value) {\n\t\treturn value + \"px\";\n\t}\n\n\tgetNewDirection(currentDirection) {\n\t\tlet newDirection;\n\t\tswitch (currentDirection) {\n\t\tcase \"top\":\n\t\t\tnewDirection = \"bottom\";\n\t\t\tbreak;\n\t\tcase \"bottom\":\n\t\t\tnewDirection = \"top\";\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tnewDirection = \"right\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tnewDirection = \"left\";\n\t\t}\n\t\treturn newDirection;\n\t}\n\n\tshowTooltip() {\n\t\tconst canDisplayFullText = this.canDisplayFullText(this.triggerRef);\n\t\tconst showToolTip = (\n\t\t\t// show tooltip if not disabled and showToolTipIfTruncated is false\n\t\t\t(!this.props.disable && !this.props.showToolTipIfTruncated) ||\n\t\t\t// show tooltip if not disabled and showToolTipIfTruncated is true and string is truncated\n\t\t\t(!this.props.disable && this.props.showToolTipIfTruncated && !canDisplayFullText));\n\t\treturn showToolTip;\n\t}\n\n\t// Return true if the string can be displayed in the available space\n\t// Return false if the string is truncated and ellipsis is shown on the UI\n\t// (offsetWidth) is a measurement in pixels of the element's CSS width, including any borders, padding, and vertical scrollbars\n\t// (scrollWidth) value is equal to the minimum width the element would require\n\t// in order to fit all the content in the viewport without using a horizontal scrollbar\n\tcanDisplayFullText(elem) {\n\t\tif (elem) {\n\t\t\tconst firstChildWidth = elem.firstChild && elem.firstChild.scrollWidth ? elem.firstChild.scrollWidth : 0;\n\t\t\tconst displayWidth = elem.offsetWidth;\n\t\t\tlet fullWidth = firstChildWidth;\n\t\t\tif (firstChildWidth === 0) {\n\t\t\t\tfullWidth = elem.scrollWidth;\n\t\t\t}\n\t\t\tconst canDisplayFullText = fullWidth <= displayWidth;\n\t\t\treturn canDisplayFullText;\n\t\t}\n\t\treturn false; // Show tooltip if we cannot read the width (Canvas objects)\n\t}\n\n\tshowTooltipWithDelay() {\n\n\t\t// set a delay on displaying the tooltip\n\t\tif (!this.pendingTooltip && this.showTooltip()) {\n\t\t\tconst that = this;\n\t\t\tthis.pendingTooltip = setTimeout(function() {\n\t\t\t\tthat.setTooltipVisible(true);\n\t\t\t}, this.props.delay);\n\t\t}\n\n\t}\n\n\tupdateTooltipLayout(tooltip, tooltipTrigger, direction) {\n\t\tconst tooltipDirection = direction;\n\t\tconst viewPortWidth = document.documentElement.clientWidth;\n\t\tconst viewPortHeight = document.documentElement.clientHeight;\n\t\tconst triggerLayout = tooltipTrigger.getBoundingClientRect();\n\t\tconst pointer = tooltip.querySelector(\"svg\");\n\t\tconst pointerLayout = pointer.getBoundingClientRect();\n\t\tconst pointerCorrection = 1;\n\n\t\t// always initialize tooltip location so it's all visible to ensure adjustments are done on the right size\n\t\ttooltip.style.left = this.getStyleValue(triggerLayout.left);\n\t\ttooltip.style.top = this.getStyleValue(triggerLayout.top);\n\n\t\tif (this.props.mousePos) {\n\t\t\tthis.updateLocationBasedOnMousePos(tooltip, this.props.mousePos, direction);\n\t\t} else { // tooltip relativ to element\n\t\t\t// tooltip - left correction\n\t\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\t\tlet tooltipLeft = triggerLayout.left;\n\t\t\t\tif (tooltip.offsetWidth > triggerLayout.width) {\n\t\t\t\t\ttooltipLeft -= (tooltip.offsetWidth - triggerLayout.width) / 2; // distribute overlap evenly left and right\n\t\t\t\t\tif (tooltipLeft < 0) {\n\t\t\t\t\t\ttooltipLeft = 2; // hitting left border\n\t\t\t\t\t}\n\t\t\t\t} else if (tooltip.offsetWidth < triggerLayout.width) {\n\t\t\t\t\ttooltipLeft += (triggerLayout.width - tooltip.offsetWidth) / 2; // center tip within triggerLayout\n\t\t\t\t}\n\t\t\t\ttooltip.style.left = this.getStyleValue(tooltipLeft);\n\t\t\t\tif ((tooltipLeft + tooltip.offsetWidth) > viewPortWidth) {\n\t\t\t\t\ttooltip.style.left = this.getStyleValue(viewPortWidth - tooltip.offsetWidth); // hitting right border\n\t\t\t\t}\n\t\t\t} else if (tooltipDirection === \"left\") {\n\t\t\t\t// For long tooltips, tooltip.offsetWidth is updated after setting tooltip.style.left. Ensure tooltip doesn't overlap tooltipTrigger element.\n\t\t\t\twhile ((tooltip.offsetLeft + tooltip.offsetWidth + pointerLayout.width) > Math.round(triggerLayout.left)) {\n\t\t\t\t\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\n\t\t\t\t}\n\t\t\t} else if (tooltipDirection === \"right\") {\n\t\t\t\ttooltip.style.left = this.getStyleValue(triggerLayout.right + pointerLayout.width);\n\t\t\t}\n\n\t\t\t// tooltip - top correction\n\t\t\tif (tooltipDirection === \"top\") {\n\t\t\t\ttooltip.style.top = this.getStyleValue(triggerLayout.top - pointerLayout.height - tooltip.offsetHeight);\n\t\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\t\ttooltip.style.top = this.getStyleValue(triggerLayout.bottom + pointerLayout.height);\n\t\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\t\tlet tooltipTop = triggerLayout.top;\n\t\t\t\tif (tooltip.offsetHeight > triggerLayout.height) {\n\t\t\t\t\ttooltipTop -= (tooltip.offsetHeight - triggerLayout.height) / 2; // distribute overlap evenly top and bottom\n\t\t\t\t\tif (tooltipTop < 0) {\n\t\t\t\t\t\ttooltipTop = triggerLayout.top; // hitting top border\n\t\t\t\t\t}\n\t\t\t\t} else if (tooltip.offsetHeight < triggerLayout.height) {\n\t\t\t\t\ttooltipTop += (triggerLayout.height - tooltip.offsetHeight) / 2; // center tip within triggerLayout\n\t\t\t\t}\n\t\t\t\ttooltip.style.top = this.getStyleValue(tooltipTop + pointerCorrection);\n\t\t\t\tif ((viewPortHeight - tooltip.offsetHeight) < triggerLayout.top) {\n\t\t\t\t\ttooltip.style.top = this.getStyleValue(viewPortHeight - tooltip.offsetHeight); // hitting bottom border\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// pointer - left correction\n\t\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(triggerLayout.left - tooltip.getBoundingClientRect().left +\n\t\t\t\t\ttooltipTrigger.getBoundingClientRect().width / 2 - pointerLayout.width / 2\t + pointerCorrection);\n\t\t\t} else if (tooltipDirection === \"left\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(tooltip.offsetWidth - 3);\n\t\t\t} else if (tooltipDirection === \"right\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(-pointerLayout.width + 2);\n\t\t\t}\n\n\t\t\t// pointer - top correction\n\t\t\tif (tooltipDirection === \"top\") {\n\t\t\t\tpointer.style.top = this.getStyleValue(tooltip.offsetHeight - 5);\n\t\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\t\tpointer.style.top = \"-11px\";\n\t\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\t\tpointer.style.top = this.getStyleValue(triggerLayout.top - tooltip.getBoundingClientRect().top +\n\t\t\t\t\ttooltipTrigger.offsetHeight / 2 - pointerLayout.height / 2);\n\t\t\t}\n\t\t}\n\n\t\t// check if out-of-bounds at the end and if so, trigger new layout on opposite site if not already re-rendered already\n\t\tif (this.isOutOfBounds(tooltip) && tooltip.getAttribute(\"direction\") === tooltipDirection) {\n\t\t\tconst newDirection = this.getNewDirection(tooltipDirection);\n\t\t\tthis.updateTooltipLayout(tooltip, tooltipTrigger, newDirection);\n\t\t\t// update class name directly, otherwise setState triggers re-render loop in canvas\n\t\t\t// also call after updateTooltipLayout, otherwise the newDirection and class of trigger are the same\n\t\t\ttooltip.setAttribute(\"direction\", newDirection);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tupdateLocationBasedOnMousePos(tooltip, mousePos, direction) {\n\t\tconst tooltipDirection = direction;\n\t\tconst viewPortWidth = document.documentElement.clientWidth;\n\t\tconst viewPortHeight = document.documentElement.clientHeight;\n\t\tconst pointer = tooltip.querySelector(\"svg\");\n\t\tconst pointerLayout = pointer.getBoundingClientRect();\n\t\tconst pointerCorrection = 1;\n\n\t\tconst mouseX = this.props.mousePos.x;\n\t\tconst mouseY = this.props.mousePos.y;\n\t\t// if mouse position is passed in, use the cursor as reference point\n\n\t\t// tooltip - left correction\n\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\tlet tooltipLeft = mouseX - tooltip.offsetWidth / 2;\n\t\t\tif ((viewPortWidth - tooltip.offsetWidth) < tooltipLeft) {\n\t\t\t\ttooltipLeft = viewPortWidth - tooltip.offsetWidth; // hitting right border\n\t\t\t} else if (tooltipLeft < 0) {\n\t\t\t\ttooltipLeft = 2; // hitting left border\n\t\t\t}\n\t\t\ttooltip.style.left = this.getStyleValue(tooltipLeft);\n\t\t} else if (tooltipDirection === \"left\") {\n\t\t\ttooltip.style.left = this.getStyleValue(mouseX - tooltip.offsetWidth - pointerLayout.width - 5);\n\t\t} else if (tooltipDirection === \"right\") {\n\t\t\ttooltip.style.left = this.getStyleValue(mouseX + pointerLayout.width + 5);\n\t\t}\n\n\t\t// tooltip - top correction\n\t\tif (tooltipDirection === \"top\") {\n\t\t\ttooltip.style.top = this.getStyleValue(mouseY - pointerLayout.height - tooltip.offsetHeight);\n\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\ttooltip.style.top = this.getStyleValue(mouseY + 2 * pointerLayout.height);\n\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\tlet tooltipTop = mouseY - tooltip.offsetHeight / 2;\n\t\t\tif ((viewPortHeight - tooltip.offsetHeight) < tooltipTop) {\n\t\t\t\ttooltipTop = viewPortHeight - tooltip.offsetHeight; // hitting bottom border\n\t\t\t} else if (tooltipTop < 0) {\n\t\t\t\ttooltipTop = 2; // hitting top border\n\t\t\t}\n\t\t\ttooltip.style.top = this.getStyleValue(tooltipTop + pointerCorrection);\n\t\t}\n\n\t\t// pointer - left correction\n\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\tpointer.style.left = this.getStyleValue(mouseX - tooltip.getBoundingClientRect().left - pointerLayout.width / 2);\n\t\t} else if (tooltipDirection === \"left\") {\n\t\t\tpointer.style.left = this.getStyleValue(tooltip.offsetWidth - 3);\n\t\t} else if (tooltipDirection === \"right\") {\n\t\t\tpointer.style.left = this.getStyleValue(-pointerLayout.width + 2);\n\t\t}\n\n\t\t// pointer - top correction\n\t\tif (tooltipDirection === \"top\") {\n\t\t\tpointer.style.top = this.getStyleValue(tooltip.offsetHeight - 5);\n\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\tpointer.style.top = \"-11px\";\n\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\tpointer.style.top = this.getStyleValue(mouseY - tooltip.getBoundingClientRect().top - pointerLayout.height / 2);\n\t\t}\n\t}\n\n\tisOutOfBounds(tooltip) {\n\t\tconst tooltipLeft = parseFloat(tooltip.style.left);\n\t\tconst tooltipTop = parseFloat(tooltip.style.top);\n\t\treturn (((tooltipLeft + tooltip.offsetWidth) > document.documentElement.clientWidth) || // to the right\n\t\t\t\t(tooltipLeft < 0) || // to the left\n\t\t\t\t(tooltipTop < 0) || // to the top\n\t\t\t\t((tooltipTop + tooltip.offsetHeight) > document.documentElement.clientHeight)); // to the bottom\n\t}\n\n\ttoggleTooltipOnClick(evt) {\n\t\t// 'blur' event occurs before 'click' event. Because of this, onBlur function is called which hides the tooltip.\n\t\t// To prevent this default behavior, stopPropagation and preventDefault is used.\n\t\tevt.stopPropagation();\n\t\tevt.preventDefault();\n\t\tif (this.state.isTooltipVisible) {\n\t\t\t// Tooltip is visible and user clicks on trigger element again, hide tooltip\n\t\t\tthis.setTooltipVisible(false);\n\t\t} else {\n\t\t\tthis.setTooltipVisible(true);\n\t\t}\n\t}\n\n\thideTooltipOnScrollAndResize(evt) {\n\t\tif (this.state.isTooltipVisible) {\n\t\t\tthis.setTooltipVisible(false);\n\t\t}\n\t}\n\n\ttooltipLinkOnClick(url) {\n\t\twindow.open(url, \"_blank\", \"noopener\");\n\t}\n\n\trender() {\n\t\tlet tooltipContent = null;\n\t\tlet triggerContent = null;\n\t\tif (this.props.children) {\n\t\t\t// when children are passed in, tooltip will handle show/hide, otherwise consumer has to hide show/hide tooltip\n\t\t\tconst mouseover = () => this.setTooltipVisible(true);\n\t\t\tconst mouseleave = () => this.setTooltipVisible(false);\n\t\t\tconst mousedown = () => this.setTooltipVisible(false);\n\t\t\t// `focus` event occurs before `click`. Adding timeout in onFocus function to ensure click is executed first.\n\t\t\t// Ref - https://stackoverflow.com/a/49512400\n\t\t\tconst onFocus = () => this.showTooltipWithDelay();\n\t\t\tconst onBlur = (evt) => {\n\t\t\t\t// Keep tooltip visible when clicked on a link.\n\t\t\t\t// Since link is an anchor tag without \"href\" attribute, it has relatedTarget=null\n\t\t\t\tif (evt.relatedTarget !== null) {\n\t\t\t\t\tthis.setTooltipVisible(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst click = (evt) => this.toggleTooltipOnClick(evt);\n\n\t\t\ttriggerContent = (<div\n\t\t\t\tdata-id={this.props.id + \"-trigger\"}\n\t\t\t\tclassName=\"tooltip-trigger\"\n\t\t\t\tonMouseOver={!this.props.showToolTipOnClick ? mouseover : null}\n\t\t\t\tonMouseLeave={!this.props.showToolTipOnClick ? mouseleave : null}\n\t\t\t\tonMouseDown={!this.props.showToolTipOnClick ? mousedown : null}\n\t\t\t\tonClick={this.props.showToolTipOnClick ? click : null}\n\t\t\t\tonFocus={this.props.showToolTipOnClick ? onFocus : null} // When focused using keyboard\n\t\t\t\tonBlur={this.props.showToolTipOnClick ? onBlur : null}\n\t\t\t\ttabIndex={this.props.showToolTipOnClick ? 0 : null}\n\t\t\t\tref={(ref) => (this.triggerRef = ref)}\n\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</div>);\n\t\t}\n\n\t\tif ((typeof this.props.tip) === \"string\") {\n\t\t\ttooltipContent = (\n\t\t\t\t<span id=\"tooltipContainer\">\n\t\t\t\t\t{this.props.tip}\n\t\t\t\t</span>\n\t\t\t);\n\t\t} else if ((typeof this.props.tip) === \"object\") {\n\t\t\ttooltipContent = (\n\t\t\t\t<div id=\"tooltipContainer\">\n\t\t\t\t\t{this.props.tip}\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else if ((typeof this.props.tip) === \"function\") {\n\t\t\ttooltipContent = this.props.tip();\n\t\t}\n\n\t\tlet tipClass = \"common-canvas-tooltip\";\n\t\tif (this.props.className) {\n\t\t\ttipClass += \" \" + this.props.className;\n\t\t}\n\n\t\tlet link = null;\n\t\tif (this.state.isTooltipVisible && this.props.tooltipLinkHandler && this.props.link) {\n\t\t\tconst linkInformation = this.props.tooltipLinkHandler(this.props.link);\n\t\t\t// Verify tooltipLinkHandler returns object in correct format\n\t\t\tif (typeof linkInformation === \"object\" && linkInformation.label && linkInformation.url) {\n\t\t\t\tlink = (<Link\n\t\t\t\t\tclassName=\"tooltip-link\"\n\t\t\t\t\tid={this.props.link.id}\n\t\t\t\t\tonClick={this.tooltipLinkOnClick.bind(this, linkInformation.url)}\n\t\t\t\t>\n\t\t\t\t\t{linkInformation.label}\n\t\t\t\t</Link>);\n\t\t\t}\n\t\t}\n\n\t\tlet tooltip = null;\n\t\tif (tooltipContent || link) {\n\t\t\ttooltip = (\n\t\t\t\t<Portal>\n\t\t\t\t\t<div data-id={this.props.id} className={tipClass} aria-hidden={!this.state.isTooltipVisible} direction={this.props.direction}>\n\t\t\t\t\t\t<svg id=\"tipArrow\" x=\"0px\" y=\"0px\" viewBox=\"0 0 9.1 16.1\">\n\t\t\t\t\t\t\t<polyline points=\"9.1,15.7 1.4,8.1 9.1,0.5\" />\n\t\t\t\t\t\t\t<polygon points=\"8.1,16.1 0,8.1 8.1,0 8.1,1.4 1.4,8.1 8.1,14.7\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{tooltipContent}\n\t\t\t\t\t\t{link}\n\t\t\t\t\t</div>\n\t\t\t\t</Portal>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\n\t\t\t\t{tooltip}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,\n\tlink: PropTypes.object,\n\ttooltipLinkHandler: PropTypes.func,\n\tdirection: PropTypes.oneOf([\"left\", \"right\", \"top\", \"bottom\"]),\n\tchildren: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n\ttargetObj: PropTypes.object,\n\tid: PropTypes.string.isRequired,\n\tclassName: PropTypes.string,\n\tmousePos: PropTypes.object,\n\tdisable: PropTypes.bool, // Tooltip will not show if disabled\n\tshowToolTipIfTruncated: PropTypes.bool, // Set to true to only display tooltip if full text does not fit in displayable width\n\tdelay: PropTypes.number,\n\tshowToolTipOnClick: PropTypes.bool\n};\n\nToolTip.defaultProps = {\n\tdelay: 200,\n\tdirection: \"bottom\",\n\tshowToolTipIfTruncated: false, // False will always show Tooltip even when whole word can be displayed\n\tshowToolTipOnClick: false\n};\n\nexport default ToolTip;\n"],"names":["ToolTip","_inherits","props","_classCallCheck","_this","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","bind","_createClass","key","value","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","currentDirection","newDirection","canDisplayFullText","triggerRef","disable","showToolTipIfTruncated","elem","firstChildWidth","firstChild","scrollWidth","displayWidth","offsetWidth","fullWidth","that","setTimeout","delay","direction","tooltipDirection","viewPortWidth","documentElement","clientWidth","viewPortHeight","clientHeight","triggerLayout","getBoundingClientRect","pointer","pointerLayout","style","left","getStyleValue","top","mousePos","updateLocationBasedOnMousePos","tooltipLeft","width","offsetLeft","Math","round","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","url","open","tooltipContent","triggerContent","children","React","className","onMouseOver","showToolTipOnClick","_this2","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","relatedTarget","tabIndex","ref","tip","_typeof","tipClass","link","tooltipLinkHandler","linkInformation","label","Link","tooltipLinkOnClick","Portal","viewBox","points","Component","defaultProps"],"mappings":"ypBAwBMA,cAAOC,OAAA,WACZ,WAAYC,GAAO,MAO+D,OAP/DC,WAClBC,cAAMF,IACDG,MAAQ,CACZC,kBAAkB,GAGnBF,EAAKG,eAAiB,KACtBH,EAAKI,6BAA+BJ,EAAKI,6BAA6BC,aA0YtE,OAzYAC,MAAAC,wBAAAC,MAED,WACCC,OAAOC,iBAAiB,SAAUC,KAAKP,8BAA8B,GACrEK,OAAOC,iBAAiB,SAAUC,KAAKP,8BAA8B,GACjEO,KAAKb,MAAMc,WACdD,KAAKE,mBAAkB,MAExBN,2BAAAC,MAED,WACCC,OAAOK,oBAAoB,SAAUH,KAAKP,8BAA8B,GACxEK,OAAOK,oBAAoB,SAAUH,KAAKP,8BAA8B,GACpEO,KAAKR,gBACRY,aAAaJ,KAAKR,mBAEnBI,wBAAAC,MAED,SAAkBQ,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,KAAKiG,mBAAmBvG,KAAKM,KAAM8F,EAAgBzB,MAE3DyB,EAAgBC,QAKpB,IAAIvF,EAAU,KAgBd,OAfI+D,GAAkBqB,KACrBpF,EACCkE,gBAACwB,OACAxB,uBAAK,UAAS1E,KAAKb,MAAMwB,GAAIgE,UAAWgB,EAAU,eAAc3F,KAAKV,MAAMC,iBAAkBwC,UAAW/B,KAAKb,MAAM4C,WAClH2C,uBAAK/D,GAAG,WAAWmD,EAAE,MAAME,EAAE,MAAMmC,QAAQ,gBAC1CzB,4BAAU0B,OAAO,6BACjB1B,2BAAS0B,OAAO,mDAEhB7B,EACAqB,KAOJlB,uBAAKC,UAAU,qBACbH,EACAhE,QAGH,EAlZoBkE,EAAM2B,WAqa5BpH,EAAQqH,aAAe,CACtBxE,MAAO,IACPC,UAAW,SACXX,wBAAwB,EACxByD,oBAAoB"}
|
|
1
|
+
{"version":3,"file":"tooltip.es.js","sources":["../../src/tooltip/tooltip.jsx"],"sourcesContent":["/*\n * Copyright 2017-2022 Elyra Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/*\n\tThis code is a modified version from portal-common-api for the Elyra canvas tooltips\n*/\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Portal } from \"react-portal\";\nimport { Link } from \"carbon-components-react\";\n\nclass ToolTip extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\tisTooltipVisible: false\n\t\t};\n\n\t\tthis.pendingTooltip = null;\n\t\tthis.hideTooltipOnScrollAndResize = this.hideTooltipOnScrollAndResize.bind(this);\n\t}\n\n\tcomponentDidMount() {\n\t\twindow.addEventListener(\"scroll\", this.hideTooltipOnScrollAndResize, true);\n\t\twindow.addEventListener(\"resize\", this.hideTooltipOnScrollAndResize, true);\n\t\tif (this.props.targetObj) {\n\t\t\tthis.setTooltipVisible(true);\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\twindow.removeEventListener(\"scroll\", this.hideTooltipOnScrollAndResize, true);\n\t\twindow.removeEventListener(\"resize\", this.hideTooltipOnScrollAndResize, true);\n\t\tif (this.pendingTooltip) {\n\t\t\tclearTimeout(this.pendingTooltip);\n\t\t}\n\t}\n\n\tsetTooltipVisible(visible) {\n\t\t// clear the display timer if set\n\t\tif (!this.showTooltip() || (!visible && this.pendingTooltip)) {\n\t\t\tclearTimeout(this.pendingTooltip);\n\t\t\tthis.pendingTooltip = null;\n\t\t\tthis.setState({\n\t\t\t\tisTooltipVisible: false\n\t\t\t});\n\t\t}\n\n\n\t\tif (this.showTooltip()) {\n\t\t\tconst tooltip = document.querySelector(\"[data-id='\" + this.props.id + \"']\");\n\t\t\tthis.pendingTooltip = null;\n\t\t\tthis.setState({\n\t\t\t\tisTooltipVisible: visible\n\t\t\t});\n\t\t\t// updates the tooltip display\n\t\t\tif (visible) {\n\t\t\t\tlet tooltipTrigger = null;\n\t\t\t\tif (this.props.targetObj) {\n\t\t\t\t\ttooltipTrigger = this.props.targetObj;\n\t\t\t\t} else {\n\t\t\t\t\ttooltipTrigger = document.querySelector(\"[data-id='\" + this.props.id + \"-trigger']\");\n\t\t\t\t}\n\t\t\t\tif (tooltipTrigger && tooltip) {\n\t\t\t\t\tthis.updateTooltipLayout(tooltip, tooltipTrigger, tooltip.getAttribute(\"direction\"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tgetStyleValue(value) {\n\t\treturn value + \"px\";\n\t}\n\n\tgetNewDirection(currentDirection) {\n\t\tlet newDirection;\n\t\tswitch (currentDirection) {\n\t\tcase \"top\":\n\t\t\tnewDirection = \"bottom\";\n\t\t\tbreak;\n\t\tcase \"bottom\":\n\t\t\tnewDirection = \"top\";\n\t\t\tbreak;\n\t\tcase \"left\":\n\t\t\tnewDirection = \"right\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tnewDirection = \"left\";\n\t\t}\n\t\treturn newDirection;\n\t}\n\n\tshowTooltip() {\n\t\tconst canDisplayFullText = this.canDisplayFullText(this.triggerRef);\n\t\tconst showToolTip = (\n\t\t\t// show tooltip if not disabled and showToolTipIfTruncated is false\n\t\t\t(!this.props.disable && !this.props.showToolTipIfTruncated) ||\n\t\t\t// show tooltip if not disabled and showToolTipIfTruncated is true and string is truncated\n\t\t\t(!this.props.disable && this.props.showToolTipIfTruncated && !canDisplayFullText));\n\t\treturn showToolTip;\n\t}\n\n\t// Return true if the string can be displayed in the available space\n\t// Return false if the string is truncated and ellipsis is shown on the UI\n\t// (offsetWidth) is a measurement in pixels of the element's CSS width, including any borders, padding, and vertical scrollbars\n\t// (scrollWidth) value is equal to the minimum width the element would require\n\t// in order to fit all the content in the viewport without using a horizontal scrollbar\n\tcanDisplayFullText(elem) {\n\t\tif (elem) {\n\t\t\tconst firstChildWidth = elem.firstChild && elem.firstChild.scrollWidth ? elem.firstChild.scrollWidth : 0;\n\t\t\tconst displayWidth = elem.offsetWidth;\n\t\t\tlet fullWidth = firstChildWidth;\n\t\t\tif (firstChildWidth === 0) {\n\t\t\t\tfullWidth = elem.scrollWidth;\n\t\t\t}\n\t\t\tconst canDisplayFullText = fullWidth <= displayWidth;\n\t\t\treturn canDisplayFullText;\n\t\t}\n\t\treturn false; // Show tooltip if we cannot read the width (Canvas objects)\n\t}\n\n\tshowTooltipWithDelay() {\n\n\t\t// set a delay on displaying the tooltip\n\t\tif (!this.pendingTooltip && this.showTooltip()) {\n\t\t\tconst that = this;\n\t\t\tthis.pendingTooltip = setTimeout(function() {\n\t\t\t\tthat.setTooltipVisible(true);\n\t\t\t}, this.props.delay);\n\t\t}\n\n\t}\n\n\tupdateTooltipLayout(tooltip, tooltipTrigger, direction) {\n\t\tconst tooltipDirection = direction;\n\t\tconst viewPortWidth = document.documentElement.clientWidth;\n\t\tconst viewPortHeight = document.documentElement.clientHeight;\n\t\tconst triggerLayout = tooltipTrigger.getBoundingClientRect();\n\t\tconst pointer = tooltip.querySelector(\"svg\");\n\t\tconst pointerLayout = pointer.getBoundingClientRect();\n\t\tconst pointerCorrection = 1;\n\n\t\t// always initialize tooltip location so it's all visible to ensure adjustments are done on the right size\n\t\ttooltip.style.left = this.getStyleValue(triggerLayout.left);\n\t\ttooltip.style.top = this.getStyleValue(triggerLayout.top);\n\n\t\tif (this.props.mousePos) {\n\t\t\tthis.updateLocationBasedOnMousePos(tooltip, this.props.mousePos, direction);\n\t\t} else { // tooltip relativ to element\n\t\t\t// tooltip - left correction\n\t\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\t\tlet tooltipLeft = triggerLayout.left;\n\t\t\t\tif (tooltip.offsetWidth > triggerLayout.width) {\n\t\t\t\t\ttooltipLeft -= (tooltip.offsetWidth - triggerLayout.width) / 2; // distribute overlap evenly left and right\n\t\t\t\t\tif (tooltipLeft < 0) {\n\t\t\t\t\t\ttooltipLeft = 2; // hitting left border\n\t\t\t\t\t}\n\t\t\t\t} else if (tooltip.offsetWidth < triggerLayout.width) {\n\t\t\t\t\ttooltipLeft += (triggerLayout.width - tooltip.offsetWidth) / 2; // center tip within triggerLayout\n\t\t\t\t}\n\t\t\t\ttooltip.style.left = this.getStyleValue(tooltipLeft);\n\t\t\t\tif ((tooltipLeft + tooltip.offsetWidth) > viewPortWidth) {\n\t\t\t\t\ttooltip.style.left = this.getStyleValue(viewPortWidth - tooltip.offsetWidth); // hitting right border\n\t\t\t\t}\n\t\t\t} else if (tooltipDirection === \"left\") {\n\t\t\t\t// For long tooltips, tooltip.offsetWidth is updated after setting tooltip.style.left. Ensure tooltip doesn't overlap tooltipTrigger element.\n\t\t\t\twhile ((tooltip.offsetLeft + tooltip.offsetWidth + pointerLayout.width) > Math.round(triggerLayout.left)) {\n\t\t\t\t\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\n\t\t\t\t}\n\t\t\t} else if (tooltipDirection === \"right\") {\n\t\t\t\ttooltip.style.left = this.getStyleValue(triggerLayout.right + pointerLayout.width);\n\t\t\t}\n\n\t\t\t// tooltip - top correction\n\t\t\tif (tooltipDirection === \"top\") {\n\t\t\t\ttooltip.style.top = this.getStyleValue(triggerLayout.top - pointerLayout.height - tooltip.offsetHeight);\n\t\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\t\ttooltip.style.top = this.getStyleValue(triggerLayout.bottom + pointerLayout.height);\n\t\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\t\tlet tooltipTop = triggerLayout.top;\n\t\t\t\tif (tooltip.offsetHeight > triggerLayout.height) {\n\t\t\t\t\ttooltipTop -= (tooltip.offsetHeight - triggerLayout.height) / 2; // distribute overlap evenly top and bottom\n\t\t\t\t\tif (tooltipTop < 0) {\n\t\t\t\t\t\ttooltipTop = triggerLayout.top; // hitting top border\n\t\t\t\t\t}\n\t\t\t\t} else if (tooltip.offsetHeight < triggerLayout.height) {\n\t\t\t\t\ttooltipTop += (triggerLayout.height - tooltip.offsetHeight) / 2; // center tip within triggerLayout\n\t\t\t\t}\n\t\t\t\ttooltip.style.top = this.getStyleValue(tooltipTop + pointerCorrection);\n\t\t\t\tif ((viewPortHeight - tooltip.offsetHeight) < triggerLayout.top) {\n\t\t\t\t\ttooltip.style.top = this.getStyleValue(viewPortHeight - tooltip.offsetHeight); // hitting bottom border\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// pointer - left correction\n\t\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(triggerLayout.left - tooltip.getBoundingClientRect().left +\n\t\t\t\t\ttooltipTrigger.getBoundingClientRect().width / 2 - pointerLayout.width / 2\t + pointerCorrection);\n\t\t\t} else if (tooltipDirection === \"left\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(tooltip.offsetWidth - 3);\n\t\t\t} else if (tooltipDirection === \"right\") {\n\t\t\t\tpointer.style.left = this.getStyleValue(-pointerLayout.width + 2);\n\t\t\t}\n\n\t\t\t// pointer - top correction\n\t\t\tif (tooltipDirection === \"top\") {\n\t\t\t\tpointer.style.top = this.getStyleValue(tooltip.offsetHeight - 5);\n\t\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\t\tpointer.style.top = \"-11px\";\n\t\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\t\tpointer.style.top = this.getStyleValue(triggerLayout.top - tooltip.getBoundingClientRect().top +\n\t\t\t\t\ttooltipTrigger.offsetHeight / 2 - pointerLayout.height / 2);\n\t\t\t}\n\t\t}\n\n\t\t// check if out-of-bounds at the end and if so, trigger new layout on opposite site if not already re-rendered already\n\t\tif (this.isOutOfBounds(tooltip) && tooltip.getAttribute(\"direction\") === tooltipDirection) {\n\t\t\tconst newDirection = this.getNewDirection(tooltipDirection);\n\t\t\tthis.updateTooltipLayout(tooltip, tooltipTrigger, newDirection);\n\t\t\t// update class name directly, otherwise setState triggers re-render loop in canvas\n\t\t\t// also call after updateTooltipLayout, otherwise the newDirection and class of trigger are the same\n\t\t\ttooltip.setAttribute(\"direction\", newDirection);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tupdateLocationBasedOnMousePos(tooltip, mousePos, direction) {\n\t\tconst tooltipDirection = direction;\n\t\tconst viewPortWidth = document.documentElement.clientWidth;\n\t\tconst viewPortHeight = document.documentElement.clientHeight;\n\t\tconst pointer = tooltip.querySelector(\"svg\");\n\t\tconst pointerLayout = pointer.getBoundingClientRect();\n\t\tconst pointerCorrection = 1;\n\n\t\tconst mouseX = this.props.mousePos.x;\n\t\tconst mouseY = this.props.mousePos.y;\n\t\t// if mouse position is passed in, use the cursor as reference point\n\n\t\t// tooltip - left correction\n\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\tlet tooltipLeft = mouseX - tooltip.offsetWidth / 2;\n\t\t\tif ((viewPortWidth - tooltip.offsetWidth) < tooltipLeft) {\n\t\t\t\ttooltipLeft = viewPortWidth - tooltip.offsetWidth; // hitting right border\n\t\t\t} else if (tooltipLeft < 0) {\n\t\t\t\ttooltipLeft = 2; // hitting left border\n\t\t\t}\n\t\t\ttooltip.style.left = this.getStyleValue(tooltipLeft);\n\t\t} else if (tooltipDirection === \"left\") {\n\t\t\ttooltip.style.left = this.getStyleValue(mouseX - tooltip.offsetWidth - pointerLayout.width - 5);\n\t\t} else if (tooltipDirection === \"right\") {\n\t\t\ttooltip.style.left = this.getStyleValue(mouseX + pointerLayout.width + 5);\n\t\t}\n\n\t\t// tooltip - top correction\n\t\tif (tooltipDirection === \"top\") {\n\t\t\ttooltip.style.top = this.getStyleValue(mouseY - pointerLayout.height - tooltip.offsetHeight);\n\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\ttooltip.style.top = this.getStyleValue(mouseY + 2 * pointerLayout.height);\n\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\tlet tooltipTop = mouseY - tooltip.offsetHeight / 2;\n\t\t\tif ((viewPortHeight - tooltip.offsetHeight) < tooltipTop) {\n\t\t\t\ttooltipTop = viewPortHeight - tooltip.offsetHeight; // hitting bottom border\n\t\t\t} else if (tooltipTop < 0) {\n\t\t\t\ttooltipTop = 2; // hitting top border\n\t\t\t}\n\t\t\ttooltip.style.top = this.getStyleValue(tooltipTop + pointerCorrection);\n\t\t}\n\n\t\t// pointer - left correction\n\t\tif (tooltipDirection === \"top\" || tooltipDirection === \"bottom\") {\n\t\t\tpointer.style.left = this.getStyleValue(mouseX - tooltip.getBoundingClientRect().left - pointerLayout.width / 2);\n\t\t} else if (tooltipDirection === \"left\") {\n\t\t\tpointer.style.left = this.getStyleValue(tooltip.offsetWidth - 3);\n\t\t} else if (tooltipDirection === \"right\") {\n\t\t\tpointer.style.left = this.getStyleValue(-pointerLayout.width + 2);\n\t\t}\n\n\t\t// pointer - top correction\n\t\tif (tooltipDirection === \"top\") {\n\t\t\tpointer.style.top = this.getStyleValue(tooltip.offsetHeight - 5);\n\t\t} else if (tooltipDirection === \"bottom\") {\n\t\t\tpointer.style.top = \"-11px\";\n\t\t} else if (tooltipDirection === \"left\" || tooltipDirection === \"right\") {\n\t\t\tpointer.style.top = this.getStyleValue(mouseY - tooltip.getBoundingClientRect().top - pointerLayout.height / 2);\n\t\t}\n\t}\n\n\tisOutOfBounds(tooltip) {\n\t\tconst tooltipLeft = parseFloat(tooltip.style.left);\n\t\tconst tooltipTop = parseFloat(tooltip.style.top);\n\t\treturn (((tooltipLeft + tooltip.offsetWidth) > document.documentElement.clientWidth) || // to the right\n\t\t\t\t(tooltipLeft < 0) || // to the left\n\t\t\t\t(tooltipTop < 0) || // to the top\n\t\t\t\t((tooltipTop + tooltip.offsetHeight) > document.documentElement.clientHeight)); // to the bottom\n\t}\n\n\ttoggleTooltipOnClick(evt) {\n\t\t// 'blur' event occurs before 'click' event. Because of this, onBlur function is called which hides the tooltip.\n\t\t// To prevent this default behavior, stopPropagation and preventDefault is used.\n\t\tevt.stopPropagation();\n\t\tevt.preventDefault();\n\t\tif (this.state.isTooltipVisible) {\n\t\t\t// Tooltip is visible and user clicks on trigger element again, hide tooltip\n\t\t\tthis.setTooltipVisible(false);\n\t\t} else {\n\t\t\tthis.setTooltipVisible(true);\n\t\t}\n\t}\n\n\thideTooltipOnScrollAndResize(evt) {\n\t\tif (this.state.isTooltipVisible) {\n\t\t\tthis.setTooltipVisible(false);\n\t\t}\n\t}\n\n\ttooltipLinkOnClick(url) {\n\t\twindow.open(url, \"_blank\", \"noopener\");\n\t}\n\n\trender() {\n\t\tlet tooltipContent = null;\n\t\tlet triggerContent = null;\n\t\tif (this.props.children) {\n\t\t\t// when children are passed in, tooltip will handle show/hide, otherwise consumer has to hide show/hide tooltip\n\t\t\tconst mouseover = () => this.setTooltipVisible(true);\n\t\t\tconst mouseleave = () => this.setTooltipVisible(false);\n\t\t\tconst mousedown = () => this.setTooltipVisible(false);\n\t\t\t// `focus` event occurs before `click`. Adding timeout in onFocus function to ensure click is executed first.\n\t\t\t// Ref - https://stackoverflow.com/a/49512400\n\t\t\tconst onFocus = () => this.showTooltipWithDelay();\n\t\t\tconst onBlur = (evt) => {\n\t\t\t\t// Keep tooltip visible when clicked on a link.\n\t\t\t\t// Since link is an anchor tag without \"href\" attribute, it has relatedTarget=null\n\t\t\t\tif (evt.relatedTarget !== null) {\n\t\t\t\t\tthis.setTooltipVisible(false);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst click = (evt) => this.toggleTooltipOnClick(evt);\n\n\t\t\ttriggerContent = (<div\n\t\t\t\tdata-id={this.props.id + \"-trigger\"}\n\t\t\t\tclassName=\"tooltip-trigger\"\n\t\t\t\tonMouseOver={!this.props.showToolTipOnClick ? mouseover : null}\n\t\t\t\tonMouseLeave={!this.props.showToolTipOnClick ? mouseleave : null}\n\t\t\t\tonMouseDown={!this.props.showToolTipOnClick ? mousedown : null}\n\t\t\t\tonClick={this.props.showToolTipOnClick ? click : null}\n\t\t\t\tonFocus={this.props.showToolTipOnClick ? onFocus : null} // When focused using keyboard\n\t\t\t\tonBlur={this.props.showToolTipOnClick ? onBlur : null}\n\t\t\t\ttabIndex={this.props.showToolTipOnClick ? 0 : null}\n\t\t\t\tref={(ref) => (this.triggerRef = ref)}\n\t\t\t>\n\t\t\t\t{this.props.children}\n\t\t\t</div>);\n\t\t}\n\n\t\tif ((typeof this.props.tip) === \"string\") {\n\t\t\ttooltipContent = (\n\t\t\t\t<span id=\"tooltipContainer\">\n\t\t\t\t\t{this.props.tip}\n\t\t\t\t</span>\n\t\t\t);\n\t\t} else if ((typeof this.props.tip) === \"object\") {\n\t\t\ttooltipContent = (\n\t\t\t\t<div id=\"tooltipContainer\">\n\t\t\t\t\t{this.props.tip}\n\t\t\t\t</div>\n\t\t\t);\n\t\t} else if ((typeof this.props.tip) === \"function\") {\n\t\t\ttooltipContent = this.props.tip();\n\t\t}\n\n\t\tlet tipClass = \"common-canvas-tooltip\";\n\t\tif (this.props.className) {\n\t\t\ttipClass += \" \" + this.props.className;\n\t\t}\n\n\t\tlet link = null;\n\t\tif (this.state.isTooltipVisible && this.props.tooltipLinkHandler && this.props.link) {\n\t\t\tconst linkInformation = this.props.tooltipLinkHandler(this.props.link);\n\t\t\t// Verify tooltipLinkHandler returns object in correct format\n\t\t\tif (typeof linkInformation === \"object\" && linkInformation.label && linkInformation.url) {\n\t\t\t\tlink = (<Link\n\t\t\t\t\tclassName=\"tooltip-link\"\n\t\t\t\t\tid={this.props.link.id}\n\t\t\t\t\tonClick={this.tooltipLinkOnClick.bind(this, linkInformation.url)}\n\t\t\t\t>\n\t\t\t\t\t{linkInformation.label}\n\t\t\t\t</Link>);\n\t\t\t}\n\t\t}\n\n\t\tlet tooltip = null;\n\t\tif (tooltipContent || link) {\n\t\t\ttooltip = (\n\t\t\t\t<Portal>\n\t\t\t\t\t<div data-id={this.props.id} className={tipClass} aria-hidden={!this.state.isTooltipVisible} direction={this.props.direction}>\n\t\t\t\t\t\t<svg id=\"tipArrow\" x=\"0px\" y=\"0px\" viewBox=\"0 0 9.1 16.1\">\n\t\t\t\t\t\t\t<polyline points=\"9.1,15.7 1.4,8.1 9.1,0.5\" />\n\t\t\t\t\t\t\t<polygon points=\"8.1,16.1 0,8.1 8.1,0 8.1,1.4 1.4,8.1 8.1,14.7\" />\n\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t{tooltipContent}\n\t\t\t\t\t\t{link}\n\t\t\t\t\t</div>\n\t\t\t\t</Portal>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\n\t\t\t\t{tooltip}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.func]).isRequired,\n\tlink: PropTypes.object,\n\ttooltipLinkHandler: PropTypes.func,\n\tdirection: PropTypes.oneOf([\"left\", \"right\", \"top\", \"bottom\"]),\n\tchildren: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n\ttargetObj: PropTypes.object,\n\tid: PropTypes.string.isRequired,\n\tclassName: PropTypes.string,\n\tmousePos: PropTypes.object,\n\tdisable: PropTypes.bool, // Tooltip will not show if disabled\n\tshowToolTipIfTruncated: PropTypes.bool, // Set to true to only display tooltip if full text does not fit in displayable width\n\tdelay: PropTypes.number,\n\tshowToolTipOnClick: PropTypes.bool\n};\n\nToolTip.defaultProps = {\n\tdelay: 200,\n\tdirection: \"bottom\",\n\tshowToolTipIfTruncated: false, // False will always show Tooltip even when whole word can be displayed\n\tshowToolTipOnClick: false\n};\n\nexport default ToolTip;\n"],"names":["ToolTip","_React$Component","_inherits","_super","_createSuper","props","_this","_classCallCheck","call","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","bind","_assertThisInitialized","_createClass","key","value","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","currentDirection","newDirection","canDisplayFullText","triggerRef","disable","showToolTipIfTruncated","elem","firstChildWidth","firstChild","scrollWidth","displayWidth","offsetWidth","fullWidth","that","setTimeout","delay","direction","tooltipDirection","viewPortWidth","documentElement","clientWidth","viewPortHeight","clientHeight","triggerLayout","getBoundingClientRect","pointer","pointerLayout","style","left","getStyleValue","top","mousePos","updateLocationBasedOnMousePos","tooltipLeft","width","offsetLeft","Math","round","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","url","open","_this2","tooltipContent","triggerContent","children","React","createElement","className","onMouseOver","showToolTipOnClick","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","relatedTarget","tabIndex","ref","tip","_typeof","tipClass","link","tooltipLinkHandler","linkInformation","label","Link","tooltipLinkOnClick","Portal","viewBox","points","Component","defaultProps"],"mappings":"ypBAwBMA,WAAOC,GAAAC,EAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GACZ,SAAAA,EAAYK,GAAO,IAAAC,EAO+D,OAP/DC,OAAAP,IAClBM,EAAAH,EAAAK,UAAMH,IACDI,MAAQ,CACZC,kBAAkB,GAGnBJ,EAAKK,eAAiB,KACtBL,EAAKM,6BAA+BN,EAAKM,6BAA6BC,KAAIC,EAAAR,IAAOA,EA0YjF,OAzYAS,EAAAf,IAAAgB,wBAAAC,MAED,WACCC,OAAOC,iBAAiB,SAAUC,KAAKR,8BAA8B,GACrEM,OAAOC,iBAAiB,SAAUC,KAAKR,8BAA8B,GACjEQ,KAAKf,MAAMgB,WACdD,KAAKE,mBAAkB,MAExBN,2BAAAC,MAED,WACCC,OAAOK,oBAAoB,SAAUH,KAAKR,8BAA8B,GACxEM,OAAOK,oBAAoB,SAAUH,KAAKR,8BAA8B,GACpEQ,KAAKT,gBACRa,aAAaJ,KAAKT,mBAEnBK,wBAAAC,MAED,SAAkBQ,GAWjB,KATKL,KAAKM,gBAAmBD,GAAWL,KAAKT,kBAC5Ca,aAAaJ,KAAKT,gBAClBS,KAAKT,eAAiB,KACtBS,KAAKO,SAAS,CACbjB,kBAAkB,KAKhBU,KAAKM,cAAe,CACvB,IAAME,EAAUC,SAASC,cAAc,aAAeV,KAAKf,MAAM0B,GAAK,MAMtE,GALAX,KAAKT,eAAiB,KACtBS,KAAKO,SAAS,CACbjB,iBAAkBe,IAGfA,EAAS,CACZ,IAAIO,EAAiB,MAEpBA,EADGZ,KAAKf,MAAMgB,UACGD,KAAKf,MAAMgB,UAEXQ,SAASC,cAAc,aAAeV,KAAKf,MAAM0B,GAAK,gBAElDH,GACrBR,KAAKa,oBAAoBL,EAASI,EAAgBJ,EAAQM,aAAa,mBAI1ElB,oBAA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