import type { NodeProps } from './types'; import TreeNode from './treenode'; import WhenNode from './whennode'; declare class ContextNode { readonly type: string; readonly name: string; 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 {string} name name of the reference to be added * @param {TreeNode} node node to be added as a reference * @returns {void} * @function * @private */ addReference(name: string, node: TreeNode): void; /** * @description - This method removes the pagelist field references from the ContextNode. * @param name - Name of the pagelist field * @param length - Length of pagelist field value which came from server. * @example Example for removePageListNodes() * // In this example, the API removed the references of pagelist field nodes from context node if there are * any pageList field entries present with length greater than 3. * this.removePageListNodes("caseInfo.content.Employees",3) */ removePageListNodes(name: string, newLength: number): void; /** * @description - This method removes the each pagelist field references from the ContextNode. * @param name - Name of the pagelist field * @param length - Length of pagelist field value which came from server. * @example Example for removeChildNode() * // In this example, the API removed the references of pagelist field nodes from context node if there are * any pageList field entries present with length greater than 3. * this.removeChildNode("caseInfo.content.Employees[0]",3) */ removeChildNode(name: string, newLength: number): 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 {string} type - type of node * @returns {TreeNode} the reference node based on the name * @function * @private */ getReference(name: string, type: string): WhenNode | TreeNode | 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 {string} type type of node * @param {string} name name of node * @returns {TreeNode} - The node based on type, name provided * @function * @private */ getNode(type: string, name: string, index?: number): TreeNode | 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 {string} type type of node * @param {string} name name of node * @returns {TreeNode} - The added node based on type, name provided * @function * @private */ addNode(type: string, name: string, options?: NodeProps): TreeNode; /** * @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} callback function to be called on mutation * @returns {void} - * @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); * // returns - * @param {Object} eventObject mutation objects to be passed to the listeners * @param {boolean} stopPropagation stop propagating the event to parent * @returns {TreeNode} - * @function * @private */ triggerEvent(eventObject: { type: string; }): void; removeReference(name: string, type: string, index?: number): void; removeNode(name: string, index: number): void; addWhen(pageName: string, subType: string, referenceName: string, whenName: string, options?: NodeProps): void; } export default ContextNode;