A custom field/input component for Admin-on-rest that provides the ability to represent embedded arrays.
Install with:
npm install --save aor-embedded-array
or
yarn add aor-embedded-array
Define the Create
and Edit
View like this:
<EmbeddedArrayInput source="links">
<LongTextInput source="url" />
<LongTextInput source="context" />
<EmbeddedArrayInput source="metadata">
<TextInput source="name" />
<TextInput source="value" />
</EmbeddedArrayInput>
</EmbeddedArrayInput>
Define the Show
and List
View like this:
<EmbeddedArrayField source="links">
<UrlField source="url" />
<TextField source="context" />
<EmbeddedArrayField source="metadata">
<TextField source="name" />
<TextField source="value" />
</EmbeddedArrayField>
</EmbeddedArrayField>
For primitive arrays, define the Views the same way but without the source prop for the unique child:
<EmbeddedArrayInput source="links">
<LongTextInput />
</EmbeddedArrayInput>