@bpmn-io/form-js-viewer 0.10.0-alpha.3 → 0.10.1

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 (68) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +165 -164
  3. package/dist/assets/flatpickr/light.css +809 -0
  4. package/dist/assets/form-js.css +611 -498
  5. package/dist/index.cjs +1493 -369
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.es.js +1475 -372
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/types/Form.d.ts +144 -144
  10. package/dist/types/core/ConditionChecker.d.ts +57 -57
  11. package/dist/types/core/EventBus.d.ts +1 -1
  12. package/dist/types/core/FormFieldRegistry.d.ts +17 -17
  13. package/dist/types/core/Validator.d.ts +7 -7
  14. package/dist/types/core/index.d.ts +18 -18
  15. package/dist/types/import/Importer.d.ts +43 -43
  16. package/dist/types/import/index.d.ts +5 -5
  17. package/dist/types/index.d.ts +18 -18
  18. package/dist/types/render/FormFields.d.ts +5 -5
  19. package/dist/types/render/Renderer.d.ts +23 -23
  20. package/dist/types/render/components/Description.d.ts +1 -1
  21. package/dist/types/render/components/Errors.d.ts +1 -1
  22. package/dist/types/render/components/FormComponent.d.ts +1 -1
  23. package/dist/types/render/components/FormField.d.ts +1 -1
  24. package/dist/types/render/components/Label.d.ts +1 -1
  25. package/dist/types/render/components/PoweredBy.d.ts +1 -1
  26. package/dist/types/render/components/Sanitizer.d.ts +8 -8
  27. package/dist/types/render/components/Util.d.ts +17 -19
  28. package/dist/types/render/components/form-fields/Button.d.ts +11 -11
  29. package/dist/types/render/components/form-fields/Checkbox.d.ts +13 -13
  30. package/dist/types/render/components/form-fields/Checklist.d.ts +12 -12
  31. package/dist/types/render/components/form-fields/Datetime.d.ts +11 -0
  32. package/dist/types/render/components/form-fields/Default.d.ts +9 -9
  33. package/dist/types/render/components/form-fields/Image.d.ts +8 -8
  34. package/dist/types/render/components/form-fields/Number.d.ts +14 -14
  35. package/dist/types/render/components/form-fields/Radio.d.ts +12 -12
  36. package/dist/types/render/components/form-fields/Select.d.ts +12 -12
  37. package/dist/types/render/components/form-fields/Taglist.d.ts +12 -12
  38. package/dist/types/render/components/form-fields/Text.d.ts +10 -10
  39. package/dist/types/render/components/form-fields/Textarea.d.ts +13 -13
  40. package/dist/types/render/components/form-fields/Textfield.d.ts +13 -13
  41. package/dist/types/render/components/form-fields/parts/Datepicker.d.ts +1 -0
  42. package/dist/types/render/components/form-fields/parts/DropdownList.d.ts +1 -1
  43. package/dist/types/render/components/form-fields/parts/InputAdorner.d.ts +1 -0
  44. package/dist/types/render/components/form-fields/parts/Timepicker.d.ts +1 -0
  45. package/dist/types/render/components/icons/index.d.ts +16 -0
  46. package/dist/types/render/components/index.d.ts +17 -15
  47. package/dist/types/render/components/util/dateTimeUtil.d.ts +12 -0
  48. package/dist/types/render/components/util/numberFieldUtil.d.ts +4 -4
  49. package/dist/types/render/components/util/sanitizerUtil.d.ts +3 -0
  50. package/dist/types/render/context/FormContext.d.ts +12 -12
  51. package/dist/types/render/context/FormRenderContext.d.ts +6 -6
  52. package/dist/types/render/context/index.d.ts +2 -2
  53. package/dist/types/render/hooks/useCondition.d.ts +9 -9
  54. package/dist/types/render/hooks/useEvaluation.d.ts +6 -6
  55. package/dist/types/render/hooks/useExpressionValue.d.ts +5 -5
  56. package/dist/types/render/hooks/useKeyDownAction.d.ts +1 -1
  57. package/dist/types/render/hooks/useService.d.ts +1 -1
  58. package/dist/types/render/hooks/useValuesAsync.d.ts +28 -28
  59. package/dist/types/render/index.d.ts +11 -11
  60. package/dist/types/src/types.d.ts +35 -35
  61. package/dist/types/util/constants/DatetimeConstants.d.ts +24 -0
  62. package/dist/types/util/constants/ValuesSourceConstants.d.ts +15 -0
  63. package/dist/types/util/constants/index.d.ts +2 -0
  64. package/dist/types/util/feel.d.ts +15 -14
  65. package/dist/types/util/form.d.ts +6 -6
  66. package/dist/types/util/index.d.ts +25 -24
  67. package/dist/types/util/injector.d.ts +2 -2
  68. package/package.json +4 -2
