mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 17:36:00 +00:00
Merge branch 'master' into develop
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "5.3.2-beta.2",
|
"version": "5.3.2-beta.3",
|
||||||
"name": "dbgate-all",
|
"name": "dbgate-all",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|||||||
@@ -1,11 +1,24 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { get_current_component } from 'svelte/internal';
|
||||||
|
import createActivator, { isComponentActiveStore } from '../utility/createActivator';
|
||||||
|
|
||||||
|
const thisInstance = get_current_component();
|
||||||
|
|
||||||
|
export const activator = createActivator('ToolStripContainer', false);
|
||||||
|
|
||||||
|
$: isComponentActive = $isComponentActiveStore('ToolStripContainer', thisInstance);
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if isComponentActive}
|
||||||
<div class="toolstrip">
|
<div class="toolstrip">
|
||||||
<slot name="toolstrip" />
|
<slot name="toolstrip" />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -401,6 +401,7 @@
|
|||||||
import { getDatabaseInfo, useDatabaseStatus } from '../utility/metadataLoaders';
|
import { getDatabaseInfo, useDatabaseStatus } from '../utility/metadataLoaders';
|
||||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import { openJsonLinesData } from '../utility/openJsonLinesData';
|
import { openJsonLinesData } from '../utility/openJsonLinesData';
|
||||||
|
import contextMenuActivator from '../utility/contextMenuActivator';
|
||||||
|
|
||||||
export let onLoadNextData = undefined;
|
export let onLoadNextData = undefined;
|
||||||
export let grider = undefined;
|
export let grider = undefined;
|
||||||
@@ -1802,6 +1803,7 @@
|
|||||||
bind:clientWidth={containerWidth}
|
bind:clientWidth={containerWidth}
|
||||||
bind:clientHeight={containerHeight}
|
bind:clientHeight={containerHeight}
|
||||||
use:contextMenu={buildMenu}
|
use:contextMenu={buildMenu}
|
||||||
|
use:contextMenuActivator={activator}
|
||||||
on:wheel={handleGridWheel}
|
on:wheel={handleGridWheel}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
|||||||
13
packages/web/src/utility/contextMenuActivator.ts
Normal file
13
packages/web/src/utility/contextMenuActivator.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
export default function contextMenuActivator(node, activator) {
|
||||||
|
const handleContextMenu = async e => {
|
||||||
|
activator.activate();
|
||||||
|
};
|
||||||
|
|
||||||
|
node.addEventListener('contextmenu', handleContextMenu);
|
||||||
|
|
||||||
|
return {
|
||||||
|
destroy() {
|
||||||
|
node.removeEventListener('contextmenu', handleContextMenu);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import { get_current_component, onMount, setContext } from 'svelte/internal';
|
import { get_current_component, onMount, setContext } from 'svelte/internal';
|
||||||
import invalidateCommands from '../commands/invalidateCommands';
|
import invalidateCommands from '../commands/invalidateCommands';
|
||||||
|
import { writable } from 'svelte/store';
|
||||||
|
|
||||||
const lastActiveDictionary = {};
|
const lastActiveDictionary = {};
|
||||||
|
|
||||||
|
export const isComponentActiveStore = writable((key: string, component) => false as boolean);
|
||||||
|
|
||||||
function isParent(parent, child) {
|
function isParent(parent, child) {
|
||||||
while (child && child.activator) {
|
while (child && child.activator) {
|
||||||
if (parent == child) return true;
|
if (parent == child) return true;
|
||||||
@@ -63,6 +66,10 @@ export default function createActivator(
|
|||||||
parentActivatorInstance.activator.activate();
|
parentActivatorInstance.activator.activate();
|
||||||
}
|
}
|
||||||
// console.log('Active components', lastActiveDictionary);
|
// console.log('Active components', lastActiveDictionary);
|
||||||
|
|
||||||
|
isComponentActiveStore.set((key, component) => {
|
||||||
|
return lastActiveDictionary[key] == component;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getTabVisible = () => tabVisibleValue;
|
const getTabVisible = () => tabVisibleValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user