@elyra/canvas 12.9.0 → 12.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (419) hide show
  1. package/.eslintrc.js +1 -1
  2. package/README.md +1 -1
  3. package/build.sh +1 -1
  4. package/dist/canvas-controller-5c90a709.js +2 -0
  5. package/dist/canvas-controller-5c90a709.js.map +1 -0
  6. package/dist/canvas-controller-a851a663.js +2 -0
  7. package/dist/canvas-controller-a851a663.js.map +1 -0
  8. package/dist/common-canvas.es.js +1 -1
  9. package/dist/common-canvas.es.js.map +1 -1
  10. package/dist/common-canvas.js +1 -1
  11. package/dist/common-canvas.js.map +1 -1
  12. package/dist/common-properties-3758e3b2.js +2 -0
  13. package/dist/common-properties-3758e3b2.js.map +1 -0
  14. package/dist/common-properties-6334cca1.js +2 -0
  15. package/dist/common-properties-6334cca1.js.map +1 -0
  16. package/dist/datarecord-metadata-v3-schema-3a2957c3.js +2 -0
  17. package/dist/datarecord-metadata-v3-schema-3a2957c3.js.map +1 -0
  18. package/dist/datarecord-metadata-v3-schema-82f2b977.js +2 -0
  19. package/dist/datarecord-metadata-v3-schema-82f2b977.js.map +1 -0
  20. package/dist/{en-3f6094d9.js → en-9e368daa.js} +2 -2
  21. package/dist/{en-3f6094d9.js.map → en-9e368daa.js.map} +1 -1
  22. package/dist/{en-8e5bfa1b.js → en-a3710fcf.js} +2 -2
  23. package/dist/{en-8e5bfa1b.js.map → en-a3710fcf.js.map} +1 -1
  24. package/dist/extends-41535aa9.js +7 -0
  25. package/dist/extends-41535aa9.js.map +1 -0
  26. package/dist/{extends-112ec8af.js → extends-76e6b8d2.js} +2 -2
  27. package/dist/extends-76e6b8d2.js.map +1 -0
  28. package/dist/{flexible-table-20276887.js → flexible-table-2bbb9e48.js} +2 -2
  29. package/dist/{flexible-table-20276887.js.map → flexible-table-2bbb9e48.js.map} +1 -1
  30. package/dist/{flexible-table-13570aa9.js → flexible-table-756ff86a.js} +2 -2
  31. package/dist/{flexible-table-13570aa9.js.map → flexible-table-756ff86a.js.map} +1 -1
  32. package/dist/{index-c21aec1b.js → index-1eff5860.js} +2 -2
  33. package/dist/{index-c21aec1b.js.map → index-1eff5860.js.map} +1 -1
  34. package/dist/index-7fba99b9.js +2 -0
  35. package/dist/{index-7e2e5c97.js.map → index-7fba99b9.js.map} +1 -1
  36. package/dist/{isEmpty-6528e7c8.js → isEmpty-3550e76f.js} +2 -2
  37. package/dist/{isEmpty-6528e7c8.js.map → isEmpty-3550e76f.js.map} +1 -1
  38. package/dist/{isEmpty-5d2981b6.js → isEmpty-c6f783dd.js} +2 -2
  39. package/dist/{isEmpty-5d2981b6.js.map → isEmpty-c6f783dd.js.map} +1 -1
  40. package/dist/lib/canvas.es.js +1 -1
  41. package/dist/lib/canvas.js +1 -1
  42. package/dist/lib/command-stack.es.js.map +1 -1
  43. package/dist/lib/command-stack.js.map +1 -1
  44. package/dist/lib/context-menu.es.js +1 -1
  45. package/dist/lib/context-menu.es.js.map +1 -1
  46. package/dist/lib/context-menu.js +1 -1
  47. package/dist/lib/context-menu.js.map +1 -1
  48. package/dist/lib/properties/field-picker.es.js +1 -1
  49. package/dist/lib/properties/field-picker.js +1 -1
  50. package/dist/lib/properties/flexible-table.es.js +1 -1
  51. package/dist/lib/properties/flexible-table.js +1 -1
  52. package/dist/lib/properties.es.js +1 -1
  53. package/dist/lib/properties.js +1 -1
  54. package/dist/lib/tooltip.es.js.map +1 -1
  55. package/dist/lib/tooltip.js.map +1 -1
  56. package/dist/styles/common-canvas.min.css +1 -1
  57. package/dist/styles/common-canvas.min.css.map +1 -1
  58. package/locales/command-actions/locales/index.js +1 -1
  59. package/locales/common-canvas/locales/index.js +1 -1
  60. package/locales/common-properties/locales/index.js +1 -1
  61. package/locales/palette/locales/index.js +1 -1
  62. package/locales/toolbar/locales/index.js +1 -1
  63. package/package.json +2 -2
  64. package/rollup.config.js +1 -1
  65. package/src/.eslintrc.js +1 -1
  66. package/src/command-actions/arrangeLayoutAction.js +1 -1
  67. package/src/command-actions/attachNodeToLinksAction.js +1 -1
  68. package/src/command-actions/collapseSuperNodeInPlaceAction.js +1 -1
  69. package/src/command-actions/commonPropertiesAction.js +1 -1
  70. package/src/command-actions/convertSuperNodeExternalToLocalAction.js +1 -1
  71. package/src/command-actions/convertSuperNodeLocalToExternalAction.js +1 -1
  72. package/src/command-actions/createAutoNodeAction.js +1 -1
  73. package/src/command-actions/createCommentAction.js +1 -1
  74. package/src/command-actions/createCommentLinkAction.js +1 -1
  75. package/src/command-actions/createNodeAction.js +1 -1
  76. package/src/command-actions/createNodeAttachLinksAction.js +1 -1
  77. package/src/command-actions/createNodeLinkAction.js +1 -1
  78. package/src/command-actions/createNodeLinkDetachedAction.js +1 -1
  79. package/src/command-actions/createNodeOnLinkAction.js +1 -1
  80. package/src/command-actions/createSuperNodeAction.js +1 -1
  81. package/src/command-actions/deconstructSuperNodeAction.js +1 -1
  82. package/src/command-actions/deleteLinkAction.js +1 -1
  83. package/src/command-actions/deleteObjectsAction.js +1 -1
  84. package/src/command-actions/disconnectObjectsAction.js +1 -1
  85. package/src/command-actions/displayPreviousPipelineAction.js +1 -1
  86. package/src/command-actions/displaySubPipelineAction.js +1 -1
  87. package/src/command-actions/editCommentAction.js +1 -1
  88. package/src/command-actions/editDecorationLabelAction.js +1 -1
  89. package/src/command-actions/expandSuperNodeInPlaceAction.js +1 -1
  90. package/src/command-actions/insertNodeIntoLinkAction.js +1 -1
  91. package/src/command-actions/moveObjectsAction.js +1 -1
  92. package/src/command-actions/pasteAction.js +1 -1
  93. package/src/command-actions/saveToPaletteAction.js +1 -1
  94. package/src/command-actions/setLinksStyleAction.js +2 -2
  95. package/src/command-actions/setNodeLabelAction.js +1 -1
  96. package/src/command-actions/setObjectsStyleAction.js +2 -2
  97. package/src/command-actions/sizeAndPositionObjectsAction.js +1 -1
  98. package/src/command-actions/updateLinkAction.js +1 -1
  99. package/src/command-stack/action.js +1 -1
  100. package/src/command-stack/command-stack.js +1 -1
  101. package/src/common-canvas/canvas-controller.js +79 -10
  102. package/src/common-canvas/cc-bottom-panel.jsx +1 -1
  103. package/src/common-canvas/cc-central-items.jsx +1 -1
  104. package/src/common-canvas/cc-contents.jsx +11 -3
  105. package/src/common-canvas/cc-context-menu.jsx +1 -1
  106. package/src/common-canvas/cc-right-flyout.jsx +1 -1
  107. package/src/common-canvas/cc-toolbar.jsx +14 -9
  108. package/src/common-canvas/common-canvas-utils.js +1 -1
  109. package/src/common-canvas/common-canvas.jsx +25 -5
  110. package/src/common-canvas/common-canvas.scss +1 -1
  111. package/src/common-canvas/d3-zoom-extension/.eslintrc.js +1 -1
  112. package/src/common-canvas/index.js +1 -1
  113. package/src/common-canvas/label-util.js +1 -1
  114. package/src/common-canvas/local-storage.js +1 -1
  115. package/src/common-canvas/svg-canvas-d3.js +40 -33
  116. package/src/common-canvas/svg-canvas-d3.scss +1 -1
  117. package/src/common-canvas/svg-canvas-renderer.js +56 -35
  118. package/src/common-canvas/svg-canvas-utils-comments.js +1 -1
  119. package/src/common-canvas/svg-canvas-utils-decs.js +1 -1
  120. package/src/common-canvas/svg-canvas-utils-display.js +1 -1
  121. package/src/common-canvas/svg-canvas-utils-links.js +1 -1
  122. package/src/common-canvas/svg-canvas-utils-nodes.js +1 -1
  123. package/src/common-properties/actions/action-factory.js +1 -1
  124. package/src/common-properties/actions/actions.scss +1 -1
  125. package/src/common-properties/actions/button/button.jsx +1 -1
  126. package/src/common-properties/actions/button/button.scss +1 -1
  127. package/src/common-properties/actions/button/index.js +1 -1
  128. package/src/common-properties/actions/image/image.jsx +1 -1
  129. package/src/common-properties/actions/image/image.scss +1 -1
  130. package/src/common-properties/actions/image/index.js +1 -1
  131. package/src/common-properties/actions.js +1 -1
  132. package/src/common-properties/common-properties.jsx +1 -1
  133. package/src/common-properties/components/components.scss +1 -1
  134. package/src/common-properties/components/control-item/control-item.jsx +1 -1
  135. package/src/common-properties/components/control-item/control-item.scss +1 -1
  136. package/src/common-properties/components/control-item/index.js +1 -1
  137. package/src/common-properties/components/editor-form/editor-form.jsx +1 -1
  138. package/src/common-properties/components/editor-form/editor-form.scss +1 -1
  139. package/src/common-properties/components/editor-form/index.js +1 -1
  140. package/src/common-properties/components/empty-table/empty-table.jsx +1 -1
  141. package/src/common-properties/components/empty-table/empty-table.scss +1 -1
  142. package/src/common-properties/components/empty-table/index.js +1 -1
  143. package/src/common-properties/components/field-picker/field-picker.jsx +1 -1
  144. package/src/common-properties/components/field-picker/field-picker.scss +1 -1
  145. package/src/common-properties/components/field-picker/index.js +1 -1
  146. package/src/common-properties/components/flexible-table/flexible-table.jsx +1 -1
  147. package/src/common-properties/components/flexible-table/index.js +1 -1
  148. package/src/common-properties/components/main-editor-properties-buttons/index.js +1 -1
  149. package/src/common-properties/components/main-editor-properties-buttons/main-editor-properties-buttons.jsx +1 -1
  150. package/src/common-properties/components/moveable-table-rows/index.js +1 -1
  151. package/src/common-properties/components/moveable-table-rows/moveable-table-rows.jsx +1 -1
  152. package/src/common-properties/components/moveable-table-rows/moveable-table-rows.scss +1 -1
  153. package/src/common-properties/components/properties-buttons/index.js +1 -1
  154. package/src/common-properties/components/properties-buttons/properties-buttons.jsx +1 -1
  155. package/src/common-properties/components/properties-buttons/properties-buttons.scss +1 -1
  156. package/src/common-properties/components/properties-editor/index.js +1 -1
  157. package/src/common-properties/components/properties-editor/properties-editor.jsx +1 -1
  158. package/src/common-properties/components/properties-modal/index.js +1 -1
  159. package/src/common-properties/components/properties-modal/properties-modal.jsx +1 -1
  160. package/src/common-properties/components/properties-modal/properties-modal.scss +1 -1
  161. package/src/common-properties/components/title-editor/index.js +1 -1
  162. package/src/common-properties/components/title-editor/title-editor.jsx +1 -1
  163. package/src/common-properties/components/title-editor/title-editor.scss +1 -1
  164. package/src/common-properties/components/truncated-content-tooltip/index.js +1 -1
  165. package/src/common-properties/components/truncated-content-tooltip/truncated-content-tooltip.jsx +7 -2
  166. package/src/common-properties/components/truncated-content-tooltip/truncated-content-tooltip.scss +1 -1
  167. package/src/common-properties/components/validation-message/index.js +1 -1
  168. package/src/common-properties/components/validation-message/validation-message.jsx +1 -1
  169. package/src/common-properties/components/validation-message/validation-message.scss +1 -1
  170. package/src/common-properties/components/virtualized-table/index.js +1 -1
  171. package/src/common-properties/components/virtualized-table/virtualized-table.jsx +1 -1
  172. package/src/common-properties/components/virtualized-table/virtualized-table.scss +1 -1
  173. package/src/common-properties/components/wide-flyout/index.js +1 -1
  174. package/src/common-properties/components/wide-flyout/wide-flyout.jsx +1 -1
  175. package/src/common-properties/components/wide-flyout/wide-flyout.scss +1 -1
  176. package/src/common-properties/constants/constants.js +2 -2
  177. package/src/common-properties/constants/form-constants.js +1 -1
  178. package/src/common-properties/controls/abstract-table.jsx +1 -1
  179. package/src/common-properties/controls/abstract-table.scss +1 -1
  180. package/src/common-properties/controls/checkbox/checkbox.jsx +1 -1
  181. package/src/common-properties/controls/checkbox/checkbox.scss +1 -1
  182. package/src/common-properties/controls/checkbox/index.js +1 -1
  183. package/src/common-properties/controls/checkboxset/checkboxset.jsx +1 -1
  184. package/src/common-properties/controls/checkboxset/checkboxset.scss +1 -1
  185. package/src/common-properties/controls/checkboxset/index.js +1 -1
  186. package/src/common-properties/controls/control-factory.js +1 -1
  187. package/src/common-properties/controls/controls.scss +1 -1
  188. package/src/common-properties/controls/datefield/datefield.jsx +32 -32
  189. package/src/common-properties/controls/datefield/index.js +1 -1
  190. package/src/common-properties/controls/dropdown/dropdown.jsx +1 -1
  191. package/src/common-properties/controls/dropdown/dropdown.scss +1 -1
  192. package/src/common-properties/controls/dropdown/index.js +1 -1
  193. package/src/common-properties/controls/expression/expression-builder/expression-builder.jsx +1 -1
  194. package/src/common-properties/controls/expression/expression-builder/expression-builder.scss +1 -1
  195. package/src/common-properties/controls/expression/expression-builder/expression-select-field-function.jsx +1 -1
  196. package/src/common-properties/controls/expression/expression-builder/expression-select-operator.jsx +1 -1
  197. package/src/common-properties/controls/expression/expression-builder/expression-selection-panel.jsx +1 -1
  198. package/src/common-properties/controls/expression/expression.jsx +1 -1
  199. package/src/common-properties/controls/expression/expression.scss +1 -1
  200. package/src/common-properties/controls/expression/expressionInfo-parser.js +1 -1
  201. package/src/common-properties/controls/expression/index.js +1 -1
  202. package/src/common-properties/controls/expression/languages/CLEM-hint.js +1 -1
  203. package/src/common-properties/controls/expression/languages/python-hint.js +1 -1
  204. package/src/common-properties/controls/expression/languages/r-hint.js +1 -1
  205. package/src/common-properties/controls/list/index.js +1 -1
  206. package/src/common-properties/controls/list/list.jsx +1 -1
  207. package/src/common-properties/controls/multiselect/index.js +1 -1
  208. package/src/common-properties/controls/multiselect/multiselect.jsx +1 -1
  209. package/src/common-properties/controls/multiselect/multiselect.scss +1 -1
  210. package/src/common-properties/controls/numberfield/index.js +1 -1
  211. package/src/common-properties/controls/numberfield/numberfield.jsx +1 -1
  212. package/src/common-properties/controls/numberfield/numberfield.scss +1 -1
  213. package/src/common-properties/controls/passwordfield/index.js +1 -1
  214. package/src/common-properties/controls/passwordfield/passwordfield.jsx +1 -1
  215. package/src/common-properties/controls/radioset/index.js +1 -1
  216. package/src/common-properties/controls/radioset/radioset.jsx +1 -1
  217. package/src/common-properties/controls/radioset/radioset.scss +1 -1
  218. package/src/common-properties/controls/readonly/index.js +1 -1
  219. package/src/common-properties/controls/readonly/readonly.jsx +13 -8
  220. package/src/common-properties/controls/readonly/readonly.scss +1 -1
  221. package/src/common-properties/controls/readonlytable/index.js +1 -1
  222. package/src/common-properties/controls/readonlytable/readonlytable.jsx +1 -1
  223. package/src/common-properties/controls/selectcolumns/index.js +1 -1
  224. package/src/common-properties/controls/selectcolumns/selectcolumns.jsx +1 -1
  225. package/src/common-properties/controls/selectcolumns/selectcolumns.scss +1 -1
  226. package/src/common-properties/controls/someofselect/index.js +1 -1
  227. package/src/common-properties/controls/someofselect/someofselect.jsx +1 -1
  228. package/src/common-properties/controls/someofselect/someofselect.scss +1 -1
  229. package/src/common-properties/controls/structureeditor/index.js +1 -1
  230. package/src/common-properties/controls/structureeditor/structureeditor.jsx +1 -1
  231. package/src/common-properties/controls/structureeditor/structureeditor.scss +1 -1
  232. package/src/common-properties/controls/structurelisteditor/index.js +1 -1
  233. package/src/common-properties/controls/structurelisteditor/structurelisteditor.jsx +1 -1
  234. package/src/common-properties/controls/structuretable/index.js +1 -1
  235. package/src/common-properties/controls/structuretable/structuretable.jsx +1 -1
  236. package/src/common-properties/controls/textarea/index.js +1 -1
  237. package/src/common-properties/controls/textarea/textarea.jsx +1 -1
  238. package/src/common-properties/controls/textarea/textarea.scss +1 -1
  239. package/src/common-properties/controls/textfield/index.js +1 -1
  240. package/src/common-properties/controls/textfield/textfield.jsx +1 -1
  241. package/src/common-properties/controls/textfield/textfield.scss +1 -1
  242. package/src/common-properties/controls/timefield/index.js +1 -1
  243. package/src/common-properties/controls/timefield/timefield.jsx +32 -33
  244. package/src/common-properties/controls/toggletext/index.js +1 -1
  245. package/src/common-properties/controls/toggletext/toggletext.jsx +1 -1
  246. package/src/common-properties/controls/toggletext/toggletext.scss +1 -1
  247. package/src/common-properties/form/ActionInfo.js +1 -1
  248. package/src/common-properties/form/Conditions.js +1 -1
  249. package/src/common-properties/form/ControlInfo.js +1 -1
  250. package/src/common-properties/form/EditorForm.js +1 -1
  251. package/src/common-properties/form/Form.js +1 -1
  252. package/src/common-properties/form/GroupInfo.js +1 -1
  253. package/src/common-properties/form/ParameterInfo.js +1 -1
  254. package/src/common-properties/form/PropertyDef.js +1 -1
  255. package/src/common-properties/form/StructureInfo.js +1 -1
  256. package/src/common-properties/form/UIItem.js +1 -1
  257. package/src/common-properties/index.js +1 -1
  258. package/src/common-properties/index.scss +1 -1
  259. package/src/common-properties/panels/action-panel/action-panel.jsx +1 -1
  260. package/src/common-properties/panels/action-panel/action-panel.scss +1 -1
  261. package/src/common-properties/panels/action-panel/index.js +1 -1
  262. package/src/common-properties/panels/column/column.jsx +1 -1
  263. package/src/common-properties/panels/column/column.scss +1 -1
  264. package/src/common-properties/panels/column/index.js +1 -1
  265. package/src/common-properties/panels/control/control.jsx +1 -1
  266. package/src/common-properties/panels/control/control.scss +1 -1
  267. package/src/common-properties/panels/control/index.js +1 -1
  268. package/src/common-properties/panels/panels.scss +1 -1
  269. package/src/common-properties/panels/selector/index.js +1 -1
  270. package/src/common-properties/panels/selector/selector.jsx +1 -1
  271. package/src/common-properties/panels/sub-panel/button.jsx +1 -1
  272. package/src/common-properties/panels/sub-panel/cell.jsx +1 -1
  273. package/src/common-properties/panels/sub-panel/invoker.jsx +1 -1
  274. package/src/common-properties/panels/sub-panel/sub-panel.scss +1 -1
  275. package/src/common-properties/panels/subtabs/index.js +1 -1
  276. package/src/common-properties/panels/subtabs/subtabs.jsx +1 -1
  277. package/src/common-properties/panels/subtabs/subtabs.scss +1 -1
  278. package/src/common-properties/panels/summary/index.js +1 -1
  279. package/src/common-properties/panels/summary/summary.jsx +1 -1
  280. package/src/common-properties/panels/summary/summary.scss +1 -1
  281. package/src/common-properties/panels/text-panel/index.js +1 -1
  282. package/src/common-properties/panels/text-panel/text-panel.jsx +1 -1
  283. package/src/common-properties/panels/text-panel/text-panel.scss +1 -1
  284. package/src/common-properties/panels/twisty/index.js +1 -1
  285. package/src/common-properties/panels/twisty/twisty.jsx +1 -1
  286. package/src/common-properties/panels/twisty/twisty.scss +1 -1
  287. package/src/common-properties/properties-controller.js +1 -1
  288. package/src/common-properties/properties-main/index.js +1 -1
  289. package/src/common-properties/properties-main/properties-main-widths.scss +1 -1
  290. package/src/common-properties/properties-main/properties-main.jsx +1 -1
  291. package/src/common-properties/properties-main/properties-main.scss +1 -1
  292. package/src/common-properties/properties-store.js +1 -1
  293. package/src/common-properties/reducers/action-states.js +1 -1
  294. package/src/common-properties/reducers/component-metadata.js +1 -1
  295. package/src/common-properties/reducers/control-states.js +1 -1
  296. package/src/common-properties/reducers/dataset-metadata.js +1 -1
  297. package/src/common-properties/reducers/disable-row-move-buttons.js +1 -1
  298. package/src/common-properties/reducers/error-messages.js +1 -1
  299. package/src/common-properties/reducers/panel-states.js +1 -1
  300. package/src/common-properties/reducers/properties.js +1 -1
  301. package/src/common-properties/reducers/row-selections.js +1 -1
  302. package/src/common-properties/reducers/row-static.js +1 -1
  303. package/src/common-properties/reducers/save-button-disable.jsx +1 -1
  304. package/src/common-properties/schema-validator/properties-schema-validator.js +2 -2
  305. package/src/common-properties/ui-conditions/condition-ops/cellNotEmpty.js +1 -1
  306. package/src/common-properties/ui-conditions/condition-ops/colDoesExists.js +1 -1
  307. package/src/common-properties/ui-conditions/condition-ops/colNotExists.js +1 -1
  308. package/src/common-properties/ui-conditions/condition-ops/condition-ops.js +1 -1
  309. package/src/common-properties/ui-conditions/condition-ops/contains.js +1 -1
  310. package/src/common-properties/ui-conditions/condition-ops/dmMeasurementEquals.js +1 -1
  311. package/src/common-properties/ui-conditions/condition-ops/dmMeasurementNotEquals.js +1 -1
  312. package/src/common-properties/ui-conditions/condition-ops/dmRoleEquals.js +1 -1
  313. package/src/common-properties/ui-conditions/condition-ops/dmRoleNotEquals.js +1 -1
  314. package/src/common-properties/ui-conditions/condition-ops/dmTypeEquals.js +1 -1
  315. package/src/common-properties/ui-conditions/condition-ops/dmTypeNotEquals.js +1 -1
  316. package/src/common-properties/ui-conditions/condition-ops/equals.js +1 -1
  317. package/src/common-properties/ui-conditions/condition-ops/greaterThan.js +1 -1
  318. package/src/common-properties/ui-conditions/condition-ops/isDateTime.js +7 -5
  319. package/src/common-properties/ui-conditions/condition-ops/isEmpty.js +1 -1
  320. package/src/common-properties/ui-conditions/condition-ops/isNotEmpty.js +1 -1
  321. package/src/common-properties/ui-conditions/condition-ops/lengthEquals.js +1 -1
  322. package/src/common-properties/ui-conditions/condition-ops/lengthGreaterThan.js +1 -1
  323. package/src/common-properties/ui-conditions/condition-ops/lengthLessThan.js +1 -1
  324. package/src/common-properties/ui-conditions/condition-ops/lessThan.js +1 -1
  325. package/src/common-properties/ui-conditions/condition-ops/matches.js +1 -1
  326. package/src/common-properties/ui-conditions/condition-ops/notContains.js +1 -1
  327. package/src/common-properties/ui-conditions/condition-ops/notEquals.js +1 -1
  328. package/src/common-properties/ui-conditions/condition-ops/notMatches.js +1 -1
  329. package/src/common-properties/ui-conditions/conditions-utils.js +1 -1
  330. package/src/common-properties/ui-conditions/ui-conditions-parser.js +1 -1
  331. package/src/common-properties/ui-conditions/ui-conditions.js +1 -1
  332. package/src/common-properties/ui-conditions/ui-groups-parser.js +1 -1
  333. package/src/common-properties/util/L10nProvider.js +1 -1
  334. package/src/common-properties/util/control-utils.js +1 -1
  335. package/src/common-properties/util/property-utils.js +1 -1
  336. package/src/context-menu/common-context-menu.jsx +12 -3
  337. package/src/context-menu/context-menu-wrapper.jsx +1 -1
  338. package/src/context-menu/context-menu.scss +1 -1
  339. package/src/flow-validation/validate-flow.js +2 -2
  340. package/src/icons/icon.jsx +1 -1
  341. package/src/icons/icon.scss +1 -1
  342. package/src/index.js +1 -1
  343. package/src/index.scss +1 -1
  344. package/src/logging/canvas-logger.js +1 -1
  345. package/src/notification-panel/notification-panel.jsx +1 -1
  346. package/src/notification-panel/notification-panel.scss +1 -1
  347. package/src/object-model/api-pipeline.js +1 -1
  348. package/src/object-model/canvas-in-handler.js +2 -2
  349. package/src/object-model/canvas-out-handler.js +1 -1
  350. package/src/object-model/config-utils.js +2 -2
  351. package/src/object-model/layout-dimensions.js +1 -1
  352. package/src/object-model/object-model.js +1 -1
  353. package/src/object-model/pipeline-in-handler.js +2 -3
  354. package/src/object-model/pipeline-out-handler.js +1 -1
  355. package/src/object-model/redux/canvas-store.js +1 -1
  356. package/src/object-model/redux/reducers/bottompanel.js +1 -1
  357. package/src/object-model/redux/reducers/breadcrumbs.js +1 -1
  358. package/src/object-model/redux/reducers/canvasconfig.js +1 -1
  359. package/src/object-model/redux/reducers/canvasinfo.js +1 -1
  360. package/src/object-model/redux/reducers/canvastoolbar.js +1 -1
  361. package/src/object-model/redux/reducers/categories.js +1 -1
  362. package/src/object-model/redux/reducers/comments.js +1 -1
  363. package/src/object-model/redux/reducers/contextmenu.js +1 -1
  364. package/src/object-model/redux/reducers/externalpipelineflows.js +1 -1
  365. package/src/object-model/redux/reducers/links.js +1 -1
  366. package/src/object-model/redux/reducers/nodes.js +1 -1
  367. package/src/object-model/redux/reducers/nodetypes.js +1 -1
  368. package/src/object-model/redux/reducers/notificationpanel.js +1 -1
  369. package/src/object-model/redux/reducers/notifications.js +1 -1
  370. package/src/object-model/redux/reducers/palette.js +1 -1
  371. package/src/object-model/redux/reducers/ports.js +1 -1
  372. package/src/object-model/redux/reducers/rightflyout.js +1 -1
  373. package/src/object-model/redux/reducers/selectioninfo.js +1 -1
  374. package/src/object-model/redux/reducers/tooltip.js +1 -1
  375. package/src/object-model/schemas-utils/schema-validator.js +2 -2
  376. package/src/object-model/schemas-utils/upgrade-palette.js +1 -1
  377. package/src/palette/palette-content-list-item.jsx +7 -6
  378. package/src/palette/palette-content-list.jsx +4 -2
  379. package/src/palette/palette-dialog-content-categories.jsx +1 -1
  380. package/src/palette/palette-dialog-content-category.jsx +1 -1
  381. package/src/palette/palette-dialog-content-grid-node.jsx +8 -7
  382. package/src/palette/palette-dialog-content-grid.jsx +4 -1
  383. package/src/palette/palette-dialog-content.jsx +5 -2
  384. package/src/palette/palette-dialog-topbar-three-way-icon.jsx +1 -1
  385. package/src/palette/palette-dialog-topbar.jsx +1 -1
  386. package/src/palette/palette-dialog.jsx +4 -2
  387. package/src/palette/palette-flyout-content-category.jsx +1 -1
  388. package/src/palette/palette-flyout-content-filtered-list.jsx +3 -1
  389. package/src/palette/palette-flyout-content-search.jsx +1 -1
  390. package/src/palette/palette-flyout-content.jsx +6 -3
  391. package/src/palette/palette-flyout-utils.js +2 -2
  392. package/src/palette/palette-flyout.jsx +4 -2
  393. package/src/palette/palette.jsx +6 -2
  394. package/src/palette/palette.scss +1 -1
  395. package/src/toolbar/toolbar-action-item.jsx +20 -6
  396. package/src/toolbar/toolbar-divider-item.jsx +1 -1
  397. package/src/toolbar/toolbar-overflow-item.jsx +1 -1
  398. package/src/toolbar/toolbar.jsx +2 -6
  399. package/src/toolbar/toolbar.scss +2 -2
  400. package/src/tooltip/tooltip.jsx +1 -1
  401. package/src/tooltip/tooltip.scss +1 -1
  402. package/stats.html +1 -1
  403. package/utils/logger.js +1 -1
  404. package/dist/canvas-controller-6f6b6511.js +0 -2
  405. package/dist/canvas-controller-6f6b6511.js.map +0 -1
  406. package/dist/canvas-controller-bf6c2800.js +0 -2
  407. package/dist/canvas-controller-bf6c2800.js.map +0 -1
  408. package/dist/common-properties-20877208.js +0 -2
  409. package/dist/common-properties-20877208.js.map +0 -1
  410. package/dist/common-properties-ea686c1c.js +0 -2
  411. package/dist/common-properties-ea686c1c.js.map +0 -1
  412. package/dist/datarecord-metadata-v3-schema-b4ad907c.js +0 -2
  413. package/dist/datarecord-metadata-v3-schema-b4ad907c.js.map +0 -1
  414. package/dist/datarecord-metadata-v3-schema-bf4483dd.js +0 -2
  415. package/dist/datarecord-metadata-v3-schema-bf4483dd.js.map +0 -1
  416. package/dist/extends-112ec8af.js.map +0 -1
  417. package/dist/extends-51fe578d.js +0 -7
  418. package/dist/extends-51fe578d.js.map +0 -1
  419. package/dist/index-7e2e5c97.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"context-menu.js","sources":["../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.jsx"],"sourcesContent":["/*\n * Copyright 2017-2020 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\";\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}\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\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\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\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\tmenuItems.push(<MenuItem attributes={customDivider} key={i + 1} onClick={() => {}} divider />);\n\t\t\t\trunningYPos += CONTEXT_MENU_DIVIDER_HEIGHT;\n\n\t\t\t} else if (submenu) {\n\t\t\t\tconst submenuItems = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\tconst submenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\tlet rtl = false;\n\n\t\t\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\t\t\tif (menuPos.x + menuSize.width + submenuSize.width > canvasRect.right) {\n\t\t\t\t\trtl = true;\n\t\t\t\t}\n\n\t\t\t\t// Does the submenu go below the bottom of the viewport?\n\t\t\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + submenuSize.height);\n\n\t\t\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t\t\t// submenu up fully into the view port.\n\t\t\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\t\t\tconst subMenuPosStyle = {\n\t\t\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t\t\t};\n\n\t\t\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\t\t\tconst menuItem = <div>{menuDefinition[i].label}{icon} </div>;\n\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<SubMenu title={menuItem} key={i + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t\t\t<div key={i + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t\t\t{submenuItems}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</SubMenu>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\n\n\t\t\t} else {\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\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-2021 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\nconst CONTEXT_MENU_BUTTON = 2;\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 Firefox, the context menu gesture emits both a 'context menu' event\n\t\t// and a 'click' event. If the click is processed it causes the\n\t\t// context menu to disappear imediately after it has displayed.\n\t\t// Consequently, when this method is called with the context menu button set\n\t\t// (which indicates one of the additional clicks from Firefox) we just\n\t\t// stop propogation and return. On other browsers we don't get this extra\n\t\t// events.\n\t\t// Also, on Safari, when a user is displaying the context menu with a ctrl-click,\n\t\t// the click is received with a ctrlKey field enabled. So we also ignore that.\n\t\tif (e.button === CONTEXT_MENU_BUTTON || 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 we just close the menu.\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\tif (domNode && !domNode.contains(e.target)) {\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\tcontextMenuClicked(action) {\n\t\tthis.props.contextMenuActionHandler(action);\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":["CommonContextMenu","props","state","itemSelected","_this","bind","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","className","menuItems","runningYPos","submenu","push","React","MenuItem","attributes","key","onClick","this","buildMenu","disabled","areAllSubmenuItemsDisabled","submenuSize","calculateMenuSize","rtl","right","bottom","subMenuPosStyle","top","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","label","SubMenu","title","style","action","calculateMenuPos","posStyle","left","id","onContextMenu","Component","propTypes","PropTypes","func","isRequired","array","object","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","button","ctrlKey","domNode","contains","target","closeContextMenu","contextMenuActionHandler","contextMenuDef","getCanvasRect","contextMenuPos","string","bool"],"mappings":"w0BAwBA,IAMMA,qDACOC,yDACLA,IACDC,MAAQ,KACRC,aAAeC,EAAKD,aAAaE,wFAGvC,SAAcC,GACbA,EAAEC,6CAGH,SAAaC,EAAMC,QACbR,MAAMS,eAAeF,GAGtBC,GACHA,EAAcE,mDAIhB,SAAkBC,WACbC,EAAc,EACTC,EAAI,EAAGA,EAAIF,EAAKG,SAAUD,EAAG,CACrBF,EAAKE,GAAGE,SAEvBH,UAIa,CACdI,OAnC8B,IAmCpBL,EAAKG,OAASF,GAlCS,EAkCmCA,EACp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,WACC4E,SAASC,iBAAiB,QAASvC,KAAKqC,oBAAoB,uCAG7D,WACCC,SAASE,oBAAoB,QAASxC,KAAKqC,oBAAoB,gCAOhE,eAEOI,EADgBH,SAASI,eAAe1C,KAAK1C,MAAMqF,iBACxBC,8BACd,CAClBlC,IAAK,EACLF,OAAQiC,EAAWjC,OAASiC,EAAW/B,IACvCe,KAAM,EACNlB,MAAOkC,EAAWlC,MAAQkC,EAAWhB,KACrCnD,OAAQmE,EAAWnE,OACnBC,MAAOkE,EAAWlE,yCAMpB,SAAmBZ,MAtCQ,IAgDtBA,EAAEkF,QAAkClF,EAAEmF,QACzCnF,EAAEK,2BAKG+E,EAAUT,SAASI,eAAe,wBACpCK,IAAYA,EAAQC,SAASrF,EAAEsF,UAG9BjD,KAAK1C,MAAMU,iBACdL,EAAEK,uBAEEV,MAAM4F,uDAIb,SAAmB5B,QACbhE,MAAM6F,yBAAyB7B,yBAGrC,kBAEE3B,wBAACtC,GACAU,eAAgBiC,KAAKoC,mBACrBhD,eAAgBY,KAAK1C,MAAM8F,eAC3B1E,WAAYsB,KAAKqD,gBACjB7E,SAAUwB,KAAK1C,MAAMgG,wBAzEuB3D,UAAMiC,WA+EtDO,EAAmBN,UAAY,CAC9BuB,eAAgBtB,UAAUG,MAAMD,WAChCW,gBAAiBb,UAAUyB,OAAOvB,WAClCsB,eAAgBxB,UAAUI,OAAOF,WACjCmB,yBAA0BrB,UAAUC,KAAKC,WACzCkB,iBAAkBpB,UAAUC,KAAKC,WACjChE,gBAAiB8D,UAAU0B"}
1
+ {"version":3,"file":"context-menu.js","sources":["../../src/context-menu/common-context-menu.jsx","../../src/context-menu/context-menu-wrapper.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/* 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\";\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}\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\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\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\tconst submenuItems = this.buildMenu(menuDefinition[i].menu, menuSize, menuPos, canvasRect);\n\t\t\t\tconst disabled = { disabled: this.areAllSubmenuItemsDisabled(menuDefinition[i].menu) };\n\t\t\t\tconst submenuSize = this.calculateMenuSize(menuDefinition[i].menu);\n\t\t\t\tlet rtl = false;\n\n\t\t\t\t// Ensure that the combined menu position, plus the menu width,\n\t\t\t\t// plus the submenu width, does not exceed the viewport bounds.\n\t\t\t\tif (menuPos.x + menuSize.width + submenuSize.width > canvasRect.right) {\n\t\t\t\t\trtl = true;\n\t\t\t\t}\n\n\t\t\t\t// Does the submenu go below the bottom of the viewport?\n\t\t\t\tconst y = canvasRect.bottom - (menuPos.y + runningYPos + submenuSize.height);\n\n\t\t\t\t// If submenu is not below the viewport bottom set offset to 0 so the\n\t\t\t\t// submenu will not be moved. Otherwise, y will be used to move the\n\t\t\t\t// submenu up fully into the view port.\n\t\t\t\tconst offset = (y > 0) ? 0 : y - EXTRA_OFFSET;\n\n\t\t\t\tconst subMenuPosStyle = {\n\t\t\t\t\ttop: offset + \"px\" // Use negative to push the menu up\n\t\t\t\t};\n\n\t\t\t\tconst icon = <Icon type={CONTEXT_MENU_CARBON_ICONS.CHEVRONARROWS.RIGHT} disabled={false} className={\"react-contextmenu-submenu-icon\"} />;\n\t\t\t\tconst menuItem = <div>{menuDefinition[i].label}{icon} </div>;\n\n\t\t\t\tmenuItems.push(\n\t\t\t\t\t<SubMenu title={menuItem} key={i + 1} className=\"contextmenu-submenu\" rtl={rtl} {...disabled}>\n\t\t\t\t\t\t<div key={i + 1} style={subMenuPosStyle} className=\"context-menu-popover\">\n\t\t\t\t\t\t\t{submenuItems}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</SubMenu>\n\t\t\t\t);\n\t\t\t\trunningYPos += CONTEXT_MENU_LINK_HEIGHT;\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\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\nconst CONTEXT_MENU_BUTTON = 2;\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 Firefox, the context menu gesture emits both a 'context menu' event\n\t\t// and a 'click' event. If the click is processed it causes the\n\t\t// context menu to disappear imediately after it has displayed.\n\t\t// Consequently, when this method is called with the context menu button set\n\t\t// (which indicates one of the additional clicks from Firefox) we just\n\t\t// stop propogation and return. On other browsers we don't get this extra\n\t\t// events.\n\t\t// Also, on Safari, when a user is displaying the context menu with a ctrl-click,\n\t\t// the click is received with a ctrlKey field enabled. So we also ignore that.\n\t\tif (e.button === CONTEXT_MENU_BUTTON || 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 we just close the menu.\n\t\tconst domNode = document.getElementById(\"context-menu-popover\");\n\t\tif (domNode && !domNode.contains(e.target)) {\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\tcontextMenuClicked(action) {\n\t\tthis.props.contextMenuActionHandler(action);\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":["CommonContextMenu","props","state","itemSelected","_this","bind","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","className","menuItems","runningYPos","previousDivider","submenu","push","React","MenuItem","attributes","key","onClick","this","buildMenu","disabled","areAllSubmenuItemsDisabled","submenuSize","calculateMenuSize","rtl","right","bottom","subMenuPosStyle","top","icon","Icon","type","CONTEXT_MENU_CARBON_ICONS","CHEVRONARROWS","RIGHT","menuItem","label","SubMenu","title","style","action","calculateMenuPos","posStyle","left","id","onContextMenu","Component","propTypes","PropTypes","func","isRequired","array","object","ContextMenuWrapper","contextMenuClicked","handleClickOutside","document","addEventListener","removeEventListener","clientRect","getElementById","containingDivId","getBoundingClientRect","button","ctrlKey","domNode","contains","target","closeContextMenu","contextMenuActionHandler","contextMenuDef","getCanvasRect","contextMenuPos","string","bool"],"mappings":"w0BAwBA,IAMMA,qDACOC,yDACLA,IACDC,MAAQ,KACRC,aAAeC,EAAKD,aAAaE,wFAGvC,SAAcC,GACbA,EAAEC,6CAGH,SAAaC,EAAMC,QACbR,MAAMS,eAAeF,GAGtBC,GACHA,EAAcE,mDAIhB,SAAkBC,WACbC,EAAc,EACTC,EAAI,EAAGA,EAAIF,EAAKG,SAAUD,EAAG,CACrBF,EAAKE,GAAGE,SAEvBH,UAIa,CACdI,OAnC8B,IAmCpBL,EAAKG,OAASF,GAlCS,EAkCmCA,EACpEK,MArCwB,qCA6C1B,SAAiBC,EAAUC,EAAUC,OAC9BC,EAAU,CAAEC,EAAGJ,EAASI,EAAGC,EAAGL,EAASK,UAGzCL,EAASK,EAAIJ,EAASH,OAASI,EAAWJ,SAC7CK,EAAQE,EAAIH,EAAWJ,OAASG,EAASH,OA/CvB,EAmDdK,EAAQE,EAAI,IACfF,EAAQE,EAAI,IAKVL,EAASI,EAAIH,EAASF,MAAQG,EAAWH,QAC5CI,EAAQC,GAAKH,EAASF,OAGhBI,4CAGR,SAA2BG,OACtBC,EAAY,EACZC,EAAgB,SACpBF,EAAaG,SAAQ,SAASC,GACxBA,EAAYb,SAChBU,KAE0B,IAAvBG,EAAYC,QACfH,OAGKA,IAAkBD,2BAG1B,SAAUK,EAAgBX,EAAUE,EAASD,WACtCW,EAAgB,CACrBC,UAAW,uBAGNC,EAAY,GAEdC,EAAc,EAIdC,GAAkB,EAEbtB,EAAI,EAAGA,EAAIiB,EAAehB,SAAUD,EAAG,KACzCE,EAAUe,EAAejB,GAAGE,QAC5BqB,EAAUN,EAAejB,GAAGuB,WAE9BrB,EACEoB,IACJF,EAAUI,KAAKC,wBAACC,YAASC,WAAYT,EAAeU,IAAK5B,EAAI,EAAG6B,QAAS,aAAU3B,cACnFmB,GAnG+B,EAoG/BC,GAAkB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DO,EAAmBN,UAAY,CAC9BuB,eAAgBtB,UAAUG,MAAMD,WAChCW,gBAAiBb,UAAUyB,OAAOvB,WAClCsB,eAAgBxB,UAAUI,OAAOF,WACjCmB,yBAA0BrB,UAAUC,KAAKC,WACzCkB,iBAAkBpB,UAAUC,KAAKC,WACjCjE,gBAAiB+D,UAAU0B"}
@@ -1,2 +1,2 @@
1
- export{F as default}from"../../index-c21aec1b.js";import"../../createClass-32a0cf0f.js";import"../../getPrototypeOf-97272efe.js";import"../../en-8e5bfa1b.js";import"../../isEmpty-6528e7c8.js";import"react";import"prop-types";import"../../flexible-table-13570aa9.js";import"../../extends-51fe578d.js";import"react-inlinesvg";import"@carbon/icons-react";import"react-intl";import"react-dom";import"carbon-components-react";import"../tooltip.es.js";import"react-portal";import"uuid";import"react-resize-detector";
1
+ export{F as default}from"../../index-1eff5860.js";import"../../createClass-32a0cf0f.js";import"../../getPrototypeOf-97272efe.js";import"../../en-a3710fcf.js";import"../../isEmpty-3550e76f.js";import"react";import"prop-types";import"../../flexible-table-756ff86a.js";import"../../extends-41535aa9.js";import"react-inlinesvg";import"@carbon/icons-react";import"react-intl";import"react-dom";import"carbon-components-react";import"../tooltip.es.js";import"react-portal";import"uuid";import"react-resize-detector";
2
2
  //# sourceMappingURL=field-picker.es.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../../index-7e2e5c97.js");require("../../createClass-6db89a23.js"),require("../../getPrototypeOf-0bf77a9e.js"),require("../../en-3f6094d9.js"),require("../../isEmpty-5d2981b6.js"),require("react"),require("prop-types"),require("../../flexible-table-20276887.js"),require("../../extends-112ec8af.js"),require("react-inlinesvg"),require("@carbon/icons-react"),require("react-intl"),require("react-dom"),require("carbon-components-react"),require("../tooltip.js"),require("react-portal"),require("uuid"),require("react-resize-detector"),module.exports=e.FieldPicker;
1
+ "use strict";var e=require("../../index-7fba99b9.js");require("../../createClass-6db89a23.js"),require("../../getPrototypeOf-0bf77a9e.js"),require("../../en-9e368daa.js"),require("../../isEmpty-c6f783dd.js"),require("react"),require("prop-types"),require("../../flexible-table-2bbb9e48.js"),require("../../extends-76e6b8d2.js"),require("react-inlinesvg"),require("@carbon/icons-react"),require("react-intl"),require("react-dom"),require("carbon-components-react"),require("../tooltip.js"),require("react-portal"),require("uuid"),require("react-resize-detector"),module.exports=e.FieldPicker;
2
2
  //# sourceMappingURL=field-picker.js.map
@@ -1,2 +1,2 @@
1
- import{F as t}from"../../flexible-table-13570aa9.js";export{F as default}from"../../flexible-table-13570aa9.js";import"../../extends-51fe578d.js";import"../../createClass-32a0cf0f.js";import"../../getPrototypeOf-97272efe.js";import"react";import"prop-types";import"react-inlinesvg";import"@carbon/icons-react";import"../../isEmpty-6528e7c8.js";import"react-intl";import"react-dom";import"carbon-components-react";import"../tooltip.es.js";import"react-portal";import"uuid";import"react-resize-detector";
1
+ import{F as t}from"../../flexible-table-756ff86a.js";export{F as default}from"../../flexible-table-756ff86a.js";import"../../extends-41535aa9.js";import"../../createClass-32a0cf0f.js";import"../../getPrototypeOf-97272efe.js";import"react";import"prop-types";import"react-inlinesvg";import"@carbon/icons-react";import"../../isEmpty-3550e76f.js";import"react-intl";import"react-dom";import"carbon-components-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-20276887.js");require("../../extends-112ec8af.js"),require("../../createClass-6db89a23.js"),require("../../getPrototypeOf-0bf77a9e.js"),require("react"),require("prop-types"),require("react-inlinesvg"),require("@carbon/icons-react"),require("../../isEmpty-5d2981b6.js"),require("react-intl"),require("react-dom"),require("carbon-components-react"),require("../tooltip.js"),require("react-portal"),require("uuid"),require("react-resize-detector"),module.exports=e.FlexibleTable;
1
+ "use strict";var e=require("../../flexible-table-2bbb9e48.js");require("../../extends-76e6b8d2.js"),require("../../createClass-6db89a23.js"),require("../../getPrototypeOf-0bf77a9e.js"),require("react"),require("prop-types"),require("react-inlinesvg"),require("@carbon/icons-react"),require("../../isEmpty-c6f783dd.js"),require("react-intl"),require("react-dom"),require("carbon-components-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-ea686c1c.js";export{F as FlexibleTable}from"../flexible-table-13570aa9.js";export{F as FieldPicker}from"../index-c21aec1b.js";import"../createClass-32a0cf0f.js";import"../getPrototypeOf-97272efe.js";import"react";import"prop-types";import"../en-8e5bfa1b.js";import"../isEmpty-6528e7c8.js";import"../datarecord-metadata-v3-schema-b4ad907c.js";import"react-intl";import"react-resize-detector";import"./tooltip.es.js";import"react-portal";import"../extends-51fe578d.js";import"react-inlinesvg";import"@carbon/icons-react";import"carbon-components-react";import"react-redux";import"react-dom";import"uuid";import"redux";import"seedrandom";import"./command-stack.es.js";import"immutable-undo";import"moment";import"react-codemirror2";
1
+ export{c as CommonProperties,P as PropertiesController}from"../common-properties-3758e3b2.js";export{F as FlexibleTable}from"../flexible-table-756ff86a.js";export{F as FieldPicker}from"../index-1eff5860.js";import"../createClass-32a0cf0f.js";import"../getPrototypeOf-97272efe.js";import"react";import"prop-types";import"../en-a3710fcf.js";import"../isEmpty-3550e76f.js";import"../datarecord-metadata-v3-schema-82f2b977.js";import"react-intl";import"react-resize-detector";import"./tooltip.es.js";import"react-portal";import"../extends-41535aa9.js";import"react-inlinesvg";import"@carbon/icons-react";import"carbon-components-react";import"react-redux";import"react-dom";import"uuid";import"redux";import"seedrandom";import"./command-stack.es.js";import"immutable-undo";import"date-fns";import"react-codemirror2";import"jsonschema";
2
2
  //# sourceMappingURL=properties.es.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../common-properties-20877208.js"),r=require("../flexible-table-20276887.js"),i=require("../index-7e2e5c97.js");require("../createClass-6db89a23.js"),require("../getPrototypeOf-0bf77a9e.js"),require("react"),require("prop-types"),require("../en-3f6094d9.js"),require("../isEmpty-5d2981b6.js"),require("../datarecord-metadata-v3-schema-bf4483dd.js"),require("react-intl"),require("react-resize-detector"),require("./tooltip.js"),require("react-portal"),require("../extends-112ec8af.js"),require("react-inlinesvg"),require("@carbon/icons-react"),require("carbon-components-react"),require("react-redux"),require("react-dom"),require("uuid"),require("redux"),require("seedrandom"),require("./command-stack.js"),require("immutable-undo"),require("moment"),require("react-codemirror2"),exports.CommonProperties=e.commonProperties,exports.PropertiesController=e.PropertiesController,exports.FlexibleTable=r.FlexibleTable,exports.FieldPicker=i.FieldPicker;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../common-properties-6334cca1.js"),r=require("../flexible-table-2bbb9e48.js"),i=require("../index-7fba99b9.js");require("../createClass-6db89a23.js"),require("../getPrototypeOf-0bf77a9e.js"),require("react"),require("prop-types"),require("../en-9e368daa.js"),require("../isEmpty-c6f783dd.js"),require("../datarecord-metadata-v3-schema-3a2957c3.js"),require("react-intl"),require("react-resize-detector"),require("./tooltip.js"),require("react-portal"),require("../extends-76e6b8d2.js"),require("react-inlinesvg"),require("@carbon/icons-react"),require("carbon-components-react"),require("react-redux"),require("react-dom"),require("uuid"),require("redux"),require("seedrandom"),require("./command-stack.js"),require("immutable-undo"),require("date-fns"),require("react-codemirror2"),require("jsonschema"),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-2021 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\";\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\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\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\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 = () => this.setTooltipVisible(false);\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}\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\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\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</div>\n\t\t\t\t</Portal>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\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","props","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","_this","bind","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","value","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","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","tooltipContent","triggerContent","children","React","className","onMouseOver","showToolTipOnClick","_this2","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","tabIndex","ref","tip","_typeof","tipClass","Portal","viewBox","points","Component","propTypes","PropTypes","oneOfType","string","element","isRequired","oneOf","object","bool","number","defaultProps"],"mappings":"ooBAuBMA,2CACOC,yCACLA,IACDC,MAAQ,CACZC,kBAAkB,KAGdC,eAAiB,OACjBC,6BAA+BC,EAAKD,6BAA6BE,wDAGvE,WACCC,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACrEG,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACjEK,KAAKT,MAAMU,gBACTC,mBAAkB,uCAIzB,WACCJ,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACxEG,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACpEK,KAAKN,gBACRU,aAAaJ,KAAKN,iDAIpB,SAAkBW,QAEZL,KAAKM,gBAAmBD,GAAWL,KAAKN,kBAC5CU,aAAaJ,KAAKN,qBACbA,eAAiB,UACjBa,SAAS,CACbd,kBAAkB,KAKhBO,KAAKM,cAAe,KACjBE,EAAUC,SAASC,cAAc,aAAeV,KAAKT,MAAMoB,GAAK,cACjEjB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oB,GAAI4D,UAAWe,iBAAwBtF,KAAKR,MAAMC,iBAAkBuC,UAAWhC,KAAKT,MAAMyC,WAClHsC,uBAAK3D,GAAG,WAAWiD,EAAE,MAAME,EAAE,MAAM0B,QAAQ,gBAC1ClB,4BAAUmB,OAAO,6BACjBnB,2BAASmB,OAAO,mDAEhBtB,YAvWeG,EAAMoB,WA+W5BpG,EAAQqG,UAAY,CACnBP,IAAKQ,EAAUC,UAAU,CAACD,EAAUE,OAAQF,EAAUG,UAAUC,WAChEhE,UAAW4D,EAAUK,MAAM,CAAC,OAAQ,QAAS,MAAO,WACpD5B,SAAUuB,EAAUC,UAAU,CAACD,EAAUE,OAAQF,EAAUG,UAC3D9F,UAAW2F,EAAUM,OACrBvF,GAAIiF,EAAUE,OAAOE,WACrBzB,UAAWqB,EAAUE,OACrB/C,SAAU6C,EAAUM,OACpB9E,QAASwE,EAAUO,KACnB9E,uBAAwBuE,EAAUO,KAClCpE,MAAO6D,EAAUQ,OACjB3B,mBAAoBmB,EAAUO,MAG/B7G,EAAQ+G,aAAe,CACtBtE,MAAO,IACPC,UAAW,SACXX,wBAAwB,EACxBoD,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\";\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\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\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\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 = () => this.setTooltipVisible(false);\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}\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\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\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</div>\n\t\t\t\t</Portal>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\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","props","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","_this","bind","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","value","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","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","tooltipContent","triggerContent","children","React","className","onMouseOver","showToolTipOnClick","_this2","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","tabIndex","ref","tip","_typeof","tipClass","Portal","viewBox","points","Component","propTypes","PropTypes","oneOfType","string","element","isRequired","oneOf","object","bool","number","defaultProps"],"mappings":"ooBAuBMA,2CACOC,yCACLA,IACDC,MAAQ,CACZC,kBAAkB,KAGdC,eAAiB,OACjBC,6BAA+BC,EAAKD,6BAA6BE,wDAGvE,WACCC,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACrEG,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACjEK,KAAKT,MAAMU,gBACTC,mBAAkB,uCAIzB,WACCJ,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACxEG,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACpEK,KAAKN,gBACRU,aAAaJ,KAAKN,iDAIpB,SAAkBW,QAEZL,KAAKM,gBAAmBD,GAAWL,KAAKN,kBAC5CU,aAAaJ,KAAKN,qBACbA,eAAiB,UACjBa,SAAS,CACbd,kBAAkB,KAKhBO,KAAKM,cAAe,KACjBE,EAAUC,SAASC,cAAc,aAAeV,KAAKT,MAAMoB,GAAK,cACjEjB,eAAiB,UACjBa,SAAS,CACbd,iBAAkBY,IAGfA,EAAS,KACRO,EAAiB,MAEpBA,EADGZ,KAAKT,MAAMU,UACGD,KAAKT,MAAMU,UAEXQ,SAASC,cAAc,aAAeV,KAAKT,MAAMoB,GAAK,gBAElDH,QAChBK,oBAAoBL,EAASI,EAAgBJ,EAAQM,aAAa,6CAM3E,SAAcC,UACNA,EAAQ,oCAGhB,SAAgBC,OACXC,SACID,OACH,MACJ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,EAAUE,OAAQF,EAAUG,UAAUC,WAChEhE,UAAW4D,EAAUK,MAAM,CAAC,OAAQ,QAAS,MAAO,WACpD5B,SAAUuB,EAAUC,UAAU,CAACD,EAAUE,OAAQF,EAAUG,UAC3D9F,UAAW2F,EAAUM,OACrBvF,GAAIiF,EAAUE,OAAOE,WACrBzB,UAAWqB,EAAUE,OACrB/C,SAAU6C,EAAUM,OACpB9E,QAASwE,EAAUO,KACnB9E,uBAAwBuE,EAAUO,KAClCpE,MAAO6D,EAAUQ,OACjB3B,mBAAoBmB,EAAUO,MAG/B7G,EAAQ+G,aAAe,CACtBtE,MAAO,IACPC,UAAW,SACXX,wBAAwB,EACxBoD,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.jsx"],"sourcesContent":["/*\n * Copyright 2017-2021 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\";\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\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\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\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 = () => this.setTooltipVisible(false);\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}\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\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\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</div>\n\t\t\t\t</Portal>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\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","props","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","_this","bind","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","value","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","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","tooltipContent","triggerContent","children","React","className","onMouseOver","showToolTipOnClick","_this2","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","tabIndex","ref","tip","_typeof","tipClass","Portal","viewBox","points","Component","propTypes","PropTypes","oneOfType","string","element","isRequired","oneOf","object","bool","number","defaultProps"],"mappings":"yuBAuBMA,qDACOC,yDACLA,IACDC,MAAQ,CACZC,kBAAkB,KAGdC,eAAiB,OACjBC,6BAA+BC,EAAKD,6BAA6BE,4FAGvE,WACCC,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACrEG,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACjEK,KAAKT,MAAMU,gBACTC,mBAAkB,uCAIzB,WACCJ,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACxEG,OAAOK,oBAAoB,SAAUH,KAAKL,8BAA8B,GACpEK,KAAKN,gBACRU,aAAaJ,KAAKN,iDAIpB,SAAkBW,QAEZL,KAAKM,gBAAmBD,GAAWL,KAAKN,kBAC5CU,aAAaJ,KAAKN,qBACbA,eAAiB,UACjBa,SAAS,CACbd,kBAAkB,KAKhBO,KAAKM,cAAe,KACjBE,EAAUC,SAASC,cAAc,aAAeV,KAAKT,MAAMoB,GAAK,cACjEjB,eAAiB,UACjBa,SAAS,CACbd,iBAAkBY,IAGfA,EAAS,KACRO,EAAiB,MAEpBA,EADGZ,KAAKT,MAAMU,UACGD,KAAKT,MAAMU,UAEXQ,SAASC,cAAc,aAAeV,KAAKT,MAAMoB,GAAK,gBAElDH,QAChBK,oBAAoBL,EAASI,EAAgBJ,EAAQM,aAAa,6CAM3E,SAAcC,UACNA,EAAQ,oCAGhB,SAAgBC,OACXC,SACID,OACH,MACJC,EAAe,mBAEX,SACJA,EAAe,gBAEX,OACJA,EAAe,sBAGfA,EAAe,cAETA,6BAGR,eACOC,EAAqBlB,KAAKkB,mBAAmBlB,KAAKmB,mBAGrDnB,KAAKT,MAAM6B,UAAYpB,KAAKT,MAAM8B,yBAElCrB,KAAKT,MAAM6B,SAAWpB,KAAKT,MAAM8B,yBAA2BH,oCAShE,SAAmBI,MACdA,EAAM,KACHC,EAAkBD,EA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ACnB9E,uBAAwBuE,UAAUO,KAClCpE,MAAO6D,UAAUQ,OACjB3B,mBAAoBmB,UAAUO,MAG/B7G,EAAQ+G,aAAe,CACtBtE,MAAO,IACPC,UAAW,SACXX,wBAAwB,EACxBoD,oBAAoB"}
1
+ {"version":3,"file":"tooltip.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\";\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\ttooltip.style.left = this.getStyleValue(triggerLayout.left - tooltip.offsetWidth - pointerLayout.width);\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\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 = () => this.setTooltipVisible(false);\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}\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\treturn (\n\t\t\t<div className=\"tooltip-container\">\n\t\t\t\t{triggerContent}\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</div>\n\t\t\t\t</Portal>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nToolTip.propTypes = {\n\ttip: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\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","props","state","isTooltipVisible","pendingTooltip","hideTooltipOnScrollAndResize","_this","bind","window","addEventListener","this","targetObj","setTooltipVisible","removeEventListener","clearTimeout","visible","showTooltip","setState","tooltip","document","querySelector","id","tooltipTrigger","updateTooltipLayout","getAttribute","value","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","right","height","offsetHeight","bottom","tooltipTop","isOutOfBounds","getNewDirection","setAttribute","mouseX","x","mouseY","y","parseFloat","evt","stopPropagation","preventDefault","tooltipContent","triggerContent","children","React","className","onMouseOver","showToolTipOnClick","_this2","onMouseLeave","onMouseDown","onClick","toggleTooltipOnClick","onFocus","showTooltipWithDelay","onBlur","tabIndex","ref","tip","_typeof","tipClass","Portal","viewBox","points","Component","propTypes","PropTypes","oneOfType","string","element","isRequired","oneOf","object","bool","number","defaultProps"],"mappings":"yuBAuBMA,qDACOC,yDACLA,IACDC,MAAQ,CACZC,kBAAkB,KAGdC,eAAiB,OACjBC,6BAA+BC,EAAKD,6BAA6BE,4FAGvE,WACCC,OAAOC,iBAAiB,SAAUC,KAAKL,8BAA8B,GACrEG,OAAOC,iBAAiB,SAAUC,KAAK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