forlogic-core 2.0.2 → 2.0.4
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 +187 -917
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/types/sidebar.d.ts +2 -1
- package/docs/AUDIT_PROMPT.md +74 -0
- package/docs/PROJECT_KNOWLEDGE_TEMPLATE.md +117 -0
- package/docs/PROMPT_TEMPLATE.md +77 -0
- package/docs/STARTER_TEMPLATE.md +114 -0
- package/docs/design-system/README.md +45 -0
- package/docs/design-system/buttons-actions.md +427 -0
- package/docs/design-system/charts-dashboards.md +547 -0
- package/docs/design-system/crud.md +243 -0
- package/docs/design-system/data-display.md +360 -0
- package/docs/design-system/dialogs.md +588 -0
- package/docs/design-system/domain.md +651 -0
- package/docs/design-system/examples.md +275 -0
- package/docs/design-system/foundation.md +82 -0
- package/docs/design-system/infra-utils.md +36 -0
- package/docs/design-system/inputs.md +536 -0
- package/docs/design-system/layout.md +351 -0
- package/docs/design-system/navigation.md +599 -0
- package/docs/design-system/notifications-feedback.md +137 -0
- package/docs/design-system/platform.md +95 -0
- package/docs/design-system/selectors.md +424 -0
- package/docs/design-system/tables-grids.md +114 -0
- package/package.json +2 -2
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
<!-- ⚠️ ARQUIVO GERADO AUTOMATICAMENTE — NÃO EDITAR MANUALMENTE -->
|
|
2
|
+
<!-- Fonte: src/design-system/docs/ | Regenerar: npx tsx scripts/generate-ds-docs.ts -->
|
|
3
|
+
|
|
4
|
+
# Gráficos & Dashboards
|
|
5
|
+
|
|
6
|
+
Categoria: **Gráficos & Dashboards** | 11 componentes
|
|
7
|
+
|
|
8
|
+
### Chart
|
|
9
|
+
|
|
10
|
+
Sistema de gráficos baseado em Recharts com suporte a temas e tooltips customizados. Inclui barras, linhas, áreas, pizza, radar e mais.
|
|
11
|
+
|
|
12
|
+
**Uso:**
|
|
13
|
+
```tsx
|
|
14
|
+
import { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent } from "forlogic-core"
|
|
15
|
+
import { Bar, BarChart, XAxis, YAxis, CartesianGrid } from "recharts"
|
|
16
|
+
|
|
17
|
+
const chartConfig = {
|
|
18
|
+
desktop: { label: "Desktop", color: "hsl(var(--primary))" },
|
|
19
|
+
mobile: { label: "Mobile", color: "hsl(var(--secondary))" },
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
<ChartContainer config={chartConfig} className="h-[300px]">
|
|
23
|
+
<BarChart data={data}>
|
|
24
|
+
<CartesianGrid strokeDasharray="3 3" vertical={false} />
|
|
25
|
+
<XAxis dataKey="month" tickLine={false} axisLine={false} />
|
|
26
|
+
<YAxis tickLine={false} axisLine={false} />
|
|
27
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
28
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
29
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
30
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
31
|
+
</BarChart>
|
|
32
|
+
</ChartContainer>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**Props:**
|
|
36
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
37
|
+
|------|------|--------|-----------|
|
|
38
|
+
| `config` | `ChartConfig` | - | Configuração de cores e labels para cada série de dados. |
|
|
39
|
+
| `className` | `string` | - | Classes CSS para dimensionamento do container. |
|
|
40
|
+
| `ChartTooltip` | `Component` | - | Componente de tooltip customizado para exibir valores. |
|
|
41
|
+
| `ChartTooltipContent` | `Component` | - | Conteúdo do tooltip com formatação automática. |
|
|
42
|
+
| `ChartLegend` | `Component` | - | Componente de legenda customizado. |
|
|
43
|
+
| `ChartLegendContent` | `Component` | - | Conteúdo da legenda com cores e labels. |
|
|
44
|
+
|
|
45
|
+
**Exemplos:**
|
|
46
|
+
```tsx
|
|
47
|
+
<BarChart data={data}>
|
|
48
|
+
<Bar dataKey=
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Acessibilidade:**
|
|
52
|
+
- Cores configuráveis via design tokens para consistência visual
|
|
53
|
+
- Tooltips acessíveis com informações detalhadas
|
|
54
|
+
- Suporte a temas claro/escuro automático
|
|
55
|
+
- Responsivo via ResponsiveContainer interno
|
|
56
|
+
- Legendas clicáveis para filtrar séries
|
|
57
|
+
|
|
58
|
+
**Notas:**
|
|
59
|
+
- Utiliza a biblioteca **Recharts** internamente
|
|
60
|
+
- As cores são definidas via CSS variables (
|
|
61
|
+
- )
|
|
62
|
+
- Suporte automático a temas light/dark
|
|
63
|
+
- Configure
|
|
64
|
+
- para definir cores e labels de cada série
|
|
65
|
+
- Use
|
|
66
|
+
- com
|
|
67
|
+
- para grids mais limpos
|
|
68
|
+
- Remova
|
|
69
|
+
- e
|
|
70
|
+
- para visual mais moderno
|
|
71
|
+
|
|
72
|
+
> Fonte: `src\design-system\docs\components\ChartDoc.tsx`
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### Dashboards — Visão Geral
|
|
77
|
+
|
|
78
|
+
Módulo completo de dashboards portado do qex-dashboards Angular. Inclui 14 tipos de painéis com Recharts, grid responsivo com drag-and-drop via @dnd-kit, lista com filtros, formulário multilíngue e visualizador com toolbar.
|
|
79
|
+
|
|
80
|
+
**Uso:**
|
|
81
|
+
```tsx
|
|
82
|
+
import {
|
|
83
|
+
// Orquestrador principal
|
|
84
|
+
DashboardGeneralView,
|
|
85
|
+
|
|
86
|
+
// Componentes de página
|
|
87
|
+
DashboardView,
|
|
88
|
+
DashboardList,
|
|
89
|
+
DashboardForm,
|
|
90
|
+
DashboardGrid,
|
|
91
|
+
DashboardPanelRenderer,
|
|
92
|
+
|
|
93
|
+
// Painéis individuais
|
|
94
|
+
NumericPanel, TextPanel, ListPanel,
|
|
95
|
+
CartesianPanel, PiePanel, ParetoPanel,
|
|
96
|
+
BurndownPanel, PerformancePanel, MatrixRiskPanel,
|
|
97
|
+
|
|
98
|
+
// Shared de painel
|
|
99
|
+
PanelHeader, PanelError, PanelLoader, PanelNoData, PanelUnavailable,
|
|
100
|
+
|
|
101
|
+
// Types & Helpers
|
|
102
|
+
DashboardPanelType, PanelState, AggregationType,
|
|
103
|
+
type PanelConfig, type Dashboard, type DashboardPanel,
|
|
104
|
+
getDefaultPanelSize, getMinPanelSize,
|
|
105
|
+
currencyFormatter, processUrl, getLinkFromRow,
|
|
106
|
+
} from 'forlogic-core';
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Props:**
|
|
110
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
111
|
+
|------|------|--------|-----------|
|
|
112
|
+
| `DashboardGeneralView` | `Component` | - | Página orquestradora — integra List → View → Form com máquina de estados, carousel auto-advance e suporte a General View. |
|
|
113
|
+
| `DashboardView` | `Component` | - | Viewer com toolbar (refresh, fullscreen, favorito, share), tabs de páginas e grid de painéis. |
|
|
114
|
+
| `DashboardList` | `Component` | - | Lista/tabela com busca, filtros rápidos, favoritos e menu de contexto. |
|
|
115
|
+
| `DashboardForm` | `Component` | - | Formulário com títulos multilíngue, configurações e aba de compartilhamento. |
|
|
116
|
+
| `DashboardGrid` | `Component` | - | Grid de 8 colunas com @dnd-kit para posicionamento via drag-and-drop. |
|
|
117
|
+
| `DashboardPanelRenderer` | `Component` | - | Mapeia DashboardPanelType → componente React (14 tipos). |
|
|
118
|
+
| `PanelConfig` | `Interface` | - | Configuração base compartilhada por todos os painéis (título, tipo, query, cores, etc.). |
|
|
119
|
+
| `PanelState` | `Enum` | - | Loading (0), Loaded (1), Error (3), NoData (4), Unavailable (5). |
|
|
120
|
+
|
|
121
|
+
**Exemplos:**
|
|
122
|
+
```tsx
|
|
123
|
+
// O renderer mapeia typeId → componente automaticamente
|
|
124
|
+
<DashboardPanelRenderer
|
|
125
|
+
config={{ ...panelConfig, typeId: DashboardPanelType.Column }}
|
|
126
|
+
state={PanelState.Loaded}
|
|
127
|
+
cartesianData={chartData}
|
|
128
|
+
cartesianSeries={[{ dataKey:
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardOverviewDoc.tsx`
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### DashboardGeneralView
|
|
136
|
+
|
|
137
|
+
Componente orquestrador que gerencia todo o ciclo de vida do módulo de Dashboards. Integra DashboardList, DashboardView e DashboardForm através de uma máquina de estados, com suporte a carousel auto-advance e General View.
|
|
138
|
+
|
|
139
|
+
**Uso:**
|
|
140
|
+
```tsx
|
|
141
|
+
import { DashboardGeneralView } from 'forlogic-core';
|
|
142
|
+
|
|
143
|
+
// Uso básico (uncontrolled — gerencia estado internamente)
|
|
144
|
+
<DashboardGeneralView
|
|
145
|
+
dashboards={dashboards}
|
|
146
|
+
limit={{ maxDashboards: 50, countDashboards: 12 }}
|
|
147
|
+
canAdd canEdit canRemove
|
|
148
|
+
activePanels={panels}
|
|
149
|
+
activePages={pages}
|
|
150
|
+
getPanelData={(panelId) => ({
|
|
151
|
+
state: PanelState.Loaded,
|
|
152
|
+
data: panelData[panelId],
|
|
153
|
+
})}
|
|
154
|
+
onOpen={(d) => loadPanels(d.id)}
|
|
155
|
+
onSave={(values) => createDashboard(values)}
|
|
156
|
+
onUpdate={(id, values) => updateDashboard(id, values)}
|
|
157
|
+
onRemove={(d) => removeDashboard(d.id)}
|
|
158
|
+
onToggleFavorite={(d) => toggleFav(d.id)}
|
|
159
|
+
/>
|
|
160
|
+
|
|
161
|
+
// Uso controlado (com react-router)
|
|
162
|
+
const [viewState, setViewState] = useState({ mode: 'list' });
|
|
163
|
+
|
|
164
|
+
<DashboardGeneralView
|
|
165
|
+
dashboards={dashboards}
|
|
166
|
+
viewState={viewState}
|
|
167
|
+
onViewStateChange={(state) => {
|
|
168
|
+
setViewState(state);
|
|
169
|
+
if (state.mode === 'view') navigate(\`/dashboards/\${state.dashboardId}\`);
|
|
170
|
+
if (state.mode === 'list') navigate('/dashboards');
|
|
171
|
+
}}
|
|
172
|
+
// ... demais props
|
|
173
|
+
/>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Exemplos:**
|
|
177
|
+
```tsx
|
|
178
|
+
// DashboardViewState
|
|
179
|
+
type DashboardViewState =
|
|
180
|
+
| { mode:
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardGeneralViewDoc.tsx`
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### DashboardList
|
|
188
|
+
|
|
189
|
+
Lista/tabela de dashboards com busca integrada, filtros rápidos (Todos / Meus / Favoritos), toggle de favorito, status ativo/inativo, ícone de compartilhamento e menu de contexto por linha.
|
|
190
|
+
|
|
191
|
+
**Uso:**
|
|
192
|
+
```tsx
|
|
193
|
+
import { DashboardList, QuickFilterDashboard } from 'forlogic-core';
|
|
194
|
+
|
|
195
|
+
<DashboardList
|
|
196
|
+
dashboards={dashboards}
|
|
197
|
+
limit={{ maxDashboards: 50, countDashboards: 12 }}
|
|
198
|
+
language={DashboardLanguage.PtBr}
|
|
199
|
+
canAdd canEdit canRemove
|
|
200
|
+
onOpen={(d) => navigate(\`/dashboards/\${d.id}\`)}
|
|
201
|
+
onEdit={(d) => navigate(\`/dashboards/\${d.id}/edit\`)}
|
|
202
|
+
onShare={(d) => openShareDialog(d)}
|
|
203
|
+
onDuplicate={(d) => duplicateDashboard(d.id)}
|
|
204
|
+
onRemove={(d) => removeDashboard(d.id)}
|
|
205
|
+
onAdd={() => navigate('/dashboards/new')}
|
|
206
|
+
onToggleFavorite={(d) => toggleFavorite(d.id)}
|
|
207
|
+
onSearch={(q) => setSearch(q)}
|
|
208
|
+
onQuickFilterChange={(f) => setFilter(f)}
|
|
209
|
+
/>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Exemplos:**
|
|
213
|
+
```tsx
|
|
214
|
+
<DashboardList
|
|
215
|
+
dashboards={dashboards}
|
|
216
|
+
limit={{ maxDashboards: 50, countDashboards: 12 }}
|
|
217
|
+
canAdd canEdit canRemove
|
|
218
|
+
onOpen={(d) => openDashboard(d)}
|
|
219
|
+
onToggleFavorite={(d) => toggleFav(d.id)}
|
|
220
|
+
onSearch={(q) => fetchFiltered(q)}
|
|
221
|
+
onQuickFilterChange={(filter) => {
|
|
222
|
+
// QuickFilterDashboard.All | OnlyMine | Favorites
|
|
223
|
+
refetch(filter);
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
```
|
|
227
|
+
```tsx
|
|
228
|
+
// As ações são controladas por callbacks
|
|
229
|
+
<DashboardList
|
|
230
|
+
canEdit={true}
|
|
231
|
+
canRemove={true}
|
|
232
|
+
onOpen={(d) => navigate(\
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardListDoc.tsx`
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### DashboardForm
|
|
240
|
+
|
|
241
|
+
Formulário de criação/edição de dashboards com títulos multilíngue (PT-BR, EN-US, ES-ES), intervalo de atualização, tipo de visualização (Normal/Carousel), switch de situação e aba de compartilhamento com três modos.
|
|
242
|
+
|
|
243
|
+
**Uso:**
|
|
244
|
+
```tsx
|
|
245
|
+
import { DashboardForm, type DashboardFormValues } from 'forlogic-core';
|
|
246
|
+
|
|
247
|
+
// Criação
|
|
248
|
+
<DashboardForm
|
|
249
|
+
onSave={(values: DashboardFormValues) => {
|
|
250
|
+
// values: { titlePtBr, titleEnUs, titleEsEs, isActive,
|
|
251
|
+
// idUpdateTime, idViewType, idPageTime,
|
|
252
|
+
// idShare, groups?, places?, collaborators? }
|
|
253
|
+
createDashboard(values);
|
|
254
|
+
}}
|
|
255
|
+
onCancel={() => navigate('/dashboards')}
|
|
256
|
+
/>
|
|
257
|
+
|
|
258
|
+
// Edição
|
|
259
|
+
<DashboardForm
|
|
260
|
+
dashboard={existingDashboard}
|
|
261
|
+
users={usersList}
|
|
262
|
+
groups={groupsList}
|
|
263
|
+
places={placesList}
|
|
264
|
+
collaborators={collaboratorsList}
|
|
265
|
+
isSaving={mutation.isPending}
|
|
266
|
+
onSave={(values) => updateDashboard(dashboard.id, values)}
|
|
267
|
+
onCancel={() => goBack()}
|
|
268
|
+
/>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Props:**
|
|
272
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
273
|
+
|------|------|--------|-----------|
|
|
274
|
+
| `dashboard` | `Dashboard | null` | - | Dashboard existente para edição. null para criação. |
|
|
275
|
+
| `initialTab` | `DashboardFormTab` | - | Aba inicial (General ou Share). Default: General. |
|
|
276
|
+
| `isSaving` | `boolean` | - | Desabilita o botão salvar e mostra spinner. |
|
|
277
|
+
| `isQualitfy` | `boolean` | - | Dashboard padrão Qualitfy — bloqueia campos de configuração. |
|
|
278
|
+
| `users` | `Array<{ id, name }>` | - | Lista para seletor de responsável. |
|
|
279
|
+
| `groups / places / collaborators` | `Array<{ id, name }>` | - | Listas para aba de compartilhamento. |
|
|
280
|
+
| `onSave` | `(values: DashboardFormValues) => void` | - | Chamado ao clicar Salvar com valores válidos. |
|
|
281
|
+
| `onCancel` | `() => void` | - | Chamado ao clicar Cancelar. |
|
|
282
|
+
|
|
283
|
+
**Exemplos:**
|
|
284
|
+
```tsx
|
|
285
|
+
<DashboardForm
|
|
286
|
+
dashboard={null} // null = criação
|
|
287
|
+
users={[
|
|
288
|
+
{ id:
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardFormDoc.tsx`
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
### DashboardView
|
|
296
|
+
|
|
297
|
+
*Documentação não extraída automaticamente. Consulte o Design System interativo em `/ds`.*
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
### DashboardGrid
|
|
302
|
+
|
|
303
|
+
Grid de 8 colunas com posicionamento por col/row e dimensão por sizeX/sizeY. Suporta drag-and-drop via @dnd-kit quando allowDragging é true. Cada painel é renderizado como um card com header arrastável.
|
|
304
|
+
|
|
305
|
+
**Uso:**
|
|
306
|
+
```tsx
|
|
307
|
+
import { DashboardGrid, getDefaultPanelSize, getMinPanelSize } from 'forlogic-core';
|
|
308
|
+
|
|
309
|
+
<DashboardGrid
|
|
310
|
+
panels={[
|
|
311
|
+
{ id: 'p1', col: 0, row: 0, sizeX: 4, sizeY: 2 },
|
|
312
|
+
{ id: 'p2', col: 4, row: 0, sizeX: 4, sizeY: 2 },
|
|
313
|
+
{ id: 'p3', col: 0, row: 2, sizeX: 8, sizeY: 2 },
|
|
314
|
+
]}
|
|
315
|
+
columns={8} // padrão: 8
|
|
316
|
+
cellHeight={160} // padrão: 160px
|
|
317
|
+
cellGap={10} // padrão: 10px
|
|
318
|
+
allowDragging={canEdit}
|
|
319
|
+
showGridLines={canEdit}
|
|
320
|
+
renderPanel={(panelId) => <MyPanelComponent id={panelId} />}
|
|
321
|
+
onLayoutChange={(updatedPanels) => saveLayout(updatedPanels)}
|
|
322
|
+
/>
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Exemplos:**
|
|
326
|
+
```tsx
|
|
327
|
+
<DashboardGrid
|
|
328
|
+
panels={[
|
|
329
|
+
{ id:
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardGridDoc.tsx`
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
### DashboardPanelRenderer
|
|
337
|
+
|
|
338
|
+
Componente de roteamento que mapeia DashboardPanelType para o componente React correto. Recebe config + state e props de dados especializadas, delegando a renderização ao painel apropriado.
|
|
339
|
+
|
|
340
|
+
**Uso:**
|
|
341
|
+
```tsx
|
|
342
|
+
import { DashboardPanelRenderer, PanelState, DashboardPanelType } from 'forlogic-core';
|
|
343
|
+
|
|
344
|
+
// O renderer resolve automaticamente qual componente usar
|
|
345
|
+
<DashboardPanelRenderer
|
|
346
|
+
config={{
|
|
347
|
+
id: 'p1',
|
|
348
|
+
title: 'Ocorrências por Mês',
|
|
349
|
+
typeId: DashboardPanelType.Column,
|
|
350
|
+
// ... demais campos de PanelConfig
|
|
351
|
+
}}
|
|
352
|
+
state={PanelState.Loaded}
|
|
353
|
+
cartesianData={[
|
|
354
|
+
{ key: 'Jan', value: 42 },
|
|
355
|
+
{ key: 'Fev', value: 58 },
|
|
356
|
+
]}
|
|
357
|
+
cartesianSeries={[{ dataKey: 'value', name: 'Total' }]}
|
|
358
|
+
/>
|
|
359
|
+
|
|
360
|
+
// Para NumericPanel, use numericValue:
|
|
361
|
+
<DashboardPanelRenderer
|
|
362
|
+
config={{ ...config, typeId: DashboardPanelType.Numeric }}
|
|
363
|
+
state={PanelState.Loaded}
|
|
364
|
+
numericValue={1247}
|
|
365
|
+
/>
|
|
366
|
+
|
|
367
|
+
// Para MatrixRisk, use matrixRule + matrixRisks:
|
|
368
|
+
<DashboardPanelRenderer
|
|
369
|
+
config={{ ...config, typeId: DashboardPanelType.RiskMatrix }}
|
|
370
|
+
state={PanelState.Loaded}
|
|
371
|
+
matrixRule={rule}
|
|
372
|
+
matrixRisks={risks}
|
|
373
|
+
/>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Props:**
|
|
377
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
378
|
+
|------|------|--------|-----------|
|
|
379
|
+
| `config` | `PanelConfig` | - | Configuração do painel — inclui typeId que determina qual componente renderizar. |
|
|
380
|
+
| `state` | `PanelState` | - | Estado atual do painel (Loading, Loaded, Error, NoData, Unavailable). |
|
|
381
|
+
|
|
382
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardPanelRendererDoc.tsx`
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Painéis Básicos
|
|
387
|
+
|
|
388
|
+
Os três painéis não-gráficos do módulo de dashboards: NumericPanel (valor numérico agregado com formatação de moeda), TextPanel (HTML rico via dangerouslySetInnerHTML) e ListPanel (tabela de dados com colunas dinâmicas e links de navegação).
|
|
389
|
+
|
|
390
|
+
**Uso:**
|
|
391
|
+
```tsx
|
|
392
|
+
import { NumericPanel, TextPanel, ListPanel, PanelState } from 'forlogic-core';
|
|
393
|
+
|
|
394
|
+
// Painel Numérico
|
|
395
|
+
<NumericPanel
|
|
396
|
+
config={panelConfig}
|
|
397
|
+
state={PanelState.Loaded}
|
|
398
|
+
value={1247}
|
|
399
|
+
label="Contagem" // override do label automático
|
|
400
|
+
onClick={() => openPopover()}
|
|
401
|
+
/>
|
|
402
|
+
|
|
403
|
+
// Painel de Texto
|
|
404
|
+
<TextPanel
|
|
405
|
+
config={{ ...panelConfig, textTypeString: '<h3>Título</h3><p>Conteúdo</p>' }}
|
|
406
|
+
state={PanelState.Loaded}
|
|
407
|
+
/>
|
|
408
|
+
|
|
409
|
+
// Painel de Lista
|
|
410
|
+
<ListPanel
|
|
411
|
+
config={panelConfig}
|
|
412
|
+
state={PanelState.Loaded}
|
|
413
|
+
data={rows}
|
|
414
|
+
columns={columnDefinitions}
|
|
415
|
+
enableRowLinks={true}
|
|
416
|
+
onRowClick={(row) => openDetail(row)}
|
|
417
|
+
/>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Props:**
|
|
421
|
+
| Prop | Tipo | Padrão | Descrição |
|
|
422
|
+
|------|------|--------|-----------|
|
|
423
|
+
| `NumericPanel.value` | `number | string | null` | - | Valor numérico a exibir. Formatado automaticamente como moeda quando o campo é de custo. |
|
|
424
|
+
| `NumericPanel.label` | `string` | - | Override do label de agregação. Sem ele, usa o mapa interno (Count→Contagem, Sum→Soma, etc.). |
|
|
425
|
+
| `NumericPanel.onClick` | `() => void` | - | Torna o valor clicável (cursor pointer + hover). |
|
|
426
|
+
| `TextPanel.htmlContent` | `string` | - | HTML alternativo. Sem ele, usa config.textTypeString. |
|
|
427
|
+
|
|
428
|
+
**Exemplos:**
|
|
429
|
+
```tsx
|
|
430
|
+
// Contagem simples
|
|
431
|
+
<NumericPanel config={config} state={PanelState.Loaded} value={1247} />
|
|
432
|
+
|
|
433
|
+
// Com formatação de moeda (detectado pelo campo
|
|
434
|
+
```
|
|
435
|
+
```tsx
|
|
436
|
+
<TextPanel
|
|
437
|
+
config={{
|
|
438
|
+
...config,
|
|
439
|
+
textTypeString:
|
|
440
|
+
```
|
|
441
|
+
```tsx
|
|
442
|
+
<ListPanel
|
|
443
|
+
config={config}
|
|
444
|
+
state={PanelState.Loaded}
|
|
445
|
+
data={[
|
|
446
|
+
{ code:
|
|
447
|
+
```
|
|
448
|
+
```tsx
|
|
449
|
+
OC-002
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardPanelsBasicDoc.tsx`
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
### Painéis Cartesianos
|
|
457
|
+
|
|
458
|
+
CartesianPanel é um componente unificado que renderiza 6 variantes de gráfico (Bar, Column, StackedColumn, Area, Line, EvolutionLine) via a prop variant. Todos usam Recharts internamente e compartilham a mesma API de dados.
|
|
459
|
+
|
|
460
|
+
**Uso:**
|
|
461
|
+
```tsx
|
|
462
|
+
import { CartesianPanel, PanelState, type CartesianSeries } from 'forlogic-core';
|
|
463
|
+
|
|
464
|
+
// Uso básico — série única
|
|
465
|
+
<CartesianPanel
|
|
466
|
+
config={panelConfig}
|
|
467
|
+
variant="column" // 'bar' | 'column' | 'stacked-column' | 'area' | 'line' | 'evolution-line'
|
|
468
|
+
state={PanelState.Loaded}
|
|
469
|
+
data={[
|
|
470
|
+
{ key: 'Jan', value: 42 },
|
|
471
|
+
{ key: 'Fev', value: 58 },
|
|
472
|
+
]}
|
|
473
|
+
/>
|
|
474
|
+
|
|
475
|
+
// Múltiplas séries
|
|
476
|
+
<CartesianPanel
|
|
477
|
+
config={panelConfig}
|
|
478
|
+
variant="column"
|
|
479
|
+
state={PanelState.Loaded}
|
|
480
|
+
data={data}
|
|
481
|
+
series={[
|
|
482
|
+
{ dataKey: 'opened', name: 'Abertas', color: '#4e79a7' },
|
|
483
|
+
{ dataKey: 'closed', name: 'Fechadas', color: '#59a14f' },
|
|
484
|
+
]}
|
|
485
|
+
categoryKey="month" // chave do eixo X (default: 'key')
|
|
486
|
+
yAxisFormat="R$ {value}" // formato do eixo Y
|
|
487
|
+
onPointClick={(data, index) => openDetail(data)}
|
|
488
|
+
/>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
**Exemplos:**
|
|
492
|
+
```tsx
|
|
493
|
+
<CartesianPanel
|
|
494
|
+
config={config}
|
|
495
|
+
variant=
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardPanelsCartesianDoc.tsx`
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
### Painéis Especiais
|
|
503
|
+
|
|
504
|
+
Cinco painéis especializados: PiePanel (pizza com percentuais), ParetoPanel (barras + linha cumulativa), BurndownPanel (execução vs planejamento), PerformancePanel (barras comparativas) e MatrixRiskPanel (grid de criticidade com tooltips).
|
|
505
|
+
|
|
506
|
+
**Uso:**
|
|
507
|
+
```tsx
|
|
508
|
+
import {
|
|
509
|
+
PiePanel, ParetoPanel, BurndownPanel,
|
|
510
|
+
PerformancePanel, MatrixRiskPanel,
|
|
511
|
+
PanelState, MatrixViewType,
|
|
512
|
+
} from 'forlogic-core';
|
|
513
|
+
|
|
514
|
+
// Pie
|
|
515
|
+
<PiePanel config={config} state={PanelState.Loaded} data={pieData} />
|
|
516
|
+
|
|
517
|
+
// Pareto
|
|
518
|
+
<ParetoPanel config={config} state={PanelState.Loaded} data={paretoData} />
|
|
519
|
+
|
|
520
|
+
// Burndown
|
|
521
|
+
<BurndownPanel config={config} state={PanelState.Loaded} data={burndownData} />
|
|
522
|
+
|
|
523
|
+
// Performance
|
|
524
|
+
<PerformancePanel config={config} state={PanelState.Loaded} data={performanceData} />
|
|
525
|
+
|
|
526
|
+
// Matrix Risk
|
|
527
|
+
<MatrixRiskPanel
|
|
528
|
+
config={config}
|
|
529
|
+
state={PanelState.Loaded}
|
|
530
|
+
rule={matrixRule}
|
|
531
|
+
risks={risks}
|
|
532
|
+
matrixViewType={MatrixViewType.Quantity}
|
|
533
|
+
/>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
**Exemplos:**
|
|
537
|
+
```tsx
|
|
538
|
+
<PiePanel
|
|
539
|
+
config={config}
|
|
540
|
+
state={PanelState.Loaded}
|
|
541
|
+
data={[
|
|
542
|
+
{ key:
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
> Fonte: `src\design-system\docs\components\dashboards\DashboardPanelsSpecialDoc.tsx`
|
|
546
|
+
|
|
547
|
+
---
|