Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bpmn-io/form-js-viewer

Package Overview
Dependencies
Maintainers
6
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bpmn-io/form-js-viewer - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

4

dist/index.es.js

@@ -603,3 +603,3 @@ import { isArray, isFunction, isNumber, bind, assign, get, set, isString } from 'min-dash';

if (validate.required && typeof value === 'undefined') {
if (validate.required && (typeof value === 'undefined' || value === '')) {
errors = [...errors, 'Field is required.'];

@@ -1687,3 +1687,3 @@ }

*/
constructor(options) {
constructor(options = {}) {
/**

@@ -1690,0 +1690,0 @@ * @private

export default class Form {
constructor(options: FormOptions);
constructor(options?: FormOptions);
private _container;

@@ -4,0 +4,0 @@ private _state;

{
"name": "@bpmn-io/form-js-viewer",
"version": "0.2.3",
"version": "0.2.4",
"description": "View forms - powered by bpmn.io",

@@ -53,3 +53,3 @@ "exports": {

],
"gitHead": "a3c25a7709b89ab6ab613c498c3e02fced3accb5"
"gitHead": "b4764afdaefaeaf9bae4924cff713552592222eb"
}

@@ -1,2 +0,2 @@

# form-js-viewer - Form viewer powered by bpmn.io
# @bpmn-io/form-js-viewer

@@ -16,3 +16,3 @@ This library exports a form viewer for viewing and submitting forms. Use [our editor](../form-js-editor) to create and edit forms.

```javascript
import { createForm } from '@bpmn-io/form-js-viewer';
import { Form } from '@bpmn-io/form-js-viewer';

@@ -36,8 +36,8 @@ const schema = {

const form = await createForm({
container: document.getElementById('form'),
schema,
data
const form = new Form({
container: document.querySelector('#form')
});
await form.importSchema(schema, data);
form.on('submit', event => {

@@ -48,3 +48,3 @@ console.log('Form <submit>', event);

Check out [a full example](https://github.com/bpmn-io/form-js-example).
Check out [a full example](https://github.com/bpmn-io/form-js-examples).

@@ -65,7 +65,28 @@

### `createForm({ container, data, schema }) => Form`
### `Form`
Create a form.
Create a new form with options `{ container?: HTMLElement }`.
```javascript
import { Form } from '@bpmn-io/form-js-viewer';
const form = new Form({
container: document.querySelector('#form')
});
```
### `Form#importSchema(schema: Schema, data?: Data) => Promise<Result, Error>`
Display a form represented via a form schema and the optional data.
```javascript
try {
await form.importSchema(schema);
} catch (err) {
console.log('importing form failed', err);
}
```
### `Form#submit() => { data: Data, errors: Errors }`

@@ -87,2 +108,15 @@

### `Form#validate() => Errors`
Validate a form programatically.
```javascript
const errors = form.validate();
if (Object.keys(errors).length) {
console.error('Form has errors', errors);
}
```
### `Form#reset() => void`

@@ -97,2 +131,15 @@

### `Form#attachTo(parentNode: HTMLElement) => void`
Attach the form to a parent node.
### `Form#detach() => void`
Detach the form from its parent node.
### `Form#on(event, fn) => void`

@@ -103,2 +150,7 @@

### `Form#destroy() => void`
Remove form from the document.
## Events

@@ -105,0 +157,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc