16 lines
6.0 KiB
JavaScript
16 lines
6.0 KiB
JavaScript
!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/checkbox",["exports","@angular/core","@angular/common","@angular/forms"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).primeng=e.primeng||{},e.primeng.checkbox={}),e.ng.core,e.ng.common,e.ng.forms)}(this,(function(e,t,n,o){"use strict";
|
|
/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */Object.create;function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,c=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(o=c.next()).done;)l.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=c.return)&&n.call(c)}finally{if(i)throw i.error}}return l}Object.create;var c={provide:o.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return l})),multi:!0},l=function(){function e(e){this.cd=e,this.checkboxIcon="pi pi-check",this.onChange=new t.EventEmitter,this.onModelChange=function(){},this.onModelTouched=function(){},this.focused=!1,this.checked=!1}return e.prototype.onClick=function(e,t,n){e.preventDefault(),this.disabled||this.readonly||(this.checked=!this.checked,this.updateModel(e),n&&t.focus())},e.prototype.updateModel=function(e){this.binary?this.onModelChange(this.checked):(this.checked?this.addValue():this.removeValue(),this.onModelChange(this.model),this.formControl&&this.formControl.setValue(this.model)),this.onChange.emit({checked:this.checked,originalEvent:e})},e.prototype.handleChange=function(e){this.readonly||(this.checked=e.target.checked,this.updateModel(e))},e.prototype.isChecked=function(){return this.binary?this.model:this.model&&this.model.indexOf(this.value)>-1},e.prototype.removeValue=function(){var e=this;this.model=this.model.filter((function(t){return t!==e.value}))},e.prototype.addValue=function(){this.model?this.model=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e}(this.model,[this.value]):this.model=[this.value]},e.prototype.onFocus=function(){this.focused=!0},e.prototype.onBlur=function(){this.focused=!1,this.onModelTouched()},e.prototype.focus=function(){this.inputViewChild.nativeElement.focus()},e.prototype.writeValue=function(e){this.model=e,this.checked=this.isChecked(),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,this.cd.markForCheck()},e}();l.decorators=[{type:t.Component,args:[{selector:"p-checkbox",template:'\n <div [ngStyle]="style" [ngClass]="{\'p-checkbox p-component\': true, \'p-checkbox-checked\': checked, \'p-checkbox-disabled\': disabled, \'p-checkbox-focused\': focused}" [class]="styleClass">\n <div class="p-hidden-accessible">\n <input #cb type="checkbox" [attr.id]="inputId" [attr.name]="name" [readonly]="readonly" [value]="value" [checked]="checked" (focus)="onFocus()" (blur)="onBlur()"\n (change)="handleChange($event)" [disabled]="disabled" [attr.tabindex]="tabindex" [attr.aria-labelledby]="ariaLabelledBy" [attr.required]="required">\n </div>\n <div class="p-checkbox-box" (click)="onClick($event,cb,true)"\n [ngClass]="{\'p-highlight\': checked, \'p-disabled\': disabled, \'p-focus\': focused}" role="checkbox" [attr.aria-checked]="checked">\n <span class="p-checkbox-icon" [ngClass]="checked ? checkboxIcon : null"></span>\n </div>\n </div>\n <label (click)="onClick($event,cb,true)" [class]="labelStyleClass"\n [ngClass]="{\'p-checkbox-label\': true, \'p-checkbox-label-active\':checked, \'p-disabled\':disabled, \'p-checkbox-label-focus\':focused}"\n *ngIf="label" [attr.for]="inputId">{{label}}</label>\n ',providers:[c],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,styles:[".p-checkbox{-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;user-select:none;vertical-align:bottom}.p-checkbox-box{-ms-flex-pack:center;display:-ms-flexbox;display:flex;justify-content:center}.p-checkbox-box,p-checkbox{-ms-flex-align:center;align-items:center}p-checkbox{display:-ms-inline-flexbox;display:inline-flex;vertical-align:bottom}.p-checkbox-label{line-height:1}"]}]}],l.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},l.propDecorators={value:[{type:t.Input}],name:[{type:t.Input}],disabled:[{type:t.Input}],binary:[{type:t.Input}],label:[{type:t.Input}],ariaLabelledBy:[{type:t.Input}],tabindex:[{type:t.Input}],inputId:[{type:t.Input}],style:[{type:t.Input}],styleClass:[{type:t.Input}],labelStyleClass:[{type:t.Input}],formControl:[{type:t.Input}],checkboxIcon:[{type:t.Input}],readonly:[{type:t.Input}],required:[{type:t.Input}],inputViewChild:[{type:t.ViewChild,args:["cb"]}],onChange:[{type:t.Output}]};var s=function(){};s.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule],exports:[l],declarations:[l]}]}],e.CHECKBOX_VALUE_ACCESSOR=c,e.Checkbox=l,e.CheckboxModule=s,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
//# sourceMappingURL=primeng-checkbox.umd.min.js.map
|