Files
windmill/frontend/src/lib/components/apps/editor/contextPanel/ComponentOutput.svelte
T
Faton Ramadani 7434edda06 feat(frontend): app navbar (#3992)
* feat(frontend): app navbar

* feat(frontend): app navbar

* fix(frontend): add icons + highlight + image

* fix(frontend): improve style

* fix(frontend): use a proper select component

* fix(frontend): fix select

* feat(frontend): Navbar component

* feat(frontend): add path indicator + fix disabled navbar item

* feat(frontend): add path indicator + fix disabled navbar item

* feat(frontend): wip

* feat(frontend): wip

* feat(frontend): add local item

* feat(frontend): introduced currentPath

* feat(frontend): fix popups

* feat(frontend): initial current path

* feat(frontend): initial current path

* feat(frontend): fix interactions

* feat(frontend): improve code

* feat(frontend): improve code

* feat(frontend): wip

* feat(frontend): open windmill apps in the same tab

* feat(frontend): added support for the goto

* feat(frontend): avoid loaded the app multiple times

* feat(frontend): add support for oneOf

* feat(frontend): done

* feat(frontend): add missing tooltips

* feat(frontend): improve alert message

* feat(frontend): fix typo

* feat(frontend): add missing reference to the ctx.query

* fix(frontend): improve code

* feat(frontend): navbar done

* feat(frontend): fix navbar wizard wording

* feat(frontend): only select the current app if the selected value is not defined + correctly clear
2024-07-04 19:50:00 +02:00

55 lines
1.8 KiB
Svelte

<script lang="ts">
import { components } from '../component'
import { getContext } from 'svelte'
import type { AppViewerContext, GridItem } from '../../types'
import ComponentOutputViewer from './ComponentOutputViewer.svelte'
import { connectOutput } from '../appUtils'
import SubGridOutput from './SubGridOutput.svelte'
import OutputHeader from './components/OutputHeader.svelte'
import TableActionsOutput from './components/TableActionsOutput.svelte'
import { BG_PREFIX } from '../../utils'
// @ts-ignore
import MenuItemsOutput from './components/MenuItemsOutput.svelte'
export let gridItem: GridItem
export let first: boolean = false
export let nested: boolean = false
export let expanded: boolean = false
const { connectingInput } = getContext<AppViewerContext>('AppViewerContext')
const name = getComponentNameById(gridItem.id)
$: nameOverrides =
gridItem?.data?.type === 'decisiontreecomponent'
? gridItem.data.nodes.map((n, i) => `${n.label} (Tab index ${i})`)
: undefined
function getComponentNameById(componentId: string) {
if (gridItem?.data?.type) {
return components?.[gridItem?.data.type]?.name ?? 'Unknown'
} else if (componentId == 'ctx') {
return 'Context'
} else if (componentId.startsWith(BG_PREFIX)) {
return 'Background'
} else {
return 'Table action'
}
}
$: subGrids = Array.from({ length: gridItem.data?.numberOfSubgrids ?? 0 }).map(
(_, i) => `${gridItem.id}-${i}`
)
</script>
<OutputHeader id={gridItem.id} name={getComponentNameById(gridItem.id)} {first} {nested}>
<ComponentOutputViewer
componentId={gridItem.id}
on:select={({ detail }) => {
connectOutput(connectingInput, gridItem?.data?.type, gridItem.data.id, detail)
}}
/>
<SubGridOutput {name} {nameOverrides} {expanded} {subGrids} parentId={gridItem.id} />
<TableActionsOutput {gridItem} />
<MenuItemsOutput {gridItem} />
</OutputHeader>