@vaadin/time-picker 23.2.0-dev.8a7678b70 → 23.3.0-alpha1
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/README.md +4 -4
- package/package.json +16 -10
- package/src/vaadin-time-picker-combo-box.js +0 -1
- package/src/vaadin-time-picker-item.js +1 -1
- package/src/vaadin-time-picker.d.ts +38 -14
- package/src/vaadin-time-picker.js +72 -13
- package/web-types.json +540 -0
- package/web-types.lit.json +230 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component that allows to enter a time, either by typing, or by selecting from a set of pre-defined options.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/time-picker)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/time-picker)
|
|
8
8
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -11,7 +11,7 @@ A web component that allows to enter a time, either by typing, or by selecting f
|
|
|
11
11
|
<vaadin-time-picker label="Delivery Time"></vaadin-time-picker>
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/time-picker/screenshot.png" width="215" alt="Screenshot of vaadin-time-picker">](https://vaadin.com/docs/latest/
|
|
14
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/time-picker/screenshot.png" width="215" alt="Screenshot of vaadin-time-picker">](https://vaadin.com/docs/latest/components/time-picker)
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ import '@vaadin/time-picker';
|
|
|
29
29
|
|
|
30
30
|
## Themes
|
|
31
31
|
|
|
32
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
32
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
33
33
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/time-picker/vaadin-time-picker.js) of the package uses the Lumo theme.
|
|
34
34
|
|
|
35
35
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -52,7 +52,7 @@ import '@vaadin/time-picker/src/vaadin-time-picker.js';
|
|
|
52
52
|
|
|
53
53
|
## Contributing
|
|
54
54
|
|
|
55
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
55
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
56
56
|
|
|
57
57
|
## License
|
|
58
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/time-picker",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"theme",
|
|
25
25
|
"vaadin-*.d.ts",
|
|
26
|
-
"vaadin-*.js"
|
|
26
|
+
"vaadin-*.js",
|
|
27
|
+
"web-types.json",
|
|
28
|
+
"web-types.lit.json"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"Vaadin",
|
|
@@ -34,18 +36,22 @@
|
|
|
34
36
|
],
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/combo-box": "23.
|
|
38
|
-
"@vaadin/component-base": "23.
|
|
39
|
-
"@vaadin/field-base": "23.
|
|
40
|
-
"@vaadin/input-container": "23.
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "23.
|
|
39
|
+
"@vaadin/combo-box": "23.3.0-alpha1",
|
|
40
|
+
"@vaadin/component-base": "23.3.0-alpha1",
|
|
41
|
+
"@vaadin/field-base": "23.3.0-alpha1",
|
|
42
|
+
"@vaadin/input-container": "23.3.0-alpha1",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha1",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha1"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
47
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
48
50
|
"sinon": "^13.0.2"
|
|
49
51
|
},
|
|
50
|
-
"
|
|
52
|
+
"web-types": [
|
|
53
|
+
"web-types.json",
|
|
54
|
+
"web-types.lit.json"
|
|
55
|
+
],
|
|
56
|
+
"gitHead": "beabc527d4b1274eb798ff701d406fed45cfe638"
|
|
51
57
|
}
|
|
@@ -35,7 +35,6 @@ class TimePickerComboBox extends ComboBoxMixin(ThemableMixin(PolymerElement)) {
|
|
|
35
35
|
|
|
36
36
|
<vaadin-time-picker-overlay
|
|
37
37
|
id="overlay"
|
|
38
|
-
hidden$="[[_isOverlayHidden(filteredItems, loading)]]"
|
|
39
38
|
opened="[[_overlayOpened]]"
|
|
40
39
|
loading$="[[loading]]"
|
|
41
40
|
theme$="[[_theme]]"
|
|
@@ -23,7 +23,7 @@ import { ComboBoxItem } from '@vaadin/combo-box/src/vaadin-combo-box-item.js';
|
|
|
23
23
|
* `selected` | Set when the item is selected | :host
|
|
24
24
|
* `focused` | Set when the item is focused | :host
|
|
25
25
|
*
|
|
26
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
26
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
27
27
|
*
|
|
28
28
|
* @extends ComboBoxItem
|
|
29
29
|
* @private
|
|
@@ -9,15 +9,13 @@ import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
|
9
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
10
|
|
|
11
11
|
export interface TimePickerTime {
|
|
12
|
-
hours:
|
|
13
|
-
minutes:
|
|
14
|
-
seconds?:
|
|
15
|
-
milliseconds?:
|
|
12
|
+
hours: number | string;
|
|
13
|
+
minutes: number | string;
|
|
14
|
+
seconds?: number | string;
|
|
15
|
+
milliseconds?: number | string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface TimePickerI18n {
|
|
19
|
-
clear: string;
|
|
20
|
-
selector: string;
|
|
21
19
|
parseTime(time: string): TimePickerTime | undefined;
|
|
22
20
|
formatTime(time: TimePickerTime | undefined): string;
|
|
23
21
|
}
|
|
@@ -34,15 +32,29 @@ export type TimePickerChangeEvent = Event & {
|
|
|
34
32
|
*/
|
|
35
33
|
export type TimePickerInvalidChangedEvent = CustomEvent<{ value: boolean }>;
|
|
36
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Fired when the `opened` property changes.
|
|
37
|
+
*/
|
|
38
|
+
export type TimePickerOpenedChangedEvent = CustomEvent<{ value: boolean }>;
|
|
39
|
+
|
|
37
40
|
/**
|
|
38
41
|
* Fired when the `value` property changes.
|
|
39
42
|
*/
|
|
40
43
|
export type TimePickerValueChangedEvent = CustomEvent<{ value: string }>;
|
|
41
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Fired whenever the field is validated.
|
|
47
|
+
*/
|
|
48
|
+
export type TimePickerValidatedEvent = CustomEvent<{ valid: boolean }>;
|
|
49
|
+
|
|
42
50
|
export interface TimePickerCustomEventMap {
|
|
43
51
|
'invalid-changed': TimePickerInvalidChangedEvent;
|
|
44
52
|
|
|
53
|
+
'opened-changed': TimePickerOpenedChangedEvent;
|
|
54
|
+
|
|
45
55
|
'value-changed': TimePickerValueChangedEvent;
|
|
56
|
+
|
|
57
|
+
validated: TimePickerValidatedEvent;
|
|
46
58
|
}
|
|
47
59
|
|
|
48
60
|
export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCustomEventMap {
|
|
@@ -79,6 +91,12 @@ export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCusto
|
|
|
79
91
|
* ----------------|----------------
|
|
80
92
|
* `toggle-button` | The toggle button
|
|
81
93
|
*
|
|
94
|
+
* In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
|
|
95
|
+
*
|
|
96
|
+
* Attribute | Description
|
|
97
|
+
* ----------|------------------------------------------
|
|
98
|
+
* `opened` | Set when the time-picker dropdown is open
|
|
99
|
+
*
|
|
82
100
|
* ### Internal components
|
|
83
101
|
*
|
|
84
102
|
* In addition to `<vaadin-time-picker>` itself, the following internal
|
|
@@ -92,11 +110,13 @@ export interface TimePickerEventMap extends HTMLElementEventMap, TimePickerCusto
|
|
|
92
110
|
* Note: the `theme` attribute value set on `<vaadin-time-picker>` is
|
|
93
111
|
* propagated to the internal components listed above.
|
|
94
112
|
*
|
|
95
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
113
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
96
114
|
*
|
|
97
115
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
98
116
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
117
|
+
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
99
118
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
119
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
100
120
|
*/
|
|
101
121
|
declare class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
|
|
102
122
|
/**
|
|
@@ -109,6 +129,11 @@ declare class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(El
|
|
|
109
129
|
*/
|
|
110
130
|
value: string;
|
|
111
131
|
|
|
132
|
+
/**
|
|
133
|
+
* True if the dropdown is open, false otherwise.
|
|
134
|
+
*/
|
|
135
|
+
opened: boolean;
|
|
136
|
+
|
|
112
137
|
/**
|
|
113
138
|
* Minimum time allowed.
|
|
114
139
|
*
|
|
@@ -185,26 +210,25 @@ declare class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(El
|
|
|
185
210
|
i18n: TimePickerI18n;
|
|
186
211
|
|
|
187
212
|
/**
|
|
188
|
-
*
|
|
213
|
+
* Opens the dropdown list.
|
|
189
214
|
*/
|
|
190
|
-
|
|
215
|
+
open(): void;
|
|
191
216
|
|
|
192
217
|
/**
|
|
193
|
-
*
|
|
194
|
-
* You can override this method for custom validations.
|
|
218
|
+
* Closes the dropdown list.
|
|
195
219
|
*/
|
|
196
|
-
|
|
220
|
+
close(): void;
|
|
197
221
|
|
|
198
222
|
addEventListener<K extends keyof TimePickerEventMap>(
|
|
199
223
|
type: K,
|
|
200
224
|
listener: (this: TimePicker, ev: TimePickerEventMap[K]) => void,
|
|
201
|
-
options?:
|
|
225
|
+
options?: AddEventListenerOptions | boolean,
|
|
202
226
|
): void;
|
|
203
227
|
|
|
204
228
|
removeEventListener<K extends keyof TimePickerEventMap>(
|
|
205
229
|
type: K,
|
|
206
230
|
listener: (this: TimePicker, ev: TimePickerEventMap[K]) => void,
|
|
207
|
-
options?:
|
|
231
|
+
options?: EventListenerOptions | boolean,
|
|
208
232
|
): void;
|
|
209
233
|
}
|
|
210
234
|
|
|
@@ -7,6 +7,7 @@ import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
|
7
7
|
import './vaadin-time-picker-combo-box.js';
|
|
8
8
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
9
9
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
+
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
10
11
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
11
12
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
12
13
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
@@ -14,6 +15,9 @@ import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
|
14
15
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
15
16
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
16
17
|
|
|
18
|
+
const MIN_ALLOWED_TIME = '00:00:00.000';
|
|
19
|
+
const MAX_ALLOWED_TIME = '23:59:59.999';
|
|
20
|
+
|
|
17
21
|
registerStyles('vaadin-time-picker', inputFieldShared, { moduleId: 'vaadin-time-picker-styles' });
|
|
18
22
|
|
|
19
23
|
/**
|
|
@@ -46,6 +50,12 @@ registerStyles('vaadin-time-picker', inputFieldShared, { moduleId: 'vaadin-time-
|
|
|
46
50
|
* ----------------|----------------
|
|
47
51
|
* `toggle-button` | The toggle button
|
|
48
52
|
*
|
|
53
|
+
* In addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:
|
|
54
|
+
*
|
|
55
|
+
* Attribute | Description
|
|
56
|
+
* ----------|------------------------------------------
|
|
57
|
+
* `opened` | Set when the time-picker dropdown is open
|
|
58
|
+
*
|
|
49
59
|
* ### Internal components
|
|
50
60
|
*
|
|
51
61
|
* In addition to `<vaadin-time-picker>` itself, the following internal
|
|
@@ -59,11 +69,13 @@ registerStyles('vaadin-time-picker', inputFieldShared, { moduleId: 'vaadin-time-
|
|
|
59
69
|
* Note: the `theme` attribute value set on `<vaadin-time-picker>` is
|
|
60
70
|
* propagated to the internal components listed above.
|
|
61
71
|
*
|
|
62
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
72
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
63
73
|
*
|
|
64
74
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
65
75
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
76
|
+
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
66
77
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
78
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
67
79
|
*
|
|
68
80
|
* @extends HTMLElement
|
|
69
81
|
* @mixes ElementMixin
|
|
@@ -104,13 +116,14 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
104
116
|
id="comboBox"
|
|
105
117
|
filtered-items="[[__dropdownItems]]"
|
|
106
118
|
value="{{_comboBoxValue}}"
|
|
119
|
+
opened="{{opened}}"
|
|
107
120
|
disabled="[[disabled]]"
|
|
108
121
|
readonly="[[readonly]]"
|
|
109
122
|
clear-button-visible="[[clearButtonVisible]]"
|
|
110
123
|
auto-open-disabled="[[autoOpenDisabled]]"
|
|
111
124
|
position-target="[[_inputContainer]]"
|
|
112
125
|
theme$="[[_theme]]"
|
|
113
|
-
on-change="
|
|
126
|
+
on-change="__onComboBoxChange"
|
|
114
127
|
>
|
|
115
128
|
<vaadin-input-container
|
|
116
129
|
part="input-field"
|
|
@@ -134,6 +147,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
134
147
|
<slot name="error-message"></slot>
|
|
135
148
|
</div>
|
|
136
149
|
</div>
|
|
150
|
+
<slot name="tooltip"></slot>
|
|
137
151
|
`;
|
|
138
152
|
}
|
|
139
153
|
|
|
@@ -154,6 +168,16 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
154
168
|
value: '',
|
|
155
169
|
},
|
|
156
170
|
|
|
171
|
+
/**
|
|
172
|
+
* True if the dropdown is open, false otherwise.
|
|
173
|
+
*/
|
|
174
|
+
opened: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
notify: true,
|
|
177
|
+
value: false,
|
|
178
|
+
reflectToAttribute: true,
|
|
179
|
+
},
|
|
180
|
+
|
|
157
181
|
/**
|
|
158
182
|
* Minimum time allowed.
|
|
159
183
|
*
|
|
@@ -165,7 +189,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
165
189
|
*/
|
|
166
190
|
min: {
|
|
167
191
|
type: String,
|
|
168
|
-
value: '
|
|
192
|
+
value: '',
|
|
169
193
|
},
|
|
170
194
|
|
|
171
195
|
/**
|
|
@@ -179,7 +203,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
179
203
|
*/
|
|
180
204
|
max: {
|
|
181
205
|
type: String,
|
|
182
|
-
value: '
|
|
206
|
+
value: '',
|
|
183
207
|
},
|
|
184
208
|
|
|
185
209
|
/**
|
|
@@ -304,6 +328,10 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
304
328
|
return ['__updateDropdownItems(i18n.*, min, max, step)'];
|
|
305
329
|
}
|
|
306
330
|
|
|
331
|
+
static get constraints() {
|
|
332
|
+
return [...super.constraints, 'min', 'max'];
|
|
333
|
+
}
|
|
334
|
+
|
|
307
335
|
/**
|
|
308
336
|
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
309
337
|
* @protected
|
|
@@ -327,6 +355,10 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
327
355
|
);
|
|
328
356
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
329
357
|
this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
|
|
358
|
+
|
|
359
|
+
this._tooltipController = new TooltipController(this);
|
|
360
|
+
this._tooltipController.setShouldShow((timePicker) => !timePicker.opened);
|
|
361
|
+
this.addController(this._tooltipController);
|
|
330
362
|
}
|
|
331
363
|
|
|
332
364
|
/**
|
|
@@ -342,6 +374,22 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
342
374
|
}
|
|
343
375
|
}
|
|
344
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Opens the dropdown list.
|
|
379
|
+
*/
|
|
380
|
+
open() {
|
|
381
|
+
if (!this.disabled && !this.readonly) {
|
|
382
|
+
this.opened = true;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Closes the dropdown list.
|
|
388
|
+
*/
|
|
389
|
+
close() {
|
|
390
|
+
this.opened = false;
|
|
391
|
+
}
|
|
392
|
+
|
|
345
393
|
/**
|
|
346
394
|
* Returns true if the current input value satisfies all constraints (if any).
|
|
347
395
|
* You can override this method for custom validations.
|
|
@@ -480,10 +528,10 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
480
528
|
|
|
481
529
|
/** @private */
|
|
482
530
|
__updateDropdownItems(i8n, min, max, step) {
|
|
483
|
-
const minTimeObj = this.__validateTime(this.__parseISO(min));
|
|
531
|
+
const minTimeObj = this.__validateTime(this.__parseISO(min || MIN_ALLOWED_TIME));
|
|
484
532
|
const minSec = this.__getSec(minTimeObj);
|
|
485
533
|
|
|
486
|
-
const maxTimeObj = this.__validateTime(this.__parseISO(max));
|
|
534
|
+
const maxTimeObj = this.__validateTime(this.__parseISO(max || MAX_ALLOWED_TIME));
|
|
487
535
|
const maxSec = this.__getSec(maxTimeObj);
|
|
488
536
|
|
|
489
537
|
this.__adjustValue(minSec, maxSec, minTimeObj, maxTimeObj);
|
|
@@ -548,15 +596,21 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
548
596
|
const parsedObj = (this.__memoValue = this.__parseISO(value));
|
|
549
597
|
const newValue = this.__formatISO(parsedObj) || '';
|
|
550
598
|
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
|
|
599
|
+
if (value !== '' && value !== null && !parsedObj) {
|
|
600
|
+
// Value can not be parsed, reset to the old one.
|
|
601
|
+
this.value = oldValue === undefined ? '' : oldValue;
|
|
602
|
+
} else if (value !== newValue) {
|
|
603
|
+
// Value can be parsed (e.g. 12 -> 12:00), adjust.
|
|
554
604
|
this.value = newValue;
|
|
605
|
+
} else if (this.__keepInvalidInput) {
|
|
606
|
+
// User input could not be parsed and was reset
|
|
607
|
+
// to empty string, do not update input value.
|
|
608
|
+
delete this.__keepInvalidInput;
|
|
555
609
|
} else {
|
|
556
610
|
this.__updateInputValue(parsedObj);
|
|
557
611
|
}
|
|
558
612
|
|
|
559
|
-
this._toggleHasValue(
|
|
613
|
+
this._toggleHasValue(this._hasValue);
|
|
560
614
|
}
|
|
561
615
|
|
|
562
616
|
/** @private */
|
|
@@ -575,12 +629,17 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
575
629
|
this.__updateValue(parsedObj);
|
|
576
630
|
}
|
|
577
631
|
} else {
|
|
632
|
+
// If user input can not be parsed, keep it.
|
|
633
|
+
if (value !== '') {
|
|
634
|
+
this.__keepInvalidInput = true;
|
|
635
|
+
}
|
|
636
|
+
|
|
578
637
|
this.value = '';
|
|
579
638
|
}
|
|
580
639
|
}
|
|
581
640
|
|
|
582
641
|
/** @private */
|
|
583
|
-
|
|
642
|
+
__onComboBoxChange(event) {
|
|
584
643
|
event.stopPropagation();
|
|
585
644
|
|
|
586
645
|
this.validate();
|
|
@@ -649,8 +708,8 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
649
708
|
* @protected
|
|
650
709
|
*/
|
|
651
710
|
_timeAllowed(time) {
|
|
652
|
-
const parsedMin = this.i18n.parseTime(this.min);
|
|
653
|
-
const parsedMax = this.i18n.parseTime(this.max);
|
|
711
|
+
const parsedMin = this.i18n.parseTime(this.min || MIN_ALLOWED_TIME);
|
|
712
|
+
const parsedMax = this.i18n.parseTime(this.max || MAX_ALLOWED_TIME);
|
|
654
713
|
|
|
655
714
|
return (
|
|
656
715
|
(!this.__getMsec(parsedMin) || this.__getMsec(time) >= this.__getMsec(parsedMin)) &&
|
package/web-types.json
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/time-picker",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-time-picker",
|
|
11
|
+
"description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "disabled",
|
|
15
|
+
"description": "If true, the user cannot interact with this element.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"boolean",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "autofocus",
|
|
26
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"boolean",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "label",
|
|
37
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "invalid",
|
|
48
|
+
"description": "Set to true when the field is invalid.",
|
|
49
|
+
"value": {
|
|
50
|
+
"type": [
|
|
51
|
+
"boolean",
|
|
52
|
+
"null",
|
|
53
|
+
"undefined"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "required",
|
|
59
|
+
"description": "Specifies that the user must fill in a value.",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"boolean",
|
|
63
|
+
"null",
|
|
64
|
+
"undefined"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "error-message",
|
|
70
|
+
"description": "Error to show when the field is invalid.",
|
|
71
|
+
"value": {
|
|
72
|
+
"type": [
|
|
73
|
+
"string",
|
|
74
|
+
"null",
|
|
75
|
+
"undefined"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "helper-text",
|
|
81
|
+
"description": "String used for the helper text.",
|
|
82
|
+
"value": {
|
|
83
|
+
"type": [
|
|
84
|
+
"string",
|
|
85
|
+
"null",
|
|
86
|
+
"undefined"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "value",
|
|
92
|
+
"description": "The time value for this element.\n\nSupported time formats are in ISO 8601:\n- `hh:mm` (default)\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
93
|
+
"value": {
|
|
94
|
+
"type": [
|
|
95
|
+
"string"
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "allowed-char-pattern",
|
|
101
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
102
|
+
"value": {
|
|
103
|
+
"type": [
|
|
104
|
+
"string",
|
|
105
|
+
"null",
|
|
106
|
+
"undefined"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "autoselect",
|
|
112
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
113
|
+
"value": {
|
|
114
|
+
"type": [
|
|
115
|
+
"boolean",
|
|
116
|
+
"null",
|
|
117
|
+
"undefined"
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "clear-button-visible",
|
|
123
|
+
"description": "Set to true to display the clear icon which clears the input.",
|
|
124
|
+
"value": {
|
|
125
|
+
"type": [
|
|
126
|
+
"boolean",
|
|
127
|
+
"null",
|
|
128
|
+
"undefined"
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "name",
|
|
134
|
+
"description": "The name of this field.",
|
|
135
|
+
"value": {
|
|
136
|
+
"type": [
|
|
137
|
+
"string",
|
|
138
|
+
"null",
|
|
139
|
+
"undefined"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "placeholder",
|
|
145
|
+
"description": "A hint to the user of what can be entered in the field.",
|
|
146
|
+
"value": {
|
|
147
|
+
"type": [
|
|
148
|
+
"string",
|
|
149
|
+
"null",
|
|
150
|
+
"undefined"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "readonly",
|
|
156
|
+
"description": "When present, it specifies that the field is read-only.",
|
|
157
|
+
"value": {
|
|
158
|
+
"type": [
|
|
159
|
+
"boolean",
|
|
160
|
+
"null",
|
|
161
|
+
"undefined"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "title",
|
|
167
|
+
"description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
|
|
168
|
+
"value": {
|
|
169
|
+
"type": [
|
|
170
|
+
"string",
|
|
171
|
+
"null",
|
|
172
|
+
"undefined"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "pattern",
|
|
178
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
179
|
+
"value": {
|
|
180
|
+
"type": [
|
|
181
|
+
"string",
|
|
182
|
+
"null",
|
|
183
|
+
"undefined"
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "prevent-invalid-input",
|
|
189
|
+
"description": "When set to true, user is prevented from typing a value that\nconflicts with the given `pattern`.",
|
|
190
|
+
"value": {
|
|
191
|
+
"type": [
|
|
192
|
+
"boolean",
|
|
193
|
+
"null",
|
|
194
|
+
"undefined"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "opened",
|
|
200
|
+
"description": "True if the dropdown is open, false otherwise.",
|
|
201
|
+
"value": {
|
|
202
|
+
"type": [
|
|
203
|
+
"boolean",
|
|
204
|
+
"null",
|
|
205
|
+
"undefined"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "min",
|
|
211
|
+
"description": "Minimum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
212
|
+
"value": {
|
|
213
|
+
"type": [
|
|
214
|
+
"string"
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "max",
|
|
220
|
+
"description": "Maximum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
221
|
+
"value": {
|
|
222
|
+
"type": [
|
|
223
|
+
"string"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "step",
|
|
229
|
+
"description": "Defines the time interval (in seconds) between the items displayed\nin the time selection box. The default is 1 hour (i.e. `3600`).\n\nIt also configures the precision of the value string. By default\nthe component formats values as `hh:mm` but setting a step value\nlower than one minute or one second, format resolution changes to\n`hh:mm:ss` and `hh:mm:ss.fff` respectively.\n\nUnit must be set in seconds, and for correctly configuring intervals\nin the dropdown, it need to evenly divide a day.\n\nNote: it is possible to define step that is dividing an hour in inexact\nfragments (i.e. 5760 seconds which equals 1 hour 36 minutes), but it is\nnot recommended to use it for better UX experience.",
|
|
230
|
+
"value": {
|
|
231
|
+
"type": [
|
|
232
|
+
"number",
|
|
233
|
+
"null",
|
|
234
|
+
"undefined"
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "auto-open-disabled",
|
|
240
|
+
"description": "Set true to prevent the overlay from opening automatically.",
|
|
241
|
+
"value": {
|
|
242
|
+
"type": [
|
|
243
|
+
"boolean",
|
|
244
|
+
"null",
|
|
245
|
+
"undefined"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "theme",
|
|
251
|
+
"description": "The theme variants to apply to the component.",
|
|
252
|
+
"value": {
|
|
253
|
+
"type": [
|
|
254
|
+
"string",
|
|
255
|
+
"null",
|
|
256
|
+
"undefined"
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"js": {
|
|
262
|
+
"properties": [
|
|
263
|
+
{
|
|
264
|
+
"name": "disabled",
|
|
265
|
+
"description": "If true, the user cannot interact with this element.",
|
|
266
|
+
"value": {
|
|
267
|
+
"type": [
|
|
268
|
+
"boolean",
|
|
269
|
+
"null",
|
|
270
|
+
"undefined"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "autofocus",
|
|
276
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
277
|
+
"value": {
|
|
278
|
+
"type": [
|
|
279
|
+
"boolean",
|
|
280
|
+
"null",
|
|
281
|
+
"undefined"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "label",
|
|
287
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
288
|
+
"value": {
|
|
289
|
+
"type": [
|
|
290
|
+
"string",
|
|
291
|
+
"null",
|
|
292
|
+
"undefined"
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "invalid",
|
|
298
|
+
"description": "Set to true when the field is invalid.",
|
|
299
|
+
"value": {
|
|
300
|
+
"type": [
|
|
301
|
+
"boolean",
|
|
302
|
+
"null",
|
|
303
|
+
"undefined"
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "required",
|
|
309
|
+
"description": "Specifies that the user must fill in a value.",
|
|
310
|
+
"value": {
|
|
311
|
+
"type": [
|
|
312
|
+
"boolean",
|
|
313
|
+
"null",
|
|
314
|
+
"undefined"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"name": "errorMessage",
|
|
320
|
+
"description": "Error to show when the field is invalid.",
|
|
321
|
+
"value": {
|
|
322
|
+
"type": [
|
|
323
|
+
"string",
|
|
324
|
+
"null",
|
|
325
|
+
"undefined"
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "helperText",
|
|
331
|
+
"description": "String used for the helper text.",
|
|
332
|
+
"value": {
|
|
333
|
+
"type": [
|
|
334
|
+
"string",
|
|
335
|
+
"null",
|
|
336
|
+
"undefined"
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "value",
|
|
342
|
+
"description": "The time value for this element.\n\nSupported time formats are in ISO 8601:\n- `hh:mm` (default)\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
343
|
+
"value": {
|
|
344
|
+
"type": [
|
|
345
|
+
"string"
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"name": "allowedCharPattern",
|
|
351
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
352
|
+
"value": {
|
|
353
|
+
"type": [
|
|
354
|
+
"string",
|
|
355
|
+
"null",
|
|
356
|
+
"undefined"
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"name": "autoselect",
|
|
362
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
363
|
+
"value": {
|
|
364
|
+
"type": [
|
|
365
|
+
"boolean",
|
|
366
|
+
"null",
|
|
367
|
+
"undefined"
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"name": "clearButtonVisible",
|
|
373
|
+
"description": "Set to true to display the clear icon which clears the input.",
|
|
374
|
+
"value": {
|
|
375
|
+
"type": [
|
|
376
|
+
"boolean",
|
|
377
|
+
"null",
|
|
378
|
+
"undefined"
|
|
379
|
+
]
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": "name",
|
|
384
|
+
"description": "The name of this field.",
|
|
385
|
+
"value": {
|
|
386
|
+
"type": [
|
|
387
|
+
"string",
|
|
388
|
+
"null",
|
|
389
|
+
"undefined"
|
|
390
|
+
]
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"name": "placeholder",
|
|
395
|
+
"description": "A hint to the user of what can be entered in the field.",
|
|
396
|
+
"value": {
|
|
397
|
+
"type": [
|
|
398
|
+
"string",
|
|
399
|
+
"null",
|
|
400
|
+
"undefined"
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"name": "readonly",
|
|
406
|
+
"description": "When present, it specifies that the field is read-only.",
|
|
407
|
+
"value": {
|
|
408
|
+
"type": [
|
|
409
|
+
"boolean",
|
|
410
|
+
"null",
|
|
411
|
+
"undefined"
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"name": "title",
|
|
417
|
+
"description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
|
|
418
|
+
"value": {
|
|
419
|
+
"type": [
|
|
420
|
+
"string",
|
|
421
|
+
"null",
|
|
422
|
+
"undefined"
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"name": "pattern",
|
|
428
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
429
|
+
"value": {
|
|
430
|
+
"type": [
|
|
431
|
+
"string",
|
|
432
|
+
"null",
|
|
433
|
+
"undefined"
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
"name": "preventInvalidInput",
|
|
439
|
+
"description": "When set to true, user is prevented from typing a value that\nconflicts with the given `pattern`.",
|
|
440
|
+
"value": {
|
|
441
|
+
"type": [
|
|
442
|
+
"boolean",
|
|
443
|
+
"null",
|
|
444
|
+
"undefined"
|
|
445
|
+
]
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"name": "opened",
|
|
450
|
+
"description": "True if the dropdown is open, false otherwise.",
|
|
451
|
+
"value": {
|
|
452
|
+
"type": [
|
|
453
|
+
"boolean",
|
|
454
|
+
"null",
|
|
455
|
+
"undefined"
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"name": "min",
|
|
461
|
+
"description": "Minimum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
462
|
+
"value": {
|
|
463
|
+
"type": [
|
|
464
|
+
"string"
|
|
465
|
+
]
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"name": "max",
|
|
470
|
+
"description": "Maximum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
471
|
+
"value": {
|
|
472
|
+
"type": [
|
|
473
|
+
"string"
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"name": "step",
|
|
479
|
+
"description": "Defines the time interval (in seconds) between the items displayed\nin the time selection box. The default is 1 hour (i.e. `3600`).\n\nIt also configures the precision of the value string. By default\nthe component formats values as `hh:mm` but setting a step value\nlower than one minute or one second, format resolution changes to\n`hh:mm:ss` and `hh:mm:ss.fff` respectively.\n\nUnit must be set in seconds, and for correctly configuring intervals\nin the dropdown, it need to evenly divide a day.\n\nNote: it is possible to define step that is dividing an hour in inexact\nfragments (i.e. 5760 seconds which equals 1 hour 36 minutes), but it is\nnot recommended to use it for better UX experience.",
|
|
480
|
+
"value": {
|
|
481
|
+
"type": [
|
|
482
|
+
"number",
|
|
483
|
+
"null",
|
|
484
|
+
"undefined"
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"name": "autoOpenDisabled",
|
|
490
|
+
"description": "Set true to prevent the overlay from opening automatically.",
|
|
491
|
+
"value": {
|
|
492
|
+
"type": [
|
|
493
|
+
"boolean",
|
|
494
|
+
"null",
|
|
495
|
+
"undefined"
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "i18n",
|
|
501
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure:\n\n```\n{\n // A function to format given `Object` as\n // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`\n formatTime: (time) => {\n // returns a string representation of the given\n // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats\n },\n\n // A function to parse the given text to an `Object` in the format\n // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.\n // Must properly parse (at least) text\n // formatted by `formatTime`.\n parseTime: text => {\n // Parses a string in object/string that can be formatted by`formatTime`.\n }\n}\n```\n\nBoth `formatTime` and `parseTime` need to be implemented\nto ensure the component works properly.",
|
|
502
|
+
"value": {
|
|
503
|
+
"type": [
|
|
504
|
+
"TimePickerI18n"
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"events": [
|
|
510
|
+
{
|
|
511
|
+
"name": "validated",
|
|
512
|
+
"description": "Fired whenever the field is validated."
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"name": "change",
|
|
516
|
+
"description": "Fired when the user commits a value change."
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "input",
|
|
520
|
+
"description": "Fired when the value is changed by the user: on every typing keystroke,\nand the value is cleared using the clear button."
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"name": "value-changed",
|
|
524
|
+
"description": "Fired when the `value` property changes."
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"name": "opened-changed",
|
|
528
|
+
"description": "Fired when the `opened` property changes."
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"name": "invalid-changed",
|
|
532
|
+
"description": "Fired when the `invalid` property changes."
|
|
533
|
+
}
|
|
534
|
+
]
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
]
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/time-picker",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-time-picker",
|
|
19
|
+
"description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/23.3.0-alpha1/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?disabled",
|
|
24
|
+
"description": "If true, the user cannot interact with this element.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "?autofocus",
|
|
31
|
+
"description": "Specify that this control should have input focus when the page loads.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "?invalid",
|
|
38
|
+
"description": "Set to true when the field is invalid.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "?required",
|
|
45
|
+
"description": "Specifies that the user must fill in a value.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "?autoselect",
|
|
52
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "?clearButtonVisible",
|
|
59
|
+
"description": "Set to true to display the clear icon which clears the input.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "?readonly",
|
|
66
|
+
"description": "When present, it specifies that the field is read-only.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "?preventInvalidInput",
|
|
73
|
+
"description": "When set to true, user is prevented from typing a value that\nconflicts with the given `pattern`.",
|
|
74
|
+
"value": {
|
|
75
|
+
"kind": "expression"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "?opened",
|
|
80
|
+
"description": "True if the dropdown is open, false otherwise.",
|
|
81
|
+
"value": {
|
|
82
|
+
"kind": "expression"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "?autoOpenDisabled",
|
|
87
|
+
"description": "Set true to prevent the overlay from opening automatically.",
|
|
88
|
+
"value": {
|
|
89
|
+
"kind": "expression"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": ".label",
|
|
94
|
+
"description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
|
|
95
|
+
"value": {
|
|
96
|
+
"kind": "expression"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": ".errorMessage",
|
|
101
|
+
"description": "Error to show when the field is invalid.",
|
|
102
|
+
"value": {
|
|
103
|
+
"kind": "expression"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": ".helperText",
|
|
108
|
+
"description": "String used for the helper text.",
|
|
109
|
+
"value": {
|
|
110
|
+
"kind": "expression"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": ".value",
|
|
115
|
+
"description": "The time value for this element.\n\nSupported time formats are in ISO 8601:\n- `hh:mm` (default)\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
116
|
+
"value": {
|
|
117
|
+
"kind": "expression"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": ".allowedCharPattern",
|
|
122
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
123
|
+
"value": {
|
|
124
|
+
"kind": "expression"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": ".name",
|
|
129
|
+
"description": "The name of this field.",
|
|
130
|
+
"value": {
|
|
131
|
+
"kind": "expression"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": ".placeholder",
|
|
136
|
+
"description": "A hint to the user of what can be entered in the field.",
|
|
137
|
+
"value": {
|
|
138
|
+
"kind": "expression"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": ".title",
|
|
143
|
+
"description": "The text usually displayed in a tooltip popup when the mouse is over the field.",
|
|
144
|
+
"value": {
|
|
145
|
+
"kind": "expression"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": ".pattern",
|
|
150
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
151
|
+
"value": {
|
|
152
|
+
"kind": "expression"
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": ".min",
|
|
157
|
+
"description": "Minimum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
158
|
+
"value": {
|
|
159
|
+
"kind": "expression"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": ".max",
|
|
164
|
+
"description": "Maximum time allowed.\n\nSupported time formats are in ISO 8601:\n- `hh:mm`\n- `hh:mm:ss`\n- `hh:mm:ss.fff`",
|
|
165
|
+
"value": {
|
|
166
|
+
"kind": "expression"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": ".step",
|
|
171
|
+
"description": "Defines the time interval (in seconds) between the items displayed\nin the time selection box. The default is 1 hour (i.e. `3600`).\n\nIt also configures the precision of the value string. By default\nthe component formats values as `hh:mm` but setting a step value\nlower than one minute or one second, format resolution changes to\n`hh:mm:ss` and `hh:mm:ss.fff` respectively.\n\nUnit must be set in seconds, and for correctly configuring intervals\nin the dropdown, it need to evenly divide a day.\n\nNote: it is possible to define step that is dividing an hour in inexact\nfragments (i.e. 5760 seconds which equals 1 hour 36 minutes), but it is\nnot recommended to use it for better UX experience.",
|
|
172
|
+
"value": {
|
|
173
|
+
"kind": "expression"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": ".i18n",
|
|
178
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure:\n\n```\n{\n // A function to format given `Object` as\n // time string. Object is in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`\n formatTime: (time) => {\n // returns a string representation of the given\n // object in `hh` / 'hh:mm' / 'hh:mm:ss' / 'hh:mm:ss.fff' - formats\n },\n\n // A function to parse the given text to an `Object` in the format\n // `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`.\n // Must properly parse (at least) text\n // formatted by `formatTime`.\n parseTime: text => {\n // Parses a string in object/string that can be formatted by`formatTime`.\n }\n}\n```\n\nBoth `formatTime` and `parseTime` need to be implemented\nto ensure the component works properly.",
|
|
179
|
+
"value": {
|
|
180
|
+
"kind": "expression"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "@validated",
|
|
185
|
+
"description": "Fired whenever the field is validated.",
|
|
186
|
+
"value": {
|
|
187
|
+
"kind": "expression"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "@change",
|
|
192
|
+
"description": "Fired when the user commits a value change.",
|
|
193
|
+
"value": {
|
|
194
|
+
"kind": "expression"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "@input",
|
|
199
|
+
"description": "Fired when the value is changed by the user: on every typing keystroke,\nand the value is cleared using the clear button.",
|
|
200
|
+
"value": {
|
|
201
|
+
"kind": "expression"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "@value-changed",
|
|
206
|
+
"description": "Fired when the `value` property changes.",
|
|
207
|
+
"value": {
|
|
208
|
+
"kind": "expression"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "@opened-changed",
|
|
213
|
+
"description": "Fired when the `opened` property changes.",
|
|
214
|
+
"value": {
|
|
215
|
+
"kind": "expression"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "@invalid-changed",
|
|
220
|
+
"description": "Fired when the `invalid` property changes.",
|
|
221
|
+
"value": {
|
|
222
|
+
"kind": "expression"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|