From 797fd718f75682f1410763f766cb193d95db41ee Mon Sep 17 00:00:00 2001 From: Shams mosowi Date: Mon, 21 Dec 2020 10:31:48 +0800 Subject: [PATCH] enable custom field settings --- .../Table/ColumnMenu/Settings/index.tsx | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/www/src/components/Table/ColumnMenu/Settings/index.tsx b/www/src/components/Table/ColumnMenu/Settings/index.tsx index 7cbb1f10..40511a34 100644 --- a/www/src/components/Table/ColumnMenu/Settings/index.tsx +++ b/www/src/components/Table/ColumnMenu/Settings/index.tsx @@ -22,10 +22,7 @@ import _sortBy from "lodash/sortBy"; import FieldsDropdown from "../FieldsDropdown"; import ColumnSelector from "./ConfigFields/ColumnSelector"; import FieldSkeleton from "components/SideDrawer/Form/FieldSkeleton"; - -const CodeEditor = lazy( - () => import("../../editors/CodeEditor" /* webpackChunkName: "CodeEditor" */) -); +import {getFieldProp} from "components/fields" const ConfigFields = ({ fieldType, config, @@ -219,7 +216,7 @@ export default function FormDialog({ handleSave: Function; }) { const [newConfig, setNewConfig] = useState(config ?? {}); - + const customFieldSettings = getFieldProp('settings',type) return (
Default value The default value will be the initial value of the cells, when ever a new row is added - { + + + {React.createElement(customFieldSettings, { + config: newConfig, + handleChange:(key) => (update) => { + setNewConfig({ ...newConfig, [key]: update }); + } + })} + + + + {/* { (update) => { - setNewConfig({ ...newConfig, [key]: update }); - }} + config={newConfig} /> - } + } */}