mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 06:06:01 +00:00
buttons folder
This commit is contained in:
29
packages/web/src/buttons/ToolStripCommandButton.svelte
Normal file
29
packages/web/src/buttons/ToolStripCommandButton.svelte
Normal file
@@ -0,0 +1,29 @@
|
||||
<script context="module">
|
||||
function getCommandTitle(command) {
|
||||
let res = command.text;
|
||||
if (command.keyText || command.keyTextFromGroup) res += ` (${command.keyText || command.keyTextFromGroup})`;
|
||||
return res;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { commandsCustomized } from '../stores';
|
||||
import ToolStripButton from './ToolStripButton.svelte';
|
||||
|
||||
export let command;
|
||||
export let component = ToolStripButton;
|
||||
|
||||
$: cmd = Object.values($commandsCustomized).find((x: any) => x.id == command) as any;
|
||||
</script>
|
||||
|
||||
{#if cmd}
|
||||
<svelte:component
|
||||
this={component}
|
||||
title={getCommandTitle(cmd)}
|
||||
icon={cmd.icon}
|
||||
on:click={cmd.onClick}
|
||||
disabled={!cmd.enabled}
|
||||
>
|
||||
{cmd.toolbarName || cmd.name}
|
||||
</svelte:component>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user