json cell data view

This commit is contained in:
Jan Prochazka
2020-11-05 14:33:51 +01:00
parent 7b64e33e92
commit 399d194771
5 changed files with 188 additions and 10 deletions

View File

@@ -2,7 +2,8 @@ import React from 'react';
import { SelectField } from '../utility/inputs';
import ErrorInfo from '../widgets/ErrorInfo';
import styled from 'styled-components';
import TextCellView from './TextCellView';
import { TextCellViewWrap, TextCellViewNoWrap } from './TextCellView';
import JsonCellView from './JsonCellDataView';
const Toolbar = styled.div`
display: flex;
@@ -22,10 +23,22 @@ const DataWrapper = styled.div`
`;
const formats = [
{
type: 'textWrap',
title: 'Text (wrap)',
Component: TextCellViewWrap,
single: true,
},
{
type: 'text',
title: 'Text',
Component: TextCellView,
title: 'Text (no wrap)',
Component: TextCellViewNoWrap,
single: true,
},
{
type: 'json',
title: 'Json',
Component: JsonCellView,
single: true,
},
];
@@ -46,7 +59,7 @@ export default function CellDataView({ selection, grider }) {
Format:
<SelectField
value={selectedFormat && selectedFormat.type}
onChange={(value) => setSelectedFormat(formats.find((x) => x.type == value))}
onChange={(e) => setSelectedFormat(formats.find((x) => x.type == e.target.value))}
>
{formats.map((fmt) => (
<option value={fmt.type} key={fmt.type}>