@syncfusion/ej2-calendars 24.2.3 → 24.2.5

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/ej2-calendars.min.js +2 -2
  3. package/dist/ej2-calendars.umd.min.js +2 -2
  4. package/dist/ej2-calendars.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-calendars.es2015.js +93 -24
  6. package/dist/es6/ej2-calendars.es2015.js.map +1 -1
  7. package/dist/es6/ej2-calendars.es5.js +93 -24
  8. package/dist/es6/ej2-calendars.es5.js.map +1 -1
  9. package/dist/global/ej2-calendars.min.js +2 -2
  10. package/dist/global/ej2-calendars.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/calendar/calendar.d.ts +2 -0
  14. package/src/calendar/calendar.js +86 -21
  15. package/src/datepicker/datepicker.js +7 -3
  16. package/styles/bootstrap-dark.css +2 -2
  17. package/styles/bootstrap.css +1 -1
  18. package/styles/bootstrap4.css +2 -2
  19. package/styles/bootstrap5-dark.css +1 -1
  20. package/styles/bootstrap5.css +1 -1
  21. package/styles/calendar/_bootstrap-dark-definition.scss +2 -2
  22. package/styles/calendar/_bootstrap4-definition.scss +2 -2
  23. package/styles/calendar/_material-dark-definition.scss +1 -1
  24. package/styles/calendar/_material-definition.scss +1 -1
  25. package/styles/calendar/_material3-definition.scss +1 -1
  26. package/styles/calendar/_theme.scss +1 -1
  27. package/styles/calendar/bootstrap-dark.css +2 -2
  28. package/styles/calendar/bootstrap.css +1 -1
  29. package/styles/calendar/bootstrap4.css +2 -2
  30. package/styles/calendar/bootstrap5-dark.css +1 -1
  31. package/styles/calendar/bootstrap5.css +1 -1
  32. package/styles/calendar/fabric-dark.css +1 -1
  33. package/styles/calendar/fabric.css +1 -1
  34. package/styles/calendar/fluent-dark.css +1 -1
  35. package/styles/calendar/fluent.css +1 -1
  36. package/styles/calendar/highcontrast-light.css +1 -1
  37. package/styles/calendar/highcontrast.css +1 -1
  38. package/styles/calendar/material-dark.css +10 -10
  39. package/styles/calendar/material.css +10 -10
  40. package/styles/calendar/material3-dark.css +10 -10
  41. package/styles/calendar/material3.css +10 -10
  42. package/styles/calendar/tailwind-dark.css +1 -1
  43. package/styles/calendar/tailwind.css +1 -1
  44. package/styles/fabric-dark.css +1 -1
  45. package/styles/fabric.css +1 -1
  46. package/styles/fluent-dark.css +1 -1
  47. package/styles/fluent.css +1 -1
  48. package/styles/highcontrast-light.css +1 -1
  49. package/styles/highcontrast.css +1 -1
  50. package/styles/material-dark.css +10 -10
  51. package/styles/material.css +10 -10
  52. package/styles/material3-dark.css +10 -10
  53. package/styles/material3.css +10 -10
  54. package/styles/tailwind-dark.css +1 -1
  55. package/styles/tailwind.css +1 -1
@@ -19,6 +19,7 @@ const DEVICE = 'e-device';
19
19
  const HEADER = 'e-header';
20
20
  const RTL = 'e-rtl';
21
21
  const CONTENT = 'e-content';
22
+ const CONTENTTABLE = 'e-content-table';
22
23
  const YEAR = 'e-year';
23
24
  const MONTH = 'e-month';
24
25
  const DECADE = 'e-decade';
@@ -34,6 +35,7 @@ const WEEKEND = 'e-weekend';
34
35
  const WEEKNUMBER = 'e-week-number';
35
36
  const SELECTED = 'e-selected';
36
37
  const FOCUSEDDATE = 'e-focused-date';
38
+ const FOCUSEDCELL = 'e-focused-cell';
37
39
  const OTHERMONTHROW = 'e-month-hide';
38
40
  const TODAY = 'e-today';
39
41
  const TITLE = 'e-title';
@@ -212,6 +214,7 @@ let CalendarBase = class CalendarBase extends Component {
212
214
  const ariaTitleAttrs = {
213
215
  'aria-atomic': 'true', 'aria-live': 'assertive', 'aria-label': 'title'
214
216
  };
217
+ const tabIndexAttr = { 'tabindex': '0' };
215
218
  this.headerElement = this.createElement('div', { className: HEADER });
216
219
  const iconContainer = this.createElement('div', { className: ICONCONTAINER });
217
220
  this.previousIcon = this.createElement('button', { className: '' + PREVICON, attrs: { type: 'button' } });
@@ -221,6 +224,7 @@ let CalendarBase = class CalendarBase extends Component {
221
224
  isCenterRipple: true
222
225
  });
