@operato/input 1.1.30 → 1.1.34
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 +18 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-input-select-buttons.d.ts +18 -0
- package/dist/src/ox-input-select-buttons.js +85 -0
- package/dist/src/ox-input-select-buttons.js.map +1 -0
- package/dist/src/ox-input-unit-number.js +8 -3
- package/dist/src/ox-input-unit-number.js.map +1 -1
- package/dist/src/ox-input-work-shift.d.ts +0 -1
- package/dist/src/ox-input-work-shift.js +2 -3
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/stories/ox-input-select-buttons.stories.d.ts +34 -0
- package/dist/stories/ox-input-select-buttons.stories.js +63 -0
- package/dist/stories/ox-input-select-buttons.stories.js.map +1 -0
- package/dist/stories/ox-input-unit.stories.d.ts +1 -0
- package/dist/stories/ox-input-unit.stories.js +4 -2
- package/dist/stories/ox-input-unit.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/index.ts +1 -0
- package/src/ox-input-select-buttons.ts +86 -0
- package/src/ox-input-unit-number.ts +9 -3
- package/src/ox-input-work-shift.ts +2 -4
- package/stories/ox-input-select-buttons.stories.ts +80 -0
- package/stories/ox-input-unit.stories.ts +6 -2
@@ -154,6 +154,7 @@ const UNIT_SYSTEMS: { [unit: string]: { [unit: string]: number | ((v: number) =>
|
|
154
154
|
'm2 oC/kW': 1000
|
155
155
|
},
|
156
156
|
'%': {},
|
157
|
+
'ppm (11%, O2 corrected)': {},
|
157
158
|
K: {
|
158
159
|
C: [(v: number) => v - 273.15, (v: number) => v + 273.15]
|
159
160
|
}
|
@@ -249,9 +250,9 @@ export class OxInputUnit extends OxFormField {
|
|
249
250
|
}
|
250
251
|
|
251
252
|
updated(changes: PropertyValues<this>) {
|
252
|
-
if (changes.has('stdUnit')) {
|
253
|
-
|
254
|
-
}
|
253
|
+
// if (changes.has('stdUnit')) {
|
254
|
+
// this.userUnit = this.userUnit || this.stdUnit
|
255
|
+
// }
|
255
256
|
}
|
256
257
|
|
257
258
|
_onChangeValue(e: Event) {
|
@@ -277,6 +278,11 @@ export class OxInputUnit extends OxFormField {
|
|
277
278
|
|
278
279
|
const converterValue = UNIT_SYSTEMS[this.stdUnit][this.userUnit]
|
279
280
|
|
281
|
+
if (!converterValue) {
|
282
|
+
delete this.userUnit
|
283
|
+
return
|
284
|
+
}
|
285
|
+
|
280
286
|
if (typeof converterValue === 'number') {
|
281
287
|
return this._toUserUnitByRate(stdValue, converterValue || 1)
|
282
288
|
} /* should be converter function array */ else {
|
@@ -2,8 +2,6 @@
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
3
|
*/
|
4
4
|
|
5
|
-
import './ox-input-color'
|
6
|
-
|
7
5
|
import { css, html } from 'lit'
|
8
6
|
import { customElement, property } from 'lit/decorators.js'
|
9
7
|
|
@@ -138,14 +136,14 @@ export class OxInputWorkShift extends OxFormField {
|
|
138
136
|
<div data-record>
|
139
137
|
<input type="text" data-name .value=${item.name} required />
|
140
138
|
|
141
|
-
<select data-from-date .value=${item.fromDate || 0}>
|
139
|
+
<select data-from-date .value=${String(item.fromDate || 0)}>
|
142
140
|
<option value="-1">${msg('The day before')}</option>
|
143
141
|
<option value="0">${msg('The day')}</option>
|
144
142
|
<option value="1">${msg('The day after')}</option>
|
145
143
|
</select>
|
146
144
|
<input type="time" data-from-time .value=${item.fromTime} step="1800" required />
|
147
145
|
|
148
|
-
<select data-to-date .value=${item.toDate || 0}>
|
146
|
+
<select data-to-date .value=${String(item.toDate || 0)}>
|
149
147
|
<option value="-1">${msg('The day before')}</option>
|
150
148
|
<option value="0">${msg('The day')}</option>
|
151
149
|
<option value="1">${msg('The day after')}</option>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import '../src/ox-input-select-buttons.js'
|
2
|
+
|
3
|
+
import { html, TemplateResult } from 'lit'
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'ox-input-select-buttons',
|
7
|
+
component: 'ox-input-select-buttons',
|
8
|
+
argTypes: {
|
9
|
+
value: { control: 'object' },
|
10
|
+
options: { control: 'object' },
|
11
|
+
multiple: { control: 'boolean' },
|
12
|
+
name: { control: 'text' }
|
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?: object | string
|
25
|
+
options: object
|
26
|
+
multiple?: boolean
|
27
|
+
}
|
28
|
+
|
29
|
+
const Template: Story<ArgTypes> = ({ name = 'options', value, multiple = false, options = [] }: ArgTypes) => html`
|
30
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
31
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
32
|
+
<style>
|
33
|
+
ox-input-select-buttons {
|
34
|
+
max-width: 400px;
|
35
|
+
}
|
36
|
+
</style>
|
37
|
+
|
38
|
+
<ox-input-select-buttons
|
39
|
+
@change=${(e: Event) => {
|
40
|
+
console.log((e.target as HTMLInputElement).value)
|
41
|
+
}}
|
42
|
+
name=${name}
|
43
|
+
.value=${value}
|
44
|
+
.options=${options}
|
45
|
+
?multiple=${multiple}
|
46
|
+
>
|
47
|
+
</ox-input-select-buttons>
|
48
|
+
`
|
49
|
+
|
50
|
+
export const Regular = Template.bind({})
|
51
|
+
Regular.args = {
|
52
|
+
name: 'options',
|
53
|
+
value: 'Clothes',
|
54
|
+
options: [
|
55
|
+
{ display: 'SHOOSE', value: 'Shoose' },
|
56
|
+
{ display: 'CHOTHES', value: 'Clothes' },
|
57
|
+
{ display: 'GLOVES', value: 'Gloves' }
|
58
|
+
]
|
59
|
+
}
|
60
|
+
|
61
|
+
export const Multiple = Template.bind({})
|
62
|
+
Multiple.args = {
|
63
|
+
name: 'options',
|
64
|
+
value: ['Clothes'],
|
65
|
+
multiple: true,
|
66
|
+
options: [
|
67
|
+
{ display: 'SHOOSE1', value: 'Shoose1' },
|
68
|
+
{ display: 'CHOTHES1', value: 'Clothes1' },
|
69
|
+
{ display: 'GLOVES1', value: 'Gloves1' },
|
70
|
+
{ display: 'SHOOSE2', value: 'Shoose2' },
|
71
|
+
{ display: 'CHOTHES2', value: 'Clothes2' },
|
72
|
+
{ display: 'GLOVES2', value: 'Gloves2' },
|
73
|
+
{ display: 'SHOOSE3', value: 'Shoose3' },
|
74
|
+
{ display: 'CHOTHES3', value: 'Clothes3' },
|
75
|
+
{ display: 'GLOVES3', value: 'Gloves3' },
|
76
|
+
{ display: 'SHOOSE4', value: 'Shoose4' },
|
77
|
+
{ display: 'CHOTHES4', value: 'Clothes4' },
|
78
|
+
{ display: 'GLOVES4', value: 'Gloves4' }
|
79
|
+
]
|
80
|
+
}
|
@@ -55,13 +55,15 @@ interface ArgTypes {
|
|
55
55
|
name?: string
|
56
56
|
value?: number
|
57
57
|
stdUnit: string
|
58
|
+
userUnit: string
|
58
59
|
}
|
59
60
|
|
60
61
|
const Template: Story<ArgTypes> = ({
|
61
62
|
placeholder = 'unit',
|
62
63
|
name = 'hello',
|
63
64
|
value = 0,
|
64
|
-
stdUnit = 'kg'
|
65
|
+
stdUnit = 'kg',
|
66
|
+
userUnit
|
65
67
|
}: ArgTypes) => html`
|
66
68
|
<link href="/themes/app-theme.css" rel="stylesheet" />
|
67
69
|
<ox-input-unit-number
|
@@ -69,6 +71,7 @@ const Template: Story<ArgTypes> = ({
|
|
69
71
|
placeholder=${placeholder}
|
70
72
|
.value=${value}
|
71
73
|
std-unit=${stdUnit}
|
74
|
+
user-unit=${userUnit}
|
72
75
|
@change=${(e: CustomEvent) => console.log(e.detail)}
|
73
76
|
>
|
74
77
|
</ox-input-unit-number>
|
@@ -95,7 +98,8 @@ Temperature.args = {
|
|
95
98
|
placeholder: 'temperature',
|
96
99
|
name: 'temperature',
|
97
100
|
value: 0,
|
98
|
-
stdUnit: 'K'
|
101
|
+
stdUnit: 'K',
|
102
|
+
userUnit: 'C'
|
99
103
|
}
|
100
104
|
|
101
105
|
export const Percentage = Template.bind({})
|