@descope/web-components-ui 1.0.65 → 1.0.67
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +6 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +663 -433
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/233.js +5 -1
- package/dist/umd/314.js +283 -0
- package/dist/umd/314.js.LICENSE.txt +27 -0
- package/dist/umd/541.js +744 -0
- package/dist/umd/541.js.LICENSE.txt +21 -0
- package/dist/umd/725.js +37 -1
- package/dist/umd/786.js +1 -1
- package/dist/umd/824.js +229 -0
- package/dist/umd/{54.js.LICENSE.txt → 824.js.LICENSE.txt} +0 -6
- package/dist/umd/840.js +9 -9
- package/dist/umd/860.js +1 -0
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -0
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-date-picker-index-js.js +1 -1
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -1
- package/dist/umd/descope-loader-linear-index-js.js +1 -1
- package/dist/umd/descope-loader-radial-index-js.js +1 -1
- package/dist/umd/descope-logo-index-js.js +1 -1
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-password-field-index-js.js +1 -1
- package/dist/umd/descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-text-area-index-js.js +1 -1
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +2 -1
- package/src/components/descope-combo-box/ComboBox.js +111 -0
- package/src/components/descope-combo-box/index.js +6 -0
- package/src/constants.js +3 -1
- package/src/helpers/componentHelpers.js +55 -36
- package/src/helpers/index.js +2 -1
- package/src/helpers/themeHelpers/index.js +3 -3
- package/src/mixins/createStyleMixin/index.js +117 -91
- package/src/mixins/index.js +1 -0
- package/src/mixins/inputMixin.js +2 -3
- package/src/mixins/portalMixin.js +62 -0
- package/src/theme/components/comboBox.js +32 -0
- package/src/theme/components/index.js +3 -1
- package/dist/umd/54.js +0 -971
- package/dist/umd/666.js +0 -37
- /package/dist/umd/{666.js.LICENSE.txt → 725.js.LICENSE.txt} +0 -0
package/dist/umd/541.js
ADDED
@@ -0,0 +1,744 @@
|
|
1
|
+
/*! For license information please see 541.js.LICENSE.txt */
|
2
|
+
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[541],{541:(e,t,s)=>{s(3787),s(9098),s(9416),s(6687);var i=s(6754),a=s(5128);const n=a.iv`
|
3
|
+
[part='overlay'] {
|
4
|
+
/*
|
5
|
+
Width:
|
6
|
+
date cell widths
|
7
|
+
+ month calendar side padding
|
8
|
+
+ year scroller width
|
9
|
+
*/
|
10
|
+
/* prettier-ignore */
|
11
|
+
width:
|
12
|
+
calc(
|
13
|
+
var(--lumo-size-m) * 7
|
14
|
+
+ var(--lumo-space-xs) * 2
|
15
|
+
+ 57px
|
16
|
+
);
|
17
|
+
height: 100%;
|
18
|
+
max-height: calc(var(--lumo-size-m) * 14);
|
19
|
+
overflow: hidden;
|
20
|
+
-webkit-tap-highlight-color: transparent;
|
21
|
+
}
|
22
|
+
|
23
|
+
[part='overlay'] {
|
24
|
+
flex-direction: column;
|
25
|
+
}
|
26
|
+
|
27
|
+
[part='content'] {
|
28
|
+
padding: 0;
|
29
|
+
height: 100%;
|
30
|
+
overflow: hidden;
|
31
|
+
-webkit-mask-image: none;
|
32
|
+
mask-image: none;
|
33
|
+
}
|
34
|
+
|
35
|
+
:host([top-aligned]) [part~='overlay'] {
|
36
|
+
margin-top: var(--lumo-space-xs);
|
37
|
+
}
|
38
|
+
|
39
|
+
:host([bottom-aligned]) [part~='overlay'] {
|
40
|
+
margin-bottom: var(--lumo-space-xs);
|
41
|
+
}
|
42
|
+
|
43
|
+
@media (max-width: 420px), (max-height: 420px) {
|
44
|
+
[part='overlay'] {
|
45
|
+
width: 100vw;
|
46
|
+
height: 70vh;
|
47
|
+
max-height: 70vh;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
`;(0,a.hC)("vaadin-date-picker-overlay",[i.L,n],{moduleId:"lumo-date-picker-overlay"}),s(1195),s(9849),s(4173),s(4513),(0,a.hC)("vaadin-date-picker-year",a.iv`
|
51
|
+
:host([current]) [part='year-number'] {
|
52
|
+
color: var(--lumo-primary-text-color);
|
53
|
+
}
|
54
|
+
|
55
|
+
:host(:not([current])) [part='year-number'],
|
56
|
+
[part='year-separator'] {
|
57
|
+
opacity: var(--_lumo-date-picker-year-opacity, 0.7);
|
58
|
+
transition: 0.2s opacity;
|
59
|
+
}
|
60
|
+
|
61
|
+
[part='year-number'],
|
62
|
+
[part='year-separator'] {
|
63
|
+
display: flex;
|
64
|
+
align-items: center;
|
65
|
+
justify-content: center;
|
66
|
+
height: 50%;
|
67
|
+
transform: translateY(-50%);
|
68
|
+
}
|
69
|
+
|
70
|
+
[part='year-separator']::after {
|
71
|
+
color: var(--lumo-disabled-text-color);
|
72
|
+
content: '\\2022';
|
73
|
+
}
|
74
|
+
`,{moduleId:"lumo-date-picker-year"}),(0,a.hC)("vaadin-date-picker-overlay-content",a.iv`
|
75
|
+
:host {
|
76
|
+
position: relative;
|
77
|
+
/* Background for the year scroller, placed here as we are using a mask image on the actual years part */
|
78
|
+
background-image: linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct));
|
79
|
+
background-size: 57px 100%;
|
80
|
+
background-position: top right;
|
81
|
+
background-repeat: no-repeat;
|
82
|
+
cursor: default;
|
83
|
+
}
|
84
|
+
|
85
|
+
::slotted([slot='months']) {
|
86
|
+
/* Month calendar height:
|
87
|
+
header height + margin-bottom
|
88
|
+
+ weekdays height + margin-bottom
|
89
|
+
+ date cell heights
|
90
|
+
+ small margin between month calendars
|
91
|
+
*/
|
92
|
+
/* prettier-ignore */
|
93
|
+
--vaadin-infinite-scroller-item-height:
|
94
|
+
calc(
|
95
|
+
var(--lumo-font-size-l) + var(--lumo-space-m)
|
96
|
+
+ var(--lumo-font-size-xs) + var(--lumo-space-s)
|
97
|
+
+ var(--lumo-size-m) * 6
|
98
|
+
+ var(--lumo-space-s)
|
99
|
+
);
|
100
|
+
--vaadin-infinite-scroller-buffer-offset: 10%;
|
101
|
+
-webkit-mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
|
102
|
+
mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
|
103
|
+
position: relative;
|
104
|
+
margin-right: 57px;
|
105
|
+
}
|
106
|
+
|
107
|
+
::slotted([slot='years']) {
|
108
|
+
/* TODO get rid of fixed magic number */
|
109
|
+
--vaadin-infinite-scroller-buffer-width: 97px;
|
110
|
+
width: 57px;
|
111
|
+
height: auto;
|
112
|
+
top: 0;
|
113
|
+
bottom: 0;
|
114
|
+
font-size: var(--lumo-font-size-s);
|
115
|
+
box-shadow: inset 2px 0 4px 0 var(--lumo-shade-5pct);
|
116
|
+
-webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
|
117
|
+
mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
|
118
|
+
cursor: var(--lumo-clickable-cursor);
|
119
|
+
}
|
120
|
+
|
121
|
+
::slotted([slot='years']:hover) {
|
122
|
+
--_lumo-date-picker-year-opacity: 1;
|
123
|
+
}
|
124
|
+
|
125
|
+
/* TODO unsupported selector */
|
126
|
+
#scrollers {
|
127
|
+
position: static;
|
128
|
+
display: block;
|
129
|
+
}
|
130
|
+
|
131
|
+
/* TODO fix this in vaadin-date-picker that it adapts to the width of the year scroller */
|
132
|
+
:host([desktop]) ::slotted([slot='months']) {
|
133
|
+
right: auto;
|
134
|
+
}
|
135
|
+
|
136
|
+
/* Year scroller position indicator */
|
137
|
+
::slotted([slot='years'])::before {
|
138
|
+
border: none;
|
139
|
+
width: 1em;
|
140
|
+
height: 1em;
|
141
|
+
background-color: var(--lumo-base-color);
|
142
|
+
background-image: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
|
143
|
+
transform: translate(-75%, -50%) rotate(45deg);
|
144
|
+
border-top-right-radius: var(--lumo-border-radius-s);
|
145
|
+
box-shadow: 2px -2px 6px 0 var(--lumo-shade-5pct);
|
146
|
+
z-index: 1;
|
147
|
+
}
|
148
|
+
|
149
|
+
[part='toolbar'] {
|
150
|
+
padding: var(--lumo-space-s);
|
151
|
+
border-bottom-left-radius: var(--lumo-border-radius-l);
|
152
|
+
margin-right: 57px;
|
153
|
+
}
|
154
|
+
|
155
|
+
[part='toolbar'] ::slotted(vaadin-button) {
|
156
|
+
margin: 0;
|
157
|
+
}
|
158
|
+
|
159
|
+
/* Narrow viewport mode (fullscreen) */
|
160
|
+
|
161
|
+
:host([fullscreen]) [part='toolbar'] {
|
162
|
+
order: -1;
|
163
|
+
background-color: var(--lumo-base-color);
|
164
|
+
}
|
165
|
+
|
166
|
+
:host([fullscreen]) [part='overlay-header'] {
|
167
|
+
order: -2;
|
168
|
+
height: var(--lumo-size-m);
|
169
|
+
padding: var(--lumo-space-s);
|
170
|
+
position: absolute;
|
171
|
+
left: 0;
|
172
|
+
right: 0;
|
173
|
+
justify-content: center;
|
174
|
+
}
|
175
|
+
|
176
|
+
:host([fullscreen]) [part='toggle-button'],
|
177
|
+
:host([fullscreen]) [part='clear-button'],
|
178
|
+
[part='overlay-header'] [part='label'] {
|
179
|
+
display: none;
|
180
|
+
}
|
181
|
+
|
182
|
+
/* Very narrow screen (year scroller initially hidden) */
|
183
|
+
|
184
|
+
[part='years-toggle-button'] {
|
185
|
+
display: flex;
|
186
|
+
align-items: center;
|
187
|
+
height: var(--lumo-size-s);
|
188
|
+
padding: 0 0.5em;
|
189
|
+
border-radius: var(--lumo-border-radius-m);
|
190
|
+
z-index: 3;
|
191
|
+
color: var(--lumo-primary-text-color);
|
192
|
+
font-weight: 500;
|
193
|
+
-webkit-font-smoothing: antialiased;
|
194
|
+
-moz-osx-font-smoothing: grayscale;
|
195
|
+
}
|
196
|
+
|
197
|
+
:host([years-visible]) [part='years-toggle-button'] {
|
198
|
+
background-color: var(--lumo-primary-color);
|
199
|
+
color: var(--lumo-primary-contrast-color);
|
200
|
+
}
|
201
|
+
|
202
|
+
/* TODO magic number (same as used for media-query in vaadin-date-picker-overlay-content) */
|
203
|
+
@media screen and (max-width: 374px) {
|
204
|
+
:host {
|
205
|
+
background-image: none;
|
206
|
+
}
|
207
|
+
|
208
|
+
[part='toolbar'],
|
209
|
+
::slotted([slot='months']) {
|
210
|
+
margin-right: 0;
|
211
|
+
}
|
212
|
+
|
213
|
+
/* TODO make date-picker adapt to the width of the years part */
|
214
|
+
::slotted([slot='years']) {
|
215
|
+
--vaadin-infinite-scroller-buffer-width: 90px;
|
216
|
+
width: 50px;
|
217
|
+
background-color: var(--lumo-shade-5pct);
|
218
|
+
}
|
219
|
+
|
220
|
+
:host([years-visible]) ::slotted([slot='months']) {
|
221
|
+
padding-left: 50px;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
`,{moduleId:"lumo-date-picker-overlay-content"}),(0,a.hC)("vaadin-month-calendar",a.iv`
|
225
|
+
:host {
|
226
|
+
-moz-user-select: none;
|
227
|
+
-webkit-user-select: none;
|
228
|
+
-webkit-tap-highlight-color: transparent;
|
229
|
+
user-select: none;
|
230
|
+
font-size: var(--lumo-font-size-m);
|
231
|
+
color: var(--lumo-body-text-color);
|
232
|
+
text-align: center;
|
233
|
+
padding: 0 var(--lumo-space-xs);
|
234
|
+
}
|
235
|
+
|
236
|
+
/* Month header */
|
237
|
+
|
238
|
+
[part='month-header'] {
|
239
|
+
color: var(--lumo-header-text-color);
|
240
|
+
font-size: var(--lumo-font-size-l);
|
241
|
+
line-height: 1;
|
242
|
+
font-weight: 500;
|
243
|
+
margin-bottom: var(--lumo-space-m);
|
244
|
+
}
|
245
|
+
|
246
|
+
/* Week days and numbers */
|
247
|
+
|
248
|
+
[part='weekdays'],
|
249
|
+
[part='weekday'],
|
250
|
+
[part='week-number'] {
|
251
|
+
font-size: var(--lumo-font-size-xxs);
|
252
|
+
line-height: 1;
|
253
|
+
color: var(--lumo-secondary-text-color);
|
254
|
+
}
|
255
|
+
|
256
|
+
[part='weekdays'] {
|
257
|
+
margin-bottom: var(--lumo-space-s);
|
258
|
+
}
|
259
|
+
|
260
|
+
[part='weekday']:empty,
|
261
|
+
[part='week-number'] {
|
262
|
+
width: var(--lumo-size-xs);
|
263
|
+
}
|
264
|
+
|
265
|
+
/* Date and week number cells */
|
266
|
+
|
267
|
+
[part~='date'],
|
268
|
+
[part='week-number'] {
|
269
|
+
box-sizing: border-box;
|
270
|
+
display: inline-flex;
|
271
|
+
align-items: center;
|
272
|
+
justify-content: center;
|
273
|
+
height: var(--lumo-size-m);
|
274
|
+
position: relative;
|
275
|
+
}
|
276
|
+
|
277
|
+
[part~='date'] {
|
278
|
+
transition: color 0.1s;
|
279
|
+
}
|
280
|
+
|
281
|
+
[part~='date']:not(:empty) {
|
282
|
+
cursor: var(--lumo-clickable-cursor);
|
283
|
+
}
|
284
|
+
|
285
|
+
:host([week-numbers]) [part='weekday']:not(:empty),
|
286
|
+
:host([week-numbers]) [part~='date'] {
|
287
|
+
width: calc((100% - var(--lumo-size-xs)) / 7);
|
288
|
+
}
|
289
|
+
|
290
|
+
/* Today date */
|
291
|
+
|
292
|
+
[part~='date'][part~='today'] {
|
293
|
+
color: var(--lumo-primary-text-color);
|
294
|
+
}
|
295
|
+
|
296
|
+
/* Focused date */
|
297
|
+
|
298
|
+
[part~='date']::before {
|
299
|
+
content: '';
|
300
|
+
position: absolute;
|
301
|
+
z-index: -1;
|
302
|
+
top: 50%;
|
303
|
+
left: 50%;
|
304
|
+
transform: translate(-50%, -50%);
|
305
|
+
min-width: 2em;
|
306
|
+
min-height: 2em;
|
307
|
+
width: 80%;
|
308
|
+
height: 80%;
|
309
|
+
max-height: 100%;
|
310
|
+
max-width: 100%;
|
311
|
+
border-radius: var(--lumo-border-radius-m);
|
312
|
+
}
|
313
|
+
|
314
|
+
[part~='date'][part~='focused']::before {
|
315
|
+
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
|
316
|
+
}
|
317
|
+
|
318
|
+
:host(:not([focused])) [part~='date'][part~='focused']::before {
|
319
|
+
animation: vaadin-date-picker-month-calendar-focus-date 1.4s infinite;
|
320
|
+
}
|
321
|
+
|
322
|
+
@keyframes vaadin-date-picker-month-calendar-focus-date {
|
323
|
+
50% {
|
324
|
+
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px transparent;
|
325
|
+
}
|
326
|
+
}
|
327
|
+
|
328
|
+
[part~='date']:not(:empty):not([part~='disabled']):not([part~='selected']):hover::before {
|
329
|
+
background-color: var(--lumo-primary-color-10pct);
|
330
|
+
}
|
331
|
+
|
332
|
+
[part~='date'][part~='selected'] {
|
333
|
+
color: var(--lumo-primary-contrast-color);
|
334
|
+
}
|
335
|
+
|
336
|
+
[part~='date'][part~='selected']::before {
|
337
|
+
background-color: var(--lumo-primary-color);
|
338
|
+
}
|
339
|
+
|
340
|
+
[part~='date'][part~='disabled'] {
|
341
|
+
color: var(--lumo-disabled-text-color);
|
342
|
+
}
|
343
|
+
|
344
|
+
@media (pointer: coarse) {
|
345
|
+
[part~='date']:hover:not([part~='selected'])::before,
|
346
|
+
[part~='focused']:not([part~='selected'])::before {
|
347
|
+
display: none;
|
348
|
+
}
|
349
|
+
|
350
|
+
[part~='date']:not(:empty):not([part~='disabled']):active::before {
|
351
|
+
display: block;
|
352
|
+
}
|
353
|
+
|
354
|
+
[part~='date'][part~='selected']::before {
|
355
|
+
box-shadow: none;
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
359
|
+
/* Disabled */
|
360
|
+
|
361
|
+
:host([disabled]) * {
|
362
|
+
color: var(--lumo-disabled-text-color) !important;
|
363
|
+
}
|
364
|
+
`,{moduleId:"lumo-month-calendar"});const r=document.createElement("template");r.innerHTML="\n <style>\n @keyframes vaadin-date-picker-month-calendar-focus-date {\n 50% {\n box-shadow: 0 0 0 2px transparent;\n }\n }\n </style>\n",document.head.appendChild(r.content),s(1735);var o=s(2279);const l=a.iv`
|
365
|
+
:host {
|
366
|
+
outline: none;
|
367
|
+
}
|
368
|
+
|
369
|
+
[part='toggle-button']::before {
|
370
|
+
content: var(--lumo-icons-calendar);
|
371
|
+
}
|
372
|
+
|
373
|
+
[part='clear-button']::before {
|
374
|
+
content: var(--lumo-icons-cross);
|
375
|
+
}
|
376
|
+
|
377
|
+
@media (max-width: 420px), (max-height: 420px) {
|
378
|
+
[part='overlay-content'] {
|
379
|
+
height: 70vh;
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
:host([dir='rtl']) [part='input-field'] ::slotted(input) {
|
384
|
+
--_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
|
385
|
+
}
|
386
|
+
|
387
|
+
:host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {
|
388
|
+
--_lumo-text-field-overflow-mask-image: none;
|
389
|
+
}
|
390
|
+
`;(0,a.hC)("vaadin-date-picker",[o.J,l],{moduleId:"lumo-date-picker"}),s(3130);var h=s(8813),d=s(3373);let c;(0,a.hC)("vaadin-date-picker-overlay",a.iv`
|
391
|
+
[part='overlay'] {
|
392
|
+
display: flex;
|
393
|
+
flex: auto;
|
394
|
+
}
|
395
|
+
|
396
|
+
[part~='content'] {
|
397
|
+
flex: auto;
|
398
|
+
}
|
399
|
+
`,{moduleId:"vaadin-date-picker-overlay-styles"});class u extends((0,d.y)(h.a)){static get is(){return"vaadin-date-picker-overlay"}static get template(){return c||(c=super.template.cloneNode(!0),c.content.querySelector('[part~="overlay"]').removeAttribute("tabindex")),c}}customElements.define(u.is,u),s(7078);var _=s(4241),p=(s(7894),s(4933)),m=s(1014);function f(e,t,s,i,a){let n;a&&(n="object"==typeof s&&null!==s,n&&(i=e.__dataTemp[t]));let r=i!==s&&(i==i||s==s);return n&&r&&(e.__dataTemp[t]=s),r}const y=(0,m.o)((e=>class extends e{_shouldPropertyChange(e,t,s){return f(this,e,t,s,!0)}})),g=(0,m.o)((e=>class extends e{static get properties(){return{mutableData:Boolean}}_shouldPropertyChange(e,t,s){return f(this,e,t,s,this.mutableData)}}));y._mutablePropertyChange=f;var b=s(9387),v=s(1342);let D=null;function w(){return D}w.prototype=Object.create(HTMLTemplateElement.prototype,{constructor:{value:w,writable:!0}});const k=(0,p.q)(w),C=y(k),x=(0,p.q)(class{});class S extends x{constructor(e){super(),this._configureProperties(e),this.root=this._stampTemplate(this.__dataHost);let t=[];this.children=t;for(let e=this.root.firstChild;e;e=e.nextSibling)t.push(e),e.__templatizeInstance=this;this.__templatizeOwner&&this.__templatizeOwner.__hideTemplateChildren__&&this._showHideChildren(!0);let s=this.__templatizeOptions;(e&&s.instanceProps||!s.instanceProps)&&this._enableProperties()}_configureProperties(e){if(this.__templatizeOptions.forwardHostProp)for(let e in this.__hostProps)this._setPendingProperty(e,this.__dataHost["_host_"+e]);for(let t in e)this._setPendingProperty(t,e[t])}forwardHostProp(e,t){this._setPendingPropertyOrPath(e,t,!1,!0)&&this.__dataHost._enqueueClient(this)}_addEventListenerToNode(e,t,s){if(this._methodHost&&this.__templatizeOptions.parentModel)this._methodHost._addEventListenerToNode(e,t,(e=>{e.model=this,s(e)}));else{let i=this.__dataHost.__dataHost;i&&i._addEventListenerToNode(e,t,s)}}_showHideChildren(e){!function(e,t){for(let s=0;s<t.length;s++){let i=t[s];if(Boolean(e)!=Boolean(i.__hideTemplateChildren__))if(i.nodeType===Node.TEXT_NODE)e?(i.__polymerTextContent__=i.textContent,i.textContent=""):i.textContent=i.__polymerTextContent__;else if("slot"===i.localName)if(e)i.__polymerReplaced__=document.createComment("hidden-slot"),(0,v.r)((0,v.r)(i).parentNode).replaceChild(i.__polymerReplaced__,i);else{const e=i.__polymerReplaced__;e&&(0,v.r)((0,v.r)(e).parentNode).replaceChild(i,e)}else i.style&&(e?(i.__polymerDisplay__=i.style.display,i.style.display="none"):i.style.display=i.__polymerDisplay__);i.__hideTemplateChildren__=e,i._showHideChildren&&i._showHideChildren(e)}}(e,this.children)}_setUnmanagedPropertyToNode(e,t,s){e.__hideTemplateChildren__&&e.nodeType==Node.TEXT_NODE&&"textContent"==t?e.__polymerTextContent__=s:super._setUnmanagedPropertyToNode(e,t,s)}get parentModel(){let e=this.__parentModel;if(!e){let t;e=this;do{e=e.__dataHost.__dataHost}while((t=e.__templatizeOptions)&&!t.parentModel);this.__parentModel=e}return e}dispatchEvent(e){return!0}}S.prototype.__dataHost,S.prototype.__templatizeOptions,S.prototype._methodHost,S.prototype.__templatizeOwner,S.prototype.__hostProps;const E=y(S);function T(e){let t=e.__dataHost;return t&&t._methodHost||t}function P(e,t){return function(e,s,i){t.call(e.__templatizeOwner,s.substring(6),i[s])}}function M(e,t){return function(e,s,i){t.call(e.__templatizeOwner,e,s,i[s])}}function I(e,t,s){if(b.XN&&!T(e))throw new Error("strictTemplatePolicy: template owner not trusted");if(s=s||{},e.__templatizeOwner)throw new Error("A <template> can only be templatized once");e.__templatizeOwner=t;let i=(t?t.constructor:S)._parseTemplate(e),a=i.templatizeInstanceClass;a||(a=function(e,t,s){let i=s.mutableData?E:S;I.mixin&&(i=I.mixin(i));let a=class extends i{};return a.prototype.__templatizeOptions=s,a.prototype._bindTemplate(e),function(e,t,s,i){let a=s.hostProps||{};for(let t in i.instanceProps){delete a[t];let s=i.notifyInstanceProp;s&&e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:M(0,s)})}if(i.forwardHostProp&&t.__dataHost)for(let t in a)s.hasHostProps||(s.hasHostProps=!0),e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:function(e,t,s){e.__dataHost._setPendingPropertyOrPath("_host_"+t,s[t],!0,!0)}})}(a,e,t,s),a}(e,i,s),i.templatizeInstanceClass=a);const n=T(e);!function(e,t,s,i){let a=s.forwardHostProp;if(a&&t.hasHostProps){const n="template"==e.localName;let r=t.templatizeTemplateClass;if(!r){if(n){let e=s.mutableData?C:k;class i extends e{}r=t.templatizeTemplateClass=i}else{const s=e.constructor;class i extends s{}r=t.templatizeTemplateClass=i}let o=t.hostProps;for(let e in o)r.prototype._addPropertyEffect("_host_"+e,r.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,{fn:P(0,a)}),r.prototype._createNotifyingProperty("_host_"+e);b.a2&&i&&function(e,t,s){const i=s.constructor._properties,{propertyEffects:a}=e,{instanceProps:n}=t;for(let e in a)if(!(i[e]||n&&n[e])){const t=a[e];for(let s=0;s<t.length;s++){const{part:i}=t[s].info;if(!i.signature||!i.signature.static){console.warn(`Property '${e}' used in template but not declared in 'properties'; attribute will not be observed.`);break}}}}(t,s,i)}if(e.__dataProto&&Object.assign(e.__data,e.__dataProto),n)!function(e,t){D=e,Object.setPrototypeOf(e,t.prototype),new t,D=null}(e,r),e.__dataTemp={},e.__dataPending=null,e.__dataOld=null,e._enableProperties();else{Object.setPrototypeOf(e,r.prototype);const s=t.hostProps;for(let t in s)if(t="_host_"+t,t in e){const s=e[t];delete e[t],e.__data[t]=s}}}}(e,i,s,n);let r=class extends a{};return r.prototype._methodHost=n,r.prototype.__dataHost=e,r.prototype.__templatizeOwner=t,r.prototype.__hostProps=i.hostProps,r}var F=s(2224);class O{constructor(){this._asyncModule=null,this._callback=null,this._timer=null}setConfig(e,t){this._asyncModule=e,this._callback=t,this._timer=this._asyncModule.run((()=>{this._timer=null,A.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),A.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}static debounce(e,t,s){return e instanceof O?e._cancelAsync():e=new O,e.setConfig(t,s),e}}let A=new Set;const H=function(){const e=Boolean(A.size);return A.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e},Y=function(){let e,t;do{e=window.ShadyDOM&&ShadyDOM.flush(),window.ShadyCSS&&window.ShadyCSS.ScopingShim&&window.ShadyCSS.ScopingShim.flush(),t=H()}while(e||t)};var B=s(1446);let N=!1;const z=g(_.H3);class $ extends z{static get is(){return"dom-repeat"}static get template(){return null}static get properties(){return{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},itemsIndexAs:{type:String,value:"itemsIndex"},sort:{type:Function,observer:"__sortChanged"},filter:{type:Function,observer:"__filterChanged"},observe:{type:String,observer:"__observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:!b.dJ,readOnly:!0},initialCount:{type:Number},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"__computeFrameTime(targetFramerate)"},notifyDomChange:{type:Boolean},reuseChunkedInstances:{type:Boolean}}}static get observers(){return["__itemsChanged(items.*)"]}constructor(){super(),this.__instances=[],this.__renderDebouncer=null,this.__itemsIdxToInstIdx={},this.__chunkCount=null,this.__renderStartTime=null,this.__itemsArrayChanged=!1,this.__shouldMeasureChunk=!1,this.__shouldContinueChunking=!1,this.__chunkingId=0,this.__sortFn=null,this.__filterFn=null,this.__observePaths=null,this.__ctor=null,this.__isDetached=!0,this.template=null,this._templateInfo}disconnectedCallback(){super.disconnectedCallback(),this.__isDetached=!0;for(let e=0;e<this.__instances.length;e++)this.__detachInstance(e);this.__chunkingId&&cancelAnimationFrame(this.__chunkingId)}connectedCallback(){if(super.connectedCallback(),function(){if(b.nL&&!b.my){if(!N){N=!0;const e=document.createElement("style");e.textContent="dom-bind,dom-if,dom-repeat{display:none;}",document.head.appendChild(e)}return!0}return!1}()||(this.style.display="none"),this.__isDetached){this.__isDetached=!1;let e=(0,v.r)((0,v.r)(this).parentNode);for(let t=0;t<this.__instances.length;t++)this.__attachInstance(t,e);this.__chunkingId&&this.__render()}}__ensureTemplatized(){if(!this.__ctor){const e=this;let t=this.template=e._templateInfo?e:this.querySelector("template");if(!t){let e=new MutationObserver((()=>{if(!this.querySelector("template"))throw new Error("dom-repeat requires a <template> child");e.disconnect(),this.__render()}));return e.observe(this,{childList:!0}),!1}let s={};s[this.as]=!0,s[this.indexAs]=!0,s[this.itemsIndexAs]=!0,this.__ctor=I(t,this,{mutableData:this.mutableData,parentModel:!0,instanceProps:s,forwardHostProp:function(e,t){let s=this.__instances;for(let i,a=0;a<s.length&&(i=s[a]);a++)i.forwardHostProp(e,t)},notifyInstanceProp:function(e,t,s){if((0,B.wB)(this.as,t)){let i=e[this.itemsIndexAs];t==this.as&&(this.items[i]=s);let a=(0,B.Iu)(this.as,`${JSCompiler_renameProperty("items",this)}.${i}`,t);this.notifyPath(a,s)}}})}return!0}__getMethodHost(){return this.__dataHost._methodHost||this.__dataHost}__functionFromPropertyValue(e){if("string"==typeof e){let t=e,s=this.__getMethodHost();return function(){return s[t].apply(s,arguments)}}return e}__sortChanged(e){this.__sortFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__filterChanged(e){this.__filterFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__computeFrameTime(e){return Math.ceil(1e3/e)}__observeChanged(){this.__observePaths=this.observe&&this.observe.replace(".*",".").split(" ")}__handleObservedPaths(e){if(this.__sortFn||this.__filterFn)if(e){if(this.__observePaths){let t=this.__observePaths;for(let s=0;s<t.length;s++)0===e.indexOf(t[s])&&this.__debounceRender(this.__render,this.delay)}}else this.__debounceRender(this.__render,this.delay)}__itemsChanged(e){this.items&&!Array.isArray(this.items)&&console.warn("dom-repeat expected array for `items`, found",this.items),this.__handleItemPath(e.path,e.value)||("items"===e.path&&(this.__itemsArrayChanged=!0),this.__debounceRender(this.__render))}__debounceRender(e,t=0){var s;this.__renderDebouncer=O.debounce(this.__renderDebouncer,t>0?F.Wc.after(t):F.YA,e.bind(this)),s=this.__renderDebouncer,A.add(s)}render(){this.__debounceRender(this.__render),Y()}__render(){if(!this.__ensureTemplatized())return;let e=this.items||[];const t=this.__sortAndFilterItems(e),s=this.__calculateLimit(t.length);this.__updateInstances(e,s,t),this.initialCount&&(this.__shouldMeasureChunk||this.__shouldContinueChunking)&&(cancelAnimationFrame(this.__chunkingId),this.__chunkingId=requestAnimationFrame((()=>{this.__chunkingId=null,this.__continueChunking()}))),this._setRenderedItemCount(this.__instances.length),b.dJ&&!this.notifyDomChange||this.dispatchEvent(new CustomEvent("dom-change",{bubbles:!0,composed:!0}))}__sortAndFilterItems(e){let t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]=s;return this.__filterFn&&(t=t.filter(((t,s,i)=>this.__filterFn(e[t],s,i)))),this.__sortFn&&t.sort(((t,s)=>this.__sortFn(e[t],e[s]))),t}__calculateLimit(e){let t=e;const s=this.__instances.length;if(this.initialCount){let i;!this.__chunkCount||this.__itemsArrayChanged&&!this.reuseChunkedInstances?(t=Math.min(e,this.initialCount),i=Math.max(t-s,0),this.__chunkCount=i||1):(i=Math.min(Math.max(e-s,0),this.__chunkCount),t=Math.min(s+i,e)),this.__shouldMeasureChunk=i===this.__chunkCount,this.__shouldContinueChunking=t<e,this.__renderStartTime=performance.now()}return this.__itemsArrayChanged=!1,t}__continueChunking(){if(this.__shouldMeasureChunk){const e=performance.now()-this.__renderStartTime,t=this._targetFrameTime/e;this.__chunkCount=Math.round(this.__chunkCount*t)||1}this.__shouldContinueChunking&&this.__debounceRender(this.__render)}__updateInstances(e,t,s){const i=this.__itemsIdxToInstIdx={};let a;for(a=0;a<t;a++){let t=this.__instances[a],n=s[a],r=e[n];i[n]=a,t?(t._setPendingProperty(this.as,r),t._setPendingProperty(this.indexAs,a),t._setPendingProperty(this.itemsIndexAs,n),t._flushProperties()):this.__insertInstance(r,a,n)}for(let e=this.__instances.length-1;e>=a;e--)this.__detachAndRemoveInstance(e)}__detachInstance(e){let t=this.__instances[e];const s=(0,v.r)(t.root);for(let e=0;e<t.children.length;e++){let i=t.children[e];s.appendChild(i)}return t}__attachInstance(e,t){let s=this.__instances[e];t.insertBefore(s.root,this)}__detachAndRemoveInstance(e){this.__detachInstance(e),this.__instances.splice(e,1)}__stampInstance(e,t,s){let i={};return i[this.as]=e,i[this.indexAs]=t,i[this.itemsIndexAs]=s,new this.__ctor(i)}__insertInstance(e,t,s){const i=this.__stampInstance(e,t,s);let a=this.__instances[t+1],n=a?a.children[0]:this;return(0,v.r)((0,v.r)(this).parentNode).insertBefore(i.root,n),this.__instances[t]=i,i}_showHideChildren(e){for(let t=0;t<this.__instances.length;t++)this.__instances[t]._showHideChildren(e)}__handleItemPath(e,t){let s=e.slice(6),i=s.indexOf("."),a=i<0?s:s.substring(0,i);if(a==parseInt(a,10)){let e=i<0?"":s.substring(i+1);this.__handleObservedPaths(e);let n=this.__itemsIdxToInstIdx[a],r=this.__instances[n];if(r){let s=this.as+(e?"."+e:"");r._setPendingPropertyOrPath(s,t,!1,!0),r._flushProperties()}return!0}}itemForElement(e){let t=this.modelForElement(e);return t&&t[this.as]}indexForElement(e){let t=this.modelForElement(e);return t&&t[this.indexAs]}modelForElement(e){return function(e,t){let s;for(;t;)if(s=t.__dataHost?t:t.__templatizeInstance){if(s.__dataHost==e)return s;t=s.__dataHost}else t=(0,v.r)(t).parentNode;return null}(this.template,e)}}customElements.define($.is,$);var W=s(2527),V=s(9109);function L(e,t){return e instanceof Date&&t instanceof Date&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function R(e,t,s){return(!t||e>=t)&&(!s||e<=s)}function q(e,t){return t.filter((e=>void 0!==e)).reduce(((t,s)=>s?t?Math.abs(e.getTime()-s.getTime())<Math.abs(t.getTime()-e.getTime())?s:t:s:t))}function j(e){return{day:e.getDate(),month:e.getMonth(),year:e.getFullYear()}}function K(e){const t=new Date,s=new Date(t);return s.setDate(1),s.setMonth(parseInt(e)+t.getMonth()),s}function X(e){const t=/^([-+]\d{1}|\d{2,4}|[-+]\d{6})-(\d{1,2})-(\d{1,2})$/u.exec(e);if(!t)return;const s=new Date(0,0);return s.setFullYear(parseInt(t[1],10)),s.setMonth(parseInt(t[2],10)-1),s.setDate(parseInt(t[3],10)),s}class U extends((0,W.W)((0,a.Tb)(_.H3))){static get template(){return _.dy`
|
400
|
+
<style>
|
401
|
+
:host {
|
402
|
+
display: block;
|
403
|
+
}
|
404
|
+
|
405
|
+
#monthGrid {
|
406
|
+
width: 100%;
|
407
|
+
border-collapse: collapse;
|
408
|
+
}
|
409
|
+
|
410
|
+
#days-container tr,
|
411
|
+
#weekdays-container tr {
|
412
|
+
display: flex;
|
413
|
+
}
|
414
|
+
|
415
|
+
[part~='date'] {
|
416
|
+
outline: none;
|
417
|
+
}
|
418
|
+
|
419
|
+
[part~='disabled'] {
|
420
|
+
pointer-events: none;
|
421
|
+
}
|
422
|
+
|
423
|
+
[part='week-number'][hidden],
|
424
|
+
[part='weekday'][hidden] {
|
425
|
+
display: none;
|
426
|
+
}
|
427
|
+
|
428
|
+
[part='weekday'],
|
429
|
+
[part~='date'] {
|
430
|
+
width: calc(100% / 7);
|
431
|
+
padding: 0;
|
432
|
+
font-weight: normal;
|
433
|
+
}
|
434
|
+
|
435
|
+
[part='weekday']:empty,
|
436
|
+
[part='week-number'] {
|
437
|
+
width: 12.5%;
|
438
|
+
flex-shrink: 0;
|
439
|
+
padding: 0;
|
440
|
+
}
|
441
|
+
|
442
|
+
:host([week-numbers]) [part='weekday']:not(:empty),
|
443
|
+
:host([week-numbers]) [part~='date'] {
|
444
|
+
width: 12.5%;
|
445
|
+
}
|
446
|
+
</style>
|
447
|
+
|
448
|
+
<div part="month-header" id="month-header" aria-hidden="true">[[_getTitle(month, i18n.monthNames)]]</div>
|
449
|
+
<table
|
450
|
+
id="monthGrid"
|
451
|
+
role="grid"
|
452
|
+
aria-labelledby="month-header"
|
453
|
+
on-touchend="_preventDefault"
|
454
|
+
on-touchstart="_onMonthGridTouchStart"
|
455
|
+
>
|
456
|
+
<thead id="weekdays-container">
|
457
|
+
<tr role="row" part="weekdays">
|
458
|
+
<th
|
459
|
+
part="weekday"
|
460
|
+
aria-hidden="true"
|
461
|
+
hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
|
462
|
+
></th>
|
463
|
+
<template
|
464
|
+
is="dom-repeat"
|
465
|
+
items="[[_getWeekDayNames(i18n.weekdays, i18n.weekdaysShort, showWeekNumbers, i18n.firstDayOfWeek)]]"
|
466
|
+
>
|
467
|
+
<th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]" aria-hidden="true">
|
468
|
+
[[item.weekDayShort]]
|
469
|
+
</th>
|
470
|
+
</template>
|
471
|
+
</tr>
|
472
|
+
</thead>
|
473
|
+
<tbody id="days-container">
|
474
|
+
<template is="dom-repeat" items="[[_weeks]]" as="week">
|
475
|
+
<tr role="row">
|
476
|
+
<td
|
477
|
+
part="week-number"
|
478
|
+
aria-hidden="true"
|
479
|
+
hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
|
480
|
+
>
|
481
|
+
[[__getWeekNumber(week)]]
|
482
|
+
</td>
|
483
|
+
<template is="dom-repeat" items="[[week]]">
|
484
|
+
<td
|
485
|
+
role="gridcell"
|
486
|
+
part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate)]]"
|
487
|
+
date="[[item]]"
|
488
|
+
tabindex$="[[__getDayTabindex(item, focusedDate)]]"
|
489
|
+
disabled$="[[__isDayDisabled(item, minDate, maxDate)]]"
|
490
|
+
aria-selected$="[[__getDayAriaSelected(item, selectedDate)]]"
|
491
|
+
aria-disabled$="[[__getDayAriaDisabled(item, minDate, maxDate)]]"
|
492
|
+
aria-label$="[[__getDayAriaLabel(item)]]"
|
493
|
+
>[[_getDate(item)]]</td
|
494
|
+
>
|
495
|
+
</template>
|
496
|
+
</tr>
|
497
|
+
</template>
|
498
|
+
</tbody>
|
499
|
+
</table>
|
500
|
+
`}static get is(){return"vaadin-month-calendar"}static get properties(){return{month:{type:Date,value:new Date},selectedDate:{type:Date,notify:!0},focusedDate:Date,showWeekNumbers:{type:Boolean,value:!1},i18n:{type:Object},ignoreTaps:Boolean,_notTapping:Boolean,minDate:{type:Date,value:null},maxDate:{type:Date,value:null},_days:{type:Array,computed:"_getDays(month, i18n.firstDayOfWeek, minDate, maxDate)"},_weeks:{type:Array,computed:"_getWeeks(_days)"},disabled:{type:Boolean,reflectToAttribute:!0,computed:"_isDisabled(month, minDate, maxDate)"}}}static get observers(){return["_showWeekNumbersChanged(showWeekNumbers, i18n.firstDayOfWeek)","__focusedDateChanged(focusedDate, _days)"]}get focusableDateElement(){return[...this.shadowRoot.querySelectorAll("[part~=date]")].find((e=>L(e.date,this.focusedDate)))}ready(){super.ready(),(0,V.NH)(this.$.monthGrid,"tap",this._handleTap.bind(this))}_isDisabled(e,t,s){const i=new Date(0,0);i.setFullYear(e.getFullYear()),i.setMonth(e.getMonth()),i.setDate(1);const a=new Date(0,0);return a.setFullYear(e.getFullYear()),a.setMonth(e.getMonth()+1),a.setDate(0),!(t&&s&&t.getMonth()===s.getMonth()&&t.getMonth()===e.getMonth()&&s.getDate()-t.getDate()>=0||R(i,t,s)||R(a,t,s))}_getTitle(e,t){if(void 0!==e&&void 0!==t)return this.i18n.formatTitle(t[e.getMonth()],e.getFullYear())}_onMonthGridTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300)}_dateAdd(e,t){e.setDate(e.getDate()+t)}_applyFirstDayOfWeek(e,t){if(void 0!==e&&void 0!==t)return e.slice(t).concat(e.slice(0,t))}_getWeekDayNames(e,t,s,i){if(void 0!==e&&void 0!==t&&void 0!==s&&void 0!==i)return e=this._applyFirstDayOfWeek(e,i),t=this._applyFirstDayOfWeek(t,i),e.map(((e,s)=>({weekDay:e,weekDayShort:t[s]})))}__focusedDateChanged(e,t){t.some((t=>L(t,e)))?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")}_getDate(e){return e?e.getDate():""}_showWeekNumbersChanged(e,t){e&&1===t?this.setAttribute("week-numbers",""):this.removeAttribute("week-numbers")}_showWeekSeparator(e,t){return e&&1===t}_isToday(e){return L(new Date,e)}_getDays(e,t){if(void 0===e||void 0===t)return;const s=new Date(0,0);for(s.setFullYear(e.getFullYear()),s.setMonth(e.getMonth()),s.setDate(1);s.getDay()!==t;)this._dateAdd(s,-1);const i=[],a=s.getMonth(),n=e.getMonth();for(;s.getMonth()===n||s.getMonth()===a;)i.push(s.getMonth()===n?new Date(s.getTime()):null),this._dateAdd(s,1);return i}_getWeeks(e){return e.reduce(((e,t,s)=>(s%7==0&&e.push([]),e[e.length-1].push(t),e)),[])}_handleTap(e){this.ignoreTaps||this._notTapping||!e.target.date||e.target.hasAttribute("disabled")||(this.selectedDate=e.target.date,this.dispatchEvent(new CustomEvent("date-tap",{detail:{date:e.target.date},bubbles:!0,composed:!0})))}_preventDefault(e){e.preventDefault()}__getDatePart(e,t,s,i,a){const n=["date"];return this.__isDayDisabled(e,i,a)&&n.push("disabled"),this.__isDayFocused(e,t)&&n.push("focused"),this.__isDaySelected(e,s)&&n.push("selected"),this._isToday(e)&&n.push("today"),n.join(" ")}__getWeekNumber(e){return function(e){let t=e.getDay();0===t&&(t=7);const s=4-t,i=new Date(e.getTime()+24*s*3600*1e3),a=new Date(0,0);a.setFullYear(i.getFullYear());const n=i.getTime()-a.getTime(),r=Math.round(n/864e5);return Math.floor(r/7+1)}(e.reduce(((e,t)=>!e&&t?t:e)))}__isDayFocused(e,t){return L(e,t)}__isDaySelected(e,t){return L(e,t)}__getDayAriaSelected(e,t){if(this.__isDaySelected(e,t))return"true"}__isDayDisabled(e,t,s){return!R(e,t,s)}__getDayAriaDisabled(e,t,s){if(void 0!==e&&void 0!==t&&void 0!==s)return this.__isDayDisabled(e,t,s)?"true":void 0}__getDayAriaLabel(e){if(!e)return"";let t=`${this._getDate(e)} ${this.i18n.monthNames[e.getMonth()]} ${e.getFullYear()}, ${this.i18n.weekdays[e.getDay()]}`;return this._isToday(e)&&(t+=`, ${this.i18n.today}`),t}__getDayTabindex(e,t){return this.__isDayFocused(e,t)?"0":"-1"}}customElements.define(U.is,U);var Q=s(1121),J=s(2223),G=s(7913),Z=s(1037),ee=s(6139),te=s(3971);class se extends _.H3{static get template(){return _.dy`
|
501
|
+
<style>
|
502
|
+
:host {
|
503
|
+
display: block;
|
504
|
+
overflow: hidden;
|
505
|
+
height: 500px;
|
506
|
+
}
|
507
|
+
|
508
|
+
#scroller {
|
509
|
+
position: relative;
|
510
|
+
height: 100%;
|
511
|
+
overflow: auto;
|
512
|
+
outline: none;
|
513
|
+
margin-right: -40px;
|
514
|
+
-webkit-overflow-scrolling: touch;
|
515
|
+
overflow-x: hidden;
|
516
|
+
}
|
517
|
+
|
518
|
+
#scroller.notouchscroll {
|
519
|
+
-webkit-overflow-scrolling: auto;
|
520
|
+
}
|
521
|
+
|
522
|
+
#scroller::-webkit-scrollbar {
|
523
|
+
display: none;
|
524
|
+
}
|
525
|
+
|
526
|
+
.buffer {
|
527
|
+
position: absolute;
|
528
|
+
width: var(--vaadin-infinite-scroller-buffer-width, 100%);
|
529
|
+
box-sizing: border-box;
|
530
|
+
padding-right: 40px;
|
531
|
+
top: var(--vaadin-infinite-scroller-buffer-offset, 0);
|
532
|
+
animation: fadein 0.2s;
|
533
|
+
}
|
534
|
+
|
535
|
+
@keyframes fadein {
|
536
|
+
from {
|
537
|
+
opacity: 0;
|
538
|
+
}
|
539
|
+
to {
|
540
|
+
opacity: 1;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
</style>
|
544
|
+
|
545
|
+
<div id="scroller" on-scroll="_scroll">
|
546
|
+
<div class="buffer"></div>
|
547
|
+
<div class="buffer"></div>
|
548
|
+
<div id="fullHeight"></div>
|
549
|
+
</div>
|
550
|
+
`}static get properties(){return{bufferSize:{type:Number,value:20},_initialScroll:{value:5e5},_initialIndex:{value:0},_buffers:Array,_preventScrollEvent:Boolean,_mayHaveMomentum:Boolean,_initialized:Boolean,active:{type:Boolean,observer:"_activated"}}}get bufferOffset(){return this._buffers[0].offsetTop}get itemHeight(){if(!this._itemHeightVal){const e=getComputedStyle(this).getPropertyValue("--vaadin-infinite-scroller-item-height"),t="background-position";this.$.fullHeight.style.setProperty(t,e);const s=getComputedStyle(this.$.fullHeight).getPropertyValue(t);this.$.fullHeight.style.removeProperty(t),this._itemHeightVal=parseFloat(s)}return this._itemHeightVal}get _bufferHeight(){return this.itemHeight*this.bufferSize}get position(){return(this.$.scroller.scrollTop-this._buffers[0].translateY)/this.itemHeight+this._firstIndex}set position(e){this._preventScrollEvent=!0,e>this._firstIndex&&e<this._firstIndex+2*this.bufferSize?this.$.scroller.scrollTop=this.itemHeight*(e-this._firstIndex)+this._buffers[0].translateY:(this._initialIndex=~~e,this._reset(),this._scrollDisabled=!0,this.$.scroller.scrollTop+=e%1*this.itemHeight,this._scrollDisabled=!1),this._mayHaveMomentum&&(this.$.scroller.classList.add("notouchscroll"),this._mayHaveMomentum=!1,setTimeout((()=>{this.$.scroller.classList.remove("notouchscroll")}),10))}ready(){super.ready(),this._buffers=[...this.shadowRoot.querySelectorAll(".buffer")],this.$.fullHeight.style.height=2*this._initialScroll+"px",Z.vU&&(this.$.scroller.tabIndex=-1)}forceUpdate(){this._debouncerUpdateClones&&(this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(),this._debouncerUpdateClones.cancel())}_createElement(){}_updateElement(e,t){}_activated(e){e&&!this._initialized&&(this._createPool(),this._initialized=!0)}_finishInit(){this._initDone||(this._buffers.forEach((e=>{[...e.children].forEach((e=>{this._ensureStampedInstance(e._itemWrapper)}))})),this._buffers[0].translateY||this._reset(),this._initDone=!0,this.dispatchEvent(new CustomEvent("init-done")))}_translateBuffer(e){const t=e?1:0;this._buffers[t].translateY=this._buffers[t?0:1].translateY+this._bufferHeight*(t?-1:1),this._buffers[t].style.transform=`translate3d(0, ${this._buffers[t].translateY}px, 0)`,this._buffers[t].updated=!1,this._buffers.reverse()}_scroll(){if(this._scrollDisabled)return;const e=this.$.scroller.scrollTop;(e<this._bufferHeight||e>2*this._initialScroll-this._bufferHeight)&&(this._initialIndex=~~this.position,this._reset());const t=this.itemHeight+this.bufferOffset,s=e>this._buffers[1].translateY+t,i=e<this._buffers[0].translateY+t;(s||i)&&(this._translateBuffer(i),this._updateClones()),this._preventScrollEvent||(this.dispatchEvent(new CustomEvent("custom-scroll",{bubbles:!1,composed:!0})),this._mayHaveMomentum=!0),this._preventScrollEvent=!1,this._debouncerScrollFinish=ee.dx.debounce(this._debouncerScrollFinish,G.Wc.after(200),(()=>{const e=this.$.scroller.getBoundingClientRect();this._isVisible(this._buffers[0],e)||this._isVisible(this._buffers[1],e)||(this.position=this.position)}))}_reset(){this._scrollDisabled=!0,this.$.scroller.scrollTop=this._initialScroll,this._buffers[0].translateY=this._initialScroll-this._bufferHeight,this._buffers[1].translateY=this._initialScroll,this._buffers.forEach((e=>{e.style.transform=`translate3d(0, ${e.translateY}px, 0)`})),this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(!0),this._debouncerUpdateClones=ee.dx.debounce(this._debouncerUpdateClones,G.Wc.after(200),(()=>{this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones()})),this._scrollDisabled=!1}_createPool(){const e=this.getBoundingClientRect();this._buffers.forEach((t=>{for(let s=0;s<this.bufferSize;s++){const s=document.createElement("div");s.style.height=`${this.itemHeight}px`,s.instance={};const i=`vaadin-infinite-scroller-item-content-${(0,te.l)()}`,a=document.createElement("slot");a.setAttribute("name",i),a._itemWrapper=s,t.appendChild(a),s.setAttribute("slot",i),this.appendChild(s),this._isVisible(s,e)&&this._ensureStampedInstance(s)}})),(0,J.T8)(this,(()=>{this._finishInit()}))}_ensureStampedInstance(e){if(e.firstElementChild)return;const t=e.instance;e.instance=this._createElement(),e.appendChild(e.instance),Object.keys(t).forEach((s=>{e.instance.set(s,t[s])}))}_updateClones(e){this._firstIndex=~~((this._buffers[0].translateY-this._initialScroll)/this.itemHeight)+this._initialIndex;const t=e?this.$.scroller.getBoundingClientRect():void 0;this._buffers.forEach(((s,i)=>{if(!s.updated){const a=this._firstIndex+this.bufferSize*i;[...s.children].forEach(((s,i)=>{const n=s._itemWrapper;e&&!this._isVisible(n,t)||this._updateElement(n.instance,a+i)})),s.updated=!0}}))}_isVisible(e,t){const s=e.getBoundingClientRect();return s.bottom>t.top&&s.top<t.bottom}}const ie=Q.d`
|
551
|
+
<style>
|
552
|
+
:host {
|
553
|
+
--vaadin-infinite-scroller-item-height: 270px;
|
554
|
+
position: absolute;
|
555
|
+
top: 0;
|
556
|
+
left: 0;
|
557
|
+
right: 0;
|
558
|
+
bottom: 0;
|
559
|
+
height: 100%;
|
560
|
+
}
|
561
|
+
</style>
|
562
|
+
`;let ae;class ne extends se{static get is(){return"vaadin-date-picker-month-scroller"}static get template(){return ae||(ae=super.template.cloneNode(!0),ae.content.appendChild(ie.content.cloneNode(!0))),ae}static get properties(){return{bufferSize:{type:Number,value:3}}}_createElement(){return document.createElement("vaadin-month-calendar")}_updateElement(e,t){e.month=K(t)}}customElements.define(ne.is,ne);const re=Q.d`
|
563
|
+
<style>
|
564
|
+
:host {
|
565
|
+
--vaadin-infinite-scroller-item-height: 80px;
|
566
|
+
width: 50px;
|
567
|
+
display: block;
|
568
|
+
height: 100%;
|
569
|
+
position: absolute;
|
570
|
+
right: 0;
|
571
|
+
transform: translateX(100%);
|
572
|
+
-webkit-tap-highlight-color: transparent;
|
573
|
+
-webkit-user-select: none;
|
574
|
+
-moz-user-select: none;
|
575
|
+
user-select: none;
|
576
|
+
/* Center the year scroller position. */
|
577
|
+
--vaadin-infinite-scroller-buffer-offset: 50%;
|
578
|
+
}
|
579
|
+
|
580
|
+
:host::before {
|
581
|
+
content: '';
|
582
|
+
display: block;
|
583
|
+
background: transparent;
|
584
|
+
width: 0;
|
585
|
+
height: 0;
|
586
|
+
position: absolute;
|
587
|
+
left: 0;
|
588
|
+
top: 50%;
|
589
|
+
transform: translateY(-50%);
|
590
|
+
border-width: 6px;
|
591
|
+
border-style: solid;
|
592
|
+
border-color: transparent;
|
593
|
+
border-left-color: #000;
|
594
|
+
}
|
595
|
+
</style>
|
596
|
+
`;let oe;class le extends se{static get is(){return"vaadin-date-picker-year-scroller"}static get template(){return oe||(oe=super.template.cloneNode(!0),oe.content.appendChild(re.content.cloneNode(!0))),oe}static get properties(){return{bufferSize:{type:Number,value:12}}}_createElement(){return document.createElement("vaadin-date-picker-year")}_updateElement(e,t){e.year=this._yearAfterXYears(t)}_yearAfterXYears(e){const t=new Date,s=new Date(t);return s.setFullYear(parseInt(e)+t.getFullYear()),s.getFullYear()}}customElements.define(le.is,le);class he extends((0,a.Tb)(_.H3)){static get is(){return"vaadin-date-picker-year"}static get template(){return _.dy`
|
597
|
+
<style>
|
598
|
+
:host {
|
599
|
+
display: block;
|
600
|
+
height: 100%;
|
601
|
+
}
|
602
|
+
</style>
|
603
|
+
<div part="year-number">[[year]]</div>
|
604
|
+
<div part="year-separator" aria-hidden="true"></div>
|
605
|
+
`}static get properties(){return{year:{type:String},selectedDate:{type:Object}}}static get observers(){return["__updateSelected(year, selectedDate)"]}__updateSelected(e,t){this.toggleAttribute("selected",t&&t.getFullYear()===e),this.toggleAttribute("current",e===(new Date).getFullYear())}}customElements.define(he.is,he);var de=s(6155),ce=s(1914);class ue{constructor(e,t){this.query=e,this.callback=t,this._boundQueryHandler=this._queryHandler.bind(this)}hostConnected(){this._removeListener(),this._mediaQuery=window.matchMedia(this.query),this._addListener(),this._queryHandler(this._mediaQuery)}hostDisconnected(){this._removeListener()}_addListener(){this._mediaQuery&&this._mediaQuery.addListener(this._boundQueryHandler)}_removeListener(){this._mediaQuery&&this._mediaQuery.removeListener(this._boundQueryHandler),this._mediaQuery=null}_queryHandler(e){"function"==typeof this.callback&&this.callback(e.matches)}}var _e=s(4271);class pe extends((0,de.k)((0,a.Tb)((0,ce.U)(_.H3)))){static get template(){return _.dy`
|
606
|
+
<style>
|
607
|
+
:host {
|
608
|
+
display: flex;
|
609
|
+
flex-direction: column;
|
610
|
+
height: 100%;
|
611
|
+
width: 100%;
|
612
|
+
outline: none;
|
613
|
+
}
|
614
|
+
|
615
|
+
[part='overlay-header'] {
|
616
|
+
display: flex;
|
617
|
+
flex-shrink: 0;
|
618
|
+
flex-wrap: nowrap;
|
619
|
+
align-items: center;
|
620
|
+
}
|
621
|
+
|
622
|
+
:host(:not([fullscreen])) [part='overlay-header'] {
|
623
|
+
display: none;
|
624
|
+
}
|
625
|
+
|
626
|
+
[part='label'] {
|
627
|
+
flex-grow: 1;
|
628
|
+
}
|
629
|
+
|
630
|
+
[hidden] {
|
631
|
+
display: none !important;
|
632
|
+
}
|
633
|
+
|
634
|
+
[part='years-toggle-button'] {
|
635
|
+
display: flex;
|
636
|
+
}
|
637
|
+
|
638
|
+
#scrollers {
|
639
|
+
display: flex;
|
640
|
+
height: 100%;
|
641
|
+
width: 100%;
|
642
|
+
position: relative;
|
643
|
+
overflow: hidden;
|
644
|
+
}
|
645
|
+
|
646
|
+
:host([desktop]) ::slotted([slot='months']) {
|
647
|
+
right: 50px;
|
648
|
+
transform: none !important;
|
649
|
+
}
|
650
|
+
|
651
|
+
:host([desktop]) ::slotted([slot='years']) {
|
652
|
+
transform: none !important;
|
653
|
+
}
|
654
|
+
|
655
|
+
:host(.animate) ::slotted([slot='months']),
|
656
|
+
:host(.animate) ::slotted([slot='years']) {
|
657
|
+
transition: all 200ms;
|
658
|
+
}
|
659
|
+
|
660
|
+
[part='toolbar'] {
|
661
|
+
display: flex;
|
662
|
+
justify-content: space-between;
|
663
|
+
z-index: 2;
|
664
|
+
flex-shrink: 0;
|
665
|
+
}
|
666
|
+
</style>
|
667
|
+
|
668
|
+
<div part="overlay-header" on-touchend="_preventDefault" aria-hidden="true">
|
669
|
+
<div part="label">[[_formatDisplayed(selectedDate, i18n.formatDate, label)]]</div>
|
670
|
+
<div part="clear-button" hidden$="[[!selectedDate]]"></div>
|
671
|
+
<div part="toggle-button"></div>
|
672
|
+
|
673
|
+
<div part="years-toggle-button" hidden$="[[_desktopMode]]" aria-hidden="true">
|
674
|
+
[[_yearAfterXMonths(_visibleMonthIndex)]]
|
675
|
+
</div>
|
676
|
+
</div>
|
677
|
+
|
678
|
+
<div id="scrollers">
|
679
|
+
<slot name="months"></slot>
|
680
|
+
<slot name="years"></slot>
|
681
|
+
</div>
|
682
|
+
|
683
|
+
<div on-touchend="_preventDefault" role="toolbar" part="toolbar">
|
684
|
+
<slot name="today-button"></slot>
|
685
|
+
<slot name="cancel-button"></slot>
|
686
|
+
</div>
|
687
|
+
`}static get is(){return"vaadin-date-picker-overlay-content"}static get properties(){return{scrollDuration:{type:Number,value:300},selectedDate:{type:Date,value:null},focusedDate:{type:Date,notify:!0,observer:"_focusedDateChanged"},_focusedMonthDate:Number,initialPosition:{type:Date,observer:"_initialPositionChanged"},_originDate:{value:new Date},_visibleMonthIndex:Number,_desktopMode:{type:Boolean,observer:"_desktopModeChanged"},_desktopMediaQuery:{type:String,value:"(min-width: 375px)"},_translateX:{observer:"_translateXChanged"},_yearScrollerWidth:{value:50},i18n:{type:Object},showWeekNumbers:{type:Boolean,value:!1},_ignoreTaps:Boolean,_notTapping:Boolean,minDate:Date,maxDate:Date,label:String,_cancelButton:{type:Object},_todayButton:{type:Object},calendars:{type:Array,value:()=>[]},years:{type:Array,value:()=>[]}}}static get observers(){return["__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme)","__updateCancelButton(_cancelButton, i18n)","__updateTodayButton(_todayButton, i18n, minDate, maxDate)","__updateYears(years, selectedDate, _theme)"]}get __useSubMonthScrolling(){return this._monthScroller.clientHeight<this._monthScroller.itemHeight+this._monthScroller.bufferOffset}get focusableDateElement(){return this.calendars.map((e=>e.focusableDateElement)).find(Boolean)}ready(){super.ready(),this.setAttribute("role","dialog"),(0,V.NH)(this.$.scrollers,"track",this._track.bind(this)),(0,V.NH)(this.shadowRoot.querySelector('[part="clear-button"]'),"tap",this._clear.bind(this)),(0,V.NH)(this.shadowRoot.querySelector('[part="toggle-button"]'),"tap",this._cancel.bind(this)),(0,V.NH)(this.shadowRoot.querySelector('[part="years-toggle-button"]'),"tap",this._toggleYearScroller.bind(this)),this.addController(new ue(this._desktopMediaQuery,(e=>{this._desktopMode=e}))),this.addController(new _e.n(this,"today-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onTodayButtonKeyDown(e))),(0,V.NH)(e,"tap",this._onTodayTap.bind(this)),this._todayButton=e}})),this.addController(new _e.n(this,"cancel-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onCancelButtonKeyDown(e))),(0,V.NH)(e,"tap",this._cancel.bind(this)),this._cancelButton=e}})),this.__initMonthScroller(),this.__initYearScroller()}connectedCallback(){super.connectedCallback(),this._closeYearScroller(),this._toggleAnimateClass(!0),(0,V.BP)(this.$.scrollers,"pan-y")}focusCancel(){this._cancelButton.focus()}scrollToDate(e,t){const s=this.__useSubMonthScrolling?this._calculateWeekScrollOffset(e):0;this._scrollToPosition(this._differenceInMonths(e,this._originDate)+s,t),this._monthScroller.forceUpdate()}__initMonthScroller(){this.addController(new _e.n(this,"months","vaadin-date-picker-month-scroller",{observe:!1,initializer:e=>{e.addEventListener("custom-scroll",(()=>{this._onMonthScroll()})),e.addEventListener("touchstart",(()=>{this._onMonthScrollTouchStart()})),e.addEventListener("keydown",(e=>{this.__onMonthCalendarKeyDown(e)})),e.addEventListener("init-done",(()=>{const e=[...this.querySelectorAll("vaadin-month-calendar")];e.forEach((e=>{e.addEventListener("selected-date-changed",(e=>{this.selectedDate=e.detail.value}))})),this.calendars=e})),this._monthScroller=e}}))}__initYearScroller(){this.addController(new _e.n(this,"years","vaadin-date-picker-year-scroller",{observe:!1,initializer:e=>{e.setAttribute("aria-hidden","true"),(0,V.NH)(e,"tap",(e=>{this._onYearTap(e)})),e.addEventListener("custom-scroll",(()=>{this._onYearScroll()})),e.addEventListener("touchstart",(()=>{this._onYearScrollTouchStart()})),e.addEventListener("init-done",(()=>{this.years=[...this.querySelectorAll("vaadin-date-picker-year")]})),this._yearScroller=e}}))}__updateCancelButton(e,t){e&&(e.textContent=t&&t.cancel)}__updateTodayButton(e,t,s,i){e&&(e.textContent=t&&t.today,e.disabled=!this._isTodayAllowed(s,i))}__updateCalendars(e,t,s,i,a,n,r,o,l){e&&e.length&&e.forEach((e=>{e.setProperties({i18n:t,minDate:s,maxDate:i,focusedDate:n,selectedDate:a,showWeekNumbers:r,ignoreTaps:o}),l?e.setAttribute("theme",l):e.removeAttribute("theme")}))}__updateYears(e,t,s){e&&e.length&&e.forEach((e=>{e.selectedDate=t,s?e.setAttribute("theme",s):e.removeAttribute("theme")}))}_selectDate(e){this.selectedDate=e,this.dispatchEvent(new CustomEvent("date-selected",{detail:{date:e},bubbles:!0,composed:!0}))}_desktopModeChanged(e){this.toggleAttribute("desktop",e)}_focusedDateChanged(e){this.revealDate(e)}revealDate(e,t=!0){if(!e)return;const s=this._differenceInMonths(e,this._originDate);if(this.__useSubMonthScrolling){const i=this._calculateWeekScrollOffset(e);return void this._scrollToPosition(s+i,t)}const i=this._monthScroller.position>s,a=Math.max(this._monthScroller.itemHeight,this._monthScroller.clientHeight-2*this._monthScroller.bufferOffset)/this._monthScroller.itemHeight,n=this._monthScroller.position+a-1<s;i?this._scrollToPosition(s,t):n&&this._scrollToPosition(s-a+1,t)}_calculateWeekScrollOffset(e){const t=new Date(0,0);t.setFullYear(e.getFullYear()),t.setMonth(e.getMonth()),t.setDate(1);let s=0;for(;t.getDate()<e.getDate();)t.setDate(t.getDate()+1),t.getDay()===this.i18n.firstDayOfWeek&&(s+=1);return s/6}_initialPositionChanged(e){this._monthScroller&&this._yearScroller&&(this._monthScroller.active=!0,this._yearScroller.active=!0),this.scrollToDate(e)}_repositionYearScroller(){const e=this._monthScroller.position;this._visibleMonthIndex=Math.floor(e),this._yearScroller.position=(e+this._originDate.getMonth())/12}_repositionMonthScroller(){this._monthScroller.position=12*this._yearScroller.position-this._originDate.getMonth(),this._visibleMonthIndex=Math.floor(this._monthScroller.position)}_onMonthScroll(){this._repositionYearScroller(),this._doIgnoreTaps()}_onYearScroll(){this._repositionMonthScroller(),this._doIgnoreTaps()}_onYearScrollTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300),this._repositionMonthScroller()}_onMonthScrollTouchStart(){this._repositionYearScroller()}_doIgnoreTaps(){this._ignoreTaps=!0,this._debouncer=ee.dx.debounce(this._debouncer,G.Wc.after(300),(()=>{this._ignoreTaps=!1}))}_formatDisplayed(e,t,s){return e?t(j(e)):s}_onTodayTap(){const e=new Date;Math.abs(this._monthScroller.position-this._differenceInMonths(e,this._originDate))<.001?(this._selectDate(e),this._close()):this._scrollToCurrentMonth()}_scrollToCurrentMonth(){this.focusedDate&&(this.focusedDate=new Date),this.scrollToDate(new Date,!0)}_onYearTap(e){if(!this._ignoreTaps&&!this._notTapping){const t=(e.detail.y-(this._yearScroller.getBoundingClientRect().top+this._yearScroller.clientHeight/2))/this._yearScroller.itemHeight;this._scrollToPosition(this._monthScroller.position+12*t,!0)}}_scrollToPosition(e,t){if(void 0!==this._targetPosition)return void(this._targetPosition=e);if(!t)return this._monthScroller.position=e,this._targetPosition=void 0,this._repositionYearScroller(),void this.__tryFocusDate();let s;this._targetPosition=e,this._revealPromise=new Promise((e=>{s=e}));let i=0;const a=this._monthScroller.position,n=e=>{i||(i=e);const t=e-i;if(t<this.scrollDuration){const e=(r=t,o=a,l=this._targetPosition-a,(r/=this.scrollDuration/2)<1?l/2*r*r+o:-l/2*((r-=1)*(r-2)-1)+o);this._monthScroller.position=e,window.requestAnimationFrame(n)}else this.dispatchEvent(new CustomEvent("scroll-animation-finished",{bubbles:!0,composed:!0,detail:{position:this._targetPosition,oldPosition:a}})),this._monthScroller.position=this._targetPosition,this._targetPosition=void 0,s(),this._revealPromise=void 0;var r,o,l;setTimeout(this._repositionYearScroller.bind(this),1)};window.requestAnimationFrame(n)}_limit(e,t){return Math.min(t.max,Math.max(t.min,e))}_handleTrack(e){if(Math.abs(e.detail.dx)<10||Math.abs(e.detail.ddy)>10)return;Math.abs(e.detail.ddx)>this._yearScrollerWidth/3&&this._toggleAnimateClass(!0);const t=this._translateX+e.detail.ddx;this._translateX=this._limit(t,{min:0,max:this._yearScrollerWidth})}_track(e){if(!this._desktopMode)switch(e.detail.state){case"start":this._toggleAnimateClass(!1);break;case"track":this._handleTrack(e);break;case"end":this._toggleAnimateClass(!0),this._translateX>=this._yearScrollerWidth/2?this._closeYearScroller():this._openYearScroller()}}_toggleAnimateClass(e){e?this.classList.add("animate"):this.classList.remove("animate")}_toggleYearScroller(){this._isYearScrollerVisible()?this._closeYearScroller():this._openYearScroller()}_openYearScroller(){this._translateX=0,this.setAttribute("years-visible","")}_closeYearScroller(){this.removeAttribute("years-visible"),this._translateX=this._yearScrollerWidth}_isYearScrollerVisible(){return this._translateX<this._yearScrollerWidth/2}_translateXChanged(e){this._desktopMode||(this._monthScroller.style.transform=`translateX(${e-this._yearScrollerWidth}px)`,this._yearScroller.style.transform=`translateX(${e}px)`)}_yearAfterXMonths(e){return K(e).getFullYear()}_differenceInMonths(e,t){return 12*(e.getFullYear()-t.getFullYear())-t.getMonth()+e.getMonth()}_clear(){this._selectDate("")}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}_cancel(){this.focusedDate=this.selectedDate,this._close()}_preventDefault(e){e.preventDefault()}__toggleDate(e){L(e,this.selectedDate)?(this._clear(),this.focusedDate=e):this._selectDate(e)}__onMonthCalendarKeyDown(e){let t=!1;switch(e.key){case"ArrowDown":this._moveFocusByDays(7),t=!0;break;case"ArrowUp":this._moveFocusByDays(-7),t=!0;break;case"ArrowRight":this._moveFocusByDays(this.__isRTL?-1:1),t=!0;break;case"ArrowLeft":this._moveFocusByDays(this.__isRTL?1:-1),t=!0;break;case"Enter":this._selectDate(this.focusedDate),this._close(),t=!0;break;case" ":this.__toggleDate(this.focusedDate),t=!0;break;case"Home":this._moveFocusInsideMonth(this.focusedDate,"minDate"),t=!0;break;case"End":this._moveFocusInsideMonth(this.focusedDate,"maxDate"),t=!0;break;case"PageDown":this._moveFocusByMonths(e.shiftKey?12:1),t=!0;break;case"PageUp":this._moveFocusByMonths(e.shiftKey?-12:-1),t=!0;break;case"Tab":this._onTabKeyDown(e,"calendar")}t&&(e.preventDefault(),e.stopPropagation())}_onTabKeyDown(e,t){switch(e.stopPropagation(),t){case"calendar":e.shiftKey&&(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusCancel():this.__focusInput());break;case"today":e.shiftKey&&(e.preventDefault(),this.focusDateElement());break;case"cancel":e.shiftKey||(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusDateElement():this.__focusInput())}}__onTodayButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"today")}__onCancelButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"cancel")}__focusInput(){this.dispatchEvent(new CustomEvent("focus-input",{bubbles:!0,composed:!0}))}__tryFocusDate(){if(this.__pendingDateFocus){const e=this.focusableDateElement;e&&L(e.date,this.__pendingDateFocus)&&(delete this.__pendingDateFocus,e.focus())}}async focusDate(e,t){const s=e||this.selectedDate||this.initialPosition||new Date;this.focusedDate=s,t||(this._focusedMonthDate=s.getDate()),await this.focusDateElement(!1)}async focusDateElement(e=!0){this.__pendingDateFocus=this.focusedDate,this.calendars.length||await new Promise((e=>{(0,J.T8)(this,(()=>{Y(),e()}))})),e&&this.revealDate(this.focusedDate),this._revealPromise&&await this._revealPromise,this.__tryFocusDate()}_focusClosestDate(e){this.focusDate(q(e,[this.minDate,this.maxDate]))}_focusAllowedDate(e,t,s){this._dateAllowed(e)?this.focusDate(e,s):this._dateAllowed(this.focusedDate)?t>0?this.focusDate(this.maxDate):this.focusDate(this.minDate):this._focusClosestDate(this.focusedDate)}_getDateDiff(e,t){const s=new Date(0,0);return s.setFullYear(this.focusedDate.getFullYear()),s.setMonth(this.focusedDate.getMonth()+e),t&&s.setDate(this.focusedDate.getDate()+t),s}_moveFocusByDays(e){const t=this._getDateDiff(0,e);this._focusAllowedDate(t,e,!1)}_moveFocusByMonths(e){const t=this._getDateDiff(e),s=t.getMonth();this._focusedMonthDate||(this._focusedMonthDate=this.focusedDate.getDate()),t.setDate(this._focusedMonthDate),t.getMonth()!==s&&t.setDate(0),this._focusAllowedDate(t,e,!0)}_moveFocusInsideMonth(e,t){const s=new Date(0,0);s.setFullYear(e.getFullYear()),"minDate"===t?(s.setMonth(e.getMonth()),s.setDate(1)):(s.setMonth(e.getMonth()+1),s.setDate(0)),this._dateAllowed(s)?this.focusDate(s):this._dateAllowed(e)?this.focusDate(this[t]):this._focusClosestDate(e)}_dateAllowed(e,t=this.minDate,s=this.maxDate){return(!t||e>=t)&&(!s||e<=s)}_isTodayAllowed(e,t){const s=new Date,i=new Date(0,0);return i.setFullYear(s.getFullYear()),i.setMonth(s.getMonth()),i.setDate(s.getDate()),this._dateAllowed(i,e,t)}}customElements.define(pe.is,pe);var me=s(1402),fe=s(4463),ye=s(2006),ge=s(3208),be=s(6729),ve=s(2743),De=s(6634),we=s(602),ke=s(9320),Ce=s(9091),xe=s(9580);const Se=e=>class extends((0,ke.u)((0,de.k)((0,De.B)((0,Ce.t)((0,we.L)(e)))))){static get properties(){return{_selectedDate:{type:Date},_focusedDate:Date,value:{type:String,notify:!0,value:""},initialPosition:String,opened:{type:Boolean,reflectToAttribute:!0,notify:!0,observer:"_openedChanged"},autoOpenDisabled:Boolean,showWeekNumbers:{type:Boolean,value:!1},_fullscreen:{type:Boolean,value:!1},_fullscreenMediaQuery:{value:"(max-width: 420px), (max-height: 420px)"},i18n:{type:Object,value:()=>({monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],firstDayOfWeek:0,today:"Today",cancel:"Cancel",referenceDate:"",formatDate(e){const t=String(e.year).replace(/\d+/u,(e=>"0000".substr(e.length)+e));return[e.month+1,e.day,t].join("/")},parseDate(e){const t=e.split("/"),s=new Date;let i,a=s.getMonth(),n=s.getFullYear();if(3===t.length?(a=parseInt(t[0])-1,i=parseInt(t[1]),n=parseInt(t[2]),t[2].length<3&&n>=0&&(n=function(e,t,s=0,i=1){if(t>99)throw new Error("The provided year cannot have more than 2 digits.");if(t<0)throw new Error("The provided year cannot be negative.");let a=t+100*Math.floor(e.getFullYear()/100);return e<new Date(a-50,s,i)?a-=100:e>new Date(a+50,s,i)&&(a+=100),a}(this.referenceDate?X(this.referenceDate):new Date,n,a,i))):2===t.length?(a=parseInt(t[0])-1,i=parseInt(t[1])):1===t.length&&(i=parseInt(t[0])),void 0!==i)return{day:i,month:a,year:n}},formatTitle:(e,t)=>`${e} ${t}`})},min:{type:String},max:{type:String},_minDate:{type:Date,computed:"__computeMinOrMaxDate(min)"},_maxDate:{type:Date,computed:"__computeMinOrMaxDate(max)"},_noInput:{type:Boolean,computed:"_isNoInput(inputElement, _fullscreen, _ios, i18n, opened, autoOpenDisabled)"},_ios:{type:Boolean,value:Z.gn},_focusOverlayOnOpen:Boolean,_overlayContent:Object,_hasInputValue:{type:Boolean}}}static get observers(){return["_selectedDateChanged(_selectedDate, i18n.formatDate)","_focusedDateChanged(_focusedDate, i18n.formatDate)","__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers)","__updateOverlayContentTheme(_overlayContent, _theme)","__updateOverlayContentFullScreen(_overlayContent, _fullscreen)"]}static get constraints(){return[...super.constraints,"min","max"]}constructor(){super(),this._boundOnClick=this._onClick.bind(this),this._boundOnScroll=this._onScroll.bind(this),this._boundOverlayRenderer=this._overlayRenderer.bind(this)}get _inputElementValue(){return super._inputElementValue}set _inputElementValue(e){super._inputElementValue=e,this._hasInputValue=!1}get clearElement(){return null}get _nativeInput(){return this.inputElement?this.inputElement.focusElement||this.inputElement:null}_onFocus(e){super._onFocus(e),this._noInput&&e.target.blur()}_onBlur(e){super._onBlur(e),this.opened||(this.autoOpenDisabled&&this._selectParsedOrFocusedDate(),this.validate(),""===this._inputElementValue&&""!==this.value&&(this.value=""))}ready(){super.ready(),this.addEventListener("click",this._boundOnClick),this.addController(new ue(this._fullscreenMediaQuery,(e=>{this._fullscreen=e}))),this.addController(new xe.B(this));const e=this.$.overlay;this._overlayElement=e,e.renderer=this._boundOverlayRenderer,this.addEventListener("mousedown",(()=>this.__bringToFront())),this.addEventListener("touchstart",(()=>this.__bringToFront()))}disconnectedCallback(){super.disconnectedCallback(),this.opened=!1}_propertiesChanged(e,t,s){super._propertiesChanged(e,t,s),"value"in t&&this.__dispatchChange&&(this.dispatchEvent(new CustomEvent("change",{bubbles:!0})),this.__dispatchChange=!1)}open(){this.disabled||this.readonly||(this.opened=!0)}close(){this.$.overlay.close()}_overlayRenderer(e){if(e.firstChild)return;const t=document.createElement("vaadin-date-picker-overlay-content");e.appendChild(t),this._overlayContent=t,t.addEventListener("close",(()=>{this._close()})),t.addEventListener("focus-input",this._focusAndSelect.bind(this)),t.addEventListener("date-tap",(e=>{this.__userConfirmedDate=!0,this._selectDate(e.detail.date),this._close()})),t.addEventListener("date-selected",(e=>{this.__userConfirmedDate=!!e.detail.date,this._selectDate(e.detail.date)})),t.addEventListener("focusin",(()=>{this._keyboardActive&&this._setFocused(!0)})),t.addEventListener("focused-date-changed",(e=>{this._focusedDate=e.detail.value}))}checkValidity(){const e=this._inputElementValue,t=!e||!!this._selectedDate&&e===this._getFormattedDate(this.i18n.formatDate,this._selectedDate),s=!this._selectedDate||R(this._selectedDate,this._minDate,this._maxDate);let i=!0;return this.inputElement&&(this.inputElement.checkValidity?i=this.inputElement.checkValidity():this.inputElement.validate&&(i=this.inputElement.validate())),t&&s&&i}_shouldSetFocus(e){return!this._shouldKeepFocusRing}_shouldRemoveFocus(e){return!this.opened}_setFocused(e){super._setFocused(e),this._shouldKeepFocusRing=e&&this._keyboardActive}_selectDate(e){const t=this._formatISO(e);this.value!==t&&(this.__dispatchChange=!0),this._selectedDate=e}_close(){this._focus(),this.close()}__bringToFront(){requestAnimationFrame((()=>{this.$.overlay.bringToFront()}))}_isNoInput(e,t,s,i,a,n){return!e||t&&(!n||a)||s&&a||!i.parseDate}_formatISO(e){if(!(e instanceof Date))return"";const t=(e,t="00")=>(t+e).substr((t+e).length-t.length);let s="",i="0000",a=e.getFullYear();return a<0?(a=-a,s="-",i="000000"):e.getFullYear()>=1e4&&(s="+",i="000000"),[s+t(a,i),t(e.getMonth()+1),t(e.getDate())].join("-")}_inputElementChanged(e){super._inputElementChanged(e),e&&(e.autocomplete="off",e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded",!!this.opened),this._applyInputValue(this._selectedDate))}_openedChanged(e){this.inputElement&&this.inputElement.setAttribute("aria-expanded",e)}_selectedDateChanged(e,t){if(void 0===e||void 0===t)return;const s=this._formatISO(e);this.__keepInputValue||this._applyInputValue(e),s!==this.value&&(this.validate(),this.value=s),this._ignoreFocusedDateChange=!0,this._focusedDate=e,this._ignoreFocusedDateChange=!1}_focusedDateChanged(e,t){void 0!==e&&void 0!==t&&(this._ignoreFocusedDateChange||this._noInput||this._applyInputValue(e))}_valueChanged(e,t){const s=X(e);!e||s?(e?L(this._selectedDate,s)||(this._selectedDate=s,void 0!==t&&this.validate()):this._selectedDate=null,this._toggleHasValue(this._hasValue)):this.value=t}__updateOverlayContent(e,t,s,i,a,n,r,o){e&&e.setProperties({i18n:t,label:s,minDate:i,maxDate:a,focusedDate:n,selectedDate:r,showWeekNumbers:o})}__updateOverlayContentTheme(e,t){e&&(t?e.setAttribute("theme",t):e.removeAttribute("theme"))}__updateOverlayContentFullScreen(e,t){e&&e.toggleAttribute("fullscreen",t)}_onOverlayEscapePress(){this._focusedDate=this._selectedDate,this._close()}_onOverlayOpened(){const e=this._getInitialPosition();this._overlayContent.initialPosition=e;const t=this._overlayContent.focusedDate||e;this._overlayContent.scrollToDate(t),this._ignoreFocusedDateChange=!0,this._overlayContent.focusedDate=t,this._ignoreFocusedDateChange=!1,window.addEventListener("scroll",this._boundOnScroll,!0),this._focusOverlayOnOpen?(this._overlayContent.focusDateElement(),this._focusOverlayOnOpen=!1):this._focus(),this._noInput&&this.focusElement&&(this.focusElement.blur(),this._overlayContent.focusDateElement())}_getInitialPosition(){const e=X(this.initialPosition),t=this._selectedDate||this._overlayContent.initialPosition||e||new Date;return e||R(t,this._minDate,this._maxDate)?t:q(t,[this._minDate,this._maxDate])}_selectParsedOrFocusedDate(){if(this._ignoreFocusedDateChange=!0,this.i18n.parseDate){const e=this._inputElementValue||"",t=this._getParsedDate(e);this._isValidDate(t)?this._selectDate(t):(this.__keepInputValue=!0,this._selectDate(null),this._selectedDate=null,this.__keepInputValue=!1)}else this._focusedDate&&this._selectDate(this._focusedDate);this._ignoreFocusedDateChange=!1}_onOverlayClosed(){window.removeEventListener("scroll",this._boundOnScroll,!0),this.__userConfirmedDate?this.__userConfirmedDate=!1:this._selectParsedOrFocusedDate(),this._nativeInput&&this._nativeInput.selectionStart&&(this._nativeInput.selectionStart=this._nativeInput.selectionEnd),this.value||this.validate()}_onScroll(e){e.target!==window&&this._overlayContent.contains(e.target)||this._overlayContent._repositionYearScroller()}_focus(){this._noInput||this.inputElement.focus()}_focusAndSelect(){this._focus(),this._setSelectionRange(0,this._inputElementValue.length)}_applyInputValue(e){this._inputElementValue=e?this._getFormattedDate(this.i18n.formatDate,e):""}_getFormattedDate(e,t){return e(j(t))}_setSelectionRange(e,t){this._nativeInput&&this._nativeInput.setSelectionRange&&this._nativeInput.setSelectionRange(e,t)}_isValidDate(e){return e&&!isNaN(e.getTime())}_onChange(e){""===this._inputElementValue&&(this.__dispatchChange=!0),e.stopPropagation()}_onClick(e){this._isClearButton(e)||this._onHostClick(e)}_onHostClick(e){this.autoOpenDisabled&&!this._noInput||(e.preventDefault(),this.open())}_onClearButtonClick(e){e.preventDefault(),this._inputElementValue="",this.value="",this.validate(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}_onKeyDown(e){switch(super._onKeyDown(e),this._noInput&&-1===[9].indexOf(e.keyCode)&&e.preventDefault(),e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this.opened?this._overlayContent.focusDateElement():(this._focusOverlayOnOpen=!0,this.open());break;case"Tab":this.opened&&(e.preventDefault(),e.stopPropagation(),this._setSelectionRange(0,0),e.shiftKey?this._overlayContent.focusCancel():this._overlayContent.focusDateElement())}}_onEnter(e){const t=this.value;this.opened?this.close():this._selectParsedOrFocusedDate(),t===this.value&&this.validate()}_onEscape(e){if(!this.opened)return this.clearButtonVisible&&this.value?(e.stopPropagation(),void this._onClearButtonClick(e)):void(this.autoOpenDisabled?(""===this.inputElement.value&&this._selectDate(null),this._applyInputValue(this._selectedDate)):(this._focusedDate=this._selectedDate,this._selectParsedOrFocusedDate()))}_getParsedDate(e=this._inputElementValue){const t=this.i18n.parseDate&&this.i18n.parseDate(e);return t&&X(`${t.year}-${t.month+1}-${t.day}`)}_isClearButton(e){return e.composedPath()[0]===this.clearElement}_onInput(){this.opened||!this.inputElement.value||this.autoOpenDisabled||this.open(),this._userInputValueChanged()}_userInputValueChanged(){if(this._inputElementValue){const e=this._getParsedDate();this._isValidDate(e)&&(this._ignoreFocusedDateChange=!0,L(e,this._focusedDate)||(this._focusedDate=e),this._ignoreFocusedDateChange=!1)}}__computeMinOrMaxDate(e){return X(e)}};(0,a.hC)("vaadin-date-picker",ve.J,{moduleId:"vaadin-date-picker-styles"});class Ee extends(Se((0,ye.L)((0,a.Tb)((0,me.S)(_.H3))))){static get is(){return"vaadin-date-picker"}static get template(){return _.dy`
|
688
|
+
<style>
|
689
|
+
:host([opened]) {
|
690
|
+
pointer-events: auto;
|
691
|
+
}
|
692
|
+
|
693
|
+
:host([dir='rtl']) [part='input-field'] {
|
694
|
+
direction: ltr;
|
695
|
+
}
|
696
|
+
|
697
|
+
:host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
|
698
|
+
direction: rtl;
|
699
|
+
text-align: left;
|
700
|
+
}
|
701
|
+
</style>
|
702
|
+
|
703
|
+
<div class="vaadin-date-picker-container">
|
704
|
+
<div part="label">
|
705
|
+
<slot name="label"></slot>
|
706
|
+
<span part="required-indicator" aria-hidden="true" on-click="focus"></span>
|
707
|
+
</div>
|
708
|
+
|
709
|
+
<vaadin-input-container
|
710
|
+
part="input-field"
|
711
|
+
readonly="[[readonly]]"
|
712
|
+
disabled="[[disabled]]"
|
713
|
+
invalid="[[invalid]]"
|
714
|
+
theme$="[[_theme]]"
|
715
|
+
>
|
716
|
+
<slot name="prefix" slot="prefix"></slot>
|
717
|
+
<slot name="input"></slot>
|
718
|
+
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
719
|
+
<div part="toggle-button" slot="suffix" aria-hidden="true" on-click="_toggle"></div>
|
720
|
+
</vaadin-input-container>
|
721
|
+
|
722
|
+
<div part="helper-text">
|
723
|
+
<slot name="helper"></slot>
|
724
|
+
</div>
|
725
|
+
|
726
|
+
<div part="error-message">
|
727
|
+
<slot name="error-message"></slot>
|
728
|
+
</div>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
<vaadin-date-picker-overlay
|
732
|
+
id="overlay"
|
733
|
+
fullscreen$="[[_fullscreen]]"
|
734
|
+
theme$="[[_theme]]"
|
735
|
+
opened="{{opened}}"
|
736
|
+
on-vaadin-overlay-escape-press="_onOverlayEscapePress"
|
737
|
+
on-vaadin-overlay-open="_onOverlayOpened"
|
738
|
+
on-vaadin-overlay-closing="_onOverlayClosed"
|
739
|
+
restore-focus-on-close
|
740
|
+
restore-focus-node="[[inputElement]]"
|
741
|
+
></vaadin-date-picker-overlay>
|
742
|
+
|
743
|
+
<slot name="tooltip"></slot>
|
744
|
+
`}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new ge.b(this,(e=>{this._setInputElement(e),this._setFocusElement(e),this.stateTarget=e,this.ariaTarget=e}))),this.addController(new be.v(this.inputElement,this._labelController)),this._tooltipController=new fe.f(this),this.addController(this._tooltipController),this._tooltipController.setPosition("top"),this._tooltipController.setShouldShow((e=>!e.opened)),this.shadowRoot.querySelector('[part="toggle-button"]').addEventListener("mousedown",(e=>e.preventDefault())),this.$.overlay.addEventListener("vaadin-overlay-close",this._onVaadinOverlayClose.bind(this))}_onVaadinOverlayClose(e){e.detail.sourceEvent&&e.detail.sourceEvent.composedPath().includes(this)&&e.preventDefault()}_toggle(e){e.stopPropagation(),this.$.overlay.opened?this.close():this.open()}_openedChanged(e){super._openedChanged(e),this.$.overlay.positionTarget=this.shadowRoot.querySelector('[part="input-field"]'),this.$.overlay.noVerticalOverlap=!0}}customElements.define(Ee.is,Ee)}}]);
|