mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
sql generator
This commit is contained in:
parent
d6ba822338
commit
a3762c6caa
@ -19,6 +19,7 @@
|
|||||||
export let menu = undefined;
|
export let menu = undefined;
|
||||||
export let expandIcon = undefined;
|
export let expandIcon = undefined;
|
||||||
export let checkedObjectsStore = null;
|
export let checkedObjectsStore = null;
|
||||||
|
export let disableContextMenu = false;
|
||||||
|
|
||||||
$: isChecked = checkedObjectsStore && $checkedObjectsStore.find(x => module.extractKey(data) == module.extractKey(x));
|
$: isChecked = checkedObjectsStore && $checkedObjectsStore.find(x => module.extractKey(data) == module.extractKey(x));
|
||||||
|
|
||||||
@ -52,7 +53,7 @@
|
|||||||
class:isBold
|
class:isBold
|
||||||
draggable={true}
|
draggable={true}
|
||||||
on:click={handleClick}
|
on:click={handleClick}
|
||||||
use:contextMenu={menu}
|
use:contextMenu={disableContextMenu ? null : menu}
|
||||||
on:dragstart={e => {
|
on:dragstart={e => {
|
||||||
e.dataTransfer.setData('app_object_drag_data', JSON.stringify(data));
|
e.dataTransfer.setData('app_object_drag_data', JSON.stringify(data));
|
||||||
}}
|
}}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
export let items;
|
export let items;
|
||||||
export let module;
|
export let module;
|
||||||
export let checkedObjectsStore = null;
|
export let checkedObjectsStore = null;
|
||||||
|
export let disableContextMenu = false;
|
||||||
|
|
||||||
let isExpanded = true;
|
let isExpanded = true;
|
||||||
|
|
||||||
@ -52,7 +53,14 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#each filtered as item (module.extractKey(item.data))}
|
{#each filtered as item (module.extractKey(item.data))}
|
||||||
<AppObjectListItem {...$$restProps} {module} data={item.data} {checkedObjectsStore} on:objectClick />
|
<AppObjectListItem
|
||||||
|
{...$$restProps}
|
||||||
|
{module}
|
||||||
|
data={item.data}
|
||||||
|
{checkedObjectsStore}
|
||||||
|
on:objectClick
|
||||||
|
{disableContextMenu}
|
||||||
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
export let filter;
|
export let filter;
|
||||||
export let expandIconFunc = undefined;
|
export let expandIconFunc = undefined;
|
||||||
export let checkedObjectsStore = null;
|
export let checkedObjectsStore = null;
|
||||||
|
export let disableContextMenu = false;
|
||||||
|
|
||||||
export let groupFunc = undefined;
|
export let groupFunc = undefined;
|
||||||
|
|
||||||
@ -46,6 +47,7 @@
|
|||||||
{subItemsComponent}
|
{subItemsComponent}
|
||||||
{checkedObjectsStore}
|
{checkedObjectsStore}
|
||||||
{groupFunc}
|
{groupFunc}
|
||||||
|
{disableContextMenu}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{:else}
|
{:else}
|
||||||
@ -59,6 +61,7 @@
|
|||||||
on:objectClick
|
on:objectClick
|
||||||
{expandIconFunc}
|
{expandIconFunc}
|
||||||
{checkedObjectsStore}
|
{checkedObjectsStore}
|
||||||
|
{disableContextMenu}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
export let isExpandable = undefined;
|
export let isExpandable = undefined;
|
||||||
export let expandIconFunc = plusExpandIcon;
|
export let expandIconFunc = plusExpandIcon;
|
||||||
export let checkedObjectsStore = null;
|
export let checkedObjectsStore = null;
|
||||||
|
export let disableContextMenu = false;
|
||||||
|
|
||||||
let isExpanded = false;
|
let isExpanded = false;
|
||||||
|
|
||||||
@ -44,6 +45,7 @@
|
|||||||
expandIcon={getExpandIcon(expandable, subItemsComponent, isExpanded, expandIconFunc)}
|
expandIcon={getExpandIcon(expandable, subItemsComponent, isExpanded, expandIconFunc)}
|
||||||
{checkedObjectsStore}
|
{checkedObjectsStore}
|
||||||
{module}
|
{module}
|
||||||
|
{disableContextMenu}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if isExpanded && subItemsComponent}
|
{#if isExpanded && subItemsComponent}
|
||||||
|
@ -131,6 +131,10 @@
|
|||||||
<ModalBase {...$$restProps} fullScreen>
|
<ModalBase {...$$restProps} fullScreen>
|
||||||
<svelte:fragment slot="header">
|
<svelte:fragment slot="header">
|
||||||
SQL Generator
|
SQL Generator
|
||||||
|
<span class="dbname">
|
||||||
|
<FontIcon icon="icon database" />
|
||||||
|
{database}
|
||||||
|
</span>
|
||||||
{#if busy}
|
{#if busy}
|
||||||
<FontIcon icon="icon loading" />
|
<FontIcon icon="icon loading" />
|
||||||
{/if}
|
{/if}
|
||||||
@ -151,6 +155,7 @@
|
|||||||
groupFunc={data => _.startCase(data.objectTypeField)}
|
groupFunc={data => _.startCase(data.objectTypeField)}
|
||||||
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
|
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
|
||||||
filter={objectsFilter}
|
filter={objectsFilter}
|
||||||
|
disableContextMenu
|
||||||
{checkedObjectsStore}
|
{checkedObjectsStore}
|
||||||
/>
|
/>
|
||||||
</WidgetsInnerContainer>
|
</WidgetsInnerContainer>
|
||||||
@ -245,4 +250,8 @@
|
|||||||
margin: 5px;
|
margin: 5px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dbname {
|
||||||
|
color: var(--theme-font-3);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -5,9 +5,11 @@ export default function contextMenu(node, items) {
|
|||||||
const handleContextMenu = e => {
|
const handleContextMenu = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
const left = e.pageX;
|
if (items) {
|
||||||
const top = e.pageY;
|
const left = e.pageX;
|
||||||
currentDropDownMenu.set({ left, top, items: _.isFunction(items) ? items() : items });
|
const top = e.pageY;
|
||||||
|
currentDropDownMenu.set({ left, top, items: _.isFunction(items) ? items() : items });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
node.addEventListener('contextmenu', handleContextMenu);
|
node.addEventListener('contextmenu', handleContextMenu);
|
||||||
|
Loading…
Reference in New Issue
Block a user