@bpmn-io/form-js-viewer 0.14.0 → 0.15.0-alpha.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 (32) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +164 -164
  3. package/dist/assets/form-js-base.css +832 -781
  4. package/dist/assets/form-js.css +92 -41
  5. package/dist/index.cjs +956 -541
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.es.js +958 -543
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/types/Form.d.ts +23 -1
  10. package/dist/types/core/EventBus.d.ts +1 -1
  11. package/dist/types/core/index.d.ts +2 -1
  12. package/dist/types/features/expression-language/FeelExpressionLanguage.d.ts +3 -5
  13. package/dist/types/features/expression-language/FeelersTemplating.d.ts +42 -0
  14. package/dist/types/features/expression-language/variableExtractionHelpers.d.ts +1 -0
  15. package/dist/types/render/Renderer.d.ts +2 -2
  16. package/dist/types/render/components/Util.d.ts +2 -2
  17. package/dist/types/render/components/form-fields/Button.d.ts +9 -7
  18. package/dist/types/render/components/form-fields/Checkbox.d.ts +11 -9
  19. package/dist/types/render/components/form-fields/Checklist.d.ts +14 -12
  20. package/dist/types/render/components/form-fields/Datetime.d.ts +9 -7
  21. package/dist/types/render/components/form-fields/Default.d.ts +9 -7
  22. package/dist/types/render/components/form-fields/Image.d.ts +7 -5
  23. package/dist/types/render/components/form-fields/Number.d.ts +12 -10
  24. package/dist/types/render/components/form-fields/Radio.d.ts +14 -12
  25. package/dist/types/render/components/form-fields/Select.d.ts +14 -12
  26. package/dist/types/render/components/form-fields/Taglist.d.ts +14 -12
  27. package/dist/types/render/components/form-fields/Text.d.ts +9 -7
  28. package/dist/types/render/components/form-fields/Textarea.d.ts +11 -9
  29. package/dist/types/render/components/form-fields/Textfield.d.ts +11 -9
  30. package/dist/types/types.d.ts +35 -35
  31. package/dist/types/util/index.d.ts +2 -1
  32. package/package.json +3 -2
@@ -28,7 +28,7 @@ export default class Form {
28
28
  */
29
29
  private _state;
30
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;
31
+ invoke: <T_1>(func: (...args: any[]) => T_1, context?: unknown, locals?: import("didi").LocalsMap) => T_1;
32
32
  clear(): void;
33
33
  /**
34
34
  * Destroy the form, removing it from DOM,
@@ -117,6 +117,28 @@ export default class Form {
117
117
  _getModules(): ({
118
118
  __init__: string[];
119
119
  expressionLanguage: (string | typeof import("./features/expression-language").FeelExpressionLanguage)[];
120
+ /**
121
+ * @typedef { import('./types').Injector } Injector
122
+ * @typedef { import('./types').Data } Data
123
+ * @typedef { import('./types').Errors } Errors
124
+ * @typedef { import('./types').Schema } Schema
125
+ * @typedef { import('./types').FormProperties } FormProperties
126
+ * @typedef { import('./types').FormProperty } FormProperty
127
+ * @typedef { import('./types').FormEvent } FormEvent
128
+ * @typedef { import('./types').FormOptions } FormOptions
129
+ *
130
+ * @typedef { {
131
+ * data: Data,
132
+ * initialData: Data,
133
+ * errors: Errors,
134
+ * properties: FormProperties,
135
+ * schema: Schema
136
+ * } } State
137
+ *
138
+ * @typedef { (type:FormEvent, priority:number, handler:Function) => void } OnEventWithPriority
139
+ * @typedef { (type:FormEvent, handler:Function) => void } OnEventWithOutPriority
140
+ * @typedef { OnEventWithPriority & OnEventWithOutPriority } OnEventType
141
+ */
120
142
  templating: (string | typeof import("./features/expression-language").FeelersTemplating)[];
121
143
  conditionChecker: (string | typeof import("./features/expression-language").ConditionChecker)[];
122
144
  } | {
@@ -1 +1 @@
1
- export {};
1
+ export { default } from "diagram-js/lib/core/EventBus";
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  formFields: (string | typeof import("../render").FormFields)[];
7
7
  renderer: (string | typeof import("../render/Renderer").default)[];
8
8
  })[];
