utils.ts 735 B

1234567891011121314151617181920212223242526272829
  1. import { REPEAT_DIR_HORIZONTAL } from '../../../core/constants';
  2. import { PanelModel } from './PanelModel';
  3. export function isOnTheSameGridRow(sourcePanel: PanelModel, otherPanel: PanelModel): boolean {
  4. if (sourcePanel.repeatDirection === REPEAT_DIR_HORIZONTAL) {
  5. return false;
  6. }
  7. if (
  8. otherPanel.gridPos.x >= sourcePanel.gridPos.x + sourcePanel.gridPos.w &&
  9. otherPanel.gridPos.y === sourcePanel.gridPos.y
  10. ) {
  11. return true;
  12. }
  13. return false;
  14. }
  15. export function deleteScopeVars(panels: PanelModel[]) {
  16. for (const panel of panels) {
  17. delete panel.scopedVars;
  18. if (panel.panels?.length) {
  19. for (const collapsedPanel of panel.panels) {
  20. delete collapsedPanel.scopedVars;
  21. }
  22. }
  23. }
  24. }