@operato/input 8.0.0-alpha.20 → 8.0.0-alpha.26
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 +18 -0
- package/dist/src/ox-input-signature.d.ts +4 -2
- package/dist/src/ox-input-signature.js +30 -7
- package/dist/src/ox-input-signature.js.map +1 -1
- package/dist/src/ox-select-floor.d.ts +2 -1
- package/dist/src/ox-select-floor.js +13 -7
- package/dist/src/ox-select-floor.js.map +1 -1
- package/dist/stories/ox-select-floor.stories.js +64 -40
- package/dist/stories/ox-select-floor.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ox-input-signature.ts +41 -10
- package/src/ox-select-floor.ts +14 -7
- package/stories/ox-select-floor.stories.ts +64 -40
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@operato/input",
|
3
3
|
"description": "Webcomponents for input following open-wc recommendations",
|
4
4
|
"author": "heartyoh@hatiolab.com",
|
5
|
-
"version": "8.0.0-alpha.
|
5
|
+
"version": "8.0.0-alpha.26",
|
6
6
|
"main": "dist/src/index.js",
|
7
7
|
"module": "dist/src/index.js",
|
8
8
|
"license": "MIT",
|
@@ -262,5 +262,5 @@
|
|
262
262
|
"prettier --write"
|
263
263
|
]
|
264
264
|
},
|
265
|
-
"gitHead": "
|
265
|
+
"gitHead": "14f757972a99c6c6807d3a7e8a555afbd4f891ce"
|
266
266
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import '@material/web/icon/icon.js'
|
2
2
|
|
3
|
-
import { css, html,
|
4
|
-
import { customElement, property, query
|
3
|
+
import { css, html, PropertyValues } from 'lit'
|
4
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
5
5
|
|
6
6
|
import { OxFormField } from './ox-form-field.js'
|
7
7
|
|
@@ -31,8 +31,6 @@ export class OxInputSignature extends OxFormField {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
dialog canvas {
|
34
|
-
width: 100%;
|
35
|
-
height: 100%;
|
36
34
|
border: 1px solid var(--md-sys-color-outline);
|
37
35
|
}
|
38
36
|
|
@@ -46,6 +44,19 @@ export class OxInputSignature extends OxFormField {
|
|
46
44
|
.filler {
|
47
45
|
flex: 1;
|
48
46
|
}
|
47
|
+
|
48
|
+
/* 버튼 스타일 */
|
49
|
+
button {
|
50
|
+
background-color: var(--md-sys-color-primary);
|
51
|
+
color: var(--md-sys-color-on-primary);
|
52
|
+
padding: 10px 20px;
|
53
|
+
border: none;
|
54
|
+
border-radius: var(--spacing-small);
|
55
|
+
font-family: 'Roboto', sans-serif;
|
56
|
+
font-size: 14px;
|
57
|
+
cursor: pointer;
|
58
|
+
transition: background-color 0.3s ease;
|
59
|
+
}
|
49
60
|
`
|
50
61
|
]
|
51
62
|
|
@@ -98,11 +109,19 @@ export class OxInputSignature extends OxFormField {
|
|
98
109
|
}
|
99
110
|
}
|
100
111
|
|
112
|
+
updated(changes: PropertyValues<this>) {
|
113
|
+
if (changes.has('value')) {
|
114
|
+
this.loadSignature(this.value)
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
101
118
|
openDialog() {
|
102
|
-
if (this.disabled)
|
119
|
+
if (this.disabled) {
|
120
|
+
return
|
121
|
+
}
|
122
|
+
|
103
123
|
this.dialog.showModal()
|
104
124
|
|
105
|
-
// 다이아로그가 열릴 때 현재 value를 캔버스에 그리기
|
106
125
|
if (this.value) {
|
107
126
|
const img = new Image()
|
108
127
|
img.onload = () => {
|
@@ -121,18 +140,30 @@ export class OxInputSignature extends OxFormField {
|
|
121
140
|
return
|
122
141
|
}
|
123
142
|
|
143
|
+
event.preventDefault()
|
144
|
+
event.stopPropagation()
|
145
|
+
|
124
146
|
this.isDrawing = true
|
125
147
|
this.ctx.beginPath()
|
126
148
|
const position = this.getEventPosition(event)
|
127
149
|
this.ctx.moveTo(position.x, position.y)
|
128
150
|
}
|
129
151
|
|
130
|
-
stopDrawing() {
|
152
|
+
stopDrawing(event: MouseEvent | TouchEvent) {
|
153
|
+
event.preventDefault()
|
154
|
+
event.stopPropagation()
|
155
|
+
|
131
156
|
this.isDrawing = false
|
132
157
|
}
|
133
158
|
|
134
159
|
draw(event: MouseEvent | TouchEvent) {
|
135
|
-
if (!this.isDrawing)
|
160
|
+
if (!this.isDrawing) {
|
161
|
+
return
|
162
|
+
}
|
163
|
+
|
164
|
+
event.preventDefault()
|
165
|
+
event.stopPropagation()
|
166
|
+
|
136
167
|
const position = this.getEventPosition(event)
|
137
168
|
this.ctx.lineTo(position.x, position.y)
|
138
169
|
this.ctx.stroke()
|
@@ -149,8 +180,8 @@ export class OxInputSignature extends OxFormField {
|
|
149
180
|
this.closeDialog()
|
150
181
|
}
|
151
182
|
|
152
|
-
loadSignature(dataUrl: string) {
|
153
|
-
this.previewDiv.style.backgroundImage = `url(${dataUrl})`
|
183
|
+
loadSignature(dataUrl: string | null) {
|
184
|
+
this.previewDiv.style.backgroundImage = dataUrl ? `url(${dataUrl})` : 'none'
|
154
185
|
}
|
155
186
|
|
156
187
|
getEventPosition(event: MouseEvent | TouchEvent) {
|
package/src/ox-select-floor.ts
CHANGED
@@ -57,14 +57,15 @@ export class OxSelectFloor extends OxFormField {
|
|
57
57
|
}
|
58
58
|
|
59
59
|
.selected {
|
60
|
-
z-index: 10;
|
61
60
|
opacity: 0.8;
|
61
|
+
z-index: 1;
|
62
62
|
border: 4px solid #3b82f6;
|
63
63
|
box-shadow: 0 8px 16px rgba(59, 130, 246, 0.4);
|
64
64
|
}
|
65
65
|
|
66
66
|
.selected.active {
|
67
67
|
opacity: 1;
|
68
|
+
z-index: 2;
|
68
69
|
transform: perspective(var(--ox-select-floor-perspective)) rotateX(var(--ox-select-floor-rotate-x-active));
|
69
70
|
box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
|
70
71
|
}
|
@@ -72,7 +73,7 @@ export class OxSelectFloor extends OxFormField {
|
|
72
73
|
[template-container] {
|
73
74
|
position: absolute;
|
74
75
|
right: 10px;
|
75
|
-
z-index:
|
76
|
+
z-index: 1;
|
76
77
|
}
|
77
78
|
`
|
78
79
|
]
|
@@ -88,6 +89,7 @@ export class OxSelectFloor extends OxFormField {
|
|
88
89
|
private isDragging = false
|
89
90
|
private lastTouchY = 0
|
90
91
|
private lastMouseY = 0
|
92
|
+
private startY = 0
|
91
93
|
|
92
94
|
render() {
|
93
95
|
const length = this.cards.length
|
@@ -162,15 +164,20 @@ export class OxSelectFloor extends OxFormField {
|
|
162
164
|
|
163
165
|
handleTouchStart(event: TouchEvent) {
|
164
166
|
this.lastTouchY = event.touches[0].clientY
|
167
|
+
this.startY = this.lastTouchY
|
165
168
|
}
|
166
169
|
|
167
170
|
handleTouchMove(event: TouchEvent) {
|
168
171
|
const touch = event.touches[0]
|
169
|
-
const deltaY = touch.clientY - this.
|
170
|
-
|
172
|
+
const deltaY = touch.clientY - this.lastMouseY
|
173
|
+
|
174
|
+
if (!this.lastMouseY) {
|
175
|
+
this.lastMouseY = touch.clientY
|
176
|
+
}
|
171
177
|
|
172
178
|
if (Math.abs(deltaY) > 30) {
|
173
|
-
|
179
|
+
this.lastMouseY = touch.clientY
|
180
|
+
const direction = deltaY > 0 ? -1 : 1
|
174
181
|
this.updateSelectedIndex(this.selectedIndex + direction)
|
175
182
|
}
|
176
183
|
}
|
@@ -234,11 +241,11 @@ export class OxSelectFloor extends OxFormField {
|
|
234
241
|
|
235
242
|
private selectCard(index: number) {
|
236
243
|
this.selectedIndex = index
|
237
|
-
this.
|
244
|
+
this.notifySelection()
|
238
245
|
this.scrollToSelectedCard()
|
239
246
|
}
|
240
247
|
|
241
|
-
private
|
248
|
+
private notifySelection() {
|
242
249
|
this.value = this.selectedIndex !== -1 ? this.cards[this.selectedIndex]?.name : undefined
|
243
250
|
|
244
251
|
this.dispatchEvent(
|
@@ -71,6 +71,23 @@ const Template: Story<ArgTypes> = ({
|
|
71
71
|
</style>
|
72
72
|
|
73
73
|
<style>
|
74
|
+
html,
|
75
|
+
body {
|
76
|
+
margin: 0;
|
77
|
+
padding: 0;
|
78
|
+
overflow: hidden;
|
79
|
+
|
80
|
+
overscroll-behavior-y: none;
|
81
|
+
|
82
|
+
/* This is a font-stack that tries to use the system-default sans-serifs first */
|
83
|
+
font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
84
|
+
line-height: 1.5;
|
85
|
+
-webkit-font-smoothing: antialiased;
|
86
|
+
|
87
|
+
accent-color: var(--md-sys-color-primary);
|
88
|
+
background-color: var(--md-sys-color-background);
|
89
|
+
}
|
90
|
+
|
74
91
|
.container {
|
75
92
|
height: 1000px;
|
76
93
|
text-align: center;
|
@@ -86,48 +103,55 @@ const Template: Story<ArgTypes> = ({
|
|
86
103
|
right: 0px;
|
87
104
|
bottom: 0px;
|
88
105
|
align-items: center;
|
89
|
-
z-index: 2;
|
90
106
|
right: 3%;
|
107
|
+
}
|
108
|
+
|
109
|
+
div[status] > div[content] {
|
110
|
+
display: flex;
|
111
|
+
background-color: #4e5055;
|
112
|
+
color: #fff;
|
113
|
+
padding: 5px 7px;
|
114
|
+
border-radius: 7px;
|
115
|
+
gap: 10px;
|
116
|
+
font-size: 14px;
|
117
|
+
}
|
118
|
+
|
119
|
+
div[status] span {
|
120
|
+
display: flex;
|
121
|
+
align-items: center;
|
122
|
+
width: 48px;
|
123
|
+
}
|
124
|
+
|
125
|
+
div[status] md-icon {
|
126
|
+
width: 20px;
|
127
|
+
height: 20px;
|
128
|
+
margin-right: 4px;
|
129
|
+
border-radius: 5px;
|
130
|
+
font-size: 21px;
|
131
|
+
font-weight: 700;
|
132
|
+
}
|
133
|
+
div[status] md-icon[request] {
|
134
|
+
background-color: #f7f7f7;
|
135
|
+
color: #4e5055;
|
136
|
+
}
|
137
|
+
div[status] md-icon[pass] {
|
138
|
+
background-color: #4bbb4a;
|
139
|
+
}
|
140
|
+
div[status] md-icon[fail] {
|
141
|
+
background-color: #ff4444;
|
142
|
+
}
|
143
|
+
|
144
|
+
span[name] {
|
145
|
+
width: 40px;
|
146
|
+
color: #4e5055;
|
147
|
+
margin-left: 6px;
|
148
|
+
text-align: center;
|
149
|
+
}
|
91
150
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
padding: 5px 7px;
|
97
|
-
border-radius: 7px;
|
98
|
-
gap: 10px;
|
99
|
-
font-size: 14px;
|
100
|
-
|
101
|
-
span {
|
102
|
-
display: flex;
|
103
|
-
align-items: center;
|
104
|
-
width: 48px;
|
105
|
-
|
106
|
-
md-icon {
|
107
|
-
width: 20px;
|
108
|
-
height: 20px;
|
109
|
-
margin-right: 4px;
|
110
|
-
border-radius: 5px;
|
111
|
-
font-size: 21px;
|
112
|
-
font-weight: 700;
|
113
|
-
}
|
114
|
-
md-icon[request] {
|
115
|
-
background-color: #f7f7f7;
|
116
|
-
color: #4e5055;
|
117
|
-
}
|
118
|
-
md-icon[pass] {
|
119
|
-
background-color: #4bbb4a;
|
120
|
-
}
|
121
|
-
md-icon[fail] {
|
122
|
-
background-color: #ff4444;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
span[name] {
|
127
|
-
color: #4e5055;
|
128
|
-
margin-left: 6px;
|
129
|
-
width: 40px;
|
130
|
-
}
|
151
|
+
span[name][active] {
|
152
|
+
color: var(--md-sys-color-on-error);
|
153
|
+
background-color: var(--md-sys-color-error);
|
154
|
+
border-radius: 999px;
|
131
155
|
}
|
132
156
|
|
133
157
|
ox-select-floor {
|