@praxisui/core 8.0.0-beta.9 → 8.0.0-beta.91

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 CHANGED
@@ -14,6 +14,33 @@
14
14
  - Keep icon, config and dynamic widget infrastructure aligned in the host app
15
15
  - Avoid duplicating low-level primitives across multiple business libraries
16
16
 
17
+ ## Governed Semantic Decisions
18
+
19
+ `DomainKnowledgeService` is the shared client for the governed Domain Knowledge
20
+ change-set lifecycle exposed by `praxis-config-starter` at
21
+ `/api/praxis/config/domain-knowledge/change-sets`. It intentionally models the
22
+ separate platform boundaries for `create`, `validate`, governed status
23
+ transition and `apply`, so consuming UIs can continue an AI-authored semantic
24
+ decision without treating the frontend as the primary source of business rules.
25
+
26
+ Use it when a cockpit or runtime needs to propose safe evidence, review a
27
+ change-set projection, approve/reject the proposal, apply an approved change set
28
+ or read back safe summaries. Runtime surfaces must continue to treat the
29
+ resulting materializations as derived projections of the canonical semantic
30
+ decision.
31
+
32
+ ## Form Layout Contract
33
+
34
+ `FormColumn.items` and the exported `FormLayoutItem` contract define the
35
+ canonical ordered content of a form column. Items with `kind: 'field'` reference
36
+ `fieldMetadata[].name`; items with `kind: 'richContent'` host visual content and
37
+ do not participate in `fieldMetadata`, `formData`, or submit payloads.
38
+
39
+ `FormColumn.fields` is still accepted as migration input and as a derived
40
+ projection of `kind: 'field'` items. New authors and tools should use `items[]`
41
+ as the canonical source and the helpers exported from
42
+ `form-layout-items.model`.
43
+
17
44
  ## 🌟 Visão Geral
18
45
 
19
46
  A biblioteca `@praxisui/core` é o núcleo do Praxis UI Workspace, fornecendo interfaces robustas, serviços base e utilitários essenciais para todas as outras bibliotecas do ecossistema. Com a arquitetura unificada, oferece uma experiência de desenvolvimento consistente e type-safe.
