@factorialco/fcode-react-forms 3.5.0 → 3.7.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/dist/components/fcode-form/fcode-form.d.ts +13 -3
- package/dist/components/fcode-form/fcode-form.flow-render.test.d.ts +1 -0
- package/dist/components/fcode-form/fcode-form.flow.d.ts +66 -0
- package/dist/components/fcode-form/fcode-form.flow.test.d.ts +1 -0
- package/dist/components/form-skeleton/form-skeleton.d.ts +2 -2
- package/dist/components/json-schema-form/fcode-json-schema-form.d.ts +8 -2
- package/dist/components/json-schema-form/multistep/flow-navigation.d.ts +28 -0
- package/dist/components/json-schema-form/multistep/flow-page.d.ts +16 -0
- package/dist/components/json-schema-form/multistep/index.d.ts +2 -1
- package/dist/components/json-schema-form/multistep/leave-guard.d.ts +24 -0
- package/dist/components/json-schema-form/multistep/multistep-controller.d.ts +8 -9
- package/dist/components/json-schema-form/multistep/parse-steps.d.ts +2 -1
- package/dist/components/json-schema-form/multistep/step-actions.d.ts +30 -0
- package/dist/components/json-schema-form/multistep/types.d.ts +102 -6
- package/dist/components/json-schema-form/oauth/types.d.ts +14 -0
- package/dist/fcode-form.cjs.js +71 -71
- package/dist/fcode-form.cjs.js.map +1 -1
- package/dist/fcode-form.es.js +9262 -8806
- package/dist/fcode-form.es.js.map +1 -1
- package/dist/fcode-form.umd.js +82 -82
- package/dist/fcode-form.umd.js.map +1 -1
- package/dist/services/fcode.d.ts +1 -0
- package/dist/styles.css +28 -0
- package/dist/types.d.ts +14 -2
- 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/services/fcode.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SubmitFormParams, SubmitFormResponse, FetchFormSpecsParams, FormData as YepFormData } from '../types';
|
|
2
|
+
export declare const FORM_NOT_AVAILABLE_MESSAGE = "Process form specs couldn't be loaded: the form does not exist, is not enabled, or needs a Factorial token this request did not carry or that was not accepted. Review documentation at https://code.factorialhr.com/docs/forms/";
|
|
2
3
|
export declare const fetchFormSpecs: ({ hostUrl, headers, team, processId, processVersion, locale, cache, }: FetchFormSpecsParams) => Promise<any>;
|
|
3
4
|
type ExtractedFile = {
|
|
4
5
|
key: string;
|
package/dist/styles.css
CHANGED
|
@@ -1730,6 +1730,30 @@ input[type='number'] {
|
|
|
1730
1730
|
color: var(--ycf-base-text-color);
|
|
1731
1731
|
}
|
|
1732
1732
|
|
|
1733
|
+
/* The confirmation's overlay layout is inline (leave-guard.tsx); only its text is styled here. */
|
|
1734
|
+
.fcode-steps-leave-title {
|
|
1735
|
+
margin: 0 0 0.5rem;
|
|
1736
|
+
font-size: 1.125rem;
|
|
1737
|
+
font-weight: 600;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
.fcode-steps-leave-message {
|
|
1741
|
+
margin: 0 0 1.5rem;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
.fcode-steps-item.is-substep {
|
|
1745
|
+
padding-left: 1.5rem;
|
|
1746
|
+
font-size: 0.875rem;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
.fcode-steps-layout-tabs .fcode-steps-item.is-substep {
|
|
1750
|
+
padding-left: 0.5rem;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.fcode-steps-item.is-skipped .fcode-steps-item-title {
|
|
1754
|
+
text-decoration: line-through;
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1733
1757
|
.fcode-steps-item.is-current {
|
|
1734
1758
|
color: var(--ycf-base-text-color);
|
|
1735
1759
|
font-weight: 500;
|
|
@@ -1808,5 +1832,9 @@ input[type='number'] {
|
|
|
1808
1832
|
.fcode-form .fcode-steps-actions {
|
|
1809
1833
|
display: flex;
|
|
1810
1834
|
align-items: center;
|
|
1835
|
+
justify-content: flex-end;
|
|
1811
1836
|
gap: 0.75rem;
|
|
1837
|
+
margin-top: 1.5rem;
|
|
1838
|
+
padding-top: 1rem;
|
|
1839
|
+
border-top: 1px solid var(--ycf-base-border-color);
|
|
1812
1840
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -32,12 +32,18 @@ export interface EmbedFormOptions {
|
|
|
32
32
|
stylesheetBaseUrl?: string;
|
|
33
33
|
className?: string;
|
|
34
34
|
loadingOverlayDisabled?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Message shown under the spinner while the form is submitting. Unset by
|
|
37
|
+
* default, so the spinner shows on its own: the SDK has no translations of
|
|
38
|
+
* its own, and a fixed English default reached users of every locale. Can
|
|
39
|
+
* come from the schema, where `fcode.i18n("key")` translates it.
|
|
40
|
+
*/
|
|
35
41
|
loadingOverlayContent?: string;
|
|
36
42
|
/**
|
|
37
43
|
* Message shown while the form schema is loading (e.g. while a
|
|
38
44
|
* `preRenderProcess` runs). Must be set by the embedder — unlike the other
|
|
39
45
|
* options it cannot come from the schema, since the schema is what is being
|
|
40
|
-
* loaded.
|
|
46
|
+
* loaded. Unset by default: the skeleton and spinner show on their own.
|
|
41
47
|
*/
|
|
42
48
|
loadingContent?: string;
|
|
43
49
|
/**
|
|
@@ -139,7 +145,13 @@ export interface TransportFetchSchemaResult {
|
|
|
139
145
|
}
|
|
140
146
|
export interface TransportSubmitParams {
|
|
141
147
|
processId: string;
|
|
142
|
-
/**
|
|
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
|
+
*/
|
|
143
155
|
formData: FormData;
|
|
144
156
|
locale?: string;
|
|
145
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.0",
|
|
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/",
|