Skip to content

Commit

Permalink
improve oneOf handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Dec 19, 2024
1 parent cfd93a3 commit d45cdf8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 7 additions & 10 deletions frontend/src/lib/components/ArgInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,11 @@
<div class="flex flex-col gap-2 w-full">
{#if oneOf && oneOf.length >= 2}
<ToggleButtonGroup
bind:selected={oneOfSelected}
on:selected={() => {
value = {}
value = { label: oneOfSelected }
redraw += 1
}}
bind:selected={oneOfSelected}
>
{#each oneOf as obj}
<ToggleButton value={obj.title} label={obj.title} />
Expand All @@ -680,10 +680,8 @@
{disablePortal}
{disabled}
schema={{
properties: Object.fromEntries(
Object.entries(obj.properties).filter(([k, v]) => k !== 'label')
),
order: obj.order?.filter((k) => k !== 'label') ?? undefined,
properties: obj.properties,
order: obj.order,
$schema: '',
required: obj.required ?? [],
type: 'object'
Expand All @@ -703,11 +701,10 @@
{onlyMaskPassword}
{disablePortal}
{disabled}
schemaSkippedValues={['label']}
schema={{
properties: Object.fromEntries(
Object.entries(obj.properties).filter(([k, v]) => k !== 'label')
),
order: obj.order?.filter((k) => k !== 'label') ?? undefined,
properties: obj.properties,
order: obj.order,
$schema: '',
required: obj.required ?? [],
type: 'object'
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/schema/SchemaFormDND.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let onlyMaskPassword: boolean = false
export let disablePortal: boolean = false
export let disabled: boolean = false
export let schemaSkippedValues: string[] = []
const dispatch = createEventDispatcher()
const flipDurationMs = 200
Expand Down Expand Up @@ -65,6 +66,7 @@
<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<SchemaForm
{schemaSkippedValues}
on:click
on:change
on:reorder
Expand Down

0 comments on commit d45cdf8

Please sign in to comment.