6c18b7c6e7344dca127add7d762b134a.json
9.09 KB
{"ast":null,"code":"/**\r\n * Submenu Base Class\r\n * @class\r\n * @ignore\r\n */\nclass Submenu {\n /**\r\n * @param {HTMLElement} subMenuElement - submenu dom element\r\n * @param {Locale} locale - translate text\r\n * @param {string} name - name of sub menu\r\n * @param {Object} iconStyle - style of icon\r\n * @param {string} menuBarPosition - position of menu\r\n * @param {*} templateHtml - template for SubMenuElement\r\n * @param {boolean} [usageStatistics=false] - template for SubMenuElement\r\n */\n constructor(subMenuElement, {\n locale,\n name,\n makeSvgIcon,\n menuBarPosition,\n templateHtml,\n usageStatistics\n }) {\n this.subMenuElement = subMenuElement;\n this.menuBarPosition = menuBarPosition;\n this.toggleDirection = menuBarPosition === 'top' ? 'down' : 'up';\n this.colorPickerControls = [];\n this.usageStatistics = usageStatistics;\n this.eventHandler = {};\n\n this._makeSubMenuElement({\n locale,\n name,\n makeSvgIcon,\n templateHtml\n });\n }\n /**\r\n * editor dom ui query selector\r\n * @param {string} selectName - query selector string name\r\n * @returns {HTMLElement}\r\n */\n\n\n selector(selectName) {\n return this.subMenuElement.querySelector(selectName);\n }\n /**\r\n * change show state change for colorpicker instance\r\n * @param {Colorpicker} occurredControl - target Colorpicker Instance\r\n */\n\n\n colorPickerChangeShow(occurredControl) {\n this.colorPickerControls.forEach(pickerControl => {\n if (occurredControl !== pickerControl) {\n pickerControl.hide();\n }\n });\n }\n /**\r\n * Get butten type\r\n * @param {HTMLElement} button - event target element\r\n * @param {array} buttonNames - Array of button names\r\n * @returns {string} - button type\r\n */\n\n\n getButtonType(button, buttonNames) {\n return button.className.match(RegExp(`(${buttonNames.join('|')})`))[0];\n }\n /**\r\n * Get butten type\r\n * @param {HTMLElement} target - event target element\r\n * @param {string} removeClass - remove class name\r\n * @param {string} addClass - add class name\r\n */\n\n\n changeClass(target, removeClass, addClass) {\n target.classList.remove(removeClass);\n target.classList.add(addClass);\n }\n /**\r\n * Interface method whose implementation is optional.\r\n * Returns the menu to its default state.\r\n */\n\n\n changeStandbyMode() {}\n /**\r\n * Interface method whose implementation is optional.\r\n * Executed when the menu starts.\r\n */\n\n\n changeStartMode() {}\n /**\r\n * Make submenu dom element\r\n * @param {Locale} locale - translate text\r\n * @param {string} name - submenu name\r\n * @param {Object} iconStyle - icon style\r\n * @param {*} templateHtml - template for SubMenuElement\r\n * @private\r\n */\n\n\n _makeSubMenuElement({\n locale,\n name,\n iconStyle,\n makeSvgIcon,\n templateHtml\n }) {\n const iconSubMenu = document.createElement('div');\n iconSubMenu.className = `tui-image-editor-menu-${name}`;\n iconSubMenu.innerHTML = templateHtml({\n locale,\n iconStyle,\n makeSvgIcon\n });\n this.subMenuElement.appendChild(iconSubMenu);\n }\n\n}\n\nexport default Submenu;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/src/js/ui/submenuBase.js"],"names":["Submenu","constructor","subMenuElement","locale","name","makeSvgIcon","menuBarPosition","templateHtml","usageStatistics","toggleDirection","colorPickerControls","eventHandler","_makeSubMenuElement","selector","selectName","querySelector","colorPickerChangeShow","occurredControl","forEach","pickerControl","hide","getButtonType","button","buttonNames","className","match","RegExp","join","changeClass","target","removeClass","addClass","classList","remove","add","changeStandbyMode","changeStartMode","iconStyle","iconSubMenu","document","createElement","innerHTML","appendChild"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAN,CAAc;AACZ;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAW,CACTC,cADS,EAET;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,WAAhB;AAA6BC,IAAAA,eAA7B;AAA8CC,IAAAA,YAA9C;AAA4DC,IAAAA;AAA5D,GAFS,EAGT;AACA,SAAKN,cAAL,GAAsBA,cAAtB;AACA,SAAKI,eAAL,GAAuBA,eAAvB;AACA,SAAKG,eAAL,GAAuBH,eAAe,KAAK,KAApB,GAA4B,MAA5B,GAAqC,IAA5D;AACA,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MAAF;AAAUC,IAAAA,IAAV;AAAgBiC,IAAAA,SAAhB;AAA2BhC,IAAAA,WAA3B;AAAwCE,IAAAA;AAAxC,GAAD,EAAyD;AAC1E,UAAM+B,WAAW,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAApB;AACAF,IAAAA,WAAW,CAACd,SAAZ,GAAyB,yBAAwBpB,IAAK,EAAtD;AACAkC,IAAAA,WAAW,CAACG,SAAZ,GAAwBlC,YAAY,CAAC;AACnCJ,MAAAA,MADmC;AAEnCkC,MAAAA,SAFmC;AAGnChC,MAAAA;AAHmC,KAAD,CAApC;AAMA,SAAKH,cAAL,CAAoBwC,WAApB,CAAgCJ,WAAhC;AACD;;AApGW;;AAuGd,eAAetC,OAAf","sourcesContent":["/**\r\n * Submenu Base Class\r\n * @class\r\n * @ignore\r\n */\r\nclass Submenu {\r\n /**\r\n * @param {HTMLElement} subMenuElement - submenu dom element\r\n * @param {Locale} locale - translate text\r\n * @param {string} name - name of sub menu\r\n * @param {Object} iconStyle - style of icon\r\n * @param {string} menuBarPosition - position of menu\r\n * @param {*} templateHtml - template for SubMenuElement\r\n * @param {boolean} [usageStatistics=false] - template for SubMenuElement\r\n */\r\n constructor(\r\n subMenuElement,\r\n { locale, name, makeSvgIcon, menuBarPosition, templateHtml, usageStatistics }\r\n ) {\r\n this.subMenuElement = subMenuElement;\r\n this.menuBarPosition = menuBarPosition;\r\n this.toggleDirection = menuBarPosition === 'top' ? 'down' : 'up';\r\n this.colorPickerControls = [];\r\n this.usageStatistics = usageStatistics;\r\n this.eventHandler = {};\r\n this._makeSubMenuElement({\r\n locale,\r\n name,\r\n makeSvgIcon,\r\n templateHtml,\r\n });\r\n }\r\n\r\n /**\r\n * editor dom ui query selector\r\n * @param {string} selectName - query selector string name\r\n * @returns {HTMLElement}\r\n */\r\n selector(selectName) {\r\n return this.subMenuElement.querySelector(selectName);\r\n }\r\n\r\n /**\r\n * change show state change for colorpicker instance\r\n * @param {Colorpicker} occurredControl - target Colorpicker Instance\r\n */\r\n colorPickerChangeShow(occurredControl) {\r\n this.colorPickerControls.forEach((pickerControl) => {\r\n if (occurredControl !== pickerControl) {\r\n pickerControl.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Get butten type\r\n * @param {HTMLElement} button - event target element\r\n * @param {array} buttonNames - Array of button names\r\n * @returns {string} - button type\r\n */\r\n getButtonType(button, buttonNames) {\r\n return button.className.match(RegExp(`(${buttonNames.join('|')})`))[0];\r\n }\r\n\r\n /**\r\n * Get butten type\r\n * @param {HTMLElement} target - event target element\r\n * @param {string} removeClass - remove class name\r\n * @param {string} addClass - add class name\r\n */\r\n changeClass(target, removeClass, addClass) {\r\n target.classList.remove(removeClass);\r\n target.classList.add(addClass);\r\n }\r\n\r\n /**\r\n * Interface method whose implementation is optional.\r\n * Returns the menu to its default state.\r\n */\r\n changeStandbyMode() {}\r\n\r\n /**\r\n * Interface method whose implementation is optional.\r\n * Executed when the menu starts.\r\n */\r\n changeStartMode() {}\r\n\r\n /**\r\n * Make submenu dom element\r\n * @param {Locale} locale - translate text\r\n * @param {string} name - submenu name\r\n * @param {Object} iconStyle - icon style\r\n * @param {*} templateHtml - template for SubMenuElement\r\n * @private\r\n */\r\n _makeSubMenuElement({ locale, name, iconStyle, makeSvgIcon, templateHtml }) {\r\n const iconSubMenu = document.createElement('div');\r\n iconSubMenu.className = `tui-image-editor-menu-${name}`;\r\n iconSubMenu.innerHTML = templateHtml({\r\n locale,\r\n iconStyle,\r\n makeSvgIcon,\r\n });\r\n\r\n this.subMenuElement.appendChild(iconSubMenu);\r\n }\r\n}\r\n\r\nexport default Submenu;\r\n"]},"metadata":{},"sourceType":"module"}