@praxisui/core 8.0.0-beta.2 → 8.0.0-beta.21

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)
@@ -208,6 +316,62 @@ Regra de leitura:
208
316
  - se o problema for URL, submit, fetch ou schema, pense primeiro em `resourcePath`
209
317
  - se o problema for discovery semantico, contexto de surface/action ou identidade estavel, pense primeiro em `resourceKey`
210
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
+ - navegação: `detail.hrefTemplate`, `routeTemplate`, `openDetailMode`
352
+
353
+ O helper `serializeOptionSourceFilterRequest(...)` monta o envelope canônico de
354
+ Cut B para `POST /option-sources/{sourceKey}/options/filter`, preservando um
355
+ único shape para:
356
+
357
+ - `filter`: filtro legado do recurso hospedeiro
358
+ - `filters`: filtros estruturados do lookup
359
+ - `search`: quick search
360
+ - `sort`: chave metadata-driven de ordenação
361
+ - `includeIds`: reidratação e retenção fora da página atual
362
+
363
+ Para Cut C, o core também publica helpers canônicos para cardinalidade e
364
+ payload de coleção:
365
+
366
+ - `resolveEntityLookupPayloadMode(...)`
367
+ - `isEntityLookupPayloadModeCompatible(...)`
368
+ - `serializeEntityLookupValueForPayload(...)`
369
+
370
+ Assim, `id`, `entityRef`, `ids` e `entityRefs` continuam sob a mesma semântica
371
+ compartilhada entre runtime, submit de formulário e integrações futuras.
372
+
373
+ 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.
374
+
211
375
  ## `x-ui.analytics` no runtime
212
376
 
213
377
  O `@praxisui/core` trata `x-ui.analytics` como a projeção semantica analitica canonica vinda do backend.
@@ -274,7 +438,7 @@ definition: {
274
438
  ```ts
275
439
  shell: {
276
440
  actions: [
277
- { id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
441
+ { id: 'back', icon: 'arrow_back', globalAction: { actionId: 'navigation.back' } }
278
442
  ]
279
443
  }
280
444
  ```
@@ -291,6 +455,7 @@ shell: {
291
455
  - `trackEvent` → `{ eventName, payload }`
292
456
  - `log` → `{ level, message, payload }`
293
457
  - `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
458
+ - `navigation.openRoute` → `{ path, query?, fragment?, replaceUrl?, state? }`
294
459
  - `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
295
460
 
296
461
  ### 5) Rotas dinâmicas (route.register)
@@ -1014,6 +1179,9 @@ export interface TableAppearanceConfig;
1014
1179
  export interface ToolbarConfig;
1015
1180
  export interface TableActionsConfig;
1016
1181
  export interface ExportConfig;
1182
+ export interface PraxisCollectionExportRequest;
1183
+ export interface PraxisCollectionExportProvider;
1184
+ export interface PraxisCollectionSelectionState;
1017
1185
  export interface MessagesConfig;
1018
1186
  export interface LocalizationConfig;
1019
1187
  export interface PerformanceConfig;
@@ -1021,6 +1189,8 @@ export interface AccessibilityConfig;
1021
1189
 
1022
1190
  // Serviços
1023
1191
  export class TableConfigService;
1192
+ export class PraxisCollectionExportService;
1193
+ export class PraxisHttpCollectionExportProvider;
1024
1194
 
1025
1195
  // Helper Functions
1026
1196
  export function createDefaultTableConfig(): TableConfig;
@@ -1029,10 +1199,13 @@ export function isTableConfigV2(config: any): config is TableConfig;
1029
1199
  export function cloneTableConfig(config: TableConfig): TableConfig;
1030
1200
  export function mergeTableConfigs(base: TableConfig, override: Partial<TableConfig>): TableConfig;
1031
1201
  export function getEssentialConfig(config: TableConfig): Partial<TableConfig>;
1202
+ export function providePraxisHttpCollectionExportProvider();
1032
1203
 
1033
1204
  // Type Aliases
1034
1205
  export type TableConfig = TableConfigV2;
1035
1206
  export type TableConfigModern = TableConfigV2;
1207
+ export type PraxisExportFormat;
1208
+ export type PraxisExportScope;
1036
1209
 
1037
1210
  // Legacy (Deprecated)
1038
1211
  export type LegacyTableConfig = TableConfig;