Principle:AFK surf Open agent Typed Property Definition
| Knowledge Sources | |
|---|---|
| Domains | Database, Data_View, BlockSuite |
| Last Updated | 2026-10-25 00:00 GMT |
Overview
Pattern of adding typed columns to a data source from a preset config, where each property type drives cell rendering, filter matching, and group-by behavior.
Description
A database column is defined by a type string (drawn from a property config) and a display name. BlockSuite ships a barrel of propertyPresets (multi-select, date, number, checkbox, progress, select, image, text) plus database-block-specific configs (databaseBlockProperties.richTextColumnConfig, databaseBlockProperties.linkColumnConfig). Each config exposes a .type and a .config (with the default name and rendering/filter/group-by metadata). Columns are appended via datasource.propertyAdd(position, { type, name }). The chosen type determines the cell renderer, the filter functions, the group-by strategy, and the type-system instance used by the data-view type unification.
Usage
Apply this principle whenever you define columns for a data-view table/kanban. Iterate over preset configs to add a standard set, or add a single column for a targeted use case. Always go through propertyAdd so the data source's reactivity and the type system stay consistent.
Theoretical Basis
A property is a typed slot: Property = (type, name, data). The type selects a PropertyMetaConfig from a registry, which carries the cell renderer, filter matcher, and group-by strategy. The data-view type system (TypeInstance + unification) uses the property's TypeInstance to validate filter/group-by compatibility.
Pseudo-code:
Object.values([
propertyPresets.multiSelectPropertyConfig,
propertyPresets.datePropertyConfig,
propertyPresets.numberPropertyConfig,
]).forEach(column => {
datasource.propertyAdd('end', { type: column.type, name: column.config.name });
});