@factorialco/fcode-react-forms 3.6.0 → 3.7.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.
- package/dist/components/fcode-form/fcode-form.d.ts +5 -2
- package/dist/components/json-schema-form/fcode-json-schema-form.d.ts +5 -0
- package/dist/components/json-schema-form/fcode-json-schema-form.test.d.ts +1 -0
- package/dist/components/json-schema-form/flat-const-options.d.ts +18 -0
- package/dist/components/json-schema-form/flat-const-options.test.d.ts +1 -0
- package/dist/components/json-schema-form/oauth/types.d.ts +14 -0
- package/dist/fcode-form.cjs.js +69 -69
- package/dist/fcode-form.cjs.js.map +1 -1
- package/dist/fcode-form.es.js +8659 -8527
- package/dist/fcode-form.es.js.map +1 -1
- package/dist/fcode-form.umd.js +69 -69
- package/dist/fcode-form.umd.js.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/utils/kept-files.d.ts +35 -0
- package/dist/utils/kept-files.test.d.ts +1 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -145,7 +145,13 @@ export interface TransportFetchSchemaResult {
|
|
|
145
145
|
}
|
|
146
146
|
export interface TransportSubmitParams {
|
|
147
147
|
processId: string;
|
|
148
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Plain JSON, except for files: a file field with a grant already holds its
|
|
150
|
+
* storage path; without one it holds the file's `data:` URL or, for a file
|
|
151
|
+
* above 50 MiB, the browser's `File` (base64 of a file near 1 GB is longer
|
|
152
|
+
* than the browser can hold). A transport uploads that `File` or fails; it
|
|
153
|
+
* must never serialize it, since in JSON it becomes `{}`.
|
|
154
|
+
*/
|
|
149
155
|
formData: FormData;
|
|
150
156
|
locale?: string;
|
|
151
157
|
async?: boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FormData as YepFormData } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Large files a form holds aside instead of reading them into a `data:` URL.
|
|
4
|
+
*
|
|
5
|
+
* Base64 of a file near 1 GB is longer than the longest string a browser can
|
|
6
|
+
* hold, so a file widget cannot store one as the field's value. It hands the
|
|
7
|
+
* `File` to `keep` instead and stores the placeholder it gets back: a `data:`
|
|
8
|
+
* URL with no content and a `fcode-kept` parameter naming the entry. That
|
|
9
|
+
* string is the field's value for every reader the form has — validation,
|
|
10
|
+
* conditional schemas, a remounted step, a JSON copy — so none of them needs
|
|
11
|
+
* to know about it. `restoreKeptFiles` swaps the `File` back in right before
|
|
12
|
+
* the submit, the one place that sends the content.
|
|
13
|
+
*/
|
|
14
|
+
export interface KeptFiles {
|
|
15
|
+
/** Holds `file` and returns the placeholder to store as the field's value. */
|
|
16
|
+
keep: (file: File) => string;
|
|
17
|
+
/** The `File` behind a placeholder; `undefined` for any other value. */
|
|
18
|
+
get: (value: unknown) => File | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** The entry a placeholder names, or `undefined` when `value` is not one. */
|
|
21
|
+
export declare const keptFileId: (value: unknown) => string | undefined;
|
|
22
|
+
/** One form's kept files. Entries live as long as the form. */
|
|
23
|
+
export declare const createKeptFiles: () => KeptFiles;
|
|
24
|
+
/** Thrown when a placeholder names no file the form holds. */
|
|
25
|
+
export declare class KeptFileMissingError extends Error {
|
|
26
|
+
readonly field: string;
|
|
27
|
+
constructor(field: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* `formData` with each top-level placeholder replaced by its `File`, which
|
|
31
|
+
* the submit paths lift out as it is. A placeholder this form does not hold,
|
|
32
|
+
* or one nested in an object or array (no submit path lifts those out),
|
|
33
|
+
* throws: sending it would deliver an empty file as if it were the user's.
|
|
34
|
+
*/
|
|
35
|
+
export declare const restoreKeptFiles: (formData: YepFormData, kept: KeptFiles) => YepFormData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/fcode-react-forms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.1",
|
|
4
4
|
"description": "Factorial Code allows start process executions from any webpage embedding process input parameters forms. This allows each form submission to start one execution with the information filled in the form, and also allows to manage the execution result into that webpage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://code.factorialhr.com/docs/forms/",
|