Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Extends field type system with modern UI controls to match enterprise platform capabilities. Cross-field validation already exists in CrossFieldValidationSchema - added usage examples.

New Field Types

slider - Numeric range with visual feedback

Field.slider({
  min: 0, max: 100, step: 5,
  showValue: true,
  marks: { '0': 'Low', '50': 'Medium', '100': 'High' }
})

qrcode - Multi-format barcode support (QR, EAN13, Code128, UPC-A/E, Code39)

Field.qrcode({
  barcodeFormat: 'qr',
  qrErrorCorrection: 'M',  // L|M|Q|H
  displayValue: true,
  allowScanning: true
})

geolocation - GPS coordinates (alias for existing location type)

Field.geolocation({
  displayMap: true,
  allowGeocoding: true
})

Cross-Field Validation Examples

Added examples/modern-fields/src/event.object.ts demonstrating validation patterns:

validation: [
  {
    type: 'cross_field',
    condition: 'end_date > start_date',
    fields: ['start_date', 'end_date'],
    message: 'End date must be after start date'
  },
  {
    type: 'cross_field',
    condition: 'current_attendees <= max_capacity',
    fields: ['current_attendees', 'max_capacity'],
    message: 'Attendees cannot exceed capacity'
  }
]

Schema Changes

  • FieldType enum: Added slider, qrcode, geolocation
  • FieldSchema: Added config properties (step, showValue, marks, barcodeFormat, qrErrorCorrection, displayValue, allowScanning)
  • Factory helpers: Field.slider(), Field.qrcode(), Field.geolocation()
  • Generated 231 JSON schemas with updated field definitions

Examples

  • examples/modern-fields/src/product.object.ts - Product catalog with barcodes, stock sliders, warehouse geolocation
  • examples/modern-fields/src/event.object.ts - Event management with 6 cross-field validation rules
Original prompt
  1. 字段类型扩展 (优先级: 中等)

// 建议添加更多现代字段类型
type: 'geolocation' // GPS 坐标 {lat, lng, accuracy}
type: 'address' // 结构化地址 (street, city, state, country, zip)
type: 'richtext' // 富文本编辑器 (Quill/TipTap)
type: 'code' // 代码编辑器 (语法高亮)
type: 'color' // 颜色选择器
type: 'rating' // 星级评分 (1-5)
type: 'slider' // 数值滑块
type: 'signature' // 数字签名
type: 'qrcode' // 二维码/条形码
影响: 提升 UI 组件丰富度,竞争力对标 Salesforce

  1. 跨字段验证 (优先级: 高)

// 目前验证规则主要针对单个字段,需要支持跨字段依赖
ValidationSchema.extend({
crossFieldRules: z.array(z.object({
condition: z.string().describe('e.g., "end_date > start_date"'),
errorMessage: z.string(),
})).optional(),
});
影响: 业务逻辑完整性


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Jan 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Ready Ready Preview, Comment Jan 23, 2026 5:53am

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 3 commits January 23, 2026 05:48
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…nused import

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Add modern field types and cross-field validation Add modern field types (slider, qrcode, geolocation) with configuration schemas Jan 23, 2026
Copilot AI requested a review from hotlong January 23, 2026 05:52
@github-actions github-actions bot added documentation Improvements or additions to documentation protocol:data tests size/xl labels Jan 23, 2026
@github-actions
Copy link
Contributor

This PR is very large. Consider breaking it into smaller PRs for easier review.

@hotlong hotlong marked this pull request as ready for review January 23, 2026 06:22
Copilot AI review requested due to automatic review settings January 23, 2026 06:22
@hotlong hotlong merged commit 48eea4a into main Jan 23, 2026
15 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends ObjectStack's field type system with three modern field types (slider, qrcode, geolocation) to enhance UI capabilities and match enterprise platform features. It also adds comprehensive examples demonstrating cross-field validation patterns already supported by the existing schema.

Changes:

  • Added three new field types (slider, qrcode, geolocation) with full configuration schemas and factory helpers
  • Added comprehensive test coverage for new field types
  • Created example objects (Product, Event) demonstrating modern fields and cross-field validation
  • Updated 231+ auto-generated JSON schemas to include new field types
  • Updated documentation to reflect new field types

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/spec/src/data/field.zod.ts Added 3 new field types to FieldType enum, configuration properties for slider/qrcode fields, and factory helpers
packages/spec/src/data/field.test.ts Added comprehensive test coverage for new field types and factory helpers
packages/spec/json-schema/*.json Auto-generated JSON schemas updated to include new field types
examples/modern-fields/src/product.object.ts Example object demonstrating slider, qrcode, and geolocation fields in a product catalog context
examples/modern-fields/src/event.object.ts Example object demonstrating cross-field validation with 6 validation rules (contains critical bug)
examples/modern-fields/README.md Comprehensive documentation for new field types and validation patterns
content/docs/references/*/meta.json Added "root": true to subdirectory meta.json files; removed pages from parent meta.json (contains critical bug)
IMPLEMENTATION_SUMMARY.md Detailed implementation summary and impact assessment

},

// Cross-field validation rules
validation: [
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property name should be validations (plural) to match the ObjectStack schema convention. Based on the existing CRM examples in the codebase (e.g., examples/crm/src/domains/crm/account.object.ts:212), validation rules are defined under the validations property, not validation.

Suggested change
validation: [
validations: [

Copilot uses AI. Check for mistakes.
"pages": [
"data",
"ui",
"system",
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "api" and "client-sdk" pages were removed from the pages array, but these directories still exist in the codebase (content/docs/references/api/ and content/docs/references/client-sdk/). Removing them from the navigation will break documentation accessibility. This change should be reverted, or if these sections are intended to be removed, the actual directories should be deleted as well.

Note: The Chinese version at content/docs/references/meta.cn.json still includes these pages, creating an inconsistency between language versions.

Suggested change
"system",
"system",
"api",
"client-sdk",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data size/xl tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants