UNPKG

6.78 kBSource Map (JSON)View Raw
1{"version":3,"file":"mdl-button.component.js","sourceRoot":"","sources":["../../../src/lib/components/button/mdl-button.component.ts"],"names":[],"mappings":";;;;;OAAO,EACL,SAAS,EACT,KAAK,EACL,UAAU,EAEV,QAAQ,EACR,QAAQ,EAER,iBAAiB,EAElB,MAAM,eAAe;OACf,EAAE,QAAQ,EAAE,MAAM,qBAAqB;OACvC,EAAE,SAAS,EAAE,MAAM,4BAA4B;AAEtD;IAAmD,iDAAQ;IACzD,uCAAY,IAAY;QACtB,kBAAM,mBAAgB,IAAI,mEAA+D,CAAC,CAAC;IAC7F,CAAC;IACH,oCAAC;AAAD,CAAC,AAJD,CAAmD,QAAQ,GAI1D;AAED;IAAoD,kDAAQ;IAC1D,wCAAY,IAAY;QACtB,kBAAM,oBAAiB,IAAI,uDAAmD,CAAC,CAAC;IAClF,CAAC;IACH,qCAAC;AAAD,CAAC,AAJD,CAAoD,QAAQ,GAI3D;AAED,IAAM,gBAAgB,GAAG;IACvB,QAAQ;IACR,KAAK;IACL,UAAU;IACV,MAAM;IACN,EAAE;CACH,CAAC;AAEF,IAAM,iBAAiB,GAAG;IACxB,SAAS;IACT,QAAQ;IACR,EAAE;CACH,CAAC;AAIF;IAaE,4BAAmB,UAAsB,EAAU,QAAkB;QAAlD,eAAU,GAAV,UAAU,CAAY;QAAU,aAAQ,GAAR,QAAQ,CAAU;QAL7D,cAAS,GAAY,KAAK,CAAC;QAMjC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC;IAC1C,CAAC;IALD,sBAAI,wCAAQ;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;IAO3C,wCAAW,GAAlB,UAAmB,OAAsB;QAEvC,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,IAA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mE,cAAM,OAAA;QAC9F,EAAC,IAAI,EAAE,UAAU,GAAG;QACpB,EAAC,IAAI,EAAE,QAAQ,GAAG;KACjB,EAH6F,CAG7F,CAAC;IACK,iCAAc,GAA2C;QAChE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,iBAAiB,EAAG,EAAE,EAAE;QAChE,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,aAAa,EAAG,EAAE,EAAE;QAC7D,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;KAC7B,CAAC;IACF,yBAAC;AAAD,CAAC,AArED,IAqEC;AAGD,IAAM,qBAAqB,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAGnD;IAAA;IAiBA,CAAC;IAhBe,uBAAO,GAArB;QACE,MAAM,CAAC;YACL,QAAQ,EAAE,eAAe;YACzB,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;IACI,0BAAU,GAA0B;QAC3C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;oBACvB,OAAO,EAAE,EAAE;oBACX,OAAO,EAAE,qBAAqB;oBAC9B,YAAY,EAAE,qBAAqB;iBACpC,EAAG,EAAE;KACL,CAAC;IACF,kBAAkB;IACX,8BAAc,GAAmE,cAAM,OAAA,EAC7F,EAD6F,CAC7F,CAAC;IACF,sBAAC;AAAD,CAAC,AAjBD,IAiBC","sourcesContent":["import {\n Component,\n Input,\n ElementRef,\n OnChanges,\n Renderer,\n NgModule,\n ModuleWithProviders,\n ViewEncapsulation,\n SimpleChanges\n} from '@angular/core';\nimport { MdlError } from '../common/mdl-error';\nimport { toBoolean } from '../common/boolean-property';\n\nexport class MdlUnsupportedButtonTypeError extends MdlError {\n constructor(type: string) {\n super(`Button type \"${type}\" isn't supported (allowed: raised, fab, mini-fab, icon, '').`);\n }\n}\n\nexport class MdlUnsupportedColoredTypeError extends MdlError {\n constructor(type: string) {\n super(`Colored type \"${type}\" isn't supported (allowed: primary, accent, '').`);\n }\n}\n\nconst MDL_BUTTON_TYPES = [\n 'raised',\n 'fab',\n 'mini-fab',\n 'icon',\n ''\n];\n\nconst MDL_COLORED_TYPES = [\n 'primary',\n 'accent',\n ''\n];\n\n\n\nexport class MdlButtonComponent implements OnChanges {\n\n private element: HTMLElement;\n\n\n public mdlButtonType: 'raised' | 'fab' | 'mini-fab' | 'icon' | '' ;\n public mdlColoredType: 'primary' | 'accent' | '';\n\n private _disabled: boolean = false;\n \n get disabled(): boolean { return this._disabled; }\n set disabled(value) { this._disabled = toBoolean(value); }\n\n constructor(public elementRef: ElementRef, private renderer: Renderer) {\n this.element = elementRef.nativeElement;\n }\n\n public ngOnChanges(changes: SimpleChanges) {\n\n if (this.mdlButtonType && MDL_BUTTON_TYPES.indexOf(this.mdlButtonType) === -1) {\n throw new MdlUnsupportedButtonTypeError(this.mdlButtonType);\n }\n\n if ( this.mdlColoredType && MDL_COLORED_TYPES.indexOf(this.mdlColoredType) === -1) {\n throw new MdlUnsupportedColoredTypeError(this.mdlColoredType);\n }\n }\n\n public onMouseUp() {\n this.blurIt();\n }\n\n public onMouseLeave() {\n this.blurIt();\n }\n\n public blurIt() {\n this.renderer.invokeElementMethod(this.element, 'blur', []);\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Component, args: [{\n selector: 'mdl-button, button[mdl-button], a[mdl-button]',\n host: {\n '[attr.disabled]': 'disabled ? \"disabled\" : null',\n '(mouseup)': 'onMouseUp()',\n '(mouseleave)': 'onMouseLeave()',\n '[class.mdl-button]': 'true',\n '[class.mdl-button--raised]': 'mdlButtonType == \"raised\"',\n '[class.mdl-button--fab]': 'mdlButtonType == \"fab\" || mdlButtonType == \"mini-fab\"',\n '[class.mdl-button--mini-fab]': 'mdlButtonType == \"mini-fab\"',\n '[class.mdl-button--icon]': 'mdlButtonType == \"icon\"',\n '[class.mdl-button--primary]' : 'mdlColoredType == \"primary\"',\n '[class.mdl-button--accent]' : 'mdlColoredType == \"accent\"'\n },\n exportAs: 'mdlButton',\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];\nstatic propDecorators: {[key: string]: DecoratorInvocation[]} = {\n'mdlButtonType': [{ type: Input, args: ['mdl-button-type', ] },],\n'mdlColoredType': [{ type: Input, args: ['mdl-colored', ] },],\n'disabled': [{ type: Input },],\n};\n}\n\n\nconst MDL_BUTTON_DIRECTIVES = [MdlButtonComponent];\n\n\nexport class MdlButtonModule {\n public static forRoot(): ModuleWithProviders {\n return {\n ngModule: MdlButtonModule,\n providers: []\n };\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: NgModule, args: [{\n imports: [],\n exports: MDL_BUTTON_DIRECTIVES,\n declarations: MDL_BUTTON_DIRECTIVES,\n}, ] },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n];\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
\No newline at end of file