@bpmn-io/form-js-viewer 1.19.0 → 1.21.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.
- package/README.md +31 -0
- package/dist/index.cjs +186 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +186 -52
- package/dist/index.es.js.map +1 -1
- package/dist/types/core/Validator.d.ts +1 -0
- package/dist/types/features/expressionLanguage/ConditionChecker.d.ts +12 -1
- package/dist/types/features/expressionLanguage/FeelExpressionLanguage.d.ts +9 -0
- package/dist/types/render/components/form-fields/DocumentPreview.d.ts +4 -2
- package/dist/types/render/hooks/index.d.ts +1 -0
- package/dist/types/render/hooks/useCondition.d.ts +3 -3
- package/dist/types/render/hooks/useUnaryTestEvaluation.d.ts +8 -0
- package/dist/types/types.d.ts +17 -0
- package/dist/types/util/expressions.d.ts +12 -2
- package/dist/types/util/getSchemaVariables.d.ts +8 -4
- package/package.json +3 -3
|
@@ -1,11 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef { import('../../types').ExpressionLanguage } ExpressionLanguage
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* @typedef {object} Condition
|
|
3
6
|
* @property {string} [hide]
|
|
4
7
|
*/
|
|
5
8
|
export class ConditionChecker {
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param {Object} formFieldRegistry
|
|
11
|
+
* @param {Object} pathRegistry
|
|
12
|
+
* @param {ExpressionLanguage} expressionLanguage
|
|
13
|
+
* @param {Object} eventBus
|
|
14
|
+
*/
|
|
15
|
+
constructor(formFieldRegistry: any, pathRegistry: any, expressionLanguage: ExpressionLanguage, eventBus: any);
|
|
7
16
|
_formFieldRegistry: any;
|
|
8
17
|
_pathRegistry: any;
|
|
18
|
+
_expressionLanguage: import("../../types").ExpressionLanguage;
|
|
9
19
|
_eventBus: any;
|
|
10
20
|
/**
|
|
11
21
|
* For given data, remove properties based on condition.
|
|
@@ -52,6 +62,7 @@ export class ConditionChecker {
|
|
|
52
62
|
export namespace ConditionChecker {
|
|
53
63
|
let $inject: string[];
|
|
54
64
|
}
|
|
65
|
+
export type ExpressionLanguage = import("../../types").ExpressionLanguage;
|
|
55
66
|
export type Condition = {
|
|
56
67
|
hide?: string;
|
|
57
68
|
};
|
|
@@ -30,6 +30,15 @@ export class FeelExpressionLanguage {
|
|
|
30
30
|
* @returns {any}
|
|
31
31
|
*/
|
|
32
32
|
evaluate(expression: string, data?: import("../../types").Data): any;
|
|
33
|
+
/**
|
|
34
|
+
* Evaluate a unary test expression. Returns null for invalid/missing expressions.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} expression
|
|
37
|
+
* @param {import('../../types').Data} [data]
|
|
38
|
+
*
|
|
39
|
+
* @returns {boolean|null}
|
|
40
|
+
*/
|
|
41
|
+
evaluateUnaryTest(expression: string, data?: import("../../types").Data): boolean | null;
|
|
33
42
|
}
|
|
34
43
|
export namespace FeelExpressionLanguage {
|
|
35
44
|
let $inject: string[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef DocumentEndpointBuilder
|
|
3
|
-
* @property {(document: DocumentMetadata) => string} buildUrl
|
|
3
|
+
* @property {(document: DocumentMetadata) => string} [buildUrl]
|
|
4
|
+
* @property {(document: DocumentMetadata) => RequestInit|undefined} [buildRequestInit]
|
|
4
5
|
*/
|
|
5
6
|
/**
|
|
6
7
|
* @typedef DocumentMetadata
|
|
@@ -37,7 +38,8 @@ export namespace DocumentPreview {
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
export type DocumentEndpointBuilder = {
|
|
40
|
-
buildUrl
|
|
41
|
+
buildUrl?: (document: DocumentMetadata) => string;
|
|
42
|
+
buildRequestInit?: (document: DocumentMetadata) => RequestInit | undefined;
|
|
41
43
|
};
|
|
42
44
|
export type DocumentMetadata = {
|
|
43
45
|
documentId: string;
|
|
@@ -5,6 +5,7 @@ export { useGetLabelCorrelation } from "./useGetLabelCorrelation";
|
|
|
5
5
|
export { useScrollIntoView } from "./useScrollIntoView";
|
|
6
6
|
export { useExpressionEvaluation } from "./useExpressionEvaluation";
|
|
7
7
|
export { useBooleanExpressionEvaluation } from "./useBooleanExpressionEvaluation";
|
|
8
|
+
export { useUnaryTestEvaluation } from "./useUnaryTestEvaluation";
|
|
8
9
|
export { useFilteredFormData } from "./useFilteredFormData";
|
|
9
10
|
export { useKeyDownAction } from "./useKeyDownAction";
|
|
10
11
|
export { useReadonly } from "./useReadonly";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Evaluate if condition is met reactively based on the
|
|
2
|
+
* Evaluate if condition is met reactively based on the expression language and form data.
|
|
3
3
|
*
|
|
4
4
|
* @param {string | undefined} condition
|
|
5
5
|
*
|
|
6
|
-
* @returns {boolean} true if condition is met
|
|
6
|
+
* @returns {boolean | null} true if condition is met, false if not, null if no condition or expression language
|
|
7
7
|
*/
|
|
8
|
-
export function useCondition(condition: string | undefined): boolean;
|
|
8
|
+
export function useCondition(condition: string | undefined): boolean | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluate a unary test expression reactively. Returns null for invalid/missing expressions.
|
|
3
|
+
* The function is memoized to minimize re-renders.
|
|
4
|
+
*
|
|
5
|
+
* @param {string | undefined} value - A unary test expression to evaluate.
|
|
6
|
+
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
7
|
+
*/
|
|
8
|
+
export function useUnaryTestEvaluation(value: string | undefined): boolean | null;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,6 +11,23 @@ export interface Errors {
|
|
|
11
11
|
[x: string]: string[];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface ExpressionLanguage {
|
|
15
|
+
isExpression(value: any): boolean;
|
|
16
|
+
getVariableNames(expression: string, options?: { type?: string }): string[];
|
|
17
|
+
evaluate(expression: string, data?: Data): any;
|
|
18
|
+
evaluateUnaryTest(expression: string, data?: Data): boolean | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface Templating {
|
|
22
|
+
isTemplate(value: any): boolean;
|
|
23
|
+
getVariableNames(template: string): string[];
|
|
24
|
+
evaluate(
|
|
25
|
+
template: string,
|
|
26
|
+
context: Data,
|
|
27
|
+
options?: { debug?: boolean; strict?: boolean; buildDebugString?: Function; sanitizer?: Function },
|
|
28
|
+
): any;
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
export type FormProperty = 'readOnly' | 'disabled' | string;
|
|
15
32
|
export type FormEvent = 'submit' | 'changed' | string;
|
|
16
33
|
|
|
@@ -8,9 +8,19 @@ export function buildExpressionContext(context: any): any;
|
|
|
8
8
|
/**
|
|
9
9
|
* If the value is a valid expression, it is evaluated and returned. Otherwise, it is returned as-is.
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {import('../types').ExpressionLanguage} expressionLanguage - The expression language to use.
|
|
12
12
|
* @param {any} value - The static value or expression to evaluate.
|
|
13
13
|
* @param {Object} expressionContextInfo - The context information to use.
|
|
14
14
|
* @returns {any} - Evaluated value or the original value if not an expression.
|
|
15
15
|
*/
|
|
16
|
-
export function runExpressionEvaluation(expressionLanguage:
|
|
16
|
+
export function runExpressionEvaluation(expressionLanguage: import("../types").ExpressionLanguage, value: any, expressionContextInfo: any): any;
|
|
17
|
+
/**
|
|
18
|
+
* Evaluate a value as a unary test expression. Returns null for invalid/missing expressions or
|
|
19
|
+
* if the expression language is not available.
|
|
20
|
+
*
|
|
21
|
+
* @param {import('../types').ExpressionLanguage} expressionLanguage - The expression language to use.
|
|
22
|
+
* @param {string} value - The unary test expression to evaluate.
|
|
23
|
+
* @param {Object} expressionContextInfo - The context information to use.
|
|
24
|
+
* @returns {boolean | null} - Evaluated result, or null if expression is invalid/missing.
|
|
25
|
+
*/
|
|
26
|
+
export function runUnaryTestEvaluation(expressionLanguage: import("../types").ExpressionLanguage, value: string, expressionContextInfo: any): boolean | null;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @typedef { import('../types').Schema } Schema
|
|
3
|
+
* @typedef { import('../types').ExpressionLanguage } ExpressionLanguage
|
|
4
|
+
* @typedef { import('../types').Templating } Templating
|
|
3
5
|
*/
|
|
4
6
|
/**
|
|
5
7
|
* Parse the schema for variables a form might make use of.
|
|
@@ -21,8 +23,8 @@
|
|
|
21
23
|
*
|
|
22
24
|
* @param {Schema} schema
|
|
23
25
|
* @param {object} [options]
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
+
* @param {ExpressionLanguage} [options.expressionLanguage]
|
|
27
|
+
* @param {Templating} [options.templating]
|
|
26
28
|
* @param {any} [options.formFields]
|
|
27
29
|
* @param {boolean} [options.inputs=true]
|
|
28
30
|
* @param {boolean} [options.outputs=true]
|
|
@@ -30,10 +32,12 @@
|
|
|
30
32
|
* @return {string[]}
|
|
31
33
|
*/
|
|
32
34
|
export function getSchemaVariables(schema: Schema, options?: {
|
|
33
|
-
expressionLanguage?:
|
|
34
|
-
templating?:
|
|
35
|
+
expressionLanguage?: ExpressionLanguage;
|
|
36
|
+
templating?: Templating;
|
|
35
37
|
formFields?: any;
|
|
36
38
|
inputs?: boolean;
|
|
37
39
|
outputs?: boolean;
|
|
38
40
|
}): string[];
|
|
39
41
|
export type Schema = import("../types").Schema;
|
|
42
|
+
export type ExpressionLanguage = import("../types").ExpressionLanguage;
|
|
43
|
+
export type Templating = import("../types").Templating;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-io/form-js-viewer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "View forms - powered by bpmn.io",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build": "run-p bundle bundle:scss generate-types",
|
|
25
25
|
"start": "SINGLE_START=basic npm run dev",
|
|
26
26
|
"start:groups": "SINGLE_START=groups npm run dev",
|
|
27
|
-
"bundle": "rollup -c --failAfterWarnings
|
|
27
|
+
"bundle": "rollup -c --failAfterWarnings",
|
|
28
28
|
"bundle:scss": "sass --no-source-map --load-path=\"../../node_modules\" assets/index.scss dist/assets/form-js.css",
|
|
29
29
|
"bundle:watch": "run-p bundle:watch-js bundle:watch-scss",
|
|
30
30
|
"bundle:watch-js": "rollup -c -w --bundleConfigAsCjs",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"files": [
|
|
67
67
|
"dist"
|
|
68
68
|
],
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "19daa3fe06157ae0ae52ae27345fc9dc236b61ca"
|
|
70
70
|
}
|