Skip to content
ФреймворкJavaScript

Строка базы данных: свойства и тело страницы

An internal block tool that stores a single database row. Not user-insertable — rows are created and managed by the parent Database block. Each row stores property values conforming to the parent database schema and a position string for ordering.

Импорт

TypeScript
import { DatabaseRow } from '@bloklabs/core/tools';

Формат данных

TypeScript
interface DatabaseRowData {
  properties: Record<string, PropertyValue>; // Column values keyed by property ID
  position: string;                          // Fractional index for ordering
}
// PropertyValue = string | number | boolean | string[] | OutputData | null
JSON
{
  "id": "row001",
  "type": "database-row",
  "data": {
    "properties": {
      "prop1": "My Task",
      "prop2": "In Progress"
    },
    "position": "a0"
  }
}

Пример использования

TypeScript
// DatabaseRow is not inserted directly — it is created by the Database tool.
// Access row data via the saved output:
import { Database, DatabaseRow } from '@bloklabs/core/tools';

const editor = new Blok({
  holder: 'editor',
  tools: {
    database: { class: Database },
    'database-row': { class: DatabaseRow },
  },
});