fix: prevent overflowing for long description and default in schema

This commit is contained in:
Ruben Fiszel
2024-04-30 11:10:27 +02:00
parent 1f983c2414
commit 450201deb8
2 changed files with 13 additions and 5 deletions

View File

@@ -5,6 +5,7 @@
import SchemaEditorProperty from './SchemaEditorProperty.svelte'
import { Button } from './common'
import { Pen, Trash } from 'lucide-svelte'
import { truncate } from '$lib/utils'
export let displayInfo: PropertyDisplayInfo
export let isAnimated: boolean
@@ -44,8 +45,15 @@
<SchemaEditorProperty property={displayInfo.property} />
</td>
{#if !lightMode}
<td>{displayInfo.property.default ? JSON.stringify(displayInfo.property.default) : ''}</td>
<td>{displayInfo.property.description ?? ''}</td>
<td class="truncate max-w-xs !text-2xs"
>{truncate(
displayInfo.property.default ? JSON.stringify(displayInfo.property.default) : '',
100
)}</td
>
<td class="truncate max-w-xs !text-2xs"
>{truncate(displayInfo.property.description ?? '', 100)}</td
>
{/if}
<td />
<td class="justify-end flex">

View File

@@ -312,9 +312,9 @@
<!--json schema or table view-->
<div class="h-full">
{#if !viewJsonSchema}
<div class="h-full">
<div class="h-full overflow-auto">
{#if schema.properties && Object.keys(schema.properties).length > 0 && schema.required}
<TableCustom>
<TableCustom wFull>
<tr slot="header-row">
<th>Name</th>
<th>Type</th>
@@ -327,7 +327,7 @@
<tbody slot="body">
{#key schema.required}
{#each schemaPropertiesToDisplay(schema) as displayInfo (displayInfoKey(displayInfo))}
<tr animate:flip={{ duration: moveAnimationDuration }}>
<tr class="w-full" animate:flip={{ duration: moveAnimationDuration }}>
<PropertyRow
{displayInfo}
{isAnimated}