@operato/input 0.2.35 → 0.2.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/demo/index-3dish.html +15 -2
- package/demo/index-angle.html +9 -4
- package/demo/index-barcode.html +66 -0
- package/demo/index-button-radio.html +18 -6
- package/demo/index-checkbox.html +17 -9
- package/demo/index-select.html +118 -0
- package/demo/index-stack.html +15 -3
- package/demo/index.html +42 -86
- package/dist/src/ox-buttons-radio.d.ts +7 -5
- package/dist/src/ox-buttons-radio.js +18 -10
- package/dist/src/ox-buttons-radio.js.map +1 -1
- package/dist/src/ox-checkbox.d.ts +5 -6
- package/dist/src/ox-checkbox.js +33 -33
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-formfield.d.ts +10 -0
- package/dist/src/ox-formfield.js +38 -0
- package/dist/src/ox-formfield.js.map +1 -0
- package/dist/src/ox-input-3dish.d.ts +15 -14
- package/dist/src/ox-input-3dish.js +49 -23
- package/dist/src/ox-input-3dish.js.map +1 -1
- package/dist/src/ox-input-angle.d.ts +4 -5
- package/dist/src/ox-input-angle.js +15 -13
- package/dist/src/ox-input-angle.js.map +1 -1
- package/dist/src/ox-input-barcode.d.ts +22 -0
- package/dist/src/ox-input-barcode.js +205 -0
- package/dist/src/ox-input-barcode.js.map +1 -0
- package/dist/src/ox-input-stack.d.ts +5 -3
- package/dist/src/ox-input-stack.js +44 -35
- package/dist/src/ox-input-stack.js.map +1 -1
- package/dist/src/ox-select.d.ts +5 -4
- package/dist/src/ox-select.js +34 -12
- package/dist/src/ox-select.js.map +1 -1
- package/dist/test/property-angle.test.js +3 -3
- package/dist/test/property-angle.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/ox-buttons-radio.ts +22 -10
- package/src/ox-checkbox.ts +37 -33
- package/src/ox-formfield.ts +36 -0
- package/src/ox-input-3dish.ts +63 -29
- package/src/ox-input-angle.ts +19 -14
- package/src/ox-input-barcode.ts +203 -0
- package/src/ox-input-stack.ts +49 -24
- package/src/ox-select.ts +46 -16
- package/test/property-angle.test.ts +3 -4
package/src/ox-buttons-radio.ts
CHANGED
@@ -2,22 +2,24 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import { css, html,
|
5
|
+
import { css, html, PropertyValues } from 'lit'
|
6
6
|
import { customElement, property } from 'lit/decorators.js'
|
7
7
|
|
8
|
+
import { OxFormField } from './ox-formfield'
|
9
|
+
|
8
10
|
/**
|
9
11
|
여러 버튼 중에서 하나만 눌리거나, 모두 눌리지 않은 상태만을 갖는 라디오 형태의 버튼이다.
|
10
12
|
|
11
13
|
Example:
|
12
14
|
|
13
15
|
<ox-buttons-radio @change=${e => this._onChange(e)} value=${value}>
|
14
|
-
<div
|
15
|
-
<div
|
16
|
-
<div
|
16
|
+
<div value="top"></div>
|
17
|
+
<div value="middle"></div>
|
18
|
+
<div value="bottom"></div>
|
17
19
|
</ox-buttons-radio>
|
18
20
|
*/
|
19
21
|
@customElement('ox-buttons-radio')
|
20
|
-
export class PropertyButtonsRadio extends
|
22
|
+
export class PropertyButtonsRadio extends OxFormField {
|
21
23
|
static styles = [
|
22
24
|
css`
|
23
25
|
:host {
|
@@ -46,7 +48,7 @@ export class PropertyButtonsRadio extends LitElement {
|
|
46
48
|
|
47
49
|
_onValueChanged(value: Object | null) {
|
48
50
|
this.buttons.forEach(button => {
|
49
|
-
if (value === button.getAttribute('
|
51
|
+
if (value === button.getAttribute('value')) {
|
50
52
|
button.setAttribute('active', '')
|
51
53
|
} else {
|
52
54
|
button.removeAttribute('active')
|
@@ -57,7 +59,7 @@ export class PropertyButtonsRadio extends LitElement {
|
|
57
59
|
_onTapButton(e: Event) {
|
58
60
|
var target = e.target as HTMLElement
|
59
61
|
|
60
|
-
while (!target.hasAttribute('
|
62
|
+
while (!target.hasAttribute('value') && target !== this) {
|
61
63
|
target = target.parentElement!
|
62
64
|
}
|
63
65
|
|
@@ -69,19 +71,29 @@ export class PropertyButtonsRadio extends LitElement {
|
|
69
71
|
|
70
72
|
if (!this.mandatory) {
|
71
73
|
if (!target.getAttribute('active')) {
|
72
|
-
this.value = target.getAttribute('
|
74
|
+
this.value = target.getAttribute('value')
|
73
75
|
target.setAttribute('active', '')
|
74
76
|
} else {
|
75
77
|
this.value = null
|
76
78
|
target.removeAttribute('active')
|
77
79
|
}
|
78
80
|
} else {
|
79
|
-
this.value = target.getAttribute('
|
81
|
+
this.value = target.getAttribute('value')
|
80
82
|
target.setAttribute('active', '')
|
81
83
|
}
|
82
84
|
|
83
85
|
if (old !== this.value) {
|
84
|
-
this.dispatchEvent(
|
86
|
+
this.dispatchEvent(
|
87
|
+
new CustomEvent('change', {
|
88
|
+
bubbles: true,
|
89
|
+
composed: true,
|
90
|
+
detail: this.value
|
91
|
+
})
|
92
|
+
)
|
85
93
|
}
|
86
94
|
}
|
95
|
+
|
96
|
+
protected appendFormData({ formData }: FormDataEvent): void {
|
97
|
+
this.name && formData.append(this.name, JSON.stringify(this.value))
|
98
|
+
}
|
87
99
|
}
|
package/src/ox-checkbox.ts
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
1
|
/*
|
6
2
|
This component is inspired by https://github.com/Polydile/dile-components, thanks Dile.
|
7
3
|
*/
|
8
4
|
|
9
|
-
import { css, html
|
5
|
+
import { css, html } from 'lit'
|
10
6
|
import { customElement, property, state } from 'lit/decorators.js'
|
11
7
|
|
8
|
+
import { OxFormField } from './ox-formfield'
|
9
|
+
|
12
10
|
@customElement('ox-checkbox')
|
13
|
-
export class OxCheckbox extends
|
11
|
+
export class OxCheckbox extends OxFormField {
|
14
12
|
static styles = [
|
15
13
|
css`
|
16
14
|
:host {
|
@@ -33,8 +31,8 @@ export class OxCheckbox extends LitElement {
|
|
33
31
|
border-radius: var(--ox-checkbox-border-radius, 4px);
|
34
32
|
border: var(--ox-checkbox-border, 1px solid rgba(0, 0, 0, 0.3));
|
35
33
|
background-color: var(--ox-checkbox-background-color, #fff);
|
36
|
-
width: var(--ox-checkbox-size,
|
37
|
-
height: var(--ox-checkbox-size,
|
34
|
+
width: var(--ox-checkbox-size, 15px);
|
35
|
+
height: var(--ox-checkbox-size, 15px);
|
38
36
|
align-items: center;
|
39
37
|
justify-content: center;
|
40
38
|
}
|
@@ -44,7 +42,7 @@ export class OxCheckbox extends LitElement {
|
|
44
42
|
border: var(--ox-checkbox-unchecked-border, 1px solid rgba(0, 0, 0, 0.3));
|
45
43
|
}
|
46
44
|
|
47
|
-
|
45
|
+
:host([checked]) a {
|
48
46
|
background-color: var(--ox-checkbox-checked-background-color, #fff);
|
49
47
|
border: var(--ox-checkbox-checked-border, 1px solid #38a25b);
|
50
48
|
}
|
@@ -53,13 +51,13 @@ export class OxCheckbox extends LitElement {
|
|
53
51
|
fill: var(--ox-checkbox-fill-color, rgba(0, 0, 0, 0.1));
|
54
52
|
}
|
55
53
|
|
56
|
-
[checked] path {
|
54
|
+
:host([checked]) path {
|
57
55
|
fill: var(--ox-checkbox-checked-color, #38a25b);
|
58
56
|
}
|
59
57
|
|
60
58
|
svg {
|
61
|
-
width: var(--ox-checkbox-size,
|
62
|
-
height: var(--ox-checkbox-size,
|
59
|
+
width: var(--ox-checkbox-size, 15px);
|
60
|
+
height: var(--ox-checkbox-size, 15px);
|
63
61
|
}
|
64
62
|
|
65
63
|
[label] {
|
@@ -67,28 +65,22 @@ export class OxCheckbox extends LitElement {
|
|
67
65
|
color: var(--ox-checkbox-label-color, #3a5877);
|
68
66
|
}
|
69
67
|
|
70
|
-
[checked]
|
68
|
+
:host([checked]) [label] {
|
71
69
|
font-weight: var(--ox-checkbox-checked-font-weight, bold);
|
72
70
|
}
|
73
71
|
`
|
74
72
|
]
|
75
73
|
|
76
|
-
@property({ type: Boolean }) checked: boolean = false
|
74
|
+
@property({ type: Boolean, attribute: 'checked', reflect: true }) checked: boolean = false
|
77
75
|
@property({ type: Boolean }) disabled: boolean = false
|
78
|
-
@property({ type: String }) name
|
76
|
+
@property({ type: String }) name?: string
|
79
77
|
|
80
78
|
@state() _hasInner: boolean = !!this.innerHTML.trim().length
|
81
79
|
|
82
80
|
render() {
|
83
81
|
return html`
|
84
82
|
<div @click=${this.onClick} ?disabled=${this.disabled}>
|
85
|
-
<a
|
86
|
-
href="#"
|
87
|
-
@click=${(e: Event) => e.preventDefault()}
|
88
|
-
@keydown=${this.onKeyDown}
|
89
|
-
?checked=${this.checked}
|
90
|
-
checkbox
|
91
|
-
>
|
83
|
+
<a href="#" @click=${(e: Event) => e.preventDefault()} checkbox>
|
92
84
|
${this.checked ? this.checkedIcon : this.uncheckedIcon}
|
93
85
|
</a>
|
94
86
|
${this._hasInner
|
@@ -100,6 +92,13 @@ export class OxCheckbox extends LitElement {
|
|
100
92
|
`
|
101
93
|
}
|
102
94
|
|
95
|
+
connectedCallback() {
|
96
|
+
super.connectedCallback()
|
97
|
+
|
98
|
+
this.setAttribute('tabindex', '0')
|
99
|
+
this.addEventListener('keydown', this.onKeyDown.bind(this))
|
100
|
+
}
|
101
|
+
|
103
102
|
onClick() {
|
104
103
|
if (this.disabled) {
|
105
104
|
return
|
@@ -111,31 +110,36 @@ export class OxCheckbox extends LitElement {
|
|
111
110
|
new CustomEvent('change', {
|
112
111
|
bubbles: true,
|
113
112
|
composed: true,
|
114
|
-
detail:
|
115
|
-
checked: this.checked,
|
116
|
-
name: this.name
|
117
|
-
}
|
113
|
+
detail: this.checked
|
118
114
|
})
|
119
115
|
)
|
120
116
|
}
|
121
117
|
|
122
118
|
get checkedIcon() {
|
123
|
-
return html
|
124
|
-
<
|
125
|
-
|
119
|
+
return html`
|
120
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
121
|
+
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
|
122
|
+
</svg>
|
123
|
+
`
|
126
124
|
}
|
127
125
|
|
128
126
|
get uncheckedIcon() {
|
129
|
-
return html
|
130
|
-
<
|
131
|
-
|
127
|
+
return html`
|
128
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
129
|
+
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
|
130
|
+
</svg>
|
131
|
+
`
|
132
132
|
}
|
133
133
|
|
134
134
|
onKeyDown(e: KeyboardEvent) {
|
135
135
|
e.preventDefault()
|
136
136
|
|
137
|
-
if (e.
|
137
|
+
if (e.key === ' ' || e.key == 'Spacebar') {
|
138
138
|
this.onClick()
|
139
139
|
}
|
140
140
|
}
|
141
|
+
|
142
|
+
protected appendFormData({ formData }: FormDataEvent): void {
|
143
|
+
this.name && formData.append(this.name, this.checked ? 'true' : 'false')
|
144
|
+
}
|
141
145
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { LitElement } from 'lit-element'
|
2
|
+
import { property } from 'lit/decorators.js'
|
3
|
+
|
4
|
+
export abstract class OxFormField extends LitElement {
|
5
|
+
@property({ type: String }) name?: string
|
6
|
+
@property() value?: any
|
7
|
+
|
8
|
+
private _form: HTMLFormElement | null = null
|
9
|
+
private _formdataEventHandler: EventListener | null = null
|
10
|
+
|
11
|
+
override connectedCallback(): void {
|
12
|
+
super.connectedCallback()
|
13
|
+
|
14
|
+
if (this.name) {
|
15
|
+
this._form = this.closest('form')
|
16
|
+
if (this._form) {
|
17
|
+
this._formdataEventHandler = this.appendFormData.bind(this) as EventListener
|
18
|
+
this._form.addEventListener('formdata', this._formdataEventHandler)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
override disconnectedCallback(): void {
|
24
|
+
super.disconnectedCallback()
|
25
|
+
|
26
|
+
if (this._form) {
|
27
|
+
this._form.removeEventListener('formdata', this._formdataEventHandler!)
|
28
|
+
this._form = null
|
29
|
+
this._formdataEventHandler = null
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
protected appendFormData({ formData }: FormDataEvent): void {
|
34
|
+
this.name && formData.append(this.name, this.value)
|
35
|
+
}
|
36
|
+
}
|
package/src/ox-input-3dish.ts
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import { css, html
|
5
|
+
import { css, html } from 'lit'
|
6
6
|
import { customElement, property } from 'lit/decorators.js'
|
7
7
|
|
8
|
+
import { OxFormField } from './ox-formfield'
|
8
9
|
import { OxInputAngle } from './ox-input-angle'
|
9
10
|
|
10
11
|
@customElement('ox-input-3dish')
|
11
|
-
export class OxInput3Dish extends
|
12
|
+
export class OxInput3Dish extends OxFormField {
|
12
13
|
static styles = [
|
13
14
|
css`
|
14
15
|
:host {
|
@@ -32,19 +33,20 @@ export class OxInput3Dish extends LitElement {
|
|
32
33
|
`
|
33
34
|
]
|
34
35
|
|
35
|
-
@property({ type: Object }) dimension?: { width
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@property({ type: Object })
|
40
|
-
@property({ type: Object }) rotate?: { x: number; y: number; z: number }
|
41
|
-
@property({ type: Object }) scale?: { x: number; y: number; z: number }
|
36
|
+
@property({ type: Object }) dimension?: { width?: number; height?: number; depth?: number }
|
37
|
+
// translate는 고유한 html element의 attribute이므로, property는 translatex로 한다.
|
38
|
+
@property({ type: Object }) translatex?: { x?: number; y?: number; z?: number }
|
39
|
+
@property({ type: Object }) rotate?: { x?: number; y?: number; z?: number }
|
40
|
+
@property({ type: Object }) scale?: { x?: number; y?: number; z?: number }
|
42
41
|
|
43
42
|
firstUpdated() {
|
44
43
|
this.renderRoot.addEventListener('change', this._onChange.bind(this))
|
45
44
|
}
|
46
45
|
|
47
46
|
_onChange(e: Event) {
|
47
|
+
e.stopPropagation()
|
48
|
+
e.preventDefault()
|
49
|
+
|
48
50
|
var element = e.target as HTMLElement
|
49
51
|
var id = element.id
|
50
52
|
var prop = id.substr(1)
|
@@ -52,7 +54,7 @@ export class OxInput3Dish extends LitElement {
|
|
52
54
|
|
53
55
|
switch (element.tagName) {
|
54
56
|
case 'PROPERTY-ANGLE':
|
55
|
-
value = Number((element as OxInputAngle).
|
57
|
+
value = Number((element as OxInputAngle).value || 0)
|
56
58
|
break
|
57
59
|
}
|
58
60
|
|
@@ -60,15 +62,17 @@ export class OxInput3Dish extends LitElement {
|
|
60
62
|
case 'tx':
|
61
63
|
case 'ty':
|
62
64
|
case 'tz':
|
65
|
+
this.translatex = {
|
66
|
+
...this.translatex,
|
67
|
+
[prop]: value
|
68
|
+
}
|
69
|
+
|
63
70
|
this.dispatchEvent(
|
64
71
|
new CustomEvent('translate-changed', {
|
65
72
|
bubbles: true,
|
66
73
|
composed: true,
|
67
74
|
detail: {
|
68
|
-
value:
|
69
|
-
...this.translatex,
|
70
|
-
[prop]: value
|
71
|
-
}
|
75
|
+
value: this.translatex
|
72
76
|
}
|
73
77
|
})
|
74
78
|
)
|
@@ -77,15 +81,17 @@ export class OxInput3Dish extends LitElement {
|
|
77
81
|
case 'rx':
|
78
82
|
case 'ry':
|
79
83
|
case 'rz':
|
84
|
+
this.rotate = {
|
85
|
+
...this.rotate,
|
86
|
+
[prop]: value
|
87
|
+
}
|
88
|
+
|
80
89
|
this.dispatchEvent(
|
81
90
|
new CustomEvent('rotate-changed', {
|
82
91
|
bubbles: true,
|
83
92
|
composed: true,
|
84
93
|
detail: {
|
85
|
-
value:
|
86
|
-
...this.rotate,
|
87
|
-
[prop]: value
|
88
|
-
}
|
94
|
+
value: this.rotate
|
89
95
|
}
|
90
96
|
})
|
91
97
|
)
|
@@ -94,15 +100,17 @@ export class OxInput3Dish extends LitElement {
|
|
94
100
|
case 'sx':
|
95
101
|
case 'sy':
|
96
102
|
case 'sz':
|
103
|
+
this.scale = {
|
104
|
+
...this.scale,
|
105
|
+
[prop]: value
|
106
|
+
}
|
107
|
+
|
97
108
|
this.dispatchEvent(
|
98
109
|
new CustomEvent('scale-changed', {
|
99
110
|
bubbles: true,
|
100
111
|
composed: true,
|
101
112
|
detail: {
|
102
|
-
value:
|
103
|
-
...this.scale,
|
104
|
-
[prop]: value
|
105
|
-
}
|
113
|
+
value: this.scale
|
106
114
|
}
|
107
115
|
})
|
108
116
|
)
|
@@ -110,19 +118,36 @@ export class OxInput3Dish extends LitElement {
|
|
110
118
|
|
111
119
|
default:
|
112
120
|
// dimension
|
121
|
+
this.dimension = {
|
122
|
+
...this.dimension,
|
123
|
+
[prop]: value
|
124
|
+
}
|
125
|
+
|
113
126
|
this.dispatchEvent(
|
114
127
|
new CustomEvent('dimension-changed', {
|
115
128
|
bubbles: true,
|
116
129
|
composed: true,
|
117
130
|
detail: {
|
118
|
-
value:
|
119
|
-
...this.dimension,
|
120
|
-
[prop]: value
|
121
|
-
}
|
131
|
+
value: this.dimension
|
122
132
|
}
|
123
133
|
})
|
124
134
|
)
|
125
135
|
}
|
136
|
+
|
137
|
+
this.value = {
|
138
|
+
translate: this.translatex,
|
139
|
+
rotate: this.rotate,
|
140
|
+
scale: this.scale,
|
141
|
+
dimension: this.dimension
|
142
|
+
}
|
143
|
+
|
144
|
+
this.dispatchEvent(
|
145
|
+
new CustomEvent('change', {
|
146
|
+
bubbles: true,
|
147
|
+
composed: true,
|
148
|
+
detail: this.value
|
149
|
+
})
|
150
|
+
)
|
126
151
|
}
|
127
152
|
|
128
153
|
render() {
|
@@ -141,10 +166,19 @@ export class OxInput3Dish extends LitElement {
|
|
141
166
|
<input type="number" id="ty" .value=${this.translatex?.y} />
|
142
167
|
<input type="number" id="tz" .value=${this.translatex?.z} />
|
143
168
|
|
169
|
+
<label><i18n-msg msgid="label.scale">scale</i18n-msg></label>
|
170
|
+
<input type="number" id="sx" .value=${this.scale?.x} />
|
171
|
+
<input type="number" id="sy" .value=${this.scale?.y} />
|
172
|
+
<input type="number" id="sz" .value=${this.scale?.z} />
|
173
|
+
|
144
174
|
<label><i18n-msg msgid="label.rotate">rotate</i18n-msg></label>
|
145
|
-
<ox-input-angle id="rx" .
|
146
|
-
<ox-input-angle id="ry" .
|
147
|
-
<ox-input-angle id="rz" .
|
175
|
+
<ox-input-angle id="rx" .value=${this.rotate?.x}></ox-input-angle>
|
176
|
+
<ox-input-angle id="ry" .value=${this.rotate?.y}></ox-input-angle>
|
177
|
+
<ox-input-angle id="rz" .value=${this.rotate?.z}></ox-input-angle>
|
148
178
|
`
|
149
179
|
}
|
180
|
+
|
181
|
+
protected appendFormData({ formData }: FormDataEvent): void {
|
182
|
+
this.name && formData.append(this.name, JSON.stringify(this.value))
|
183
|
+
}
|
150
184
|
}
|
package/src/ox-input-angle.ts
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import { css, html
|
5
|
+
import { css, html } from 'lit'
|
6
6
|
import { customElement, property, query } from 'lit/decorators.js'
|
7
7
|
|
8
|
+
import { OxFormField } from './ox-formfield'
|
9
|
+
|
8
10
|
@customElement('ox-input-angle')
|
9
|
-
export class OxInputAngle extends
|
11
|
+
export class OxInputAngle extends OxFormField {
|
10
12
|
static styles = [
|
11
13
|
css`
|
12
14
|
:host {
|
@@ -22,32 +24,35 @@ export class OxInputAngle extends LitElement {
|
|
22
24
|
`
|
23
25
|
]
|
24
26
|
|
25
|
-
@property({ type:
|
27
|
+
@property({ type: String }) placeholder?: string
|
28
|
+
|
26
29
|
@query('input') input!: HTMLInputElement
|
27
30
|
|
28
31
|
render() {
|
29
32
|
return html`
|
30
33
|
<input
|
31
34
|
type="number"
|
32
|
-
.value=${this._toDegree(this.
|
35
|
+
.value=${this._toDegree(this.value)}
|
36
|
+
.placeholder=${this.placeholder || '0°'}
|
33
37
|
@change=${(e: Event) => this._onChangeValue(e)}
|
34
|
-
.placeholder=${this.placeholder}
|
35
38
|
/>
|
36
39
|
`
|
37
40
|
}
|
38
41
|
|
39
|
-
get placeholder() {
|
40
|
-
return this.getAttribute('placeholder') || '0°'
|
41
|
-
}
|
42
|
-
|
43
42
|
_onChangeValue(e: Event) {
|
44
|
-
this.
|
45
|
-
|
46
|
-
this.dispatchEvent(
|
43
|
+
this.value = this._toRadian(this.input.value)
|
44
|
+
|
45
|
+
this.dispatchEvent(
|
46
|
+
new CustomEvent('change', {
|
47
|
+
bubbles: true,
|
48
|
+
composed: true,
|
49
|
+
detail: this.value
|
50
|
+
})
|
51
|
+
)
|
47
52
|
}
|
48
53
|
|
49
|
-
_toDegree(
|
50
|
-
return Math.round(((Number(
|
54
|
+
_toDegree(value: string | number | undefined) {
|
55
|
+
return Math.round(((Number(value) || 0) * 180) / Math.PI)
|
51
56
|
}
|
52
57
|
|
53
58
|
_toRadian(degree: string | number | undefined) {
|