@operato/input 8.0.0-alpha.21 → 8.0.0-alpha.27

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/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.21",
5
+ "version": "8.0.0-alpha.27",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "license": "MIT",
@@ -216,8 +216,8 @@
216
216
  "@material/web": "^2.0.0",
217
217
  "@operato/color-picker": "^8.0.0-alpha.0",
218
218
  "@operato/i18n": "^8.0.0-alpha.0",
219
- "@operato/popup": "^8.0.0-alpha.4",
220
- "@operato/styles": "^8.0.0-alpha.4",
219
+ "@operato/popup": "^8.0.0-alpha.27",
220
+ "@operato/styles": "^8.0.0-alpha.27",
221
221
  "@operato/utils": "^8.0.0-alpha.0",
222
222
  "@polymer/paper-dropdown-menu": "^3.2.0",
223
223
  "@polymer/paper-item": "^3.0.1",
@@ -262,5 +262,5 @@
262
262
  "prettier --write"
263
263
  ]
264
264
  },
265
- "gitHead": "2a7eabbdab4073648f5d8bd49c02f2e62b7d3a8a"
265
+ "gitHead": "7f16dfa02491950f7a8782cb305605925a9e0be4"
266
266
  }
@@ -1,7 +1,7 @@
1
1
  import '@material/web/icon/icon.js'
2
2
 
3
- import { css, html, nothing } from 'lit'
4
- import { customElement, property, query, state } from 'lit/decorators.js'
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) return
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) return
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) {
@@ -9,7 +9,8 @@ body {
9
9
  /* monthly layout */
10
10
  --calendar-monthly-ol-margin: var(--margin-default) 0;
11
11
  --calendar-monthly-ol-top-border: 2px solid var(--md-sys-color-secondary);
12
- --calendar-current-monty-background-color: var(--md-sys-color-surface-variant);
12
+ --calendar-current-month-background-color: var(--md-sys-color-surface-variant);
13
+ --calendar-current-month-color: var(--md-sys-color-on-surface);
13
14
  --calendar-monthly-label-align: left;
14
15
  --calendar-monthly-label-padding: var(--padding-narrow) 0;
15
16
  --calendar-monthly-label-color: var(--md-sys-color-secondary);
@@ -35,6 +36,7 @@ body {
35
36
  --calendar-weekly-ol-margin: var(--margin-default) 0;
36
37
  --calendar-weekly-ol-top-border: 2px solid var(--md-sys-color-secondary);
37
38
  --calendar-current-week-background-color: var(--md-sys-color-surface-variant);
39
+ --calendar-current-week-color: var(--md-sys-color-on-surface);
38
40
  --calendar-weekly-label-align: center;
39
41
  --calendar-weekly-label-padding: var(--padding-narrow) 0;
40
42
  --calendar-weekly-label-color: var(--md-sys-color-secondary);