@pieninck/ionic2-calendar 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1257 -1027
- package/fesm2022/pieninck-ionic2-calendar.mjs +435 -400
- package/fesm2022/pieninck-ionic2-calendar.mjs.map +1 -1
- package/package.json +9 -7
- package/types/pieninck-ionic2-calendar.d.ts +25 -334
package/README.md
CHANGED
|
@@ -1,1027 +1,1257 @@
|
|
|
1
|
-
# Ionic-Calendar directive
|
|
2
|
-
|
|
3
|
-
Ionic calendar directive
|
|
4
|
-
@pieninck/ionic2-calendar
|
|
5
|
-
[](https://www.npmjs.com/package/@pieninck/ionic2-calendar)
|
|
6
|
-
ionic8-calendar
|
|
7
|
-
[](https://www.npmjs.com/package/ionic8-calendar)
|
|
8
|
-
[](https://raw.githubusercontent.com/pieninck/Ionic2-Calendar/master/LICENSE)
|
|
9
|
-
|
|
10
|
-
# Table of Contents
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Version
|
|
25
|
-
https://stackblitz.com/edit/ionic-calendar-demo-
|
|
26
|
-
Version 0
|
|
27
|
-
https://stackblitz.com/edit/ionic-calendar-demo?file=
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# Dependency
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| 2.
|
|
36
|
-
| 2.
|
|
37
|
-
| 2.
|
|
38
|
-
| 2.
|
|
39
|
-
| 2.
|
|
40
|
-
| 2.
|
|
41
|
-
| 2.
|
|
42
|
-
| 2.
|
|
43
|
-
|
|
|
44
|
-
| 0.
|
|
45
|
-
| 0.
|
|
46
|
-
| 0.
|
|
47
|
-
| 0.
|
|
48
|
-
| 0.
|
|
49
|
-
| 0.2.
|
|
50
|
-
| 0.
|
|
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
|
-
export class AppModule {}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
- version 0.1.x - 0.4.x
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
import {
|
|
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
|
-
The format of the
|
|
178
|
-
Default value: '
|
|
179
|
-
|
|
180
|
-
The format of the header displayed in the
|
|
181
|
-
Default value: 'EEE'
|
|
182
|
-
|
|
183
|
-
The format of the
|
|
184
|
-
Default value: '
|
|
185
|
-
|
|
186
|
-
The
|
|
187
|
-
Default value:
|
|
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
|
-
The
|
|
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
|
-
The
|
|
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
|
-
Type: TemplateRef\<
|
|
760
|
-
The template provides customized view for all day event
|
|
761
|
-
|
|
762
|
-
```
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
```
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
*
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
*
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1
|
+
# Ionic-Calendar directive
|
|
2
|
+
|
|
3
|
+
Ionic calendar directive
|
|
4
|
+
@pieninck/ionic2-calendar
|
|
5
|
+
[](https://www.npmjs.com/package/@pieninck/ionic2-calendar)
|
|
6
|
+
ionic8-calendar
|
|
7
|
+
[](https://www.npmjs.com/package/ionic8-calendar)
|
|
8
|
+
[](https://raw.githubusercontent.com/pieninck/Ionic2-Calendar/master/LICENSE)
|
|
9
|
+
|
|
10
|
+
# Table of Contents
|
|
11
|
+
|
|
12
|
+
1. [Demo](#demo)
|
|
13
|
+
2. [Dependency](#dependency)
|
|
14
|
+
3. [Usage](#usage)
|
|
15
|
+
4. [Options](#options)
|
|
16
|
+
5. [Callback](#callback)
|
|
17
|
+
6. [View Customization Option](#view-customization-option)
|
|
18
|
+
7. [EventSource](#eventsource)
|
|
19
|
+
8. [Performance Tuning](#performance-tuning)
|
|
20
|
+
9. [Common Questions](#common-questions)
|
|
21
|
+
|
|
22
|
+
# Demo
|
|
23
|
+
|
|
24
|
+
Version 2.0
|
|
25
|
+
https://stackblitz.com/edit/ionic-calendar-demo-2-2?file=src%2Fapp%2Fexample.component.html
|
|
26
|
+
Version 1.0
|
|
27
|
+
https://stackblitz.com/edit/ionic-calendar-demo-1-0?file=src%2Fapp%2Fexample.component.html
|
|
28
|
+
Version 0.x
|
|
29
|
+
https://stackblitz.com/edit/ionic-calendar-demo?file=pages%2Fhome%2Fhome.html
|
|
30
|
+
|
|
31
|
+
# Dependency
|
|
32
|
+
|
|
33
|
+
| Calendar Version | Ionic Version | Angular Version | Swiper Version |
|
|
34
|
+
| ---------------- | ------------------------ | --------------- | -------------- |
|
|
35
|
+
| 2.8.x | >=8.0.0 | >=21.0.0 | >=11.0.0 |
|
|
36
|
+
| 2.7.x | >=8.0.0 | >=20.0.0 | >=11.0.0 |
|
|
37
|
+
| 2.6.x | >=8.0.0 | >=19.0.0 | >=11.0.0 |
|
|
38
|
+
| 2.5.x | >=8.0.0 | >=18.0.0 | >=11.0.0 |
|
|
39
|
+
| 2.4.x | >=7.0.0 | >=17.0.0 | >=11.0.0 |
|
|
40
|
+
| 2.3.x | >=7.0.0 | >=17.0.0 | >=11.0.0 |
|
|
41
|
+
| 2.2.x | >=7.0.0 | >=1s7.0.0 | >=10.1.0 |
|
|
42
|
+
| 2.1.x | >=7.0.0 | >=16.0.0 | >=10.1.0 |
|
|
43
|
+
| 2.0.x | >=7.0.0 | >=16.0.0 | [8.4.6, 9.0.0) |
|
|
44
|
+
| 1.0.x | >=6.1.9 | >=15.1.2 | [8.4.6, 9.0.0) |
|
|
45
|
+
| 0.6.x | >=5.1.0 | >=9.1.0 | |
|
|
46
|
+
| 0.5.x | >=4.0.0-rc.1 | | |
|
|
47
|
+
| 0.4.x | >=3.9.2 | | |
|
|
48
|
+
| 0.3.x | >=3.1.1 | | |
|
|
49
|
+
| 0.2.9+ | >=2.3.0 | | |
|
|
50
|
+
| 0.2.x | 2.0.0-rc.5 | | |
|
|
51
|
+
| 0.1.x | [2.0.0-rc.1, 2.0.0-rc.4] | | |
|
|
52
|
+
|
|
53
|
+
version 0.2-0.4 has below dependency:
|
|
54
|
+
intl 1.2.5, due to issue https://github.com/angular/angular/issues/3333
|
|
55
|
+
|
|
56
|
+
**Angular 21 note:** starting with `2.8.x` you need Angular CLI/Framework 21+, TypeScript `5.9.x`, and a `bundler` `moduleResolution` in `tsconfig.json`. Install `rimraf` (already listed in devDependencies) to keep the build scripts cross-platform.
|
|
57
|
+
|
|
58
|
+
## Maintainer publish flow
|
|
59
|
+
|
|
60
|
+
1. `npm run build`
|
|
61
|
+
2. `npm publish ./dist --access public`
|
|
62
|
+
3. Tag the release (`git tag vX.Y.Z && git push origin vX.Y.Z`)
|
|
63
|
+
|
|
64
|
+
# Usage
|
|
65
|
+
|
|
66
|
+
## 1. Install Calendar Dependency
|
|
67
|
+
|
|
68
|
+
`npm install @pieninck/ionic2-calendar --save`
|
|
69
|
+
|
|
70
|
+
If you need the legacy npm name published by the original maintainer, install `ionic2-calendar`. Both packages expose the same API, but `@pieninck/ionic2-calendar` is this fork with Angular 21 support.
|
|
71
|
+
|
|
72
|
+
> **Note:** Throughout this README the snippets still reference `ionic2-calendar`. When consuming this fork, replace those import paths with `@pieninck/ionic2-calendar`.
|
|
73
|
+
|
|
74
|
+
### version 1.0.x onwards
|
|
75
|
+
|
|
76
|
+
version 1.0.x is also published as Ionic6-Calendar package name. So could also run
|
|
77
|
+
`npm install ionic6-calendar --save`
|
|
78
|
+
version 2.0.+ is also published as Ionic7-Calendar package name. So could also run
|
|
79
|
+
`npm install ionic7-calendar --save`
|
|
80
|
+
version 2.5.+ is also published as Ionic8-Calendar package name. So could also run
|
|
81
|
+
`npm install ionic8-calendar --save`
|
|
82
|
+
|
|
83
|
+
<font color=red>**NOTE: Starting from Version 1.0.x, the underlying implementaion is based on Swiper instead of IonSlides, so also needs to install Swiper dependency.**</font>
|
|
84
|
+
|
|
85
|
+
- Install swiper dependency
|
|
86
|
+
`npm install swiper --save`
|
|
87
|
+
|
|
88
|
+
- Import swiper css in **global.scss**
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
@import 'swiper/css';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 2. Import the Calendar module
|
|
95
|
+
|
|
96
|
+
If using version 1.0.x, could use both ionic2-calendar or ionic6-calendar, ionic7-calendar.
|
|
97
|
+
|
|
98
|
+
- version 0.5.x onwards
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { NgModule } from "@angular/core";
|
|
102
|
+
import { IonicApp, IonicModule } from "@ionic/angular";
|
|
103
|
+
import { MyApp } from "./app/app.component";
|
|
104
|
+
import { NgCalendarModule } from "ionic2-calendar";
|
|
105
|
+
|
|
106
|
+
@NgModule({
|
|
107
|
+
declarations: [MyApp],
|
|
108
|
+
imports: [NgCalendarModule, IonicModule.forRoot(MyApp)],
|
|
109
|
+
bootstrap: [IonicApp],
|
|
110
|
+
entryComponents: [MyApp],
|
|
111
|
+
})
|
|
112
|
+
export class AppModule {}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- version 0.1.x - 0.4.x
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import { NgModule } from "@angular/core";
|
|
119
|
+
import { IonicApp, IonicModule } from "ionic-angular";
|
|
120
|
+
import { MyApp } from "./app/app.component";
|
|
121
|
+
import { NgCalendarModule } from "ionic2-calendar";
|
|
122
|
+
|
|
123
|
+
@NgModule({
|
|
124
|
+
declarations: [MyApp],
|
|
125
|
+
imports: [NgCalendarModule, IonicModule.forRoot(MyApp)],
|
|
126
|
+
bootstrap: [IonicApp],
|
|
127
|
+
entryComponents: [MyApp],
|
|
128
|
+
})
|
|
129
|
+
export class AppModule {}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
If you are using PageModule, you need to import the NgCalendarModule in your page module
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { NgCalendarModule } from "ionic2-calendar";
|
|
136
|
+
|
|
137
|
+
@NgModule({
|
|
138
|
+
declarations: [MyPage],
|
|
139
|
+
imports: [IonicPageModule.forChild(MyPage), NgCalendarModule],
|
|
140
|
+
entryComponents: [MyPage],
|
|
141
|
+
})
|
|
142
|
+
export class MyPageModule {}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 3. Add the directive in the html page
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<calendar
|
|
149
|
+
[eventSource]="eventSource"
|
|
150
|
+
[calendarMode]="calendar.mode"
|
|
151
|
+
[currentDate]="calendar.currentDate"
|
|
152
|
+
(onCurrentDateChanged)="onCurrentDateChanged($event)"
|
|
153
|
+
(onRangeChanged)="reloadSource(startTime, endTime)"
|
|
154
|
+
(onEventSelected)="onEventSelected($event)"
|
|
155
|
+
(onTitleChanged)="onViewTitleChanged($event)"
|
|
156
|
+
(onTimeSelected)="onTimeSelected($event)"
|
|
157
|
+
[step]="calendar.step"
|
|
158
|
+
>
|
|
159
|
+
</calendar>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
# Options
|
|
163
|
+
|
|
164
|
+
- formatDay
|
|
165
|
+
The format of the date displayed in the month view.
|
|
166
|
+
Default value: 'dd'
|
|
167
|
+
- formatDayHeader
|
|
168
|
+
The format of the header displayed in the month view.
|
|
169
|
+
Default value: 'EEE'
|
|
170
|
+
- formatDayTitle
|
|
171
|
+
The format of the title displayed in the day view.
|
|
172
|
+
Default value: 'MMMM dd, yyyy'
|
|
173
|
+
- formatWeekTitle
|
|
174
|
+
The format of the title displayed in the week view.
|
|
175
|
+
Default value: (version 0.1-0.3) 'MMMM yyyy, Week $n', (version 0.4+) 'MMMM yyyy, \'Week\' w'
|
|
176
|
+
- formatMonthTitle
|
|
177
|
+
The format of the title displayed in the month view.
|
|
178
|
+
Default value: 'MMMM yyyy'
|
|
179
|
+
- formatWeekViewDayHeader
|
|
180
|
+
The format of the header displayed in the week view.
|
|
181
|
+
Default value: 'EEE d'
|
|
182
|
+
- formatHourColumn
|
|
183
|
+
The format of the hour column displayed in the week and day view.
|
|
184
|
+
Default value: (version 0.1-0.3) 'j', (version 0.4+) 'ha'
|
|
185
|
+
- calendarMode
|
|
186
|
+
The initial mode of the calendar.
|
|
187
|
+
Default value: 'month'
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<calendar ... [calendarMode]="calendar.mode"></calendar>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Version 1.0.x onwards
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
import { CalendarMode } from "ionic2-calendar";
|
|
197
|
+
|
|
198
|
+
calendar = {
|
|
199
|
+
mode: "week" as CalendarMode,
|
|
200
|
+
};
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Version 0.x
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
import { CalendarMode } from "ionic2-calendar/calendar";
|
|
207
|
+
|
|
208
|
+
calendar = {
|
|
209
|
+
mode: "week" as CalendarMode,
|
|
210
|
+
};
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
- showEventDetail
|
|
214
|
+
If set to true, when selecting the date in the month view, the events happened on that day will be shown below.
|
|
215
|
+
Default value: true
|
|
216
|
+
- startingDayMonth
|
|
217
|
+
Control month view starting from which day.
|
|
218
|
+
Default value: 0 (Sunday)
|
|
219
|
+
- startingDayWeek
|
|
220
|
+
Control week view starting from which day.
|
|
221
|
+
Default value: 0 (Sunday)
|
|
222
|
+
- allDayLabel
|
|
223
|
+
The text displayed in the allDay column header of week and day view.
|
|
224
|
+
Default value: 'all day'
|
|
225
|
+
- noEventsLabel
|
|
226
|
+
The text displayed when there’s no event on the selected date in month view.
|
|
227
|
+
Default value: 'No Events'
|
|
228
|
+
- eventSource
|
|
229
|
+
The data source of the calendar, when the eventSource is set, the view will be updated accordingly.
|
|
230
|
+
Default value: null
|
|
231
|
+
The format of the eventSource is described in the [EventSource](#eventsource) section
|
|
232
|
+
- queryMode
|
|
233
|
+
If queryMode is set to 'local', when the range or mode is changed, the calendar will use the already bound eventSource to update the view
|
|
234
|
+
If queryMode is set to 'remote', when the range or mode is changed, the calendar will trigger a callback function rangeChanged.
|
|
235
|
+
Users will need to implement their custom loading data logic in this function, and fill it into the eventSource. The eventSource is watched, so the view will be updated once the eventSource is changed.
|
|
236
|
+
Default value: 'local'
|
|
237
|
+
- step
|
|
238
|
+
It is used to display the event using more accurate time interval in weekview and dayview. For example, if set to 30, then the event will only occupy half of the row height (If timeInterval option uses default value). The unit is minute. It can be set to 15 or 30.
|
|
239
|
+
Default value: 60
|
|
240
|
+
|
|
241
|
+
```html
|
|
242
|
+
<calendar ... [step]="calendar.step"></calendar>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
import { Step } from "ionic2-calendar/calendar";
|
|
247
|
+
|
|
248
|
+
calendar = {
|
|
249
|
+
step: 30 as Step,
|
|
250
|
+
};
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
- timeInterval (version >= 0.3)
|
|
254
|
+
It is used to display the rows using more accurate time interval in weekview and dayview. For example, if set to 30, then the time interval between each row is 30 mins.
|
|
255
|
+
The unit is minute. It should be the factor or multiple of 60, which means 60%timeInterval=0 or timeInterval%60=0.
|
|
256
|
+
Default value: 60
|
|
257
|
+
|
|
258
|
+
```html
|
|
259
|
+
<calendar ... [timeInterval]="30"></calendar>
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
- autoSelect
|
|
263
|
+
If set to true, the current calendar date will be auto selected when calendar is loaded or swiped in the month and week view.
|
|
264
|
+
Default value: true
|
|
265
|
+
- locale
|
|
266
|
+
The locale used to display text in the calendar.
|
|
267
|
+
Check [Localization](#localization) section for more details.
|
|
268
|
+
Default value: undefined (which means the local language)
|
|
269
|
+
|
|
270
|
+
```html
|
|
271
|
+
<calendar ... [locale]="calendar.locale"></calendar>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
calendar = {
|
|
276
|
+
locale: "en-GB",
|
|
277
|
+
};
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
- markDisabled
|
|
281
|
+
The callback function used to determine if the time should be marked as disabled.
|
|
282
|
+
|
|
283
|
+
```html
|
|
284
|
+
<calendar ... [markDisabled]="markDisabled"></calendar>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
markDisabled = (date: Date) => {
|
|
289
|
+
var current = new Date();
|
|
290
|
+
return date < current;
|
|
291
|
+
};
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
- dateFormatter
|
|
295
|
+
The custom date formatter to transform date to text.
|
|
296
|
+
If the custom date formatter is not set, the default Angular DatePipe is used.
|
|
297
|
+
The format method in dateFormatter is optional, if omitted, the default Angular DatePipe is used.
|
|
298
|
+
|
|
299
|
+
```html
|
|
300
|
+
<calendar ... [dateFormatter]="calendar.dateFormatter"></calendar>
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
calendar = {
|
|
305
|
+
dateFormatter: {
|
|
306
|
+
formatMonthViewDay: function (date: Date) {
|
|
307
|
+
return date.getDate().toString();
|
|
308
|
+
},
|
|
309
|
+
formatMonthViewDayHeader: function (date: Date) {
|
|
310
|
+
return "testMDH";
|
|
311
|
+
},
|
|
312
|
+
formatMonthViewTitle: function (date: Date) {
|
|
313
|
+
return "testMT";
|
|
314
|
+
},
|
|
315
|
+
formatWeekViewDayHeader: function (date: Date) {
|
|
316
|
+
return "testWDH";
|
|
317
|
+
},
|
|
318
|
+
formatWeekViewTitle: function (date: Date) {
|
|
319
|
+
return "testWT";
|
|
320
|
+
},
|
|
321
|
+
formatWeekViewHourColumn: function (date: Date) {
|
|
322
|
+
return "testWH";
|
|
323
|
+
},
|
|
324
|
+
formatDayViewHourColumn: function (date: Date) {
|
|
325
|
+
return "testDH";
|
|
326
|
+
},
|
|
327
|
+
formatDayViewTitle: function (date: Date) {
|
|
328
|
+
return "testDT";
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
- dir
|
|
335
|
+
If set to "rtl", the calendar supports RTL language. This feature is only supported in Ionic 2.3.0 version onwards.
|
|
336
|
+
Default value: ""
|
|
337
|
+
|
|
338
|
+
- scrollToHour
|
|
339
|
+
Make weekview and dayview scroll to the specific hour after entering to the new view.
|
|
340
|
+
Default value: 0
|
|
341
|
+
|
|
342
|
+
- preserveScrollPosition
|
|
343
|
+
If set to true, the previous/next views in weekview and dayview will also scroll to the same position as the current active view.
|
|
344
|
+
Default value: false
|
|
345
|
+
|
|
346
|
+
- lockSwipeToPrev
|
|
347
|
+
If set to true, swiping to previous view is disabled.
|
|
348
|
+
Default value: false
|
|
349
|
+
|
|
350
|
+
```html
|
|
351
|
+
<calendar ... [lockSwipeToPrev]="lockSwipeToPrev"></calendar>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
```typescript
|
|
355
|
+
onCurrentDateChanged(event:Date) {
|
|
356
|
+
var today = new Date();
|
|
357
|
+
today.setHours(0, 0, 0, 0);
|
|
358
|
+
event.setHours(0, 0, 0, 0);
|
|
359
|
+
|
|
360
|
+
if (this.calendar.mode === 'month') {
|
|
361
|
+
if (event.getFullYear() < today.getFullYear() || (event.getFullYear() === today.getFullYear() && event.getMonth() <= today.getMonth())) {
|
|
362
|
+
this.lockSwipeToPrev = true;
|
|
363
|
+
} else {
|
|
364
|
+
this.lockSwipeToPrev = false;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
- lockSwipeToNext (version 1.0.x onwards)
|
|
371
|
+
If set to true, swiping to next view is disabled.
|
|
372
|
+
Default value: false
|
|
373
|
+
|
|
374
|
+
```html
|
|
375
|
+
<calendar ... [lockSwipeToNext]="lockSwipeToNext"></calendar>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
onCurrentDateChanged(event:Date) {
|
|
380
|
+
var today = new Date();
|
|
381
|
+
today.setHours(0, 0, 0, 0);
|
|
382
|
+
event.setHours(0, 0, 0, 0);
|
|
383
|
+
|
|
384
|
+
if (this.calendar.mode === 'month') {
|
|
385
|
+
if (event.getFullYear() > today.getFullYear() || (event.getFullYear() === today.getFullYear() && event.getMonth() >= today.getMonth())) {
|
|
386
|
+
this.lockSwipeToNext = true;
|
|
387
|
+
} else {
|
|
388
|
+
this.lockSwipeToNext = false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
- lockSwipes
|
|
395
|
+
If set to true, swiping is disabled.
|
|
396
|
+
Default value: false
|
|
397
|
+
|
|
398
|
+
**Version 1.x**
|
|
399
|
+
_Note:_ Since swiping is disabled, you could set currentDate or call slideToPrev/slideToNext [method](#instance-methods) to move the calendar to previous/next view. You need to first set the lockSwipes to false, move the slide, then set it back.
|
|
400
|
+
|
|
401
|
+
```html
|
|
402
|
+
<calendar ... [lockSwipes]="lockSwipes"></calendar>
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
moveSlide() {
|
|
407
|
+
this.calendar.lockSwipes = false;
|
|
408
|
+
setTimeout(function() {
|
|
409
|
+
this.myCalendar.slideNext();
|
|
410
|
+
this.calendar.lockSwipes = true;
|
|
411
|
+
},100);
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**Version 0.x**
|
|
416
|
+
_Note:_ Since swiping is disabled, you could set currentDate or call slideToPrev/slideToNext [method](#instance-methods) to move the calendar to previous/next view. Do not set lockSwipeToPrev in the constructor phase. It will cause the view not updating when changing the currentDate. You could either set it in some callback function after initialization phase or use setTimeout to trigger some delay.
|
|
417
|
+
|
|
418
|
+
```html
|
|
419
|
+
<calendar ... [lockSwipes]="lockSwipes"></calendar>
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
ngAfterViewInit() {
|
|
424
|
+
var me = this;
|
|
425
|
+
setTimeout(function() {
|
|
426
|
+
me.lockSwipes = true;
|
|
427
|
+
},100);
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
- startHour
|
|
432
|
+
Limit the weekview and dayview starts from which hour (0-23).
|
|
433
|
+
Default value: 0
|
|
434
|
+
|
|
435
|
+
```html
|
|
436
|
+
<calendar ... startHour="9"></calendar>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
- endHour
|
|
440
|
+
Limit the weekview and dayview ends until which hour (1-24).
|
|
441
|
+
Default value: 24
|
|
442
|
+
|
|
443
|
+
```html
|
|
444
|
+
<calendar ... endHour="19"></calendar>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
- sliderOptions
|
|
448
|
+
Options to pass to the underlying swiper instance. See https://swiperjs.com/swiper-api#parameters for valid options.
|
|
449
|
+
|
|
450
|
+
```html
|
|
451
|
+
<calendar ... sliderOptions="sliderOptions"></calendar>
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
options = {
|
|
456
|
+
spaceBetween: 10,
|
|
457
|
+
threshold: 50,
|
|
458
|
+
};
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
- `dayviewShowCategoryView` (version: 2.4+)
|
|
462
|
+
Determines if show dayview with category
|
|
463
|
+
Type: `boolean`
|
|
464
|
+
Default value: `false`
|
|
465
|
+
|
|
466
|
+
- `dayviewCategorySource` (version: 2.4+)
|
|
467
|
+
Determines the source the category names so that events with corresponding category will display accordingly. If events are not assigned with category, they will NOT be placed in the category view.
|
|
468
|
+
Type: `Set<string>`
|
|
469
|
+
Default value: `null`
|
|
470
|
+
|
|
471
|
+
```html
|
|
472
|
+
<calendar
|
|
473
|
+
...
|
|
474
|
+
[dayviewCategorySource]="calendar.dayviewCategorySource"
|
|
475
|
+
></calendar>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
calendar = {
|
|
480
|
+
dayviewCategorySource: new Set<string>(["Alice", "Bob", "Charlie"]),
|
|
481
|
+
};
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
# Callback
|
|
485
|
+
|
|
486
|
+
- onCurrentDateChanged
|
|
487
|
+
The callback function triggered when the date that is currently viewed changes.
|
|
488
|
+
|
|
489
|
+
```html
|
|
490
|
+
<calendar ... (onCurrentDateChanged)="onCurrentDateChanged($event)"></calendar>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
onCurrentChanged = (ev: Date) => {
|
|
495
|
+
console.log("Currently viewed date: " + ev);
|
|
496
|
+
};
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
- onRangeChanged
|
|
500
|
+
The callback function triggered when the range or mode is changed if the **queryMode** is set to '**remote**'
|
|
501
|
+
The ev parameter contains two fields, startTime and endTime.
|
|
502
|
+
|
|
503
|
+
```html
|
|
504
|
+
<calendar ... (onRangeChanged)="onRangeChanged($event)"></calendar>
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
```typescript
|
|
508
|
+
onRangeChanged = (ev: { startTime: Date; endTime: Date }) => {
|
|
509
|
+
Events.query(ev, (events) => {
|
|
510
|
+
this.eventSource = events;
|
|
511
|
+
});
|
|
512
|
+
};
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
- onEventSelected
|
|
516
|
+
The callback function triggered when an event is clicked
|
|
517
|
+
|
|
518
|
+
```html
|
|
519
|
+
<calendar ... (onEventSelected)="onEventSelected($event)"></calendar>
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
```typescript
|
|
523
|
+
onEventSelected = (event) => {
|
|
524
|
+
console.log(event.title);
|
|
525
|
+
};
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
- onTimeSelected
|
|
529
|
+
The callback function triggered when a time slot is selected.
|
|
530
|
+
The ev parameter contains three fields, selectedTime, events and disabled, if there's no event at the selected time, the events field will be either undefined or empty array
|
|
531
|
+
|
|
532
|
+
```html
|
|
533
|
+
<calendar ... (onTimeSelected)="onTimeSelected($event)"></calendar>
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
```typescript
|
|
537
|
+
onTimeSelected = (ev: {
|
|
538
|
+
selectedTime: Date;
|
|
539
|
+
events: any[];
|
|
540
|
+
disabled: boolean;
|
|
541
|
+
}) => {
|
|
542
|
+
console.log(
|
|
543
|
+
"Selected time: " +
|
|
544
|
+
ev.selectedTime +
|
|
545
|
+
", hasEvents: " +
|
|
546
|
+
(ev.events !== undefined && ev.events.length !== 0) +
|
|
547
|
+
", disabled: " +
|
|
548
|
+
ev.disabled,
|
|
549
|
+
);
|
|
550
|
+
};
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
- onDayHeaderSelected
|
|
554
|
+
The callback function triggered when a day header is selected in week view.
|
|
555
|
+
The ev parameter contains three fields, selectedTime, events and disabled, if there's no event at the selected time, the events field will be either undefined or empty array
|
|
556
|
+
|
|
557
|
+
```html
|
|
558
|
+
<calendar ... (onDayHeaderSelected)="onDayHeaderSelected($event)"></calendar>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
onDayHeaderSelected = (ev: {
|
|
563
|
+
selectedTime: Date;
|
|
564
|
+
events: any[];
|
|
565
|
+
disabled: boolean;
|
|
566
|
+
}) => {
|
|
567
|
+
console.log(
|
|
568
|
+
"Selected day: " +
|
|
569
|
+
ev.selectedTime +
|
|
570
|
+
", hasEvents: " +
|
|
571
|
+
(ev.events !== undefined && ev.events.length !== 0) +
|
|
572
|
+
", disabled: " +
|
|
573
|
+
ev.disabled,
|
|
574
|
+
);
|
|
575
|
+
};
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
- onTitleChanged
|
|
579
|
+
The callback function triggered when the view title is changed
|
|
580
|
+
|
|
581
|
+
```html
|
|
582
|
+
<calendar ... (onTitleChanged)="onViewTitleChanged($event)"></calendar>
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
onViewTitleChanged = (title: string) => {
|
|
587
|
+
this.viewTitle = title;
|
|
588
|
+
};
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
# View Customization Option
|
|
592
|
+
|
|
593
|
+
There are two ways to customize the look and feel. If you just want to simply change the color or size of certain element, you could override the styles of the predefined css classes. **CSS Customization** section lists some important css classes. If you need to change the layout of certain element, you could refer to the **Template Customization** part.
|
|
594
|
+
|
|
595
|
+
## CSS Customization
|
|
596
|
+
|
|
597
|
+
The customized styles should be added in global.scss. Just adding in each components css file may not work due to the View Encapsulation.
|
|
598
|
+
|
|
599
|
+
- monthview-primary-with-event
|
|
600
|
+
The date that is in current month and having events
|
|
601
|
+
|
|
602
|
+
- monthview-secondary-with-event
|
|
603
|
+
The date that is in previous/next month and having events
|
|
604
|
+
|
|
605
|
+
- monthview-selected
|
|
606
|
+
The selected date
|
|
607
|
+
|
|
608
|
+
- monthview-current
|
|
609
|
+
The current date
|
|
610
|
+
|
|
611
|
+
- monthview-disabled
|
|
612
|
+
The disabled date
|
|
613
|
+
|
|
614
|
+
- weekview-with-event
|
|
615
|
+
The date having all day events, applied to the day header in week view
|
|
616
|
+
|
|
617
|
+
- weekview-current
|
|
618
|
+
The current date, applied to the day header in week view
|
|
619
|
+
|
|
620
|
+
- weekview-selected
|
|
621
|
+
The selected date, applied to the day header in week view
|
|
622
|
+
|
|
623
|
+
- weekview-allday-label
|
|
624
|
+
Applied to the all day label in week view
|
|
625
|
+
|
|
626
|
+
- dayview-allday-label
|
|
627
|
+
Applied to the all day label in day view
|
|
628
|
+
|
|
629
|
+
- calendar-hour-column
|
|
630
|
+
Applied to the hour column in both weekview and day view
|
|
631
|
+
|
|
632
|
+
- dayview-category-header (version: 2.4+)
|
|
633
|
+
Applied to the category section in day view
|
|
634
|
+
|
|
635
|
+
- dayview-category-header-item (version: 2.4+)
|
|
636
|
+
Applied to the category header item in day view
|
|
637
|
+
|
|
638
|
+
## Template Customization
|
|
639
|
+
|
|
640
|
+
Note: For any css class appear in the customized template, you need to specify the styles by yourself. The styles defined in the calendar component won’t be applied because of the view encapsulation. You could refer to calendar.ts to get the definition of context types.
|
|
641
|
+
|
|
642
|
+
- monthviewDisplayEventTemplate
|
|
643
|
+
Type: TemplateRef\<IMonthViewDisplayEventTemplateContext\>
|
|
644
|
+
The template provides customized view for event displayed in the active monthview
|
|
645
|
+
|
|
646
|
+
```html
|
|
647
|
+
<ng-template
|
|
648
|
+
#monthviewDisplayEventTemplate
|
|
649
|
+
let-view="view"
|
|
650
|
+
let-row="row"
|
|
651
|
+
let-col="col"
|
|
652
|
+
>
|
|
653
|
+
{{view.dates[row*7+col].label}}
|
|
654
|
+
</ng-template>
|
|
655
|
+
|
|
656
|
+
<calendar
|
|
657
|
+
...
|
|
658
|
+
[monthviewDisplayEventTemplate]="monthviewDisplayEventTemplate"
|
|
659
|
+
></calendar>
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
- monthviewInactiveDisplayEventTemplate
|
|
663
|
+
Type: TemplateRef\<IMonthViewDisplayEventTemplateContext\>
|
|
664
|
+
The template provides customized view for event displayed in the inactive monthview
|
|
665
|
+
|
|
666
|
+
```html
|
|
667
|
+
<ng-template
|
|
668
|
+
#monthviewInactiveDisplayEventTemplate
|
|
669
|
+
let-view="view"
|
|
670
|
+
let-row="row"
|
|
671
|
+
let-col="col"
|
|
672
|
+
>
|
|
673
|
+
{{view.dates[row*7+col].label}}
|
|
674
|
+
</ng-template>
|
|
675
|
+
|
|
676
|
+
<calendar
|
|
677
|
+
...
|
|
678
|
+
[monthviewInactiveDisplayEventTemplate]="monthviewInactiveDisplayEventTemplate"
|
|
679
|
+
></calendar>
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
- monthviewEventDetailTemplate
|
|
683
|
+
Type: TemplateRef\<IMonthViewEventDetailTemplateContext\>
|
|
684
|
+
The template provides customized view for event detail section in the monthview
|
|
685
|
+
|
|
686
|
+
```html
|
|
687
|
+
<ng-template
|
|
688
|
+
#monthviewEventDetailTemplate
|
|
689
|
+
let-showEventDetail="showEventDetail"
|
|
690
|
+
let-selectedDate="selectedDate"
|
|
691
|
+
let-noEventsLabel="noEventsLabel"
|
|
692
|
+
>
|
|
693
|
+
...
|
|
694
|
+
</ng-template>
|
|
695
|
+
|
|
696
|
+
<calendar
|
|
697
|
+
...
|
|
698
|
+
[monthviewEventDetailTemplate]="monthviewEventDetailTemplate"
|
|
699
|
+
></calendar>
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
- weekviewHeaderTemplate (version >= 0.4.5)
|
|
703
|
+
Type: TemplateRef\<IDisplayWeekViewHeader\>
|
|
704
|
+
The template provides customized view for day header in the weekview
|
|
705
|
+
|
|
706
|
+
```html
|
|
707
|
+
<ng-template #weekviewHeaderTemplate let-viewDate="viewDate">
|
|
708
|
+
<div class="custom-day-header">{{ viewDate.dayHeader }}</div>
|
|
709
|
+
</ng-template>
|
|
710
|
+
|
|
711
|
+
<calendar ... [weekviewHeaderTemplate]="weekviewHeaderTemplate"></calendar>
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
- weekviewAllDayEventTemplate
|
|
715
|
+
Type: TemplateRef\<IDisplayAllDayEvent\>
|
|
716
|
+
The template provides customized view for all day event in the weekview
|
|
717
|
+
|
|
718
|
+
```html
|
|
719
|
+
<ng-template #weekviewAllDayEventTemplate let-displayEvent="displayEvent">
|
|
720
|
+
<div class="calendar-event-inner">{{displayEvent.event.title}}</div>
|
|
721
|
+
</ng-template>
|
|
722
|
+
|
|
723
|
+
<calendar
|
|
724
|
+
...
|
|
725
|
+
[weekviewAllDayEventTemplate]="weekviewAllDayEventTemplate"
|
|
726
|
+
></calendar>
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
- weekviewNormalEventTemplate
|
|
730
|
+
Type: TemplateRef\<IDisplayEvent\>
|
|
731
|
+
The template provides customized view for normal event in the weekview
|
|
732
|
+
|
|
733
|
+
```html
|
|
734
|
+
<ng-template #weekviewNormalEventTemplate let-displayEvent="displayEvent">
|
|
735
|
+
<div class="calendar-event-inner">{{displayEvent.event.title}}</div>
|
|
736
|
+
</ng-template>
|
|
737
|
+
|
|
738
|
+
<calendar
|
|
739
|
+
...
|
|
740
|
+
[weekviewNormalEventTemplate]="weekviewNormalEventTemplate"
|
|
741
|
+
></calendar>
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
- dayviewCategoryItemTemplate (version: 2.4+)
|
|
745
|
+
The template provides customized view for category item with categoryId and categoryName in the day view
|
|
746
|
+
|
|
747
|
+
```html
|
|
748
|
+
<ng-template #dayviewCategoryItemTemplate let-category="category">
|
|
749
|
+
{{ category.categoryName }}
|
|
750
|
+
</ng-template>
|
|
751
|
+
|
|
752
|
+
<calendar
|
|
753
|
+
...
|
|
754
|
+
[dayviewCategoryItemTemplate]="dayviewCategoryItemTemplate"
|
|
755
|
+
></calendar>
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
- dayviewAllDayEventTemplate
|
|
759
|
+
Type: TemplateRef\<IDisplayAllDayEvent\>
|
|
760
|
+
The template provides customized view for all day event in the dayview
|
|
761
|
+
|
|
762
|
+
```html
|
|
763
|
+
<ng-template #dayviewAllDayEventTemplate let-displayEvent="displayEvent">
|
|
764
|
+
<div class="calendar-event-inner">{{displayEvent.event.title}}</div>
|
|
765
|
+
</ng-template>
|
|
766
|
+
|
|
767
|
+
<calendar
|
|
768
|
+
...
|
|
769
|
+
[dayviewAllDayEventTemplate]="dayviewAllDayEventTemplate"
|
|
770
|
+
></calendar>
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
- dayviewNormalEventTemplate
|
|
774
|
+
Type: TemplateRef\<IDisplayEvent\>
|
|
775
|
+
The template provides customized view for normal event in the dayview
|
|
776
|
+
|
|
777
|
+
```html
|
|
778
|
+
<ng-template #dayviewNormalEventTemplate let-displayEvent="displayEvent">
|
|
779
|
+
<div class="calendar-event-inner">{{displayEvent.event.title}}</div>
|
|
780
|
+
</ng-template>
|
|
781
|
+
|
|
782
|
+
<calendar
|
|
783
|
+
...
|
|
784
|
+
[dayviewNormalEventTemplate]="dayviewNormalEventTemplate"
|
|
785
|
+
></calendar>
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
- weekviewAllDayEventSectionTemplate (version >= 0.3)
|
|
789
|
+
Type: TemplateRef\<IWeekViewAllDayEventSectionTemplateContext\>
|
|
790
|
+
The template provides customized view for all day event section (table part) in the weekview
|
|
791
|
+
|
|
792
|
+
```html
|
|
793
|
+
<ng-template
|
|
794
|
+
#weekviewAllDayEventSectionTemplate
|
|
795
|
+
let-day="day"
|
|
796
|
+
let-eventTemplate="eventTemplate"
|
|
797
|
+
>
|
|
798
|
+
<div
|
|
799
|
+
[ngClass]="{'calendar-event-wrap': day.events}"
|
|
800
|
+
*ngIf="day.events"
|
|
801
|
+
[ngStyle]="{height: 25*day.events.length+'px'}"
|
|
802
|
+
>
|
|
803
|
+
<div
|
|
804
|
+
*ngFor="let displayEvent of day.events"
|
|
805
|
+
class="calendar-event"
|
|
806
|
+
tappable
|
|
807
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
808
|
+
[ngStyle]="{top: 25*displayEvent.position+'px', width: 100*(displayEvent.endIndex-displayEvent.startIndex)+'%', height: '25px'}"
|
|
809
|
+
>
|
|
810
|
+
<ng-template
|
|
811
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
812
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
813
|
+
>
|
|
814
|
+
</ng-template>
|
|
815
|
+
</div>
|
|
816
|
+
</div>
|
|
817
|
+
</ng-template>
|
|
818
|
+
|
|
819
|
+
<calendar
|
|
820
|
+
...
|
|
821
|
+
[weekviewAllDayEventSectionTemplate]="weekviewAllDayEventSectionTemplate"
|
|
822
|
+
></calendar>
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
- weekviewNormalEventSectionTemplate (version >= 0.3)
|
|
826
|
+
Type: TemplateRef\<IWeekViewNormalEventSectionTemplateContext\>
|
|
827
|
+
The template provides customized view for normal event section (table part) in the weekview
|
|
828
|
+
|
|
829
|
+
```html
|
|
830
|
+
<ng-template
|
|
831
|
+
#weekviewNormalEventSectionTemplate
|
|
832
|
+
let-tm="tm"
|
|
833
|
+
let-hourParts="hourParts"
|
|
834
|
+
let-eventTemplate="eventTemplate"
|
|
835
|
+
>
|
|
836
|
+
<div [ngClass]="{'calendar-event-wrap': tm.events}" *ngIf="tm.events">
|
|
837
|
+
<div
|
|
838
|
+
*ngFor="let displayEvent of tm.events"
|
|
839
|
+
class="calendar-event"
|
|
840
|
+
tappable
|
|
841
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
842
|
+
[ngStyle]="{top: (37*displayEvent.startOffset/hourParts)+'px',left: 100/displayEvent.overlapNumber*displayEvent.position+'%', width: 100/displayEvent.overlapNumber+'%', height: 37*(displayEvent.endIndex -displayEvent.startIndex - (displayEvent.endOffset + displayEvent.startOffset)/hourParts)+'px'}"
|
|
843
|
+
>
|
|
844
|
+
<ng-template
|
|
845
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
846
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
847
|
+
>
|
|
848
|
+
</ng-template>
|
|
849
|
+
</div>
|
|
850
|
+
</div>
|
|
851
|
+
</ng-template>
|
|
852
|
+
|
|
853
|
+
<calendar
|
|
854
|
+
...
|
|
855
|
+
[weekviewNormalEventSectionTemplate]="weekviewNormalEventSectionTemplate"
|
|
856
|
+
></calendar>
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
- dayviewAllDayEventSectionTemplate (version >= 0.3)
|
|
860
|
+
Type: TemplateRef\<IDayViewAllDayEventSectionTemplateContext\>
|
|
861
|
+
The template provides customized view for all day event section (table part) in the dayview
|
|
862
|
+
|
|
863
|
+
```html
|
|
864
|
+
<ng-template
|
|
865
|
+
#dayviewAllDayEventSectionTemplate
|
|
866
|
+
let-allDayEvents="allDayEvents"
|
|
867
|
+
let-eventTemplate="eventTemplate"
|
|
868
|
+
>
|
|
869
|
+
<div
|
|
870
|
+
*ngFor="let displayEvent of allDayEvents; let eventIndex=index"
|
|
871
|
+
class="calendar-event"
|
|
872
|
+
tappable
|
|
873
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
874
|
+
[ngStyle]="{top: 25*eventIndex+'px',width: '100%',height:'25px'}"
|
|
875
|
+
>
|
|
876
|
+
<ng-template
|
|
877
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
878
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
879
|
+
>
|
|
880
|
+
</ng-template>
|
|
881
|
+
</div>
|
|
882
|
+
</ng-template>
|
|
883
|
+
|
|
884
|
+
<calendar
|
|
885
|
+
...
|
|
886
|
+
[dayviewAllDayEventSectionTemplate]="dayviewAllDayEventSectionTemplate"
|
|
887
|
+
></calendar>
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
- dayviewNormalEventSectionTemplate (version >= 0.3)
|
|
891
|
+
Type: TemplateRef\<IDayViewNormalEventSectionTemplateContext\>
|
|
892
|
+
The template provides customized view for normal event section (table part) in the dayview
|
|
893
|
+
|
|
894
|
+
```html
|
|
895
|
+
<ng-template
|
|
896
|
+
#dayviewNormalEventSectionTemplate
|
|
897
|
+
let-tm="tm"
|
|
898
|
+
let-hourParts="hourParts"
|
|
899
|
+
let-eventTemplate="eventTemplate"
|
|
900
|
+
>
|
|
901
|
+
<div [ngClass]="{'calendar-event-wrap': tm.events}" *ngIf="tm.events">
|
|
902
|
+
<div
|
|
903
|
+
*ngFor="let displayEvent of tm.events"
|
|
904
|
+
class="calendar-event"
|
|
905
|
+
tappable
|
|
906
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
907
|
+
[ngStyle]="{top: (37*displayEvent.startOffset/hourParts)+'px',left: 100/displayEvent.overlapNumber*displayEvent.position+'%', width: 100/displayEvent.overlapNumber+'%', height: 37*(displayEvent.endIndex -displayEvent.startIndex - (displayEvent.endOffset + displayEvent.startOffset)/hourParts)+'px'}"
|
|
908
|
+
>
|
|
909
|
+
<ng-template
|
|
910
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
911
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
912
|
+
>
|
|
913
|
+
</ng-template>
|
|
914
|
+
</div>
|
|
915
|
+
</div>
|
|
916
|
+
</ng-template>
|
|
917
|
+
|
|
918
|
+
<calendar
|
|
919
|
+
...
|
|
920
|
+
[dayviewNormalEventSectionTemplate]="dayviewNormalEventSectionTemplate"
|
|
921
|
+
></calendar>
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
- weekviewInactiveAllDayEventSectionTemplate (version >= 0.5)
|
|
925
|
+
Type: TemplateRef\<IWeekViewAllDayEventSectionTemplateContext\>
|
|
926
|
+
The template provides customized view for all day event section (table part) in the inactive weekview
|
|
927
|
+
|
|
928
|
+
```html
|
|
929
|
+
<ng-template
|
|
930
|
+
#weekviewInactiveAllDayEventSectionTemplate
|
|
931
|
+
let-day="day"
|
|
932
|
+
let-eventTemplate="eventTemplate"
|
|
933
|
+
>
|
|
934
|
+
<div
|
|
935
|
+
[ngClass]="{'calendar-event-wrap': day.events}"
|
|
936
|
+
*ngIf="day.events"
|
|
937
|
+
[ngStyle]="{height: 25*day.events.length+'px'}"
|
|
938
|
+
>
|
|
939
|
+
<div
|
|
940
|
+
*ngFor="let displayEvent of day.events"
|
|
941
|
+
class="calendar-event"
|
|
942
|
+
tappable
|
|
943
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
944
|
+
[ngStyle]="{top: 25*displayEvent.position+'px', width: 100*(displayEvent.endIndex-displayEvent.startIndex)+'%', height: '25px'}"
|
|
945
|
+
>
|
|
946
|
+
<ng-template
|
|
947
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
948
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
949
|
+
>
|
|
950
|
+
</ng-template>
|
|
951
|
+
</div>
|
|
952
|
+
</div>
|
|
953
|
+
</ng-template>
|
|
954
|
+
|
|
955
|
+
<calendar
|
|
956
|
+
...
|
|
957
|
+
[weekviewInactiveAllDayEventSectionTemplate]="weekviewInactiveAllDayEventSectionTemplate"
|
|
958
|
+
></calendar>
|
|
959
|
+
```
|
|
960
|
+
|
|
961
|
+
- weekviewInactiveNormalEventSectionTemplate (version >= 0.5)
|
|
962
|
+
Type: TemplateRef\<IWeekViewNormalEventSectionTemplateContext\>
|
|
963
|
+
The template provides customized view for normal event section (table part) in the inactive weekview
|
|
964
|
+
|
|
965
|
+
```html
|
|
966
|
+
<ng-template
|
|
967
|
+
#weekviewInactiveNormalEventSectionTemplate
|
|
968
|
+
let-tm="tm"
|
|
969
|
+
let-hourParts="hourParts"
|
|
970
|
+
let-eventTemplate="eventTemplate"
|
|
971
|
+
>
|
|
972
|
+
<div [ngClass]="{'calendar-event-wrap': tm.events}" *ngIf="tm.events">
|
|
973
|
+
<div
|
|
974
|
+
*ngFor="let displayEvent of tm.events"
|
|
975
|
+
class="calendar-event"
|
|
976
|
+
tappable
|
|
977
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
978
|
+
[ngStyle]="{top: (37*displayEvent.startOffset/hourParts)+'px',left: 100/displayEvent.overlapNumber*displayEvent.position+'%', width: 100/displayEvent.overlapNumber+'%', height: 37*(displayEvent.endIndex -displayEvent.startIndex - (displayEvent.endOffset + displayEvent.startOffset)/hourParts)+'px'}"
|
|
979
|
+
>
|
|
980
|
+
<ng-template
|
|
981
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
982
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
983
|
+
>
|
|
984
|
+
</ng-template>
|
|
985
|
+
</div>
|
|
986
|
+
</div>
|
|
987
|
+
</ng-template>
|
|
988
|
+
|
|
989
|
+
<calendar
|
|
990
|
+
...
|
|
991
|
+
[weekviewInactiveNormalEventSectionTemplate]="weekviewInactiveNormalEventSectionTemplate"
|
|
992
|
+
></calendar>
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
- dayviewInactiveAllDayEventSectionTemplate (version >= 0.5)
|
|
996
|
+
Type: TemplateRef\<IDayViewAllDayEventSectionTemplateContext\>
|
|
997
|
+
The template provides customized view for all day event section (table part) in the inactive dayview
|
|
998
|
+
|
|
999
|
+
```html
|
|
1000
|
+
<ng-template
|
|
1001
|
+
#dayviewInactiveAllDayEventSectionTemplate
|
|
1002
|
+
let-allDayEvents="allDayEvents"
|
|
1003
|
+
let-eventTemplate="eventTemplate"
|
|
1004
|
+
>
|
|
1005
|
+
<div
|
|
1006
|
+
*ngFor="let displayEvent of allDayEvents; let eventIndex=index"
|
|
1007
|
+
class="calendar-event"
|
|
1008
|
+
tappable
|
|
1009
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
1010
|
+
[ngStyle]="{top: 25*eventIndex+'px',width: '100%',height:'25px'}"
|
|
1011
|
+
>
|
|
1012
|
+
<ng-template
|
|
1013
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
1014
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
1015
|
+
>
|
|
1016
|
+
</ng-template>
|
|
1017
|
+
</div>
|
|
1018
|
+
</ng-template>
|
|
1019
|
+
|
|
1020
|
+
<calendar
|
|
1021
|
+
...
|
|
1022
|
+
[dayviewInactiveAllDayEventSectionTemplate]="dayviewInactiveAllDayEventSectionTemplate"
|
|
1023
|
+
></calendar>
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
- dayviewInactiveNormalEventSectionTemplate (version >= 0.5)
|
|
1027
|
+
Type: TemplateRef\<IDayViewNormalEventSectionTemplateContext\>
|
|
1028
|
+
The template provides customized view for normal event section (table part) in the inactive dayview
|
|
1029
|
+
|
|
1030
|
+
```html
|
|
1031
|
+
<ng-template
|
|
1032
|
+
#dayviewInactiveNormalEventSectionTemplate
|
|
1033
|
+
let-tm="tm"
|
|
1034
|
+
let-hourParts="hourParts"
|
|
1035
|
+
let-eventTemplate="eventTemplate"
|
|
1036
|
+
>
|
|
1037
|
+
<div [ngClass]="{'calendar-event-wrap': tm.events}" *ngIf="tm.events">
|
|
1038
|
+
<div
|
|
1039
|
+
*ngFor="let displayEvent of tm.events"
|
|
1040
|
+
class="calendar-event"
|
|
1041
|
+
tappable
|
|
1042
|
+
(click)="onEventSelected(displayEvent.event)"
|
|
1043
|
+
[ngStyle]="{top: (37*displayEvent.startOffset/hourParts)+'px',left: 100/displayEvent.overlapNumber*displayEvent.position+'%', width: 100/displayEvent.overlapNumber+'%', height: 37*(displayEvent.endIndex -displayEvent.startIndex - (displayEvent.endOffset + displayEvent.startOffset)/hourParts)+'px'}"
|
|
1044
|
+
>
|
|
1045
|
+
<ng-template
|
|
1046
|
+
[ngTemplateOutlet]="eventTemplate"
|
|
1047
|
+
[ngTemplateOutletContext]="{displayEvent:displayEvent}"
|
|
1048
|
+
>
|
|
1049
|
+
</ng-template>
|
|
1050
|
+
</div>
|
|
1051
|
+
</div>
|
|
1052
|
+
</ng-template>
|
|
1053
|
+
|
|
1054
|
+
<calendar
|
|
1055
|
+
...
|
|
1056
|
+
[dayviewInactiveNormalEventSectionTemplate]="dayviewInactiveNormalEventSectionTemplate"
|
|
1057
|
+
></calendar>
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
# EventSource
|
|
1061
|
+
|
|
1062
|
+
EventSource is an array of event object which contains at least below fields:
|
|
1063
|
+
|
|
1064
|
+
- title
|
|
1065
|
+
Type: `string`
|
|
1066
|
+
|
|
1067
|
+
- startTime
|
|
1068
|
+
Type: `Date`
|
|
1069
|
+
If allDay is set to true, the startTime has to be as a UTC date which time is set to 0:00 AM, because in an allDay event, only the date is considered, the exact time or timezone doesn't matter.
|
|
1070
|
+
For example, if an allDay event starting from 2014-05-09, then startTime is
|
|
1071
|
+
|
|
1072
|
+
```javascript
|
|
1073
|
+
var startTime = new Date(Date.UTC(2014, 4, 8));
|
|
1074
|
+
```
|
|
1075
|
+
|
|
1076
|
+
- endTime
|
|
1077
|
+
Type: `Date`
|
|
1078
|
+
If allDay is set to true, the startTime has to be as a UTC date which time is set to 0:00 AM, because in an allDay event, only the date is considered, the exact time or timezone doesn't matter.
|
|
1079
|
+
For example, if an allDay event ending to 2014-05-10, then endTime is
|
|
1080
|
+
|
|
1081
|
+
```javascript
|
|
1082
|
+
var endTime = new Date(Date.UTC(2014, 4, 9));
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
- allDay
|
|
1086
|
+
Type: `boolean`
|
|
1087
|
+
Indicates the event is allDay event or regular event
|
|
1088
|
+
|
|
1089
|
+
- category (optional)
|
|
1090
|
+
Type: `string`
|
|
1091
|
+
Indicates which category the event belongs to. If the value is specified but not one of `dayviewCategorySource`, the event will not display in category view.
|
|
1092
|
+
|
|
1093
|
+
**Note** The calendar only watches for the eventSource reference for performance consideration. That means only you manually reassign the eventSource value, the calendar gets notified, and this is usually fit to the scenario when the range is changed, you load a new data set from the backend. In case you want to manually insert/remove/update the element in the eventSource array, you can call [instance method](#instance-methods) ‘loadEvents’ event to notify the calendar manually.
|
|
1094
|
+
|
|
1095
|
+
# Instance Methods
|
|
1096
|
+
|
|
1097
|
+
- loadEvents
|
|
1098
|
+
When this method is called, the calendar will be forced to reload the events in the eventSource array. This is only necessary when you directly modify the element in the eventSource array.
|
|
1099
|
+
|
|
1100
|
+
```typescript
|
|
1101
|
+
import { CalendarComponent } from "ionic2-calendar";
|
|
1102
|
+
|
|
1103
|
+
@Component({
|
|
1104
|
+
selector: 'page-home',
|
|
1105
|
+
templateUrl: 'home.html'
|
|
1106
|
+
})
|
|
1107
|
+
export class HomePage {
|
|
1108
|
+
@ViewChild(CalendarComponent, null) myCalendar:CalendarComponent;
|
|
1109
|
+
eventSource;
|
|
1110
|
+
…
|
|
1111
|
+
loadEvents: function() {
|
|
1112
|
+
this.eventSource.push({
|
|
1113
|
+
title: 'test',
|
|
1114
|
+
startTime: startTime,
|
|
1115
|
+
endTime: endTime,
|
|
1116
|
+
allDay: false
|
|
1117
|
+
});
|
|
1118
|
+
this.myCalendar.loadEvents();
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
```
|
|
1122
|
+
|
|
1123
|
+
- slideNext (version >= 0.5)
|
|
1124
|
+
Slide the calendar to the next date range.
|
|
1125
|
+
|
|
1126
|
+
```typescript
|
|
1127
|
+
import { CalendarComponent } from "ionic2-calendar";
|
|
1128
|
+
|
|
1129
|
+
@Component({
|
|
1130
|
+
selector: 'page-home',
|
|
1131
|
+
templateUrl: 'home.html'
|
|
1132
|
+
})
|
|
1133
|
+
export class HomePage {
|
|
1134
|
+
@ViewChild(CalendarComponent, null) myCalendar:CalendarComponent;
|
|
1135
|
+
…
|
|
1136
|
+
slideNext: function() {
|
|
1137
|
+
this.myCalendar.slideNext();
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
- slidePrev (version >= 0.5)
|
|
1143
|
+
Slide the calendar to the previous date range.
|
|
1144
|
+
|
|
1145
|
+
```typescript
|
|
1146
|
+
import { CalendarComponent } from "ionic2-calendar";
|
|
1147
|
+
|
|
1148
|
+
@Component({
|
|
1149
|
+
selector: 'page-home',
|
|
1150
|
+
templateUrl: 'home.html'
|
|
1151
|
+
})
|
|
1152
|
+
export class HomePage {
|
|
1153
|
+
@ViewChild(CalendarComponent, null) myCalendar:CalendarComponent;
|
|
1154
|
+
…
|
|
1155
|
+
slidePrev: function() {
|
|
1156
|
+
this.myCalendar.slidePrev();
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
```
|
|
1160
|
+
|
|
1161
|
+
- update (version >= 0.6.5)
|
|
1162
|
+
Update the underlying slides.
|
|
1163
|
+
|
|
1164
|
+
```typescript
|
|
1165
|
+
import { CalendarComponent } from "ionic2-calendar";
|
|
1166
|
+
|
|
1167
|
+
@Component({
|
|
1168
|
+
selector: 'page-home',
|
|
1169
|
+
templateUrl: 'home.html'
|
|
1170
|
+
})
|
|
1171
|
+
export class HomePage {
|
|
1172
|
+
@ViewChild(CalendarComponent, null) myCalendar:CalendarComponent;
|
|
1173
|
+
…
|
|
1174
|
+
slidePrev: function() {
|
|
1175
|
+
this.myCalendar.update();
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
# Localization
|
|
1181
|
+
|
|
1182
|
+
You could use _locale_ option to achieve the localization.
|
|
1183
|
+
If locale option is not specified, the calendar will use the LOCALE_ID set at the module level.
|
|
1184
|
+
By default, the LOCALE_ID is **en-US**. You can override it in the module as below. If you pass **undefined**, the LOCALE_ID will be detected using the browser language setting. But using explicit value is recommended, as browser has different level of localization support.
|
|
1185
|
+
Note that the event detail section in the month view doesn't support _locale_ option, only LOCALE_ID takes effect. This is because it uses DatePipe in html directly. You could easily leverage customized event detail template to switch to other locale.
|
|
1186
|
+
|
|
1187
|
+
```typescript
|
|
1188
|
+
import { NgModule, LOCALE_ID } from '@angular/core';
|
|
1189
|
+
|
|
1190
|
+
@NgModule({
|
|
1191
|
+
…
|
|
1192
|
+
providers: [
|
|
1193
|
+
{ provide: LOCALE_ID, useValue: 'zh-CN' }
|
|
1194
|
+
]
|
|
1195
|
+
})
|
|
1196
|
+
```
|
|
1197
|
+
|
|
1198
|
+
For version 0.4.x+ which depends on Ionic 3.9.2+ and Angular 5.0+, locale module needs to be registered explicitly in module file as below.
|
|
1199
|
+
|
|
1200
|
+
```typescript
|
|
1201
|
+
import { registerLocaleData } from "@angular/common";
|
|
1202
|
+
import localeZh from "@angular/common/locales/zh";
|
|
1203
|
+
registerLocaleData(localeZh);
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
If you want to change the locale dynamically, you should use _locale_ option instead of LOCALE_ID.
|
|
1207
|
+
|
|
1208
|
+
# Performance Tuning
|
|
1209
|
+
|
|
1210
|
+
In the CPU profile, the default Intl based localization code occupies a big portion of the execution time. If you don’t need localization on certain parts, you can use the custom dateFormatter to override the date transform method. For example, the date in month view usually doesn’t require localization, you could use below code to just display the date part. If the month view day header doesn’t need to include the date, you could also use a string array containing static labels to save the date calculation.
|
|
1211
|
+
|
|
1212
|
+
```html
|
|
1213
|
+
<calendar ... [dateFormatter]="calendar.dateFormatter"></calendar>
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
```typescript
|
|
1217
|
+
calendar = {
|
|
1218
|
+
dateFormatter: {
|
|
1219
|
+
formatMonthViewDay: function (date: Date) {
|
|
1220
|
+
return date.getDate().toString();
|
|
1221
|
+
},
|
|
1222
|
+
},
|
|
1223
|
+
};
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
# Known issue (No longer exists in version 1.0.x)
|
|
1227
|
+
|
|
1228
|
+
This component updates the ion-slide dynamically so that only 3 looped slides are needed.
|
|
1229
|
+
The ion-slide in Ionic2 uses Swiper. It seems in the Swiper implementation, the next slide after the end of looped slide is a separate cached slide, instead of the first slide.
|
|
1230
|
+
I can't find out a way to force refresh that cached slide, so you will notice that when sliding from the third month to the forth month, the preview month is not the forth month, but the first month.
|
|
1231
|
+
Once the sliding is over, the slide will be forced to render the forth month.
|
|
1232
|
+
|
|
1233
|
+
# Common Questions
|
|
1234
|
+
|
|
1235
|
+
- Error: Cannot find module "intl"
|
|
1236
|
+
Answer: This calendar has dependency on 'Intl'. Run _npm install intl@1.2.5_ to install the dependency
|
|
1237
|
+
|
|
1238
|
+
- Error: Cannot read property 'getFullYear' of undefined
|
|
1239
|
+
Answer: If you bind currentDate like this: [currentDate]="calendar.currentDate". You need to assign calendar.currentDate a valid Date object
|
|
1240
|
+
|
|
1241
|
+
- How to switch the calendar to previous/next month programmatically?
|
|
1242
|
+
Answer: You can change currentDate to the date in previous/next month. You could also call the instance method slideNext/slidePrev.
|
|
1243
|
+
|
|
1244
|
+
- Error: Cannot read property 'dayHeaders' of undefined
|
|
1245
|
+
Answer: Take a look at the Localization section. For version 0.4.x+, you need to manually register the locale.
|
|
1246
|
+
|
|
1247
|
+
- Error: TypeError: event_1.startTime.getTime is not a function
|
|
1248
|
+
Answer: This is due to the startTime field of the event object is not a valid Date object. Be aware that different browser has different implementation of new Date() constructor. Some date string format may not be supported. It is recommended to use millisecond or year/month/date parameters.
|
|
1249
|
+
|
|
1250
|
+
- Error: How to override css
|
|
1251
|
+
Answer: By default, the css applied on each component is view encapsulated, for example, .table-bordered[_ngcontent-jto-c5]. You need to remove the encapsulated part.
|
|
1252
|
+
|
|
1253
|
+
```css
|
|
1254
|
+
.table-bordered[_ngcontent-jto-c5] {
|
|
1255
|
+
border: 1px solid #ddd !important;
|
|
1256
|
+
}
|
|
1257
|
+
```
|