@@ -1,144 +1,144 @@
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 {OnEventType}
13
- */
14
- public on: OnEventType;
15
- /**
16
- * @public
17
- * @type {String}
18
- */
19
- public _id: string;
20
- /**
21
- * @private
22
- * @type {Element}
23
- */
24
- private _container;
25
- /**
26
- * @private
27
- * @type {State}
28
- */
29
- private _state;
30
- get: <T>(name: string, strict?: boolean) => T;
31
- invoke: <T_1>(func: (...args: unknown[]) => T_1, context: unknown, locals: import("didi").LocalsMap) => T_1;
32
- clear(): void;
33
- /**
34
- * Destroy the form, removing it from DOM,
35
- * if attached.
36
- */
37
- destroy(): void;
38
- /**
39
- * Open a form schema with the given initial data.
40
- *
41
- * @param {Schema} schema
42
- * @param {Data} [data]
43
- *
44
- * @return Promise<{ warnings: Array<any> }>
45
- */
46
- importSchema(schema: Schema, data?: Data): Promise<any>;
47
- /**
48
- * Submit the form, triggering all field validations.
49
- *
50
- * @returns { { data: Data, errors: Errors } }
51
- */
52
- submit(): {
53
- data: Data;
54
- errors: Errors;
55
- };
56
- reset(): void;
57
- /**
58
- * @returns {Errors}
59
- */
60
- validate(): Errors;
61
- /**
62
- * @param {Element|string} parentNode
63
- */
64
- attachTo(parentNode: Element | string): void;
65
- detach(): void;
66
- /**
67
- * @private
68
- *
69
- * @param {boolean} [emit]
70
- */
71
- private _detach;
72
- /**
73
- * @param {FormProperty} property
74
- * @param {any} value
75
- */
76
- setProperty(property: FormProperty, value: any): void;
77
- /**
78
- * @param {FormEvent} type
79
- * @param {Function} handler
80
- */
81
- off(type: FormEvent, handler: Function): void;
82
- /**
83
- * @private
84
- *
85
- * @param {FormOptions} options
86
- * @param {Element} container
87
- *
88
- * @returns {Injector}
89
- */
90
- private _createInjector;
91
- /**
92
- * @private
93
- */
94
- private _emit;
95
- /**
96
- * @internal
97
- *
98
- * @param { { add?: boolean, field: any, remove?: number, value?: any } } update
99
- */
100
- _update(update: {
101
- add?: boolean;
102
- field: any;
103
- remove?: number;
104
- value?: any;
105
- }): void;
106
- /**
107
- * @internal
108
- */
109
- _getState(): State;
110
- /**
111
- * @internal
112
- */
113
- _setState(state: any): void;
114
- /**
115
- * @internal
116
- */
117
- _onEvent(type: any, priority: any, handler: any): void;
118
- /**
119
- * @internal
120
- */
121
- _getSubmitData(): any;
122
- /**
123
- * @internal
124
- */
125
- _applyConditions(toFilter: any, data: any): any;
126
- }
127
- export type Injector = import('./types').Injector;
128
- export type Data = import('./types').Data;
129
- export type Errors = import('./types').Errors;
130
- export type Schema = import('./types').Schema;
131
- export type FormProperties = import('./types').FormProperties;
132
- export type FormProperty = import('./types').FormProperty;
133
- export type FormEvent = import('./types').FormEvent;
134
- export type FormOptions = import('./types').FormOptions;
135
- export type State = {
136
- data: Data;
137
- initialData: Data;
138
- errors: Errors;
139
- properties: FormProperties;
140
- schema: Schema;
141
- };
142
- export type OnEventWithPriority = OnEventWithPriority;
143
- export type OnEventWithOutPriority = OnEventWithOutPriority;
144
- export type OnEventType = OnEventWithPriority & OnEventWithOutPriority;
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 {OnEventType}
13
+ */
14
+ public on: OnEventType;
15
+ /**
16
+ * @public
17
+ * @type {String}
18
+ */
19
+ public _id: string;
20
+ /**
21
+ * @private
22
+ * @type {Element}
23
+ */
24
+ private _container;
25
+ /**
26
+ * @private
27
+ * @type {State}
28
+ */
29
+ private _state;
30
+ get: <T>(name: string, strict?: boolean) => T;
31
+ invoke: <T_1>(func: (...args: unknown[]) => T_1, context: unknown, locals: import("didi").LocalsMap) => T_1;
32
+ clear(): void;
33
+ /**
34
+ * Destroy the form, removing it from DOM,
35
+ * if attached.
36
+ */
37
+ destroy(): void;
38
+ /**
39
+ * Open a form schema with the given initial data.
40
+ *
41
+ * @param {Schema} schema
42
+ * @param {Data} [data]
43
+ *
44
+ * @return Promise<{ warnings: Array<any> }>
45
+ */
46
+ importSchema(schema: Schema, data?: Data): Promise<any>;
47
+ /**
48
+ * Submit the form, triggering all field validations.
49
+ *
50
+ * @returns { { data: Data, errors: Errors } }
51
+ */
52
+ submit(): {
53
+ data: Data;
54
+ errors: Errors;
55
+ };
56
+ reset(): void;
57
+ /**
58
+ * @returns {Errors}
59
+ */
60
+ validate(): Errors;
61
+ /**
62
+ * @param {Element|string} parentNode
63
+ */
64
+ attachTo(parentNode: Element | string): void;
65
+ detach(): void;
66
+ /**
67
+ * @private
68
+ *
69
+ * @param {boolean} [emit]
70
+ */
71
+ private _detach;
72
+ /**
73
+ * @param {FormProperty} property
74
+ * @param {any} value
75
+ */
76
+ setProperty(property: FormProperty, value: any): void;
77
+ /**
78
+ * @param {FormEvent} type
79
+ * @param {Function} handler
80
+ */
81
+ off(type: FormEvent, handler: Function): void;
82
+ /**
83
+ * @private
84
+ *
85
+ * @param {FormOptions} options
86
+ * @param {Element} container
87
+ *
88
+ * @returns {Injector}
89
+ */
90
+ private _createInjector;
91
+ /**
92
+ * @private
93
+ */
94
+ private _emit;
95
+ /**
96
+ * @internal
97
+ *
98
+ * @param { { add?: boolean, field: any, remove?: number, value?: any } } update
99
+ */
100
+ _update(update: {
101
+ add?: boolean;
102
+ field: any;
103
+ remove?: number;
104
+ value?: any;
105
+ }): void;
106
+ /**
107
+ * @internal
108
+ */
109
+ _getState(): State;
110
+ /**
111
+ * @internal
112
+ */
113
+ _setState(state: any): void;
114
+ /**
115
+ * @internal
116
+ */
117
+ _onEvent(type: any, priority: any, handler: any): void;
118
+ /**
119
+ * @internal
120
+ */
121
+ _getSubmitData(): any;
122
+ /**
123
+ * @internal
124
+ */
125
+ _applyConditions(toFilter: any, data: any): any;
126
+ }
127
+ export type Injector = import('./types').Injector;
128
+ export type Data = import('./types').Data;
129
+ export type Errors = import('./types').Errors;
130
+ export type Schema = import('./types').Schema;
131
+ export type FormProperties = import('./types').FormProperties;
132
+ export type FormProperty = import('./types').FormProperty;
133
+ export type FormEvent = import('./types').FormEvent;
134
+ export type FormOptions = import('./types').FormOptions;
135
+ export type State = {
136
+ data: Data;
137
+ initialData: Data;
138
+ errors: Errors;
139
+ properties: FormProperties;
140
+ schema: Schema;
141
+ };
142
+ export type OnEventWithPriority = OnEventWithPriority;
143
+ export type OnEventWithOutPriority = OnEventWithOutPriority;
144
+ export type OnEventType = OnEventWithPriority & OnEventWithOutPriority;
@@ -1,57 +1,57 @@
1
- /**
2
- * @typedef {object} Condition
3
- * @property {string} [hide]
4
- */
5
- export class ConditionChecker {
6
- constructor(formFieldRegistry: any, eventBus: any);
7
- _formFieldRegistry: any;
8
- _eventBus: any;
9
- /**
10
- * For given data, remove properties based on condition.
11
- *
12
- * @param {Object<string, any>} properties
13
- * @param {Object<string, any>} data
14
- */
15
- applyConditions(properties: {
16
- [x: string]: any;
17
- }, data?: {
18
- [x: string]: any;
19
- }): {
20
- [x: string]: any;
21
- };
22
- /**
23
- * Check if given condition is met. Returns null for invalid/missing conditions.
24
- *
25
- * @param {string} condition
26
- * @param {import('../types').Data} [data]
27
- *
28
- * @returns {boolean|null}
29
- */
30
- check(condition: string, data?: import('../types').Data): boolean | null;
31
- /**
32
- * Check if hide condition is met.
33
- *
34
- * @param {Condition} condition
35
- * @param {Object<string, any>} data
36
- * @returns {boolean}
37
- */
38
- _checkHideCondition(condition: Condition, data: {
39
- [x: string]: any;
40
- }): boolean;
41
- /**
42
- * Evaluate an expression.
43
- *
44
- * @param {string} expression
45
- * @param {import('../types').Data} [data]
46
- *
47
- * @returns {any}
48
- */
49
- evaluate(expression: string, data?: import('../types').Data): any;
50
- _getConditions(): any;
51
- }
52
- export namespace ConditionChecker {
53
- const $inject: string[];
54
- }
55
- export type Condition = {
56
- hide?: string;
57
- };
1
+ /**
2
+ * @typedef {object} Condition
3
+ * @property {string} [hide]
4
+ */
5
+ export class ConditionChecker {
6
+ constructor(formFieldRegistry: any, eventBus: any);
7
+ _formFieldRegistry: any;
8
+ _eventBus: any;
9
+ /**
10
+ * For given data, remove properties based on condition.
11
+ *
12
+ * @param {Object<string, any>} properties
13
+ * @param {Object<string, any>} data
14
+ */
15
+ applyConditions(properties: {
16
+ [x: string]: any;
17
+ }, data?: {
18
+ [x: string]: any;
19
+ }): {
20
+ [x: string]: any;
21
+ };
22
+ /**
23
+ * Check if given condition is met. Returns null for invalid/missing conditions.
24
+ *
25
+ * @param {string} condition
26
+ * @param {import('../types').Data} [data]
27
+ *
28
+ * @returns {boolean|null}
29
+ */
30
+ check(condition: string, data?: import('../types').Data): boolean | null;
31
+ /**
32
+ * Check if hide condition is met.
33
+ *
34
+ * @param {Condition} condition
35
+ * @param {Object<string, any>} data
36
+ * @returns {boolean}
37
+ */
38
+ _checkHideCondition(condition: Condition, data: {
39
+ [x: string]: any;
40
+ }): boolean;
41
+ /**
42
+ * Evaluate an expression.
43
+ *
44
+ * @param {string} expression
45
+ * @param {import('../types').Data} [data]
46
+ *
47
+ * @returns {any}
48
+ */
49
+ evaluate(expression: string, data?: import('../types').Data): any;
50
+ _getConditions(): any;
51
+ }
52
+ export namespace ConditionChecker {
53
+ const $inject: string[];
54
+ }
55
+ export type Condition = {
56
+ hide?: string;
57
+ };
@@ -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,7 +1,7 @@
1
- declare class Validator {
2
- validateField(field: any, value: any): any[];
3
- }
4
- declare namespace Validator {
5
- const $inject: any[];
6
- }
7
- export default Validator;
1
+ declare class Validator {
2
+ validateField(field: any, value: any): any[];
3
+ }
4
+ declare namespace Validator {
5
+ const $inject: any[];
6
+ }
7
+ export default Validator;
@@ -1,18 +1,18 @@
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 conditionChecker: (string | typeof ConditionChecker)[];
11
- const eventBus: any[];
12
- const formFieldRegistry: (string | typeof FormFieldRegistry)[];
13
- const validator: (string | typeof Validator)[];
14
- }
15
- export default _default;
16
- import FormFieldRegistry from "./FormFieldRegistry";
17
- import { ConditionChecker } from "./ConditionChecker";
18
- 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 conditionChecker: (string | typeof ConditionChecker)[];
11
+ const eventBus: any[];
12
+ const formFieldRegistry: (string | typeof FormFieldRegistry)[];
13
+ const validator: (string | typeof Validator)[];
14
+ }
15
+ export default _default;
16
+ import FormFieldRegistry from "./FormFieldRegistry";
17
+ import { ConditionChecker } from "./ConditionChecker";
18
+ import Validator from "./Validator";
@@ -1,43 +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 {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} initializedData
37
- */
38
- initializeFieldValues(data: any): any;
39
- }
40
- declare namespace Importer {
41
- const $inject: string[];
42
- }
43
- 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} initializedData
37
+ */
38
+ initializeFieldValues(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: 6;
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: 6;
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
+ }