1.8.6 • Published 15 days ago

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

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
15 days 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.8.6

15 days ago

1.8.5

19 days ago

1.8.4

20 days ago

1.8.3

1 month ago

1.8.2

1 month ago

1.8.1

1 month ago

1.8.0

1 month ago

1.7.3

2 months ago

1.7.2

2 months ago

1.7.1

3 months ago

1.7.0

3 months ago

1.7.0-alpha.0

3 months ago

1.6.4

4 months ago

1.6.3

4 months ago

1.6.2

4 months ago

1.6.1

5 months ago

1.6.0

5 months ago

1.5.0

5 months ago

1.2.0

9 months ago

1.0.0

10 months ago

1.4.1

6 months ago

1.4.0

6 months ago

1.3.0-alpha.0

8 months ago

1.1.0

10 months ago

1.3.3

7 months ago

1.3.2

7 months ago

1.3.1

7 months ago

1.3.0

8 months ago

1.5.0-alpha.0

6 months ago

1.0.0-alpha.9

11 months ago

1.0.0-alpha.8

11 months ago

1.0.0-alpha.7

11 months ago

1.0.0-alpha.6

11 months ago

1.0.0-alpha.10

11 months ago

1.0.0-alpha.5

11 months ago

1.0.0-alpha.4

11 months ago

1.0.0-alpha.3

11 months ago

1.0.0-alpha.2

11 months ago

1.0.0-alpha.1

11 months ago

1.0.0-alpha.0

12 months ago

0.15.0-alpha.0

1 year ago

0.14.1

1 year ago

0.13.0

1 year ago

0.13.1

1 year ago

0.14.0

1 year ago

0.12.2

1 year ago

0.11.0

1 year ago

0.11.1

1 year ago

0.12.0

1 year ago

0.12.1

1 year ago

0.9.8

2 years ago

0.9.9

2 years ago

0.10.0-alpha.3

1 year ago

0.10.0-alpha.2

1 year ago

0.10.0-alpha.1

1 year ago

0.10.0-alpha.0

1 year ago

0.10.1

1 year ago

0.10.0

1 year ago

0.9.7

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.8.0-alpha.1

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.9.1

2 years ago

0.8.0-alpha.0

2 years ago

0.7.2

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

3 years ago

0.5.1

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago