@oondemand/oon-core-front 0.3.7 → 0.3.9

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
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
  import * as _tanstack_react_query from '@tanstack/react-query';
4
4
  import { AxiosInstance } from 'axios';
5
5
 
@@ -40,6 +40,12 @@ interface MenuMeta {
40
40
  section?: string;
41
41
  order?: number;
42
42
  permissions?: string[];
43
+ children?: OonMenuItem[];
44
+ badge?: string | number;
45
+ external?: boolean;
46
+ hidden?: boolean;
47
+ action?: string;
48
+ renderer?: string;
43
49
  }
44
50
  /** Resposta completa de GET /core/metadata. */
45
51
  interface CoreMetadata {
@@ -141,6 +147,8 @@ interface OonCoreFrontConfig {
141
147
  * registrar coleções/documentos/esteiras sem escrever um módulo inteiro.
142
148
  */
143
149
  ui?: OonUiManifest;
150
+ layout?: OonLayoutConfig;
151
+ registry?: OonComponentRegistry;
144
152
  security?: OonSecurityConfig;
145
153
  /** Elemento DOM onde montar. Default: #root. */
146
154
  rootElementId?: string;
@@ -159,6 +167,38 @@ interface OonMenuItem {
159
167
  section?: string;
160
168
  order?: number;
161
169
  permissions?: string[];
170
+ children?: OonMenuItem[];
171
+ badge?: string | number;
172
+ external?: boolean;
173
+ hidden?: boolean;
174
+ action?: string;
175
+ renderer?: string;
176
+ }
177
+ type OonSchemaVersion = 1 | 2;
178
+ type OonSlotConfig = "core" | "none" | `custom:${string}`;
179
+ interface OonLayoutConfig {
180
+ shell?: "default" | "portal" | "content-only" | `custom:${string}`;
181
+ sidebar?: OonSlotConfig;
182
+ topbar?: OonSlotConfig;
183
+ header?: "none" | `custom:${string}`;
184
+ footer?: "core" | "none" | `custom:${string}`;
185
+ assistant?: "core" | "none" | `custom:${string}`;
186
+ main?: "core";
187
+ }
188
+ type OonRendererComponent<TProps = Record<string, unknown>> = ComponentType<TProps>;
189
+ interface OonComponentRegistry {
190
+ layoutSlots?: Record<string, OonRendererComponent<any>>;
191
+ fieldRenderers?: Record<string, OonRendererComponent<any>>;
192
+ cellRenderers?: Record<string, OonRendererComponent<any>>;
193
+ cardRenderers?: Record<string, OonRendererComponent<any>>;
194
+ actionRenderers?: Record<string, OonRendererComponent<any>>;
195
+ pageComponents?: Record<string, OonRendererComponent<any>>;
196
+ menuRenderers?: Record<string, OonRendererComponent<any>>;
197
+ }
198
+ type OonNavigationMode = "auto" | "manual" | "mixed";
199
+ interface OonNavigationConfig {
200
+ mode?: OonNavigationMode;
201
+ items?: OonMenuItem[];
162
202
  }
163
203
  interface OonModule {
164
204
  id: string;
@@ -177,6 +217,8 @@ interface OonColumnDef {
177
217
  kind?: FieldKind;
178
218
  sortable?: boolean;
179
219
  width?: number;
220
+ renderer?: string;
221
+ permissions?: string[];
180
222
  }
181
223
  interface OonFormFieldDef {
182
224
  field: string;
@@ -186,8 +228,17 @@ interface OonFormFieldDef {
186
228
  options?: string[];
187
229
  /** model relacionada quando kind === "ref". */
188
230
  ref?: string;
231
+ renderer?: string;
232
+ permissions?: string[];
189
233
  }
190
234
  /** Definição de uma coleção nas três formas da Seção 4.4. */
235
+ interface OonActionDef {
236
+ id: string;
237
+ label?: string;
238
+ renderer?: string;
239
+ permissions?: string[];
240
+ action?: string;
241
+ }
191
242
  interface CollectionViewDef {
192
243
  type: "collection";
193
244
  /** id de rota/menu; default = model em minúsculas. */
@@ -204,6 +255,9 @@ interface CollectionViewDef {
204
255
  /** modo "full": campos de formulário explícitos. */
205
256
  form?: OonFormFieldDef[];
206
257
  importExport?: boolean;
258
+ renderer?: string;
259
+ cardRenderer?: string;
260
+ actions?: OonActionDef[];
207
261
  permissions?: string[];
208
262
  }
209
263
  interface DocumentViewDef {
@@ -245,6 +299,59 @@ interface DashboardViewDef {
245
299
  section?: string;
246
300
  widgets?: DashboardWidgetDef[];
247
301
  }
302
+ type OonPageLayout = "default" | "content-only" | "portal";
303
+ interface OonPageDef {
304
+ id?: string;
305
+ path: string;
306
+ label?: string;
307
+ title?: string;
308
+ section?: string;
309
+ icon?: ReactNode;
310
+ layout?: OonPageLayout;
311
+ blocks?: OonBlockDef[];
312
+ component?: string;
313
+ permissions?: string[];
314
+ hidden?: boolean;
315
+ order?: number;
316
+ }
317
+ type OonBlockDef = OonCustomBlockDef | OonCollectionDataGridBlockDef | OonCollectionCardsBlockDef | OonSectionBlockDef | OonMarkdownBlockDef | OonGenericBlockDef;
318
+ interface OonBaseBlockDef {
319
+ id?: string;
320
+ title?: string;
321
+ permissions?: string[];
322
+ hidden?: boolean;
323
+ }
324
+ interface OonCustomBlockDef extends OonBaseBlockDef {
325
+ type: "custom";
326
+ component: string;
327
+ props?: Record<string, unknown>;
328
+ }
329
+ interface OonCollectionDataGridBlockDef extends OonBaseBlockDef {
330
+ type: "collection.datagrid";
331
+ model: string;
332
+ mode?: CollectionMode;
333
+ renderer?: string;
334
+ columns?: OonColumnDef[];
335
+ form?: OonFormFieldDef[];
336
+ }
337
+ interface OonCollectionCardsBlockDef extends OonBaseBlockDef {
338
+ type: "collection.cards";
339
+ model: string;
340
+ renderer?: string;
341
+ }
342
+ interface OonSectionBlockDef extends OonBaseBlockDef {
343
+ type: "section";
344
+ description?: string;
345
+ blocks?: OonBlockDef[];
346
+ }
347
+ interface OonMarkdownBlockDef extends OonBaseBlockDef {
348
+ type: "markdown";
349
+ content: string;
350
+ }
351
+ interface OonGenericBlockDef extends OonBaseBlockDef {
352
+ type: "collection.form" | "pipeline.board" | "document.viewer" | "dashboard.kpi" | "tabs";
353
+ [key: string]: unknown;
354
+ }
248
355
  interface DashboardWidgetDef {
249
356
  id: string;
250
357
  label: string;
@@ -257,7 +364,13 @@ interface DashboardWidgetDef {
257
364
  }
258
365
  type OonViewDefinition = CollectionViewDef | DocumentViewDef | PipelineViewDef | DashboardViewDef;
259
366
  interface OonUiManifest {
367
+ schemaVersion?: OonSchemaVersion;
368
+ layout?: OonLayoutConfig;
369
+ registry?: OonComponentRegistry;
370
+ navigation?: OonNavigationConfig;
260
371
  views: OonViewDefinition[];
372
+ pages?: OonPageDef[];
373
+ blocks?: OonBlockDef[];
261
374
  }
262
375
 
263
376
  /**
@@ -285,9 +398,11 @@ interface CentralUiManifest {
285
398
  backend?: {
286
399
  metadataUrl?: string;
287
400
  };
288
- navigation?: {
289
- mode?: "auto" | "manual";
290
- };
401
+ schemaVersion?: 1 | 2;
402
+ layout?: OonLayoutConfig;
403
+ registry?: OonComponentRegistry;
404
+ navigation?: OonNavigationConfig;
405
+ pages?: OonPageDef[];
291
406
  collections?: Array<{
292
407
  model: string;
293
408
  mode?: CollectionMode;
@@ -442,6 +557,52 @@ interface CoreDashboardProps {
442
557
  */
443
558
  declare function CoreDashboard({ label, widgets }: CoreDashboardProps): react.JSX.Element;
444
559
 
560
+ declare function CorePage({ page, registry }: {
561
+ page: OonPageDef;
562
+ registry?: OonComponentRegistry;
563
+ }): react.JSX.Element;
564
+
565
+ declare function CorePageHeader({ title, description, actions }: {
566
+ title?: string;
567
+ description?: string;
568
+ actions?: ReactNode;
569
+ }): react.JSX.Element;
570
+ declare function CoreToolbar({ children }: {
571
+ children?: ReactNode;
572
+ }): react.JSX.Element;
573
+ declare function CoreDataGrid(props: {
574
+ model: string;
575
+ mode?: CollectionMode;
576
+ columns?: OonColumnDef[];
577
+ form?: OonFormFieldDef[];
578
+ label?: string;
579
+ }): react.JSX.Element;
580
+ declare function CoreCards(props: {
581
+ model: string;
582
+ renderer?: string;
583
+ }): react.JSX.Element;
584
+ declare function CoreForm(props: {
585
+ children?: ReactNode;
586
+ }): react.JSX.Element;
587
+ declare function CoreField({ label, children }: {
588
+ label?: string;
589
+ children?: ReactNode;
590
+ }): react.JSX.Element;
591
+ declare function CoreRelationField(props: {
592
+ children?: ReactNode;
593
+ }): react.JSX.Element;
594
+ declare function CoreActions({ children }: {
595
+ children?: ReactNode;
596
+ }): react.JSX.Element;
597
+ declare function CoreEmptyState({ title, actionLabel, onAction }: {
598
+ title?: string;
599
+ actionLabel?: string;
600
+ onAction?: () => void;
601
+ }): react.JSX.Element;
602
+ declare function CoreLoadingState({ label }: {
603
+ label?: string;
604
+ }): react.JSX.Element;
605
+
445
606
  type AuthStatus = "loading" | "authenticated" | "unauthenticated" | "forbidden" | "error";
446
607
  interface AuthContextValue {
447
608
  user: OonUser | null;
@@ -525,4 +686,4 @@ declare function useCoreMetadata(): _tanstack_react_query.UseQueryResult<NoInfer
525
686
  /** Descrição de uma model específica — base do modo "dynamic". */
526
687
  declare function useModelSchema(name: string): _tanstack_react_query.UseQueryResult<NoInfer<ModelSummary>, Error>;
527
688
 
528
- export { type CentralUiManifest, type CollectionMode, type CollectionViewDef, CoreAssistant, CoreCollection, CoreCurrency, CoreDashboard, CoreDocument, CoreIntegration, type CoreMetadata, CorePipeline, type DashboardViewDef, type DashboardWidgetDef, type DocumentViewDef, type FieldKind, type FieldMeta, type ListParams, type ManifestRuntime, type ModelSummary, type OonApiConfig, type OonAppConfig, type OonAuthConfig, type OonColumnDef, type OonCoreFrontConfig, type OonError, type OonFormFieldDef, type OonMenuItem, type OonModule, type OonRoute, 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 };
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 };