@bpmn-io/form-js-viewer 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/assets/form-js.css +36 -38
  2. package/dist/index.cjs +128 -70
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.es.js +128 -70
  5. package/dist/index.es.js.map +1 -1
  6. package/dist/types/Form.d.ts +130 -143
  7. package/dist/types/core/EventBus.d.ts +1 -1
  8. package/dist/types/core/FormFieldRegistry.d.ts +17 -17
  9. package/dist/types/core/Validator.d.ts +3 -3
  10. package/dist/types/core/index.d.ts +16 -16
  11. package/dist/types/import/Importer.d.ts +43 -38
  12. package/dist/types/import/index.d.ts +5 -5
  13. package/dist/types/index.d.ts +18 -18
  14. package/dist/types/render/FormFields.d.ts +5 -5
  15. package/dist/types/render/Renderer.d.ts +23 -23
  16. package/dist/types/render/components/Description.d.ts +1 -1
  17. package/dist/types/render/components/Errors.d.ts +1 -1
  18. package/dist/types/render/components/FormComponent.d.ts +1 -1
  19. package/dist/types/render/components/FormField.d.ts +1 -1
  20. package/dist/types/render/components/Label.d.ts +1 -1
  21. package/dist/types/render/components/PoweredBy.d.ts +1 -1
  22. package/dist/types/render/components/Sanitizer.d.ts +7 -7
  23. package/dist/types/render/components/Util.d.ts +4 -4
  24. package/dist/types/render/components/form-fields/Button.d.ts +11 -11
  25. package/dist/types/render/components/form-fields/Checkbox.d.ts +10 -9
  26. package/dist/types/render/components/form-fields/Default.d.ts +9 -9
  27. package/dist/types/render/components/form-fields/Number.d.ts +10 -9
  28. package/dist/types/render/components/form-fields/Radio.d.ts +15 -14
  29. package/dist/types/render/components/form-fields/Select.d.ts +15 -14
  30. package/dist/types/render/components/form-fields/Text.d.ts +10 -10
  31. package/dist/types/render/components/form-fields/Textfield.d.ts +10 -9
  32. package/dist/types/render/components/index.d.ts +11 -11
  33. package/dist/types/render/context/FormContext.d.ts +12 -11
  34. package/dist/types/render/context/FormRenderContext.d.ts +6 -6
  35. package/dist/types/render/context/index.d.ts +2 -2
  36. package/dist/types/render/hooks/useService.d.ts +1 -1
  37. package/dist/types/render/index.d.ts +11 -11
  38. package/dist/types/util/form.d.ts +6 -6
  39. package/dist/types/util/index.d.ts +16 -16
  40. package/dist/types/util/injector.d.ts +1 -1
  41. package/package.json +3 -2
