fix: comprehensive view component spec UI protocol compliance audit#832
fix: comprehensive view component spec UI protocol compliance audit#832
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add 'gallery' and 'gantt' to ViewType in views.ts - Add 'gallery' and 'gantt' to ViewTypeSchema in views.zod.ts - Sync DetailViewFieldSchema type enum with TS interface (add data-oriented types) - Add missing options, reference_to, reference_field, currency fields to DetailViewFieldSchema - Add missing showBorder, headerColor fields to DetailViewSectionSchema - Add gallery and gantt icons/labels to plugin-view ViewSwitcher Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 检查所有的问题,包括每一个控件的细节 |
…nputs with spec - plugin-list: Remove invalid 'list'/'chart' types from viewType enum, add 'gallery'/'timeline'/'gantt'/'map' to match spec ListView type values - plugin-detail: Add missing detail-view inputs (layout, columns, loading, backUrl, editUrl, deleteConfirmation, header, footer) - plugin-detail: Add showBorder and headerColor to detail-section inputs Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Deep audit completed in plugin-list/index.tsx — plugin-detail/index.tsx — plugin-detail/index.tsx — All 2015 tests pass (898 view-related + 1117 compliance). |
There was a problem hiding this comment.
Pull request overview
This PR comprehensively audits and fixes spec UI protocol compliance for view-related components across the ObjectUI codebase. The changes synchronize ViewType enums, Zod validators, TypeScript interfaces, and component registrations to align with the @objectstack/spec ListView type definitions and ensure internal consistency.
Changes:
- Extended ViewType enum with missing
'gallery'and'gantt'view types to match spec ListView type enum - Synchronized DetailViewFieldSchema Zod validator with TS interface by adding 11 data-oriented field types and 4 missing properties
- Enhanced DetailViewSectionSchema with
showBorderandheaderColorproperties in both Zod and component registrations - Updated ViewSwitcher default labels and icons for gallery (Images) and gantt (GanttChartSquare) views
- Fixed component registration enum values in plugin-list to remove invalid types (
'list','chart') and add spec-compliant types - Added 8 missing inputs to detail-view component registration (
layout,columns,loading,backUrl,editUrl,deleteConfirmation,header,footer)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/views.ts | Added 'gallery' and 'gantt' to ViewType enum to complete spec ListView type coverage |
| packages/types/src/zod/views.zod.ts | Added missing field types and properties to DetailViewFieldSchema and DetailViewSectionSchema Zod validators |
| packages/plugin-view/src/ViewSwitcher.tsx | Added gallery and gantt view labels/icons with proper Lucide icon imports (Images, GanttChartSquare) |
| packages/plugin-list/src/index.tsx | Fixed viewType enum in list-view and list registrations to match spec (removed 'list'/'chart', added 'gallery'/'timeline'/'gantt'/'map') |
| packages/plugin-detail/src/index.tsx | Added 8 missing inputs to detail-view registration and 2 to detail-section registration to match schema definitions |
| ROADMAP.md | Documented all compliance fixes with checkboxes marking completed items |
| { name: 'resourceId', type: 'string', label: 'Resource ID' }, | ||
| { name: 'api', type: 'string', label: 'API Endpoint' }, | ||
| { name: 'data', type: 'object', label: 'Data' }, | ||
| { name: 'layout', type: 'enum', label: 'Layout Mode', enum: ['vertical', 'horizontal', 'grid'] }, |
There was a problem hiding this comment.
The enum format for the 'layout' input is inconsistent with other enum inputs in the codebase. It uses a plain string array ['vertical', 'horizontal', 'grid'] instead of an object array with label/value pairs like other enum inputs (e.g., the 'viewType' enum in plugin-list uses [{ label: 'Grid', value: 'grid' }, ...]). For consistency and better UX in component editors, this should use the object array format: enum: [{ label: 'Vertical', value: 'vertical' }, { label: 'Horizontal', value: 'horizontal' }, { label: 'Grid', value: 'grid' }].
| { name: 'layout', type: 'enum', label: 'Layout Mode', enum: ['vertical', 'horizontal', 'grid'] }, | |
| { | |
| name: 'layout', | |
| type: 'enum', | |
| label: 'Layout Mode', | |
| enum: [ | |
| { label: 'Vertical', value: 'vertical' }, | |
| { label: 'Horizontal', value: 'horizontal' }, | |
| { label: 'Grid', value: 'grid' }, | |
| ], | |
| }, |
ViewType, view-related Zod validators, and component registrations were out of sync with the@objectstack/spec/uiListView type enum and their own TS interfaces.ViewType enum
Spec defines ListView
typeasgrid | kanban | gallery | calendar | timeline | gantt | map. ObjectUI'sViewTypewas missinggalleryandgantt.Zod ↔ TS interface drift in
views.zod.tsDetailViewFieldSchema.type— Zod had 10 values, TS interface had 21. Added missing data-oriented types:number,currency,percent,boolean,select,lookup,master_detail,email,url,phone,userDetailViewFieldSchema— Missing properties:options,reference_to,reference_field,currencyDetailViewSectionSchema— Missing properties:showBorder,headerColorplugin-view ViewSwitcher
Added
gallery(Imagesicon) andgantt(GanttChartSquareicon) toDEFAULT_VIEW_LABELSandDEFAULT_VIEW_ICONSmaps.plugin-list component registrations
The
list-viewandlistcomponent registrations had invalidviewTypeenum values ('list'and'chart'are not valid spec types) and were missing'gallery','timeline','gantt', and'map'. Fixed to match spec'sgrid | kanban | gallery | calendar | timeline | gantt | map.plugin-detail component registrations
detail-viewregistration was missing 8 inputs that exist onDetailViewSchema:layout,columns,loading,backUrl,editUrl,deleteConfirmation,header,footer.detail-sectionregistration was missingshowBorderandheaderColorinputs that are already implemented in theDetailSection.tsxcomponent and TS interface.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.