@praxisui/core 1.0.0-beta.8 → 3.0.0-beta.0
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 +120 -3
- package/fesm2022/praxisui-core.mjs +13583 -2966
- package/fesm2022/praxisui-core.mjs.map +1 -1
- package/index.d.ts +4043 -783
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Biblioteca central com interfaces e serviços fundamentais para o Praxis UI Workspace
|
|
4
4
|
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- Official documentation: https://praxisui.dev
|
|
8
|
+
- Quickstart reference app: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
9
|
+
- Recommended for: hosts that need the shared contracts, tokens, icons and base services used across `@praxisui/*`
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
- Centralize shared contracts, tokens and utilities across Praxis UI packages
|
|
14
|
+
- Keep icon, config and dynamic widget infrastructure aligned in the host app
|
|
15
|
+
- Avoid duplicating low-level primitives across multiple business libraries
|
|
16
|
+
|
|
5
17
|
## 🌟 Visão Geral
|
|
6
18
|
|
|
7
19
|
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 +47,9 @@ A biblioteca `@praxisui/core` é o núcleo do Praxis UI Workspace, fornecendo in
|
|
|
35
47
|
npm install @praxisui/core
|
|
36
48
|
```
|
|
37
49
|
|
|
50
|
+
Exemplo completo (app de referência)
|
|
51
|
+
- Quickstart: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
52
|
+
|
|
38
53
|
### Peer dependencies (Angular v20)
|
|
39
54
|
|
|
40
55
|
- `@angular/core` `^20.0.0`
|
|
@@ -105,6 +120,105 @@ Observação: os IDs de widgets usados na página devem estar registrados via `C
|
|
|
105
120
|
[`public-api.ts`](https://github.com/codexrodrigues/praxis/blob/main/frontend-libs/praxis-ui-workspace/projects/praxis-core/src/public-api.ts)
|
|
106
121
|
para a lista consolidada de serviços, tokens, modelos e utilitários disponíveis para importação.
|
|
107
122
|
|
|
123
|
+
## 📄 Documentacao Tecnica da Lib
|
|
124
|
+
|
|
125
|
+
- `projects/praxis-core/docs/connection-editor.md`
|
|
126
|
+
- `projects/praxis-core/docs/dynamic-gridster-page.md`
|
|
127
|
+
- `projects/praxis-core/docs/schema-flow.md`
|
|
128
|
+
|
|
129
|
+
## ⚙️ Global Config (bootstrap)
|
|
130
|
+
|
|
131
|
+
- Use `provideGlobalConfigTenant(...)` para definir o tenant e bloquear o bootstrap até a config remota ser carregada.
|
|
132
|
+
- Se não houver tenant, use `provideGlobalConfigReady()` para apenas aguardar o carregamento remoto.
|
|
133
|
+
|
|
134
|
+
## 🌐 Global Actions (shell + widgets)
|
|
135
|
+
|
|
136
|
+
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.
|
|
137
|
+
|
|
138
|
+
### 1) Providers (plug-and-play no host)
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import {
|
|
142
|
+
providePraxisGlobalActions,
|
|
143
|
+
providePraxisToastGlobalActions,
|
|
144
|
+
providePraxisAnalyticsGlobalActions,
|
|
145
|
+
} from '@praxisui/core';
|
|
146
|
+
import { providePraxisDialogGlobalActions } from '@praxisui/dialog';
|
|
147
|
+
|
|
148
|
+
providers: [
|
|
149
|
+
...providePraxisGlobalActions({ dialog: false, toast: false, analytics: false }),
|
|
150
|
+
providePraxisDialogGlobalActions(),
|
|
151
|
+
providePraxisToastGlobalActions(),
|
|
152
|
+
providePraxisAnalyticsGlobalActions({ prefix: 'app' }),
|
|
153
|
+
]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 2) Mapeando outputs para ações globais
|
|
157
|
+
|
|
158
|
+
`WidgetDefinition.outputs` pode apontar para ações globais:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
definition: {
|
|
162
|
+
id: 'praxis-dynamic-form',
|
|
163
|
+
outputs: {
|
|
164
|
+
formSubmit: {
|
|
165
|
+
type: 'api.post',
|
|
166
|
+
params: { url: '/api/clientes', body: '${payload.formData}' }
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### 3) Ação global no Widget Shell
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
shell: {
|
|
176
|
+
actions: [
|
|
177
|
+
{ id: 'back', icon: 'arrow_back', command: 'global:navigation.back' }
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 4) Catálogo básico de ações globais
|
|
183
|
+
|
|
184
|
+
- `navigation.back`
|
|
185
|
+
- `navigation.openExternal` → `{ url }`
|
|
186
|
+
- `dialog.alert` → `{ title, message, variant }`
|
|
187
|
+
- `dialog.prompt` → `{ title, message, placeholder, defaultValue }`
|
|
188
|
+
- `dialog.open` → `{ componentId, inputs, size, data }`
|
|
189
|
+
- `toast.success` / `toast.error` → `{ message }`
|
|
190
|
+
- `clipboard.copy` → `{ text }`
|
|
191
|
+
- `trackEvent` → `{ eventName, payload }`
|
|
192
|
+
- `log` → `{ level, message, payload }`
|
|
193
|
+
- `api.get` / `api.post` / `api.patch` → `{ url, params|body }`
|
|
194
|
+
- `route.register` → `{ path, componentId|loadChildren, data?, resolve?, guards?, canMatch?, canActivateChild?, replace?, position? }`
|
|
195
|
+
|
|
196
|
+
### 5) Rotas dinâmicas (route.register)
|
|
197
|
+
|
|
198
|
+
Requer `componentId` **ou** `loadChildren`. Guards são resolvidos pelo host via `GLOBAL_ROUTE_GUARD_RESOLVER`.
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
// payload
|
|
202
|
+
{
|
|
203
|
+
path: '/clientes/novo',
|
|
204
|
+
componentId: 'praxis-dynamic-page',
|
|
205
|
+
data: { pageId: 'clientes-novo' },
|
|
206
|
+
guards: ['auth', 'permission:clientes.create'],
|
|
207
|
+
position: 'before-wildcard'
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
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`).
|
|
212
|
+
|
|
213
|
+
### 7) Output mapeado para ação global x conexões
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
### 6) Estilo de toast
|
|
218
|
+
|
|
219
|
+
O estilo padrão usa as classes `.pdx-toast-success` / `.pdx-toast-error`.
|
|
220
|
+
Inclua estilos equivalentes no app host (ou sobrescreva com `providePraxisToastGlobalActions`).
|
|
221
|
+
|
|
108
222
|
## 🔎 Schema Viewer (para Showcases)
|
|
109
223
|
|
|
110
224
|
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`.
|
|
@@ -120,7 +234,7 @@ import { SchemaViewerComponent, SCHEMA_VIEWER_CONTEXT } from '@praxisui/core';
|
|
|
120
234
|
imports: [PraxisTabs, SchemaViewerComponent],
|
|
121
235
|
template: `
|
|
122
236
|
<!-- Aba Preview -->
|
|
123
|
-
<praxis-tabs [config]="tabs"></praxis-tabs>
|
|
237
|
+
<praxis-tabs [config]="tabs" tabsId="tabs-preview"></praxis-tabs>
|
|
124
238
|
|
|
125
239
|
<!-- Aba Schema -->
|
|
126
240
|
<praxis-schema-viewer [context]="schemaCtx"></praxis-schema-viewer>
|
|
@@ -370,7 +484,7 @@ interface SortingConfig {
|
|
|
370
484
|
/** Habilitar ordenação */
|
|
371
485
|
enabled: boolean;
|
|
372
486
|
|
|
373
|
-
/** Permitir ordenação múltipla */
|
|
487
|
+
/** Permitir ordenação múltipla (schema-only no runtime atual) */
|
|
374
488
|
multiSort: boolean;
|
|
375
489
|
|
|
376
490
|
/** Estratégia de ordenação */
|
|
@@ -387,6 +501,8 @@ interface SortingConfig {
|
|
|
387
501
|
}
|
|
388
502
|
```
|
|
389
503
|
|
|
504
|
+
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).
|
|
505
|
+
|
|
390
506
|
## 🎨 Configurações de Aparência
|
|
391
507
|
|
|
392
508
|
### TableAppearanceConfig
|
|
@@ -556,7 +672,8 @@ export class MyComponent {
|
|
|
556
672
|
this.configService.setConfig(this.tableConfig);
|
|
557
673
|
|
|
558
674
|
// Verificar recursos
|
|
559
|
-
|
|
675
|
+
// No runtime atual, multiSort permanece schema-only.
|
|
676
|
+
const hasMultiSort = false;
|
|
560
677
|
const hasBulkActions = this.configService.isFeatureEnabled('bulkActions');
|
|
561
678
|
const hasExport = this.configService.isFeatureEnabled('export');
|
|
562
679
|
|