@vaadin/date-picker 22.0.0-beta1 → 22.0.1
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 +26 -29
- package/package.json +14 -14
- package/src/vaadin-date-picker-light.js +4 -3
- package/src/vaadin-date-picker-mixin.d.ts +18 -13
- package/src/vaadin-date-picker-mixin.js +9 -24
- package/src/vaadin-date-picker-overlay-content.js +37 -36
- package/src/vaadin-date-picker-overlay.js +1 -1
- package/src/vaadin-date-picker-styles.js +1 -1
- package/src/vaadin-date-picker.d.ts +1 -3
- package/src/vaadin-date-picker.js +10 -10
- package/src/vaadin-infinite-scroller.js +3 -3
- package/src/vaadin-month-calendar.js +1 -1
- package/theme/lumo/vaadin-date-picker-overlay-content-styles.js +1 -1
- package/theme/lumo/vaadin-date-picker-overlay-styles.js +1 -1
- package/theme/lumo/vaadin-date-picker-styles.js +1 -1
- package/theme/lumo/vaadin-month-calendar-styles.js +1 -1
- package/theme/material/vaadin-date-picker-overlay-content-styles.js +1 -1
- package/theme/material/vaadin-date-picker-overlay-styles.js +1 -1
- package/theme/material/vaadin-date-picker-styles.js +1 -1
- package/theme/material/vaadin-month-calendar-styles.js +1 -1
package/README.md
CHANGED
|
@@ -1,58 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vaadin/date-picker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
|
5
|
-
[API documentation ↗](https://vaadin.com/components/vaadin-date-picker/html-api)
|
|
3
|
+
A web component that allows to enter a date by typing or by selecting from a calendar overlay.
|
|
6
4
|
|
|
7
|
-
[
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/date-picker)
|
|
8
6
|
|
|
9
7
|
[](https://www.npmjs.com/package/@vaadin/date-picker)
|
|
10
|
-
[](https://vaadin.com/directory/component/vaadinvaadin-date-picker)
|
|
11
8
|
[](https://discord.gg/PHmkCKC)
|
|
12
9
|
|
|
13
10
|
```html
|
|
14
|
-
<vaadin-date-picker label="Label"
|
|
11
|
+
<vaadin-date-picker label="Label" value="2018-12-03" clear-button-visible></vaadin-date-picker>
|
|
15
12
|
```
|
|
16
13
|
|
|
17
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/date-picker/screenshot.png" width="
|
|
14
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/date-picker/screenshot.png" width="343" alt="Screenshot of vaadin-date-picker">](https://vaadin.com/docs/latest/ds/components/date-picker)
|
|
18
15
|
|
|
19
16
|
## Installation
|
|
20
17
|
|
|
21
|
-
Install
|
|
18
|
+
Install the component:
|
|
22
19
|
|
|
23
20
|
```sh
|
|
24
|
-
npm i @vaadin/date-picker
|
|
21
|
+
npm i @vaadin/date-picker
|
|
25
22
|
```
|
|
26
23
|
|
|
27
|
-
Once installed, import
|
|
24
|
+
Once installed, import the component in your application:
|
|
28
25
|
|
|
29
26
|
```js
|
|
30
|
-
import '@vaadin/date-picker
|
|
27
|
+
import '@vaadin/date-picker';
|
|
31
28
|
```
|
|
32
29
|
|
|
33
|
-
##
|
|
30
|
+
## Themes
|
|
34
31
|
|
|
35
|
-
Vaadin components
|
|
32
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
|
|
33
|
+
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/date-picker/vaadin-date-picker.js) of the package uses the Lumo theme.
|
|
36
34
|
|
|
37
|
-
To use the Material theme, import the
|
|
35
|
+
To use the Material theme, import the component from the `theme/material` folder:
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`theme/lumo/vaadin-date-picker.js`
|
|
44
|
-
`theme/lumo/vaadin-date-picker-light.js`
|
|
37
|
+
```js
|
|
38
|
+
import '@vaadin/date-picker/theme/material/vaadin-date-picker.js';
|
|
39
|
+
```
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
You can also import the Lumo version of the component explicitly:
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
```js
|
|
44
|
+
import '@vaadin/date-picker/theme/lumo/vaadin-date-picker.js';
|
|
45
|
+
```
|
|
50
46
|
|
|
51
|
-
-
|
|
52
|
-
`theme/lumo/vaadin-date-picker-light.js`:
|
|
47
|
+
Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
```js
|
|
50
|
+
import '@vaadin/date-picker/src/vaadin-date-picker.js';
|
|
51
|
+
```
|
|
56
52
|
|
|
57
53
|
## Contributing
|
|
58
54
|
|
|
@@ -62,4 +58,5 @@ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/
|
|
|
62
58
|
|
|
63
59
|
Apache License 2.0
|
|
64
60
|
|
|
65
|
-
Vaadin collects development time
|
|
61
|
+
Vaadin collects usage statistics at development time to improve this product.
|
|
62
|
+
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,25 +31,25 @@
|
|
|
31
31
|
"web-component"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
35
|
"@polymer/iron-a11y-announcer": "^3.0.0",
|
|
35
|
-
"@polymer/iron-a11y-keys-behavior": "^3.0.0",
|
|
36
36
|
"@polymer/iron-media-query": "^3.0.0",
|
|
37
37
|
"@polymer/polymer": "^3.2.0",
|
|
38
|
-
"@vaadin/button": "22.0.
|
|
39
|
-
"@vaadin/component-base": "22.0.
|
|
40
|
-
"@vaadin/field-base": "22.0.
|
|
41
|
-
"@vaadin/input-container": "22.0.
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "22.0.
|
|
43
|
-
"@vaadin/vaadin-material-styles": "22.0.
|
|
44
|
-
"@vaadin/vaadin-overlay": "22.0.
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "22.0.
|
|
38
|
+
"@vaadin/button": "^22.0.1",
|
|
39
|
+
"@vaadin/component-base": "^22.0.1",
|
|
40
|
+
"@vaadin/field-base": "^22.0.1",
|
|
41
|
+
"@vaadin/input-container": "^22.0.1",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "^22.0.1",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "^22.0.1",
|
|
44
|
+
"@vaadin/vaadin-overlay": "^22.0.1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "^22.0.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
49
|
-
"@vaadin/dialog": "22.0.
|
|
50
|
-
"@vaadin/polymer-legacy-adapter": "22.0.
|
|
51
|
-
"@vaadin/testing-helpers": "^0.3.
|
|
49
|
+
"@vaadin/dialog": "^22.0.1",
|
|
50
|
+
"@vaadin/polymer-legacy-adapter": "^22.0.1",
|
|
51
|
+
"@vaadin/testing-helpers": "^0.3.2",
|
|
52
52
|
"sinon": "^9.2.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "2b0a2bff0369d6020f7cc33ad35506aa2d1f6f68"
|
|
55
55
|
}
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
8
6
|
import '@polymer/iron-media-query/iron-media-query.js';
|
|
9
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
7
|
import './vaadin-date-picker-overlay.js';
|
|
11
8
|
import './vaadin-date-picker-overlay-content.js';
|
|
9
|
+
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
10
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
11
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
12
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -74,6 +74,7 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
|
|
|
74
74
|
opened="{{opened}}"
|
|
75
75
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
76
76
|
on-vaadin-overlay-close="_onOverlayClosed"
|
|
77
|
+
on-vaadin-overlay-outside-click="focus"
|
|
77
78
|
theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
|
|
78
79
|
>
|
|
79
80
|
<template>
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
8
|
+
import { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
9
|
+
import { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
10
|
+
import { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
11
|
+
import { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
|
|
9
12
|
|
|
10
13
|
export interface DatePickerDate {
|
|
11
14
|
day: number;
|
|
@@ -28,15 +31,19 @@ export interface DatePickerI18n {
|
|
|
28
31
|
formatTitle: (monthName: string, fullYear: number) => string;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
declare function DatePickerMixin<T extends
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
export declare function DatePickerMixin<T extends Constructor<HTMLElement>>(
|
|
35
|
+
base: T
|
|
36
|
+
): T &
|
|
37
|
+
Constructor<DatePickerMixinClass> &
|
|
38
|
+
Constructor<DelegateFocusMixinClass> &
|
|
39
|
+
Constructor<DisabledMixinClass> &
|
|
40
|
+
Constructor<FocusMixinClass> &
|
|
41
|
+
Constructor<InputMixinClass> &
|
|
42
|
+
Constructor<KeyboardMixinClass>;
|
|
43
|
+
|
|
44
|
+
export declare class DatePickerMixinClass {
|
|
38
45
|
/**
|
|
39
|
-
*
|
|
46
|
+
* Selected date.
|
|
40
47
|
*
|
|
41
48
|
* Supported date formats:
|
|
42
49
|
* - ISO 8601 `"YYYY-MM-DD"` (default)
|
|
@@ -194,5 +201,3 @@ interface DatePickerMixin extends DelegateFocusMixin, InputMixin, KeyboardMixin
|
|
|
194
201
|
*/
|
|
195
202
|
checkValidity(): boolean;
|
|
196
203
|
}
|
|
197
|
-
|
|
198
|
-
export { DatePickerMixinConstructor, DatePickerMixin };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { IronA11yKeysBehavior } from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js';
|
|
7
6
|
import { addListener } from '@polymer/polymer/lib/utils/gestures.js';
|
|
7
|
+
import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
|
|
8
8
|
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
9
9
|
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
10
10
|
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
|
|
@@ -33,7 +33,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
33
33
|
_focusedDate: Date,
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Selected date.
|
|
37
37
|
*
|
|
38
38
|
* Supported date formats:
|
|
39
39
|
* - ISO 8601 `"YYYY-MM-DD"` (default)
|
|
@@ -308,7 +308,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
308
308
|
/** @private */
|
|
309
309
|
_ios: {
|
|
310
310
|
type: Boolean,
|
|
311
|
-
value:
|
|
311
|
+
value: isIOS
|
|
312
312
|
},
|
|
313
313
|
|
|
314
314
|
/** @private */
|
|
@@ -824,21 +824,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
|
|
827
|
-
/**
|
|
828
|
-
* Keyboard Navigation
|
|
829
|
-
* @private
|
|
830
|
-
*/
|
|
831
|
-
_eventKey(e) {
|
|
832
|
-
const keys = ['down', 'up', 'enter', 'esc', 'tab'];
|
|
833
|
-
|
|
834
|
-
for (let i = 0; i < keys.length; i++) {
|
|
835
|
-
const k = keys[i];
|
|
836
|
-
if (IronA11yKeysBehavior.keyboardEventMatchesKeys(e, k)) {
|
|
837
|
-
return k;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
827
|
/** @private */
|
|
843
828
|
_isValidDate(d) {
|
|
844
829
|
return d && !isNaN(d.getTime());
|
|
@@ -893,9 +878,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
893
878
|
}
|
|
894
879
|
}
|
|
895
880
|
|
|
896
|
-
switch (
|
|
897
|
-
case '
|
|
898
|
-
case '
|
|
881
|
+
switch (e.key) {
|
|
882
|
+
case 'ArrowDown':
|
|
883
|
+
case 'ArrowUp':
|
|
899
884
|
// prevent scrolling the page with arrows
|
|
900
885
|
e.preventDefault();
|
|
901
886
|
|
|
@@ -908,7 +893,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
908
893
|
}
|
|
909
894
|
|
|
910
895
|
break;
|
|
911
|
-
case '
|
|
896
|
+
case 'Enter': {
|
|
912
897
|
const parsedDate = this._getParsedDate();
|
|
913
898
|
const isValidDate = this._isValidDate(parsedDate);
|
|
914
899
|
if (this.opened) {
|
|
@@ -929,7 +914,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
929
914
|
}
|
|
930
915
|
break;
|
|
931
916
|
}
|
|
932
|
-
case '
|
|
917
|
+
case 'Escape':
|
|
933
918
|
if (this.opened) {
|
|
934
919
|
this._focusedDate = this._selectedDate;
|
|
935
920
|
this._close();
|
|
@@ -946,7 +931,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
946
931
|
this._selectParsedOrFocusedDate();
|
|
947
932
|
}
|
|
948
933
|
break;
|
|
949
|
-
case '
|
|
934
|
+
case 'Tab':
|
|
950
935
|
if (this.opened) {
|
|
951
936
|
e.preventDefault();
|
|
952
937
|
//Clear the selection range (remains visible on IE)
|
|
@@ -3,20 +3,19 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
8
|
-
import { addListener, setTouchAction } from '@polymer/polymer/lib/utils/gestures.js';
|
|
9
|
-
import { IronA11yKeysBehavior } from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js';
|
|
10
|
-
import { IronA11yAnnouncer } from '@polymer/iron-a11y-announcer/iron-a11y-announcer.js';
|
|
11
6
|
import '@polymer/iron-media-query/iron-media-query.js';
|
|
12
7
|
import '@vaadin/button/src/vaadin-button.js';
|
|
8
|
+
import './vaadin-month-calendar.js';
|
|
9
|
+
import './vaadin-infinite-scroller.js';
|
|
10
|
+
import { IronA11yAnnouncer } from '@polymer/iron-a11y-announcer/iron-a11y-announcer.js';
|
|
11
|
+
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
12
|
+
import { addListener, setTouchAction } from '@polymer/polymer/lib/utils/gestures.js';
|
|
13
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
13
14
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
14
15
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
15
16
|
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
16
17
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
17
|
-
import './vaadin-
|
|
18
|
-
import './vaadin-infinite-scroller.js';
|
|
19
|
-
import { dateEquals, getClosestDate, getISOWeekNumber, extractDateParts } from './vaadin-date-picker-helper.js';
|
|
18
|
+
import { dateEquals, extractDateParts, getClosestDate, getISOWeekNumber } from './vaadin-date-picker-helper.js';
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @extends HTMLElement
|
|
@@ -704,20 +703,6 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
704
703
|
e.preventDefault();
|
|
705
704
|
}
|
|
706
705
|
|
|
707
|
-
/**
|
|
708
|
-
* Keyboard Navigation
|
|
709
|
-
*/
|
|
710
|
-
_eventKey(e) {
|
|
711
|
-
var keys = ['down', 'up', 'right', 'left', 'enter', 'space', 'home', 'end', 'pageup', 'pagedown', 'tab', 'esc'];
|
|
712
|
-
|
|
713
|
-
for (var i = 0; i < keys.length; i++) {
|
|
714
|
-
var k = keys[i];
|
|
715
|
-
if (IronA11yKeysBehavior.keyboardEventMatchesKeys(e, k)) {
|
|
716
|
-
return k;
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
|
|
721
706
|
_onKeydown(e) {
|
|
722
707
|
var focus = this._currentlyFocusedDate();
|
|
723
708
|
|
|
@@ -727,8 +712,24 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
727
712
|
const isCancel = e.composedPath().indexOf(this.$.cancelButton) >= 0;
|
|
728
713
|
const isScroller = !isToday && !isCancel;
|
|
729
714
|
|
|
730
|
-
|
|
731
|
-
|
|
715
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
|
|
716
|
+
const navigationKeys = [
|
|
717
|
+
' ',
|
|
718
|
+
'ArrowDown',
|
|
719
|
+
'ArrowUp',
|
|
720
|
+
'ArrowRight',
|
|
721
|
+
'ArrowLeft',
|
|
722
|
+
'Enter',
|
|
723
|
+
'End',
|
|
724
|
+
'Escape',
|
|
725
|
+
'Home',
|
|
726
|
+
'PageUp',
|
|
727
|
+
'PageDown',
|
|
728
|
+
'Tab'
|
|
729
|
+
];
|
|
730
|
+
|
|
731
|
+
const eventKey = e.key;
|
|
732
|
+
if (eventKey === 'Tab') {
|
|
732
733
|
// We handle tabs here and don't want to bubble up.
|
|
733
734
|
e.stopPropagation();
|
|
734
735
|
|
|
@@ -751,36 +752,36 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
751
752
|
// set to false.
|
|
752
753
|
this._focused = false;
|
|
753
754
|
}
|
|
754
|
-
} else if (eventKey) {
|
|
755
|
+
} else if (navigationKeys.includes(eventKey)) {
|
|
755
756
|
e.preventDefault();
|
|
756
757
|
e.stopPropagation();
|
|
757
758
|
switch (eventKey) {
|
|
758
|
-
case '
|
|
759
|
+
case 'ArrowDown':
|
|
759
760
|
this._moveFocusByDays(7);
|
|
760
761
|
this.focus();
|
|
761
762
|
break;
|
|
762
|
-
case '
|
|
763
|
+
case 'ArrowUp':
|
|
763
764
|
this._moveFocusByDays(-7);
|
|
764
765
|
this.focus();
|
|
765
766
|
break;
|
|
766
|
-
case '
|
|
767
|
+
case 'ArrowRight':
|
|
767
768
|
if (isScroller) {
|
|
768
769
|
this._moveFocusByDays(this.__isRTL ? -1 : 1);
|
|
769
770
|
}
|
|
770
771
|
break;
|
|
771
|
-
case '
|
|
772
|
+
case 'ArrowLeft':
|
|
772
773
|
if (isScroller) {
|
|
773
774
|
this._moveFocusByDays(this.__isRTL ? 1 : -1);
|
|
774
775
|
}
|
|
775
776
|
break;
|
|
776
|
-
case '
|
|
777
|
+
case 'Enter':
|
|
777
778
|
if (isScroller || isCancel) {
|
|
778
779
|
this._close();
|
|
779
780
|
} else if (isToday) {
|
|
780
781
|
this._onTodayTap();
|
|
781
782
|
}
|
|
782
783
|
break;
|
|
783
|
-
case '
|
|
784
|
+
case ' ':
|
|
784
785
|
if (isCancel) {
|
|
785
786
|
this._close();
|
|
786
787
|
} else if (isToday) {
|
|
@@ -795,19 +796,19 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(GestureEventListen
|
|
|
795
796
|
}
|
|
796
797
|
}
|
|
797
798
|
break;
|
|
798
|
-
case '
|
|
799
|
+
case 'Home':
|
|
799
800
|
this._moveFocusInsideMonth(focus, 'minDate');
|
|
800
801
|
break;
|
|
801
|
-
case '
|
|
802
|
+
case 'End':
|
|
802
803
|
this._moveFocusInsideMonth(focus, 'maxDate');
|
|
803
804
|
break;
|
|
804
|
-
case '
|
|
805
|
+
case 'PageDown':
|
|
805
806
|
this._moveFocusByMonths(e.shiftKey ? 12 : 1);
|
|
806
807
|
break;
|
|
807
|
-
case '
|
|
808
|
+
case 'PageUp':
|
|
808
809
|
this._moveFocusByMonths(e.shiftKey ? -12 : -1);
|
|
809
810
|
break;
|
|
810
|
-
case '
|
|
811
|
+
case 'Escape':
|
|
811
812
|
this._cancel();
|
|
812
813
|
break;
|
|
813
814
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { DisableUpgradeMixin } from '@polymer/polymer/lib/mixins/disable-upgrade-mixin.js';
|
|
7
7
|
import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
|
|
8
8
|
import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
|
|
9
|
-
import { registerStyles } from '@vaadin/vaadin-themable-mixin/
|
|
9
|
+
import { registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
10
|
import { datePickerOverlayStyles } from './vaadin-date-picker-styles.js';
|
|
11
11
|
|
|
12
12
|
registerStyles('vaadin-date-picker-overlay', datePickerOverlayStyles, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { css } from '@vaadin/vaadin-themable-mixin/
|
|
6
|
+
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
7
|
|
|
8
8
|
export const datePickerStyles = css`
|
|
9
9
|
:host([dir='rtl']) [part='input-field'] {
|
|
@@ -125,7 +125,7 @@ export interface DatePickerEventMap extends HTMLElementEventMap, DatePickerCusto
|
|
|
125
125
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
126
126
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
127
127
|
*/
|
|
128
|
-
declare class DatePicker extends HTMLElement {
|
|
128
|
+
declare class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
|
|
129
129
|
addEventListener<K extends keyof DatePickerEventMap>(
|
|
130
130
|
type: K,
|
|
131
131
|
listener: (this: DatePicker, ev: DatePickerEventMap[K]) => void,
|
|
@@ -139,8 +139,6 @@ declare class DatePicker extends HTMLElement {
|
|
|
139
139
|
): void;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
interface DatePicker extends DatePickerMixin, ElementMixin, InputControlMixin, ThemableMixin {}
|
|
143
|
-
|
|
144
142
|
declare global {
|
|
145
143
|
interface HTMLElementTagNameMap {
|
|
146
144
|
'vaadin-date-picker': DatePicker;
|
|
@@ -3,21 +3,20 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
8
6
|
import '@polymer/iron-media-query/iron-media-query.js';
|
|
7
|
+
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
8
|
+
import './vaadin-date-picker-overlay.js';
|
|
9
|
+
import './vaadin-date-picker-overlay-content.js';
|
|
10
|
+
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
11
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
9
12
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
10
|
-
import { AriaLabelController } from '@vaadin/field-base/src/aria-label-controller.js';
|
|
11
|
-
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
12
13
|
import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
14
|
+
import { InputController } from '@vaadin/field-base/src/input-controller.js';
|
|
15
|
+
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
13
16
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
14
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
15
|
-
import { registerStyles } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
16
|
-
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
17
|
+
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
17
18
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
18
19
|
import { datePickerStyles } from './vaadin-date-picker-styles.js';
|
|
19
|
-
import './vaadin-date-picker-overlay.js';
|
|
20
|
-
import './vaadin-date-picker-overlay-content.js';
|
|
21
20
|
|
|
22
21
|
registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { moduleId: 'vaadin-date-picker-styles' });
|
|
23
22
|
|
|
@@ -166,6 +165,7 @@ class DatePicker extends DatePickerMixin(
|
|
|
166
165
|
theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
|
|
167
166
|
on-vaadin-overlay-open="_onOverlayOpened"
|
|
168
167
|
on-vaadin-overlay-close="_onOverlayClosed"
|
|
168
|
+
on-vaadin-overlay-outside-click="focus"
|
|
169
169
|
disable-upgrade
|
|
170
170
|
>
|
|
171
171
|
<template>
|
|
@@ -213,7 +213,7 @@ class DatePicker extends DatePickerMixin(
|
|
|
213
213
|
this.ariaTarget = input;
|
|
214
214
|
})
|
|
215
215
|
);
|
|
216
|
-
this.addController(new
|
|
216
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelNode));
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
/** @private */
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
-
import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
|
|
8
6
|
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
|
|
7
|
+
import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
|
|
8
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
9
9
|
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
10
|
+
import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
|
|
10
11
|
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -137,7 +138,6 @@ class InfiniteScroller extends PolymerElement {
|
|
|
137
138
|
|
|
138
139
|
// Firefox interprets elements with overflow:auto as focusable
|
|
139
140
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1069739
|
|
140
|
-
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
|
141
141
|
if (isFirefox) {
|
|
142
142
|
this.$.scroller.tabIndex = -1;
|
|
143
143
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2021 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
|
|
7
6
|
import '@polymer/polymer/lib/elements/dom-repeat.js';
|
|
8
7
|
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
8
|
+
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
9
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
10
10
|
import { dateAllowed, dateEquals, getISOWeekNumber } from './vaadin-date-picker-helper.js';
|
|
11
11
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
3
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
4
|
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
5
|
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
7
6
|
import '@vaadin/button/theme/lumo/vaadin-button.js';
|
|
7
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
8
|
|
|
9
9
|
registerStyles(
|
|
10
10
|
'vaadin-date-picker-overlay-content',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
3
2
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
4
3
|
import { menuOverlay } from '@vaadin/vaadin-lumo-styles/mixins/menu-overlay.js';
|
|
4
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
5
|
|
|
6
6
|
const datePickerOverlay = css`
|
|
7
7
|
[part='overlay'] {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
3
2
|
import { inputFieldShared } from '@vaadin/vaadin-lumo-styles/mixins/input-field-shared.js';
|
|
3
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
4
|
|
|
5
5
|
const datePicker = css`
|
|
6
6
|
:host {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-lumo-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-lumo-styles/sizing.js';
|
|
4
3
|
import '@vaadin/vaadin-lumo-styles/spacing.js';
|
|
5
4
|
import '@vaadin/vaadin-lumo-styles/style.js';
|
|
6
5
|
import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
6
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
7
|
|
|
8
8
|
registerStyles(
|
|
9
9
|
'vaadin-month-calendar',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
4
3
|
import '@vaadin/vaadin-material-styles/typography.js';
|
|
5
4
|
import '@vaadin/vaadin-material-styles/shadow.js';
|
|
6
5
|
import '@vaadin/button/theme/material/vaadin-button.js';
|
|
6
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
7
|
|
|
8
8
|
registerStyles(
|
|
9
9
|
'vaadin-date-picker-overlay-content',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import { overlay } from '@vaadin/vaadin-material-styles/mixins/overlay.js';
|
|
2
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
3
3
|
|
|
4
4
|
const datePickerOverlay = css`
|
|
5
5
|
:host([fullscreen]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-material-styles/font-icons.js';
|
|
4
3
|
import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
|
|
4
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
5
|
|
|
6
6
|
const datePicker = css`
|
|
7
7
|
:host {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
|
|
2
1
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
3
2
|
import '@vaadin/vaadin-material-styles/typography.js';
|
|
3
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
4
|
|
|
5
5
|
registerStyles(
|
|
6
6
|
'vaadin-month-calendar',
|