Skip to content

Commit 5382e3e

Browse files
committed
Refactor field and chart type definitions for improved clarity and consistency
1 parent 9334a86 commit 5382e3e

File tree

4 files changed

+68
-36
lines changed

4 files changed

+68
-36
lines changed

content/prompts/development/component.prompt.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,17 @@ Responsible for **Input** (Edit Mode) and **Display** (Read Mode) of a specific
2222
}
2323
```
2424
* **Required Types (Ref: `src/data/field.zod.ts`):**
25-
* **Core:** `text`, `textarea`, `email`, `url`, `phone`, `password`
26-
* **Rich Content:** `markdown`, `html`, `richtext`
27-
* **Numbers:** `number`, `currency`, `percent`
28-
* **Date & Time:** `date`, `datetime`, `time`
29-
* **Logic:** `boolean` (Checkbox/Switch)
30-
* **Selection:** `select` (Dropdown/Radio)
31-
* **Relational:** `lookup` (Searchable Ref), `master_detail`
32-
* **Media:** `image` (Upload/Preview), `file`, `avatar`
33-
* **Calculated:** `formula` (Readonly), `summary`, `autonumber`
34-
* **Enhanced:** `location` (Lat/Long Map), `address`, `code` (Monaco), `color` (Picker), `rating` (Stars), `slider` (Range), `signature` (Pad), `qrcode` (Generator).
25+
* **Textual:** `text` (Input), `textarea` (Multi-line), `password`, `email`, `url`, `phone`.
26+
* **Rich Content:** `markdown` (Editor), `html` (WYSIWYG), `code` (Monaco/Ace).
27+
* **Numeric:** `number` (Int/Float), `currency` (Money), `percent` (Progress), `slider` (Range).
28+
* **Selection:**
29+
* `boolean` (Switch/Toggle), `checkboxes` (Group).
30+
* `select` (Dropdown), `multiselect` (Tags), `radio` (Cards).
31+
* **Date & Time:** `date` (Picker), `datetime`, `time`, `duration`.
32+
* **Relational:** `lookup` (Modal/Combobox), `master_detail` (Inline), `tree` (Hierarchy).
33+
* **Media:** `image` (Upload/Gallery), `file` (Drag&Drop), `video` (Player), `audio`, `avatar`.
34+
* **Visual:** `color` (Picker), `rating` (Star), `signature` (Canvas), `qrcode`, `progress`.
35+
* **Structure:** `json` (Object Editor), `address` (Street/City/State), `location` (Map Pin).
3536
3637
### B. List View Layouts (`view.list.*`)
3738
Responsible for rendering a collection of records.
@@ -45,7 +46,11 @@ Responsible for rendering a collection of records.
4546
onSelectionChange?: (selectedIds: string[]) => void;
4647
}
4748
```
48-
* **Required Types:** `grid` (DataGrid), `kanban` (Drag & Drop), `calendar` (Events), `gantt` (Timeline), `map` (Markers).
49+
* **Required Types (Ref: `src/ui/view.zod.ts`):**
50+
* **Data:** `grid` (Standard Table), `spreadsheet` (Editable Cell).
51+
* **Cards:** `gallery` (Image Deck), `kanban` (Status Board).
52+
* **Time:** `calendar` (Schedule), `gantt` (Project), `timeline` (Activity Stream).
53+
* **Geo:** `map` (Cluster/Markers).
4954
5055
### C. Form View Layouts (`view.form.*`)
5156
Responsible for rendering a single record detail.
@@ -59,7 +64,9 @@ Responsible for rendering a single record detail.
5964
onChange?: (field: string, value: any) => void;
6065
}
6166
```
62-
* **Required Types:** `simple` (Sections), `tabbed` (Tabs), `wizard` (Steps).
67+
* **Required Types:**
68+
* `simple` (Vertical Flow), `tabbed` (Categorized), `wizard` (Step-by-Step).
69+
* `split` (Master-Detail), `drawer` (Side Panel), `modal` (Dialog).
6370
6471
### D. Dashboard Widgets (`widget.*`)
6572
Standalone cards placed on a dashboard grid.
@@ -73,8 +80,10 @@ Standalone cards placed on a dashboard grid.
7380
}
7481
```
7582
* **Required Types (Ref: `src/ui/dashboard.zod.ts`):**
76-
* **Charts:** `metric` (KPI), `bar`, `line`, `pie`, `donut`, `funnel`.
77-
* **Content:** `table` (Data List), `text` (Rich Text/Markdown).
83+
* **KPI:** `metric` (Big Number with Trend).
84+
* **Charts:** `bar`, `line`, `pie`, `funnel`, `radar`, `scatter`, `heatmap`.
85+
* **Analysis:** `pivot` (Cross-Tab Table).
86+
* **Content:** `table` (List), `text` (Note), `image`, `frame` (Embed).
7887
7988
---
8089

