mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-07 00:01:49 +00:00
* fix(frontend): sync columnDefs + improve columnDefs management * fix(frontend): sync columnDefs + improve columnDefs management * fix(frontend): improve code quality * fix(frontend): improve code quality * fix(frontend): remove useless warning while the config is loading * fix(frontend): Disable actions for database studio, since columnDefs are managed by the component * feat(frontend): Fix Database studio * feat(frontend): revert changes from Database Studio * feat(frontend): fix DB Studio refresh * fix(frontend): improve code quality * fix(frontend): improve code quality * fix(frontend): fix build * fix(frontend): fix wording * fix(frontend): fix aggrid
71 lines
2.0 KiB
Svelte
71 lines
2.0 KiB
Svelte
<script lang="ts">
|
|
import { getModifierKey } from '$lib/utils'
|
|
|
|
import { Copy, Paintbrush2, Scissors, Trash } from 'lucide-svelte'
|
|
import ContextMenu from '$lib/components/ContextMenu.svelte'
|
|
import ComponentCallbacks from './component/ComponentCallbacks.svelte'
|
|
import { getContext } from 'svelte'
|
|
import type { AppEditorContext, AppViewerContext } from '../types'
|
|
import DeleteComponent from './settingsPanel/DeleteComponent.svelte'
|
|
import { findComponentSettings } from './appUtils'
|
|
import { secondaryMenuLeft } from './settingsPanel/secondaryMenu'
|
|
import StylePanel from './settingsPanel/StylePanel.svelte'
|
|
|
|
export let id: string
|
|
let componentCallbacks: ComponentCallbacks | undefined = undefined
|
|
|
|
const { selectedComponent, app } = getContext<AppViewerContext>('AppViewerContext')
|
|
const { movingcomponents } = getContext<AppEditorContext>('AppEditorContext')
|
|
|
|
let deleteComponent: DeleteComponent | undefined = undefined
|
|
$: componentSettings = $selectedComponent?.map((sc) => findComponentSettings($app, sc))
|
|
</script>
|
|
|
|
<ComponentCallbacks bind:this={componentCallbacks} />
|
|
<ContextMenu
|
|
contextMenu={{
|
|
menuItems: [
|
|
{
|
|
label: 'Cut',
|
|
onClick: () => {
|
|
componentCallbacks?.handleCut(new KeyboardEvent('keydown'))
|
|
},
|
|
icon: Scissors,
|
|
shortcut: `${getModifierKey()}X`,
|
|
disabled: $movingcomponents?.includes($selectedComponent?.[0] ?? '')
|
|
},
|
|
{
|
|
label: 'Copy',
|
|
onClick: () => {
|
|
componentCallbacks?.handleCopy(new KeyboardEvent('keydown'))
|
|
},
|
|
icon: Copy,
|
|
shortcut: `${getModifierKey()}C`
|
|
},
|
|
{
|
|
label: 'Show style panel',
|
|
onClick: () => {
|
|
secondaryMenuLeft?.toggle(StylePanel, { type: 'style' })
|
|
},
|
|
icon: Paintbrush2,
|
|
disabled: $secondaryMenuLeft.isOpen
|
|
},
|
|
|
|
{
|
|
label: 'Delete',
|
|
onClick: () => {
|
|
deleteComponent?.removeGridElement()
|
|
},
|
|
icon: Trash,
|
|
shortcut: `Del`,
|
|
color: 'red'
|
|
}
|
|
]
|
|
}}
|
|
{id}
|
|
>
|
|
<slot />
|
|
</ContextMenu>
|
|
|
|
<DeleteComponent {componentSettings} bind:this={deleteComponent} />
|