1.11.3 • Published 6 months ago

@bpmn-io/form-js-editor v1.11.3

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
6 months ago

@bpmn-io/form-js-editor

An editor to create forms that can be displayed with the form-js viewer.

Installation

npm install @bpmn-io/form-js-editor

Usage

import { FormEditor } from '@bpmn-io/form-js-editor';

const schema = {
  components: [
    {
      key: 'creditor',
      label: 'Creditor',
      type: 'textfield',
      validate: {
        required: true,
      },
    },
  ],
};

const formEditor = new FormEditor({
  container: document.querySelector('#form-editor'),
});

await formEditor.importSchema(schema);

Check out a full example.

Styling

For proper styling include the necessary stylesheets, and font used:

<link
  href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,600;1,400&display=swap"
  rel="stylesheet" />

<link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js.css" />
<link rel="stylesheet" href="https://unpkg.com/@bpmn-io/form-js@0.10.0/dist/assets/form-js-editor.css" />

API

FormEditor

Create a new form editor with options { container?: HTMLElement }.

import { FormEditor } from '@bpmn-io/form-js-editor';

const formEditor = new FormEditor({
  container: document.querySelector('#form-editor'),
});

FormEditor#importSchema(schema: Schema) => Promise<Result, Error>

Display and edit a form represented via a form schema.

try {
  await formEditor.importSchema(schema);
} catch (err) {
  console.log('importing form failed', err);
}

FormEditor#saveSchema() => Schema

Export the form schema.

const schema = formEditor.saveSchema(schema);

console.log('exported schema', schema);

FormEditor#attachTo(parentNode: HTMLElement) => void

Attach the form editor to a parent node.

FormEditor#detach() => void

Detach the form editor from its parent node.

FormEditor#on(event, fn) => void

Subscribe to an event.

FormEditor#destroy() => void

Remove form from editor the document.

Events

selection.changed :: { selection }

Properties panel events

  • propertiesPanel.focusin
  • propertiesPanel.focusout
  • propertiesPanel.showEntry :: { id }
  • propertiesPanel.updated :: { formField }

Form lifecycle events

  • detach
  • attach
  • rendered
  • form.init
  • form.clear
  • form.destroy
  • diagram.clear
  • diagram.destroy
  • dragula.created
  • dragula.destroyed
  • editorActions.init :: { editorActions }

Drag events

  • drag.start :: { element, source }
  • drag.end :: { element }
  • drag.drop :: { element, target, source, sibling }
  • drag.hover :: { element, container, source }
  • drag.out :: { element, container, source }
  • drag.cancel :: { element, container, source }

Form field events

  • formField.add :: { formField }
  • formField.remove :: { formField }
  • formField.updateId :: { formField, newId }

License

Use under the terms of the bpmn.io license.

1.11.3

6 months ago

1.11.2

6 months ago

1.11.1

7 months ago

1.11.0

7 months ago

1.10.1

8 months ago

1.11.0-alpha.0

8 months ago

1.9.1

9 months ago

1.9.0

11 months ago

1.10.0

8 months ago

1.9.2

8 months ago

1.8.8

11 months ago

1.8.7

12 months ago

1.8.6

1 year ago

1.8.5

1 year ago

1.8.4

1 year ago

1.8.3

1 year ago

1.8.2

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.7.0-alpha.0

1 year ago

1.6.4

1 year ago

1.6.3

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.2.0

2 years ago

1.0.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0-alpha.0

2 years ago

1.1.0

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.5.0-alpha.0

1 year ago

1.0.0-alpha.9

2 years ago

1.0.0-alpha.8

2 years ago

1.0.0-alpha.7

2 years ago

1.0.0-alpha.6

2 years ago

1.0.0-alpha.10

2 years ago

1.0.0-alpha.5

2 years ago

1.0.0-alpha.4

2 years ago

1.0.0-alpha.3

2 years ago

1.0.0-alpha.2

2 years ago

1.0.0-alpha.1

2 years ago

1.0.0-alpha.0

2 years ago

0.15.0-alpha.0

2 years ago

0.14.1

2 years ago

0.13.0

2 years ago

0.13.1

2 years ago

0.14.0

2 years ago

0.12.2

2 years ago

0.11.0

2 years ago

0.11.1

2 years ago

0.12.0

2 years ago

0.12.1

2 years ago

0.9.8

3 years ago

0.9.9

3 years ago

0.10.0-alpha.3

2 years ago

0.10.0-alpha.2

2 years ago

0.10.0-alpha.1

2 years ago

0.10.0-alpha.0

2 years ago

0.10.1

2 years ago

0.10.0

2 years ago

0.9.7

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.8.0-alpha.1

3 years ago

0.9.0

3 years ago

0.8.0

3 years ago

0.9.1

3 years ago

0.8.0-alpha.0

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.5.1

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago