@praxisui/core 1.0.0-beta.5 → 1.0.0-beta.52
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 +162 -2
- package/fesm2022/praxisui-core.mjs +11537 -3713
- package/fesm2022/praxisui-core.mjs.map +1 -1
- package/index.d.ts +3107 -806
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
> Biblioteca central com interfaces e serviços fundamentais para o Praxis UI Workspace
|
|
4
4
|
|
|
5
|
+
## 🔰 Exemplos / Quickstart
|
|
6
|
+
|
|
7
|
+
Para ver esta biblioteca em funcionamento em uma aplicação completa, utilize o projeto de exemplo (Quickstart):
|
|
8
|
+
|
|
9
|
+
- Repositório: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
10
|
+
- O Quickstart demonstra a integração das bibliotecas `@praxisui/*` em um app Angular, incluindo instalação, configuração e uso em telas reais.
|
|
11
|
+
|
|
5
12
|
## 🌟 Visão Geral
|
|
6
13
|
|
|
7
14
|
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.
|
|
@@ -35,6 +42,9 @@ A biblioteca `@praxisui/core` é o núcleo do Praxis UI Workspace, fornecendo in
|
|
|
35
42
|
npm install @praxisui/core
|
|
36
43
|
```
|
|
37
44
|
|
|
45
|
+
Exemplo completo (app de referência)
|
|
46
|
+
- Quickstart: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
47
|
+
|
|
38
48
|
### Peer dependencies (Angular v20)
|
|
39
49
|
|
|
40
50
|
- `@angular/core` `^20.0.0`
|
|
@@ -105,6 +115,153 @@ Observação: os IDs de widgets usados na página devem estar registrados via `C
|
|
|
105
115
|
[`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
|
|
106
116
|
para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
|
|
107
117
|
|
|
118
|
+
## 📄 Documentacao Tecnica da Lib
|
|
119
|
+
|
|
120
|
+
- `projects/praxis-core/docs/connection-editor.md`
|
|
121
|
+
- `projects/praxis-core/docs/dynamic-gridster-page.md`
|
|
122
|
+
- `projects/praxis-core/docs/schema-flow.md`
|
|
123
|
+
|
|
124
|
+
## ⚙️ Global Config (bootstrap)
|
|
125
|
+
|
|
126
|
+
- Use `provideGlobalConfigTenant(...)` para definir o tenant e bloquear o bootstrap até a config remota ser carregada.
|
|
127
|
+
- Se não houver tenant, use `provideGlobalConfigReady()` para apenas aguardar o carregamento remoto.
|
|
128
|
+
|
|
129
|
+
## 🌐 Global Actions (shell + widgets)
|
|
130
|
+
|
|
131
|
+
O core agora suporta **ações globais** executadas por widgets e pelo Widget Shell, permitindo integrar navegação, dialog, toast, analytics, API e rotas dinâmicas de forma padronizada.
|
|
132
|
+
|
|
133
|
+
### 1) Providers (plug-and-play no host)
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import {
|
|
137
|
+
providePraxisGlobalActions,
|
|
138
|
+
providePraxisToastGlobalActions,
|
|
139
|
+
providePraxisAnalyticsGlobalActions,
|
|
140
|
+
} from '@praxisui/core';
|
|
141
|
+
import { providePraxisDialogGlobalActions } from '@praxisui/dialog';
|
|
142
|
+
|
|
143
|
+
providers: [
|
|
144
|
+
...providePraxisGlobalActions({ dialog: false, toast: false, analytics: false }),
|
|
145
|
+
providePraxisDialogGlobalActions(),
|
|
146
|
+
providePraxisToastGlobalActions(),
|
|
147
|
+
providePraxisAnalyticsGlobalActions({ prefix: 'app' }),
|
|
148
|
+
]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 2) Mapeando outputs para ações globais
|
|
152
|
+
|
|
153
|
+
`WidgetDefinition.outputs` pode apontar para ações globais:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
definition: {
|
|
157
|
+
id: 'praxis-dynamic-form',
|
|
158
|
+
outputs: {
|
|
159
|
+
formSubmit: {
|
|
160
|
+
type: 'api.post',
|
|
161
|
+
params: { url: '/api/clientes', body: '${payload.formData}' }
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 3) Ação global no Widget Shell
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
shell: {
|
|
171
|
+
actions: [
|
|
172
|
+
{ id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 4) Catálogo básico de ações globais
|
|
178
|
+
|
|
179
|
+
- `navigation.back`
|
|
180
|
+
- `navigation.openExternal` → `{ url }`
|
|
181
|
+
- `dialog.alert` → `{ title, message, variant }`
|
|
182
|
+
- `dialog.prompt` → `{ title, message, placeholder, defaultValue }`
|
|
183
|
+
- `dialog.open` → `{ componentId, inputs, size, data }`
|
|
184
|
+
- `toast.success` / `toast.error` → `{ message }`
|
|
185
|
+
- `clipboard.copy` → `{ text }`
|
|
186
|
+
- `trackEvent` → `{ eventName, payload }`
|
|
187
|
+
- `log` → `{ level, message, payload }`
|
|
188
|
+
- `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
|
|
189
|
+
- `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
|
|
190
|
+
|
|
191
|
+
### 5) Rotas dinâmicas (route.register)
|
|
192
|
+
|
|
193
|
+
Requer `componentId` **ou** `loadChildren`. Guards são resolvidos pelo host via `GLOBAL_ROUTE_GUARD_RESOLVER`.
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
// payload
|
|
197
|
+
{
|
|
198
|
+
path: '/clientes/novo',
|
|
199
|
+
componentId: 'praxis-dynamic-page',
|
|
200
|
+
data: { pageId: 'clientes-novo' },
|
|
201
|
+
guards: ['auth', 'permission:clientes.create'],
|
|
202
|
+
position: 'before-wildcard'
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
As rotas registradas são persistidas em `GlobalConfig.routes.dynamic`. O host deve re‑hidratar isso no bootstrap (ex.: ler `GlobalConfigService` e re‑aplicar com `route.register`).
|
|
207
|
+
|
|
208
|
+
### 7) Output mapeado para ação global x conexões
|
|
209
|
+
|
|
210
|
+
Quando `WidgetDefinition.outputs[output]` aponta para uma ação global (não `'emit'`), o evento **não** é repassado para conexões locais — a ação global tem prioridade.
|
|
211
|
+
|
|
212
|
+
### 6) Estilo de toast
|
|
213
|
+
|
|
214
|
+
O estilo padrão usa as classes `.pdx-toast-success` / `.pdx-toast-error`.
|
|
215
|
+
Inclua estilos equivalentes no app host (ou sobrescreva com `providePraxisToastGlobalActions`).
|
|
216
|
+
|
|
217
|
+
## 🔎 Schema Viewer (para Showcases)
|
|
218
|
+
|
|
219
|
+
Para exibir os metadados e schemas usados por um exemplo (ex.: na aba “Schema” de um showcase), use o componente `SchemaViewerComponent` e (opcionalmente) injete o contexto via `SCHEMA_VIEWER_CONTEXT`.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
import { Component, Provider } from '@angular/core';
|
|
223
|
+
import { PraxisTabs, TabsMetadata } from '@praxisui/tabs';
|
|
224
|
+
import { SchemaViewerComponent, SCHEMA_VIEWER_CONTEXT } from '@praxisui/core';
|
|
225
|
+
|
|
226
|
+
@Component({
|
|
227
|
+
standalone: true,
|
|
228
|
+
selector: 'app-tabs-showcase',
|
|
229
|
+
imports: [PraxisTabs, SchemaViewerComponent],
|
|
230
|
+
template: `
|
|
231
|
+
<!-- Aba Preview -->
|
|
232
|
+
<praxis-tabs [config]="tabs" tabsId="tabs-preview"></praxis-tabs>
|
|
233
|
+
|
|
234
|
+
<!-- Aba Schema -->
|
|
235
|
+
<praxis-schema-viewer [context]="schemaCtx"></praxis-schema-viewer>
|
|
236
|
+
`,
|
|
237
|
+
providers: [
|
|
238
|
+
{
|
|
239
|
+
provide: SCHEMA_VIEWER_CONTEXT,
|
|
240
|
+
useFactory: () => ({
|
|
241
|
+
componentId: 'praxis-tabs',
|
|
242
|
+
title: 'Tabs — Schema & Metadata',
|
|
243
|
+
rawConfig: {
|
|
244
|
+
group: { alignTabs: 'center', dynamicHeight: true },
|
|
245
|
+
tabs: [ { id: 't1', textLabel: 'Dados', content: [] } ],
|
|
246
|
+
} satisfies TabsMetadata,
|
|
247
|
+
}),
|
|
248
|
+
} as Provider,
|
|
249
|
+
],
|
|
250
|
+
})
|
|
251
|
+
export class TabsShowcaseComponent {
|
|
252
|
+
tabs: TabsMetadata = { group: { dynamicHeight: true }, tabs: [] };
|
|
253
|
+
schemaCtx = {
|
|
254
|
+
componentId: 'praxis-tabs',
|
|
255
|
+
rawConfig: this.tabs,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Campos opcionais do contexto (`SchemaViewerContext`):
|
|
261
|
+
- `rawConfig` (JSON usado pelo exemplo), `effectiveConfig` (se houver merge de defaults);
|
|
262
|
+
- `backendSchema` (OpenAPI/JSON Schema) e `schemaMeta` (path/operation/schemaType/schemaHash);
|
|
263
|
+
- `normalizedFields` (se já normalizado; caso contrário, o componente aplica `SchemaNormalizerService`).
|
|
264
|
+
|
|
108
265
|
## 🧩 Compatibilidade
|
|
109
266
|
|
|
110
267
|
- `@praxisui/core` `1.0.0-beta.x` → Angular `20.x`
|
|
@@ -322,7 +479,7 @@ interface SortingConfig {
|
|
|
322
479
|
/** Habilitar ordenação */
|
|
323
480
|
enabled: boolean;
|
|
324
481
|
|
|
325
|
-
/** Permitir ordenação múltipla */
|
|
482
|
+
/** Permitir ordenação múltipla (schema-only no runtime atual) */
|
|
326
483
|
multiSort: boolean;
|
|
327
484
|
|
|
328
485
|
/** Estratégia de ordenação */
|
|
@@ -339,6 +496,8 @@ interface SortingConfig {
|
|
|
339
496
|
}
|
|
340
497
|
```
|
|
341
498
|
|
|
499
|
+
Observação enterprise: `multiSort` está disponível no contrato de schema, porém no runtime atual deve ser tratado como `schema-only` (apenas 1 critério de ordenação efetivo).
|
|
500
|
+
|
|
342
501
|
## 🎨 Configurações de Aparência
|
|
343
502
|
|
|
344
503
|
### TableAppearanceConfig
|
|
@@ -508,7 +667,8 @@ export class MyComponent {
|
|
|
508
667
|
this.configService.setConfig(this.tableConfig);
|
|
509
668
|
|
|
510
669
|
// Verificar recursos
|
|
511
|
-
|
|
670
|
+
// No runtime atual, multiSort permanece schema-only.
|
|
671
|
+
const hasMultiSort = false;
|
|
512
672
|
const hasBulkActions = this.configService.isFeatureEnabled('bulkActions');
|
|
513
673
|
const hasExport = this.configService.isFeatureEnabled('export');
|
|
514
674
|
|