JSPM

  • Created
  • Published
  • Downloads 116
  • Score
    100M100P100Q45439F
  • License MIT

React admin front components and utils

Package Exports

  • @ra-libs/react
  • @ra-libs/react/dist/cjs/index.js
  • @ra-libs/react/dist/esm/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-libs/react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@ra-libs/react

NPM Version Package License Publish Status

This Package uses semantic-release to publish new versions. Check Angular Commit Message Conventions for new commits

Installation

Run npm install

npm install @ra-libs/react

Components

ResponsiveDatagrid

A component to render SimpleList or Datagrid based on screen size.

      <ResponsiveDatagrid
        primaryText={(record) => `${record.firstName} ${record.lastName}`}
        secondaryText={(record) => `${record.company}`}
      >
        <TextField source="firstName" />
        <TextField source="lastName" />
        <TextField source="company" />
      </ResponsiveDatagrid>

Datagrid

Datagrid component with bulkActionButtons false by default

Hooks

useScreenSize

Hook that uses material ui useMediaQuery to check if screen isSmall or isXsmall

    const { isSmall, isXSmall } = useScreenSize()

Services

raDataRestProvider

it uses ra-data-simple-rest provider and intercepts react-admin requests to transform to formData when it has any file in the request body.

import { raDataRestProvider } from '@ra-libs/react';

<Admin
    dataProvider={raDataRestProvider('<API_URL>')}
>
    ...
</Admin>

LocalSession

a customized sessionStoage class that uses cookies when sessionStorage not available.

import { LocalSession } from '@ra-libs/react'


// Set session key-value
LocalSession.set("key", "value");

// Get session key
LocalSession.get("key");

// Check if key exists
LocalSession.check("key");

HttpRequest

a customized axios class

import { HttpRequest } from '@ra-libs/react';

// Get
const results = await HttpRequest.get('<URL>')