packages/spec/src/data/field.zod.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,30 @@ export const FieldType = z.enum([
1414
// Date & Time
1515
'date', 'datetime', 'time',
1616
// Logic
17-
'boolean',
17+
'boolean', 'toggle', // Toggle is a distinct UI from checkbox
1818
// Selection
19-
'select', // Static options
19+
'select', // Single select dropdown
20+
'multiselect', // Multi select (often tags)
21+
'radio', // Radio group
22+
'checkboxes', // Checkbox group
2023
// Relational
21-
'lookup', 'master_detail', // Dynamic reference to other objects
24+
'lookup', 'master_detail', // Dynamic reference
2225
// Media
23-
'image', 'file', 'avatar',
26+
'image', 'file', 'avatar', 'video', 'audio',
2427
// Calculated / System
2528
'formula', 'summary', 'autonumber',
2629
// Enhanced Types
27-
'location', // GPS coordinates (aka geolocation)
28-
'geolocation', // Alternative name for location field
29-
'address', // Structured address
30-
'code', // Code with syntax highlighting
31-
'color', // Color picker
32-
'rating', // Star rating
33-
'slider', // Numeric slider
34-
'signature', // Digital signature
35-
'qrcode', // QR code / Barcode
30+
'location', // GPS coordinates
31+
'address', // Structured address
32+
'code', // Code editor (JSON/SQL/JS)
33+
'json', // Structured JSON data
34+
'color', // Color picker
35+
'rating', // Star rating
36+
'slider', // Numeric slider
37+
'signature', // Digital signature
38+
'qrcode', // QR code / Barcode
39+
'progress', // Progress bar
40+
'tags', // Simple tag list
3641
]);
3742

3843
export type FieldType = z.infer<typeof FieldType>;

packages/spec/src/ui/dashboard.zod.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,23 @@ import { FilterConditionSchema } from '../data/filter.zod';
55
* Chart Type Enum
66
*/
77
export const ChartType = z.enum([
8-
'metric', // Single big number
9-
'bar', // Bar chart
10-
'line', // Line chart
11-
'pie', // Pie/Donut chart
12-
'donut', // Donut chart
13-
'funnel', // Funnel chart
14-
'table', // Data table
15-
'text' // Rich text / Markdown
8+
// Analysis
9+
'metric', // KPI / Big Number
10+
'bar', // Bar / Column
11+
'line', // Line / Area
12+
'pie', // Pie / Donut
13+
'funnel', // Conversion Funnel
14+
'radar', // Spider / Radar
15+
'scatter', // Scatter Plot
16+
'heatmap', // Heatmap
17+
'pivot', // Pivot Table (Cross-tab)
18+
19+
// Content
20+
'table', // Data Grid
21+
'list', // Simple List
22+
'text', // Markdown / HTML
23+
'image', // Static Image
24+
'frame', // IFrame / Embed
1625
]);
1726

1827
/**

packages/spec/src/ui/view.zod.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,16 @@ export const GanttConfigSchema = z.object({
119119
export const ListViewSchema = z.object({
120120
name: SnakeCaseIdentifierSchema.optional().describe('Internal view name (lowercase snake_case)'),
121121
label: z.string().optional(), // Display label override
122-
type: z.enum(['grid', 'kanban', 'calendar', 'gantt', 'map']).default('grid'),
122+
type: z.enum([
123+
'grid', // Standard Data Table
124+
'spreadsheet',// Excel-like Editable Grid
125+
'kanban', // Board / Columns
126+
'gallery', // Card Deck / Masonry
127+
'calendar', // Monthly/Weekly/Daily
128+
'timeline', // Chronological Stream (Feed)
129+
'gantt', // Project Timeline
130+
'map' // Geospatial
131+
]).default('grid'),
123132

124133
/** Data Source Configuration */
125134
data: ViewDataSchema.optional().describe('Data source configuration (defaults to "object" provider)'),

0 commit comments

Comments
 (0)