import Collection from "@arcgis/core/core/Collection"; import type { LayoutProperties } from "@vertigis/viewer-spec/app-config/common/LayoutProperties"; import { ItemType } from "../ItemType"; import type { ComponentFactory, ComponentRegistry } from "../components"; import type { Action } from "../messaging"; import type { PropertyDefs } from "../models"; import { ComponentModelBase } from "../models"; import { LayoutNode } from "./LayoutNode"; /** * A URL to a layout XML document. */ export type LayoutUrl = string; /** * A layout XML document. */ export type LayoutXml = string; /** * The XML namespace for layouts. */ export declare const LAYOUT_NAMESPACE = "https://geocortex.com/layout/v1"; /** * Arguments for layout events. */ export interface LayoutEventArgs { /** * The layout node that this event pertains to. */ node: LayoutNode; } /** * A VertiGIS Studio Web layout, representing a hierarchy of components. */ export declare class Layout extends ComponentModelBase { componentFactory: ComponentFactory; componentRegistry: ComponentRegistry; /** * The URL of the layout XML (Either a url or definition must be provided). */ url?: string; /** * An action that will be performed when the layout is about to load. */ onLayoutLoading?: Action; /** * An action that will be performed when the layout has loaded. */ onLayoutLoaded?: Action; /** * @inheritdoc */ protected readonly _itemType = ItemType.LAYOUT; private readonly _initializedNodes; private _document; private _changeHandle; private _root; private _layoutNodesToDomNodes; private readonly _tags; /** * Application-defined tags associated with the layout, e.g. "handheld" or * "high-contrast". An application might use these tags to choose a layout * when there are multiple to choose from. */ get tags(): Collection; /** * The stringified layout XML (Either a url or definition must be provided). */ get definition(): LayoutXml; set definition(xml: LayoutXml | undefined); /** * Gets a flattened list of all LayoutNodes in the Layout. Returned in * breadth-first order. */ get allNodes(): LayoutNode[]; /** * The root node in the layout hierarchy, corresponding to the "" * element in layout XML. */ get root(): LayoutNode; assignProperties(properties: LayoutProperties): void; /** * Returns a node by its unique ID, or undefined if no match is found. * * @param id The ID of the desired node. */ selectById(id: string): LayoutNode | undefined; /** * Returns all nodes with the given name. * * @param name The desired name (i.e. the XML element name). * @param namespace The desired namespace (e.g. * "https://geocortex.com/layout/web/v1"). */ selectByName(name: string, namespace?: string): LayoutNode[]; /** * Activates one or more nodes. * * @param nodes The node(s) or selector string identifying the nodes to * activate. */ activate(nodes: LayoutNode | LayoutNode[] | string): Promise; /** * Deactivates one or more nodes. * * @param nodes The nodes(s) or selector string identifying the nodes to * deactivate. */ deactivate(nodes: LayoutNode | LayoutNode[] | string): Promise; /** * Selects nodes based on a selector. * * @param selector A selector, which is a comma separated list of node names * and/or node IDs prefixed with "#". */ select(selector: string): LayoutNode[]; /** * Initializes a layout node, i.e. creates its model and initializes it. * * @param node The node to initialize. */ initializeNode(node: LayoutNode): Promise; /** * Manually runs the auto-activate algorithm on the descendants of a node. * This is useful when a component has its child activation setting set to * "none" and want to simulate the behavior of "all", but at a deferred * point in time, for example in response to use interaction. * * @param node The node whose descendants should be auto-activated. If this * has already occurred (either due to calling this method, or because the * child activation was something other than "none"), then nothing will * happen. */ autoActivateDescendants(node: LayoutNode): Promise; /** * @inheritdoc */ protected _getSerializableProperties(): PropertyDefs; /** * @inheritdoc */ protected _onDestroy(): Promise; private _updateLayoutDefinition; /** * Creates a layout tree from XML and returns the root node. * * @param xml The XMl to create the tree from. */ private _createLayoutTree; private _serializeLayoutTree; private _toXML; /** * Gets all descendants of a node that are eligible to activate when the * node is activated for the first time. * * @param node The node to get descendants from. * @param force If true, will proceed as though this node has not been * initialized and has child activation of "all". */ private _getAutoActivateDescendants; /** * Definition including transients. */ private _definitionWithTransients; private _getActiveDescendants; /** * Deactivates a node. * * @param node The node to deactivate. */ private _deactivateNode; /** * Resolve dependencies between nodes in the layout. * * @param updateModelsProperty Whether the models= property should be * updated. */ private _resolveAllModelImports; private _resolveModelImports; private _markAsFailed; private _isExporter; private _ancestorIsExporter; private _resolveModelImport; private _addModels; /** * Only remove models which correspond to a certain itemType. * * @param node The node to modify. * @param type The item type for the model. */ private _removeModels; private _setLayoutNodeAttributesFromDomNode; private _createLayoutNodeFromDomNode; private _createDomNodeFromLayoutNode; private _setupLayoutTree; private _findMatchingLayoutNode; private _elementMatchesLayoutNode; private _getLayoutRootElement; private _cleanupDocument; /** * Destroys the layout nodes and clears the root. */ private _cleanupLayout; }