BlockSuite API Documentation / @blocksuite/blocks / DatabaseBlockComponent
Class: DatabaseBlockComponent 
Extends 
CaptionedBlockComponent<DatabaseBlockModel,DatabaseBlockService>
Constructors 
new DatabaseBlockComponent() 
new DatabaseBlockComponent():
DatabaseBlockComponent
Returns 
Inherited from 
`CaptionedBlockComponent< DatabaseBlockModel, DatabaseBlockService
.constructor`
Defined in 
packages/affine/components/dist/caption/captioned-block-component.d.ts:9
Other 
_bindHotkey() 
_bindHotkey: (
hotkeys) =>Disposable
Parameters 
• hotkeys: Record<string, UIEventHandler>
Returns 
Disposable
Defined in 
packages/blocks/src/database-block/database-block.ts:164
_disposables 
protected_disposables:DisposableGroup
Inherited from 
CaptionedBlockComponent._disposables
Defined in 
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:4
_handleEvent() 
_handleEvent: (
name,handler) =>Disposable
Parameters 
• name: "pan" | "click" | "doubleClick" | "tripleClick" | "pointerDown" | "pointerMove" | "pointerUp" | "pointerOut" | "dragStart" | "dragMove" | "dragEnd" | "pinch" | "keyDown" | "keyUp" | "selectionChange" | "compositionStart" | "compositionUpdate" | "compositionEnd" | "cut" | "copy" | "paste" | "beforeInput" | "blur" | "focus" | "drop" | "contextMenu" | "wheel"
• handler: UIEventHandler
Returns 
Disposable
Defined in 
packages/blocks/src/database-block/database-block.ts:172
[blockComponentSymbol] 
[blockComponentSymbol]:
boolean
Inherited from 
CaptionedBlockComponent.[blockComponentSymbol]
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:13
disposables 
readonlydisposables:DisposableGroup
Inherited from 
CaptionedBlockComponent.disposables
Defined in 
packages/framework/block-std/dist/view/utils/with-disposable.d.ts:5
handleEvent() 
handleEvent: (
name,handler,options?) =>void
Parameters 
• name: "pan" | "click" | "doubleClick" | "tripleClick" | "pointerDown" | "pointerMove" | "pointerUp" | "pointerOut" | "dragStart" | "dragMove" | "dragEnd" | "pinch" | "keyDown" | "keyUp" | "selectionChange" | "compositionStart" | "compositionUpdate" | "compositionEnd" | "cut" | "copy" | "paste" | "beforeInput" | "blur" | "focus" | "drop" | "contextMenu" | "wheel"
• handler: UIEventHandler
• options?
• options.flavour?: boolean
• options.global?: boolean
Returns 
void
Inherited from 
CaptionedBlockComponent.handleEvent
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:14
headerWidget 
headerWidget:
DataViewWidget
Defined in 
packages/blocks/src/database-block/database-block.ts:184
indicator 
indicator:
DragIndicator
Defined in 
packages/blocks/src/database-block/database-block.ts:206
toolsWidget 
toolsWidget:
DataViewWidget
Defined in 
packages/blocks/src/database-block/database-block.ts:259
viewSelection$ 
viewSelection$:
ReadonlySignal<undefined|DataViewSelection>
Defined in 
packages/blocks/src/database-block/database-block.ts:273
virtualPadding$ 
virtualPadding$:
Signal<number>
Defined in 
packages/blocks/src/database-block/database-block.ts:285
disableShadowRoot 
staticdisableShadowRoot:boolean
Inherited from 
CaptionedBlockComponent.disableShadowRoot
Defined in 
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:4
_renderers 
Inherited from 
CaptionedBlockComponent._renderers
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:53
blockContainerStyles 
Inherited from 
CaptionedBlockComponent.blockContainerStyles
Defined in 
packages/affine/components/dist/caption/captioned-block-component.d.ts:12
blockId 
getblockId():string
Returns 
string
Inherited from 
CaptionedBlockComponent.blockId
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:18
captionEditor 
getcaptionEditor():undefined|BlockCaptionEditor<BlockModel<BlockCaptionProps,BlockCaptionProps&object>>
Returns 
undefined | BlockCaptionEditor<BlockModel<BlockCaptionProps, BlockCaptionProps & object>>
Inherited from 
CaptionedBlockComponent.captionEditor
Defined in 
packages/affine/components/dist/caption/captioned-block-component.d.ts:6
childBlocks 
getchildBlocks():BlockComponent<BlockModel<object,object>,BlockService,string>[]
Returns 
BlockComponent<BlockModel<object, object>, BlockService, string>[]
Inherited from 
CaptionedBlockComponent.childBlocks
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:19
dataSource 
getdataSource():DatabaseBlockDataSource
Returns 
DatabaseBlockDataSource
Defined in 
packages/blocks/src/database-block/database-block.ts:287
dirty 
Inherited from 
CaptionedBlockComponent.dirty
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:55
doc 
Inherited from 
CaptionedBlockComponent.doc
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:56
flavour 
getflavour():string
Returns 
string
Inherited from 
CaptionedBlockComponent.flavour
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:20
host 
gethost():EditorHost
Returns 
Inherited from 
CaptionedBlockComponent.host
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:21
isVersionMismatch 
getisVersionMismatch():boolean
Returns 
boolean
Inherited from 
CaptionedBlockComponent.isVersionMismatch
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:22
model 
getmodel():Model
Returns 
Model
Inherited from 
CaptionedBlockComponent.model
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:23
optionsConfig 
getoptionsConfig():DatabaseOptionsConfig
Returns 
Defined in 
packages/blocks/src/database-block/database-block.ts:297
parentComponent 
getparentComponent():null|BlockComponent<BlockModel<object,SignaledProps<object>>,BlockService,string>
Returns 
null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>
Inherited from 
CaptionedBlockComponent.parentComponent
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:24
renderChildren 
getrenderChildren(): (model,filter?) =>TemplateResult
Returns 
Function
Parameters 
• model: BlockModel<object, SignaledProps<object>>
• filter?
Returns 
TemplateResult
Inherited from 
CaptionedBlockComponent.renderChildren
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:25
rootComponent 
getrootComponent():null|BlockComponent<BlockModel<object,SignaledProps<object>>,BlockService,string>
Returns 
null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>
Inherited from 
CaptionedBlockComponent.rootComponent
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:26
selected 
getselected():null|BaseSelection
Returns 
null | BaseSelection
Inherited from 
CaptionedBlockComponent.selected
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:27
selection 
getselection():SelectionManager
Returns 
Inherited from 
CaptionedBlockComponent.selection
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:28
service 
getservice():Service
Returns 
Service
Inherited from 
CaptionedBlockComponent.service
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:29
showBlockSelection 
Inherited from 
CaptionedBlockComponent.showBlockSelection
Defined in 
packages/affine/components/dist/caption/captioned-block-component.d.ts:13
std 
Inherited from 
CaptionedBlockComponent.std
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:57
topContenteditableElement 
gettopContenteditableElement():null|BlockComponent<BlockModel<object,SignaledProps<object>>,BlockService,string>
Returns 
null | BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>
Overrides 
CaptionedBlockComponent.topContenteditableElement
Defined in 
packages/blocks/src/database-block/database-block.ts:304
useCaptionEditor 
Inherited from 
CaptionedBlockComponent.useCaptionEditor
Defined in 
packages/affine/components/dist/caption/captioned-block-component.d.ts:14
useZeroWidth 
Overrides 
CaptionedBlockComponent.useZeroWidth
Defined in 
packages/blocks/src/database-block/database-block.ts:420
view 
getview():undefined|DataViewExpose
Returns 
undefined | DataViewExpose
Defined in 
packages/blocks/src/database-block/database-block.ts:312
viewType 
Inherited from 
CaptionedBlockComponent.viewType
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:58
widgetComponents 
getwidgetComponents():Partial<Record<WidgetName,WidgetComponent<BlockModel<object,SignaledProps<object>>,BlockComponent<BlockModel<object,SignaledProps<object>>,BlockService,string>,BlockService>>>
Returns 
Partial<Record<WidgetName, WidgetComponent<BlockModel<object, SignaledProps<object>>, BlockComponent<BlockModel<object, SignaledProps<object>>, BlockService, string>, BlockService>>>
Inherited from 
CaptionedBlockComponent.widgetComponents
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:31
widgets 
Inherited from 
CaptionedBlockComponent.widgets
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:59
addRenderer() 
addRenderer(
renderer):void
Parameters 
• renderer
Returns 
void
Inherited from 
CaptionedBlockComponent.addRenderer
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:34
bindHotKey() 
bindHotKey(
keymap,options?): () =>void
Parameters 
• keymap: Record<string, UIEventHandler>
• options?
• options.flavour?: boolean
• options.global?: boolean
Returns 
Function
Returns 
void
Inherited from 
CaptionedBlockComponent.bindHotKey
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:35
connectedCallback() 
connectedCallback():
void
Returns 
void
Overrides 
CaptionedBlockComponent.connectedCallback
Defined in 
packages/blocks/src/database-block/database-block.ts:325
getRootService() 
getRootService():
null|RootService
Returns 
null | RootService
Defined in 
packages/blocks/src/database-block/database-block.ts:180
listenFullWidthChange() 
listenFullWidthChange():
void
Returns 
void
Defined in 
packages/blocks/src/database-block/database-block.ts:375
onDrag() 
onDrag(
evt,id): () =>void
Parameters 
• evt: MouseEvent
• id: string
Returns 
Function
Returns 
void
Defined in 
packages/blocks/src/database-block/database-block.ts:208
renderBlock() 
renderBlock():
TemplateResult<1>
Returns 
TemplateResult<1>
Overrides 
CaptionedBlockComponent.renderBlock
Defined in 
packages/blocks/src/database-block/database-block.ts:389
renderVersionMismatch() 
renderVersionMismatch(
expectedVersion,actualVersion):TemplateResult
Render a warning message when the block version is mismatched.
Parameters 
• expectedVersion: number
If the schema is not found, the expected version is -1. Which means the block is not supported in the current editor.
• actualVersion: number
The version of the block's crdt data.
Returns 
TemplateResult
Inherited from 
CaptionedBlockComponent.renderVersionMismatch
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:50
setSelection() 
setSelection(
selection):void
Parameters 
• selection: undefined | DataViewSelection
Returns 
void
Defined in 
packages/blocks/src/database-block/database-block.ts:245
lifecycle 
disconnectedCallback() 
disconnectedCallback():
void
Invoked when the component is removed from the document's DOM.
This callback is the main signal to the element that it may no longer be used. disconnectedCallback() should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.
disconnectedCallback() {
  super.disconnectedCallback();
  window.removeEventListener('keydown', this._handleKeydown);
}An element may be re-connected after being disconnected.
Returns 
void
Inherited from 
CaptionedBlockComponent.disconnectedCallback
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:40
rendering 
createRenderRoot() 
createRenderRoot():
HTMLElement|DocumentFragment
Returns 
HTMLElement | DocumentFragment
Inherited from 
CaptionedBlockComponent.createRenderRoot
Defined in 
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:6
render() 
render():
unknown
Invoked on each update to perform rendering tasks. This method may return any value renderable by lit-html's ChildPart - typically a TemplateResult. Setting properties inside this method will not trigger the element to update.
Returns 
unknown
Inherited from 
CaptionedBlockComponent.render
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:42
styles 
styles 
staticstyles:CSSResult
Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.
Note on Content Security Policy:
Element styles are implemented with <style> tags when the browser doesn't support adopted StyleSheets. To use such <style> tags with the style-src CSP directive, the style-src value must either include 'unsafe-inline' or nonce-<base64-value> with <base64-value> replaced be a server-generated nonce.
To provide a nonce to use on generated <style> elements, set window.litNonce to a server-generated nonce in your page's HTML, before loading application code:
<script>
  // Generated and unique per request:
  window.litNonce = 'a1b2c3d4';
</script>Nocollapse 
Overrides 
CaptionedBlockComponent.styles
Defined in 
packages/blocks/src/database-block/database-block.ts:58
finalizeStyles() 
protectedstaticfinalizeStyles(styles?):CSSResultOrNative[]
Takes the styles the user supplied via the static styles property and returns the array of styles to apply to the element. Override this method to integrate into a style management system.
Styles are deduplicated preserving the last instance in the list. This is a performance optimization to avoid duplicated styles that can occur especially when composing via subclassing. The last item is kept to try to preserve the cascade order with the assumption that it's most important that last added styles override previous styles.
Parameters 
• styles?: CSSResultGroup
Returns 
CSSResultOrNative[]
Nocollapse 
Inherited from 
CaptionedBlockComponent.finalizeStyles
Defined in 
packages/framework/block-std/dist/view/element/shadowless-element.d.ts:5
updates 
getUpdateComplete() 
protectedgetUpdateComplete():Promise<boolean>
Override point for the updateComplete promise.
It is not safe to override the updateComplete getter directly due to a limitation in TypeScript which means it is not possible to call a superclass getter (e.g. super.updateComplete.then(...)) when the target language is ES5 (https://github.com/microsoft/TypeScript/issues/338). This method should be overridden instead. For example:
class MyElement extends LitElement {
  override async getUpdateComplete() {
    const result = await super.getUpdateComplete();
    await this._myChild.updateComplete;
    return result;
  }
}Returns 
Promise<boolean>
A promise of a boolean that resolves to true if the update completed without triggering another update.
Inherited from 
CaptionedBlockComponent.getUpdateComplete
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:41
update() 
protectedupdate(changedProperties):void
Updates the element. This method reflects property values to attributes and calls render to render DOM via lit-html. Setting properties inside this method will not trigger another update.
Parameters 
• changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
Map of changed properties with old values
Returns 
void
Inherited from 
CaptionedBlockComponent.update
Defined in 
packages/framework/block-std/dist/view/element/block-component.d.ts:51