From 69eaf321a422cc989f22d07f9f4c49ca741d0950 Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Fri, 21 Aug 2020 16:10:32 +1000 Subject: [PATCH] support custom fieldNames and nested field key --- .../components/Table/ColumnMenu/NewColumn.tsx | 39 +++++++++++++------ .../components/Table/Settings/Webhooks.tsx | 9 ++--- .../components/Table/editors/TextEditor.tsx | 3 +- .../Table/formatters/withCustomCell.tsx | 9 +++-- www/src/components/Table/index.tsx | 20 +++++++--- www/src/contexts/firetableContext.tsx | 18 ++++----- 6 files changed, 63 insertions(+), 35 deletions(-) diff --git a/www/src/components/Table/ColumnMenu/NewColumn.tsx b/www/src/components/Table/ColumnMenu/NewColumn.tsx index ab075d32..45a6b297 100644 --- a/www/src/components/Table/ColumnMenu/NewColumn.tsx +++ b/www/src/components/Table/ColumnMenu/NewColumn.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import Button from "@material-ui/core/Button"; import TextField from "@material-ui/core/TextField"; import Dialog from "@material-ui/core/Dialog"; @@ -23,7 +23,12 @@ export default function FormDialog({ handleSave: Function; }) { const [type, setType] = useState(FieldType.shortText); - const [name, setName] = useState(""); + const [columnLabel, setColumnLabel] = useState(""); + const [fieldKey, setFieldKey] = useState(""); + useEffect(() => { + setFieldKey(_camel(columnLabel)); + }, [columnLabel]); + return (
Column Name { - setName(e.target.value); + onChange={(e) => { + setColumnLabel(e.target.value); + }} + /> + Field Key + { + setFieldKey(e.target.value); }} /> Column Type @@ -82,12 +99,12 @@ export default function FormDialog({