Skip to content

[P0] Gallery/Timeline Spec Config 标准化接入 #757

@hotlong

Description

@hotlong

背景

Parent Issue: #736

Spec 定义了 GalleryConfigSchemaTimelineConfigSchema,但 ObjectUI 的 Gallery/Timeline 视图仍使用 legacy options.gallery / options.timeline 格式。

目标

  • Gallery 支持 Spec gallery config:coverField, coverFit, cardSize, titleField, visibleFields
  • Timeline 支持 Spec timeline config:startDateField, endDateField, titleField, groupByField, colorField, scale
  • 保持向后兼容:legacy options.* 仍可用作 fallback

技术要点

  • packages/types/src/objectql.ts — ListViewSchema 已有 gallery?: anytimeline?: any,需改为强类型
  • packages/plugin-list/src/ListView.tsx — 视图组件 schema 构建需优先读取 spec config,fallback 到 options
  • packages/react/src/spec-bridge/bridges/list-view.ts — bridge 已传递,需映射到实际 props

改动范围

  • packages/types/src/objectql.ts — 定义 GalleryConfig / TimelineConfig 强类型 interface
  • packages/plugin-list/src/ListView.tsx — Gallery/Timeline schema 构建优先使用 spec config
  • packages/plugin-gallery/src/ObjectGallery.tsx — 接受新的 prop 命名
  • packages/plugin-timeline/src/ObjectTimeline.tsx — 接受新的 prop 命名

验收标准

  • schema.gallery.coverField 驱动 Gallery 封面图
  • schema.gallery.cardSize 控制卡片尺寸(small/medium/large)
  • schema.timeline.scale 控制时间轴刻度(day/week/month/quarter/year)
  • Legacy options.gallery / options.timeline 仍向后兼容
  • 所有新增代码有对应单元测试
  • pnpm test 全部通过

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions