/* * Project Name : Visual Python * Description : GUI-based Python code generator * File Name : MenuGroup.js * Author : Black Logic * Note : Render and load menu group * License : GNU GPLv3 with Visual Python special exception * Date : 2021. 09. 13 * Change Date : */ //============================================================================ // [CLASS] MenuGroup //============================================================================ define([ '../com/component/Component', '../com/com_util', '../com/com_String', ], function(Component, com_util, com_String) { 'use strict'; //======================================================================== // Declare class //======================================================================== /** * MenuGroup */ class MenuGroup extends Component { constructor($target, state) { super($target, state); } _bindEvent() { var that = this; this.$target.on('click', function(evt) { var target = evt.target; if ($(target).parent().hasClass(that.uuid)) { var bodyTag = $('.' + that.uuid).find('.vp-menugroup-box'); if (bodyTag.is(':visible')) { bodyTag.hide(); } else { bodyTag.show(); // scroll to view $(target)[0].scrollIntoView({behavior: "smooth", block: "start"}); } evt.stopPropagation(); } }); } template() { var { id, name, desc, level, open, grid } = this.state; // open menu group on default? var openItemsAttribute = open && open==true? '': 'style="display:none;"' var isGrid = (grid == true); var page = new com_String(); page.appendFormatLine('