mirror of
https://github.com/rowyio/rowy.git
synced 2026-02-24 04:01:17 +01:00
add subcollection parent label settings
This commit is contained in:
30
www/src/components/fields/SubTable/Settings.tsx
Normal file
30
www/src/components/fields/SubTable/Settings.tsx
Normal 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;
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user