@syncfusion/ej2-calendars 24.2.3 → 24.2.8

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 (58) hide show
  1. package/CHANGELOG.md +18 -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 +103 -40
  6. package/dist/es6/ej2-calendars.es2015.js.map +1 -1
  7. package/dist/es6/ej2-calendars.es5.js +103 -40
  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/src/daterangepicker/daterangepicker.d.ts +0 -2
  17. package/src/daterangepicker/daterangepicker.js +8 -12
  18. package/src/maskbase/masked-date-time.js +2 -4
  19. package/styles/bootstrap-dark.css +2 -2
  20. package/styles/bootstrap.css +1 -1
  21. package/styles/bootstrap4.css +2 -2
  22. package/styles/bootstrap5-dark.css +1 -1
  23. package/styles/bootstrap5.css +1 -1
  24. package/styles/calendar/_bootstrap-dark-definition.scss +2 -2
  25. package/styles/calendar/_bootstrap4-definition.scss +2 -2
  26. package/styles/calendar/_material-dark-definition.scss +1 -1
  27. package/styles/calendar/_material-definition.scss +1 -1
  28. package/styles/calendar/_material3-definition.scss +1 -1
  29. package/styles/calendar/_theme.scss +1 -1
  30. package/styles/calendar/bootstrap-dark.css +2 -2
  31. package/styles/calendar/bootstrap.css +1 -1
  32. package/styles/calendar/bootstrap4.css +2 -2
  33. package/styles/calendar/bootstrap5-dark.css +1 -1
  34. package/styles/calendar/bootstrap5.css +1 -1
  35. package/styles/calendar/fabric-dark.css +1 -1
  36. package/styles/calendar/fabric.css +1 -1
  37. package/styles/calendar/fluent-dark.css +1 -1
  38. package/styles/calendar/fluent.css +1 -1
  39. package/styles/calendar/highcontrast-light.css +1 -1
  40. package/styles/calendar/highcontrast.css +1 -1
  41. package/styles/calendar/material-dark.css +10 -10
  42. package/styles/calendar/material.css +10 -10
  43. package/styles/calendar/material3-dark.css +10 -10
  44. package/styles/calendar/material3.css +10 -10
  45. package/styles/calendar/tailwind-dark.css +1 -1
  46. package/styles/calendar/tailwind.css +1 -1
  47. package/styles/fabric-dark.css +1 -1
  48. package/styles/fabric.css +1 -1
  49. package/styles/fluent-dark.css +1 -1
  50. package/styles/fluent.css +1 -1
  51. package/styles/highcontrast-light.css +1 -1
  52. package/styles/highcontrast.css +1 -1
  53. package/styles/material-dark.css +10 -10
  54. package/styles/material.css +10 -10
  55. package/styles/material3-dark.css +10 -10
  56. package/styles/material3.css +10 -10
  57. package/styles/tailwind-dark.css +1 -1
  58. package/styles/tailwind.css +1 -1
@@ -32,6 +32,7 @@ var DEVICE = 'e-device';
32
32
  var HEADER = 'e-header';
33
33
  var RTL = 'e-rtl';
34
34
  var CONTENT = 'e-content';
35
+ var CONTENTTABLE = 'e-calandar-content-table';
35
36
  var YEAR = 'e-year';
36
37
  var MONTH = 'e-month';
37
38
  var DECADE = 'e-decade';
@@ -47,6 +48,7 @@ var WEEKEND = 'e-weekend';
47
48
  var WEEKNUMBER = 'e-week-number';
48
49
  var SELECTED = 'e-selected';
49
50
  var FOCUSEDDATE = 'e-focused-date';
51
+ var FOCUSEDCELL = 'e-focused-cell';
50
52
  var OTHERMONTHROW = 'e-month-hide';
51
53
  var TODAY = 'e-today';
52
54
  var TITLE = 'e-title';
