@bpmn-io/form-js-viewer 0.10.0-alpha.0 → 0.10.0-alpha.2

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.
@@ -119,6 +119,10 @@ export default class Form {
119
119
  * @internal
120
120
  */
121
121
  _getSubmitData(): any;
122
+ /**
123
+ * @internal
124
+ */
125
+ _applyConditions(toFilter: any, data: any): any;
122
126
  }
123
127
  export type Injector = import('./types').Injector;
124
128
  export type Data = import('./types').Data;
@@ -0,0 +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
+ };
@@ -7,10 +7,12 @@ declare namespace _default {
7
7
  formFields: (string | typeof import("../render").FormFields)[];
8
8
  renderer: (string | typeof import("../render/Renderer").default)[];
9
9
  })[];
10
+ const conditionChecker: (string | typeof ConditionChecker)[];
10
11
  const eventBus: any[];
11
12
  const formFieldRegistry: (string | typeof FormFieldRegistry)[];
12
13
  const validator: (string | typeof Validator)[];
13
14
  }
14
15
  export default _default;
15
16
  import FormFieldRegistry from "./FormFieldRegistry";
17
+ import { ConditionChecker } from "./ConditionChecker";
16
18
  import Validator from "./Validator";
@@ -33,9 +33,9 @@ declare class Importer {
33
33
  /**
34
34
  * @param {Object} data
35
35
  *
36
- * @return {Object} importedData
36
+ * @return {Object} initializedData
37
37
  */
38
- importData(data: any): any;
38
+ initializeFieldValues(data: any): any;
39
39
  }
