Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

plugandwork-toolkit

pierrecabriere24MIT1.4.6TypeScript support: included

Made with create-react-library

readme

plugandwork-toolkit

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install --save plugandwork-toolkit

Usage

Connnect your component and extends PawViewProps to type your props.

import React, { Component } from 'react'

import { MyComponent, store, alertsReducer, alertsActions, i18nInstance, PawModel, PawConnectedModel, PawViewProps } from 'plugandwork-toolkit';
import 'plugandwork-toolkit/dist/index.css';
import { useTranslation, I18nextProvider } from 'react-i18next';

export interface IAppProps extends PawViewProps {
  pawModel: PawConnectedModel<PawModel>
}

React.useEffect(() => {
  store.dispatch(alertsActions.infoAlert('Component mounted'))
  // Use instance to push locales into locales store
  i18nInstance.addResourceBundle('fr', 'translation', { name: 'Nom' })
  i18nInstance.addResourceBundle('en', 'translation', { name: 'Name' })
}, [])

function App (props: IAppProps) {
  const { t, i18n } = useTranslation()
  return (
    <I18nextProvider i18n={i18nInstance}>
      <div>
        {t('name')}
      </div>
    <I18nextProvider>
  );
}

export default PawModel.connect('pawModel')(App);

Storybook

Documentation

npm run storybook

Documentation

License

MIT © pierrecabriere

changelog

Changelog

1.3.21

  • Fix fetch after sort

1.3.15

  • Improve cache, queries and paginations

1.3.9

  • Add filters

1.3.5

  • Fix fetch query and use POST on fetch when d3Compatible

1.3.4

  • Add Groupd to d3Compatible

1.3.0

  • Add pagination to PawModel

1.2.9

  • Add Group model and missing shared attributes on PawModel

1.2.5

  • Add i18n store and actions

1.2.0

  • Update alert error type

1.1.9

  • Typing store

1.1.8

  • Change Notifications to Alerts

1.1.7

  • Use global to share redux store from toolkit to core and apps
  • update doc

1.0.9

  • Add missing reactstrap components

1.0.8

  • Add reactstrap types to ineritance

1.0.7

  • Add types for ViewLoaderChildren
  • Remove react and react-dom from peer-dependencies to avoid versions conflicts

1.0.6

  • Add notification ts definitions to exports
  • Add Models ORM to exports

1.0.5

  • Add typescript
  • Use named exports
  • Add notifications store, reducer and actions to exports