@operato/input 1.0.0-beta.15 → 1.0.0-beta.18
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 +28 -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-range.js +35 -38
- package/dist/src/ox-input-range.js.map +1 -1
- package/dist/src/ox-input-search.d.ts +0 -1
- package/dist/src/ox-input-search.js +7 -3
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-unit.d.ts +1 -1
- package/dist/src/ox-input-unit.js +13 -3
- package/dist/src/ox-input-unit.js.map +1 -1
- package/dist/src/ox-input-work-shift.js +58 -26
- package/dist/src/ox-input-work-shift.js.map +1 -1
- package/dist/src/ox-select.js +12 -1
- package/dist/src/ox-select.js.map +1 -1
- package/dist/stories/ox-input-crontab.stories.d.ts +26 -0
- package/dist/stories/ox-input-crontab.stories.js +37 -0
- package/dist/stories/ox-input-crontab.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/ox-input-range.stories.js +3 -0
- package/dist/stories/ox-input-range.stories.js.map +1 -1
- package/dist/stories/ox-input-search.stories.js +5 -1
- package/dist/stories/ox-input-search.stories.js.map +1 -1
- package/dist/stories/ox-input-unit.stories.js +1 -0
- package/dist/stories/ox-input-unit.stories.js.map +1 -1
- package/dist/stories/ox-select.stories.js +1 -0
- package/dist/stories/ox-select.stories.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/ox-input-file.ts +7 -6
- package/src/ox-input-range.ts +35 -38
- package/src/ox-input-search.ts +7 -4
- package/src/ox-input-unit.ts +15 -4
- package/src/ox-input-work-shift.ts +58 -26
- package/src/ox-select.ts +15 -3
- package/stories/{ox-input-conntab.stories.ts → ox-input-crontab.stories.ts} +0 -0
- package/stories/ox-input-file.stories.ts +77 -0
- package/stories/ox-input-range.stories.ts +3 -0
- package/stories/ox-input-search.stories.ts +5 -1
- package/stories/ox-input-unit.stories.ts +2 -1
- package/stories/ox-select.stories.ts +1 -0
package/src/ox-input-range.ts
CHANGED
@@ -11,10 +11,9 @@ import { OxFormField } from './ox-form-field.js'
|
|
11
11
|
class OxInputRange extends OxFormField {
|
12
12
|
static styles = css`
|
13
13
|
:host {
|
14
|
-
font-size: 16px;
|
15
14
|
display: flex;
|
15
|
+
gap: var(--margin-default);
|
16
16
|
align-items: center;
|
17
|
-
padding: 1px 0;
|
18
17
|
|
19
18
|
width: 100%;
|
20
19
|
user-select: text;
|
@@ -22,15 +21,15 @@ class OxInputRange extends OxFormField {
|
|
22
21
|
|
23
22
|
input[type='number'] {
|
24
23
|
width: 48px;
|
25
|
-
|
24
|
+
border: 0;
|
25
|
+
border-bottom: var(--border-dark-color);
|
26
|
+
padding: var(--input-padding);
|
27
|
+
font: var(--input-font);
|
28
|
+
color: var(--primary-text-color);
|
26
29
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
border: none;
|
31
|
-
font-weight: 300;
|
32
|
-
background: white;
|
33
|
-
padding: 1px 2px;
|
30
|
+
input[type='number']:focus {
|
31
|
+
outline: none;
|
32
|
+
border-bottom: 1px solid var(--primary-color);
|
34
33
|
}
|
35
34
|
|
36
35
|
input[type='range'] {
|
@@ -44,40 +43,40 @@ class OxInputRange extends OxFormField {
|
|
44
43
|
}
|
45
44
|
input[type='range']::-webkit-slider-runnable-track {
|
46
45
|
width: 100%;
|
47
|
-
height:
|
48
|
-
background:
|
49
|
-
border:
|
46
|
+
height: 7px;
|
47
|
+
background-color: rgba(0, 0, 0, 0.02);
|
48
|
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
50
49
|
border-radius: 5px;
|
51
50
|
}
|
52
51
|
input[type='range']::-webkit-slider-thumb {
|
53
52
|
-webkit-appearance: none;
|
54
53
|
border: none;
|
55
|
-
height:
|
56
|
-
width:
|
54
|
+
height: 16px;
|
55
|
+
width: 16px;
|
57
56
|
border-radius: 50%;
|
58
|
-
background:
|
59
|
-
margin-top: -
|
57
|
+
background: var(--primary-color);
|
58
|
+
margin-top: -6px;
|
59
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.15);
|
60
60
|
}
|
61
61
|
input[type='range']:focus {
|
62
62
|
outline: none;
|
63
63
|
}
|
64
|
-
input[type='range']:focus::-webkit-slider-runnable-track {
|
65
|
-
background: black;
|
66
|
-
}
|
67
64
|
|
68
65
|
input[type='range']::-moz-range-track {
|
69
66
|
width: 100%;
|
70
|
-
height:
|
71
|
-
background:
|
72
|
-
border:
|
67
|
+
height: 7px;
|
68
|
+
background-color: rgba(0, 0, 0, 0.02);
|
69
|
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
73
70
|
border-radius: 5px;
|
74
71
|
}
|
75
72
|
input[type='range']::-moz-range-thumb {
|
76
73
|
border: none;
|
77
|
-
height:
|
78
|
-
width:
|
74
|
+
height: 16px;
|
75
|
+
width: 16px;
|
79
76
|
border-radius: 50%;
|
80
|
-
background:
|
77
|
+
background: var(--primary-color);
|
78
|
+
margin-top: -6px;
|
79
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.15);
|
81
80
|
}
|
82
81
|
|
83
82
|
input[type='range']:-moz-focusring {
|
@@ -87,21 +86,19 @@ class OxInputRange extends OxFormField {
|
|
87
86
|
|
88
87
|
input[type='range']::-ms-track {
|
89
88
|
width: 100%;
|
90
|
-
height:
|
91
|
-
background:
|
92
|
-
border
|
93
|
-
|
94
|
-
border: none;
|
95
|
-
outline: none;
|
89
|
+
height: 7px;
|
90
|
+
background-color: rgba(0, 0, 0, 0.02);
|
91
|
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
92
|
+
border-radius: 5px;
|
96
93
|
}
|
97
94
|
input[type='range']::-ms-thumb {
|
98
|
-
height: 10px;
|
99
|
-
width: 10px;
|
100
|
-
border-radius: 50%;
|
101
|
-
background: black;
|
102
95
|
border: none;
|
103
|
-
|
104
|
-
|
96
|
+
height: 16px;
|
97
|
+
width: 16px;
|
98
|
+
border-radius: 50%;
|
99
|
+
background: var(--primary-color);
|
100
|
+
margin-top: -6px;
|
101
|
+
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.15);
|
105
102
|
}
|
106
103
|
|
107
104
|
input:focus {
|
package/src/ox-input-search.ts
CHANGED
@@ -55,14 +55,17 @@ export class OxInputSearch extends OxFormField {
|
|
55
55
|
.value=${this.value || ''}
|
56
56
|
.placeholder=${this.placeholder || ''}
|
57
57
|
@change=${(e: Event) => this._onChangeValue(e)}
|
58
|
+
@keydown=${(e: KeyboardEvent) => {
|
59
|
+
if (e.key === 'Enter') {
|
60
|
+
/* Even if the value has not changed, the enter key triggers a change event. */
|
61
|
+
e.preventDefault() /* Prevent change event from occurring twice. */
|
62
|
+
this._onChangeValue(e)
|
63
|
+
}
|
64
|
+
}}
|
58
65
|
/>
|
59
66
|
`
|
60
67
|
}
|
61
68
|
|
62
|
-
firstUpdated() {
|
63
|
-
this.renderRoot.addEventListener('change', this._onChangeValue.bind(this))
|
64
|
-
}
|
65
|
-
|
66
69
|
_onChangeValue(e: Event) {
|
67
70
|
e.stopPropagation()
|
68
71
|
this.value = this.input.value
|
package/src/ox-input-unit.ts
CHANGED
@@ -5,9 +5,10 @@
|
|
5
5
|
import { css, html } from 'lit'
|
6
6
|
import { customElement, property, query } from 'lit/decorators.js'
|
7
7
|
|
8
|
-
import { OxFormField } from './ox-form-field'
|
9
8
|
import { OxPopupList } from '@operato/popup'
|
10
9
|
|
10
|
+
import { OxFormField } from './ox-form-field'
|
11
|
+
|
11
12
|
const UNIT_SYSTEMS: { [unit: string]: { [unit: string]: number } } = {
|
12
13
|
kg: {
|
13
14
|
mg: 1000000,
|
@@ -24,9 +25,15 @@ export class OxInputUnit extends OxFormField {
|
|
24
25
|
static styles = [
|
25
26
|
css`
|
26
27
|
input {
|
27
|
-
|
28
|
-
border:
|
29
|
-
|
28
|
+
border: 0;
|
29
|
+
border-bottom: var(--border-dark-color);
|
30
|
+
padding: var(--input-padding);
|
31
|
+
font: var(--input-font);
|
32
|
+
color: var(--primary-text-color);
|
33
|
+
}
|
34
|
+
input:focus {
|
35
|
+
outline: none;
|
36
|
+
border-bottom: 1px solid var(--primary-color);
|
30
37
|
}
|
31
38
|
|
32
39
|
input::-webkit-outer-spin-button,
|
@@ -42,6 +49,10 @@ export class OxInputUnit extends OxFormField {
|
|
42
49
|
div {
|
43
50
|
display: inline;
|
44
51
|
position: relative;
|
52
|
+
margin-left: var(--margin-narrow);
|
53
|
+
font: var(--label-font);
|
54
|
+
color: var(--label-color);
|
55
|
+
opacity: 0.7;
|
45
56
|
}
|
46
57
|
`
|
47
58
|
]
|
@@ -30,34 +30,19 @@ export class OxInputWorkShift extends OxFormField {
|
|
30
30
|
:host {
|
31
31
|
display: flex;
|
32
32
|
flex-direction: column;
|
33
|
-
align-content: center;
|
34
33
|
|
35
34
|
width: 100%;
|
36
35
|
overflow: hidden;
|
37
|
-
border: 1px solid #ccc;
|
38
36
|
}
|
39
37
|
|
40
38
|
div {
|
41
39
|
display: flex;
|
42
40
|
flex-flow: row nowrap;
|
43
|
-
|
44
|
-
|
45
|
-
border-bottom: 1px solid #c0c0c0;
|
46
|
-
}
|
47
|
-
|
48
|
-
div:last-child {
|
49
|
-
border-bottom: none;
|
50
|
-
}
|
51
|
-
|
52
|
-
div > * {
|
53
|
-
min-width: 0px;
|
54
|
-
margin: 2px;
|
55
|
-
padding: 0;
|
41
|
+
gap: var(--margin-default);
|
56
42
|
}
|
57
43
|
|
58
|
-
button,
|
59
44
|
empty-element {
|
60
|
-
width:
|
45
|
+
width: 34px;
|
61
46
|
text-align: center;
|
62
47
|
}
|
63
48
|
|
@@ -66,21 +51,64 @@ export class OxInputWorkShift extends OxFormField {
|
|
66
51
|
span {
|
67
52
|
flex: 1;
|
68
53
|
}
|
54
|
+
[data-header] {
|
55
|
+
background-color: rgba(var(--primary-color-rgb), 0.05);
|
56
|
+
padding: var(--padding-narrow);
|
57
|
+
}
|
58
|
+
[data-header] span {
|
59
|
+
font: var(--label-font);
|
60
|
+
color: var(--label-color);
|
61
|
+
text-transform: var(--label-text-transform);
|
62
|
+
text-align: center;
|
63
|
+
}
|
64
|
+
[data-record] {
|
65
|
+
margin-bottom: var(--margin-narrow);
|
66
|
+
}
|
67
|
+
input,
|
68
|
+
select {
|
69
|
+
border: 0;
|
70
|
+
border-bottom: var(--border-dark-color);
|
71
|
+
padding: var(--input-padding);
|
72
|
+
font: var(--input-font);
|
73
|
+
color: var(--primary-text-color);
|
74
|
+
|
75
|
+
max-height: 35px;
|
76
|
+
}
|
77
|
+
input:focus,
|
78
|
+
select:focus {
|
79
|
+
outline: none;
|
80
|
+
border-bottom: 1px solid var(--primary-color);
|
81
|
+
}
|
69
82
|
|
70
83
|
input:required:invalid {
|
71
84
|
border: 1px dashed red;
|
72
85
|
}
|
73
|
-
|
74
|
-
|
75
|
-
flex: 2;
|
86
|
+
input[type='time'] {
|
87
|
+
padding: 2px var(--padding-default);
|
76
88
|
}
|
77
89
|
|
78
|
-
|
79
|
-
border
|
90
|
+
button {
|
91
|
+
border: var(--button-border);
|
92
|
+
border-radius: var(--border-radius);
|
93
|
+
background-color: var(--button-background-color);
|
94
|
+
padding: var(--padding-narrow) var(--padding-default);
|
95
|
+
line-height: 0.8;
|
96
|
+
color: var(--button-color);
|
97
|
+
cursor: pointer;
|
98
|
+
}
|
99
|
+
button mwc-icon {
|
100
|
+
font-size: var(--fontsize-default);
|
101
|
+
}
|
102
|
+
button:focus,
|
103
|
+
button:hover,
|
104
|
+
button:active {
|
105
|
+
border: var(--button-activ-border);
|
106
|
+
background-color: var(--button-background-focus-color);
|
107
|
+
color: var(--theme-white-color);
|
80
108
|
}
|
81
109
|
|
82
|
-
|
83
|
-
|
110
|
+
[placeholder='value'] {
|
111
|
+
flex: 2;
|
84
112
|
}
|
85
113
|
`
|
86
114
|
|
@@ -122,7 +150,9 @@ export class OxInputWorkShift extends OxFormField {
|
|
122
150
|
</select>
|
123
151
|
<input type="time" data-to-time .value=${item.toTime} step="1800" required />
|
124
152
|
|
125
|
-
<button class="record-action" @click=${(e: Event) => this._delete(e)} tabindex="-1"
|
153
|
+
<button class="record-action" @click=${(e: Event) => this._delete(e)} tabindex="-1">
|
154
|
+
<mwc-icon>remove</mwc-icon>
|
155
|
+
</button>
|
126
156
|
</div>
|
127
157
|
`
|
128
158
|
)}
|
@@ -144,7 +174,9 @@ export class OxInputWorkShift extends OxFormField {
|
|
144
174
|
</select>
|
145
175
|
<input type="time" data-to-time step="1800" />
|
146
176
|
|
147
|
-
<button class="record-action" @click=${(e: Event) => this._add()} tabindex="-1"
|
177
|
+
<button class="record-action" @click=${(e: Event) => this._add()} tabindex="-1">
|
178
|
+
<mwc-icon>add</mwc-icon>
|
179
|
+
</button>
|
148
180
|
</div>
|
149
181
|
`
|
150
182
|
}
|
package/src/ox-select.ts
CHANGED
@@ -5,14 +5,15 @@
|
|
5
5
|
import '@material/mwc-icon'
|
6
6
|
import '@operato/popup/ox-popup-list.js'
|
7
7
|
|
8
|
-
import {
|
9
|
-
import { customElement, property,
|
8
|
+
import { css, html, PropertyValues } from 'lit'
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
10
10
|
|
11
|
-
import { OxFormField } from './ox-form-field.js'
|
12
11
|
import { OxPopupList } from '@operato/popup'
|
13
12
|
import { TooltipStyles } from '@operato/styles'
|
14
13
|
import { detectOverflow } from '@operato/utils'
|
15
14
|
|
15
|
+
import { OxFormField } from './ox-form-field.js'
|
16
|
+
|
16
17
|
function onmouseover(e: Event) {
|
17
18
|
const element = e.target as HTMLSpanElement
|
18
19
|
if (detectOverflow(element)) {
|
@@ -41,6 +42,11 @@ export class Select extends OxFormField {
|
|
41
42
|
align-items: center;
|
42
43
|
justify-content: center;
|
43
44
|
cursor: pointer;
|
45
|
+
|
46
|
+
border-bottom: var(--border-dark-color);
|
47
|
+
padding: var(--input-padding);
|
48
|
+
font: var(--input-font);
|
49
|
+
color: var(--primary-text-color);
|
44
50
|
}
|
45
51
|
|
46
52
|
span {
|
@@ -49,6 +55,9 @@ export class Select extends OxFormField {
|
|
49
55
|
text-overflow: ellipsis;
|
50
56
|
white-space: nowrap;
|
51
57
|
}
|
58
|
+
div:hover {
|
59
|
+
border-bottom: 1px solid var(--primary-color);
|
60
|
+
}
|
52
61
|
|
53
62
|
mwc-icon {
|
54
63
|
display: block;
|
@@ -58,6 +67,9 @@ export class Select extends OxFormField {
|
|
58
67
|
color: var(--theme-primary-text-color, #3c3938);
|
59
68
|
opacity: 0.7;
|
60
69
|
}
|
70
|
+
div:hover mwc-icon {
|
71
|
+
color: var(--primary-color);
|
72
|
+
}
|
61
73
|
|
62
74
|
::slotted(ox-popup-list) {
|
63
75
|
width: 100%;
|
File without changes
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import '../src/ox-input-file.js'
|
2
|
+
|
3
|
+
import { html, TemplateResult } from 'lit'
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'ox-input-file',
|
7
|
+
component: 'ox-input-file',
|
8
|
+
argTypes: {
|
9
|
+
name: { control: 'text' },
|
10
|
+
multiple: { control: 'boolean' },
|
11
|
+
accept: { control: 'text' },
|
12
|
+
icon: { control: 'text' },
|
13
|
+
label: { control: 'text' },
|
14
|
+
description: { control: 'text' },
|
15
|
+
hideFileList: { control: 'boolean' },
|
16
|
+
attachFileList: { control: 'boolean' }
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
interface Story<T> {
|
21
|
+
(args: T): TemplateResult
|
22
|
+
args?: Partial<T>
|
23
|
+
argTypes?: Record<string, unknown>
|
24
|
+
}
|
25
|
+
|
26
|
+
interface ArgTypes {
|
27
|
+
label?: string
|
28
|
+
name?: string
|
29
|
+
multiple?: boolean
|
30
|
+
accept?: string
|
31
|
+
icon?: string
|
32
|
+
description?: string
|
33
|
+
hideFileList?: boolean
|
34
|
+
attachFileList?: boolean
|
35
|
+
}
|
36
|
+
|
37
|
+
const Template: Story<ArgTypes> = ({
|
38
|
+
label = 'select files',
|
39
|
+
name = 'file',
|
40
|
+
multiple = true,
|
41
|
+
accept,
|
42
|
+
icon,
|
43
|
+
description,
|
44
|
+
hideFileList = false,
|
45
|
+
attachFileList = false
|
46
|
+
}: ArgTypes) => html`
|
47
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
48
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
49
|
+
<style>
|
50
|
+
body {
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
|
54
|
+
<ox-input-file
|
55
|
+
label=${label}
|
56
|
+
name=${name}
|
57
|
+
?multiple=${multiple}
|
58
|
+
?hide-filelist=${hideFileList}
|
59
|
+
?attach-filelist=${attachFileList}
|
60
|
+
accept=${accept}
|
61
|
+
icon=${icon}
|
62
|
+
description=${description}
|
63
|
+
>
|
64
|
+
</ox-input-file>
|
65
|
+
`
|
66
|
+
|
67
|
+
export const Regular = Template.bind({})
|
68
|
+
Regular.args = {
|
69
|
+
label: 'select files',
|
70
|
+
name: 'files',
|
71
|
+
multiple: true,
|
72
|
+
hideFileList: false,
|
73
|
+
attachFileList: false,
|
74
|
+
accept: '*.*',
|
75
|
+
icon: 'upload',
|
76
|
+
description: 'drop files here!'
|
77
|
+
}
|
@@ -29,6 +29,9 @@ interface ArgTypes {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
const Template: Story<ArgTypes> = ({ name = 'range', value = 0, step = 1, min = 0, max = 100 }: ArgTypes) => html`
|
32
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
33
|
+
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
34
|
+
|
32
35
|
<ox-input-range name=${name} value=${value} step=${step} min=${min} max=${max}> </ox-input-range>
|
33
36
|
`
|
34
37
|
|
@@ -32,7 +32,11 @@ const Template: Story<ArgTypes> = ({ placeholder = 'Search', name = 'hello', val
|
|
32
32
|
}
|
33
33
|
</style>
|
34
34
|
|
35
|
-
<ox-input-search
|
35
|
+
<ox-input-search
|
36
|
+
@change=${(e: Event) => console.log('changed', (e.target as HTMLInputElement).value)}
|
37
|
+
name=${name}
|
38
|
+
.checked=${value}
|
39
|
+
>
|
36
40
|
</ox-input-search>
|
37
41
|
`
|
38
42
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import '../src/ox-input-unit.js'
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { html, TemplateResult } from 'lit'
|
4
4
|
|
5
5
|
export default {
|
6
6
|
title: 'ox-input-unit',
|
@@ -35,6 +35,7 @@ const Template: Story<ArgTypes> = ({
|
|
35
35
|
stdUnit = 'kg',
|
36
36
|
userUnit
|
37
37
|
}: ArgTypes) => html`
|
38
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
38
39
|
<ox-input-unit
|
39
40
|
name=${name}
|
40
41
|
placeholder=${placeholder}
|
@@ -26,6 +26,7 @@ interface ArgTypes {
|
|
26
26
|
}
|
27
27
|
|
28
28
|
const Template: Story<ArgTypes> = ({ placeholder = 'Checkbox', name = 'hello', value = '', slot }: ArgTypes) => html`
|
29
|
+
<link href="/themes/app-theme.css" rel="stylesheet" />
|
29
30
|
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
|
30
31
|
|
31
32
|
<ox-select
|