@@ -227,6 +229,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
227
229
  var ariaTitleAttrs = {
228
230
  'aria-atomic': 'true', 'aria-live': 'assertive', 'aria-label': 'title'
229
231
  };
232
+ var tabIndexAttr = { 'tabindex': '0' };
230
233
  this.headerElement = this.createElement('div', { className: HEADER });
231
234
  var iconContainer = this.createElement('div', { className: ICONCONTAINER });
232
235
  this.previousIcon = this.createElement('button', { className: '' + PREVICON, attrs: { type: 'button' } });
@@ -236,6 +239,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
236
239
  isCenterRipple: true
237
240
  });
238
241
  attributes(this.previousIcon, ariaPrevAttrs);
242
+ attributes(this.previousIcon, tabIndexAttr);
239
243
  this.nextIcon = this.createElement('button', { className: '' + NEXTICON, attrs: { type: 'button' } });
240
244
  rippleEffect(this.nextIcon, {
241
245
  selector: '.e-next',
@@ -247,8 +251,10 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
247
251
  attributes(this.nextIcon, { tabIndex: '-1' });
248
252
  }
249
253
  attributes(this.nextIcon, ariaNextAttrs);
254
+ attributes(this.nextIcon, tabIndexAttr);
250
255
  this.headerTitleElement = this.createElement('div', { className: '' + LINK + ' ' + TITLE });
251
256
  attributes(this.headerTitleElement, ariaTitleAttrs);
257
+ attributes(this.headerTitleElement, tabIndexAttr);
252
258
  this.headerElement.appendChild(this.headerTitleElement);
253
259
  this.previousIcon.appendChild(this.createElement('span', { className: '' + PREVSPAN + ' ' + ICON }));
254
260
  this.nextIcon.appendChild(this.createElement('span', { className: '' + NEXTSPAN + ' ' + ICON }));
@@ -265,7 +271,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
265
271
  };
266
272
  CalendarBase.prototype.createContent = function () {
267
273
  this.contentElement = this.createElement('div', { className: CONTENT });
268
- this.table = this.createElement('table', { attrs: { tabIndex: '0', 'role': 'grid', 'aria-activedescendant': '', 'aria-labelledby': this.element.id } });
274
+ this.table = this.createElement('table', { attrs: { 'class': CONTENTTABLE, 'tabIndex': '0', 'role': 'grid', 'aria-activedescendant': '', 'aria-labelledby': this.element.id } });
269
275
  if (this.getModuleName() === 'calendar') {
270
276
  this.element.appendChild(this.contentElement);
271
277
  }
@@ -278,6 +284,30 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
278
284
  if (this.showTodayButton) {
279
285
  this.createContentFooter();
280
286
  }
287
+ if (this.getModuleName() != 'daterangepicker') {
288
+ EventHandler.add(this.table, 'focus', this.addContentFocus, this);
289
+ EventHandler.add(this.table, 'blur', this.removeContentFocus, this);
290
+ }
291
+ };
292
+ CalendarBase.prototype.addContentFocus = function (args) {
293
+ var focusedDate = this.tableBodyElement.querySelector('tr td.e-focused-date');
294
+ var selectedDate = this.tableBodyElement.querySelector('tr td.e-selected');
295
+ if (!isNullOrUndefined(selectedDate)) {
296
+ selectedDate.classList.add(FOCUSEDCELL);
297
+ }
298
+ else if (!isNullOrUndefined(focusedDate)) {
299
+ focusedDate.classList.add(FOCUSEDCELL);
300
+ }
301
+ };
302
+ CalendarBase.prototype.removeContentFocus = function (args) {
303
+ var focusedDate = this.tableBodyElement.querySelector('tr td.e-focused-date');
304
+ var selectedDate = this.tableBodyElement.querySelector('tr td.e-selected');
305
+ if (!isNullOrUndefined(selectedDate)) {
306
+ selectedDate.classList.remove(FOCUSEDCELL);
307
+ }
308
+ else if (!isNullOrUndefined(focusedDate)) {
309
+ focusedDate.classList.remove(FOCUSEDCELL);
310
+ }
281
311
  };
