SDK Reference
Library

Library

The Library class in Vizzly is designed to manage and organize a collection of components that can be utilized across various parts of a dashboard. It acts as a repository for storing and retrieving reusable components.

Breaking Changes

From version 0.9.0 of the services package a uniqueViewId is now required for every component added to the library.

Initialization

The Library can be initialized with an optional object containing attributes. These attributes can include an array of components, which are instances of ViewServices.View. This allows for the pre-population of the library with a set of components.

Basic Example

To initialize a new Library instance in Vizzly, use the following TypeScript syntax:

import { Vizzly } from "@vizzly/services;
 
new Vizzly.Library();

API

/**
* Creates a new instance of a Library.
* @param attributes An optional object containing the attributes of the library.
* @param components The `component` instance to be added to the library. `uniqueViewId` of the component, should always be the same and not auto-generated.
*/
 
constructor(attributes?: { components?: { component: ViewServices.View; uniqueViewId: string } })
 
/**
* Adds a cell to the library at a specified position or appends it at the end if
  no position is specified.
* @param component The Component instance to be added to the library.
* @param uniqueViewId The unique view id of the component, should always be the same and not auto-generated.
* @param attributes An optional object containing the attributes of the cell.
*/
 
addComponent(component: ViewServices.View, uniqueViewId: string, attributes?: {
    position?: number; localFilters?: AdditionalFilter[]
})
 
/**
*  Adds an array of cells to the library.
* @param components An array of Component instances.
* @param components The `component` instance to be added to the library. `uniqueViewId` of the component, should always be the same and not auto-generated.
*/
addComponents(components: { component: ViewServices.View; uniqueViewId: string })