UNPKG

lazy-object-view

Version:

A simple JS object tree visualizer/explorer that adheres to 'what you see is what's in the DOM'

43 lines (42 loc) 1.54 kB
import "./styles/index.scss"; export interface IRenderOptions { /** * Whether or not to encapsulate the entire object inside a single root element. */ useRootElement?: boolean; /** * The name of the root element to use if useRootElement is true. Defaults to "root". */ rootName?: string; /** * Attempt to show a loading indicator before expanding nodes * Note that this introduces a small artificial delay of 10ms when expanding */ showLoadingIndicator?: boolean; /** * If set will collapse values over that number and show an ellipses (...) at the * end with the remaining count to expand. */ collapseStringsOver?: number; } export declare class LazyObjectView { private readonly elementTypeToUse; private readonly keyValueClassName; private readonly keyClassName; private readonly valueClassName; private readonly subtreeClassName; private readonly defaultRootNodeName; private window; constructor(windowObject?: Window); /** * Renders a json viewer on the target element for the given data * @param target The target element to render the JSON document under * @param data The data to render as a tree view * @param options Options for rendering the viewer */ render(target: HTMLElement, data: any, options?: IRenderOptions): null | undefined; collapse(target: HTMLElement): void; private constructTextElement; private constructRenderedKeyValue; } export default LazyObjectView;