import React from "react"; import { FieldProps } from "../../types"; import { FieldHelperText, LabelWithIcon } from "../components"; import { PropertyFieldBinding } from "../PropertyFieldBinding"; import { ExpandablePanel } from "@firecms/ui"; import { getIconForProperty } from "../../util"; import { useClearRestoreValue } from "../useClearRestoreValue"; /** * Array field used for custom * * This is one of the internal components that get mapped natively inside forms * and tables to the specified properties. * @group Form fields */ export function ArrayCustomShapedFieldBinding>({ propertyKey, value, error, showError, isSubmitting, setValue, tableMode, property, includeDescription, underlyingValueHasChanged, context, disabled }: FieldProps) { if (!Array.isArray(property.resolvedProperties)) throw Error("ArrayCustomShapedFieldBinding misconfiguration. Property `of` not set"); const expanded = property.expanded === undefined ? true : property.expanded; useClearRestoreValue({ property, value, setValue }); const title = ; const body = property.resolvedProperties.map((childProperty, index) => { const fieldProps = { propertyKey: `${propertyKey}[${index}]`, disabled, property: childProperty, includeDescription, underlyingValueHasChanged, context, tableMode: false, partOfArray: true, partOfBlock: false, autoFocus: false }; return
; }); return ( <> {!tableMode && {body} } {tableMode && body} ); }