40
40
  declare namespace Importer {
41
41
  const $inject: string[];
@@ -5,3 +5,4 @@
5
5
  * @return {string}
6
6
  */
7
7
  export function sanitizeHTML(html: string): string;
8
+ export function sanitizeImageSource(src: any): any;
@@ -5,5 +5,15 @@ export function formFieldClasses(type: any, { errors, disabled }?: {
5
5
  export function prefixId(id: any, formId: any): string;
6
6
  export function markdownToHTML(markdown: any): any;
7
7
  export function safeMarkdown(markdown: any): string;
8
+ /**
9
+ * Sanitizes an image source to ensure we only allow for data URI and links
10
+ * that start with http(s).
11
+ *
12
+ * Note: Most browsers anyway do not support script execution in <img> elements.
13
+ *
14
+ * @param {string} src
15
+ * @returns {string}
16
+ */
17
+ export function safeImageSource(src: string): string;
8
18
  export function sanitizeSingleSelectValue(options: any): any;
9
19
  export function sanitizeMultiSelectValue(options: any): any;
@@ -0,0 +1,8 @@
1
+ declare function Image(props: any): import("preact").JSX.Element;
2
+ declare namespace Image {
3
+ export function create(options?: {}): {};
4
+ export { type };
5
+ export const keyed: boolean;
6
+ }
7
+ export default Image;
8
+ declare const type: "image";
@@ -1,13 +1,14 @@
1
- declare function Number(props: any): import("preact").JSX.Element;
2
- declare namespace Number {
1
+ declare function Numberfield(props: any): import("preact").JSX.Element;
2
+ declare namespace Numberfield {
3
3
  export function create(options?: {}): {};
4
- export function sanitizeValue({ value }: {
4
+ export function sanitizeValue({ value, formField }: {
5
5
  value: any;
6
- }): number;
6
+ formField: any;
7
+ }): any;
7
8
  export { type };
8
9
  export const keyed: boolean;
9
10
  export const label: string;
10
11
  export const emptyValue: any;
11
12
  }
12
- export default Number;
13
+ export default Numberfield;
13
14
  declare const type: "number";
@@ -1,14 +1,15 @@
1
- export const formFields: (typeof Button | typeof Default | typeof Radio | typeof Text)[];
1
+ export const formFields: (typeof Image)[];
2
2
  import Button from "./form-fields/Button";
3
3
  import Checkbox from "./form-fields/Checkbox";
4
4
  import Checklist from "./form-fields/Checklist";
5
5
  import Default from "./form-fields/Default";
6
6
  import FormComponent from "./FormComponent";
7
- import Number from "./form-fields/Number";
7
+ import Image from "./form-fields/Image";
8
+ import Numberfield from "./form-fields/Number";
8
9
  import Radio from "./form-fields/Radio";
9
10
  import Select from "./form-fields/Select";
10
11
  import Taglist from "./form-fields/Taglist";
11
12
  import Text from "./form-fields/Text";
12
13
  import Textfield from "./form-fields/Textfield";
13
14
  import Textarea from "./form-fields/Textarea";
14
- export { Button, Checkbox, Checklist, Default, FormComponent, Number, Radio, Select, Taglist, Text, Textfield, Textarea };
15
+ export { Button, Checkbox, Checklist, Default, FormComponent, Image, Numberfield, Radio, Select, Taglist, Text, Textfield, Textarea };
@@ -0,0 +1,4 @@
1
+ export function countDecimals(number: any): any;
2
+ export function isValidNumber(value: any): boolean;
3
+ export function willKeyProduceValidNumber(key: any, previousValue: any, carretIndex: any, selectionWidth: any, decimalDigits: any): boolean;
4
+ export function isNullEquivalentValue(value: any): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Check if condition is met with given variables.
3
+ *
4
+ * @param {string | undefined} condition
5
+ * @param {import('../../types').Data} data
6
+ *
7
+ * @returns {boolean} true if condition is met or no condition or condition checker exists
8
+ */
9
+ export function useCondition(condition: string | undefined, data: import('../../types').Data): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ * @param {string | undefined} expression
4
+ * @param {import('../../types').Data} data
5
+ */
6
+ export function useEvaluation(expression: string | undefined, data: import('../../types').Data): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ * @param {string} value
4
+ */
5
+ export function useExpressionValue(value: string): any;
File without changes
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Retrieve variable names from given FEEL unary test.
3
+ *
4
+ * @param {string} unaryTest
5
+ * @returns {string[]}
6
+ */
7
+ export function getVariableNames(unaryTest: string): string[];
8
+ /**
9
+ * Retrieve variable names from given FEEL expression.
10
+ *
11
+ * @param {string} expression
12
+ * @returns {string[]}
13
+ */
14
+ export function getExpressionVariableNames(expression: string): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-viewer",
3
- "version": "0.10.0-alpha.0",
3
+ "version": "0.10.0-alpha.2",
4
4
  "description": "View forms - powered by bpmn.io",
5
5
  "exports": {
6
6
  ".": {
@@ -23,7 +23,7 @@
23
23
  "bundle": "rollup -c --failAfterWarnings",
24
24
  "bundle:watch": "rollup -c -w",
25
25
  "dev": "npm test -- --auto-watch --no-single-run",
26
- "generate-types": "tsc --allowJs --skipLibCheck --declaration --emitDeclarationOnly --outDir dist/types src/index.js && cp src/*.d.ts dist/types",
26
+ "generate-types": "tsc --allowJs --skipLibCheck --declaration --emitDeclarationOnly --outDir dist/types src/index.js && copyfiles src/*.d.ts dist/types",
27
27
  "test": "karma start",
28
28
  "prepublishOnly": "npm run build"
29
29
  },
@@ -39,8 +39,10 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@bpmn-io/snarkdown": "^2.1.0",
42
+ "big.js": "^6.2.1",
42
43
  "classnames": "^2.3.1",
43
44
  "didi": "^9.0.0",
45
+ "feelin": "^0.41.0",
44
46
  "ids": "^1.0.0",
45
47
  "min-dash": "^4.0.0",
46
48
  "preact": "^10.5.14",
@@ -52,5 +54,5 @@
52
54
  "files": [
53
55
  "dist"
54
56
  ],
55
- "gitHead": "ac7ce2105fc1c982d1da45d4f863c8999d9d736e"
57
+ "gitHead": "df68b02bb080ad816ad17f8c629650f118e266bd"
56
58
  }