223
226
  attributes(this.previousIcon, ariaPrevAttrs);
227
+ attributes(this.previousIcon, tabIndexAttr);
224
228
  this.nextIcon = this.createElement('button', { className: '' + NEXTICON, attrs: { type: 'button' } });
225
229
  rippleEffect(this.nextIcon, {
226
230
  selector: '.e-next',
@@ -232,8 +236,10 @@ let CalendarBase = class CalendarBase extends Component {
232
236
  attributes(this.nextIcon, { tabIndex: '-1' });
233
237
  }
234
238
  attributes(this.nextIcon, ariaNextAttrs);
239
+ attributes(this.nextIcon, tabIndexAttr);
235
240
  this.headerTitleElement = this.createElement('div', { className: '' + LINK + ' ' + TITLE });
236
241
  attributes(this.headerTitleElement, ariaTitleAttrs);
242
+ attributes(this.headerTitleElement, tabIndexAttr);
237
243
  this.headerElement.appendChild(this.headerTitleElement);
238
244
  this.previousIcon.appendChild(this.createElement('span', { className: '' + PREVSPAN + ' ' + ICON }));
239
245
  this.nextIcon.appendChild(this.createElement('span', { className: '' + NEXTSPAN + ' ' + ICON }));
@@ -250,7 +256,7 @@ let CalendarBase = class CalendarBase extends Component {
250
256
  }
251
257
  createContent() {
252
258
  this.contentElement = this.createElement('div', { className: CONTENT });
253
- this.table = this.createElement('table', { attrs: { tabIndex: '0', 'role': 'grid', 'aria-activedescendant': '', 'aria-labelledby': this.element.id } });
259
+ this.table = this.createElement('table', { attrs: { 'class': CONTENTTABLE, 'tabIndex': '0', 'role': 'grid', 'aria-activedescendant': '', 'aria-labelledby': this.element.id } });
254
260
  if (this.getModuleName() === 'calendar') {
255
261
  this.element.appendChild(this.contentElement);
256
262
  }
@@ -263,6 +269,30 @@ let CalendarBase = class CalendarBase extends Component {
263
269
  if (this.showTodayButton) {
264
270
  this.createContentFooter();
265
271
  }
272
+ if (this.getModuleName() != 'daterangepicker') {
273
+ EventHandler.add(this.table, 'focus', this.addContentFocus, this);
274
+ EventHandler.add(this.table, 'blur', this.removeContentFocus, this);
275
+ }
276
+ }
277
+ addContentFocus(args) {
278
+ const focusedDate = this.tableBodyElement.querySelector('tr td.e-focused-date');
279
+ const selectedDate = this.tableBodyElement.querySelector('tr td.e-selected');
280
+ if (!isNullOrUndefined(selectedDate)) {
281
+ selectedDate.classList.add(FOCUSEDCELL);
282
+ }
283
+ else if (!isNullOrUndefined(focusedDate)) {
284
+ focusedDate.classList.add(FOCUSEDCELL);
285
+ }
286
+ }
287
+ removeContentFocus(args) {
288
+ const focusedDate = this.tableBodyElement.querySelector('tr td.e-focused-date');
289
+ const selectedDate = this.tableBodyElement.querySelector('tr td.e-selected');
290
+ if (!isNullOrUndefined(selectedDate)) {
291
+ selectedDate.classList.remove(FOCUSEDCELL);
292
+ }
293
+ else if (!isNullOrUndefined(focusedDate)) {
294
+ focusedDate.classList.remove(FOCUSEDCELL);
295
+ }
266
296
  }
267
297
  getCultureValues() {
268
298
  const culShortNames = [];
@@ -346,6 +376,7 @@ let CalendarBase = class CalendarBase extends Component {
346
376
  updateFooter() {
347
377
  this.todayElement.textContent = this.l10.getConstant('today');
348
378
  this.todayElement.setAttribute('aria-label', this.l10.getConstant('today'));
379
+ this.todayElement.setAttribute('tabindex', '0');
349
380
  }
350
381
  createContentFooter() {
351
382
  if (this.showTodayButton) {
@@ -450,34 +481,54 @@ let CalendarBase = class CalendarBase extends Component {
450
481
  this.effect = '';
451
482
  switch (e.action) {
452
483
  case 'moveLeft':
453
- this.keyboardNavigate(-1, view, e, this.max, this.min);
454
- e.preventDefault();
484
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
485
+ this.keyboardNavigate(-1, view, e, this.max, this.min);
486
+ e.preventDefault();
487
+ }
455
488
  break;
456
489
  case 'moveRight':
457
- this.keyboardNavigate(1, view, e, this.max, this.min);
458
- e.preventDefault();
490
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
491
+ this.keyboardNavigate(1, view, e, this.max, this.min);
492
+ e.preventDefault();
493
+ }
459
494
  break;
460
495
  case 'moveUp':
461
- if (view === 0) {
462
- this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
463
- }
464
- else {
465
- this.keyboardNavigate(-4, view, e, this.max, this.min); // move the current year to the previous four days.
496
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
497
+ if (view === 0) {
498
+ this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
499
+ }
500
+ else {
501
+ this.keyboardNavigate(-4, view, e, this.max, this.min); // move the current year to the previous four days.
502
+ }
503
+ e.preventDefault();
466
504
  }
467
- e.preventDefault();
468
505
  break;
469
506
  case 'moveDown':
470
- if (view === 0) {
471
- this.keyboardNavigate(7, view, e, this.max, this.min);
472
- }
473
- else {
474
- this.keyboardNavigate(4, view, e, this.max, this.min);
507
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains('e-content-table')) {
508
+ if (view === 0) {
509
+ this.keyboardNavigate(7, view, e, this.max, this.min);
510
+ }
511
+ else {
512
+ this.keyboardNavigate(4, view, e, this.max, this.min);
513
+ }
514
+ e.preventDefault();
475
515
  }
476
- e.preventDefault();
477
516
  break;
478
517
  case 'select':
479
- if (e.target === this.todayElement) {
518
+ if (e.target === this.headerTitleElement) {
519
+ this.navigateTitle(e);
520
+ }
521
+ else if (e.target === this.previousIcon) {
522
+ this.navigatePrevious(e);
523
+ }
524
+ else if (e.target === this.nextIcon) {
525
+ this.navigateNext(e);
526
+ }
527
+ else if (e.target === this.todayElement) {
480
528
  this.todayButtonClick(e, value);
529
+ if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
530
+ this.element.focus();
531
+ }
481
532
  }
482
533
  else {
483
534
  const element = !isNullOrUndefined(focusedDate) ? focusedDate : selectedDate;
@@ -490,6 +541,9 @@ let CalendarBase = class CalendarBase extends Component {
490
541
  else {
491
542
  this.contentClick(null, --view, (element), value);
492
543
  }
544
+ if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
545
+ this.element.focus();
546
+ }
493
547
  }
494
548
  }
495
549
  break;
@@ -559,9 +613,20 @@ let CalendarBase = class CalendarBase extends Component {
559
613
  this.navigateTo('Month', new Date(this.currentDate.getFullYear(), 11, 31));
560
614
  e.preventDefault();
561
615
  break;
562
- }
563
- if (this.getModuleName() === 'calendar') {
564
- this.table.focus();
616
+ case 'tab':
617
+ if ((this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') && e.target === this.todayElement) {
618
+ e.preventDefault();
619
+ this.element.focus();
620
+ this.hide();
621
+ }
622
+ break;
623
+ case 'shiftTab':
624
+ if ((this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') && e.target === this.headerTitleElement) {
625
+ e.preventDefault();
626
+ this.element.focus();
627
+ this.hide();
628
+ }
629
+ break;
565
630
  }
566
631
  }
567
632
  keyboardNavigate(number, currentView, e, max, min) {
@@ -3801,8 +3866,6 @@ let DatePicker = class DatePicker extends Calendar {
3801
3866
  this.inputElement.focus();
3802
3867
  }
3803
3868
  break;
3804
- case 'tab':
3805
- this.hide(e);
3806
3869
  }
3807
3870
  }
3808
3871
  inputFocusHandler() {
@@ -3964,7 +4027,13 @@ let DatePicker = class DatePicker extends Calendar {
3964
4027
  this.inputElement.selectionStart = start;
3965
4028
  this.inputElement.selectionEnd = end;
3966
4029
  }
3967
- this.hide(e);
4030
+ if (e.action === 'tab' && e.target === this.inputElement && this.isCalendar() && document.activeElement === this.inputElement) {
4031
+ e.preventDefault();
4032
+ this.headerTitleElement.focus();
4033
+ }
4034
+ if (e.action === 'shiftTab' && e.target === this.inputElement && this.isCalendar() && document.activeElement === this.inputElement) {
4035
+ this.hide(e);
4036
+ }
3968
4037
  break;
3969
4038
  }
3970
4039
  default: