@vaadin/date-picker 23.1.2 → 23.2.0-alpha3
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 +10 -10
- package/src/vaadin-date-picker-light.d.ts +10 -1
- package/src/vaadin-date-picker-light.js +3 -1
- package/src/vaadin-date-picker-mixin.d.ts +6 -13
- package/src/vaadin-date-picker-mixin.js +7 -14
- package/src/vaadin-date-picker-overlay-content.js +6 -2
- package/src/vaadin-date-picker.d.ts +8 -0
- package/src/vaadin-date-picker.js +1 -0
- package/src/vaadin-infinite-scroller.js +3 -3
- package/src/vaadin-month-calendar.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/date-picker",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.2.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
36
36
|
"@polymer/polymer": "^3.2.0",
|
|
37
|
-
"@vaadin/button": "
|
|
38
|
-
"@vaadin/component-base": "
|
|
39
|
-
"@vaadin/field-base": "
|
|
40
|
-
"@vaadin/input-container": "
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
42
|
-
"@vaadin/vaadin-material-styles": "
|
|
43
|
-
"@vaadin/vaadin-overlay": "
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
37
|
+
"@vaadin/button": "23.2.0-alpha3",
|
|
38
|
+
"@vaadin/component-base": "23.2.0-alpha3",
|
|
39
|
+
"@vaadin/field-base": "23.2.0-alpha3",
|
|
40
|
+
"@vaadin/input-container": "23.2.0-alpha3",
|
|
41
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-alpha3",
|
|
42
|
+
"@vaadin/vaadin-material-styles": "23.2.0-alpha3",
|
|
43
|
+
"@vaadin/vaadin-overlay": "23.2.0-alpha3",
|
|
44
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-alpha3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
48
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
49
49
|
"sinon": "^13.0.2"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
|
|
52
52
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
6
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
8
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
8
9
|
export { DatePickerDate, DatePickerI18n } from './vaadin-date-picker-mixin.js';
|
|
@@ -29,12 +30,19 @@ export type DatePickerLightInvalidChangedEvent = CustomEvent<{ value: boolean }>
|
|
|
29
30
|
*/
|
|
30
31
|
export type DatePickerLightValueChangedEvent = CustomEvent<{ value: string }>;
|
|
31
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Fired whenever the field is validated.
|
|
35
|
+
*/
|
|
36
|
+
export type DatePickerLightValidatedEvent = CustomEvent<{ valid: boolean }>;
|
|
37
|
+
|
|
32
38
|
export interface DatePickerLightCustomEventMap {
|
|
33
39
|
'opened-changed': DatePickerLightOpenedChangedEvent;
|
|
34
40
|
|
|
35
41
|
'invalid-changed': DatePickerLightInvalidChangedEvent;
|
|
36
42
|
|
|
37
43
|
'value-changed': DatePickerLightValueChangedEvent;
|
|
44
|
+
|
|
45
|
+
validated: DatePickerLightValidatedEvent;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
export interface DatePickerLightEventMap extends HTMLElementEventMap, DatePickerLightCustomEventMap {
|
|
@@ -79,8 +87,9 @@ export interface DatePickerLightEventMap extends HTMLElementEventMap, DatePicker
|
|
|
79
87
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
80
88
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
81
89
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
90
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
82
91
|
*/
|
|
83
|
-
declare class DatePickerLight extends ThemableMixin(DatePickerMixin(HTMLElement)) {
|
|
92
|
+
declare class DatePickerLight extends ThemableMixin(DatePickerMixin(ValidateMixin(HTMLElement))) {
|
|
84
93
|
/**
|
|
85
94
|
* Name of the two-way data-bindable property representing the
|
|
86
95
|
* value of the custom input field.
|
|
@@ -7,6 +7,7 @@ import './vaadin-date-picker-overlay.js';
|
|
|
7
7
|
import './vaadin-date-picker-overlay-content.js';
|
|
8
8
|
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
9
9
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
10
|
+
import { ValidateMixin } from '@vaadin/field-base/src/validate-mixin.js';
|
|
10
11
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
12
|
import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
12
13
|
|
|
@@ -48,12 +49,13 @@ import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
|
|
|
48
49
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
49
50
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
50
51
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
52
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
51
53
|
*
|
|
52
54
|
* @extends HTMLElement
|
|
53
55
|
* @mixes ThemableMixin
|
|
54
56
|
* @mixes DatePickerMixin
|
|
55
57
|
*/
|
|
56
|
-
class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
|
|
58
|
+
class DatePickerLight extends ThemableMixin(DatePickerMixin(ValidateMixin(PolymerElement))) {
|
|
57
59
|
static get template() {
|
|
58
60
|
return html`
|
|
59
61
|
<style>
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
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';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
8
|
+
import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
9
|
+
import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
10
|
+
import type { DelegateFocusMixinClass } from '@vaadin/field-base/src/delegate-focus-mixin.js';
|
|
11
|
+
import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
|
|
12
12
|
|
|
13
13
|
export interface DatePickerDate {
|
|
14
14
|
day: number;
|
|
@@ -188,13 +188,6 @@ export declare class DatePickerMixinClass {
|
|
|
188
188
|
*/
|
|
189
189
|
close(): void;
|
|
190
190
|
|
|
191
|
-
/**
|
|
192
|
-
* Returns true if `value` is valid, and sets the `invalid` flag appropriately.
|
|
193
|
-
*
|
|
194
|
-
* @returns True if the value is valid and sets the `invalid` flag appropriately
|
|
195
|
-
*/
|
|
196
|
-
validate(): boolean;
|
|
197
|
-
|
|
198
191
|
/**
|
|
199
192
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
200
193
|
*
|
|
@@ -475,7 +475,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
475
475
|
this.$.overlay.removeAttribute('disable-upgrade');
|
|
476
476
|
this._overlayInitialized = true;
|
|
477
477
|
|
|
478
|
-
this.$.overlay.addEventListener('opened-changed', (e) =>
|
|
478
|
+
this.$.overlay.addEventListener('opened-changed', (e) => {
|
|
479
|
+
this.opened = e.detail.value;
|
|
480
|
+
});
|
|
479
481
|
|
|
480
482
|
this.$.overlay.addEventListener('vaadin-overlay-escape-press', () => {
|
|
481
483
|
this._focusedDate = this._selectedDate;
|
|
@@ -510,15 +512,6 @@ export const DatePickerMixin = (subclass) =>
|
|
|
510
512
|
this.addEventListener('touchstart', () => this.__bringToFront());
|
|
511
513
|
}
|
|
512
514
|
|
|
513
|
-
/**
|
|
514
|
-
* Returns true if `value` is valid, and sets the `invalid` flag appropriately.
|
|
515
|
-
*
|
|
516
|
-
* @return {boolean} True if the value is valid and sets the `invalid` flag appropriately
|
|
517
|
-
*/
|
|
518
|
-
validate() {
|
|
519
|
-
return !(this.invalid = !this.checkValidity());
|
|
520
|
-
}
|
|
521
|
-
|
|
522
515
|
/**
|
|
523
516
|
* Returns true if the current input value satisfies all constraints (if any)
|
|
524
517
|
*
|
|
@@ -529,7 +522,7 @@ export const DatePickerMixin = (subclass) =>
|
|
|
529
522
|
checkValidity() {
|
|
530
523
|
const inputValid =
|
|
531
524
|
!this._inputValue ||
|
|
532
|
-
(this._selectedDate && this._inputValue === this._getFormattedDate(this.i18n.formatDate, this._selectedDate));
|
|
525
|
+
(!!this._selectedDate && this._inputValue === this._getFormattedDate(this.i18n.formatDate, this._selectedDate));
|
|
533
526
|
const minMaxValid = !this._selectedDate || dateAllowed(this._selectedDate, this._minDate, this._maxDate);
|
|
534
527
|
|
|
535
528
|
let inputValidity = true;
|
|
@@ -819,9 +812,9 @@ export const DatePickerMixin = (subclass) =>
|
|
|
819
812
|
window.removeEventListener('scroll', this._boundOnScroll, true);
|
|
820
813
|
|
|
821
814
|
if (this._touchPrevented) {
|
|
822
|
-
this._touchPrevented.forEach(
|
|
823
|
-
|
|
824
|
-
);
|
|
815
|
+
this._touchPrevented.forEach((prevented) => {
|
|
816
|
+
prevented.element.style.webkitOverflowScrolling = prevented.oldInlineValue;
|
|
817
|
+
});
|
|
825
818
|
this._touchPrevented = [];
|
|
826
819
|
}
|
|
827
820
|
|
|
@@ -451,7 +451,9 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
451
451
|
|
|
452
452
|
_onYearScrollTouchStart() {
|
|
453
453
|
this._notTapping = false;
|
|
454
|
-
setTimeout(() =>
|
|
454
|
+
setTimeout(() => {
|
|
455
|
+
this._notTapping = true;
|
|
456
|
+
}, 300);
|
|
455
457
|
|
|
456
458
|
this._repositionMonthScroller();
|
|
457
459
|
}
|
|
@@ -462,7 +464,9 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po
|
|
|
462
464
|
|
|
463
465
|
_doIgnoreTaps() {
|
|
464
466
|
this._ignoreTaps = true;
|
|
465
|
-
this._debouncer = Debouncer.debounce(this._debouncer, timeOut.after(300), () =>
|
|
467
|
+
this._debouncer = Debouncer.debounce(this._debouncer, timeOut.after(300), () => {
|
|
468
|
+
this._ignoreTaps = false;
|
|
469
|
+
});
|
|
466
470
|
}
|
|
467
471
|
|
|
468
472
|
_formatDisplayed(date, formatDate, label) {
|
|
@@ -31,12 +31,19 @@ export type DatePickerInvalidChangedEvent = CustomEvent<{ value: boolean }>;
|
|
|
31
31
|
*/
|
|
32
32
|
export type DatePickerValueChangedEvent = CustomEvent<{ value: string }>;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Fired whenever the field is validated.
|
|
36
|
+
*/
|
|
37
|
+
export type DatePickerValidatedEvent = CustomEvent<{ valid: boolean }>;
|
|
38
|
+
|
|
34
39
|
export interface DatePickerCustomEventMap {
|
|
35
40
|
'opened-changed': DatePickerOpenedChangedEvent;
|
|
36
41
|
|
|
37
42
|
'invalid-changed': DatePickerInvalidChangedEvent;
|
|
38
43
|
|
|
39
44
|
'value-changed': DatePickerValueChangedEvent;
|
|
45
|
+
|
|
46
|
+
validated: DatePickerValidatedEvent;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
export interface DatePickerEventMap extends HTMLElementEventMap, DatePickerCustomEventMap {
|
|
@@ -133,6 +140,7 @@ export interface DatePickerEventMap extends HTMLElementEventMap, DatePickerCusto
|
|
|
133
140
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
134
141
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
135
142
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
143
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
136
144
|
*/
|
|
137
145
|
declare class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(ElementMixin(HTMLElement)))) {
|
|
138
146
|
addEventListener<K extends keyof DatePickerEventMap>(
|
|
@@ -108,6 +108,7 @@ registerStyles('vaadin-date-picker', [inputFieldShared, datePickerStyles], { mod
|
|
|
108
108
|
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
109
109
|
* @fires {CustomEvent} opened-changed - Fired when the `opened` property changes.
|
|
110
110
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
111
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
111
112
|
*
|
|
112
113
|
* @extends HTMLElement
|
|
113
114
|
* @mixes ElementMixin
|
|
@@ -155,7 +155,7 @@ class InfiniteScroller extends PolymerElement {
|
|
|
155
155
|
// Once the first set of items start fading in, stamp the rest
|
|
156
156
|
this._buffers.forEach((buffer) => {
|
|
157
157
|
[].forEach.call(buffer.children, (insertionPoint) => this._ensureStampedInstance(insertionPoint._itemWrapper));
|
|
158
|
-
}
|
|
158
|
+
});
|
|
159
159
|
|
|
160
160
|
if (!this._buffers[0].translateY) {
|
|
161
161
|
this._reset();
|
|
@@ -318,7 +318,7 @@ class InfiniteScroller extends PolymerElement {
|
|
|
318
318
|
}
|
|
319
319
|
}, 1); // Wait for first reset
|
|
320
320
|
}
|
|
321
|
-
}
|
|
321
|
+
});
|
|
322
322
|
|
|
323
323
|
setTimeout(() => {
|
|
324
324
|
afterNextRender(this, this._finishInit.bind(this));
|
|
@@ -356,7 +356,7 @@ class InfiniteScroller extends PolymerElement {
|
|
|
356
356
|
});
|
|
357
357
|
buffer.updated = true;
|
|
358
358
|
}
|
|
359
|
-
}
|
|
359
|
+
});
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
_isVisible(element, container) {
|
|
@@ -250,7 +250,9 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
|
|
|
250
250
|
|
|
251
251
|
_onMonthGridTouchStart() {
|
|
252
252
|
this._notTapping = false;
|
|
253
|
-
setTimeout(() =>
|
|
253
|
+
setTimeout(() => {
|
|
254
|
+
this._notTapping = true;
|
|
255
|
+
}, 300);
|
|
254
256
|
}
|
|
255
257
|
|
|
256
258
|
_dateAdd(date, delta) {
|