|
|
@@ -1,5 +1,6 @@
|
|
|
///<reference path="../../headers/common.d.ts" />
|
|
|
|
|
|
+import $ from 'jquery';
|
|
|
import {coreModule} from 'app/core/core';
|
|
|
|
|
|
var template = `
|
|
|
@@ -106,13 +107,38 @@ function panelHeader($compile) {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ elem.find('.panel-menu-toggle').click((evt) => {
|
|
|
+ console.log(evt);
|
|
|
+ togglePanelState();
|
|
|
+ });
|
|
|
+
|
|
|
function togglePanelMenu(e) {
|
|
|
if (!isDragged) {
|
|
|
e.stopPropagation();
|
|
|
+ togglePanelState();
|
|
|
elem.find('[data-toggle=dropdown]').dropdown('toggle');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Hack for adding special class 'dropdown-menu-open' to the panel.
|
|
|
+ * This class sets z-index for panel and prevents menu overlapping.
|
|
|
+ */
|
|
|
+ function togglePanelState() {
|
|
|
+ const menuOpenClass = 'dropdown-menu-open';
|
|
|
+ const panelGridClass = '.react-grid-item.panel';
|
|
|
+
|
|
|
+ let panelElem = elem.find('[data-toggle=dropdown]').parentsUntil('.panel').parent();
|
|
|
+ let menuElem = elem.find('[data-toggle=dropdown]').parent();
|
|
|
+ panelElem = panelElem && panelElem.length ? panelElem[0] : undefined;
|
|
|
+ if (panelElem) {
|
|
|
+ panelElem = $(panelElem);
|
|
|
+ $(panelGridClass).removeClass(menuOpenClass);
|
|
|
+ let state = !menuElem.hasClass('open');
|
|
|
+ panelElem.toggleClass(menuOpenClass, state);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let mouseX, mouseY;
|
|
|
elem.mousedown((e) => {
|
|
|
mouseX = e.pageX;
|