@praxisui/core 8.0.0-beta.0 → 8.0.0-beta.100

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.
@@ -59,6 +86,15 @@ Exemplo completo (app de referência)
59
86
 
60
87
  ### 1) `PraxisIconDirective`
61
88
 
89
+ Hosts devem carregar Material Symbols para ícones `mso:*` e Material Icons classic quando usarem `mi:*`, componentes legados baseados em ligature classic, ou `mat-icon.material-icons`. Sem Material Icons classic, a ligature pode aparecer como texto visível, por exemplo `clear` dentro de um select.
90
+
91
+ Para alinhar tokens e superfícies Angular Material/Praxis, importe o asset canônico do pacote depois do tema Angular Material e do CSS do CDK Overlay:
92
+
93
+ ```scss
94
+ @import "@angular/cdk/overlay-prebuilt.css";
95
+ @import "@praxisui/core/theme-bridge.css";
96
+ ```
97
+
62
98
  ```ts
63
99
  import { Component } from '@angular/core';
64
100
  import { MatIconModule } from '@angular/material/icon';
@@ -111,6 +147,42 @@ export class GridDemoComponent {
111
147
 
112
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.
113
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
+
114
186
  ### Component config editors
115
187
 
116
188
  `ComponentDocMeta.configEditor` é a superfície pública canônica para um
@@ -150,6 +222,29 @@ Regra de plataforma: não crie editor local no host para uma semântica que já
150
222
  tem dono canônico. Corrija ou publique o `configEditor` no metadata da lib dona
151
223
  do componente.
152
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
+
153
248
  ### Widget Shell body layout
154
249
 
155
250
  `WidgetShellConfig.bodyLayout` declares how projected widget content should use
@@ -170,6 +265,28 @@ state, because the fill body intentionally hides overflow.
170
265
  [`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
171
266
  para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
172
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
+
173
290
  ## 📄 Documentacao Tecnica da Lib
174
291
 
175
292
  - `projects/praxis-core/docs/connection-editor.md` (historico legado; fora do fluxo ativo)
@@ -199,6 +316,76 @@ Regra de leitura:
199
316
  - se o problema for URL, submit, fetch ou schema, pense primeiro em `resourcePath`
200
317
  - se o problema for discovery semantico, contexto de surface/action ou identidade estavel, pense primeiro em `resourceKey`
201
318
 
319
+ ## `x-ui.optionSource` e Entity Lookup
320
+
321
+ `@praxisui/core` preserva `x-ui.optionSource` como contrato canônico de opções remotas e lookups de entidade publicados por `/schemas/filtered`.
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
+
343
+ Para `RESOURCE_ENTITY`, o `SchemaNormalizerService` mantém a semântica enriquecida usada pelos consumidores:
344
+
345
+ - identidade: `entityKey`, `valuePropertyPath`, `labelPropertyPath`, `codePropertyPath`
346
+ - exibição: `descriptionPropertyPaths`, `statusPropertyPath`, `disabledReasonPropertyPath`
347
+ - busca e cascata: `searchPropertyPaths`, `dependsOn`, `dependencyFilterMap`
348
+ - filtro rico: `filtering.availableFilters`, `defaultFilters`, `sortOptions`, `defaultSort`, `quickFilterFields`, `searchPlaceholder`
349
+ - seleção: `selectionPolicy.allowedStatuses`, `blockedStatuses`, `allowRetainInvalidExistingValue`
350
+ - operação: `capabilities.byIds`, `navigateToDetail`, `create`, `auditSnapshot`
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.
386
+
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.
388
+
202
389
  ## `x-ui.analytics` no runtime
203
390
 
204
391
  O `@praxisui/core` trata `x-ui.analytics` como a projeção semantica analitica canonica vinda do backend.
@@ -265,7 +452,7 @@ definition: {
265
452
  ```ts
266
453
  shell: {
267
454
  actions: [
268
- { id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
455
+ { id: 'back', icon: 'arrow_back', globalAction: { actionId: 'navigation.back' } }
269
456
  ]
270
457
  }
271
458
  ```
@@ -282,6 +469,7 @@ shell: {
282
469
  - `trackEvent` → `{ eventName, payload }`
283
470
  - `log` → `{ level, message, payload }`
284
471
  - `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
472
+ - `navigation.openRoute` → `{ path, query?, fragment?, replaceUrl?, state? }`
285
473
  - `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
286
474
 
287
475
  ### 5) Rotas dinâmicas (route.register)
@@ -1005,6 +1193,9 @@ export interface TableAppearanceConfig;
1005
1193
  export interface ToolbarConfig;
1006
1194
  export interface TableActionsConfig;
1007
1195
  export interface ExportConfig;
1196
+ export interface PraxisCollectionExportRequest;
1197
+ export interface PraxisCollectionExportProvider;
1198
+ export interface PraxisCollectionSelectionState;
1008
1199
  export interface MessagesConfig;
1009
1200
  export interface LocalizationConfig;
1010
1201
  export interface PerformanceConfig;
@@ -1012,6 +1203,8 @@ export interface AccessibilityConfig;
1012
1203
 
1013
1204
  // Serviços
1014
1205
  export class TableConfigService;
1206
+ export class PraxisCollectionExportService;
1207
+ export class PraxisHttpCollectionExportProvider;
1015
1208
 
1016
1209
  // Helper Functions
1017
1210
  export function createDefaultTableConfig(): TableConfig;
@@ -1020,10 +1213,13 @@ export function isTableConfigV2(config: any): config is TableConfig;
1020
1213
  export function cloneTableConfig(config: TableConfig): TableConfig;
1021
1214
  export function mergeTableConfigs(base: TableConfig, override: Partial<TableConfig>): TableConfig;
1022
1215
  export function getEssentialConfig(config: TableConfig): Partial<TableConfig>;
1216
+ export function providePraxisHttpCollectionExportProvider();
1023
1217
 
1024
1218
  // Type Aliases
1025
1219
  export type TableConfig = TableConfigV2;
1026
1220
  export type TableConfigModern = TableConfigV2;
1221
+ export type PraxisExportFormat;
1222
+ export type PraxisExportScope;
1027
1223
 
1028
1224
  // Legacy (Deprecated)
1029
1225
  export type LegacyTableConfig = TableConfig;