@praxisui/dynamic-form 8.0.0-beta.0 → 8.0.0-beta.11
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 +90 -6
- package/fesm2022/praxisui-dynamic-form.mjs +1836 -528
- package/index.d.ts +89 -13
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ keywords:
|
|
|
37
37
|
- "schema-driven"
|
|
38
38
|
- "layout editor"
|
|
39
39
|
- "settings integration"
|
|
40
|
-
last_updated: "2026-
|
|
40
|
+
last_updated: "2026-04-12"
|
|
41
41
|
---
|
|
42
42
|
|
|
43
43
|
# @praxisui/dynamic-form
|
|
@@ -136,6 +136,74 @@ Tip: connect to a backend resource by setting `resourcePath`/`resourceId`. The c
|
|
|
136
136
|
For metadata-driven surfaces published by the backend, prefer passing `schemaUrl`, `submitUrl` and `submitMethod` explicitly. In dialog/drawer hosts detached from the route injector, pass `apiUrlEntry` in addition to `apiEndpointKey` so relative runtime URLs still resolve against the remote backend instead of the local shell origin.
|
|
137
137
|
When a late `config` hydration rebuilds the surface, the runtime preserves the current form values already mounted in memory only when the logical context remains the same (`resourcePath`, `resourceId`, and mode). If the form was preloaded from `resourceId`, that entity hydration remains visible after the rebuild only for the same entity context; entity switches and create-mode transitions do not restore the previous record snapshot.
|
|
138
138
|
|
|
139
|
+
## Local fields, transient state, and submit payloads
|
|
140
|
+
|
|
141
|
+
`praxis-dynamic-form` supports host-owned fields that participate in the form runtime without becoming part of the backend DTO. This is the right model for confirmation controls, wizard state, client-side calculated previews, host notes, and other UI context that should be available to rules and hooks but should not be persisted by default.
|
|
142
|
+
|
|
143
|
+
The submit contract exposes two values:
|
|
144
|
+
|
|
145
|
+
| Property | Meaning | Typical consumer |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| `formSubmit.formData` | filtered persistence payload after submit policy is applied | HTTP submit, persistence hooks, backend DTO integration |
|
|
148
|
+
| `formSubmit.rawFormData` | full form value before filtering | host hooks, UI audit context, diagnostics, calculations |
|
|
149
|
+
|
|
150
|
+
Default behavior:
|
|
151
|
+
|
|
152
|
+
- schema-backed fields are included in `formData`.
|
|
153
|
+
- fields with `source: 'local'` are omitted from `formData` and kept in `rawFormData`.
|
|
154
|
+
- fields with `transient: true` are omitted from `formData` and kept in `rawFormData`.
|
|
155
|
+
- `submitPolicy` has priority over `source` and `transient`.
|
|
156
|
+
|
|
157
|
+
| `submitPolicy` | Effect |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| `include` | always include the field in `formData` |
|
|
160
|
+
| `omit` | always omit the field from `formData` |
|
|
161
|
+
| `includeWhenDirty` | include the field in `formData` only when the control is dirty |
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
fieldMetadata: [
|
|
167
|
+
{ name: 'fullName', label: 'Full name', controlType: 'input' },
|
|
168
|
+
{
|
|
169
|
+
name: 'approvalComment',
|
|
170
|
+
label: 'Approval comment',
|
|
171
|
+
controlType: 'textarea',
|
|
172
|
+
source: 'local',
|
|
173
|
+
submitPolicy: 'omit',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'calculatedRiskScore',
|
|
177
|
+
label: 'Risk score',
|
|
178
|
+
controlType: 'numericTextBox',
|
|
179
|
+
transient: true,
|
|
180
|
+
readOnly: true,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'manualOverrideReason',
|
|
184
|
+
label: 'Manual override reason',
|
|
185
|
+
controlType: 'textarea',
|
|
186
|
+
source: 'local',
|
|
187
|
+
submitPolicy: 'includeWhenDirty',
|
|
188
|
+
},
|
|
189
|
+
];
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
For a submitted value like:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"fullName": "Ana Souza",
|
|
197
|
+
"approvalComment": "Checked with HR",
|
|
198
|
+
"calculatedRiskScore": 72,
|
|
199
|
+
"manualOverrideReason": "Approved exception"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`rawFormData` keeps all four values. `formData` keeps `fullName` and, when dirty, `manualOverrideReason`; it omits `approvalComment` and `calculatedRiskScore`.
|
|
204
|
+
|
|
205
|
+
Do not use local/transient fields to hide a backend contract problem. If a field exists in the backend schema, keep it server-backed and fix the canonical schema or metadata mapping instead of creating a parallel local convention.
|
|
206
|
+
|
|
139
207
|
Presentation/read-only note:
|
|
140
208
|
- `praxis-dynamic-form` hospeda `FieldMetadata`, mas não é o resolvedor direto de `valuePresentation`.
|
|
141
209
|
- quando campos entram em modo view/presentation, a semântica de apresentação vem do metadata do campo e é resolvida por `@praxisui/dynamic-fields`.
|
|
@@ -248,6 +316,19 @@ export class FormEditorLauncherComponent {
|
|
|
248
316
|
|
|
249
317
|
Alternatively, when `enableCustomization` is true, `praxis-dynamic-form` renders a gear button that opens the editor internally.
|
|
250
318
|
|
|
319
|
+
## Agentic Authoring & Manifest
|
|
320
|
+
|
|
321
|
+
`praxis-dynamic-form` supports executable authoring contracts through the `ComponentAuthoringManifest`. This allows AI agents to perform structured, safe, and deterministic edits to the form configuration.
|
|
322
|
+
|
|
323
|
+
- **Manifest:** `PRAXIS_DYNAMIC_FORM_AUTHORING_MANIFEST`
|
|
324
|
+
- **Editable targets:** 10 target kinds: `field`, `section`, `row`, `column`, `formAction`, `formRule`, `message`, `layoutPlacement`, `localField`, `schemaBackedField`.
|
|
325
|
+
- **Operations:** Supports 22 operations covering field property updates, local field lifecycle, layout manipulation, rule management, and action configuration.
|
|
326
|
+
- **Validation:** 19 deterministic validators ensure uniqueness of IDs, layout integrity, local/schema-backed separation, destructive confirmation, and editor round-trip preservation.
|
|
327
|
+
- **Examples/evals:** 8 fixtures cover local transient fields, schema-backed relabeling, layout moves, visibility rules, unknown target rejection, destructive confirmation, and save/reopen without drift.
|
|
328
|
+
- **Round-trip:** Preserves editor state and ensures that AI-generated patches are compatible with the visual editor.
|
|
329
|
+
|
|
330
|
+
For more details on authoring manifests, see `docs/ai/agentic-authoring/component-authoring-contracts/README.md`.
|
|
331
|
+
|
|
251
332
|
## API Surface
|
|
252
333
|
|
|
253
334
|
- Components: `PraxisDynamicForm`, `PraxisDynamicFormConfigEditor`, `JsonConfigEditorComponent`, `LayoutEditorComponent`
|
|
@@ -597,14 +678,14 @@ Cobertura ja estabilizada:
|
|
|
597
678
|
- `JSON` com edicao real e bloqueio de payload invalido
|
|
598
679
|
- `Hooks`
|
|
599
680
|
- `Acoes` (`Botoes Padrao` e `Layout`)
|
|
600
|
-
- `Acoes` customizadas profundas (`
|
|
681
|
+
- `Acoes` customizadas profundas (`dialog.alert` com `globalAction` simples e estruturado)
|
|
601
682
|
- `Comportamento`
|
|
602
683
|
- `Mensagens`
|
|
603
684
|
- `Dicas e Tooltips`
|
|
604
685
|
|
|
605
686
|
Ajuste tecnico aplicado durante essa fase:
|
|
606
687
|
- [praxis-dynamic-form-config-editor.ts](/mnt/d/Developer/praxis-plataform/praxis-ui-angular/projects/praxis-dynamic-form/src/lib/config-editor/praxis-dynamic-form-config-editor.ts) agora chama `this.jsonEditor?.updateJsonFromConfig(this.editedConfig)` em `onConfigChange(...)` para manter o editor JSON sincronizado com mudancas vindas de abas como `Hooks`.
|
|
607
|
-
- [actions-editor.component.ts](/mnt/d/Developer/praxis-plataform/praxis-ui-angular/projects/praxis-dynamic-form/src/lib/actions-editor/actions-editor.component.ts) agora
|
|
688
|
+
- [actions-editor.component.ts](/mnt/d/Developer/praxis-plataform/praxis-ui-angular/projects/praxis-dynamic-form/src/lib/actions-editor/actions-editor.component.ts) agora usa o catalogo global canonico do app para o editor de acoes customizadas.
|
|
608
689
|
- [actions-editor.component.ts](/mnt/d/Developer/praxis-plataform/praxis-ui-angular/projects/praxis-dynamic-form/src/lib/actions-editor/actions-editor.component.ts) agora preserva draft local dos campos globais e usa `track` estavel em `actions.custom`.
|
|
609
690
|
|
|
610
691
|
Comando base usado para rerodar suites isoladas:
|
|
@@ -652,6 +733,7 @@ Apache-2.0 – see the `LICENSE` packaged with this library or the repository ro
|
|
|
652
733
|
- Fluxo de Schema (ETag/304, schemaId, reconciliação): `projects/praxis-core/docs/schema-flow.md` (canônico) e `docs/schemas/fluxo-schema.md` (resumo operacional)
|
|
653
734
|
- Guia de implementação e metadados da cascata: `docs/CASCADE-NATIVA.md`
|
|
654
735
|
- Padrões de endpoints (Options vs Filter) para selects: `projects/praxis-dynamic-fields/docs/generic-crud-service.md` (canônico) e `docs/DEVS-GENERIC-CRUD-SERVICE.md` (resumo operacional)
|
|
736
|
+
- Recipe oficial de Entity Lookup corporativo com `RESOURCE_ENTITY`, `dependsOn`, `dependencyFilterMap`, reidratação por `by-ids` e política de seleção: `examples/ai-recipes/praxis-dynamic-form.entity-lookup-procurement.json`
|
|
655
737
|
|
|
656
738
|
## Verificação de Schema (ETag/If-None-Match)
|
|
657
739
|
|
|
@@ -666,9 +748,11 @@ Apache-2.0 – see the `LICENSE` packaged with this library or the repository ro
|
|
|
666
748
|
- `form-schema-prefs:{formId}` → `{ notifyIfOutdated?, snoozeMs?, autoOpenSettingsOnOutdated? }`
|
|
667
749
|
- Por hash (suppress): `schemaIgnore:{formId}:{hash}`, `schemaSnooze:{formId}:{hash}`, `schemaNotified:{formId}:{hash}`
|
|
668
750
|
- Comportamento:
|
|
669
|
-
- Quando
|
|
670
|
-
-
|
|
671
|
-
-
|
|
751
|
+
- Quando existe uma config persistida para o `formId`, o componente normaliza a config local, baixa o schema estrutural canônico e reconcilia `fieldMetadata` antes de montar o formulário.
|
|
752
|
+
- Essa reconciliação preserva customizações locais intencionais, incluindo campos com `source: "local"`, `transient: true` e `submitPolicy`, mas atualiza semântica server-backed publicada pelo schema.
|
|
753
|
+
- Campos de select publicados com `x-ui.endpoint` em `/options/filter` preservam `endpoint` como operação concreta e `resourcePath` como recurso dono. Isso evita usar `/filter` ou consultar schema do endpoint de options por engano.
|
|
754
|
+
- 304 em verificações posteriores apenas atualiza `lastVerifiedAt` e emite `schemaStatusChange(outdated=false)`.
|
|
755
|
+
- 200 em verificações posteriores atualiza `serverHash/lastVerifiedAt`, define `schemaOutdated = enableCustomization && hadBase` e emite `schemaStatusChange`.
|
|
672
756
|
- Primeira vez (sem base): baixa o corpo do schema para gerar o layout; persiste `form-schema-meta:{formId}`.
|
|
673
757
|
- Notificações respeitam preferências e são one‑shot por hash; o banner/snackbar oferecem ações para Reconciliar, Lembrar depois (snooze) e Ignorar.
|
|
674
758
|
|