282
312
  CalendarBase.prototype.getCultureValues = function () {
283
313
  var culShortNames = [];
@@ -362,6 +392,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
362
392
  CalendarBase.prototype.updateFooter = function () {
363
393
  this.todayElement.textContent = this.l10.getConstant('today');
364
394
  this.todayElement.setAttribute('aria-label', this.l10.getConstant('today'));
395
+ this.todayElement.setAttribute('tabindex', '0');
365
396
  };
366
397
  CalendarBase.prototype.createContentFooter = function () {
367
398
  if (this.showTodayButton) {
@@ -466,34 +497,54 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
466
497
  this.effect = '';
467
498
  switch (e.action) {
468
499
  case 'moveLeft':
469
- this.keyboardNavigate(-1, view, e, this.max, this.min);
470
- e.preventDefault();
500
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
501
+ this.keyboardNavigate(-1, view, e, this.max, this.min);
502
+ e.preventDefault();
503
+ }
471
504
  break;
472
505
  case 'moveRight':
473
- this.keyboardNavigate(1, view, e, this.max, this.min);
474
- e.preventDefault();
506
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
507
+ this.keyboardNavigate(1, view, e, this.max, this.min);
508
+ e.preventDefault();
509
+ }
475
510
  break;
476
511
  case 'moveUp':
477
- if (view === 0) {
478
- this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
479
- }
480
- else {
481
- this.keyboardNavigate(-4, view, e, this.max, this.min); // move the current year to the previous four days.
512
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
513
+ if (view === 0) {
514
+ this.keyboardNavigate(-7, view, e, this.max, this.min); // move the current date to the previous seven days.
515
+ }
516
+ else {
517
+ this.keyboardNavigate(-4, view, e, this.max, this.min); // move the current year to the previous four days.
518
+ }
519
+ e.preventDefault();
482
520
  }
483
- e.preventDefault();
484
521
  break;
485
522
  case 'moveDown':
486
- if (view === 0) {
487
- this.keyboardNavigate(7, view, e, this.max, this.min);
488
- }
489
- else {
490
- this.keyboardNavigate(4, view, e, this.max, this.min);
523
+ if (this.getModuleName() != 'daterangepicker' && !isNullOrUndefined(e.target) && e.target.classList.length > 0 && e.target.classList.contains(CONTENTTABLE)) {
524
+ if (view === 0) {
525
+ this.keyboardNavigate(7, view, e, this.max, this.min);
526
+ }
527
+ else {
528
+ this.keyboardNavigate(4, view, e, this.max, this.min);
529
+ }
530
+ e.preventDefault();
491
531
  }
492
- e.preventDefault();
493
532
  break;
494
533
  case 'select':
495
- if (e.target === this.todayElement) {
534
+ if (e.target === this.headerTitleElement) {
535
+ this.navigateTitle(e);
536
+ }
537
+ else if (e.target === this.previousIcon) {
538
+ this.navigatePrevious(e);
539
+ }
540
+ else if (e.target === this.nextIcon) {
541
+ this.navigateNext(e);
542
+ }
543
+ else if (e.target === this.todayElement) {
496
544
  this.todayButtonClick(e, value);
545
+ if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
546
+ this.element.focus();
547
+ }
497
548
  }
498
549
  else {
499
550
  var element = !isNullOrUndefined(focusedDate) ? focusedDate : selectedDate;
@@ -506,6 +557,9 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
506
557
  else {
507
558
  this.contentClick(null, --view, (element), value);
508
559
  }
560
+ if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
561
+ this.element.focus();
562
+ }
509
563
  }
510
564
  }
511
565
  break;
@@ -575,9 +629,20 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
575
629
  this.navigateTo('Month', new Date(this.currentDate.getFullYear(), 11, 31));
576
630
  e.preventDefault();
577
631
  break;
578
- }
579
- if (this.getModuleName() === 'calendar') {
580
- this.table.focus();
632
+ case 'tab':
633
+ if ((this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') && e.target === this.todayElement) {
634
+ e.preventDefault();
635
+ this.element.focus();
636
+ this.hide();
637
+ }
638
+ break;
639
+ case 'shiftTab':
640
+ if ((this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') && e.target === this.headerTitleElement) {
641
+ e.preventDefault();
642
+ this.element.focus();
643
+ this.hide();
644
+ }
645
+ break;
581
646
  }
582
647
  };
583
648
  CalendarBase.prototype.keyboardNavigate = function (number, currentView, e, max, min) {
@@ -3845,8 +3910,6 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3845
3910
  this.inputElement.focus();
3846
3911
  }
3847
3912
  break;
3848
- case 'tab':
3849
- this.hide(e);
3850
3913
  }
