@finos/perspective-viewer
Version:
The `<perspective-viewer>` Custom Element, frontend for Perspective.js
256 lines (252 loc) • 10.1 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/**
* @param {string} name
*/
export function register_plugin(name: string): void;
/**
*/
export class ExpressionEditorElement {
free(): void;
}
/**
*/
export class FilterDropDownElement {
free(): void;
}
/**
*/
export class PerspectiveColumnStyleElement {
free(): void;
/**
* @param {HTMLElement} elem
* @param {any} js_config
* @param {any} js_def_config
*/
constructor(elem: HTMLElement, js_config: any, js_def_config: any);
/**
* Reset to a provided JSON config, to be used in place of `new()` when
* re-using this component.
*
* # Arguments
* * `config` - a `ColumnStyle` config in JSON form.
* * `default_config` - the default `ColumnStyle` config for this column
* type, in JSON form.
* @param {any} config
* @param {any} default_config
*/
reset(config: any, default_config: any): void;
/**
* Dispatches to `ModalElement::open(target)`
*
* # Arguments
* `target` - the relative target to pin this `ModalElement` to.
* @param {HTMLElement} target
*/
open(target: HTMLElement): void;
/**
* Remove this `ModalElement` from the DOM.
*/
close(): void;
/**
* DOM lifecycle method when connected. We don't use this, as it can fire during
* innocuous events like re-parenting.
*/
connected_callback(): void;
}
/**
* A `customElements` external API.
*/
export class PerspectiveViewerElement {
free(): void;
/**
* @param {HTMLElement} elem
*/
constructor(elem: HTMLElement);
/**
*/
connected_callback(): void;
/**
* Loads a promise to a `JsPerspectiveTable` in this viewer.
* @param {any} table
* @returns {Promise<any>}
*/
js_load(table: any): Promise<any>;
/**
* Delete the `View` and all associated state, rendering this
* `<perspective-viewer>` unusable and freeing all associated resources.
* Does not delete the supplied `Table` (as this is constructed by the
* callee). Allowing a `<perspective-viewer>` to be garbage-collected
* without calling `delete()` will leak WASM memory.
* @returns {boolean}
*/
js_delete(): boolean;
/**
* Get the underlying `Table` for this viewer.
* @returns {Promise<any>}
*/
js_get_table(): Promise<any>;
/**
* @returns {Promise<any>}
*/
js_flush(): Promise<any>;
/**
* Restores this element from a full/partial `JsPerspectiveViewConfig`.
*
* # Arguments
* - `update` The config to restore to, as returned by `.save()` in either
* "json", "string" or "arraybuffer" format.
* @param {any} update
* @returns {Promise<any>}
*/
js_restore(update: any): Promise<any>;
/**
* Save this element to serialized state object, one which can be restored via
* the `.restore()` method.
*
* # Arguments
* - `format` Supports "json" (default), "arraybuffer" or "string".
* @param {string | undefined} format
* @returns {Promise<any>}
*/
js_save(format?: string): Promise<any>;
/**
* Download this viewer's `View` or `Table` data as a `.csv` file.
*
* # Arguments
* - `flat` Whether to use the current `ViewConfig` to generate this data, or use
* the default.
* @param {boolean} flat
* @returns {Promise<any>}
*/
js_download(flat: boolean): Promise<any>;
/**
* Copy this viewer's `View` or `Table` data as CSV to the system clipboard.
*
* # Arguments
* - `flat` Whether to use the current `ViewConfig` to generate this data, or use
* the default.
* @param {boolean} flat
* @returns {Promise<any>}
*/
js_copy(flat: boolean): Promise<any>;
/**
* Reset the viewer's `ViewerConfig` to the default.
* @returns {Promise<any>}
*/
js_reset(): Promise<any>;
/**
* Recalculate the viewer's dimensions and redraw.
* @returns {Promise<any>}
*/
js_resize(): Promise<any>;
/**
* Get this viewer's edit port for the currently loaded `Table`.
* @returns {number}
*/
js_get_edit_port(): number;
/**
* Restyle all plugins from current document.
* @returns {Promise<any>}
*/
js_restyle_element(): Promise<any>;
/**
* Determines the render throttling behavior. Can be an integer, for
* millisecond window to throttle render event; or, if `None`, adaptive throttling
* will be calculated from the measured render time of the last 5 frames.
*
* # Examples
* // Only draws at most 1 frame/sec.
* viewer.js_set_throttle(Some(1000_f64));
*
* # Arguments
* - `throttle` The throttle rate - milliseconds (f64), or `None` for adaptive
* throttling.
* @param {number | undefined} val
*/
js_set_throttle(val?: number): void;
/**
* Toggle (or force) the config panel open/closed.
*
* # Arguments
* - `force` Force the state of the panel open or closed, or `None` to toggle.
* @param {boolean | undefined} force
* @returns {Promise<any>}
*/
js_toggle_config(force?: boolean): Promise<any>;
/**
* Get an `Array` of all of the plugin custom elements registered for this element.
* This may not include plugins which called `registerPlugin()` after the host has
* rendered for the first time.
* @returns {Array<any>}
*/
js_get_all_plugins(): Array<any>;
/**
* Gets a plugin Custom Element with the `name` field, or get the active plugin
* if no `name` is provided.
*
* # Arguments
* - `name` The `name` property of a perspective plugin Custom Element, or `None`
* for the active plugin's Custom Element.
* @param {string | undefined} name
* @returns {any}
*/
js_get_plugin(name?: string): any;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_perspectivecolumnstyleelement_free: (a: number) => void;
readonly perspectivecolumnstyleelement_new: (a: number, b: number, c: number) => number;
readonly perspectivecolumnstyleelement_reset: (a: number, b: number, c: number) => void;
readonly perspectivecolumnstyleelement_open: (a: number, b: number) => void;
readonly perspectivecolumnstyleelement_close: (a: number) => void;
readonly perspectivecolumnstyleelement_connected_callback: (a: number) => void;
readonly __wbg_expressioneditorelement_free: (a: number) => void;
readonly __wbg_filterdropdownelement_free: (a: number) => void;
readonly __wbg_perspectiveviewerelement_free: (a: number) => void;
readonly perspectiveviewerelement_new: (a: number) => number;
readonly perspectiveviewerelement_connected_callback: (a: number) => void;
readonly perspectiveviewerelement_js_load: (a: number, b: number) => number;
readonly perspectiveviewerelement_js_delete: (a: number) => number;
readonly perspectiveviewerelement_js_get_table: (a: number) => number;
readonly perspectiveviewerelement_js_flush: (a: number) => number;
readonly perspectiveviewerelement_js_restore: (a: number, b: number) => number;
readonly perspectiveviewerelement_js_save: (a: number, b: number, c: number) => number;
readonly perspectiveviewerelement_js_download: (a: number, b: number) => number;
readonly perspectiveviewerelement_js_copy: (a: number, b: number) => number;
readonly perspectiveviewerelement_js_reset: (a: number) => number;
readonly perspectiveviewerelement_js_resize: (a: number) => number;
readonly perspectiveviewerelement_js_get_edit_port: (a: number) => number;
readonly perspectiveviewerelement_js_restyle_element: (a: number) => number;
readonly perspectiveviewerelement_js_set_throttle: (a: number, b: number, c: number) => void;
readonly perspectiveviewerelement_js_toggle_config: (a: number, b: number) => number;
readonly perspectiveviewerelement_js_get_all_plugins: (a: number) => number;
readonly perspectiveviewerelement_js_get_plugin: (a: number, b: number, c: number) => number;
readonly register_plugin: (a: number, b: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0f0393b7c688cd26: (a: number, b: number) => void;
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0055515a3255e576: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4dfcab3f0f5a91ec: (a: number, b: number, c: number) => number;
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h995c625052d8eabb: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h914fb479cd443ebe: (a: number, b: number) => number;
readonly _dyn_core__ops__function__Fn__A_B_C___Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9d8bdb0a9cd8866f: (a: number, b: number, c: number, d: number, e: number) => number;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h303f94a6f2fe9410: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut___A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc46afe3cd27c0087: (a: number, b: number, c: number) => void;
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h19ae12bc7ab1830f: (a: number, b: number) => void;
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h4f0bea1752253b0f: (a: number, b: number, c: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly wasm_bindgen__convert__closures__invoke2_mut__hc2d235ec69d537f9: (a: number, b: number, c: number, d: number) => void;
}
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;