#90 handle native json field in datagrid

This commit is contained in:
Jan Prochazka
2021-04-24 12:24:58 +02:00
parent c30724c5da
commit 7524b30f50
5 changed files with 48 additions and 10 deletions

View File

@@ -1,6 +1,19 @@
<script lang="ts">
import _ from 'lodash';
export let selection;
export let wrap;
</script>
<textarea class="flex1" {wrap} readonly value={selection.map(cell => cell.value).join('\n')} />
<textarea
class="flex1"
{wrap}
readonly
value={selection
.map(cell => {
const { value } = cell;
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value, undefined, 2);
return cell.value;
})
.join('\n')}
/>