mn-angular-lib 2.0.33 → 2.0.35
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/fesm2022/mn-angular-lib-alert.mjs +515 -527
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-button.mjs +819 -382
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-core.mjs +693 -1241
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-display.mjs +679 -712
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal.mjs +76 -121
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-tab.mjs +409 -642
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
- package/fesm2022/mn-angular-lib.mjs +16 -29
- package/package.json +1 -1
- package/types/mn-angular-lib-alert.d.ts +239 -241
- package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
- package/types/mn-angular-lib-button.d.ts +319 -317
- package/types/mn-angular-lib-calendar-core.d.ts +199 -209
- package/types/mn-angular-lib-calendar.d.ts +656 -511
- package/types/mn-angular-lib-collection.d.ts +1649 -1585
- package/types/mn-angular-lib-core.d.ts +524 -535
- package/types/mn-angular-lib-display.d.ts +946 -886
- package/types/mn-angular-lib-forms.d.ts +3012 -3013
- package/types/mn-angular-lib-keyboard.d.ts +125 -85
- package/types/mn-angular-lib-modal-core.d.ts +978 -994
- package/types/mn-angular-lib-modal-ui.d.ts +541 -493
- package/types/mn-angular-lib-modal.d.ts +24 -27
- package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
- package/types/mn-angular-lib-segmented.d.ts +354 -341
- package/types/mn-angular-lib-tab.d.ts +345 -336
- package/types/mn-angular-lib.d.ts +16 -16
- package/fesm2022/mn-angular-lib.mjs.map +0 -1
|
@@ -1,1553 +1,1699 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { CommonModule } from
|
|
4
|
-
import * as i1 from
|
|
5
|
-
import { FormsModule } from
|
|
6
|
-
import { LucideDynamicIcon } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { MnLanguageService, lucideIcons } from
|
|
10
|
-
import { MnBadge, MnButton } from
|
|
11
|
-
import { MnDatetime } from
|
|
12
|
-
import * as lucide from
|
|
13
|
-
import { takeUntilDestroyed } from
|
|
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
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, ElementRef, EventEmitter, HostListener, Injector, Input, Output, ViewChild, ViewContainerRef, afterNextRender, computed, inject, input, linkedSignal, output, signal, viewChildren } from "@angular/core";
|
|
3
|
+
import { CommonModule } from "@angular/common";
|
|
4
|
+
import * as i1 from "@angular/forms";
|
|
5
|
+
import { FormsModule } from "@angular/forms";
|
|
6
|
+
import { LucideDynamicIcon } from "@lucide/angular";
|
|
7
|
+
import { BehaviorSubject, Subject, skip, takeUntil } from "rxjs";
|
|
8
|
+
import { CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarEventLayoutService, CalendarUtility, CalendarView, DEFAULT_CALENDAR_CONFIG, DefaultCalendarDateFormatter, MN_CALENDAR_CONFIG, provideMnCalendarConfig, resolveCalendarConfig } from "mn-angular-lib/calendar-core";
|
|
9
|
+
import { MnLanguageService, lucideIcons } from "mn-angular-lib/core";
|
|
10
|
+
import { MnBadge, MnButton } from "mn-angular-lib/button";
|
|
11
|
+
import { MnDatetime } from "mn-angular-lib/forms";
|
|
12
|
+
import * as lucide from "lucide";
|
|
13
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
14
|
+
var CalendarMonthComponent = class CalendarMonthComponent {
|
|
15
|
+
lang = inject(MnLanguageService);
|
|
16
|
+
cdr = inject(ChangeDetectorRef);
|
|
17
|
+
get monthViewLabel() {
|
|
18
|
+
return this.lang.translateIfPresent("mnCalendar.monthView") ?? "Month view";
|
|
19
|
+
}
|
|
20
|
+
focusDay;
|
|
21
|
+
eventsChanged;
|
|
22
|
+
focusDayChanged;
|
|
23
|
+
config;
|
|
24
|
+
dayClicked = new EventEmitter();
|
|
25
|
+
monthItems = [];
|
|
26
|
+
weekdayLabels;
|
|
27
|
+
moreEventsLabel = DEFAULT_CALENDAR_CONFIG.moreEventsLabel;
|
|
28
|
+
events = [];
|
|
29
|
+
destroy$ = new Subject();
|
|
30
|
+
formatter;
|
|
31
|
+
constructor() {
|
|
32
|
+
this.formatter = new DefaultCalendarDateFormatter();
|
|
33
|
+
this.weekdayLabels = DEFAULT_CALENDAR_CONFIG.shortDayNames;
|
|
34
|
+
}
|
|
35
|
+
ngOnInit() {
|
|
36
|
+
const resolved = this.config ? resolveCalendarConfig(this.config) : { ...DEFAULT_CALENDAR_CONFIG };
|
|
37
|
+
this.weekdayLabels = resolved.shortDayNames;
|
|
38
|
+
this.moreEventsLabel = resolved.moreEventsLabel;
|
|
39
|
+
this.buildMonth();
|
|
40
|
+
if (this.eventsChanged) this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
41
|
+
this.events = events;
|
|
42
|
+
this.buildMonth();
|
|
43
|
+
this.cdr.markForCheck();
|
|
44
|
+
});
|
|
45
|
+
if (this.focusDayChanged) this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
46
|
+
this.focusDay = date;
|
|
47
|
+
this.buildMonth();
|
|
48
|
+
this.cdr.markForCheck();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
ngOnDestroy() {
|
|
52
|
+
this.destroy$.next();
|
|
53
|
+
this.destroy$.complete();
|
|
54
|
+
}
|
|
55
|
+
onDayClick(date) {
|
|
56
|
+
this.dayClicked.emit(date);
|
|
57
|
+
}
|
|
58
|
+
trackByDayName(index) {
|
|
59
|
+
return index;
|
|
60
|
+
}
|
|
61
|
+
trackByMonthItem(_index, item) {
|
|
62
|
+
return item.date.getTime();
|
|
63
|
+
}
|
|
64
|
+
trackByEventDot(_index, event) {
|
|
65
|
+
return event.id;
|
|
66
|
+
}
|
|
67
|
+
buildMonth() {
|
|
68
|
+
if (!this.focusDay) return;
|
|
69
|
+
const year = this.focusDay.getFullYear();
|
|
70
|
+
const month = this.focusDay.getMonth();
|
|
71
|
+
const firstDay = new Date(year, month, 1);
|
|
72
|
+
const lastDay = new Date(year, month + 1, 0);
|
|
73
|
+
let startOffset = firstDay.getDay() - 1;
|
|
74
|
+
if (startOffset < 0) startOffset = 6;
|
|
75
|
+
const today = /* @__PURE__ */ new Date();
|
|
76
|
+
this.monthItems = [];
|
|
77
|
+
for (let i = startOffset - 1; i >= 0; i--) {
|
|
78
|
+
const date = new Date(year, month, -i);
|
|
79
|
+
this.monthItems.push(this.createMonthItem(date, false, today));
|
|
80
|
+
}
|
|
81
|
+
for (let d = 1; d <= lastDay.getDate(); d++) {
|
|
82
|
+
const date = new Date(year, month, d);
|
|
83
|
+
this.monthItems.push(this.createMonthItem(date, true, today));
|
|
84
|
+
}
|
|
85
|
+
const remaining = 42 - this.monthItems.length;
|
|
86
|
+
for (let i = 1; i <= remaining; i++) {
|
|
87
|
+
const date = new Date(year, month + 1, i);
|
|
88
|
+
this.monthItems.push(this.createMonthItem(date, false, today));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
createMonthItem(date, isCurrentMonth, today) {
|
|
92
|
+
const isToday = this.formatter.isSameDay(date, today);
|
|
93
|
+
const dayEvents = this.events.filter((e) => this.formatter.isSameDay(e.startTime, date) || this.formatter.isSameDay(e.endTime, date) || e.startTime < date && e.endTime > date);
|
|
94
|
+
return {
|
|
95
|
+
date,
|
|
96
|
+
dayNumber: date.getDate(),
|
|
97
|
+
isCurrentMonth,
|
|
98
|
+
isToday,
|
|
99
|
+
events: dayEvents
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
103
|
+
minVersion: "12.0.0",
|
|
104
|
+
version: "22.2.2",
|
|
105
|
+
ngImport: i0,
|
|
106
|
+
type: CalendarMonthComponent,
|
|
107
|
+
deps: [],
|
|
108
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
109
|
+
});
|
|
110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
111
|
+
minVersion: "17.0.0",
|
|
112
|
+
version: "22.2.2",
|
|
113
|
+
type: CalendarMonthComponent,
|
|
114
|
+
isStandalone: true,
|
|
115
|
+
selector: "mn-calendar-month",
|
|
116
|
+
inputs: {
|
|
117
|
+
focusDay: "focusDay",
|
|
118
|
+
eventsChanged: "eventsChanged",
|
|
119
|
+
focusDayChanged: "focusDayChanged",
|
|
120
|
+
config: "config"
|
|
121
|
+
},
|
|
122
|
+
outputs: { dayClicked: "dayClicked" },
|
|
123
|
+
ngImport: i0,
|
|
124
|
+
template: "<!-- Month grid. Cells are grouped by space rather than boxed by borders, in\n keeping with the date-selector-bar: no rules, soft rounded cells, a hover\n wash, and today marked by a tinted number alone (no circle). -->\n<!-- Rows are a compact fixed height rather than stretched to fill the container:\n a month with few events shouldn't leave each cell mostly empty. The panel\n scrolls if the grid is taller than the space it's given. -->\n<div [attr.aria-label]=\"monthViewLabel\" class=\"w-full flex flex-col\" role=\"grid\">\n <div class=\"grid grid-cols-7 pb-2\">\n @for (day of weekdayLabels; track day) {\n <div class=\"pl-2 text-left text-[11px] font-semibold uppercase tracking-wide opacity-45\" role=\"columnheader\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-1 auto-rows-[minmax(92px,auto)]\">\n @for (item of monthItems; track item.date.getTime()) {\n <div\n class=\"flex flex-col gap-1 min-h-0 overflow-hidden rounded-xl p-1.5 cursor-pointer transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n [class.opacity-40]=\"!item.isCurrentMonth\"\n (keyup.enter)=\"onDayClick(item.date)\"\n (click)=\"onDayClick(item.date)\"\n tabindex=\"0\"\n role=\"gridcell\"\n [attr.aria-label]=\"item.date.toDateString()\">\n <span class=\"text-[13px] font-bold leading-none tabular-nums\" [class.text-primary]=\"item.isToday\">{{ item.dayNumber }}</span>\n <div class=\"flex flex-col gap-0.5 min-h-0\">\n @for (event of item.events.slice(0, 3); track $index) {\n <div\n class=\"flex items-center overflow-hidden rounded-md border-l-[3px] px-1.5 py-0.5 text-[11px] leading-tight\"\n [style.background-color]=\"'color-mix(in oklab, ' + event.color.primaryColor + ' 18%, var(--color-base-100, #fff))'\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\"\n [title]=\"event.title\">\n <span class=\"truncate font-semibold\">{{ event.title }}</span>\n </div>\n }\n <!-- Overflow indicator. Styled as a pill that lights up on hover so it\n reads as actionable; the whole cell already navigates to the Day\n view for this date on click / Enter, where every event is listed. -->\n @if (item.events.length > 3) {\n <span class=\"mt-0.5 inline-flex w-fit items-center rounded-md px-1.5 py-0.5 text-[10.5px] font-semibold opacity-60 transition-colors hover:bg-base-300 hover:opacity-100 motion-reduce:transition-none\">\n +{{ item.events.length - 3 }} {{ moreEventsLabel }}\n </span>\n }\n </div>\n </div>\n }\n </div>\n</div>\n",
|
|
125
|
+
dependencies: [{
|
|
126
|
+
kind: "ngmodule",
|
|
127
|
+
type: CommonModule
|
|
128
|
+
}]
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
132
|
+
minVersion: "12.0.0",
|
|
133
|
+
version: "22.2.2",
|
|
134
|
+
ngImport: i0,
|
|
135
|
+
type: CalendarMonthComponent,
|
|
136
|
+
decorators: [{
|
|
137
|
+
type: Component,
|
|
138
|
+
args: [{
|
|
139
|
+
selector: "mn-calendar-month",
|
|
140
|
+
standalone: true,
|
|
141
|
+
imports: [CommonModule],
|
|
142
|
+
template: "<!-- Month grid. Cells are grouped by space rather than boxed by borders, in\n keeping with the date-selector-bar: no rules, soft rounded cells, a hover\n wash, and today marked by a tinted number alone (no circle). -->\n<!-- Rows are a compact fixed height rather than stretched to fill the container:\n a month with few events shouldn't leave each cell mostly empty. The panel\n scrolls if the grid is taller than the space it's given. -->\n<div [attr.aria-label]=\"monthViewLabel\" class=\"w-full flex flex-col\" role=\"grid\">\n <div class=\"grid grid-cols-7 pb-2\">\n @for (day of weekdayLabels; track day) {\n <div class=\"pl-2 text-left text-[11px] font-semibold uppercase tracking-wide opacity-45\" role=\"columnheader\">{{ day }}</div>\n }\n </div>\n <div class=\"grid grid-cols-7 gap-1 auto-rows-[minmax(92px,auto)]\">\n @for (item of monthItems; track item.date.getTime()) {\n <div\n class=\"flex flex-col gap-1 min-h-0 overflow-hidden rounded-xl p-1.5 cursor-pointer transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n [class.opacity-40]=\"!item.isCurrentMonth\"\n (keyup.enter)=\"onDayClick(item.date)\"\n (click)=\"onDayClick(item.date)\"\n tabindex=\"0\"\n role=\"gridcell\"\n [attr.aria-label]=\"item.date.toDateString()\">\n <span class=\"text-[13px] font-bold leading-none tabular-nums\" [class.text-primary]=\"item.isToday\">{{ item.dayNumber }}</span>\n <div class=\"flex flex-col gap-0.5 min-h-0\">\n @for (event of item.events.slice(0, 3); track $index) {\n <div\n class=\"flex items-center overflow-hidden rounded-md border-l-[3px] px-1.5 py-0.5 text-[11px] leading-tight\"\n [style.background-color]=\"'color-mix(in oklab, ' + event.color.primaryColor + ' 18%, var(--color-base-100, #fff))'\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\"\n [title]=\"event.title\">\n <span class=\"truncate font-semibold\">{{ event.title }}</span>\n </div>\n }\n <!-- Overflow indicator. Styled as a pill that lights up on hover so it\n reads as actionable; the whole cell already navigates to the Day\n view for this date on click / Enter, where every event is listed. -->\n @if (item.events.length > 3) {\n <span class=\"mt-0.5 inline-flex w-fit items-center rounded-md px-1.5 py-0.5 text-[10.5px] font-semibold opacity-60 transition-colors hover:bg-base-300 hover:opacity-100 motion-reduce:transition-none\">\n +{{ item.events.length - 3 }} {{ moreEventsLabel }}\n </span>\n }\n </div>\n </div>\n }\n </div>\n</div>\n"
|
|
143
|
+
}]
|
|
144
|
+
}],
|
|
145
|
+
ctorParameters: () => [],
|
|
146
|
+
propDecorators: {
|
|
147
|
+
focusDay: [{ type: Input }],
|
|
148
|
+
eventsChanged: [{ type: Input }],
|
|
149
|
+
focusDayChanged: [{ type: Input }],
|
|
150
|
+
config: [{ type: Input }],
|
|
151
|
+
dayClicked: [{ type: Output }]
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
var CalendarEventDefaultComponent = class CalendarEventDefaultComponent {
|
|
155
|
+
cdr = inject(ChangeDetectorRef);
|
|
156
|
+
event;
|
|
157
|
+
formattedTime = "";
|
|
158
|
+
formatter;
|
|
159
|
+
constructor() {
|
|
160
|
+
const formatter = inject(CALENDAR_DATE_FORMATTER, { optional: true });
|
|
161
|
+
this.formatter = formatter ?? new DefaultCalendarDateFormatter();
|
|
162
|
+
}
|
|
163
|
+
async ngOnInit() {
|
|
164
|
+
if (this.event) {
|
|
165
|
+
const start = await this.formatter.formatTime(this.event.startTime);
|
|
166
|
+
const end = await this.formatter.formatTime(this.event.endTime);
|
|
167
|
+
this.formattedTime = `${start} - ${end}`;
|
|
168
|
+
this.cdr.markForCheck();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
172
|
+
minVersion: "12.0.0",
|
|
173
|
+
version: "22.2.2",
|
|
174
|
+
ngImport: i0,
|
|
175
|
+
type: CalendarEventDefaultComponent,
|
|
176
|
+
deps: [],
|
|
177
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
178
|
+
});
|
|
179
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
180
|
+
minVersion: "17.0.0",
|
|
181
|
+
version: "22.2.2",
|
|
182
|
+
type: CalendarEventDefaultComponent,
|
|
183
|
+
isStandalone: true,
|
|
184
|
+
selector: "mn-calendar-event-default",
|
|
185
|
+
ngImport: i0,
|
|
186
|
+
template: "<!-- The shared event chip: a colored spine and a tinted fill from the event's own\n colours, so it reads the same in week, day and month. Text inherits the\n event's primary colour, keeping it legible on either theme. The fill mixes that\n colour into the page surface, so it darkens with a dark theme instead of staying\n a light pastel. -->\n<div class=\"h-full overflow-hidden cursor-pointer rounded-lg border-l-[3px] px-2 py-1 text-xs\"\n [style.background-color]=\"'color-mix(in oklab, ' + event.color.primaryColor + ' 18%, var(--color-base-100, #fff))'\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\">\n <div class=\"truncate font-semibold\">{{ event.title }}</div>\n <div class=\"truncate text-[11px] opacity-85\">{{ formattedTime }}</div>\n @if (event.description) {\n <div class=\"truncate text-[11px] opacity-75\">{{ event.description }}</div>\n }\n</div>\n",
|
|
187
|
+
dependencies: [{
|
|
188
|
+
kind: "ngmodule",
|
|
189
|
+
type: CommonModule
|
|
190
|
+
}]
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
194
|
+
minVersion: "12.0.0",
|
|
195
|
+
version: "22.2.2",
|
|
196
|
+
ngImport: i0,
|
|
197
|
+
type: CalendarEventDefaultComponent,
|
|
198
|
+
decorators: [{
|
|
199
|
+
type: Component,
|
|
200
|
+
args: [{
|
|
201
|
+
selector: "mn-calendar-event-default",
|
|
202
|
+
standalone: true,
|
|
203
|
+
imports: [CommonModule],
|
|
204
|
+
template: "<!-- The shared event chip: a colored spine and a tinted fill from the event's own\n colours, so it reads the same in week, day and month. Text inherits the\n event's primary colour, keeping it legible on either theme. The fill mixes that\n colour into the page surface, so it darkens with a dark theme instead of staying\n a light pastel. -->\n<div class=\"h-full overflow-hidden cursor-pointer rounded-lg border-l-[3px] px-2 py-1 text-xs\"\n [style.background-color]=\"'color-mix(in oklab, ' + event.color.primaryColor + ' 18%, var(--color-base-100, #fff))'\"\n [style.border-left-color]=\"event.color.primaryColor\"\n [style.color]=\"event.color.primaryColor\">\n <div class=\"truncate font-semibold\">{{ event.title }}</div>\n <div class=\"truncate text-[11px] opacity-85\">{{ formattedTime }}</div>\n @if (event.description) {\n <div class=\"truncate text-[11px] opacity-75\">{{ event.description }}</div>\n }\n</div>\n"
|
|
205
|
+
}]
|
|
206
|
+
}],
|
|
207
|
+
ctorParameters: () => []
|
|
208
|
+
});
|
|
209
|
+
var CalendarEventComponent = class CalendarEventComponent {
|
|
210
|
+
event;
|
|
211
|
+
customComponent;
|
|
212
|
+
eventClicked = new EventEmitter();
|
|
213
|
+
eventContainer;
|
|
214
|
+
rendered = false;
|
|
215
|
+
ngAfterViewInit() {
|
|
216
|
+
this.renderComponent();
|
|
217
|
+
}
|
|
218
|
+
ngOnChanges(changes) {
|
|
219
|
+
if (this.rendered && (changes["event"] || changes["customComponent"])) this.renderComponent();
|
|
220
|
+
}
|
|
221
|
+
onEventClick() {
|
|
222
|
+
this.eventClicked.emit(this.event);
|
|
223
|
+
}
|
|
224
|
+
renderComponent() {
|
|
225
|
+
if (!this.eventContainer) return;
|
|
226
|
+
this.eventContainer.clear();
|
|
227
|
+
const component = this.customComponent ?? this.event?.component ?? CalendarEventDefaultComponent;
|
|
228
|
+
const ref = this.eventContainer.createComponent(component);
|
|
229
|
+
ref.instance.event = this.event;
|
|
230
|
+
ref.changeDetectorRef.detectChanges();
|
|
231
|
+
this.rendered = true;
|
|
232
|
+
}
|
|
233
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
234
|
+
minVersion: "12.0.0",
|
|
235
|
+
version: "22.2.2",
|
|
236
|
+
ngImport: i0,
|
|
237
|
+
type: CalendarEventComponent,
|
|
238
|
+
deps: [],
|
|
239
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
240
|
+
});
|
|
241
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
242
|
+
minVersion: "14.0.0",
|
|
243
|
+
version: "22.2.2",
|
|
244
|
+
type: CalendarEventComponent,
|
|
245
|
+
isStandalone: true,
|
|
246
|
+
selector: "mn-calendar-event",
|
|
247
|
+
inputs: {
|
|
248
|
+
event: "event",
|
|
249
|
+
customComponent: "customComponent"
|
|
250
|
+
},
|
|
251
|
+
outputs: { eventClicked: "eventClicked" },
|
|
252
|
+
viewQueries: [{
|
|
253
|
+
propertyName: "eventContainer",
|
|
254
|
+
first: true,
|
|
255
|
+
predicate: ["eventContainer"],
|
|
256
|
+
descendants: true,
|
|
257
|
+
read: ViewContainerRef,
|
|
258
|
+
static: true
|
|
259
|
+
}],
|
|
260
|
+
usesOnChanges: true,
|
|
261
|
+
ngImport: i0,
|
|
262
|
+
template: "<!-- Host for the dynamically-rendered event component. Click/keyboard handling and\n the focus ring live on the week/day event wrapper, so this stays presentational\n to avoid a second, redundant tab stop per event. -->\n<div class=\"h-full w-full\">\n <ng-template #eventContainer></ng-template>\n</div>\n",
|
|
263
|
+
dependencies: [{
|
|
264
|
+
kind: "ngmodule",
|
|
265
|
+
type: CommonModule
|
|
266
|
+
}]
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
270
|
+
minVersion: "12.0.0",
|
|
271
|
+
version: "22.2.2",
|
|
272
|
+
ngImport: i0,
|
|
273
|
+
type: CalendarEventComponent,
|
|
274
|
+
decorators: [{
|
|
275
|
+
type: Component,
|
|
276
|
+
args: [{
|
|
277
|
+
selector: "mn-calendar-event",
|
|
278
|
+
standalone: true,
|
|
279
|
+
imports: [CommonModule],
|
|
280
|
+
template: "<!-- Host for the dynamically-rendered event component. Click/keyboard handling and\n the focus ring live on the week/day event wrapper, so this stays presentational\n to avoid a second, redundant tab stop per event. -->\n<div class=\"h-full w-full\">\n <ng-template #eventContainer></ng-template>\n</div>\n"
|
|
281
|
+
}]
|
|
282
|
+
}],
|
|
283
|
+
propDecorators: {
|
|
284
|
+
event: [{ type: Input }],
|
|
285
|
+
customComponent: [{ type: Input }],
|
|
286
|
+
eventClicked: [{ type: Output }],
|
|
287
|
+
eventContainer: [{
|
|
288
|
+
type: ViewChild,
|
|
289
|
+
args: ["eventContainer", {
|
|
290
|
+
read: ViewContainerRef,
|
|
291
|
+
static: true
|
|
292
|
+
}]
|
|
293
|
+
}]
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
var CalendarWeekComponent = class CalendarWeekComponent {
|
|
297
|
+
lang = inject(MnLanguageService);
|
|
298
|
+
get weekViewLabel() {
|
|
299
|
+
return this.lang.translateIfPresent("mnCalendar.weekView") ?? "Week view";
|
|
300
|
+
}
|
|
301
|
+
layoutService = inject(CalendarEventLayoutService);
|
|
302
|
+
cdr = inject(ChangeDetectorRef);
|
|
303
|
+
focusDay;
|
|
304
|
+
eventsChanged;
|
|
305
|
+
focusDayChanged;
|
|
306
|
+
config;
|
|
307
|
+
calendarEventComponent;
|
|
308
|
+
eventClicked = new EventEmitter();
|
|
309
|
+
columns = [];
|
|
310
|
+
hourRows = [];
|
|
311
|
+
displayEvents = [];
|
|
312
|
+
totalRows = 0;
|
|
313
|
+
currentTimeRow = 0;
|
|
314
|
+
currentTimeCol = "";
|
|
315
|
+
currentTimeLabel = "";
|
|
316
|
+
gridTemplateColumns = "repeat(7, 1fr)";
|
|
317
|
+
dayColumnMap = [];
|
|
318
|
+
events = [];
|
|
319
|
+
destroy$ = new Subject();
|
|
320
|
+
formatter;
|
|
321
|
+
resolvedConfig;
|
|
322
|
+
currentTimeInterval;
|
|
323
|
+
constructor() {
|
|
324
|
+
this.formatter = new DefaultCalendarDateFormatter();
|
|
325
|
+
}
|
|
326
|
+
ngOnInit() {
|
|
327
|
+
this.resolvedConfig = this.config ? resolveCalendarConfig(this.config) : { ...DEFAULT_CALENDAR_CONFIG };
|
|
328
|
+
this.buildColumns();
|
|
329
|
+
this.updateCurrentTime();
|
|
330
|
+
this.currentTimeInterval = setInterval(() => this.updateCurrentTime(), 6e4);
|
|
331
|
+
if (this.eventsChanged) this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
332
|
+
this.events = events;
|
|
333
|
+
this.refreshEvents();
|
|
334
|
+
this.cdr.markForCheck();
|
|
335
|
+
});
|
|
336
|
+
if (this.focusDayChanged) this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
337
|
+
this.focusDay = date;
|
|
338
|
+
this.buildColumns();
|
|
339
|
+
this.refreshEvents();
|
|
340
|
+
this.updateCurrentTime();
|
|
341
|
+
this.cdr.markForCheck();
|
|
342
|
+
});
|
|
343
|
+
this.buildHourRows().then(() => this.cdr.markForCheck());
|
|
344
|
+
}
|
|
345
|
+
ngOnDestroy() {
|
|
346
|
+
this.destroy$.next();
|
|
347
|
+
this.destroy$.complete();
|
|
348
|
+
if (this.currentTimeInterval) clearInterval(this.currentTimeInterval);
|
|
349
|
+
}
|
|
350
|
+
getEventRow(event) {
|
|
351
|
+
const startRow = CalendarUtility.getCorrectRow(event.startTime.getHours(), event.startTime.getMinutes(), this.resolvedConfig.startHour);
|
|
352
|
+
const endRow = CalendarUtility.getCorrectRow(event.endTime.getHours(), event.endTime.getMinutes(), this.resolvedConfig.startHour);
|
|
353
|
+
return `${startRow} / ${Math.max(endRow, startRow + 1)}`;
|
|
354
|
+
}
|
|
355
|
+
getHeaderColumn(dayIndex) {
|
|
356
|
+
if (!this.dayColumnMap.length) return `${dayIndex + 2} / span 1`;
|
|
357
|
+
const dayInfo = this.dayColumnMap[dayIndex];
|
|
358
|
+
return `${dayInfo.startCol + 1} / span ${dayInfo.subColumns}`;
|
|
359
|
+
}
|
|
360
|
+
getEventColumn(event) {
|
|
361
|
+
const dayIdx = this.columns.findIndex((c) => this.formatter.isSameDay(c.date, event.startTime));
|
|
362
|
+
if (dayIdx < 0) return "1 / span 1";
|
|
363
|
+
const dayInfo = this.dayColumnMap[dayIdx];
|
|
364
|
+
return `${(event.column ?? 0) + dayInfo.startCol} / span ${event.width ?? 1}`;
|
|
365
|
+
}
|
|
366
|
+
onEventClick(event) {
|
|
367
|
+
this.eventClicked.emit(event);
|
|
368
|
+
}
|
|
369
|
+
trackByHour(_index, row) {
|
|
370
|
+
return row.hour;
|
|
371
|
+
}
|
|
372
|
+
trackByColumn(_index, col) {
|
|
373
|
+
return col.date.getTime();
|
|
374
|
+
}
|
|
375
|
+
trackByEvent(_index, event) {
|
|
376
|
+
return event.id;
|
|
377
|
+
}
|
|
378
|
+
async buildHourRows() {
|
|
379
|
+
const hours = this.resolvedConfig.endHour - this.resolvedConfig.startHour;
|
|
380
|
+
this.totalRows = hours * 2;
|
|
381
|
+
const rows = [];
|
|
382
|
+
for (let i = 0; i < hours; i++) {
|
|
383
|
+
const hour = this.resolvedConfig.startHour + i;
|
|
384
|
+
const label = await this.formatter.formatTimeI(hour, 0);
|
|
385
|
+
rows.push({
|
|
386
|
+
hour,
|
|
387
|
+
topRow: i * 2 + 1,
|
|
388
|
+
bottomRow: i * 2 + 3,
|
|
389
|
+
hourLabel: label
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
this.hourRows = rows;
|
|
393
|
+
}
|
|
394
|
+
buildColumns() {
|
|
395
|
+
if (!this.focusDay) return;
|
|
396
|
+
const shortNames = this.resolvedConfig.shortDayNames;
|
|
397
|
+
const today = /* @__PURE__ */ new Date();
|
|
398
|
+
const day = this.focusDay.getDay();
|
|
399
|
+
const mondayOffset = day === 0 ? -6 : 1 - day;
|
|
400
|
+
const monday = new Date(this.focusDay);
|
|
401
|
+
monday.setDate(this.focusDay.getDate() + mondayOffset);
|
|
402
|
+
this.columns = [];
|
|
403
|
+
for (let i = 0; i < 7; i++) {
|
|
404
|
+
const date = new Date(monday);
|
|
405
|
+
date.setDate(monday.getDate() + i);
|
|
406
|
+
this.columns.push({
|
|
407
|
+
date,
|
|
408
|
+
dayName: shortNames[i],
|
|
409
|
+
dayNumber: date.getDate(),
|
|
410
|
+
isToday: this.formatter.isSameDay(date, today)
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
refreshEvents() {
|
|
415
|
+
if (!this.columns.length) return;
|
|
416
|
+
const rangeStart = this.columns[0].date;
|
|
417
|
+
const rangeEnd = new Date(this.columns[6].date);
|
|
418
|
+
rangeEnd.setHours(23, 59, 59, 999);
|
|
419
|
+
const filtered = this.events.filter((e) => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
420
|
+
this.displayEvents = this.layoutService.calculateMultiDayEvents(filtered, this.resolvedConfig.startHour, this.resolvedConfig.endHour, rangeStart, rangeEnd);
|
|
421
|
+
for (let i = 0; i < 7; i++) {
|
|
422
|
+
const dayStart = new Date(this.columns[i].date);
|
|
423
|
+
dayStart.setHours(0, 0, 0, 0);
|
|
424
|
+
const dayEnd = new Date(this.columns[i].date);
|
|
425
|
+
dayEnd.setHours(23, 59, 59, 999);
|
|
426
|
+
const dayEvents = this.displayEvents.filter((e) => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
427
|
+
this.layoutService.assignColumnsToEvents(dayEvents);
|
|
428
|
+
this.layoutService.assignWidthsToEvents(dayEvents, dayStart, dayEnd);
|
|
429
|
+
}
|
|
430
|
+
this.buildGridColumns();
|
|
431
|
+
this.updateCurrentTime();
|
|
432
|
+
}
|
|
433
|
+
buildGridColumns() {
|
|
434
|
+
this.dayColumnMap = [];
|
|
435
|
+
let currentCol = 1;
|
|
436
|
+
for (let i = 0; i < 7; i++) {
|
|
437
|
+
const dayEvents = this.displayEvents.filter((e) => this.formatter.isSameDay(e.startTime, this.columns[i].date));
|
|
438
|
+
let maxSubCols = 1;
|
|
439
|
+
for (const e of dayEvents) maxSubCols = Math.max(maxSubCols, (e.column ?? 0) + (e.width ?? 1));
|
|
440
|
+
this.dayColumnMap.push({
|
|
441
|
+
subColumns: maxSubCols,
|
|
442
|
+
startCol: currentCol
|
|
443
|
+
});
|
|
444
|
+
currentCol += maxSubCols;
|
|
445
|
+
}
|
|
446
|
+
const parts = [];
|
|
447
|
+
for (const day of this.dayColumnMap) {
|
|
448
|
+
const share = Math.max(1 / day.subColumns, .8);
|
|
449
|
+
for (let j = 0; j < day.subColumns; j++) parts.push(`${share}fr`);
|
|
450
|
+
}
|
|
451
|
+
this.gridTemplateColumns = parts.join(" ");
|
|
452
|
+
}
|
|
453
|
+
updateCurrentTime() {
|
|
454
|
+
const now = /* @__PURE__ */ new Date();
|
|
455
|
+
const dayIdx = this.columns.findIndex((c) => this.formatter.isSameDay(c.date, now));
|
|
456
|
+
if (dayIdx >= 0 && this.dayColumnMap.length > 0) {
|
|
457
|
+
const dayInfo = this.dayColumnMap[dayIdx];
|
|
458
|
+
this.currentTimeCol = `${dayInfo.startCol} / span ${dayInfo.subColumns}`;
|
|
459
|
+
this.currentTimeRow = CalendarUtility.getCorrectRow(now.getHours(), now.getMinutes(), this.resolvedConfig.startHour);
|
|
460
|
+
this.formatter.formatTime(now).then((label) => {
|
|
461
|
+
this.currentTimeLabel = label;
|
|
462
|
+
this.cdr.markForCheck();
|
|
463
|
+
});
|
|
464
|
+
} else {
|
|
465
|
+
this.currentTimeCol = "";
|
|
466
|
+
this.currentTimeRow = 0;
|
|
467
|
+
this.currentTimeLabel = "";
|
|
468
|
+
}
|
|
469
|
+
this.cdr.markForCheck();
|
|
470
|
+
}
|
|
471
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
472
|
+
minVersion: "12.0.0",
|
|
473
|
+
version: "22.2.2",
|
|
474
|
+
ngImport: i0,
|
|
475
|
+
type: CalendarWeekComponent,
|
|
476
|
+
deps: [],
|
|
477
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
478
|
+
});
|
|
479
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
480
|
+
minVersion: "17.0.0",
|
|
481
|
+
version: "22.2.2",
|
|
482
|
+
type: CalendarWeekComponent,
|
|
483
|
+
isStandalone: true,
|
|
484
|
+
selector: "mn-calendar-week",
|
|
485
|
+
inputs: {
|
|
486
|
+
focusDay: "focusDay",
|
|
487
|
+
eventsChanged: "eventsChanged",
|
|
488
|
+
focusDayChanged: "focusDayChanged",
|
|
489
|
+
config: "config",
|
|
490
|
+
calendarEventComponent: "calendarEventComponent"
|
|
491
|
+
},
|
|
492
|
+
outputs: { eventClicked: "eventClicked" },
|
|
493
|
+
providers: [CalendarEventLayoutService],
|
|
494
|
+
ngImport: i0,
|
|
495
|
+
template: "<!-- Week grid. Hour rules are quiet hairlines; today's column header is a tinted\n number (no fill); the current time is a line carrying a small time bubble.\n Dynamic row/column placement stays inline — the layout maths lives in TS. -->\n<div [attr.aria-label]=\"weekViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid\" [style.grid-template-columns]=\"'60px ' + gridTemplateColumns\">\n <div></div>\n @for (col of columns; track col.dayName; let i = $index) {\n <div class=\"py-2 px-1 text-center\"\n [style.grid-column]=\"getHeaderColumn(i)\"\n role=\"columnheader\">\n <span class=\"block text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ col.dayName }}</span>\n <span class=\"text-lg font-bold tabular-nums\" [class.text-primary]=\"col.isToday\">{{ col.dayNumber }}</span>\n </div>\n }\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"gridTemplateColumns\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && currentTimeCol) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"currentTimeCol\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n",
|
|
496
|
+
dependencies: [{
|
|
497
|
+
kind: "ngmodule",
|
|
498
|
+
type: CommonModule
|
|
499
|
+
}, {
|
|
500
|
+
kind: "component",
|
|
501
|
+
type: CalendarEventComponent,
|
|
502
|
+
selector: "mn-calendar-event",
|
|
503
|
+
inputs: ["event", "customComponent"],
|
|
504
|
+
outputs: ["eventClicked"]
|
|
505
|
+
}]
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
509
|
+
minVersion: "12.0.0",
|
|
510
|
+
version: "22.2.2",
|
|
511
|
+
ngImport: i0,
|
|
512
|
+
type: CalendarWeekComponent,
|
|
513
|
+
decorators: [{
|
|
514
|
+
type: Component,
|
|
515
|
+
args: [{
|
|
516
|
+
selector: "mn-calendar-week",
|
|
517
|
+
standalone: true,
|
|
518
|
+
imports: [CommonModule, CalendarEventComponent],
|
|
519
|
+
providers: [CalendarEventLayoutService],
|
|
520
|
+
template: "<!-- Week grid. Hour rules are quiet hairlines; today's column header is a tinted\n number (no fill); the current time is a line carrying a small time bubble.\n Dynamic row/column placement stays inline — the layout maths lives in TS. -->\n<div [attr.aria-label]=\"weekViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid\" [style.grid-template-columns]=\"'60px ' + gridTemplateColumns\">\n <div></div>\n @for (col of columns; track col.dayName; let i = $index) {\n <div class=\"py-2 px-1 text-center\"\n [style.grid-column]=\"getHeaderColumn(i)\"\n role=\"columnheader\">\n <span class=\"block text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ col.dayName }}</span>\n <span class=\"text-lg font-bold tabular-nums\" [class.text-primary]=\"col.isToday\">{{ col.dayNumber }}</span>\n </div>\n }\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"gridTemplateColumns\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && currentTimeCol) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"currentTimeCol\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n"
|
|
521
|
+
}]
|
|
522
|
+
}],
|
|
523
|
+
ctorParameters: () => [],
|
|
524
|
+
propDecorators: {
|
|
525
|
+
focusDay: [{ type: Input }],
|
|
526
|
+
eventsChanged: [{ type: Input }],
|
|
527
|
+
focusDayChanged: [{ type: Input }],
|
|
528
|
+
config: [{ type: Input }],
|
|
529
|
+
calendarEventComponent: [{ type: Input }],
|
|
530
|
+
eventClicked: [{ type: Output }]
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
var CalendarDayComponent = class CalendarDayComponent {
|
|
534
|
+
lang = inject(MnLanguageService);
|
|
535
|
+
get dayViewLabel() {
|
|
536
|
+
return this.lang.translateIfPresent("mnCalendar.dayView") ?? "Day view";
|
|
537
|
+
}
|
|
538
|
+
layoutService = inject(CalendarEventLayoutService);
|
|
539
|
+
cdr = inject(ChangeDetectorRef);
|
|
540
|
+
focusDay;
|
|
541
|
+
eventsChanged;
|
|
542
|
+
focusDayChanged;
|
|
543
|
+
config;
|
|
544
|
+
calendarEventComponent;
|
|
545
|
+
eventClicked = new EventEmitter();
|
|
546
|
+
hourRows = [];
|
|
547
|
+
displayEvents = [];
|
|
548
|
+
totalRows = 0;
|
|
549
|
+
totalColumns = 1;
|
|
550
|
+
currentTimeRow = 0;
|
|
551
|
+
currentTimeLabel = "";
|
|
552
|
+
isToday = false;
|
|
553
|
+
dayName = "";
|
|
554
|
+
events = [];
|
|
555
|
+
destroy$ = new Subject();
|
|
556
|
+
formatter;
|
|
557
|
+
resolvedConfig;
|
|
558
|
+
currentTimeInterval;
|
|
559
|
+
constructor() {
|
|
560
|
+
this.formatter = new DefaultCalendarDateFormatter();
|
|
561
|
+
}
|
|
562
|
+
ngOnInit() {
|
|
563
|
+
this.resolvedConfig = this.config ? resolveCalendarConfig(this.config) : { ...DEFAULT_CALENDAR_CONFIG };
|
|
564
|
+
this.updateDayInfo();
|
|
565
|
+
this.updateCurrentTime();
|
|
566
|
+
this.currentTimeInterval = setInterval(() => this.updateCurrentTime(), 6e4);
|
|
567
|
+
if (this.eventsChanged) this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
568
|
+
this.events = events;
|
|
569
|
+
this.refreshEvents();
|
|
570
|
+
this.cdr.markForCheck();
|
|
571
|
+
});
|
|
572
|
+
if (this.focusDayChanged) this.focusDayChanged.pipe(takeUntil(this.destroy$)).subscribe((date) => {
|
|
573
|
+
this.focusDay = date;
|
|
574
|
+
this.updateDayInfo();
|
|
575
|
+
this.refreshEvents();
|
|
576
|
+
this.updateCurrentTime();
|
|
577
|
+
this.cdr.markForCheck();
|
|
578
|
+
});
|
|
579
|
+
this.buildHourRows().then(() => this.cdr.markForCheck());
|
|
580
|
+
}
|
|
581
|
+
ngOnDestroy() {
|
|
582
|
+
this.destroy$.next();
|
|
583
|
+
this.destroy$.complete();
|
|
584
|
+
if (this.currentTimeInterval) clearInterval(this.currentTimeInterval);
|
|
585
|
+
}
|
|
586
|
+
getEventRow(event) {
|
|
587
|
+
const startRow = CalendarUtility.getCorrectRow(event.startTime.getHours(), event.startTime.getMinutes(), this.resolvedConfig.startHour);
|
|
588
|
+
const endRow = CalendarUtility.getCorrectRow(event.endTime.getHours(), event.endTime.getMinutes(), this.resolvedConfig.startHour);
|
|
589
|
+
return `${startRow} / ${Math.max(endRow, startRow + 1)}`;
|
|
590
|
+
}
|
|
591
|
+
getEventColumn(event) {
|
|
592
|
+
return `${(event.column ?? 0) + 1} / span ${event.width ?? 1}`;
|
|
593
|
+
}
|
|
594
|
+
onEventClick(event) {
|
|
595
|
+
this.eventClicked.emit(event);
|
|
596
|
+
}
|
|
597
|
+
trackByHour(_index, row) {
|
|
598
|
+
return row.hour;
|
|
599
|
+
}
|
|
600
|
+
trackByEvent(_index, event) {
|
|
601
|
+
return event.id;
|
|
602
|
+
}
|
|
603
|
+
async buildHourRows() {
|
|
604
|
+
const hours = this.resolvedConfig.endHour - this.resolvedConfig.startHour;
|
|
605
|
+
this.totalRows = hours * 2;
|
|
606
|
+
const rows = [];
|
|
607
|
+
for (let i = 0; i < hours; i++) {
|
|
608
|
+
const hour = this.resolvedConfig.startHour + i;
|
|
609
|
+
const label = await this.formatter.formatTimeI(hour, 0);
|
|
610
|
+
rows.push({
|
|
611
|
+
hour,
|
|
612
|
+
topRow: i * 2 + 1,
|
|
613
|
+
bottomRow: i * 2 + 3,
|
|
614
|
+
hourLabel: label
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
this.hourRows = rows;
|
|
618
|
+
}
|
|
619
|
+
updateDayInfo() {
|
|
620
|
+
if (!this.focusDay) return;
|
|
621
|
+
const today = /* @__PURE__ */ new Date();
|
|
622
|
+
this.isToday = this.formatter.isSameDay(this.focusDay, today);
|
|
623
|
+
const longNames = this.resolvedConfig.longDayNames;
|
|
624
|
+
const dayIdx = this.focusDay.getDay();
|
|
625
|
+
const mondayIdx = dayIdx === 0 ? 6 : dayIdx - 1;
|
|
626
|
+
this.dayName = longNames[mondayIdx];
|
|
627
|
+
}
|
|
628
|
+
refreshEvents() {
|
|
629
|
+
if (!this.focusDay) return;
|
|
630
|
+
const rangeStart = new Date(this.focusDay);
|
|
631
|
+
rangeStart.setHours(0, 0, 0, 0);
|
|
632
|
+
const rangeEnd = new Date(this.focusDay);
|
|
633
|
+
rangeEnd.setHours(23, 59, 59, 999);
|
|
634
|
+
const filtered = this.events.filter((e) => this.layoutService.eventsOverlap(e.startTime, e.endTime, rangeStart, rangeEnd));
|
|
635
|
+
this.displayEvents = this.layoutService.calculateMultiDayEvents(filtered, this.resolvedConfig.startHour, this.resolvedConfig.endHour, rangeStart, rangeEnd);
|
|
636
|
+
this.layoutService.assignColumnsToEvents(this.displayEvents);
|
|
637
|
+
this.layoutService.assignWidthsToEvents(this.displayEvents, rangeStart, rangeEnd);
|
|
638
|
+
this.totalColumns = this.displayEvents.reduce((max, e) => Math.max(max, (e.column ?? 0) + (e.width ?? 1)), 1);
|
|
639
|
+
}
|
|
640
|
+
updateCurrentTime() {
|
|
641
|
+
const now = /* @__PURE__ */ new Date();
|
|
642
|
+
if (this.focusDay && this.formatter.isSameDay(this.focusDay, now)) {
|
|
643
|
+
this.currentTimeRow = CalendarUtility.getCorrectRow(now.getHours(), now.getMinutes(), this.resolvedConfig.startHour);
|
|
644
|
+
this.isToday = true;
|
|
645
|
+
this.formatter.formatTime(now).then((label) => {
|
|
646
|
+
this.currentTimeLabel = label;
|
|
647
|
+
this.cdr.markForCheck();
|
|
648
|
+
});
|
|
649
|
+
} else {
|
|
650
|
+
this.currentTimeRow = 0;
|
|
651
|
+
this.isToday = false;
|
|
652
|
+
this.currentTimeLabel = "";
|
|
653
|
+
}
|
|
654
|
+
this.cdr.markForCheck();
|
|
655
|
+
}
|
|
656
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
657
|
+
minVersion: "12.0.0",
|
|
658
|
+
version: "22.2.2",
|
|
659
|
+
ngImport: i0,
|
|
660
|
+
type: CalendarDayComponent,
|
|
661
|
+
deps: [],
|
|
662
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
663
|
+
});
|
|
664
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
665
|
+
minVersion: "17.0.0",
|
|
666
|
+
version: "22.2.2",
|
|
667
|
+
type: CalendarDayComponent,
|
|
668
|
+
isStandalone: true,
|
|
669
|
+
selector: "mn-calendar-day",
|
|
670
|
+
inputs: {
|
|
671
|
+
focusDay: "focusDay",
|
|
672
|
+
eventsChanged: "eventsChanged",
|
|
673
|
+
focusDayChanged: "focusDayChanged",
|
|
674
|
+
config: "config",
|
|
675
|
+
calendarEventComponent: "calendarEventComponent"
|
|
676
|
+
},
|
|
677
|
+
outputs: { eventClicked: "eventClicked" },
|
|
678
|
+
providers: [CalendarEventLayoutService],
|
|
679
|
+
ngImport: i0,
|
|
680
|
+
template: "<!-- Day grid. One column, its header centered over that column (the toolbar\n already names the date). Today's number is tinted, not filled; the now-line\n carries a time bubble that overhangs into the gutter. -->\n<div [attr.aria-label]=\"dayViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid grid-cols-[60px_1fr]\">\n <div></div>\n <div class=\"flex items-center justify-center gap-2 py-2 px-1\" role=\"columnheader\">\n <span class=\"text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ dayName }}</span>\n <span class=\"text-base font-bold tabular-nums\" [class.text-primary]=\"isToday\">{{ focusDay.getDate() }}</span>\n </div>\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"'repeat(' + totalColumns + ', 1fr)'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && isToday) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"'1 / -1'\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n",
|
|
681
|
+
dependencies: [{
|
|
682
|
+
kind: "ngmodule",
|
|
683
|
+
type: CommonModule
|
|
684
|
+
}, {
|
|
685
|
+
kind: "component",
|
|
686
|
+
type: CalendarEventComponent,
|
|
687
|
+
selector: "mn-calendar-event",
|
|
688
|
+
inputs: ["event", "customComponent"],
|
|
689
|
+
outputs: ["eventClicked"]
|
|
690
|
+
}]
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
694
|
+
minVersion: "12.0.0",
|
|
695
|
+
version: "22.2.2",
|
|
696
|
+
ngImport: i0,
|
|
697
|
+
type: CalendarDayComponent,
|
|
698
|
+
decorators: [{
|
|
699
|
+
type: Component,
|
|
700
|
+
args: [{
|
|
701
|
+
selector: "mn-calendar-day",
|
|
702
|
+
standalone: true,
|
|
703
|
+
imports: [CommonModule, CalendarEventComponent],
|
|
704
|
+
providers: [CalendarEventLayoutService],
|
|
705
|
+
template: "<!-- Day grid. One column, its header centered over that column (the toolbar\n already names the date). Today's number is tinted, not filled; the now-line\n carries a time bubble that overhangs into the gutter. -->\n<div [attr.aria-label]=\"dayViewLabel\" class=\"w-full h-full flex flex-col overflow-hidden\" role=\"grid\">\n <div class=\"grid grid-cols-[60px_1fr]\">\n <div></div>\n <div class=\"flex items-center justify-center gap-2 py-2 px-1\" role=\"columnheader\">\n <span class=\"text-[11px] font-semibold uppercase tracking-wide opacity-50\">{{ dayName }}</span>\n <span class=\"text-base font-bold tabular-nums\" [class.text-primary]=\"isToday\">{{ focusDay.getDate() }}</span>\n </div>\n </div>\n <div class=\"grid grid-cols-[60px_1fr] flex-1 min-h-0 overflow-hidden items-stretch\">\n <div class=\"grid h-full min-h-0\" [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"flex items-start justify-end min-h-0 overflow-hidden pr-2 text-[11px] tabular-nums opacity-50\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\">\n {{ row.hourLabel }}\n </div>\n }\n </div>\n <div class=\"grid relative auto-rows-fr h-full min-h-0\"\n [style.grid-template-rows]=\"'repeat(' + totalRows + ', minmax(1.5rem, 1fr))'\"\n [style.grid-template-columns]=\"'repeat(' + totalColumns + ', 1fr)'\">\n @for (row of hourRows; track row.topRow) {\n <div class=\"border-t border-base-200 pointer-events-none min-h-0\"\n [style.grid-row]=\"row.topRow + '/' + row.bottomRow\"\n [style.grid-column]=\"'1 / -1'\">\n </div>\n }\n @if (currentTimeRow > 0 && isToday) {\n <div class=\"relative z-[2] pointer-events-none\"\n [style.grid-row]=\"currentTimeRow\"\n [style.grid-column]=\"'1 / -1'\">\n <div class=\"absolute -left-1 -top-1 h-2 w-2 rounded-full bg-error\"></div>\n <div class=\"h-0.5 w-full bg-error\"></div>\n <div class=\"absolute left-0 top-0 -translate-x-2 -translate-y-1/2 rounded-full bg-error px-1.5 py-0.5 text-[10px] font-bold tabular-nums text-error-content shadow\">{{ currentTimeLabel }}</div>\n </div>\n }\n @for (event of displayEvents; track $index) {\n <div class=\"z-[1] min-h-0 overflow-hidden rounded-lg p-0.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary\"\n [style.grid-row]=\"getEventRow(event)\"\n [style.grid-column]=\"getEventColumn(event)\"\n (click)=\"onEventClick(event)\"\n (keyup.enter)=\"onEventClick(event)\"\n tabindex=\"0\">\n <mn-calendar-event [customComponent]=\"calendarEventComponent\" [event]=\"event\"></mn-calendar-event>\n </div>\n }\n </div>\n </div>\n</div>\n"
|
|
706
|
+
}]
|
|
707
|
+
}],
|
|
708
|
+
ctorParameters: () => [],
|
|
709
|
+
propDecorators: {
|
|
710
|
+
focusDay: [{ type: Input }],
|
|
711
|
+
eventsChanged: [{ type: Input }],
|
|
712
|
+
focusDayChanged: [{ type: Input }],
|
|
713
|
+
config: [{ type: Input }],
|
|
714
|
+
calendarEventComponent: [{ type: Input }],
|
|
715
|
+
eventClicked: [{ type: Output }]
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
var UpcomingEventRowComponent = class UpcomingEventRowComponent {
|
|
719
|
+
event;
|
|
720
|
+
eventClicked = new EventEmitter();
|
|
721
|
+
formattedDate = "";
|
|
722
|
+
formatter;
|
|
723
|
+
cdr = inject(ChangeDetectorRef);
|
|
724
|
+
constructor() {
|
|
725
|
+
const formatter = inject(CALENDAR_DATE_FORMATTER, { optional: true });
|
|
726
|
+
this.formatter = formatter ?? new DefaultCalendarDateFormatter();
|
|
727
|
+
}
|
|
728
|
+
async ngOnInit() {
|
|
729
|
+
if (this.event) {
|
|
730
|
+
const start = await this.formatter.formatTime(this.event.startTime);
|
|
731
|
+
const end = await this.formatter.formatTime(this.event.endTime);
|
|
732
|
+
this.formattedDate = `${start} - ${end}`;
|
|
733
|
+
this.cdr.markForCheck();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
737
|
+
minVersion: "12.0.0",
|
|
738
|
+
version: "22.2.2",
|
|
739
|
+
ngImport: i0,
|
|
740
|
+
type: UpcomingEventRowComponent,
|
|
741
|
+
deps: [],
|
|
742
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
743
|
+
});
|
|
744
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
745
|
+
minVersion: "17.0.0",
|
|
746
|
+
version: "22.2.2",
|
|
747
|
+
type: UpcomingEventRowComponent,
|
|
748
|
+
isStandalone: true,
|
|
749
|
+
selector: "mn-upcoming-event-row",
|
|
750
|
+
inputs: { event: "event" },
|
|
751
|
+
outputs: { eventClicked: "eventClicked" },
|
|
752
|
+
ngImport: i0,
|
|
753
|
+
template: "<!-- Sidebar row in the shared chip language: a colored rail from the event's own\n colour, a hover wash, and space-grouped content — no boxed borders. -->\n<div (click)=\"eventClicked.emit(event)\"\n (keyup.enter)=\"eventClicked.emit(event)\"\n class=\"grid grid-cols-[3px_1fr] items-stretch gap-2.5 mb-1.5 cursor-pointer rounded-lg p-2 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n tabindex=\"0\">\n <div class=\"rounded-full\" [style.background-color]=\"event.color.primaryColor\"></div>\n <div class=\"min-w-0\">\n <div class=\"line-clamp-2 break-words text-[13px] font-semibold\">{{ event.title }}</div>\n <div class=\"text-xs tabular-nums opacity-60\">{{ formattedDate }}</div>\n @if (event.description) {\n <div class=\"line-clamp-2 break-words text-xs opacity-50\">{{ event.description }}</div>\n }\n </div>\n</div>\n",
|
|
754
|
+
dependencies: [{
|
|
755
|
+
kind: "ngmodule",
|
|
756
|
+
type: CommonModule
|
|
757
|
+
}]
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
761
|
+
minVersion: "12.0.0",
|
|
762
|
+
version: "22.2.2",
|
|
763
|
+
ngImport: i0,
|
|
764
|
+
type: UpcomingEventRowComponent,
|
|
765
|
+
decorators: [{
|
|
766
|
+
type: Component,
|
|
767
|
+
args: [{
|
|
768
|
+
selector: "mn-upcoming-event-row",
|
|
769
|
+
standalone: true,
|
|
770
|
+
imports: [CommonModule],
|
|
771
|
+
template: "<!-- Sidebar row in the shared chip language: a colored rail from the event's own\n colour, a hover wash, and space-grouped content — no boxed borders. -->\n<div (click)=\"eventClicked.emit(event)\"\n (keyup.enter)=\"eventClicked.emit(event)\"\n class=\"grid grid-cols-[3px_1fr] items-stretch gap-2.5 mb-1.5 cursor-pointer rounded-lg p-2 transition-colors hover:bg-base-200 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-primary motion-reduce:transition-none\"\n tabindex=\"0\">\n <div class=\"rounded-full\" [style.background-color]=\"event.color.primaryColor\"></div>\n <div class=\"min-w-0\">\n <div class=\"line-clamp-2 break-words text-[13px] font-semibold\">{{ event.title }}</div>\n <div class=\"text-xs tabular-nums opacity-60\">{{ formattedDate }}</div>\n @if (event.description) {\n <div class=\"line-clamp-2 break-words text-xs opacity-50\">{{ event.description }}</div>\n }\n </div>\n</div>\n"
|
|
772
|
+
}]
|
|
773
|
+
}],
|
|
774
|
+
ctorParameters: () => [],
|
|
775
|
+
propDecorators: {
|
|
776
|
+
event: [{ type: Input }],
|
|
777
|
+
eventClicked: [{ type: Output }]
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
var UpcomingEventsComponent = class UpcomingEventsComponent {
|
|
781
|
+
lang = inject(MnLanguageService);
|
|
782
|
+
cdr = inject(ChangeDetectorRef);
|
|
783
|
+
get upcomingEventsLabel() {
|
|
784
|
+
return this.lang.translateIfPresent("mnCalendar.upcomingEvents") ?? "Upcoming events";
|
|
785
|
+
}
|
|
786
|
+
eventsChanged;
|
|
787
|
+
config;
|
|
788
|
+
eventClicked = new EventEmitter();
|
|
789
|
+
upcomingEvents = [];
|
|
790
|
+
title;
|
|
791
|
+
noEventsMessage;
|
|
792
|
+
destroy$ = new Subject();
|
|
793
|
+
constructor() {
|
|
794
|
+
this.title = DEFAULT_CALENDAR_CONFIG.upcomingEventsTitle;
|
|
795
|
+
this.noEventsMessage = DEFAULT_CALENDAR_CONFIG.noUpcomingEvents;
|
|
796
|
+
}
|
|
797
|
+
ngOnChanges(changes) {
|
|
798
|
+
if (changes["config"] && this.config) {
|
|
799
|
+
const resolved = resolveCalendarConfig(this.config);
|
|
800
|
+
this.title = resolved.upcomingEventsTitle;
|
|
801
|
+
this.noEventsMessage = resolved.noUpcomingEvents;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
ngOnInit() {
|
|
805
|
+
const resolved = this.config ? resolveCalendarConfig(this.config) : { ...DEFAULT_CALENDAR_CONFIG };
|
|
806
|
+
this.title = resolved.upcomingEventsTitle;
|
|
807
|
+
this.noEventsMessage = resolved.noUpcomingEvents;
|
|
808
|
+
if (this.eventsChanged) this.eventsChanged.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
809
|
+
const now = /* @__PURE__ */ new Date();
|
|
810
|
+
this.upcomingEvents = events.filter((e) => e.endTime > now).sort((a, b) => a.startTime.getTime() - b.startTime.getTime()).slice(0, 10);
|
|
811
|
+
this.cdr.markForCheck();
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
ngOnDestroy() {
|
|
815
|
+
this.destroy$.next();
|
|
816
|
+
this.destroy$.complete();
|
|
817
|
+
}
|
|
818
|
+
trackByEvent(_index, event) {
|
|
819
|
+
return event.id;
|
|
820
|
+
}
|
|
821
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
822
|
+
minVersion: "12.0.0",
|
|
823
|
+
version: "22.2.2",
|
|
824
|
+
ngImport: i0,
|
|
825
|
+
type: UpcomingEventsComponent,
|
|
826
|
+
deps: [],
|
|
827
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
828
|
+
});
|
|
829
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
830
|
+
minVersion: "17.0.0",
|
|
831
|
+
version: "22.2.2",
|
|
832
|
+
type: UpcomingEventsComponent,
|
|
833
|
+
isStandalone: true,
|
|
834
|
+
selector: "mn-upcoming-events",
|
|
835
|
+
inputs: {
|
|
836
|
+
eventsChanged: "eventsChanged",
|
|
837
|
+
config: "config"
|
|
838
|
+
},
|
|
839
|
+
outputs: { eventClicked: "eventClicked" },
|
|
840
|
+
usesOnChanges: true,
|
|
841
|
+
ngImport: i0,
|
|
842
|
+
template: "<div [attr.aria-label]=\"upcomingEventsLabel\" class=\"p-4\" role=\"complementary\">\n <div class=\"mb-3 flex items-center gap-2\">\n <h3 class=\"text-sm font-bold tracking-wide\">{{ title }}</h3>\n @if (upcomingEvents.length) {\n <span mnBadge [data]=\"{ size: 'sm', color: 'accent', variant: 'fill' }\" class=\"tabular-nums\">{{ upcomingEvents.length }}</span>\n }\n </div>\n @for (event of upcomingEvents; track $index) {\n <mn-upcoming-event-row\n [event]=\"event\"\n (eventClicked)=\"eventClicked.emit($event)\">\n </mn-upcoming-event-row>\n }\n @if (upcomingEvents.length === 0) {\n <div class=\"text-sm opacity-50\">{{ noEventsMessage }}</div>\n }\n</div>\n",
|
|
843
|
+
dependencies: [
|
|
844
|
+
{
|
|
845
|
+
kind: "ngmodule",
|
|
846
|
+
type: CommonModule
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
kind: "component",
|
|
850
|
+
type: UpcomingEventRowComponent,
|
|
851
|
+
selector: "mn-upcoming-event-row",
|
|
852
|
+
inputs: ["event"],
|
|
853
|
+
outputs: ["eventClicked"]
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
kind: "component",
|
|
857
|
+
type: MnBadge,
|
|
858
|
+
selector: "span[mnBadge]",
|
|
859
|
+
inputs: ["data"]
|
|
860
|
+
}
|
|
861
|
+
]
|
|
862
|
+
});
|
|
863
|
+
};
|
|
864
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
865
|
+
minVersion: "12.0.0",
|
|
866
|
+
version: "22.2.2",
|
|
867
|
+
ngImport: i0,
|
|
868
|
+
type: UpcomingEventsComponent,
|
|
869
|
+
decorators: [{
|
|
870
|
+
type: Component,
|
|
871
|
+
args: [{
|
|
872
|
+
selector: "mn-upcoming-events",
|
|
873
|
+
standalone: true,
|
|
874
|
+
imports: [
|
|
875
|
+
CommonModule,
|
|
876
|
+
UpcomingEventRowComponent,
|
|
877
|
+
MnBadge
|
|
878
|
+
],
|
|
879
|
+
template: "<div [attr.aria-label]=\"upcomingEventsLabel\" class=\"p-4\" role=\"complementary\">\n <div class=\"mb-3 flex items-center gap-2\">\n <h3 class=\"text-sm font-bold tracking-wide\">{{ title }}</h3>\n @if (upcomingEvents.length) {\n <span mnBadge [data]=\"{ size: 'sm', color: 'accent', variant: 'fill' }\" class=\"tabular-nums\">{{ upcomingEvents.length }}</span>\n }\n </div>\n @for (event of upcomingEvents; track $index) {\n <mn-upcoming-event-row\n [event]=\"event\"\n (eventClicked)=\"eventClicked.emit($event)\">\n </mn-upcoming-event-row>\n }\n @if (upcomingEvents.length === 0) {\n <div class=\"text-sm opacity-50\">{{ noEventsMessage }}</div>\n }\n</div>\n"
|
|
880
|
+
}]
|
|
881
|
+
}],
|
|
882
|
+
ctorParameters: () => [],
|
|
883
|
+
propDecorators: {
|
|
884
|
+
eventsChanged: [{ type: Input }],
|
|
885
|
+
config: [{ type: Input }],
|
|
886
|
+
eventClicked: [{ type: Output }]
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
const ICONS$1 = lucideIcons({
|
|
890
|
+
ChevronLeft: lucide.ChevronLeft,
|
|
891
|
+
ChevronRight: lucide.ChevronRight
|
|
892
|
+
});
|
|
804
893
|
let instanceCounter$1 = 0;
|
|
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
|
-
|
|
894
|
+
var CalendarViewComponent = class CalendarViewComponent {
|
|
895
|
+
icons = ICONS$1;
|
|
896
|
+
get calendarViewLabel() {
|
|
897
|
+
return this.lang.translateIfPresent("mnCalendar.calendarView") ?? "Calendar view";
|
|
898
|
+
}
|
|
899
|
+
showButton = false;
|
|
900
|
+
buttonTitle = "";
|
|
901
|
+
buttons = [];
|
|
902
|
+
CalendarEventComponent;
|
|
903
|
+
NewCalendarItemsEvent;
|
|
904
|
+
RequestNewCalendarItemsEvent = new EventEmitter();
|
|
905
|
+
CalendarItemClickedEvent = new EventEmitter();
|
|
906
|
+
ButtonClickedEvent = new EventEmitter();
|
|
907
|
+
CalendarView = CalendarView;
|
|
908
|
+
panelId = `mn-calendar-panel-${++instanceCounter$1}`;
|
|
909
|
+
currentView = CalendarView.WEEK;
|
|
910
|
+
focusDay = /* @__PURE__ */ new Date();
|
|
911
|
+
viewOptions = [];
|
|
912
|
+
isMobileView = false;
|
|
913
|
+
internalEventsChanged = new BehaviorSubject([]);
|
|
914
|
+
internalFocusDayChanged = new Subject();
|
|
915
|
+
destroy$ = new Subject();
|
|
916
|
+
config;
|
|
917
|
+
mnConfigRef;
|
|
918
|
+
destroyRef = inject(DestroyRef);
|
|
919
|
+
lang = inject(MnLanguageService);
|
|
920
|
+
cdr = inject(ChangeDetectorRef);
|
|
921
|
+
constructor() {
|
|
922
|
+
const mnConfig = inject(MN_CALENDAR_CONFIG, { optional: true });
|
|
923
|
+
const legacyConfig = inject(CALENDAR_CONFIG, { optional: true });
|
|
924
|
+
this.mnConfigRef = mnConfig;
|
|
925
|
+
const raw = mnConfig ?? legacyConfig ?? void 0;
|
|
926
|
+
this.config = resolveCalendarConfig(raw);
|
|
927
|
+
}
|
|
928
|
+
onResize() {
|
|
929
|
+
this.checkMobileView();
|
|
930
|
+
}
|
|
931
|
+
ngOnInit() {
|
|
932
|
+
this.rebuildFromConfig();
|
|
933
|
+
const sub = this.lang.locale$.pipe(skip(1)).subscribe(() => {
|
|
934
|
+
this.rebuildFromConfig();
|
|
935
|
+
this.cdr.markForCheck();
|
|
936
|
+
});
|
|
937
|
+
this.destroyRef.onDestroy(() => sub.unsubscribe());
|
|
938
|
+
this.checkMobileView();
|
|
939
|
+
this.RequestNewCalendarItemsEvent.emit(this.focusDay);
|
|
940
|
+
if (this.NewCalendarItemsEvent) this.NewCalendarItemsEvent.pipe(takeUntil(this.destroy$)).subscribe((events) => {
|
|
941
|
+
this.internalEventsChanged.next(events);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
ngOnDestroy() {
|
|
945
|
+
this.destroy$.next();
|
|
946
|
+
this.destroy$.complete();
|
|
947
|
+
}
|
|
948
|
+
switchView(view) {
|
|
949
|
+
if (this.isMobileView) {
|
|
950
|
+
this.currentView = CalendarView.DAY;
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
this.currentView = view;
|
|
954
|
+
}
|
|
955
|
+
get periodLabel() {
|
|
956
|
+
const locale = this.config.locale;
|
|
957
|
+
if (this.currentView === CalendarView.MONTH) return this.focusDay.toLocaleDateString(locale, {
|
|
958
|
+
month: "long",
|
|
959
|
+
year: "numeric"
|
|
960
|
+
});
|
|
961
|
+
if (this.currentView === CalendarView.DAY) return this.focusDay.toLocaleDateString(locale, {
|
|
962
|
+
day: "numeric",
|
|
963
|
+
month: "long",
|
|
964
|
+
...this.focusDay.getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear() ? { year: "numeric" } : {}
|
|
965
|
+
});
|
|
966
|
+
const start = this.startOfWeek(this.focusDay);
|
|
967
|
+
const end = new Date(start);
|
|
968
|
+
end.setDate(end.getDate() + 6);
|
|
969
|
+
return `${start.getFullYear() !== end.getFullYear() ? start.toLocaleDateString(locale, {
|
|
970
|
+
day: "numeric",
|
|
971
|
+
month: "short",
|
|
972
|
+
year: "numeric"
|
|
973
|
+
}) : start.toLocaleDateString(locale, {
|
|
974
|
+
day: "numeric",
|
|
975
|
+
...start.getMonth() !== end.getMonth() ? { month: "short" } : {}
|
|
976
|
+
})} – ${end.toLocaleDateString(locale, {
|
|
977
|
+
day: "numeric",
|
|
978
|
+
month: "short",
|
|
979
|
+
year: "numeric"
|
|
980
|
+
})}`;
|
|
981
|
+
}
|
|
982
|
+
get focusDayString() {
|
|
983
|
+
const pad = (n) => n.toString().padStart(2, "0");
|
|
984
|
+
const d = this.focusDay;
|
|
985
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
986
|
+
}
|
|
987
|
+
navigate(step) {
|
|
988
|
+
const next = new Date(this.focusDay);
|
|
989
|
+
switch (this.currentView) {
|
|
990
|
+
case CalendarView.DAY:
|
|
991
|
+
next.setDate(next.getDate() + step);
|
|
992
|
+
break;
|
|
993
|
+
case CalendarView.WEEK:
|
|
994
|
+
next.setDate(next.getDate() + step * 7);
|
|
995
|
+
break;
|
|
996
|
+
default:
|
|
997
|
+
this.setFocusDay(this.addMonths(this.focusDay, step));
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
this.setFocusDay(next);
|
|
1001
|
+
}
|
|
1002
|
+
goToToday() {
|
|
1003
|
+
this.setFocusDay(/* @__PURE__ */ new Date());
|
|
1004
|
+
}
|
|
1005
|
+
onPickDate(value) {
|
|
1006
|
+
if (!value) return;
|
|
1007
|
+
const picked = /* @__PURE__ */ new Date(value + "T00:00:00");
|
|
1008
|
+
if (isNaN(picked.getTime())) return;
|
|
1009
|
+
this.setFocusDay(picked);
|
|
1010
|
+
}
|
|
1011
|
+
onMonthDayClick(date) {
|
|
1012
|
+
this.currentView = CalendarView.DAY;
|
|
1013
|
+
this.setFocusDay(date);
|
|
1014
|
+
}
|
|
1015
|
+
onEventClick(event) {
|
|
1016
|
+
this.CalendarItemClickedEvent.emit(event);
|
|
1017
|
+
}
|
|
1018
|
+
trackByView(_index, item) {
|
|
1019
|
+
return item.value;
|
|
1020
|
+
}
|
|
1021
|
+
rebuildFromConfig() {
|
|
1022
|
+
if (this.mnConfigRef) this.config = resolveCalendarConfig(this.mnConfigRef);
|
|
1023
|
+
this.viewOptions = [
|
|
1024
|
+
{
|
|
1025
|
+
value: CalendarView.MONTH,
|
|
1026
|
+
label: this.config.viewLabels["MONTH"] ?? "Month"
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
value: CalendarView.WEEK,
|
|
1030
|
+
label: this.config.viewLabels["WEEK"] ?? "Week"
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
value: CalendarView.DAY,
|
|
1034
|
+
label: this.config.viewLabels["DAY"] ?? "Day"
|
|
1035
|
+
}
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
checkMobileView() {
|
|
1039
|
+
const wasMobile = this.isMobileView;
|
|
1040
|
+
const width = window.innerWidth;
|
|
1041
|
+
const breakpoint = this.config.mobileBreakpoint;
|
|
1042
|
+
this.isMobileView = width < breakpoint;
|
|
1043
|
+
if (this.isMobileView && !wasMobile) this.currentView = CalendarView.DAY;
|
|
1044
|
+
}
|
|
1045
|
+
addMonths(date, months) {
|
|
1046
|
+
const day = date.getDate();
|
|
1047
|
+
const shifted = new Date(date);
|
|
1048
|
+
shifted.setDate(1);
|
|
1049
|
+
shifted.setMonth(shifted.getMonth() + months);
|
|
1050
|
+
const lastDayOfMonth = new Date(shifted.getFullYear(), shifted.getMonth() + 1, 0).getDate();
|
|
1051
|
+
shifted.setDate(Math.min(day, lastDayOfMonth));
|
|
1052
|
+
return shifted;
|
|
1053
|
+
}
|
|
1054
|
+
startOfWeek(date) {
|
|
1055
|
+
const start = new Date(date);
|
|
1056
|
+
start.setHours(0, 0, 0, 0);
|
|
1057
|
+
start.setDate(start.getDate() - (start.getDay() + 6) % 7);
|
|
1058
|
+
return start;
|
|
1059
|
+
}
|
|
1060
|
+
setFocusDay(date) {
|
|
1061
|
+
this.focusDay = date;
|
|
1062
|
+
this.internalFocusDayChanged.next(date);
|
|
1063
|
+
this.RequestNewCalendarItemsEvent.emit(date);
|
|
1064
|
+
}
|
|
1065
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1066
|
+
minVersion: "12.0.0",
|
|
1067
|
+
version: "22.2.2",
|
|
1068
|
+
ngImport: i0,
|
|
1069
|
+
type: CalendarViewComponent,
|
|
1070
|
+
deps: [],
|
|
1071
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1072
|
+
});
|
|
1073
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1074
|
+
minVersion: "17.0.0",
|
|
1075
|
+
version: "22.2.2",
|
|
1076
|
+
type: CalendarViewComponent,
|
|
1077
|
+
isStandalone: true,
|
|
1078
|
+
selector: "mn-calendar-view",
|
|
1079
|
+
inputs: {
|
|
1080
|
+
showButton: "showButton",
|
|
1081
|
+
buttonTitle: "buttonTitle",
|
|
1082
|
+
buttons: "buttons",
|
|
1083
|
+
CalendarEventComponent: "CalendarEventComponent",
|
|
1084
|
+
NewCalendarItemsEvent: "NewCalendarItemsEvent"
|
|
1085
|
+
},
|
|
1086
|
+
outputs: {
|
|
1087
|
+
RequestNewCalendarItemsEvent: "RequestNewCalendarItemsEvent",
|
|
1088
|
+
CalendarItemClickedEvent: "CalendarItemClickedEvent",
|
|
1089
|
+
ButtonClickedEvent: "ButtonClickedEvent"
|
|
1090
|
+
},
|
|
1091
|
+
host: { listeners: { "window:resize": "onResize()" } },
|
|
1092
|
+
providers: [provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG)],
|
|
1093
|
+
ngImport: i0,
|
|
1094
|
+
template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the ‹ date › nav centred on its own row beneath — the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls — icon-only\n picker, hidden view-switcher, forced day view — not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) — a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width — and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) — hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n",
|
|
1095
|
+
styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"],
|
|
1096
|
+
dependencies: [
|
|
1097
|
+
{
|
|
1098
|
+
kind: "ngmodule",
|
|
1099
|
+
type: CommonModule
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
kind: "ngmodule",
|
|
1103
|
+
type: FormsModule
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
kind: "directive",
|
|
1107
|
+
type: i1.NgControlStatus,
|
|
1108
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
kind: "directive",
|
|
1112
|
+
type: i1.NgModel,
|
|
1113
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
1114
|
+
inputs: [
|
|
1115
|
+
"name",
|
|
1116
|
+
"disabled",
|
|
1117
|
+
"ngModel",
|
|
1118
|
+
"ngModelOptions"
|
|
1119
|
+
],
|
|
1120
|
+
outputs: ["ngModelChange"],
|
|
1121
|
+
exportAs: ["ngModel"]
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
kind: "component",
|
|
1125
|
+
type: CalendarMonthComponent,
|
|
1126
|
+
selector: "mn-calendar-month",
|
|
1127
|
+
inputs: [
|
|
1128
|
+
"focusDay",
|
|
1129
|
+
"eventsChanged",
|
|
1130
|
+
"focusDayChanged",
|
|
1131
|
+
"config"
|
|
1132
|
+
],
|
|
1133
|
+
outputs: ["dayClicked"]
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
kind: "component",
|
|
1137
|
+
type: CalendarWeekComponent,
|
|
1138
|
+
selector: "mn-calendar-week",
|
|
1139
|
+
inputs: [
|
|
1140
|
+
"focusDay",
|
|
1141
|
+
"eventsChanged",
|
|
1142
|
+
"focusDayChanged",
|
|
1143
|
+
"config",
|
|
1144
|
+
"calendarEventComponent"
|
|
1145
|
+
],
|
|
1146
|
+
outputs: ["eventClicked"]
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
kind: "component",
|
|
1150
|
+
type: CalendarDayComponent,
|
|
1151
|
+
selector: "mn-calendar-day",
|
|
1152
|
+
inputs: [
|
|
1153
|
+
"focusDay",
|
|
1154
|
+
"eventsChanged",
|
|
1155
|
+
"focusDayChanged",
|
|
1156
|
+
"config",
|
|
1157
|
+
"calendarEventComponent"
|
|
1158
|
+
],
|
|
1159
|
+
outputs: ["eventClicked"]
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
kind: "component",
|
|
1163
|
+
type: UpcomingEventsComponent,
|
|
1164
|
+
selector: "mn-upcoming-events",
|
|
1165
|
+
inputs: ["eventsChanged", "config"],
|
|
1166
|
+
outputs: ["eventClicked"]
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
kind: "component",
|
|
1170
|
+
type: MnButton,
|
|
1171
|
+
selector: "button[mnButton], a[mnButton]",
|
|
1172
|
+
inputs: ["data"]
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
kind: "component",
|
|
1176
|
+
type: MnDatetime,
|
|
1177
|
+
selector: "mn-lib-datetime",
|
|
1178
|
+
inputs: ["props"]
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
kind: "component",
|
|
1182
|
+
type: LucideDynamicIcon,
|
|
1183
|
+
selector: "svg[lucideIcon]",
|
|
1184
|
+
inputs: ["lucideIcon"]
|
|
1185
|
+
}
|
|
1186
|
+
]
|
|
1187
|
+
});
|
|
1188
|
+
};
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1190
|
+
minVersion: "12.0.0",
|
|
1191
|
+
version: "22.2.2",
|
|
1192
|
+
ngImport: i0,
|
|
1193
|
+
type: CalendarViewComponent,
|
|
1194
|
+
decorators: [{
|
|
1195
|
+
type: Component,
|
|
1196
|
+
args: [{
|
|
1197
|
+
selector: "mn-calendar-view",
|
|
1198
|
+
standalone: true,
|
|
1199
|
+
imports: [
|
|
1200
|
+
CommonModule,
|
|
1201
|
+
FormsModule,
|
|
1202
|
+
CalendarMonthComponent,
|
|
1203
|
+
CalendarWeekComponent,
|
|
1204
|
+
CalendarDayComponent,
|
|
1205
|
+
UpcomingEventsComponent,
|
|
1206
|
+
MnButton,
|
|
1207
|
+
MnDatetime,
|
|
1208
|
+
LucideDynamicIcon
|
|
1209
|
+
],
|
|
1210
|
+
providers: [provideMnCalendarConfig(DEFAULT_CALENDAR_CONFIG)],
|
|
1211
|
+
template: "<div class=\"w-full h-full flex flex-col\" role=\"application\" aria-label=\"Calendar\">\n\n <!-- Toolbar has one layout below the desktop (`lg`) width and one at it. Below\n `lg`: a controls row (Today anchored left, the right-hand cluster anchored\n right) with the ‹ date › nav centred on its own row beneath — the same\n shape from phone through tablet, so nothing wraps into a lopsided diagonal.\n At `lg`, where the upcoming-events sidebar also appears, the nav folds up\n inline after Today and the whole toolbar becomes a single row. The one JS\n breakpoint (`mobileBreakpoint`) governs the phone controls — icon-only\n picker, hidden view-switcher, forced day view — not the toolbar's shape. -->\n <div class=\"flex flex-wrap items-center gap-x-3 gap-y-2 py-3\">\n\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', size: 'md', color: 'primary' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ config.todayLabel }}\n </button>\n\n <!-- Stepping through time. The arrows sit either side of the date they move,\n so the control and the thing it controls read as one unit. Below `lg` it\n sits centred on its own row (basis-full, ordered last) — a period header\n above the grid, tight rather than flinging the arrows to the row's edges.\n At `lg` it folds inline right after Today, taking a stable min-width so\n the arrows don't jitter as the label's length changes. -->\n <div class=\"flex basis-full order-last justify-center items-center gap-1\n lg:basis-auto lg:order-none lg:justify-start\">\n <button (click)=\"navigate(-1)\"\n [attr.aria-label]=\"config.previousLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <h2 aria-live=\"polite\"\n class=\"text-center text-base font-semibold whitespace-nowrap px-1 lg:min-w-56\">\n {{ periodLabel }}\n </h2>\n\n <button (click)=\"navigate(1)\"\n [attr.aria-label]=\"config.nextLabel\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n\n <!-- Right-hand controls travel together as one cluster with `ml-auto`, so they\n hold to the right of the row on every width — and when space runs short the\n whole group wraps to a new line as a unit rather than stranding a lone\n button. On desktop the cluster lands above the upcoming-events sidebar,\n using that otherwise-empty space. -->\n <div class=\"ml-auto flex items-center gap-2\">\n <!-- On mobile the picker collapses to its icon-only variant. -->\n <mn-lib-datetime (ngModelChange)=\"onPickDate($event)\"\n [ngModel]=\"focusDayString\"\n [props]=\"{ id: panelId + '-date', mode: 'date', placeholder: config.pickDateLabel, size: 'md', borderRadius: 'lg', hover: true, iconOnly: isMobileView }\"\n class=\"block\"></mn-lib-datetime>\n\n <!-- View switcher (month / week / day) — hidden on mobile, which is forced to day view. -->\n @if (!isMobileView) {\n <div [attr.aria-label]=\"calendarViewLabel\" class=\"flex border border-base-300 rounded-md overflow-hidden\"\n role=\"tablist\">\n @for (view of viewOptions; track view.value) {\n <button\n (click)=\"switchView(view.value)\"\n [attr.aria-controls]=\"panelId\"\n [attr.aria-selected]=\"currentView === view.value\"\n [data]=\"{ size: 'md', variant: currentView === view.value ? 'fill' : 'text', color: 'primary' }\"\n mnButton\n role=\"tab\"\n type=\"button\">\n {{ view.label }}\n </button>\n }\n </div>\n }\n\n <!-- Action buttons (custom buttons + optional showButton CTA). -->\n @if (buttons.length || showButton) {\n @for (btn of buttons; track btn.label) {\n <button (click)=\"btn.onClick()\" [data]=\"btn.buttonData || {}\" mnButton type=\"button\">\n {{ btn.label }}\n </button>\n }\n @if (showButton) {\n <button (click)=\"ButtonClickedEvent.emit()\" [data]=\"{}\" mnButton type=\"button\">\n {{ buttonTitle }}\n </button>\n }\n }\n </div>\n\n </div>\n\n <div class=\"grid grid-cols-1 lg:grid-cols-[1fr_220px] gap-3 flex-1 min-h-0\">\n <div [id]=\"panelId\" class=\"min-w-0 min-h-0 overflow-hidden overflow-y-auto\" role=\"tabpanel\">\n @if (currentView === CalendarView.MONTH) {\n <mn-calendar-month\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n (dayClicked)=\"onMonthDayClick($event)\">\n </mn-calendar-month>\n }\n @if (currentView === CalendarView.WEEK) {\n <mn-calendar-week\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-week>\n }\n @if (currentView === CalendarView.DAY) {\n <mn-calendar-day\n [focusDay]=\"focusDay\"\n [eventsChanged]=\"internalEventsChanged\"\n [focusDayChanged]=\"internalFocusDayChanged\"\n [config]=\"config\"\n [calendarEventComponent]=\"CalendarEventComponent\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-calendar-day>\n }\n </div>\n <div class=\"hidden lg:block border-l border-base-300 overflow-auto\">\n <mn-upcoming-events\n [eventsChanged]=\"internalEventsChanged\"\n [config]=\"config\"\n (eventClicked)=\"onEventClick($event)\">\n </mn-upcoming-events>\n </div>\n </div>\n\n</div>\n",
|
|
1212
|
+
styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}\n"]
|
|
1213
|
+
}]
|
|
1214
|
+
}],
|
|
1215
|
+
ctorParameters: () => [],
|
|
1216
|
+
propDecorators: {
|
|
1217
|
+
showButton: [{ type: Input }],
|
|
1218
|
+
buttonTitle: [{ type: Input }],
|
|
1219
|
+
buttons: [{ type: Input }],
|
|
1220
|
+
CalendarEventComponent: [{ type: Input }],
|
|
1221
|
+
NewCalendarItemsEvent: [{ type: Input }],
|
|
1222
|
+
RequestNewCalendarItemsEvent: [{ type: Output }],
|
|
1223
|
+
CalendarItemClickedEvent: [{ type: Output }],
|
|
1224
|
+
ButtonClickedEvent: [{ type: Output }],
|
|
1225
|
+
onResize: [{
|
|
1226
|
+
type: HostListener,
|
|
1227
|
+
args: ["window:resize"]
|
|
1228
|
+
}]
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
const ICONS = lucideIcons({
|
|
1232
|
+
ChevronLeft: lucide.ChevronLeft,
|
|
1233
|
+
ChevronRight: lucide.ChevronRight
|
|
1234
|
+
});
|
|
1092
1235
|
const DAYS_IN_WEEK = 7;
|
|
1093
|
-
/** Fewest days worth showing before the picker takes over instead. */
|
|
1094
1236
|
const MIN_TILE_COUNT = 3;
|
|
1095
|
-
/** `Date.getDay()` value for Monday. */
|
|
1096
1237
|
const MONDAY = 1;
|
|
1097
|
-
/**
|
|
1098
|
-
* Width one day occupies. Days are sized by their content: a three-letter weekday
|
|
1099
|
-
* and a two-digit number at their set sizes measure about 72px including padding,
|
|
1100
|
-
* plus the `gap-1` beside it. Rounded up, because coming in under the real width
|
|
1101
|
-
* overflows the strip into the arrow beside it.
|
|
1102
|
-
*/
|
|
1103
1238
|
const TILE_SLOT_WIDTH = 80;
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1106
|
-
/**
|
|
1107
|
-
* Space the Today button claims, including the bar's own horizontal padding and
|
|
1108
|
-
* the gap beside it.
|
|
1109
|
-
*/
|
|
1110
|
-
const CONTROLS_ZONE_WIDTH = 150;
|
|
1111
|
-
/**
|
|
1112
|
-
* Everything on the controls row that isn't a day tile. The month is a full-width
|
|
1113
|
-
* header on its own line now, so it no longer competes with the days for room —
|
|
1114
|
-
* which is why more of them fit at a given width than they used to.
|
|
1115
|
-
*/
|
|
1116
|
-
const RESERVED_WIDTH = ARROWS_ZONE_WIDTH + CONTROLS_ZONE_WIDTH;
|
|
1117
|
-
/** Below this the strip can't hold even {@link MIN_TILE_COUNT} days. */
|
|
1118
|
-
const COMPACT_MAX_WIDTH = MIN_TILE_COUNT * TILE_SLOT_WIDTH + RESERVED_WIDTH;
|
|
1119
|
-
/** Assumed width before the first measurement (and during server-side rendering). */
|
|
1239
|
+
const RESERVED_WIDTH = 238;
|
|
1240
|
+
const COMPACT_MAX_WIDTH = 478;
|
|
1120
1241
|
const UNMEASURED_WIDTH = 960;
|
|
1121
|
-
/** Counter used to give each bar instance a unique date-picker id. */
|
|
1122
1242
|
let instanceCounter = 0;
|
|
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
|
-
|
|
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
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1243
|
+
var MnDateSelectorBar = class MnDateSelectorBar {
|
|
1244
|
+
icons = ICONS;
|
|
1245
|
+
selectedDate = input(this.getToday(), ...ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []);
|
|
1246
|
+
todayLabel = input("Today", ...ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []);
|
|
1247
|
+
pickDateLabel = input("Pick a date", ...ngDevMode ? [{ debugName: "pickDateLabel" }] : /* istanbul ignore next */ []);
|
|
1248
|
+
previousLabel = input("Show the previous week", ...ngDevMode ? [{ debugName: "previousLabel" }] : /* istanbul ignore next */ []);
|
|
1249
|
+
nextLabel = input("Show the next week", ...ngDevMode ? [{ debugName: "nextLabel" }] : /* istanbul ignore next */ []);
|
|
1250
|
+
dayStripLabel = input("Select a day", ...ngDevMode ? [{ debugName: "dayStripLabel" }] : /* istanbul ignore next */ []);
|
|
1251
|
+
locale = input("", ...ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
1252
|
+
dateSelected = output();
|
|
1253
|
+
pickerId = `mn-dsb-date-${++instanceCounter}`;
|
|
1254
|
+
destroyRef = inject(DestroyRef);
|
|
1255
|
+
injector = inject(Injector);
|
|
1256
|
+
host = inject(ElementRef);
|
|
1257
|
+
lang = inject(MnLanguageService);
|
|
1258
|
+
tileButtons = viewChildren("tileButton", ...ngDevMode ? [{ debugName: "tileButtons" }] : /* istanbul ignore next */ []);
|
|
1259
|
+
containerWidth = signal(0, ...ngDevMode ? [{ debugName: "containerWidth" }] : /* istanbul ignore next */ []);
|
|
1260
|
+
localeTick = signal(0, ...ngDevMode ? [{ debugName: "localeTick" }] : /* istanbul ignore next */ []);
|
|
1261
|
+
layout = computed(() => (this.containerWidth() || UNMEASURED_WIDTH) >= COMPACT_MAX_WIDTH ? "inline" : "compact", ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
1262
|
+
showDayStrip = computed(() => this.layout() === "inline", ...ngDevMode ? [{ debugName: "showDayStrip" }] : /* istanbul ignore next */ []);
|
|
1263
|
+
tileCount = computed(() => {
|
|
1264
|
+
if (!this.showDayStrip()) return 0;
|
|
1265
|
+
const width = this.containerWidth() || UNMEASURED_WIDTH;
|
|
1266
|
+
const fits = Math.floor((width - RESERVED_WIDTH) / TILE_SLOT_WIDTH);
|
|
1267
|
+
return Math.min(DAYS_IN_WEEK, Math.max(MIN_TILE_COUNT, fits));
|
|
1268
|
+
}, ...ngDevMode ? [{ debugName: "tileCount" }] : /* istanbul ignore next */ []);
|
|
1269
|
+
effectiveLocale = computed(() => {
|
|
1270
|
+
this.localeTick();
|
|
1271
|
+
return this.locale() || this.lang.locale;
|
|
1272
|
+
}, ...ngDevMode ? [{ debugName: "effectiveLocale" }] : /* istanbul ignore next */ []);
|
|
1273
|
+
windowStart = linkedSignal({
|
|
1274
|
+
...ngDevMode ? { debugName: "windowStart" } : /* istanbul ignore next */ {},
|
|
1275
|
+
source: () => ({
|
|
1276
|
+
selected: this.selectedDate().getTime(),
|
|
1277
|
+
count: this.tileCount()
|
|
1278
|
+
}),
|
|
1279
|
+
computation: (source, previous) => {
|
|
1280
|
+
const selected = new Date(source.selected);
|
|
1281
|
+
const { count } = source;
|
|
1282
|
+
const anchored = this.anchorFor(selected, count);
|
|
1283
|
+
if (!previous || count === 0) return anchored;
|
|
1284
|
+
const current = previous.value;
|
|
1285
|
+
const holdsSelection = (() => {
|
|
1286
|
+
const offset = this.daysBetween(current, selected);
|
|
1287
|
+
return offset >= 0 && offset < count;
|
|
1288
|
+
})();
|
|
1289
|
+
return (count === DAYS_IN_WEEK ? holdsSelection && current.getDay() === MONDAY : holdsSelection) ? current : anchored;
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
focusedIndex = linkedSignal({
|
|
1293
|
+
...ngDevMode ? { debugName: "focusedIndex" } : /* istanbul ignore next */ {},
|
|
1294
|
+
source: () => this.selectedDate().getTime(),
|
|
1295
|
+
computation: () => Math.max(0, this.indexOfSelected())
|
|
1296
|
+
});
|
|
1297
|
+
dayTiles = computed(() => {
|
|
1298
|
+
const count = this.tileCount();
|
|
1299
|
+
if (count === 0) return [];
|
|
1300
|
+
const start = this.windowStart();
|
|
1301
|
+
const selected = this.selectedDate();
|
|
1302
|
+
const today = this.getToday();
|
|
1303
|
+
const locale = this.effectiveLocale();
|
|
1304
|
+
const tiles = [];
|
|
1305
|
+
let previousMonth = -1;
|
|
1306
|
+
let previousYear = -1;
|
|
1307
|
+
for (let i = 0; i < count; i++) {
|
|
1308
|
+
const date = new Date(start);
|
|
1309
|
+
date.setDate(start.getDate() + i);
|
|
1310
|
+
const month = date.getMonth();
|
|
1311
|
+
const year = date.getFullYear();
|
|
1312
|
+
const startsNewMonth = i > 0 && (month !== previousMonth || year !== previousYear);
|
|
1313
|
+
tiles.push({
|
|
1314
|
+
date,
|
|
1315
|
+
dayName: date.toLocaleDateString(locale, { weekday: "short" }),
|
|
1316
|
+
dayNumber: date.getDate(),
|
|
1317
|
+
monthName: date.toLocaleDateString(locale, { month: "short" }),
|
|
1318
|
+
startsNewMonth,
|
|
1319
|
+
isSelected: this.isSameDay(date, selected),
|
|
1320
|
+
isToday: this.isSameDay(date, today),
|
|
1321
|
+
accessibleLabel: date.toLocaleDateString(locale, {
|
|
1322
|
+
weekday: "long",
|
|
1323
|
+
day: "numeric",
|
|
1324
|
+
month: "long",
|
|
1325
|
+
year: "numeric"
|
|
1326
|
+
})
|
|
1327
|
+
});
|
|
1328
|
+
previousMonth = month;
|
|
1329
|
+
previousYear = year;
|
|
1330
|
+
}
|
|
1331
|
+
return tiles;
|
|
1332
|
+
}, ...ngDevMode ? [{ debugName: "dayTiles" }] : /* istanbul ignore next */ []);
|
|
1333
|
+
monthCaption = computed(() => {
|
|
1334
|
+
const locale = this.effectiveLocale();
|
|
1335
|
+
const tiles = this.dayTiles();
|
|
1336
|
+
if (!tiles.length) return this.selectedDate().toLocaleDateString(locale, {
|
|
1337
|
+
month: "long",
|
|
1338
|
+
year: "numeric"
|
|
1339
|
+
});
|
|
1340
|
+
const first = tiles[0].date;
|
|
1341
|
+
const last = tiles[tiles.length - 1].date;
|
|
1342
|
+
if (first.getFullYear() !== last.getFullYear()) return `${first.toLocaleDateString(locale, {
|
|
1343
|
+
month: "long",
|
|
1344
|
+
year: "numeric"
|
|
1345
|
+
})} – ${last.toLocaleDateString(locale, {
|
|
1346
|
+
month: "long",
|
|
1347
|
+
year: "numeric"
|
|
1348
|
+
})}`;
|
|
1349
|
+
if (first.getMonth() !== last.getMonth()) return `${first.toLocaleDateString(locale, { month: "long" })} – ${last.toLocaleDateString(locale, {
|
|
1350
|
+
month: "long",
|
|
1351
|
+
year: "numeric"
|
|
1352
|
+
})}`;
|
|
1353
|
+
return first.toLocaleDateString(locale, {
|
|
1354
|
+
month: "long",
|
|
1355
|
+
year: "numeric"
|
|
1356
|
+
});
|
|
1357
|
+
}, ...ngDevMode ? [{ debugName: "monthCaption" }] : /* istanbul ignore next */ []);
|
|
1358
|
+
selectedDateString = computed(() => {
|
|
1359
|
+
const d = this.selectedDate();
|
|
1360
|
+
const pad = (n) => n.toString().padStart(2, "0");
|
|
1361
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
1362
|
+
}, ...ngDevMode ? [{ debugName: "selectedDateString" }] : /* istanbul ignore next */ []);
|
|
1363
|
+
pickerProps = computed(() => ({
|
|
1364
|
+
id: this.pickerId,
|
|
1365
|
+
mode: "date",
|
|
1366
|
+
placeholder: this.pickDateLabel(),
|
|
1367
|
+
size: "md",
|
|
1368
|
+
borderRadius: "lg",
|
|
1369
|
+
hover: true,
|
|
1370
|
+
fullWidth: true
|
|
1371
|
+
}), ...ngDevMode ? [{ debugName: "pickerProps" }] : /* istanbul ignore next */ []);
|
|
1372
|
+
ngOnInit() {
|
|
1373
|
+
this.lang.locale$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.localeTick.update((v) => v + 1));
|
|
1374
|
+
this.observeOwnWidth();
|
|
1375
|
+
}
|
|
1376
|
+
navigatePrevious() {
|
|
1377
|
+
this.shiftWindow(-1);
|
|
1378
|
+
}
|
|
1379
|
+
navigateNext() {
|
|
1380
|
+
this.shiftWindow(1);
|
|
1381
|
+
}
|
|
1382
|
+
goToToday() {
|
|
1383
|
+
const today = this.getToday();
|
|
1384
|
+
this.windowStart.set(this.anchorFor(today, this.tileCount()));
|
|
1385
|
+
if (!this.isSameDay(today, this.selectedDate())) this.dateSelected.emit(today);
|
|
1386
|
+
}
|
|
1387
|
+
selectDate(date) {
|
|
1388
|
+
if (this.isSameDay(date, this.selectedDate())) return;
|
|
1389
|
+
this.dateSelected.emit(date);
|
|
1390
|
+
}
|
|
1391
|
+
onDateModelChanged(value) {
|
|
1392
|
+
if (!value) return;
|
|
1393
|
+
const picked = /* @__PURE__ */ new Date(value + "T00:00:00");
|
|
1394
|
+
if (isNaN(picked.getTime())) return;
|
|
1395
|
+
this.windowStart.set(this.anchorFor(picked, this.tileCount()));
|
|
1396
|
+
if (!this.isSameDay(picked, this.selectedDate())) this.dateSelected.emit(picked);
|
|
1397
|
+
}
|
|
1398
|
+
isTabbable(index) {
|
|
1399
|
+
return index === this.focusedIndex();
|
|
1400
|
+
}
|
|
1401
|
+
onTileFocus(index) {
|
|
1402
|
+
this.focusedIndex.set(index);
|
|
1403
|
+
}
|
|
1404
|
+
onTileKeydown(event, index) {
|
|
1405
|
+
const lastIndex = this.tileCount() - 1;
|
|
1406
|
+
switch (event.key) {
|
|
1407
|
+
case "ArrowRight":
|
|
1408
|
+
event.preventDefault();
|
|
1409
|
+
if (index < lastIndex) this.moveFocusTo(index + 1);
|
|
1410
|
+
else {
|
|
1411
|
+
this.shiftWindow(1);
|
|
1412
|
+
this.moveFocusTo(0);
|
|
1413
|
+
}
|
|
1414
|
+
break;
|
|
1415
|
+
case "ArrowLeft":
|
|
1416
|
+
event.preventDefault();
|
|
1417
|
+
if (index > 0) this.moveFocusTo(index - 1);
|
|
1418
|
+
else {
|
|
1419
|
+
this.shiftWindow(-1);
|
|
1420
|
+
this.moveFocusTo(lastIndex);
|
|
1421
|
+
}
|
|
1422
|
+
break;
|
|
1423
|
+
case "Home":
|
|
1424
|
+
event.preventDefault();
|
|
1425
|
+
this.moveFocusTo(0);
|
|
1426
|
+
break;
|
|
1427
|
+
case "End":
|
|
1428
|
+
event.preventDefault();
|
|
1429
|
+
this.moveFocusTo(lastIndex);
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
trackByTile(_index, tile) {
|
|
1433
|
+
return tile.date.getTime();
|
|
1434
|
+
}
|
|
1435
|
+
shiftWindow(pages) {
|
|
1436
|
+
const next = new Date(this.windowStart());
|
|
1437
|
+
next.setDate(next.getDate() + pages * this.tileCount());
|
|
1438
|
+
this.windowStart.set(next);
|
|
1439
|
+
}
|
|
1440
|
+
moveFocusTo(index) {
|
|
1441
|
+
this.focusedIndex.set(index);
|
|
1442
|
+
afterNextRender(() => this.tileButtons()[index]?.nativeElement.focus(), { injector: this.injector });
|
|
1443
|
+
}
|
|
1444
|
+
indexOfSelected() {
|
|
1445
|
+
return this.dayTiles().findIndex((tile) => tile.isSelected);
|
|
1446
|
+
}
|
|
1447
|
+
anchorFor(date, count) {
|
|
1448
|
+
if (count === DAYS_IN_WEEK) return this.startOfWeek(date);
|
|
1449
|
+
const start = new Date(date);
|
|
1450
|
+
start.setHours(0, 0, 0, 0);
|
|
1451
|
+
start.setDate(start.getDate() - Math.floor(count / 2));
|
|
1452
|
+
return start;
|
|
1453
|
+
}
|
|
1454
|
+
startOfWeek(date) {
|
|
1455
|
+
const start = new Date(date);
|
|
1456
|
+
start.setHours(0, 0, 0, 0);
|
|
1457
|
+
start.setDate(start.getDate() - (start.getDay() + 6) % 7);
|
|
1458
|
+
return start;
|
|
1459
|
+
}
|
|
1460
|
+
daysBetween(from, to) {
|
|
1461
|
+
const a = Date.UTC(from.getFullYear(), from.getMonth(), from.getDate());
|
|
1462
|
+
const b = Date.UTC(to.getFullYear(), to.getMonth(), to.getDate());
|
|
1463
|
+
return Math.round((b - a) / 864e5);
|
|
1464
|
+
}
|
|
1465
|
+
observeOwnWidth() {
|
|
1466
|
+
const element = this.host.nativeElement;
|
|
1467
|
+
this.containerWidth.set(element.getBoundingClientRect().width);
|
|
1468
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
1469
|
+
const observer = new ResizeObserver((entries) => {
|
|
1470
|
+
const width = entries[0]?.contentRect.width ?? 0;
|
|
1471
|
+
if (width > 0) this.containerWidth.set(width);
|
|
1472
|
+
});
|
|
1473
|
+
observer.observe(element);
|
|
1474
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
1475
|
+
}
|
|
1476
|
+
getToday() {
|
|
1477
|
+
const now = /* @__PURE__ */ new Date();
|
|
1478
|
+
now.setHours(0, 0, 0, 0);
|
|
1479
|
+
return now;
|
|
1480
|
+
}
|
|
1481
|
+
isSameDay(a, b) {
|
|
1482
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
1483
|
+
}
|
|
1484
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1485
|
+
minVersion: "12.0.0",
|
|
1486
|
+
version: "22.2.2",
|
|
1487
|
+
ngImport: i0,
|
|
1488
|
+
type: MnDateSelectorBar,
|
|
1489
|
+
deps: [],
|
|
1490
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1491
|
+
});
|
|
1492
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1493
|
+
minVersion: "17.0.0",
|
|
1494
|
+
version: "22.2.2",
|
|
1495
|
+
type: MnDateSelectorBar,
|
|
1496
|
+
isStandalone: true,
|
|
1497
|
+
selector: "mn-date-selector-bar",
|
|
1498
|
+
inputs: {
|
|
1499
|
+
selectedDate: {
|
|
1500
|
+
classPropertyName: "selectedDate",
|
|
1501
|
+
publicName: "selectedDate",
|
|
1502
|
+
isSignal: true,
|
|
1503
|
+
isRequired: false,
|
|
1504
|
+
transformFunction: null
|
|
1505
|
+
},
|
|
1506
|
+
todayLabel: {
|
|
1507
|
+
classPropertyName: "todayLabel",
|
|
1508
|
+
publicName: "todayLabel",
|
|
1509
|
+
isSignal: true,
|
|
1510
|
+
isRequired: false,
|
|
1511
|
+
transformFunction: null
|
|
1512
|
+
},
|
|
1513
|
+
pickDateLabel: {
|
|
1514
|
+
classPropertyName: "pickDateLabel",
|
|
1515
|
+
publicName: "pickDateLabel",
|
|
1516
|
+
isSignal: true,
|
|
1517
|
+
isRequired: false,
|
|
1518
|
+
transformFunction: null
|
|
1519
|
+
},
|
|
1520
|
+
previousLabel: {
|
|
1521
|
+
classPropertyName: "previousLabel",
|
|
1522
|
+
publicName: "previousLabel",
|
|
1523
|
+
isSignal: true,
|
|
1524
|
+
isRequired: false,
|
|
1525
|
+
transformFunction: null
|
|
1526
|
+
},
|
|
1527
|
+
nextLabel: {
|
|
1528
|
+
classPropertyName: "nextLabel",
|
|
1529
|
+
publicName: "nextLabel",
|
|
1530
|
+
isSignal: true,
|
|
1531
|
+
isRequired: false,
|
|
1532
|
+
transformFunction: null
|
|
1533
|
+
},
|
|
1534
|
+
dayStripLabel: {
|
|
1535
|
+
classPropertyName: "dayStripLabel",
|
|
1536
|
+
publicName: "dayStripLabel",
|
|
1537
|
+
isSignal: true,
|
|
1538
|
+
isRequired: false,
|
|
1539
|
+
transformFunction: null
|
|
1540
|
+
},
|
|
1541
|
+
locale: {
|
|
1542
|
+
classPropertyName: "locale",
|
|
1543
|
+
publicName: "locale",
|
|
1544
|
+
isSignal: true,
|
|
1545
|
+
isRequired: false,
|
|
1546
|
+
transformFunction: null
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
outputs: { dateSelected: "dateSelected" },
|
|
1550
|
+
host: { classAttribute: "block" },
|
|
1551
|
+
viewQueries: [{
|
|
1552
|
+
propertyName: "tileButtons",
|
|
1553
|
+
predicate: ["tileButton"],
|
|
1554
|
+
descendants: true,
|
|
1555
|
+
isSignal: true
|
|
1556
|
+
}],
|
|
1557
|
+
ngImport: i0,
|
|
1558
|
+
template: "<!-- Date selector bar. Layout is driven by the bar's own measured width, so it\n rearranges for the space the bar was given, not for the viewport. The strip\n never stacks: as room runs out it shows fewer days, then hands over to the\n picker. Nothing here is boxed — spacing does the grouping, not borders. -->\n<div class=\"flex flex-col gap-2 px-4 py-3\">\n\n <!-- Month header. Titles the whole bar so the day numbers below are never loose:\n it names the month the strip is in (or, when compact, the month the\n selection sits in), reading as a range where the strip crosses a boundary.\n On its own line it has room to be spelled out, and no longer steals width\n from the days the way the old inline caption did. -->\n <div aria-hidden=\"true\"\n class=\"text-center text-sm font-semibold tracking-wide whitespace-nowrap opacity-80\">\n {{ monthCaption() }}\n </div>\n\n <!-- Controls row. Today and the strip travel together as one centred cluster, so\n Today sits right beside the days instead of stranded against the far edge;\n the gap between them matches the strip's own spacing. When the strip gives\n way to the picker, the picker fills the row and Today anchors its left. -->\n <div class=\"flex items-center justify-center gap-3\">\n\n <!-- Today: returns the strip and the selection to the current day. Outlined\n rather than filled, so the one filled-primary element on the bar is the\n selected day — Today shares the primary accent without competing with it. -->\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ todayLabel() }}\n </button>\n\n <!-- Too narrow for a usable strip, so the picker takes its place beside Today.\n Every date stays reachable on a phone, in one tap rather than by paging;\n the month header above keeps the compact bar labelled like the wide one. -->\n @if (!showDayStrip()) {\n <mn-lib-datetime (ngModelChange)=\"onDateModelChanged($event)\"\n [ngModel]=\"selectedDateString()\"\n [props]=\"pickerProps()\"\n class=\"block min-w-0 flex-1\"></mn-lib-datetime>\n }\n\n <!-- Arrows and days, sized to their own content so the row can centre them\n together with Today as a single cluster — rather than the days drifting to\n the middle of the leftover space, away from the button. -->\n @if (showDayStrip()) {\n <div [attr.aria-label]=\"dayStripLabel()\"\n class=\"flex min-w-0 items-center gap-3\"\n role=\"group\">\n <button (click)=\"navigatePrevious()\"\n [attr.aria-label]=\"previousLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <!-- Days read on one line so each sits at the same height as the buttons\n either side of it. Roving tabindex: one day is in the tab order, the\n arrow keys move between the rest and page the strip at either end. -->\n <div class=\"flex min-w-0 gap-1\">\n @for (tile of dayTiles(); track tile.date.getTime(); let i = $index) {\n <!-- Selected is the filled pill; today is called out by its number\n alone, tinted primary — no box, in keeping with a bar that groups\n by spacing rather than borders. When today is also the selected\n day the fill takes over, since there is nothing left to tell apart.\n A month break is marked by extra breathing room rather than a rule,\n so the run of days stays unbroken; the header names both months. -->\n <button #tileButton\n (click)=\"selectDate(tile.date)\"\n (focus)=\"onTileFocus(i)\"\n (keydown)=\"onTileKeydown($event, i)\"\n [attr.aria-current]=\"tile.isToday ? 'date' : null\"\n [attr.aria-label]=\"tile.accessibleLabel\"\n [attr.aria-pressed]=\"tile.isSelected\"\n [attr.tabindex]=\"isTabbable(i) ? 0 : -1\"\n [class.bg-primary]=\"tile.isSelected\"\n [class.hover:bg-base-200]=\"!tile.isSelected\"\n [class.ml-3]=\"tile.startsNewMonth\"\n [class.text-primary-content]=\"tile.isSelected\"\n class=\"flex min-w-16 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none\"\n type=\"button\">\n <span [class.opacity-60]=\"!tile.isSelected\"\n [class.opacity-90]=\"tile.isSelected\"\n aria-hidden=\"true\"\n class=\"text-xs font-medium uppercase\">\n {{ tile.dayName }}\n </span>\n <!-- Today's number carries the primary tint, unless the tile is\n filled — then it wears the fill's own text colour instead. -->\n <span [class.text-primary]=\"tile.isToday && !tile.isSelected\"\n aria-hidden=\"true\"\n class=\"font-bold tabular-nums\">{{ tile.dayNumber }}</span>\n </button>\n }\n </div>\n\n <button (click)=\"navigateNext()\"\n [attr.aria-label]=\"nextLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n }\n </div>\n</div>\n",
|
|
1559
|
+
dependencies: [
|
|
1560
|
+
{
|
|
1561
|
+
kind: "ngmodule",
|
|
1562
|
+
type: CommonModule
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
kind: "ngmodule",
|
|
1566
|
+
type: FormsModule
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
kind: "directive",
|
|
1570
|
+
type: i1.NgControlStatus,
|
|
1571
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
kind: "directive",
|
|
1575
|
+
type: i1.NgModel,
|
|
1576
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
1577
|
+
inputs: [
|
|
1578
|
+
"name",
|
|
1579
|
+
"disabled",
|
|
1580
|
+
"ngModel",
|
|
1581
|
+
"ngModelOptions"
|
|
1582
|
+
],
|
|
1583
|
+
outputs: ["ngModelChange"],
|
|
1584
|
+
exportAs: ["ngModel"]
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
kind: "component",
|
|
1588
|
+
type: MnButton,
|
|
1589
|
+
selector: "button[mnButton], a[mnButton]",
|
|
1590
|
+
inputs: ["data"]
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
kind: "component",
|
|
1594
|
+
type: MnDatetime,
|
|
1595
|
+
selector: "mn-lib-datetime",
|
|
1596
|
+
inputs: ["props"]
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
kind: "component",
|
|
1600
|
+
type: LucideDynamicIcon,
|
|
1601
|
+
selector: "svg[lucideIcon]",
|
|
1602
|
+
inputs: ["lucideIcon"]
|
|
1603
|
+
}
|
|
1604
|
+
],
|
|
1605
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1606
|
+
});
|
|
1607
|
+
};
|
|
1608
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1609
|
+
minVersion: "12.0.0",
|
|
1610
|
+
version: "22.2.2",
|
|
1611
|
+
ngImport: i0,
|
|
1612
|
+
type: MnDateSelectorBar,
|
|
1613
|
+
decorators: [{
|
|
1614
|
+
type: Component,
|
|
1615
|
+
args: [{
|
|
1616
|
+
selector: "mn-date-selector-bar",
|
|
1617
|
+
standalone: true,
|
|
1618
|
+
imports: [
|
|
1619
|
+
CommonModule,
|
|
1620
|
+
FormsModule,
|
|
1621
|
+
MnButton,
|
|
1622
|
+
MnDatetime,
|
|
1623
|
+
LucideDynamicIcon
|
|
1624
|
+
],
|
|
1625
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1626
|
+
host: { class: "block" },
|
|
1627
|
+
template: "<!-- Date selector bar. Layout is driven by the bar's own measured width, so it\n rearranges for the space the bar was given, not for the viewport. The strip\n never stacks: as room runs out it shows fewer days, then hands over to the\n picker. Nothing here is boxed — spacing does the grouping, not borders. -->\n<div class=\"flex flex-col gap-2 px-4 py-3\">\n\n <!-- Month header. Titles the whole bar so the day numbers below are never loose:\n it names the month the strip is in (or, when compact, the month the\n selection sits in), reading as a range where the strip crosses a boundary.\n On its own line it has room to be spelled out, and no longer steals width\n from the days the way the old inline caption did. -->\n <div aria-hidden=\"true\"\n class=\"text-center text-sm font-semibold tracking-wide whitespace-nowrap opacity-80\">\n {{ monthCaption() }}\n </div>\n\n <!-- Controls row. Today and the strip travel together as one centred cluster, so\n Today sits right beside the days instead of stranded against the far edge;\n the gap between them matches the strip's own spacing. When the strip gives\n way to the picker, the picker fills the row and Today anchors its left. -->\n <div class=\"flex items-center justify-center gap-3\">\n\n <!-- Today: returns the strip and the selection to the current day. Outlined\n rather than filled, so the one filled-primary element on the bar is the\n selected day — Today shares the primary accent without competing with it. -->\n <button (click)=\"goToToday()\"\n [data]=\"{ variant: 'outline', color: 'primary', size: 'md' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n {{ todayLabel() }}\n </button>\n\n <!-- Too narrow for a usable strip, so the picker takes its place beside Today.\n Every date stays reachable on a phone, in one tap rather than by paging;\n the month header above keeps the compact bar labelled like the wide one. -->\n @if (!showDayStrip()) {\n <mn-lib-datetime (ngModelChange)=\"onDateModelChanged($event)\"\n [ngModel]=\"selectedDateString()\"\n [props]=\"pickerProps()\"\n class=\"block min-w-0 flex-1\"></mn-lib-datetime>\n }\n\n <!-- Arrows and days, sized to their own content so the row can centre them\n together with Today as a single cluster — rather than the days drifting to\n the middle of the leftover space, away from the button. -->\n @if (showDayStrip()) {\n <div [attr.aria-label]=\"dayStripLabel()\"\n class=\"flex min-w-0 items-center gap-3\"\n role=\"group\">\n <button (click)=\"navigatePrevious()\"\n [attr.aria-label]=\"previousLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronLeft\"></svg>\n </button>\n\n <!-- Days read on one line so each sits at the same height as the buttons\n either side of it. Roving tabindex: one day is in the tab order, the\n arrow keys move between the rest and page the strip at either end. -->\n <div class=\"flex min-w-0 gap-1\">\n @for (tile of dayTiles(); track tile.date.getTime(); let i = $index) {\n <!-- Selected is the filled pill; today is called out by its number\n alone, tinted primary — no box, in keeping with a bar that groups\n by spacing rather than borders. When today is also the selected\n day the fill takes over, since there is nothing left to tell apart.\n A month break is marked by extra breathing room rather than a rule,\n so the run of days stays unbroken; the header names both months. -->\n <button #tileButton\n (click)=\"selectDate(tile.date)\"\n (focus)=\"onTileFocus(i)\"\n (keydown)=\"onTileKeydown($event, i)\"\n [attr.aria-current]=\"tile.isToday ? 'date' : null\"\n [attr.aria-label]=\"tile.accessibleLabel\"\n [attr.aria-pressed]=\"tile.isSelected\"\n [attr.tabindex]=\"isTabbable(i) ? 0 : -1\"\n [class.bg-primary]=\"tile.isSelected\"\n [class.hover:bg-base-200]=\"!tile.isSelected\"\n [class.ml-3]=\"tile.startsNewMonth\"\n [class.text-primary-content]=\"tile.isSelected\"\n class=\"flex min-w-16 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none\"\n type=\"button\">\n <span [class.opacity-60]=\"!tile.isSelected\"\n [class.opacity-90]=\"tile.isSelected\"\n aria-hidden=\"true\"\n class=\"text-xs font-medium uppercase\">\n {{ tile.dayName }}\n </span>\n <!-- Today's number carries the primary tint, unless the tile is\n filled — then it wears the fill's own text colour instead. -->\n <span [class.text-primary]=\"tile.isToday && !tile.isSelected\"\n aria-hidden=\"true\"\n class=\"font-bold tabular-nums\">{{ tile.dayNumber }}</span>\n </button>\n }\n </div>\n\n <button (click)=\"navigateNext()\"\n [attr.aria-label]=\"nextLabel()\"\n [data]=\"{ variant: 'text', size: 'md', color: 'gray' }\"\n class=\"shrink-0\"\n mnButton\n type=\"button\">\n <svg [size]=\"18\" [lucideIcon]=\"icons.ChevronRight\"></svg>\n </button>\n </div>\n }\n </div>\n</div>\n"
|
|
1628
|
+
}]
|
|
1629
|
+
}],
|
|
1630
|
+
propDecorators: {
|
|
1631
|
+
selectedDate: [{
|
|
1632
|
+
type: i0.Input,
|
|
1633
|
+
args: [{
|
|
1634
|
+
isSignal: true,
|
|
1635
|
+
alias: "selectedDate",
|
|
1636
|
+
required: false
|
|
1637
|
+
}]
|
|
1638
|
+
}],
|
|
1639
|
+
todayLabel: [{
|
|
1640
|
+
type: i0.Input,
|
|
1641
|
+
args: [{
|
|
1642
|
+
isSignal: true,
|
|
1643
|
+
alias: "todayLabel",
|
|
1644
|
+
required: false
|
|
1645
|
+
}]
|
|
1646
|
+
}],
|
|
1647
|
+
pickDateLabel: [{
|
|
1648
|
+
type: i0.Input,
|
|
1649
|
+
args: [{
|
|
1650
|
+
isSignal: true,
|
|
1651
|
+
alias: "pickDateLabel",
|
|
1652
|
+
required: false
|
|
1653
|
+
}]
|
|
1654
|
+
}],
|
|
1655
|
+
previousLabel: [{
|
|
1656
|
+
type: i0.Input,
|
|
1657
|
+
args: [{
|
|
1658
|
+
isSignal: true,
|
|
1659
|
+
alias: "previousLabel",
|
|
1660
|
+
required: false
|
|
1661
|
+
}]
|
|
1662
|
+
}],
|
|
1663
|
+
nextLabel: [{
|
|
1664
|
+
type: i0.Input,
|
|
1665
|
+
args: [{
|
|
1666
|
+
isSignal: true,
|
|
1667
|
+
alias: "nextLabel",
|
|
1668
|
+
required: false
|
|
1669
|
+
}]
|
|
1670
|
+
}],
|
|
1671
|
+
dayStripLabel: [{
|
|
1672
|
+
type: i0.Input,
|
|
1673
|
+
args: [{
|
|
1674
|
+
isSignal: true,
|
|
1675
|
+
alias: "dayStripLabel",
|
|
1676
|
+
required: false
|
|
1677
|
+
}]
|
|
1678
|
+
}],
|
|
1679
|
+
locale: [{
|
|
1680
|
+
type: i0.Input,
|
|
1681
|
+
args: [{
|
|
1682
|
+
isSignal: true,
|
|
1683
|
+
alias: "locale",
|
|
1684
|
+
required: false
|
|
1685
|
+
}]
|
|
1686
|
+
}],
|
|
1687
|
+
dateSelected: [{
|
|
1688
|
+
type: i0.Output,
|
|
1689
|
+
args: ["dateSelected"]
|
|
1690
|
+
}],
|
|
1691
|
+
tileButtons: [{
|
|
1692
|
+
type: i0.ViewChildren,
|
|
1693
|
+
args: ["tileButton", { isSignal: true }]
|
|
1694
|
+
}]
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1552
1697
|
export { CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarMonthComponent, CalendarViewComponent, CalendarWeekComponent, MnDateSelectorBar, UpcomingEventRowComponent, UpcomingEventsComponent };
|
|
1553
|
-
|
|
1698
|
+
|
|
1699
|
+
//# sourceMappingURL=mn-angular-lib-calendar.mjs.map
|