mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 23:53:57 +00:00
toolbar ordered
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
id: 'commandPalette.show',
|
id: 'commandPalette.show',
|
||||||
category: 'Command palette',
|
category: 'Command palette',
|
||||||
name: 'Show',
|
name: 'Show',
|
||||||
|
toolbarName: 'Menu',
|
||||||
|
toolbarOrder: 0,
|
||||||
keyText: 'F1',
|
keyText: 'F1',
|
||||||
toolbar: true,
|
toolbar: true,
|
||||||
showDisabled: true,
|
showDisabled: true,
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export interface GlobalCommand {
|
|||||||
toolbar?: boolean;
|
toolbar?: boolean;
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
showDisabled?: boolean;
|
showDisabled?: boolean;
|
||||||
|
toolbarName?: string;
|
||||||
|
toolbarOrder?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function registerCommand(command: GlobalCommand) {
|
export default function registerCommand(command: GlobalCommand) {
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
<script>
|
<script>
|
||||||
import { filter } from 'lodash';
|
import _ from 'lodash';
|
||||||
import App from '../App.svelte';
|
import App from '../App.svelte';
|
||||||
import { commands } from '../stores';
|
import { commands } from '../stores';
|
||||||
import ToolbarButton from './ToolbarButton.svelte';
|
import ToolbarButton from './ToolbarButton.svelte';
|
||||||
|
|
||||||
|
$: list = _.sortBy(
|
||||||
|
Object.values($commands).filter(x => (x.enabled || x.showDisabled) && x.toolbar && x.onClick),
|
||||||
|
x => (x.toolbarOrder == null ? 100 : x.toolbarOrder)
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{#each Object.values($commands).filter(x => (x.enabled || x.showDisabled) && x.toolbar && x.onClick) as command}
|
{#each list as command}
|
||||||
<ToolbarButton icon={command.icon} on:click={command.onClick} disabled={!command.enabled}
|
<ToolbarButton icon={command.icon} on:click={command.onClick} disabled={!command.enabled}
|
||||||
>{command.name}</ToolbarButton
|
>{command.toolbarName || command.name}</ToolbarButton
|
||||||
>
|
>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user