@react-ui-generator/metaphor
TypeScript icon, indicating that this package has built-in type declarations

0.7.5 • Public • Published

Metaphor

DSL for easing baking of metadata for the react-ui-generator.

Example

import Metaphor from '@react-ui-generator/metaphor';
import BaseMeta from './meta.json';

const formToView = new Metaphor(BaseMeta)
  .showAll()
  .disableAll()
  .value();

const formToEdit = new Metaphor(BaseMeta)
  .enableAll()
  .disable(['id', 'createdAt', 'author'])
  .config
    .set('email', { showAsterix: true })
    .set(['birthDate', 'employmentDate'], {
      showAsterix: true,
      format: 'DD.MM.YYYY',
    })
    .up()
  .actions
    .set(['btnSave'], { onClick: 'sendFormToServer' })
    .set('btnCancel', { onClick: isFormChanged() ? 'confirmEditCancellation' : 'closeForm' })
    .up()
  .hide(calcSecretFieldsByUserRole(), true)
  .value();

Package Sidebar

Install

npm i @react-ui-generator/metaphor

Weekly Downloads

4

Version

0.7.5

License

MIT

Unpacked Size

618 kB

Total Files

35

Last publish

Collaborators

  • azaviruha