9
- const eventBus: any[];
9
+ const eventBus: (string | typeof EventBus)[];
10
10
  const formFieldRegistry: (string | typeof FormFieldRegistry)[];
11
11
  const formLayouter: (string | typeof FormLayouter)[];
12
12
  const validator: (string | typeof Validator)[];
@@ -14,5 +14,6 @@ declare namespace _default {
14
14
  export default _default;
15
15
  import FormFieldRegistry from './FormFieldRegistry';
16
16
  import FormLayouter from './FormLayouter';
17
+ import EventBus from './EventBus';
17
18
  import Validator from './Validator';
18
19
  export { FormFieldRegistry, FormLayouter };
@@ -2,13 +2,13 @@ declare class FeelExpressionLanguage {
2
2
  constructor(eventBus: any);
3
3
  _eventBus: any;
4
4
  /**
5
- * Determines if the given string is a FEEL expression.
5
+ * Determines if the given value is a FEEL expression.
6
6
  *
7
- * @param {string} value
7
+ * @param {any} value
8
8
  * @returns {boolean}
9
9
  *
10
10
  */
11
- isExpression(value: string): boolean;
11
+ isExpression(value: any): boolean;
12
12
  /**
13
13
  * Retrieve variable names from a given FEEL expression.
14
14
  *
@@ -30,8 +30,6 @@ declare class FeelExpressionLanguage {
30
30
  * @returns {any}
31
31
  */
32
32
  evaluate(expression: string, data?: import('../../types').Data): any;
33
- _getExpressionVariableNames(expression: any): any[];
34
- _getUnaryVariableNames(unaryTest: any): any[];
35
33
  }
36
34
  declare namespace FeelExpressionLanguage {
37
35
  const $inject: string[];
@@ -1,5 +1,20 @@
1
1
  declare class FeelersTemplating {
2
+ /**
3
+ * Determines if the given value is a feelers template.
4
+ *
5
+ * @param {any} value
6
+ * @returns {boolean}
7
+ *
8
+ */
2
9
  isTemplate(value: any): boolean;
10
+ /**
11
+ * Retrieve variable names from a given feelers template.
12
+ *
13
+ * @param {string} template
14
+ *
15
+ * @returns {string[]}
16
+ */
17
+ getVariableNames(template: string): string[];
3
18
  /**
4
19
  * Evaluate a template.
5
20
  *
@@ -19,6 +34,33 @@ declare class FeelersTemplating {
19
34
  strict?: boolean;
20
35
  buildDebugString?: Function;
21
36
  }): any;
37
+ /**
38
+ * @typedef {Object} ExpressionWithDepth
39
+ * @property {number} depth - The depth of the expression in the syntax tree.
40
+ * @property {string} expression - The extracted expression
41
+ */
42
+ /**
43
+ * Extracts all feel expressions in the template along with their depth in the syntax tree.
44
+ * The depth is incremented for child expressions of loops to account for context drilling.
45
+
46
+ * @name extractExpressionsWithDepth
47
+ * @param {string} template - A feelers template string.
48
+ * @returns {Array<ExpressionWithDepth>} An array of objects, each containing the depth and the extracted expression.
49
+ *
50
+ * @example
51
+ * const template = "Hello {{user}}, you have:{{#loop items}}\n- {{amount}} {{name}}{{/loop}}.";
52
+ * const extractedExpressions = _extractExpressionsWithDepth(template);
53
+ */
54
+ _extractExpressionsWithDepth(template: string): {
55
+ /**
56
+ * - The depth of the expression in the syntax tree.
57
+ */
58
+ depth: number;
59
+ /**
60
+ * - The extracted expression
61
+ */
62
+ expression: string;
63
+ }[];
22
64
  }
23
65
  declare namespace FeelersTemplating {
24
66
  const $inject: any[];
@@ -0,0 +1 @@
1
+ export function getFlavouredFeelVariableNames(feelString: any, feelFlavour: any, options?: {}): any;
@@ -10,7 +10,7 @@
10
10
  * @param {Form} form
11
11
  * @param {Injector} injector
12
12
  */
13
- declare function Renderer(config: Config, eventBus: any, form: Form, injector: Injector): void;
13
+ declare function Renderer(config: Config, eventBus: EventBus, form: Form, injector: Injector): void;
14
14
  declare namespace Renderer {
15
15
  const $inject: string[];
16
16
  }
@@ -19,5 +19,5 @@ export type Config = {
19
19
  container;
20
20
  };
21
21
  export type Injector = import('didi').Injector;
22
- export type EventBus = any;
22
+ export type EventBus = import('../core/EventBus').default;
23
23
  export type Form = import('../Form').default;
@@ -1,6 +1,6 @@
1
1
  export function formFieldClasses(type: any, { errors, disabled }?: {
2
2
  errors?: any[];
3
3
  disabled?: boolean;
4
- }): string;
5
- export function gridColumnClasses(formField: any): string;
4
+ }): any;
5
+ export function gridColumnClasses(formField: any): any;
6
6
  export function prefixId(id: any, formId: any): string;
@@ -1,12 +1,14 @@
1
1
  declare function Button(props: any): import("preact").JSX.Element;
2
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
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export function create(options?: {}): {
9
+ action: string;
10
+ };
11
+ }
10
12
  }
