@bpmn-io/form-js-viewer 0.13.1 → 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.
@@ -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;
@@ -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.13.1",
3
+ "version": "0.14.1",
4
4
  "description": "View forms - powered by bpmn.io",
5
5
  "exports": {
6
6
  ".": {
@@ -61,5 +61,5 @@
61
61
  "files": [
62
62
  "dist"
63
63
  ],
64
- "gitHead": "0b139786808d65c52aa030be7b9ae26abda34fde"
64
+ "gitHead": "a9ad771bc8f87d2fc428bd5bd1429b96bb03fe7a"
65
65
  }