{"version":3,"file":"primeng-tristatecheckbox.umd.js","sources":["../../src/app/components/tristatecheckbox/tristatecheckbox.ts","../../src/app/components/tristatecheckbox/primeng-tristatecheckbox.ts"],"sourcesContent":["import {NgModule,Component,Input,Output,EventEmitter,forwardRef,ChangeDetectorRef,ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';\n\nexport const TRISTATECHECKBOX_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => TriStateCheckbox),\n multi: true\n};\n\n@Component({\n selector: 'p-triStateCheckbox',\n template: `\n
\n
\n \n
\n
\n \n
\n
\n \n `,\n providers: [TRISTATECHECKBOX_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class TriStateCheckbox implements ControlValueAccessor {\n\n constructor(private cd: ChangeDetectorRef) {}\n\n @Input() disabled: boolean;\n\n @Input() name: string;\n\n @Input() ariaLabelledBy: string;\n\n @Input() tabindex: number;\n\n @Input() inputId: string;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() label: string;\n\n @Input() readonly: boolean;\n\n @Output() onChange: EventEmitter = new EventEmitter();\n\n focused: boolean;\n\n value: any;\n\n onModelChange: Function = () => {};\n\n onModelTouched: Function = () => {};\n\n onClick(event: Event, input: HTMLInputElement) {\n if (!this.disabled && !this.readonly) {\n this.toggle(event);\n this.focused = true;\n input.focus();\n }\n }\n\n onKeydown(event: KeyboardEvent) {\n if (event.keyCode == 32) {\n event.preventDefault();\n }\n }\n\n onKeyup(event: KeyboardEvent) {\n if (event.keyCode == 32 && !this.readonly) {\n this.toggle(event);\n event.preventDefault();\n }\n }\n\n toggle(event: Event) {\n if (this.value == null || this.value == undefined)\n this.value = true;\n else if (this.value == true)\n this.value = false;\n else if (this.value == false)\n this.value = null;\n\n this.onModelChange(this.value);\n this.onChange.emit({\n originalEvent: event,\n value: this.value\n })\n }\n\n onFocus() {\n this.focused = true;\n }\n\n onBlur() {\n this.focused = false;\n this.onModelTouched();\n }\n\n registerOnChange(fn: Function): void {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: Function): void {\n this.onModelTouched = fn;\n }\n\n writeValue(value: any) : void {\n this.value = value;\n this.cd.markForCheck();\n }\n\n setDisabledState(disabled: boolean): void {\n this.disabled = disabled;\n this.cd.markForCheck();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [TriStateCheckbox],\n declarations: [TriStateCheckbox]\n})\nexport class TriStateCheckboxModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["NG_VALUE_ACCESSOR","forwardRef","EventEmitter","Component","ChangeDetectionStrategy","ViewEncapsulation","ChangeDetectorRef","Input","Output","NgModule","CommonModule"],"mappings":";;;;;;QAIa,+BAA+B,GAAQ;QAClD,OAAO,EAAEA,uBAAiB;QAC1B,WAAW,EAAEC,eAAU,CAAC,cAAM,OAAA,gBAAgB,GAAA,CAAC;QAC/C,KAAK,EAAE,IAAI;MACX;;QAwBE,0BAAoB,EAAqB;YAArB,OAAE,GAAF,EAAE,CAAmB;YAoB/B,aAAQ,GAAsB,IAAIC,iBAAY,EAAE,CAAC;YAM3D,kBAAa,GAAa,eAAQ,CAAC;YAEnC,mBAAc,GAAa,eAAQ,CAAC;SA5BS;QA8B7C,kCAAO,GAAP,UAAQ,KAAY,EAAE,KAAuB;YACzC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,KAAK,CAAC,KAAK,EAAE,CAAC;aACjB;SACJ;QAED,oCAAS,GAAT,UAAU,KAAoB;YAC1B,IAAI,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE;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