@operato/input 2.0.0-alpha.8 → 2.0.0-alpha.80
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 +203 -0
- package/demo/index-multiple-colors.html +14 -2
- package/demo/index-partition-keys.html +13 -2
- package/demo/index-select.html +20 -9
- package/demo/index-table.html +13 -2
- package/demo/index.html +13 -2
- package/dist/src/locale/locale-picker.d.ts +1 -1
- package/dist/src/ox-buttons-radio.d.ts +1 -1
- package/dist/src/ox-checkbox.d.ts +4 -4
- package/dist/src/ox-input-3axis.d.ts +1 -1
- package/dist/src/ox-input-3dish.d.ts +1 -1
- package/dist/src/ox-input-angle.d.ts +1 -1
- package/dist/src/ox-input-barcode.d.ts +3 -4
- package/dist/src/ox-input-barcode.js +28 -42
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-code.d.ts +2 -3
- package/dist/src/ox-input-code.js +8 -15
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.d.ts +1 -1
- package/dist/src/ox-input-color-stops.d.ts +1 -1
- package/dist/src/ox-input-color.d.ts +1 -1
- package/dist/src/ox-input-container.d.ts +2 -2
- package/dist/src/ox-input-container.js +2 -2
- package/dist/src/ox-input-container.js.map +1 -1
- package/dist/src/ox-input-crontab.d.ts +1 -2
- package/dist/src/ox-input-crontab.js +4 -7
- package/dist/src/ox-input-crontab.js.map +1 -1
- package/dist/src/ox-input-data.d.ts +4 -5
- package/dist/src/ox-input-data.js +88 -36
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-duration.d.ts +1 -2
- package/dist/src/ox-input-duration.js +13 -9
- package/dist/src/ox-input-duration.js.map +1 -1
- package/dist/src/ox-input-file.d.ts +2 -2
- package/dist/src/ox-input-file.js +10 -9
- package/dist/src/ox-input-file.js.map +1 -1
- package/dist/src/ox-input-hashtags.d.ts +1 -1
- package/dist/src/ox-input-i18n-label.d.ts +33 -0
- package/dist/src/ox-input-i18n-label.js +129 -0
- package/dist/src/ox-input-i18n-label.js.map +1 -0
- package/dist/src/ox-input-image.d.ts +2 -2
- package/dist/src/ox-input-image.js +4 -4
- package/dist/src/ox-input-image.js.map +1 -1
- package/dist/src/ox-input-key-values.d.ts +2 -2
- package/dist/src/ox-input-key-values.js +9 -10
- package/dist/src/ox-input-key-values.js.map +1 -1
- package/dist/src/ox-input-mass-fraction.d.ts +2 -2
- package/dist/src/ox-input-mass-fraction.js +46 -29
- package/dist/src/ox-input-mass-fraction.js.map +1 -1
- package/dist/src/ox-input-multiple-colors.d.ts +2 -2
- package/dist/src/ox-input-multiple-colors.js +7 -7
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.d.ts +2 -2
- package/dist/src/ox-input-options.js +5 -7
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.d.ts +2 -2
- package/dist/src/ox-input-partition-keys.js +10 -10
- package/dist/src/ox-input-partition-keys.js.map +1 -1
- package/dist/src/ox-input-privilege.d.ts +1 -2
- package/dist/src/ox-input-privilege.js +15 -31
- package/dist/src/ox-input-privilege.js.map +1 -1
- package/dist/src/ox-input-quantifier.d.ts +1 -1
- package/dist/src/ox-input-scene-component-id.d.ts +1 -1
- package/dist/src/ox-input-search.d.ts +2 -2
- package/dist/src/ox-input-search.js +4 -4
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-select-buttons.d.ts +1 -1
- package/dist/src/ox-input-stack.d.ts +1 -1
- package/dist/src/ox-input-table.d.ts +1 -1
- package/dist/src/ox-input-table.js +12 -12
- package/dist/src/ox-input-table.js.map +1 -1
- package/dist/src/ox-input-textarea.d.ts +1 -1
- package/dist/src/ox-input-unit-number.d.ts +2 -2
- package/dist/src/ox-input-unit-number.js +5 -4
- package/dist/src/ox-input-unit-number.js.map +1 -1
- package/dist/src/ox-input-value-map.d.ts +2 -2
- package/dist/src/ox-input-value-map.js +15 -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 +15 -15
- package/dist/src/ox-input-value-ranges.js.map +1 -1
- package/dist/src/ox-input-work-shift.d.ts +1 -1
- package/dist/src/ox-input-work-shift.js +4 -5
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/src/ox-select.d.ts +2 -2
- package/dist/src/ox-select.js +4 -4
- package/dist/src/ox-select.js.map +1 -1
- package/dist/stories/ox-input-3axis.stories.js +14 -1
- package/dist/stories/ox-input-3axis.stories.js.map +1 -1
- package/dist/stories/ox-input-3dish.stories.js +14 -1
- package/dist/stories/ox-input-3dish.stories.js.map +1 -1
- package/dist/stories/ox-input-angle.stories.js +13 -1
- package/dist/stories/ox-input-angle.stories.js.map +1 -1
- package/dist/stories/ox-input-barcode.stories.js +13 -1
- package/dist/stories/ox-input-barcode.stories.js.map +1 -1
- package/dist/stories/ox-input-code.stories.d.ts +4 -0
- package/dist/stories/ox-input-code.stories.js +18 -3
- package/dist/stories/ox-input-code.stories.js.map +1 -1
- package/dist/stories/ox-input-crontab.stories.js +13 -1
- package/dist/stories/ox-input-crontab.stories.js.map +1 -1
- package/dist/stories/ox-input-data.stories.d.ts +29 -0
- package/dist/stories/ox-input-data.stories.js +50 -0
- package/dist/stories/ox-input-data.stories.js.map +1 -0
- package/dist/stories/ox-input-duration.stories.js +13 -1
- package/dist/stories/ox-input-duration.stories.js.map +1 -1
- package/dist/stories/ox-input-file.stories.js +13 -1
- package/dist/stories/ox-input-file.stories.js.map +1 -1
- package/dist/stories/ox-input-hashtags.stories.js +13 -1
- package/dist/stories/ox-input-hashtags.stories.js.map +1 -1
- package/dist/stories/ox-input-i18n-label.stories.d.ts +29 -0
- package/dist/stories/ox-input-i18n-label.stories.js +70 -0
- package/dist/stories/ox-input-i18n-label.stories.js.map +1 -0
- package/dist/stories/ox-input-key-values.stories.js +13 -1
- package/dist/stories/ox-input-key-values.stories.js.map +1 -1
- package/dist/stories/ox-input-mass-fraction.stories.js +13 -1
- package/dist/stories/ox-input-mass-fraction.stories.js.map +1 -1
- package/dist/stories/ox-input-multiple-colors.stories.js +21 -10
- package/dist/stories/ox-input-multiple-colors.stories.js.map +1 -1
- package/dist/stories/ox-input-options.stories.js +13 -1
- package/dist/stories/ox-input-options.stories.js.map +1 -1
- package/dist/stories/ox-input-partition-keys.stories.js +13 -1
- package/dist/stories/ox-input-partition-keys.stories.js.map +1 -1
- package/dist/stories/ox-input-privilege.stories.js +13 -1
- package/dist/stories/ox-input-privilege.stories.js.map +1 -1
- package/dist/stories/ox-input-quantifier.stories.js +13 -1
- package/dist/stories/ox-input-quantifier.stories.js.map +1 -1
- package/dist/stories/ox-input-range.stories.js +13 -1
- package/dist/stories/ox-input-range.stories.js.map +1 -1
- package/dist/stories/ox-input-search.stories.js +13 -1
- package/dist/stories/ox-input-search.stories.js.map +1 -1
- package/dist/stories/ox-input-select-buttons.stories.js +13 -1
- package/dist/stories/ox-input-select-buttons.stories.js.map +1 -1
- package/dist/stories/ox-input-unit.stories.js +14 -1
- package/dist/stories/ox-input-unit.stories.js.map +1 -1
- package/dist/stories/ox-input-value-map.stories.js +13 -1
- package/dist/stories/ox-input-value-map.stories.js.map +1 -1
- package/dist/stories/ox-input-value-ranges.stories.js +13 -1
- package/dist/stories/ox-input-value-ranges.stories.js.map +1 -1
- package/dist/stories/ox-input-work-shift.stories.js +13 -1
- package/dist/stories/ox-input-work-shift.stories.js.map +1 -1
- package/dist/stories/ox-select.stories.js +13 -1
- package/dist/stories/ox-select.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -21
- package/src/ox-input-barcode.ts +31 -41
- package/src/ox-input-code.ts +6 -13
- package/src/ox-input-container.ts +2 -2
- package/src/ox-input-crontab.ts +4 -8
- package/src/ox-input-data.ts +97 -38
- package/src/ox-input-duration.ts +13 -10
- package/src/ox-input-file.ts +10 -9
- package/src/ox-input-i18n-label.ts +139 -0
- package/src/ox-input-image.ts +4 -4
- package/src/ox-input-key-values.ts +27 -22
- package/src/ox-input-mass-fraction.ts +46 -29
- package/src/ox-input-multiple-colors.ts +7 -7
- package/src/ox-input-options.ts +5 -7
- package/src/ox-input-partition-keys.ts +28 -22
- package/src/ox-input-privilege.ts +15 -32
- package/src/ox-input-search.ts +4 -4
- package/src/ox-input-table.ts +12 -12
- package/src/ox-input-unit-number.ts +5 -4
- package/src/ox-input-value-map.ts +17 -17
- package/src/ox-input-value-ranges.ts +17 -17
- package/src/ox-input-work-shift.ts +4 -5
- package/src/ox-select.ts +4 -4
- package/stories/ox-input-3axis.stories.ts +14 -1
- package/stories/ox-input-3dish.stories.ts +14 -1
- package/stories/ox-input-angle.stories.ts +13 -1
- package/stories/ox-input-barcode.stories.ts +13 -1
- package/stories/ox-input-code.stories.ts +25 -3
- package/stories/ox-input-crontab.stories.ts +13 -1
- package/stories/ox-input-data.stories.ts +65 -0
- package/stories/ox-input-duration.stories.ts +13 -1
- package/stories/ox-input-file.stories.ts +13 -1
- package/stories/ox-input-hashtags.stories.ts +13 -1
- package/stories/ox-input-i18n-label.stories.ts +85 -0
- package/stories/ox-input-key-values.stories.ts +13 -1
- package/stories/ox-input-mass-fraction.stories.ts +13 -1
- package/stories/ox-input-multiple-colors.stories.ts +21 -10
- package/stories/ox-input-options.stories.ts +13 -1
- package/stories/ox-input-partition-keys.stories.ts +13 -1
- package/stories/ox-input-privilege.stories.ts +13 -1
- package/stories/ox-input-quantifier.stories.ts +13 -1
- package/stories/ox-input-range.stories.ts +13 -1
- package/stories/ox-input-search.stories.ts +13 -1
- package/stories/ox-input-select-buttons.stories.ts +13 -1
- package/stories/ox-input-unit.stories.ts +14 -1
- package/stories/ox-input-value-map.stories.ts +13 -1
- package/stories/ox-input-value-ranges.stories.ts +13 -1
- package/stories/ox-input-work-shift.stories.ts +13 -1
- package/stories/ox-select.stories.ts +13 -1
@@ -0,0 +1,139 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import '@material/web/icon/icon.js'
|
6
|
+
|
7
|
+
import { css, html } from 'lit'
|
8
|
+
import { customElement, property, queryAll } from 'lit/decorators.js'
|
9
|
+
|
10
|
+
import { OxFormField } from './ox-form-field'
|
11
|
+
|
12
|
+
type I18nLabel = { [code: string]: string }
|
13
|
+
|
14
|
+
const LANGUAGES = [
|
15
|
+
{
|
16
|
+
code: 'en',
|
17
|
+
display: 'English'
|
18
|
+
}
|
19
|
+
]
|
20
|
+
|
21
|
+
/**
|
22
|
+
input component for i18n labels
|
23
|
+
|
24
|
+
Example:
|
25
|
+
|
26
|
+
<ox-input-i18n-label
|
27
|
+
value=${map}
|
28
|
+
languages=${languages}
|
29
|
+
</ox-input-i18n-label>
|
30
|
+
*/
|
31
|
+
@customElement('ox-input-i18n-label')
|
32
|
+
export class OxInputI18nLabels extends OxFormField {
|
33
|
+
static styles = css`
|
34
|
+
:host {
|
35
|
+
display: flex;
|
36
|
+
flex-direction: column;
|
37
|
+
overflow: hidden;
|
38
|
+
}
|
39
|
+
|
40
|
+
[data-record] {
|
41
|
+
display: flex;
|
42
|
+
flex-direction: row;
|
43
|
+
gap: 10px;
|
44
|
+
}
|
45
|
+
|
46
|
+
label {
|
47
|
+
width: 80px;
|
48
|
+
align-self: center;
|
49
|
+
text-align: end;
|
50
|
+
}
|
51
|
+
|
52
|
+
input {
|
53
|
+
flex: 1;
|
54
|
+
border: 0;
|
55
|
+
border-bottom: var(--border-dark-color);
|
56
|
+
padding: var(--input-padding);
|
57
|
+
font: var(--input-font);
|
58
|
+
color: var(--primary-text-color);
|
59
|
+
min-width: 100px;
|
60
|
+
}
|
61
|
+
|
62
|
+
input:focus {
|
63
|
+
outline: none;
|
64
|
+
border-bottom: 1px solid var(--primary-color);
|
65
|
+
}
|
66
|
+
|
67
|
+
input[type='hidden'] {
|
68
|
+
flex: 0;
|
69
|
+
}
|
70
|
+
`
|
71
|
+
|
72
|
+
@property({ type: Object }) value: I18nLabel = {}
|
73
|
+
@property({ type: Array }) languages: { display: string; code: string }[] = LANGUAGES
|
74
|
+
|
75
|
+
@queryAll('[data-record]') records!: NodeListOf<HTMLElement>
|
76
|
+
|
77
|
+
private changing: boolean = false
|
78
|
+
|
79
|
+
firstUpdated() {
|
80
|
+
this.renderRoot.addEventListener('change', this.onChange.bind(this))
|
81
|
+
}
|
82
|
+
|
83
|
+
render() {
|
84
|
+
const value = !this.value || typeof this.value !== 'object' ? {} : this.value
|
85
|
+
const languages = (this.languages && this.languages.length > 0 && this.languages) || LANGUAGES
|
86
|
+
|
87
|
+
return html`
|
88
|
+
${languages.map(
|
89
|
+
({ display, code }) => html`
|
90
|
+
<div data-record>
|
91
|
+
<label>${display}</label>
|
92
|
+
<input type="hidden" data-code value=${code} />
|
93
|
+
<input
|
94
|
+
type="text"
|
95
|
+
data-label
|
96
|
+
placeholder="label"
|
97
|
+
.value=${value?.[code] || ''}
|
98
|
+
?disabled=${this.disabled}
|
99
|
+
/>
|
100
|
+
</div>
|
101
|
+
`
|
102
|
+
)}
|
103
|
+
`
|
104
|
+
}
|
105
|
+
|
106
|
+
private onChange(e: Event) {
|
107
|
+
e.stopPropagation()
|
108
|
+
|
109
|
+
if (this.changing) {
|
110
|
+
return
|
111
|
+
}
|
112
|
+
|
113
|
+
this.changing = true
|
114
|
+
|
115
|
+
this.build()
|
116
|
+
|
117
|
+
this.changing = false
|
118
|
+
}
|
119
|
+
|
120
|
+
private build() {
|
121
|
+
var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>
|
122
|
+
|
123
|
+
var newmap: I18nLabel = {}
|
124
|
+
|
125
|
+
for (var i = 0; i < records.length; i++) {
|
126
|
+
var record = records[i]
|
127
|
+
|
128
|
+
const code = (record.querySelector('[data-code]') as HTMLInputElement).value
|
129
|
+
const label = (record.querySelector('[data-label]') as HTMLInputElement).value
|
130
|
+
|
131
|
+
if (code) {
|
132
|
+
newmap[code] = label || ''
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
this.value = { ...this.value, ...newmap }
|
137
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
138
|
+
}
|
139
|
+
}
|
package/src/ox-input-image.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import '@material/
|
5
|
+
import '@material/web/icon/icon.js'
|
6
6
|
|
7
7
|
import { css, html } from 'lit'
|
8
8
|
import { customElement, query } from 'lit/decorators.js'
|
@@ -76,11 +76,11 @@ export class OxInputImage extends OxFormField {
|
|
76
76
|
place-content: center;
|
77
77
|
}
|
78
78
|
|
79
|
-
|
79
|
+
md-icon {
|
80
80
|
align-self: center;
|
81
81
|
|
82
82
|
color: var(--file-uploader-icon-color, black);
|
83
|
-
--
|
83
|
+
--md-icon-size: var(--file-uploader-icon-size, 36px);
|
84
84
|
}
|
85
85
|
`
|
86
86
|
]
|
@@ -118,7 +118,7 @@ export class OxInputImage extends OxFormField {
|
|
118
118
|
@change=${(e: Event) => this._onChangeValue(e)}
|
119
119
|
?disabled=${this.disabled}
|
120
120
|
/>
|
121
|
-
<
|
121
|
+
<md-icon>upload</md-icon>
|
122
122
|
</label>
|
123
123
|
</div>
|
124
124
|
`
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import '@material/
|
5
|
+
import '@material/web/icon/icon.js'
|
6
6
|
|
7
7
|
import { css, html, nothing } from 'lit'
|
8
8
|
import { customElement, property, queryAll } from 'lit/decorators.js'
|
@@ -29,6 +29,8 @@ export class OxInputKeyValues extends OxFormField {
|
|
29
29
|
flex-direction: column;
|
30
30
|
overflow: hidden;
|
31
31
|
margin-bottom: var(--margin-wide);
|
32
|
+
|
33
|
+
--md-icon-size: 14px;
|
32
34
|
}
|
33
35
|
|
34
36
|
div {
|
@@ -50,9 +52,6 @@ export class OxInputKeyValues extends OxFormField {
|
|
50
52
|
button + button {
|
51
53
|
margin-left: -5px;
|
52
54
|
}
|
53
|
-
button mwc-icon {
|
54
|
-
font-size: var(--fontsize-default);
|
55
|
-
}
|
56
55
|
button:focus,
|
57
56
|
button:hover,
|
58
57
|
button:active {
|
@@ -112,7 +111,7 @@ export class OxInputKeyValues extends OxFormField {
|
|
112
111
|
tabindex="-1"
|
113
112
|
?disabled=${this.disabled}
|
114
113
|
>
|
115
|
-
<
|
114
|
+
<md-icon>remove</md-icon>
|
116
115
|
</button>
|
117
116
|
<button
|
118
117
|
class="record-action"
|
@@ -120,7 +119,7 @@ export class OxInputKeyValues extends OxFormField {
|
|
120
119
|
tabindex="-1"
|
121
120
|
?disabled=${this.disabled}
|
122
121
|
>
|
123
|
-
<
|
122
|
+
<md-icon>arrow_upward</md-icon>
|
124
123
|
</button>
|
125
124
|
<button
|
126
125
|
class="record-action"
|
@@ -128,7 +127,7 @@ export class OxInputKeyValues extends OxFormField {
|
|
128
127
|
tabindex="-1"
|
129
128
|
?disabled=${this.disabled}
|
130
129
|
>
|
131
|
-
<
|
130
|
+
<md-icon>arrow_downward</md-icon>
|
132
131
|
</button>
|
133
132
|
</div>
|
134
133
|
`
|
@@ -140,10 +139,10 @@ export class OxInputKeyValues extends OxFormField {
|
|
140
139
|
<input type="text" data-key placeholder="key" value="" />
|
141
140
|
<input type="text" data-value placeholder="value" value="" list="value-template" />
|
142
141
|
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
143
|
-
<
|
142
|
+
<md-icon>add</md-icon>
|
144
143
|
</button>
|
145
|
-
<button class="hidden"><
|
146
|
-
<button class="hidden"><
|
144
|
+
<button class="hidden"><md-icon>add</md-icon></button>
|
145
|
+
<button class="hidden"><md-icon>add</md-icon></button>
|
147
146
|
</div>
|
148
147
|
`}
|
149
148
|
|
@@ -260,13 +259,16 @@ export class OxInputKeyValues extends OxFormField {
|
|
260
259
|
const deleted = array.splice(index, 1)
|
261
260
|
array.splice(index + 1, 0, ...deleted)
|
262
261
|
|
263
|
-
this.value = array.reduce(
|
264
|
-
|
265
|
-
|
262
|
+
this.value = array.reduce(
|
263
|
+
(sum, record) => {
|
264
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
265
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
266
266
|
|
267
|
-
|
268
|
-
|
269
|
-
|
267
|
+
sum[key] = value
|
268
|
+
return sum
|
269
|
+
},
|
270
|
+
{} as { [key: string]: string }
|
271
|
+
)
|
270
272
|
|
271
273
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
272
274
|
}
|
@@ -283,13 +285,16 @@ export class OxInputKeyValues extends OxFormField {
|
|
283
285
|
array.splice(index, 1)
|
284
286
|
array.splice(index + 1, 0, record)
|
285
287
|
|
286
|
-
this.value = array.reduce(
|
287
|
-
|
288
|
-
|
288
|
+
this.value = array.reduce(
|
289
|
+
(sum, record) => {
|
290
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
291
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
289
292
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
+
sum[key] = value
|
294
|
+
return sum
|
295
|
+
},
|
296
|
+
{} as { [key: string]: string }
|
297
|
+
)
|
293
298
|
|
294
299
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
295
300
|
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import '@material/
|
5
|
+
import '@material/web/icon/icon.js'
|
6
6
|
import '@operato/popup/ox-popup-list.js'
|
7
7
|
import './ox-select.js'
|
8
8
|
|
@@ -43,19 +43,26 @@ export class OxInputMassFraction extends OxFormField {
|
|
43
43
|
display: flex;
|
44
44
|
flex-direction: column;
|
45
45
|
justify-content: space-between;
|
46
|
+
|
47
|
+
--md-icon-size: var(--fontsize-default, 14px);
|
46
48
|
}
|
47
49
|
|
48
50
|
[records] {
|
49
51
|
flex: 1;
|
50
52
|
|
51
53
|
overflow: overlay;
|
52
|
-
}
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
> div {
|
56
|
+
display: flex;
|
57
|
+
flex-flow: row nowrap;
|
58
|
+
gap: var(--mass-fraction-gap, 3px);
|
59
|
+
margin-bottom: var(--margin-narrow);
|
60
|
+
}
|
61
|
+
|
62
|
+
> [nofraction] {
|
63
|
+
display: block;
|
64
|
+
text-align: center;
|
65
|
+
}
|
59
66
|
}
|
60
67
|
|
61
68
|
[data-record-new] {
|
@@ -74,19 +81,18 @@ export class OxInputMassFraction extends OxFormField {
|
|
74
81
|
padding: var(--mass-fraction-button-padding-vertical, 3px) var(--mass-fraction-button-padding-horizontal, 3px);
|
75
82
|
color: var(--button-color);
|
76
83
|
cursor: pointer;
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
background-color: var(--button-background-focus-color);
|
86
|
-
color: var(--theme-white-color);
|
84
|
+
|
85
|
+
&:focus,
|
86
|
+
&:hover,
|
87
|
+
&:active {
|
88
|
+
border: var(--button-active-border, 1px solid rgba(0, 0, 0, 0.2));
|
89
|
+
background-color: var(--button-background-focus-color);
|
90
|
+
color: var(--theme-white-color);
|
91
|
+
}
|
87
92
|
}
|
88
93
|
|
89
94
|
input,
|
95
|
+
label,
|
90
96
|
ox-select {
|
91
97
|
border: 0;
|
92
98
|
border-bottom: var(--border-dark-color);
|
@@ -95,10 +101,15 @@ export class OxInputMassFraction extends OxFormField {
|
|
95
101
|
min-width: 50px;
|
96
102
|
}
|
97
103
|
|
98
|
-
input
|
104
|
+
input,
|
105
|
+
label {
|
99
106
|
padding: var(--input-padding);
|
100
107
|
}
|
101
108
|
|
109
|
+
label {
|
110
|
+
text-align: center;
|
111
|
+
}
|
112
|
+
|
102
113
|
ox-select {
|
103
114
|
padding: 0;
|
104
115
|
}
|
@@ -127,14 +138,13 @@ export class OxInputMassFraction extends OxFormField {
|
|
127
138
|
left: 0;
|
128
139
|
}
|
129
140
|
|
130
|
-
[records] > [nofraction] {
|
131
|
-
display: block;
|
132
|
-
text-align: center;
|
133
|
-
}
|
134
|
-
|
135
141
|
[right-end] {
|
136
142
|
margin-left: auto;
|
137
143
|
}
|
144
|
+
|
145
|
+
[hidden] {
|
146
|
+
opacity: 0;
|
147
|
+
}
|
138
148
|
`
|
139
149
|
]
|
140
150
|
|
@@ -157,6 +167,13 @@ export class OxInputMassFraction extends OxFormField {
|
|
157
167
|
|
158
168
|
return html`
|
159
169
|
<div records>
|
170
|
+
<div data-header>
|
171
|
+
<label data-key>성분</label>
|
172
|
+
<label data-value>체적비(몰분율)</label>
|
173
|
+
<button hidden><md-icon>remove</md-icon></button>
|
174
|
+
<button hidden><md-icon>remove</md-icon></button>
|
175
|
+
${this.composable ? html` <button hidden><md-icon>remove</md-icon></button>` : nothing}
|
176
|
+
</div>
|
160
177
|
${arrayed.length
|
161
178
|
? arrayed.map(
|
162
179
|
(item, idx) => html`
|
@@ -181,7 +198,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
181
198
|
tabindex="-1"
|
182
199
|
?disabled=${this.disabled}
|
183
200
|
>
|
184
|
-
<
|
201
|
+
<md-icon>remove</md-icon>
|
185
202
|
</button>
|
186
203
|
`
|
187
204
|
: nothing}
|
@@ -191,7 +208,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
191
208
|
tabindex="-1"
|
192
209
|
?disabled=${this.disabled || idx === 0}
|
193
210
|
>
|
194
|
-
<
|
211
|
+
<md-icon>arrow_upward</md-icon>
|
195
212
|
</button>
|
196
213
|
<button
|
197
214
|
class="record-action"
|
@@ -199,7 +216,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
199
216
|
tabindex="-1"
|
200
217
|
?disabled=${this.disabled || idx === arrayed.length - 1}
|
201
218
|
>
|
202
|
-
<
|
219
|
+
<md-icon>arrow_downward</md-icon>
|
203
220
|
</button>
|
204
221
|
</div>
|
205
222
|
`
|
@@ -235,7 +252,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
235
252
|
list="value-template"
|
236
253
|
/>
|
237
254
|
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
238
|
-
<
|
255
|
+
<md-icon>add</md-icon>
|
239
256
|
</button>
|
240
257
|
`
|
241
258
|
: nothing}
|
@@ -247,7 +264,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
247
264
|
}}
|
248
265
|
right-end
|
249
266
|
>
|
250
|
-
<
|
267
|
+
<md-icon>settings_suggest</md-icon>
|
251
268
|
</button>
|
252
269
|
<button
|
253
270
|
title="normalize fraction"
|
@@ -255,7 +272,7 @@ export class OxInputMassFraction extends OxFormField {
|
|
255
272
|
this._normalize()
|
256
273
|
}}
|
257
274
|
>
|
258
|
-
<
|
275
|
+
<md-icon>repartition</md-icon>
|
259
276
|
</button>
|
260
277
|
</div>
|
261
278
|
`}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
*/
|
4
4
|
|
5
5
|
import './ox-input-color.js'
|
6
|
-
import '@material/
|
6
|
+
import '@material/web/icon/icon.js'
|
7
7
|
|
8
8
|
import { css, html } from 'lit'
|
9
9
|
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
@@ -28,7 +28,10 @@ export class OxInputMultipleColors extends OxFormField {
|
|
28
28
|
static styles = css`
|
29
29
|
:host {
|
30
30
|
display: inline-block;
|
31
|
+
|
32
|
+
--md-icon-size: var(--fontsize-default, 14px);
|
31
33
|
}
|
34
|
+
|
32
35
|
#colors-container > div {
|
33
36
|
display: grid;
|
34
37
|
grid-template-columns: 34px 1fr 34px;
|
@@ -47,14 +50,11 @@ export class OxInputMultipleColors extends OxFormField {
|
|
47
50
|
border: var(--button-border);
|
48
51
|
border-radius: var(--border-radius);
|
49
52
|
background-color: var(--button-background-color);
|
50
|
-
padding: var(--padding-narrow) var(--padding-default);
|
51
53
|
line-height: 0.8;
|
52
54
|
color: var(--button-color);
|
53
55
|
cursor: pointer;
|
54
56
|
}
|
55
|
-
|
56
|
-
font-size: var(--fontsize-default);
|
57
|
-
}
|
57
|
+
|
58
58
|
button:focus,
|
59
59
|
button:hover,
|
60
60
|
button:active {
|
@@ -80,7 +80,7 @@ export class OxInputMultipleColors extends OxFormField {
|
|
80
80
|
(item, index) => html`
|
81
81
|
<div>
|
82
82
|
<button @click=${() => this._appendEditorColor()} data-index=${index} ?disabled=${this.disabled}>
|
83
|
-
<
|
83
|
+
<md-icon>add</md-icon>
|
84
84
|
</button>
|
85
85
|
<ox-input-color .value=${item} ?disabled=${this.disabled}> </ox-input-color>
|
86
86
|
|
@@ -91,7 +91,7 @@ export class OxInputMultipleColors extends OxFormField {
|
|
91
91
|
data-index=${index}
|
92
92
|
?disabled=${this.disabled}
|
93
93
|
>
|
94
|
-
<
|
94
|
+
<md-icon>remove</md-icon>
|
95
95
|
</button>
|
96
96
|
`
|
97
97
|
: html``}
|
package/src/ox-input-options.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import '@material/
|
5
|
+
import '@material/web/icon/icon.js'
|
6
6
|
|
7
7
|
import { css, html, nothing } from 'lit'
|
8
8
|
import { customElement, property } from 'lit/decorators.js'
|
@@ -19,6 +19,8 @@ export class OxInputOptions extends OxFormField {
|
|
19
19
|
flex-direction: column;
|
20
20
|
overflow: hidden;
|
21
21
|
margin-bottom: var(--margin-wide);
|
22
|
+
|
23
|
+
--md-icon-size: var(--fontsize-default, 14px);
|
22
24
|
}
|
23
25
|
|
24
26
|
div {
|
@@ -32,7 +34,6 @@ export class OxInputOptions extends OxFormField {
|
|
32
34
|
border: var(--button-border);
|
33
35
|
border-radius: var(--border-radius);
|
34
36
|
background-color: var(--button-background-color);
|
35
|
-
padding: var(--padding-narrow) var(--padding-default);
|
36
37
|
line-height: 0.8;
|
37
38
|
color: var(--button-color);
|
38
39
|
cursor: pointer;
|
@@ -40,9 +41,6 @@ export class OxInputOptions extends OxFormField {
|
|
40
41
|
button + button {
|
41
42
|
margin-left: -5px;
|
42
43
|
}
|
43
|
-
button mwc-icon {
|
44
|
-
font-size: var(--fontsize-default);
|
45
|
-
}
|
46
44
|
button:focus,
|
47
45
|
button:hover,
|
48
46
|
button:active {
|
@@ -91,7 +89,7 @@ export class OxInputOptions extends OxFormField {
|
|
91
89
|
tabindex="-1"
|
92
90
|
?disabled=${this.disabled}
|
93
91
|
>
|
94
|
-
<
|
92
|
+
<md-icon>remove</md-icon>
|
95
93
|
</button>
|
96
94
|
</div>
|
97
95
|
`
|
@@ -103,7 +101,7 @@ export class OxInputOptions extends OxFormField {
|
|
103
101
|
<input type="text" data-text="" placeholder="text" value="" />
|
104
102
|
<input type="text" data-value="" placeholder="value" value="" @change=${(e: Event) => this._add()} />
|
105
103
|
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
106
|
-
<
|
104
|
+
<md-icon>add</md-icon>
|
107
105
|
</button>
|
108
106
|
</div>
|
109
107
|
`}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import '@material/
|
5
|
+
import '@material/web/icon/icon.js'
|
6
6
|
|
7
7
|
import { css, html, nothing } from 'lit'
|
8
8
|
import { customElement, property, queryAll } from 'lit/decorators.js'
|
@@ -29,6 +29,8 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
29
29
|
flex-direction: column;
|
30
30
|
overflow: hidden;
|
31
31
|
margin-bottom: var(--margin-wide);
|
32
|
+
|
33
|
+
--md-icon-size: var(--fontsize-default, 14px);
|
32
34
|
}
|
33
35
|
|
34
36
|
div {
|
@@ -50,9 +52,7 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
50
52
|
button + button {
|
51
53
|
margin-left: -5px;
|
52
54
|
}
|
53
|
-
|
54
|
-
font-size: var(--fontsize-default);
|
55
|
-
}
|
55
|
+
|
56
56
|
button:focus,
|
57
57
|
button:hover,
|
58
58
|
button:active {
|
@@ -109,7 +109,7 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
109
109
|
tabindex="-1"
|
110
110
|
?disabled=${this.disabled}
|
111
111
|
>
|
112
|
-
<
|
112
|
+
<md-icon>remove</md-icon>
|
113
113
|
</button>
|
114
114
|
<button
|
115
115
|
class="record-action"
|
@@ -117,7 +117,7 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
117
117
|
tabindex="-1"
|
118
118
|
?disabled=${this.disabled}
|
119
119
|
>
|
120
|
-
<
|
120
|
+
<md-icon>arrow_upward</md-icon>
|
121
121
|
</button>
|
122
122
|
<button
|
123
123
|
class="record-action"
|
@@ -125,7 +125,7 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
125
125
|
tabindex="-1"
|
126
126
|
?disabled=${this.disabled}
|
127
127
|
>
|
128
|
-
<
|
128
|
+
<md-icon>arrow_downward</md-icon>
|
129
129
|
</button>
|
130
130
|
</div>
|
131
131
|
`
|
@@ -137,10 +137,10 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
137
137
|
<input type="text" data-key placeholder="key" value="" />
|
138
138
|
<input type="text" data-value placeholder="value" value="" list="value-template" />
|
139
139
|
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
140
|
-
<
|
140
|
+
<md-icon>add</md-icon>
|
141
141
|
</button>
|
142
|
-
<button class="hidden"><
|
143
|
-
<button class="hidden"><
|
142
|
+
<button class="hidden"><md-icon>add</md-icon></button>
|
143
|
+
<button class="hidden"><md-icon>add</md-icon></button>
|
144
144
|
</div>
|
145
145
|
`}
|
146
146
|
|
@@ -261,13 +261,16 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
261
261
|
const deleted = array.splice(index, 1)
|
262
262
|
array.splice(index + 1, 0, ...deleted)
|
263
263
|
|
264
|
-
this.value = array.reduce(
|
265
|
-
|
266
|
-
|
264
|
+
this.value = array.reduce(
|
265
|
+
(sum, record) => {
|
266
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
267
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
267
268
|
|
268
|
-
|
269
|
-
|
270
|
-
|
269
|
+
sum[key] = value
|
270
|
+
return sum
|
271
|
+
},
|
272
|
+
{} as { [key: string]: string }
|
273
|
+
)
|
271
274
|
|
272
275
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
273
276
|
}
|
@@ -284,13 +287,16 @@ export class OxInputPartitionKeys extends OxFormField {
|
|
284
287
|
array.splice(index, 1)
|
285
288
|
array.splice(index + 1, 0, record)
|
286
289
|
|
287
|
-
this.value = array.reduce(
|
288
|
-
|
289
|
-
|
290
|
+
this.value = array.reduce(
|
291
|
+
(sum, record) => {
|
292
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
293
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
290
294
|
|
291
|
-
|
292
|
-
|
293
|
-
|
295
|
+
sum[key] = value
|
296
|
+
return sum
|
297
|
+
},
|
298
|
+
{} as { [key: string]: string }
|
299
|
+
)
|
294
300
|
|
295
301
|
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
296
302
|
}
|