@vaadin/time-picker 25.1.11 → 25.1.13
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/package.json +14 -14
- package/src/vaadin-time-picker-mixin.js +32 -20
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/time-picker",
|
|
3
|
-
"version": "25.1.
|
|
3
|
+
"version": "25.1.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "~25.1.
|
|
39
|
-
"@vaadin/combo-box": "~25.1.
|
|
40
|
-
"@vaadin/component-base": "~25.1.
|
|
41
|
-
"@vaadin/field-base": "~25.1.
|
|
42
|
-
"@vaadin/input-container": "~25.1.
|
|
43
|
-
"@vaadin/item": "~25.1.
|
|
44
|
-
"@vaadin/overlay": "~25.1.
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "~25.1.
|
|
38
|
+
"@vaadin/a11y-base": "~25.1.13",
|
|
39
|
+
"@vaadin/combo-box": "~25.1.13",
|
|
40
|
+
"@vaadin/component-base": "~25.1.13",
|
|
41
|
+
"@vaadin/field-base": "~25.1.13",
|
|
42
|
+
"@vaadin/input-container": "~25.1.13",
|
|
43
|
+
"@vaadin/item": "~25.1.13",
|
|
44
|
+
"@vaadin/overlay": "~25.1.13",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "~25.1.13",
|
|
46
46
|
"lit": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vaadin/aura": "~25.1.
|
|
50
|
-
"@vaadin/chai-plugins": "~25.1.
|
|
51
|
-
"@vaadin/test-runner-commands": "~25.1.
|
|
49
|
+
"@vaadin/aura": "~25.1.13",
|
|
50
|
+
"@vaadin/chai-plugins": "~25.1.13",
|
|
51
|
+
"@vaadin/test-runner-commands": "~25.1.13",
|
|
52
52
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
53
|
-
"@vaadin/vaadin-lumo-styles": "~25.1.
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "~25.1.13",
|
|
54
54
|
"sinon": "^21.0.2"
|
|
55
55
|
},
|
|
56
56
|
"customElements": "custom-elements.json",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"web-types.json",
|
|
59
59
|
"web-types.lit.json"
|
|
60
60
|
],
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "096f6a289e018a246f3bfb0162d52fd1c2fd6bce"
|
|
62
62
|
}
|
|
@@ -119,7 +119,6 @@ export const TimePickerMixin = (superClass) =>
|
|
|
119
119
|
'_openedOrItemsChanged(opened, _dropdownItems)',
|
|
120
120
|
'_updateScroller(opened, _dropdownItems, _focusedIndex, _theme, _comboBoxValue)',
|
|
121
121
|
'__updateAriaAttributes(_dropdownItems, opened, inputElement)',
|
|
122
|
-
'__updateDropdownItems(__effectiveI18n, min, max, step)',
|
|
123
122
|
];
|
|
124
123
|
}
|
|
125
124
|
|
|
@@ -235,6 +234,23 @@ export const TimePickerMixin = (superClass) =>
|
|
|
235
234
|
this.addController(this._tooltipController);
|
|
236
235
|
}
|
|
237
236
|
|
|
237
|
+
/** @protected */
|
|
238
|
+
updated(props) {
|
|
239
|
+
super.updated(props);
|
|
240
|
+
|
|
241
|
+
if (['__effectiveI18n', 'min', 'max', 'step'].some((prop) => props.has(prop))) {
|
|
242
|
+
this.__updateDropdownItems();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (props.has('step')) {
|
|
246
|
+
this.__updateValue(this.__getTimeObject(this.value));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (props.has('__effectiveI18n') && this.value) {
|
|
250
|
+
this.__updateInputValue(this.__getTimeObject(this.value));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
238
254
|
/**
|
|
239
255
|
* Returns true if the current input value satisfies all constraints (if any).
|
|
240
256
|
* You can override this method for custom validations.
|
|
@@ -462,6 +478,15 @@ export const TimePickerMixin = (superClass) =>
|
|
|
462
478
|
return result;
|
|
463
479
|
}
|
|
464
480
|
|
|
481
|
+
/**
|
|
482
|
+
* Returning Object in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`
|
|
483
|
+
* from an ISO 8601 time, stripped to the resolution defined by the step.
|
|
484
|
+
* @private
|
|
485
|
+
*/
|
|
486
|
+
__getTimeObject(timeString) {
|
|
487
|
+
return validateTime(parseISOTime(timeString), this.step);
|
|
488
|
+
}
|
|
489
|
+
|
|
465
490
|
/**
|
|
466
491
|
* Returning seconds from Object in the format `{ hours: ..., minutes: ..., seconds: ..., milliseconds: ... }`
|
|
467
492
|
* @private
|
|
@@ -508,25 +533,11 @@ export const TimePickerMixin = (superClass) =>
|
|
|
508
533
|
}
|
|
509
534
|
|
|
510
535
|
/** @private */
|
|
511
|
-
__updateDropdownItems(
|
|
512
|
-
const
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
const maxTimeObj = validateTime(parseISOTime(max || MAX_ALLOWED_TIME), step);
|
|
516
|
-
const maxSec = this.__getSec(maxTimeObj);
|
|
536
|
+
__updateDropdownItems() {
|
|
537
|
+
const minSec = this.__getSec(this.__getTimeObject(this.min || MIN_ALLOWED_TIME));
|
|
538
|
+
const maxSec = this.__getSec(this.__getTimeObject(this.max || MAX_ALLOWED_TIME));
|
|
517
539
|
|
|
518
|
-
this._dropdownItems = this.__generateDropdownList(minSec, maxSec, step);
|
|
519
|
-
|
|
520
|
-
const parsedValue = validateTime(parseISOTime(this.value), step);
|
|
521
|
-
|
|
522
|
-
if (step !== this.__oldStep) {
|
|
523
|
-
this.__oldStep = step;
|
|
524
|
-
this.__updateValue(parsedValue);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
if (this.value) {
|
|
528
|
-
this._comboBoxValue = effectiveI18n.formatTime(parsedValue);
|
|
529
|
-
}
|
|
540
|
+
this._dropdownItems = this.__generateDropdownList(minSec, maxSec, this.step);
|
|
530
541
|
}
|
|
531
542
|
|
|
532
543
|
/** @private */
|
|
@@ -574,7 +585,8 @@ export const TimePickerMixin = (superClass) =>
|
|
|
574
585
|
* @override
|
|
575
586
|
*/
|
|
576
587
|
_valueChanged(value, oldValue) {
|
|
577
|
-
|
|
588
|
+
// Strip value to the step resolution before marking as committed.
|
|
589
|
+
const parsedObj = (this.__memoValue = this.__getTimeObject(value));
|
|
578
590
|
const newValue = formatISOTime(parsedObj) || '';
|
|
579
591
|
|
|
580
592
|
// Mark value set programmatically by the user
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/time-picker",
|
|
4
|
-
"version": "25.1.
|
|
4
|
+
"version": "25.1.13",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
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-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.1.
|
|
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-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.1.13/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "accessible-name",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/time-picker",
|
|
4
|
-
"version": "25.1.
|
|
4
|
+
"version": "25.1.13",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
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-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.1.
|
|
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-time-picker-overlay-width` | Width of the overlay | `auto`\n`--vaadin-time-picker-overlay-max-height`| Max height of the overlay | `65vh`\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and buttons\n`field-button` | Set on both clear and toggle buttons\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`toggle-button` | The toggle button\n`overlay` | The overlay container\n`content` | The overlay content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`opened` | Set when the overlay is opened\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/25.1.13/#/elements/vaadin-item).\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|