extended-dynamic-forms 0.5.0 → 0.5.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/README.md +266 -10
- package/dist/WizardForm.d.ts +3 -1
- package/dist/components/RJSF611ErrorStateAdapter.d.ts +6 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/templates/FieldErrorTemplate.d.ts +3 -0
- package/dist/conditionals/v2/utils/dynamicArrayItems.d.ts +1 -0
- package/dist/events/FormEventHub.d.ts +5 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +30841 -30465
- package/dist/index.umd.js +1618 -1618
- package/dist/types/index.d.ts +22 -2
- package/dist/utils/nullContractValidator.d.ts +6 -0
- package/dist/utils/submittedData.d.ts +18 -0
- package/dist/utils/transformErrors.d.ts +4 -0
- package/dist/widgets/base/utils.d.ts +1 -1
- package/dist/widgets/index.d.ts +4 -1
- package/dist/widgets/input/HiddenWidget.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install 'react@^18.0.0' 'react-dom@^18.0.0' 'antd@^5.24.0' 'dayjs@^1.11.13'
|
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
React and React DOM 19 are also supported by the peer ranges. Keep their major
|
|
21
|
-
versions aligned. EDF 0.5.
|
|
21
|
+
versions aligned. EDF 0.5.1 bundles RJSF 6.11.0 and the AJV validator;
|
|
22
22
|
you do not need a sibling RJSF checkout. Before upgrading, read the
|
|
23
23
|
[0.5.0 migration guide](docs/migration-0.5.md), including the breaking host-template,
|
|
24
24
|
cleared-value and one-step Wizard contracts.
|
|
@@ -34,6 +34,109 @@ provided; use an ESNext/Bundler-compatible module configuration.
|
|
|
34
34
|
- Per-field options, custom widgets, fields, templates and grid layouts.
|
|
35
35
|
- Field focus, blur and change events, submission hooks and webhook configuration.
|
|
36
36
|
|
|
37
|
+
## Empty values: null contract
|
|
38
|
+
|
|
39
|
+
Clearing Text, Textarea, Email, URL or Telephone emits `null` by default.
|
|
40
|
+
An explicit own `ui:options.emptyValue` overrides this default, including `""` and `undefined`.
|
|
41
|
+
Password, Number (including String Mode), Date, Time and DateTime retain their
|
|
42
|
+
existing clear values.
|
|
43
|
+
|
|
44
|
+
In both `ExtendedForm` and `WizardForm`, AJV validates a copy with null object
|
|
45
|
+
properties omitted, for every schema type. Optional nulls therefore behave like
|
|
46
|
+
absent answers for content constraints, enums, combinators and dependencies.
|
|
47
|
+
Validation-only schema resolution uses that same null-omitted copy before
|
|
48
|
+
expanding dependencies and conditionals. Clearing an optional answer cannot
|
|
49
|
+
activate a presence-based requirement for another field. Live answers, dynamic
|
|
50
|
+
item UI and submission payloads retain the original null.
|
|
51
|
+
Required null properties fail with AJV's normal required error. This applies
|
|
52
|
+
deeply to nested objects and object properties inside array items. Primitive
|
|
53
|
+
array slots are never removed or normalized: their schema must explicitly
|
|
54
|
+
accept null. Host custom validation still receives real null answers and may
|
|
55
|
+
reject them. Null does not refill a schema default.
|
|
56
|
+
|
|
57
|
+
Null survives submission callbacks, Wizard step data and webhook envelopes for
|
|
58
|
+
visible, enabled fields. Hidden or disabled nulls are absent, while their valued
|
|
59
|
+
answers are retained. Receivers must distinguish null (“answered, then cleared”)
|
|
60
|
+
from absence (which can also mean an inactive null). Explicit overrides and other
|
|
61
|
+
widgets retain their own empty-value semantics. The existing envelope shapes do not
|
|
62
|
+
change: ExtendedForm submit envelopes contain the RJSF event under `formData`;
|
|
63
|
+
one-step Wizard submit envelopes contain flat answers, and multi-step Wizard
|
|
64
|
+
submit envelopes contain step data.
|
|
65
|
+
|
|
66
|
+
EDF's null acceptance policy belongs to its validator, not its widgets.
|
|
67
|
+
Native hosts using EDF widgets in their own `@rjsf/core` Form must pass EDF's
|
|
68
|
+
exported `nullContractValidator` to get the same acceptance policy with existing
|
|
69
|
+
string-only schemas. The existing `validator` export remains plain AJV.
|
|
70
|
+
With plain RJSF/AJV, widgets still emit null and a string-only schema rejects it.
|
|
71
|
+
Declaring `type: ["string", "null"]` suffices for simple optional string constraints,
|
|
72
|
+
but does not bypass enums, dependencies or combinators, or make required nulls
|
|
73
|
+
missing. Use `nullContractValidator` for the full contract and keep required
|
|
74
|
+
fields in the parent schema's `required` array. No Formstudio marker is needed.
|
|
75
|
+
|
|
76
|
+
## Submitted data: hidden and disabled fields
|
|
77
|
+
|
|
78
|
+
`ExtendedForm` and `WizardForm` send valued answers unchanged, including hidden
|
|
79
|
+
and disabled fields. Read-only fields also remain answers. The submit callback
|
|
80
|
+
and `afterSubmit` receive optional `meta` alongside `formData` only when at least
|
|
81
|
+
one flag list is non-empty. When emitted, both arrays are present:
|
|
82
|
+
`{ hiddenFields: string[], disabledFields: string[] }`. Unflagged callbacks keep
|
|
83
|
+
their existing shape. The exported `SubmissionMeta` type describes this property.
|
|
84
|
+
|
|
85
|
+
Paths are RFC 6901 JSON Pointers relative to the delivered answers, including
|
|
86
|
+
array indices (`/address/street`, `/items/0/note`). Indices refer to the delivered
|
|
87
|
+
array after inactive-null omission; dynamic UI still evaluates original indices.
|
|
88
|
+
Structured Wizard pointers include the step key. A hidden object is listed once,
|
|
89
|
+
not once per descendant. An inactive object root uses the whole-document pointer `""`.
|
|
90
|
+
Only paths with delivered values are flagged. `hiddenFields` lists effectively
|
|
91
|
+
hidden fields addressed by visibility-capable conditional rule effects, including
|
|
92
|
+
declarative `ui:dynamicItems` rule patches and base-hidden Show targets whose rules
|
|
93
|
+
have not shown them. Only `ui:widget`, `ui:options`, or whole-UI replacements
|
|
94
|
+
establish visibility provenance; only whole-UI replacements cover descendants.
|
|
95
|
+
Static hidden fields that no visibility-capable rule addresses, such as IDs and
|
|
96
|
+
prefills, are sent without a hidden flag.
|
|
97
|
+
`disabledFields` includes static and rule-set disabled fields. A field may occur
|
|
98
|
+
in both lists. Rule order still determines effective state at submit time.
|
|
99
|
+
|
|
100
|
+
Hidden or disabled null values are absent; visible optional null values remain
|
|
101
|
+
null under the empty-value contract. Live answers are not cleared, so re-showing
|
|
102
|
+
a field restores its value. Dynamic item UI receives actual answers and context.
|
|
103
|
+
Traversal follows RJSF-resolved references, `allOf`, schema dependencies and
|
|
104
|
+
additional-property metadata. Declared fields use their own UI; pattern-only
|
|
105
|
+
keys use `uiSchema.additionalProperties`, matching RJSF. Wizard's flat traversal
|
|
106
|
+
is step-scoped, so an inactive step root cannot remove another step's answers.
|
|
107
|
+
|
|
108
|
+
Hidden and disabled fields remain exempt from validation and Wizard navigation
|
|
109
|
+
requirements. Their values are sent as entered, even when invalid. The
|
|
110
|
+
validation-only schema removes inactive names from `required`, array-form
|
|
111
|
+
`dependencies` and `dependentRequired`, and exempts field constraints, including
|
|
112
|
+
matching pattern constraints. Field-scoped custom and host errors are excluded.
|
|
113
|
+
Active fields retain validation; the authored schema remains unchanged. Leaf
|
|
114
|
+
validation schemas are not resolved as rendering schemas: conditional content
|
|
115
|
+
constraints still distinguish an explicit empty string from a supplied value,
|
|
116
|
+
and corrected pattern configurations resume validation without losing answers.
|
|
117
|
+
Array-level `minItems`, `maxItems` and `uniqueItems` validate the live array.
|
|
118
|
+
|
|
119
|
+
`beforeSubmit` receives all valued answers in the component's existing hook shape
|
|
120
|
+
(after inactive nulls are removed). Its returned answers are delivered as returned:
|
|
121
|
+
there is no second filter. Metadata is captured from field state at submit and
|
|
122
|
+
restricted to returned paths; it never removes answers or re-adds keys removed
|
|
123
|
+
by the host. After `beforeSubmit` reorders or removes array items, flags are
|
|
124
|
+
restricted by path, not item identity, so an index can refer to a different item.
|
|
125
|
+
|
|
126
|
+
Submit webhook envelopes carry `meta` as a fixed root key only when a flag list
|
|
127
|
+
is non-empty. Otherwise their existing bytes and component-specific `formData`
|
|
128
|
+
wrappers are unchanged. `body` cannot supply or override `meta`.
|
|
129
|
+
`formDataFields` still selects top-level answers; metadata is restricted to that
|
|
130
|
+
selection, using flat answer pointers for Wizard's selected webhooks.
|
|
131
|
+
Change, focus, blur, stepChange and validationError events carry unfiltered
|
|
132
|
+
answer snapshots and no metadata. Their existing `fieldValue` semantics remain.
|
|
133
|
+
Standalone `FormEventHub` callers remain responsible for their own field state.
|
|
134
|
+
|
|
135
|
+
`includeHiddenStepsInSubmit` retains its existing structured Wizard membership
|
|
136
|
+
policy. Fields belonging to hidden steps are not flagged by this mechanism.
|
|
137
|
+
The flat answer view retains its existing all-step contract. Use structured
|
|
138
|
+
Wizard answers when whole-step exclusion is required.
|
|
139
|
+
|
|
37
140
|
## Basic usage
|
|
38
141
|
|
|
39
142
|
```tsx
|
|
@@ -75,6 +178,10 @@ EDF supplies its widgets and validator by default. Override the RJSF `widgets`,
|
|
|
75
178
|
`customWidgets`, `validator` and commonly used RJSF types are exported from
|
|
76
179
|
`extended-dynamic-forms`; no private subpath import is needed.
|
|
77
180
|
|
|
181
|
+
Both `ExtendedForm` and `WizardForm` accept an omitted `formData` prop. It uses a
|
|
182
|
+
stable empty initial value, and edited answers persist across host re-renders.
|
|
183
|
+
Pass `formData` when your host needs to supply answers explicitly.
|
|
184
|
+
|
|
78
185
|
## Multi-step forms
|
|
79
186
|
|
|
80
187
|
`WizardForm` detects steps from root properties beginning with `STEP_`. Define at
|
|
@@ -129,7 +236,7 @@ for the one-step payload contract and the configured-step boundary.
|
|
|
129
236
|
|
|
130
237
|
Step visibility rules use `x-edf:stepRules`. Hidden steps are skipped in navigation
|
|
131
238
|
and excluded from structured submissions unless `includeHiddenStepsInSubmit` is
|
|
132
|
-
true; `flatFormData` retains the all-step context. `onStepChange` reports the
|
|
239
|
+
true; `flatFormData` retains the all-step context after inactive-null omission. `onStepChange` reports the
|
|
133
240
|
visible-step index; `onStepChangeDetailed` also includes the original index as
|
|
134
241
|
`allStepsIndex`. The last visible step can submit, and final submission validates
|
|
135
242
|
all visible steps, including an earlier step newly revealed by a later answer.
|
|
@@ -145,7 +252,32 @@ errors by default; hiding the error list does not bypass validation.
|
|
|
145
252
|
|
|
146
253
|
`LayoutGridField` is included for step layouts. Configure `ui:field` as
|
|
147
254
|
`LayoutGridField` and use `ui:layoutGrid` with Ant Design's 24-column spans and
|
|
148
|
-
gutters.
|
|
255
|
+
gutters. Grouped objects display their own title and description once before
|
|
256
|
+
their members, using the registered templates. UI titles and descriptions
|
|
257
|
+
override schema metadata; empty UI values hide that heading, and
|
|
258
|
+
`ui:options.label: false` hides both. Custom fields and templates remain
|
|
259
|
+
overridable.
|
|
260
|
+
|
|
261
|
+
### Form headings and step descriptions
|
|
262
|
+
|
|
263
|
+
Root `uiSchema['ui:options'].label` defaults to `true`. Set it to `false` to hide
|
|
264
|
+
the form title and description together on one-step and multi-step forms; field
|
|
265
|
+
labels are unaffected. An empty root `ui:title` or `ui:description` hides only
|
|
266
|
+
that heading.
|
|
267
|
+
|
|
268
|
+
The `WizardForm` prop `showStepDescription` defaults to `true`. Multi-step forms
|
|
269
|
+
show one active-step description inside the form, above the fields, even when
|
|
270
|
+
progress is hidden. Set it to `false` to hide that description. It is a component
|
|
271
|
+
prop, not a persisted uiSchema option, so hosts such as Formstudio must pass it
|
|
272
|
+
explicitly. One-step forms show no step description.
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
<WizardForm
|
|
276
|
+
schema={schema}
|
|
277
|
+
uiSchema={{ 'ui:options': { label: false } }}
|
|
278
|
+
showStepDescription={false}
|
|
279
|
+
/>
|
|
280
|
+
```
|
|
149
281
|
|
|
150
282
|
## Conditional logic
|
|
151
283
|
|
|
@@ -178,6 +310,46 @@ UI rules belong in `uiSchema['x-edf:rules']`; schema rules belong in
|
|
|
178
310
|
per-item JsonLogic. Conditional requiredness changes validation, not just a
|
|
179
311
|
visual required marker.
|
|
180
312
|
|
|
313
|
+
### Rule order
|
|
314
|
+
|
|
315
|
+
Rules in each conditional engine run in ascending numeric `order`. Use a finite
|
|
316
|
+
number; negative values and zero are valid. Equal orders retain their array
|
|
317
|
+
order. Rules without `order` run **after every explicitly ordered rule**, keeping
|
|
318
|
+
their own array order. Evaluation does not reorder the caller's array.
|
|
319
|
+
|
|
320
|
+
Only matching rules apply effects. Effects run sequentially, so a later effect
|
|
321
|
+
on the same property wins: hide followed by show reveals a field, and a later
|
|
322
|
+
widget replacement replaces the earlier widget. Effects within one rule also
|
|
323
|
+
retain their array order. A false condition does not apply an automatic inverse;
|
|
324
|
+
authors that need an inverse must supply another rule.
|
|
325
|
+
|
|
326
|
+
This contract applies separately to the UI, schema, and validation engines.
|
|
327
|
+
Schema effects determine both rendered constraints and submission validation.
|
|
328
|
+
The code-only `useConditionalValidation` hook preserves the same rule order;
|
|
329
|
+
`createCustomValidate` then runs the selected validation callbacks in sequence.
|
|
330
|
+
Callbacks that add errors accumulate them; an earlier error is not automatically
|
|
331
|
+
removed unless a later callback explicitly changes it.
|
|
332
|
+
|
|
333
|
+
`ExtendedForm` applies embedded schema and UI rules with this ordering.
|
|
334
|
+
`WizardForm` applies it independently for each step, including navigation and
|
|
335
|
+
final validation. A step's rule list is its local rules followed by inherited
|
|
336
|
+
root rules, then sorted by `order`; root rules therefore follow local rules when
|
|
337
|
+
their orders tie or both omit `order`. Rule paths are relative to the step.
|
|
338
|
+
|
|
339
|
+
For example, these UI rules reveal `answer` as a textarea even though the hide
|
|
340
|
+
rule appears last in the array:
|
|
341
|
+
|
|
342
|
+
```json
|
|
343
|
+
{
|
|
344
|
+
"x-edf:rules": [
|
|
345
|
+
{ "name": "Show", "order": 20, "condition": true,
|
|
346
|
+
"effect": [{ "op": "replace", "path": "/answer/ui:widget", "value": "textarea" }] },
|
|
347
|
+
{ "name": "Hide", "order": 10, "condition": true,
|
|
348
|
+
"effect": [{ "op": "replace", "path": "/answer/ui:widget", "value": "hidden" }] }
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
181
353
|
## Widgets and options
|
|
182
354
|
|
|
183
355
|
Select a registered widget using `ui:widget`. The same registered key can also
|
|
@@ -250,19 +422,47 @@ Choice presenter-specific Ant Design options use `choiceConfig.antd`, such as
|
|
|
250
422
|
|
|
251
423
|
### Empty answers
|
|
252
424
|
|
|
253
|
-
The
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
425
|
+
The five text widgets follow the [null contract](#empty-values-null-contract)
|
|
426
|
+
above. Widgets that still emit `undefined` omit those object properties during
|
|
427
|
+
JSON serialization, including properties in array items; callbacks may retain
|
|
428
|
+
undefined-valued own properties. Clearing an array row does not delete or compact it;
|
|
429
|
+
hidden or disabled null items are omitted at submit and the array compacts, while
|
|
430
|
+
valued hidden items are kept. See “Indices refer to the delivered array” in
|
|
431
|
+
[Submitted data: hidden and disabled fields](#submitted-data-hidden-and-disabled-fields).
|
|
432
|
+
Explicit `emptyValue` overrides retain their configured value and validation
|
|
433
|
+
behavior, including optional-null acceptance. Custom fields/widgets control
|
|
434
|
+
their own child-change behavior.
|
|
260
435
|
|
|
261
436
|
Stored/default answers are not rewritten on load. Turning off interaction
|
|
262
437
|
feedback does not disable Submit or Wizard Next validation. Change callbacks
|
|
263
438
|
can contain incomplete or invalid drafts; only accepted submissions should be
|
|
264
439
|
stored as completed responses.
|
|
265
440
|
|
|
441
|
+
### Conditional validation feedback
|
|
442
|
+
|
|
443
|
+
`ExtendedForm` and every `WizardForm` step fold an AJV `if` error for a failed
|
|
444
|
+
`then` or `else` branch when a specific, non-wrapper error has the same property
|
|
445
|
+
path. Wrappers remain visible when no specific error exists at their path,
|
|
446
|
+
even when several conditional rules fail there. Field feedback and the error
|
|
447
|
+
list use the same transformed errors; schemas and submitted answers are unchanged.
|
|
448
|
+
|
|
449
|
+
Both components accept `transformErrors(errors, uiSchema)`. EDF folds first,
|
|
450
|
+
then calls the host transform. Wizard navigation and final validation use the
|
|
451
|
+
same order as the step renderer. Hosts should not depend on redundant wrapper
|
|
452
|
+
errors reaching their callback.
|
|
453
|
+
|
|
454
|
+
### Configuration errors and email feedback
|
|
455
|
+
|
|
456
|
+
Configuration failures carry `name: 'edf:configuration'`, including errors from
|
|
457
|
+
the exported `nullContractValidator`. This marker is the supported way for hosts
|
|
458
|
+
to recognise configuration failures. Host `transformErrors` callbacks should
|
|
459
|
+
preserve `name` when copying or replacing error objects so Wizard retains its
|
|
460
|
+
configuration-error feedback path.
|
|
461
|
+
|
|
462
|
+
Email fields in `ExtendedForm` and `WizardForm` now honour `ui:hideError` for
|
|
463
|
+
schema and custom validation messages. Widget-local blur feedback when no
|
|
464
|
+
schema or custom errors exist is unchanged.
|
|
465
|
+
|
|
266
466
|
### Date and time answers
|
|
267
467
|
|
|
268
468
|
| Widget/schema | Accepted answer |
|
|
@@ -309,6 +509,62 @@ Custom widgets can import `useFieldEventHandlers` from the root package alongsid
|
|
|
309
509
|
other event exports. Call the RJSF `onChange` to update the answer and the field
|
|
310
510
|
event handler to participate in EDF events.
|
|
311
511
|
|
|
512
|
+
Both components send webhooks through `FormEventHub`, using a single JSON envelope
|
|
513
|
+
with `eventType`, `timestamp`, `source` and `formData`. Subscriptions support
|
|
514
|
+
`focus`, `blur`, `change`, `submit`, `validationError` and wizard `stepChange`.
|
|
515
|
+
Field events also carry `fieldId`, `fieldValue` and `fieldPath`; step events carry
|
|
516
|
+
`fromStep` and `toStep`; validation events carry `errors`.
|
|
517
|
+
|
|
518
|
+
```tsx
|
|
519
|
+
import type { JsonValue, WebhookConfig } from 'extended-dynamic-forms';
|
|
520
|
+
|
|
521
|
+
const metadata: Record<string, JsonValue> = {
|
|
522
|
+
tenant: 'operations',
|
|
523
|
+
correlation: null,
|
|
524
|
+
label: '{{literal text}}',
|
|
525
|
+
};
|
|
526
|
+
const webhooks: WebhookConfig[] = [{
|
|
527
|
+
url: 'https://example.com/events?channel=forms#receiver',
|
|
528
|
+
events: ['change', 'submit'],
|
|
529
|
+
body: metadata,
|
|
530
|
+
query: [{ key: 'tag', value: 'customer care' }, { key: 'tag', value: '' }],
|
|
531
|
+
formDataFields: ['contact', 'consent'],
|
|
532
|
+
}];
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
- `body` adds fixed extra root properties once. Its recursive `JsonValue` type
|
|
536
|
+
accepts JSON primitives, objects, arrays and null. There is no templating or
|
|
537
|
+
script execution: `{{...}}` remains literal text. Reserved keys are always
|
|
538
|
+
ignored, even when absent from the event: `eventType`, `timestamp`, `source`,
|
|
539
|
+
`formData`, `fieldId`, `fieldValue`, `fieldPath`, `fromStep`, `toStep`, `errors` and `meta`.
|
|
540
|
+
- `query` appends URL-encoded string pairs in order. Existing query values,
|
|
541
|
+
duplicate keys and empty values are retained; the fragment remains last.
|
|
542
|
+
An absent or empty list leaves the URL byte-for-byte unchanged.
|
|
543
|
+
- `formDataFields` selects literal own top-level answer keys for this webhook only.
|
|
544
|
+
It does not interpret paths, wildcards or renames. An absent list keeps existing
|
|
545
|
+
full-data delivery; an empty list sends `{}`. Missing keys stay absent. Selected
|
|
546
|
+
JSON values retain their complete nested structure and nulls. Null or missing
|
|
547
|
+
answer data stays as it is. Submit selection uses ExtendedForm's inner answers
|
|
548
|
+
and WizardForm's accepted flat answer view, not their compatibility wrappers.
|
|
549
|
+
Other events select from their answer data. Unselected payloads and callbacks
|
|
550
|
+
retain their existing component-specific shapes.
|
|
551
|
+
|
|
552
|
+
Native `FormEventHub` callers may supply `handleAfterSubmit(data, { formData: answers })`
|
|
553
|
+
when their canonical submit data is wrapped. Omitting the second argument selects
|
|
554
|
+
from `data` as before; an explicit null or undefined snapshot stays null or missing.
|
|
555
|
+
The snapshot travels with that event through deferred delivery and retries.
|
|
556
|
+
|
|
557
|
+
These options apply to every subscribed event without changing methods, headers,
|
|
558
|
+
debouncing, retries, timeouts or subscriptions. With all three absent, the URL and
|
|
559
|
+
serialized request body remain byte-identical to existing delivery. They do not
|
|
560
|
+
mutate the shared event, another webhook's payload or host/lifecycle callback data.
|
|
561
|
+
**Answer selection is not a redaction control:** it filters only `formData`, not
|
|
562
|
+
`fieldValue`, `errors`, query values or authored body properties. Hosts must apply
|
|
563
|
+
their own disclosure policy before configuring a destination.
|
|
564
|
+
|
|
565
|
+
These EDF options do not interpret Formstudio's legacy `request_body` or
|
|
566
|
+
`form_data_fields` storage.
|
|
567
|
+
|
|
312
568
|
### RJSF 6.11 native integration in 0.5.0
|
|
313
569
|
|
|
314
570
|
For native hosts that register EDF's `TelephoneWidget` on their own RJSF 6.11
|
package/dist/WizardForm.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WebhookConfig } from './types';
|
|
2
|
+
import { ErrorTransformer } from '@rjsf/utils';
|
|
2
3
|
|
|
3
4
|
export interface WizardStep {
|
|
4
5
|
id: string;
|
|
@@ -35,6 +36,7 @@ export interface WizardFormProps {
|
|
|
35
36
|
submitButtonText?: string;
|
|
36
37
|
liveValidate?: boolean;
|
|
37
38
|
showErrorList?: boolean;
|
|
39
|
+
transformErrors?: ErrorTransformer;
|
|
38
40
|
onWebhookStart?: (webhook: WebhookConfig, event: any) => void;
|
|
39
41
|
onWebhookComplete?: (webhook: WebhookConfig, event: any, response: any) => void;
|
|
40
42
|
onWebhookError?: (webhook: WebhookConfig, event: any, error: Error) => void;
|
|
@@ -44,4 +46,4 @@ export interface WizardFormProps {
|
|
|
44
46
|
enableDynamicBinding?: boolean;
|
|
45
47
|
includeHiddenStepsInSubmit?: boolean;
|
|
46
48
|
}
|
|
47
|
-
export declare function WizardForm({ schema, uiSchema, webhooks, formData: initialFormData, onSubmit, onStepChange, onFieldFocus, onFieldBlur, onFieldChange, onLiveChange, showProgressBar, showStepDescription, submitButtonText, liveValidate, showErrorList, onWebhookStart, onWebhookComplete, onWebhookError, widgets, fields, templates, enableDynamicBinding, onStepChangeDetailed, onStepAutoAdvance, includeHiddenStepsInSubmit, }: WizardFormProps): import("react/jsx-runtime").JSX.Element;
|
|
49
|
+
export declare function WizardForm({ schema, uiSchema, webhooks, formData: initialFormData, onSubmit, onStepChange, onFieldFocus, onFieldBlur, onFieldChange, onLiveChange, showProgressBar, showStepDescription, submitButtonText, liveValidate, showErrorList, transformErrors, onWebhookStart, onWebhookComplete, onWebhookError, widgets, fields, templates, enableDynamicBinding, onStepChangeDetailed, onStepAutoAdvance, includeHiddenStepsInSubmit, }: WizardFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FormProps } from '@rjsf/core';
|
|
2
|
+
import { default as Form, FormProps } from '@rjsf/core';
|
|
3
3
|
|
|
4
4
|
type ErrorOwner = {
|
|
5
5
|
setError: (id: string, message: string) => void;
|
|
6
6
|
remove: (id: string) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare const useRJSF611WidgetErrorOwner: () => ErrorOwner | undefined;
|
|
9
|
+
/** Internal Wizard snapshot; ordinary validation belongs in RJSF state, not extraErrors. */
|
|
10
|
+
export declare const WizardValidationContext: React.Context<{
|
|
11
|
+
validation: Pick<Form["state"], "errors" | "errorSchema">;
|
|
12
|
+
reveal: boolean;
|
|
13
|
+
} | undefined>;
|
|
9
14
|
export interface RJSF611ErrorStateAdapterProps {
|
|
10
15
|
children: React.ReactElement<FormProps>;
|
|
11
16
|
/** Same constraints as the child's customValidate, without lifecycle notifications. */
|
|
@@ -7,6 +7,7 @@ import { ArrayFieldTemplate, ArrayFieldItemTemplate } from './arrays';
|
|
|
7
7
|
import { WizardObjectFieldTemplate, WizardSectionTemplate } from '../layouts/wizard';
|
|
8
8
|
import { SubmitButton } from './templates/SubmitButton';
|
|
9
9
|
import { FieldTemplate } from './templates/FieldTemplate';
|
|
10
|
+
import { FieldErrorTemplate } from './templates/FieldErrorTemplate';
|
|
10
11
|
import { FieldProps } from '@rjsf/utils';
|
|
11
12
|
|
|
12
13
|
export declare const customFields: {
|
|
@@ -17,6 +18,7 @@ export declare const customFields: {
|
|
|
17
18
|
};
|
|
18
19
|
export declare const customTemplates: {
|
|
19
20
|
FieldTemplate: React.FC<import('@rjsf/utils').FieldTemplateProps>;
|
|
21
|
+
FieldErrorTemplate: typeof FieldErrorTemplate;
|
|
20
22
|
ObjectFieldTemplate: React.FC<import('@rjsf/utils').ObjectFieldTemplateProps>;
|
|
21
23
|
ArrayFieldTemplate: (props: import('@rjsf/utils').ArrayFieldTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
ArrayFieldItemTemplate: (props: import('@rjsf/utils').ArrayFieldItemTemplateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -52,6 +52,7 @@ export type DynamicItemsConfig = {
|
|
|
52
52
|
base?: UiSchema;
|
|
53
53
|
rules: DynamicItemsRule[];
|
|
54
54
|
};
|
|
55
|
+
export declare const dynamicItemsRulePatches: WeakMap<ArrayItemsFunction, Partial<UiSchema>[]>;
|
|
55
56
|
/**
|
|
56
57
|
* Compile a declarative JSON config into an ArrayItemsFunction
|
|
57
58
|
* - Supports single-rule shorthand and multi-rule configs
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormEventHandlers, FieldEventHandlers, WebhookConfig } from '../types';
|
|
1
|
+
import { FormEventHandlers, FieldEventHandlers, WebhookConfig, SubmissionMeta } from '../types';
|
|
2
2
|
|
|
3
3
|
export declare class FormEventHub {
|
|
4
4
|
private formHandlers;
|
|
@@ -20,7 +20,10 @@ export declare class FormEventHub {
|
|
|
20
20
|
onWebhookError?: (webhook: WebhookConfig, event: any, error: Error) => void;
|
|
21
21
|
}): void;
|
|
22
22
|
handleBeforeSubmit(data: any): Promise<any>;
|
|
23
|
-
handleAfterSubmit(data:
|
|
23
|
+
handleAfterSubmit(data: unknown, answerSnapshot?: {
|
|
24
|
+
formData: unknown;
|
|
25
|
+
meta?: SubmissionMeta;
|
|
26
|
+
}, meta?: SubmissionMeta, fullAnswers?: unknown): Promise<void>;
|
|
24
27
|
handleBeforeValidation(data: any): Promise<any>;
|
|
25
28
|
handleAfterValidation(validationErrors: any, formData: any): Promise<void>;
|
|
26
29
|
handleStepChange(fromStep: number, toStep: number, formData: any): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './hooks';
|
|
|
10
10
|
export type { FormProps, IChangeEvent } from '@rjsf/core';
|
|
11
11
|
export type { RJSFSchema, UiSchema, WidgetProps, FieldProps, ArrayFieldTemplateProps, ObjectFieldTemplateProps, FieldTemplateProps, ErrorSchema, RJSFValidationError, } from '@rjsf/utils';
|
|
12
12
|
export { default as validator } from '@rjsf/validator-ajv8';
|
|
13
|
+
export { nullContractValidator } from './utils/nullContractValidator';
|
|
13
14
|
export { ExtendedForm } from './ExtendedForm';
|
|
14
15
|
export { WizardForm } from './WizardForm';
|
|
15
16
|
export type { WizardFormProps, WizardStep } from './WizardForm';
|