11
13
  export default Button;
12
14
  declare const type: "button";
@@ -1,14 +1,16 @@
1
1
  declare function Checkbox(props: any): import("preact").JSX.Element;
2
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
- export function sanitizeValue({ value }: {
9
- value: any;
10
- }): boolean;
11
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: boolean;
9
+ export function sanitizeValue({ value }: {
10
+ value: any;
11
+ }): boolean;
12
+ export function create(options?: {}): {};
13
+ }
12
14
  }
13
15
  export default Checkbox;
14
16
  declare const type: "checkbox";
@@ -1,17 +1,19 @@
1
1
  declare function Checklist(props: any): import("preact").JSX.Element;
2
2
  declare namespace Checklist {
3
- export function create(options?: {}): {
4
- values: {
5
- label: string;
6
- value: string;
7
- }[];
8
- };
9
- export { type };
10
- export const label: string;
11
- export const keyed: boolean;
12
- export const emptyValue: any[];
13
- export { sanitizeMultiSelectValue as sanitizeValue };
14
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any[];
9
+ export { sanitizeMultiSelectValue as sanitizeValue };
10
+ export function create(options?: {}): {
11
+ values: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ };
16
+ }
15
17
  }
16
18
  export default Checklist;
17
19
  declare const type: "checklist";
@@ -1,12 +1,14 @@
1
1
  declare function Datetime(props: any): import("preact").JSX.Element;
2
2
  declare namespace Datetime {
3
- export function create(options?: {}): {};
4
- export { type };
5
- export const keyed: boolean;
6
- export const emptyValue: any;
7
- export { sanitizeDateTimePickerValue as sanitizeValue };
8
- export const label: string;
9
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any;
9
+ export { sanitizeDateTimePickerValue as sanitizeValue };
10
+ export function create(options?: {}): {};
11
+ }
10
12
  }
11
13
  export default Datetime;
12
14
  declare const type: "datetime";
@@ -1,11 +1,13 @@
1
1
  declare function Default(props: any): import("preact").JSX.Element;
2
2
  declare namespace Default {
3
- function create(options?: {}): {
4
- components: any[];
5
- };
6
- const type: string;
7
- const keyed: boolean;
8
- const label: any;
9
- const group: any;
3
+ namespace config {
4
+ const type: string;
5
+ const keyed: boolean;
6
+ const label: any;
7
+ const group: any;
8
+ function create(options?: {}): {
9
+ components: any[];
10
+ };
11
+ }
10
12
  }
11
13
  export default Default;
@@ -1,10 +1,12 @@
1
1
  declare function Image(props: any): import("preact").JSX.Element;
2
2
  declare namespace Image {
3
- export function create(options?: {}): {};
4
- export { type };
5
- export const keyed: boolean;
6
- export const label: string;
7
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export function create(options?: {}): {};
9
+ }
8
10
  }
