@lidorsystems/integralui-web
Version:
IntegralUI Web - Advanced UI Components for Angular
15 lines (12 loc) • 6.73 kB
JavaScript
/*
filename: integralui.menu.js
version : 20.2.0
Copyright © 2016-2020 Lidor Systems. All rights reserved.
This file is part of the "IntegralUI Web" Library.
The contents of this file are subject to the IntegralUI Web License, and may not be used except in compliance with the License.
A copy of the License should have been installed in the product's root installation directory or it can be found at
http://www.lidorsystems.com/products/web/studio/license-agreement.aspx.
This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language
governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws.
*/
;var __extends=this&&this.__extends||function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)if(t.hasOwnProperty(i))e[i]=t[i]})(t,i)};return function(t,i){e(t,i);function n(){this.constructor=t}t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0});var core_1=require("@angular/core"),integralui_core_1=require("./integralui.core"),integralui_common_service_1=require("../services/integralui.common.service"),integralui_data_service_1=require("../services/integralui.data.service"),integralui_menuitem_1=require("../components/integralui.menuitem"),i0=require("@angular/core"),i1=require("../services/integralui.data.service"),i2=require("../services/integralui.common.service"),i3=require("./integralui.core"),i4=require("@angular/common"),i5=require("./integralui.menuitem"),_c0=["content"];function IntegralUIMenu_span_2_iui_menuitem_3_Template(e,t){if(1&e)i0.ɵɵelement(0,"iui-menuitem",7);if(2&e){var i=t.$implicit,n=i0.ɵɵnextContext(2);i0.ɵɵproperty("data",i)("items",i.items)("enabled",i.enabled)("icon",i.icon)("iconUrl",i.iconUrl)("text",i.text)("level",0)("templateRef",n.itemTemplate)("showAnimation",n.showAnimation)}}function IntegralUIMenu_span_2_Template(e,t){if(1&e){i0.ɵɵelementStart(0,"span");i0.ɵɵelementStart(1,"ul",4,5);i0.ɵɵtemplate(3,IntegralUIMenu_span_2_iui_menuitem_3_Template,1,9,"iui-menuitem",6);i0.ɵɵelementEnd();i0.ɵɵelementEnd()}if(2&e){var i=i0.ɵɵnextContext();i0.ɵɵadvance(3);i0.ɵɵproperty("ngForOf",i.items)}}function IntegralUIMenu_span_3_Template(e,t){if(1&e){i0.ɵɵelementStart(0,"span");i0.ɵɵelementStart(1,"ul",4,5);i0.ɵɵprojection(3);i0.ɵɵelementEnd();i0.ɵɵelementEnd()}}var _c1=["*"],IntegralUIMenu=function(e){__extends(t,e);function t(t,i,n,r,a,o){var c=e.call(this,r)||this;c.dataService=t;c.elemRef=i;c.elemRenderer=n;c.commonService=r;c.cmpResolver=a;c.baseService=o;c.virtualization=!0;c.tRef=null;c.showAnimation=!0;c.itemClick=new core_1.EventEmitter;return c}Object.defineProperty(t.prototype,"virtualMode",{get:function(){return this.virtualization},set:function(e){this.virtualization=e;this.updateLayout()},enumerable:!0,configurable:!0});t.prototype.ngOnInit=function(){this.baseService.setComponent(this);this.dataService.init([{data:this.items}]);this.generalClassName="iui-menu";this.initStyle()};t.prototype.ngAfterViewInit=function(){var e=this,t=setTimeout(function(){var i=e.cmpResolver.resolveComponentFactory(integralui_core_1.IntegralUITComponent);if(i&&e.contentRef)e.tRef=e.contentRef.createComponent(i);clearTimeout(t)},100)};t.prototype.ngAfterContentInit=function(){this.itemList=this.contentList.toArray();this.updateLayout()};t.prototype.ngOnDestroy=function(){if(this.tRef)this.tRef.destroy()};t.prototype.getItemFromComponent=function(e){if(e&&e.data)return e.data;if(this.items){this.itemList=this.contentList.toArray();var t=this.itemList.indexOf(e);if(t>=0&&t<this.items.length)return this.items[t]}return null};t.prototype.getItemParent=function(e){return this.dataService.getParent(e)};t.prototype.invokeMethod=function(e,t){if(this.isEnabled)switch(e){case"ITEM_CLICK":this.itemClick.emit({event:t.event,item:t.item})}};t.prototype.updateLayout=function(){};t.prototype.getControlStyle=function(){var e={};if(this.ctrlSize.width>0)e.width=this.ctrlSize.width+"px";if(this.ctrlSize.height>0)e.height=this.ctrlSize.height+"px";return e};t.ɵfac=function(e){return new(e||t)(i0.ɵɵdirectiveInject(i1.IntegralUIDataService),i0.ɵɵdirectiveInject(i0.ElementRef),i0.ɵɵdirectiveInject(i0.Renderer2),i0.ɵɵdirectiveInject(i2.IntegralUICommonService),i0.ɵɵdirectiveInject(i0.ComponentFactoryResolver),i0.ɵɵdirectiveInject(i3.IntegralUIBaseService))};t.ɵcmp=i0.ɵɵdefineComponent({type:t,selectors:[["iui-menu"]],contentQueries:function(e,t,i){if(1&e){i0.ɵɵcontentQuery(i,core_1.TemplateRef,!0);i0.ɵɵcontentQuery(i,integralui_menuitem_1.IntegralUIMenuItem,!0)}if(2&e){var n;i0.ɵɵqueryRefresh(n=i0.ɵɵloadQuery())&&(t.itemTemplate=n.first);i0.ɵɵqueryRefresh(n=i0.ɵɵloadQuery())&&(t.contentList=n)}},viewQuery:function(e,t){if(1&e)i0.ɵɵviewQuery(_c0,!0,core_1.ViewContainerRef);if(2&e){var i;i0.ɵɵqueryRefresh(i=i0.ɵɵloadQuery())&&(t.contentRef=i.first)}},inputs:{controlStyle:"controlStyle",data:"data",enabled:"enabled",name:"name",size:"size",state:"state",appRef:"appRef",items:"items",showAnimation:"showAnimation",virtualMode:"virtualMode"},outputs:{itemClick:"itemClick"},features:[i0.ɵɵProvidersFeature([integralui_core_1.IntegralUIBaseService,integralui_data_service_1.IntegralUIDataService]),i0.ɵɵInheritDefinitionFeature],ngContentSelectors:_c1,decls:4,vars:4,consts:[[3,"ngClass","ngStyle"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],[1,"iui-menu-block"],["content",""],[3,"data","items","enabled","icon","iconUrl","text","level","templateRef","showAnimation",4,"ngFor","ngForOf"],[3,"data","items","enabled","icon","iconUrl","text","level","templateRef","showAnimation"]],template:function(e,t){if(1&e){i0.ɵɵprojectionDef();i0.ɵɵelementStart(0,"div",0);i0.ɵɵelementStart(1,"span",1);i0.ɵɵtemplate(2,IntegralUIMenu_span_2_Template,4,1,"span",2);i0.ɵɵtemplate(3,IntegralUIMenu_span_3_Template,4,0,"span",3);i0.ɵɵelementEnd();i0.ɵɵelementEnd()}if(2&e){i0.ɵɵproperty("ngClass",t.getControlClass())("ngStyle",t.getControlStyle());i0.ɵɵadvance(1);i0.ɵɵproperty("ngSwitch",t.virtualMode);i0.ɵɵadvance(1);i0.ɵɵproperty("ngSwitchCase",!0)}},directives:[i4.NgClass,i4.NgStyle,i4.NgSwitch,i4.NgSwitchCase,i4.NgSwitchDefault,i4.NgForOf,i5.IntegralUIMenuItem],encapsulation:2});return t}(integralui_core_1.IntegralUIBaseComponent);exports.IntegralUIMenu=IntegralUIMenu;