Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/components/fields/SubTable/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useAtom } from "jotai";
import { ISettingsProps } from "@src/components/fields/types";

import { useState } from "react";
import MultiSelect from "@rowy/multiselect";
import { FieldType } from "@src/constants/fields";

import { TextField } from "@mui/material";
import { tableScope, tableColumnsOrderedAtom } from "@src/atoms/tableScope";

const Settings = ({ config, onChange }: ISettingsProps) => {
const [tableOrderedColumns] = useAtom(tableColumnsOrderedAtom, tableScope);

const [inputValue, setInputValue] = useState("");
const columnOptions = tableOrderedColumns
.filter((column) =>
[
Expand All @@ -21,12 +21,26 @@ const Settings = ({ config, onChange }: ISettingsProps) => {
.map((c) => ({ label: c.name, value: c.key }));

return (
<MultiSelect
label="Parent label"
options={columnOptions}
value={config.parentLabel ?? []}
onChange={onChange("parentLabel")}
/>
<>
<MultiSelect
label="Parent label"
options={columnOptions}
value={config.parentLabel ?? []}
onChange={onChange("parentLabel")}
/>

<TextField
id="subcollectionid"
value={inputValue}
onChange={(e) =>
{ onChange("subcollectionid")(e.target.value)
setInputValue(e.target.value)}
}
label="Subcollection ID"
className="labelVertical"
inputProps={{ style: { width: "23ch" } }}
/>
</>
);
};
export default Settings;
2 changes: 1 addition & 1 deletion src/components/fields/SubTable/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useSubTableData = (
rootTablePath,
ROUTES.subTable,
encodeURIComponent(_rowy_ref.path),
column.key,
column.key
].join("/");

subTablePath += "?parentLabel=" + encodeURIComponent(label ?? "");
Expand Down