UNPKG

4.38 kBSource Map (JSON)View Raw
1{"version":3,"file":"mdl-menu-item.component.js","sourceRoot":"","sources":["../../../src/lib/components/menu/mdl-menu-item.component.ts"],"names":[],"mappings":"OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe;OACf,EAAE,gBAAgB,EAAE,MAAM,sBAAsB;OAChD,EAAE,SAAS,EAAE,MAAM,4BAA4B;AAItD;IAQE,2GAA2G;IAC3G,8BACU,UAAsB,EACtB,QAAkB,EACjB,OAAyB;QAF1B,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAU;QACjB,YAAO,GAAP,OAAO,CAAkB;QAV5B,cAAS,GAAY,KAAK,CAAC;QAWjC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC;IAC1C,CAAC;IAVD,sBAAI,0CAAQ;aAAZ,cAA0B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;aAClD,UAAa,KAAK,IAAI,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;;;OADR;IAY3C,sCAAO,GAAd,UAAe,MAAM;QACnB,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YAClB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,CAAC;QACT,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;IACnC,CAAC;IAED,oGAAoG;IACpG,sGAAsG;IACtG,qGAAqG;IACrG,yCAAyC;IAClC,sCAAO,GAAd,UAAe,MAAM;QACnB,6CAA6C;QAC7C,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,MAAM,CAAC,cAAc,EAAE,CAAC;QAExB,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,CAAC;IAEI,+BAAU,GAA0B;QAC3C,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oBACxB,QAAQ,EAAE,eAAe;oBACzB,IAAI,EAAE;wBACJ,wBAAwB,EAAE,MAAM;wBAChC,UAAU,EAAE,IAAI;wBAChB,SAAS,EAAE,iBAAiB;wBAC5B,cAAc,EAAE,iBAAiB;qBAClC;oBACD,QAAQ,EAAE,2BAA2B;oBACrC,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC,EAAG,EAAE;KACL,CAAC;IACF,kBAAkB;IACX,mCAAc,GAAmE,cAAM,OAAA;QAC9F,EAAC,IAAI,EAAE,UAAU,GAAG;QACpB,EAAC,IAAI,EAAE,QAAQ,GAAG;QAClB,EAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,cAAM,OAAA,gBAAgB,EAAhB,CAAgB,CAAC,EAAG,EAAE,EAAG,EAAC;KACvG,EAJ6F,CAI7F,CAAC;IACK,mCAAc,GAA2C;QAChE,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;KAC7B,CAAC;IACF,2BAAC;AAAD,CAAC,AA5DD,IA4DC","sourcesContent":["import {\n Component,\n Input,\n ElementRef,\n forwardRef,\n Renderer,\n Inject,\n ViewEncapsulation\n} from '@angular/core';\nimport { MdlMenuComponent } from './mdl-menu.component';\nimport { toBoolean } from '../common/boolean-property';\n\n\n\nexport class MdlMenuItemComponent {\n\n private _disabled: boolean = false;\n \n get disabled(): boolean { return this._disabled; }\n set disabled(value) { this._disabled = toBoolean(value); }\n\n public element: HTMLElement;\n // forwardRef is needed because of he circular dependency menu queries menuitems; menuitem needs the parent\n constructor(\n private elementRef: ElementRef,\n private renderer: Renderer,\n private mdlMenu: MdlMenuComponent) {\n this.element = elementRef.nativeElement;\n }\n\n public onClick($event) {\n $event.stopPropagation();\n if (this.disabled) {\n this.mdlMenu.hide();\n return;\n }\n this.mdlMenu.hideOnItemClicked();\n }\n\n // we need to register a touchstart at the window to get informed if the user taps outside the menu.\n // But if we register a touchstart event - safari will no longer convert touch events to click events.\n // So we need to convert touch to click and the user still needs to register a (click) listener to be\n // informed if the menu item has clicked.\n public onTouch($event) {\n // ensure that this event is totally consumed\n $event.stopPropagation();\n $event.preventDefault();\n\n let event = new MouseEvent('click', {bubbles: true});\n this.renderer.invokeElementMethod(this.element, 'dispatchEvent', [event]);\n }\n\nstatic decorators: DecoratorInvocation[] = [\n{ type: Component, args: [{\n selector: 'mdl-menu-item',\n host: {\n '[class.mdl-menu__item]': 'true',\n 'tabindex': '-1',\n '(click)': 'onClick($event)',\n '(touchstart)': 'onTouch($event)'\n },\n template: '<ng-content></ng-content>',\n encapsulation: ViewEncapsulation.None\n}, ] },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: ElementRef, },\n{type: Renderer, },\n{type: MdlMenuComponent, decorators: [{ type: Inject, args: [forwardRef(() => MdlMenuComponent), ] }, ]},\n];\nstatic propDecorators: {[key: string]: DecoratorInvocation[]} = {\n'disabled': [{ type: Input },],\n};\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
\No newline at end of file