@sassoftware/vi-api
Version:
Types used in the SAS Visual Investigator API
59 lines (58 loc) • 2.17 kB
TypeScript
import { StoredObjectDTO, Template } from "../svi-datahub";
export interface HomepageDesignerState {
isNew: boolean;
page: Template;
designerType: string;
}
export interface ObjectPageDesignerState {
isNew: boolean;
page: Template;
designerType: string;
childEntityDataSources: StoredObjectDTO[];
primaryDataSource: StoredObjectDTO;
}
/**
* This API provides functionality that pertains to the page state.
* Accessed from the window at `window.sas.vi.pageState`.
*
* @example window.sas.vi.pageState.getCurrent();
* @category API
*/
export interface PageStateApi {
/**
* @method
* @description Returns the state of the current page.
* @returns An object containing the page state data or undefined if no page exists.
*/
getCurrent(): HomepageDesignerState | ObjectPageDesignerState | undefined;
/**
* @method
* @description Returns the state of the page matching the ID.
* @param id {string | number} Page ID for which the state will be returned.
* @returns An object containing the page state data or undefined if the ID doesn't exist.
*/
get(id: string | number): HomepageDesignerState | ObjectPageDesignerState | undefined;
/**
* @method
* @description Creates a page state.
* @param id {string | number} Page ID to be created.
* @param state {HomepageDesignerState | ObjectPageDesignerState} Object containing the state data required to create the page.
*/
add(id: string | number, state: HomepageDesignerState | ObjectPageDesignerState): void;
/**
* @method
* @description Deletes a page state.
* @param id {string | number} ID of the page to be deleted.
*/
remove(id: string | number): void;
/**
* Gives the currently active Home page's state, or undefined if a Home page
* designer tab is not active.
*/
getCurrentHomepageDesigner(): HomepageDesignerState | undefined;
/**
* Gives the currently active object pages state, or undefined if an object page
* designer tab is not active.
*/
getCurrentObjectPageDesigner(): ObjectPageDesignerState | undefined;
}