フィールド

フィールドは Base テーブルのスキーマを定義します。各フィールドには、型、設定、デフォルト値のほか、並べ替え、フィルタリング、グループ化、カード表示などの機能があります。

フィールドの種類

用途BaseFieldType
テキストと連絡先Text, Link, Phone, Email
数値と進捗Number, Currency, Progress, Rating
選択肢とメンバーCheckbox, SingleSelect, MultiSelect, Person, Group
日付と添付ファイルDate, Attachment
計算と関連付けFormula, RecordLink
自動生成と監査Numbering, RecordId, CreatedBy, UpdatedBy, CreatedAt, UpdatedAt

選択値には選択肢 ID、メンバー値には業務側の ID を使います。連番と監査フィールドはシステムが管理します。数式とレコードの関連付けも参照してください。

フィールドを追加する

TypeScript
const table = base.getTableById('tasks')if (!table) throw new Error('Tasks table not found')const title = table.addField('Title', univerAPI.Enum.BaseFieldType.Text)const priority = table.addField(  'Priority',  univerAPI.Enum.BaseFieldType.SingleSelect,  {    field: {      config: {        options: [          { id: 'high', name: 'High', color: '#ef4444' },          { id: 'low', name: 'Low', color: '#22c55e' },        ],      },    },  },)

フィールドを更新する

TypeScript
priority.setName('Impact')priority.update({ description: 'Business priority' })priority.setConfig({  options: [    { id: 'p0', name: 'P0', color: '#dc2626' },    { id: 'p1', name: 'P1', color: '#f97316' },  ],})

フィールドの型を変更する

TypeScript
priority.changeType(univerAPI.Enum.BaseFieldType.Text, {})

フィールドの型を変更すると、既存の値が正規化される場合があります。本番環境のテーブルにスキーマの変更を適用する前に、アプリケーションでデータを検証してください。

添付ファイル

添付ファイルには安定した ID、名前、アクセス可能な取得元が必要です。次の例ではアプリ側でアップロード済みとします。

TypeScript
const attachments = table.addField('Files', univerAPI.Enum.BaseFieldType.Attachment)const record = table.getRecords()[0]if (!record) throw new Error('Create a record first')record.setAttachments(attachments.getId(), [{  id: 'brief-1',  name: 'brief.pdf',  mimeType: 'application/pdf',  source: 'https://example.com/files/brief.pdf',}])

setAttachments() はリスト全体を置き換えます。読み取りは getAttachments()、指定項目の削除は deleteAttachments() を使います。実際にアクセスできる URL に置き換え、既存の Bases UI 登録でアップロードを設定します。

TypeScript
univer.registerPlugin(UniverBasesUIPlugin, {  attachment: {    accept: ['image/*', '.pdf'],    maxSize: 10 * 1024 * 1024,    upload: uploadAttachment,  },})

uploadAttachment の型は (file: File) => Promise<IBaseAttachment> で、上記の添付データを返します。maxSize はバイト単位です。独自アップローダーがない場合は画像 IO、次に Base64 を試み、スナップショットが大きくなります。本番ではストレージを接続し、バックエンドで種類、サイズ、ダウンロード権限を検証してください。

ユーザーとグループ

Bases UI の personOptions と groupOptions に候補を指定します。各項目は id、name、任意の avatar を持ちます。表示用の設定であり、認証とアクセス権限はアプリ側で管理します。

このガイドはいかがですか?

© 2026 DreamNum Co., Ltd.