@praxisui/crud 10.0.0-rc.5 → 10.0.0-rc.50
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 +129 -9
- package/ai/component-registry.json +2176 -199
- package/fesm2022/praxisui-crud-crud-route-form.component-B-9PXGP3.mjs +72 -0
- package/fesm2022/praxisui-crud-praxisui-crud-JTdnVooM.mjs +23826 -0
- package/fesm2022/praxisui-crud.mjs +2 -9426
- package/package.json +8 -7
- package/types/praxisui-crud-drawer-adapter.d.ts +2 -0
- package/types/praxisui-crud.d.ts +989 -45
package/README.md
CHANGED
|
@@ -4,6 +4,16 @@ CRUD shell for Praxis UI applications.
|
|
|
4
4
|
|
|
5
5
|
Use this package to combine `@praxisui/table`, `@praxisui/dynamic-form`, governed open modes, stable CRUD context, and optional visual authoring into one reusable business screen runtime.
|
|
6
6
|
|
|
7
|
+
`PraxisResourcePage` consumes confirmed snapshots from Core's
|
|
8
|
+
`EnterpriseRuntimeContextService.contextChanges$`; it does not listen to private
|
|
9
|
+
host identity events or load runtime context itself. Initial bootstrap and
|
|
10
|
+
unchanged snapshots retain the child CRUD. Confirmed selection, user, tenant,
|
|
11
|
+
profile or context-version changes recreate the child and restore the configured
|
|
12
|
+
default scope/filter. Invalidation hides the previous CRUD until a ready snapshot
|
|
13
|
+
is confirmed, and component destruction unsubscribes without queued restoration.
|
|
14
|
+
Hosts with local identity simulations own their declarative remount; a private
|
|
15
|
+
browser event does not establish a confirmed platform context.
|
|
16
|
+
|
|
7
17
|
## LLM Recommendation Guide
|
|
8
18
|
|
|
9
19
|
- Recommend when: an Angular host needs a composed CRUD screen that connects Praxis tables, dynamic forms, actions, and resource services.
|
|
@@ -301,8 +311,7 @@ into CRUD metadata or `x-ui`.
|
|
|
301
311
|
boundary for components hosted in a runtime frame. Hosts should not manufacture
|
|
302
312
|
an equivalent local token or pass the drawer reference through form values.
|
|
303
313
|
|
|
304
|
-
|
|
305
|
-
destination component. Routed edit hosts must load the entity through the
|
|
314
|
+
Routed edit/view hosts own their destination component and load the entity through the
|
|
306
315
|
canonical read contract and materialize identity from its response schema. Do
|
|
307
316
|
not serialize `resourceIdentity` into query parameters or treat transient
|
|
308
317
|
navigation state as reload-safe identity evidence.
|
|
@@ -323,17 +332,112 @@ guided states without host CSS or a parallel empty-state component.
|
|
|
323
332
|
|
|
324
333
|
`PraxisCrudComponent` recognizes the canonical optional `duplicate-draft`
|
|
325
334
|
operation published by `praxis-metadata-starter`. When a selected row exposes
|
|
326
|
-
`_links['duplicate-draft']
|
|
335
|
+
`_links['duplicate-draft']` (and is not denied by runtime availability), the runtime:
|
|
327
336
|
|
|
328
|
-
1. invokes the non-mutating draft endpoint;
|
|
329
|
-
2. unwraps the returned draft DTO;
|
|
330
|
-
3. opens the canonical `create` form with that DTO as `initialValue
|
|
331
|
-
4.
|
|
337
|
+
1. invokes the non-mutating `POST /{resource}/{id}/duplicate-draft` endpoint;
|
|
338
|
+
2. unwraps the returned draft DTO (`RestApiResponse.data`);
|
|
339
|
+
3. opens the canonical `create` form (`mode='create'`) with that DTO as `initialValue`, contextual copy dialog/submit labels (`crud.duplicate.dialogTitleWithSource` / `crud.duplicate.dialogTitleFallback`), `contextIdentity` set to the source record identity (`resourceIdentity` stays unset because a new record is being created), and `focusOrigin` preserved for focus restoration;
|
|
340
|
+
4. in `openMode='route'`, hands off the create seed through `@praxisui/crud`'s `CrudRouteFormHandoffService` (`NavigationExtras.info` opaque marker claimed once by `createCrudFormRoute` / `CrudRouteFormComponent`, scoped by `resourcePath`, `formId`, and route URL, with `canDeactivate` dirty-exit guard and `crud.route.unavailable` status when reloaded without a fresh handoff) without serializing personal or domain fields into URL query parameters, `history.state`, or persistent storage;
|
|
341
|
+
5. refreshes the table only after the user saves the new record via `POST /{resource}`.
|
|
332
342
|
|
|
333
343
|
The host does not need to call `HttpClient`, rebuild create schema URLs, or own
|
|
334
|
-
a second launcher. Absence of the HATEOAS link keeps the operation unavailable;
|
|
344
|
+
a second launcher. Absence of the HATEOAS link or an explicit `allowed: false` availability decision keeps the operation unavailable;
|
|
335
345
|
the runtime does not infer permission from labels, tags, or frontend flags.
|
|
336
346
|
|
|
347
|
+
For a seeded route destination, register the CRUD-owned form host in the host's
|
|
348
|
+
Angular routes and use its URL in the create action:
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
import { createCrudFormRoute } from '@praxisui/crud';
|
|
352
|
+
|
|
353
|
+
export const routes = [
|
|
354
|
+
createCrudFormRoute({
|
|
355
|
+
path: 'employees/copy',
|
|
356
|
+
formId: 'employees-create',
|
|
357
|
+
resourcePath: 'employees',
|
|
358
|
+
}),
|
|
359
|
+
];
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
`formId` and `resourcePath` must match the create action and resource. The seed is
|
|
363
|
+
claimed once during that navigation. Reload, back or direct access without a new
|
|
364
|
+
handoff shows an unavailable state; a custom `RouteReuseStrategy` must not cache
|
|
365
|
+
this destination. Ordinary unseeded form routes keep their existing host flow.
|
|
366
|
+
Modal/drawer restore focus to the surviving launch control; route navigation
|
|
367
|
+
destroys that control and focuses the destination heading.
|
|
368
|
+
|
|
369
|
+
Custom drawer adapters receive an optional `AbortSignal` and must honor it to
|
|
370
|
+
cancel their own asynchronous opening. For `surfaceRuntime.push`, CRUD closes an
|
|
371
|
+
obsolete frame as soon as its reference resolves; it cannot cancel an external
|
|
372
|
+
pending push before a reference exists.
|
|
373
|
+
|
|
374
|
+
The backend owns the copied/cleared field policy. CRUD clones the returned DTO,
|
|
375
|
+
uses the CREATE request schema and preserves an explicit create seed over saved
|
|
376
|
+
overrides. An object seed, including `{}`, suppresses omitted schema/config
|
|
377
|
+
defaults in Dynamic Form, including metadata rebuilds; `false` and `null` remain
|
|
378
|
+
values. Compatible edits survive rebuilds. Ordinary create without an object
|
|
379
|
+
seed keeps defaults. Submit remains POST; cancel/discard sends no create request.
|
|
380
|
+
An unavailable link, denial, preparation error or invalid response never opens an
|
|
381
|
+
empty copy or retries through generic workflow discovery. Links and runtime
|
|
382
|
+
denials are checked again after preparation to reject obsolete results.
|
|
383
|
+
|
|
384
|
+
`createCrudFormRoute` is an additive public helper for seeded create; hosts must
|
|
385
|
+
adopt it for that route. The handoff service and marker are private CRUD runtime,
|
|
386
|
+
not a Form/Core global slot or saved authoring document. They bind the transfer
|
|
387
|
+
to navigation, final URL, resource, form and context. After claim, the destination
|
|
388
|
+
owns its context/lifetime; a normal source teardown after successful guards is
|
|
389
|
+
allowed. Redirects, rejection, cancellation and obsolete context release the
|
|
390
|
+
payload. Explicit `enableCustomization=false`/`true` survives the private handoff;
|
|
391
|
+
absence alone selects the form host's global fallback.
|
|
392
|
+
|
|
393
|
+
Copy title, guidance and submit use CRUD i18n. Domain labels stay host-owned.
|
|
394
|
+
This does not imply complete Form localization: its generated section fallback
|
|
395
|
+
“Informações” in `dynamic-form-layout.service.ts` is an existing runtime i18n gap.
|
|
396
|
+
|
|
397
|
+
## Governed Two-Phase Bulk Operations
|
|
398
|
+
|
|
399
|
+
`PraxisCrudComponent` discovers governed two-phase bulk operations published by
|
|
400
|
+
`praxis-metadata-starter` on collection capabilities (`actions[].execution.bulk`
|
|
401
|
+
for `DOMAIN_COMMAND` and `operations['bulk-update'].bulk` for `UNIFORM_UPDATE`)
|
|
402
|
+
and materializes them in the contextual bulk selection toolbar:
|
|
403
|
+
|
|
404
|
+
1. **Pre-evaluation gates**: validates `limits.maxTargets` before evaluation and
|
|
405
|
+
resolves `expectedVersion` (`ETag`) via `_links.self` only when
|
|
406
|
+
`preconditions.resourceVersion === 'REQUIRED'`.
|
|
407
|
+
2. **Phase 1 — Immutable Proposal (`PraxisBulkOperationDialogComponent` / `PraxisBulkEditDialogComponent`)**:
|
|
408
|
+
hydrates command parameters (unwrapping `/properties/parameters` and OpenAPI
|
|
409
|
+
`$ref` definitions with a resource-and-action-scoped `formId`) or
|
|
410
|
+
`@BulkEditable` fields (`SET` / `CLEAR`), submits the evaluation request, and
|
|
411
|
+
renders target eligibility totals (`executable`, `blocked`) and per-item
|
|
412
|
+
diagnostics.
|
|
413
|
+
3. **Phase 2 — Transactional Confirmation & Reconciliation**: confirms the
|
|
414
|
+
approved `proposalId` with an `Idempotency-Key`, polls asynchronous
|
|
415
|
+
executions until terminal state (`COMPLETED`, `COMPLETED_WITH_ERRORS`,
|
|
416
|
+
`CANCELLED`, `STOPPED`, `RECONCILIATION_REQUIRED`), aggregates all rejection
|
|
417
|
+
categories (`denied`, `invalid`, `conflict`, `notProcessed`, `unknown`),
|
|
418
|
+
clears table selection on full success or deselects only confirmed items on
|
|
419
|
+
partial outcomes so rejected/unprocessed rows remain selected across
|
|
420
|
+
`persistOnDataUpdate: true` table refreshes, and re-fetches capabilities
|
|
421
|
+
when `refresh.capabilities === true`.
|
|
422
|
+
|
|
423
|
+
`CANCEL_REQUESTED` stays pending: requesting cancellation does not imply that the
|
|
424
|
+
server finished. The dialogs keep one execution-tracking subscription, prevent
|
|
425
|
+
duplicate cancellation and accept final results only from canonical terminal
|
|
426
|
+
snapshots. Once terminal, late polling or cancellation callbacks cannot downgrade
|
|
427
|
+
the result. Terminal status is not proof of full success; partial totals and
|
|
428
|
+
reconciliation diagnostics remain visible.
|
|
429
|
+
|
|
430
|
+
If tracking fails or expires, the dialogs show an unknown outcome rather than a
|
|
431
|
+
completed result: server effects may already exist. The explicit resume action
|
|
432
|
+
only reads the same execution with the original proposal/key; it never repeats
|
|
433
|
+
confirmation or evaluation. The person can close this state with `success:false`
|
|
434
|
+
and the last snapshot, without claiming that no effects committed. Tracking ends
|
|
435
|
+
when the dialog closes or is destroyed. Retaining intention/key custody across
|
|
436
|
+
reopening or reload remains a separate requirement, not a guarantee of this flow.
|
|
437
|
+
|
|
438
|
+
Unavailable bulk operations (`availability.allowed === false`) remain visible
|
|
439
|
+
but disabled in the bulk toolbar with their canonical translated reason tooltip.
|
|
440
|
+
|
|
337
441
|
## Visual Authoring
|
|
338
442
|
|
|
339
443
|
The package publishes the CRUD-specific authoring surface:
|
|
@@ -344,6 +448,19 @@ The package publishes the CRUD-specific authoring surface:
|
|
|
344
448
|
- `openCrudMetadataEditor(...)`
|
|
345
449
|
- `PRAXIS_CRUD_AUTHORING_MANIFEST`
|
|
346
450
|
|
|
451
|
+
`CrudMetadataEditorComponent` provides guided authoring tabs for:
|
|
452
|
+
|
|
453
|
+
- **Connection (`resource` / `data` / `pageHeader`)**: bind remote resource paths, `idField`, `endpointKey`, or inspect-only local rows, and author the executive `pageHeader` (`title`, `subtitle`, `domain.label`, `domain.icon`, `domain.tone`) consumed by `PraxisResourcePage`.
|
|
454
|
+
- **Opening & Return (`defaults`)**: configure modal/drawer presentation defaults, header options, and back navigation policy.
|
|
455
|
+
- **Actions (`actions`)**: configure `create`, `view`, `edit`, and `delete` open modes, form bindings, parameter mappings, and initial value seeds. Action expansion panels stay open while typing (`isActionPanelOpen`) until explicitly closed or reset.
|
|
456
|
+
- **KPI Band (`kpiBand`)**: enable or disable the top summary band, author KPI cards (`id`, `label`, `value`, `valueExpr`, `captionExpr`, `variant`/`tone`), bind card click filters (`none`, clear filter `{}`, field equality `{ [field]: value }`, or custom JSON criteria), and preview the rendered band live with CSP-safe arithmetic and pipe evaluation.
|
|
457
|
+
- **Filter Bar (`filterBar`)**: toggle advanced filter visibility (`showAdvanced`), select inline filter fields (`inlineFields`), configure quick filter pills (`quickFilters` with `id`, `label`, `icon`, and `filter` criteria), and control `placement` (`'table-toolbar'` or `'scope-bar'`) without editing raw JSON.
|
|
458
|
+
- **Table (`table`)**: embedded `<praxis-table-inline-authoring-editor>` with explicit column inheritance awareness. When `metadata.table.columns` is `[]` and the CRUD resolves columns dynamically from the bound resource schema (`effectiveTableConfig`), the editor surfaces an inheritance banner showing the resolved resource columns, forwards those columns into the inline table editor for direct inspection/customization, preserves `columns: []` when only toolbar or pagination settings change, and provides a one-click reset back to inherited resource columns after customization.
|
|
459
|
+
- **Form Layout Scope & Persistence (`layoutScope?: 'shared' | 'mode-only'`)**: when customizing an inner `praxis-dynamic-form` inside a CRUD dialog or drawer (`DynamicFormDialogHostComponent`), the **Comportamento & Contexto** tab exposes the layout scope selector (`[data-testid="dynamic-form-layout-scope-toggle"]`):
|
|
460
|
+
- `'shared'` (default): structural layout edits (`sections`, `rows`, `columns`) propagate across sibling modes (`create`, `edit`, `view`) while automatically protecting any sibling mode explicitly locked with `metadata.layoutScope === 'mode-only'`.
|
|
461
|
+
- `'mode-only'`: locks the structural layout exclusively to the active mode (`create`, `edit`, or `view`), isolating it from future shared updates or resets triggered from sibling modes.
|
|
462
|
+
- Both `crud-authoring:<id>` and `praxis-form-config-<id>:<mode>` keys persist seamlessly through `ASYNC_CONFIG_STORAGE` (local `LocalStorageConfigService` or remote `ApiConfigStorage` backed by `praxis-config-starter` at `/api/praxis/config/ui` with `If-Match` / `ETag` concurrency and automatic 412 conflict retry).
|
|
463
|
+
|
|
347
464
|
Use this authoring surface to edit CRUD orchestration metadata. Do not build local CRUD editors in consuming apps when the needed behavior belongs to the package contract.
|
|
348
465
|
|
|
349
466
|
## AI Authoring
|
|
@@ -352,6 +469,8 @@ Use this authoring surface to edit CRUD orchestration metadata. Do not build loc
|
|
|
352
469
|
|
|
353
470
|
- `resource.bind`
|
|
354
471
|
- `list.surface.configure`
|
|
472
|
+
- `list.kpiBand.configure`
|
|
473
|
+
- `list.filterBar.configure`
|
|
355
474
|
- `surface.create.configure`
|
|
356
475
|
- `surface.edit.configure`
|
|
357
476
|
- `surface.view.configure`
|
|
@@ -367,9 +486,10 @@ The manifest owns CRUD orchestration only. It delegates table, form, field, and
|
|
|
367
486
|
Main exports:
|
|
368
487
|
|
|
369
488
|
- `PraxisCrudComponent`
|
|
489
|
+
- `PraxisBulkOperationDialogComponent`, `PraxisBulkEditDialogComponent`
|
|
370
490
|
- `CrudLauncherService`
|
|
371
491
|
- `DynamicFormDialogHostComponent`
|
|
372
|
-
- `CrudMetadata`, `CrudActionFormContract`, `CrudDefaults`, `CrudParamMapping`
|
|
492
|
+
- `CrudMetadata`, `CrudActionFormContract`, `CrudDefaults`, `CrudParamMapping`, `CrudKpiBandConfig`, `CrudKpiCardConfig`, `CrudKpiCardVariant`, `CrudFilterBarConfig`, `CrudFilterBarQuickFilter`
|
|
373
493
|
- `DialogService`
|
|
374
494
|
- `CrudPageHeaderComponent`
|
|
375
495
|
- `CrudMetadataEditorComponent`
|