@oondemand/oon-core-front 0.3.10 → 0.3.12

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/index.d.ts CHANGED
@@ -40,6 +40,7 @@ interface MenuMeta {
40
40
  section?: string;
41
41
  order?: number;
42
42
  permissions?: string[];
43
+ capabilities?: string[];
43
44
  children?: OonMenuItem[];
44
45
  badge?: string | number;
45
46
  external?: boolean;
@@ -99,8 +100,22 @@ interface OonUser {
99
100
  tipo: string;
100
101
  nome: string;
101
102
  email: string;
103
+ capabilities?: string[];
104
+ permissoes?: {
105
+ capabilities?: string[];
106
+ [extra: string]: unknown;
107
+ };
108
+ aplicativo?: {
109
+ capabilities?: string[];
110
+ permissoes?: {
111
+ capabilities?: string[];
112
+ [extra: string]: unknown;
113
+ };
114
+ [extra: string]: unknown;
115
+ };
102
116
  [extra: string]: unknown;
103
117
  }
118
+ type OonAppKind = "root-central" | "member-central" | "portal-cockpit";
104
119
  interface OonAppConfig {
105
120
  id: string;
106
121
  name: string;
@@ -108,6 +123,13 @@ interface OonAppConfig {
108
123
  logo?: string;
109
124
  favicon?: string;
110
125
  version?: string;
126
+ /**
127
+ * Perfil arquitetural da aplicação no Ecossistema Oon.
128
+ * - root-central: Central de Ativações.
129
+ * - member-central: Central publicada para tenant/licença/ambiente.
130
+ * - portal-cockpit: Portal/Cockpit como Meus Apps.
131
+ */
132
+ kind?: OonAppKind;
111
133
  }
112
134
  interface OonApiConfig {
113
135
  baseUrl: string;
@@ -117,8 +139,9 @@ interface OonApiConfig {
117
139
  versionPrefix?: string;
118
140
  timeout?: number;
119
141
  }
142
+ type OonAuthMode = "bearer" | "cookie" | "external-sso" | "central-instance" | "central-client";
120
143
  interface OonAuthConfig {
121
- mode?: "bearer" | "cookie" | "external-sso";
144
+ mode?: OonAuthMode;
122
145
  /** URL de login externo (Meus Apps) para redirect quando sem token. */
123
146
  loginUrl?: string;
124
147
  /** Nome do query param que carrega o token na volta do SSO. Default: "code". */
@@ -159,6 +182,7 @@ interface OonRoute {
159
182
  /** rota pública não passa pelo RouteGuard. */
160
183
  public?: boolean;
161
184
  permissions?: string[];
185
+ capabilities?: string[];
162
186
  }
163
187
  interface OonMenuItem {
164
188
  label: string;
@@ -167,6 +191,7 @@ interface OonMenuItem {
167
191
  section?: string;
168
192
  order?: number;
169
193
  permissions?: string[];
194
+ capabilities?: string[];
170
195
  children?: OonMenuItem[];
171
196
  badge?: string | number;
172
197
  external?: boolean;
@@ -219,6 +244,7 @@ interface OonColumnDef {
219
244
  width?: number;
220
245
  renderer?: string;
221
246
  permissions?: string[];
247
+ capabilities?: string[];
222
248
  }
223
249
  interface OonFormFieldDef {
224
250
  field: string;
@@ -230,6 +256,7 @@ interface OonFormFieldDef {
230
256
  ref?: string;
231
257
  renderer?: string;
232
258
  permissions?: string[];
259
+ capabilities?: string[];
233
260
  }
234
261
  /** Definição de uma coleção nas três formas da Seção 4.4. */
235
262
  interface OonActionDef {
@@ -237,8 +264,141 @@ interface OonActionDef {
237
264
  label?: string;
238
265
  renderer?: string;
239
266
  permissions?: string[];
267
+ capabilities?: string[];
240
268
  action?: string;
241
269
  }
270
+ type OonListFilterDef = {
271
+ field: string;
272
+ label?: string;
273
+ type?: "text" | "select" | "date" | "dateRange" | "numberRange" | "boolean" | "ref";
274
+ options?: Array<{
275
+ label: string;
276
+ value: string | number | boolean | null;
277
+ }>;
278
+ defaultValue?: unknown;
279
+ placeholder?: string;
280
+ };
281
+ type OonConditionDef = {
282
+ field: string;
283
+ exists: boolean;
284
+ } | {
285
+ field: string;
286
+ equals: unknown;
287
+ } | {
288
+ field: string;
289
+ notEquals: unknown;
290
+ } | {
291
+ field: string;
292
+ in: unknown[];
293
+ } | {
294
+ field: string;
295
+ gt: number;
296
+ } | {
297
+ field: string;
298
+ gte: number;
299
+ } | {
300
+ field: string;
301
+ lt: number;
302
+ } | {
303
+ field: string;
304
+ lte: number;
305
+ };
306
+ type OonRowActionDef = {
307
+ id?: string;
308
+ label: string;
309
+ icon?: string;
310
+ type: "openDetailModal" | "navigate" | "apiAction" | "customAction";
311
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
312
+ endpoint?: string;
313
+ href?: string;
314
+ initialTab?: string;
315
+ confirm?: {
316
+ title?: string;
317
+ description?: string;
318
+ };
319
+ disabledWhen?: OonConditionDef;
320
+ hiddenWhen?: OonConditionDef;
321
+ refresh?: Array<"self" | "parent" | "all" | string>;
322
+ roles?: string[];
323
+ permissions?: string[];
324
+ capabilities?: string[];
325
+ renderer?: string;
326
+ };
327
+ type OonCollectionListConfig = {
328
+ filters?: OonListFilterDef[];
329
+ columns?: Array<string | OonColumnDef>;
330
+ rowActions?: OonRowActionDef[];
331
+ };
332
+ type OonRelationDef = {
333
+ model: string;
334
+ foreignKey: string;
335
+ parentKey?: string;
336
+ label?: string;
337
+ };
338
+ type OonRelatedGridColumnDef = OonColumnDef & {
339
+ editable?: boolean;
340
+ readonly?: boolean;
341
+ format?: "text" | "number" | "currency" | "percent" | "date" | "badge";
342
+ editor?: "string" | "number" | "currency" | "date" | "enum" | "select" | "ref" | "boolean" | "textarea";
343
+ hidden?: boolean;
344
+ roles?: string[];
345
+ required?: boolean;
346
+ display?: "badgeExists" | "badge" | string;
347
+ };
348
+ type OonSummaryCardDef = {
349
+ label: string;
350
+ source?: "field" | "relatedCount" | "relatedSum" | "relatedAvg" | "customMetric";
351
+ field?: string;
352
+ relation?: string | OonRelationDef;
353
+ metric?: string;
354
+ format?: "text" | "number" | "currency" | "percent" | "date" | "badge";
355
+ };
356
+ type OonDetailTabDef = {
357
+ id: string;
358
+ label: string;
359
+ type: "summary";
360
+ cards?: OonSummaryCardDef[];
361
+ } | {
362
+ id: string;
363
+ label: string;
364
+ type: "form";
365
+ groups?: Array<{
366
+ label: string;
367
+ description?: string;
368
+ fields: string[];
369
+ columns?: 1 | 2 | 3 | 4;
370
+ }>;
371
+ fields?: string[];
372
+ } | {
373
+ id: string;
374
+ label: string;
375
+ type: "relatedGrid";
376
+ relation: string | OonRelationDef;
377
+ editable?: boolean;
378
+ editMode?: "inline" | "modal" | "drawer";
379
+ columns?: Array<string | OonRelatedGridColumnDef>;
380
+ rowActions?: OonRowActionDef[];
381
+ } | {
382
+ id: string;
383
+ label: string;
384
+ type: "readonlyGrid";
385
+ relation: string | OonRelationDef;
386
+ columns?: Array<string | OonRelatedGridColumnDef>;
387
+ rowActions?: OonRowActionDef[];
388
+ } | {
389
+ id: string;
390
+ label: string;
391
+ type: "customComponent";
392
+ component: string;
393
+ props?: Record<string, unknown>;
394
+ };
395
+ type OonDetailModalConfig = {
396
+ enabled?: boolean;
397
+ titleField?: string;
398
+ size?: "md" | "lg" | "xl" | "full";
399
+ defaultTab?: string;
400
+ tabs: OonDetailTabDef[];
401
+ };
242
402
  interface CollectionViewDef {
243
403
  type: "collection";
244
404
  /** id de rota/menu; default = model em minúsculas. */
@@ -258,7 +418,11 @@ interface CollectionViewDef {
258
418
  renderer?: string;
259
419
  cardRenderer?: string;
260
420
  actions?: OonActionDef[];
421
+ list?: OonCollectionListConfig;
422
+ relations?: Record<string, OonRelationDef>;
423
+ detailModal?: OonDetailModalConfig;
261
424
  permissions?: string[];
425
+ capabilities?: string[];
262
426
  }
263
427
  interface DocumentViewDef {
264
428
  type: "document";
@@ -271,6 +435,7 @@ interface DocumentViewDef {
271
435
  approval?: boolean;
272
436
  attachments?: boolean;
273
437
  permissions?: string[];
438
+ capabilities?: string[];
274
439
  }
275
440
  interface PipelineViewDef {
276
441
  type: "pipeline";
@@ -289,6 +454,7 @@ interface PipelineViewDef {
289
454
  label: string;
290
455
  }>;
291
456
  permissions?: string[];
457
+ capabilities?: string[];
292
458
  }
293
459
  interface DashboardViewDef {
294
460
  type: "dashboard";
@@ -298,6 +464,8 @@ interface DashboardViewDef {
298
464
  icon?: ReactNode;
299
465
  section?: string;
300
466
  widgets?: DashboardWidgetDef[];
467
+ permissions?: string[];
468
+ capabilities?: string[];
301
469
  }
302
470
  type OonPageLayout = "default" | "content-only" | "portal";
303
471
  interface OonPageDef {
@@ -311,6 +479,7 @@ interface OonPageDef {
311
479
  blocks?: OonBlockDef[];
312
480
  component?: string;
313
481
  permissions?: string[];
482
+ capabilities?: string[];
314
483
  hidden?: boolean;
315
484
  order?: number;
316
485
  }
@@ -319,6 +488,7 @@ interface OonBaseBlockDef {
319
488
  id?: string;
320
489
  title?: string;
321
490
  permissions?: string[];
491
+ capabilities?: string[];
322
492
  hidden?: boolean;
323
493
  }
324
494
  interface OonCustomBlockDef extends OonBaseBlockDef {
@@ -399,6 +569,10 @@ interface CentralUiManifest {
399
569
  metadataUrl?: string;
400
570
  };
401
571
  schemaVersion?: 1 | 2;
572
+ /** Perfil arquitetural: root-central, member-central ou portal-cockpit. */
573
+ appKind?: OonAppKind;
574
+ /** Configuração declarativa de autenticação. Segredos nunca entram aqui. */
575
+ auth?: Pick<OonAuthConfig, "mode" | "loginUrl" | "tokenParam">;
402
576
  layout?: OonLayoutConfig;
403
577
  registry?: OonComponentRegistry;
404
578
  navigation?: OonNavigationConfig;
@@ -409,6 +583,9 @@ interface CentralUiManifest {
409
583
  path?: string;
410
584
  label?: string;
411
585
  section?: string;
586
+ list?: OonCollectionListConfig;
587
+ relations?: Record<string, OonRelationDef>;
588
+ detailModal?: OonDetailModalConfig;
412
589
  }>;
413
590
  pipelines?: Array<{
414
591
  name?: string;
@@ -429,7 +606,7 @@ interface CentralUiManifest {
429
606
  attachments?: boolean;
430
607
  }>;
431
608
  }
432
- /** Dados de runtime que o `central.ui.json` não carrega (vêm do .env). */
609
+ /** Dados de runtime que o `central.ui.json` não carrega (vêm do .env/código). */
433
610
  interface ManifestRuntime {
434
611
  apiBaseUrl: string;
435
612
  meusAppsUrl?: string;
@@ -437,6 +614,14 @@ interface ManifestRuntime {
437
614
  versionPrefix?: string;
438
615
  /** Token local enviado ao backend somente quando o consumidor o configurar. */
439
616
  devToken?: string;
617
+ /** Registry de componentes React, registrado em código TypeScript. */
618
+ registry?: OonComponentRegistry;
619
+ /** Atalho para registrar páginas/componentes custom sem reescrever o frontend. */
620
+ customComponents?: OonComponentRegistry["pageComponents"];
621
+ /** Overrides de autenticação vindos do runtime/env. */
622
+ auth?: Partial<OonAuthConfig>;
623
+ /** Override do perfil arquitetural da aplicação. */
624
+ appKind?: OonAppKind;
440
625
  }
441
626
  /** Converte o manifesto declarativo + runtime em config do Core. */
442
627
  declare function manifestToConfig(manifest: CentralUiManifest, runtime: ManifestRuntime): OonCoreFrontConfig;
@@ -470,8 +655,11 @@ interface CoreCollectionProps {
470
655
  columns?: OonColumnDef[];
471
656
  form?: OonFormFieldDef[];
472
657
  importExport?: boolean;
658
+ list?: OonCollectionListConfig;
659
+ relations?: Record<string, OonRelationDef>;
660
+ detailModal?: OonDetailModalConfig;
473
661
  }
474
- declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport }: CoreCollectionProps): react.JSX.Element;
662
+ declare function CoreCollection({ model, label, section, mode, endpoint, columns, form, importExport, list, relations, detailModal }: CoreCollectionProps): react.JSX.Element;
475
663
 
476
664
  interface CoreDocumentProps {
477
665
  model: string;
@@ -607,6 +795,7 @@ type AuthStatus = "loading" | "authenticated" | "unauthenticated" | "forbidden"
607
795
  interface AuthContextValue {
608
796
  user: OonUser | null;
609
797
  roles: string[];
798
+ capabilities: string[];
610
799
  status: AuthStatus;
611
800
  isAuthenticated: boolean;
612
801
  hasPermission: (permission?: string | string[]) => boolean;
@@ -686,4 +875,4 @@ declare function useCoreMetadata(): _tanstack_react_query.UseQueryResult<NoInfer
686
875
  /** Descrição de uma model específica — base do modo "dynamic". */
687
876
  declare function useModelSchema(name: string): _tanstack_react_query.UseQueryResult<NoInfer<ModelSummary>, Error>;
688
877
 
689
- export { type CentralUiManifest, type CollectionMode, type CollectionViewDef, CoreActions, CoreAssistant, CoreCards, CoreCollection, CoreCurrency, CoreDashboard, CoreDataGrid, CoreDocument, CoreEmptyState, CoreField, CoreForm, CoreIntegration, CoreLoadingState, type CoreMetadata, CorePage, CorePageHeader, CorePipeline, CoreRelationField, CoreToolbar, type DashboardViewDef, type DashboardWidgetDef, type DocumentViewDef, type FieldKind, type FieldMeta, type ListParams, type ManifestRuntime, type ModelSummary, type OonActionDef, type OonApiConfig, type OonAppConfig, type OonAuthConfig, type OonBlockDef, type OonColumnDef, type OonComponentRegistry, type OonCoreFrontConfig, type OonError, type OonFormFieldDef, type OonLayoutConfig, type OonMenuItem, type OonModule, type OonNavigationConfig, type OonNavigationMode, type OonPageDef, type OonRoute, type OonSchemaVersion, type OonSecurityConfig, type OonUiManifest, type OonUser, type OonViewDefinition, type PaginatedResult, type Pagination, PermissionGate, type PipelineViewDef, defineCollectionView, defineDashboard, defineDocumentView, defineOonModule, definePipelineView, manifestToConfig, oonCoreFront, start, startFromManifest, useCoreMetadata, useModelSchema, useOonApi, useOonAuth, useOonResource };
878
+ export { type CentralUiManifest, type CollectionMode, type CollectionViewDef, CoreActions, CoreAssistant, CoreCards, CoreCollection, CoreCurrency, CoreDashboard, CoreDataGrid, CoreDocument, CoreEmptyState, CoreField, CoreForm, CoreIntegration, CoreLoadingState, type CoreMetadata, CorePage, CorePageHeader, CorePipeline, CoreRelationField, CoreToolbar, type DashboardViewDef, type DashboardWidgetDef, type DocumentViewDef, type FieldKind, type FieldMeta, type ListParams, type ManifestRuntime, type ModelSummary, type OonActionDef, type OonApiConfig, type OonAppConfig, type OonAppKind, type OonAuthConfig, type OonAuthMode, type OonBlockDef, type OonColumnDef, type OonComponentRegistry, type OonCoreFrontConfig, type OonError, type OonFormFieldDef, type OonLayoutConfig, type OonMenuItem, type OonModule, type OonNavigationConfig, type OonNavigationMode, type OonPageDef, type OonRoute, type OonSchemaVersion, type OonSecurityConfig, type OonUiManifest, type OonUser, type OonViewDefinition, type PaginatedResult, type Pagination, PermissionGate, type PipelineViewDef, defineCollectionView, defineDashboard, defineDocumentView, defineOonModule, definePipelineView, manifestToConfig, oonCoreFront, start, startFromManifest, useCoreMetadata, useModelSchema, useOonApi, useOonAuth, useOonResource };