3851
3914
  };
3852
3915
  DatePicker.prototype.inputFocusHandler = function () {
@@ -4008,7 +4071,13 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4008
4071
  this.inputElement.selectionStart = start;
4009
4072
  this.inputElement.selectionEnd = end;
4010
4073
  }
4011
- this.hide(e);
4074
+ if (e.action === 'tab' && e.target === this.inputElement && this.isCalendar() && document.activeElement === this.inputElement) {
4075
+ e.preventDefault();
4076
+ this.headerTitleElement.focus();
4077
+ }
4078
+ if (e.action === 'shiftTab' && e.target === this.inputElement && this.isCalendar() && document.activeElement === this.inputElement) {
4079
+ this.hide(e);
4080
+ }
4012
4081
  break;
4013
4082
  }
4014
4083
  default:
@@ -5409,7 +5478,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5409
5478
  _this.invalidValueString = null;
5410
5479
  _this.isAngular = false;
5411
5480
  _this.preventChange = false;
5412
- _this.isKeyPressed = false;
5413
5481
  _this.dateRangeOptions = options;
5414
5482
  return _this;
5415
5483
  }
@@ -5765,7 +5833,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5765
5833
  EventHandler.add(this.inputElement, 'focus', this.inputFocusHandler, this);
5766
5834
  EventHandler.add(this.inputElement, 'blur', this.inputBlurHandler, this);
5767
5835
  EventHandler.add(this.inputElement, 'change', this.inputChangeHandler, this);
5768
- EventHandler.add(this.inputElement, 'keyup', this.keyupHandler, this);
5769
5836
  if (this.showClearButton && this.inputWrapper.clearButton) {
5770
5837
  EventHandler.add(this.inputWrapper.clearButton, 'mousedown', this.resetHandler, this);
5771
5838
  }
@@ -5792,7 +5859,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5792
5859
  EventHandler.remove(this.inputElement, 'blur', this.inputBlurHandler);
5793
5860
  EventHandler.remove(this.inputElement, 'focus', this.inputFocusHandler);
5794
5861
  EventHandler.remove(this.inputElement, 'change', this.inputChangeHandler);
5795
- EventHandler.remove(this.inputElement, 'keyup', this.keyupHandler);
5796
5862
  if (this.showClearButton && this.inputWrapper.clearButton) {
5797
5863
  EventHandler.remove(this.inputWrapper.clearButton, 'mousedown touchstart', this.resetHandler);
5798
5864
  }
@@ -6047,8 +6113,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6047
6113
  var startDate = this.presetsItem[i].start;
6048
6114
  var endDate = this.presetsItem[i].end;
6049
6115
  if (this.startValue && this.endValue) {
6050
- if ((+new Date(startDate.setHours(0, 0, 0, 0)) === +new Date(this.startValue.setHours(0, 0, 0, 0))) &&
6051
- (+new Date(endDate.setHours(0, 0, 0, 0)) === +new Date(this.endValue.setHours(0, 0, 0, 0)))) {
6116
+ if (startDate.getDate() == this.startValue.getDate() && startDate.getMonth() == this.startValue.getMonth() && startDate.getFullYear() == this.startValue.getFullYear()
6117
+ && endDate.getDate() == this.endValue.getDate() && endDate.getMonth() == this.endValue.getMonth() && endDate.getFullYear() == this.endValue.getFullYear()) {
6052
6118
  this.activeIndex = i;
6053
6119
  this.isCustomRange = false;
6054
6120
  }
@@ -8027,9 +8093,6 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8027
8093
  this.startButton.element.classList.add(ACTIVE$1);
8028
8094
  }
8029
8095
  };
8030
- DateRangePicker.prototype.keyupHandler = function (e) {
8031
- this.isKeyPressed = (this.inputElement.value !== this.previousEleValue) ? true : false;
8032
- };
8033
8096
  DateRangePicker.prototype.applyFunction = function (eve) {
8034
8097
  var isValueChanged = false;
8035
8098
  if (eve.type !== 'touchstart') {
@@ -8052,13 +8115,15 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8052
8115
  eve.preventDefault();
8053
8116
  }
8054
8117
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8118
+ if (!(this.previousStartValue && this.previousEndValue && this.startValue.getDate() == this.previousStartValue.getDate() && this.startValue.getMonth() == this.previousStartValue.getMonth() &&
8119
+ this.startValue.getFullYear() == this.previousStartValue.getFullYear()
8120
+ && this.endValue.getDate() == this.previousEndValue.getDate() && this.endValue.getMonth() == this.previousEndValue.getMonth()
8121
+ && this.endValue.getFullYear() == this.previousEndValue.getFullYear())) {
8122
+ Input.setValue(this.rangeArgs(eve).text, this.inputElement, this.floatLabelType, this.showClearButton);
8123
+ }
8055
8124
  this.previousStartValue = new Date(+this.startValue);
8056
8125
  this.previousEndValue = new Date(+this.endValue);
8057
8126
  this.previousEleValue = this.inputElement.value;
8058
- if (!this.isKeyPressed) {
8059
- Input.setValue(this.rangeArgs(eve).text, this.inputElement, this.floatLabelType, this.showClearButton);
8060
- }
8061
- this.isKeyPressed = false;
8062
8127
  if (+this.initStartDate !== +this.startValue || +this.initEndDate !== +this.endValue) {
8063
8128
  isValueChanged = true;
8064
8129
  }
@@ -14536,6 +14601,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14536
14601
  {
14537
14602
  var year = (this.isYearPart && (newDateValue.getFullYear().toString().length < 4
14538
14603
  && !this.isShortYear) ? newDateValue.getFullYear() * 10 : 0) + parseInt(newVal[start - 1], 10);
14604
+ var yearValue = (this.dateformat.match(/y/g) || []).length;
14539
14605
  this.isShortYear = false;
14540
14606
  this.isYearZero = (newVal[start - 1] === '0');
14541
14607
  if (isNaN(year)) {
@@ -14549,7 +14615,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14549
14615
  }
14550
14616
  else {
14551
14617
  newDateValue.setFullYear(year);
14552
- if (year.toString().length === 4) {
14618
+ if (year.toString().length === yearValue) {
14553
14619
  this.isNavigate = true;
14554
14620
  }
14555
14621
  this.previousDate = new Date(newDateValue.getFullYear(), newDateValue.getMonth(), newDateValue.getDate());
@@ -14724,9 +14790,6 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14724
14790
  case 'yy':
14725
14791
  result = proxy.isYearPart ? proxy.roundOff(proxy.maskDateValue.getFullYear() % 100, 2) : proxy.defaultConstant['year'].toString();
14726
14792
  result = proxy.zeroCheck(proxy.isYearZero, proxy.isYearPart, result);
14727
- if (proxy.isYearPart) {
14728
- proxy.isNavigate = proxy.isShortYear = (proxy.maskDateValue.getFullYear() % 100).toString().length === 2;
14729
- }
14730
14793
  break;
14731
14794
  case 'y':
14732
14795
  case 'yyyy':