formatz / aor-embedded-array

Embedded Arrays for Admin On Rest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm npm npm Travis

aor-embedded-array

A custom field/input component for Admin-on-rest that provides the ability to represent embedded arrays.

Installation

Install with:

npm install --save aor-embedded-array

or

yarn add aor-embedded-array

Usage

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>

About

Embedded Arrays for Admin On Rest

License:MIT License


Languages

Language:JavaScript 97.4%Language:Makefile 2.6%