import type * as psp from "@finos/perspective"; export { PerspectiveWorkspace } from "./workspace"; export { PerspectiveViewerWidget } from "./workspace/widget"; import "./external"; import { PerspectiveWorkspaceConfig, ViewerConfigUpdateExt } from "./workspace"; /** * A Custom Element for coordinating a set of `` light DOM * children. `` is built on Lumino.js to allow a more * app-like experience than ``, providing * these features additionally: * * - Docking, arranging, tabbing and max/min-ing of ``s. * - Trivial `` duplication. * - Global Filter sidebar, for using selection state of a pivot table to filter * siblings. * - Total persistence/serializable state and child state. * - Easy sharing/ownership of `Table()` among different ``. * - A cool DOM-reactive API. * * There are a few ways to use this Custom Element. In plain HTML, you can * express your initial view simply: * * ```html * * * * * * * ``` * * You can also use the DOM API in Javascript: * * ```javascript * const workspace = document.createElement("perspective-workspace"); * const viewer = document.createElement("perspective-viewer"); * workspace.appendChild(viewer); * document.body.appendChild(workspace); * ``` * * This will yield a ` with the default layout. To load * a `Table()`, add it to `tables` via the `Map()` API where it will be * auto-wired into all matching ``s immediately: * * ```javascript * workspace.tables.set("superstore", await worker.table(my_data)); * ``` * * */ export declare class HTMLPerspectiveWorkspaceElement extends HTMLElement { private workspace?; private _resize_observer?; constructor(); /*************************************************************************** * * Public * */ /** * Persists this `` to a token `Object`. This object * is JSON serializable and describes the state of the Workspace and it's * child `` elements. Some important keys: * * - `viewers`: The serialized state of `` children, * named by `slot`. * - `detail`: The main layout. * - `master`: The contents of the Global Filter sidebar. * * While the `table` attribute is persisted for each `perspective-viewer`, * `Table`s themselves must be added to the `tables` property `Map()` * separately. * * @return {Object} A configuration token, compatible with * `restore(config)`. * @example * // Save this layout to local storage * const workspace = document.querySelector("perspective-workspace"); * localStorage.set("CONFIG", JSON.stringify(workspace.save())); */ save(): Promise<{ viewers: Record; sizes: number[]; detail: import("@lumino/widgets").DockLayout.ILayoutConfig | undefined; master: { widgets: string[]; sizes: number[]; } | undefined; }>; /** * Restore this `` to a previous state captured by * `save()`. Calling this method will completely rewrite this element's * `innerHTML`, but may reuse `` children depending * on the `slot` attribute names. However, it should always be possible * to recreate any given state from within the UI itself, as the attributes * on `` itself create immutable views. * * While the `table` attribute is set for each `perspective-viewer`, * `Table`s themselves must be added to the `tables` property `Map()` * separately. * @param {Object} config A configuration token, as returned by `save()`. * @example * // Restore this layout from local storage * const workspace = document.querySelector("perspective-workspace"); * workspace.restore(JSON.parse(localStorage.get("CONFIG")); * * // Add `Table` separately. * workspace.tables.set("superstore", await worker.table(data)); */ restore(layout: PerspectiveWorkspaceConfig): Promise; clear(): Promise; /** * Await all asynchronous tasks for all viewers in this workspace. This is * useful to make sure asynchonous side effects of synchronous methods calls * are applied. */ flush(): Promise; /** * Add a new viewer to the workspace for a given `ViewerConfigUpdateExt`. * @param config */ addViewer(config: ViewerConfigUpdateExt): Promise; /** * Add a new `Table` to the workspace, so that it can be bound by viewers. * Each `Table` is identified by a unique `name`. */ addTable(name: string, table: Promise): Promise; /** * Deleta a table by name from this workspace * @param name * @returns */ getTable(name: string): psp.Table | Promise; /** * Replace a `Table` by name. As `Table` doe snot guarantee the same * structure, this will wipe the viewer's state. * @param name * @param table */ replaceTable(name: string, table: Promise): Promise; /** * Remove a `Table` by name. * @param name * @returns */ removeTable(name: string): boolean; /** * A `Map()` of `perspective.Table()` by name. The names set here will auto * wire any child `perspective-viewer` elements in this Workspace's subtree, * by looking up their respective `table` attribute. * * Calling methods on this `Map()` may have side-effects, as * `PerspectiveViewerHTMLElement.load()` is called when a new `Table()` is * set with a name matching an existing child `perspective-viewer`. * * @readonly * @memberof HTMLPerspectiveWorkspaceElement */ get tables(): import("./utils/observable_map").ObservableMap>; /** * Invalidate this component's dimensions and recalculate. */ resize(): Promise; /** * Set whether this workspace element should auto-size itself via a * `ResizeObserver`. */ setAutoSize(is_auto_size: boolean): void; connectedCallback(): void; /*************************************************************************** * * Private * */ private _light_dom_changed; private _register_light_dom_listener; }