{#snippet edit_panel()}
{edit_label || field_name}
{#if field_type === 'textarea'} {:else if field_type === 'select'}
{#if Object.keys(select_options).length === 0}
{/if}
{:else if field_type === 'checkbox'} {:else if field_type === 'tiptap'} {:else if field_type === 'codemirror'} {:else if field_type === 'date'} {:else if field_type === 'datetime'} {:else} e.key === 'Enter' && handle_patch()} /> {/if}
{/snippet}
{#if children} {@render children()} {:else if field_type === 'checkbox'} {display_value ? 'True' : 'False'} {:else if field_type === 'tiptap' || field_type === 'codemirror'}
{@html display_value || 'Empty'}
{:else} {display_value || 'Not set'} {/if}
{#if is_editing && !display_modal}
{@render edit_panel()}
{/if}
{#if display_modal} { e.preventDefault(); cancel_edit(); }} onclick={(e) => { if (e.target === dialog_ref) cancel_edit(); }} onkeydown={(e) => { if (e.key === 'Escape') cancel_edit(); }}> {@render edit_panel()} {/if}