Skip to content

Commit 832687f

Browse files
committed
feat: add DashboardSchema, PageRegion, and ListViewSchema interfaces for enhanced layout and view definitions
1 parent 4e77377 commit 832687f

File tree

4 files changed

+93
-4
lines changed

4 files changed

+93
-4
lines changed

packages/types/src/complex.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,35 @@
1717

1818
import type { BaseSchema, SchemaNode } from './base';
1919

20+
/**
21+
* Dashboard Component Schema
22+
* (Report / BI View)
23+
*/
24+
export interface DashboardSchema extends BaseSchema {
25+
type: 'dashboard';
26+
/**
27+
* Layout Grid Configuration (e.g. 12 column grid)
28+
*/
29+
columns?: number;
30+
/**
31+
* Widget gap
32+
*/
33+
gap?: number;
34+
/**
35+
* Dashboard Widgets
36+
*/
37+
widgets: Array<{
38+
/** Unique Widget ID */
39+
id: string;
40+
/** Widget Title */
41+
title?: string;
42+
/** Widget Component (Chart, Statistic, List, etc) */
43+
component: SchemaNode;
44+
/** Grid Position: x, y, w, h */
45+
layout?: { x: number; y: number; w: number; h: number };
46+
}>;
47+
}
48+
2049
/**
2150
* Kanban column
2251
*/
@@ -470,4 +499,5 @@ export type ComplexSchema =
470499
| CalendarViewSchema
471500
| FilterBuilderSchema
472501
| CarouselSchema
473-
| ChatbotSchema;
502+
| ChatbotSchema
503+
| DashboardSchema;

packages/types/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export type {
332332
// Union Types - Discriminated Unions for All Schemas
333333
// ============================================================================
334334

335-
import type { BaseSchema, SchemaNode } from './base';
335+
import type { AnySchema, BaseSchema, SchemaNode } from './base';
336336
import type { LayoutSchema } from './layout';
337337
import type { FormComponentSchema } from './form';
338338
import type { DataDisplaySchema } from './data-display';

packages/types/src/layout.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,32 @@ export interface AspectRatioSchema extends BaseSchema {
424424
children?: SchemaNode | SchemaNode[];
425425
}
426426

427+
/**
428+
* Page Region (Header, Sidebar, Main, etc)
429+
*/
430+
export interface PageRegion {
431+
/**
432+
* Region name/id
433+
*/
434+
name: string;
435+
/**
436+
* Region type
437+
*/
438+
type?: 'header' | 'sidebar' | 'main' | 'footer' | 'aside';
439+
/**
440+
* Width (flex basis)
441+
*/
442+
width?: string;
443+
/**
444+
* Components in this region
445+
*/
446+
components: SchemaNode[];
447+
/**
448+
* CSS class
449+
*/
450+
className?: string;
451+
}
452+
427453
/**
428454
* Page layout component
429455
* Top-level container for a page route
@@ -443,7 +469,12 @@ export interface PageSchema extends BaseSchema {
443469
*/
444470
description?: string;
445471
/**
446-
* Main content array
472+
* Page layout regions
473+
* (Aligned with @objectstack/spec Page.regions)
474+
*/
475+
regions?: PageRegion[];
476+
/**
477+
* Main content array (Legacy/Simple mode)
447478
*/
448479
body?: SchemaNode[];
449480
/**

packages/types/src/objectql.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,33 @@ export interface ObjectViewSchema extends BaseSchema {
674674
className?: string;
675675
}
676676

677+
/**
678+
* Generic View Definition
679+
* Aligned with @objectstack/spec View/ListView
680+
* Defines the data requirement, not just the visual component.
681+
*/
682+
export interface ListViewSchema extends BaseSchema {
683+
type: 'list-view';
684+
685+
/** Object Name */
686+
objectName: string;
687+
688+
/** View Type (grid, kanban, etc) */
689+
viewType?: 'grid' | 'kanban' | 'calendar' | 'gantt' | 'map' | 'chart';
690+
691+
/** Fields to fetch/display */
692+
fields?: string[];
693+
694+
/** Filter conditions */
695+
filters?: Array<any[] | string>; // placeholder for FilterCondition
696+
697+
/** Sort order */
698+
sort?: Array<{ field: string; order: 'asc' | 'desc' }>;
699+
700+
/** Visual Component overrides */
701+
options?: Record<string, any>;
702+
}
703+
677704
/**
678705
* Object Map Component Schema
679706
*/
@@ -766,4 +793,5 @@ export type ObjectQLComponentSchema =
766793
| ObjectGanttSchema
767794
| ObjectCalendarSchema
768795
| ObjectKanbanSchema
769-
| ObjectChartSchema;
796+
| ObjectChartSchema
797+
| ListViewSchema;

0 commit comments

Comments
 (0)