shirkasoft-ui-components 1.13.18 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +415 -42
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs +189 -100
- package/fesm2022/shirkasoft-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-button.mjs +367 -73
- package/fesm2022/shirkasoft-ui-components-button.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-chart.mjs +206 -142
- package/fesm2022/shirkasoft-ui-components-chart.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-config.mjs +976 -0
- package/fesm2022/shirkasoft-ui-components-config.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs +307 -142
- package/fesm2022/shirkasoft-ui-components-confirm-dialog.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs +1624 -1400
- package/fesm2022/shirkasoft-ui-components-date-picker.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs +347 -92
- package/fesm2022/shirkasoft-ui-components-fieldset.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs +484 -293
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-icons.mjs +1141 -0
- package/fesm2022/shirkasoft-ui-components-icons.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-knob.mjs +395 -180
- package/fesm2022/shirkasoft-ui-components-knob.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-loading.mjs +505 -128
- package/fesm2022/shirkasoft-ui-components-loading.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-modal.mjs +311 -303
- package/fesm2022/shirkasoft-ui-components-modal.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-notification.mjs +188 -142
- package/fesm2022/shirkasoft-ui-components-notification.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +517 -277
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +669 -289
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-select.mjs +1014 -814
- package/fesm2022/shirkasoft-ui-components-select.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs +508 -184
- package/fesm2022/shirkasoft-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs +197 -57
- package/fesm2022/shirkasoft-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +1918 -1676
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tabs.mjs +419 -177
- package/fesm2022/shirkasoft-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tag.mjs +177 -51
- package/fesm2022/shirkasoft-ui-components-tag.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-text-field.mjs +687 -369
- package/fesm2022/shirkasoft-ui-components-text-field.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs +466 -0
- package/fesm2022/shirkasoft-ui-components-theme-picker.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs +147 -0
- package/fesm2022/shirkasoft-ui-components-theme.mjs.map +1 -0
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +791 -215
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-toggle.mjs +205 -128
- package/fesm2022/shirkasoft-ui-components-toggle.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs +244 -180
- package/fesm2022/shirkasoft-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +97 -125
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-wizard.mjs +673 -166
- package/fesm2022/shirkasoft-ui-components-wizard.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components.mjs +0 -9
- package/package.json +37 -7
- package/src/baseline.css +2472 -0
- package/src/theme.css +15 -543
- package/src/themes/ocean.css +56 -0
- package/src/themes/sunset.css +55 -0
- package/src/themes/violet.css +25 -0
- package/src/tokens.css +612 -0
- package/types/shirkasoft-ui-components-breadcrumb.d.ts +59 -44
- package/types/shirkasoft-ui-components-button.d.ts +142 -49
- package/types/shirkasoft-ui-components-chart.d.ts +59 -44
- package/types/shirkasoft-ui-components-config.d.ts +357 -0
- package/types/shirkasoft-ui-components-confirm-dialog.d.ts +107 -65
- package/types/shirkasoft-ui-components-date-picker.d.ts +527 -373
- package/types/shirkasoft-ui-components-fieldset.d.ts +135 -59
- package/types/shirkasoft-ui-components-file-upload.d.ts +176 -106
- package/types/shirkasoft-ui-components-icons.d.ts +1430 -0
- package/types/shirkasoft-ui-components-knob.d.ts +151 -64
- package/types/shirkasoft-ui-components-loading.d.ts +155 -64
- package/types/shirkasoft-ui-components-modal.d.ts +134 -132
- package/types/shirkasoft-ui-components-notification.d.ts +63 -58
- package/types/shirkasoft-ui-components-price-input.d.ts +198 -85
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +262 -142
- package/types/shirkasoft-ui-components-select.d.ts +301 -192
- package/types/shirkasoft-ui-components-sidebar.d.ts +198 -92
- package/types/shirkasoft-ui-components-skeleton.d.ts +68 -27
- package/types/shirkasoft-ui-components-table.d.ts +849 -649
- package/types/shirkasoft-ui-components-tabs.d.ts +102 -61
- package/types/shirkasoft-ui-components-tag.d.ts +54 -23
- package/types/shirkasoft-ui-components-text-field.d.ts +231 -111
- package/types/shirkasoft-ui-components-theme-picker.d.ts +117 -0
- package/types/shirkasoft-ui-components-theme.d.ts +80 -0
- package/types/shirkasoft-ui-components-timeline.d.ts +326 -150
- package/types/shirkasoft-ui-components-toggle.d.ts +76 -45
- package/types/shirkasoft-ui-components-tooltip.d.ts +64 -43
- package/types/shirkasoft-ui-components-utils.d.ts +26 -17
- package/types/shirkasoft-ui-components-wizard.d.ts +236 -86
- package/types/shirkasoft-ui-components.d.ts +1 -2
- package/fesm2022/shirkasoft-ui-components.mjs.map +0 -1
|
@@ -1,1401 +1,1625 @@
|
|
|
1
|
-
import * as i1 from
|
|
2
|
-
import { CommonModule } from
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { takeUntilDestroyed } from
|
|
7
|
-
import { TranslocoService } from
|
|
8
|
-
import { PortalDirective } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
fromDate(date, hasTime = true) {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
], viewQueries: [{ propertyName: "overlay", first: true, predicate: ["overlay"], descendants: true, isSignal: true }, { propertyName: "anchor", first: true, predicate: ["anchor"], descendants: true, isSignal: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-600)] mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n <div #anchor class=\"relative\">\n <input\n [id]=\"id()\"\n type=\"text\"\n autocomplete=\"off\"\n [disabled]=\"isDisabled()\"\n [placeholder]=\"inputPlaceholder()\"\n [value]=\"isTyping() ? typedValue() : displayLabel()\"\n (input)=\"onInputText($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown.enter)=\"$any($event.target).blur()\"\n (keydown.escape)=\"cancelTyping()\"\n (click)=\"toggle()\"\n class=\"date-input-field\"\n [ngClass]=\"{\n 'input-error': shouldShowError() || typingValid() === false,\n 'input-valid': wasFixedError() || typingValid() === true,\n }\"\n [attr.aria-invalid]=\"shouldShowError() || typingValid() === false || null\"\n [attr.aria-describedby]=\"shouldShowError() ? id() + '-error' : null\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n />\n <button\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 p-1 _shk-text-surface-400 dark:[color:var(--shk-surface-400)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n [attr.aria-label]=\"texts().open\"\n >\n @if (timeOnly()) {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M12 7v5l3 2\"></path>\n </svg>\n } @else {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect>\n <path d=\"M16 2v4M8 2v4M3 10h18\"></path>\n </svg>\n }\n </button>\n </div>\n\n @if (isOpen()) {\n <div #overlay shkPortal class=\"shk-date-picker-overlay\">\n <div class=\"fixed inset-0 z-40\" (click)=\"close()\"></div>\n\n <div\n #panel\n role=\"dialog\"\n class=\"dp-panel fixed z-50 p-4\"\n [style.top.px]=\"panelPosition()?.top ?? 0\"\n [style.left.px]=\"panelPosition()?.left ?? 0\"\n [style.visibility]=\"panelPosition() ? 'visible' : 'hidden'\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <div class=\"flex items-stretch\">\n @if (!timeOnly()) {\n <!-- ================= DAYS ================= -->\n @if (currentView() === 'date') {\n <div class=\"flex gap-6\" (wheel)=\"onWheel($event)\">\n @for (m of visibleMonths(); track m.year * 12 + m.month; let first = $first; let last = $last) {\n <div class=\"w-64\" [class.dp-month-divider]=\"!first\">\n <!-- Header: \u2039 Mes A\u00F1o \u203A -->\n <div class=\"flex items-center justify-between mb-3\">\n @if (first) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">\n {{ monthLongNames()[m.month] }} {{ m.year }}\n </button>\n @if (last) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n </div>\n\n <!-- Typed date + Today (single mode) -->\n @if (!range()) {\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input\"\n [class.input-error]=\"panelTextError() === 'single'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"panelText()\"\n (keydown.enter)=\"commitPanelText('single', $event)\"\n (blur)=\"commitPanelText('single', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n </div>\n }\n\n <!-- Weekday names -->\n <div class=\"grid grid-cols-7\">\n @for (name of dayNames(); track $index) {\n <div class=\"dp-weekday\">{{ name }}</div>\n }\n </div>\n\n <!-- Day grid (6 weeks, neighbouring months included) -->\n <div class=\"grid grid-cols-7\" (mouseleave)=\"onDayHover(null)\">\n @for (cell of m.cells; track cell.iso) {\n <div\n class=\"dp-cell\"\n [class.in-range]=\"(cell.inMonth || !range()) && isInRange(cell.iso)\"\n [class.range-start]=\"(cell.inMonth || !range()) && isRangeStart(cell.iso)\"\n [class.range-end]=\"(cell.inMonth || !range()) && isRangeEnd(cell.iso)\"\n >\n <button\n type=\"button\"\n class=\"dp-day\"\n [class.is-outside]=\"!cell.inMonth\"\n [class.is-today]=\"isTodayDate(cell.iso)\"\n [class.is-selected]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [disabled]=\"isDisabledDate(cell.iso)\"\n [attr.aria-pressed]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [attr.aria-current]=\"isTodayDate(cell.iso) ? 'date' : null\"\n (click)=\"selectDay(cell)\"\n (dblclick)=\"quickApply(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n >\n {{ cell.day }}\n @if (isMarked(cell.iso)) {\n <span class=\"dp-dot\"></span>\n }\n </button>\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n\n <!-- ================= WEEKS ================= -->\n @if (currentView() === 'week') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"space-y-1\">\n @for (week of monthWeeks(); track week.index) {\n <button\n type=\"button\"\n (click)=\"selectWeek(week.start)\"\n class=\"dp-chip w-full flex items-center justify-between px-3\"\n [class.is-selected]=\"isSelectedWeek(week.start)\"\n [class.is-current]=\"isCurrentWeek(week.start)\"\n >\n <span class=\"font-medium\">{{ weekLabel(week.index) }}</span>\n <span class=\"text-xs opacity-80\">{{ week.range }}</span>\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= MONTHS ================= -->\n @if (currentView() === 'month') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedMonth($index)\"\n [class.is-current]=\"isCurrentMonth($index)\"\n (click)=\"selectMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= YEARS ================= -->\n @if (currentView() === 'year') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <span class=\"dp-title\">{{ headerTitle() }}</span>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (year of decadeYears(); track year) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedYear(year)\"\n [class.is-current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n </div>\n }\n }\n\n <!-- ================= TIME (columns) ================= -->\n @if (showTimeColumns()) {\n <div\n class=\"flex flex-col\"\n [ngClass]=\"timeOnly() ? 'w-64' : 'w-40 ml-6 dp-month-divider'\"\n >\n <!-- Typed time + Now -->\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input text-center font-semibold tabular-nums\"\n [class.input-error]=\"timeTextError()\"\n [placeholder]=\"hourFormat() === '12' ? 'hh:mm AM' : 'HH:mm'\"\n [value]=\"timeText()\"\n (keydown.enter)=\"commitTimeText($event)\"\n (blur)=\"commitTimeText($event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"setNow()\">{{ texts().now }}</button>\n </div>\n\n <!-- Column titles -->\n <div class=\"flex\">\n <div class=\"dp-weekday flex-1\">{{ texts().hour }}</div>\n <div class=\"dp-weekday flex-1\">{{ texts().minute }}</div>\n @if (showSeconds()) {\n <div class=\"dp-weekday flex-1\">{{ texts().second }}</div>\n }\n @if (hourFormat() === '12') {\n <div class=\"dp-weekday flex-1\"></div>\n }\n </div>\n\n <!-- Scrollable columns -->\n <div class=\"relative\" [ngClass]=\"timeOnly() ? 'h-56' : 'flex-1 min-h-[12rem]'\">\n <div class=\"absolute inset-0 flex\">\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().hour\">\n @for (h of hourOptions(); track h.value) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewHour() === h.value\"\n [class.is-current]=\"isCurrentHour(h.value)\"\n [attr.aria-selected]=\"viewHour() === h.value\"\n (click)=\"selectHour(h.value)\"\n >\n {{ h.label }}\n </button>\n }\n </div>\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().minute\">\n @for (m of minuteOptions(); track m) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewMinute() === m\"\n [attr.aria-selected]=\"viewMinute() === m\"\n (click)=\"selectMinute(m)\"\n >\n {{ pad2(m) }}\n </button>\n }\n </div>\n @if (showSeconds()) {\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().second\">\n @for (sec of secondOptions; track sec) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewSecond() === sec\"\n [attr.aria-selected]=\"viewSecond() === sec\"\n (click)=\"selectSecond(sec)\"\n >\n {{ pad2(sec) }}\n </button>\n }\n </div>\n }\n @if (hourFormat() === '12') {\n <div class=\"dp-time-col\">\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'AM'\" (click)=\"setMeridiem('AM')\">AM</button>\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'PM'\" (click)=\"setMeridiem('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n </div>\n\n <!-- ================= FOOTER ================= -->\n @if (showFooter()) {\n <div class=\"mt-4 pt-4 border-t dp-divider\">\n @if (range()) {\n <div class=\"flex items-center gap-3\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n <div class=\"flex-1\"></div>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'start'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeStartText()\"\n (keydown.enter)=\"commitPanelText('start', $event)\"\n (blur)=\"commitPanelText('start', $event)\"\n />\n <span class=\"_shk-text-surface-400\">\u2013</span>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'end'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeEndText()\"\n (keydown.enter)=\"commitPanelText('end', $event)\"\n (blur)=\"commitPanelText('end', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n } @else {\n <div class=\"grid grid-cols-2 gap-3 w-64 ml-auto\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (shouldShowError()) {\n <div [id]=\"id() + '-error'\" class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n", styles: [".dp-panel{background-color:#fff;border:1px solid var(--shk-surface-200);border-radius:.75rem;box-shadow:0 12px 32px -8px #0000002e,0 2px 6px #0000000f;color:var(--shk-surface-700)}.dark .dp-panel{background-color:var(--shk-surface-100)}.dp-nav{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:9999px;color:var(--shk-surface-500);transition:background-color .15s,color .15s}.dp-nav:hover:not(:disabled){background-color:var(--shk-surface-100);color:var(--shk-surface-800)}.dark .dp-nav:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-nav:disabled{opacity:.3;cursor:not-allowed}.dp-title{font-size:.875rem;font-weight:600;padding:.25rem .5rem;border-radius:.375rem;color:var(--shk-surface-800);transition:background-color .15s}button.dp-title:hover{background-color:var(--shk-surface-100)}.dark button.dp-title:hover{background-color:var(--shk-surface-200)}.dp-month-divider{position:relative}.dp-month-divider:before{content:\"\";position:absolute;top:-1rem;bottom:0;left:-.75rem;border-left:1px solid var(--shk-surface-200)}.dp-weekday{text-align:center;font-size:.75rem;font-weight:500;color:var(--shk-surface-500);padding:.25rem 0}.dp-cell{position:relative;display:flex;align-items:center;justify-content:center;height:2.25rem}.dp-cell.in-range:before,.dp-cell.range-start:before,.dp-cell.range-end:before{content:\"\";position:absolute;inset:.125rem 0;background-color:color-mix(in srgb,var(--shk-primary-500) 12%,transparent)}.dp-cell.range-start:before{left:50%}.dp-cell.range-end:before{right:50%}.dp-cell.range-start.range-end:before{display:none}.dp-day{position:relative;z-index:1;width:2.125rem;height:2.125rem;border-radius:9999px;font-size:.8125rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-200)}.dp-day.is-outside{color:var(--shk-surface-400)}.dp-day.is-today{font-weight:700;color:var(--shk-primary-600);background-color:color-mix(in srgb,var(--shk-primary-500) 10%,transparent)}.dp-day.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-day:disabled{opacity:.3;cursor:not-allowed;text-decoration:line-through}.dp-dot{position:absolute;left:50%;bottom:.25rem;width:.25rem;height:.25rem;border-radius:9999px;transform:translate(-50%);background-color:var(--shk-primary-500)}.dp-day.is-selected .dp-dot{background-color:#fff}.dp-chip{padding:.5rem 0;font-size:.8125rem;border-radius:.5rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-chip.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-chip.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-btn{display:inline-flex;align-items:center;justify-content:center;padding:.4375rem .875rem;font-size:.8125rem;font-weight:500;border-radius:.5rem;border:1px solid var(--shk-surface-200);color:var(--shk-surface-700);background-color:transparent;transition:background-color .15s,border-color .15s;white-space:nowrap}.dp-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}.dark .dp-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-btn-primary{border-color:var(--shk-primary-500);background-color:var(--shk-primary-500);color:#fff}.dp-btn-primary:hover:not(:disabled){background-color:var(--shk-primary-700)!important;border-color:var(--shk-primary-700)}.dp-btn:disabled{opacity:.5;cursor:not-allowed}.dp-mini-input{width:100%;min-width:0;padding:.4375rem .625rem;font-size:.8125rem;border-radius:.5rem;border:1px solid var(--shk-surface-200);background-color:transparent;color:var(--shk-surface-700);outline:none;transition:border-color .15s,box-shadow .15s}.dp-mini-input:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.dp-mini-input.input-error{border-color:var(--shk-error-500)}.dp-divider{border-color:var(--shk-surface-200)}.dp-time-col{position:relative;flex:1 1 0;min-width:0;overflow-y:auto;scrollbar-width:thin;scroll-behavior:smooth;padding:0 .125rem}.dp-time-col+.dp-time-col{border-left:1px solid var(--shk-surface-200)}.dp-time-item{display:flex;align-items:center;justify-content:center;width:100%;height:2rem;margin:.125rem 0;border-radius:.5rem;font-size:.8125rem;font-variant-numeric:tabular-nums;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-time-item.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-time-item.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.date-input-field{width:100%;padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;border-radius:.5rem;outline:none;transition:border-color .15s,box-shadow .15s;background-color:var(--shk-surface-50);color:var(--shk-surface-700);border:1px solid var(--shk-surface-200);text-overflow:ellipsis}:host-context(.dark) .date-input-field,.dark .date-input-field{background-color:var(--shk-surface-100)}.date-input-field::placeholder{color:var(--shk-surface-400)}.date-input-field:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.date-input-field:disabled{background-color:var(--shk-surface-100);color:var(--shk-surface-500);cursor:not-allowed}:host-context(.dark) .date-input-field:disabled,.dark .date-input-field:disabled{background-color:var(--shk-surface-50);color:var(--shk-surface-400)}.date-input-field.input-error,:host-context(.dark) .date-input-field.input-error,.dark .date-input-field.input-error{border-color:var(--shk-error-500)}.date-input-field.input-error:focus,:host-context(.dark) .date-input-field.input-error:focus,.dark .date-input-field.input-error:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-error-500) 22%,transparent)}.date-input-field.input-valid,:host-context(.dark) .date-input-field.input-valid,.dark .date-input-field.input-valid{border-color:#22c55e}.date-input-field.input-valid:focus,:host-context(.dark) .date-input-field.input-valid:focus,.dark .date-input-field.input-valid:focus{box-shadow:0 0 0 3px #22c55e33}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: PortalDirective, selector: "[shkPortal]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
], template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 dark:[color:var(--shk-surface-600)] mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n <div #anchor class=\"relative\">\n <input\n [id]=\"id()\"\n type=\"text\"\n autocomplete=\"off\"\n [disabled]=\"isDisabled()\"\n [placeholder]=\"inputPlaceholder()\"\n [value]=\"isTyping() ? typedValue() : displayLabel()\"\n (input)=\"onInputText($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown.enter)=\"$any($event.target).blur()\"\n (keydown.escape)=\"cancelTyping()\"\n (click)=\"toggle()\"\n class=\"date-input-field\"\n [ngClass]=\"{\n 'input-error': shouldShowError() || typingValid() === false,\n 'input-valid': wasFixedError() || typingValid() === true,\n }\"\n [attr.aria-invalid]=\"shouldShowError() || typingValid() === false || null\"\n [attr.aria-describedby]=\"shouldShowError() ? id() + '-error' : null\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n />\n <button\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 p-1 _shk-text-surface-400 dark:[color:var(--shk-surface-400)] hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n [attr.aria-label]=\"texts().open\"\n >\n @if (timeOnly()) {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M12 7v5l3 2\"></path>\n </svg>\n } @else {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect>\n <path d=\"M16 2v4M8 2v4M3 10h18\"></path>\n </svg>\n }\n </button>\n </div>\n\n @if (isOpen()) {\n <div #overlay shkPortal class=\"shk-date-picker-overlay\">\n <div class=\"fixed inset-0 z-40\" (click)=\"close()\"></div>\n\n <div\n #panel\n role=\"dialog\"\n class=\"dp-panel fixed z-50 p-4\"\n [style.top.px]=\"panelPosition()?.top ?? 0\"\n [style.left.px]=\"panelPosition()?.left ?? 0\"\n [style.visibility]=\"panelPosition() ? 'visible' : 'hidden'\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <div class=\"flex items-stretch\">\n @if (!timeOnly()) {\n <!-- ================= DAYS ================= -->\n @if (currentView() === 'date') {\n <div class=\"flex gap-6\" (wheel)=\"onWheel($event)\">\n @for (m of visibleMonths(); track m.year * 12 + m.month; let first = $first; let last = $last) {\n <div class=\"w-64\" [class.dp-month-divider]=\"!first\">\n <!-- Header: \u2039 Mes A\u00F1o \u203A -->\n <div class=\"flex items-center justify-between mb-3\">\n @if (first) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">\n {{ monthLongNames()[m.month] }} {{ m.year }}\n </button>\n @if (last) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n </div>\n\n <!-- Typed date + Today (single mode) -->\n @if (!range()) {\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input\"\n [class.input-error]=\"panelTextError() === 'single'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"panelText()\"\n (keydown.enter)=\"commitPanelText('single', $event)\"\n (blur)=\"commitPanelText('single', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n </div>\n }\n\n <!-- Weekday names -->\n <div class=\"grid grid-cols-7\">\n @for (name of dayNames(); track $index) {\n <div class=\"dp-weekday\">{{ name }}</div>\n }\n </div>\n\n <!-- Day grid (6 weeks, neighbouring months included) -->\n <div class=\"grid grid-cols-7\" (mouseleave)=\"onDayHover(null)\">\n @for (cell of m.cells; track cell.iso) {\n <div\n class=\"dp-cell\"\n [class.in-range]=\"(cell.inMonth || !range()) && isInRange(cell.iso)\"\n [class.range-start]=\"(cell.inMonth || !range()) && isRangeStart(cell.iso)\"\n [class.range-end]=\"(cell.inMonth || !range()) && isRangeEnd(cell.iso)\"\n >\n <button\n type=\"button\"\n class=\"dp-day\"\n [class.is-outside]=\"!cell.inMonth\"\n [class.is-today]=\"isTodayDate(cell.iso)\"\n [class.is-selected]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [disabled]=\"isDisabledDate(cell.iso)\"\n [attr.aria-pressed]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [attr.aria-current]=\"isTodayDate(cell.iso) ? 'date' : null\"\n (click)=\"selectDay(cell)\"\n (dblclick)=\"quickApply(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n >\n {{ cell.day }}\n @if (isMarked(cell.iso)) {\n <span class=\"dp-dot\"></span>\n }\n </button>\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n\n <!-- ================= WEEKS ================= -->\n @if (currentView() === 'week') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"space-y-1\">\n @for (week of monthWeeks(); track week.index) {\n <button\n type=\"button\"\n (click)=\"selectWeek(week.start)\"\n class=\"dp-chip w-full flex items-center justify-between px-3\"\n [class.is-selected]=\"isSelectedWeek(week.start)\"\n [class.is-current]=\"isCurrentWeek(week.start)\"\n >\n <span class=\"font-medium\">{{ weekLabel(week.index) }}</span>\n <span class=\"text-xs opacity-80\">{{ week.range }}</span>\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= MONTHS ================= -->\n @if (currentView() === 'month') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedMonth($index)\"\n [class.is-current]=\"isCurrentMonth($index)\"\n (click)=\"selectMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= YEARS ================= -->\n @if (currentView() === 'year') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <span class=\"dp-title\">{{ headerTitle() }}</span>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (year of decadeYears(); track year) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedYear(year)\"\n [class.is-current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n </div>\n }\n }\n\n <!-- ================= TIME (columns) ================= -->\n @if (showTimeColumns()) {\n <div\n class=\"flex flex-col\"\n [ngClass]=\"timeOnly() ? 'w-64' : 'w-40 ml-6 dp-month-divider'\"\n >\n <!-- Typed time + Now -->\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input text-center font-semibold tabular-nums\"\n [class.input-error]=\"timeTextError()\"\n [placeholder]=\"hourFormat() === '12' ? 'hh:mm AM' : 'HH:mm'\"\n [value]=\"timeText()\"\n (keydown.enter)=\"commitTimeText($event)\"\n (blur)=\"commitTimeText($event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"setNow()\">{{ texts().now }}</button>\n </div>\n\n <!-- Column titles -->\n <div class=\"flex\">\n <div class=\"dp-weekday flex-1\">{{ texts().hour }}</div>\n <div class=\"dp-weekday flex-1\">{{ texts().minute }}</div>\n @if (showSeconds()) {\n <div class=\"dp-weekday flex-1\">{{ texts().second }}</div>\n }\n @if (hourFormat() === '12') {\n <div class=\"dp-weekday flex-1\"></div>\n }\n </div>\n\n <!-- Scrollable columns -->\n <div class=\"relative\" [ngClass]=\"timeOnly() ? 'h-56' : 'flex-1 min-h-[12rem]'\">\n <div class=\"absolute inset-0 flex\">\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().hour\">\n @for (h of hourOptions(); track h.value) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewHour() === h.value\"\n [class.is-current]=\"isCurrentHour(h.value)\"\n [attr.aria-selected]=\"viewHour() === h.value\"\n (click)=\"selectHour(h.value)\"\n >\n {{ h.label }}\n </button>\n }\n </div>\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().minute\">\n @for (m of minuteOptions(); track m) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewMinute() === m\"\n [attr.aria-selected]=\"viewMinute() === m\"\n (click)=\"selectMinute(m)\"\n >\n {{ pad2(m) }}\n </button>\n }\n </div>\n @if (showSeconds()) {\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().second\">\n @for (sec of secondOptions; track sec) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewSecond() === sec\"\n [attr.aria-selected]=\"viewSecond() === sec\"\n (click)=\"selectSecond(sec)\"\n >\n {{ pad2(sec) }}\n </button>\n }\n </div>\n }\n @if (hourFormat() === '12') {\n <div class=\"dp-time-col\">\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'AM'\" (click)=\"setMeridiem('AM')\">AM</button>\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'PM'\" (click)=\"setMeridiem('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n </div>\n\n <!-- ================= FOOTER ================= -->\n @if (showFooter()) {\n <div class=\"mt-4 pt-4 border-t dp-divider\">\n @if (range()) {\n <div class=\"flex items-center gap-3\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n <div class=\"flex-1\"></div>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'start'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeStartText()\"\n (keydown.enter)=\"commitPanelText('start', $event)\"\n (blur)=\"commitPanelText('start', $event)\"\n />\n <span class=\"_shk-text-surface-400\">\u2013</span>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'end'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeEndText()\"\n (keydown.enter)=\"commitPanelText('end', $event)\"\n (blur)=\"commitPanelText('end', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n } @else {\n <div class=\"grid grid-cols-2 gap-3 w-64 ml-auto\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (shouldShowError()) {\n <div [id]=\"id() + '-error'\" class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n", styles: [".dp-panel{background-color:#fff;border:1px solid var(--shk-surface-200);border-radius:.75rem;box-shadow:0 12px 32px -8px #0000002e,0 2px 6px #0000000f;color:var(--shk-surface-700)}.dark .dp-panel{background-color:var(--shk-surface-100)}.dp-nav{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:9999px;color:var(--shk-surface-500);transition:background-color .15s,color .15s}.dp-nav:hover:not(:disabled){background-color:var(--shk-surface-100);color:var(--shk-surface-800)}.dark .dp-nav:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-nav:disabled{opacity:.3;cursor:not-allowed}.dp-title{font-size:.875rem;font-weight:600;padding:.25rem .5rem;border-radius:.375rem;color:var(--shk-surface-800);transition:background-color .15s}button.dp-title:hover{background-color:var(--shk-surface-100)}.dark button.dp-title:hover{background-color:var(--shk-surface-200)}.dp-month-divider{position:relative}.dp-month-divider:before{content:\"\";position:absolute;top:-1rem;bottom:0;left:-.75rem;border-left:1px solid var(--shk-surface-200)}.dp-weekday{text-align:center;font-size:.75rem;font-weight:500;color:var(--shk-surface-500);padding:.25rem 0}.dp-cell{position:relative;display:flex;align-items:center;justify-content:center;height:2.25rem}.dp-cell.in-range:before,.dp-cell.range-start:before,.dp-cell.range-end:before{content:\"\";position:absolute;inset:.125rem 0;background-color:color-mix(in srgb,var(--shk-primary-500) 12%,transparent)}.dp-cell.range-start:before{left:50%}.dp-cell.range-end:before{right:50%}.dp-cell.range-start.range-end:before{display:none}.dp-day{position:relative;z-index:1;width:2.125rem;height:2.125rem;border-radius:9999px;font-size:.8125rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-200)}.dp-day.is-outside{color:var(--shk-surface-400)}.dp-day.is-today{font-weight:700;color:var(--shk-primary-600);background-color:color-mix(in srgb,var(--shk-primary-500) 10%,transparent)}.dp-day.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-day:disabled{opacity:.3;cursor:not-allowed;text-decoration:line-through}.dp-dot{position:absolute;left:50%;bottom:.25rem;width:.25rem;height:.25rem;border-radius:9999px;transform:translate(-50%);background-color:var(--shk-primary-500)}.dp-day.is-selected .dp-dot{background-color:#fff}.dp-chip{padding:.5rem 0;font-size:.8125rem;border-radius:.5rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-chip.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-chip.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-btn{display:inline-flex;align-items:center;justify-content:center;padding:.4375rem .875rem;font-size:.8125rem;font-weight:500;border-radius:.5rem;border:1px solid var(--shk-surface-200);color:var(--shk-surface-700);background-color:transparent;transition:background-color .15s,border-color .15s;white-space:nowrap}.dp-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}.dark .dp-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-btn-primary{border-color:var(--shk-primary-500);background-color:var(--shk-primary-500);color:#fff}.dp-btn-primary:hover:not(:disabled){background-color:var(--shk-primary-700)!important;border-color:var(--shk-primary-700)}.dp-btn:disabled{opacity:.5;cursor:not-allowed}.dp-mini-input{width:100%;min-width:0;padding:.4375rem .625rem;font-size:.8125rem;border-radius:.5rem;border:1px solid var(--shk-surface-200);background-color:transparent;color:var(--shk-surface-700);outline:none;transition:border-color .15s,box-shadow .15s}.dp-mini-input:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.dp-mini-input.input-error{border-color:var(--shk-error-500)}.dp-divider{border-color:var(--shk-surface-200)}.dp-time-col{position:relative;flex:1 1 0;min-width:0;overflow-y:auto;scrollbar-width:thin;scroll-behavior:smooth;padding:0 .125rem}.dp-time-col+.dp-time-col{border-left:1px solid var(--shk-surface-200)}.dp-time-item{display:flex;align-items:center;justify-content:center;width:100%;height:2rem;margin:.125rem 0;border-radius:.5rem;font-size:.8125rem;font-variant-numeric:tabular-nums;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-time-item.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-time-item.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.date-input-field{width:100%;padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;border-radius:.5rem;outline:none;transition:border-color .15s,box-shadow .15s;background-color:var(--shk-surface-50);color:var(--shk-surface-700);border:1px solid var(--shk-surface-200);text-overflow:ellipsis}:host-context(.dark) .date-input-field,.dark .date-input-field{background-color:var(--shk-surface-100)}.date-input-field::placeholder{color:var(--shk-surface-400)}.date-input-field:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.date-input-field:disabled{background-color:var(--shk-surface-100);color:var(--shk-surface-500);cursor:not-allowed}:host-context(.dark) .date-input-field:disabled,.dark .date-input-field:disabled{background-color:var(--shk-surface-50);color:var(--shk-surface-400)}.date-input-field.input-error,:host-context(.dark) .date-input-field.input-error,.dark .date-input-field.input-error{border-color:var(--shk-error-500)}.date-input-field.input-error:focus,:host-context(.dark) .date-input-field.input-error:focus,.dark .date-input-field.input-error:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-error-500) 22%,transparent)}.date-input-field.input-valid,:host-context(.dark) .date-input-field.input-valid,.dark .date-input-field.input-valid{border-color:#22c55e}.date-input-field.input-valid:focus,:host-context(.dark) .date-input-field.input-valid:focus,.dark .date-input-field.input-valid:focus{box-shadow:0 0 0 3px #22c55e33}\n"] }]
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1
|
+
import * as i1 from "@angular/common";
|
|
2
|
+
import { CommonModule } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, ElementRef, HostListener, Injector, afterNextRender, computed, effect, forwardRef, inject, input, model, output, signal, untracked, viewChild } from "@angular/core";
|
|
5
|
+
import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from "@angular/forms";
|
|
6
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
7
|
+
import { TranslocoService } from "@jsverse/transloco";
|
|
8
|
+
import { PortalDirective } from "shirkasoft-ui-components/utils";
|
|
9
|
+
import { ShkConfigService, formatDate, formatDateStyle, resolveDateFormat, typedDateLayout } from "shirkasoft-ui-components/config";
|
|
10
|
+
var DatePickerComponent = class DatePickerComponent {
|
|
11
|
+
get _value() {
|
|
12
|
+
return this.value;
|
|
13
|
+
}
|
|
14
|
+
constructor() {
|
|
15
|
+
this.elementRef = inject(ElementRef);
|
|
16
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
17
|
+
this.destroyRef = inject(DestroyRef);
|
|
18
|
+
this.injector = inject(Injector);
|
|
19
|
+
this.transloco = inject(TranslocoService);
|
|
20
|
+
this.id = input("", ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
21
|
+
this.view = input("date", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
22
|
+
this.weekStart = input(null, ...ngDevMode ? [{ debugName: "weekStart" }] : /* istanbul ignore next */ []);
|
|
23
|
+
this.range = input(false, ...ngDevMode ? [{ debugName: "range" }] : /* istanbul ignore next */ []);
|
|
24
|
+
this.markedDates = input([], ...ngDevMode ? [{ debugName: "markedDates" }] : /* istanbul ignore next */ []);
|
|
25
|
+
this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
26
|
+
this.placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
27
|
+
this.formGroup = input(void 0, ...ngDevMode ? [{ debugName: "formGroup" }] : /* istanbul ignore next */ []);
|
|
28
|
+
this.controlName = input("", ...ngDevMode ? [{ debugName: "controlName" }] : /* istanbul ignore next */ []);
|
|
29
|
+
this.control = input(void 0, ...ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []);
|
|
30
|
+
this.disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
31
|
+
this.errorMessage = input("", ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
32
|
+
this.errorMessages = input({}, ...ngDevMode ? [{ debugName: "errorMessages" }] : /* istanbul ignore next */ []);
|
|
33
|
+
this.minValue = input("", ...ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []);
|
|
34
|
+
this.maxValue = input("", ...ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []);
|
|
35
|
+
this.locale = input("", ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
36
|
+
this.dateFormat = input("", ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
37
|
+
this.displayStyle = input(void 0, ...ngDevMode ? [{ debugName: "displayStyle" }] : /* istanbul ignore next */ []);
|
|
38
|
+
this.timeOnly = input(false, ...ngDevMode ? [{ debugName: "timeOnly" }] : /* istanbul ignore next */ []);
|
|
39
|
+
this.showTime = input(false, ...ngDevMode ? [{ debugName: "showTime" }] : /* istanbul ignore next */ []);
|
|
40
|
+
this.hourFormat = input(void 0, ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
|
|
41
|
+
this.showSeconds = input(false, ...ngDevMode ? [{ debugName: "showSeconds" }] : /* istanbul ignore next */ []);
|
|
42
|
+
this.minuteStep = input(1, ...ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []);
|
|
43
|
+
this.valueFormat = input("", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
44
|
+
this.config = inject(ShkConfigService);
|
|
45
|
+
this.effectiveLocale = computed(() => this.locale() || this.config.get("dates.locale")(), ...ngDevMode ? [{ debugName: "effectiveLocale" }] : /* istanbul ignore next */ []);
|
|
46
|
+
this.effectiveHourFormat = computed(() => this.hourFormat() ?? this.config.get("dates.hourFormat")(), ...ngDevMode ? [{ debugName: "effectiveHourFormat" }] : /* istanbul ignore next */ []);
|
|
47
|
+
this.effectiveDateFormat = computed(() => resolveDateFormat(this.dateFormat() || this.config.get("dates.format")(), this.effectiveLocale()), ...ngDevMode ? [{ debugName: "effectiveDateFormat" }] : /* istanbul ignore next */ []);
|
|
48
|
+
this.typedLayout = computed(() => typedDateLayout(this.effectiveDateFormat()), ...ngDevMode ? [{ debugName: "typedLayout" }] : /* istanbul ignore next */ []);
|
|
49
|
+
this.effectiveDisplayStyle = computed(() => this.displayStyle() ?? this.config.get("dates.displayStyle")(), ...ngDevMode ? [{ debugName: "effectiveDisplayStyle" }] : /* istanbul ignore next */ []);
|
|
50
|
+
this.overlay = viewChild("overlay", ...ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []);
|
|
51
|
+
this.anchor = viewChild("anchor", ...ngDevMode ? [{ debugName: "anchor" }] : /* istanbul ignore next */ []);
|
|
52
|
+
this.panel = viewChild("panel", ...ngDevMode ? [{ debugName: "panel" }] : /* istanbul ignore next */ []);
|
|
53
|
+
this.panelPosition = signal(null, ...ngDevMode ? [{ debugName: "panelPosition" }] : /* istanbul ignore next */ []);
|
|
54
|
+
this.isOpen = signal(false, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
|
|
55
|
+
this.currentView = signal("date", ...ngDevMode ? [{ debugName: "currentView" }] : /* istanbul ignore next */ []);
|
|
56
|
+
this.viewYear = signal((/* @__PURE__ */ new Date()).getFullYear(), ...ngDevMode ? [{ debugName: "viewYear" }] : /* istanbul ignore next */ []);
|
|
57
|
+
this.viewMonth = signal((/* @__PURE__ */ new Date()).getMonth(), ...ngDevMode ? [{ debugName: "viewMonth" }] : /* istanbul ignore next */ []);
|
|
58
|
+
this.viewDecade = signal(Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 12) * 12, ...ngDevMode ? [{ debugName: "viewDecade" }] : /* istanbul ignore next */ []);
|
|
59
|
+
this.viewHour = signal(0, ...ngDevMode ? [{ debugName: "viewHour" }] : /* istanbul ignore next */ []);
|
|
60
|
+
this.viewMinute = signal(0, ...ngDevMode ? [{ debugName: "viewMinute" }] : /* istanbul ignore next */ []);
|
|
61
|
+
this.viewSecond = signal(0, ...ngDevMode ? [{ debugName: "viewSecond" }] : /* istanbul ignore next */ []);
|
|
62
|
+
this.viewMeridiem = computed(() => this.viewHour() >= 12 ? "PM" : "AM", ...ngDevMode ? [{ debugName: "viewMeridiem" }] : /* istanbul ignore next */ []);
|
|
63
|
+
this.pendingDate = signal(null, ...ngDevMode ? [{ debugName: "pendingDate" }] : /* istanbul ignore next */ []);
|
|
64
|
+
this.rangeStart = signal(null, ...ngDevMode ? [{ debugName: "rangeStart" }] : /* istanbul ignore next */ []);
|
|
65
|
+
this.rangeEnd = signal(null, ...ngDevMode ? [{ debugName: "rangeEnd" }] : /* istanbul ignore next */ []);
|
|
66
|
+
this.hoverDate = signal(null, ...ngDevMode ? [{ debugName: "hoverDate" }] : /* istanbul ignore next */ []);
|
|
67
|
+
this.panelText = signal("", ...ngDevMode ? [{ debugName: "panelText" }] : /* istanbul ignore next */ []);
|
|
68
|
+
this.rangeStartText = signal("", ...ngDevMode ? [{ debugName: "rangeStartText" }] : /* istanbul ignore next */ []);
|
|
69
|
+
this.rangeEndText = signal("", ...ngDevMode ? [{ debugName: "rangeEndText" }] : /* istanbul ignore next */ []);
|
|
70
|
+
this.panelTextError = signal(null, ...ngDevMode ? [{ debugName: "panelTextError" }] : /* istanbul ignore next */ []);
|
|
71
|
+
this.isTyping = signal(false, ...ngDevMode ? [{ debugName: "isTyping" }] : /* istanbul ignore next */ []);
|
|
72
|
+
this.typedValue = signal("", ...ngDevMode ? [{ debugName: "typedValue" }] : /* istanbul ignore next */ []);
|
|
73
|
+
this.typingValid = signal(null, ...ngDevMode ? [{ debugName: "typingValid" }] : /* istanbul ignore next */ []);
|
|
74
|
+
this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
75
|
+
this._disabledState = signal(false, ...ngDevMode ? [{ debugName: "_disabledState" }] : /* istanbul ignore next */ []);
|
|
76
|
+
this.subscribed = signal(false, ...ngDevMode ? [{ debugName: "subscribed" }] : /* istanbul ignore next */ []);
|
|
77
|
+
this.valueSubscribed = signal(false, ...ngDevMode ? [{ debugName: "valueSubscribed" }] : /* istanbul ignore next */ []);
|
|
78
|
+
this.errorTracker = signal(0, ...ngDevMode ? [{ debugName: "errorTracker" }] : /* istanbul ignore next */ []);
|
|
79
|
+
this.hadError = signal(false, ...ngDevMode ? [{ debugName: "hadError" }] : /* istanbul ignore next */ []);
|
|
80
|
+
this.onChange = () => {};
|
|
81
|
+
this.onTouched = () => {};
|
|
82
|
+
this.isDisabled = computed(() => this.disabled() || this._disabledState(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
83
|
+
this.actualControl = computed(() => {
|
|
84
|
+
const ctrl = this.control();
|
|
85
|
+
if (ctrl) return ctrl;
|
|
86
|
+
const fg = this.formGroup();
|
|
87
|
+
if (!fg) return void 0;
|
|
88
|
+
const name = this.controlName() || this.label();
|
|
89
|
+
if (!name) return void 0;
|
|
90
|
+
return fg.get(name) ?? void 0;
|
|
91
|
+
}, ...ngDevMode ? [{ debugName: "actualControl" }] : /* istanbul ignore next */ []);
|
|
92
|
+
this.shouldShowError = computed(() => {
|
|
93
|
+
this.errorTracker();
|
|
94
|
+
const ctrl = this.actualControl();
|
|
95
|
+
return ctrl?.invalid && (ctrl?.dirty || ctrl?.touched);
|
|
96
|
+
}, ...ngDevMode ? [{ debugName: "shouldShowError" }] : /* istanbul ignore next */ []);
|
|
97
|
+
this.wasFixedError = computed(() => {
|
|
98
|
+
this.errorTracker();
|
|
99
|
+
const ctrl = this.actualControl();
|
|
100
|
+
return this.hadError() && ctrl?.valid && ctrl?.touched;
|
|
101
|
+
}, ...ngDevMode ? [{ debugName: "wasFixedError" }] : /* istanbul ignore next */ []);
|
|
102
|
+
this.getErrorMessages = computed(() => {
|
|
103
|
+
this.errorTracker();
|
|
104
|
+
const customError = this.errorMessage();
|
|
105
|
+
if (customError) return [customError];
|
|
106
|
+
const ctrl = this.actualControl();
|
|
107
|
+
if (!ctrl?.errors) return [];
|
|
108
|
+
const customErrors = this.errorMessages();
|
|
109
|
+
return Object.keys(ctrl.errors).map((key) => {
|
|
110
|
+
if (customErrors[key]) return customErrors[key];
|
|
111
|
+
return key === "required" ? this.transloco.translate("validation.required") : this.transloco.translate("validation.invalid");
|
|
112
|
+
});
|
|
113
|
+
}, ...ngDevMode ? [{ debugName: "getErrorMessages" }] : /* istanbul ignore next */ []);
|
|
114
|
+
this.texts = computed(() => this.effectiveLocale().startsWith("en") ? {
|
|
115
|
+
today: "Today",
|
|
116
|
+
now: "Now",
|
|
117
|
+
cancel: "Cancel",
|
|
118
|
+
apply: "Apply",
|
|
119
|
+
hour: "Hour",
|
|
120
|
+
minute: "Min",
|
|
121
|
+
second: "Sec",
|
|
122
|
+
week: "Week",
|
|
123
|
+
open: "Open calendar",
|
|
124
|
+
prevMonth: "Previous month",
|
|
125
|
+
nextMonth: "Next month",
|
|
126
|
+
prevYear: "Previous year",
|
|
127
|
+
nextYear: "Next year",
|
|
128
|
+
prevYears: "Previous years",
|
|
129
|
+
nextYears: "Next years"
|
|
130
|
+
} : {
|
|
131
|
+
today: "Hoy",
|
|
132
|
+
now: "Ahora",
|
|
133
|
+
cancel: "Cancelar",
|
|
134
|
+
apply: "Aplicar",
|
|
135
|
+
hour: "Hora",
|
|
136
|
+
minute: "Min",
|
|
137
|
+
second: "Seg",
|
|
138
|
+
week: "Semana",
|
|
139
|
+
open: "Abrir calendario",
|
|
140
|
+
prevMonth: "Mes anterior",
|
|
141
|
+
nextMonth: "Mes siguiente",
|
|
142
|
+
prevYear: "Año anterior",
|
|
143
|
+
nextYear: "Año siguiente",
|
|
144
|
+
prevYears: "Años anteriores",
|
|
145
|
+
nextYears: "Años siguientes"
|
|
146
|
+
}, ...ngDevMode ? [{ debugName: "texts" }] : /* istanbul ignore next */ []);
|
|
147
|
+
this.todayISO = signal(this.toISODate(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "todayISO" }] : /* istanbul ignore next */ []);
|
|
148
|
+
this.currentHour = signal((/* @__PURE__ */ new Date()).getHours(), ...ngDevMode ? [{ debugName: "currentHour" }] : /* istanbul ignore next */ []);
|
|
149
|
+
this.effectiveStep = computed(() => Math.max(1, Math.min(30, this.minuteStep() || 1)), ...ngDevMode ? [{ debugName: "effectiveStep" }] : /* istanbul ignore next */ []);
|
|
150
|
+
this.showTimeColumns = computed(() => this.timeOnly() || this.showTime() && !this.range(), ...ngDevMode ? [{ debugName: "showTimeColumns" }] : /* istanbul ignore next */ []);
|
|
151
|
+
this.outsideNavTimer = null;
|
|
152
|
+
this.lastWheelNav = 0;
|
|
153
|
+
this.firstDayOfWeek = computed(() => {
|
|
154
|
+
const ws = this.weekStart() ?? this.config.get("dates.weekStart")();
|
|
155
|
+
if (ws !== null && ws !== void 0) return (ws % 7 + 7) % 7;
|
|
156
|
+
return this.effectiveLocale().startsWith("en") ? 0 : 1;
|
|
157
|
+
}, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
|
|
158
|
+
this.displayedDate = computed(() => {
|
|
159
|
+
if (this.timeOnly() || this.range()) return null;
|
|
160
|
+
const pending = this.pendingDate();
|
|
161
|
+
if (pending) return pending;
|
|
162
|
+
const current = this._value();
|
|
163
|
+
return current ? this.datePartOf(current) : null;
|
|
164
|
+
}, ...ngDevMode ? [{ debugName: "displayedDate" }] : /* istanbul ignore next */ []);
|
|
165
|
+
this.displayLabel = computed(() => {
|
|
166
|
+
const value = this._value();
|
|
167
|
+
if (!value) return "";
|
|
168
|
+
if (this.timeOnly()) return this.formatTimeFromValue(value);
|
|
169
|
+
if (this.range()) {
|
|
170
|
+
const [start, end] = value.split("|");
|
|
171
|
+
return `${this.formatMedium(start)} – ${this.formatMedium(end)}`;
|
|
172
|
+
}
|
|
173
|
+
const datePart = this.datePartOf(value);
|
|
174
|
+
const timePart = value.includes("T") ? value.split("T")[1] : null;
|
|
175
|
+
const v = this.view();
|
|
176
|
+
let label;
|
|
177
|
+
if (v === "year") label = datePart;
|
|
178
|
+
else if (v === "month") {
|
|
179
|
+
const [y, m] = datePart.split("-").map(Number);
|
|
180
|
+
label = this.capitalize(new Intl.DateTimeFormat(this.effectiveLocale(), {
|
|
181
|
+
month: "long",
|
|
182
|
+
year: "numeric"
|
|
183
|
+
}).format(new Date(y, m - 1, 1)));
|
|
184
|
+
} else if (v === "week") {
|
|
185
|
+
const start = this.parseISO(datePart);
|
|
186
|
+
label = this.formatWeekRange(start, this.addDays(start, 6));
|
|
187
|
+
} else label = this.formatDisplay(datePart);
|
|
188
|
+
if (this.showTime() && timePart) label += " " + this.formatTimeFromValue(timePart);
|
|
189
|
+
return label;
|
|
190
|
+
}, ...ngDevMode ? [{ debugName: "displayLabel" }] : /* istanbul ignore next */ []);
|
|
191
|
+
this.monthNames = computed(() => {
|
|
192
|
+
const fmt = new Intl.DateTimeFormat(this.effectiveLocale(), { month: "short" });
|
|
193
|
+
return Array.from({ length: 12 }, (_, i) => this.capitalize(fmt.format(new Date(2e3, i, 1)).replace(".", "")));
|
|
194
|
+
}, ...ngDevMode ? [{ debugName: "monthNames" }] : /* istanbul ignore next */ []);
|
|
195
|
+
this.monthLongNames = computed(() => {
|
|
196
|
+
const fmt = new Intl.DateTimeFormat(this.effectiveLocale(), { month: "long" });
|
|
197
|
+
return Array.from({ length: 12 }, (_, i) => this.capitalize(fmt.format(new Date(2e3, i, 1))));
|
|
198
|
+
}, ...ngDevMode ? [{ debugName: "monthLongNames" }] : /* istanbul ignore next */ []);
|
|
199
|
+
this.dayNames = computed(() => {
|
|
200
|
+
const fmt = new Intl.DateTimeFormat(this.effectiveLocale(), { weekday: "short" });
|
|
201
|
+
const first = this.firstDayOfWeek();
|
|
202
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
203
|
+
const name = fmt.format(new Date(2024, 0, 7 + (first + i) % 7)).replace(".", "");
|
|
204
|
+
return this.capitalize(name.slice(0, 2));
|
|
205
|
+
});
|
|
206
|
+
}, ...ngDevMode ? [{ debugName: "dayNames" }] : /* istanbul ignore next */ []);
|
|
207
|
+
this.visibleMonths = computed(() => {
|
|
208
|
+
const y = this.viewYear();
|
|
209
|
+
const m = this.viewMonth();
|
|
210
|
+
const months = [this.buildMonth(y, m)];
|
|
211
|
+
if (this.range()) {
|
|
212
|
+
const next = new Date(y, m + 1, 1);
|
|
213
|
+
months.push(this.buildMonth(next.getFullYear(), next.getMonth()));
|
|
214
|
+
}
|
|
215
|
+
return months;
|
|
216
|
+
}, ...ngDevMode ? [{ debugName: "visibleMonths" }] : /* istanbul ignore next */ []);
|
|
217
|
+
this.markedSet = computed(() => new Set(this.markedDates()), ...ngDevMode ? [{ debugName: "markedSet" }] : /* istanbul ignore next */ []);
|
|
218
|
+
this.monthWeeks = computed(() => {
|
|
219
|
+
const year = this.viewYear();
|
|
220
|
+
const month = this.viewMonth();
|
|
221
|
+
const first = new Date(year, month, 1);
|
|
222
|
+
const last = new Date(year, month + 1, 0);
|
|
223
|
+
let cursor = this.startOfWeek(first);
|
|
224
|
+
const weeks = [];
|
|
225
|
+
let index = 0;
|
|
226
|
+
while (cursor.getTime() <= last.getTime()) {
|
|
227
|
+
index++;
|
|
228
|
+
const start = cursor;
|
|
229
|
+
const end = this.addDays(start, 6);
|
|
230
|
+
weeks.push({
|
|
231
|
+
index,
|
|
232
|
+
start,
|
|
233
|
+
end,
|
|
234
|
+
range: this.formatWeekRange(start, end)
|
|
235
|
+
});
|
|
236
|
+
cursor = this.addDays(start, 7);
|
|
237
|
+
}
|
|
238
|
+
return weeks;
|
|
239
|
+
}, ...ngDevMode ? [{ debugName: "monthWeeks" }] : /* istanbul ignore next */ []);
|
|
240
|
+
this.decadeYears = computed(() => {
|
|
241
|
+
const start = this.viewDecade();
|
|
242
|
+
return Array.from({ length: 12 }, (_, i) => start + i);
|
|
243
|
+
}, ...ngDevMode ? [{ debugName: "decadeYears" }] : /* istanbul ignore next */ []);
|
|
244
|
+
this.headerTitle = computed(() => {
|
|
245
|
+
const v = this.currentView();
|
|
246
|
+
if (v === "year") return `${this.viewDecade()} – ${this.viewDecade() + 11}`;
|
|
247
|
+
if (v === "month") return String(this.viewYear());
|
|
248
|
+
return `${this.monthLongNames()[this.viewMonth()]} ${this.viewYear()}`;
|
|
249
|
+
}, ...ngDevMode ? [{ debugName: "headerTitle" }] : /* istanbul ignore next */ []);
|
|
250
|
+
this.canGoPrev = computed(() => {
|
|
251
|
+
const min = this.minValue();
|
|
252
|
+
if (!min) return true;
|
|
253
|
+
const minY = Number(min.slice(0, 4));
|
|
254
|
+
const v = this.currentView();
|
|
255
|
+
if (v === "date" || v === "week") return this.toISODate(new Date(this.viewYear(), this.viewMonth(), 0)).slice(0, min.length) >= min.slice(0, 10);
|
|
256
|
+
if (v === "month") return this.viewYear() > minY;
|
|
257
|
+
return this.viewDecade() > minY;
|
|
258
|
+
}, ...ngDevMode ? [{ debugName: "canGoPrev" }] : /* istanbul ignore next */ []);
|
|
259
|
+
this.canGoNext = computed(() => {
|
|
260
|
+
const max = this.maxValue();
|
|
261
|
+
if (!max) return true;
|
|
262
|
+
const maxY = Number(max.slice(0, 4));
|
|
263
|
+
const v = this.currentView();
|
|
264
|
+
if (v === "date" || v === "week") {
|
|
265
|
+
const extra = this.range() ? 2 : 1;
|
|
266
|
+
return this.toISODate(new Date(this.viewYear(), this.viewMonth() + extra, 1)).slice(0, max.length) <= max.slice(0, 10);
|
|
267
|
+
}
|
|
268
|
+
if (v === "month") return this.viewYear() < maxY;
|
|
269
|
+
return this.viewDecade() + 11 < maxY;
|
|
270
|
+
}, ...ngDevMode ? [{ debugName: "canGoNext" }] : /* istanbul ignore next */ []);
|
|
271
|
+
this.showFooter = computed(() => this.timeOnly() || this.range() || this.view() === "date" || this.showTime(), ...ngDevMode ? [{ debugName: "showFooter" }] : /* istanbul ignore next */ []);
|
|
272
|
+
this.canApply = computed(() => {
|
|
273
|
+
if (this.timeOnly()) return true;
|
|
274
|
+
if (this.range()) return !!this.rangeStart();
|
|
275
|
+
return !!this.pendingDate();
|
|
276
|
+
}, ...ngDevMode ? [{ debugName: "canApply" }] : /* istanbul ignore next */ []);
|
|
277
|
+
this.inputFormat = computed(() => {
|
|
278
|
+
const { order, separator } = this.typedLayout();
|
|
279
|
+
const names = {
|
|
280
|
+
d: "DD",
|
|
281
|
+
m: "MM",
|
|
282
|
+
y: "YYYY"
|
|
283
|
+
};
|
|
284
|
+
return order.map((field) => names[field]).join(separator);
|
|
285
|
+
}, ...ngDevMode ? [{ debugName: "inputFormat" }] : /* istanbul ignore next */ []);
|
|
286
|
+
this.touch = output();
|
|
287
|
+
this.canZoomOut = computed(() => this.currentView() !== "year", ...ngDevMode ? [{ debugName: "canZoomOut" }] : /* istanbul ignore next */ []);
|
|
288
|
+
this.effectiveEnd = computed(() => {
|
|
289
|
+
const start = this.rangeStart();
|
|
290
|
+
const end = this.rangeEnd();
|
|
291
|
+
if (end) return end;
|
|
292
|
+
const hover = this.hoverDate();
|
|
293
|
+
return start && hover && hover > start ? hover : null;
|
|
294
|
+
}, ...ngDevMode ? [{ debugName: "effectiveEnd" }] : /* istanbul ignore next */ []);
|
|
295
|
+
this.hourOptions = computed(() => {
|
|
296
|
+
if (this.effectiveHourFormat() === "12") {
|
|
297
|
+
const pm = this.viewMeridiem() === "PM" ? 12 : 0;
|
|
298
|
+
return [
|
|
299
|
+
12,
|
|
300
|
+
1,
|
|
301
|
+
2,
|
|
302
|
+
3,
|
|
303
|
+
4,
|
|
304
|
+
5,
|
|
305
|
+
6,
|
|
306
|
+
7,
|
|
307
|
+
8,
|
|
308
|
+
9,
|
|
309
|
+
10,
|
|
310
|
+
11
|
|
311
|
+
].map((h) => ({
|
|
312
|
+
value: h % 12 + pm,
|
|
313
|
+
label: this.pad2(h)
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
return Array.from({ length: 24 }, (_, h) => ({
|
|
317
|
+
value: h,
|
|
318
|
+
label: this.pad2(h)
|
|
319
|
+
}));
|
|
320
|
+
}, ...ngDevMode ? [{ debugName: "hourOptions" }] : /* istanbul ignore next */ []);
|
|
321
|
+
this.minuteOptions = computed(() => {
|
|
322
|
+
const step = this.effectiveStep();
|
|
323
|
+
return Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step);
|
|
324
|
+
}, ...ngDevMode ? [{ debugName: "minuteOptions" }] : /* istanbul ignore next */ []);
|
|
325
|
+
this.secondOptions = Array.from({ length: 60 }, (_, i) => i);
|
|
326
|
+
this.timeText = computed(() => this.formatTime(this.viewHour(), this.viewMinute(), this.viewSecond()), ...ngDevMode ? [{ debugName: "timeText" }] : /* istanbul ignore next */ []);
|
|
327
|
+
this.timeTextError = signal(false, ...ngDevMode ? [{ debugName: "timeTextError" }] : /* istanbul ignore next */ []);
|
|
328
|
+
const doc = this.elementRef.nativeElement.ownerDocument;
|
|
329
|
+
const onScroll = () => this.onViewportChange();
|
|
330
|
+
doc.addEventListener("scroll", onScroll, true);
|
|
331
|
+
this.destroyRef.onDestroy(() => {
|
|
332
|
+
doc.removeEventListener("scroll", onScroll, true);
|
|
333
|
+
this.cancelOutsideNav();
|
|
334
|
+
});
|
|
335
|
+
effect(() => {
|
|
336
|
+
this.currentView();
|
|
337
|
+
if (untracked(() => this.isOpen())) this.schedulePosition();
|
|
338
|
+
});
|
|
339
|
+
effect(() => {
|
|
340
|
+
const pending = this.pendingDate();
|
|
341
|
+
const start = this.rangeStart();
|
|
342
|
+
const end = this.rangeEnd();
|
|
343
|
+
untracked(() => {
|
|
344
|
+
this.panelText.set(pending ? this.formatTyped(pending) : "");
|
|
345
|
+
this.rangeStartText.set(start ? this.formatTyped(start) : "");
|
|
346
|
+
this.rangeEndText.set(end ? this.formatTyped(end) : "");
|
|
347
|
+
this.panelTextError.set(null);
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
effect(() => {
|
|
351
|
+
const ctrl = this.actualControl();
|
|
352
|
+
if (!ctrl) {
|
|
353
|
+
this.subscribed.set(false);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (this.subscribed()) return;
|
|
357
|
+
if (ctrl.invalid && ctrl.touched) this.hadError.set(true);
|
|
358
|
+
ctrl.statusChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
359
|
+
this.errorTracker.update((v) => v + 1);
|
|
360
|
+
if (ctrl.invalid && ctrl.touched) this.hadError.set(true);
|
|
361
|
+
});
|
|
362
|
+
this.subscribed.set(true);
|
|
363
|
+
});
|
|
364
|
+
effect(() => {
|
|
365
|
+
const ctrl = this.actualControl();
|
|
366
|
+
if (!ctrl || this.valueSubscribed()) return;
|
|
367
|
+
this.writeValue(ctrl.value);
|
|
368
|
+
ctrl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => this.writeValue(value));
|
|
369
|
+
this.valueSubscribed.set(true);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
onDocumentClick(event) {
|
|
373
|
+
if (!this.isOpen()) return;
|
|
374
|
+
const target = event.target;
|
|
375
|
+
const overlay = this.overlay()?.nativeElement;
|
|
376
|
+
if (!this.elementRef.nativeElement.contains(target) && !overlay?.contains(target)) this.close();
|
|
377
|
+
}
|
|
378
|
+
onViewportChange() {
|
|
379
|
+
if (this.isOpen()) this.positionPanel();
|
|
380
|
+
}
|
|
381
|
+
onEscape() {
|
|
382
|
+
this.close();
|
|
383
|
+
}
|
|
384
|
+
schedulePosition() {
|
|
385
|
+
afterNextRender(() => this.positionPanel(), { injector: this.injector });
|
|
386
|
+
}
|
|
387
|
+
positionPanel() {
|
|
388
|
+
const anchor = this.anchor()?.nativeElement;
|
|
389
|
+
const panel = this.panel()?.nativeElement;
|
|
390
|
+
if (!anchor || !panel) return;
|
|
391
|
+
const margin = 8;
|
|
392
|
+
const gap = 4;
|
|
393
|
+
const rect = anchor.getBoundingClientRect();
|
|
394
|
+
const height = panel.offsetHeight;
|
|
395
|
+
const width = panel.offsetWidth;
|
|
396
|
+
let top = rect.bottom + gap;
|
|
397
|
+
if (top + height > window.innerHeight - margin && rect.top - gap - height >= margin) top = rect.top - gap - height;
|
|
398
|
+
top = Math.max(margin, Math.min(top, window.innerHeight - height - margin));
|
|
399
|
+
const left = Math.max(margin, Math.min(rect.left, window.innerWidth - width - margin));
|
|
400
|
+
this.panelPosition.set({
|
|
401
|
+
top,
|
|
402
|
+
left
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
toggle() {
|
|
406
|
+
if (this.isDisabled()) return;
|
|
407
|
+
if (this.isOpen()) {
|
|
408
|
+
this.close();
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const now = /* @__PURE__ */ new Date();
|
|
412
|
+
this.todayISO.set(this.toISODate(now));
|
|
413
|
+
this.currentHour.set(now.getHours());
|
|
414
|
+
this.syncViewToValue();
|
|
415
|
+
this.currentView.set(this.view());
|
|
416
|
+
this.isTyping.set(false);
|
|
417
|
+
this.panelPosition.set(null);
|
|
418
|
+
this.isOpen.set(true);
|
|
419
|
+
this.timeTextError.set(false);
|
|
420
|
+
this.schedulePosition();
|
|
421
|
+
if (this.showTimeColumns()) this.scheduleTimeScroll();
|
|
422
|
+
}
|
|
423
|
+
close() {
|
|
424
|
+
if (!this.isOpen()) return;
|
|
425
|
+
this.touch.emit();
|
|
426
|
+
this.cancelOutsideNav();
|
|
427
|
+
this.isOpen.set(false);
|
|
428
|
+
this.hoverDate.set(null);
|
|
429
|
+
this.onTouched();
|
|
430
|
+
const ctrl = this.actualControl();
|
|
431
|
+
if (ctrl) ctrl.markAsTouched();
|
|
432
|
+
this.errorTracker.update((v) => v + 1);
|
|
433
|
+
if (ctrl?.invalid && ctrl?.touched) this.hadError.set(true);
|
|
434
|
+
}
|
|
435
|
+
syncViewToValue() {
|
|
436
|
+
const val = this._value();
|
|
437
|
+
const now = /* @__PURE__ */ new Date();
|
|
438
|
+
this.pendingDate.set(null);
|
|
439
|
+
this.rangeStart.set(null);
|
|
440
|
+
this.rangeEnd.set(null);
|
|
441
|
+
this.hoverDate.set(null);
|
|
442
|
+
if (!val) {
|
|
443
|
+
this.goToDate(now);
|
|
444
|
+
this.setNowTime(now);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
if (this.range()) {
|
|
448
|
+
const [start, end] = val.split("|");
|
|
449
|
+
this.rangeStart.set(start);
|
|
450
|
+
this.rangeEnd.set(end);
|
|
451
|
+
this.goToDate(this.parseISO(start));
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
if (this.timeOnly()) {
|
|
455
|
+
this.setClockFrom(val);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
const datePart = this.datePartOf(val);
|
|
459
|
+
const v = this.view();
|
|
460
|
+
if (v === "year") {
|
|
461
|
+
this.viewYear.set(Number(datePart));
|
|
462
|
+
this.viewDecade.set(this.decadeOf(Number(datePart)));
|
|
463
|
+
} else if (v === "month") {
|
|
464
|
+
this.viewYear.set(Number(datePart.slice(0, 4)));
|
|
465
|
+
this.viewMonth.set(Number(datePart.slice(5, 7)) - 1);
|
|
466
|
+
} else this.goToDate(this.parseISO(datePart));
|
|
467
|
+
if (val.includes("T")) this.setClockFrom(val.split("T")[1]);
|
|
468
|
+
this.pendingDate.set(datePart);
|
|
469
|
+
}
|
|
470
|
+
prev() {
|
|
471
|
+
this.shift(-1);
|
|
472
|
+
}
|
|
473
|
+
next() {
|
|
474
|
+
this.shift(1);
|
|
475
|
+
}
|
|
476
|
+
shift(dir) {
|
|
477
|
+
const v = this.currentView();
|
|
478
|
+
if (v === "year") this.viewDecade.update((d) => d + 12 * dir);
|
|
479
|
+
else if (v === "month") this.viewYear.update((y) => y + dir);
|
|
480
|
+
else this.goToDate(new Date(this.viewYear(), this.viewMonth() + dir, 1));
|
|
481
|
+
}
|
|
482
|
+
zoomOut() {
|
|
483
|
+
const v = this.currentView();
|
|
484
|
+
if (v === "date" || v === "week") this.currentView.set("month");
|
|
485
|
+
else if (v === "month") {
|
|
486
|
+
this.viewDecade.set(this.decadeOf(this.viewYear()));
|
|
487
|
+
this.currentView.set("year");
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
onWheel(event) {
|
|
491
|
+
if (Math.abs(event.deltaY) < 20) return;
|
|
492
|
+
event.preventDefault();
|
|
493
|
+
const now = Date.now();
|
|
494
|
+
if (now - this.lastWheelNav < DatePickerComponent.WHEEL_THROTTLE_MS) return;
|
|
495
|
+
this.lastWheelNav = now;
|
|
496
|
+
if (event.deltaY > 0 ? this.canGoNext() : this.canGoPrev()) this.shift(event.deltaY > 0 ? 1 : -1);
|
|
497
|
+
}
|
|
498
|
+
onPanelKeydown(event) {
|
|
499
|
+
if (event.key === "PageUp" && this.canGoPrev()) {
|
|
500
|
+
event.preventDefault();
|
|
501
|
+
this.prev();
|
|
502
|
+
} else if (event.key === "PageDown" && this.canGoNext()) {
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
this.next();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
goToday() {
|
|
508
|
+
const today = /* @__PURE__ */ new Date();
|
|
509
|
+
this.currentView.set(this.view() === "week" ? "week" : "date");
|
|
510
|
+
this.goToDate(today);
|
|
511
|
+
if (!this.range() && !this.isDisabledDate(this.toISODate(today))) this.pendingDate.set(this.toISODate(today));
|
|
512
|
+
}
|
|
513
|
+
selectDay(cell) {
|
|
514
|
+
if (this.isDisabledDate(cell.iso)) return;
|
|
515
|
+
if (this.range()) {
|
|
516
|
+
const start = this.rangeStart();
|
|
517
|
+
const end = this.rangeEnd();
|
|
518
|
+
if (!start || end || cell.iso < start) {
|
|
519
|
+
this.rangeStart.set(cell.iso);
|
|
520
|
+
this.rangeEnd.set(null);
|
|
521
|
+
} else {
|
|
522
|
+
this.rangeEnd.set(cell.iso);
|
|
523
|
+
this.hoverDate.set(null);
|
|
524
|
+
}
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
this.pendingDate.set(cell.iso);
|
|
528
|
+
this.cancelOutsideNav();
|
|
529
|
+
if (!cell.inMonth) this.outsideNavTimer = setTimeout(() => {
|
|
530
|
+
this.outsideNavTimer = null;
|
|
531
|
+
this.goToDate(this.parseISO(cell.iso));
|
|
532
|
+
this.cdr.markForCheck();
|
|
533
|
+
}, DatePickerComponent.DBLCLICK_DELAY_MS);
|
|
534
|
+
}
|
|
535
|
+
cancelOutsideNav() {
|
|
536
|
+
if (this.outsideNavTimer !== null) {
|
|
537
|
+
clearTimeout(this.outsideNavTimer);
|
|
538
|
+
this.outsideNavTimer = null;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
quickApply(cell) {
|
|
542
|
+
if (this.range() || this.showTime() || this.isDisabledDate(cell.iso)) return;
|
|
543
|
+
this.cancelOutsideNav();
|
|
544
|
+
this.pendingDate.set(cell.iso);
|
|
545
|
+
this.apply();
|
|
546
|
+
}
|
|
547
|
+
onDayHover(cell) {
|
|
548
|
+
if (!this.range() || !this.rangeStart() || this.rangeEnd()) return;
|
|
549
|
+
this.hoverDate.set(cell?.iso ?? null);
|
|
550
|
+
}
|
|
551
|
+
selectMonth(monthIndex) {
|
|
552
|
+
this.viewMonth.set(monthIndex);
|
|
553
|
+
if (this.view() === "month") {
|
|
554
|
+
this.setValue(`${this.viewYear()}-${String(monthIndex + 1).padStart(2, "0")}`);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
this.currentView.set(this.view() === "week" ? "week" : "date");
|
|
558
|
+
}
|
|
559
|
+
selectYear(year) {
|
|
560
|
+
this.viewYear.set(year);
|
|
561
|
+
if (this.view() === "year") {
|
|
562
|
+
this.setValue(String(year));
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
this.currentView.set("month");
|
|
566
|
+
}
|
|
567
|
+
selectWeek(start) {
|
|
568
|
+
const value = this.toISODate(start);
|
|
569
|
+
if (this.showTime()) {
|
|
570
|
+
this.pendingDate.set(value);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.setValue(value);
|
|
574
|
+
}
|
|
575
|
+
apply() {
|
|
576
|
+
if (!this.canApply()) return;
|
|
577
|
+
const time = this.buildTime(this.viewHour(), this.viewMinute(), this.viewSecond());
|
|
578
|
+
if (this.timeOnly()) {
|
|
579
|
+
this.setValue(time);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
if (this.range()) {
|
|
583
|
+
const start = this.rangeStart();
|
|
584
|
+
this.setValue(`${start}|${this.rangeEnd() ?? start}`);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const date = this.pendingDate();
|
|
588
|
+
this.setValue(this.showTime() ? `${date}T${time}` : date);
|
|
589
|
+
}
|
|
590
|
+
clear() {
|
|
591
|
+
this._value.set(null);
|
|
592
|
+
this.onChange(null);
|
|
593
|
+
const ctrl = this.actualControl();
|
|
594
|
+
if (ctrl) {
|
|
595
|
+
ctrl.setValue(null);
|
|
596
|
+
ctrl.markAsDirty();
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
setValue(value, close = true) {
|
|
600
|
+
this._value.set(value);
|
|
601
|
+
const output = this.toOutputValue(value);
|
|
602
|
+
this.onChange(output);
|
|
603
|
+
const ctrl = this.actualControl();
|
|
604
|
+
if (ctrl) {
|
|
605
|
+
ctrl.setValue(output);
|
|
606
|
+
ctrl.markAsDirty();
|
|
607
|
+
}
|
|
608
|
+
if (close) this.close();
|
|
609
|
+
}
|
|
610
|
+
commitPanelText(which, event) {
|
|
611
|
+
const text = event.target.value.trim();
|
|
612
|
+
const current = which === "single" ? this.pendingDate() : which === "start" ? this.rangeStart() : this.rangeEnd();
|
|
613
|
+
if (!text) {
|
|
614
|
+
this.panelTextError.set(null);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
const iso = this.parseDateText(text);
|
|
618
|
+
if (!iso || this.isDisabledDate(iso)) {
|
|
619
|
+
this.panelTextError.set(which);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
this.panelTextError.set(null);
|
|
623
|
+
if (iso === current) return;
|
|
624
|
+
if (which === "single") this.pendingDate.set(iso);
|
|
625
|
+
else if (which === "start") {
|
|
626
|
+
this.rangeStart.set(iso);
|
|
627
|
+
if (this.rangeEnd() && this.rangeEnd() < iso) this.rangeEnd.set(null);
|
|
628
|
+
} else if (!this.rangeStart() || iso < this.rangeStart()) {
|
|
629
|
+
this.rangeStart.set(iso);
|
|
630
|
+
this.rangeEnd.set(null);
|
|
631
|
+
} else this.rangeEnd.set(iso);
|
|
632
|
+
this.currentView.set("date");
|
|
633
|
+
this.goToDate(this.parseISO(iso));
|
|
634
|
+
}
|
|
635
|
+
isSelectedDate(iso) {
|
|
636
|
+
if (this.range()) return iso === this.rangeStart() || iso === this.rangeEnd();
|
|
637
|
+
return this.displayedDate() === iso;
|
|
638
|
+
}
|
|
639
|
+
isInRange(iso) {
|
|
640
|
+
const start = this.rangeStart();
|
|
641
|
+
const end = this.effectiveEnd();
|
|
642
|
+
return !!start && !!end && iso > start && iso < end;
|
|
643
|
+
}
|
|
644
|
+
isRangeStart(iso) {
|
|
645
|
+
return !!this.effectiveEnd() && iso === this.rangeStart();
|
|
646
|
+
}
|
|
647
|
+
isRangeEnd(iso) {
|
|
648
|
+
return !!this.rangeStart() && iso === this.effectiveEnd();
|
|
649
|
+
}
|
|
650
|
+
isTodayDate(iso) {
|
|
651
|
+
return iso === this.todayISO();
|
|
652
|
+
}
|
|
653
|
+
isMarked(iso) {
|
|
654
|
+
return this.markedSet().has(iso);
|
|
655
|
+
}
|
|
656
|
+
isDisabledDate(iso) {
|
|
657
|
+
const min = this.minValue();
|
|
658
|
+
const max = this.maxValue();
|
|
659
|
+
if (min && iso.slice(0, min.length) < min.slice(0, 10)) return true;
|
|
660
|
+
if (max && iso.slice(0, max.length) > max.slice(0, 10)) return true;
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
isSelectedMonth(monthIndex) {
|
|
664
|
+
const d = this.displayedDate() ?? this.rangeStart();
|
|
665
|
+
if (!d || d.length < 7) return false;
|
|
666
|
+
return Number(d.slice(0, 4)) === this.viewYear() && Number(d.slice(5, 7)) - 1 === monthIndex;
|
|
667
|
+
}
|
|
668
|
+
isCurrentMonth(monthIndex) {
|
|
669
|
+
const now = /* @__PURE__ */ new Date();
|
|
670
|
+
return this.viewYear() === now.getFullYear() && monthIndex === now.getMonth();
|
|
671
|
+
}
|
|
672
|
+
isSelectedYear(year) {
|
|
673
|
+
const d = this.displayedDate() ?? this.rangeStart();
|
|
674
|
+
return !!d && Number(d.slice(0, 4)) === year;
|
|
675
|
+
}
|
|
676
|
+
isCurrentYear(year) {
|
|
677
|
+
return (/* @__PURE__ */ new Date()).getFullYear() === year;
|
|
678
|
+
}
|
|
679
|
+
isSelectedWeek(start) {
|
|
680
|
+
const date = this.displayedDate();
|
|
681
|
+
if (!date) return false;
|
|
682
|
+
return this.toISODate(this.startOfWeek(this.parseISO(date))) === this.toISODate(start);
|
|
683
|
+
}
|
|
684
|
+
isCurrentWeek(start) {
|
|
685
|
+
return this.toISODate(this.startOfWeek(/* @__PURE__ */ new Date())) === this.toISODate(start);
|
|
686
|
+
}
|
|
687
|
+
weekLabel(index) {
|
|
688
|
+
return `${this.texts().week} ${index}`;
|
|
689
|
+
}
|
|
690
|
+
formatWeekRange(start, end) {
|
|
691
|
+
const loc = this.effectiveLocale();
|
|
692
|
+
const dayFmt = new Intl.DateTimeFormat(loc, { day: "numeric" });
|
|
693
|
+
const monthFmt = new Intl.DateTimeFormat(loc, { month: "short" });
|
|
694
|
+
const startLabel = `${dayFmt.format(start)} ${monthFmt.format(start).replace(".", "")}`;
|
|
695
|
+
if (start.getMonth() !== end.getMonth() || start.getFullYear() !== end.getFullYear()) {
|
|
696
|
+
const year = start.getFullYear() !== end.getFullYear() ? ` ${end.getFullYear()}` : "";
|
|
697
|
+
return `${startLabel} — ${dayFmt.format(end)} ${monthFmt.format(end).replace(".", "")}${year}`;
|
|
698
|
+
}
|
|
699
|
+
return `${startLabel} — ${dayFmt.format(end)}`;
|
|
700
|
+
}
|
|
701
|
+
isCurrentHour(hour) {
|
|
702
|
+
return this.currentHour() === hour;
|
|
703
|
+
}
|
|
704
|
+
selectHour(hour) {
|
|
705
|
+
this.viewHour.set(hour);
|
|
706
|
+
}
|
|
707
|
+
selectMinute(minute) {
|
|
708
|
+
this.viewMinute.set(minute);
|
|
709
|
+
}
|
|
710
|
+
selectSecond(second) {
|
|
711
|
+
this.viewSecond.set(second);
|
|
712
|
+
}
|
|
713
|
+
setMeridiem(meridiem) {
|
|
714
|
+
const h = this.viewHour();
|
|
715
|
+
if (meridiem === "PM" && h < 12) this.viewHour.set(h + 12);
|
|
716
|
+
else if (meridiem === "AM" && h >= 12) this.viewHour.set(h - 12);
|
|
717
|
+
}
|
|
718
|
+
setNow() {
|
|
719
|
+
this.setNowTime(/* @__PURE__ */ new Date());
|
|
720
|
+
this.timeTextError.set(false);
|
|
721
|
+
this.scheduleTimeScroll();
|
|
722
|
+
}
|
|
723
|
+
setNowTime(date) {
|
|
724
|
+
const step = this.effectiveStep();
|
|
725
|
+
let minute = Math.round(date.getMinutes() / step) * step;
|
|
726
|
+
let hour = date.getHours();
|
|
727
|
+
if (minute >= 60) {
|
|
728
|
+
minute = 0;
|
|
729
|
+
hour = (hour + 1) % 24;
|
|
730
|
+
}
|
|
731
|
+
this.viewHour.set(hour);
|
|
732
|
+
this.viewMinute.set(minute);
|
|
733
|
+
this.viewSecond.set(this.showSeconds() && step === 1 ? date.getSeconds() : 0);
|
|
734
|
+
}
|
|
735
|
+
commitTimeText(event) {
|
|
736
|
+
const input = event.target;
|
|
737
|
+
const text = input.value.trim();
|
|
738
|
+
if (!text || text === this.timeText()) {
|
|
739
|
+
this.timeTextError.set(false);
|
|
740
|
+
input.value = this.timeText();
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
const time = this.parseTimeOnly(text);
|
|
744
|
+
if (!time) {
|
|
745
|
+
this.timeTextError.set(true);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
this.timeTextError.set(false);
|
|
749
|
+
this.setClockFrom(time);
|
|
750
|
+
input.value = this.timeText();
|
|
751
|
+
this.scheduleTimeScroll();
|
|
752
|
+
}
|
|
753
|
+
scheduleTimeScroll() {
|
|
754
|
+
afterNextRender(() => {
|
|
755
|
+
(this.panel()?.nativeElement)?.querySelectorAll(".dp-time-col").forEach((col) => {
|
|
756
|
+
const sel = col.querySelector(".is-selected");
|
|
757
|
+
if (sel) col.scrollTop = sel.offsetTop - col.clientHeight / 2 + sel.offsetHeight / 2;
|
|
758
|
+
});
|
|
759
|
+
}, { injector: this.injector });
|
|
760
|
+
}
|
|
761
|
+
pad2(value) {
|
|
762
|
+
return String(value).padStart(2, "0");
|
|
763
|
+
}
|
|
764
|
+
inputPlaceholder() {
|
|
765
|
+
if (this.placeholder()) return this.placeholder();
|
|
766
|
+
if (this.timeOnly()) return this.effectiveHourFormat() === "12" ? "hh:mm AM" : "HH:mm";
|
|
767
|
+
if (this.range()) return `${this.inputFormat()} – ${this.inputFormat()}`;
|
|
768
|
+
if (this.view() === "year") return "YYYY";
|
|
769
|
+
if (this.view() === "month") return "MM/YYYY";
|
|
770
|
+
if (this.view() === "week") return `${this.texts().week} · MM/YYYY`;
|
|
771
|
+
return this.inputFormat();
|
|
772
|
+
}
|
|
773
|
+
onInputText(event) {
|
|
774
|
+
this.typedValue.set(event.target.value);
|
|
775
|
+
this.typingValid.set(null);
|
|
776
|
+
}
|
|
777
|
+
onInputFocus() {
|
|
778
|
+
this.isTyping.set(true);
|
|
779
|
+
this.typedValue.set(this.typedFormOfValue());
|
|
780
|
+
this.typingValid.set(null);
|
|
781
|
+
}
|
|
782
|
+
onInputBlur() {
|
|
783
|
+
const text = this.typedValue().trim();
|
|
784
|
+
this.isTyping.set(false);
|
|
785
|
+
if (!text || text === this.typedFormOfValue()) return;
|
|
786
|
+
const parsed = this.parseTypedValue(text);
|
|
787
|
+
if (parsed) {
|
|
788
|
+
this.setValue(parsed, false);
|
|
789
|
+
this.typingValid.set(true);
|
|
790
|
+
if (this.isOpen()) this.syncViewToValue();
|
|
791
|
+
} else {
|
|
792
|
+
this.typingValid.set(false);
|
|
793
|
+
setTimeout(() => this.typingValid.set(null), 1500);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
cancelTyping() {
|
|
797
|
+
this.isTyping.set(false);
|
|
798
|
+
this.typedValue.set("");
|
|
799
|
+
this.typingValid.set(null);
|
|
800
|
+
}
|
|
801
|
+
typedFormOfValue() {
|
|
802
|
+
const val = this._value();
|
|
803
|
+
if (!val) return "";
|
|
804
|
+
if (this.timeOnly()) return this.formatTimeFromValue(val);
|
|
805
|
+
if (this.range()) {
|
|
806
|
+
const [s, e] = val.split("|");
|
|
807
|
+
return `${this.formatTyped(s)} - ${this.formatTyped(e)}`;
|
|
808
|
+
}
|
|
809
|
+
const v = this.view();
|
|
810
|
+
if (v === "year") return val;
|
|
811
|
+
if (v === "month") return `${val.slice(5, 7)}/${val.slice(0, 4)}`;
|
|
812
|
+
let text = this.formatTyped(this.datePartOf(val));
|
|
813
|
+
if (val.includes("T")) text += " " + this.formatTimeFromValue(val.split("T")[1]);
|
|
814
|
+
return text;
|
|
815
|
+
}
|
|
816
|
+
parseTypedValue(text) {
|
|
817
|
+
if (this.timeOnly()) return this.parseTimeOnly(text);
|
|
818
|
+
if (this.range()) {
|
|
819
|
+
const parts = text.split(/\s+[-–]\s+|\s*–\s*/).filter(Boolean);
|
|
820
|
+
if (parts.length !== 2) return null;
|
|
821
|
+
const a = this.parseDateText(parts[0]);
|
|
822
|
+
const b = this.parseDateText(parts[1]);
|
|
823
|
+
if (!a || !b) return null;
|
|
824
|
+
return a <= b ? `${a}|${b}` : `${b}|${a}`;
|
|
825
|
+
}
|
|
826
|
+
const v = this.view();
|
|
827
|
+
if (v === "week") return null;
|
|
828
|
+
if (v === "year") {
|
|
829
|
+
const y = Number(text);
|
|
830
|
+
return /^\d{4}$/.test(text) && y >= 1900 && y <= 2100 ? String(y) : null;
|
|
831
|
+
}
|
|
832
|
+
if (v === "month") {
|
|
833
|
+
const parts = text.split(/[\/\-.\s]+/).filter(Boolean);
|
|
834
|
+
if (parts.length !== 2) return null;
|
|
835
|
+
const [a, b] = parts.map(Number);
|
|
836
|
+
const [m, y] = parts[0].length === 4 ? [b, a] : [a, b];
|
|
837
|
+
return m >= 1 && m <= 12 && y >= 1900 && y <= 2100 ? `${y}-${this.pad2(m)}` : null;
|
|
838
|
+
}
|
|
839
|
+
const [datePart, ...timeParts] = text.split(/\s+/);
|
|
840
|
+
const iso = this.parseDateText(datePart);
|
|
841
|
+
if (!iso) return null;
|
|
842
|
+
if (!this.showTime()) return iso;
|
|
843
|
+
return `${iso}T${(timeParts.length ? this.parseTimeOnly(timeParts.join(" ")) : null) ?? this.buildTime(this.viewHour(), this.viewMinute(), this.viewSecond())}`;
|
|
844
|
+
}
|
|
845
|
+
parseDateText(text) {
|
|
846
|
+
const parts = text.trim().split(/[\/\-.\s]+/).filter(Boolean);
|
|
847
|
+
if (parts.length !== 3) return null;
|
|
848
|
+
const nums = parts.map(Number);
|
|
849
|
+
const order = parts[0].length === 4 ? [
|
|
850
|
+
"y",
|
|
851
|
+
"m",
|
|
852
|
+
"d"
|
|
853
|
+
] : this.typedLayout().order;
|
|
854
|
+
const field = (f) => nums[order.indexOf(f)];
|
|
855
|
+
const d = field("d");
|
|
856
|
+
const m = field("m");
|
|
857
|
+
let y = field("y");
|
|
858
|
+
if (y < 100) y += 2e3;
|
|
859
|
+
if (!(y >= 1900 && y <= 2100 && m >= 1 && m <= 12 && d >= 1 && d <= 31)) return null;
|
|
860
|
+
const date = new Date(y, m - 1, d);
|
|
861
|
+
if (date.getMonth() !== m - 1 || date.getDate() !== d) return null;
|
|
862
|
+
return this.toISODate(date);
|
|
863
|
+
}
|
|
864
|
+
parseTimeOnly(text) {
|
|
865
|
+
const match = /^(\d{1,2})[:.](\d{2})(?:[:.](\d{2}))?\s*(am|pm)?$/i.exec(text.trim());
|
|
866
|
+
if (!match) return null;
|
|
867
|
+
let h = Number(match[1]);
|
|
868
|
+
const m = Number(match[2]);
|
|
869
|
+
const s = Number(match[3] ?? 0);
|
|
870
|
+
const suffix = match[4]?.toLowerCase();
|
|
871
|
+
if (suffix === "pm" && h < 12) h += 12;
|
|
872
|
+
if (suffix === "am" && h === 12) h = 0;
|
|
873
|
+
if (h > 23 || m > 59 || s > 59) return null;
|
|
874
|
+
return this.buildTime(h, m, s);
|
|
875
|
+
}
|
|
876
|
+
buildMonth(year, month) {
|
|
877
|
+
const first = new Date(year, month, 1);
|
|
878
|
+
const start = this.startOfWeek(first);
|
|
879
|
+
const cells = [];
|
|
880
|
+
for (let i = 0; i < 42; i++) {
|
|
881
|
+
const d = this.addDays(start, i);
|
|
882
|
+
cells.push({
|
|
883
|
+
iso: this.toISODate(d),
|
|
884
|
+
day: d.getDate(),
|
|
885
|
+
inMonth: d.getMonth() === month
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
year,
|
|
890
|
+
month,
|
|
891
|
+
cells
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
startOfWeek(date) {
|
|
895
|
+
const offset = (date.getDay() - this.firstDayOfWeek() + 7) % 7;
|
|
896
|
+
return this.addDays(date, -offset);
|
|
897
|
+
}
|
|
898
|
+
addDays(date, days) {
|
|
899
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
|
|
900
|
+
}
|
|
901
|
+
goToDate(date) {
|
|
902
|
+
this.viewYear.set(date.getFullYear());
|
|
903
|
+
this.viewMonth.set(date.getMonth());
|
|
904
|
+
this.viewDecade.set(this.decadeOf(date.getFullYear()));
|
|
905
|
+
}
|
|
906
|
+
decadeOf(year) {
|
|
907
|
+
return Math.floor(year / 12) * 12;
|
|
908
|
+
}
|
|
909
|
+
setClockFrom(time) {
|
|
910
|
+
const [h, m, s] = time.split(":").map(Number);
|
|
911
|
+
this.viewHour.set(h || 0);
|
|
912
|
+
this.viewMinute.set(m || 0);
|
|
913
|
+
this.viewSecond.set(s || 0);
|
|
914
|
+
}
|
|
915
|
+
parseISO(iso) {
|
|
916
|
+
return /* @__PURE__ */ new Date(iso.slice(0, 10) + "T12:00:00");
|
|
917
|
+
}
|
|
918
|
+
datePartOf(value) {
|
|
919
|
+
const i = value.indexOf("T");
|
|
920
|
+
return i >= 0 ? value.slice(0, i) : value;
|
|
921
|
+
}
|
|
922
|
+
toISODate(date) {
|
|
923
|
+
return `${date.getFullYear()}-${this.pad2(date.getMonth() + 1)}-${this.pad2(date.getDate())}`;
|
|
924
|
+
}
|
|
925
|
+
formatTyped(iso) {
|
|
926
|
+
const [y, m, d] = iso.split("-");
|
|
927
|
+
const parts = {
|
|
928
|
+
d,
|
|
929
|
+
m,
|
|
930
|
+
y
|
|
931
|
+
};
|
|
932
|
+
const { order, separator } = this.typedLayout();
|
|
933
|
+
return order.map((field) => parts[field]).join(separator);
|
|
934
|
+
}
|
|
935
|
+
formatMedium(iso) {
|
|
936
|
+
return this.effectiveDisplayStyle() === "format" ? formatDate(iso, this.effectiveDateFormat(), this.effectiveLocale()) : formatDateStyle(iso, "medium", this.effectiveLocale());
|
|
937
|
+
}
|
|
938
|
+
formatDisplay(iso) {
|
|
939
|
+
const style = this.effectiveDisplayStyle();
|
|
940
|
+
return style === "format" ? formatDate(iso, this.effectiveDateFormat(), this.effectiveLocale()) : formatDateStyle(iso, style, this.effectiveLocale());
|
|
941
|
+
}
|
|
942
|
+
capitalize(text) {
|
|
943
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
944
|
+
}
|
|
945
|
+
formatTimeFromValue(time) {
|
|
946
|
+
const [h, m, s] = time.split(":").map(Number);
|
|
947
|
+
return this.formatTime(h || 0, m || 0, s || 0);
|
|
948
|
+
}
|
|
949
|
+
formatTime(h, m, s) {
|
|
950
|
+
const secs = this.showSeconds() ? `:${this.pad2(s)}` : "";
|
|
951
|
+
if (this.effectiveHourFormat() === "12") return `${this.pad2(h % 12 || 12)}:${this.pad2(m)}${secs} ${h < 12 ? "AM" : "PM"}`;
|
|
952
|
+
return `${this.pad2(h)}:${this.pad2(m)}${secs}`;
|
|
953
|
+
}
|
|
954
|
+
buildTime(h, m, s) {
|
|
955
|
+
let time = `${this.pad2(h)}:${this.pad2(m)}`;
|
|
956
|
+
if (this.showSeconds()) time += `:${this.pad2(s)}`;
|
|
957
|
+
return time;
|
|
958
|
+
}
|
|
959
|
+
writeValue(value) {
|
|
960
|
+
this._value.set(this.range() ? this.normalizeRange(value) : this.normalizeValue(value));
|
|
961
|
+
}
|
|
962
|
+
normalizeRange(value) {
|
|
963
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
964
|
+
let start;
|
|
965
|
+
let end;
|
|
966
|
+
if (Array.isArray(value)) [start, end] = value;
|
|
967
|
+
else if (typeof value === "object") ({start, end} = value);
|
|
968
|
+
else return this.invalidValue(value);
|
|
969
|
+
const s = this.normalizeValue(start);
|
|
970
|
+
const e = this.normalizeValue(end ?? start);
|
|
971
|
+
if (!s) return null;
|
|
972
|
+
const a = this.datePartOf(s);
|
|
973
|
+
const b = e ? this.datePartOf(e) : a;
|
|
974
|
+
return a <= b ? `${a}|${b}` : `${b}|${a}`;
|
|
975
|
+
}
|
|
976
|
+
normalizeValue(value) {
|
|
977
|
+
if (value === null || value === void 0 || value === "") return null;
|
|
978
|
+
if (value instanceof Date || typeof value === "number") {
|
|
979
|
+
const d = new Date(value);
|
|
980
|
+
return isNaN(d.getTime()) ? this.invalidValue(value) : this.fromDate(d);
|
|
981
|
+
}
|
|
982
|
+
if (typeof value !== "string") return this.invalidValue(value);
|
|
983
|
+
const str = value.trim();
|
|
984
|
+
if (!str) return null;
|
|
985
|
+
if (this.valueFormat()) {
|
|
986
|
+
const parsed = this.parseWithFormat(str, this.valueFormat());
|
|
987
|
+
if (parsed) return parsed;
|
|
988
|
+
}
|
|
989
|
+
if (this.timeOnly()) {
|
|
990
|
+
const time = str.includes("T") ? str.split("T")[1] : str;
|
|
991
|
+
const m = /^(\d{1,2}):(\d{2})(?::(\d{2}))?/.exec(time);
|
|
992
|
+
if (!m) return this.invalidValue(value);
|
|
993
|
+
return this.buildTime(Number(m[1]), Number(m[2]), Number(m[3] ?? 0));
|
|
994
|
+
}
|
|
995
|
+
const [rawDate, rawTime] = str.split(/[T\s]/);
|
|
996
|
+
const parts = rawDate.split(/[-\/.]/).filter(Boolean);
|
|
997
|
+
let y;
|
|
998
|
+
let mo = 1;
|
|
999
|
+
let d = 1;
|
|
1000
|
+
if (parts.length === 1 && /^\d{4}$/.test(parts[0])) y = Number(parts[0]);
|
|
1001
|
+
else if (parts.length === 2) {
|
|
1002
|
+
if (parts[0].length === 4) [y, mo] = parts.map(Number);
|
|
1003
|
+
else [mo, y] = parts.map(Number);
|
|
1004
|
+
} else if (parts.length === 3) {
|
|
1005
|
+
if (parts[0].length === 4) [y, mo, d] = parts.map(Number);
|
|
1006
|
+
else if (this.effectiveLocale().startsWith("en")) [mo, d, y] = parts.map(Number);
|
|
1007
|
+
else [d, mo, y] = parts.map(Number);
|
|
1008
|
+
} else return this.invalidValue(value);
|
|
1009
|
+
const date = new Date(y, mo - 1, d);
|
|
1010
|
+
if (isNaN(date.getTime()) || date.getFullYear() !== y || date.getMonth() !== mo - 1 || date.getDate() !== d) return this.invalidValue(value);
|
|
1011
|
+
const t = rawTime ? /^(\d{1,2}):(\d{2})(?::(\d{2}))?/.exec(rawTime) : null;
|
|
1012
|
+
if (t) date.setHours(Number(t[1]), Number(t[2]), Number(t[3] ?? 0));
|
|
1013
|
+
return this.fromDate(date, !!t);
|
|
1014
|
+
}
|
|
1015
|
+
static {
|
|
1016
|
+
this.FORMAT_TOKENS = /YYYY|MM|DD|HH|mm|ss/g;
|
|
1017
|
+
}
|
|
1018
|
+
static {
|
|
1019
|
+
this.WHEEL_THROTTLE_MS = 150;
|
|
1020
|
+
}
|
|
1021
|
+
static {
|
|
1022
|
+
this.DBLCLICK_DELAY_MS = 250;
|
|
1023
|
+
}
|
|
1024
|
+
parseWithFormat(str, format) {
|
|
1025
|
+
const tokens = [];
|
|
1026
|
+
const pattern = format.split(DatePickerComponent.FORMAT_TOKENS).map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
1027
|
+
const found = format.match(DatePickerComponent.FORMAT_TOKENS) ?? [];
|
|
1028
|
+
let source = pattern[0];
|
|
1029
|
+
found.forEach((tok, i) => {
|
|
1030
|
+
tokens.push(tok);
|
|
1031
|
+
source += (tok === "YYYY" ? "(\\d{4})" : "(\\d{1,2})") + pattern[i + 1];
|
|
1032
|
+
});
|
|
1033
|
+
const match = new RegExp(`^${source}$`).exec(str);
|
|
1034
|
+
if (!match) return null;
|
|
1035
|
+
const get = (tok, def) => {
|
|
1036
|
+
const i = tokens.indexOf(tok);
|
|
1037
|
+
return i >= 0 ? Number(match[i + 1]) : def;
|
|
1038
|
+
};
|
|
1039
|
+
const y = get("YYYY", (/* @__PURE__ */ new Date()).getFullYear());
|
|
1040
|
+
const mo = get("MM", 1);
|
|
1041
|
+
const d = get("DD", 1);
|
|
1042
|
+
const h = get("HH", 0);
|
|
1043
|
+
const mi = get("mm", 0);
|
|
1044
|
+
const s = get("ss", 0);
|
|
1045
|
+
if (h > 23 || mi > 59 || s > 59) return null;
|
|
1046
|
+
const date = new Date(y, mo - 1, d, h, mi, s);
|
|
1047
|
+
if (date.getFullYear() !== y || date.getMonth() !== mo - 1 || date.getDate() !== d) return null;
|
|
1048
|
+
return this.fromDate(date, tokens.includes("HH"));
|
|
1049
|
+
}
|
|
1050
|
+
toOutputValue(value) {
|
|
1051
|
+
if (this.range()) {
|
|
1052
|
+
const [start, end] = value.split("|");
|
|
1053
|
+
return {
|
|
1054
|
+
start: this.formatOutput(start),
|
|
1055
|
+
end: this.formatOutput(end)
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
return this.formatOutput(value);
|
|
1059
|
+
}
|
|
1060
|
+
formatOutput(value) {
|
|
1061
|
+
const format = this.valueFormat();
|
|
1062
|
+
if (!format || !value) return value;
|
|
1063
|
+
let y = "", mo = "01", d = "01", h = "00", mi = "00", s = "00";
|
|
1064
|
+
if (this.timeOnly()) [h, mi, s = "00"] = value.split(":");
|
|
1065
|
+
else {
|
|
1066
|
+
const [datePart, timePart] = value.split("T");
|
|
1067
|
+
[y, mo = "01", d = "01"] = datePart.split("-");
|
|
1068
|
+
if (timePart) [h, mi, s = "00"] = timePart.split(":");
|
|
1069
|
+
}
|
|
1070
|
+
const map = {
|
|
1071
|
+
YYYY: y,
|
|
1072
|
+
MM: mo,
|
|
1073
|
+
DD: d,
|
|
1074
|
+
HH: h,
|
|
1075
|
+
mm: mi,
|
|
1076
|
+
ss: s
|
|
1077
|
+
};
|
|
1078
|
+
return format.replace(DatePickerComponent.FORMAT_TOKENS, (tok) => map[tok]);
|
|
1079
|
+
}
|
|
1080
|
+
fromDate(date, hasTime = true) {
|
|
1081
|
+
if (this.timeOnly()) return this.buildTime(date.getHours(), date.getMinutes(), date.getSeconds());
|
|
1082
|
+
const iso = this.toISODate(date);
|
|
1083
|
+
const v = this.view();
|
|
1084
|
+
if (!this.range()) {
|
|
1085
|
+
if (v === "year") return iso.slice(0, 4);
|
|
1086
|
+
if (v === "month") return iso.slice(0, 7);
|
|
1087
|
+
if (this.showTime() && hasTime) return `${iso}T${this.buildTime(date.getHours(), date.getMinutes(), date.getSeconds())}`;
|
|
1088
|
+
}
|
|
1089
|
+
return iso;
|
|
1090
|
+
}
|
|
1091
|
+
invalidValue(value) {
|
|
1092
|
+
console.warn("[shk-date-picker] Valor de fecha no válido, se ignora:", value);
|
|
1093
|
+
return null;
|
|
1094
|
+
}
|
|
1095
|
+
registerOnChange(fn) {
|
|
1096
|
+
this.onChange = fn;
|
|
1097
|
+
}
|
|
1098
|
+
registerOnTouched(fn) {
|
|
1099
|
+
this.onTouched = fn;
|
|
1100
|
+
}
|
|
1101
|
+
setDisabledState(isDisabled) {
|
|
1102
|
+
this._disabledState.set(isDisabled);
|
|
1103
|
+
this.cdr.markForCheck();
|
|
1104
|
+
}
|
|
1105
|
+
static {
|
|
1106
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
1107
|
+
minVersion: "12.0.0",
|
|
1108
|
+
version: "22.3.2",
|
|
1109
|
+
ngImport: i0,
|
|
1110
|
+
type: DatePickerComponent,
|
|
1111
|
+
deps: [],
|
|
1112
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
static {
|
|
1116
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1117
|
+
minVersion: "17.0.0",
|
|
1118
|
+
version: "22.3.2",
|
|
1119
|
+
type: DatePickerComponent,
|
|
1120
|
+
isStandalone: true,
|
|
1121
|
+
selector: "shk-date-picker",
|
|
1122
|
+
inputs: {
|
|
1123
|
+
id: {
|
|
1124
|
+
classPropertyName: "id",
|
|
1125
|
+
publicName: "id",
|
|
1126
|
+
isSignal: true,
|
|
1127
|
+
isRequired: false,
|
|
1128
|
+
transformFunction: null
|
|
1129
|
+
},
|
|
1130
|
+
view: {
|
|
1131
|
+
classPropertyName: "view",
|
|
1132
|
+
publicName: "view",
|
|
1133
|
+
isSignal: true,
|
|
1134
|
+
isRequired: false,
|
|
1135
|
+
transformFunction: null
|
|
1136
|
+
},
|
|
1137
|
+
weekStart: {
|
|
1138
|
+
classPropertyName: "weekStart",
|
|
1139
|
+
publicName: "weekStart",
|
|
1140
|
+
isSignal: true,
|
|
1141
|
+
isRequired: false,
|
|
1142
|
+
transformFunction: null
|
|
1143
|
+
},
|
|
1144
|
+
range: {
|
|
1145
|
+
classPropertyName: "range",
|
|
1146
|
+
publicName: "range",
|
|
1147
|
+
isSignal: true,
|
|
1148
|
+
isRequired: false,
|
|
1149
|
+
transformFunction: null
|
|
1150
|
+
},
|
|
1151
|
+
markedDates: {
|
|
1152
|
+
classPropertyName: "markedDates",
|
|
1153
|
+
publicName: "markedDates",
|
|
1154
|
+
isSignal: true,
|
|
1155
|
+
isRequired: false,
|
|
1156
|
+
transformFunction: null
|
|
1157
|
+
},
|
|
1158
|
+
label: {
|
|
1159
|
+
classPropertyName: "label",
|
|
1160
|
+
publicName: "label",
|
|
1161
|
+
isSignal: true,
|
|
1162
|
+
isRequired: false,
|
|
1163
|
+
transformFunction: null
|
|
1164
|
+
},
|
|
1165
|
+
placeholder: {
|
|
1166
|
+
classPropertyName: "placeholder",
|
|
1167
|
+
publicName: "placeholder",
|
|
1168
|
+
isSignal: true,
|
|
1169
|
+
isRequired: false,
|
|
1170
|
+
transformFunction: null
|
|
1171
|
+
},
|
|
1172
|
+
formGroup: {
|
|
1173
|
+
classPropertyName: "formGroup",
|
|
1174
|
+
publicName: "formGroup",
|
|
1175
|
+
isSignal: true,
|
|
1176
|
+
isRequired: false,
|
|
1177
|
+
transformFunction: null
|
|
1178
|
+
},
|
|
1179
|
+
controlName: {
|
|
1180
|
+
classPropertyName: "controlName",
|
|
1181
|
+
publicName: "controlName",
|
|
1182
|
+
isSignal: true,
|
|
1183
|
+
isRequired: false,
|
|
1184
|
+
transformFunction: null
|
|
1185
|
+
},
|
|
1186
|
+
control: {
|
|
1187
|
+
classPropertyName: "control",
|
|
1188
|
+
publicName: "control",
|
|
1189
|
+
isSignal: true,
|
|
1190
|
+
isRequired: false,
|
|
1191
|
+
transformFunction: null
|
|
1192
|
+
},
|
|
1193
|
+
disabled: {
|
|
1194
|
+
classPropertyName: "disabled",
|
|
1195
|
+
publicName: "disabled",
|
|
1196
|
+
isSignal: true,
|
|
1197
|
+
isRequired: false,
|
|
1198
|
+
transformFunction: null
|
|
1199
|
+
},
|
|
1200
|
+
errorMessage: {
|
|
1201
|
+
classPropertyName: "errorMessage",
|
|
1202
|
+
publicName: "errorMessage",
|
|
1203
|
+
isSignal: true,
|
|
1204
|
+
isRequired: false,
|
|
1205
|
+
transformFunction: null
|
|
1206
|
+
},
|
|
1207
|
+
errorMessages: {
|
|
1208
|
+
classPropertyName: "errorMessages",
|
|
1209
|
+
publicName: "errorMessages",
|
|
1210
|
+
isSignal: true,
|
|
1211
|
+
isRequired: false,
|
|
1212
|
+
transformFunction: null
|
|
1213
|
+
},
|
|
1214
|
+
minValue: {
|
|
1215
|
+
classPropertyName: "minValue",
|
|
1216
|
+
publicName: "minValue",
|
|
1217
|
+
isSignal: true,
|
|
1218
|
+
isRequired: false,
|
|
1219
|
+
transformFunction: null
|
|
1220
|
+
},
|
|
1221
|
+
maxValue: {
|
|
1222
|
+
classPropertyName: "maxValue",
|
|
1223
|
+
publicName: "maxValue",
|
|
1224
|
+
isSignal: true,
|
|
1225
|
+
isRequired: false,
|
|
1226
|
+
transformFunction: null
|
|
1227
|
+
},
|
|
1228
|
+
locale: {
|
|
1229
|
+
classPropertyName: "locale",
|
|
1230
|
+
publicName: "locale",
|
|
1231
|
+
isSignal: true,
|
|
1232
|
+
isRequired: false,
|
|
1233
|
+
transformFunction: null
|
|
1234
|
+
},
|
|
1235
|
+
dateFormat: {
|
|
1236
|
+
classPropertyName: "dateFormat",
|
|
1237
|
+
publicName: "dateFormat",
|
|
1238
|
+
isSignal: true,
|
|
1239
|
+
isRequired: false,
|
|
1240
|
+
transformFunction: null
|
|
1241
|
+
},
|
|
1242
|
+
displayStyle: {
|
|
1243
|
+
classPropertyName: "displayStyle",
|
|
1244
|
+
publicName: "displayStyle",
|
|
1245
|
+
isSignal: true,
|
|
1246
|
+
isRequired: false,
|
|
1247
|
+
transformFunction: null
|
|
1248
|
+
},
|
|
1249
|
+
timeOnly: {
|
|
1250
|
+
classPropertyName: "timeOnly",
|
|
1251
|
+
publicName: "timeOnly",
|
|
1252
|
+
isSignal: true,
|
|
1253
|
+
isRequired: false,
|
|
1254
|
+
transformFunction: null
|
|
1255
|
+
},
|
|
1256
|
+
showTime: {
|
|
1257
|
+
classPropertyName: "showTime",
|
|
1258
|
+
publicName: "showTime",
|
|
1259
|
+
isSignal: true,
|
|
1260
|
+
isRequired: false,
|
|
1261
|
+
transformFunction: null
|
|
1262
|
+
},
|
|
1263
|
+
hourFormat: {
|
|
1264
|
+
classPropertyName: "hourFormat",
|
|
1265
|
+
publicName: "hourFormat",
|
|
1266
|
+
isSignal: true,
|
|
1267
|
+
isRequired: false,
|
|
1268
|
+
transformFunction: null
|
|
1269
|
+
},
|
|
1270
|
+
showSeconds: {
|
|
1271
|
+
classPropertyName: "showSeconds",
|
|
1272
|
+
publicName: "showSeconds",
|
|
1273
|
+
isSignal: true,
|
|
1274
|
+
isRequired: false,
|
|
1275
|
+
transformFunction: null
|
|
1276
|
+
},
|
|
1277
|
+
minuteStep: {
|
|
1278
|
+
classPropertyName: "minuteStep",
|
|
1279
|
+
publicName: "minuteStep",
|
|
1280
|
+
isSignal: true,
|
|
1281
|
+
isRequired: false,
|
|
1282
|
+
transformFunction: null
|
|
1283
|
+
},
|
|
1284
|
+
valueFormat: {
|
|
1285
|
+
classPropertyName: "valueFormat",
|
|
1286
|
+
publicName: "valueFormat",
|
|
1287
|
+
isSignal: true,
|
|
1288
|
+
isRequired: false,
|
|
1289
|
+
transformFunction: null
|
|
1290
|
+
},
|
|
1291
|
+
value: {
|
|
1292
|
+
classPropertyName: "value",
|
|
1293
|
+
publicName: "value",
|
|
1294
|
+
isSignal: true,
|
|
1295
|
+
isRequired: false,
|
|
1296
|
+
transformFunction: null
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
outputs: {
|
|
1300
|
+
value: "valueChange",
|
|
1301
|
+
touch: "touch"
|
|
1302
|
+
},
|
|
1303
|
+
host: { listeners: {
|
|
1304
|
+
"document:click": "onDocumentClick($event)",
|
|
1305
|
+
"window:resize": "onViewportChange()",
|
|
1306
|
+
"document:keydown.escape": "onEscape()"
|
|
1307
|
+
} },
|
|
1308
|
+
providers: [{
|
|
1309
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1310
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
1311
|
+
multi: true
|
|
1312
|
+
}],
|
|
1313
|
+
viewQueries: [
|
|
1314
|
+
{
|
|
1315
|
+
propertyName: "overlay",
|
|
1316
|
+
first: true,
|
|
1317
|
+
predicate: ["overlay"],
|
|
1318
|
+
descendants: true,
|
|
1319
|
+
isSignal: true
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
propertyName: "anchor",
|
|
1323
|
+
first: true,
|
|
1324
|
+
predicate: ["anchor"],
|
|
1325
|
+
descendants: true,
|
|
1326
|
+
isSignal: true
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
propertyName: "panel",
|
|
1330
|
+
first: true,
|
|
1331
|
+
predicate: ["panel"],
|
|
1332
|
+
descendants: true,
|
|
1333
|
+
isSignal: true
|
|
1334
|
+
}
|
|
1335
|
+
],
|
|
1336
|
+
ngImport: i0,
|
|
1337
|
+
template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n <div #anchor class=\"relative\">\n <input\n [id]=\"id()\"\n type=\"text\"\n autocomplete=\"off\"\n [disabled]=\"isDisabled()\"\n [placeholder]=\"inputPlaceholder()\"\n [value]=\"isTyping() ? typedValue() : displayLabel()\"\n (input)=\"onInputText($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown.enter)=\"$any($event.target).blur()\"\n (keydown.escape)=\"cancelTyping()\"\n (click)=\"toggle()\"\n class=\"date-input-field\"\n [ngClass]=\"{\n 'input-error': shouldShowError() || typingValid() === false,\n 'input-valid': wasFixedError() || typingValid() === true,\n }\"\n [attr.aria-invalid]=\"shouldShowError() || typingValid() === false || null\"\n [attr.aria-describedby]=\"shouldShowError() ? id() + '-error' : null\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n />\n <button\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 p-1 _shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n [attr.aria-label]=\"texts().open\"\n >\n @if (timeOnly()) {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M12 7v5l3 2\"></path>\n </svg>\n } @else {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect>\n <path d=\"M16 2v4M8 2v4M3 10h18\"></path>\n </svg>\n }\n </button>\n </div>\n\n @if (isOpen()) {\n <div #overlay shkPortal class=\"shk-date-picker-overlay\">\n <div class=\"fixed inset-0 z-40\" (click)=\"close()\"></div>\n\n <div\n #panel\n role=\"dialog\"\n class=\"dp-panel fixed z-50 p-4\"\n [style.top.px]=\"panelPosition()?.top ?? 0\"\n [style.left.px]=\"panelPosition()?.left ?? 0\"\n [style.visibility]=\"panelPosition() ? 'visible' : 'hidden'\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <div class=\"flex items-stretch\">\n @if (!timeOnly()) {\n <!-- ================= DAYS ================= -->\n @if (currentView() === 'date') {\n <div class=\"flex gap-6\" (wheel)=\"onWheel($event)\">\n @for (m of visibleMonths(); track m.year * 12 + m.month; let first = $first; let last = $last) {\n <div class=\"w-64\" [class.dp-month-divider]=\"!first\">\n <!-- Header: ‹ Mes Año › -->\n <div class=\"flex items-center justify-between mb-3\">\n @if (first) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">\n {{ monthLongNames()[m.month] }} {{ m.year }}\n </button>\n @if (last) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n </div>\n\n <!-- Typed date + Today (single mode) -->\n @if (!range()) {\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input\"\n [class.input-error]=\"panelTextError() === 'single'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"panelText()\"\n (keydown.enter)=\"commitPanelText('single', $event)\"\n (blur)=\"commitPanelText('single', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n </div>\n }\n\n <!-- Weekday names -->\n <div class=\"grid grid-cols-7\">\n @for (name of dayNames(); track $index) {\n <div class=\"dp-weekday\">{{ name }}</div>\n }\n </div>\n\n <!-- Day grid (6 weeks, neighbouring months included) -->\n <div class=\"grid grid-cols-7\" (mouseleave)=\"onDayHover(null)\">\n @for (cell of m.cells; track cell.iso) {\n <div\n class=\"dp-cell\"\n [class.in-range]=\"(cell.inMonth || !range()) && isInRange(cell.iso)\"\n [class.range-start]=\"(cell.inMonth || !range()) && isRangeStart(cell.iso)\"\n [class.range-end]=\"(cell.inMonth || !range()) && isRangeEnd(cell.iso)\"\n >\n <button\n type=\"button\"\n class=\"dp-day\"\n [class.is-outside]=\"!cell.inMonth\"\n [class.is-today]=\"isTodayDate(cell.iso)\"\n [class.is-selected]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [disabled]=\"isDisabledDate(cell.iso)\"\n [attr.aria-pressed]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [attr.aria-current]=\"isTodayDate(cell.iso) ? 'date' : null\"\n (click)=\"selectDay(cell)\"\n (dblclick)=\"quickApply(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n >\n {{ cell.day }}\n @if (isMarked(cell.iso)) {\n <span class=\"dp-dot\"></span>\n }\n </button>\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n\n <!-- ================= WEEKS ================= -->\n @if (currentView() === 'week') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"space-y-1\">\n @for (week of monthWeeks(); track week.index) {\n <button\n type=\"button\"\n (click)=\"selectWeek(week.start)\"\n class=\"dp-chip w-full flex items-center justify-between px-3\"\n [class.is-selected]=\"isSelectedWeek(week.start)\"\n [class.is-current]=\"isCurrentWeek(week.start)\"\n >\n <span class=\"font-medium\">{{ weekLabel(week.index) }}</span>\n <span class=\"text-xs opacity-80\">{{ week.range }}</span>\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= MONTHS ================= -->\n @if (currentView() === 'month') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedMonth($index)\"\n [class.is-current]=\"isCurrentMonth($index)\"\n (click)=\"selectMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= YEARS ================= -->\n @if (currentView() === 'year') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <span class=\"dp-title\">{{ headerTitle() }}</span>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (year of decadeYears(); track year) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedYear(year)\"\n [class.is-current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n </div>\n }\n }\n\n <!-- ================= TIME (columns) ================= -->\n @if (showTimeColumns()) {\n <div\n class=\"flex flex-col\"\n [ngClass]=\"timeOnly() ? 'w-64' : 'w-40 ml-6 dp-month-divider'\"\n >\n <!-- Typed time + Now -->\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input text-center font-semibold tabular-nums\"\n [class.input-error]=\"timeTextError()\"\n [placeholder]=\"effectiveHourFormat() === '12' ? 'hh:mm AM' : 'HH:mm'\"\n [value]=\"timeText()\"\n (keydown.enter)=\"commitTimeText($event)\"\n (blur)=\"commitTimeText($event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"setNow()\">{{ texts().now }}</button>\n </div>\n\n <!-- Column titles -->\n <div class=\"flex\">\n <div class=\"dp-weekday flex-1\">{{ texts().hour }}</div>\n <div class=\"dp-weekday flex-1\">{{ texts().minute }}</div>\n @if (showSeconds()) {\n <div class=\"dp-weekday flex-1\">{{ texts().second }}</div>\n }\n @if (effectiveHourFormat() === '12') {\n <div class=\"dp-weekday flex-1\"></div>\n }\n </div>\n\n <!-- Scrollable columns -->\n <div class=\"relative\" [ngClass]=\"timeOnly() ? 'h-56' : 'flex-1 min-h-[12rem]'\">\n <div class=\"absolute inset-0 flex\">\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().hour\">\n @for (h of hourOptions(); track h.value) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewHour() === h.value\"\n [class.is-current]=\"isCurrentHour(h.value)\"\n [attr.aria-selected]=\"viewHour() === h.value\"\n (click)=\"selectHour(h.value)\"\n >\n {{ h.label }}\n </button>\n }\n </div>\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().minute\">\n @for (m of minuteOptions(); track m) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewMinute() === m\"\n [attr.aria-selected]=\"viewMinute() === m\"\n (click)=\"selectMinute(m)\"\n >\n {{ pad2(m) }}\n </button>\n }\n </div>\n @if (showSeconds()) {\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().second\">\n @for (sec of secondOptions; track sec) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewSecond() === sec\"\n [attr.aria-selected]=\"viewSecond() === sec\"\n (click)=\"selectSecond(sec)\"\n >\n {{ pad2(sec) }}\n </button>\n }\n </div>\n }\n @if (effectiveHourFormat() === '12') {\n <div class=\"dp-time-col\">\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'AM'\" (click)=\"setMeridiem('AM')\">AM</button>\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'PM'\" (click)=\"setMeridiem('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n </div>\n\n <!-- ================= FOOTER ================= -->\n @if (showFooter()) {\n <div class=\"mt-4 pt-4 border-t dp-divider\">\n @if (range()) {\n <div class=\"flex items-center gap-3\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n <div class=\"flex-1\"></div>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'start'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeStartText()\"\n (keydown.enter)=\"commitPanelText('start', $event)\"\n (blur)=\"commitPanelText('start', $event)\"\n />\n <span class=\"_shk-text-surface-400\">–</span>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'end'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeEndText()\"\n (keydown.enter)=\"commitPanelText('end', $event)\"\n (blur)=\"commitPanelText('end', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n } @else {\n <div class=\"grid grid-cols-2 gap-3 w-64 ml-auto\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (shouldShowError()) {\n <div [id]=\"id() + '-error'\" class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n",
|
|
1338
|
+
styles: [".dp-panel{background-color:#fff;border:1px solid var(--shk-surface-200);border-radius:.75rem;box-shadow:0 12px 32px -8px #0000002e,0 2px 6px #0000000f;color:var(--shk-surface-700)}.dark .dp-panel{background-color:var(--shk-surface-100)}.dp-nav{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:9999px;color:var(--shk-surface-500);transition:background-color .15s,color .15s}.dp-nav:hover:not(:disabled){background-color:var(--shk-surface-100);color:var(--shk-surface-800)}.dark .dp-nav:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-nav:disabled{opacity:.3;cursor:not-allowed}.dp-title{font-size:.875rem;font-weight:600;padding:.25rem .5rem;border-radius:.375rem;color:var(--shk-surface-800);transition:background-color .15s}button.dp-title:hover{background-color:var(--shk-surface-100)}.dark button.dp-title:hover{background-color:var(--shk-surface-200)}.dp-month-divider{position:relative}.dp-month-divider:before{content:\"\";position:absolute;top:-1rem;bottom:0;left:-.75rem;border-left:1px solid var(--shk-surface-200)}.dp-weekday{text-align:center;font-size:.75rem;font-weight:500;color:var(--shk-surface-500);padding:.25rem 0}.dp-cell{position:relative;display:flex;align-items:center;justify-content:center;height:2.25rem}.dp-cell.in-range:before,.dp-cell.range-start:before,.dp-cell.range-end:before{content:\"\";position:absolute;inset:.125rem 0;background-color:color-mix(in srgb,var(--shk-primary-500) 12%,transparent)}.dp-cell.range-start:before{left:50%}.dp-cell.range-end:before{right:50%}.dp-cell.range-start.range-end:before{display:none}.dp-day{position:relative;z-index:1;width:2.125rem;height:2.125rem;border-radius:9999px;font-size:.8125rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-200)}.dp-day.is-outside{color:var(--shk-surface-400)}.dp-day.is-today{font-weight:700;color:var(--shk-primary-600);background-color:color-mix(in srgb,var(--shk-primary-500) 10%,transparent)}.dp-day.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-day:disabled{opacity:.3;cursor:not-allowed;text-decoration:line-through}.dp-dot{position:absolute;left:50%;bottom:.25rem;width:.25rem;height:.25rem;border-radius:9999px;transform:translate(-50%);background-color:var(--shk-primary-500)}.dp-day.is-selected .dp-dot{background-color:#fff}.dp-chip{padding:.5rem 0;font-size:.8125rem;border-radius:.5rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-chip.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-chip.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-btn{display:inline-flex;align-items:center;justify-content:center;padding:.4375rem .875rem;font-size:.8125rem;font-weight:500;border-radius:.5rem;border:1px solid var(--shk-surface-200);color:var(--shk-surface-700);background-color:transparent;transition:background-color .15s,border-color .15s;white-space:nowrap}.dp-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}.dark .dp-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-btn-primary{border-color:var(--shk-primary-500);background-color:var(--shk-primary-500);color:#fff}.dp-btn-primary:hover:not(:disabled){background-color:var(--shk-primary-700)!important;border-color:var(--shk-primary-700)}.dp-btn:disabled{opacity:.5;cursor:not-allowed}.dp-mini-input{width:100%;min-width:0;padding:.4375rem .625rem;font-size:.8125rem;border-radius:.5rem;border:1px solid var(--shk-surface-200);background-color:transparent;color:var(--shk-surface-700);outline:none;transition:border-color .15s,box-shadow .15s}.dp-mini-input:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.dp-mini-input.input-error{border-color:var(--shk-error-500)}.dp-divider{border-color:var(--shk-surface-200)}.dp-time-col{position:relative;flex:1 1 0;min-width:0;overflow-y:auto;scrollbar-width:thin;scroll-behavior:smooth;padding:0 .125rem}.dp-time-col+.dp-time-col{border-left:1px solid var(--shk-surface-200)}.dp-time-item{display:flex;align-items:center;justify-content:center;width:100%;height:2rem;margin:.125rem 0;border-radius:.5rem;font-size:.8125rem;font-variant-numeric:tabular-nums;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-time-item.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-time-item.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.date-input-field{width:100%;padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;border-radius:.5rem;outline:none;transition:border-color .15s,box-shadow .15s;background-color:var(--shk-surface-50);color:var(--shk-surface-700);border:1px solid var(--shk-surface-200);text-overflow:ellipsis}:host-context(.dark) .date-input-field,.dark .date-input-field{background-color:var(--shk-surface-100)}.date-input-field::placeholder{color:var(--shk-surface-400)}.date-input-field:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.date-input-field:disabled{background-color:var(--shk-surface-100);color:var(--shk-surface-500);cursor:not-allowed}:host-context(.dark) .date-input-field:disabled,.dark .date-input-field:disabled{background-color:var(--shk-surface-50);color:var(--shk-surface-400)}.date-input-field.input-error,:host-context(.dark) .date-input-field.input-error,.dark .date-input-field.input-error{border-color:var(--shk-error-500)}.date-input-field.input-error:focus,:host-context(.dark) .date-input-field.input-error:focus,.dark .date-input-field.input-error:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-error-500) 22%,transparent)}.date-input-field.input-valid,:host-context(.dark) .date-input-field.input-valid,.dark .date-input-field.input-valid{border-color:#22c55e}.date-input-field.input-valid:focus,:host-context(.dark) .date-input-field.input-valid:focus,.dark .date-input-field.input-valid:focus{box-shadow:0 0 0 3px #22c55e33}\n"],
|
|
1339
|
+
dependencies: [
|
|
1340
|
+
{
|
|
1341
|
+
kind: "ngmodule",
|
|
1342
|
+
type: CommonModule
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
kind: "directive",
|
|
1346
|
+
type: i1.NgClass,
|
|
1347
|
+
selector: "[ngClass]",
|
|
1348
|
+
inputs: ["class", "ngClass"]
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
kind: "ngmodule",
|
|
1352
|
+
type: ReactiveFormsModule
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
kind: "directive",
|
|
1356
|
+
type: PortalDirective,
|
|
1357
|
+
selector: "[shkPortal]"
|
|
1358
|
+
}
|
|
1359
|
+
],
|
|
1360
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1365
|
+
minVersion: "12.0.0",
|
|
1366
|
+
version: "22.3.2",
|
|
1367
|
+
ngImport: i0,
|
|
1368
|
+
type: DatePickerComponent,
|
|
1369
|
+
decorators: [{
|
|
1370
|
+
type: Component,
|
|
1371
|
+
args: [{
|
|
1372
|
+
selector: "shk-date-picker",
|
|
1373
|
+
imports: [
|
|
1374
|
+
CommonModule,
|
|
1375
|
+
ReactiveFormsModule,
|
|
1376
|
+
PortalDirective
|
|
1377
|
+
],
|
|
1378
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1379
|
+
providers: [{
|
|
1380
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1381
|
+
useExisting: forwardRef(() => DatePickerComponent),
|
|
1382
|
+
multi: true
|
|
1383
|
+
}],
|
|
1384
|
+
template: "<div class=\"relative mb-4\">\n @if (label()) {\n <div class=\"text-sm font-medium _shk-text-surface-700 mb-1\">\n {{ label() }}\n </div>\n }\n\n <div class=\"relative\">\n <div #anchor class=\"relative\">\n <input\n [id]=\"id()\"\n type=\"text\"\n autocomplete=\"off\"\n [disabled]=\"isDisabled()\"\n [placeholder]=\"inputPlaceholder()\"\n [value]=\"isTyping() ? typedValue() : displayLabel()\"\n (input)=\"onInputText($event)\"\n (focus)=\"onInputFocus()\"\n (blur)=\"onInputBlur()\"\n (keydown.enter)=\"$any($event.target).blur()\"\n (keydown.escape)=\"cancelTyping()\"\n (click)=\"toggle()\"\n class=\"date-input-field\"\n [ngClass]=\"{\n 'input-error': shouldShowError() || typingValid() === false,\n 'input-valid': wasFixedError() || typingValid() === true,\n }\"\n [attr.aria-invalid]=\"shouldShowError() || typingValid() === false || null\"\n [attr.aria-describedby]=\"shouldShowError() ? id() + '-error' : null\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"isOpen()\"\n />\n <button\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n class=\"absolute right-2 top-1/2 -translate-y-1/2 p-1 _shk-text-surface-400 hover:[color:var(--shk-surface-600)] dark:hover:[color:var(--shk-surface-300)] transition-colors\"\n [attr.aria-label]=\"texts().open\"\n >\n @if (timeOnly()) {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"9\"></circle>\n <path d=\"M12 7v5l3 2\"></path>\n </svg>\n } @else {\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n <rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"></rect>\n <path d=\"M16 2v4M8 2v4M3 10h18\"></path>\n </svg>\n }\n </button>\n </div>\n\n @if (isOpen()) {\n <div #overlay shkPortal class=\"shk-date-picker-overlay\">\n <div class=\"fixed inset-0 z-40\" (click)=\"close()\"></div>\n\n <div\n #panel\n role=\"dialog\"\n class=\"dp-panel fixed z-50 p-4\"\n [style.top.px]=\"panelPosition()?.top ?? 0\"\n [style.left.px]=\"panelPosition()?.left ?? 0\"\n [style.visibility]=\"panelPosition() ? 'visible' : 'hidden'\"\n (click)=\"$event.stopPropagation()\"\n (keydown)=\"onPanelKeydown($event)\"\n >\n <div class=\"flex items-stretch\">\n @if (!timeOnly()) {\n <!-- ================= DAYS ================= -->\n @if (currentView() === 'date') {\n <div class=\"flex gap-6\" (wheel)=\"onWheel($event)\">\n @for (m of visibleMonths(); track m.year * 12 + m.month; let first = $first; let last = $last) {\n <div class=\"w-64\" [class.dp-month-divider]=\"!first\">\n <!-- Header: ‹ Mes Año › -->\n <div class=\"flex items-center justify-between mb-3\">\n @if (first) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">\n {{ monthLongNames()[m.month] }} {{ m.year }}\n </button>\n @if (last) {\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n } @else {\n <span class=\"w-8\"></span>\n }\n </div>\n\n <!-- Typed date + Today (single mode) -->\n @if (!range()) {\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input\"\n [class.input-error]=\"panelTextError() === 'single'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"panelText()\"\n (keydown.enter)=\"commitPanelText('single', $event)\"\n (blur)=\"commitPanelText('single', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n </div>\n }\n\n <!-- Weekday names -->\n <div class=\"grid grid-cols-7\">\n @for (name of dayNames(); track $index) {\n <div class=\"dp-weekday\">{{ name }}</div>\n }\n </div>\n\n <!-- Day grid (6 weeks, neighbouring months included) -->\n <div class=\"grid grid-cols-7\" (mouseleave)=\"onDayHover(null)\">\n @for (cell of m.cells; track cell.iso) {\n <div\n class=\"dp-cell\"\n [class.in-range]=\"(cell.inMonth || !range()) && isInRange(cell.iso)\"\n [class.range-start]=\"(cell.inMonth || !range()) && isRangeStart(cell.iso)\"\n [class.range-end]=\"(cell.inMonth || !range()) && isRangeEnd(cell.iso)\"\n >\n <button\n type=\"button\"\n class=\"dp-day\"\n [class.is-outside]=\"!cell.inMonth\"\n [class.is-today]=\"isTodayDate(cell.iso)\"\n [class.is-selected]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [disabled]=\"isDisabledDate(cell.iso)\"\n [attr.aria-pressed]=\"(cell.inMonth || !range()) && isSelectedDate(cell.iso)\"\n [attr.aria-current]=\"isTodayDate(cell.iso) ? 'date' : null\"\n (click)=\"selectDay(cell)\"\n (dblclick)=\"quickApply(cell)\"\n (mouseenter)=\"onDayHover(cell)\"\n >\n {{ cell.day }}\n @if (isMarked(cell.iso)) {\n <span class=\"dp-dot\"></span>\n }\n </button>\n </div>\n }\n </div>\n </div>\n }\n </div>\n }\n\n <!-- ================= WEEKS ================= -->\n @if (currentView() === 'week') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextMonth\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"space-y-1\">\n @for (week of monthWeeks(); track week.index) {\n <button\n type=\"button\"\n (click)=\"selectWeek(week.start)\"\n class=\"dp-chip w-full flex items-center justify-between px-3\"\n [class.is-selected]=\"isSelectedWeek(week.start)\"\n [class.is-current]=\"isCurrentWeek(week.start)\"\n >\n <span class=\"font-medium\">{{ weekLabel(week.index) }}</span>\n <span class=\"text-xs opacity-80\">{{ week.range }}</span>\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= MONTHS ================= -->\n @if (currentView() === 'month') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <button type=\"button\" class=\"dp-title\" (click)=\"zoomOut()\">{{ headerTitle() }}</button>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYear\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedMonth($index)\"\n [class.is-current]=\"isCurrentMonth($index)\"\n (click)=\"selectMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n </div>\n }\n\n <!-- ================= YEARS ================= -->\n @if (currentView() === 'year') {\n <div class=\"w-64\" (wheel)=\"onWheel($event)\">\n <div class=\"flex items-center justify-between mb-3\">\n <button type=\"button\" class=\"dp-nav\" (click)=\"prev()\" [disabled]=\"!canGoPrev()\" [attr.aria-label]=\"texts().prevYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M15 18l-6-6 6-6\"></path></svg>\n </button>\n <span class=\"dp-title\">{{ headerTitle() }}</span>\n <button type=\"button\" class=\"dp-nav\" (click)=\"next()\" [disabled]=\"!canGoNext()\" [attr.aria-label]=\"texts().nextYears\">\n <svg class=\"w-4 h-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 18l6-6-6-6\"></path></svg>\n </button>\n </div>\n <div class=\"grid grid-cols-3 gap-1\">\n @for (year of decadeYears(); track year) {\n <button\n type=\"button\"\n class=\"dp-chip\"\n [class.is-selected]=\"isSelectedYear(year)\"\n [class.is-current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n </div>\n }\n }\n\n <!-- ================= TIME (columns) ================= -->\n @if (showTimeColumns()) {\n <div\n class=\"flex flex-col\"\n [ngClass]=\"timeOnly() ? 'w-64' : 'w-40 ml-6 dp-month-divider'\"\n >\n <!-- Typed time + Now -->\n <div class=\"flex items-center gap-2 mb-3\">\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input text-center font-semibold tabular-nums\"\n [class.input-error]=\"timeTextError()\"\n [placeholder]=\"effectiveHourFormat() === '12' ? 'hh:mm AM' : 'HH:mm'\"\n [value]=\"timeText()\"\n (keydown.enter)=\"commitTimeText($event)\"\n (blur)=\"commitTimeText($event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"setNow()\">{{ texts().now }}</button>\n </div>\n\n <!-- Column titles -->\n <div class=\"flex\">\n <div class=\"dp-weekday flex-1\">{{ texts().hour }}</div>\n <div class=\"dp-weekday flex-1\">{{ texts().minute }}</div>\n @if (showSeconds()) {\n <div class=\"dp-weekday flex-1\">{{ texts().second }}</div>\n }\n @if (effectiveHourFormat() === '12') {\n <div class=\"dp-weekday flex-1\"></div>\n }\n </div>\n\n <!-- Scrollable columns -->\n <div class=\"relative\" [ngClass]=\"timeOnly() ? 'h-56' : 'flex-1 min-h-[12rem]'\">\n <div class=\"absolute inset-0 flex\">\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().hour\">\n @for (h of hourOptions(); track h.value) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewHour() === h.value\"\n [class.is-current]=\"isCurrentHour(h.value)\"\n [attr.aria-selected]=\"viewHour() === h.value\"\n (click)=\"selectHour(h.value)\"\n >\n {{ h.label }}\n </button>\n }\n </div>\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().minute\">\n @for (m of minuteOptions(); track m) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewMinute() === m\"\n [attr.aria-selected]=\"viewMinute() === m\"\n (click)=\"selectMinute(m)\"\n >\n {{ pad2(m) }}\n </button>\n }\n </div>\n @if (showSeconds()) {\n <div class=\"dp-time-col\" role=\"listbox\" [attr.aria-label]=\"texts().second\">\n @for (sec of secondOptions; track sec) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"dp-time-item\"\n [class.is-selected]=\"viewSecond() === sec\"\n [attr.aria-selected]=\"viewSecond() === sec\"\n (click)=\"selectSecond(sec)\"\n >\n {{ pad2(sec) }}\n </button>\n }\n </div>\n }\n @if (effectiveHourFormat() === '12') {\n <div class=\"dp-time-col\">\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'AM'\" (click)=\"setMeridiem('AM')\">AM</button>\n <button type=\"button\" class=\"dp-time-item\" [class.is-selected]=\"viewMeridiem() === 'PM'\" (click)=\"setMeridiem('PM')\">PM</button>\n </div>\n }\n </div>\n </div>\n </div>\n }\n </div>\n\n <!-- ================= FOOTER ================= -->\n @if (showFooter()) {\n <div class=\"mt-4 pt-4 border-t dp-divider\">\n @if (range()) {\n <div class=\"flex items-center gap-3\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"goToday()\">{{ texts().today }}</button>\n <div class=\"flex-1\"></div>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'start'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeStartText()\"\n (keydown.enter)=\"commitPanelText('start', $event)\"\n (blur)=\"commitPanelText('start', $event)\"\n />\n <span class=\"_shk-text-surface-400\">–</span>\n <input\n type=\"text\"\n autocomplete=\"off\"\n class=\"dp-mini-input !w-32\"\n [class.input-error]=\"panelTextError() === 'end'\"\n [placeholder]=\"inputFormat()\"\n [value]=\"rangeEndText()\"\n (keydown.enter)=\"commitPanelText('end', $event)\"\n (blur)=\"commitPanelText('end', $event)\"\n />\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n } @else {\n <div class=\"grid grid-cols-2 gap-3 w-64 ml-auto\">\n <button type=\"button\" class=\"dp-btn\" (click)=\"close()\">{{ texts().cancel }}</button>\n <button type=\"button\" class=\"dp-btn dp-btn-primary\" [disabled]=\"!canApply()\" (click)=\"apply()\">\n {{ texts().apply }}\n </button>\n </div>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (shouldShowError()) {\n <div [id]=\"id() + '-error'\" class=\"mt-1 text-xs text-red-500 max-h-20 overflow-y-auto _shk-scrollbar\">\n <ul class=\"list-disc pl-4 space-y-1\">\n @for (error of getErrorMessages(); track error) {\n <li>{{ error }}</li>\n }\n </ul>\n </div>\n }\n</div>\n",
|
|
1385
|
+
styles: [".dp-panel{background-color:#fff;border:1px solid var(--shk-surface-200);border-radius:.75rem;box-shadow:0 12px 32px -8px #0000002e,0 2px 6px #0000000f;color:var(--shk-surface-700)}.dark .dp-panel{background-color:var(--shk-surface-100)}.dp-nav{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;border-radius:9999px;color:var(--shk-surface-500);transition:background-color .15s,color .15s}.dp-nav:hover:not(:disabled){background-color:var(--shk-surface-100);color:var(--shk-surface-800)}.dark .dp-nav:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-nav:disabled{opacity:.3;cursor:not-allowed}.dp-title{font-size:.875rem;font-weight:600;padding:.25rem .5rem;border-radius:.375rem;color:var(--shk-surface-800);transition:background-color .15s}button.dp-title:hover{background-color:var(--shk-surface-100)}.dark button.dp-title:hover{background-color:var(--shk-surface-200)}.dp-month-divider{position:relative}.dp-month-divider:before{content:\"\";position:absolute;top:-1rem;bottom:0;left:-.75rem;border-left:1px solid var(--shk-surface-200)}.dp-weekday{text-align:center;font-size:.75rem;font-weight:500;color:var(--shk-surface-500);padding:.25rem 0}.dp-cell{position:relative;display:flex;align-items:center;justify-content:center;height:2.25rem}.dp-cell.in-range:before,.dp-cell.range-start:before,.dp-cell.range-end:before{content:\"\";position:absolute;inset:.125rem 0;background-color:color-mix(in srgb,var(--shk-primary-500) 12%,transparent)}.dp-cell.range-start:before{left:50%}.dp-cell.range-end:before{right:50%}.dp-cell.range-start.range-end:before{display:none}.dp-day{position:relative;z-index:1;width:2.125rem;height:2.125rem;border-radius:9999px;font-size:.8125rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-day:hover:not(:disabled):not(.is-selected){background-color:var(--shk-surface-200)}.dp-day.is-outside{color:var(--shk-surface-400)}.dp-day.is-today{font-weight:700;color:var(--shk-primary-600);background-color:color-mix(in srgb,var(--shk-primary-500) 10%,transparent)}.dp-day.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-day:disabled{opacity:.3;cursor:not-allowed;text-decoration:line-through}.dp-dot{position:absolute;left:50%;bottom:.25rem;width:.25rem;height:.25rem;border-radius:9999px;transform:translate(-50%);background-color:var(--shk-primary-500)}.dp-day.is-selected .dp-dot{background-color:#fff}.dp-chip{padding:.5rem 0;font-size:.8125rem;border-radius:.5rem;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-chip:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-chip.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-chip.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.dp-btn{display:inline-flex;align-items:center;justify-content:center;padding:.4375rem .875rem;font-size:.8125rem;font-weight:500;border-radius:.5rem;border:1px solid var(--shk-surface-200);color:var(--shk-surface-700);background-color:transparent;transition:background-color .15s,border-color .15s;white-space:nowrap}.dp-btn:hover:not(:disabled){background-color:var(--shk-surface-100)}.dark .dp-btn:hover:not(:disabled){background-color:var(--shk-surface-200)}.dp-btn-primary{border-color:var(--shk-primary-500);background-color:var(--shk-primary-500);color:#fff}.dp-btn-primary:hover:not(:disabled){background-color:var(--shk-primary-700)!important;border-color:var(--shk-primary-700)}.dp-btn:disabled{opacity:.5;cursor:not-allowed}.dp-mini-input{width:100%;min-width:0;padding:.4375rem .625rem;font-size:.8125rem;border-radius:.5rem;border:1px solid var(--shk-surface-200);background-color:transparent;color:var(--shk-surface-700);outline:none;transition:border-color .15s,box-shadow .15s}.dp-mini-input:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.dp-mini-input.input-error{border-color:var(--shk-error-500)}.dp-divider{border-color:var(--shk-surface-200)}.dp-time-col{position:relative;flex:1 1 0;min-width:0;overflow-y:auto;scrollbar-width:thin;scroll-behavior:smooth;padding:0 .125rem}.dp-time-col+.dp-time-col{border-left:1px solid var(--shk-surface-200)}.dp-time-item{display:flex;align-items:center;justify-content:center;width:100%;height:2rem;margin:.125rem 0;border-radius:.5rem;font-size:.8125rem;font-variant-numeric:tabular-nums;color:var(--shk-surface-700);transition:background-color .12s,color .12s}.dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-100)}.dark .dp-time-item:hover:not(.is-selected){background-color:var(--shk-surface-200)}.dp-time-item.is-current{font-weight:700;color:var(--shk-primary-600)}.dp-time-item.is-selected{background-color:var(--shk-primary-500);color:#fff;font-weight:600}.date-input-field{width:100%;padding:.5rem 2.5rem .5rem .75rem;font-size:.875rem;border-radius:.5rem;outline:none;transition:border-color .15s,box-shadow .15s;background-color:var(--shk-surface-50);color:var(--shk-surface-700);border:1px solid var(--shk-surface-200);text-overflow:ellipsis}:host-context(.dark) .date-input-field,.dark .date-input-field{background-color:var(--shk-surface-100)}.date-input-field::placeholder{color:var(--shk-surface-400)}.date-input-field:focus{border-color:var(--shk-primary-500);box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-primary-500) 22%,transparent)}.date-input-field:disabled{background-color:var(--shk-surface-100);color:var(--shk-surface-500);cursor:not-allowed}:host-context(.dark) .date-input-field:disabled,.dark .date-input-field:disabled{background-color:var(--shk-surface-50);color:var(--shk-surface-400)}.date-input-field.input-error,:host-context(.dark) .date-input-field.input-error,.dark .date-input-field.input-error{border-color:var(--shk-error-500)}.date-input-field.input-error:focus,:host-context(.dark) .date-input-field.input-error:focus,.dark .date-input-field.input-error:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--shk-error-500) 22%,transparent)}.date-input-field.input-valid,:host-context(.dark) .date-input-field.input-valid,.dark .date-input-field.input-valid{border-color:#22c55e}.date-input-field.input-valid:focus,:host-context(.dark) .date-input-field.input-valid:focus,.dark .date-input-field.input-valid:focus{box-shadow:0 0 0 3px #22c55e33}\n"]
|
|
1386
|
+
}]
|
|
1387
|
+
}],
|
|
1388
|
+
ctorParameters: () => [],
|
|
1389
|
+
propDecorators: {
|
|
1390
|
+
id: [{
|
|
1391
|
+
type: i0.Input,
|
|
1392
|
+
args: [{
|
|
1393
|
+
isSignal: true,
|
|
1394
|
+
alias: "id",
|
|
1395
|
+
required: false
|
|
1396
|
+
}]
|
|
1397
|
+
}],
|
|
1398
|
+
view: [{
|
|
1399
|
+
type: i0.Input,
|
|
1400
|
+
args: [{
|
|
1401
|
+
isSignal: true,
|
|
1402
|
+
alias: "view",
|
|
1403
|
+
required: false
|
|
1404
|
+
}]
|
|
1405
|
+
}],
|
|
1406
|
+
weekStart: [{
|
|
1407
|
+
type: i0.Input,
|
|
1408
|
+
args: [{
|
|
1409
|
+
isSignal: true,
|
|
1410
|
+
alias: "weekStart",
|
|
1411
|
+
required: false
|
|
1412
|
+
}]
|
|
1413
|
+
}],
|
|
1414
|
+
range: [{
|
|
1415
|
+
type: i0.Input,
|
|
1416
|
+
args: [{
|
|
1417
|
+
isSignal: true,
|
|
1418
|
+
alias: "range",
|
|
1419
|
+
required: false
|
|
1420
|
+
}]
|
|
1421
|
+
}],
|
|
1422
|
+
markedDates: [{
|
|
1423
|
+
type: i0.Input,
|
|
1424
|
+
args: [{
|
|
1425
|
+
isSignal: true,
|
|
1426
|
+
alias: "markedDates",
|
|
1427
|
+
required: false
|
|
1428
|
+
}]
|
|
1429
|
+
}],
|
|
1430
|
+
label: [{
|
|
1431
|
+
type: i0.Input,
|
|
1432
|
+
args: [{
|
|
1433
|
+
isSignal: true,
|
|
1434
|
+
alias: "label",
|
|
1435
|
+
required: false
|
|
1436
|
+
}]
|
|
1437
|
+
}],
|
|
1438
|
+
placeholder: [{
|
|
1439
|
+
type: i0.Input,
|
|
1440
|
+
args: [{
|
|
1441
|
+
isSignal: true,
|
|
1442
|
+
alias: "placeholder",
|
|
1443
|
+
required: false
|
|
1444
|
+
}]
|
|
1445
|
+
}],
|
|
1446
|
+
formGroup: [{
|
|
1447
|
+
type: i0.Input,
|
|
1448
|
+
args: [{
|
|
1449
|
+
isSignal: true,
|
|
1450
|
+
alias: "formGroup",
|
|
1451
|
+
required: false
|
|
1452
|
+
}]
|
|
1453
|
+
}],
|
|
1454
|
+
controlName: [{
|
|
1455
|
+
type: i0.Input,
|
|
1456
|
+
args: [{
|
|
1457
|
+
isSignal: true,
|
|
1458
|
+
alias: "controlName",
|
|
1459
|
+
required: false
|
|
1460
|
+
}]
|
|
1461
|
+
}],
|
|
1462
|
+
control: [{
|
|
1463
|
+
type: i0.Input,
|
|
1464
|
+
args: [{
|
|
1465
|
+
isSignal: true,
|
|
1466
|
+
alias: "control",
|
|
1467
|
+
required: false
|
|
1468
|
+
}]
|
|
1469
|
+
}],
|
|
1470
|
+
disabled: [{
|
|
1471
|
+
type: i0.Input,
|
|
1472
|
+
args: [{
|
|
1473
|
+
isSignal: true,
|
|
1474
|
+
alias: "disabled",
|
|
1475
|
+
required: false
|
|
1476
|
+
}]
|
|
1477
|
+
}],
|
|
1478
|
+
errorMessage: [{
|
|
1479
|
+
type: i0.Input,
|
|
1480
|
+
args: [{
|
|
1481
|
+
isSignal: true,
|
|
1482
|
+
alias: "errorMessage",
|
|
1483
|
+
required: false
|
|
1484
|
+
}]
|
|
1485
|
+
}],
|
|
1486
|
+
errorMessages: [{
|
|
1487
|
+
type: i0.Input,
|
|
1488
|
+
args: [{
|
|
1489
|
+
isSignal: true,
|
|
1490
|
+
alias: "errorMessages",
|
|
1491
|
+
required: false
|
|
1492
|
+
}]
|
|
1493
|
+
}],
|
|
1494
|
+
minValue: [{
|
|
1495
|
+
type: i0.Input,
|
|
1496
|
+
args: [{
|
|
1497
|
+
isSignal: true,
|
|
1498
|
+
alias: "minValue",
|
|
1499
|
+
required: false
|
|
1500
|
+
}]
|
|
1501
|
+
}],
|
|
1502
|
+
maxValue: [{
|
|
1503
|
+
type: i0.Input,
|
|
1504
|
+
args: [{
|
|
1505
|
+
isSignal: true,
|
|
1506
|
+
alias: "maxValue",
|
|
1507
|
+
required: false
|
|
1508
|
+
}]
|
|
1509
|
+
}],
|
|
1510
|
+
locale: [{
|
|
1511
|
+
type: i0.Input,
|
|
1512
|
+
args: [{
|
|
1513
|
+
isSignal: true,
|
|
1514
|
+
alias: "locale",
|
|
1515
|
+
required: false
|
|
1516
|
+
}]
|
|
1517
|
+
}],
|
|
1518
|
+
dateFormat: [{
|
|
1519
|
+
type: i0.Input,
|
|
1520
|
+
args: [{
|
|
1521
|
+
isSignal: true,
|
|
1522
|
+
alias: "dateFormat",
|
|
1523
|
+
required: false
|
|
1524
|
+
}]
|
|
1525
|
+
}],
|
|
1526
|
+
displayStyle: [{
|
|
1527
|
+
type: i0.Input,
|
|
1528
|
+
args: [{
|
|
1529
|
+
isSignal: true,
|
|
1530
|
+
alias: "displayStyle",
|
|
1531
|
+
required: false
|
|
1532
|
+
}]
|
|
1533
|
+
}],
|
|
1534
|
+
timeOnly: [{
|
|
1535
|
+
type: i0.Input,
|
|
1536
|
+
args: [{
|
|
1537
|
+
isSignal: true,
|
|
1538
|
+
alias: "timeOnly",
|
|
1539
|
+
required: false
|
|
1540
|
+
}]
|
|
1541
|
+
}],
|
|
1542
|
+
showTime: [{
|
|
1543
|
+
type: i0.Input,
|
|
1544
|
+
args: [{
|
|
1545
|
+
isSignal: true,
|
|
1546
|
+
alias: "showTime",
|
|
1547
|
+
required: false
|
|
1548
|
+
}]
|
|
1549
|
+
}],
|
|
1550
|
+
hourFormat: [{
|
|
1551
|
+
type: i0.Input,
|
|
1552
|
+
args: [{
|
|
1553
|
+
isSignal: true,
|
|
1554
|
+
alias: "hourFormat",
|
|
1555
|
+
required: false
|
|
1556
|
+
}]
|
|
1557
|
+
}],
|
|
1558
|
+
showSeconds: [{
|
|
1559
|
+
type: i0.Input,
|
|
1560
|
+
args: [{
|
|
1561
|
+
isSignal: true,
|
|
1562
|
+
alias: "showSeconds",
|
|
1563
|
+
required: false
|
|
1564
|
+
}]
|
|
1565
|
+
}],
|
|
1566
|
+
minuteStep: [{
|
|
1567
|
+
type: i0.Input,
|
|
1568
|
+
args: [{
|
|
1569
|
+
isSignal: true,
|
|
1570
|
+
alias: "minuteStep",
|
|
1571
|
+
required: false
|
|
1572
|
+
}]
|
|
1573
|
+
}],
|
|
1574
|
+
valueFormat: [{
|
|
1575
|
+
type: i0.Input,
|
|
1576
|
+
args: [{
|
|
1577
|
+
isSignal: true,
|
|
1578
|
+
alias: "valueFormat",
|
|
1579
|
+
required: false
|
|
1580
|
+
}]
|
|
1581
|
+
}],
|
|
1582
|
+
overlay: [{
|
|
1583
|
+
type: i0.ViewChild,
|
|
1584
|
+
args: ["overlay", { isSignal: true }]
|
|
1585
|
+
}],
|
|
1586
|
+
anchor: [{
|
|
1587
|
+
type: i0.ViewChild,
|
|
1588
|
+
args: ["anchor", { isSignal: true }]
|
|
1589
|
+
}],
|
|
1590
|
+
panel: [{
|
|
1591
|
+
type: i0.ViewChild,
|
|
1592
|
+
args: ["panel", { isSignal: true }]
|
|
1593
|
+
}],
|
|
1594
|
+
value: [{
|
|
1595
|
+
type: i0.Input,
|
|
1596
|
+
args: [{
|
|
1597
|
+
isSignal: true,
|
|
1598
|
+
alias: "value",
|
|
1599
|
+
required: false
|
|
1600
|
+
}]
|
|
1601
|
+
}, {
|
|
1602
|
+
type: i0.Output,
|
|
1603
|
+
args: ["valueChange"]
|
|
1604
|
+
}],
|
|
1605
|
+
onDocumentClick: [{
|
|
1606
|
+
type: HostListener,
|
|
1607
|
+
args: ["document:click", ["$event"]]
|
|
1608
|
+
}],
|
|
1609
|
+
onViewportChange: [{
|
|
1610
|
+
type: HostListener,
|
|
1611
|
+
args: ["window:resize"]
|
|
1612
|
+
}],
|
|
1613
|
+
onEscape: [{
|
|
1614
|
+
type: HostListener,
|
|
1615
|
+
args: ["document:keydown.escape"]
|
|
1616
|
+
}],
|
|
1617
|
+
touch: [{
|
|
1618
|
+
type: i0.Output,
|
|
1619
|
+
args: ["touch"]
|
|
1620
|
+
}]
|
|
1621
|
+
}
|
|
1622
|
+
});
|
|
1400
1623
|
export { DatePickerComponent };
|
|
1401
|
-
|
|
1624
|
+
|
|
1625
|
+
//# sourceMappingURL=shirkasoft-ui-components-date-picker.mjs.map
|