mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 14:56:01 +00:00
inline editing
This commit is contained in:
@@ -4,6 +4,7 @@ import { ForeignKeyInfo, TableInfo, ColumnInfo, DbType } from '@dbgate/types';
|
||||
import { parseFilter, getFilterType } from '@dbgate/filterparser';
|
||||
import { filterName } from './filterName';
|
||||
import { Select, Expression } from '@dbgate/sqltree';
|
||||
import { ChangeSetFieldDefinition } from './ChangeSet';
|
||||
|
||||
export interface DisplayColumn {
|
||||
schemaName: string;
|
||||
@@ -47,6 +48,8 @@ export abstract class GridDisplay {
|
||||
) {}
|
||||
abstract getPageQuery(offset: number, count: number): string;
|
||||
columns: DisplayColumn[];
|
||||
baseTable?: TableInfo;
|
||||
changeSetKeyFields: string[] = null;
|
||||
setColumnVisibility(uniquePath: string[], isVisible: boolean) {
|
||||
const uniqueName = uniquePath.join('.');
|
||||
if (uniquePath.length == 1) {
|
||||
@@ -350,4 +353,23 @@ export abstract class GridDisplay {
|
||||
});
|
||||
this.reload();
|
||||
}
|
||||
|
||||
getChangeSetCondition(row) {
|
||||
if (!this.changeSetKeyFields) return null;
|
||||
return _.pick(row, this.changeSetKeyFields);
|
||||
}
|
||||
|
||||
getChangeSetField(row, uniqueName): ChangeSetFieldDefinition {
|
||||
const col = this.columns.find(x => x.uniqueName == uniqueName);
|
||||
if (!col) return null;
|
||||
if (!this.baseTable) return null;
|
||||
if (this.baseTable.pureName != col.pureName || this.baseTable.schemaName != col.schemaName) return null;
|
||||
return {
|
||||
pureName: col.pureName,
|
||||
schemaName: col.schemaName,
|
||||
uniqueName: uniqueName,
|
||||
columnName: col.columnName,
|
||||
condition: this.getChangeSetCondition(row),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user