mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-01 08:00:47 +08:00
Fix Favorites placing on filter
This commit is contained in:
parent
bf07231225
commit
1ad34e7f55
2 changed files with 28 additions and 18 deletions
|
@ -27,7 +27,7 @@
|
|||
import {Directive, Input, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {BreakpointObserver, Breakpoints, BreakpointState} from '@angular/cdk/layout';
|
||||
import {FieldGridRow, LabelDisplay} from './field-grid.model';
|
||||
import {FieldGridColumn, FieldGridRow, LabelDisplay} from './field-grid.model';
|
||||
import {ScreenSizeMap} from '../../common/services/ui/resize.model';
|
||||
|
||||
|
||||
|
@ -153,26 +153,41 @@ export abstract class BaseFieldGridComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
|
||||
} else {
|
||||
const lastNeededCol = this.colNumber - neededSlots.length;
|
||||
let lastRow = grid[grid.length - 1];
|
||||
|
||||
if (lastRow.cols[lastNeededCol].field) {
|
||||
lastRow = {
|
||||
cols: []
|
||||
} as FieldGridRow;
|
||||
this.fillRow(lastRow);
|
||||
grid.push(lastRow);
|
||||
}
|
||||
let rowLength = lastRow.cols.length;
|
||||
|
||||
let place = this.colNumber - 1;
|
||||
neededSlots.forEach(type => {
|
||||
lastRow.cols[place][type] = true;
|
||||
place--;
|
||||
neededSlots.reverse().forEach(type => {
|
||||
let actionSlot = false;
|
||||
if (type === 'actionSlot') {
|
||||
actionSlot = true;
|
||||
}
|
||||
|
||||
if (rowLength === this.colNumber || actionSlot) {
|
||||
lastRow = this.addNewRow();
|
||||
grid.push(lastRow);
|
||||
rowLength = actionSlot ? (this.colNumber - 1) : 0;
|
||||
}
|
||||
|
||||
lastRow.cols[rowLength] = [] as FieldGridColumn;
|
||||
lastRow.cols[rowLength][type] = true;
|
||||
this.fillRow(lastRow);
|
||||
rowLength++;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected addNewRow(): FieldGridRow {
|
||||
const row = {
|
||||
cols: []
|
||||
} as FieldGridRow
|
||||
|
||||
this.fillRow(row);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
protected getNeededExtraSlots(): string[] {
|
||||
const neededSlots = [];
|
||||
|
||||
|
|
|
@ -81,11 +81,6 @@ export class FieldGridComponent extends BaseFieldGridComponent implements OnChan
|
|||
col++;
|
||||
});
|
||||
|
||||
const lastRow = grid[grid.length - 1];
|
||||
if (col < this.colNumber) {
|
||||
this.fillRow(lastRow);
|
||||
}
|
||||
|
||||
this.addSpecialSlots(grid);
|
||||
|
||||
this.fieldGrid = grid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue