mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 02:13:57 +00:00
refactor
This commit is contained in:
11
packages/web/src/buttons/ToolStripCommandSplitButton.svelte
Normal file
11
packages/web/src/buttons/ToolStripCommandSplitButton.svelte
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
import ToolStripCommandButton from './ToolStripCommandButton.svelte';
|
||||||
|
import ToolStripSplitDropDownButton from './ToolStripSplitDropDownButton.svelte';
|
||||||
|
|
||||||
|
export let commands;
|
||||||
|
$: menu = _.compact(commands).map(command => ({ command }));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<ToolStripCommandButton command={commands[0]} component={ToolStripSplitDropDownButton} {menu} />
|
||||||
@@ -1,20 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import getElectron from '../utility/getElectron';
|
import getElectron from '../utility/getElectron';
|
||||||
|
import ToolStripCommandSplitButton from './ToolStripCommandSplitButton.svelte';
|
||||||
import ToolStripCommandButton from './ToolStripCommandButton.svelte';
|
|
||||||
import ToolStripSplitDropDownButton from './ToolStripSplitDropDownButton.svelte';
|
|
||||||
|
|
||||||
export let idPrefix;
|
export let idPrefix;
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ToolStripCommandButton
|
<ToolStripCommandSplitButton
|
||||||
command={`${idPrefix}.save`}
|
commands={[`${idPrefix}.save`, `${idPrefix}.saveAs`, electron && `${idPrefix}.saveToDisk`]}
|
||||||
component={ToolStripSplitDropDownButton}
|
|
||||||
menu={[
|
|
||||||
{ command: `${idPrefix}.save` },
|
|
||||||
{ command: `${idPrefix}.saveAs` },
|
|
||||||
electron && { command: `${idPrefix}.saveToDisk` },
|
|
||||||
]}
|
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -73,8 +73,7 @@
|
|||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
||||||
import JslDataGrid from '../datagrid/JslDataGrid.svelte';
|
import JslDataGrid from '../datagrid/JslDataGrid.svelte';
|
||||||
import runCommand from '../commands/runCommand';
|
import ToolStripCommandSplitButton from '../buttons/ToolStripCommandSplitButton.svelte';
|
||||||
import ToolStripSplitDropDownButton from '../buttons/ToolStripSplitDropDownButton.svelte';
|
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let archiveFolder;
|
export let archiveFolder;
|
||||||
@@ -199,11 +198,7 @@
|
|||||||
|
|
||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton command="jsonl.save" />
|
<ToolStripCommandButton command="jsonl.save" />
|
||||||
<ToolStripCommandButton
|
<ToolStripCommandSplitButton commands={['jsonl.preview', 'jsonl.previewNewTab']} />
|
||||||
command="jsonl.preview"
|
|
||||||
component={ToolStripSplitDropDownButton}
|
|
||||||
menu={[{ command: 'jsonl.preview' }, { command: 'jsonl.previewNewTab' }]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ToolStripCommandButton command="jsonl.closePreview" />
|
<ToolStripCommandButton command="jsonl.closePreview" />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|||||||
@@ -71,9 +71,8 @@
|
|||||||
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
||||||
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
||||||
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
import ToolStripExportButton, { createQuickExportHandlerRef } from '../buttons/ToolStripExportButton.svelte';
|
||||||
import ToolStripSplitButton from '../buttons/ToolStripSplitButton.svelte';
|
import ToolStripSaveButton from '../buttons/ToolStripSaveButton.svelte';
|
||||||
import ToolStripSplitDropDownButton from '../buttons/ToolStripSplitDropDownButton.svelte';
|
import ToolStripCommandSplitButton from '../buttons/ToolStripCommandSplitButton.svelte';
|
||||||
import ToolStripSaveButton from '../buttons/ToolStripSaveButton.svelte';
|
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -327,11 +326,7 @@ import ToolStripSaveButton from '../buttons/ToolStripSaveButton.svelte';
|
|||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</VerticalSplitter>
|
</VerticalSplitter>
|
||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton
|
<ToolStripCommandSplitButton commands={['query.execute', 'query.executeCurrent']} />
|
||||||
command="query.execute"
|
|
||||||
component={ToolStripSplitDropDownButton}
|
|
||||||
menu={[{ command: 'query.execute' }, { command: 'query.executeCurrent' }]}
|
|
||||||
/>
|
|
||||||
<ToolStripCommandButton command="query.kill" />
|
<ToolStripCommandButton command="query.kill" />
|
||||||
<ToolStripSaveButton idPrefix="query" />
|
<ToolStripSaveButton idPrefix="query" />
|
||||||
<ToolStripCommandButton command="query.formatCode" />
|
<ToolStripCommandButton command="query.formatCode" />
|
||||||
|
|||||||
Reference in New Issue
Block a user