9
11
  export default Image;
10
12
  declare const type: "image";
@@ -1,15 +1,17 @@
1
1
  declare function Numberfield(props: any): import("preact").JSX.Element;
2
2
  declare namespace Numberfield {
3
- export function create(options?: {}): {};
4
- export function sanitizeValue({ value, formField }: {
5
- value: any;
6
- formField: any;
7
- }): any;
8
- export { type };
9
- export const keyed: boolean;
10
- export const label: string;
11
- export const emptyValue: any;
12
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any;
9
+ export function sanitizeValue({ value, formField }: {
10
+ value: any;
11
+ formField: any;
12
+ }): any;
13
+ export function create(options?: {}): {};
14
+ }
13
15
  }
14
16
  export default Numberfield;
15
17
  declare const type: "number";
@@ -1,17 +1,19 @@
1
1
  declare function Radio(props: any): import("preact").JSX.Element;
2
2
  declare namespace Radio {
3
- export function create(options?: {}): {
4
- values: {
5
- label: string;
6
- value: string;
7
- }[];
8
- };
9
- export { type };
10
- export const label: string;
11
- export const keyed: boolean;
12
- export const emptyValue: any;
13
- export { sanitizeSingleSelectValue as sanitizeValue };
14
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any;
9
+ export { sanitizeSingleSelectValue as sanitizeValue };
10
+ export function create(options?: {}): {
11
+ values: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ };
16
+ }
15
17
  }
16
18
  export default Radio;
17
19
  declare const type: "radio";
@@ -1,17 +1,19 @@
1
1
  declare function Select(props: any): import("preact").JSX.Element;
2
2
  declare namespace Select {
3
- export function create(options?: {}): {
4
- values: {
5
- label: string;
6
- value: string;
7
- }[];
8
- };
9
- export { type };
10
- export const label: string;
11
- export const keyed: boolean;
12
- export const emptyValue: any;
13
- export { sanitizeSingleSelectValue as sanitizeValue };
14
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any;
9
+ export { sanitizeSingleSelectValue as sanitizeValue };
10
+ export function create(options?: {}): {
11
+ values: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ };
16
+ }
15
17
  }
16
18
  export default Select;
17
19
  declare const type: "select";
@@ -1,17 +1,19 @@
1
1
  declare function Taglist(props: any): import("preact").JSX.Element;
2
2
  declare namespace Taglist {
3
- export function create(options?: {}): {
4
- values: {
5
- label: string;
6
- value: string;
7
- }[];
8
- };
9
- export { type };
10
- export const label: string;
11
- export const keyed: boolean;
12
- export const emptyValue: any[];
13
- export { sanitizeMultiSelectValue as sanitizeValue };
14
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: any[];
9
+ export { sanitizeMultiSelectValue as sanitizeValue };
10
+ export function create(options?: {}): {
11
+ values: {
12
+ label: string;
13
+ value: string;
14
+ }[];
15
+ };
16
+ }
15
17
  }
16
18
  export default Taglist;
17
19
  declare const type: "taglist";
@@ -1,12 +1,14 @@
1
1
  declare function Text(props: any): import("preact").JSX.Element;
2
2
  declare namespace Text {
3
- export function create(options?: {}): {
4
- text: string;
5
- };
6
- export { type };
7
- export const keyed: boolean;
8
- export const group: string;
9
- export const label: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export function create(options?: {}): {
9
+ text: string;
10
+ };
11
+ }
10
12
  }
11
13
  export default Text;
12
14
  declare const type: "text";
@@ -1,14 +1,16 @@
1
1
  declare function Textarea(props: any): import("preact").JSX.Element;
2
2
  declare namespace Textarea {
3
- export function create(options?: {}): {};
4
- export { type };
5
- export const label: string;
6
- export const keyed: boolean;
7
- export const emptyValue: string;
8
- export function sanitizeValue({ value }: {
9
- value: any;
10
- }): string;
11
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: string;
9
+ export function sanitizeValue({ value }: {
10
+ value: any;
11
+ }): string;
12
+ export function create(options?: {}): {};
13
+ }
12
14
  }
13
15
  export default Textarea;
14
16
  declare const type: "textarea";
@@ -1,14 +1,16 @@
1
1
  declare function Textfield(props: any): import("preact").JSX.Element;
2
2
  declare namespace Textfield {
3
- export function create(options?: {}): {};
4
- export { type };
5
- export const label: string;
6
- export const keyed: boolean;
7
- export const emptyValue: string;
8
- export function sanitizeValue({ value }: {
9
- value: any;
10
- }): string;
11
- export const group: string;
3
+ namespace config {
4
+ export { type };
5
+ export const keyed: boolean;
6
+ export const label: string;
7
+ export const group: string;
8
+ export const emptyValue: string;
9
+ export function sanitizeValue({ value }: {
10
+ value: any;
11
+ }): string;
12
+ export function create(options?: {}): {};
13
+ }
12
14
  }
13
15
  export default Textfield;
14
16
  declare const type: "textfield";
@@ -1,36 +1,36 @@
1
- import { Injector } from 'didi';
2
-
3
- export type Module = any;
4
- export type Schema = any;
5
-
6
- export interface Data {
7
- [x: string]: any;
8
- }
9
-
10
- export interface Errors {
11
- [x: string]: string[];
12
- }
13
-
14
- export type FormProperty = ('readOnly' | string);
15
- export type FormEvent = ('submit' | 'changed' | string);
16
-
17
- export interface FormProperties {
18
- [x: string]: any;
19
- }
20
-
21
- export interface FormOptions {
22
- additionalModules?: Module[];
23
- container?: Element | null | string;
24
- injector?: Injector;
25
- modules?: Module[];
26
- properties?: FormProperties;
27
- }
28
-
29
- export interface CreateFormOptions extends FormOptions {
30
- data?: Data;
31
- schema: Schema;
32
- }
33
-
34
- export {
35
- Injector
1
+ import { Injector } from 'didi';
2
+
3
+ export type Module = any;
4
+ export type Schema = any;
5
+
6
+ export interface Data {
7
+ [x: string]: any;
8
+ }
9
+
10
+ export interface Errors {
11
+ [x: string]: string[];
12
+ }
13
+
14
+ export type FormProperty = ('readOnly' | string);
15
+ export type FormEvent = ('submit' | 'changed' | string);
16
+
17
+ export interface FormProperties {
18
+ [x: string]: any;
19
+ }
20
+
21
+ export interface FormOptions {
22
+ additionalModules?: Module[];
23
+ container?: Element | null | string;
24
+ injector?: Injector;
25
+ modules?: Module[];
26
+ properties?: FormProperties;
27
+ }
28
+
29
+ export interface CreateFormOptions extends FormOptions {
30
+ data?: Data;
31
+ schema: Schema;
32
+ }
33
+
34
+ export {
35
+ Injector
36
36
  };
@@ -19,8 +19,9 @@ export function clone<T>(data: T, replacer?: (this: any, key: string, value: any
19
19
  *
20
20
  * @return {string[]}
21
21
  */
22
- export function getSchemaVariables(schema: any, expressionLanguage?: FeelExpressionLanguage): string[];
22
+ export function getSchemaVariables(schema: any, expressionLanguage?: FeelExpressionLanguage, templating?: FeelersTemplating): string[];
23
23
  export * from "./constants";
24
24
  export * from "./injector";
25
25
  export * from "./form";
26
26
  import FeelExpressionLanguage from '../features/expression-language/FeelExpressionLanguage.js';
27
+ import FeelersTemplating from '../features/expression-language/FeelersTemplating.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-viewer",
3
- "version": "0.14.0",
3
+ "version": "0.15.0-alpha.0",
4
4
  "description": "View forms - powered by bpmn.io",
5
5
  "exports": {
6
6
  ".": {
@@ -60,5 +60,6 @@
60
60
  ],
61
61
  "files": [
62
62
  "dist"
63
- ]
63
+ ],
64
+ "gitHead": "205275d1b314a512e662758999cd6667894c3695"
64
65
  }