403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/main/core/src/lib/z-index/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/main/core/src/lib/z-index/z-index-manager.js
import Type from '../type';
import ZIndexStack from './z-index-stack';
import type ZIndexComponent from './z-index-component';
import type { ZIndexComponentOptions } from './z-index-component-options';

/**
 * @memberof BX
 */
export default class ZIndexManager
{
	static stacks: WeakMap<HTMLElement, ZIndexStack> = new WeakMap();

	static register(element: HTMLElement, options: ZIndexComponentOptions = {}): ?ZIndexComponent
	{
		const parentNode = this.#getParentNode(element);
		if (!parentNode)
		{
			return null;
		}

		const stack = this.getOrAddStack(parentNode);

		return stack.register(element, options);
	}

	static unregister(element: HTMLElement)
	{
		const parentNode = this.#getParentNode(element);
		const stack = this.getStack(parentNode);
		if (stack)
		{
			stack.unregister(element);
		}
	}

	static addStack(container: HTMLElement): ZIndexStack
	{
		const stack = new ZIndexStack(container);
		this.stacks.set(container, stack);

		return stack;
	}

	static getStack(container: HTMLElement): ?ZIndexStack
	{
		return this.stacks.get(container) || null;
	}

	static getOrAddStack(container: HTMLElement): ?ZIndexStack
	{
		return this.getStack(container) || this.addStack(container);
	}

	static getComponent(element: HTMLElement): ?ZIndexComponent
	{
		const parentNode = this.#getParentNode(element, true);
		if (!parentNode)
		{
			return null;
		}

		const stack = this.getStack(parentNode);

		return stack ? stack.getComponent(element) : null;
	}

	static bringToFront(element: HTMLElement): ?ZIndexComponent
	{
		const parentNode = this.#getParentNode(element);
		const stack = this.getStack(parentNode);

		if (stack)
		{
			return stack.bringToFront(element);
		}

		return null;
	}

	static #getParentNode(element: HTMLElement, suppressWarnings: boolean = false): ?HTMLElement
	{
		if (!Type.isElementNode(element))
		{
			if (!suppressWarnings)
			{
				console.error('ZIndexManager: The argument \'element\' must be a DOM element.', element);
			}

			return null;
		}
		else if (!Type.isElementNode(element.parentNode))
		{
			if (!suppressWarnings)
			{
				console.error('ZIndexManager: The \'element\' doesn\'t have a parent node.', element);
			}

			return null;
		}

		return element.parentNode;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit