Chore: codehinter for table cell properties

This commit is contained in:
navaneeth 2021-08-29 11:45:57 +05:30
parent 15e58c0b26
commit eb2ebb207e
3 changed files with 21 additions and 17 deletions

View file

@ -3,6 +3,7 @@ import React, { useState } from 'react';
export const Radio = ({ options, value, onChange, readOnly }) => {
value = value === undefined ? [] : value;
options = Array.isArray(options) ? options : [];
return (
<div className="radio row">

View file

@ -450,7 +450,11 @@ export function Table({
const columns = useMemo(
() => [...columnData, ...actionsCellData],
[JSON.stringify(columnData), actionsCellData.length, componentState.changeSet] // Hack: need to fix
[JSON.stringify(columnData),
actionsCellData.length,
componentState.changeSet,
JSON.stringify(component.definition.properties.columns)
] // Hack: need to fix
);
const data = useMemo(() => tableData, [tableData.length]);

View file

@ -9,6 +9,7 @@ import { Color } from '../Elements/Color';
import SelectSearch, { fuzzySearch } from 'react-select-search';
import { v4 as uuidv4 } from 'uuid';
import { EventManager } from '../EventManager';
import { CodeHinter } from '../../CodeBuilder/CodeHinter';
class Table extends React.Component {
constructor(props) {
@ -169,28 +170,26 @@ class Table extends React.Component {
<div>
<div className="field mb-2">
<label className="form-label">Values</label>
<input
type="text"
className="form-control text-field"
onChange={(e) => {
e.stopPropagation();
this.onColumnItemChange(index, 'values', e.target.value);
}}
value={column.values}
<CodeHinter
currentState={this.props.currentState}
initialValue={column.values}
theme={this.props.darkMode ? 'monokai' : 'default'}
mode= "javascript"
lineNumbers={false}
placeholder={'{{[1, 2, 3]}}'}
onChange={(value) => this.onColumnItemChange(index, 'values', value)}
/>
</div>
<div className="field mb-2">
<label className="form-label">Labels</label>
<input
type="text"
className="form-control text-field"
onChange={(e) => {
e.stopPropagation();
this.onColumnItemChange(index, 'labels', e.target.value);
}}
value={column.labels}
<CodeHinter
currentState={this.props.currentState}
initialValue={column.labels}
theme={this.props.darkMode ? 'monokai' : 'default'}
mode= "javascript"
lineNumbers={false}
placeholder={'{{["one", "two", "three"]}}'}
onChange={(value) => this.onColumnItemChange(index, 'labels', value)}
/>
</div>
</div>