add subcollection parent label settings

This commit is contained in:
Shams mosowi
2021-05-27 23:33:55 +10:00
parent d958786b1d
commit 0d8a0597f6
2 changed files with 35 additions and 1 deletions

View File

@@ -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 (
<>
<MultiSelect
label={"Parent Label"}
options={columnOptions}
value={config.parentLabel ?? []}
onChange={handleChange("parentLabel")}
/>
</>
);
};
export default Settings;

View File

@@ -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: <SubTableIcon />,
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;