{ rawValue = JSON.stringify(value, null, 2) editor?.setCode(rawValue) }} readOnlyMode={false} />
{#if diffStatus && typeof diffStatus === 'object' && diffStatus.diff !== 'same'}
{/if} {#if displayHeader} {/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 }} class={valid ? '' : 'border border-red-700 border-opacity-30 focus:border-red-700 focus:border-opacity-30 bg-red-100'} placeholder={placeholder ?? defaultValue ?? ''} bind:value min={extra['min']} max={extra['max']} />
{/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 == 'list' && !isListJson}
{#if Array.isArray(itemsType?.multiselect) && Array.isArray(value)}
{ dispatch('focus') }} />
{:else if itemsType?.enum != undefined && Array.isArray(itemsType?.enum) && Array.isArray(value)}
[...value], (v) => { if (!deepEqual(v, value)) { value = v } } } options={itemsType?.enum ?? []} selectedOptionsDraggable={true} on:open={() => { dispatch('focus') }} />
{:else}
{#key redraw} {#if Array.isArray(value)} {#each value ?? [] as v, i} {#if i < itemsLimit}
{#if itemsType?.type == 'number'} {:else if itemsType?.type == 'string' && itemsType?.contentEncoding == 'base64'} fileChanged(x, (val) => (value[i] = val))} multiple={false} /> {:else if itemsType?.type == 'object' && itemsType?.resourceType === undefined && itemsType?.properties === undefined} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} {/await} {:else if Array.isArray(itemsType?.enum)} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} {defaultValue} {valid} {disabled} {autofocus} bind:value={value[i]} enum_={itemsType?.enum ?? []} enumLabels={extra['enumLabels']} /> {:else if itemsType?.type == 'resource' && itemsType?.resourceType && resourceTypes?.includes(itemsType.resourceType)} {: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} {:else if itemsType?.type === 'object' && itemsType?.properties}
{:else} {/if}
{/if} {/each} {#if value.length > itemsLimit} {/if} {/if} {/key}
{/if}
{ // 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={{ right: 'json' }} />
{:else if inputCat == 'dynselect'} {:else if inputCat == 'resource-object' && resourceTypes == undefined} Loading resource types... {:else if inputCat == 'resource-object' && (resourceTypes == undefined || (format.split('-').length > 1 && resourceTypes.includes(format.substring('resource-'.length))))} { defaultValue = null }} {showSchemaExplorer} /> {:else if inputCat == 'resource-object' && format.split('-').length > 1 && format .replace('resource-', '') .replace('_', '') .toLowerCase() == 's3object'}
{#if s3FileUploadRawMode} {#await import('$lib/components/JsonEditor.svelte')} {:then Module} { dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} code={JSON.stringify(value ?? defaultValue ?? { s3: '' }, null, 2)} on:changeValue={(e) => { setNewValueFromCode(e.detail) }} /> {/await} {:else} { value = { s3: evt.detail?.path ?? '', filename: evt.detail?.filename ?? '' } }} on:deletion={(evt) => { value = { s3: '' } }} defaultValue={defaultValue?.s3} initialValue={value} /> {/if}
{:else if inputCat == 'object' || inputCat == 'resource-object' || isListJson} {#if oneOf && oneOf.length >= 2}
{#if oneOf && oneOf.length >= 2} { oneOfSelected = detail const prevValueKeys = Object.keys( oneOf?.find((o) => o.title == detail)?.properties ?? {} ) const toKeep = {} for (const key of prevValueKeys) { toKeep[key] = value[key] } value = { ...toKeep, label: detail } }} let:item > {#each oneOf as obj} {/each} {#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} { if (oneOf && oneOf[objIdx]) { const keys = e.detail oneOf[objIdx].order = keys } }} on:change={() => { dispatch('nestedChange') }} on:nestedChange {shouldDispatchChanges} /> {:else} { 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 }} on:change={() => { dispatch('nestedChange') }} 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'}
{ isListJson = !isListJson }} checked={isListJson} textClass="text-secondary" size="xs" options={{ right: 'json' }} />
{/if} {:else if inputCat == 'enum'}
{ dispatch('focus') }} on:blur={(e) => { dispatch('blur') }} enumLabels={extra['enumLabels']} />
{:else if inputCat == 'date'} {#if format === 'date'} {: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'}
fileChanged(x, (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 == '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']} {/key} {#if !disabled && itemPicker && extra?.['disableVariablePicker'] != true} {/if} {/if}
{#if variableEditor}
{#if value && typeof value == 'string' && value?.startsWith('$var:')} Linked to variable {/if}
{/if}
{/if}
{#if !compact || (error && error != '')}
{#if disabled || error === ''}   {:else} {error} {/if}
{:else if !noMargin}
{/if}