mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 12:35:59 +00:00
column manager search box, hide all, show all
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user