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/popup/src/menu/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/main/popup/src/menu/menu-manager.js
import Menu from './menu';
import { Type } from 'main.core';
import { MenuOptions } from './menu-types';

export default class MenuManager
{
	/**
	 * @private
	 */
	static Data: { [id: string]: Menu } = {};

	/**
	 * @private
	 */
	static currentItem: ? Menu = null;

	constructor()
	{
		throw new Error('You cannot make an instance of MenuManager.');
	}

	static show(...args)
	{
		if (this.currentItem !== null)
		{
			this.currentItem.popupWindow.close();
		}

		this.currentItem = this.create.apply(this, args);
		this.currentItem.popupWindow.show();
	}

	static create(options: MenuOptions)
	{
		let menuId = null;

		//Compatibility
		const bindElement = arguments[1];
		const menuItems = arguments[2];
		const params = arguments[3];

		if (Type.isPlainObject(options) && !bindElement && !menuItems && !params)
		{
			menuId = options.id;
			if (!Type.isStringFilled(menuId))
			{
				throw new Error('BX.Main.Menu.create: "id" parameter is required.');
			}
		}
		else
		{
			menuId = options;
		}

		if (!this.Data[menuId])
		{
			const menu = new Menu(options, bindElement, menuItems, params);
			menu.getPopupWindow().subscribe('onDestroy', () => {
				MenuManager.destroy(menuId);
			});

			this.Data[menuId] = menu;
		}

		return this.Data[menuId];
	}

	static getCurrentMenu(): Menu | null
	{
		return this.currentItem;
	}

	static getMenuById(id): Menu | null
	{
		return this.Data[id] ? this.Data[id] : null;
	}

	/**
	 * compatibility
	 * @private
	 */
	static onPopupDestroy(popupMenuWindow: Menu)
	{
		this.destroy(popupMenuWindow.id);
	}

	static destroy(id)
	{
		const menu = this.getMenuById(id);
		if (menu)
		{
			if (this.currentItem === menu)
			{
				this.currentItem = null;
			}

			delete this.Data[id];
			menu.getPopupWindow().destroy();
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit