@oondemand/oon-core-front 0.5.6 → 0.6.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/dist/chunk-32GGDIWB.js +71 -0
- package/dist/chunk-32GGDIWB.js.map +1 -0
- package/dist/chunk-ALZCHGGI.js +19 -0
- package/dist/chunk-ALZCHGGI.js.map +1 -0
- package/dist/chunk-KD7UQF5E.js +103 -0
- package/dist/chunk-KD7UQF5E.js.map +1 -0
- package/dist/chunk-R7ZBLDC2.js +5429 -0
- package/dist/chunk-R7ZBLDC2.js.map +1 -0
- package/dist/chunk-V6TY7KAL.js +8 -0
- package/dist/chunk-V6TY7KAL.js.map +1 -0
- package/dist/chunk-VC6NTMZS.js +187 -0
- package/dist/chunk-VC6NTMZS.js.map +1 -0
- package/dist/chunk-VJ7YNFF7.js +694 -0
- package/dist/chunk-VJ7YNFF7.js.map +1 -0
- package/dist/chunk-VJDTI2II.js +2111 -0
- package/dist/chunk-VJDTI2II.js.map +1 -0
- package/dist/hooks-lXMaiLqz.d.ts +89 -0
- package/dist/hooks.d.ts +8 -0
- package/dist/hooks.js +24 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +26 -1187
- package/dist/index.js +63 -10202
- package/dist/index.js.map +1 -1
- package/dist/routing.d.ts +12 -0
- package/dist/routing.js +17 -0
- package/dist/routing.js.map +1 -0
- package/dist/testing.d.ts +8 -0
- package/dist/testing.js +22 -0
- package/dist/testing.js.map +1 -0
- package/dist/theme-Clhoswb3.d.ts +28 -0
- package/dist/theme.d.ts +12 -0
- package/dist/theme.js +14 -0
- package/dist/theme.js.map +1 -0
- package/dist/types-BEVt-nU8.d.ts +666 -0
- package/dist/ui-1Um8gXIZ.d.ts +337 -0
- package/dist/ui.d.ts +5 -0
- package/dist/ui.js +86 -0
- package/dist/ui.js.map +1 -0
- package/package.json +21 -1
|
@@ -0,0 +1,666 @@
|
|
|
1
|
+
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { O as OonThemeDefinition } from './theme-Clhoswb3.js';
|
|
3
|
+
|
|
4
|
+
/** Tipos de campo emitidos pelo `fields` do back (Seção 2.4). */
|
|
5
|
+
type FieldKind = "string" | "number" | "boolean" | "date" | "ref" | "enum" | "currency" | "currencyCode" | "currencyConverted" | "raw";
|
|
6
|
+
/** Metadata de um campo de model, vinda de `metaFields` no back. */
|
|
7
|
+
interface FieldMeta {
|
|
8
|
+
name: string;
|
|
9
|
+
kind: FieldKind;
|
|
10
|
+
label?: string;
|
|
11
|
+
searchable?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
/** model referenciada quando kind === "ref". */
|
|
14
|
+
ref?: string;
|
|
15
|
+
/** valores possíveis quando kind === "enum". */
|
|
16
|
+
options?: string[];
|
|
17
|
+
/** moeda base quando kind === "currencyConverted". */
|
|
18
|
+
base?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Resumo de uma model (resposta de /core/models e /core/models/:name). */
|
|
21
|
+
interface ModelSummary {
|
|
22
|
+
name: string;
|
|
23
|
+
singular: string;
|
|
24
|
+
/** basePath em que o CRUD está montado no back (ex.: "/cotacoes"). */
|
|
25
|
+
basePath: string;
|
|
26
|
+
crud: boolean;
|
|
27
|
+
roles: {
|
|
28
|
+
read?: string[];
|
|
29
|
+
write?: string[];
|
|
30
|
+
};
|
|
31
|
+
fields: FieldMeta[];
|
|
32
|
+
searchable: string[];
|
|
33
|
+
}
|
|
34
|
+
interface MenuMeta {
|
|
35
|
+
label: string;
|
|
36
|
+
href?: string;
|
|
37
|
+
icon?: string;
|
|
38
|
+
section?: string;
|
|
39
|
+
order?: number;
|
|
40
|
+
permissions?: string[];
|
|
41
|
+
capabilities?: string[];
|
|
42
|
+
children?: OonMenuItem[];
|
|
43
|
+
badge?: string | number;
|
|
44
|
+
external?: boolean;
|
|
45
|
+
hidden?: boolean;
|
|
46
|
+
action?: string;
|
|
47
|
+
renderer?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Resposta completa de GET /core/metadata. */
|
|
50
|
+
interface CoreMetadata {
|
|
51
|
+
service: {
|
|
52
|
+
name: string;
|
|
53
|
+
version: string;
|
|
54
|
+
};
|
|
55
|
+
models: ModelSummary[];
|
|
56
|
+
collections: unknown[];
|
|
57
|
+
documents: unknown[];
|
|
58
|
+
pipelines: unknown[];
|
|
59
|
+
features: unknown[];
|
|
60
|
+
menus: MenuMeta[];
|
|
61
|
+
}
|
|
62
|
+
interface Pagination {
|
|
63
|
+
currentPage: number;
|
|
64
|
+
totalPages: number;
|
|
65
|
+
totalItems: number;
|
|
66
|
+
itemsPerPage: number;
|
|
67
|
+
}
|
|
68
|
+
interface PaginatedResult<T = Record<string, unknown>> {
|
|
69
|
+
results: T[];
|
|
70
|
+
pagination: Pagination;
|
|
71
|
+
}
|
|
72
|
+
interface ListParams {
|
|
73
|
+
pageIndex?: number;
|
|
74
|
+
pageSize?: number;
|
|
75
|
+
searchTerm?: string;
|
|
76
|
+
/** ex.: "nome.asc" | "criadoEm.desc" */
|
|
77
|
+
sort?: string;
|
|
78
|
+
/** filtros adicionais viram query string. */
|
|
79
|
+
[filter: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
/** Erro normalizado (errorNormalizer). */
|
|
82
|
+
interface OonError {
|
|
83
|
+
code: string;
|
|
84
|
+
message: string;
|
|
85
|
+
status?: number;
|
|
86
|
+
details?: unknown;
|
|
87
|
+
requestId?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Origem de auditoria enviada nos headers x-oon-* das mutações. */
|
|
90
|
+
type AuditOrigin = "datagrid" | "form" | "workflow" | "assistant" | "import";
|
|
91
|
+
interface AuditContext {
|
|
92
|
+
origem?: AuditOrigin;
|
|
93
|
+
module?: string;
|
|
94
|
+
entity?: string;
|
|
95
|
+
}
|
|
96
|
+
interface OonUser {
|
|
97
|
+
tipo: string;
|
|
98
|
+
nome: string;
|
|
99
|
+
email: string;
|
|
100
|
+
capabilities?: string[];
|
|
101
|
+
permissoes?: {
|
|
102
|
+
capabilities?: string[];
|
|
103
|
+
[extra: string]: unknown;
|
|
104
|
+
};
|
|
105
|
+
aplicativo?: {
|
|
106
|
+
capabilities?: string[];
|
|
107
|
+
permissoes?: {
|
|
108
|
+
capabilities?: string[];
|
|
109
|
+
[extra: string]: unknown;
|
|
110
|
+
};
|
|
111
|
+
[extra: string]: unknown;
|
|
112
|
+
};
|
|
113
|
+
[extra: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
type OonAppKind = "root-central" | "member-central" | "portal-cockpit";
|
|
116
|
+
type OonTenancyModel = "none" | "single_tenant" | "multi_tenant";
|
|
117
|
+
interface OonAppConfig {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
title?: string;
|
|
121
|
+
logo?: string;
|
|
122
|
+
favicon?: string;
|
|
123
|
+
version?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Perfil arquitetural da aplicação no Ecossistema Oon.
|
|
126
|
+
* - root-central: Central de Ativações.
|
|
127
|
+
* - member-central: Central publicada para tenant/licença/ambiente.
|
|
128
|
+
* - portal-cockpit: Portal/Cockpit como Meus Apps.
|
|
129
|
+
*/
|
|
130
|
+
kind?: OonAppKind;
|
|
131
|
+
/** Define se o runtime pode selecionar e persistir tenant para este App. */
|
|
132
|
+
tenancyModel?: OonTenancyModel;
|
|
133
|
+
capabilities?: string[];
|
|
134
|
+
capabilitySettings?: Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
interface OonApiConfig {
|
|
137
|
+
baseUrl: string;
|
|
138
|
+
assistantBaseUrl?: string;
|
|
139
|
+
meusAppsUrl?: string;
|
|
140
|
+
/** Control Plane público usado somente por cadastro e confirmação. */
|
|
141
|
+
onboardingBaseUrl?: string;
|
|
142
|
+
/** Prefixo de versão concatenado às chamadas. Default: "". */
|
|
143
|
+
versionPrefix?: string;
|
|
144
|
+
timeout?: number;
|
|
145
|
+
}
|
|
146
|
+
type OonAuthMode = "bearer" | "cookie" | "external-sso" | "central-instance" | "central-client";
|
|
147
|
+
type OonRuntimeMode = "platform" | "local";
|
|
148
|
+
interface OonAuthConfig {
|
|
149
|
+
mode?: OonAuthMode;
|
|
150
|
+
/** URL de login externo (Meus Apps) para redirect quando sem token. */
|
|
151
|
+
loginUrl?: string;
|
|
152
|
+
/** Nome do query param que carrega o token na volta do SSO. Default: "code". */
|
|
153
|
+
tokenParam?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Token usado somente no desenvolvimento local. Quando informado, tem
|
|
156
|
+
* prioridade sobre um token antigo do storage, é persistido e validado no
|
|
157
|
+
* backend normalmente antes de qualquer redirecionamento.
|
|
158
|
+
*/
|
|
159
|
+
devToken?: string;
|
|
160
|
+
}
|
|
161
|
+
interface OonSecurityConfig {
|
|
162
|
+
enableRouteGuard?: boolean;
|
|
163
|
+
enablePermissionGate?: boolean;
|
|
164
|
+
redactAssistantContext?: boolean;
|
|
165
|
+
disableConsoleInProduction?: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface OonCoreFrontConfig {
|
|
168
|
+
app: OonAppConfig;
|
|
169
|
+
api: OonApiConfig;
|
|
170
|
+
/** Runtime local desconectado ou execução integrada à plataforma. */
|
|
171
|
+
runtimeMode?: OonRuntimeMode;
|
|
172
|
+
auth?: OonAuthConfig;
|
|
173
|
+
theme?: OonThemeDefinition | Record<string, unknown>;
|
|
174
|
+
themes?: OonThemeDefinition[];
|
|
175
|
+
defaultThemeId?: string;
|
|
176
|
+
modules?: OonModule[];
|
|
177
|
+
/**
|
|
178
|
+
* Composição declarativa opcional para coleções, documentos e esteiras.
|
|
179
|
+
*/
|
|
180
|
+
ui?: OonUiManifest;
|
|
181
|
+
layout?: OonLayoutConfig;
|
|
182
|
+
registry?: OonComponentRegistry;
|
|
183
|
+
security?: OonSecurityConfig;
|
|
184
|
+
/** Substituições explícitas para experiências de sistema, sem liberar a rota reservada. */
|
|
185
|
+
systemPages?: OonSystemPages;
|
|
186
|
+
/** Elemento DOM onde montar. Default: #root. */
|
|
187
|
+
rootElementId?: string;
|
|
188
|
+
}
|
|
189
|
+
/** Contrato code-first do app. Código local permanece no grafo de frontend. */
|
|
190
|
+
interface OonAppDefinition {
|
|
191
|
+
app: OonAppConfig;
|
|
192
|
+
api: OonApiConfig;
|
|
193
|
+
runtimeMode?: OonRuntimeMode;
|
|
194
|
+
auth?: OonAuthConfig;
|
|
195
|
+
routes?: OonRoute[];
|
|
196
|
+
navigation?: OonNavigationConfig | OonMenuItem[];
|
|
197
|
+
shell?: OonLayoutConfig;
|
|
198
|
+
layouts?: OonComponentRegistry["layoutSlots"];
|
|
199
|
+
components?: OonComponentRegistry;
|
|
200
|
+
pages?: OonPageDef[];
|
|
201
|
+
modules?: OonModule[];
|
|
202
|
+
/** Composição declarativa opcional para casos simples. */
|
|
203
|
+
ui?: OonUiManifest;
|
|
204
|
+
theme?: OonThemeDefinition | Record<string, unknown>;
|
|
205
|
+
themes?: OonThemeDefinition[];
|
|
206
|
+
defaultThemeId?: string;
|
|
207
|
+
security?: OonSecurityConfig;
|
|
208
|
+
systemPages?: OonSystemPages;
|
|
209
|
+
rootElementId?: string;
|
|
210
|
+
}
|
|
211
|
+
interface OonSystemPages {
|
|
212
|
+
login?: ComponentType;
|
|
213
|
+
}
|
|
214
|
+
interface OonRoute {
|
|
215
|
+
path: string;
|
|
216
|
+
/** Elemento React já construído. Use apenas uma fonte de renderização por rota. */
|
|
217
|
+
element?: ReactNode;
|
|
218
|
+
/** Página React convencional, instanciada pelo roteador do Core. */
|
|
219
|
+
component?: ComponentType;
|
|
220
|
+
/** Lazy import convencional: () => import("./MinhaPagina"). */
|
|
221
|
+
lazy?: () => Promise<{
|
|
222
|
+
default: ComponentType;
|
|
223
|
+
}>;
|
|
224
|
+
/** Layout local aplicado somente à rota. */
|
|
225
|
+
layout?: ComponentType<{
|
|
226
|
+
children: ReactNode;
|
|
227
|
+
}>;
|
|
228
|
+
/** rota pública não passa pelo RouteGuard. */
|
|
229
|
+
public?: boolean;
|
|
230
|
+
permissions?: string[];
|
|
231
|
+
capabilities?: string[];
|
|
232
|
+
}
|
|
233
|
+
interface OonMenuItem {
|
|
234
|
+
label: string;
|
|
235
|
+
href: string;
|
|
236
|
+
icon?: ReactNode;
|
|
237
|
+
section?: string;
|
|
238
|
+
order?: number;
|
|
239
|
+
permissions?: string[];
|
|
240
|
+
capabilities?: string[];
|
|
241
|
+
children?: OonMenuItem[];
|
|
242
|
+
badge?: string | number;
|
|
243
|
+
external?: boolean;
|
|
244
|
+
hidden?: boolean;
|
|
245
|
+
action?: string;
|
|
246
|
+
renderer?: string;
|
|
247
|
+
}
|
|
248
|
+
type OonSchemaVersion = 2;
|
|
249
|
+
type OonSlotConfig = "core" | "none" | `custom:${string}`;
|
|
250
|
+
interface OonLayoutConfig {
|
|
251
|
+
shell?: "default" | "portal" | "content-only" | `custom:${string}`;
|
|
252
|
+
sidebar?: OonSlotConfig;
|
|
253
|
+
topbar?: OonSlotConfig;
|
|
254
|
+
header?: "none" | `custom:${string}`;
|
|
255
|
+
footer?: "core" | "none" | `custom:${string}`;
|
|
256
|
+
assistant?: "core" | "none" | `custom:${string}`;
|
|
257
|
+
main?: "core";
|
|
258
|
+
}
|
|
259
|
+
type OonRendererComponent<TProps = Record<string, unknown>> = ComponentType<TProps>;
|
|
260
|
+
interface OonComponentRegistry {
|
|
261
|
+
layoutSlots?: Record<string, OonRendererComponent<any>>;
|
|
262
|
+
fieldRenderers?: Record<string, OonRendererComponent<any>>;
|
|
263
|
+
cellRenderers?: Record<string, OonRendererComponent<any>>;
|
|
264
|
+
cardRenderers?: Record<string, OonRendererComponent<any>>;
|
|
265
|
+
actionRenderers?: Record<string, OonRendererComponent<any>>;
|
|
266
|
+
pageComponents?: Record<string, OonRendererComponent<any>>;
|
|
267
|
+
menuRenderers?: Record<string, OonRendererComponent<any>>;
|
|
268
|
+
}
|
|
269
|
+
type OonNavigationMode = "auto" | "manual" | "mixed";
|
|
270
|
+
interface OonNavigationConfig {
|
|
271
|
+
mode?: OonNavigationMode;
|
|
272
|
+
items?: OonMenuItem[];
|
|
273
|
+
}
|
|
274
|
+
interface OonModule {
|
|
275
|
+
id: string;
|
|
276
|
+
label: string;
|
|
277
|
+
version?: string;
|
|
278
|
+
routes?: OonRoute[];
|
|
279
|
+
menu?: OonMenuItem[];
|
|
280
|
+
/** views declarativas que o Core transforma em rota + menu. */
|
|
281
|
+
views?: OonViewDefinition[];
|
|
282
|
+
}
|
|
283
|
+
type CollectionMode = "full" | "minimal" | "dynamic";
|
|
284
|
+
type OonValueFormat = "text" | "number" | "currency" | "percent" | "date" | "datetime" | "badge";
|
|
285
|
+
interface OonColumnDef {
|
|
286
|
+
field: string;
|
|
287
|
+
label?: string;
|
|
288
|
+
/** kind sobrescreve o inferido da metadata. */
|
|
289
|
+
kind?: FieldKind;
|
|
290
|
+
/** Formato de apresentação; datetime preserva data e hora no locale do usuário. */
|
|
291
|
+
format?: OonValueFormat;
|
|
292
|
+
sortable?: boolean;
|
|
293
|
+
width?: number;
|
|
294
|
+
renderer?: string;
|
|
295
|
+
permissions?: string[];
|
|
296
|
+
capabilities?: string[];
|
|
297
|
+
}
|
|
298
|
+
type OonFormFieldWidget = "default" | "checkbox";
|
|
299
|
+
interface OonSelectOption {
|
|
300
|
+
value: string;
|
|
301
|
+
label: string;
|
|
302
|
+
description?: string;
|
|
303
|
+
}
|
|
304
|
+
interface OonFormFieldDef {
|
|
305
|
+
field: string;
|
|
306
|
+
label?: string;
|
|
307
|
+
kind?: FieldKind;
|
|
308
|
+
required?: boolean;
|
|
309
|
+
options?: Array<string | OonSelectOption>;
|
|
310
|
+
/** Endpoint de opções dependente dos valores atuais do formulário. */
|
|
311
|
+
optionsEndpoint?: string;
|
|
312
|
+
/** Caminho da lista na resposta do endpoint. Default: "options". */
|
|
313
|
+
optionsResponsePath?: string;
|
|
314
|
+
/** Campos usados como value/label/descrição em cada item remoto. */
|
|
315
|
+
optionsValueField?: string;
|
|
316
|
+
optionsLabelField?: string;
|
|
317
|
+
optionsDescriptionField?: string;
|
|
318
|
+
/** Caminho booleano que informa se a seleção pode ser alterada. */
|
|
319
|
+
optionsEditablePath?: string;
|
|
320
|
+
/** Campos do formulário que invalidam/recarregam as opções. */
|
|
321
|
+
optionsDependsOn?: string[];
|
|
322
|
+
/** Opções seguras usadas quando o endpoint falha ou retorna lista vazia. */
|
|
323
|
+
fallbackOptions?: Array<string | OonSelectOption>;
|
|
324
|
+
/** Bloqueia a seleção enquanto usa fallback. Default: true. */
|
|
325
|
+
readonlyOnFallback?: boolean;
|
|
326
|
+
/** Texto auxiliar exibido quando o fallback está ativo. */
|
|
327
|
+
optionsUnavailableMessage?: string;
|
|
328
|
+
readonly?: boolean;
|
|
329
|
+
/** model relacionada quando kind === "ref". */
|
|
330
|
+
ref?: string;
|
|
331
|
+
renderer?: string;
|
|
332
|
+
/** Controle visual pontual sem substituir a página/formulário inteiro. */
|
|
333
|
+
widget?: OonFormFieldWidget;
|
|
334
|
+
/** Valor persistido quando um checkbox está marcado. Default: true. */
|
|
335
|
+
checkedValue?: string | number | boolean;
|
|
336
|
+
/** Valor persistido quando um checkbox está desmarcado. Default: false. */
|
|
337
|
+
uncheckedValue?: string | number | boolean;
|
|
338
|
+
/** Agrupa campos relacionados em um bloco visual comum. */
|
|
339
|
+
group?: string;
|
|
340
|
+
/** Rótulo exibido uma vez acima do grupo. Default: group. */
|
|
341
|
+
groupLabel?: string;
|
|
342
|
+
groupDescription?: string;
|
|
343
|
+
/** Exibe controles do mesmo grupo na mesma linha quando houver espaço. */
|
|
344
|
+
inline?: boolean;
|
|
345
|
+
permissions?: string[];
|
|
346
|
+
capabilities?: string[];
|
|
347
|
+
}
|
|
348
|
+
/** Definição de uma coleção nas três formas da Seção 4.4. */
|
|
349
|
+
interface OonActionDef {
|
|
350
|
+
id: string;
|
|
351
|
+
label?: string;
|
|
352
|
+
renderer?: string;
|
|
353
|
+
permissions?: string[];
|
|
354
|
+
capabilities?: string[];
|
|
355
|
+
action?: string;
|
|
356
|
+
}
|
|
357
|
+
type OonListFilterDef = {
|
|
358
|
+
field: string;
|
|
359
|
+
label?: string;
|
|
360
|
+
type?: "text" | "select" | "date" | "dateRange" | "numberRange" | "boolean" | "ref";
|
|
361
|
+
options?: Array<{
|
|
362
|
+
label: string;
|
|
363
|
+
value: string | number | boolean | null;
|
|
364
|
+
}>;
|
|
365
|
+
defaultValue?: unknown;
|
|
366
|
+
placeholder?: string;
|
|
367
|
+
};
|
|
368
|
+
type OonConditionDef = {
|
|
369
|
+
field: string;
|
|
370
|
+
exists: boolean;
|
|
371
|
+
} | {
|
|
372
|
+
field: string;
|
|
373
|
+
equals: unknown;
|
|
374
|
+
} | {
|
|
375
|
+
field: string;
|
|
376
|
+
notEquals: unknown;
|
|
377
|
+
} | {
|
|
378
|
+
field: string;
|
|
379
|
+
in: unknown[];
|
|
380
|
+
} | {
|
|
381
|
+
field: string;
|
|
382
|
+
gt: number;
|
|
383
|
+
} | {
|
|
384
|
+
field: string;
|
|
385
|
+
gte: number;
|
|
386
|
+
} | {
|
|
387
|
+
field: string;
|
|
388
|
+
lt: number;
|
|
389
|
+
} | {
|
|
390
|
+
field: string;
|
|
391
|
+
lte: number;
|
|
392
|
+
};
|
|
393
|
+
type OonRowActionDef = {
|
|
394
|
+
id?: string;
|
|
395
|
+
label: string;
|
|
396
|
+
icon?: string;
|
|
397
|
+
/** Exibe somente o ícone, preservando label em title e aria-label. */
|
|
398
|
+
iconOnly?: boolean;
|
|
399
|
+
type: "openDetailModal" | "navigate" | "apiAction" | "customAction";
|
|
400
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
401
|
+
endpoint?: string;
|
|
402
|
+
href?: string;
|
|
403
|
+
initialTab?: string;
|
|
404
|
+
confirm?: {
|
|
405
|
+
title?: string;
|
|
406
|
+
description?: string;
|
|
407
|
+
};
|
|
408
|
+
disabledWhen?: OonConditionDef;
|
|
409
|
+
hiddenWhen?: OonConditionDef;
|
|
410
|
+
refresh?: Array<"self" | "parent" | "all" | string>;
|
|
411
|
+
roles?: string[];
|
|
412
|
+
permissions?: string[];
|
|
413
|
+
capabilities?: string[];
|
|
414
|
+
renderer?: string;
|
|
415
|
+
};
|
|
416
|
+
type OonCollectionListConfig = {
|
|
417
|
+
filters?: OonListFilterDef[];
|
|
418
|
+
columns?: Array<string | OonColumnDef>;
|
|
419
|
+
rowActions?: OonRowActionDef[];
|
|
420
|
+
/** Permite ocultar ações CRUD nativas quando a Central fornece ações de negócio próprias. */
|
|
421
|
+
builtInActions?: {
|
|
422
|
+
create?: boolean;
|
|
423
|
+
edit?: boolean;
|
|
424
|
+
delete?: boolean;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
427
|
+
type OonRelationDef = {
|
|
428
|
+
model: string;
|
|
429
|
+
foreignKey: string;
|
|
430
|
+
parentKey?: string;
|
|
431
|
+
label?: string;
|
|
432
|
+
};
|
|
433
|
+
type OonRelatedGridColumnDef = OonColumnDef & {
|
|
434
|
+
editable?: boolean;
|
|
435
|
+
readonly?: boolean;
|
|
436
|
+
format?: OonValueFormat;
|
|
437
|
+
editor?: "string" | "number" | "currency" | "date" | "enum" | "select" | "ref" | "boolean" | "textarea";
|
|
438
|
+
hidden?: boolean;
|
|
439
|
+
roles?: string[];
|
|
440
|
+
required?: boolean;
|
|
441
|
+
display?: "badgeExists" | "badge" | string;
|
|
442
|
+
};
|
|
443
|
+
type OonSummaryCardDef = {
|
|
444
|
+
label: string;
|
|
445
|
+
source?: "field" | "relatedCount" | "relatedSum" | "relatedAvg" | "customMetric";
|
|
446
|
+
field?: string;
|
|
447
|
+
relation?: string | OonRelationDef;
|
|
448
|
+
metric?: string;
|
|
449
|
+
format?: OonValueFormat;
|
|
450
|
+
};
|
|
451
|
+
type OonDetailTabDef = {
|
|
452
|
+
id: string;
|
|
453
|
+
label: string;
|
|
454
|
+
type: "summary";
|
|
455
|
+
cards?: OonSummaryCardDef[];
|
|
456
|
+
} | {
|
|
457
|
+
id: string;
|
|
458
|
+
label: string;
|
|
459
|
+
type: "form";
|
|
460
|
+
groups?: Array<{
|
|
461
|
+
label: string;
|
|
462
|
+
description?: string;
|
|
463
|
+
fields: string[];
|
|
464
|
+
columns?: 1 | 2 | 3 | 4;
|
|
465
|
+
}>;
|
|
466
|
+
fields?: string[];
|
|
467
|
+
} | {
|
|
468
|
+
id: string;
|
|
469
|
+
label: string;
|
|
470
|
+
type: "relatedGrid";
|
|
471
|
+
relation: string | OonRelationDef;
|
|
472
|
+
editable?: boolean;
|
|
473
|
+
editMode?: "inline" | "modal" | "drawer";
|
|
474
|
+
columns?: Array<string | OonRelatedGridColumnDef>;
|
|
475
|
+
rowActions?: OonRowActionDef[];
|
|
476
|
+
} | {
|
|
477
|
+
id: string;
|
|
478
|
+
label: string;
|
|
479
|
+
type: "readonlyGrid";
|
|
480
|
+
relation: string | OonRelationDef;
|
|
481
|
+
columns?: Array<string | OonRelatedGridColumnDef>;
|
|
482
|
+
rowActions?: OonRowActionDef[];
|
|
483
|
+
} | {
|
|
484
|
+
id: string;
|
|
485
|
+
label: string;
|
|
486
|
+
type: "customComponent";
|
|
487
|
+
component: string;
|
|
488
|
+
props?: Record<string, unknown>;
|
|
489
|
+
};
|
|
490
|
+
type OonDetailModalConfig = {
|
|
491
|
+
enabled?: boolean;
|
|
492
|
+
titleField?: string;
|
|
493
|
+
size?: "md" | "lg" | "xl" | "full";
|
|
494
|
+
defaultTab?: string;
|
|
495
|
+
tabs: OonDetailTabDef[];
|
|
496
|
+
};
|
|
497
|
+
interface CollectionViewDef {
|
|
498
|
+
type: "collection";
|
|
499
|
+
/** id de rota/menu; default = model em minúsculas. */
|
|
500
|
+
id?: string;
|
|
501
|
+
model: string;
|
|
502
|
+
label?: string;
|
|
503
|
+
path?: string;
|
|
504
|
+
icon?: ReactNode;
|
|
505
|
+
section?: string;
|
|
506
|
+
/** Mantém a rota disponível, mas remove a coleção do menu lateral. */
|
|
507
|
+
hidden?: boolean;
|
|
508
|
+
/** "dynamic" monta tudo a partir de /core/models/:model. */
|
|
509
|
+
mode?: CollectionMode;
|
|
510
|
+
/** modo "full": colunas explícitas. */
|
|
511
|
+
columns?: OonColumnDef[];
|
|
512
|
+
/** Campos explícitos ou overrides pontuais sobre a metadata do model. */
|
|
513
|
+
form?: OonFormFieldDef[];
|
|
514
|
+
importExport?: boolean;
|
|
515
|
+
renderer?: string;
|
|
516
|
+
cardRenderer?: string;
|
|
517
|
+
actions?: OonActionDef[];
|
|
518
|
+
list?: OonCollectionListConfig;
|
|
519
|
+
relations?: Record<string, OonRelationDef>;
|
|
520
|
+
detailModal?: OonDetailModalConfig;
|
|
521
|
+
permissions?: string[];
|
|
522
|
+
capabilities?: string[];
|
|
523
|
+
}
|
|
524
|
+
interface DocumentViewDef {
|
|
525
|
+
type: "document";
|
|
526
|
+
id?: string;
|
|
527
|
+
model: string;
|
|
528
|
+
endpoint?: string;
|
|
529
|
+
label?: string;
|
|
530
|
+
path?: string;
|
|
531
|
+
icon?: ReactNode;
|
|
532
|
+
section?: string;
|
|
533
|
+
approval?: boolean;
|
|
534
|
+
attachments?: boolean;
|
|
535
|
+
/** Experiência de uso: CRUD operacional (legado) ou biblioteca para leitura. */
|
|
536
|
+
display?: "crud" | "library";
|
|
537
|
+
categoryField?: string;
|
|
538
|
+
titleField?: string;
|
|
539
|
+
descriptionField?: string;
|
|
540
|
+
contentField?: string;
|
|
541
|
+
statusField?: string;
|
|
542
|
+
updatedAtField?: string;
|
|
543
|
+
permissions?: string[];
|
|
544
|
+
capabilities?: string[];
|
|
545
|
+
}
|
|
546
|
+
interface PipelineViewDef {
|
|
547
|
+
type: "pipeline";
|
|
548
|
+
id?: string;
|
|
549
|
+
/** model dos cards (tickets). */
|
|
550
|
+
model: string;
|
|
551
|
+
label?: string;
|
|
552
|
+
path?: string;
|
|
553
|
+
icon?: ReactNode;
|
|
554
|
+
section?: string;
|
|
555
|
+
/** campo do registro que define a etapa/coluna. */
|
|
556
|
+
stageField?: string;
|
|
557
|
+
/** etapas fixas; se omitido, derivadas do enum de stageField. */
|
|
558
|
+
stages?: Array<{
|
|
559
|
+
id: string;
|
|
560
|
+
label: string;
|
|
561
|
+
}>;
|
|
562
|
+
permissions?: string[];
|
|
563
|
+
capabilities?: string[];
|
|
564
|
+
}
|
|
565
|
+
interface DashboardViewDef {
|
|
566
|
+
type: "dashboard";
|
|
567
|
+
id?: string;
|
|
568
|
+
label?: string;
|
|
569
|
+
path?: string;
|
|
570
|
+
icon?: ReactNode;
|
|
571
|
+
section?: string;
|
|
572
|
+
widgets?: DashboardWidgetDef[];
|
|
573
|
+
permissions?: string[];
|
|
574
|
+
capabilities?: string[];
|
|
575
|
+
}
|
|
576
|
+
type OonPageLayout = "default" | "content-only" | "portal";
|
|
577
|
+
interface OonPageDef {
|
|
578
|
+
id?: string;
|
|
579
|
+
path: string;
|
|
580
|
+
/** Rota pública declarada, usada por entradas customizadas como o login do portal. */
|
|
581
|
+
public?: boolean;
|
|
582
|
+
label?: string;
|
|
583
|
+
title?: string;
|
|
584
|
+
section?: string;
|
|
585
|
+
icon?: ReactNode;
|
|
586
|
+
layout?: OonPageLayout;
|
|
587
|
+
blocks?: OonBlockDef[];
|
|
588
|
+
component?: string;
|
|
589
|
+
permissions?: string[];
|
|
590
|
+
capabilities?: string[];
|
|
591
|
+
hidden?: boolean;
|
|
592
|
+
order?: number;
|
|
593
|
+
}
|
|
594
|
+
type OonBlockDef = OonCustomBlockDef | OonCollectionDataGridBlockDef | OonCollectionCardsBlockDef | OonSectionBlockDef | OonMarkdownBlockDef | OonNavigationCardsBlockDef | OonGenericBlockDef;
|
|
595
|
+
interface OonBaseBlockDef {
|
|
596
|
+
id?: string;
|
|
597
|
+
title?: string;
|
|
598
|
+
permissions?: string[];
|
|
599
|
+
capabilities?: string[];
|
|
600
|
+
hidden?: boolean;
|
|
601
|
+
}
|
|
602
|
+
interface OonCustomBlockDef extends OonBaseBlockDef {
|
|
603
|
+
type: "custom";
|
|
604
|
+
component: string;
|
|
605
|
+
props?: Record<string, unknown>;
|
|
606
|
+
}
|
|
607
|
+
interface OonCollectionDataGridBlockDef extends OonBaseBlockDef {
|
|
608
|
+
type: "collection.datagrid";
|
|
609
|
+
model: string;
|
|
610
|
+
mode?: CollectionMode;
|
|
611
|
+
renderer?: string;
|
|
612
|
+
columns?: OonColumnDef[];
|
|
613
|
+
form?: OonFormFieldDef[];
|
|
614
|
+
}
|
|
615
|
+
interface OonCollectionCardsBlockDef extends OonBaseBlockDef {
|
|
616
|
+
type: "collection.cards";
|
|
617
|
+
model: string;
|
|
618
|
+
renderer?: string;
|
|
619
|
+
}
|
|
620
|
+
interface OonSectionBlockDef extends OonBaseBlockDef {
|
|
621
|
+
type: "section";
|
|
622
|
+
description?: string;
|
|
623
|
+
blocks?: OonBlockDef[];
|
|
624
|
+
}
|
|
625
|
+
interface OonMarkdownBlockDef extends OonBaseBlockDef {
|
|
626
|
+
type: "markdown";
|
|
627
|
+
content: string;
|
|
628
|
+
}
|
|
629
|
+
interface OonNavigationCardDef {
|
|
630
|
+
title: string;
|
|
631
|
+
description?: string;
|
|
632
|
+
href: string;
|
|
633
|
+
actionLabel?: string;
|
|
634
|
+
external?: boolean;
|
|
635
|
+
}
|
|
636
|
+
interface OonNavigationCardsBlockDef extends OonBaseBlockDef {
|
|
637
|
+
type: "navigation.cards";
|
|
638
|
+
cards: OonNavigationCardDef[];
|
|
639
|
+
columns?: 1 | 2 | 3 | 4;
|
|
640
|
+
}
|
|
641
|
+
interface OonGenericBlockDef extends OonBaseBlockDef {
|
|
642
|
+
type: "collection.form" | "pipeline.board" | "document.viewer" | "dashboard.kpi" | "tabs";
|
|
643
|
+
[key: string]: unknown;
|
|
644
|
+
}
|
|
645
|
+
interface DashboardWidgetDef {
|
|
646
|
+
id: string;
|
|
647
|
+
label: string;
|
|
648
|
+
/** model de onde puxar a contagem/agregação. */
|
|
649
|
+
model?: string;
|
|
650
|
+
kind?: "count" | "sum" | "custom";
|
|
651
|
+
/** campo somado quando kind === "sum". */
|
|
652
|
+
field?: string;
|
|
653
|
+
render?: () => ReactNode;
|
|
654
|
+
}
|
|
655
|
+
type OonViewDefinition = CollectionViewDef | DocumentViewDef | PipelineViewDef | DashboardViewDef;
|
|
656
|
+
interface OonUiManifest {
|
|
657
|
+
schemaVersion?: OonSchemaVersion;
|
|
658
|
+
layout?: OonLayoutConfig;
|
|
659
|
+
registry?: OonComponentRegistry;
|
|
660
|
+
navigation?: OonNavigationConfig;
|
|
661
|
+
views: OonViewDefinition[];
|
|
662
|
+
pages?: OonPageDef[];
|
|
663
|
+
blocks?: OonBlockDef[];
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export type { OonSecurityConfig as A, OonSystemPages as B, CollectionViewDef as C, DashboardViewDef as D, OonTenancyModel as E, FieldKind as F, OonUiManifest as G, OonUser as H, OonViewDefinition as I, Pagination as J, PipelineViewDef as K, ListParams as L, ModelSummary as M, AuditContext as N, OonMenuItem as O, PaginatedResult as P, OonRowActionDef as Q, OonDetailModalConfig as R, OonDetailTabDef as S, OonRelationDef as T, OonListFilterDef as U, OonCollectionListConfig as V, OonRoute as a, OonNavigationConfig as b, OonAppDefinition as c, OonCoreFrontConfig as d, DocumentViewDef as e, OonModule as f, CollectionMode as g, CoreMetadata as h, DashboardWidgetDef as i, FieldMeta as j, OonActionDef as k, OonApiConfig as l, OonAppConfig as m, OonAppKind as n, OonAuthConfig as o, OonAuthMode as p, OonBlockDef as q, OonColumnDef as r, OonComponentRegistry as s, OonError as t, OonFormFieldDef as u, OonLayoutConfig as v, OonNavigationMode as w, OonPageDef as x, OonRuntimeMode as y, OonSchemaVersion as z };
|