2021-10-10 23:33:04 -05:00
|
|
|
import { REPEAT_DIR_HORIZONTAL } from '../../../core/constants';
|
|
|
|
|
2022-04-22 08:33:13 -05:00
|
|
|
import { PanelModel } from './PanelModel';
|
|
|
|
|
2021-10-10 23:33:04 -05:00
|
|
|
export function isOnTheSameGridRow(sourcePanel: PanelModel, otherPanel: PanelModel): boolean {
|
|
|
|
if (sourcePanel.repeatDirection === REPEAT_DIR_HORIZONTAL) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (
|
|
|
|
otherPanel.gridPos.x >= sourcePanel.gridPos.x + sourcePanel.gridPos.w &&
|
|
|
|
otherPanel.gridPos.y === sourcePanel.gridPos.y
|
|
|
|
) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2021-11-17 23:22:16 -06:00
|
|
|
|
|
|
|
export function deleteScopeVars(panels: PanelModel[]) {
|
|
|
|
for (const panel of panels) {
|
|
|
|
delete panel.scopedVars;
|
|
|
|
if (panel.panels?.length) {
|
|
|
|
for (const collapsedPanel of panel.panels) {
|
|
|
|
delete collapsedPanel.scopedVars;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|