1 | import { NgModule, Component, Input, forwardRef, EventEmitter, Output, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
|
---|
2 | import { CommonModule } from '@angular/common';
|
---|
3 | import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
---|
4 | import * as i0 from "@angular/core";
|
---|
5 | import * as i1 from "@angular/common";
|
---|
6 | export const INPUTSWITCH_VALUE_ACCESSOR = {
|
---|
7 | provide: NG_VALUE_ACCESSOR,
|
---|
8 | useExisting: forwardRef(() => InputSwitch),
|
---|
9 | multi: true
|
---|
10 | };
|
---|
11 | export class InputSwitch {
|
---|
12 | constructor(cd) {
|
---|
13 | this.cd = cd;
|
---|
14 | this.trueValue = true;
|
---|
15 | this.falseValue = false;
|
---|
16 | this.onChange = new EventEmitter();
|
---|
17 | this.modelValue = false;
|
---|
18 | this.focused = false;
|
---|
19 | this.onModelChange = () => { };
|
---|
20 | this.onModelTouched = () => { };
|
---|
21 | }
|
---|
22 | onClick(event, cb) {
|
---|
23 | if (!this.disabled && !this.readonly) {
|
---|
24 | event.preventDefault();
|
---|
25 | this.toggle(event);
|
---|
26 | cb.focus();
|
---|
27 | }
|
---|
28 | }
|
---|
29 | onInputChange(event) {
|
---|
30 | if (!this.readonly) {
|
---|
31 | const inputChecked = event.target.checked;
|
---|
32 | this.updateModel(event, inputChecked);
|
---|
33 | }
|
---|
34 | }
|
---|
35 | toggle(event) {
|
---|
36 | this.updateModel(event, !this.checked());
|
---|
37 | }
|
---|
38 | updateModel(event, value) {
|
---|
39 | this.modelValue = value ? this.trueValue : this.falseValue;
|
---|
40 | this.onModelChange(this.modelValue);
|
---|
41 | this.onChange.emit({
|
---|
42 | originalEvent: event,
|
---|
43 | checked: this.modelValue
|
---|
44 | });
|
---|
45 | }
|
---|
46 | onFocus(event) {
|
---|
47 | this.focused = true;
|
---|
48 | }
|
---|
49 | onBlur(event) {
|
---|
50 | this.focused = false;
|
---|
51 | this.onModelTouched();
|
---|
52 | }
|
---|
53 | writeValue(value) {
|
---|
54 | this.modelValue = value;
|
---|
55 | this.cd.markForCheck();
|
---|
56 | }
|
---|
57 | registerOnChange(fn) {
|
---|
58 | this.onModelChange = fn;
|
---|
59 | }
|
---|
60 | registerOnTouched(fn) {
|
---|
61 | this.onModelTouched = fn;
|
---|
62 | }
|
---|
63 | setDisabledState(val) {
|
---|
64 | this.disabled = val;
|
---|
65 | this.cd.markForCheck();
|
---|
66 | }
|
---|
67 | checked() {
|
---|
68 | return this.modelValue === this.trueValue;
|
---|
69 | }
|
---|
70 | }
|
---|
71 | InputSwitch.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitch, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
---|
72 | InputSwitch.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: InputSwitch, selector: "p-inputSwitch", inputs: { style: "style", styleClass: "styleClass", tabindex: "tabindex", inputId: "inputId", name: "name", disabled: "disabled", readonly: "readonly", trueValue: "trueValue", falseValue: "falseValue", ariaLabelledBy: "ariaLabelledBy" }, outputs: { onChange: "onChange" }, host: { classAttribute: "p-element" }, providers: [INPUTSWITCH_VALUE_ACCESSOR], ngImport: i0, template: `
|
---|
73 | <div [ngClass]="{'p-inputswitch p-component': true, 'p-inputswitch-checked': checked(), 'p-disabled': disabled, 'p-focus': focused}"
|
---|
74 | [ngStyle]="style" [class]="styleClass" (click)="onClick($event, cb)">
|
---|
75 | <div class="p-hidden-accessible">
|
---|
76 | <input #cb type="checkbox" [attr.id]="inputId" [attr.name]="name" [attr.tabindex]="tabindex" [checked]="checked()" (change)="onInputChange($event)"
|
---|
77 | (focus)="onFocus($event)" (blur)="onBlur($event)" [disabled]="disabled" role="switch" [attr.aria-checked]="checked()" [attr.aria-labelledby]="ariaLabelledBy"/>
|
---|
78 | </div>
|
---|
79 | <span class="p-inputswitch-slider"></span>
|
---|
80 | </div>
|
---|
81 | `, isInline: true, styles: [".p-inputswitch{position:relative;display:inline-block;-webkit-user-select:none;-ms-user-select:none;user-select:none}.p-inputswitch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0}.p-inputswitch-slider:before{position:absolute;content:\"\";top:50%}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
82 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitch, decorators: [{
|
---|
83 | type: Component,
|
---|
84 | args: [{ selector: 'p-inputSwitch', template: `
|
---|
85 | <div [ngClass]="{'p-inputswitch p-component': true, 'p-inputswitch-checked': checked(), 'p-disabled': disabled, 'p-focus': focused}"
|
---|
86 | [ngStyle]="style" [class]="styleClass" (click)="onClick($event, cb)">
|
---|
87 | <div class="p-hidden-accessible">
|
---|
88 | <input #cb type="checkbox" [attr.id]="inputId" [attr.name]="name" [attr.tabindex]="tabindex" [checked]="checked()" (change)="onInputChange($event)"
|
---|
89 | (focus)="onFocus($event)" (blur)="onBlur($event)" [disabled]="disabled" role="switch" [attr.aria-checked]="checked()" [attr.aria-labelledby]="ariaLabelledBy"/>
|
---|
90 | </div>
|
---|
91 | <span class="p-inputswitch-slider"></span>
|
---|
92 | </div>
|
---|
93 | `, providers: [INPUTSWITCH_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
94 | 'class': 'p-element'
|
---|
95 | }, styles: [".p-inputswitch{position:relative;display:inline-block;-webkit-user-select:none;-ms-user-select:none;user-select:none}.p-inputswitch-slider{position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0}.p-inputswitch-slider:before{position:absolute;content:\"\";top:50%}\n"] }]
|
---|
96 | }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { style: [{
|
---|
97 | type: Input
|
---|
98 | }], styleClass: [{
|
---|
99 | type: Input
|
---|
100 | }], tabindex: [{
|
---|
101 | type: Input
|
---|
102 | }], inputId: [{
|
---|
103 | type: Input
|
---|
104 | }], name: [{
|
---|
105 | type: Input
|
---|
106 | }], disabled: [{
|
---|
107 | type: Input
|
---|
108 | }], readonly: [{
|
---|
109 | type: Input
|
---|
110 | }], trueValue: [{
|
---|
111 | type: Input
|
---|
112 | }], falseValue: [{
|
---|
113 | type: Input
|
---|
114 | }], ariaLabelledBy: [{
|
---|
115 | type: Input
|
---|
116 | }], onChange: [{
|
---|
117 | type: Output
|
---|
118 | }] } });
|
---|
119 | export class InputSwitchModule {
|
---|
120 | }
|
---|
121 | InputSwitchModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
122 | InputSwitchModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitchModule, declarations: [InputSwitch], imports: [CommonModule], exports: [InputSwitch] });
|
---|
123 | InputSwitchModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitchModule, imports: [[CommonModule]] });
|
---|
124 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: InputSwitchModule, decorators: [{
|
---|
125 | type: NgModule,
|
---|
126 | args: [{
|
---|
127 | imports: [CommonModule],
|
---|
128 | exports: [InputSwitch],
|
---|
129 | declarations: [InputSwitch]
|
---|
130 | }]
|
---|
131 | }] });
|
---|
132 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXRzd2l0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY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