@praxisui/dynamic-form 10.0.0-rc.56 → 10.0.0-rc.58
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 +36 -2
- package/ai/component-registry.json +763 -138
- package/docs/dynamic-form-authoring-document-semantics.md +7 -1
- package/docs/dynamic-form-stepper-implementation-plan.md +31 -3
- package/fesm2022/praxisui-dynamic-form.mjs +4595 -201
- package/package.json +8 -8
- package/src/lib/config-editor/praxis-dynamic-form-config-editor.json-api.md +3 -2
- package/src/lib/layout-editor/praxis-layout-editor.json-api.md +8 -0
- package/src/lib/praxis-dynamic-form.json-api.md +21 -11
- package/types/praxisui-dynamic-form.d.ts +201 -11
package/README.md
CHANGED
|
@@ -218,6 +218,13 @@ boolean/action controls, uploads and unknown control types remain at their canon
|
|
|
218
218
|
When `mode="view"` and the host does not provide `presentationModeGlobal`, a schema policy with
|
|
219
219
|
`intent: "detail"` or `preset: "compactPresentation"` also enables presentation rendering. Hosts
|
|
220
220
|
that need traditional disabled controls for the same schema can pass `[presentationModeGlobal]="false"`.
|
|
221
|
+
To open semantic read-only rendering unconditionally, bind `mode="presentation"` or `mode="dossier"`
|
|
222
|
+
(with `dossier` defaulting `presentationPreset` to `'corporate-dossier'`; `'editorial-card'`,
|
|
223
|
+
`'compact-presentation'`, and `'default'` are also supported). When entity snapshots are hydrated via
|
|
224
|
+
`readUrl`, `initialValue`, or reset, `FormArray` fields (`controlType: 'array'` or `field.array`)
|
|
225
|
+
automatically materialize their child `FormGroup` rows from `array.itemSchema.fields` (including
|
|
226
|
+
nested local calendar date coercion) and inherit runtime policies such as `fieldIconPolicy` and
|
|
227
|
+
`apiUrlEntry`.
|
|
221
228
|
For compact detail screens, explicit schema `x-ui.width` values are honored as 12-column spans so
|
|
222
229
|
fieldsets can render multiple read-only fields per row. Fields without an explicit width remain
|
|
223
230
|
full-width to preserve existing layouts. Generated compact sections also receive semantic header
|
|
@@ -334,6 +341,25 @@ const commandConfig: FormConfig = {
|
|
|
334
341
|
};
|
|
335
342
|
```
|
|
336
343
|
|
|
344
|
+
## Section layout modes and native stepper
|
|
345
|
+
|
|
346
|
+
`FormConfig.layout.mode` accepts `'vertical'` (default), `'tabs'`, `'accordion'`, and `'stepper'` (with explicit `[layoutMode]` > `[formLayout]` > `config.layout` > optional transient schema `x-ui.formLayout` precedence, including Phase 2 schema flags `defaultTabId`, `tabsAppearance`, `accordionMulti`, `hideSectionHeaderInTabs`, `hideSectionHeaderInStepper`, and `stepperInReadMode` when emitted by `@FormLayout` on backend command/detail DTOs — honored across `SERVER_DEFAULT`, `HOST_CONFIG`, and `LOCAL_CONFIG` reconciliation flows whenever the explicit tier leaves a key unset, without overwriting persisted user overrides). Both page forms and CRUD modal/drawer hosts share the same runtime contract:
|
|
347
|
+
|
|
348
|
+
- **Single root `FormGroup`**: in `stepper` mode, resolved steps (`layout.steps` grouping one or more `sectionIds`, or 1 step per visible section by default when omitted; unreferenced sections are appended deterministically) operate on the same root `FormGroup`, `FormArray`, dirty/touched tracking, reactive determinations, and hooks without copying drafts between child forms. Multi-section steps keep inner section headings visible so sub-blocks remain clear while single-section steps honor `hideSectionHeaderInStepper ?? true`.
|
|
349
|
+
- **Optional steps and sections (`optional`)**: steps (`layout.steps[].optional`) or derived section steps (`sections[].optional`) render an accessible `Opcional` / `Optional` pill and unlock header/action jumps directly into or across valid optional steps as soon as the preceding required steps are satisfied (while preserving strict linear locking for mandatory-only steppers after reset/initialValue); any invalid control on an optional step (including untouched errors) immediately blocks forward jumps past that step until corrected. Custom-field schema reconciliation (`reconcileFormConfig`) matches custom-field groups against both `layout.tabs` and `layout.steps` and appends new custom steps when explicit steps are configured.
|
|
350
|
+
- **Presentation & read-only behavior (`stepperInReadMode`, `@media print` expansion) and error recovery**: by default (`stepperInReadMode: 'presentation'`), Presentation/Dossier modes (`presentation`, `dossier`, or `view` with presentation enabled) keep `'stepper'` active as non-linear dossier chapters (all steps unlocked and clickable without error badges, checkmarks, or mutation buttons, paired with a navigation-only `Anterior` / `Etapa X de N` / `Próxima etapa` bar; `@media print` automatically expands every visible chapter/tab and collapsed `accordion`/`collapsible` section with its heading — falling back to the owning `layout.steps[].label` or `layout.tabs[].label` via `data-print-section-title` when a single-section chapter omits `section.title` — so corporate dossier print/PDF output includes the full document), while blocked `view`/`readonly` degrades to `'vertical'`. Set `stepperInReadMode: 'all'` to allow non-linear stepper in blocked `view`/`readonly` too, or `'none'` to stack all sections vertically across every read mode. Forms with 0 or 1 visible sections hide the stepper header and keep normal vertical controls. Both local final-step validation errors and HTTP `422` field-targeted errors reveal the owning earlier step and focus the offending control inside the form host.
|
|
351
|
+
- **Visual customization bypass & Stepper Grouping Editor**: when `enableCustomization` is enabled, step pills remain unlocked so authors can switch steps freely on the canvas regardless of incomplete required fields. In the Layout Editor (`LayoutEditorComponent`), selecting `mode = 'stepper'` exposes the **Agrupamento de etapas (`layout.steps`)** panel to visually group multiple sections into a single step, reorder steps, edit step labels/subtitles, mark steps as `optional`, toggle `stepperReviewStep`, or restore automatic 1-step-per-section derivation without manual JSON editing.
|
|
352
|
+
- **Automatic Final Review Step (`layout.stepperReviewStep`)**: when `layout.stepperReviewStep = true` (or emitted by backend `@FormLayout(stepperReviewStep = UiBoolean.TRUE)` / `@FormLayout(FormLayoutMode.AUTO)` into `x-ui.formLayout.stepperReviewStep`) in interactive `create`/`edit` stepper flows, the runtime appends a synthetic final review step (`__praxis_stepper_review__`, `Revisão`) displaying a read-only chapter-by-chapter summary of all visible fields (including dotted `customFields.<key>` paths, semantic `FormArray` collection item summaries via `array.itemTitleTemplate` / `collectionDisplay.itemTitleFields` with item-by-item collection diff badges `+ Novo`, `~ Alterado`, and `- Removido` when `dirty`, baseline-vs-current diff `<del>previous</del> → current` for effectively modified fields with automatic false-positive suppression when reverted to baseline, a quantitative required-field completion badge `X/Y obrigatórios` per chapter, an accessible `aria-pressed` filter toggle `Mostrar apenas alterados`, option labels, and `'••••••••'` masking for `password` controls) with quick `Editar etapa` chapter jump-back and per-item `Editar campo` direct focus actions (`editStepperReviewField`), plus automatic WCAG focus transfer before final submission.
|
|
353
|
+
- **Session Draft persistence (`behavior.draftPersistence` / `layout.draftPersistence`)**: when `config.behavior.draftPersistence = true` (or emitted by backend `@FormLayout(draftPersistence = UiBoolean.TRUE)` / `@FormLayout(FormLayoutMode.AUTO)` into `x-ui.formLayout.draftPersistence`, while honoring explicit `behavior.draftPersistence = false` host overrides) in `create` mode (configurable via JSON, host input, AI manifest `behavior.draftPersistence.set`, or visually in `BehaviorEditorComponent`), the runtime automatically persists and restores the in-progress draft (`rawValue`, `dirtyFields`, and active step `activeStepId`/`activeStepIndex`) in `sessionStorage` under the multi-tenant key `praxis-session-draft:<tenant>:<resource>:<formId>:create`, renders an accessible restoration status banner (`role="status"`, `aria-live="polite"`) with a `Descartar rascunho` action, informs the user on dirty cancel/exit confirmation that the local session draft will be preserved for resumption (`Sair e manter rascunho`), and clears the draft automatically on successful submit, explicit discard, reset, or corporate tenant/context change.
|
|
354
|
+
- **Structured Step Telemetry (`@Output() stepTelemetry`)**: emits metadata-only `FormStepTelemetryEvent` (`fromStepIndex`, `toStepIndex`, `stepId`, `totalSteps`, and `reason`: `'next' | 'previous' | 'header' | 'review-edit' | 'validation-recovery' | 'http-422-recovery' | 'draft-restored'`) for corporate UX observability without leaking field values.
|
|
355
|
+
- **AI Authoring Manifest support (`PRAXIS_DYNAMIC_FORM_AUTHORING_MANIFEST`)**: the semantic copilot supports `layout.mode.set` (including declarative `steps` and `stepperReviewStep`), `section.update` (`optional`, `stepLabel`), and `behavior.draftPersistence.set` (`formBehavior` target).
|
|
356
|
+
|
|
357
|
+
### Enterprise architecture guidance
|
|
358
|
+
|
|
359
|
+
- **When to use `FormConfig.layout.mode = 'stepper'`**: choose the native form stepper for single-aggregate transactional records (employee onboarding, credit applications, supplier registration) in page, modal, or drawer hosts that benefit from a single root `FormGroup`, dirty tracking (`canLeaveForm()`), optimistic concurrency (`ETag` / `If-Match`), `layoutScope: 'shared'` with configurable presentation/view read policy (`stepperInReadMode`), and `422` field-level error recovery.
|
|
360
|
+
- **When to use standalone `@praxisui/stepper` (`PraxisStepperComponent`)**: choose `@praxisui/stepper` when orchestrating multiple independent entities/endpoints, combining non-form stages (confirmations, payments, async job monitors), or requiring intermediate server persistence/checkpoints per stage.
|
|
361
|
+
- **Corporate sizing & ergonomics**: keep 2–5 cohesive steps per form; for 3 or more steps, prefer full routes, `drawer` hosts, or `md`/`lg`/`xl` modal presets. Validation runs cumulatively (`0..targetIndex - 1`) on forward transitions, locking forward jumps past invalidated earlier steps and scoping `hasUnsatisfiedReactiveDeterminations` away from unvisited future steps until those steps are reached.
|
|
362
|
+
|
|
337
363
|
Pair this config with an explicit schema source, such as `[schemaUrl]`,
|
|
338
364
|
`[submitUrl]`, `[submitMethod]` and, in detached hosts, `[apiEndpointKey]` or
|
|
339
365
|
`[apiUrlEntry]`. A sectionless config is valid only when the schema/runtime
|
|
@@ -350,13 +376,17 @@ Common inputs:
|
|
|
350
376
|
- `resourcePath`, `resourceId`, `initialValue`, `emptyState`
|
|
351
377
|
- `schemaUrl`, `readUrl`, `submitUrl`, `submitMethod`, `responseSchemaUrl`
|
|
352
378
|
- `apiEndpointKey`, `apiUrlEntry`
|
|
353
|
-
- `actions`, `layout`, `backConfig`, `hooks`
|
|
379
|
+
- `actions`, `layout`, `layoutMode`, `formLayout`, `activeStepIndex`, `backConfig`, `hooks`
|
|
354
380
|
- `enableCustomization`
|
|
355
381
|
- `readonlyModeGlobal`, `disabledModeGlobal`, `presentationModeGlobal`, `fieldIconPolicy`, `visibleGlobal`
|
|
356
382
|
- `notifyIfOutdated`, `snoozeMs`, `autoOpenSettingsOnOutdated`
|
|
357
383
|
- `domainRules`
|
|
358
384
|
- `editorialContext`
|
|
359
385
|
|
|
386
|
+
Key layout/navigation outputs:
|
|
387
|
+
|
|
388
|
+
- `tabChange` (active tab ID), `tabSelected` (resolved tab metadata), `stepChange` (0-based active step index in `stepper` mode), `stepTelemetry` (metadata-only `FormStepTelemetryEvent` for stepper transitions and recovery flows)
|
|
389
|
+
|
|
360
390
|
`providePraxisDynamicFormMetadata()` also registers localized editorial copy through
|
|
361
391
|
the existing `ComponentMetadataRegistry`. Shared editors resolve labels and help
|
|
362
392
|
with `resolveEditorial('praxis-dynamic-form')`, while raw input names, types and
|
|
@@ -453,6 +483,7 @@ Common outputs:
|
|
|
453
483
|
- `loadingStateChange`, `initializationError`
|
|
454
484
|
- `customAction`, `actionConfirmation`
|
|
455
485
|
- `fieldRenderError`, `ruleDiagnosticsChange`
|
|
486
|
+
- `stepChange`, `stepTelemetry`
|
|
456
487
|
|
|
457
488
|
### Public untrusted runtime profile
|
|
458
489
|
|
|
@@ -566,13 +597,16 @@ field below the useful viewport. Larger guidance cards, timelines, and stat grou
|
|
|
566
597
|
dedicated row, side context, or a separate rich-content demonstration tab rather than the compact
|
|
567
598
|
detail header.
|
|
568
599
|
|
|
569
|
-
The runtime exposes host-themeable CSS variables for this mode:
|
|
600
|
+
The runtime exposes host-themeable CSS variables for this mode and scales spacing, pill heights, nested collection cards, and typography across three presentation densities (`'comfortable'`, `'cozy'`, `'compact'`) exposed via `data-presentation-density` and `.pres-density-*` host classes (`FormPresentationConfig` explicit overrides > `--pdx-presentation-*` host tokens > preset × density scale, with fallback to `config.metadata.presentationDensity` when `presentation.density` is omitted):
|
|
570
601
|
|
|
571
602
|
- `--pdx-presentation-label-width`
|
|
572
603
|
- `--pdx-presentation-label-size`
|
|
573
604
|
- `--pdx-presentation-value-size`
|
|
574
605
|
- `--pdx-presentation-row-gap`
|
|
606
|
+
- `--pdx-presentation-column-gap`
|
|
575
607
|
- `--pdx-presentation-section-gap`
|
|
608
|
+
- `--pdx-presentation-array-gap`
|
|
609
|
+
- `--pdx-presentation-array-item-padding`
|
|
576
610
|
- `--pdx-presentation-flag-height`
|
|
577
611
|
- `--pdx-presentation-flag-padding`
|
|
578
612
|
- `--pdx-presentation-flag-radius`
|