@praxisui/core 8.0.0-beta.1 → 8.0.0-beta.12

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,18 @@
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
+ ## Form Layout Contract
18
+
19
+ `FormColumn.items` and the exported `FormLayoutItem` contract define the
20
+ canonical ordered content of a form column. Items with `kind: 'field'` reference
21
+ `fieldMetadata[].name`; items with `kind: 'richContent'` host visual content and
22
+ do not participate in `fieldMetadata`, `formData`, or submit payloads.
23
+
24
+ `FormColumn.fields` is still accepted as migration input and as a derived
25
+ projection of `kind: 'field'` items. New authors and tools should use `items[]`
26
+ as the canonical source and the helpers exported from
27
+ `form-layout-items.model`.
28
+
17
29
  ## 🌟 Visão Geral
18
30
 
19
31
  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 +132,42 @@ export class GridDemoComponent {
120
132
 
121
133
  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
134
 
135
+ #### Composition links e nested component ports
136
+
137
+ O wiring persistido de páginas dinâmicas deve usar `page.composition.links`.
138
+ `page.connections` é formato legado/residual e não deve ser usado para novas
139
+ páginas ou exemplos.
140
+
141
+ Para conectar componentes internos de containers como `praxis-tabs` e
142
+ `praxis-expansion`, use endpoints `component-port` com `ref.nestedPath`:
143
+
144
+ ```json
145
+ {
146
+ "kind": "component-port",
147
+ "ref": {
148
+ "widget": "tabs-widget",
149
+ "nestedPath": [
150
+ { "kind": "tab", "id": "analytics", "index": 0 },
151
+ { "kind": "widget", "key": "sales-chart", "componentType": "praxis-chart" }
152
+ ],
153
+ "port": "pointClick",
154
+ "direction": "output",
155
+ "componentType": "praxis-chart"
156
+ }
157
+ }
158
+ ```
159
+
160
+ Regras de plataforma:
161
+
162
+ - `ref.widget` é sempre o owner top-level presente em `page.widgets`;
163
+ - `nestedPath` é relativo ao owner e deve terminar com segmento
164
+ `kind: "widget"` contendo `key` estável;
165
+ - `ref.port` representa a porta real do componente filho;
166
+ - `widgetEvent` em containers compostos é bridge avançada/legado, não caminho
167
+ principal de authoring;
168
+ - `bindingPath` e dot-path profundo não são endereço canônico para nested
169
+ component ports.
170
+
123
171
  ### Component config editors
124
172
 
125
173
  `ComponentDocMeta.configEditor` é a superfície pública canônica para um
@@ -179,6 +227,28 @@ state, because the fill body intentionally hides overflow.
179
227
  [`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
180
228
  para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
181
229
 
230
+ ### Collection Export
231
+
232
+ `PraxisCollectionExportService` é o contrato canônico para exportação de coleções usado por Table, List e próximos componentes de dados.
233
+
234
+ - sem provider registrado, CSV/JSON local usa `loadedItems` e aplica escape de fórmulas para planilhas;
235
+ - com `providePraxisHttpCollectionExportProvider()`, o host registra o provider HTTP oficial;
236
+ - o provider HTTP envia `POST /{resourcePath}/export` usando `API_URL`;
237
+ - escopos remotos `filtered` e `all` omitem `loadedItems` por padrão e delegam query/sort/paginação/seleção ao backend;
238
+ - a resposta pode ser um arquivo binário com `content-disposition` ou um `PraxisCollectionExportResult` JSON;
239
+ - resultados JSON suportam `status: 'completed' | 'deferred'`, `downloadUrl`, `jobId`, `warnings` e `metadata`;
240
+ - resultados `completed` sem `content` nem `downloadUrl` são tratados como erro de contrato pelo runtime.
241
+
242
+ ```ts
243
+ import { providePraxisHttpCollectionExportProvider } from '@praxisui/core';
244
+
245
+ export const appConfig = {
246
+ providers: [
247
+ providePraxisHttpCollectionExportProvider(),
248
+ ],
249
+ };
250
+ ```
251
+
182
252
  ## 📄 Documentacao Tecnica da Lib
183
253
 
184
254
  - `projects/praxis-core/docs/connection-editor.md` (historico legado; fora do fluxo ativo)
@@ -208,6 +278,21 @@ Regra de leitura:
208
278
  - se o problema for URL, submit, fetch ou schema, pense primeiro em `resourcePath`
209
279
  - se o problema for discovery semantico, contexto de surface/action ou identidade estavel, pense primeiro em `resourceKey`
210
280
 
281
+ ## `x-ui.optionSource` e Entity Lookup
282
+
283
+ `@praxisui/core` preserva `x-ui.optionSource` como contrato canônico de opções remotas e lookups de entidade publicados por `/schemas/filtered`.
284
+
285
+ Para `RESOURCE_ENTITY`, o `SchemaNormalizerService` mantém a semântica enriquecida usada pelos consumidores:
286
+
287
+ - identidade: `entityKey`, `valuePropertyPath`, `labelPropertyPath`, `codePropertyPath`
288
+ - exibição: `descriptionPropertyPaths`, `statusPropertyPath`, `disabledReasonPropertyPath`
289
+ - busca e cascata: `searchPropertyPaths`, `dependsOn`, `dependencyFilterMap`
290
+ - seleção: `selectionPolicy.allowedStatuses`, `blockedStatuses`, `allowRetainInvalidExistingValue`
291
+ - operação: `capabilities.byIds`, `navigateToDetail`, `create`, `auditSnapshot`
292
+ - navegação: `detail.hrefTemplate`, `routeTemplate`, `openDetailMode`
293
+
294
+ 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.
295
+
211
296
  ## `x-ui.analytics` no runtime
212
297
 
213
298
  O `@praxisui/core` trata `x-ui.analytics` como a projeção semantica analitica canonica vinda do backend.
@@ -274,7 +359,7 @@ definition: {
274
359
  ```ts
275
360
  shell: {
276
361
  actions: [
277
- { id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
362
+ { id: 'back', icon: 'arrow_back', globalAction: { actionId: 'navigation.back' } }
278
363
  ]
279
364
  }
280
365
  ```
@@ -1014,6 +1099,9 @@ export interface TableAppearanceConfig;
1014
1099
  export interface ToolbarConfig;
1015
1100
  export interface TableActionsConfig;
1016
1101
  export interface ExportConfig;
1102
+ export interface PraxisCollectionExportRequest;
1103
+ export interface PraxisCollectionExportProvider;
1104
+ export interface PraxisCollectionSelectionState;
1017
1105
  export interface MessagesConfig;
1018
1106
  export interface LocalizationConfig;
1019
1107
  export interface PerformanceConfig;
@@ -1021,6 +1109,8 @@ export interface AccessibilityConfig;
1021
1109
 
1022
1110
  // Serviços
1023
1111
  export class TableConfigService;
1112
+ export class PraxisCollectionExportService;
1113
+ export class PraxisHttpCollectionExportProvider;
1024
1114
 
1025
1115
  // Helper Functions
1026
1116
  export function createDefaultTableConfig(): TableConfig;
@@ -1029,10 +1119,13 @@ export function isTableConfigV2(config: any): config is TableConfig;
1029
1119
  export function cloneTableConfig(config: TableConfig): TableConfig;
1030
1120
  export function mergeTableConfigs(base: TableConfig, override: Partial<TableConfig>): TableConfig;
1031
1121
  export function getEssentialConfig(config: TableConfig): Partial<TableConfig>;
1122
+ export function providePraxisHttpCollectionExportProvider();
1032
1123
 
1033
1124
  // Type Aliases
1034
1125
  export type TableConfig = TableConfigV2;
1035
1126
  export type TableConfigModern = TableConfigV2;
1127
+ export type PraxisExportFormat;
1128
+ export type PraxisExportScope;
1036
1129
 
1037
1130
  // Legacy (Deprecated)
1038
1131
  export type LegacyTableConfig = TableConfig;