mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 03:53:57 +00:00
fixed popup menu for columns
This commit is contained in:
@@ -75,6 +75,7 @@ export abstract class GridDisplay {
|
|||||||
}
|
}
|
||||||
changeSetKeyFields: string[] = null;
|
changeSetKeyFields: string[] = null;
|
||||||
sortable = false;
|
sortable = false;
|
||||||
|
groupable = false;
|
||||||
filterable = false;
|
filterable = false;
|
||||||
editable = false;
|
editable = false;
|
||||||
isLoadedCorrectly = true;
|
isLoadedCorrectly = true;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class TableGridDisplay extends GridDisplay {
|
|||||||
this.columns = this.getDisplayColumns(this.table, []);
|
this.columns = this.getDisplayColumns(this.table, []);
|
||||||
this.filterable = true;
|
this.filterable = true;
|
||||||
this.sortable = true;
|
this.sortable = true;
|
||||||
|
this.groupable = true;
|
||||||
this.editable = true;
|
this.editable = true;
|
||||||
this.supportsReload = true;
|
this.supportsReload = true;
|
||||||
this.baseTable = this.table;
|
this.baseTable = this.table;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export class ViewGridDisplay extends GridDisplay {
|
|||||||
this.columns = this.getDisplayColumns(view);
|
this.columns = this.getDisplayColumns(view);
|
||||||
this.filterable = true;
|
this.filterable = true;
|
||||||
this.sortable = true;
|
this.sortable = true;
|
||||||
|
this.groupable = true;
|
||||||
this.editable = false;
|
this.editable = false;
|
||||||
this.supportsReload = true;
|
this.supportsReload = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import ColumnLabel from '../elements/ColumnLabel.svelte';
|
import ColumnLabel from '../elements/ColumnLabel.svelte';
|
||||||
import { isTypeDateTime } from 'dbgate-tools';
|
import { isTypeDateTime } from 'dbgate-tools';
|
||||||
import { openDatabaseObjectDetail } from '../appobj/DatabaseObjectAppObject.svelte';
|
import { openDatabaseObjectDetail } from '../appobj/DatabaseObjectAppObject.svelte';
|
||||||
|
import { copyTextToClipboard } from '../utility/clipboard';
|
||||||
|
|
||||||
export let column;
|
export let column;
|
||||||
export let conid = undefined;
|
export let conid = undefined;
|
||||||
@@ -27,19 +28,20 @@
|
|||||||
|
|
||||||
function getMenu() {
|
function getMenu() {
|
||||||
return [
|
return [
|
||||||
{ onClick: () => setSort('ASC'), text: 'Sort ascending' },
|
setSort && { onClick: () => setSort('ASC'), text: 'Sort ascending' },
|
||||||
{ onClick: () => setSort('DESC'), text: 'Sort descending' },
|
setSort && { onClick: () => setSort('DESC'), text: 'Sort descending' },
|
||||||
|
{ onClick: () => copyTextToClipboard(column.columnName), text: 'Copy column name' },
|
||||||
|
|
||||||
column.foreignKey && [{ divider: true }, { onClick: openReferencedTable, text: column.foreignKey.refTableName }],
|
column.foreignKey && [{ divider: true }, { onClick: openReferencedTable, text: column.foreignKey.refTableName }],
|
||||||
|
|
||||||
{ divider: true },
|
setGrouping && { divider: true },
|
||||||
{ onClick: () => setGrouping('GROUP'), text: 'Group by' },
|
setGrouping && { onClick: () => setGrouping('GROUP'), text: 'Group by' },
|
||||||
{ onClick: () => setGrouping('MAX'), text: 'MAX' },
|
setGrouping && { onClick: () => setGrouping('MAX'), text: 'MAX' },
|
||||||
{ onClick: () => setGrouping('MIN'), text: 'MIN' },
|
setGrouping && { onClick: () => setGrouping('MIN'), text: 'MIN' },
|
||||||
{ onClick: () => setGrouping('SUM'), text: 'SUM' },
|
setGrouping && { onClick: () => setGrouping('SUM'), text: 'SUM' },
|
||||||
{ onClick: () => setGrouping('AVG'), text: 'AVG' },
|
setGrouping && { onClick: () => setGrouping('AVG'), text: 'AVG' },
|
||||||
{ onClick: () => setGrouping('COUNT'), text: 'COUNT' },
|
setGrouping && { onClick: () => setGrouping('COUNT'), text: 'COUNT' },
|
||||||
{ onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
|
setGrouping && { onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
|
||||||
|
|
||||||
isTypeDateTime(column.dataType) && [
|
isTypeDateTime(column.dataType) && [
|
||||||
{ divider: true },
|
{ divider: true },
|
||||||
|
|||||||
@@ -1051,7 +1051,7 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
display.resizeColumn(col.uniqueName, col.width, e.detail);
|
display.resizeColumn(col.uniqueName, col.width, e.detail);
|
||||||
}}
|
}}
|
||||||
setGrouping={display.sortable ? groupFunc => display.setGrouping(col.uniqueName, groupFunc) : null}
|
setGrouping={display.groupable ? groupFunc => display.setGrouping(col.uniqueName, groupFunc) : null}
|
||||||
grouping={display.getGrouping(col.uniqueName)}
|
grouping={display.getGrouping(col.uniqueName)}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user