@@ -120,6 +147,42 @@ export class GridDemoComponent {
120
147
 
121
148
  Observação: os IDs de widgets usados na página devem estar registrados via `ComponentMetadataRegistry` para que o carregador dinâmico resolva os componentes.
122
149
 
150
+ #### Composition links e nested component ports
151
+
152
+ O wiring persistido de páginas dinâmicas deve usar `page.composition.links`.
153
+ `page.connections` é formato legado/residual e não deve ser usado para novas
154
+ páginas ou exemplos.
155
+
156
+ Para conectar componentes internos de containers como `praxis-tabs` e
157
+ `praxis-expansion`, use endpoints `component-port` com `ref.nestedPath`:
158
+
159
+ ```json
160
+ {
161
+ "kind": "component-port",
162
+ "ref": {
163
+ "widget": "tabs-widget",
164
+ "nestedPath": [
165
+ { "kind": "tab", "id": "analytics", "index": 0 },
166
+ { "kind": "widget", "key": "sales-chart", "componentType": "praxis-chart" }
167
+ ],
168
+ "port": "pointClick",
169
+ "direction": "output",
170
+ "componentType": "praxis-chart"
171
+ }
172
+ }
173
+ ```
174
+
175
+ Regras de plataforma:
176
+
177
+ - `ref.widget` é sempre o owner top-level presente em `page.widgets`;
178
+ - `nestedPath` é relativo ao owner e deve terminar com segmento
179
+ `kind: "widget"` contendo `key` estável;
180
+ - `ref.port` representa a porta real do componente filho;
181
+ - `widgetEvent` em containers compostos é bridge avançada/legado, não caminho
182
+ principal de authoring;
183
+ - `bindingPath` e dot-path profundo não são endereço canônico para nested
184
+ component ports.
185
+
123
186
  ### Component config editors
124
187
 
125
188
  `ComponentDocMeta.configEditor` é a superfície pública canônica para um
@@ -159,6 +222,29 @@ Regra de plataforma: não crie editor local no host para uma semântica que já
159
222
  tem dono canônico. Corrija ou publique o `configEditor` no metadata da lib dona
160
223
  do componente.
161
224
 
225
+ ### Component AI authoring manifests
226
+
227
+ `ComponentDocMeta.authoringManifestRef` é a superfície pública canônica para um
228
+ componente declarar que possui manifesto executável de authoring por IA. O
229
+ manifesto continua pertencendo à lib dona do componente; hosts e page builders
230
+ devem usar esse campo para discovery, delegação e readiness, não para redefinir
231
+ operações internas localmente.
232
+
233
+ Contrato esperado:
234
+
235
+ ```ts
236
+ registry.register({
237
+ id: 'praxis-table',
238
+ selector: 'praxis-table',
239
+ component: PraxisTable,
240
+ friendlyName: 'Praxis Table',
241
+ authoringManifestRef: {
242
+ componentId: 'praxis-table',
243
+ source: 'PRAXIS_TABLE_AUTHORING_MANIFEST',
244
+ },
245
+ });
246
+ ```
247
+
162
248
  ### Widget Shell body layout
163
249
 
164
250
  `WidgetShellConfig.bodyLayout` declares how projected widget content should use
@@ -179,6 +265,28 @@ state, because the fill body intentionally hides overflow.
179
265
  [`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
180
266
  para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
181
267
 
268
+ ### Collection Export
269
+
270
+ `PraxisCollectionExportService` é o contrato canônico para exportação de coleções usado por Table, List e próximos componentes de dados.
271
+
272
+ - sem provider registrado, CSV/JSON local usa `loadedItems` e aplica escape de fórmulas para planilhas;
273
+ - com `providePraxisHttpCollectionExportProvider()`, o host registra o provider HTTP oficial;
274
+ - o provider HTTP envia `POST /{resourcePath}/export` usando `API_URL`;
275
+ - escopos remotos `filtered` e `all` omitem `loadedItems` por padrão e delegam query/sort/paginação/seleção ao backend;
276
+ - a resposta pode ser um arquivo binário com `content-disposition` ou um `PraxisCollectionExportResult` JSON;
277
+ - resultados JSON suportam `status: 'completed' | 'deferred'`, `downloadUrl`, `jobId`, `warnings` e `metadata`;
278
+ - resultados `completed` sem `content` nem `downloadUrl` são tratados como erro de contrato pelo runtime.
279
+
280
+ ```ts
281
+ import { providePraxisHttpCollectionExportProvider } from '@praxisui/core';
282
+
283
+ export const appConfig = {
284
+ providers: [
285
+ providePraxisHttpCollectionExportProvider(),
286
+ ],
287
+ };
288
+ ```
289
+
182
290
  ## 📄 Documentacao Tecnica da Lib
183
291
 
184
292
  - `projects/praxis-core/docs/connection-editor.md` (historico legado; fora do fluxo ativo)
@@ -212,14 +320,69 @@ Regra de leitura:
212
320
 
213
321
  `@praxisui/core` preserva `x-ui.optionSource` como contrato canônico de opções remotas e lookups de entidade publicados por `/schemas/filtered`.
214
322
 
323
+ Os tipos públicos exportados para esse contrato ficam em `option-source.model`:
324
+
325
+ - `OptionSourceMetadata`
326
+ - `LookupFilteringMetadata`
327
+ - `LookupFilterDefinitionMetadata`
328
+ - `LookupSortOptionMetadata`
329
+ - `LookupFilterRequest`
330
+ - `OptionSourceFilterRequest`
331
+ - `LookupSelectionPolicyMetadata`
332
+ - `LookupCapabilitiesMetadata`
333
+ - `LookupDetailMetadata`
334
+ - `LookupCreateMetadata`
335
+ - `LookupDialogMetadata`
336
+ - `LookupResultColumnMetadata`
337
+ - `EntityLookupDisplayMetadata`
338
+ - `EntityLookupCollectionMetadata`
339
+ - `EntityLookupPayloadMode`
340
+ - `EntityLookupResult`
341
+ - `EntityRef`
342
+
215
343
  Para `RESOURCE_ENTITY`, o `SchemaNormalizerService` mantém a semântica enriquecida usada pelos consumidores:
216
344
 
217
345
  - identidade: `entityKey`, `valuePropertyPath`, `labelPropertyPath`, `codePropertyPath`
218
346
  - exibição: `descriptionPropertyPaths`, `statusPropertyPath`, `disabledReasonPropertyPath`
219
347
  - busca e cascata: `searchPropertyPaths`, `dependsOn`, `dependencyFilterMap`
348
+ - filtro rico: `filtering.availableFilters`, `defaultFilters`, `sortOptions`, `defaultSort`, `quickFilterFields`, `searchPlaceholder`
220
349
  - seleção: `selectionPolicy.allowedStatuses`, `blockedStatuses`, `allowRetainInvalidExistingValue`
221
350
  - operação: `capabilities.byIds`, `navigateToDetail`, `create`, `auditSnapshot`
222
- - navegação: `detail.hrefTemplate`, `routeTemplate`, `openDetailMode`
351
+ - detalhe governado: `detail.kind = surface`, `surfaceId`, `presentation`, `preferredWidget`, `mode`
352
+ - UX de referência: `display.preset`, `usage`, `density`, `selectedLayout`, `resultLayout`, `fields`, `secondaryPropertyPaths`, `badgePropertyPaths`
353
+
354
+ O bloco `display` descreve intenção de apresentação, não implementação visual local.
355
+ Presets como `directory`, `reference`, `status`, `hierarchical`, `rich` e
356
+ `compact` permitem que a mesma option-source seja usada em formulário, filtro,
357
+ tabela editável, dashboard ou revisão sem duplicar regras no host. O runtime
358
+ pode aplicar overrides locais quando o contexto exigir, mas a semântica
359
+ preferencial continua no `optionSource`.
360
+ Use `display.fields[]` para publicar subinformações ricas do resultado, como
361
+ `cargo`, `departamento`, `dataAdmissao`, `status` ou métricas. Cada campo carrega
362
+ `propertyPath`, `label`, `icon`, `presentation`, `tone` e `format`; o endpoint de
363
+ option-source pode materializar esses campos em `OptionDTO.extra.richFields[]`
364
+ para que runtimes exibam ícones, chips, badges ou valores formatados sem
365
+ heurística local.
366
+
367
+ O helper `serializeOptionSourceFilterRequest(...)` monta o envelope canônico de
368
+ Cut B para `POST /option-sources/{sourceKey}/options/filter`, preservando um
369
+ único shape para:
370
+
371
+ - `filter`: filtro legado do recurso hospedeiro
372
+ - `filters`: filtros estruturados do lookup
373
+ - `search`: quick search
374
+ - `sort`: chave metadata-driven de ordenação
375
+ - `includeIds`: reidratação e retenção fora da página atual
376
+
377
+ Para Cut C, o core também publica helpers canônicos para cardinalidade e
378
+ payload de coleção:
379
+
380
+ - `resolveEntityLookupPayloadMode(...)`
381
+ - `isEntityLookupPayloadModeCompatible(...)`
382
+ - `serializeEntityLookupValueForPayload(...)`
383
+
384
+ Assim, `id`, `entityRef`, `ids` e `entityRefs` continuam sob a mesma semântica
385
+ compartilhada entre runtime, submit de formulário e integrações futuras.
223
386
 
224
387
  O mapper de `FieldDefinition` para `FieldMetadata` deriva apenas a ponte runtime necessária (`dependencyFields` e `dependencyFilterMap`) a partir de `optionSource.dependsOn`. Ele não inventa política de reset, reload ou persistência; essas decisões continuam explícitas no metadata do campo.
225
388
 
@@ -289,7 +452,7 @@ definition: {
289
452
  ```ts
290
453
  shell: {
291
454
  actions: [
292
- { id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
455
+ { id: 'back', icon: 'arrow_back', globalAction: { actionId: 'navigation.back' } }
293
456
  ]
294
457
  }
295
458
  ```
@@ -306,6 +469,7 @@ shell: {
306
469
  - `trackEvent` → `{ eventName, payload }`
307
470
  - `log` → `{ level, message, payload }`
308
471
  - `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
472
+ - `navigation.openRoute` → `{ path, query?, fragment?, replaceUrl?, state? }`
309
473
  - `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
310
474
 
311
475
  ### 5) Rotas dinâmicas (route.register)
@@ -1029,6 +1193,9 @@ export interface TableAppearanceConfig;
1029
1193
  export interface ToolbarConfig;
1030
1194
  export interface TableActionsConfig;
1031
1195
  export interface ExportConfig;
1196
+ export interface PraxisCollectionExportRequest;
1197
+ export interface PraxisCollectionExportProvider;
1198
+ export interface PraxisCollectionSelectionState;
1032
1199
  export interface MessagesConfig;
1033
1200
  export interface LocalizationConfig;
1034
1201
  export interface PerformanceConfig;
@@ -1036,6 +1203,8 @@ export interface AccessibilityConfig;
1036
1203
 
1037
1204
  // Serviços
1038
1205
  export class TableConfigService;
1206
+ export class PraxisCollectionExportService;
1207
+ export class PraxisHttpCollectionExportProvider;
1039
1208
 
1040
1209
  // Helper Functions
1041
1210
  export function createDefaultTableConfig(): TableConfig;
@@ -1044,10 +1213,13 @@ export function isTableConfigV2(config: any): config is TableConfig;
1044
1213
  export function cloneTableConfig(config: TableConfig): TableConfig;
1045
1214
  export function mergeTableConfigs(base: TableConfig, override: Partial<TableConfig>): TableConfig;
1046
1215
  export function getEssentialConfig(config: TableConfig): Partial<TableConfig>;
1216
+ export function providePraxisHttpCollectionExportProvider();
1047
1217
 
1048
1218
  // Type Aliases
1049
1219
  export type TableConfig = TableConfigV2;
1050
1220
  export type TableConfigModern = TableConfigV2;
1221
+ export type PraxisExportFormat;
1222
+ export type PraxisExportScope;
1051
1223
 
1052
1224
  // Legacy (Deprecated)
1053
1225
  export type LegacyTableConfig = TableConfig;