@operato/input 1.0.0-beta.11 → 1.0.0-beta.14
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 +41 -0
- package/demo/index-multiple-colors.html +4 -1
- package/demo/index-partition-keys.html +2 -5
- package/demo/index.html +4 -0
- 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-color.js +16 -11
- package/dist/src/ox-input-color.js.map +1 -1
- package/dist/src/ox-input-crontab.js +13 -10
- package/dist/src/ox-input-crontab.js.map +1 -1
- 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 +54 -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-search.js +7 -2
- 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 +112 -0
- package/dist/src/ox-input-unit.js.map +1 -0
- package/dist/src/ox-input-work-shift.js +19 -17
- package/dist/src/ox-input-work-shift.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/{index.stories.d.ts → ox-input-barcode.stories.d.ts} +11 -11
- package/dist/stories/ox-input-barcode.stories.js +22 -0
- package/dist/stories/ox-input-barcode.stories.js.map +1 -0
- package/dist/stories/ox-input-conntab.stories.d.ts +26 -0
- package/dist/stories/ox-input-conntab.stories.js +37 -0
- package/dist/stories/ox-input-conntab.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 +27 -0
- package/dist/stories/ox-input-partition-keys.stories.js +55 -0
- package/dist/stories/ox-input-partition-keys.stories.js.map +1 -0
- package/dist/stories/ox-input-range.stories.d.ts +37 -0
- package/dist/stories/ox-input-range.stories.js +25 -0
- package/dist/stories/ox-input-range.stories.js.map +1 -0
- package/dist/stories/ox-input-search.stories.d.ts +29 -0
- package/dist/stories/ox-input-search.stories.js +28 -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 +41 -0
- package/dist/stories/ox-input-unit.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.stories.d.ts +30 -0
- package/dist/stories/ox-select.stories.js +82 -0
- package/dist/stories/ox-select.stories.js.map +1 -0
- package/dist/themes/common-grist-styles.d.ts +1 -0
- package/dist/themes/common-grist-styles.js +110 -0
- package/dist/themes/common-grist-styles.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- 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-color.ts +17 -11
- package/src/ox-input-crontab.ts +13 -10
- package/src/ox-input-multiple-colors.ts +29 -21
- package/src/ox-input-options.ts +53 -13
- package/src/ox-input-partition-keys.ts +51 -22
- package/src/ox-input-search.ts +7 -2
- package/src/ox-input-unit.ts +112 -0
- package/src/ox-input-work-shift.ts +20 -17
- package/stories/ox-checkbox.stories.ts +69 -0
- package/stories/ox-input-3dish.stories.ts +73 -0
- package/stories/ox-input-barcode.stories.ts +38 -0
- package/stories/ox-input-code.stories.ts_ +71 -0
- package/stories/ox-input-conntab.stories.ts +51 -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 +71 -0
- package/stories/ox-input-range.stories.ts +42 -0
- package/stories/ox-input-search.stories.ts +43 -0
- package/stories/ox-input-unit.stories.ts +65 -0
- package/stories/ox-input-work-shift.stories.ts +73 -0
- package/stories/ox-select.stories.ts +100 -0
- package/themes/app-theme.css +142 -0
- package/themes/common-grist-styles.ts +110 -0
- package/themes/input-theme.css +19 -0
- 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-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
|
}
|
@@ -3,6 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
|
5
5
|
import './ox-input-color.js'
|
6
|
+
import '@material/mwc-icon'
|
6
7
|
|
7
8
|
import { css, html } from 'lit'
|
8
9
|
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
@@ -28,29 +29,38 @@ export class OxInputMultipleColors extends OxFormField {
|
|
28
29
|
:host {
|
29
30
|
display: inline-block;
|
30
31
|
}
|
31
|
-
|
32
32
|
#colors-container > div {
|
33
33
|
display: grid;
|
34
|
-
grid-template-columns:
|
35
|
-
grid-gap:
|
34
|
+
grid-template-columns: 34px 1fr 34px;
|
35
|
+
grid-gap: var(--margin-default);
|
36
36
|
align-items: center;
|
37
37
|
justify-content: left;
|
38
|
+
margin-bottom: var(--margin-narrow);
|
38
39
|
}
|
39
40
|
|
40
41
|
ox-input-color {
|
41
|
-
height: 25px;
|
42
42
|
width: 100%;
|
43
43
|
}
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
border:
|
49
|
-
|
50
|
-
padding
|
51
|
-
|
52
|
-
color:
|
53
|
-
|
45
|
+
button {
|
46
|
+
height: 100%;
|
47
|
+
border: var(--button-border);
|
48
|
+
border-radius: var(--border-radius);
|
49
|
+
background-color: var(--button-background-color);
|
50
|
+
padding: var(--padding-narrow) var(--padding-default);
|
51
|
+
line-height: 0.8;
|
52
|
+
color: var(--button-color);
|
53
|
+
cursor: pointer;
|
54
|
+
}
|
55
|
+
button mwc-icon {
|
56
|
+
font-size: var(--fontsize-default);
|
57
|
+
}
|
58
|
+
button:focus,
|
59
|
+
button:hover,
|
60
|
+
button:active {
|
61
|
+
border: var(--button-activ-border);
|
62
|
+
background-color: var(--button-background-focus-color);
|
63
|
+
color: var(--theme-white-color);
|
54
64
|
}
|
55
65
|
`
|
56
66
|
|
@@ -69,18 +79,16 @@ export class OxInputMultipleColors extends OxFormField {
|
|
69
79
|
${(this.value || []).map(
|
70
80
|
(item, index) => html`
|
71
81
|
<div>
|
72
|
-
<
|
73
|
-
|
82
|
+
<button @click=${() => this._appendEditorColor()} data-index=${index}>
|
83
|
+
<mwc-icon>add</mwc-icon>
|
84
|
+
</button>
|
74
85
|
<ox-input-color .value=${item}> </ox-input-color>
|
75
86
|
|
76
87
|
${(this.value || []).length > 1
|
77
88
|
? html`
|
78
|
-
<
|
79
|
-
|
80
|
-
|
81
|
-
@click=${(e: Event) => this._removeEditorColor(e)}
|
82
|
-
data-index=${index}
|
83
|
-
/>
|
89
|
+
<button @click=${(e: Event) => this._removeEditorColor(e)} data-index=${index}>
|
90
|
+
<mwc-icon>remove</mwc-icon>
|
91
|
+
</button>
|
84
92
|
`
|
85
93
|
: html``}
|
86
94
|
</div>
|
package/src/ox-input-options.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
|
+
import '@material/mwc-icon'
|
4
5
|
|
5
6
|
import { css, html } from 'lit'
|
6
7
|
import { customElement, property } from 'lit/decorators.js'
|
@@ -12,23 +13,58 @@ type Option = { text: string; value: string }
|
|
12
13
|
@customElement('ox-input-options')
|
13
14
|
export class OxInputOptions extends OxFormField {
|
14
15
|
static styles = css`
|
15
|
-
|
16
|
-
display:
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
:host {
|
17
|
+
display: flex;
|
18
|
+
flex-direction: column;
|
19
|
+
overflow: hidden;
|
20
|
+
margin-bottom: var(--margin-wide);
|
20
21
|
}
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
div {
|
24
|
+
display: flex;
|
25
|
+
flex-flow: row nowrap;
|
26
|
+
gap: var(--margin-default);
|
27
|
+
margin-bottom: var(--margin-narrow);
|
24
28
|
}
|
25
29
|
|
26
|
-
|
27
|
-
|
30
|
+
button {
|
31
|
+
border: var(--button-border);
|
32
|
+
border-radius: var(--border-radius);
|
33
|
+
background-color: var(--button-background-color);
|
34
|
+
padding: var(--padding-narrow) var(--padding-default);
|
35
|
+
line-height: 0.8;
|
36
|
+
color: var(--button-color);
|
37
|
+
cursor: pointer;
|
38
|
+
}
|
39
|
+
button + button {
|
40
|
+
margin-left: -5px;
|
41
|
+
}
|
42
|
+
button mwc-icon {
|
43
|
+
font-size: var(--fontsize-default);
|
44
|
+
}
|
45
|
+
button:focus,
|
46
|
+
button:hover,
|
47
|
+
button:active {
|
48
|
+
border: var(--button-activ-border);
|
49
|
+
background-color: var(--button-background-focus-color);
|
50
|
+
color: var(--theme-white-color);
|
28
51
|
}
|
29
52
|
|
30
|
-
|
31
|
-
|
53
|
+
input {
|
54
|
+
flex: 1;
|
55
|
+
border: 0;
|
56
|
+
border-bottom: var(--border-dark-color);
|
57
|
+
padding: var(--input-padding);
|
58
|
+
font: var(--input-font);
|
59
|
+
color: var(--primary-text-color);
|
60
|
+
}
|
61
|
+
input:focus {
|
62
|
+
outline: none;
|
63
|
+
border-bottom: 1px solid var(--primary-color);
|
64
|
+
}
|
65
|
+
button.hidden {
|
66
|
+
opacity: 0;
|
67
|
+
cursor: default;
|
32
68
|
}
|
33
69
|
`
|
34
70
|
|
@@ -47,7 +83,9 @@ export class OxInputOptions extends OxFormField {
|
|
47
83
|
<div data-record="">
|
48
84
|
<input type="text" data-text="" placeholder="text" .value=${item.text} />
|
49
85
|
<input type="text" data-value="" placeholder="value" .value=${item.value} />
|
50
|
-
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1"
|
86
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1">
|
87
|
+
<mwc-icon>remove</mwc-icon>
|
88
|
+
</button>
|
51
89
|
</div>
|
52
90
|
`
|
53
91
|
)}
|
@@ -55,7 +93,9 @@ export class OxInputOptions extends OxFormField {
|
|
55
93
|
<div data-record-new="">
|
56
94
|
<input type="text" data-text="" placeholder="text" value="" />
|
57
95
|
<input type="text" data-value="" placeholder="value" value="" @change=${(e: Event) => this._add()} />
|
58
|
-
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1"
|
96
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
97
|
+
<mwc-icon>add</mwc-icon>
|
98
|
+
</button>
|
59
99
|
</div>
|
60
100
|
`
|
61
101
|
}
|
@@ -2,6 +2,8 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
+
import '@material/mwc-icon'
|
6
|
+
|
5
7
|
import { css, html } from 'lit'
|
6
8
|
import { customElement, property, queryAll } from 'lit/decorators.js'
|
7
9
|
|
@@ -25,38 +27,55 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
25
27
|
:host {
|
26
28
|
display: flex;
|
27
29
|
flex-direction: column;
|
28
|
-
align-content: center;
|
29
|
-
|
30
|
-
width: 100%;
|
31
30
|
overflow: hidden;
|
32
|
-
|
31
|
+
margin-bottom: var(--margin-wide);
|
33
32
|
}
|
34
33
|
|
35
34
|
div {
|
36
35
|
display: flex;
|
37
36
|
flex-flow: row nowrap;
|
38
|
-
|
39
|
-
|
40
|
-
border-bottom: 1px solid #c0c0c0;
|
37
|
+
gap: var(--margin-default);
|
38
|
+
margin-bottom: var(--margin-narrow);
|
41
39
|
}
|
42
40
|
|
43
|
-
|
44
|
-
border
|
41
|
+
button {
|
42
|
+
border: var(--button-border);
|
43
|
+
border-radius: var(--border-radius);
|
44
|
+
background-color: var(--button-background-color);
|
45
|
+
padding: var(--padding-narrow) var(--padding-default);
|
46
|
+
line-height: 0.8;
|
47
|
+
color: var(--button-color);
|
48
|
+
cursor: pointer;
|
45
49
|
}
|
46
|
-
|
47
|
-
|
48
|
-
min-width: 0px;
|
49
|
-
margin: 2px;
|
50
|
-
padding: 0;
|
50
|
+
button + button {
|
51
|
+
margin-left: -5px;
|
51
52
|
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
button mwc-icon {
|
54
|
+
font-size: var(--fontsize-default);
|
55
|
+
}
|
56
|
+
button:focus,
|
57
|
+
button:hover,
|
58
|
+
button:active {
|
59
|
+
border: var(--button-activ-border);
|
60
|
+
background-color: var(--button-background-focus-color);
|
61
|
+
color: var(--theme-white-color);
|
56
62
|
}
|
57
63
|
|
58
64
|
input {
|
59
65
|
flex: 1;
|
66
|
+
border: 0;
|
67
|
+
border-bottom: var(--border-dark-color);
|
68
|
+
padding: var(--input-padding);
|
69
|
+
font: var(--input-font);
|
70
|
+
color: var(--primary-text-color);
|
71
|
+
}
|
72
|
+
input:focus {
|
73
|
+
outline: none;
|
74
|
+
border-bottom: 1px solid var(--primary-color);
|
75
|
+
}
|
76
|
+
button.hidden {
|
77
|
+
opacity: 0;
|
78
|
+
cursor: default;
|
60
79
|
}
|
61
80
|
`
|
62
81
|
|
@@ -77,9 +96,15 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
77
96
|
<div data-record>
|
78
97
|
<input type="text" data-key placeholder="key" .value=${item.key} />
|
79
98
|
<input type="text" data-value placeholder="value" .value=${item.value} list="value-template" />
|
80
|
-
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1"
|
81
|
-
|
82
|
-
|
99
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1">
|
100
|
+
<mwc-icon>remove</mwc-icon>
|
101
|
+
</button>
|
102
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._up(e)} tabindex="-1">
|
103
|
+
<mwc-icon>arrow_upward</mwc-icon>
|
104
|
+
</button>
|
105
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._down(e)} tabindex="-1">
|
106
|
+
<mwc-icon>arrow_downward</mwc-icon>
|
107
|
+
</button>
|
83
108
|
</div>
|
84
109
|
`
|
85
110
|
)}
|
@@ -87,7 +112,11 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
87
112
|
<div data-record-new>
|
88
113
|
<input type="text" data-key placeholder="key" value="" />
|
89
114
|
<input type="text" data-value placeholder="value" value="" list="value-template" />
|
90
|
-
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1"
|
115
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
116
|
+
<mwc-icon>add</mwc-icon>
|
117
|
+
</button>
|
118
|
+
<button class="hidden"><mwc-icon>add</mwc-icon></button>
|
119
|
+
<button class="hidden"><mwc-icon>add</mwc-icon></button>
|
91
120
|
</div>
|
92
121
|
|
93
122
|
<datalist id="value-template">
|
package/src/ox-input-search.ts
CHANGED
@@ -26,9 +26,14 @@ export class OxInputSearch extends OxFormField {
|
|
26
26
|
background-color: transparent;
|
27
27
|
border: 0;
|
28
28
|
border-bottom: var(--border-dark-color);
|
29
|
-
padding: var(--
|
30
|
-
|
29
|
+
padding: var(--input-padding);
|
30
|
+
padding-left: 25px;
|
31
|
+
font: var(--input-font);
|
32
|
+
color: var(--primary-text-color);
|
33
|
+
}
|
34
|
+
[type='text']:focus {
|
31
35
|
outline: none;
|
36
|
+
border-bottom: 1px solid var(--primary-color);
|
32
37
|
}
|
33
38
|
|
34
39
|
mwc-icon {
|
@@ -0,0 +1,112 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { css, html } from 'lit'
|
6
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
7
|
+
|
8
|
+
import { OxFormField } from './ox-form-field'
|
9
|
+
import { OxPopupList } from '@operato/popup'
|
10
|
+
|
11
|
+
const UNIT_SYSTEMS: { [unit: string]: { [unit: string]: number } } = {
|
12
|
+
kg: {
|
13
|
+
mg: 1000000,
|
14
|
+
g: 1000,
|
15
|
+
ton: 0.001
|
16
|
+
},
|
17
|
+
rad: {
|
18
|
+
degree: 180 / Math.PI
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
@customElement('ox-input-unit')
|
23
|
+
export class OxInputUnit extends OxFormField {
|
24
|
+
static styles = [
|
25
|
+
css`
|
26
|
+
input {
|
27
|
+
box-sizing: border-box;
|
28
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
29
|
+
text-align: end;
|
30
|
+
}
|
31
|
+
|
32
|
+
input::-webkit-outer-spin-button,
|
33
|
+
input::-webkit-inner-spin-button {
|
34
|
+
-webkit-appearance: none;
|
35
|
+
margin: 0;
|
36
|
+
}
|
37
|
+
|
38
|
+
input[type='number'] {
|
39
|
+
-moz-appearance: textfield;
|
40
|
+
}
|
41
|
+
|
42
|
+
div {
|
43
|
+
display: inline;
|
44
|
+
position: relative;
|
45
|
+
}
|
46
|
+
`
|
47
|
+
]
|
48
|
+
|
49
|
+
@property({ type: String }) placeholder?: string
|
50
|
+
@property({ type: String, attribute: 'std-unit' }) stdUnit!: string
|
51
|
+
@property({ type: String, attribute: 'user-unit' }) userUnit?: string
|
52
|
+
|
53
|
+
@query('input') input!: HTMLInputElement
|
54
|
+
@query('ox-popup-list') popup!: OxPopupList
|
55
|
+
|
56
|
+
render() {
|
57
|
+
const userUnit = this.userUnit || this.stdUnit
|
58
|
+
const units = Object.keys(UNIT_SYSTEMS[this.stdUnit])
|
59
|
+
const rate = !this.userUnit || this.userUnit === this.stdUnit ? 1 : UNIT_SYSTEMS[this.stdUnit][this.userUnit] || 1
|
60
|
+
|
61
|
+
return html`
|
62
|
+
<input
|
63
|
+
type="number"
|
64
|
+
.value=${this._toUserUnit(this.value)}
|
65
|
+
placeholder=${this.placeholder}
|
66
|
+
@change=${(e: Event) => this._onChangeValue(e)}
|
67
|
+
/>
|
68
|
+
<div
|
69
|
+
@click=${(e: Event) => {
|
70
|
+
const target = e.currentTarget as HTMLElement
|
71
|
+
this.popup.open({
|
72
|
+
right: 0,
|
73
|
+
top: target.offsetTop + target.offsetHeight
|
74
|
+
})
|
75
|
+
}}
|
76
|
+
>
|
77
|
+
${userUnit}
|
78
|
+
<ox-popup-list
|
79
|
+
.value=${userUnit}
|
80
|
+
@select=${(e: CustomEvent) => {
|
81
|
+
this.userUnit = e.detail
|
82
|
+
}}
|
83
|
+
>
|
84
|
+
<div option value=${this.stdUnit}>${this.stdUnit}</div>
|
85
|
+
${units.map(unit => html`<div option value=${unit}>${unit}</div>`)}
|
86
|
+
</ox-popup-list>
|
87
|
+
</div>
|
88
|
+
`
|
89
|
+
}
|
90
|
+
|
91
|
+
_onChangeValue(e: Event) {
|
92
|
+
this.value = this._toStdUnit(this.input.value)
|
93
|
+
|
94
|
+
this.dispatchEvent(
|
95
|
+
new CustomEvent('change', {
|
96
|
+
bubbles: true,
|
97
|
+
composed: true,
|
98
|
+
detail: this.value
|
99
|
+
})
|
100
|
+
)
|
101
|
+
}
|
102
|
+
|
103
|
+
_toUserUnit(stdValue: string | number | undefined) {
|
104
|
+
const rate = !this.userUnit || this.userUnit === this.stdUnit ? 1 : UNIT_SYSTEMS[this.stdUnit][this.userUnit] || 1
|
105
|
+
return Number(stdValue) * rate
|
106
|
+
}
|
107
|
+
|
108
|
+
_toStdUnit(userValue: string | number | undefined) {
|
109
|
+
const rate = !this.userUnit || this.userUnit === this.stdUnit ? 1 : UNIT_SYSTEMS[this.stdUnit][this.userUnit] || 1
|
110
|
+
return isNaN(Number(userValue)) ? undefined : Number(userValue) / rate
|
111
|
+
}
|
112
|
+
}
|
@@ -7,6 +7,8 @@ import './ox-input-color'
|
|
7
7
|
import { css, html } from 'lit'
|
8
8
|
import { customElement, property } from 'lit/decorators.js'
|
9
9
|
|
10
|
+
import { localized, msg } from '@lit/localize'
|
11
|
+
|
10
12
|
import { OxFormField } from './ox-form-field.js'
|
11
13
|
|
12
14
|
type WorkShift = { name: string; fromDate: number; fromTime: string; toDate: number; toTime: string }
|
@@ -21,6 +23,7 @@ Example:
|
|
21
23
|
</ox-input-work-shift>
|
22
24
|
*/
|
23
25
|
|
26
|
+
@localized()
|
24
27
|
@customElement('ox-input-work-shift')
|
25
28
|
export class OxInputWorkShift extends OxFormField {
|
26
29
|
static styles = css`
|
@@ -92,11 +95,11 @@ export class OxInputWorkShift extends OxFormField {
|
|
92
95
|
render() {
|
93
96
|
return html`
|
94
97
|
<div data-header>
|
95
|
-
<span
|
96
|
-
<span
|
97
|
-
<span
|
98
|
-
<span
|
99
|
-
<span
|
98
|
+
<span>${msg('name')}</span>
|
99
|
+
<span>${msg('from date')}</span>
|
100
|
+
<span>${msg('from time')}</span>
|
101
|
+
<span>${msg('to date')}</span>
|
102
|
+
<span>${msg('to time')}</span>
|
100
103
|
<empty-element></empty-element>
|
101
104
|
</div>
|
102
105
|
|
@@ -106,16 +109,16 @@ export class OxInputWorkShift extends OxFormField {
|
|
106
109
|
<input type="text" data-name .value=${item.name} required />
|
107
110
|
|
108
111
|
<select data-from-date .value=${item.fromDate || 0}>
|
109
|
-
<option value="-1"
|
110
|
-
<option value="0"
|
111
|
-
<option value="1"
|
112
|
+
<option value="-1">${msg('The day before')}</option>
|
113
|
+
<option value="0">${msg('The day')}</option>
|
114
|
+
<option value="1">${msg('The day after')}</option>
|
112
115
|
</select>
|
113
116
|
<input type="time" data-from-time .value=${item.fromTime} step="1800" required />
|
114
117
|
|
115
118
|
<select data-to-date .value=${item.toDate || 0}>
|
116
|
-
<option value="-1"
|
117
|
-
<option value="0"
|
118
|
-
<option value="1"
|
119
|
+
<option value="-1">${msg('The day before')}</option>
|
120
|
+
<option value="0">${msg('The day')}</option>
|
121
|
+
<option value="1">${msg('The day after')}</option>
|
119
122
|
</select>
|
120
123
|
<input type="time" data-to-time .value=${item.toTime} step="1800" required />
|
121
124
|
|
@@ -128,16 +131,16 @@ export class OxInputWorkShift extends OxFormField {
|
|
128
131
|
<input type="text" data-name />
|
129
132
|
|
130
133
|
<select data-from-date>
|
131
|
-
<option value="-1"
|
132
|
-
<option value="0" selected
|
133
|
-
<option value="+1"
|
134
|
+
<option value="-1">${msg('The day before')}</option>
|
135
|
+
<option value="0" selected>${msg('The day')}</option>
|
136
|
+
<option value="+1">${msg('The day after')}</option>
|
134
137
|
</select>
|
135
138
|
<input type="time" data-from-time step="1800" />
|
136
139
|
|
137
140
|
<select data-to-date>
|
138
|
-
<option value="-1"
|
139
|
-
<option value="0" selected
|
140
|
-
<option value="+1"
|
141
|
+
<option value="-1">${msg('The day before')}</option>
|
142
|
+
<option value="0" selected>${msg('The day')}</option>
|
143
|
+
<option value="+1">${msg('The day after')}</option>
|
141
144
|
</select>
|
142
145
|
<input type="time" data-to-time step="1800" />
|
143
146
|
|