UNPKG

3.52 kBJavaScriptView Raw
1!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("primeng/inputswitch",["exports","@angular/core","@angular/common","@angular/forms"],t):t(((e=e||self).primeng=e.primeng||{},e.primeng.inputswitch={}),e.ng.core,e.ng.common,e.ng.forms)}(this,(function(e,t,n,o){"use strict";var i=this&&this.__decorate||function(e,t,n,o){var i,c=arguments.length,r=c<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var u=e.length-1;u>=0;u--)(i=e[u])&&(r=(c<3?i(r):c>3?i(t,n,r):i(t,n))||r);return c>3&&r&&Object.defineProperty(t,n,r),r},c={provide:o.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return r})),multi:!0},r=function(){function e(e){this.cd=e,this.onChange=new t.EventEmitter,this.checked=!1,this.focused=!1,this.onModelChange=function(){},this.onModelTouched=function(){}}return e.prototype.onClick=function(e,t){this.disabled||this.readonly||(e.preventDefault(),this.toggle(e),t.focus())},e.prototype.onInputChange=function(e){if(!this.readonly){var t=e.target.checked;this.updateModel(e,t)}},e.prototype.toggle=function(e){this.updateModel(e,!this.checked)},e.prototype.updateModel=function(e,t){this.checked=t,this.onModelChange(this.checked),this.onChange.emit({originalEvent:e,checked:this.checked})},e.prototype.onFocus=function(e){this.focused=!0},e.prototype.onBlur=function(e){this.focused=!1,this.onModelTouched()},e.prototype.writeValue=function(e){this.checked=e,this.cd.markForCheck()},e.prototype.registerOnChange=function(e){this.onModelChange=e},e.prototype.registerOnTouched=function(e){this.onModelTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e},e.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},i([t.Input()],e.prototype,"style",void 0),i([t.Input()],e.prototype,"styleClass",void 0),i([t.Input()],e.prototype,"tabindex",void 0),i([t.Input()],e.prototype,"inputId",void 0),i([t.Input()],e.prototype,"name",void 0),i([t.Input()],e.prototype,"disabled",void 0),i([t.Input()],e.prototype,"readonly",void 0),i([t.Input()],e.prototype,"ariaLabelledBy",void 0),i([t.Output()],e.prototype,"onChange",void 0),e=i([t.Component({selector:"p-inputSwitch",template:'\n <div [ngClass]="{\'ui-inputswitch ui-widget\': true, \'ui-inputswitch-checked\': checked, \'ui-state-disabled\': disabled, \'ui-inputswitch-readonly\': readonly, \'ui-inputswitch-focus\': focused}" \n [ngStyle]="style" [class]="styleClass" (click)="onClick($event, cb)">\n <div class="ui-helper-hidden-accessible">\n <input #cb type="checkbox" [attr.id]="inputId" [attr.name]="name" [attr.tabindex]="tabindex" [checked]="checked" (change)="onInputChange($event)"\n (focus)="onFocus($event)" (blur)="onBlur($event)" [disabled]="disabled" role="switch" [attr.aria-checked]="checked" [attr.aria-labelledby]="ariaLabelledBy"/>\n </div>\n <span class="ui-inputswitch-slider"></span>\n </div>\n ',providers:[c],changeDetection:t.ChangeDetectionStrategy.Default})],e)}(),u=function(){function e(){}return e=i([t.NgModule({imports:[n.CommonModule],exports:[r],declarations:[r]})],e)}();e.INPUTSWITCH_VALUE_ACCESSOR=c,e.InputSwitch=r,e.InputSwitchModule=u,Object.defineProperty(e,"__esModule",{value:!0})}));
2//# sourceMappingURL=primeng-inputswitch.umd.min.js.map
\No newline at end of file