@operato/input 2.0.0-alpha.4 → 2.0.0-alpha.48
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 +126 -0
- package/dist/src/ox-input-barcode.d.ts +48 -5
- package/dist/src/ox-input-barcode.js +96 -69
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-data.d.ts +3 -4
- package/dist/src/ox-input-data.js +86 -34
- package/dist/src/ox-input-data.js.map +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-mass-fraction.d.ts +1 -0
- package/dist/src/ox-input-mass-fraction.js +48 -31
- package/dist/src/ox-input-mass-fraction.js.map +1 -1
- package/dist/stories/ox-input-barcode.stories.js +4 -0
- package/dist/stories/ox-input-barcode.stories.js.map +1 -1
- package/dist/stories/ox-input-data.stories.d.ts +33 -0
- package/dist/stories/ox-input-data.stories.js +40 -0
- package/dist/stories/ox-input-data.stories.js.map +1 -0
- package/dist/stories/ox-input-i18n-label.stories.d.ts +29 -0
- package/dist/stories/ox-input-i18n-label.stories.js +58 -0
- package/dist/stories/ox-input-i18n-label.stories.js.map +1 -0
- package/dist/stories/ox-input-mass-fraction.stories.d.ts +4 -0
- package/dist/stories/ox-input-mass-fraction.stories.js +9 -2
- package/dist/stories/ox-input-mass-fraction.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -17
- package/src/ox-input-barcode.ts +127 -63
- package/src/ox-input-data.ts +95 -36
- package/src/ox-input-i18n-label.ts +139 -0
- package/src/ox-input-mass-fraction.ts +46 -32
- package/stories/ox-input-barcode.stories.ts +4 -0
- package/stories/ox-input-data.stories.ts +55 -0
- package/stories/ox-input-i18n-label.stories.ts +73 -0
- package/stories/ox-input-mass-fraction.stories.ts +10 -1
- package/yarn-error.log +17084 -0
@@ -131,11 +131,16 @@ export class OxInputMassFraction extends OxFormField {
|
|
131
131
|
display: block;
|
132
132
|
text-align: center;
|
133
133
|
}
|
134
|
+
|
135
|
+
[right-end] {
|
136
|
+
margin-left: auto;
|
137
|
+
}
|
134
138
|
`
|
135
139
|
]
|
136
140
|
|
137
141
|
@property({ type: Object }) defaultValue: MassFraction = {}
|
138
142
|
@property({ type: Object }) value: MassFraction = {}
|
143
|
+
@property({ type: Boolean, attribute: true }) composable: boolean = false
|
139
144
|
|
140
145
|
@queryAll('[data-record]') records!: NodeListOf<HTMLElement>
|
141
146
|
|
@@ -168,14 +173,18 @@ export class OxInputMassFraction extends OxFormField {
|
|
168
173
|
list="value-template"
|
169
174
|
?disabled=${this.disabled}
|
170
175
|
/>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
176
|
+
${this.composable
|
177
|
+
? html`
|
178
|
+
<button
|
179
|
+
class="record-action"
|
180
|
+
@click=${(e: MouseEvent) => this._delete(e)}
|
181
|
+
tabindex="-1"
|
182
|
+
?disabled=${this.disabled}
|
183
|
+
>
|
184
|
+
<mwc-icon>remove</mwc-icon>
|
185
|
+
</button>
|
186
|
+
`
|
187
|
+
: nothing}
|
179
188
|
<button
|
180
189
|
class="record-action"
|
181
190
|
@click=${(e: MouseEvent) => this._up(e)}
|
@@ -202,36 +211,41 @@ export class OxInputMassFraction extends OxFormField {
|
|
202
211
|
? nothing
|
203
212
|
: html`
|
204
213
|
<div data-record-new>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
214
|
+
${this.composable
|
215
|
+
? html`
|
216
|
+
<ox-select
|
217
|
+
data-key
|
218
|
+
placeholder="Fluid"
|
219
|
+
.value=${live('')}
|
220
|
+
@change=${(e: Event) => {
|
221
|
+
e.stopPropagation()
|
222
|
+
}}
|
223
|
+
>
|
224
|
+
<ox-popup-list with-search> ${this.options} </ox-popup-list>
|
225
|
+
</ox-select>
|
226
|
+
|
227
|
+
<input
|
228
|
+
type="number"
|
229
|
+
data-value
|
230
|
+
placeholder="proportion"
|
231
|
+
min="0"
|
232
|
+
max="1"
|
233
|
+
step="0.01"
|
234
|
+
value=""
|
235
|
+
list="value-template"
|
236
|
+
/>
|
237
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
|
238
|
+
<mwc-icon>add</mwc-icon>
|
239
|
+
</button>
|
240
|
+
`
|
241
|
+
: nothing}
|
229
242
|
<button
|
230
243
|
title="fill with the values suggested"
|
231
244
|
@click=${() => {
|
232
245
|
this.value = { ...this.defaultValue }
|
233
246
|
this.dispatchChangeEvent()
|
234
247
|
}}
|
248
|
+
right-end
|
235
249
|
>
|
236
250
|
<mwc-icon>settings_suggest</mwc-icon>
|
237
251
|
</button>
|
@@ -43,6 +43,10 @@ const Template: Story<ArgTypes> = ({
|
|
43
43
|
<link href="/themes/app-theme.css" rel="stylesheet" />
|
44
44
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
45
45
|
<style>
|
46
|
+
#root {
|
47
|
+
height: 500px;
|
48
|
+
}
|
49
|
+
|
46
50
|
ox-input-barcode {
|
47
51
|
font-size: 80px;
|
48
52
|
--input-font: initial;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import '../src/ox-input-data.js'
|
2
|
+
|
3
|
+
import { html, TemplateResult } from 'lit'
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'ox-input-data',
|
7
|
+
component: 'ox-input-data',
|
8
|
+
argTypes: {
|
9
|
+
value: { control: 'text' },
|
10
|
+
name: { control: 'text' },
|
11
|
+
language: { control: 'select', options: ['javascript', 'sql', 'json'] },
|
12
|
+
disabled: { control: 'boolean' }
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
interface Story<T> {
|
17
|
+
(args: T): TemplateResult
|
18
|
+
args?: Partial<T>
|
19
|
+
argTypes?: Record<string, unknown>
|
20
|
+
}
|
21
|
+
|
22
|
+
interface ArgTypes {
|
23
|
+
name?: string
|
24
|
+
value?: string | number | object
|
25
|
+
disabled?: boolean
|
26
|
+
}
|
27
|
+
|
28
|
+
const Template: Story<ArgTypes> = ({ name = 'code', value = '', disabled }: ArgTypes) => html`
|
29
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
30
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
31
|
+
<style>
|
32
|
+
body {
|
33
|
+
}
|
34
|
+
ox-input-data {
|
35
|
+
height: 300px;
|
36
|
+
}
|
37
|
+
</style>
|
38
|
+
|
39
|
+
<ox-input-data
|
40
|
+
@change=${(e: Event) => {
|
41
|
+
const value = (e.target as HTMLInputElement).value
|
42
|
+
console.log('value : ', value, typeof value)
|
43
|
+
}}
|
44
|
+
name=${name}
|
45
|
+
.value=${value}
|
46
|
+
?disabled=${disabled}
|
47
|
+
>
|
48
|
+
</ox-input-data>
|
49
|
+
`
|
50
|
+
|
51
|
+
export const Regular = Template.bind({})
|
52
|
+
Regular.args = {
|
53
|
+
name: 'data',
|
54
|
+
value: ''
|
55
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import '../src/ox-input-i18n-label.js'
|
2
|
+
|
3
|
+
import { html, TemplateResult } from 'lit'
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'ox-input-i18n-label',
|
7
|
+
component: 'ox-input-i18n-label',
|
8
|
+
argTypes: {
|
9
|
+
name: { control: 'text' },
|
10
|
+
value: { control: 'object' },
|
11
|
+
disabled: { control: 'boolean' }
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
interface Story<T> {
|
16
|
+
(args: T): TemplateResult
|
17
|
+
args?: Partial<T>
|
18
|
+
argTypes?: Record<string, unknown>
|
19
|
+
}
|
20
|
+
|
21
|
+
interface ArgTypes {
|
22
|
+
name?: string
|
23
|
+
value?: object
|
24
|
+
disabled?: boolean
|
25
|
+
}
|
26
|
+
|
27
|
+
const Template: Story<ArgTypes> = ({ name = 'values', value = {}, disabled }: ArgTypes) => html`
|
28
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
29
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
30
|
+
<style>
|
31
|
+
body {
|
32
|
+
}
|
33
|
+
</style>
|
34
|
+
|
35
|
+
<ox-input-i18n-label
|
36
|
+
@change=${(e: Event) => {
|
37
|
+
console.log((e.target as HTMLInputElement).value)
|
38
|
+
}}
|
39
|
+
name=${name}
|
40
|
+
.value=${value}
|
41
|
+
.languages=${[
|
42
|
+
{
|
43
|
+
code: 'ko',
|
44
|
+
display: '한글'
|
45
|
+
},
|
46
|
+
{
|
47
|
+
code: 'en',
|
48
|
+
display: 'English'
|
49
|
+
},
|
50
|
+
{
|
51
|
+
code: 'zh',
|
52
|
+
display: 'Chinese'
|
53
|
+
},
|
54
|
+
{
|
55
|
+
code: 'ja',
|
56
|
+
display: 'Japanese'
|
57
|
+
}
|
58
|
+
]}
|
59
|
+
?disabled=${disabled}
|
60
|
+
>
|
61
|
+
</ox-input-i18n-label>
|
62
|
+
`
|
63
|
+
|
64
|
+
export const Regular = Template.bind({})
|
65
|
+
Regular.args = {
|
66
|
+
name: 'i18n labels',
|
67
|
+
value: {
|
68
|
+
ko: '한글 코드',
|
69
|
+
en: 'English code',
|
70
|
+
zh: 'Chinese code',
|
71
|
+
ja: 'Japan code'
|
72
|
+
}
|
73
|
+
}
|
@@ -9,6 +9,7 @@ export default {
|
|
9
9
|
name: { control: 'text' },
|
10
10
|
value: { control: 'object' },
|
11
11
|
defaultValue: { control: 'object' },
|
12
|
+
composable: { control: 'boolean' },
|
12
13
|
disabled: { control: 'boolean' }
|
13
14
|
}
|
14
15
|
}
|
@@ -23,6 +24,7 @@ interface ArgTypes {
|
|
23
24
|
name?: string
|
24
25
|
value?: object
|
25
26
|
defaultValue?: object
|
27
|
+
composable?: boolean
|
26
28
|
disabled?: boolean
|
27
29
|
}
|
28
30
|
|
@@ -30,6 +32,7 @@ const Template: Story<ArgTypes> = ({
|
|
30
32
|
name = 'mass-fraction',
|
31
33
|
value = {},
|
32
34
|
defaultValue = {},
|
35
|
+
composable = true,
|
33
36
|
disabled
|
34
37
|
}: ArgTypes) => html`
|
35
38
|
<link href="/themes/app-theme.css" rel="stylesheet" />
|
@@ -46,6 +49,7 @@ const Template: Story<ArgTypes> = ({
|
|
46
49
|
name=${name}
|
47
50
|
.value=${value}
|
48
51
|
.defaultValue=${defaultValue}
|
52
|
+
?composable=${composable}
|
49
53
|
?disabled=${disabled}
|
50
54
|
>
|
51
55
|
</ox-input-mass-fraction>
|
@@ -54,7 +58,12 @@ const Template: Story<ArgTypes> = ({
|
|
54
58
|
export const Regular = Template.bind({})
|
55
59
|
Regular.args = {
|
56
60
|
name: 'mass-fraction',
|
57
|
-
value: {
|
61
|
+
value: {
|
62
|
+
H2O: 0.8,
|
63
|
+
N2O: 0.1,
|
64
|
+
CO2: 0.1
|
65
|
+
},
|
66
|
+
composable: true,
|
58
67
|
defaultValue: {
|
59
68
|
H2O: 0.8,
|
60
69
|
N2O: 0.1,
|