object-fields
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSteedos Object Fields | Steedos 对象字段
Steedos 对象字段
Overview | 概述
概述
Fields define how data is stored, validated, and displayed. Each field is defined as a separate file in the object's subfolder.
.field.ymlfields/字段定义数据的存储、验证和显示方式。每个字段作为独立的 文件定义在对象的 子文件夹中。
.field.ymlfields/字段定义数据的存储、验证和显示方式。每个字段作为独立的 文件定义在对象的 子文件夹中。
.field.ymlfields/File Location | 文件位置
文件位置
steedos-packages/
└── my-package/
└── main/default/
└── objects/
└── orders/
└── fields/
├── order_number.field.yml
├── customer.field.yml
├── status.field.yml
├── total_amount.field.yml
└── shipping_address.field.ymlsteedos-packages/
└── my-package/
└── main/default/
└── objects/
└── orders/
└── fields/
├── order_number.field.yml
├── customer.field.yml
├── status.field.yml
├── total_amount.field.yml
└── shipping_address.field.ymlField Structure | 字段结构
字段结构
yaml
undefinedyaml
undefinedobjects/orders/fields/customer.field.yml
objects/orders/fields/customer.field.yml
name: customer
type: lookup
label: 客户
reference_to: customers
required: true
index: true
searchable: true
filterable: true
sortable: true
sort_no: 200
group: Basic Information
undefinedname: customer
type: lookup
label: 客户
reference_to: customers
required: true
index: true
searchable: true
filterable: true
sortable: true
sort_no: 200
group: Basic Information
undefinedCommon Properties | 通用属性
通用属性
| Property | Type | Description |
|---|---|---|
| string | Field API name (required) |
| string | Field type (required, see Valid Field Types below) |
| string | Display label — use the language of the user's prompt (required) |
| boolean | Is required |
| boolean | Read-only |
| boolean | Hide from all UI |
| boolean | Omit from forms |
| boolean | Disable editing |
| any | Default value |
| string | Field group name |
| number | Display order |
| boolean | Mark as the object's display name field (see below) |
| boolean | Full width in forms |
| boolean | Create database index |
| boolean | Unique constraint |
| boolean | Include in global search |
| boolean | Available in filters |
| boolean | Sortable in list views |
| string | Backend data type |
| string | Amis formula for conditional visibility |
| string | Tooltip help text |
| 属性 | 类型 | 描述 |
|---|---|---|
| string | 字段API名称(必填) |
| string | 字段类型(必填,详见下方有效字段类型) |
| string | 显示标签——使用用户界面的语言(必填) |
| boolean | 是否必填 |
| boolean | 是否只读 |
| boolean | 是否在所有UI中隐藏 |
| boolean | 是否在表单中省略 |
| boolean | 是否禁用编辑 |
| any | 默认值 |
| string | 字段分组名称 |
| number | 显示顺序 |
| boolean | 标记为对象的显示名称字段(详见下文) |
| boolean | 在表单中占满宽度 |
| boolean | 是否创建数据库索引 |
| boolean | 是否唯一约束 |
| boolean | 是否纳入全局搜索 |
| boolean | 是否可用于筛选 |
| boolean | 是否可在列表视图中排序 |
| string | 后端数据类型 |
| string | 控制条件可见性的Amis公式 |
| string | 提示框帮助文本 |
Name Field (is_name
) | 名称字段
is_name名称字段(is_name
)
is_nameEvery object must have a name field — the human-readable identifier shown in lookups, related lists, and record titles. The system determines the name field by:
每个对象必须有一个名称字段——在查找、相关列表和记录标题中显示的人类可读标识。系统按以下优先级确定名称字段:
- A field with (highest priority)
is_name: true - A field named (fallback)
name
Use when the display name is not a simple text field:
is_name: truename当显示名称不是简单的 文本字段时,使用 :
nameis_name: trueyaml
undefined每个对象必须有一个名称字段——在查找、相关列表和记录标题中显示的人类可读标识。系统按以下优先级确定名称字段:
- 设置了的字段(优先级最高)
is_name: true - 名为的字段(备选)
name
当显示名称不是简单的文本字段时,使用:
nameis_name: trueyaml
undefinedautonumber as name field
自动编号作为名称字段
name: order_number
type: autonumber
label: Order Number
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
is_name: true
readonly: true
name: order_number
type: autonumber
label: Order Number
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
is_name: true
readonly: true
lookup as name field
查找字段作为名称字段
name: permission_set
type: master_detail
label: Permission Set
reference_to: permission_set
required: true
is_name: true
name: permission_set
type: master_detail
label: Permission Set
reference_to: permission_set
required: true
is_name: true
simple text name field (is_name not needed)
简单文本名称字段(无需设置is_name)
name: name
type: text
label: Product Name
required: true
searchable: true
undefinedname: name
type: text
label: Product Name
required: true
searchable: true
undefinedValid Field Types | 有效字段类型
有效字段类型
⚠️ CRITICAL: The property MUST be one of the values listed below. NEVER invent field types. Any value NOT in this list will cause an error.
type⚠️ 重要: 属性必须为下表中的值之一,严禁自行编造字段类型。不在此列表中的值会导致错误。
type| Type | Description |
|---|---|
| Short text |
| Long text (multiline) |
| Rich text (HTML editor) |
| Single or multiple choice (with |
| True/false |
| Toggle switch (same as boolean, different UI) |
| Date only |
| Date and time |
| Time only |
| Integer or decimal |
| Money amount |
| Percentage |
| Auto-generated sequential number |
| Reference to another object (many-to-one) |
| Parent-child reference (cascade delete) |
| Inline table (array of objects) |
| URL |
| Email address |
| Image upload |
| File upload |
| Code editor |
| Markdown editor |
| Color picker |
| Geographic location |
| JSON object |
| Computed formula field |
| Roll-up summary field |
| Password (masked) |
⚠️ 重要:属性必须为下表中的值之一,严禁自行编造字段类型。不在此列表中的值会导致错误。
type| 类型 | 描述 |
|---|---|
| 短文本 |
| 长文本(多行) |
| 富文本(HTML编辑器) |
| 单选或多选(需配置 |
| 布尔值(是/否) |
| 开关控件(功能同boolean,UI不同) |
| 仅日期 |
| 日期和时间 |
| 仅时间 |
| 整数或小数 |
| 货币金额 |
| 百分比 |
| 自动生成的序列号 |
| 引用其他对象(多对一) |
| 主从引用(级联删除) |
| 内嵌表格(对象数组) |
| 网址 |
| 邮箱地址 |
| 图片上传 |
| 文件上传 |
| 代码编辑器 |
| Markdown编辑器 |
| 颜色选择器 |
| 地理位置 |
| JSON对象 |
| 公式计算字段 |
| 汇总字段 |
| 密码(掩码显示) |
Text Field Types | 文本字段类型
文本字段类型
text (Short Text) | 短文本
text(短文本)
yaml
name: customer_name
type: text
label: Customer Name
required: true
searchable: true
index: trueyaml
name: customer_name
type: text
label: Customer Name
required: true
searchable: true
index: truetextarea (Long Text) | 长文本
textarea(长文本)
yaml
name: description
type: textarea
label: Description
rows: 4
is_wide: trueyaml
name: description
type: textarea
label: Description
rows: 4
is_wide: truehtml (Rich Text) | 富文本
html(富文本)
yaml
name: content
type: html
label: Content
is_wide: trueyaml
name: content
type: html
label: Content
is_wide: trueurl
url
yaml
name: website
type: url
label: Websiteyaml
name: website
type: url
label: Websiteyaml
name: email
type: email
label: Email
unique: true
index: trueyaml
name: email
type: email
label: Email
unique: true
index: trueNumeric Field Types | 数值字段类型
数值字段类型
number
number
yaml
name: quantity
type: number
label: Quantity
scale: 0
min: 0
max: 999999yaml
name: quantity
type: number
label: Quantity
scale: 0
min: 0
max: 999999currency | 货币
currency(货币)
yaml
name: price
type: currency
label: Price
scale: 2
min: 0yaml
name: price
type: currency
label: Price
scale: 2
min: 0percent | 百分比
percent(百分比)
yaml
name: discount_rate
type: percent
label: Discount Rate
scale: 2
min: 0
max: 100yaml
name: discount_rate
type: percent
label: Discount Rate
scale: 2
min: 0
max: 100autonumber | 自动编号
autonumber(自动编号)
yaml
name: order_number
type: autonumber
label: Order Number
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
readonly: trueFormat placeholders: , , , , (sequential with padding)
{YYYY}{YY}{MM}{DD}{0000}yaml
name: order_number
type: autonumber
label: Order Number
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
readonly: true格式占位符:、、、、(带填充的序列号)
{YYYY}{YY}{MM}{DD}{0000}Date and Time Types | 日期时间类型
日期时间类型
date
date
yaml
name: order_date
type: date
label: Order Date
defaultValue: '{now}'yaml
name: order_date
type: date
label: Order Date
defaultValue: '{now}'datetime
datetime
yaml
name: submitted_at
type: datetime
label: Submitted At
readonly: trueyaml
name: submitted_at
type: datetime
label: Submitted At
readonly: trueBoolean and Selection Types | 布尔和选择类型
布尔和选择类型
boolean
boolean
yaml
name: is_active
type: boolean
label: Is Active
defaultValue: trueyaml
name: is_active
type: boolean
label: Is Active
defaultValue: trueselect (Single) | 单选
select(单选)
yaml
name: status
type: select
label: Status
options:
- label: Draft
value: draft
- label: Submitted
value: submitted
- label: Approved
value: approved
defaultValue: draftyaml
name: status
type: select
label: Status
options:
- label: Draft
value: draft
- label: Submitted
value: submitted
- label: Approved
value: approved
defaultValue: draftselect (Multiple) | 多选
select(多选)
yaml
name: tags
type: select
label: Tags
multiple: true
options:
- label: Technology
value: tech
- label: Sales
value: salesyaml
name: tags
type: select
label: Tags
multiple: true
options:
- label: Technology
value: tech
- label: Sales
value: salesRelationship Fields | 关系字段
关系字段
lookup (Many-to-One) | 查找关系
lookup(多对一)
yaml
name: customer
type: lookup
label: Customer
reference_to: customers
required: true
index: trueyaml
name: customer
type: lookup
label: Customer
reference_to: customers
required: true
index: trueWith filters
带筛选条件
name: contact
type: lookup
label: Contact
reference_to: contacts
filters: [["account", "=", "{$customer}"]]
depend_on:
- customer
name: contact
type: lookup
label: Contact
reference_to: contacts
filters: [["account", "=", "{$customer}"]]
depend_on:
- customer
Multiple selection
多选
name: assigned_users
type: lookup
label: Assigned Users
reference_to: users
multiple: true
Lookup properties:
- `reference_to` — target object API name (required)
- `multiple` — allow selecting multiple records (`true`/`false`)
- `filters` — filter condition for lookup dropdown
- `depend_on` — re-fetch options when these fields change
- `deleted_lookup_record_behavior` — when referenced record is deleted. **⚠️ MUST be `clear` (set to null) or `retain` (keep stale reference). Only these two values are valid.**name: assigned_users
type: lookup
label: Assigned Users
reference_to: users
multiple: true
Lookup属性说明:
- `reference_to` — 目标对象API名称(必填)
- `multiple` — 是否允许选择多条记录(`true`/`false`)
- `filters` — 查找下拉框的筛选条件
- `depend_on` — 当这些字段变化时重新获取选项
- `deleted_lookup_record_behavior` — 当引用记录被删除时的处理方式。**⚠️ 必须设置为`clear`(设为null)或`retain`(保留过期引用),仅这两个值有效。**master_detail (Parent-Child) | 主从关系
master_detail(主从关系)
yaml
name: order
type: master_detail
label: Order
reference_to: orders
required: true
index: trueCascade delete: deleting parent deletes all children.
yaml
name: order
type: master_detail
label: Order
reference_to: orders
required: true
index: true级联删除:删除父记录时会删除所有子记录。
Computed Fields | 计算字段
计算字段
formula | 公式
formula(公式)
yaml
name: total_price
type: formula
label: Total Price
data_type: currency
scale: 2
formula_blank_value: zeroes
formula: !!js/function |
function() {
return (this.quantity || 0) * (this.unit_price || 0);
}data_typetextnumbercurrencypercentbooleandatedatetimeformula_blank_valuezeroesblanksyaml
name: total_price
type: formula
label: Total Price
data_type: currency
scale: 2
formula_blank_value: zeroes
formula: !!js/function |
function() {
return (this.quantity || 0) * (this.unit_price || 0);
}data_typetextnumbercurrencypercentbooleandatedatetimeformula_blank_valuezeroesblankssummary (Rollup) | 汇总
summary(汇总)
yaml
name: total_orders
type: summary
label: Total Orders
summary_object: orders
summary_type: count
summary_field: customer
summary_filters: [["status", "!=", "cancelled"]]⚠️ MUST be one of: , , , , . Do NOT use other values.
summary_typecountsumavgminmaxyaml
name: total_orders
type: summary
label: Total Orders
summary_object: orders
summary_type: count
summary_field: customer
summary_filters: [["status", "!=", "cancelled"]]⚠️ 必须为以下值之一:、、、、,禁止使用其他值。
summary_typecountsumavgminmaxFile and Media Types | 文件和媒体类型
文件和媒体类型
file
file
yaml
name: attachment
type: file
label: Attachment
multiple: trueyaml
name: attachment
type: file
label: Attachment
multiple: trueimage
image
yaml
name: avatar
type: image
label: Avataryaml
name: avatar
type: image
label: AvatarSpecial Types | 特殊类型
特殊类型
code (Code Editor) | 代码编辑器
code(代码编辑器)
yaml
name: custom_script
type: code
label: Script
language: javascript
is_wide: true⚠️ MUST be one of: , , , , , , , , , , , , , , , , , , , , . Do NOT use other values.
languagejavascripttypescriptjsonhtmlcsssqlpythonjavarubygoshellyamlxmlmarkdownphpcsharpcppcswiftluaryaml
name: custom_script
type: code
label: Script
language: javascript
is_wide: true⚠️ 必须为以下值之一:、、、、、、、、、、、、、、、、、、、、,禁止使用其他值。
languagejavascripttypescriptjsonhtmlcsssqlpythonjavarubygoshellyamlxmlmarkdownphpcsharpcppcswiftluarobject (JSON)
object(JSON)
yaml
name: metadata
type: object
label: Metadata
blackbox: true
is_wide: trueyaml
name: metadata
type: object
label: Metadata
blackbox: true
is_wide: truegrid (Table/Array)
grid(表格/数组)
yaml
name: line_items
type: grid
label: Line Items
is_wide: trueyaml
name: line_items
type: grid
label: Line Items
is_wide: trueAmis UI Customization | Amis UI 自定义
Amis UI 自定义
Fields can have custom Amis rendering configuration:
yaml
undefined字段可配置自定义Amis渲染规则:
yaml
undefinedobjects/materials/fields/classification.field.yml
objects/materials/fields/classification.field.yml
name: classification
type: text
label: Classification
amis:
id: 'u:classification'
type: tree-select
label: Classification
multiple: true
clearable: true
source:
url: /graphql
method: post
requestAdaptor: |
api.data = {
query:
}
adaptor: |
const items = payload.data?.hierarchical_picklist_items || [];
return { options: buildTree(items) };
cache: 86400000
onEvent:
change:
weight: 0
actions:
- actionType: setValue
args:
value:
related_field: "${event.data.value}"
{ hierarchical_picklist_items(filters: ["list", "=", "classification"]) { label, value, parent } }undefinedname: classification
type: text
label: Classification
amis:
id: 'u:classification'
type: tree-select
label: Classification
multiple: true
clearable: true
source:
url: /graphql
method: post
requestAdaptor: |
api.data = {
query:
}
adaptor: |
const items = payload.data?.hierarchical_picklist_items || [];
return { options: buildTree(items) };
cache: 86400000
onEvent:
change:
weight: 0
actions:
- actionType: setValue
args:
value:
related_field: "${event.data.value}"
{ hierarchical_picklist_items(filters: ["list", "=", "classification"]) { label, value, parent } }undefinedConditional Visibility | 条件可见性
条件可见性
Use with Amis formula syntax:
visible_onyaml
name: rejection_reason
type: textarea
label: Rejection Reason
visible_on: "{{status == 'rejected'}}"
name: tracking_number
type: text
label: Tracking Number
visible_on: "{{status == 'shipped' || status == 'completed'}}"使用配置Amis公式语法:
visible_onyaml
name: rejection_reason
type: textarea
label: Rejection Reason
visible_on: "{{status == 'rejected'}}"
name: tracking_number
type: text
label: Tracking Number
visible_on: "{{status == 'shipped' || status == 'completed'}}"Default Values | 默认值
默认值
yaml
undefinedyaml
undefinedStatic
静态默认值
defaultValue: 'draft'
defaultValue: 0
defaultValue: true
defaultValue: 'draft'
defaultValue: 0
defaultValue: true
Dynamic
动态默认值
defaultValue: '{now}' # Current date/time
defaultValue: '{userId}' # Current user
defaultValue: '{spaceId}' # Current workspace
undefineddefaultValue: '{now}' # 当前日期/时间
defaultValue: '{userId}' # 当前用户ID
defaultValue: '{spaceId}' # 当前工作区ID
undefinedField Dependencies | 字段依赖
字段依赖
yaml
undefinedyaml
undefinedReload field when dependency changes
当依赖字段变化时重新加载当前字段
name: contact
type: lookup
label: Contact
reference_to: contacts
depend_on:
- customer filters: [["account", "=", "{$customer}"]]
undefinedname: contact
type: lookup
label: Contact
reference_to: contacts
depend_on:
- customer filters: [["account", "=", "{$customer}"]]
undefinedBest Practices | 最佳实践
最佳实践
- Use specific types: not just
currency,numbernot justemailtext - Add indexes: on frequently queried/filtered fields
index: true - Label follows user's language: Write in the language of the user's prompt. For i18n, use the translations skill
label - Use sort_no: Control field display order
- Group fields: Use to organize related fields
group - Set appropriate defaults: Use to reduce user input
defaultValue
- 使用特定类型:优先使用而非
currency,使用number而非emailtext - 添加索引:对频繁查询/筛选的字段设置
index: true - 标签符合用户语言:使用用户界面的语言,如需国际化请使用翻译功能
label - 使用sort_no:控制字段的显示顺序
- 分组字段:使用组织相关字段
group - 设置合适的默认值:使用减少用户输入
defaultValue