diagram-js
Advanced tools
Comparing version 11.1.0 to 11.1.1
@@ -50,4 +50,5 @@ import { | ||
this._canvas = canvas; | ||
this._current = {}; | ||
this._current = null; | ||
var scale = isDefined(config && config.scale) ? config.scale : { | ||
@@ -64,3 +65,3 @@ min: 1, | ||
eventBus.on('diagram.destroy', () => { | ||
this._destroy(); | ||
this.close(); | ||
}); | ||
@@ -116,15 +117,16 @@ | ||
render(html` | ||
<${PopupMenuComponent} | ||
onClose=${ onClose } | ||
onSelect=${ onSelect } | ||
position=${ position } | ||
className=${ className } | ||
entries=${ entriesArray } | ||
headerEntries=${ headerEntriesArray } | ||
scale=${ scale } | ||
...${{ ...options }} | ||
/> | ||
`, | ||
this._current.container | ||
render( | ||
html` | ||
<${PopupMenuComponent} | ||
onClose=${ onClose } | ||
onSelect=${ onSelect } | ||
position=${ position } | ||
className=${ className } | ||
entries=${ entriesArray } | ||
headerEntries=${ headerEntriesArray } | ||
scale=${ scale } | ||
...${{ ...options }} | ||
/> | ||
`, | ||
this._current.container | ||
); | ||
@@ -159,2 +161,3 @@ }; | ||
} | ||
const { | ||
@@ -180,4 +183,2 @@ entries, | ||
this._render(); | ||
}; | ||
@@ -217,7 +218,11 @@ | ||
this._current.container = null; | ||
this._current = null; | ||
}; | ||
PopupMenu.prototype.reset = function() { | ||
render(null, this._current.container); | ||
const container = this._current.container; | ||
render(null, container); | ||
domRemove(container); | ||
}; | ||
@@ -260,7 +265,2 @@ | ||
PopupMenu.prototype._destroy = function() { | ||
this._current.container && domRemove(this._current.container); | ||
}; | ||
/** | ||
@@ -485,3 +485,3 @@ * Updates popup style.transform with respect to the config and zoom level. | ||
PopupMenu.prototype.isOpen = function() { | ||
return !!this._current.container; | ||
return !!this._current; | ||
}; | ||
@@ -488,0 +488,0 @@ |
@@ -252,5 +252,5 @@ import { | ||
const overlay = domClosest(event.target, '.djs-popup .djs-popup-overlay', true); | ||
const popup = domClosest(event.target, '.djs-popup', true); | ||
if (overlay) { | ||
if (popup) { | ||
return; | ||
@@ -262,4 +262,2 @@ } | ||
const overlayRef = useRef(); | ||
useLayoutEffect(() => { | ||
@@ -270,8 +268,8 @@ if (typeof positionGetter !== 'function') { | ||
const overlayEl = overlayRef.current; | ||
const position = positionGetter(overlayEl); | ||
const popupEl = popupRef.current; | ||
const position = positionGetter(popupEl); | ||
overlayEl.style.left = `${position.x}px`; | ||
overlayEl.style.top = `${position.y}px`; | ||
}, [ overlayRef.current, positionGetter ]); | ||
popupEl.style.left = `${position.x}px`; | ||
popupEl.style.top = `${position.y}px`; | ||
}, [ popupRef.current, positionGetter ]); | ||
@@ -285,13 +283,12 @@ // focus popup initially, on mount | ||
<div | ||
class=${ classNames('djs-popup', className) } | ||
class="djs-popup-backdrop" | ||
onClick=${ checkClose } | ||
onKeydown=${ onKeydown } | ||
onKeyup=${ onKeyup } | ||
ref=${ popupRef } | ||
tabIndex="-1" | ||
> | ||
<div | ||
class="djs-popup-overlay" | ||
ref=${ overlayRef } | ||
style=${ getOverlayStyle(props) } | ||
class=${ classNames('djs-popup', className) } | ||
style=${ getPopupStyle(props) } | ||
onKeydown=${ onKeydown } | ||
onKeyup=${ onKeyup } | ||
ref=${ popupRef } | ||
tabIndex="-1" | ||
> | ||
@@ -306,3 +303,3 @@ ${children} | ||
function getOverlayStyle(props) { | ||
function getPopupStyle(props) { | ||
return { | ||
@@ -309,0 +306,0 @@ transform: `scale(${props.scale})`, |
{ | ||
"name": "diagram-js", | ||
"version": "11.1.0", | ||
"version": "11.1.1", | ||
"description": "A toolbox for displaying and modifying diagrams on the web", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
671507
22925