fixed popup menu for columns

This commit is contained in:
Jan Prochazka
2021-07-18 07:57:25 +02:00
parent ba608ff438
commit 32d05edb6a
5 changed files with 16 additions and 11 deletions

View File

@@ -75,6 +75,7 @@ export abstract class GridDisplay {
}
changeSetKeyFields: string[] = null;
sortable = false;
groupable = false;
filterable = false;
editable = false;
isLoadedCorrectly = true;

View File

@@ -35,6 +35,7 @@ export class TableGridDisplay extends GridDisplay {
this.columns = this.getDisplayColumns(this.table, []);
this.filterable = true;
this.sortable = true;
this.groupable = true;
this.editable = true;
this.supportsReload = true;
this.baseTable = this.table;

View File

@@ -17,6 +17,7 @@ export class ViewGridDisplay extends GridDisplay {
this.columns = this.getDisplayColumns(view);
this.filterable = true;
this.sortable = true;
this.groupable = true;
this.editable = false;
this.supportsReload = true;
}

View File

@@ -6,6 +6,7 @@
import ColumnLabel from '../elements/ColumnLabel.svelte';
import { isTypeDateTime } from 'dbgate-tools';
import { openDatabaseObjectDetail } from '../appobj/DatabaseObjectAppObject.svelte';
import { copyTextToClipboard } from '../utility/clipboard';
export let column;
export let conid = undefined;
@@ -27,19 +28,20 @@
function getMenu() {
return [
{ onClick: () => setSort('ASC'), text: 'Sort ascending' },
{ onClick: () => setSort('DESC'), text: 'Sort descending' },
setSort && { onClick: () => setSort('ASC'), text: 'Sort ascending' },
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 }],
{ divider: true },
{ onClick: () => setGrouping('GROUP'), text: 'Group by' },
{ onClick: () => setGrouping('MAX'), text: 'MAX' },
{ onClick: () => setGrouping('MIN'), text: 'MIN' },
{ onClick: () => setGrouping('SUM'), text: 'SUM' },
{ onClick: () => setGrouping('AVG'), text: 'AVG' },
{ onClick: () => setGrouping('COUNT'), text: 'COUNT' },
{ onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
setGrouping && { divider: true },
setGrouping && { onClick: () => setGrouping('GROUP'), text: 'Group by' },
setGrouping && { onClick: () => setGrouping('MAX'), text: 'MAX' },
setGrouping && { onClick: () => setGrouping('MIN'), text: 'MIN' },
setGrouping && { onClick: () => setGrouping('SUM'), text: 'SUM' },
setGrouping && { onClick: () => setGrouping('AVG'), text: 'AVG' },
setGrouping && { onClick: () => setGrouping('COUNT'), text: 'COUNT' },
setGrouping && { onClick: () => setGrouping('COUNT DISTINCT'), text: 'COUNT DISTINCT' },
isTypeDateTime(column.dataType) && [
{ divider: true },

View File

@@ -1051,7 +1051,7 @@
// @ts-ignore
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)}
/>
</td>