@operato/input 1.0.0-beta.5 → 1.0.0-beta.50
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/.storybook/main.js +2 -2
- package/.storybook/server.mjs +4 -4
- package/CHANGELOG.md +648 -0
- package/demo/index-multiple-colors.html +4 -1
- package/demo/index-partition-keys.html +2 -5
- package/demo/index-select.html +1 -1
- package/demo/index.html +4 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/locales/en.d.ts +8 -0
- package/dist/src/locales/en.js +8 -0
- package/dist/src/locales/en.js.map +1 -1
- package/dist/src/locales/ko.d.ts +8 -0
- package/dist/src/locales/ko.js +8 -0
- package/dist/src/locales/ko.js.map +1 -1
- package/dist/src/locales/ms.d.ts +8 -0
- package/dist/src/locales/ms.js +8 -0
- package/dist/src/locales/ms.js.map +1 -1
- package/dist/src/locales/zh.d.ts +8 -0
- package/dist/src/locales/zh.js +8 -0
- package/dist/src/locales/zh.js.map +1 -1
- package/dist/src/ox-input-3dish.js +24 -8
- package/dist/src/ox-input-3dish.js.map +1 -1
- package/dist/src/ox-input-barcode.d.ts +5 -2
- package/dist/src/ox-input-barcode.js +61 -31
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-color.js +16 -11
- package/dist/src/ox-input-color.js.map +1 -1
- package/dist/src/ox-input-crontab.js +28 -10
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-data.js +1 -1
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-duration.d.ts +13 -0
- package/dist/src/ox-input-duration.js +163 -0
- package/dist/src/ox-input-duration.js.map +1 -0
- package/dist/src/ox-input-file.js +5 -3
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/src/ox-input-key-values.d.ts +41 -0
- package/dist/src/ox-input-key-values.js +233 -0
- package/dist/src/ox-input-key-values.js.map +1 -0
- package/dist/src/ox-input-multiple-colors.d.ts +1 -0
- package/dist/src/ox-input-multiple-colors.js +29 -21
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.d.ts +1 -0
- package/dist/src/ox-input-options.js +55 -14
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.d.ts +1 -0
- package/dist/src/ox-input-partition-keys.js +51 -23
- package/dist/src/ox-input-partition-keys.js.map +1 -1
- package/dist/src/ox-input-quantifier.d.ts +11 -0
- package/dist/src/ox-input-quantifier.js +67 -0
- package/dist/src/ox-input-quantifier.js.map +1 -0
- package/dist/src/ox-input-range.js +35 -38
- package/dist/src/ox-input-range.js.map +1 -1
- package/dist/src/ox-input-search.d.ts +1 -0
- package/dist/src/ox-input-search.js +27 -5
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-unit.d.ts +17 -0
- package/dist/src/ox-input-unit.js +122 -0
- package/dist/src/ox-input-unit.js.map +1 -0
- package/dist/src/ox-input-value-map.d.ts +2 -2
- package/dist/src/ox-input-value-map.js +51 -15
- package/dist/src/ox-input-value-map.js.map +1 -1
- package/dist/src/ox-input-value-ranges.d.ts +2 -2
- package/dist/src/ox-input-value-ranges.js +50 -23
- package/dist/src/ox-input-value-ranges.js.map +1 -1
- package/dist/src/ox-input-work-shift.js +79 -44
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/src/ox-select.js +12 -3
- package/dist/src/ox-select.js.map +1 -1
- package/dist/stories/ox-checkbox.stories.d.ts +39 -0
- package/dist/stories/ox-checkbox.stories.js +44 -0
- package/dist/stories/ox-checkbox.stories.js.map +1 -0
- package/dist/stories/ox-input-3dish.stories.d.ts +26 -0
- package/dist/stories/ox-input-3dish.stories.js +59 -0
- package/dist/stories/ox-input-3dish.stories.js.map +1 -0
- package/dist/stories/ox-input-barcode.stories.d.ts +43 -0
- package/dist/stories/ox-input-barcode.stories.js +59 -0
- package/dist/stories/ox-input-barcode.stories.js.map +1 -0
- package/dist/stories/ox-input-crontab.stories.d.ts +25 -0
- package/dist/stories/ox-input-crontab.stories.js +35 -0
- package/dist/stories/ox-input-crontab.stories.js.map +1 -0
- package/dist/stories/ox-input-duration.stories.d.ts +26 -0
- package/dist/stories/ox-input-duration.stories.js +37 -0
- package/dist/stories/ox-input-duration.stories.js.map +1 -0
- package/dist/stories/ox-input-file.stories.d.ts +49 -0
- package/dist/stories/ox-input-file.stories.js +48 -0
- package/dist/stories/ox-input-file.stories.js.map +1 -0
- package/dist/stories/{index.stories.d.ts → ox-input-key-values.stories.d.ts} +7 -11
- package/dist/stories/ox-input-key-values.stories.js +49 -0
- package/dist/stories/ox-input-key-values.stories.js.map +1 -0
- package/dist/stories/ox-input-multiple-colors.stories.d.ts +20 -0
- package/dist/stories/ox-input-multiple-colors.stories.js +167 -0
- package/dist/stories/ox-input-multiple-colors.stories.js.map +1 -0
- package/dist/stories/ox-input-options.stories.d.ts +25 -0
- package/dist/stories/ox-input-options.stories.js +33 -0
- package/dist/stories/ox-input-options.stories.js.map +1 -0
- package/dist/stories/ox-input-partition-keys.stories.d.ts +25 -0
- package/dist/stories/ox-input-partition-keys.stories.js +37 -0
- package/dist/stories/ox-input-partition-keys.stories.js.map +1 -0
- package/dist/stories/ox-input-quantifier.stories.d.ts +25 -0
- package/dist/stories/ox-input-quantifier.stories.js +27 -0
- package/dist/stories/ox-input-quantifier.stories.js.map +1 -0
- package/dist/stories/ox-input-range.stories.d.ts +37 -0
- package/dist/stories/ox-input-range.stories.js +28 -0
- package/dist/stories/ox-input-range.stories.js.map +1 -0
- package/dist/stories/ox-input-search.stories.d.ts +33 -0
- package/dist/stories/ox-input-search.stories.js +35 -0
- package/dist/stories/ox-input-search.stories.js.map +1 -0
- package/dist/stories/ox-input-unit.stories.d.ts +40 -0
- package/dist/stories/ox-input-unit.stories.js +42 -0
- package/dist/stories/ox-input-unit.stories.js.map +1 -0
- package/dist/stories/ox-input-value-map.stories.d.ts +35 -0
- package/dist/stories/ox-input-value-map.stories.js +37 -0
- package/dist/stories/ox-input-value-map.stories.js.map +1 -0
- package/dist/stories/ox-input-value-ranges.stories.d.ts +35 -0
- package/dist/stories/ox-input-value-ranges.stories.js +37 -0
- package/dist/stories/ox-input-value-ranges.stories.js.map +1 -0
- package/dist/stories/ox-input-work-shift.stories.d.ts +26 -0
- package/dist/stories/ox-input-work-shift.stories.js +59 -0
- package/dist/stories/ox-input-work-shift.stories.js.map +1 -0
- package/dist/stories/ox-select-dynamic.stories.d.ts +28 -0
- package/dist/stories/ox-select-dynamic.stories.js +60 -0
- package/dist/stories/ox-select-dynamic.stories.js.map +1 -0
- package/dist/stories/ox-select.stories copy.d.ts +30 -0
- package/dist/stories/ox-select.stories copy.js +83 -0
- package/dist/stories/ox-select.stories copy.js.map +1 -0
- package/dist/stories/ox-select.stories.d.ts +30 -0
- package/dist/stories/ox-select.stories.js +83 -0
- package/dist/stories/ox-select.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -13
- package/src/index.ts +4 -2
- package/src/locales/en.ts +8 -0
- package/src/locales/ko.ts +8 -0
- package/src/locales/ms.ts +8 -0
- package/src/locales/zh.ts +8 -0
- package/src/ox-input-3dish.ts +24 -8
- package/src/ox-input-barcode.ts +67 -34
- package/src/ox-input-color.ts +17 -11
- package/src/ox-input-crontab.ts +30 -10
- package/src/ox-input-data.ts +2 -2
- package/src/ox-input-duration.ts +168 -0
- package/src/ox-input-file.ts +7 -6
- package/src/ox-input-key-values.ts +270 -0
- package/src/ox-input-multiple-colors.ts +29 -21
- package/src/ox-input-options.ts +54 -13
- package/src/ox-input-partition-keys.ts +51 -22
- package/src/ox-input-quantifier.ts +62 -0
- package/src/ox-input-range.ts +35 -38
- package/src/ox-input-search.ts +29 -5
- package/src/ox-input-unit.ts +123 -0
- package/src/ox-input-value-map.ts +52 -16
- package/src/ox-input-value-ranges.ts +52 -25
- package/src/ox-input-work-shift.ts +81 -44
- package/src/ox-select.ts +19 -5
- package/stories/ox-checkbox.stories.ts +69 -0
- package/stories/ox-input-3dish.stories.ts +73 -0
- package/stories/ox-input-barcode.stories.ts +85 -0
- package/stories/ox-input-code.stories.ts_ +51 -0
- package/stories/ox-input-crontab.stories.ts +49 -0
- package/stories/ox-input-duration.stories.ts +51 -0
- package/stories/ox-input-file.stories.ts +77 -0
- package/stories/ox-input-key-values.stories.ts +64 -0
- package/stories/ox-input-multiple-colors.stories.ts +178 -0
- package/stories/ox-input-options.stories.ts +47 -0
- package/stories/ox-input-partition-keys.stories.ts +51 -0
- package/stories/ox-input-quantifier.stories.ts +43 -0
- package/stories/ox-input-range.stories.ts +45 -0
- package/stories/ox-input-search.stories.ts +56 -0
- package/stories/ox-input-unit.stories.ts +66 -0
- package/stories/ox-input-value-map.stories.ts +58 -0
- package/stories/ox-input-value-ranges.stories.ts +58 -0
- package/stories/ox-input-work-shift.stories.ts +73 -0
- package/stories/ox-select.stories.ts +101 -0
- package/themes/app-theme.css +142 -0
- package/themes/input-theme.css +19 -0
- package/translations/en.json +45 -1
- package/translations/ko.json +43 -1
- package/translations/ms.json +43 -1
- package/translations/zh.json +43 -1
- package/xliff/en.xlf +24 -0
- package/xliff/ko.xlf +32 -0
- package/xliff/ms.xlf +24 -0
- package/xliff/zh.xlf +24 -0
- package/dist/stories/index.stories.js +0 -33
- package/dist/stories/index.stories.js.map +0 -1
- package/stories/index.stories.ts +0 -52
package/src/ox-input-3dish.ts
CHANGED
@@ -16,21 +16,37 @@ export class OxInput3Dish extends OxFormField {
|
|
16
16
|
css`
|
17
17
|
:host {
|
18
18
|
display: grid;
|
19
|
-
grid-template-columns: repeat(
|
20
|
-
grid-gap:
|
21
|
-
grid-auto-rows: minmax(24px, auto);
|
22
|
-
}
|
23
|
-
|
24
|
-
:host > * {
|
25
|
-
grid-column: span 1;
|
19
|
+
grid-template-columns: repeat(7, minmax(50px, 1fr));
|
20
|
+
grid-gap: var(--margin-default);
|
26
21
|
}
|
27
22
|
|
28
23
|
label {
|
29
24
|
text-align: right;
|
25
|
+
align-self: center;
|
26
|
+
font: var(--label-font);
|
27
|
+
color: var(--label-color);
|
28
|
+
text-transform: var(--label-text-transform);
|
29
|
+
grid-column: span 1;
|
30
30
|
}
|
31
31
|
|
32
32
|
span {
|
33
|
+
grid-column: span 2;
|
33
34
|
text-align: center;
|
35
|
+
font: var(--label-font);
|
36
|
+
color: var(--legend-color);
|
37
|
+
}
|
38
|
+
|
39
|
+
input {
|
40
|
+
grid-column: span 2;
|
41
|
+
border: 0;
|
42
|
+
border-bottom: var(--border-dark-color);
|
43
|
+
padding: var(--input-padding);
|
44
|
+
font: var(--input-font);
|
45
|
+
color: var(--primary-text-color);
|
46
|
+
}
|
47
|
+
input:focus {
|
48
|
+
outline: none;
|
49
|
+
border-bottom: 1px solid var(--primary-color);
|
34
50
|
}
|
35
51
|
`
|
36
52
|
]
|
@@ -154,7 +170,7 @@ export class OxInput3Dish extends OxFormField {
|
|
154
170
|
|
155
171
|
render() {
|
156
172
|
return html`
|
157
|
-
<
|
173
|
+
<label></label> <span>${msg('x-axes')}</span>
|
158
174
|
<span>${msg('y-axes')}</span>
|
159
175
|
<span>${msg('z-axes')}</span>
|
160
176
|
|
package/src/ox-input-barcode.ts
CHANGED
@@ -3,9 +3,10 @@ import '@operato/popup/ox-popup.js'
|
|
3
3
|
import { css, html } from 'lit'
|
4
4
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
5
5
|
|
6
|
+
import { OxPopup } from '@operato/popup'
|
6
7
|
import { BrowserMultiFormatReader } from '@zxing/library'
|
8
|
+
|
7
9
|
import { OxFormField } from './ox-form-field.js'
|
8
|
-
import { OxPopup } from '@operato/popup'
|
9
10
|
|
10
11
|
const barcodeIcon = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAYBAMAAAAfR1CMAAADKGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpFNjM4RURDQkQ1OUExMUU5QkExMkQ4NUY3NkMxNzBFOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpFNjM4RURDQ0Q1OUExMUU5QkExMkQ4NUY3NkMxNzBFOSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkU2MzhFREM5RDU5QTExRTlCQTEyRDg1Rjc2QzE3MEU5IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkU2MzhFRENBRDU5QTExRTlCQTEyRDg1Rjc2QzE3MEU5Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+55pr/QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAkUExURQAAAEdwTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEus/7UCWQwAAAALdFJOU9YAg3wKBFBDSz9PnvQNDgAAAE9JREFUGNNjEEQFDKLJSnCOklkgg9QUJFn3RgZhRyS+iCGDEIp2RSBfQICRkRGIgTSQL4jCF6ScvxsZYOFT2T50/6D7Fz080MMLPTzRwhsAHVspfelur08AAAAASUVORK5CYII=`
|
11
12
|
|
@@ -17,10 +18,6 @@ export class OxInputBarcode extends OxFormField {
|
|
17
18
|
display: flex;
|
18
19
|
align-items: center;
|
19
20
|
border: none;
|
20
|
-
overflow: hidden;
|
21
|
-
background-color: #fff;
|
22
|
-
|
23
|
-
padding: var(--custom-input-barcode-field-padding) !important;
|
24
21
|
}
|
25
22
|
|
26
23
|
* {
|
@@ -32,23 +29,27 @@ export class OxInputBarcode extends OxFormField {
|
|
32
29
|
}
|
33
30
|
|
34
31
|
input {
|
35
|
-
flex: 1
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
flex: 1;
|
33
|
+
width: 10px; /* intentionally width set */
|
34
|
+
border: 0;
|
35
|
+
border-bottom: var(--border-dark-color);
|
36
|
+
padding: var(--input-padding);
|
37
|
+
padding-right: 35px;
|
38
|
+
font: var(--input-font);
|
39
|
+
color: var(--primary-text-color);
|
40
|
+
}
|
41
|
+
input:focus {
|
42
|
+
outline: none;
|
43
|
+
border-bottom: 1px solid var(--primary-color);
|
40
44
|
}
|
41
45
|
|
42
46
|
#scan-button {
|
43
47
|
display: block;
|
48
|
+
position: relative;
|
49
|
+
margin-left: -30px;
|
44
50
|
width: 30px;
|
45
|
-
height: 100%;
|
46
|
-
min-height: 24px;
|
47
51
|
border: none;
|
48
|
-
background
|
49
|
-
background-repeat: no-repeat;
|
50
|
-
background-position: center;
|
51
|
-
background-image: var(--barcodescan-input-button-icon);
|
52
|
+
background: var(--barcodescan-input-button-icon) no-repeat center center;
|
52
53
|
}
|
53
54
|
|
54
55
|
#scan-button[hidden] {
|
@@ -84,6 +85,8 @@ export class OxInputBarcode extends OxFormField {
|
|
84
85
|
@property({ type: Boolean }) scannable?: boolean
|
85
86
|
@property({ attribute: 'without-enter', type: Boolean }) withoutEnter?: boolean
|
86
87
|
@property({ type: String }) declare value?: string
|
88
|
+
@property({ attribute: 'english-only', type: Boolean }) englishOnly?: boolean
|
89
|
+
@property({ attribute: 'select-after-change', type: Boolean }) selectAfterChange?: boolean
|
87
90
|
|
88
91
|
@state() stream?: MediaStream
|
89
92
|
@state() reader?: BrowserMultiFormatReader
|
@@ -123,9 +126,8 @@ export class OxInputBarcode extends OxFormField {
|
|
123
126
|
<input
|
124
127
|
type="text"
|
125
128
|
.value=${this.value || ''}
|
126
|
-
|
127
|
-
@
|
128
|
-
@keypress=${(e: Event) => this.onChange(e)}
|
129
|
+
@change=${(e: Event) => this.onInputChange(e)}
|
130
|
+
@keydown=${(e: KeyboardEvent) => this.onInputKeyDown(e)}
|
129
131
|
/>
|
130
132
|
<button
|
131
133
|
?hidden=${!this.scannable}
|
@@ -145,11 +147,49 @@ export class OxInputBarcode extends OxFormField {
|
|
145
147
|
`
|
146
148
|
}
|
147
149
|
|
148
|
-
|
150
|
+
onInputChange(e: Event) {
|
149
151
|
e.stopPropagation()
|
150
|
-
|
151
|
-
|
152
|
-
|
152
|
+
|
153
|
+
if (this.englishOnly) {
|
154
|
+
/* englishOnly 인 경우에는 멀티바이트 문자들을 모두 제거한다. */
|
155
|
+
this.value = this.input.value = this.input.value?.replace(/[^\x00-\x7F]/g, '')
|
156
|
+
} else {
|
157
|
+
this.value = this.input.value
|
158
|
+
}
|
159
|
+
|
160
|
+
if (this.selectAfterChange) {
|
161
|
+
requestAnimationFrame(() => {
|
162
|
+
this.input.select()
|
163
|
+
})
|
164
|
+
}
|
165
|
+
|
166
|
+
this.dispatchEvent(
|
167
|
+
new CustomEvent('change', {
|
168
|
+
detail: this.value
|
169
|
+
})
|
170
|
+
)
|
171
|
+
}
|
172
|
+
|
173
|
+
onInputKeyDown(e: KeyboardEvent) {
|
174
|
+
if (e.key === 'Enter' && !e.isComposing) {
|
175
|
+
/* Even if the value has not changed, the enter key triggers a change event. */
|
176
|
+
e.preventDefault() /* Prevent change event from occurring twice. */
|
177
|
+
|
178
|
+
this.input.dispatchEvent(new CustomEvent('change'))
|
179
|
+
} else if (this.englishOnly && !e.metaKey && !e.ctrlKey && !e.altKey && /^Key/.test(e.code)) {
|
180
|
+
e.stopPropagation()
|
181
|
+
e.preventDefault()
|
182
|
+
|
183
|
+
/* englishOnly 인 경우에 문자들은 여기에서 처리한다. 멀티바이트 문자들이 대부분 알파벳의 자모음을 조합하므로, ... */
|
184
|
+
const key = e.shiftKey ? e.code.charAt(3) : e.code.charAt(3).toLowerCase()
|
185
|
+
const value = this.input.value
|
186
|
+
|
187
|
+
const start = this.input.selectionStart || 0
|
188
|
+
const end = this.input.selectionEnd || start
|
189
|
+
|
190
|
+
this.input.value = [value.substring(0, start), key, value.substring(end)].join('')
|
191
|
+
this.input.setSelectionRange(start + 1, start + 1)
|
192
|
+
}
|
153
193
|
}
|
154
194
|
|
155
195
|
async scan(e: MouseEvent) {
|
@@ -170,14 +210,7 @@ export class OxInputBarcode extends OxFormField {
|
|
170
210
|
this.value = input.value = String(result)
|
171
211
|
|
172
212
|
if (!this.withoutEnter) {
|
173
|
-
input.dispatchEvent(new KeyboardEvent('
|
174
|
-
input.dispatchEvent(
|
175
|
-
new CustomEvent('change', {
|
176
|
-
bubbles: true,
|
177
|
-
composed: true,
|
178
|
-
detail: this.value
|
179
|
-
})
|
180
|
-
)
|
213
|
+
input.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }))
|
181
214
|
}
|
182
215
|
} else {
|
183
216
|
/* popup이 비동기 진행 중에 close된 경우라면, stopScan()을 처리하지 못하게 되므로, 다시한번 clear해준다. */
|
@@ -197,10 +230,10 @@ export class OxInputBarcode extends OxFormField {
|
|
197
230
|
}
|
198
231
|
|
199
232
|
stopScan() {
|
200
|
-
this.video
|
233
|
+
this.video?.pause()
|
201
234
|
|
202
|
-
this.stream
|
203
|
-
this.reader
|
235
|
+
this.stream?.getTracks().forEach(track => track.stop())
|
236
|
+
this.reader?.reset()
|
204
237
|
|
205
238
|
delete this.stream
|
206
239
|
delete this.reader
|
package/src/ox-input-color.ts
CHANGED
@@ -7,9 +7,10 @@ import '@operato/color-picker/paper-color-picker.js'
|
|
7
7
|
import { css, html } from 'lit'
|
8
8
|
import { customElement, property } from 'lit/decorators.js'
|
9
9
|
|
10
|
-
import { OxFormField } from './ox-form-field'
|
11
10
|
import { tinycolor } from '@thebespokepixel/es-tinycolor'
|
12
11
|
|
12
|
+
import { OxFormField } from './ox-form-field'
|
13
|
+
|
13
14
|
/**
|
14
15
|
색상을 입력하는데 사용되는 입력 컴포넌트이다.
|
15
16
|
화면상에는 두개의 입력 필드가 보이며, 하나는 색상값을 키보드로 직접 입력하는 입력 픽드이며,
|
@@ -180,18 +181,24 @@ export class OxInputColor extends OxFormField {
|
|
180
181
|
}
|
181
182
|
|
182
183
|
input[type='text'] {
|
183
|
-
padding-right: 24px;
|
184
184
|
width: 100%;
|
185
|
-
|
186
|
-
|
187
|
-
|
185
|
+
border: 0;
|
186
|
+
border-bottom: var(--border-dark-color);
|
187
|
+
padding: var(--input-padding);
|
188
|
+
font: var(--input-font);
|
189
|
+
color: var(--primary-text-color);
|
190
|
+
padding-right: 35px;
|
191
|
+
}
|
192
|
+
input:focus {
|
193
|
+
outline: none;
|
194
|
+
border-bottom: 1px solid var(--primary-color);
|
188
195
|
}
|
189
196
|
|
190
197
|
a {
|
191
198
|
-webkit-appearance: none;
|
192
199
|
display: flex;
|
193
200
|
position: absolute;
|
194
|
-
width:
|
201
|
+
width: 35px;
|
195
202
|
height: 100%;
|
196
203
|
box-sizing: border-box;
|
197
204
|
align-items: center;
|
@@ -199,11 +206,10 @@ export class OxInputColor extends OxFormField {
|
|
199
206
|
}
|
200
207
|
|
201
208
|
span {
|
202
|
-
width:
|
203
|
-
height:
|
204
|
-
|
205
|
-
border-radius:
|
206
|
-
border: 1px solid #eee;
|
209
|
+
width: 80%;
|
210
|
+
height: 60%;
|
211
|
+
border: var(--border-dark-color);
|
212
|
+
border-radius: var(--border-radius);
|
207
213
|
}
|
208
214
|
|
209
215
|
span.transparent {
|
package/src/ox-input-crontab.ts
CHANGED
@@ -84,7 +84,6 @@ export class OxInputCrontab extends OxFormField {
|
|
84
84
|
width: 100%;
|
85
85
|
height: 100%;
|
86
86
|
border: 0;
|
87
|
-
background-color: var(--main-section-background-color);
|
88
87
|
}
|
89
88
|
|
90
89
|
:host * {
|
@@ -118,32 +117,36 @@ export class OxInputCrontab extends OxFormField {
|
|
118
117
|
grid-column: 4 / span 3;
|
119
118
|
width: 100%;
|
120
119
|
height: 100%;
|
121
|
-
|
120
|
+
padding: var(--input-padding);
|
121
|
+
border: 0;
|
122
|
+
border-bottom: var(--border-dark-color);
|
122
123
|
text-transform: capitalize;
|
123
|
-
|
124
|
-
|
124
|
+
font: var(--label-font);
|
125
|
+
color: var(--label-color);
|
125
126
|
}
|
126
127
|
|
127
128
|
input {
|
128
129
|
width: 100%;
|
129
130
|
margin-top: var(--margin-default);
|
130
131
|
padding: 5px;
|
131
|
-
border
|
132
|
-
border: var(--border-dark-color);
|
133
|
-
|
132
|
+
border: 0;
|
133
|
+
border-bottom: var(--border-dark-color);
|
134
|
+
padding: var(--input-padding);
|
135
|
+
font: var(--input-font);
|
136
|
+
color: var(--primary-text-color);
|
134
137
|
}
|
135
138
|
input:focus {
|
136
|
-
|
139
|
+
outline: none;
|
140
|
+
border-bottom: 1px solid var(--primary-color);
|
137
141
|
}
|
138
142
|
|
139
143
|
input:invalid {
|
140
|
-
border: 1px solid var(--status-danger-color);
|
144
|
+
border-bottom: 1px solid var(--status-danger-color);
|
141
145
|
color: var(--status-danger-color);
|
142
146
|
}
|
143
147
|
|
144
148
|
label {
|
145
149
|
width: 100%;
|
146
|
-
height: 100%;
|
147
150
|
font: normal 0.8em var(--theme-font);
|
148
151
|
color: var(--primary-color);
|
149
152
|
}
|
@@ -370,6 +373,23 @@ export class OxInputCrontab extends OxFormField {
|
|
370
373
|
`
|
371
374
|
)}
|
372
375
|
</div>
|
376
|
+
<button
|
377
|
+
id="clear"
|
378
|
+
@click=${(e: Event) => {
|
379
|
+
e.preventDefault()
|
380
|
+
e.stopPropagation()
|
381
|
+
this.value = ''
|
382
|
+
this.dispatchEvent(
|
383
|
+
new CustomEvent('change', {
|
384
|
+
bubbles: true,
|
385
|
+
composed: true,
|
386
|
+
detail: this.value
|
387
|
+
})
|
388
|
+
)
|
389
|
+
}}
|
390
|
+
>
|
391
|
+
Clear
|
392
|
+
</button>
|
373
393
|
</form>
|
374
394
|
`
|
375
395
|
}
|
package/src/ox-input-data.ts
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
import './ox-input-code'
|
6
6
|
|
7
|
-
import {
|
7
|
+
import { css, html, PropertyValues } from 'lit'
|
8
|
+
import { customElement } from 'lit/decorators.js'
|
8
9
|
|
9
10
|
import { OxFormField } from './ox-form-field.js'
|
10
11
|
import { OxInputCode } from './ox-input-code.js'
|
11
|
-
import { customElement } from 'lit/decorators.js'
|
12
12
|
|
13
13
|
/**
|
14
14
|
WEB Component for code-mirror based data editor.
|
@@ -0,0 +1,168 @@
|
|
1
|
+
import '@material/mwc-button'
|
2
|
+
|
3
|
+
import { css, html } from 'lit'
|
4
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
5
|
+
|
6
|
+
import { i18next } from '@operato/i18n'
|
7
|
+
|
8
|
+
import { OxFormField } from './ox-form-field'
|
9
|
+
|
10
|
+
@customElement('ox-input-duration')
|
11
|
+
export class OxInputDuration extends OxFormField {
|
12
|
+
static styles = css`
|
13
|
+
:host {
|
14
|
+
text-align: center;
|
15
|
+
padding: 10px;
|
16
|
+
}
|
17
|
+
|
18
|
+
:host * {
|
19
|
+
box-sizing: border-box;
|
20
|
+
}
|
21
|
+
|
22
|
+
:host *:focus {
|
23
|
+
outline: none;
|
24
|
+
}
|
25
|
+
|
26
|
+
form {
|
27
|
+
width: 100%;
|
28
|
+
height: 100%;
|
29
|
+
justify-content: center;
|
30
|
+
}
|
31
|
+
|
32
|
+
input {
|
33
|
+
border: 0;
|
34
|
+
border-bottom: var(--border-dark-color);
|
35
|
+
padding: var(--input-padding);
|
36
|
+
padding-right: 0;
|
37
|
+
max-width: 70px;
|
38
|
+
font: var(--input-font);
|
39
|
+
color: var(--primary-text-color);
|
40
|
+
text-align: right;
|
41
|
+
}
|
42
|
+
|
43
|
+
input:focus {
|
44
|
+
outline: none;
|
45
|
+
border-bottom: 1px solid var(--primary-color);
|
46
|
+
}
|
47
|
+
|
48
|
+
input:invalid {
|
49
|
+
border-bottom: 1px solid var(--status-danger-color);
|
50
|
+
color: var(--status-danger-color);
|
51
|
+
}
|
52
|
+
|
53
|
+
label {
|
54
|
+
width: 100%;
|
55
|
+
margin-right: var(--margin-default);
|
56
|
+
font: normal 0.8em var(--theme-font);
|
57
|
+
color: var(--primary-color);
|
58
|
+
}
|
59
|
+
|
60
|
+
button {
|
61
|
+
border: var(--button-border);
|
62
|
+
border-radius: var(--border-radius);
|
63
|
+
background-color: var(--button-background-color);
|
64
|
+
padding: var(--padding-narrow) var(--padding-default);
|
65
|
+
min-height: 35px;
|
66
|
+
line-height: 0.8;
|
67
|
+
color: var(--button-color);
|
68
|
+
cursor: pointer;
|
69
|
+
}
|
70
|
+
button + button {
|
71
|
+
margin-left: -5px;
|
72
|
+
}
|
73
|
+
button mwc-icon {
|
74
|
+
font-size: var(--fontsize-default);
|
75
|
+
}
|
76
|
+
button:focus,
|
77
|
+
button:hover,
|
78
|
+
button:active {
|
79
|
+
border: var(--button-activ-border);
|
80
|
+
background-color: var(--button-background-focus-color);
|
81
|
+
color: var(--theme-white-color);
|
82
|
+
}
|
83
|
+
`
|
84
|
+
|
85
|
+
@property({ type: Number }) declare value?: number
|
86
|
+
|
87
|
+
render() {
|
88
|
+
var d = Number(this.value || 0)
|
89
|
+
|
90
|
+
const days = Math.floor(d / (3600 * 24))
|
91
|
+
d -= days * 24 * 3600
|
92
|
+
const hours = Math.floor(d / 3600)
|
93
|
+
d -= hours * 3600
|
94
|
+
const minutes = Math.floor(d / 60)
|
95
|
+
const seconds = d - minutes * 60
|
96
|
+
|
97
|
+
return html`
|
98
|
+
<form @change=${this.onChange.bind(this)}>
|
99
|
+
<input id="days" type="number" .value=${days} pattern="\\d*" />
|
100
|
+
<label for="days">${i18next.t('label.days')}</label>
|
101
|
+
|
102
|
+
<input id="hours" type="number" .value=${hours} pattern="[01]?\\d|2[0-3]" />
|
103
|
+
<label for="hour">${i18next.t('label.hours')}</label>
|
104
|
+
|
105
|
+
<input id="minutes" type="number" .value=${minutes} pattern="[0-5]?\\d" />
|
106
|
+
<label for="minute">${i18next.t('label.minutes')}</label>
|
107
|
+
|
108
|
+
<input id="seconds" type="number" .value=${seconds} pattern="[0-5]?\\d" />
|
109
|
+
<label for="second">${i18next.t('label.seconds')}</label>
|
110
|
+
|
111
|
+
<button
|
112
|
+
type="button"
|
113
|
+
@click=${(e: Event) => {
|
114
|
+
e.preventDefault()
|
115
|
+
e.stopPropagation()
|
116
|
+
|
117
|
+
this.value = 0
|
118
|
+
|
119
|
+
this.dispatchEvent(
|
120
|
+
new CustomEvent('change', {
|
121
|
+
bubbles: true,
|
122
|
+
composed: true,
|
123
|
+
detail: this.value
|
124
|
+
})
|
125
|
+
)
|
126
|
+
}}
|
127
|
+
>
|
128
|
+
<mwc-icon>backspace</mwc-icon>
|
129
|
+
</button>
|
130
|
+
</form>
|
131
|
+
`
|
132
|
+
}
|
133
|
+
|
134
|
+
firstUpdated() {
|
135
|
+
;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()
|
136
|
+
}
|
137
|
+
|
138
|
+
@query('#days') days!: HTMLInputElement
|
139
|
+
@query('#hours') hours!: HTMLInputElement
|
140
|
+
@query('#minutes') minutes!: HTMLInputElement
|
141
|
+
@query('#seconds') seconds!: HTMLInputElement
|
142
|
+
|
143
|
+
onChange(e: Event) {
|
144
|
+
e.stopPropagation()
|
145
|
+
|
146
|
+
var form = this.renderRoot.querySelector('form') as HTMLFormElement
|
147
|
+
var valid = form.checkValidity()
|
148
|
+
if (!valid) {
|
149
|
+
form.reportValidity()
|
150
|
+
return
|
151
|
+
}
|
152
|
+
|
153
|
+
const days = Number(this.days.value)
|
154
|
+
const hours = Number(this.hours.value)
|
155
|
+
const minutes = Number(this.minutes.value)
|
156
|
+
const seconds = Number(this.seconds.value)
|
157
|
+
|
158
|
+
this.value = (days || 0) * 24 * 60 * 60 + (hours || 0) * 60 * 60 + (minutes || 0) * 60 + (seconds || 0)
|
159
|
+
|
160
|
+
this.dispatchEvent(
|
161
|
+
new CustomEvent('change', {
|
162
|
+
bubbles: true,
|
163
|
+
composed: true,
|
164
|
+
detail: this.value
|
165
|
+
})
|
166
|
+
)
|
167
|
+
}
|
168
|
+
}
|
package/src/ox-input-file.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
import '@material/mwc-icon'
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { css, html, PropertyValues } from 'lit'
|
4
4
|
import { customElement, property, query } from 'lit/decorators.js'
|
5
5
|
|
6
|
+
import { ScrollbarStyles } from '@operato/styles'
|
6
7
|
import { FileDropHelper } from '@operato/utils'
|
8
|
+
|
7
9
|
import { OxFormField } from './ox-form-field.js'
|
8
|
-
import { ScrollbarStyles } from '@operato/styles'
|
9
10
|
|
10
11
|
@customElement('ox-input-file')
|
11
12
|
export class OxInputFile extends OxFormField {
|
@@ -85,9 +86,9 @@ export class OxInputFile extends OxFormField {
|
|
85
86
|
|
86
87
|
@property({ type: Boolean }) multiple?: boolean
|
87
88
|
@property({ type: String }) accept?: string
|
88
|
-
@property({ type: String }) icon?: string
|
89
|
+
@property({ type: String }) icon?: string = 'upload'
|
89
90
|
@property({ type: String }) label?: string
|
90
|
-
@property({ type: String }) description?: string
|
91
|
+
@property({ type: String }) description?: string = 'drop files here!'
|
91
92
|
@property({ type: Boolean, reflect: true, attribute: 'hide-filelist' })
|
92
93
|
hideFileList: boolean = false
|
93
94
|
@property({ type: Boolean, reflect: true, attribute: 'attach-filelist' })
|
@@ -99,9 +100,9 @@ export class OxInputFile extends OxFormField {
|
|
99
100
|
var files: File[] = this.value || []
|
100
101
|
|
101
102
|
return html`
|
102
|
-
<mwc-icon
|
103
|
+
<mwc-icon>${this.icon || 'upload'}</mwc-icon>
|
103
104
|
|
104
|
-
<span
|
105
|
+
<span>${this.description || 'drop files here!'}</span>
|
105
106
|
|
106
107
|
<input
|
107
108
|
id="input-file"
|