From aef10f79e6da40fe5a1452fc4cb46296d9d08bb5 Mon Sep 17 00:00:00 2001 From: Thomas Jang Date: Wed, 26 Apr 2017 09:06:43 +0900 Subject: [PATCH] PATCH@ https://github.com/ax5ui/ax5ui-menu/issues/6 --- src/ax5ui-menu/dist/ax5menu.js | 8 ++++---- src/ax5ui-menu/dist/ax5menu.min.js | 3 ++- src/ax5ui-menu/dist/ax5menu.min.js.map | 2 +- src/ax5ui-menu/src/ax5menu.js | 7 +++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ax5ui-menu/dist/ax5menu.js b/src/ax5ui-menu/dist/ax5menu.js index e71a57a9..f47173ac 100644 --- a/src/ax5ui-menu/dist/ax5menu.js +++ b/src/ax5ui-menu/dist/ax5menu.js @@ -8,7 +8,7 @@ UI.addClass({ className: "menu", - version: "1.4.25" + version: "${VERSION}" }, function () { /** * @class ax5.ui.menu @@ -365,13 +365,13 @@ } }); if (target) { - + if (typeof opt === "undefined") opt = {}; item = function (path) { if (!path) return false; var item = void 0; try { - item = Function("", "return this[" + path.substring(5).replace(/\./g, '].' + cfg.columnKeys.items + '[') + "];").call(opt.items); + item = Function("", "return this[" + path.substring(5).replace(/\./g, '].' + cfg.columnKeys.items + '[') + "];").call(opt.items || cfg.items); } catch (e) { console.log(ax5.info.getError("ax5menu", "501", "menuItemClick")); } @@ -650,7 +650,7 @@ opt = getOption["object"].call(this, { left: offset.left, top: offset.top + height - scrollTop }, opt); popup.call(self, opt, cfg.items[index][cfg.columnKeys.items], 0, 'root.' + target.getAttribute("data-menu-item-index")); // 0 is seq of queue - appEventAttach.call(self, true); // 이벤트 연결 + appEventAttach.call(self, true, {}); // 이벤트 연결 } target = null; diff --git a/src/ax5ui-menu/dist/ax5menu.min.js b/src/ax5ui-menu/dist/ax5menu.min.js index 1e7c88f0..7ba22fc4 100644 --- a/src/ax5ui-menu/dist/ax5menu.min.js +++ b/src/ax5ui-menu/dist/ax5menu.min.js @@ -1 +1,2 @@ -"use strict";!function(){var e,t=ax5.ui,n=ax5.util;t.addClass({className:"menu",version:"1.4.25"},function(){var i=function(){var i=this,u=void 0;this.instanceId=ax5.getGuid(),this.config={theme:"default",iconWidth:22,acceleratorWidth:100,menuBodyPadding:5,offset:{left:0,top:0},position:"fixed",animateTime:250,items:[],itemClickAndClose:!0,columnKeys:{label:"label",items:"items"}},this.openTimer=null,this.closeTimer=null,this.queue=[],this.menuBar={},this.state=void 0,u=this.config;var l=function(e,t){e?(jQuery(document).unbind("click.ax5menu-"+this.menuId).bind("click.ax5menu-"+this.menuId,o.bind(this,t)),jQuery(window).unbind("keydown.ax5menu-"+this.menuId).bind("keydown.ax5menu-"+this.menuId,function(e){e.which==ax5.info.eventKeys.ESC&&i.close()}),jQuery(window).unbind("resize.ax5menu-"+this.menuId).bind("resize.ax5menu-"+this.menuId,function(e){i.close()})):(jQuery(document).unbind("click.ax5menu-"+this.menuId),jQuery(window).unbind("keydown.ax5menu-"+this.menuId),jQuery(window).unbind("resize.ax5menu-"+this.menuId))},a=function(e,t){return e&&e.onStateChanged?e.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),i.state=t.state,e=null,t=null,!0},s=function(e){return this.onLoad&&this.onLoad.call(e,e),e=null,!0},c=function d(t,n,l,c){var o=t,r=void 0,h=void 0;return o.theme=t.theme||u.theme,o.cfg={icons:jQuery.extend({},u.icons),iconWidth:t.iconWidth||u.iconWidth,acceleratorWidth:t.acceleratorWidth||u.acceleratorWidth},n.forEach(function(e){e.html||e.divide?(e["@isMenu"]=!1,e.html&&(e["@html"]=e.html.call({item:e,config:u,opt:t}))):e["@isMenu"]=!0}),o[u.columnKeys.items]=n,o["@depth"]=l,o["@path"]=c||"root",o["@hasChild"]=function(){return this[u.columnKeys.items]&&this[u.columnKeys.items].length>0},r=jQuery(e.tmpl.get.call(this,"tmpl",o,u.columnKeys)),jQuery(document.body).append(r),h=this.queue.splice(l),h.forEach(function(e){e.$target.remove()}),this.queue.push({$target:r,data:jQuery.extend({},o)}),r.find("[data-menu-item-index]").bind("mouseover",function(){var e=this.getAttribute("data-menu-item-depth"),n=this.getAttribute("data-menu-item-index"),l=this.getAttribute("data-menu-item-path"),a=void 0,s=void 0,c=void 0,o=void 0,m=void 0,r=void 0;null!=e&&"undefined"!=typeof e&&(m=i.queue[e].data[u.columnKeys.items][n][u.columnKeys.items],r=i.queue[e].$target,r.find("[data-menu-item-index]").removeClass("hover"),jQuery(this).addClass("hover"),r.attr("data-selected-menu-item-index")!=n&&(r.attr("data-selected-menu-item-index",n),m&&m.length>0?(a=jQuery(this),s=a.offset(),c="fixed"==u.position?jQuery(document).scrollTop():0,o={"@parent":{left:s.left,top:s.top,width:a.outerWidth(),height:a.outerHeight()},left:s.left+a.outerWidth()-u.menuBodyPadding,top:s.top-u.menuBodyPadding-1-c},o=jQuery.extend(!0,t,o),d.call(i,o,m,Number(e)+1,l)):i.queue.splice(Number(e)+1).forEach(function(e){e.$target.remove()}))),e=null,n=null,l=null,a=null,s=null,c=null,o=null,m=null,r=null}),r.find("[data-menu-item-index]").bind("mouseout",function(){var e=this.getAttribute("data-menu-item-depth"),t=this.getAttribute("data-menu-item-index"),n=this.getAttribute("data-menu-item-path"),l=void 0;n&&(l=i.queue[e].data[u.columnKeys.items][t][u.columnKeys.items]),l&&l.length>0||jQuery(this).removeClass("hover")}),0==l&&(o.direction&&r.addClass("direction-"+o.direction),a.call(this,null,{self:this,items:n,parent:function(e){if(!e)return!1;var t=null;try{t=Function("","return this.config.items["+e.substring(5).replace(/\./g,"].items[")+"];").call(i)}catch(n){}return t}(o["@path"]),state:"popup"})),m.call(this,r,o),s.call(this,{self:this,items:n,element:r.get(0)}),o=null,r=null,h=null,t=null,n=null,l=null,c=null,this},o=function(e,t){var l=void 0,a=void 0;if(l=n.findParentNode(t.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0})){if(a=function(t){if(!t)return!1;var n=void 0;try{n=Function("","return this["+t.substring(5).replace(/\./g,"]."+u.columnKeys.items+"[")+"];").call(e.items)}catch(i){console.log(ax5.info.getError("ax5menu","501","menuItemClick"))}try{return n}finally{n=null}}(l.getAttribute("data-menu-item-path")),!a)return this;a.check&&(function(e){var t={checkbox:function(e){this.checked=!e},radio:function(t){var n=this.name;e.forEach(function(e){e.check&&"radio"===e.check.type&&e.check.name==n&&(e.check.checked=!1)}),this.checked=!t}};t[this.type]&&t[this.type].call(this,this.checked),t=null}.call(a.check,u.items),u.itemClickAndClose||i.queue.forEach(function(e){e.$target.find("[data-menu-item-index]").each(function(){var t=e.data[u.columnKeys.items][this.getAttribute("data-menu-item-index")];t.check&&jQuery(this).find(".item-checkbox-wrap").attr("data-item-checked",t.check.checked)})})),i.onClick&&i.onClick.call(a,a,e.param)&&i.close(),a[u.columnKeys.items]&&0!=a[u.columnKeys.items].length||!u.itemClickAndClose||i.close()}else i.close();return l=null,a=null,this},m=function(e,t){var n=jQuery(window),i=jQuery(document),l="fixed"==u.position?n.height():i.height(),a=n.width(),s=e.outerHeight(),c=e.outerWidth(),o=t.left,m=t.top,d=u.position||"fixed";return o+c>a&&(o=t["@parent"]?t["@parent"].left-c+u.menuBodyPadding:a-c),m+s>l&&(m=l-s),e.css({left:o,top:m,position:d}),e=null,t=null,n=null,i=null,l=null,a=null,s=null,c=null,o=null,m=null,d=null,this};this.init=function(){i.menuId=ax5.getGuid(),this.onStateChanged=u.onStateChanged,this.onClick=u.onClick,this.onLoad=u.onLoad,a.call(this,null,{self:this,state:"init"})},this.popup=function(){var e={event:function(e,t){e={left:e.clientX,top:"fixed"==u.position?e.clientY:e.pageY,width:u.width,theme:u.theme},e.left-=5,e.top-=5,u.offset&&(u.offset.left&&(e.left+=u.offset.left),u.offset.top&&(e.top+=u.offset.top)),t=jQuery.extend(!0,e,t);try{return t}finally{e=null}},object:function(e,t){e={left:e.left,top:e.top,width:e.width||u.width,theme:e.theme||u.theme},u.offset&&(u.offset.left&&(e.left+=u.offset.left),u.offset.top&&(e.top+=u.offset.top)),t=jQuery.extend(!0,e,t);try{return t}finally{e=null}}},t=function(e){e&&(u.theme=e)};return function(n,i){if(!n)return this;i=e["undefined"==typeof n.clientX?"object":"event"].call(this,n,i),t(i.theme);var a=[].concat(u.items),s=void 0;return i.items=a,i.filter&&(s=function(e){var t=[];return e.forEach(function(e){e.items&&e.items.length>0&&(e.items=s(e.items)),i.filter.call(e)&&t.push(e)}),t},i.items=a=s(a)),a.length&&(c.call(this,i,a,0),this.popupEventAttachTimer&&clearTimeout(this.popupEventAttachTimer),this.popupEventAttachTimer=setTimeout(function(){l.call(this,!0,i)}.bind(this),500)),n=null,this}}(),this.attach=function(){var t={object:function(e,t){e={left:e.left,top:e.top,width:e.width||u.width,theme:e.theme||u.theme,direction:e.direction||u.direction},t=jQuery.extend(!0,t,e);try{return t}finally{e=null,t=null}}},a=function(e,n,a){var s=jQuery(e),o=s.offset(),m=s.outerHeight(),d=Number(e.getAttribute("data-menu-item-index")),r="fixed"==u.position?jQuery(document).scrollTop():0;if(u.items&&u.items[d][u.columnKeys.items]&&u.items[d][u.columnKeys.items].length){if(i.menuBar.openedIndex==d)return"click"==a&&i.close(),!1;i.menuBar.target.find("[data-menu-item-index]").removeClass("hover"),i.menuBar.opened=!0,i.menuBar.openedIndex=d,s.attr("data-menu-item-opened","true"),s.addClass("hover"),u.offset&&(u.offset.left&&(o.left+=u.offset.left),u.offset.top&&(o.top+=u.offset.top)),n=t.object.call(this,{left:o.left,top:o.top+m-r},n),c.call(i,n,u.items[d][u.columnKeys.items],0,"root."+e.getAttribute("data-menu-item-index")),l.call(i,!0)}e=null,n=null,s=null,o=null,m=null,d=null,r=null},s=function(e,t,n){var l=jQuery(e),a=(l.offset(),l.outerHeight(),Number(e.getAttribute("data-menu-item-index")));"fixed"==u.position?jQuery(document).scrollTop():0;!u.items||u.items[a][u.columnKeys.items]&&0!=u.items[a][u.columnKeys.items].length||i.onClick&&i.onClick.call(u.items[a],u.items[a])};return function(t,l){var c,o={},m=u.items;return"undefined"==typeof l&&(l={}),o.theme=l.theme||u.theme,o.cfg={icons:jQuery.extend({},u.icons),iconWidth:l.iconWidth||u.iconWidth,acceleratorWidth:l.acceleratorWidth||u.acceleratorWidth},m.forEach(function(e){e.html||e.divide?(e["@isMenu"]=!1,e.html&&(e["@html"]=e.html.call({item:e,config:u,opt:l}))):e["@isMenu"]=!0}),o[u.columnKeys.items]=m,c=jQuery(e.tmpl.get.call(this,"tmplMenubar",o,u.columnKeys)),i.menuBar={target:jQuery(t),opened:!1},i.menuBar.target.html(c),i.menuBar.target.bind("click",function(e){if(!e)return this;var t=n.findParentNode(e.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0});t&&(s(t,l,"click"),a(t,l,"click")),t=null}),i.menuBar.target.bind("mouseover",function(e){if(!i.menuBar.opened)return!1;var t=n.findParentNode(e.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0});t&&a(t,l,"mouseover"),t=null}),t=null,l=null,o=null,m=null,c=null,this}}(),this.close=function(){return i.menuBar&&i.menuBar.target&&(i.menuBar.target.find("[data-menu-item-index]").removeClass("hover"),i.menuBar.opened=!1,i.menuBar.openedIndex=null),l.call(this,!1),this.queue.forEach(function(e){e.$target.remove()}),this.queue=[],a.call(this,null,{self:this,state:"close"}),this},this.getCheckValue=function(){var e={},t=function(i){for(var u=i.length;u--;)i[u].check&&i[u].check.checked&&(e[i[u].check.name]?(n.isString(e[i[u].check.name])&&(e[i[u].check.name]=[e[i[u].check.name]]),e[i[u].check.name].push(i[u].check.value)):e[i[u].check.name]=i[u].check.value),i[u].items&&i[u].items.length>0&&t(i[u].items)};t(u.items);try{return e}finally{e=null,t=null}},this.main=function(){t.menu_instance=t.menu_instance||[],t.menu_instance.push(this),arguments&&n.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return i}()),e=ax5.ui.menu}(),function(){var e=ax5.ui.menu,t=function(e){return'\n
\n
\n {{#'+e.items+'}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n \n {{#check}}\n \n {{/check}}\n {{^check}}\n \n {{/check}}\n \n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{'+e.label+'}}}\n {{#accelerator}}\n {{.}}\n {{/accelerator}}\n {{#@hasChild}}\n {{{cfg.icons.arrow}}}\n {{/@hasChild}}\n
\n {{/@isMenu}}\n\n {{/'+e.items+'}}\n
\n
\n
\n '},n=function(e){return'\n
\n
\n {{#'+e.items+'}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{'+e.label+"}}}\n
\n {{/@isMenu}}\n {{/"+e.items+"}}\n
\n
\n "};e.tmpl={tmpl:t,tmplMenubar:n,get:function(t,n,i){return ax5.mustache.render(e.tmpl[t].call(this,i),n)}}}(); \ No newline at end of file +"use strict";!function(){var e,t=ax5.ui,n=ax5.util;t.addClass({className:"menu",version:"${VERSION}"},function(){var i=function(){var i=this,u=void 0;this.instanceId=ax5.getGuid(),this.config={theme:"default",iconWidth:22,acceleratorWidth:100,menuBodyPadding:5,offset:{left:0,top:0},position:"fixed",animateTime:250,items:[],itemClickAndClose:!0,columnKeys:{label:"label",items:"items"}},this.openTimer=null,this.closeTimer=null,this.queue=[],this.menuBar={},this.state=void 0,u=this.config;var l=function(e,t){e?(jQuery(document).unbind("click.ax5menu-"+this.menuId).bind("click.ax5menu-"+this.menuId,o.bind(this,t)),jQuery(window).unbind("keydown.ax5menu-"+this.menuId).bind("keydown.ax5menu-"+this.menuId,function(e){e.which==ax5.info.eventKeys.ESC&&i.close()}),jQuery(window).unbind("resize.ax5menu-"+this.menuId).bind("resize.ax5menu-"+this.menuId,function(e){i.close()})):(jQuery(document).unbind("click.ax5menu-"+this.menuId),jQuery(window).unbind("keydown.ax5menu-"+this.menuId),jQuery(window).unbind("resize.ax5menu-"+this.menuId))},a=function(e,t){return e&&e.onStateChanged?e.onStateChanged.call(t,t):this.onStateChanged&&this.onStateChanged.call(t,t),i.state=t.state,e=null,t=null,!0},s=function(e){return this.onLoad&&this.onLoad.call(e,e),e=null,!0},c=function t(n,l,c,o){var d=n,r=void 0,h=void 0;return d.theme=n.theme||u.theme,d.cfg={icons:jQuery.extend({},u.icons),iconWidth:n.iconWidth||u.iconWidth,acceleratorWidth:n.acceleratorWidth||u.acceleratorWidth},l.forEach(function(e){e.html||e.divide?(e["@isMenu"]=!1,e.html&&(e["@html"]=e.html.call({item:e,config:u,opt:n}))):e["@isMenu"]=!0}),d[u.columnKeys.items]=l,d["@depth"]=c,d["@path"]=o||"root",d["@hasChild"]=function(){return this[u.columnKeys.items]&&this[u.columnKeys.items].length>0},r=jQuery(e.tmpl.get.call(this,"tmpl",d,u.columnKeys)),jQuery(document.body).append(r),h=this.queue.splice(c),h.forEach(function(e){e.$target.remove()}),this.queue.push({$target:r,data:jQuery.extend({},d)}),r.find("[data-menu-item-index]").bind("mouseover",function(){var e=this.getAttribute("data-menu-item-depth"),l=this.getAttribute("data-menu-item-index"),a=this.getAttribute("data-menu-item-path"),s=void 0,c=void 0,o=void 0,m=void 0,d=void 0,r=void 0;null!=e&&"undefined"!=typeof e&&(d=i.queue[e].data[u.columnKeys.items][l][u.columnKeys.items],r=i.queue[e].$target,r.find("[data-menu-item-index]").removeClass("hover"),jQuery(this).addClass("hover"),r.attr("data-selected-menu-item-index")!=l&&(r.attr("data-selected-menu-item-index",l),d&&d.length>0?(s=jQuery(this),c=s.offset(),o="fixed"==u.position?jQuery(document).scrollTop():0,m={"@parent":{left:c.left,top:c.top,width:s.outerWidth(),height:s.outerHeight()},left:c.left+s.outerWidth()-u.menuBodyPadding,top:c.top-u.menuBodyPadding-1-o},m=jQuery.extend(!0,n,m),t.call(i,m,d,Number(e)+1,a)):i.queue.splice(Number(e)+1).forEach(function(e){e.$target.remove()}))),e=null,l=null,a=null,s=null,c=null,o=null,m=null,d=null,r=null}),r.find("[data-menu-item-index]").bind("mouseout",function(){var e=this.getAttribute("data-menu-item-depth"),t=this.getAttribute("data-menu-item-index"),n=this.getAttribute("data-menu-item-path"),l=void 0;n&&(l=i.queue[e].data[u.columnKeys.items][t][u.columnKeys.items]),l&&l.length>0||jQuery(this).removeClass("hover")}),0==c&&(d.direction&&r.addClass("direction-"+d.direction),a.call(this,null,{self:this,items:l,parent:function(e){if(!e)return!1;var t=null;try{t=Function("","return this.config.items["+e.substring(5).replace(/\./g,"].items[")+"];").call(i)}catch(e){}return t}(d["@path"]),state:"popup"})),m.call(this,r,d),s.call(this,{self:this,items:l,element:r.get(0)}),d=null,r=null,h=null,n=null,l=null,c=null,o=null,this},o=function(e,t){var l=void 0,a=void 0;if(l=n.findParentNode(t.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0})){if("undefined"==typeof e&&(e={}),a=function(t){if(!t)return!1;var n=void 0;try{n=Function("","return this["+t.substring(5).replace(/\./g,"]."+u.columnKeys.items+"[")+"];").call(e.items||u.items)}catch(e){console.log(ax5.info.getError("ax5menu","501","menuItemClick"))}try{return n}finally{n=null}}(l.getAttribute("data-menu-item-path")),!a)return this;a.check&&(function(e){var t={checkbox:function(e){this.checked=!e},radio:function(t){var n=this.name;e.forEach(function(e){e.check&&"radio"===e.check.type&&e.check.name==n&&(e.check.checked=!1)}),this.checked=!t}};t[this.type]&&t[this.type].call(this,this.checked),t=null}.call(a.check,u.items),u.itemClickAndClose||i.queue.forEach(function(e){e.$target.find("[data-menu-item-index]").each(function(){var t=e.data[u.columnKeys.items][this.getAttribute("data-menu-item-index")];t.check&&jQuery(this).find(".item-checkbox-wrap").attr("data-item-checked",t.check.checked)})})),i.onClick&&i.onClick.call(a,a,e.param)&&i.close(),a[u.columnKeys.items]&&0!=a[u.columnKeys.items].length||!u.itemClickAndClose||i.close()}else i.close();return l=null,a=null,this},m=function(e,t){var n=jQuery(window),i=jQuery(document),l="fixed"==u.position?n.height():i.height(),a=n.width(),s=e.outerHeight(),c=e.outerWidth(),o=t.left,m=t.top,d=u.position||"fixed";return o+c>a&&(o=t["@parent"]?t["@parent"].left-c+u.menuBodyPadding:a-c),m+s>l&&(m=l-s),e.css({left:o,top:m,position:d}),e=null,t=null,n=null,i=null,l=null,a=null,s=null,c=null,o=null,m=null,d=null,this};this.init=function(){i.menuId=ax5.getGuid(),this.onStateChanged=u.onStateChanged,this.onClick=u.onClick,this.onLoad=u.onLoad,a.call(this,null,{self:this,state:"init"})},this.popup=function(){var e={event:function(e,t){e={left:e.clientX,top:"fixed"==u.position?e.clientY:e.pageY,width:u.width,theme:u.theme},e.left-=5,e.top-=5,u.offset&&(u.offset.left&&(e.left+=u.offset.left),u.offset.top&&(e.top+=u.offset.top)),t=jQuery.extend(!0,e,t);try{return t}finally{e=null}},object:function(e,t){e={left:e.left,top:e.top,width:e.width||u.width,theme:e.theme||u.theme},u.offset&&(u.offset.left&&(e.left+=u.offset.left),u.offset.top&&(e.top+=u.offset.top)),t=jQuery.extend(!0,e,t);try{return t}finally{e=null}}},t=function(e){e&&(u.theme=e)};return function(n,i){if(!n)return this;i=e["undefined"==typeof n.clientX?"object":"event"].call(this,n,i),t(i.theme);var a=[].concat(u.items),s=void 0;return i.items=a,i.filter&&(s=function(e){var t=[];return e.forEach(function(e){e.items&&e.items.length>0&&(e.items=s(e.items)),i.filter.call(e)&&t.push(e)}),t},i.items=a=s(a)),a.length&&(c.call(this,i,a,0),this.popupEventAttachTimer&&clearTimeout(this.popupEventAttachTimer),this.popupEventAttachTimer=setTimeout(function(){l.call(this,!0,i)}.bind(this),500)),n=null,this}}(),this.attach=function(){var t={object:function(e,t){e={left:e.left,top:e.top,width:e.width||u.width,theme:e.theme||u.theme,direction:e.direction||u.direction},t=jQuery.extend(!0,t,e);try{return t}finally{e=null,t=null}}},a=function(e,n,a){var s=jQuery(e),o=s.offset(),m=s.outerHeight(),d=Number(e.getAttribute("data-menu-item-index")),r="fixed"==u.position?jQuery(document).scrollTop():0;if(u.items&&u.items[d][u.columnKeys.items]&&u.items[d][u.columnKeys.items].length){if(i.menuBar.openedIndex==d)return"click"==a&&i.close(),!1;i.menuBar.target.find("[data-menu-item-index]").removeClass("hover"),i.menuBar.opened=!0,i.menuBar.openedIndex=d,s.attr("data-menu-item-opened","true"),s.addClass("hover"),u.offset&&(u.offset.left&&(o.left+=u.offset.left),u.offset.top&&(o.top+=u.offset.top)),n=t.object.call(this,{left:o.left,top:o.top+m-r},n),c.call(i,n,u.items[d][u.columnKeys.items],0,"root."+e.getAttribute("data-menu-item-index")),l.call(i,!0,{})}e=null,n=null,s=null,o=null,m=null,d=null,r=null},s=function(e,t,n){var l=jQuery(e),a=(l.offset(),l.outerHeight(),Number(e.getAttribute("data-menu-item-index")));"fixed"==u.position?jQuery(document).scrollTop():0;!u.items||u.items[a][u.columnKeys.items]&&0!=u.items[a][u.columnKeys.items].length||i.onClick&&i.onClick.call(u.items[a],u.items[a])};return function(t,l){var c,o={},m=u.items;return"undefined"==typeof l&&(l={}),o.theme=l.theme||u.theme,o.cfg={icons:jQuery.extend({},u.icons),iconWidth:l.iconWidth||u.iconWidth,acceleratorWidth:l.acceleratorWidth||u.acceleratorWidth},m.forEach(function(e){e.html||e.divide?(e["@isMenu"]=!1,e.html&&(e["@html"]=e.html.call({item:e,config:u,opt:l}))):e["@isMenu"]=!0}),o[u.columnKeys.items]=m,c=jQuery(e.tmpl.get.call(this,"tmplMenubar",o,u.columnKeys)),i.menuBar={target:jQuery(t),opened:!1},i.menuBar.target.html(c),i.menuBar.target.bind("click",function(e){if(!e)return this;var t=n.findParentNode(e.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0});t&&(s(t,l,"click"),a(t,l,"click")),t=null}),i.menuBar.target.bind("mouseover",function(e){if(!i.menuBar.opened)return!1;var t=n.findParentNode(e.target,function(e){if(e.getAttribute("data-menu-item-index"))return!0});t&&a(t,l,"mouseover"),t=null}),t=null,l=null,o=null,m=null,c=null,this}}(),this.close=function(){return i.menuBar&&i.menuBar.target&&(i.menuBar.target.find("[data-menu-item-index]").removeClass("hover"),i.menuBar.opened=!1,i.menuBar.openedIndex=null),l.call(this,!1),this.queue.forEach(function(e){e.$target.remove()}),this.queue=[],a.call(this,null,{self:this,state:"close"}),this},this.getCheckValue=function(){var e={},t=function(i){for(var u=i.length;u--;)i[u].check&&i[u].check.checked&&(e[i[u].check.name]?(n.isString(e[i[u].check.name])&&(e[i[u].check.name]=[e[i[u].check.name]]),e[i[u].check.name].push(i[u].check.value)):e[i[u].check.name]=i[u].check.value),i[u].items&&i[u].items.length>0&&t(i[u].items)};t(u.items);try{return e}finally{e=null,t=null}},this.main=function(){t.menu_instance=t.menu_instance||[],t.menu_instance.push(this),arguments&&n.isObject(arguments[0])&&this.setConfig(arguments[0])}.apply(this,arguments)};return i}()),e=ax5.ui.menu}(),function(){var e=ax5.ui.menu,t=function(e){return'\n
\n
\n {{#'+e.items+'}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n \n {{#check}}\n \n {{/check}}\n {{^check}}\n \n {{/check}}\n \n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{'+e.label+'}}}\n {{#accelerator}}\n {{.}}\n {{/accelerator}}\n {{#@hasChild}}\n {{{cfg.icons.arrow}}}\n {{/@hasChild}}\n
\n {{/@isMenu}}\n\n {{/'+e.items+'}}\n
\n
\n
\n '},n=function(e){return'\n
\n
\n {{#'+e.items+'}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{'+e.label+"}}}\n
\n {{/@isMenu}}\n {{/"+e.items+"}}\n
\n
\n "};e.tmpl={tmpl:t,tmplMenubar:n,get:function(t,n,i){return ax5.mustache.render(e.tmpl[t].call(this,i),n)}}}(); +//# sourceMappingURL=ax5menu.min.js.map diff --git a/src/ax5ui-menu/dist/ax5menu.min.js.map b/src/ax5ui-menu/dist/ax5menu.min.js.map index 9ed326ef..0ec28bb5 100644 --- a/src/ax5ui-menu/dist/ax5menu.min.js.map +++ b/src/ax5ui-menu/dist/ax5menu.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["ax5menu.js","ax5menu-tmpl.js"],"names":["MENU","UI","ax5","ui","U","util","addClass","className","version","ax5menu","self","this","cfg","instanceId","getGuid","config","theme","iconWidth","acceleratorWidth","menuBodyPadding","offset","left","top","position","animateTime","items","itemClickAndClose","columnKeys","label","openTimer","closeTimer","queue","menuBar","state","undefined","appEventAttach","active","opt","jQuery","document","unbind","menuId","bind","clickItem","window","e","which","info","eventKeys","ESC","close","onStateChanged","opts","that","call","onLoad","popup","depth","path","data","activeMenu","removed","icons","extend","forEach","n","html","divide","item","length","tmpl","get","body","append","splice","$target","remove","push","find","getAttribute","index","$this","scrollTop","childOpt","_items","_activeMenu","removeClass","attr","@parent","width","outerWidth","height","outerHeight","Number","direction","parent","Function","substring","replace","align","element","target","findParentNode","console","log","getError","check","setValue","checkbox","value","checked","radio","name","type","each","onClick","param","$window","$document","wh","ww","h","w","l","t","css","init","getOption","event","clientX","clientY","pageY","object","updateTheme","concat","filteringItem","filter","arr","popupEventAttachTimer","clearTimeout","setTimeout","attach","popUpChildMenu","eType","openedIndex","opened","clickParentMenu","el","getCheckValue","checkItems","collectItem","i","isString","main","menu_instance","arguments","isObject","setConfig","apply","menu","tmplMenubar","tmplName","mustache","render"],"mappings":"cACA,WACA,GAEAA,GAFAC,EAAAC,IAAAC,GACAC,EAAAF,IAAAG,IAGAJ,GAAAK,UACAC,UAAA,OACAC,QAAA,cACA,WA4HA,GAAAC,GAAA,WACA,GAAAC,GAAAC,KACAC,EAAAA,MAEAD,MAAAE,WAAAX,IAAAY,UACAH,KAAAI,QACAC,MAAA,UACAC,UAAA,GACAC,iBAAA,IACAC,gBAAA,EAEAC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,GAAA4J,KAEAzF,EAAA,SAAA3C,GACA,MAAA,4JAGAA,EAAAF,MAHA,s0CAyBAE,EAAAC,MAzBA,whBAmCAD,EAAAF,MAnCA,mGAyCAuI,EAAA,SAAArI,GACA,MAAA,gHAGAA,EAAAF,MAHA,myBAiBAE,EAAAC,MAjBA,gGAoBAD,EAAAF,MApBA,mDA0BAzB,GAAAsE,MACAA,KAAAA,EACA0F,YAAAA,EAEAzF,IAAA,SAAA0F,EAAAtG,EAAAhC,GACA,MAAAzB,KAAAgK,SAAAC,OAAAnK,EAAAsE,KAAA2F,GAAA3G,KAAA3C,KAAAgB,GAAAgC","file":"ax5menu.min.js","sourcesContent":["// ax5.ui.menu\n(function () {\n var UI = ax5.ui;\n var U = ax5.util;\n var MENU;\n\n UI.addClass({\n className: \"menu\",\n version: \"${VERSION}\"\n }, (function () {\n /**\n * @class ax5.ui.menu\n * @classdesc\n * @author tom@axisj.com\n * @example\n * ```js\n * var menu = new ax5.ui.menu({\n * theme: 'primary',\n * iconWidth: 20,\n * acceleratorWidth: 100,\n * itemClickAndClose: false,\n * icons: {\n * 'arrow': ''\n * },\n * columnKeys: {\n * label: 'name',\n * items: 'chidren'\n * },\n * items: [\n * {\n * icon: '',\n * name: \"Menu Parent 0\",\n * chidren: [\n * {\n * check: {\n * type: 'checkbox',\n * name: 'A',\n * value: '0',\n * checked: false\n * },\n * name: \"Menu Z\",\n * data: {},\n * role: \"\",\n * accelerator: \"CmdOrCtrl+Z\"\n * },\n * {\n * check: {\n * type: 'checkbox',\n * name: 'A',\n * value: '1',\n * checked: true\n * },\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ],\n * filterType: \"A\"\n * },\n * {\n * divide: true,\n * filterType: \"A\"\n * },\n * {\n * icon: '',\n * name: \"Menu Parent 1\",\n * chidren: [\n * {\n * name: \"Menu Z\",\n * data: {},\n * role: \"\",\n * chidren: [\n * {\n * name: \"Menu Z\",\n * data: {},\n * role: \"\"\n * },\n * {\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ]\n * },\n * {\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ],\n * filterType: \"A\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '1',\n * checked: false\n * },\n * icon: '',\n * name: \"Menu Parent 2\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '2',\n * checked: false\n * },\n * name: \"Menu Parent 3\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '3',\n * checked: false\n * },\n * name: \"Menu Parent 4\"\n * },\n * {divide: true},\n * {\n * html: function () {\n * return '
' +\n * ' ' +\n * '' +\n * '
';\n * }\n * }\n * ]\n * });\n * ```\n */\n var ax5menu = function () {\n let self = this,\n cfg;\n\n this.instanceId = ax5.getGuid();\n this.config = {\n theme: \"default\",\n iconWidth: 22,\n acceleratorWidth: 100,\n menuBodyPadding: 5,\n //direction: \"top\", // top|bottom\n offset: {left: 0, top: 0},\n position: \"fixed\",\n animateTime: 250,\n items: [],\n itemClickAndClose: true,\n columnKeys: {\n label: 'label',\n items: 'items'\n }\n };\n\n this.openTimer = null;\n this.closeTimer = null;\n this.queue = [];\n this.menuBar = {};\n this.state = undefined;\n\n cfg = this.config;\n\n let appEventAttach = function (active, opt) {\n if (active) {\n jQuery(document).unbind(\"click.ax5menu-\" + this.menuId).bind(\"click.ax5menu-\" + this.menuId, clickItem.bind(this, opt));\n jQuery(window).unbind(\"keydown.ax5menu-\" + this.menuId).bind(\"keydown.ax5menu-\" + this.menuId, function (e) {\n if (e.which == ax5.info.eventKeys.ESC) {\n self.close();\n }\n });\n jQuery(window).unbind(\"resize.ax5menu-\" + this.menuId).bind(\"resize.ax5menu-\" + this.menuId, function (e) {\n self.close();\n });\n }\n else {\n jQuery(document).unbind(\"click.ax5menu-\" + this.menuId);\n jQuery(window).unbind(\"keydown.ax5menu-\" + this.menuId);\n jQuery(window).unbind(\"resize.ax5menu-\" + this.menuId);\n }\n },\n onStateChanged = function (opts, that) {\n if (opts && opts.onStateChanged) {\n opts.onStateChanged.call(that, that);\n }\n else if (this.onStateChanged) {\n this.onStateChanged.call(that, that);\n }\n\n self.state = that.state;\n opts = null;\n that = null;\n return true;\n },\n onLoad = function (that) {\n if (this.onLoad) {\n this.onLoad.call(that, that);\n }\n\n that = null;\n return true;\n },\n popup = function (opt, items, depth, path) {\n let data = opt,\n activeMenu,\n removed\n ;\n\n data.theme = opt.theme || cfg.theme;\n data.cfg = {\n icons: jQuery.extend({}, cfg.icons),\n iconWidth: opt.iconWidth || cfg.iconWidth,\n acceleratorWidth: opt.acceleratorWidth || cfg.acceleratorWidth\n };\n\n items.forEach(function (n) {\n if (n.html || n.divide) {\n n['@isMenu'] = false;\n if (n.html) {\n n['@html'] = n.html.call({\n item: n,\n config: cfg,\n opt: opt\n });\n }\n }\n else {\n n['@isMenu'] = true;\n }\n });\n\n data[cfg.columnKeys.items] = items;\n data['@depth'] = depth;\n data['@path'] = path || \"root\";\n data['@hasChild'] = function () {\n return this[cfg.columnKeys.items] && this[cfg.columnKeys.items].length > 0;\n };\n activeMenu = jQuery(MENU.tmpl.get.call(this, \"tmpl\", data, cfg.columnKeys));\n jQuery(document.body).append(activeMenu);\n\n // remove queue\n\n removed = this.queue.splice(depth);\n removed.forEach(function (n) {\n n.$target.remove();\n });\n\n this.queue.push({\n '$target': activeMenu,\n 'data': jQuery.extend({}, data)\n });\n\n activeMenu.find('[data-menu-item-index]').bind(\"mouseover\", function () {\n let depth = this.getAttribute(\"data-menu-item-depth\"),\n index = this.getAttribute(\"data-menu-item-index\"),\n path = this.getAttribute(\"data-menu-item-path\"),\n $this,\n offset,\n scrollTop,\n childOpt,\n _items,\n _activeMenu;\n\n if (depth != null && typeof depth != \"undefined\") {\n _items = self.queue[depth].data[cfg.columnKeys.items][index][cfg.columnKeys.items];\n _activeMenu = self.queue[depth].$target;\n _activeMenu.find('[data-menu-item-index]').removeClass(\"hover\");\n jQuery(this).addClass(\"hover\");\n\n if (_activeMenu.attr(\"data-selected-menu-item-index\") != index) {\n _activeMenu.attr(\"data-selected-menu-item-index\", index);\n\n if (_items && _items.length > 0) {\n\n $this = jQuery(this);\n offset = $this.offset();\n scrollTop = (cfg.position == \"fixed\" ? jQuery(document).scrollTop() : 0);\n childOpt = {\n '@parent': {\n left: offset.left,\n top: offset.top,\n width: $this.outerWidth(),\n height: $this.outerHeight()\n },\n left: offset.left + $this.outerWidth() - cfg.menuBodyPadding,\n top: offset.top - cfg.menuBodyPadding - 1 - scrollTop\n };\n\n childOpt = jQuery.extend(true, opt, childOpt);\n popup.call(self, childOpt, _items, (Number(depth) + 1), path);\n }\n else {\n self.queue.splice(Number(depth) + 1).forEach(function (n) {\n n.$target.remove();\n });\n }\n }\n }\n\n depth = null;\n index = null;\n path = null;\n $this = null;\n offset = null;\n scrollTop = null;\n childOpt = null;\n _items = null;\n _activeMenu = null;\n });\n\n // mouse out\n activeMenu.find('[data-menu-item-index]').bind(\"mouseout\", function () {\n let depth = this.getAttribute(\"data-menu-item-depth\"),\n index = this.getAttribute(\"data-menu-item-index\"),\n path = this.getAttribute(\"data-menu-item-path\"),\n _items;\n\n if (path) {\n _items = self.queue[depth].data[cfg.columnKeys.items][index][cfg.columnKeys.items];\n }\n if (_items && _items.length > 0) {\n\n } else {\n jQuery(this).removeClass(\"hover\");\n }\n });\n\n // is Root\n if (depth == 0) {\n if (data.direction) activeMenu.addClass(\"direction-\" + data.direction);\n onStateChanged.call(this, null, {\n self: this,\n items: items,\n parent: (function (path) {\n if (!path) return false;\n var item = null;\n try {\n item = (Function(\"\", \"return this.config.items[\" + path.substring(5).replace(/\\./g, '].items[') + \"];\")).call(self);\n } catch (e) {\n\n }\n return item;\n })(data['@path']),\n state: \"popup\"\n });\n }\n\n align.call(this, activeMenu, data);\n onLoad.call(this, {\n self: this,\n items: items,\n element: activeMenu.get(0)\n });\n\n data = null;\n activeMenu = null;\n removed = null;\n opt = null;\n items = null;\n depth = null;\n path = null;\n\n return this;\n },\n clickItem = function (opt, e) {\n let target, item;\n\n target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) {\n\n item = (function (path) {\n if (!path) return false;\n let item;\n\n try {\n item = (Function(\"\", \"return this[\" + path.substring(5).replace(/\\./g, '].' + cfg.columnKeys.items + '[') + \"];\")).call(opt.items);\n } catch (e) {\n console.log(ax5.info.getError(\"ax5menu\", \"501\", \"menuItemClick\"));\n }\n\n try {\n return item;\n }\n finally {\n item = null;\n }\n })(target.getAttribute(\"data-menu-item-path\"));\n\n if (!item) return this;\n\n if (item.check) {\n (function (items) {\n var setValue = {\n 'checkbox': function (value) {\n this.checked = !value;\n },\n 'radio': function (value) {\n var name = this.name;\n items.forEach(function (n) {\n if (n.check && n.check.type === 'radio' && n.check.name == name) {\n n.check.checked = false;\n }\n });\n this.checked = !value;\n }\n };\n if (setValue[this.type]) setValue[this.type].call(this, this.checked);\n setValue = null;\n }).call(item.check, cfg.items);\n\n if (!cfg.itemClickAndClose) {\n self.queue.forEach(function (n) {\n n.$target.find('[data-menu-item-index]').each(function () {\n var item = n.data[cfg.columnKeys.items][this.getAttribute(\"data-menu-item-index\")];\n if (item.check) {\n jQuery(this).find(\".item-checkbox-wrap\").attr(\"data-item-checked\", item.check.checked);\n }\n });\n });\n }\n }\n\n if (self.onClick) {\n if (self.onClick.call(item, item, opt.param)) {\n self.close();\n }\n }\n if ((!item[cfg.columnKeys.items] || item[cfg.columnKeys.items].length == 0) && cfg.itemClickAndClose) self.close();\n }\n else {\n self.close();\n }\n\n target = null;\n item = null;\n return this;\n },\n align = function (activeMenu, data) {\n let $window = jQuery(window),\n $document = jQuery(document),\n wh = (cfg.position == \"fixed\") ? $window.height() : $document.height(),\n ww = $window.width(),\n h = activeMenu.outerHeight(),\n w = activeMenu.outerWidth(),\n l = data.left,\n t = data.top,\n position = cfg.position || \"fixed\";\n\n if (l + w > ww) {\n if (data['@parent']) {\n l = data['@parent'].left - w + cfg.menuBodyPadding;\n }\n else {\n l = ww - w;\n }\n }\n\n if (t + h > wh) {\n t = wh - h;\n }\n\n activeMenu.css({left: l, top: t, position: position});\n\n activeMenu = null;\n data = null;\n $window = null;\n $document = null;\n wh = null;\n ww = null;\n h = null;\n w = null;\n l = null;\n t = null;\n position = null;\n return this;\n };\n\n /// private end\n\n this.init = function () {\n self.menuId = ax5.getGuid();\n\n /**\n * config에 선언된 이벤트 함수들을 this로 이동시켜 주어 나중에 인스턴스.on... 으로 처리 가능 하도록 변경\n */\n this.onStateChanged = cfg.onStateChanged;\n this.onClick = cfg.onClick;\n this.onLoad = cfg.onLoad;\n\n onStateChanged.call(this, null, {\n self: this,\n state: \"init\"\n });\n };\n\n /**\n * @method ax5.ui.menu.popup\n * @param {Event|Object} e - Event or Object\n * @param {Object} [opt]\n * @param {String} [opt.theme]\n * @param {Function} [opt.filter]\n * @returns {ax5.ui.menu} this\n */\n this.popup = (function () {\n\n let getOption = {\n 'event': function (e, opt) {\n //var xOffset = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);\n //var yOffset = Math.max(document.documentElement.scrollTop, document.body.scrollTop);\n //console.log(e.pageY);\n\n e = {\n left: e.clientX,\n top: (cfg.position == \"fixed\") ? e.clientY : e.pageY,\n width: cfg.width,\n theme: cfg.theme\n };\n\n e.left -= 5;\n e.top -= 5;\n\n if (cfg.offset) {\n if (cfg.offset.left) e.left += cfg.offset.left;\n if (cfg.offset.top) e.top += cfg.offset.top;\n }\n opt = jQuery.extend(true, e, opt);\n\n try {\n return opt;\n }\n finally {\n e = null;\n //opt = null;\n }\n },\n 'object': function (e, opt) {\n e = {\n left: e.left,\n top: e.top,\n width: e.width || cfg.width,\n theme: e.theme || cfg.theme\n };\n\n if (cfg.offset) {\n if (cfg.offset.left) e.left += cfg.offset.left;\n if (cfg.offset.top) e.top += cfg.offset.top;\n }\n\n opt = jQuery.extend(true, e, opt);\n\n try {\n return opt;\n }\n finally {\n e = null;\n //opt = null;\n }\n }\n },\n updateTheme = function (theme) {\n if (theme) cfg.theme = theme;\n };\n\n return function (e, opt) {\n\n if (!e) return this;\n opt = getOption[((typeof e.clientX == \"undefined\") ? \"object\" : \"event\")].call(this, e, opt);\n updateTheme(opt.theme);\n\n let items = [].concat(cfg.items),\n filteringItem;\n opt.items = items;\n\n if (opt.filter) {\n filteringItem = function (_items) {\n let arr = [];\n _items.forEach(function (n) {\n if (n.items && n.items.length > 0) {\n n.items = filteringItem(n.items);\n }\n if (opt.filter.call(n)) {\n arr.push(n);\n }\n });\n return arr;\n };\n opt.items = items = filteringItem(items);\n }\n\n if (items.length) {\n popup.call(this, opt, items, 0); // 0 is seq of queue\n\n if (this.popupEventAttachTimer) clearTimeout(this.popupEventAttachTimer);\n this.popupEventAttachTimer = setTimeout((function () {\n appEventAttach.call(this, true, opt); // 이벤트 연결\n }).bind(this), 500);\n }\n\n e = null;\n return this;\n }\n })();\n\n /**\n * @method ax5.ui.menu.attach\n * @param {Element|jQueryObject} el\n * @returns {ax5.ui.menu} this\n */\n this.attach = (function () {\n\n var getOption = {\n 'object': function (e, opt) {\n e = {\n left: e.left,\n top: e.top,\n width: e.width || cfg.width,\n theme: e.theme || cfg.theme,\n direction: e.direction || cfg.direction\n };\n opt = jQuery.extend(true, opt, e);\n\n try {\n return opt;\n }\n finally {\n e = null;\n opt = null;\n }\n }\n };\n\n var popUpChildMenu = function (target, opt, eType) {\n var\n $target = jQuery(target),\n offset = $target.offset(),\n height = $target.outerHeight(),\n index = Number(target.getAttribute(\"data-menu-item-index\")),\n scrollTop = (cfg.position == \"fixed\") ? jQuery(document).scrollTop() : 0;\n\n\n if (cfg.items && cfg.items[index][cfg.columnKeys.items] && cfg.items[index][cfg.columnKeys.items].length) {\n\n if (self.menuBar.openedIndex == index) {\n if (eType == \"click\") self.close();\n return false;\n }\n\n self.menuBar.target.find('[data-menu-item-index]').removeClass(\"hover\");\n self.menuBar.opened = true;\n self.menuBar.openedIndex = index;\n\n $target.attr(\"data-menu-item-opened\", \"true\");\n $target.addClass(\"hover\");\n\n if (cfg.offset) {\n if (cfg.offset.left) offset.left += cfg.offset.left;\n if (cfg.offset.top) offset.top += cfg.offset.top;\n }\n\n opt = getOption[\"object\"].call(this, {left: offset.left, top: offset.top + height - scrollTop}, opt);\n\n popup.call(self, opt, cfg.items[index][cfg.columnKeys.items], 0, 'root.' + target.getAttribute(\"data-menu-item-index\")); // 0 is seq of queue\n appEventAttach.call(self, true); // 이벤트 연결\n }\n\n target = null;\n opt = null;\n $target = null;\n offset = null;\n height = null;\n index = null;\n scrollTop = null;\n };\n var clickParentMenu = function (target, opt, eType) {\n var\n $target = jQuery(target),\n offset = $target.offset(),\n height = $target.outerHeight(),\n index = Number(target.getAttribute(\"data-menu-item-index\")),\n scrollTop = (cfg.position == \"fixed\") ? jQuery(document).scrollTop() : 0;\n if (cfg.items && (!cfg.items[index][cfg.columnKeys.items] || cfg.items[index][cfg.columnKeys.items].length == 0)) {\n if (self.onClick) {\n self.onClick.call(cfg.items[index], cfg.items[index]);\n }\n }\n };\n\n return function (el, opt) {\n var\n data = {},\n items = cfg.items,\n activeMenu;\n\n if (typeof opt === \"undefined\") opt = {};\n\n data.theme = opt.theme || cfg.theme;\n data.cfg = {\n icons: jQuery.extend({}, cfg.icons),\n iconWidth: opt.iconWidth || cfg.iconWidth,\n acceleratorWidth: opt.acceleratorWidth || cfg.acceleratorWidth\n };\n\n items.forEach(function (n) {\n if (n.html || n.divide) {\n n['@isMenu'] = false;\n if (n.html) {\n n['@html'] = n.html.call({\n item: n,\n config: cfg,\n opt: opt\n });\n }\n }\n else {\n n['@isMenu'] = true;\n }\n });\n\n data[cfg.columnKeys.items] = items;\n\n activeMenu = jQuery(MENU.tmpl.get.call(this, \"tmplMenubar\", data, cfg.columnKeys));\n self.menuBar = {\n target: jQuery(el),\n opened: false\n };\n self.menuBar.target.html(activeMenu);\n\n // click, mouseover\n self.menuBar.target.bind(\"click\", function (e) {\n if (!e) return this;\n var target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) {\n clickParentMenu(target, opt, \"click\");\n popUpChildMenu(target, opt, \"click\");\n }\n\n target = null;\n });\n self.menuBar.target.bind(\"mouseover\", function (e) {\n if (!self.menuBar.opened) return false;\n var target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) popUpChildMenu(target, opt, \"mouseover\");\n\n target = null;\n });\n\n el = null;\n opt = null;\n data = null;\n items = null;\n activeMenu = null;\n\n return this;\n }\n })();\n\n /**\n * @method ax5.ui.menu.close\n * @returns {ax5.ui.menu} this\n */\n this.close = function () {\n\n if (self.menuBar && self.menuBar.target) {\n self.menuBar.target.find('[data-menu-item-index]').removeClass(\"hover\");\n self.menuBar.opened = false;\n self.menuBar.openedIndex = null;\n }\n\n appEventAttach.call(this, false); // 이벤트 제거\n\n this.queue.forEach(function (n) {\n n.$target.remove();\n });\n this.queue = [];\n\n onStateChanged.call(this, null, {\n self: this,\n state: \"close\"\n });\n\n return this;\n };\n\n /**\n * @method ax5.ui.menu.getCheckValue\n * @returns {Object} statusCheckItem\n */\n this.getCheckValue = function () {\n var checkItems = {},\n collectItem = function (items) {\n var i = items.length;\n while (i--) {\n if (items[i].check && items[i].check.checked) {\n if (!checkItems[items[i].check.name]) checkItems[items[i].check.name] = items[i].check.value;\n else {\n if (U.isString(checkItems[items[i].check.name])) checkItems[items[i].check.name] = [checkItems[items[i].check.name]];\n checkItems[items[i].check.name].push(items[i].check.value);\n }\n }\n if (items[i].items && items[i].items.length > 0) collectItem(items[i].items);\n }\n };\n\n collectItem(cfg.items);\n\n try {\n return checkItems;\n }\n finally {\n checkItems = null;\n collectItem = null;\n }\n };\n\n // 클래스 생성자\n this.main = (function () {\n\n UI.menu_instance = UI.menu_instance || [];\n UI.menu_instance.push(this);\n\n if (arguments && U.isObject(arguments[0])) {\n this.setConfig(arguments[0]);\n }\n }).apply(this, arguments);\n };\n return ax5menu;\n })());\n\n MENU = ax5.ui.menu;\n})();\n\n// todo : menu 드랍다운 아이콘 설정 기능 추가","// ax5.ui.menu.tmpl\n(function () {\n var MENU = ax5.ui.menu;\n \n var tmpl = function (columnKeys) {\n return `\n
\n
\n {{#${columnKeys.items}}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n \n {{#check}}\n \n {{/check}}\n {{^check}}\n \n {{/check}}\n \n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{${columnKeys.label}}}}\n {{#accelerator}}\n {{.}}\n {{/accelerator}}\n {{#@hasChild}}\n {{{cfg.icons.arrow}}}\n {{/@hasChild}}\n
\n {{/@isMenu}}\n\n {{/${columnKeys.items}}}\n
\n
\n
\n `;\n };\n var tmplMenubar = function (columnKeys) {\n return `\n
\n
\n {{#${columnKeys.items}}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{${columnKeys.label}}}}\n
\n {{/@isMenu}}\n {{/${columnKeys.items}}}\n
\n
\n `;\n };\n\n MENU.tmpl = {\n \"tmpl\" : tmpl,\n \"tmplMenubar\" : tmplMenubar,\n\n get: function (tmplName, data, columnKeys) {\n return ax5.mustache.render(MENU.tmpl[tmplName].call(this, columnKeys), data);\n }\n };\n})();"]} \ No newline at end of file +{"version":3,"sources":["ax5menu.js","ax5menu-tmpl.js"],"names":["MENU","UI","ax5","ui","U","util","addClass","className","version","ax5menu","self","this","cfg","instanceId","getGuid","config","theme","iconWidth","acceleratorWidth","menuBodyPadding","offset","left","top","position","animateTime","items","itemClickAndClose","columnKeys","label","openTimer","closeTimer","queue","menuBar","state","undefined","appEventAttach","active","opt","jQuery","document","unbind","menuId","bind","clickItem","window","e","which","info","eventKeys","ESC","close","onStateChanged","opts","that","call","onLoad","popup","depth","path","data","activeMenu","removed","icons","extend","forEach","n","html","divide","item","length","tmpl","get","body","append","splice","$target","remove","push","find","getAttribute","index","$this","scrollTop","childOpt","_items","_activeMenu","removeClass","attr","@parent","width","outerWidth","height","outerHeight","Number","direction","parent","Function","substring","replace","align","element","target","findParentNode","console","log","getError","check","setValue","checkbox","value","checked","radio","name","type","each","onClick","param","$window","$document","wh","ww","h","w","l","t","css","init","getOption","event","clientX","clientY","pageY","object","updateTheme","concat","filteringItem","filter","arr","popupEventAttachTimer","clearTimeout","setTimeout","attach","popUpChildMenu","eType","openedIndex","opened","clickParentMenu","el","getCheckValue","checkItems","collectItem","i","isString","main","menu_instance","arguments","isObject","setConfig","apply","menu","tmplMenubar","tmplName","mustache","render"],"mappings":"cACA,WACA,GAEAA,GAFAC,EAAAC,IAAAC,GACAC,EAAAF,IAAAG,IAGAJ,GAAAK,UACAC,UAAA,OACAC,QAAA,cACA,WA4HA,GAAAC,GAAA,WACA,GAAAC,GAAAC,KACAC,EAAAA,MAEAD,MAAAE,WAAAX,IAAAY,UACAH,KAAAI,QACAC,MAAA,UACAC,UAAA,GACAC,iBAAA,IACAC,gBAAA,EAEAC,QAAAC,KAAA,EAAAC,IAAA,GACAC,SAAA,QACAC,YAAA,IACAC,SACAC,mBAAA,EACAC,YACAC,MAAA,QACAH,MAAA,UAIAd,KAAAkB,UAAA,KACAlB,KAAAmB,WAAA,KACAnB,KAAAoB,SACApB,KAAAqB,WACArB,KAAAsB,MAAAC,OAEAtB,EAAAD,KAAAI,MAEA,IAAAoB,GAAA,SAAAC,EAAAC,GACAD,GACAE,OAAAC,UAAAC,OAAA,iBAAA7B,KAAA8B,QAAAC,KAAA,iBAAA/B,KAAA8B,OAAAE,EAAAD,KAAA/B,KAAA0B,IACAC,OAAAM,QAAAJ,OAAA,mBAAA7B,KAAA8B,QAAAC,KAAA,mBAAA/B,KAAA8B,OAAA,SAAAI,GACAA,E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menu\n(function () {\n var UI = ax5.ui;\n var U = ax5.util;\n var MENU;\n\n UI.addClass({\n className: \"menu\",\n version: \"${VERSION}\"\n }, (function () {\n /**\n * @class ax5.ui.menu\n * @classdesc\n * @author tom@axisj.com\n * @example\n * ```js\n * var menu = new ax5.ui.menu({\n * theme: 'primary',\n * iconWidth: 20,\n * acceleratorWidth: 100,\n * itemClickAndClose: false,\n * icons: {\n * 'arrow': ''\n * },\n * columnKeys: {\n * label: 'name',\n * items: 'chidren'\n * },\n * items: [\n * {\n * icon: '',\n * name: \"Menu Parent 0\",\n * chidren: [\n * {\n * check: {\n * type: 'checkbox',\n * name: 'A',\n * value: '0',\n * checked: false\n * },\n * name: \"Menu Z\",\n * data: {},\n * role: \"\",\n * accelerator: \"CmdOrCtrl+Z\"\n * },\n * {\n * check: {\n * type: 'checkbox',\n * name: 'A',\n * value: '1',\n * checked: true\n * },\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ],\n * filterType: \"A\"\n * },\n * {\n * divide: true,\n * filterType: \"A\"\n * },\n * {\n * icon: '',\n * name: \"Menu Parent 1\",\n * chidren: [\n * {\n * name: \"Menu Z\",\n * data: {},\n * role: \"\",\n * chidren: [\n * {\n * name: \"Menu Z\",\n * data: {},\n * role: \"\"\n * },\n * {\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ]\n * },\n * {\n * name: \"Menu A\",\n * data: {},\n * role: \"\"\n * }\n * ],\n * filterType: \"A\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '1',\n * checked: false\n * },\n * icon: '',\n * name: \"Menu Parent 2\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '2',\n * checked: false\n * },\n * name: \"Menu Parent 3\"\n * },\n * {\n * check: {\n * type: 'radio',\n * name: 'radioName',\n * value: '3',\n * checked: false\n * },\n * name: \"Menu Parent 4\"\n * },\n * {divide: true},\n * {\n * html: function () {\n * return '
' +\n * ' ' +\n * '' +\n * '
';\n * }\n * }\n * ]\n * });\n * ```\n */\n var ax5menu = function () {\n let self = this,\n cfg;\n\n this.instanceId = ax5.getGuid();\n this.config = {\n theme: \"default\",\n iconWidth: 22,\n acceleratorWidth: 100,\n menuBodyPadding: 5,\n //direction: \"top\", // top|bottom\n offset: {left: 0, top: 0},\n position: \"fixed\",\n animateTime: 250,\n items: [],\n itemClickAndClose: true,\n columnKeys: {\n label: 'label',\n items: 'items'\n }\n };\n\n this.openTimer = null;\n this.closeTimer = null;\n this.queue = [];\n this.menuBar = {};\n this.state = undefined;\n\n cfg = this.config;\n\n let appEventAttach = function (active, opt) {\n if (active) {\n jQuery(document).unbind(\"click.ax5menu-\" + this.menuId).bind(\"click.ax5menu-\" + this.menuId, clickItem.bind(this, opt));\n jQuery(window).unbind(\"keydown.ax5menu-\" + this.menuId).bind(\"keydown.ax5menu-\" + this.menuId, function (e) {\n if (e.which == ax5.info.eventKeys.ESC) {\n self.close();\n }\n });\n jQuery(window).unbind(\"resize.ax5menu-\" + this.menuId).bind(\"resize.ax5menu-\" + this.menuId, function (e) {\n self.close();\n });\n }\n else {\n jQuery(document).unbind(\"click.ax5menu-\" + this.menuId);\n jQuery(window).unbind(\"keydown.ax5menu-\" + this.menuId);\n jQuery(window).unbind(\"resize.ax5menu-\" + this.menuId);\n }\n },\n onStateChanged = function (opts, that) {\n if (opts && opts.onStateChanged) {\n opts.onStateChanged.call(that, that);\n }\n else if (this.onStateChanged) {\n this.onStateChanged.call(that, that);\n }\n\n self.state = that.state;\n opts = null;\n that = null;\n return true;\n },\n onLoad = function (that) {\n if (this.onLoad) {\n this.onLoad.call(that, that);\n }\n\n that = null;\n return true;\n },\n popup = function (opt, items, depth, path) {\n let data = opt,\n activeMenu,\n removed\n ;\n\n data.theme = opt.theme || cfg.theme;\n data.cfg = {\n icons: jQuery.extend({}, cfg.icons),\n iconWidth: opt.iconWidth || cfg.iconWidth,\n acceleratorWidth: opt.acceleratorWidth || cfg.acceleratorWidth\n };\n\n items.forEach(function (n) {\n if (n.html || n.divide) {\n n['@isMenu'] = false;\n if (n.html) {\n n['@html'] = n.html.call({\n item: n,\n config: cfg,\n opt: opt\n });\n }\n }\n else {\n n['@isMenu'] = true;\n }\n });\n\n data[cfg.columnKeys.items] = items;\n data['@depth'] = depth;\n data['@path'] = path || \"root\";\n data['@hasChild'] = function () {\n return this[cfg.columnKeys.items] && this[cfg.columnKeys.items].length > 0;\n };\n activeMenu = jQuery(MENU.tmpl.get.call(this, \"tmpl\", data, cfg.columnKeys));\n jQuery(document.body).append(activeMenu);\n\n // remove queue\n\n removed = this.queue.splice(depth);\n removed.forEach(function (n) {\n n.$target.remove();\n });\n\n this.queue.push({\n '$target': activeMenu,\n 'data': jQuery.extend({}, data)\n });\n\n activeMenu.find('[data-menu-item-index]').bind(\"mouseover\", function () {\n let depth = this.getAttribute(\"data-menu-item-depth\"),\n index = this.getAttribute(\"data-menu-item-index\"),\n path = this.getAttribute(\"data-menu-item-path\"),\n $this,\n offset,\n scrollTop,\n childOpt,\n _items,\n _activeMenu;\n\n if (depth != null && typeof depth != \"undefined\") {\n _items = self.queue[depth].data[cfg.columnKeys.items][index][cfg.columnKeys.items];\n _activeMenu = self.queue[depth].$target;\n _activeMenu.find('[data-menu-item-index]').removeClass(\"hover\");\n jQuery(this).addClass(\"hover\");\n\n if (_activeMenu.attr(\"data-selected-menu-item-index\") != index) {\n _activeMenu.attr(\"data-selected-menu-item-index\", index);\n\n if (_items && _items.length > 0) {\n\n $this = jQuery(this);\n offset = $this.offset();\n scrollTop = (cfg.position == \"fixed\" ? jQuery(document).scrollTop() : 0);\n childOpt = {\n '@parent': {\n left: offset.left,\n top: offset.top,\n width: $this.outerWidth(),\n height: $this.outerHeight()\n },\n left: offset.left + $this.outerWidth() - cfg.menuBodyPadding,\n top: offset.top - cfg.menuBodyPadding - 1 - scrollTop\n };\n\n childOpt = jQuery.extend(true, opt, childOpt);\n popup.call(self, childOpt, _items, (Number(depth) + 1), path);\n }\n else {\n self.queue.splice(Number(depth) + 1).forEach(function (n) {\n n.$target.remove();\n });\n }\n }\n }\n\n depth = null;\n index = null;\n path = null;\n $this = null;\n offset = null;\n scrollTop = null;\n childOpt = null;\n _items = null;\n _activeMenu = null;\n });\n\n // mouse out\n activeMenu.find('[data-menu-item-index]').bind(\"mouseout\", function () {\n let depth = this.getAttribute(\"data-menu-item-depth\"),\n index = this.getAttribute(\"data-menu-item-index\"),\n path = this.getAttribute(\"data-menu-item-path\"),\n _items;\n\n if (path) {\n _items = self.queue[depth].data[cfg.columnKeys.items][index][cfg.columnKeys.items];\n }\n if (_items && _items.length > 0) {\n\n } else {\n jQuery(this).removeClass(\"hover\");\n }\n });\n\n // is Root\n if (depth == 0) {\n if (data.direction) activeMenu.addClass(\"direction-\" + data.direction);\n onStateChanged.call(this, null, {\n self: this,\n items: items,\n parent: (function (path) {\n if (!path) return false;\n var item = null;\n try {\n item = (Function(\"\", \"return this.config.items[\" + path.substring(5).replace(/\\./g, '].items[') + \"];\")).call(self);\n } catch (e) {\n\n }\n return item;\n })(data['@path']),\n state: \"popup\"\n });\n }\n\n align.call(this, activeMenu, data);\n onLoad.call(this, {\n self: this,\n items: items,\n element: activeMenu.get(0)\n });\n\n data = null;\n activeMenu = null;\n removed = null;\n opt = null;\n items = null;\n depth = null;\n path = null;\n\n return this;\n },\n clickItem = function (opt, e) {\n let target, item;\n\n target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) {\n if (typeof opt === \"undefined\") opt = {};\n item = (function (path) {\n if (!path) return false;\n let item;\n\n try {\n item = (Function(\"\", \"return this[\" + path.substring(5).replace(/\\./g, '].' + cfg.columnKeys.items + '[') + \"];\")).call(opt.items || cfg.items);\n } catch (e) {\n console.log(ax5.info.getError(\"ax5menu\", \"501\", \"menuItemClick\"));\n }\n\n try {\n return item;\n }\n finally {\n item = null;\n }\n })(target.getAttribute(\"data-menu-item-path\"));\n\n if (!item) return this;\n\n if (item.check) {\n (function (items) {\n var setValue = {\n 'checkbox': function (value) {\n this.checked = !value;\n },\n 'radio': function (value) {\n var name = this.name;\n items.forEach(function (n) {\n if (n.check && n.check.type === 'radio' && n.check.name == name) {\n n.check.checked = false;\n }\n });\n this.checked = !value;\n }\n };\n if (setValue[this.type]) setValue[this.type].call(this, this.checked);\n setValue = null;\n }).call(item.check, cfg.items);\n\n if (!cfg.itemClickAndClose) {\n self.queue.forEach(function (n) {\n n.$target.find('[data-menu-item-index]').each(function () {\n var item = n.data[cfg.columnKeys.items][this.getAttribute(\"data-menu-item-index\")];\n if (item.check) {\n jQuery(this).find(\".item-checkbox-wrap\").attr(\"data-item-checked\", item.check.checked);\n }\n });\n });\n }\n }\n\n if (self.onClick) {\n if (self.onClick.call(item, item, opt.param)) {\n self.close();\n }\n }\n if ((!item[cfg.columnKeys.items] || item[cfg.columnKeys.items].length == 0) && cfg.itemClickAndClose) self.close();\n }\n else {\n self.close();\n }\n\n target = null;\n item = null;\n return this;\n },\n align = function (activeMenu, data) {\n let $window = jQuery(window),\n $document = jQuery(document),\n wh = (cfg.position == \"fixed\") ? $window.height() : $document.height(),\n ww = $window.width(),\n h = activeMenu.outerHeight(),\n w = activeMenu.outerWidth(),\n l = data.left,\n t = data.top,\n position = cfg.position || \"fixed\";\n\n if (l + w > ww) {\n if (data['@parent']) {\n l = data['@parent'].left - w + cfg.menuBodyPadding;\n }\n else {\n l = ww - w;\n }\n }\n\n if (t + h > wh) {\n t = wh - h;\n }\n\n activeMenu.css({left: l, top: t, position: position});\n\n activeMenu = null;\n data = null;\n $window = null;\n $document = null;\n wh = null;\n ww = null;\n h = null;\n w = null;\n l = null;\n t = null;\n position = null;\n return this;\n };\n\n /// private end\n\n this.init = function () {\n self.menuId = ax5.getGuid();\n\n /**\n * config에 선언된 이벤트 함수들을 this로 이동시켜 주어 나중에 인스턴스.on... 으로 처리 가능 하도록 변경\n */\n this.onStateChanged = cfg.onStateChanged;\n this.onClick = cfg.onClick;\n this.onLoad = cfg.onLoad;\n\n onStateChanged.call(this, null, {\n self: this,\n state: \"init\"\n });\n };\n\n /**\n * @method ax5.ui.menu.popup\n * @param {Event|Object} e - Event or Object\n * @param {Object} [opt]\n * @param {String} [opt.theme]\n * @param {Function} [opt.filter]\n * @returns {ax5.ui.menu} this\n */\n this.popup = (function () {\n\n let getOption = {\n 'event': function (e, opt) {\n //var xOffset = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);\n //var yOffset = Math.max(document.documentElement.scrollTop, document.body.scrollTop);\n //console.log(e.pageY);\n\n e = {\n left: e.clientX,\n top: (cfg.position == \"fixed\") ? e.clientY : e.pageY,\n width: cfg.width,\n theme: cfg.theme\n };\n\n e.left -= 5;\n e.top -= 5;\n\n if (cfg.offset) {\n if (cfg.offset.left) e.left += cfg.offset.left;\n if (cfg.offset.top) e.top += cfg.offset.top;\n }\n opt = jQuery.extend(true, e, opt);\n\n try {\n return opt;\n }\n finally {\n e = null;\n //opt = null;\n }\n },\n 'object': function (e, opt) {\n e = {\n left: e.left,\n top: e.top,\n width: e.width || cfg.width,\n theme: e.theme || cfg.theme\n };\n\n if (cfg.offset) {\n if (cfg.offset.left) e.left += cfg.offset.left;\n if (cfg.offset.top) e.top += cfg.offset.top;\n }\n\n opt = jQuery.extend(true, e, opt);\n\n try {\n return opt;\n }\n finally {\n e = null;\n //opt = null;\n }\n }\n },\n updateTheme = function (theme) {\n if (theme) cfg.theme = theme;\n };\n\n return function (e, opt) {\n\n if (!e) return this;\n opt = getOption[((typeof e.clientX == \"undefined\") ? \"object\" : \"event\")].call(this, e, opt);\n updateTheme(opt.theme);\n\n let items = [].concat(cfg.items),\n filteringItem;\n opt.items = items;\n\n if (opt.filter) {\n filteringItem = function (_items) {\n let arr = [];\n _items.forEach(function (n) {\n if (n.items && n.items.length > 0) {\n n.items = filteringItem(n.items);\n }\n if (opt.filter.call(n)) {\n arr.push(n);\n }\n });\n return arr;\n };\n opt.items = items = filteringItem(items);\n }\n\n if (items.length) {\n popup.call(this, opt, items, 0); // 0 is seq of queue\n\n if (this.popupEventAttachTimer) clearTimeout(this.popupEventAttachTimer);\n this.popupEventAttachTimer = setTimeout((function () {\n appEventAttach.call(this, true, opt); // 이벤트 연결\n }).bind(this), 500);\n }\n\n e = null;\n return this;\n }\n })();\n\n /**\n * @method ax5.ui.menu.attach\n * @param {Element|jQueryObject} el\n * @returns {ax5.ui.menu} this\n */\n this.attach = (function () {\n\n var getOption = {\n 'object': function (e, opt) {\n e = {\n left: e.left,\n top: e.top,\n width: e.width || cfg.width,\n theme: e.theme || cfg.theme,\n direction: e.direction || cfg.direction\n };\n opt = jQuery.extend(true, opt, e);\n\n try {\n return opt;\n }\n finally {\n e = null;\n opt = null;\n }\n }\n };\n\n var popUpChildMenu = function (target, opt, eType) {\n var\n $target = jQuery(target),\n offset = $target.offset(),\n height = $target.outerHeight(),\n index = Number(target.getAttribute(\"data-menu-item-index\")),\n scrollTop = (cfg.position == \"fixed\") ? jQuery(document).scrollTop() : 0;\n\n if (cfg.items && cfg.items[index][cfg.columnKeys.items] && cfg.items[index][cfg.columnKeys.items].length) {\n\n if (self.menuBar.openedIndex == index) {\n if (eType == \"click\") self.close();\n return false;\n }\n\n self.menuBar.target.find('[data-menu-item-index]').removeClass(\"hover\");\n self.menuBar.opened = true;\n self.menuBar.openedIndex = index;\n\n $target.attr(\"data-menu-item-opened\", \"true\");\n $target.addClass(\"hover\");\n\n if (cfg.offset) {\n if (cfg.offset.left) offset.left += cfg.offset.left;\n if (cfg.offset.top) offset.top += cfg.offset.top;\n }\n\n opt = getOption[\"object\"].call(this, {left: offset.left, top: offset.top + height - scrollTop}, opt);\n\n popup.call(self, opt, cfg.items[index][cfg.columnKeys.items], 0, 'root.' + target.getAttribute(\"data-menu-item-index\")); // 0 is seq of queue\n appEventAttach.call(self, true, {}); // 이벤트 연결\n }\n\n target = null;\n opt = null;\n $target = null;\n offset = null;\n height = null;\n index = null;\n scrollTop = null;\n };\n var clickParentMenu = function (target, opt, eType) {\n var\n $target = jQuery(target),\n offset = $target.offset(),\n height = $target.outerHeight(),\n index = Number(target.getAttribute(\"data-menu-item-index\")),\n scrollTop = (cfg.position == \"fixed\") ? jQuery(document).scrollTop() : 0;\n if (cfg.items && (!cfg.items[index][cfg.columnKeys.items] || cfg.items[index][cfg.columnKeys.items].length == 0)) {\n if (self.onClick) {\n self.onClick.call(cfg.items[index], cfg.items[index]);\n }\n }\n };\n\n return function (el, opt) {\n var\n data = {},\n items = cfg.items,\n activeMenu;\n\n if (typeof opt === \"undefined\") opt = {};\n\n data.theme = opt.theme || cfg.theme;\n data.cfg = {\n icons: jQuery.extend({}, cfg.icons),\n iconWidth: opt.iconWidth || cfg.iconWidth,\n acceleratorWidth: opt.acceleratorWidth || cfg.acceleratorWidth\n };\n\n items.forEach(function (n) {\n if (n.html || n.divide) {\n n['@isMenu'] = false;\n if (n.html) {\n n['@html'] = n.html.call({\n item: n,\n config: cfg,\n opt: opt\n });\n }\n }\n else {\n n['@isMenu'] = true;\n }\n });\n\n data[cfg.columnKeys.items] = items;\n\n activeMenu = jQuery(MENU.tmpl.get.call(this, \"tmplMenubar\", data, cfg.columnKeys));\n self.menuBar = {\n target: jQuery(el),\n opened: false\n };\n self.menuBar.target.html(activeMenu);\n\n // click, mouseover\n self.menuBar.target.bind(\"click\", function (e) {\n if (!e) return this;\n var target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) {\n clickParentMenu(target, opt, \"click\");\n popUpChildMenu(target, opt, \"click\");\n }\n\n target = null;\n });\n self.menuBar.target.bind(\"mouseover\", function (e) {\n if (!self.menuBar.opened) return false;\n var target = U.findParentNode(e.target, function (target) {\n if (target.getAttribute(\"data-menu-item-index\")) {\n return true;\n }\n });\n if (target) popUpChildMenu(target, opt, \"mouseover\");\n\n target = null;\n });\n\n el = null;\n opt = null;\n data = null;\n items = null;\n activeMenu = null;\n\n return this;\n }\n })();\n\n /**\n * @method ax5.ui.menu.close\n * @returns {ax5.ui.menu} this\n */\n this.close = function () {\n\n if (self.menuBar && self.menuBar.target) {\n self.menuBar.target.find('[data-menu-item-index]').removeClass(\"hover\");\n self.menuBar.opened = false;\n self.menuBar.openedIndex = null;\n }\n\n appEventAttach.call(this, false); // 이벤트 제거\n\n this.queue.forEach(function (n) {\n n.$target.remove();\n });\n this.queue = [];\n\n onStateChanged.call(this, null, {\n self: this,\n state: \"close\"\n });\n\n return this;\n };\n\n /**\n * @method ax5.ui.menu.getCheckValue\n * @returns {Object} statusCheckItem\n */\n this.getCheckValue = function () {\n var checkItems = {},\n collectItem = function (items) {\n var i = items.length;\n while (i--) {\n if (items[i].check && items[i].check.checked) {\n if (!checkItems[items[i].check.name]) checkItems[items[i].check.name] = items[i].check.value;\n else {\n if (U.isString(checkItems[items[i].check.name])) checkItems[items[i].check.name] = [checkItems[items[i].check.name]];\n checkItems[items[i].check.name].push(items[i].check.value);\n }\n }\n if (items[i].items && items[i].items.length > 0) collectItem(items[i].items);\n }\n };\n\n collectItem(cfg.items);\n\n try {\n return checkItems;\n }\n finally {\n checkItems = null;\n collectItem = null;\n }\n };\n\n // 클래스 생성자\n this.main = (function () {\n\n UI.menu_instance = UI.menu_instance || [];\n UI.menu_instance.push(this);\n\n if (arguments && U.isObject(arguments[0])) {\n this.setConfig(arguments[0]);\n }\n }).apply(this, arguments);\n };\n return ax5menu;\n })());\n\n MENU = ax5.ui.menu;\n})();\n\n// todo : menu 드랍다운 아이콘 설정 기능 추가","// ax5.ui.menu.tmpl\n(function () {\n var MENU = ax5.ui.menu;\n \n var tmpl = function (columnKeys) {\n return `\n
\n
\n {{#${columnKeys.items}}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n \n {{#check}}\n \n {{/check}}\n {{^check}}\n \n {{/check}}\n \n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{${columnKeys.label}}}}\n {{#accelerator}}\n {{.}}\n {{/accelerator}}\n {{#@hasChild}}\n {{{cfg.icons.arrow}}}\n {{/@hasChild}}\n
\n {{/@isMenu}}\n\n {{/${columnKeys.items}}}\n
\n
\n
\n `;\n };\n var tmplMenubar = function (columnKeys) {\n return `\n
\n
\n {{#${columnKeys.items}}}\n {{^@isMenu}}\n {{#divide}}\n
\n {{/divide}}\n {{#html}}\n
{{{@html}}}
\n {{/html}}\n {{/@isMenu}}\n {{#@isMenu}}\n
\n {{#icon}}\n {{{.}}}\n {{/icon}}\n {{{${columnKeys.label}}}}\n
\n {{/@isMenu}}\n {{/${columnKeys.items}}}\n
\n
\n `;\n };\n\n MENU.tmpl = {\n \"tmpl\" : tmpl,\n \"tmplMenubar\" : tmplMenubar,\n\n get: function (tmplName, data, columnKeys) {\n return ax5.mustache.render(MENU.tmpl[tmplName].call(this, columnKeys), data);\n }\n };\n})();"]} \ No newline at end of file diff --git a/src/ax5ui-menu/src/ax5menu.js b/src/ax5ui-menu/src/ax5menu.js index c0e9d8f0..b71df9ee 100644 --- a/src/ax5ui-menu/src/ax5menu.js +++ b/src/ax5ui-menu/src/ax5menu.js @@ -371,13 +371,13 @@ } }); if (target) { - + if (typeof opt === "undefined") opt = {}; item = (function (path) { if (!path) return false; let item; try { - item = (Function("", "return this[" + path.substring(5).replace(/\./g, '].' + cfg.columnKeys.items + '[') + "];")).call(opt.items); + item = (Function("", "return this[" + path.substring(5).replace(/\./g, '].' + cfg.columnKeys.items + '[') + "];")).call(opt.items || cfg.items); } catch (e) { console.log(ax5.info.getError("ax5menu", "501", "menuItemClick")); } @@ -641,7 +641,6 @@ index = Number(target.getAttribute("data-menu-item-index")), scrollTop = (cfg.position == "fixed") ? jQuery(document).scrollTop() : 0; - if (cfg.items && cfg.items[index][cfg.columnKeys.items] && cfg.items[index][cfg.columnKeys.items].length) { if (self.menuBar.openedIndex == index) { @@ -664,7 +663,7 @@ opt = getOption["object"].call(this, {left: offset.left, top: offset.top + height - scrollTop}, opt); popup.call(self, opt, cfg.items[index][cfg.columnKeys.items], 0, 'root.' + target.getAttribute("data-menu-item-index")); // 0 is seq of queue - appEventAttach.call(self, true); // 이벤트 연결 + appEventAttach.call(self, true, {}); // 이벤트 연결 } target = null;