@bpmn-io/form-js-viewer 0.14.0 → 0.14.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.
@@ -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
  } | {
@@ -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;
@@ -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.14.1",
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": "a9ad771bc8f87d2fc428bd5bd1429b96bb03fe7a"
64
65
  }