@bpmn-io/form-js-viewer 1.11.0 → 1.11.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.
@@ -55,11 +55,12 @@ export class Form {
55
55
  /**
56
56
  * Submit the form, triggering all field validations.
57
57
  *
58
- * @returns { { data: Data, errors: Errors } }
58
+ * @returns { { data: Data, errors: Errors, files: Map<string, File[]> } }
59
59
  */
60
60
  submit(): {
61
61
  data: Data;
62
62
  errors: Errors;
63
+ files: Map<string, File[]>;
63
64
  };
64
65
  reset(): void;
65
66
  /**
@@ -4,8 +4,9 @@ export class FormFieldInstanceRegistry {
4
4
  _formFieldRegistry: any;
5
5
  _formFields: any;
6
6
  _formFieldInstances: {};
7
- add(instance: any): string;
8
- remove(instanceId: any): void;
7
+ syncInstance(instanceId: any, formFieldInfo: any): any;
8
+ cleanupInstance(instanceId: any): void;
9
+ get(instanceId: any): any;
9
10
  getAll(): any[];
10
11
  getAllKeyed(): any[];
11
12
  clear(): void;
@@ -3,6 +3,7 @@ export namespace CoreModule {
3
3
  __init__: string[];
4
4
  formFields: (string | typeof import("../render").FormFields)[];
5
5
  renderer: (string | typeof import("../render/Renderer").Renderer)[];
6
+ fileRegistry: (string | typeof import("../render/FileRegistry").FileRegistry)[];
6
7
  }[];
7
8
  let eventBus: (string | typeof EventBus)[];
8
9
  let importer: (string | typeof Importer)[];
@@ -1,9 +1,14 @@
1
1
  export class RepeatRenderManager {
2
- constructor(form: any, formFields: any, formFieldRegistry: any, pathRegistry: any);
2
+ constructor(form: any, formFields: any, formFieldRegistry: any, pathRegistry: any, eventBus: any);
3
3
  _form: any;
4
- _formFields: any;
5
- _formFieldRegistry: any;
6
- _pathRegistry: any;
4
+ /** @type {import('../../render/FormFields').FormFields} */
5
+ _formFields: import('../../render/FormFields').FormFields;
6
+ /** @type {import('../../core/FormFieldRegistry').FormFieldRegistry} */
7
+ _formFieldRegistry: import('../../core/FormFieldRegistry').FormFieldRegistry;
8
+ /** @type {import('../../core/PathRegistry').PathRegistry} */
9
+ _pathRegistry: import('../../core/PathRegistry').PathRegistry;
10
+ /** @type {import('../../core/EventBus').EventBus} */
11
+ _eventBus: import('../../core/EventBus').EventBus;
7
12
  Repeater(props: any): import("preact").JSX.Element;
8
13
  RepeatFooter(props: any): import("preact").JSX.Element;
9
14
  /**
@@ -0,0 +1,52 @@
1
+ export class FileRegistry {
2
+ /**
3
+ * @param {import('../core/EventBus').EventBus} eventBus
4
+ * @param {import('../core/FormFieldRegistry').FormFieldRegistry} formFieldRegistry
5
+ * @param {import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry} formFieldInstanceRegistry
6
+ */
7
+ constructor(eventBus: import('../core/EventBus').EventBus, formFieldRegistry: import('../core/FormFieldRegistry').FormFieldRegistry, formFieldInstanceRegistry: import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry);
8
+ /**
9
+ * @param {string} id
10
+ * @param {File[]} files
11
+ */
12
+ setFiles(id: string, files: File[]): void;
13
+ /**
14
+ * @param {string} id
15
+ * @returns {File[]}
16
+ */
17
+ getFiles(id: string): File[];
18
+ /**
19
+ * @returns {string[]}
20
+ */
21
+ getKeys(): string[];
22
+ /**
23
+ * @param {string} id
24
+ * @returns {boolean}
25
+ */
26
+ hasKey(id: string): boolean;
27
+ /**
28
+ * @param {string} id
29
+ */
30
+ deleteFiles(id: string): void;
31
+ /**
32
+ * @returns {Map<string, File[]>}
33
+ */
34
+ getAllFiles(): Map<string, File[]>;
35
+ clear(): void;
36
+ /** @type {Map<string, File[]>} */
37
+ [fileRegistry]: Map<string, File[]>;
38
+ /** @type {import('../core/EventBus').EventBus} */
39
+ [eventBusSymbol]: import('../core/EventBus').EventBus;
40
+ /** @type {import('../core/FormFieldRegistry').FormFieldRegistry} */
41
+ [formFieldRegistrySymbol]: import('../core/FormFieldRegistry').FormFieldRegistry;
42
+ /** @type {import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry} */
43
+ [formFieldInstanceRegistrySymbol]: import('../core/FormFieldInstanceRegistry').FormFieldInstanceRegistry;
44
+ }
45
+ export namespace FileRegistry {
46
+ let $inject: string[];
47
+ }
48
+ declare const fileRegistry: unique symbol;
49
+ declare const eventBusSymbol: unique symbol;
50
+ declare const formFieldRegistrySymbol: unique symbol;
51
+ declare const formFieldInstanceRegistrySymbol: unique symbol;
52
+ export {};
@@ -10,7 +10,8 @@
10
10
  * @property {string} field.id
11
11
  * @property {string} [field.label]
12
12
  * @property {string} [field.accept]
13
- * @property {boolean} [field.multiple]
13
+ * @property {string|boolean} [field.multiple]
14
+ * @property {string} [value]
14
15
  *
15
16
  * @param {Props} props
16
17
  * @returns {import("preact").JSX.Element}
@@ -23,9 +24,6 @@ export namespace FilePicker {
23
24
  let label: string;
24
25
  let group: string;
25
26
  let emptyValue: any;
26
- function sanitizeValue({ value }: {
27
- value: any;
28
- }): any;
29
27
  function create(options?: {}): {};
30
28
  }
31
29
  }
@@ -42,6 +40,7 @@ export type Props = {
42
40
  id: string;
43
41
  label?: string;
44
42
  accept?: string;
45
- multiple?: boolean;
43
+ multiple?: string | boolean;
46
44
  };
45
+ value?: string;
47
46
  };
@@ -4,6 +4,7 @@ export { useSecurityAttributesMap } from "./useSecurityAttributesMap";
4
4
  export { useGetLabelCorrelation } from "./useGetLabelCorrelation";
5
5
  export { useScrollIntoView } from "./useScrollIntoView";
6
6
  export { useExpressionEvaluation } from "./useExpressionEvaluation";
7
+ export { useBooleanExpressionEvaluation } from "./useBooleanExpressionEvaluation";
7
8
  export { useFilteredFormData } from "./useFilteredFormData";
8
9
  export { useKeyDownAction } from "./useKeyDownAction";
9
10
  export { useReadonly } from "./useReadonly";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * If the value is a valid expression, we evaluate it. Otherwise, we continue with the value as-is.
3
+ * If the resulting value isn't a boolean, we return 'false'
4
+ * The function is memoized to minimize re-renders.
5
+ *
6
+ * @param {boolean | string} value - A static boolean or expression to evaluate.
7
+ * @returns {boolean} - Evaluated boolean result.
8
+ */
9
+ export function useBooleanExpressionEvaluation(value: boolean | string): boolean;
@@ -1,9 +1,8 @@
1
1
  /**
2
- * Evaluate a string reactively based on the expressionLanguage and form data.
3
- * If the string is not an expression, it is returned as is.
2
+ * If the value is a valid expression, it is evaluated and returned. Otherwise, it is returned as-is.
4
3
  * The function is memoized to minimize re-renders.
5
4
  *
6
- * @param {string} value - The string to evaluate.
5
+ * @param {any} value - A static value or expression to evaluate.
7
6
  * @returns {any} - Evaluated value or the original value if not an expression.
8
7
  */
9
- export function useExpressionEvaluation(value: string): any;
8
+ export function useExpressionEvaluation(value: any): any;
@@ -1 +1,7 @@
1
- export function useService(type: any, strict: any): any;
1
+ /**
2
+ * @template T
3
+ * @param {string} type
4
+ * @param {boolean} [strict=true]
5
+ * @returns {T | null}
6
+ */
7
+ export function useService<T>(type: string, strict?: boolean): T;
@@ -5,7 +5,9 @@ export namespace RenderModule {
5
5
  let __init__: string[];
6
6
  let formFields: (string | typeof FormFields)[];
7
7
  let renderer: (string | typeof Renderer)[];
8
+ let fileRegistry: (string | typeof FileRegistry)[];
8
9
  }
9
10
  import { FormFields } from './FormFields';
10
11
  import { Renderer } from './Renderer';
12
+ import { FileRegistry } from './FileRegistry';
11
13
  export { useExpressionEvaluation, useSingleLineTemplateEvaluation, useTemplateEvaluation } from "./hooks";
@@ -0,0 +1 @@
1
+ export const FILE_PICKER_FILE_KEY_PREFIX: "files::";
@@ -6,12 +6,11 @@
6
6
  */
7
7
  export function buildExpressionContext(context: any): any;
8
8
  /**
9
- * Evaluate a string based on the expressionLanguage and context information.
10
- * If the string is not an expression, it is returned as is.
9
+ * If the value is a valid expression, it is evaluated and returned. Otherwise, it is returned as-is.
11
10
  *
12
11
  * @param {any} expressionLanguage - The expression language to use.
13
- * @param {string} value - The string to evaluate.
12
+ * @param {any} value - The static value or expression to evaluate.
14
13
  * @param {Object} expressionContextInfo - The context information to use.
15
14
  * @returns {any} - Evaluated value or the original value if not an expression.
16
15
  */
17
- export function runExpressionEvaluation(expressionLanguage: any, value: string, expressionContextInfo: any): any;
16
+ export function runExpressionEvaluation(expressionLanguage: any, value: any, expressionContextInfo: any): any;
@@ -0,0 +1,7 @@
1
+ export type RemovedData = Record<PropertyKey, unknown>;
2
+ /**
3
+ * @typedef {Record<PropertyKey, unknown>} RemovedData
4
+ * @param {RemovedData} removedData
5
+ * @returns {string[]}
6
+ */
7
+ export function extractFileReferencesFromRemovedData(removedData: RemovedData): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-viewer",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "View forms - powered by bpmn.io",
5
5
  "exports": {
6
6
  ".": {
@@ -66,5 +66,5 @@
66
66
  "files": [
67
67
  "dist"
68
68
  ],
69
- "gitHead": "d1731fe95e832b1408564d14dc6d4a139a6a90ab"
69
+ "gitHead": "fa5965e45151907b42d679b38b466efa526b1a7b"
70
70
  }