BasesView
Official
View for the Bases plugin.
Import:
import { BasesView } from 'obsidian';Signature:
export class BasesView extends ComponentExtends: Component
Constructor
new BasesView(leaf: WorkspaceLeaf, basesPluginInstance: BasesPluginInstance)Constructor.
Properties
| Property | Type | Description | |
|---|---|---|---|
| _children | Component[] | Child Components attached to current component, will be unloaded on unloading parent component. (Inherited from Component) | |
| _events | EventRef[] | Events that are attached to the current component, will be detached on unloading parent component. (Inherited from Component) | |
| _loaded | boolean | Whether the component and its children are loaded. (Inherited from Component) | |
| allProperties | BasesPropertyId[] | All available properties from the dataset. | |
| app | App | Reference to the app instance. | |
| config | BasesViewConfig | The config object for this view. | |
| controller | BasesController | The controller for the view. | |
| data | BasesQueryResult | The most recent output from executing the bases query, applying filters, and evaluating formulas. This object will be replaced with a new result set when changes to the vault or Bases config occur, so views should not keep a reference to it. Also note the contained obsidian#BasesEntry objects will be recreated. | |
| lastData | string | The last data of the view. | |
| plugin | BasesPluginInstance | Bases plugin. | |
| query | BasesQuery | The query for the view. | |
| queryController | QueryController | The query controller driving this view. | |
| redoStack | BasesViewTransaction[] | The redo stack of transactions. | |
| type | string | The type ID of this view | |
| undoStack | BasesViewTransaction[] | The undo stack of transactions. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addChild(component) | T | Adds a child component, loading it if this component is loaded. (Inherited from Component) | |
| copyToClipboard() | void | Copies the current table to the clipboard (as TSV and Markdown). | |
| createFileForView(baseFileName?, frontmatterProcessor?) | Promise<void> | Display the new note menu for a file with the provided filename and optionally a function to modify the frontmatter. | |
| createGroupHeadingEl(group) | HTMLElement | null | Creates the heading element for a result group. | |
| createRenderer(property, el) | unknown | Creates a property-value renderer for a property within a container element. | |
| createTransaction(callback) | Promise<void> | Runs a batch of property changes as one transaction that can be undone and redone. | |
| exportTable() | unknown | Builds an exportable representation of the current table. | |
| focus() | void | Focuses the view. | |
| getEphemeralState() | Record<string, unknown> | Gets the view's ephemeral (non-persisted) state. | |
| getViewActions() | unknown[] | Gets the view's toolbar actions. | |
| getViewType() | typeof ViewType.Bases | Get view type. | |
| load() | void | Load this component and its children. (Inherited from Component) | |
| onDataUpdated() | void | Called when there is new data for the query. This view should rerender with the updated data. | |
| onLayoutChange() | void | Called when the layout of the view changes. | |
| onload() | void | Override this to load your component. (Inherited from Component) | |
| onResize() | void | Handles a resize of the view container. | |
| onunload() | void | Override this to unload your component (Inherited from Component) | |
| onViewChanged() | void | Called when the view changes. | |
| receiveSyncState(fileView) | void | Receives the sync state. | |
| redoTransaction() | Promise<void> | Redoes the most recently undone transaction. | |
| register(cb) | void | Registers a callback to be called when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading. (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerDomEvent(el, type, callback, options?) | void | Registers a DOM event to be detached when unloading (Inherited from Component) | |
| registerEvent(eventRef) | void | Registers an event to be detached when unloading. (Inherited from Component) | |
| registerInterval(id) | number | Registers an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API(Inherited from Component) | |
| registerScopeEvent(keymapEventHandler) | void | Register a scope keymap event handler to be removed on unload. (Inherited from Component) | |
| removeChild(component) | T | Removes a child component, unloading it. (Inherited from Component) | |
| saveQuery(query) | void | Saves the query. | |
| setEphemeralState(state) | void | Restores the view's ephemeral state. | |
| undoTransaction() | Promise<void> | Undoes the most recent transaction. | |
| unload() | void | Override this to unload your component. (Inherited from Component) | |
| updateCurrentFile(file) | void | Updates the current file. | |
| updateProperty(file, property, value) | Promise<void> | Updates a single frontmatter property on a file within a transaction. |
Links to this page: