@vaadin/date-picker 23.3.3 → 24.0.0-alpha10

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.
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2016 - 2023 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html } from '@polymer/polymer/lib/utils/html-tag.js';
7
+ import { dateAfterXMonths } from './vaadin-date-picker-helper.js';
8
+ import { InfiniteScroller } from './vaadin-infinite-scroller.js';
9
+
10
+ const stylesTemplate = html`
11
+ <style>
12
+ :host {
13
+ --vaadin-infinite-scroller-item-height: 270px;
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ height: 100%;
20
+ }
21
+ </style>
22
+ `;
23
+
24
+ let memoizedTemplate;
25
+
26
+ /**
27
+ * An element used internally by `<vaadin-date-picker>`. Not intended to be used separately.
28
+ *
29
+ * @extends InfiniteScroller
30
+ * @private
31
+ */
32
+ class DatePickerMonthScroller extends InfiniteScroller {
33
+ static get is() {
34
+ return 'vaadin-date-picker-month-scroller';
35
+ }
36
+
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
+ }
45
+
46
+ static get properties() {
47
+ return {
48
+ bufferSize: {
49
+ type: Number,
50
+ value: 3,
51
+ },
52
+ };
53
+ }
54
+
55
+ /**
56
+ * @protected
57
+ * @override
58
+ */
59
+ _createElement() {
60
+ return document.createElement('vaadin-month-calendar');
61
+ }
62
+
63
+ /**
64
+ * @param {HTMLElement} element
65
+ * @param {number} index
66
+ * @protected
67
+ * @override
68
+ */
69
+ _updateElement(element, index) {
70
+ element.month = dateAfterXMonths(index);
71
+ }
72
+ }
73
+
74
+ customElements.define(DatePickerMonthScroller.is, DatePickerMonthScroller);