* feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * feat(frontend): add type editor * feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * feat(frontend): dnd * feat(frontend): add missing error * feat(frontend): fix build * feat(frontend): fix build * feat(frontend): clean up * feat(frontend): fix layout * feat(frontend): fix dark mode * feat(frontend): Fix Dnd + resource s3 and objects * feat(frontend): handle inner objets * feat(frontend): wip * feat(frontend): wip * feat(frontend): wip * fix(frontend): UI nits * fix(frontend): fix type selection * fix(frontend): Correctly handle subproperties * fix(frontend): fix autosize + height * fix(frontend): replace everywhere * fix(frontend): fix dnd * fix(frontend): fix list refresh + height issues * fix(frontend): fix order * fix(frontend): restore default behavior * fix(frontend): Move the rename input * fix(frontend): Fix rename wrt order array * fix(frontend): Fix hub * fix(frontend): Fix renam * fix(frontend): Fix UI Nits + fix SchemaForm order * fix(frontend): Handle nested order * fix(frontend): Fix saving properties * fix(frontend): Improve approval form * feat(frontend): done * feat(frontend): merge main * feat(frontend): done * feat(frontend): wip * feat(frontend): SchemaFormDND * feat(frontend): SchemaFormDND wip * feat(frontend): improve displayWebhookWarning * feat(frontend): DND done * feat(frontend): DND done * feat(frontend): improve name * feat(frontend): improve dnd * feat(frontend): done * first batch * new try * nits * all * drag handle in more places * push everything * migrate all * all * fix * fix * fix henri bug --------- Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
57 lines
1.2 KiB
Svelte
57 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
import ResourcePicker from './ResourcePicker.svelte'
|
|
import S3ObjectPicker from './S3ObjectPicker.svelte'
|
|
|
|
export let format: string
|
|
export let value: any
|
|
export let disablePortal = false
|
|
export let showSchemaExplorer = false
|
|
export let selectFirst = false
|
|
export let defaultValue: any
|
|
|
|
function isString(value: any) {
|
|
return typeof value === 'string' || value instanceof String
|
|
}
|
|
|
|
let path: string = ''
|
|
|
|
function resourceToValue() {
|
|
if (path) {
|
|
value = `$res:${path}`
|
|
} else {
|
|
value = undefined
|
|
}
|
|
}
|
|
|
|
function isResource() {
|
|
return isString(value) && value.length >= '$res:'.length
|
|
}
|
|
|
|
function valueToPath() {
|
|
if (isResource()) {
|
|
path = value.substr('$res:'.length)
|
|
}
|
|
}
|
|
|
|
$: value && valueToPath()
|
|
</script>
|
|
|
|
<div class="flex flex-row w-full flex-wrap gap-x-2 gap-y-0.5">
|
|
{#if format === 'resource-s3_object'}
|
|
<S3ObjectPicker bind:value />
|
|
{:else}
|
|
<ResourcePicker
|
|
{selectFirst}
|
|
{disablePortal}
|
|
on:change={(e) => {
|
|
path = e.detail
|
|
resourceToValue()
|
|
}}
|
|
bind:value={path}
|
|
initialValue={defaultValue}
|
|
resourceType={format.split('-').length > 1 ? format.substring('resource-'.length) : undefined}
|
|
{showSchemaExplorer}
|
|
/>
|
|
{/if}
|
|
</div>
|