From a0d7ade863fa44a635098465a96658f8cd4f122e Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 20 Jan 2022 14:34:04 +0100 Subject: [PATCH] table system menu callable from designer --- .../src/appobj/DatabaseObjectAppObject.svelte | 80 ++++++++++--------- packages/web/src/designer/Designer.svelte | 2 + .../web/src/designer/DesignerTable.svelte | 4 + .../web/src/designer/DiagramDesigner.svelte | 1 + .../designer/DiagramDesignerReference.svelte | 2 +- .../web/src/designer/QueryDesigner.svelte | 1 + 6 files changed, 51 insertions(+), 39 deletions(-) diff --git a/packages/web/src/appobj/DatabaseObjectAppObject.svelte b/packages/web/src/appobj/DatabaseObjectAppObject.svelte index 46bdbf48..ff2e3653 100644 --- a/packages/web/src/appobj/DatabaseObjectAppObject.svelte +++ b/packages/web/src/appobj/DatabaseObjectAppObject.svelte @@ -392,45 +392,15 @@ a.schemaName == b.schemaName ); } - - + + diff --git a/packages/web/src/designer/Designer.svelte b/packages/web/src/designer/Designer.svelte index 1fbf52fa..15311c3f 100644 --- a/packages/web/src/designer/Designer.svelte +++ b/packages/web/src/designer/Designer.svelte @@ -751,6 +751,8 @@ onChangeTableColor={handleChangeTableColor} onMoveReferences={recomputeReferencePositions} {table} + {conid} + {database} onChangeTable={changeTable} onBringToFront={bringToFront} onSelectTable={selectTable} diff --git a/packages/web/src/designer/DesignerTable.svelte b/packages/web/src/designer/DesignerTable.svelte index 38e8264e..2b698b43 100644 --- a/packages/web/src/designer/DesignerTable.svelte +++ b/packages/web/src/designer/DesignerTable.svelte @@ -2,6 +2,7 @@ import { presetDarkPalettes, presetPalettes } from '@ant-design/colors'; import { tick } from 'svelte'; + import { createDatabaseObjectMenu } from '../appobj/DatabaseObjectAppObject.svelte'; import FontIcon from '../icons/FontIcon.svelte'; import InputTextModal from '../modals/InputTextModal.svelte'; @@ -12,6 +13,8 @@ import ColumnLine from './ColumnLine.svelte'; import DomTableRef from './DomTableRef'; + export let conid; + export let database; export let table; export let onChangeTable; export let onBringToFront; @@ -153,6 +156,7 @@ ], settings?.allowAddAllReferences && { text: 'Add references', onClick: () => onAddAllReferences(table) }, settings?.allowChangeColor && { text: 'Change color', onClick: () => onChangeTableColor(table) }, + settings?.appendTableSystemMenu && [{ divider: true }, createDatabaseObjectMenu({ ...table, conid, database })], ]; } diff --git a/packages/web/src/designer/DiagramDesigner.svelte b/packages/web/src/designer/DiagramDesigner.svelte index 96597482..81a411c4 100644 --- a/packages/web/src/designer/DiagramDesigner.svelte +++ b/packages/web/src/designer/DiagramDesigner.svelte @@ -19,6 +19,7 @@ canSelectColumns: false, canSelectTables: true, allowChangeColor: true, + appendTableSystemMenu: true, }} referenceComponent={DiagramDesignerReference} /> diff --git a/packages/web/src/designer/DiagramDesignerReference.svelte b/packages/web/src/designer/DiagramDesignerReference.svelte index e7f599b2..d9da2381 100644 --- a/packages/web/src/designer/DiagramDesignerReference.svelte +++ b/packages/web/src/designer/DiagramDesignerReference.svelte @@ -93,6 +93,6 @@ } polygon { - fill: var(--theme-bg-4); + fill: var(--theme-font-1); } diff --git a/packages/web/src/designer/QueryDesigner.svelte b/packages/web/src/designer/QueryDesigner.svelte index 970f9134..612cbe89 100644 --- a/packages/web/src/designer/QueryDesigner.svelte +++ b/packages/web/src/designer/QueryDesigner.svelte @@ -19,6 +19,7 @@ canSelectColumns: true, canSelectTables: false, allowChangeColor: false, + appendTableSystemMenu: false, }} referenceComponent={QueryDesignerReference} />