{"version":3,"file":"primeng-tristatecheckbox.mjs","sources":["../../src/app/components/tristatecheckbox/tristatecheckbox.ts","../../src/app/components/tristatecheckbox/primeng-tristatecheckbox.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, EventEmitter, Input, NgModule, Output, QueryList, TemplateRef, ViewEncapsulation, forwardRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { LicenseManager, PrimeTemplate, SharedModule } from 'primeng/api';\nimport { CheckIcon } from 'primeng/icons/check';\nimport { TimesIcon } from 'primeng/icons/times';\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 \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n `,\n providers: [TRISTATECHECKBOX_VALUE_ACCESSOR],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'p-element'\n }\n})\nexport class TriStateCheckbox implements ControlValueAccessor, AfterViewInit {\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 @Input() checkboxTrueIcon: string;\n\n @Input() checkboxFalseIcon: string;\n\n @Output() onChange: EventEmitter = new EventEmitter();\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n checkIconTemplate: TemplateRef;\n\n uncheckIconTemplate: TemplateRef;\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) this.value = true;\n else if (this.value == true) this.value = false;\n else if (this.value == false) this.value = null;\n\n this.onModelChange(this.value);\n this.onChange.emit({\n originalEvent: event,\n value: this.value\n });\n }\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch (item.getType()) {\n case 'checkicon':\n this.checkIconTemplate = item.template;\n break;\n\n case 'uncheckicon':\n this.uncheckIconTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewInit() {\n LicenseManager.check();\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, SharedModule, CheckIcon, TimesIcon],\n exports: [TriStateCheckbox, SharedModule],\n declarations: [TriStateCheckbox]\n})\nexport class TriStateCheckboxModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;AAOa,MAAA,+BAA+B,GAAQ;AAChD,IAAA,OAAO,EAAE,iBAAiB;AAC1B,IAAA,WAAW,EAAE,UAAU,CAAC,MAAM,gBAAgB,CAAC;AAC/C,IAAA,KAAK,EAAE,IAAI;EACb;MAqDW,gBAAgB,CAAA;AACzB,IAAA,WAAA,CAAoB,EAAqB,EAAA;AAArB,QAAA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