column manager search box, hide all, show all

This commit is contained in:
Jan Prochazka
2020-03-07 18:13:44 +01:00
parent 49a0a16c25
commit d64ae4b688
7 changed files with 67 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
import _ from 'lodash';
import GridConfig from './GridConfig';
import { GridConfig } from './GridConfig';
import { ForeignKeyInfo } from '@dbgate/types';
export interface DisplayColumn {
@@ -14,7 +14,7 @@ export interface DisplayColumn {
isChecked: boolean;
}
export default abstract class GridDisplay {
export abstract class GridDisplay {
constructor(public config: GridConfig, protected setConfig: (config: GridConfig) => void) {}
abstract getPageQuery(offset: number, count: number): string;
columns: DisplayColumn[];
@@ -32,6 +32,20 @@ export default abstract class GridDisplay {
}
}
showAllColumns() {
this.setConfig({
...this.config,
hiddenColumns: [],
});
}
hideAllColumns() {
this.setConfig({
...this.config,
hiddenColumns: this.columns.map(x => x.uniqueName),
});
}
get hiddenColumnIndexes() {
return (this.config.hiddenColumns || []).map(x => _.findIndex(this.columns, y => y.uniqueName == x));
}