@praxisui/page-builder 1.0.0-beta.7 → 2.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 +177 -3
- package/fesm2022/praxisui-page-builder.mjs +4811 -50
- package/fesm2022/praxisui-page-builder.mjs.map +1 -1
- package/index.d.ts +468 -6
- package/package.json +8 -7
- package/fesm2022/praxisui-page-builder-connection-graph.component-C6x--6--.mjs +0 -1129
- package/fesm2022/praxisui-page-builder-connection-graph.component-C6x--6--.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# @praxisui/page-builder
|
|
2
2
|
|
|
3
|
-
Ferramentas de
|
|
3
|
+
Ferramentas de edicao para paginas dinamicas baseadas em Gridster, com builders visuais, palette, graph e integracao com `@praxisui/settings-panel`.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
- Documentação oficial: https://praxisui.dev
|
|
8
|
+
- Aplicação de referência: https://github.com/codexrodrigues/praxis-ui-quickstart
|
|
9
|
+
- Indicado para: times que precisam montar dashboards e paginas metadata-driven com edicao visual corporativa
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
- Montar paginas dinamicas com widgets, conexoes e layout visual
|
|
14
|
+
- Entregar experiencia de builder para usuarios internos ou squads de configuracao
|
|
15
|
+
- Integrar page composition com IA, settings panel e contratos compartilhados do Praxis UI
|
|
16
|
+
|
|
17
|
+
Inclui o conjunto de editores (Builder, Graph), paleta de componentes e toolbars para montar e inspecionar conexões entre widgets definidos por metadata (`GridPageDefinition` do `@praxisui/core`). Integra com o `@praxisui/settings-panel` para abrir editores em painel lateral e oferece um modo de diálogo fullscreen para edição visual.
|
|
4
18
|
|
|
5
19
|
## Instalação
|
|
6
20
|
|
|
@@ -24,12 +38,82 @@ Este pacote expõe os editores e utilitários usados pelo componente de página
|
|
|
24
38
|
- `ConnectionBuilderComponent` — lista e edita conexões (from.output → to.input) com filtros, agrupamentos e validação.
|
|
25
39
|
- `ConnectionGraph` (uso integrado) — visualiza nós/portas/arestas; suporta arrastar para criar conexões e abrir o Builder.
|
|
26
40
|
- `ComponentPaletteDialog` — paleta para adicionar widgets à página.
|
|
27
|
-
- `FloatingToolbar` e `TileToolbar` — ações rápidas (adicionar, conexões,
|
|
41
|
+
- `FloatingToolbar` e `TileToolbar` — ações rápidas (adicionar, conexões, configurar widget, configurar card, salvar, pré‑visualizar).
|
|
28
42
|
|
|
29
43
|
Os editores podem ser abertos:
|
|
30
44
|
- Via `SettingsPanelService` (painel lateral) — recomendado para fluxo dentro do app.
|
|
31
45
|
- Como diálogo fullscreen (Material Dialog) para uma experiência imersiva de edição.
|
|
32
46
|
|
|
47
|
+
## AI Capabilities Registration
|
|
48
|
+
|
|
49
|
+
Para que o assistente de IA consiga configurar os inputs dos widgets, registre os catálogos de capacidades no bootstrap da aplicação.
|
|
50
|
+
|
|
51
|
+
Opção recomendada (registro automático via provider + InjectionToken):
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
55
|
+
import { PAGE_BUILDER_WIDGET_AI_CATALOGS, providePageBuilderWidgetAiCatalogs } from '@praxisui/page-builder';
|
|
56
|
+
import { TABLE_AI_CAPABILITIES } from '@praxisui/table';
|
|
57
|
+
import { CRUD_AI_CAPABILITIES } from '@praxisui/crud';
|
|
58
|
+
import { AppComponent } from './app/app.component';
|
|
59
|
+
|
|
60
|
+
bootstrapApplication(AppComponent, {
|
|
61
|
+
providers: [
|
|
62
|
+
{
|
|
63
|
+
provide: PAGE_BUILDER_WIDGET_AI_CATALOGS,
|
|
64
|
+
useValue: {
|
|
65
|
+
'praxis-table': TABLE_AI_CAPABILITIES,
|
|
66
|
+
'praxis-crud': CRUD_AI_CAPABILITIES,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
providePageBuilderWidgetAiCatalogs(),
|
|
70
|
+
],
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Registro manual (útil para apps que precisam customizar o mapa):
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { registerWidgetAiCatalogs } from '@praxisui/page-builder';
|
|
78
|
+
import { TABLE_AI_CAPABILITIES } from '@praxisui/table';
|
|
79
|
+
import { CRUD_AI_CAPABILITIES } from '@praxisui/crud';
|
|
80
|
+
|
|
81
|
+
registerWidgetAiCatalogs({
|
|
82
|
+
'praxis-table': TABLE_AI_CAPABILITIES,
|
|
83
|
+
'praxis-crud': CRUD_AI_CAPABILITIES,
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Registro via token:
|
|
88
|
+
- Use o InjectionToken `PAGE_BUILDER_WIDGET_AI_CATALOGS` para fornecer o mapa no host.
|
|
89
|
+
|
|
90
|
+
## Settings Panel Bridge
|
|
91
|
+
|
|
92
|
+
Para abrir "Configurações da Página" e editores no painel lateral, o host deve
|
|
93
|
+
registrar o bridge do Settings Panel:
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { SETTINGS_PANEL_BRIDGE } from '@praxisui/core';
|
|
97
|
+
import { SettingsPanelService } from '@praxisui/settings-panel';
|
|
98
|
+
|
|
99
|
+
providers: [
|
|
100
|
+
{
|
|
101
|
+
provide: SETTINGS_PANEL_BRIDGE,
|
|
102
|
+
useExisting: SettingsPanelService,
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Catálogos conhecidos (exports):
|
|
108
|
+
- `TABLE_AI_CAPABILITIES` — `@praxisui/table` (`praxis-table`)
|
|
109
|
+
- `CRUD_AI_CAPABILITIES` — `@praxisui/crud` (`praxis-crud`)
|
|
110
|
+
- `LIST_AI_CAPABILITIES` — `@praxisui/list` (`praxis-list`)
|
|
111
|
+
- `FORM_AI_CAPABILITIES` — `@praxisui/dynamic-form` (`praxis-dynamic-form`)
|
|
112
|
+
- `FILES_UPLOAD_AI_CAPABILITIES` — `@praxisui/files-upload` (`praxis-files-upload`)
|
|
113
|
+
- `STEPPER_AI_CAPABILITIES` — `@praxisui/stepper` (`praxis-stepper`)
|
|
114
|
+
- `TABS_AI_CAPABILITIES` — `@praxisui/tabs` (`praxis-tabs`)
|
|
115
|
+
- `EXPANSION_AI_CAPABILITIES` — `@praxisui/expansion` (`praxis-expansion`)
|
|
116
|
+
|
|
33
117
|
## Quick Start (usando a página Gridster)
|
|
34
118
|
|
|
35
119
|
O componente de página dinâmica (parte do workspace) expõe métodos utilitários para abrir editores. Exemplo de uso no template:
|
|
@@ -38,7 +122,7 @@ O componente de página dinâmica (parte do workspace) expõe métodos utilitár
|
|
|
38
122
|
<praxis-dynamic-gridster-page
|
|
39
123
|
#page
|
|
40
124
|
[page]="page"
|
|
41
|
-
[
|
|
125
|
+
[enableCustomization]="true"
|
|
42
126
|
(pageChange)="onPageChange($event)">
|
|
43
127
|
</praxis-dynamic-gridster-page>
|
|
44
128
|
|
|
@@ -50,6 +134,96 @@ O componente de página dinâmica (parte do workspace) expõe métodos utilitár
|
|
|
50
134
|
|
|
51
135
|
`page` é um `GridPageDefinition` (do `@praxisui/core`) contendo `widgets` e opcionalmente `connections`.
|
|
52
136
|
|
|
137
|
+
## Widget Shell (Dashboard Cards)
|
|
138
|
+
|
|
139
|
+
Cada widget pode declarar um `shell` para renderizar um card padronizado com cabeçalho rico,
|
|
140
|
+
ações de contexto e controles de janela (expandir/recolher). Exemplo:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"widgets": [
|
|
145
|
+
{
|
|
146
|
+
"key": "dados-cadastrais",
|
|
147
|
+
"definition": { "id": "praxis-list", "inputs": { "listId": "dados", "config": {} } },
|
|
148
|
+
"layout": { "col": 1, "row": 1, "colSpan": 6, "rowSpan": 4 },
|
|
149
|
+
"shell": {
|
|
150
|
+
"kind": "dashboard-card",
|
|
151
|
+
"icon": "badge",
|
|
152
|
+
"title": "Dados Cadastrais",
|
|
153
|
+
"subtitle": "Servidor: Jéssica Techne",
|
|
154
|
+
"actions": [
|
|
155
|
+
{ "id": "editar", "label": "Editar", "icon": "edit", "variant": "outlined", "emit": "editar" },
|
|
156
|
+
{ "id": "imprimir", "label": "Imprimir", "icon": "print", "variant": "text", "emit": "imprimir" }
|
|
157
|
+
],
|
|
158
|
+
"windowActions": { "collapsible": true, "expandable": true },
|
|
159
|
+
"appearance": {
|
|
160
|
+
"card": { "background": "#0b1220", "borderColor": "rgba(255,255,255,0.12)", "borderRadius": "16px" },
|
|
161
|
+
"header": { "titleColor": "#e6edf3", "subtitleColor": "#9fb0c4", "iconColor": "#8ab4ff" },
|
|
162
|
+
"typography": { "titleSize": "14px", "titleWeight": "600", "subtitleSize": "12px" }
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Quando uma ação é clicada, o shell:
|
|
171
|
+
- dispara um evento para o page-builder (`emit`, ou `shell:<id>` por padrão) para uso em `connections`;
|
|
172
|
+
- tenta despachar a ação para o componente interno via método `handleShellAction(action)`.
|
|
173
|
+
|
|
174
|
+
### Presets visuais (global)
|
|
175
|
+
|
|
176
|
+
Você pode definir presets globais na página e escolher um preset padrão para todos os cards:
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"context": {
|
|
181
|
+
"ui": {
|
|
182
|
+
"shell": {
|
|
183
|
+
"preset": "dark-glass",
|
|
184
|
+
"presets": {
|
|
185
|
+
"dark-glass": {
|
|
186
|
+
"card": { "background": "#0b1220", "borderColor": "rgba(255,255,255,0.12)", "borderRadius": "16px" }
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
O widget pode sobrescrever:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"shell": {
|
|
200
|
+
"preset": "light-neutral",
|
|
201
|
+
"appearance": { "header": { "titleColor": "#1f2937" } }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Editor do Card (Shell)
|
|
207
|
+
|
|
208
|
+
O botão "Configurar card" na toolbar do tile abre o editor de shell, permitindo editar
|
|
209
|
+
titulo, subtitulo, icone e acoes do cabecalho. O editor grava os metadados no campo
|
|
210
|
+
`shell` do widget.
|
|
211
|
+
|
|
212
|
+
Para abrir via API (Settings Panel):
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import { WidgetShellEditorComponent } from '@praxisui/page-builder';
|
|
216
|
+
|
|
217
|
+
this.settingsPanel.open({
|
|
218
|
+
id: 'grid-widget-shell:table',
|
|
219
|
+
title: 'Configurar Card',
|
|
220
|
+
content: {
|
|
221
|
+
component: WidgetShellEditorComponent,
|
|
222
|
+
inputs: { shell: widget.shell },
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
53
227
|
## Abrindo editores via Settings Panel
|
|
54
228
|
|
|
55
229
|
Para abrir o Builder/Graph em um painel lateral, injete o `SettingsPanelService` e forneça o conteúdo. O `ConnectionBuilderComponent` é exportado por este pacote.
|