mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
fix initialization for app with forms
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { faUser } from '@fortawesome/free-solid-svg-icons'
|
||||
import { getContext } from 'svelte'
|
||||
import { Icon } from 'svelte-awesome'
|
||||
import { initOutput } from '../../editor/appUtils'
|
||||
import type { AppInput } from '../../inputType'
|
||||
import type { Output } from '../../rx'
|
||||
import type { AppViewerContext, ComponentCustomCSS, RichConfigurations } from '../../types'
|
||||
@@ -25,10 +26,10 @@
|
||||
|
||||
const { app, worldStore, stateId } = getContext<AppViewerContext>('AppViewerContext')
|
||||
|
||||
$: outputs = $worldStore?.outputsById[id] as {
|
||||
result: Output<Array<any>>
|
||||
loading: Output<boolean>
|
||||
}
|
||||
let outputs = initOutput($worldStore, id, {
|
||||
result: undefined,
|
||||
loading: false
|
||||
})
|
||||
|
||||
let labelValue: string = ''
|
||||
let color: ButtonType.Color
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
import Portal from 'svelte-portal'
|
||||
import Modal from '$lib/components/common/modal/Modal.svelte'
|
||||
import { concatCustomCss } from '../../utils'
|
||||
import { initOutput } from '../../editor/appUtils'
|
||||
|
||||
export let id: string
|
||||
export let componentInput: AppInput | undefined
|
||||
@@ -24,14 +25,12 @@
|
||||
export let customCss: ComponentCustomCSS<'formbuttoncomponent'> | undefined = undefined
|
||||
export let render: boolean
|
||||
|
||||
export const staticOutputs: string[] = ['loading', 'result']
|
||||
|
||||
const { app, worldStore } = getContext<AppViewerContext>('AppViewerContext')
|
||||
|
||||
$: outputs = $worldStore?.outputsById[id] as {
|
||||
result: Output<Array<any>>
|
||||
loading: Output<boolean>
|
||||
}
|
||||
let outputs = initOutput($worldStore, id, {
|
||||
result: undefined,
|
||||
loading: false
|
||||
})
|
||||
|
||||
let labelValue: string = ''
|
||||
let color: ButtonType.Color
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
const { app, worldStore, selectedComponent } = getContext<AppViewerContext>('AppViewerContext')
|
||||
|
||||
initOutput($worldStore, id, {
|
||||
result: undefined
|
||||
const outputs = initOutput($worldStore, id, {
|
||||
result: null as number | null
|
||||
})
|
||||
|
||||
let defaultValue: number | undefined = undefined
|
||||
@@ -29,10 +29,6 @@
|
||||
let locale: string | undefined = undefined
|
||||
let value: number | undefined = undefined
|
||||
|
||||
$: outputs = $worldStore?.outputsById[id] as {
|
||||
result: Output<number | null>
|
||||
}
|
||||
|
||||
function handleInput() {
|
||||
outputs?.result.set(value ?? null)
|
||||
}
|
||||
|
||||
@@ -91,8 +91,14 @@
|
||||
class="{$$props.class} {lockedClasses} h-full
|
||||
w-full {app.fullscreen ? '' : 'max-w-6xl'} mx-auto"
|
||||
>
|
||||
{#if $appStore.grid && !$appStore.norefreshbar}
|
||||
<div class={classNames('mx-auto', width)}>
|
||||
{#if $appStore.grid}
|
||||
<div
|
||||
class={classNames(
|
||||
'mx-auto',
|
||||
width,
|
||||
$appStore?.norefreshbar ? 'invisible h-0 overflow-hidden' : ''
|
||||
)}
|
||||
>
|
||||
<div
|
||||
class="w-full sticky top-0 flex justify-between border-b bg-gray-50 px-4 py-1 items-center gap-4"
|
||||
style="z-index: 1000;"
|
||||
|
||||
Reference in New Issue
Block a user