@@ -1,143 +1,130 @@
1
- /**
2
- * @typedef { import('./types').Injector } Injector
3
- * @typedef { import('./types').Data } Data
4
- * @typedef { import('./types').Errors } Errors
5
- * @typedef { import('./types').Schema } Schema
6
- * @typedef { import('./types').FormProperties } FormProperties
7
- * @typedef { import('./types').FormProperty } FormProperty
8
- * @typedef { import('./types').FormEvent } FormEvent
9
- * @typedef { import('./types').FormOptions } FormOptions
10
- *
11
- * @typedef { {
12
- * data: Data,
13
- * initialData: Data,
14
- * errors: Errors,
15
- * properties: FormProperties,
16
- * schema: Schema
17
- * } } State
18
- */
19
- /**
20
- * The form.
21
- */
22
- export default class Form {
23
- /**
24
- * @constructor
25
- * @param {FormOptions} options
26
- */
27
- constructor(options?: FormOptions);
28
- /**
29
- * @private
30
- * @type {Element}
31
- */
32
- private _container;
33
- /**
34
- * @private
35
- * @type {State}
36
- */
37
- private _state;
38
- get: any;
39
- invoke: any;
40
- clear(): void;
41
- /**
42
- * Destroy the form, removing it from DOM,
43
- * if attached.
44
- */
45
- destroy(): void;
46
- /**
47
- * Open a form schema with the given initial data.
48
- *
49
- * @param {Schema} schema
50
- * @param {Data} [data]
51
- *
52
- * @return Promise<{ warnings: Array<any> }>
53
- */
54
- importSchema(schema: Schema, data?: Data): Promise<any>;
55
- /**
56
- * Submit the form, triggering all field validations.
57
- *
58
- * @returns { { data: Data, errors: Errors } }
59
- */
60
- submit(): {
61
- data: Data;
62
- errors: Errors;
63
- };
64
- reset(): void;
65
- /**
66
- * @returns {Errors}
67
- */
68
- validate(): Errors;
69
- /**
70
- * @param {Element|string} parentNode
71
- */
72
- attachTo(parentNode: Element | string): void;
73
- detach(): void;
74
- /**
75
- * @private
76
- *
77
- * @param {boolean} [emit]
78
- */
79
- private _detach;
80
- /**
81
- * @param {FormProperty} property
82
- * @param {any} value
83
- */
84
- setProperty(property: FormProperty, value: any): void;
85
- /**
86
- * @param {FormEvent} type
87
- * @param {number} priority
88
- * @param {Function} handler
89
- */
90
- on(type: FormEvent, priority: number, handler: Function): void;
91
- /**
92
- * @param {FormEvent} type
93
- * @param {Function} handler
94
- */
95
- off(type: FormEvent, handler: Function): void;
96
- /**
97
- * @private
98
- *
99
- * @param {FormOptions} options
100
- * @param {Element} container
101
- *
102
- * @returns {Injector}
103
- */
104
- private _createInjector;
105
- /**
106
- * @private
107
- */
108
- private _emit;
109
- /**
110
- * @internal
111
- *
112
- * @param { { add?: boolean, field: any, remove?: number, value?: any } } update
113
- */
114
- _update(update: {
115
- add?: boolean;
116
- field: any;
117
- remove?: number;
118
- value?: any;
119
- }): void;
120
- /**
121
- * @internal
122
- */
123
- _getState(): State;
124
- /**
125
- * @internal
126
- */
127
- _setState(state: any): void;
128
- }
129
- export type Injector = any;
130
- export type Data = import('./types').Data;
131
- export type Errors = import('./types').Errors;
132
- export type Schema = import('./types').Schema;
133
- export type FormProperties = import('./types').FormProperties;
134
- export type FormProperty = import('./types').FormProperty;
135
- export type FormEvent = import('./types').FormEvent;
136
- export type FormOptions = import('./types').FormOptions;
137
- export type State = {
138
- data: Data;
139
- initialData: Data;
140
- errors: Errors;
141
- properties: FormProperties;
142
- schema: Schema;
143
- };
1
+ /**
2
+ * The form.
3
+ */
4
+ export default class Form {
5
+ /**
6
+ * @constructor
7
+ * @param {FormOptions} options
8
+ */
9
+ constructor(options?: FormOptions);
10
+ /**
11
+ * @public
12
+ * @type {String}
13
+ */
14
+ public _id: string;
15
+ /**
16
+ * @private
17
+ * @type {Element}
18
+ */
19
+ private _container;
20
+ /**
21
+ * @private
22
+ * @type {State}
23
+ */
24
+ private _state;
25
+ get: any;
26
+ invoke: any;
27
+ clear(): void;
28
+ /**
29
+ * Destroy the form, removing it from DOM,
30
+ * if attached.
31
+ */
32
+ destroy(): void;
33
+ /**
34
+ * Open a form schema with the given initial data.
35
+ *
36
+ * @param {Schema} schema
37
+ * @param {Data} [data]
38
+ *
39
+ * @return Promise<{ warnings: Array<any> }>
40
+ */
41
+ importSchema(schema: Schema, data?: Data): Promise<any>;
42
+ /**
43
+ * Submit the form, triggering all field validations.
44
+ *
45
+ * @returns { { data: Data, errors: Errors } }
46
+ */
47
+ submit(): {
48
+ data: Data;
49
+ errors: Errors;
50
+ };
51
+ reset(): void;
52
+ /**
53
+ * @returns {Errors}
54
+ */
55
+ validate(): Errors;
56
+ /**
57
+ * @param {Element|string} parentNode
58
+ */
59
+ attachTo(parentNode: Element | string): void;
60
+ detach(): void;
61
+ /**
62
+ * @private
63
+ *
64
+ * @param {boolean} [emit]
65
+ */
66
+ private _detach;
67
+ /**
68
+ * @param {FormProperty} property
69
+ * @param {any} value
70
+ */
71
+ setProperty(property: FormProperty, value: any): void;
72
+ /**
73
+ * @param {FormEvent} type
74
+ * @param {number} priority
75
+ * @param {Function} handler
76
+ */
77
+ on(type: FormEvent, priority: number, handler: Function): void;
78
+ /**
79
+ * @param {FormEvent} type
80
+ * @param {Function} handler
81
+ */
82
+ off(type: FormEvent, handler: Function): void;
83
+ /**
84
+ * @private
85
+ *
86
+ * @param {FormOptions} options
87
+ * @param {Element} container
88
+ *
89
+ * @returns {Injector}
90
+ */
91
+ private _createInjector;
92
+ /**
93
+ * @private
94
+ */
95
+ private _emit;
96
+ /**
97
+ * @internal
98
+ *
99
+ * @param { { add?: boolean, field: any, remove?: number, value?: any } } update
100
+ */
101
+ _update(update: {
102
+ add?: boolean;
103
+ field: any;
104
+ remove?: number;
105
+ value?: any;
106
+ }): void;
107
+ /**
108
+ * @internal
109
+ */
110
+ _getState(): State;
111
+ /**
112
+ * @internal
113
+ */
114
+ _setState(state: any): void;
115
+ }
116
+ export type Injector = any;
117
+ export type Data = import('./types').Data;
118
+ export type Errors = import('./types').Errors;
119
+ export type Schema = import('./types').Schema;
120
+ export type FormProperties = import('./types').FormProperties;
121
+ export type FormProperty = import('./types').FormProperty;
122
+ export type FormEvent = import('./types').FormEvent;
123
+ export type FormOptions = import('./types').FormOptions;
124
+ export type State = {
125
+ data: Data;
126
+ initialData: Data;
127
+ errors: Errors;
128
+ properties: FormProperties;
129
+ schema: Schema;
130
+ };
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,17 +1,17 @@
1
- declare class FormFieldRegistry {
2
- constructor(eventBus: any);
3
- _eventBus: any;
4
- _formFields: {};
5
- _ids: any;
6
- _keys: any;
7
- add(formField: any): void;
8
- remove(formField: any): void;
9
- get(id: any): any;
10
- getAll(): any[];
11
- forEach(callback: any): void;
12
- clear(): void;
13
- }
14
- declare namespace FormFieldRegistry {
15
- const $inject: string[];
16
- }
17
- export default FormFieldRegistry;
1
+ declare class FormFieldRegistry {
2
+ constructor(eventBus: any);
3
+ _eventBus: any;
4
+ _formFields: {};
5
+ _ids: any;
6
+ _keys: any;
7
+ add(formField: any): void;
8
+ remove(formField: any): void;
9
+ get(id: any): any;
10
+ getAll(): any[];
11
+ forEach(callback: any): void;
12
+ clear(): void;
13
+ }
14
+ declare namespace FormFieldRegistry {
15
+ const $inject: string[];
16
+ }
17
+ export default FormFieldRegistry;
@@ -1,3 +1,3 @@
1
- export default class Validator {
2
- validateField(field: any, value: any): any[];
3
- }
1
+ export default class Validator {
2
+ validateField(field: any, value: any): any[];
3
+ }
@@ -1,16 +1,16 @@
1
- export { FormFieldRegistry };
2
- declare namespace _default {
3
- const __depends__: ({
4
- importer: (string | typeof import("../import/Importer").default)[];
5
- } | {
6
- __init__: string[];
7
- formFields: (string | typeof import("../render").FormFields)[];
8
- renderer: (string | typeof import("../render/Renderer").default)[];
9
- })[];
10
- const eventBus: any[];
11
- const formFieldRegistry: (string | typeof FormFieldRegistry)[];
12
- const validator: (string | typeof Validator)[];
13
- }
14
- export default _default;
15
- import FormFieldRegistry from "./FormFieldRegistry";
16
- import Validator from "./Validator";
1
+ export { FormFieldRegistry };
2
+ declare namespace _default {
3
+ const __depends__: ({
4
+ importer: (string | typeof import("../import/Importer").default)[];
5
+ } | {
6
+ __init__: string[];
7
+ formFields: (string | typeof import("../render").FormFields)[];
8
+ renderer: (string | typeof import("../render/Renderer").default)[];
9
+ })[];
10
+ const eventBus: any[];
11
+ const formFieldRegistry: (string | typeof FormFieldRegistry)[];
12
+ const validator: (string | typeof Validator)[];
13
+ }
14
+ export default _default;
15
+ import FormFieldRegistry from "./FormFieldRegistry";
16
+ import Validator from "./Validator";
@@ -1,38 +1,43 @@
1
- declare class Importer {
2
- /**
3
- * @constructor
4
- * @param { import('../core').FormFieldRegistry } formFieldRegistry
5
- * @param { import('../render/FormFields').default } formFields
6
- */
7
- constructor(formFieldRegistry: import('../core').FormFieldRegistry, formFields: import('../render/FormFields').default);
8
- _formFieldRegistry: import("../core").FormFieldRegistry;
9
- _formFields: import("../render/FormFields").default;
10
- /**
11
- * Import schema adding `id`, `_parent` and `_path`
12
- * information to each field and adding it to the
13
- * form field registry.
14
- *
15
- * @param {any} schema
16
- * @param {any} [data]
17
- *
18
- * @return { { warnings: Array<any>, schema: any, data: any } }
19
- */
20
- importSchema(schema: any, data?: any): {
21
- warnings: Array<any>;
22
- schema: any;
23
- data: any;
24
- };
25
- /**
26
- * @param {any} formField
27
- * @param {Object} [data]
28
- * @param {string} [parentId]
29
- *
30
- * @return {any} field
31
- */
32
- importFormField(formField: any, data?: any, parentId?: string): any;
33
- importFormFields(components: any, data: {}, parentId: any): void;
34
- }
35
- declare namespace Importer {
36
- const $inject: string[];
37
- }
38
- export default Importer;
1
+ declare class Importer {
2
+ /**
3
+ * @constructor
4
+ * @param { import('../core').FormFieldRegistry } formFieldRegistry
5
+ * @param { import('../render/FormFields').default } formFields
6
+ */
7
+ constructor(formFieldRegistry: import('../core').FormFieldRegistry, formFields: import('../render/FormFields').default);
8
+ _formFieldRegistry: import("../core").FormFieldRegistry;
9
+ _formFields: import("../render/FormFields").default;
10
+ /**
11
+ * Import schema adding `id`, `_parent` and `_path`
12
+ * information to each field and adding it to the
13
+ * form field registry.
14
+ *
15
+ * @param {any} schema
16
+ * @param {any} [data]
17
+ *
18
+ * @return { { warnings: Array<any>, schema: any, data: any } }
19
+ */
20
+ importSchema(schema: any, data?: any): {
21
+ warnings: Array<any>;
22
+ schema: any;
23
+ data: any;
24
+ };
25
+ /**
26
+ * @param {any} formField
27
+ * @param {string} [parentId]
28
+ *
29
+ * @return {any} importedField
30
+ */
31
+ importFormField(formField: any, parentId?: string): any;
32
+ importFormFields(components: any, parentId: any): void;
33
+ /**
34
+ * @param {Object} data
35
+ *
36
+ * @return {Object} importedData
37
+ */
38
+ importData(data: any): any;
39
+ }
40
+ declare namespace Importer {
41
+ const $inject: string[];
42
+ }
43
+ export default Importer;
@@ -1,5 +1,5 @@
1
- declare namespace _default {
2
- const importer: (string | typeof Importer)[];
3
- }
4
- export default _default;
5
- import Importer from "./Importer";
1
+ declare namespace _default {
2
+ const importer: (string | typeof Importer)[];
3
+ }
4
+ export default _default;
5
+ import Importer from "./Importer";
@@ -1,18 +1,18 @@
1
- /**
2
- * @typedef { import('./types').CreateFormOptions } CreateFormOptions
3
- */
4
- /**
5
- * Create a form.
6
- *
7
- * @param {CreateFormOptions} options
8
- *
9
- * @return {Promise<Form>}
10
- */
11
- export function createForm(options: CreateFormOptions): Promise<Form>;
12
- export { FormFieldRegistry } from "./core";
13
- export * from "./render";
14
- export * from "./util";
15
- export type CreateFormOptions = import('./types').CreateFormOptions;
16
- import Form from "./Form";
17
- export const schemaVersion: 2;
18
- export { Form };
1
+ /**
2
+ * @typedef { import('./types').CreateFormOptions } CreateFormOptions
3
+ */
4
+ /**
5
+ * Create a form.
6
+ *
7
+ * @param {CreateFormOptions} options
8
+ *
9
+ * @return {Promise<Form>}
10
+ */
11
+ export function createForm(options: CreateFormOptions): Promise<Form>;
12
+ export { FormFieldRegistry } from "./core";
13
+ export * from "./render";
14
+ export * from "./util";
15
+ export type CreateFormOptions = import('./types').CreateFormOptions;
16
+ import Form from "./Form";
17
+ export const schemaVersion: 3;
18
+ export { Form };
@@ -1,5 +1,5 @@
1
- export default class FormFields {
2
- _formFields: {};
3
- register(type: any, formField: any): void;
4
- get(type: any): any;
5
- }
1
+ export default class FormFields {
2
+ _formFields: {};
3
+ register(type: any, formField: any): void;
4
+ get(type: any): any;
5
+ }
@@ -1,23 +1,23 @@
1
- /**
2
- * @typedef { { container } } Config
3
- * @typedef { import('didi').Injector } Injector
4
- * @typedef { import('../core/EventBus').default } EventBus
5
- * @typedef { import('../Form').default } Form
6
- */
7
- /**
8
- * @param {Config} config
9
- * @param {EventBus} eventBus
10
- * @param {Form} form
11
- * @param {Injector} injector
12
- */
13
- declare function Renderer(config: Config, eventBus: any, form: Form, injector: any): void;
14
- declare namespace Renderer {
15
- const $inject: string[];
16
- }
17
- export default Renderer;
18
- export type Config = {
19
- container;
20
- };
21
- export type Injector = any;
22
- export type EventBus = any;
23
- export type Form = import('../Form').default;
1
+ /**
2
+ * @typedef { { container } } Config
3
+ * @typedef { import('didi').Injector } Injector
4
+ * @typedef { import('../core/EventBus').default } EventBus
5
+ * @typedef { import('../Form').default } Form
6
+ */
7
+ /**
8
+ * @param {Config} config
9
+ * @param {EventBus} eventBus
10
+ * @param {Form} form
11
+ * @param {Injector} injector
12
+ */
13
+ declare function Renderer(config: Config, eventBus: any, form: Form, injector: any): void;
14
+ declare namespace Renderer {
15
+ const $inject: string[];
16
+ }
17
+ export default Renderer;
18
+ export type Config = {
19
+ container;
20
+ };
21
+ export type Injector = any;
22
+ export type EventBus = any;
23
+ export type Form = import('../Form').default;
@@ -1 +1 @@
1
- export default function Description(props: any): import("preact").JSX.Element;
1
+ export default function Description(props: any): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export default function Errors(props: any): import("preact").JSX.Element;
1
+ export default function Errors(props: any): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export default function FormComponent(props: any): import("preact").JSX.Element;
1
+ export default function FormComponent(props: any): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export default function FormField(props: any): import("preact").JSX.Element;
1
+ export default function FormField(props: any): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export default function Label(props: any): import("preact").JSX.Element;
1
+ export default function Label(props: any): import("preact").JSX.Element;
@@ -1 +1 @@
1
- export default function PoweredBy(props: any): import("preact").JSX.Element;
1
+ export default function PoweredBy(props: any): import("preact").JSX.Element;
@@ -1,7 +1,7 @@
1
- /**
2
- * Sanitize a HTML string and return the cleaned, safe version.
3
- *
4
- * @param {string} html
5
- * @return {string}
6
- */
7
- export function sanitizeHTML(html: string): string;
1
+ /**
2
+ * Sanitize a HTML string and return the cleaned, safe version.
3
+ *
4
+ * @param {string} html
5
+ * @return {string}
6
+ */
7
+ export function sanitizeHTML(html: string): string;
@@ -1,4 +1,4 @@
1
- export function formFieldClasses(type: any, errors?: any[]): string;
2
- export function prefixId(id: any): string;
3
- export function markdownToHTML(markdown: any): any;
4
- export function safeMarkdown(markdown: any): string;
1
+ export function formFieldClasses(type: any, errors?: any[]): string;
2
+ export function prefixId(id: any, formId: any): string;
3
+ export function markdownToHTML(markdown: any): any;
4
+ export function safeMarkdown(markdown: any): string;
@@ -1,11 +1,11 @@
1
- declare function Button(props: any): import("preact").JSX.Element;
2
- declare namespace Button {
3
- export function create(options?: {}): {
4
- action: string;
5
- };
6
- export { type };
7
- export const label: string;
8
- export const keyed: boolean;
9
- }
10
- export default Button;
11
- declare const type: "button";
1
+ declare function Button(props: any): import("preact").JSX.Element;
2
+ declare namespace Button {
3
+ export function create(options?: {}): {
4
+ action: string;
5
+ };
6
+ export { type };
7
+ export const label: string;
8
+ export const keyed: boolean;
9
+ }
10
+ export default Button;
11
+ declare const type: "button";
@@ -1,9 +1,10 @@
1
- declare function Checkbox(props: any): import("preact").JSX.Element;
2
- declare namespace Checkbox {
3
- export function create(options?: {}): {};
4
- export { type };
5
- export const label: string;
6
- export const keyed: boolean;
7
- }
8
- export default Checkbox;
9
- declare const type: "checkbox";
1
+ declare function Checkbox(props: any): import("preact").JSX.Element;
2
+ declare namespace Checkbox {
3
+ export function create(options?: {}): {};
4
+ export { type };
5
+ export const label: string;
6
+ export const keyed: boolean;
7
+ export const emptyValue: boolean;
8
+ }
9
+ export default Checkbox;
10
+ declare const type: "checkbox";