{#snippet variableInput()} {#if variableEditor}
{#if value && typeof value == 'string' && value?.startsWith('$var:')} Linked to variable {/if}
{/if} {/snippet} {#snippet resourceInput()} {#if variableEditor}
{#if value && typeof value == 'string' && value?.startsWith('$res:')} Linked to resource {value.slice(5)} {/if}
{/if} {/snippet}
{#if diffStatus && typeof diffStatus === 'object' && diffStatus.diff !== 'same'}
{/if} {#if displayHeader}
{#if displayJsonToggleHeader} { // Once the user has changed the input type, we should not change it back automatically if (!hasIsListJsonChanged) { hasIsListJsonChanged = true } evalValueToRaw() isListJson = !isListJson }} checked={isListJson} textClass="text-secondary" size="xs" options={{ left: 'json' }} /> {/if} {@render fieldHeaderActions?.()}
{/if} {#if description}
{description}
{/if}
{#if inputCat == 'number'} {#if extra['min'] != undefined && extra['max'] != undefined} {:else if extra['seconds'] !== undefined} {:else if extra?.currency} {:else}
(ignoreValueUndefined = true), placeholder: placeholder ?? defaultValue ?? '', min: extra['min'], max: extra['max'] }} {error} bind:value />
{/if} {:else if inputCat == 'boolean'}
{ e?.stopPropagation() }} {disabled} class={valid ? '' : 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'} bind:checked={value} /> {#if type == 'boolean' && value == undefined}   Not set {/if}
{:else if (inputCat == 'resource-object' && format && format.split('-').length > 1 && format .replace('resource-', '') .replace('_', '') .toLowerCase() == 's3object') || (inputCat == 'list' && (itemsType?.resourceType === 's3_object' || itemsType?.resourceType === 's3object'))} dispatch('focus')} onBlur={() => dispatch('blur')} bind:editor {appPath} {computeS3ForceViewerPolicies} bottom={innerBottomSnippet} /> {:else if inputCat == 'object' && format == 'json-schema'} {#await import('$lib/components/EditableSchemaForm.svelte')} {:then Module} value && typeof value === 'object' && !Array.isArray(value) ? value : emptySchema(), (v) => { value = v } } isFlowInput editTab="inputEditor" noPreview addPropertyInEditorTab on:delete={(e) => { // Handle property deletion if (value && value.properties && value.properties[e.detail]) { delete value.properties[e.detail] // Also remove from order array if it exists if (value.order) { value.order = value.order.filter((key) => key !== e.detail) } // Update the value to trigger reactivity value = { ...value } dispatch('change') } }} /> {/await} {:else if inputCat == 'object' && format?.startsWith('jsonschema-')} {#await getJsonSchemaFromResource(format.substring('jsonschema-'.length), workspace ?? $workspaceStore ?? '')} {:then schema} {#if !schema || !schema.properties}
{#await import('$lib/components/JsonEditor.svelte')} {:then Module} {/await}
Error loading json schema resource {format.substring('jsonschema-'.length)}, please check if the resource exists and is a valid json schema. See documentation
{:else}
{/if} {/await} {:else if inputCat == 'list' && !isListJson}
{#if Array.isArray(itemsType?.multiselect) && Array.isArray(value)}
dispatch('focus')} reorderable />
{:else if enum_ && (Array.isArray(value) || value == undefined)}
dispatch('focus')} reorderable />
{:else if itemsType?.enum != undefined && Array.isArray(itemsType?.enum) && (Array.isArray(value) || value == undefined)}
dispatch('focus')} reorderable />
{:else}
{#key redraw} {#if Array.isArray(value)} {#each value ?? [] as v, i} {#if i < itemsLimit}
{#snippet deleteItemBtn()} {/snippet} {#if itemsType?.type == 'number'}
{@render deleteItemBtn()}
{:else if itemsType?.type == 'string' && itemsType?.contentEncoding == 'base64'} fileChangedInner(x.detail?.[0], (val) => (value[i] = val))} multiple={false} /> {@render deleteItemBtn()} {:else if itemsType?.type == 'object' && itemsType?.resourceType === undefined && itemsType?.properties === undefined && !(format?.startsWith('resource-') && resourceTypes?.includes(format.split('-')[1]))} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} {/await} {@render deleteItemBtn()} {:else if Array.isArray(itemsType?.enum)} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} {defaultValue} valid={valid ?? true} {disabled} {autofocus} bind:value={value[i]} enum_={itemsType?.enum ?? []} enumLabels={extra['enumLabels']} /> {@render deleteItemBtn()} {:else if (itemsType?.type == 'resource' && itemsType?.resourceType && resourceTypes?.includes(itemsType.resourceType)) || (format?.startsWith('resource-') && resourceTypes?.includes(format.split('-')[1]))} {@const resourceFormat = itemsType?.type == 'resource' && itemsType.resourceType && resourceTypes.includes(itemsType.resourceType) ? `resource-${itemsType.resourceType}` : format!} {@render deleteItemBtn()} {:else if itemsType?.type == 'resource'} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} code={JSON.stringify(v, null, 2)} bind:value={value[i]} /> {/await} {@render deleteItemBtn()} {:else if itemsType?.type === 'object' && itemsType?.properties}
{@render deleteItemBtn()} {:else}
{@render deleteItemBtn()}
{/if}
{/if} {/each} {#if value.length > itemsLimit} {/if} {:else if typeof value === 'string'} {#if value.startsWith('$res:')} {@render resourceInput()} {:else}
Invalid string value: "{value}", expected array. Click add item to turn it into an array.
{/if} {/if} {/key}
{/if}
{#if !displayHeader}
{ // Once the user has changed the input type, we should not change it back automatically if (!hasIsListJsonChanged) { hasIsListJsonChanged = true } evalValueToRaw() isListJson = !isListJson }} checked={isListJson} textClass="text-secondary" size="xs" options={{ left: 'json' }} />
{/if}
{:else if inputCat == 'dynamic'} {:else if inputCat == 'resource-object' && resourceTypes == undefined} Loading resource types... {:else if inputCat == 'resource-object' && (resourceTypes == undefined || (format && format?.split('-').length > 1 && resourceTypes.includes(format?.substring('resource-'.length))))} { defaultValue = null }} {showSchemaExplorer} /> {:else if inputCat == 'object' || inputCat == 'resource-object' || isListJson} {#if oneOf && oneOf.length >= 2}
{#if oneOf && oneOf.length >= 2} { oneOfSelected = detail const selectedObjProperties = oneOf?.find((o) => o.title == detail)?.properties ?? {} const newValueKeys = Object.keys(selectedObjProperties) const toKeep = {} for (const key of newValueKeys) { // Check if there is a select (enum) in the newly selected oneOf and if the current value is not in the enum, skip it if ( !['kind', 'label'].includes(key) && selectedObjProperties[key]?.enum && value && value[key] !== undefined && !selectedObjProperties[key].enum.includes(value[key]) ) { continue } toKeep[key] = value[key] } const tagKey = oneOf.find((o) => Object.keys(o.properties ?? {}).includes('kind')) ? 'kind' : 'label' value = { ...toKeep, [tagKey]: detail } }} > {#snippet children({ item })} {#each oneOf as obj} {/each} {/snippet} {#if oneOfSelected} {@const objIdx = oneOf.findIndex((o) => o.title === oneOfSelected)} {@const obj = oneOf[objIdx]} {#if obj && obj.properties && Object.keys(obj.properties).length > 0} {#key redraw} {#if orderEditable} ({ properties: obj.properties ?? {}, order: obj.order, $schema: '', required: obj.required ?? [], type: 'object' }), () => { dispatch('nestedChange') } } bind:args={value} hiddenArgs={[ oneOf?.find((o) => Object.keys(o.properties ?? {}).includes('kind')) ? 'kind' : 'label' ]} on:reorder={(e) => { if (oneOf && oneOf[objIdx]) { const keys = e.detail oneOf[objIdx].order = keys } }} on:nestedChange {shouldDispatchChanges} /> {:else} value, (v) => { value = { ...v, [tagKey]: oneOfSelected } } } {shouldDispatchChanges} on:change={() => { dispatch('nestedChange') }} on:nestedChange /> {/if} {/key} {:else if disabled} {:else} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} code={rawValue} on:changeValue={(e) => { setNewValueFromCode(e.detail) }} /> {/await} {/if} {/if} {:else if disabled} {:else} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} code={rawValue} on:change={(e) => { value = e.detail }} /> {/await} {/if}
{:else if properties && Object.keys(properties).length > 0 && inputCat !== 'list'}
{#if orderEditable} { const keys = e.detail order = keys }} diff={diffStatus && typeof diffStatus.diff === 'object' ? diffStatus.diff : {}} on:acceptChange={(e) => { dispatch('acceptChange', e.detail) }} on:rejectChange={(e) => { dispatch('rejectChange', e.detail) }} on:nestedChange nestedParent={{ label, nestedParent }} {shouldDispatchChanges} /> {:else} { dispatch('acceptChange', e.detail) }} on:rejectChange={(e) => { dispatch('rejectChange', e.detail) }} on:change={() => { dispatch('nestedChange') }} on:nestedChange {shouldDispatchChanges} /> {/if}
{:else if disabled} {:else} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} code={rawValue} on:changeValue={(e) => { setNewValueFromCode(e.detail) }} /> {/await} {/if} {#if inputCat == 'list' && !displayHeader}
{ isListJson = !isListJson }} checked={isListJson} textClass="text-secondary" size="xs" options={{ left: 'json' }} />
{/if} {:else if inputCat == 'enum'}
{ lastValue = undefined value = undefined }} create={extra['disableCreate'] != true} {defaultValue} valid={valid ?? true} {disabled} bind:value {enum_} {autofocus} on:focus={() => { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} enumLabels={extra['enumLabels']} />
{:else if inputCat == 'date'} {#if format === 'date'} {:else if format === 'naive-date-time'} {:else} {/if} {:else if isRawStringEditor(inputCat)} {#if disabled} {:else}
{#await import('$lib/components/SimpleEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} on:change={(e) => { setNewValueFromCode(e.detail?.code) }} bind:this={editor} lang={inputCat} code={typeof rawValue == 'string' ? rawValue : JSON.stringify(rawValue, null, 2)} autoHeight /> {/await}
{/if} {:else if inputCat == 'base64'}
fileChangedInner(x.detail?.[0], (val) => (value = val))} multiple={false} /> {#if value?.length}
File length: {value.length} base64 chars ({(value.length / 1024 / 1024).toFixed(2)}MB)
{/if}
{:else if inputCat == 'resource-string'} 1 ? format.substring('resource-'.length) : undefined} {showSchemaExplorer} /> {:else if inputCat == 'ai-provider'} {:else if inputCat == 'email'} {:else if inputCat == 'string'}
{#if password || extra?.['password'] == true} {#if onlyMaskPassword} {#if value && typeof value == 'string' && value?.startsWith('$var:')} {:else} {/if} {:else} {/if} {:else} {#key extra?.['minRows']} dispatch('focus'), onblur: () => dispatch('blur'), disabled, onkeydown: onKeyDown, placeholder: placeholder ?? defaultValue ?? '', rows: extra?.['minRows'] ? extra['minRows']?.toString() : '1' }} bind:value {error} unifiedHeight={false} underlyingInputEl="textarea" /> {/key} {/if} {#if !disabled && itemPicker && extra?.['disableVariablePicker'] != true}
{@render variableInput()} {@render resourceInput()}
{/if} {@render actions?.()}
{#if !compact || (error && error != '')}
{#if disabled || error === ''}   {:else} {error} {/if}
{:else if !noMargin}
{/if} {#if !s3StorageConfigured && extra['x-no-s3-storage-workspace-warning']} {/if}