@5rabbits/dms

DMS component for Lemontech products

Usage no npm install needed!

<script type="module">
  import 5rabbitsDms from 'https://cdn.skypack.dev/@5rabbits/dms';
</script>

README

DMS React Component

Usage

  • Install with yarn add @5rabbits/dms.
  • Install peer dependencies (if you haven't already) yarn add react@^16.0.0 react-dom@^16.0.0 mobx@^3.1.2 mobx-react@^4.3.3. React 15 is also supported.
  • Use the DMS component:
import DMS from '@5rabbits/dms'
import '@5rabbits/dms/dist/dms.css'

<DMS
  apiHost="https://my-api.com"
  apiToken="some-auth-token"
/>

Props

prop type default required description
apiHost string yes The host where all requests will be made.
apiToken string yes The token that will be sent as header Authorization: Bearer TOKEN on every request.
locale string 'en' Language to display the component. en and es are supported by default, but you can add other languages using the translations prop.
translations object Extra locales for the component. Use this file as a template and pass the translations as { [locale]: [translations] }.
routerType memory, browser, hash memory Specifies where the component should persist the inner routing.
defaultRoute string '/' (memory router only) The initial route the component will render. At the moment you can use:
  • /
  • /files (alias of /)
  • /recent
  • /deleted
  • /(files\|recent\|deleted)/:itemID (the first segments is used to highlight the corresponding sidebar section)
onRouteChange func Callback that will be invoked every time the internal route changes. The first argument will be the new route string.
baseRoute string (browser and hash routers only) The base url segment for browser based routes.
onError func (React 16 only) Callback that will be invoked if the DMS component crashes and recovers itself. The first argument is the exception and the second one is the React components stack. This is provided for error tracking purposes.