source: trip-planner-front/node_modules/primeng/fesm2015/primeng-tristatecheckbox.mjs@ 8d391a1

Last change on this file since 8d391a1 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

  • Property mode set to 100644
File size: 7.9 KB
Line 
1import * as i0 from '@angular/core';
2import { forwardRef, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
3import * as i1 from '@angular/common';
4import { CommonModule } from '@angular/common';
5import { NG_VALUE_ACCESSOR } from '@angular/forms';
6
7const TRISTATECHECKBOX_VALUE_ACCESSOR = {
8 provide: NG_VALUE_ACCESSOR,
9 useExisting: forwardRef(() => TriStateCheckbox),
10 multi: true
11};
12class TriStateCheckbox {
13 constructor(cd) {
14 this.cd = cd;
15 this.checkboxTrueIcon = 'pi pi-check';
16 this.checkboxFalseIcon = 'pi pi-times';
17 this.onChange = new EventEmitter();
18 this.onModelChange = () => { };
19 this.onModelTouched = () => { };
20 }
21 onClick(event, input) {
22 if (!this.disabled && !this.readonly) {
23 this.toggle(event);
24 this.focused = true;
25 input.focus();
26 }
27 }
28 onKeydown(event) {
29 if (event.keyCode == 32) {
30 event.preventDefault();
31 }
32 }
33 onKeyup(event) {
34 if (event.keyCode == 32 && !this.readonly) {
35 this.toggle(event);
36 event.preventDefault();
37 }
38 }
39 toggle(event) {
40 if (this.value == null || this.value == undefined)
41 this.value = true;
42 else if (this.value == true)
43 this.value = false;
44 else if (this.value == false)
45 this.value = null;
46 this.onModelChange(this.value);
47 this.onChange.emit({
48 originalEvent: event,
49 value: this.value
50 });
51 }
52 onFocus() {
53 this.focused = true;
54 }
55 onBlur() {
56 this.focused = false;
57 this.onModelTouched();
58 }
59 registerOnChange(fn) {
60 this.onModelChange = fn;
61 }
62 registerOnTouched(fn) {
63 this.onModelTouched = fn;
64 }
65 writeValue(value) {
66 this.value = value;
67 this.cd.markForCheck();
68 }
69 setDisabledState(disabled) {
70 this.disabled = disabled;
71 this.cd.markForCheck();
72 }
73}
74TriStateCheckbox.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckbox, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
75TriStateCheckbox.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: TriStateCheckbox, selector: "p-triStateCheckbox", inputs: { disabled: "disabled", name: "name", ariaLabelledBy: "ariaLabelledBy", tabindex: "tabindex", inputId: "inputId", style: "style", styleClass: "styleClass", label: "label", readonly: "readonly", checkboxTrueIcon: "checkboxTrueIcon", checkboxFalseIcon: "checkboxFalseIcon" }, outputs: { onChange: "onChange" }, host: { classAttribute: "p-element" }, providers: [TRISTATECHECKBOX_VALUE_ACCESSOR], ngImport: i0, template: `
76 <div [ngStyle]="style" [ngClass]="{'p-checkbox p-component': true,'p-checkbox-disabled': disabled, 'p-checkbox-focused': focused}" [class]="styleClass">
77 <div class="p-hidden-accessible">
78 <input #input type="text" [attr.id]="inputId" [name]="name" [attr.tabindex]="tabindex" [readonly]="readonly" [disabled]="disabled" (keyup)="onKeyup($event)" (keydown)="onKeydown($event)" (focus)="onFocus()" (blur)="onBlur()" [attr.aria-labelledby]="ariaLabelledBy" inputmode="none">
79 </div>
80 <div class="p-checkbox-box" (click)="onClick($event,input)" role="checkbox" [attr.aria-checked]="value === true"
81 [ngClass]="{'p-highlight':value!=null,'p-disabled':disabled,'p-focus':focused}">
82 <span class="p-checkbox-icon" [ngClass]="value === true ? checkboxTrueIcon : value === false ? checkboxFalseIcon : ''"></span>
83 </div>
84 </div>
85 <label class="p-checkbox-label" (click)="onClick($event,input)"
86 [ngClass]="{'p-checkbox-label-active':value!=null, 'p-disabled':disabled, 'p-checkbox-label-focus':focused}"
87 *ngIf="label" [attr.for]="inputId">{{label}}</label>
88 `, isInline: true, directives: [{ type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
89i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckbox, decorators: [{
90 type: Component,
91 args: [{
92 selector: 'p-triStateCheckbox',
93 template: `
94 <div [ngStyle]="style" [ngClass]="{'p-checkbox p-component': true,'p-checkbox-disabled': disabled, 'p-checkbox-focused': focused}" [class]="styleClass">
95 <div class="p-hidden-accessible">
96 <input #input type="text" [attr.id]="inputId" [name]="name" [attr.tabindex]="tabindex" [readonly]="readonly" [disabled]="disabled" (keyup)="onKeyup($event)" (keydown)="onKeydown($event)" (focus)="onFocus()" (blur)="onBlur()" [attr.aria-labelledby]="ariaLabelledBy" inputmode="none">
97 </div>
98 <div class="p-checkbox-box" (click)="onClick($event,input)" role="checkbox" [attr.aria-checked]="value === true"
99 [ngClass]="{'p-highlight':value!=null,'p-disabled':disabled,'p-focus':focused}">
100 <span class="p-checkbox-icon" [ngClass]="value === true ? checkboxTrueIcon : value === false ? checkboxFalseIcon : ''"></span>
101 </div>
102 </div>
103 <label class="p-checkbox-label" (click)="onClick($event,input)"
104 [ngClass]="{'p-checkbox-label-active':value!=null, 'p-disabled':disabled, 'p-checkbox-label-focus':focused}"
105 *ngIf="label" [attr.for]="inputId">{{label}}</label>
106 `,
107 providers: [TRISTATECHECKBOX_VALUE_ACCESSOR],
108 changeDetection: ChangeDetectionStrategy.OnPush,
109 encapsulation: ViewEncapsulation.None,
110 host: {
111 'class': 'p-element'
112 }
113 }]
114 }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
115 type: Input
116 }], name: [{
117 type: Input
118 }], ariaLabelledBy: [{
119 type: Input
120 }], tabindex: [{
121 type: Input
122 }], inputId: [{
123 type: Input
124 }], style: [{
125 type: Input
126 }], styleClass: [{
127 type: Input
128 }], label: [{
129 type: Input
130 }], readonly: [{
131 type: Input
132 }], checkboxTrueIcon: [{
133 type: Input
134 }], checkboxFalseIcon: [{
135 type: Input
136 }], onChange: [{
137 type: Output
138 }] } });
139class TriStateCheckboxModule {
140}
141TriStateCheckboxModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
142TriStateCheckboxModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckboxModule, declarations: [TriStateCheckbox], imports: [CommonModule], exports: [TriStateCheckbox] });
143TriStateCheckboxModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckboxModule, imports: [[CommonModule]] });
144i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: TriStateCheckboxModule, decorators: [{
145 type: NgModule,
146 args: [{
147 imports: [CommonModule],
148 exports: [TriStateCheckbox],
149 declarations: [TriStateCheckbox]
150 }]
151 }] });
152
153/**
154 * Generated bundle index. Do not edit.
155 */
156
157export { TRISTATECHECKBOX_VALUE_ACCESSOR, TriStateCheckbox, TriStateCheckboxModule };
Note: See TracBrowser for help on using the repository browser.