JSPM

ra-input-array-sortable

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q23183F
  • License MIT

A sortable input for React Admin.

Package Exports

  • ra-input-array-sortable
  • ra-input-array-sortable/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ra-input-array-sortable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

A sortable input for React Admin.

Setup

yarn add ra-input-array-sortable

Use

import {
  TextField,
  TextInput,
  Edit,
  SimpleForm,
  NumberInput,
  required,
} from "react-admin";
import SortableArray from "ra-input-array-sortable";

const EditItem = (props) => (
  <Edit>
    <SimpleForm>
      <TextInput source="name" validate={required()} />

      <SortableArray source="colors" label="Colors">
        <TextInput source="" />
      </SortableArray>

      <SortableArray source="cars" label="Cars">
        <TextInput source="brand" />
        <NumberInput source="year" />
      </SortableArray>
    </SimpleForm>
  </Edit>
);

/*
Result:
{
    name:"string",
    colors:["blue","gray"],
    cars:[{
        brand:"Renault",
        year:2019
    },{
        brand:"Chevrolet",
        year:1978
    }]
}
*/

export default EditItem;

Todo

  • Support deepest objects