import ContextNode from './contextnode'; import type { NodeProps } from './types'; declare class TreeNode { readonly type: string; readonly name: string; value: any; previousValue: any; parent: ContextNode | TreeNode | null; readonly children: TreeNode[]; private readonly eventSubscribers; readonly references: Map; props: NodeProps; constructor(type: string, name: string, options?: NodeProps); /** * @description This method adds the node to the set of references present in the current node * with the name as its key * @example Example for addReference() * // In this example, the API adds the reference to the current node * this.addReference("TOP_EmbeddedData_5.EmbeddedData",fieldNode) * // returns - * @param name name of the reference to be added * @param node node to be added as a reference * @function * @private */ addReference(name: string, node: TreeNode): void; /** * @description This method gives the reference for name provided. * @example Example for getReference() * // In this example, the API gives the reference to the node we are looking for * viewNode = pageNode.getReference(parentView) * // returns - Tree node which was set as reference * @param {string} name nameof node * @param name nameof node * @returns the reference node based on the name * @function * @private */ getReference(name: string | undefined): this | undefined; /** * @description This method gives the node for type, name provided. * @example Example for getNode() * // In this example, the API gives the node for the type, name are looking for * node = this.getContextNode(contextName)?.getNode('PAGE', pageName) * // returns - The node based on type, name provided * @param type type of node * @param name name of node * @returns - The node based on type, name provided * @function * @private */ getNode(type: string, name: string, index?: null | number): this | undefined; /** * @description This method adds the node for type, name provided. * @example Example for addNode() * // In this example, the API adds the node for the type, name are looking for * const pageNode = this.addContextNode(contextName).addNode('PAGE', pageName); * // returns - The node based on type, name provided * @param type type of node * @param name name of node * @returns - The added node based on type, name provided * @function * @private */ addNode(type: string, name: string, options?: NodeProps): this; /** * @description This method adds the evenlistener for callback provided. * @example Example for addEventListener() * // In this example, the API adds the callback to the event subscribers * this.getPageListNode(contextName, pageName, viewName, pageListName)?.addEventListener(callback) * // returns - * @param callback function to be called on mutation * @function * @private */ addEventListener(callback: (object: { type: string; }) => void): void; /** * @description This method triggers the event for the event object provided. * @example Example for triggerEvent() * // In this example, the API triggers the event for the event object * contextNode.getReference(`${pageName}.${pageListName}`)?.triggerEvent(mutateObject); * @param eventObject mutation objects to be passed to the listeners * @param stopPropagation stop propagating the event to parent * @function * @private */ triggerEvent(eventObject: { type: string; }, stopPropagation?: boolean): void; setPreviousDefaultValue(): void; removeReference(name: string, index?: number): void; /** * This API removes the specified TreeNode from the children array of the current TreeNode. * @param name - name of the name of the pageList node * @private */ removeChildNode(name: string): void; /** * This API removes all the children from the current TreeNode. * @param name * @Private */ removeChildren(): void; removeNode(name: string, index: number): void; } export default TreeNode;