diff --git a/www/src/components/fields/SubTable/Settings.tsx b/www/src/components/fields/SubTable/Settings.tsx new file mode 100644 index 00000000..5b852c14 --- /dev/null +++ b/www/src/components/fields/SubTable/Settings.tsx @@ -0,0 +1,30 @@ +import React from "react"; +import MultiSelect from "@antlerengineering/multiselect"; +import { FieldType } from "constants/fields"; +import { useFiretableContext } from "contexts/FiretableContext"; + +const Settings = ({ config, handleChange }) => { + const { tableState } = useFiretableContext(); + if (!tableState?.columns) return <>; + const columnOptions = Object.values(tableState.columns) + .filter((column) => + [ + FieldType.shortText, + FieldType.singleSelect, + FieldType.email, + FieldType.phone, + ].includes(column.type) + ) + .map((c) => ({ label: c.name, value: c.key })); + return ( + <> + + + ); +}; +export default Settings; diff --git a/www/src/components/fields/SubTable/index.tsx b/www/src/components/fields/SubTable/index.tsx index b4f99a55..41a9f0c0 100644 --- a/www/src/components/fields/SubTable/index.tsx +++ b/www/src/components/fields/SubTable/index.tsx @@ -15,17 +15,21 @@ const SideDrawerField = lazy( "./SideDrawerField" /* webpackChunkName: "SideDrawerField-SubTable" */ ) ); - +const Settings = lazy( + () => import("./Settings" /* webpackChunkName: "Settings-Subtable" */) +); export const config: IFieldConfig = { type: FieldType.subTable, name: "SubTable", dataType: "undefined", initialValue: null, icon: , + settings: Settings, description: "Creates a sub-table. Also displays number of rows inside the sub-table. Max sub-table levels: 100.", TableCell: withHeavyCell(BasicCell, TableCell), TableEditor: NullEditor, SideDrawerField, + initializable: false, }; export default config;