@vaadin/date-picker 24.8.0-alpha8 → 25.0.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 +0 -23
- package/package.json +12 -14
- package/src/vaadin-date-picker-mixin.js +1 -14
- package/src/vaadin-date-picker-overlay-content-mixin.js +4 -6
- package/src/vaadin-date-picker-overlay-content.js +22 -21
- package/src/vaadin-date-picker-overlay.js +11 -9
- package/src/vaadin-date-picker-year.js +15 -10
- package/src/vaadin-date-picker.d.ts +0 -3
- package/src/vaadin-date-picker.js +53 -41
- package/src/vaadin-infinite-scroller.js +0 -13
- package/src/vaadin-month-calendar.js +67 -46
- package/web-types.json +2 -369
- package/web-types.lit.json +2 -156
- package/src/vaadin-date-picker-light.d.ts +0 -112
- package/src/vaadin-date-picker-light.js +0 -133
- package/src/vaadin-lit-date-picker-overlay-content.js +0 -70
- package/src/vaadin-lit-date-picker-overlay.js +0 -46
- package/src/vaadin-lit-date-picker-year.js +0 -41
- package/src/vaadin-lit-date-picker.js +0 -172
- package/src/vaadin-lit-month-calendar.js +0 -98
- package/theme/lumo/vaadin-date-picker-light.d.ts +0 -4
- package/theme/lumo/vaadin-date-picker-light.js +0 -4
- package/theme/lumo/vaadin-lit-date-picker.d.ts +0 -5
- package/theme/lumo/vaadin-lit-date-picker.js +0 -5
- package/theme/material/vaadin-date-picker-light.d.ts +0 -4
- package/theme/material/vaadin-date-picker-light.js +0 -4
- package/theme/material/vaadin-date-picker-overlay-content-styles.d.ts +0 -6
- package/theme/material/vaadin-date-picker-overlay-content-styles.js +0 -132
- package/theme/material/vaadin-date-picker-overlay-styles.d.ts +0 -1
- package/theme/material/vaadin-date-picker-overlay-styles.js +0 -47
- package/theme/material/vaadin-date-picker-styles.d.ts +0 -3
- package/theme/material/vaadin-date-picker-styles.js +0 -22
- package/theme/material/vaadin-date-picker-year-styles.d.ts +0 -1
- package/theme/material/vaadin-date-picker-year-styles.js +0 -28
- package/theme/material/vaadin-date-picker.d.ts +0 -5
- package/theme/material/vaadin-date-picker.js +0 -5
- package/theme/material/vaadin-lit-date-picker.d.ts +0 -5
- package/theme/material/vaadin-lit-date-picker.js +0 -5
- package/theme/material/vaadin-month-calendar-styles.d.ts +0 -2
- package/theme/material/vaadin-month-calendar-styles.js +0 -120
- package/vaadin-date-picker-light.d.ts +0 -1
- package/vaadin-date-picker-light.js +0 -2
- package/vaadin-lit-date-picker.d.ts +0 -1
- package/vaadin-lit-date-picker.js +0 -2
package/README.md
CHANGED
|
@@ -26,29 +26,6 @@ Once installed, import the component in your application:
|
|
|
26
26
|
import '@vaadin/date-picker';
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
## Themes
|
|
30
|
-
|
|
31
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
32
|
-
The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/date-picker/vaadin-date-picker.js) of the package uses the Lumo theme.
|
|
33
|
-
|
|
34
|
-
To use the Material theme, import the component from the `theme/material` folder:
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
import '@vaadin/date-picker/theme/material/vaadin-date-picker.js';
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
You can also import the Lumo version of the component explicitly:
|
|
41
|
-
|
|
42
|
-
```js
|
|
43
|
-
import '@vaadin/date-picker/theme/lumo/vaadin-date-picker.js';
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
import '@vaadin/date-picker/src/vaadin-date-picker.js';
|
|
50
|
-
```
|
|
51
|
-
|
|
52
29
|
## Contributing
|
|
53
30
|
|
|
54
31
|
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,21 +35,19 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@
|
|
39
|
-
"@vaadin/
|
|
40
|
-
"@vaadin/
|
|
41
|
-
"@vaadin/
|
|
42
|
-
"@vaadin/
|
|
43
|
-
"@vaadin/
|
|
44
|
-
"@vaadin/
|
|
45
|
-
"@vaadin/vaadin-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "24.8.0-alpha8",
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha1",
|
|
39
|
+
"@vaadin/button": "25.0.0-alpha1",
|
|
40
|
+
"@vaadin/component-base": "25.0.0-alpha1",
|
|
41
|
+
"@vaadin/field-base": "25.0.0-alpha1",
|
|
42
|
+
"@vaadin/input-container": "25.0.0-alpha1",
|
|
43
|
+
"@vaadin/overlay": "25.0.0-alpha1",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
48
46
|
"lit": "^3.0.0"
|
|
49
47
|
},
|
|
50
48
|
"devDependencies": {
|
|
51
|
-
"@vaadin/chai-plugins": "
|
|
52
|
-
"@vaadin/test-runner-commands": "
|
|
49
|
+
"@vaadin/chai-plugins": "25.0.0-alpha1",
|
|
50
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha1",
|
|
53
51
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
54
52
|
"sinon": "^18.0.0"
|
|
55
53
|
},
|
|
@@ -57,5 +55,5 @@
|
|
|
57
55
|
"web-types.json",
|
|
58
56
|
"web-types.lit.json"
|
|
59
57
|
],
|
|
60
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
|
|
61
59
|
}
|
|
@@ -8,7 +8,6 @@ import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.j
|
|
|
8
8
|
import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
9
9
|
import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
|
|
10
10
|
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
11
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
12
11
|
import { I18nMixin } from '@vaadin/component-base/src/i18n-mixin.js';
|
|
13
12
|
import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
|
|
14
13
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
@@ -82,7 +81,6 @@ export const datePickerI18nDefaults = Object.freeze({
|
|
|
82
81
|
|
|
83
82
|
/**
|
|
84
83
|
* @polymerMixin
|
|
85
|
-
* @mixes ControllerMixin
|
|
86
84
|
* @mixes DelegateFocusMixin
|
|
87
85
|
* @mixes I18nMixin
|
|
88
86
|
* @mixes InputConstraintsMixin
|
|
@@ -93,7 +91,7 @@ export const datePickerI18nDefaults = Object.freeze({
|
|
|
93
91
|
export const DatePickerMixin = (subclass) =>
|
|
94
92
|
class DatePickerMixinClass extends I18nMixin(
|
|
95
93
|
datePickerI18nDefaults,
|
|
96
|
-
OverlayClassMixin(
|
|
94
|
+
OverlayClassMixin(DelegateFocusMixin(InputConstraintsMixin(KeyboardMixin(subclass)))),
|
|
97
95
|
) {
|
|
98
96
|
static get properties() {
|
|
99
97
|
return {
|
|
@@ -397,17 +395,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
397
395
|
this.__setEnteredDate(parsedDate);
|
|
398
396
|
}
|
|
399
397
|
|
|
400
|
-
/**
|
|
401
|
-
* Override a getter from `InputControlMixin` to make it optional
|
|
402
|
-
* and to prevent warning when a clear button is missing,
|
|
403
|
-
* for example when using <vaadin-date-picker-light>.
|
|
404
|
-
* @protected
|
|
405
|
-
* @return {Element | null | undefined}
|
|
406
|
-
*/
|
|
407
|
-
get clearElement() {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
398
|
/** @private */
|
|
412
399
|
get _nativeInput() {
|
|
413
400
|
if (this.inputElement) {
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { flush } from '@polymer/polymer/lib/utils/flush.js';
|
|
7
|
-
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
8
6
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
9
7
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
10
8
|
import { addListener, setTouchAction } from '@vaadin/component-base/src/gestures.js';
|
|
@@ -936,10 +934,10 @@ export const DatePickerOverlayContentMixin = (superClass) =>
|
|
|
936
934
|
// Wait for `vaadin-month-calendar` elements to be rendered
|
|
937
935
|
if (!this.calendars.length) {
|
|
938
936
|
await new Promise((resolve) => {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
937
|
+
requestAnimationFrame(() => {
|
|
938
|
+
setTimeout(() => {
|
|
939
|
+
resolve();
|
|
940
|
+
});
|
|
943
941
|
});
|
|
944
942
|
});
|
|
945
943
|
}
|
|
@@ -8,35 +8,40 @@ import './vaadin-date-picker-month-scroller.js';
|
|
|
8
8
|
import './vaadin-date-picker-year-scroller.js';
|
|
9
9
|
import './vaadin-date-picker-year.js';
|
|
10
10
|
import './vaadin-month-calendar.js';
|
|
11
|
-
import { html,
|
|
12
|
-
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
|
|
11
|
+
import { html, LitElement } from 'lit';
|
|
13
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
14
13
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
15
|
-
import {
|
|
14
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
15
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
16
16
|
import { DatePickerOverlayContentMixin } from './vaadin-date-picker-overlay-content-mixin.js';
|
|
17
17
|
import { overlayContentStyles } from './vaadin-date-picker-overlay-content-styles.js';
|
|
18
18
|
|
|
19
|
-
registerStyles('vaadin-date-picker-overlay-content', overlayContentStyles, {
|
|
20
|
-
moduleId: 'vaadin-date-picker-overlay-content-styles',
|
|
21
|
-
});
|
|
22
|
-
|
|
23
19
|
/**
|
|
24
20
|
* @customElement
|
|
25
21
|
* @extends HTMLElement
|
|
26
22
|
* @private
|
|
27
23
|
*/
|
|
28
24
|
class DatePickerOverlayContent extends DatePickerOverlayContentMixin(
|
|
29
|
-
|
|
25
|
+
ThemableMixin(DirMixin(PolylitMixin(LitElement))),
|
|
30
26
|
) {
|
|
31
|
-
static get
|
|
27
|
+
static get is() {
|
|
28
|
+
return 'vaadin-date-picker-overlay-content';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static get styles() {
|
|
32
|
+
return overlayContentStyles;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @protected */
|
|
36
|
+
render() {
|
|
32
37
|
return html`
|
|
33
|
-
<div part="overlay-header"
|
|
34
|
-
<div part="label"
|
|
35
|
-
<div part="clear-button" hidden
|
|
38
|
+
<div part="overlay-header" @touchend="${this._preventDefault}" aria-hidden="true">
|
|
39
|
+
<div part="label">${this._formatDisplayed(this.selectedDate, this.i18n, this.label)}</div>
|
|
40
|
+
<div part="clear-button" ?hidden="${!this.selectedDate}"></div>
|
|
36
41
|
<div part="toggle-button"></div>
|
|
37
42
|
|
|
38
|
-
<div part="years-toggle-button" hidden
|
|
39
|
-
|
|
43
|
+
<div part="years-toggle-button" ?hidden="${this._desktopMode}" aria-hidden="true">
|
|
44
|
+
${this._yearAfterXMonths(this._visibleMonthIndex)}
|
|
40
45
|
</div>
|
|
41
46
|
</div>
|
|
42
47
|
|
|
@@ -45,20 +50,16 @@ class DatePickerOverlayContent extends DatePickerOverlayContentMixin(
|
|
|
45
50
|
<slot name="years"></slot>
|
|
46
51
|
</div>
|
|
47
52
|
|
|
48
|
-
<div
|
|
53
|
+
<div @touchend="${this._preventDefault}" role="toolbar" part="toolbar">
|
|
49
54
|
<slot name="today-button"></slot>
|
|
50
55
|
<slot name="cancel-button"></slot>
|
|
51
56
|
</div>
|
|
52
57
|
`;
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
static get is() {
|
|
56
|
-
return 'vaadin-date-picker-overlay-content';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
60
|
/** @protected */
|
|
60
|
-
|
|
61
|
-
super.
|
|
61
|
+
firstUpdated() {
|
|
62
|
+
super.firstUpdated();
|
|
62
63
|
|
|
63
64
|
this.setAttribute('role', 'dialog');
|
|
64
65
|
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
8
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
10
|
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
10
|
-
import {
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { DatePickerOverlayMixin } from './vaadin-date-picker-overlay-mixin.js';
|
|
12
13
|
import { datePickerOverlayStyles } from './vaadin-date-picker-overlay-styles.js';
|
|
13
14
|
|
|
14
|
-
registerStyles('vaadin-date-picker-overlay', [overlayStyles, datePickerOverlayStyles], {
|
|
15
|
-
moduleId: 'vaadin-date-picker-overlay-styles',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
15
|
/**
|
|
19
16
|
* An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
|
|
20
17
|
*
|
|
@@ -25,14 +22,19 @@ registerStyles('vaadin-date-picker-overlay', [overlayStyles, datePickerOverlaySt
|
|
|
25
22
|
* @mixes ThemableMixin
|
|
26
23
|
* @private
|
|
27
24
|
*/
|
|
28
|
-
class DatePickerOverlay extends DatePickerOverlayMixin(DirMixin(ThemableMixin(
|
|
25
|
+
class DatePickerOverlay extends DatePickerOverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
29
26
|
static get is() {
|
|
30
27
|
return 'vaadin-date-picker-overlay';
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
static get
|
|
30
|
+
static get styles() {
|
|
31
|
+
return [overlayStyles, datePickerOverlayStyles];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** @protected */
|
|
35
|
+
render() {
|
|
34
36
|
return html`
|
|
35
|
-
<div id="backdrop" part="backdrop" hidden
|
|
37
|
+
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
36
38
|
<div part="overlay" id="overlay">
|
|
37
39
|
<div part="content" id="content">
|
|
38
40
|
<slot></slot>
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { css, html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
8
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
import { DatePickerYearMixin } from './vaadin-date-picker-year-mixin.js';
|
|
10
11
|
|
|
@@ -17,20 +18,24 @@ import { DatePickerYearMixin } from './vaadin-date-picker-year-mixin.js';
|
|
|
17
18
|
* @mixes DatePickerYearMixin
|
|
18
19
|
* @private
|
|
19
20
|
*/
|
|
20
|
-
export class DatePickerYear extends ThemableMixin(DatePickerYearMixin(
|
|
21
|
+
export class DatePickerYear extends ThemableMixin(DatePickerYearMixin(PolylitMixin(LitElement))) {
|
|
21
22
|
static get is() {
|
|
22
23
|
return 'vaadin-date-picker-year';
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
static get
|
|
26
|
+
static get styles() {
|
|
27
|
+
return css`
|
|
28
|
+
:host {
|
|
29
|
+
display: block;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @protected */
|
|
36
|
+
render() {
|
|
26
37
|
return html`
|
|
27
|
-
<
|
|
28
|
-
:host {
|
|
29
|
-
display: block;
|
|
30
|
-
height: 100%;
|
|
31
|
-
}
|
|
32
|
-
</style>
|
|
33
|
-
<div part="year-number">[[year]]</div>
|
|
38
|
+
<div part="year-number">${this.year}</div>
|
|
34
39
|
<div part="year-separator" aria-hidden="true"></div>
|
|
35
40
|
`;
|
|
36
41
|
}
|
|
@@ -93,9 +93,6 @@ export interface DatePickerEventMap extends HTMLElementEventMap, DatePickerCusto
|
|
|
93
93
|
* -----------|--------------------------------------------------|-----------
|
|
94
94
|
* `opened` | Set when the date selector overlay is opened | :host
|
|
95
95
|
*
|
|
96
|
-
* If you want to replace the default `<input>` and its container with a custom implementation to get full control
|
|
97
|
-
* over the input field, consider using the [`<vaadin-date-picker-light>`](#/elements/vaadin-date-picker-light) element.
|
|
98
|
-
*
|
|
99
96
|
* ### Internal components
|
|
100
97
|
*
|
|
101
98
|
* In addition to `<vaadin-date-picker>` itself, the following internal
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
7
7
|
import './vaadin-date-picker-overlay.js';
|
|
8
8
|
import './vaadin-date-picker-overlay-content.js';
|
|
9
|
-
import { html,
|
|
9
|
+
import { html, LitElement } from 'lit';
|
|
10
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
11
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
12
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
13
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
12
14
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
13
15
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
14
16
|
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
15
17
|
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
16
18
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
17
|
-
import {
|
|
19
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
18
20
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
19
21
|
import { datePickerStyles } from './vaadin-date-picker-styles.js';
|
|
20
22
|
|
|
21
|
-
registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { moduleId: 'vaadin-date-picker-styles' });
|
|
22
|
-
|
|
23
23
|
/**
|
|
24
24
|
* `<vaadin-date-picker>` is an input field that allows to enter a date by typing or by selecting from a calendar overlay.
|
|
25
25
|
*
|
|
@@ -56,9 +56,6 @@ registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { mod
|
|
|
56
56
|
* -----------|--------------------------------------------------|-----------
|
|
57
57
|
* `opened` | Set when the date selector overlay is opened | :host
|
|
58
58
|
*
|
|
59
|
-
* If you want to replace the default `<input>` and its container with a custom implementation to get full control
|
|
60
|
-
* over the input field, consider using the [`<vaadin-date-picker-light>`](#/elements/vaadin-date-picker-light) element.
|
|
61
|
-
*
|
|
62
59
|
* ### Internal components
|
|
63
60
|
*
|
|
64
61
|
* In addition to `<vaadin-date-picker>` itself, the following internal
|
|
@@ -150,30 +147,54 @@ registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { mod
|
|
|
150
147
|
* @mixes InputControlMixin
|
|
151
148
|
* @mixes DatePickerMixin
|
|
152
149
|
*/
|
|
153
|
-
class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(ElementMixin(
|
|
150
|
+
class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(ElementMixin(PolylitMixin(LitElement))))) {
|
|
154
151
|
static get is() {
|
|
155
152
|
return 'vaadin-date-picker';
|
|
156
153
|
}
|
|
157
154
|
|
|
158
|
-
static get
|
|
155
|
+
static get styles() {
|
|
156
|
+
return [inputFieldShared, datePickerStyles];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static get properties() {
|
|
160
|
+
return {
|
|
161
|
+
/** @private */
|
|
162
|
+
_positionTarget: {
|
|
163
|
+
type: Object,
|
|
164
|
+
sync: true,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
171
|
+
* @protected
|
|
172
|
+
* @return {!HTMLElement}
|
|
173
|
+
*/
|
|
174
|
+
get clearElement() {
|
|
175
|
+
return this.$.clearButton;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** @protected */
|
|
179
|
+
render() {
|
|
159
180
|
return html`
|
|
160
181
|
<div class="vaadin-date-picker-container">
|
|
161
182
|
<div part="label">
|
|
162
183
|
<slot name="label"></slot>
|
|
163
|
-
<span part="required-indicator" aria-hidden="true"
|
|
184
|
+
<span part="required-indicator" aria-hidden="true" @click="${this.focus}"></span>
|
|
164
185
|
</div>
|
|
165
186
|
|
|
166
187
|
<vaadin-input-container
|
|
167
188
|
part="input-field"
|
|
168
|
-
readonly="
|
|
169
|
-
disabled="
|
|
170
|
-
invalid="
|
|
171
|
-
theme
|
|
189
|
+
.readonly="${this.readonly}"
|
|
190
|
+
.disabled="${this.disabled}"
|
|
191
|
+
.invalid="${this.invalid}"
|
|
192
|
+
theme="${ifDefined(this._theme)}"
|
|
172
193
|
>
|
|
173
194
|
<slot name="prefix" slot="prefix"></slot>
|
|
174
195
|
<slot name="input"></slot>
|
|
175
196
|
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
176
|
-
<div part="toggle-button" slot="suffix" aria-hidden="true"
|
|
197
|
+
<div part="toggle-button" slot="suffix" aria-hidden="true" @click="${this._toggle}"></div>
|
|
177
198
|
</vaadin-input-container>
|
|
178
199
|
|
|
179
200
|
<div part="helper-text">
|
|
@@ -187,29 +208,24 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
187
208
|
|
|
188
209
|
<vaadin-date-picker-overlay
|
|
189
210
|
id="overlay"
|
|
190
|
-
fullscreen
|
|
191
|
-
theme
|
|
192
|
-
opened="{
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
211
|
+
?fullscreen="${this._fullscreen}"
|
|
212
|
+
theme="${ifDefined(this._theme)}"
|
|
213
|
+
.opened="${this.opened}"
|
|
214
|
+
@opened-changed="${this._onOpenedChanged}"
|
|
215
|
+
@vaadin-overlay-escape-press="${this._onOverlayEscapePress}"
|
|
216
|
+
@vaadin-overlay-open="${this._onOverlayOpened}"
|
|
217
|
+
@vaadin-overlay-close="${this._onVaadinOverlayClose}"
|
|
218
|
+
@vaadin-overlay-closing="${this._onOverlayClosed}"
|
|
196
219
|
restore-focus-on-close
|
|
197
|
-
|
|
220
|
+
no-vertical-overlap
|
|
221
|
+
.restoreFocusNode="${this.inputElement}"
|
|
222
|
+
.positionTarget="${this._positionTarget}"
|
|
198
223
|
></vaadin-date-picker-overlay>
|
|
199
224
|
|
|
200
225
|
<slot name="tooltip"></slot>
|
|
201
226
|
`;
|
|
202
227
|
}
|
|
203
228
|
|
|
204
|
-
/**
|
|
205
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
206
|
-
* @protected
|
|
207
|
-
* @return {!HTMLElement}
|
|
208
|
-
*/
|
|
209
|
-
get clearElement() {
|
|
210
|
-
return this.$.clearButton;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
229
|
/** @protected */
|
|
214
230
|
ready() {
|
|
215
231
|
super.ready();
|
|
@@ -239,10 +255,15 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
239
255
|
this._tooltipController.setAriaTarget(this.inputElement);
|
|
240
256
|
this._tooltipController.setShouldShow((target) => !target.opened);
|
|
241
257
|
|
|
258
|
+
this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
|
|
259
|
+
|
|
242
260
|
const toggleButton = this.shadowRoot.querySelector('[part="toggle-button"]');
|
|
243
261
|
toggleButton.addEventListener('mousedown', (e) => e.preventDefault());
|
|
262
|
+
}
|
|
244
263
|
|
|
245
|
-
|
|
264
|
+
/** @private */
|
|
265
|
+
_onOpenedChanged(event) {
|
|
266
|
+
this.opened = event.detail.value;
|
|
246
267
|
}
|
|
247
268
|
|
|
248
269
|
/** @private */
|
|
@@ -262,15 +283,6 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
|
|
|
262
283
|
this.open();
|
|
263
284
|
}
|
|
264
285
|
}
|
|
265
|
-
|
|
266
|
-
// Workaround https://github.com/vaadin/web-components/issues/2855
|
|
267
|
-
/** @protected */
|
|
268
|
-
_openedChanged(opened) {
|
|
269
|
-
super._openedChanged(opened);
|
|
270
|
-
|
|
271
|
-
this.$.overlay.positionTarget = this.shadowRoot.querySelector('[part="input-field"]');
|
|
272
|
-
this.$.overlay.noVerticalOverlap = true;
|
|
273
|
-
}
|
|
274
286
|
}
|
|
275
287
|
|
|
276
288
|
defineCustomElement(DatePicker);
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { flush } from '@polymer/polymer/lib/utils/flush.js';
|
|
7
6
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
8
7
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
9
8
|
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
|
|
@@ -41,16 +40,6 @@ template.innerHTML = `
|
|
|
41
40
|
box-sizing: border-box;
|
|
42
41
|
padding-right: 40px;
|
|
43
42
|
top: var(--vaadin-infinite-scroller-buffer-offset, 0);
|
|
44
|
-
animation: fadein 0.2s;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@keyframes fadein {
|
|
48
|
-
from {
|
|
49
|
-
opacity: 0;
|
|
50
|
-
}
|
|
51
|
-
to {
|
|
52
|
-
opacity: 1;
|
|
53
|
-
}
|
|
54
43
|
}
|
|
55
44
|
</style>
|
|
56
45
|
|
|
@@ -230,8 +219,6 @@ export class InfiniteScroller extends HTMLElement {
|
|
|
230
219
|
this._updateClones();
|
|
231
220
|
this._debouncerUpdateClones.cancel();
|
|
232
221
|
}
|
|
233
|
-
|
|
234
|
-
flush();
|
|
235
222
|
}
|
|
236
223
|
|
|
237
224
|
/**
|