source: trip-planner-front/node_modules/primeng/esm2020/knob/knob.mjs@ 59329aa

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

adding photos

  • Property mode set to 100644
File size: 34.9 KB
Line 
1import { NgModule, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, forwardRef, Output, EventEmitter } from '@angular/core';
2import { CommonModule } from '@angular/common';
3import { NG_VALUE_ACCESSOR } from '@angular/forms';
4import * as i0 from "@angular/core";
5import * as i1 from "@angular/common";
6export const KNOB_VALUE_ACCESSOR = {
7 provide: NG_VALUE_ACCESSOR,
8 useExisting: forwardRef(() => Knob),
9 multi: true
10};
11export class Knob {
12 constructor(cd, el) {
13 this.cd = cd;
14 this.el = el;
15 this.valueColor = "var(--primary-color, Black)";
16 this.rangeColor = "var(--surface-d, LightGray)";
17 this.textColor = "var(--text-color-secondary, Black)";
18 this.valueTemplate = "{value}";
19 this.size = 100;
20 this.step = 1;
21 this.min = 0;
22 this.max = 100;
23 this.strokeWidth = 14;
24 this.showValue = true;
25 this.readonly = false;
26 this.onChange = new EventEmitter();
27 this.radius = 40;
28 this.midX = 50;
29 this.midY = 50;
30 this.minRadians = 4 * Math.PI / 3;
31 this.maxRadians = -Math.PI / 3;
32 this.value = null;
33 this.onModelChange = () => { };
34 this.onModelTouched = () => { };
35 }
36 mapRange(x, inMin, inMax, outMin, outMax) {
37 return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
38 }
39 onClick(event) {
40 if (!this.disabled && !this.readonly) {
41 this.updateValue(event.offsetX, event.offsetY);
42 }
43 }
44 updateValue(offsetX, offsetY) {
45 let dx = offsetX - this.size / 2;
46 let dy = this.size / 2 - offsetY;
47 let angle = Math.atan2(dy, dx);
48 let start = -Math.PI / 2 - Math.PI / 6;
49 this.updateModel(angle, start);
50 }
51 updateModel(angle, start) {
52 let mappedValue;
53 if (angle > this.maxRadians)
54 mappedValue = this.mapRange(angle, this.minRadians, this.maxRadians, this.min, this.max);
55 else if (angle < start)
56 mappedValue = this.mapRange(angle + 2 * Math.PI, this.minRadians, this.maxRadians, this.min, this.max);
57 else
58 return;
59 let newValue = Math.round((mappedValue - this.min) / this.step) * this.step + this.min;
60 this.value = newValue;
61 this.onModelChange(this.value);
62 this.onChange.emit(this.value);
63 }
64 onMouseDown(event) {
65 if (!this.disabled && !this.readonly) {
66 this.windowMouseMoveListener = this.onMouseMove.bind(this);
67 this.windowMouseUpListener = this.onMouseUp.bind(this);
68 window.addEventListener('mousemove', this.windowMouseMoveListener);
69 window.addEventListener('mouseup', this.windowMouseUpListener);
70 event.preventDefault();
71 }
72 }
73 onMouseUp(event) {
74 if (!this.disabled && !this.readonly) {
75 window.removeEventListener('mousemove', this.windowMouseMoveListener);
76 window.removeEventListener('mouseup', this.windowMouseUpListener);
77 this.windowMouseUpListener = null;
78 this.windowMouseMoveListener = null;
79 event.preventDefault();
80 }
81 }
82 onTouchStart(event) {
83 if (!this.disabled && !this.readonly) {
84 this.windowTouchMoveListener = this.onTouchMove.bind(this);
85 this.windowTouchEndListener = this.onTouchEnd.bind(this);
86 window.addEventListener('touchmove', this.windowTouchMoveListener);
87 window.addEventListener('touchend', this.windowTouchEndListener);
88 event.preventDefault();
89 }
90 }
91 onTouchEnd(event) {
92 if (!this.disabled && !this.readonly) {
93 window.removeEventListener('touchmove', this.windowTouchMoveListener);
94 window.removeEventListener('touchend', this.windowTouchEndListener);
95 this.windowTouchMoveListener = null;
96 this.windowTouchEndListener = null;
97 event.preventDefault();
98 }
99 }
100 onMouseMove(event) {
101 if (!this.disabled && !this.readonly) {
102 this.updateValue(event.offsetX, event.offsetY);
103 event.preventDefault();
104 }
105 }
106 onTouchMove(event) {
107 if (!this.disabled && !this.readonly && event.touches.length == 1) {
108 const rect = this.el.nativeElement.children[0].getBoundingClientRect();
109 const touch = event.targetTouches.item(0);
110 const offsetX = touch.clientX - rect.left;
111 const offsetY = touch.clientY - rect.top;
112 this.updateValue(offsetX, offsetY);
113 }
114 }
115 writeValue(value) {
116 this.value = value;
117 this.cd.markForCheck();
118 }
119 registerOnChange(fn) {
120 this.onModelChange = fn;
121 }
122 registerOnTouched(fn) {
123 this.onModelTouched = fn;
124 }
125 setDisabledState(val) {
126 this.disabled = val;
127 this.cd.markForCheck();
128 }
129 containerClass() {
130 return {
131 'p-knob p-component': true,
132 'p-disabled': this.disabled
133 };
134 }
135 rangePath() {
136 return `M ${this.minX()} ${this.minY()} A ${this.radius} ${this.radius} 0 1 1 ${this.maxX()} ${this.maxY()}`;
137 }
138 valuePath() {
139 return `M ${this.zeroX()} ${this.zeroY()} A ${this.radius} ${this.radius} 0 ${this.largeArc()} ${this.sweep()} ${this.valueX()} ${this.valueY()}`;
140 }
141 zeroRadians() {
142 if (this.min > 0 && this.max > 0)
143 return this.mapRange(this.min, this.min, this.max, this.minRadians, this.maxRadians);
144 else
145 return this.mapRange(0, this.min, this.max, this.minRadians, this.maxRadians);
146 }
147 valueRadians() {
148 return this.mapRange(this._value, this.min, this.max, this.minRadians, this.maxRadians);
149 }
150 minX() {
151 return this.midX + Math.cos(this.minRadians) * this.radius;
152 }
153 minY() {
154 return this.midY - Math.sin(this.minRadians) * this.radius;
155 }
156 maxX() {
157 return this.midX + Math.cos(this.maxRadians) * this.radius;
158 }
159 maxY() {
160 return this.midY - Math.sin(this.maxRadians) * this.radius;
161 }
162 zeroX() {
163 return this.midX + Math.cos(this.zeroRadians()) * this.radius;
164 }
165 zeroY() {
166 return this.midY - Math.sin(this.zeroRadians()) * this.radius;
167 }
168 valueX() {
169 return this.midX + Math.cos(this.valueRadians()) * this.radius;
170 }
171 valueY() {
172 return this.midY - Math.sin(this.valueRadians()) * this.radius;
173 }
174 largeArc() {
175 return Math.abs(this.zeroRadians() - this.valueRadians()) < Math.PI ? 0 : 1;
176 }
177 sweep() {
178 return this.valueRadians() > this.zeroRadians() ? 0 : 1;
179 }
180 valueToDisplay() {
181 return this.valueTemplate.replace("{value}", this._value.toString());
182 }
183 get _value() {
184 return this.value != null ? this.value : this.min;
185 }
186}
187Knob.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Knob, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
188Knob.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: Knob, selector: "p-knob", inputs: { styleClass: "styleClass", style: "style", severity: "severity", valueColor: "valueColor", rangeColor: "rangeColor", textColor: "textColor", valueTemplate: "valueTemplate", name: "name", size: "size", step: "step", min: "min", max: "max", strokeWidth: "strokeWidth", disabled: "disabled", showValue: "showValue", readonly: "readonly" }, outputs: { onChange: "onChange" }, host: { classAttribute: "p-element" }, providers: [KNOB_VALUE_ACCESSOR], ngImport: i0, template: `
189 <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
190 <svg viewBox="0 0 100 100" [style.width]="size + 'px'" [style.height]="size + 'px'" (click)="onClick($event)" (mousedown)="onMouseDown($event)" (mouseup)="onMouseUp($event)"
191 (touchstart)="onTouchStart($event)" (touchend)="onTouchEnd($event)">
192 <path [attr.d]="rangePath()" [attr.stroke-width]="strokeWidth" [attr.stroke]="rangeColor" class="p-knob-range"></path>
193 <path [attr.d]="valuePath()" [attr.stroke-width]="strokeWidth" [attr.stroke]="valueColor" class="p-knob-value"></path>
194 <text *ngIf="showValue" [attr.x]="50" [attr.y]="57" text-anchor="middle" [attr.fill]="textColor" class="p-knob-text" [attr.name]="name">{{valueToDisplay()}}</text>
195 </svg>
196 </div>
197 `, isInline: true, styles: ["@keyframes dash-frame{to{stroke-dashoffset:0}}.p-knob-range{fill:none;transition:stroke .1s ease-in}.p-knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}.p-knob-text{font-size:1.3rem;text-align:center}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
198i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: Knob, decorators: [{
199 type: Component,
200 args: [{ selector: 'p-knob', template: `
201 <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style">
202 <svg viewBox="0 0 100 100" [style.width]="size + 'px'" [style.height]="size + 'px'" (click)="onClick($event)" (mousedown)="onMouseDown($event)" (mouseup)="onMouseUp($event)"
203 (touchstart)="onTouchStart($event)" (touchend)="onTouchEnd($event)">
204 <path [attr.d]="rangePath()" [attr.stroke-width]="strokeWidth" [attr.stroke]="rangeColor" class="p-knob-range"></path>
205 <path [attr.d]="valuePath()" [attr.stroke-width]="strokeWidth" [attr.stroke]="valueColor" class="p-knob-value"></path>
206 <text *ngIf="showValue" [attr.x]="50" [attr.y]="57" text-anchor="middle" [attr.fill]="textColor" class="p-knob-text" [attr.name]="name">{{valueToDisplay()}}</text>
207 </svg>
208 </div>
209 `, providers: [KNOB_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
210 'class': 'p-element'
211 }, styles: ["@keyframes dash-frame{to{stroke-dashoffset:0}}.p-knob-range{fill:none;transition:stroke .1s ease-in}.p-knob-value{animation-name:dash-frame;animation-fill-mode:forwards;fill:none}.p-knob-text{font-size:1.3rem;text-align:center}\n"] }]
212 }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }]; }, propDecorators: { styleClass: [{
213 type: Input
214 }], style: [{
215 type: Input
216 }], severity: [{
217 type: Input
218 }], valueColor: [{
219 type: Input
220 }], rangeColor: [{
221 type: Input
222 }], textColor: [{
223 type: Input
224 }], valueTemplate: [{
225 type: Input
226 }], name: [{
227 type: Input
228 }], size: [{
229 type: Input
230 }], step: [{
231 type: Input
232 }], min: [{
233 type: Input
234 }], max: [{
235 type: Input
236 }], strokeWidth: [{
237 type: Input
238 }], disabled: [{
239 type: Input
240 }], showValue: [{
241 type: Input
242 }], readonly: [{
243 type: Input
244 }], onChange: [{
245 type: Output
246 }] } });
247export class KnobModule {
248}
249KnobModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: KnobModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
250KnobModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: KnobModule, declarations: [Knob], imports: [CommonModule], exports: [Knob] });
251KnobModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: KnobModule, imports: [[CommonModule]] });
252i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: KnobModule, decorators: [{
253 type: NgModule,
254 args: [{
255 imports: [CommonModule],
256 exports: [Knob],
257 declarations: [Knob]
258 }]
259 }] });
260//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia25vYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9rbm9iL2tub2IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxTQUFTLEVBQUUsdUJBQXVCLEVBQUUsaUJBQWlCLEVBQUUsS0FBSyxFQUFFLFVBQVUsRUFBaUMsTUFBTSxFQUFFLFlBQVksRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUN2SyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDL0MsT0FBTyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sZ0JBQWdCLENBQUM7OztBQUVuRCxNQUFNLENBQUMsTUFBTSxtQkFB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ndpbmRvd1RvdWNoRW5kTGlzdGVuZXIpO1xuICAgICAgICAgICAgdGhpcy53aW5kb3dUb3VjaE1vdmVMaXN0ZW5lciA9IG51bGw7XG4gICAgICAgICAgICB0aGlzLndpbmRvd1RvdWNoRW5kTGlzdGVuZXIgPSBudWxsO1xuICAgICAgICAgICAgZXZlbnQucHJldmVudERlZmF1bHQoKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIG9uTW91c2VNb3ZlKGV2ZW50KSB7XG4gICAgICAgIGlmICghdGhpcy5kaXNhYmxlZCAmJiAhdGhpcy5yZWFkb25seSkge1xuICAgICAgICAgICAgdGhpcy51cGRhdGVWYWx1ZShldmVudC5vZmZzZXRYLCBldmVudC5vZmZzZXRZKTtcbiAgICAgICAgICAgIGV2ZW50LnByZXZlbnREZWZhdWx0KCk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBvblRvdWNoTW92ZShldmVudCkge1xuICAgICAgICBpZiAoIXRoaXMuZGlzYWJsZWQgJiYgIXRoaXMucmVhZG9ubHkgJiYgZXZlbnQudG91Y2hlcy5sZW5ndGggPT0gMSkge1xuICAgICAgICAgICAgY29uc3QgcmVjdCA9IHRoaXMuZWwubmF0aXZlRWxlbWVudC5jaGlsZHJlblswXS5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcbiAgICAgICAgICAgIGNvbnN0IHRvdWNoID0gZXZlbnQudGFyZ2V0VG91Y2hlcy5pdGVtKDApO1xuICAgICAgICAgICAgY29uc3Qgb2Zmc2V0WCA9IHRvdWNoLmNsaWVudFggLSByZWN0LmxlZnQ7XG4gICAgICAgICAgICBjb25zdCBvZmZzZXRZID0gdG91Y2guY2xpZW50WSAtIHJlY3QudG9wO1xuICAgICAgICAgICAgdGhpcy51cGRhdGVWYWx1ZShvZmZzZXRYLCBvZmZzZXRZKTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHdyaXRlVmFsdWUodmFsdWU6IGFueSkgOiB2b2lkIHtcbiAgICAgICAgdGh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IFtLbm9iXVxufSlcbmV4cG9ydCBjbGFzcyBLbm9iTW9kdWxlIHsgfVxuIl19
Note: See TracBrowser for help on using the repository browser.