@vaadin/date-picker 24.2.0-alpha6 → 24.2.0-alpha7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/date-picker",
3
- "version": "24.2.0-alpha6",
3
+ "version": "24.2.0-alpha7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,10 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/vaadin-lit-date-picker-overlay-content.js",
25
+ "!src/vaadin-lit-date-picker-overlay.js",
26
+ "!src/vaadin-lit-month-calendar.js",
27
+ "!src/vaadin-lit-date-picker.js",
24
28
  "theme",
25
29
  "vaadin-*.d.ts",
26
30
  "vaadin-*.js",
@@ -36,15 +40,15 @@
36
40
  "dependencies": {
37
41
  "@open-wc/dedupe-mixin": "^1.3.0",
38
42
  "@polymer/polymer": "^3.2.0",
39
- "@vaadin/a11y-base": "24.2.0-alpha6",
40
- "@vaadin/button": "24.2.0-alpha6",
41
- "@vaadin/component-base": "24.2.0-alpha6",
42
- "@vaadin/field-base": "24.2.0-alpha6",
43
- "@vaadin/input-container": "24.2.0-alpha6",
44
- "@vaadin/overlay": "24.2.0-alpha6",
45
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha6",
46
- "@vaadin/vaadin-material-styles": "24.2.0-alpha6",
47
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha6"
43
+ "@vaadin/a11y-base": "24.2.0-alpha7",
44
+ "@vaadin/button": "24.2.0-alpha7",
45
+ "@vaadin/component-base": "24.2.0-alpha7",
46
+ "@vaadin/field-base": "24.2.0-alpha7",
47
+ "@vaadin/input-container": "24.2.0-alpha7",
48
+ "@vaadin/overlay": "24.2.0-alpha7",
49
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha7",
50
+ "@vaadin/vaadin-material-styles": "24.2.0-alpha7",
51
+ "@vaadin/vaadin-themable-mixin": "24.2.0-alpha7"
48
52
  },
49
53
  "devDependencies": {
50
54
  "@esm-bundle/chai": "^4.3.4",
@@ -55,5 +59,5 @@
55
59
  "web-types.json",
56
60
  "web-types.lit.json"
57
61
  ],
58
- "gitHead": "3ef6e6cd66919b3ef7637e42916e4c54656beb51"
62
+ "gitHead": "81ecf12d2d59a3e5b467273c37a391e31932dc9c"
59
63
  }
@@ -42,14 +42,18 @@ export const DatePickerMixin = (subclass) =>
42
42
  * @protected
43
43
  */
44
44
  _selectedDate: {
45
- type: Date,
45
+ type: Object,
46
+ sync: true,
46
47
  },
47
48
 
48
49
  /**
49
50
  * @type {Date | undefined}
50
51
  * @protected
51
52
  */
52
- _focusedDate: Date,
53
+ _focusedDate: {
54
+ type: Object,
55
+ sync: true,
56
+ },
53
57
 
54
58
  /**
55
59
  * Selected date.
@@ -64,6 +68,7 @@ export const DatePickerMixin = (subclass) =>
64
68
  type: String,
65
69
  notify: true,
66
70
  value: '',
71
+ sync: true,
67
72
  },
68
73
 
69
74
  /**
@@ -82,6 +87,7 @@ export const DatePickerMixin = (subclass) =>
82
87
  reflectToAttribute: true,
83
88
  notify: true,
84
89
  observer: '_openedChanged',
90
+ sync: true,
85
91
  },
86
92
 
87
93
  /**
@@ -99,6 +105,7 @@ export const DatePickerMixin = (subclass) =>
99
105
  showWeekNumbers: {
100
106
  type: Boolean,
101
107
  value: false,
108
+ sync: true,
102
109
  },
103
110
 
104
111
  /**
@@ -108,6 +115,7 @@ export const DatePickerMixin = (subclass) =>
108
115
  _fullscreen: {
109
116
  type: Boolean,
110
117
  value: false,
118
+ sync: true,
111
119
  },
112
120
 
113
121
  /**
@@ -206,6 +214,7 @@ export const DatePickerMixin = (subclass) =>
206
214
  */
207
215
  i18n: {
208
216
  type: Object,
217
+ sync: true,
209
218
  value: () => {
210
219
  return {
211
220
  monthNames: [
@@ -276,6 +285,7 @@ export const DatePickerMixin = (subclass) =>
276
285
  */
277
286
  min: {
278
287
  type: String,
288
+ sync: true,
279
289
  },
280
290
 
281
291
  /**
@@ -289,6 +299,7 @@ export const DatePickerMixin = (subclass) =>
289
299
  */
290
300
  max: {
291
301
  type: String,
302
+ sync: true,
292
303
  },
293
304
 
294
305
  /**
@@ -299,6 +310,7 @@ export const DatePickerMixin = (subclass) =>
299
310
  _minDate: {
300
311
  type: Date,
301
312
  computed: '__computeMinOrMaxDate(min)',
313
+ sync: true,
302
314
  },
303
315
 
304
316
  /**
@@ -309,6 +321,7 @@ export const DatePickerMixin = (subclass) =>
309
321
  _maxDate: {
310
322
  type: Date,
311
323
  computed: '__computeMinOrMaxDate(max)',
324
+ sync: true,
312
325
  },
313
326
 
314
327
  /** @private */
@@ -327,7 +340,10 @@ export const DatePickerMixin = (subclass) =>
327
340
  _focusOverlayOnOpen: Boolean,
328
341
 
329
342
  /** @private */
330
- _overlayContent: Object,
343
+ _overlayContent: {
344
+ type: Object,
345
+ sync: true,
346
+ },
331
347
 
332
348
  /**
333
349
  * In date-picker, unlike other components extending `InputMixin`,
@@ -347,8 +363,8 @@ export const DatePickerMixin = (subclass) =>
347
363
 
348
364
  static get observers() {
349
365
  return [
350
- '_selectedDateChanged(_selectedDate, i18n.formatDate)',
351
- '_focusedDateChanged(_focusedDate, i18n.formatDate)',
366
+ '_selectedDateChanged(_selectedDate, i18n)',
367
+ '_focusedDateChanged(_focusedDate, i18n)',
352
368
  '__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers)',
353
369
  '__updateOverlayContentTheme(_overlayContent, _theme)',
354
370
  '__updateOverlayContentFullScreen(_overlayContent, _fullscreen)',
@@ -490,6 +506,22 @@ export const DatePickerMixin = (subclass) =>
490
506
  }
491
507
  }
492
508
 
509
+ /**
510
+ * Override LitElement lifecycle callback to dispatch `change` event if needed.
511
+ * This is necessary to ensure `change` is fired after `value-changed`.
512
+ *
513
+ * @protected
514
+ * @override
515
+ */
516
+ updated(props) {
517
+ super.updated(props);
518
+
519
+ if (props.has('value') && this.__dispatchChange) {
520
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
521
+ this.__dispatchChange = false;
522
+ }
523
+ }
524
+
493
525
  /**
494
526
  * Opens the dropdown.
495
527
  */
@@ -718,8 +750,8 @@ export const DatePickerMixin = (subclass) =>
718
750
  }
719
751
 
720
752
  /** @private */
721
- _selectedDateChanged(selectedDate, formatDate) {
722
- if (selectedDate === undefined || formatDate === undefined) {
753
+ _selectedDateChanged(selectedDate, i18n) {
754
+ if (selectedDate === undefined || i18n === undefined) {
723
755
  return;
724
756
  }
725
757
  const value = this._formatISO(selectedDate);
@@ -738,8 +770,8 @@ export const DatePickerMixin = (subclass) =>
738
770
  }
739
771
 
740
772
  /** @private */
741
- _focusedDateChanged(focusedDate, formatDate) {
742
- if (focusedDate === undefined || formatDate === undefined) {
773
+ _focusedDateChanged(focusedDate, i18n) {
774
+ if (focusedDate === undefined || i18n === undefined) {
743
775
  return;
744
776
  }
745
777
  if (!this._ignoreFocusedDateChange && !this._noInput) {
@@ -789,15 +821,13 @@ export const DatePickerMixin = (subclass) =>
789
821
  // eslint-disable-next-line max-params
790
822
  __updateOverlayContent(overlayContent, i18n, label, minDate, maxDate, focusedDate, selectedDate, showWeekNumbers) {
791
823
  if (overlayContent) {
792
- overlayContent.setProperties({
793
- i18n,
794
- label,
795
- minDate,
796
- maxDate,
797
- focusedDate,
798
- selectedDate,
799
- showWeekNumbers,
800
- });
824
+ overlayContent.i18n = i18n;
825
+ overlayContent.label = label;
826
+ overlayContent.minDate = minDate;
827
+ overlayContent.maxDate = maxDate;
828
+ overlayContent.focusedDate = focusedDate;
829
+ overlayContent.selectedDate = selectedDate;
830
+ overlayContent.showWeekNumbers = showWeekNumbers;
801
831
  }
802
832
  }
803
833
 
@@ -828,6 +858,7 @@ export const DatePickerMixin = (subclass) =>
828
858
  /** @protected */
829
859
  _onOverlayOpened() {
830
860
  const content = this._overlayContent;
861
+ content.reset();
831
862
 
832
863
  // Detect which date to show
833
864
  const initialPosition = this._getInitialPosition();
@@ -3,11 +3,11 @@
3
3
  * Copyright (c) 2016 - 2023 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 } from '@polymer/polymer/lib/utils/html-tag.js';
7
6
  import { dateAfterXMonths } from './vaadin-date-picker-helper.js';
8
7
  import { InfiniteScroller } from './vaadin-infinite-scroller.js';
9
8
 
10
- const stylesTemplate = html`
9
+ const stylesTemplate = document.createElement('template');
10
+ stylesTemplate.innerHTML = `
11
11
  <style>
12
12
  :host {
13
13
  --vaadin-infinite-scroller-item-height: 270px;
@@ -21,8 +21,6 @@ const stylesTemplate = html`
21
21
  </style>
22
22
  `;
23
23
 
24
- let memoizedTemplate;
25
-
26
24
  /**
27
25
  * An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
28
26
  *
@@ -34,22 +32,11 @@ class DatePickerMonthScroller extends InfiniteScroller {
34
32
  return 'vaadin-date-picker-month-scroller';
35
33
  }
36
34
 
37
- static get template() {
38
- if (!memoizedTemplate) {
39
- memoizedTemplate = super.template.cloneNode(true);
40
- memoizedTemplate.content.appendChild(stylesTemplate.content.cloneNode(true));
41
- }
42
-
43
- return memoizedTemplate;
44
- }
35
+ constructor() {
36
+ super();
45
37
 
46
- static get properties() {
47
- return {
48
- bufferSize: {
49
- type: Number,
50
- value: 3,
51
- },
52
- };
38
+ this.bufferSize = 3;
39
+ this.shadowRoot.appendChild(stylesTemplate.content.cloneNode(true));
53
40
  }
54
41
 
55
42
  /**