json view

This commit is contained in:
Jan Prochazka
2021-04-03 18:52:11 +02:00
parent 18860c823d
commit 41cf7009b3
4 changed files with 38 additions and 16 deletions

View File

@@ -25,6 +25,9 @@
if (_.isString(value)) {
if (value.startsWith('[') || value.startsWith('{')) return 'json';
}
if (_.isPlainObject(value) || _.isArray(value)) {
return 'json';
}
return 'textWrap';
}
@@ -75,11 +78,11 @@
</div>
<div class="data">
{#if usedFormat.single && selection?.length != 1}
<ErrorInfo message="Must be selected one cell" />
<ErrorInfo message="Must be selected one cell" alignTop />
{:else if usedFormat == null}
<ErrorInfo message="Format not selected" />
<ErrorInfo message="Format not selected" alignTop />
{:else if !selection || selection.length == 0}
<ErrorInfo message="No data selected" />
<ErrorInfo message="No data selected" alignTop />
{:else}
<svelte:component this={usedFormat?.component} {selection} />
{/if}