dashboard grid: enable CSS transforms (#10125)

This commit is contained in:
Alexander Zobnin
2017-12-08 10:21:00 +03:00
committed by Torkel Ödegaard
parent 017b337f00
commit 3de17ecda7
3 changed files with 34 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ function GridWrapper({size, layout, onLayoutChange, children, onResize, onResize
isResizable={true} isResizable={true}
measureBeforeMount={false} measureBeforeMount={false}
containerPadding={[0, 0]} containerPadding={[0, 0]}
useCSSTransforms={false} useCSSTransforms={true}
margin={[GRID_CELL_VMARGIN, GRID_CELL_VMARGIN]} margin={[GRID_CELL_VMARGIN, GRID_CELL_VMARGIN]}
cols={GRID_COLUMN_COUNT} cols={GRID_COLUMN_COUNT}
rowHeight={GRID_CELL_HEIGHT} rowHeight={GRID_CELL_HEIGHT}

View File

@@ -1,5 +1,6 @@
///<reference path="../../headers/common.d.ts" /> ///<reference path="../../headers/common.d.ts" />
import $ from 'jquery';
import {coreModule} from 'app/core/core'; import {coreModule} from 'app/core/core';
var template = ` var template = `
@@ -106,13 +107,38 @@ function panelHeader($compile) {
} }
}); });
elem.find('.panel-menu-toggle').click((evt) => {
console.log(evt);
togglePanelState();
});
function togglePanelMenu(e) { function togglePanelMenu(e) {
if (!isDragged) { if (!isDragged) {
e.stopPropagation(); e.stopPropagation();
togglePanelState();
elem.find('[data-toggle=dropdown]').dropdown('toggle'); 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; let mouseX, mouseY;
elem.mousedown((e) => { elem.mousedown((e) => {
mouseX = e.pageX; mouseX = e.pageX;

View File

@@ -47,3 +47,10 @@
} }
} }
// Hack for preventing panel menu overlapping.
.react-grid-item.resizing.panel,
.react-grid-item.panel.dropdown-menu-open,
.react-grid-item.react-draggable-dragging.panel {
z-index: $zindex-dropdown;
}