@syncfusion/ej2-calendars 23.2.7 → 24.1.41

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.
@@ -318,7 +318,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
318
318
  }
319
319
  this.tableHeadElement = this.createElement('thead', { className: WEEKHEADER });
320
320
  if (this.weekNumber) {
321
- html += '<th class="e-week-number"></th>';
321
+ html += '<th class="e-week-number" aria-hidden="true"></th>';
322
322
  if (this.getModuleName() === 'calendar') {
323
323
  addClass([this.element], '' + WEEKNUMBER);
324
324
  }
@@ -717,6 +717,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
717
717
  }
718
718
  if (currentMonth !== localDate.getMonth()) {
719
719
  addClass([tdEle], OTHERMONTH);
720
+ dayLink.setAttribute('aria-disabled', 'true');
720
721
  }
721
722
  if (localDate.getDay() === 0 || localDate.getDay() === 6) {
722
723
  addClass([tdEle], WEEKEND);
@@ -752,6 +753,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
752
753
  if (this.renderDayCellArgs.isDisabled && !tdEle.classList.contains(SELECTED)) {
753
754
  addClass([tdEle], DISABLED);
754
755
  addClass([tdEle], OVERLAY);
756
+ dayLink.setAttribute('aria-disabled', 'true');
755
757
  if (+this.renderDayCellArgs.date === +this.todayDate) {
756
758
  this.todayDisabled = true;
757
759
  }
@@ -913,6 +915,7 @@ var CalendarBase = /** @__PURE__ @class */ (function (_super) {
913
915
  });
914
916
  if ((year < startFullYr) || (year > endFullYr)) {
915
917
  addClass([tdEle], OTHERDECADE);
918
+ dayLink.setAttribute('aria-disabled', 'true');
916
919
  if (!isNullOrUndefined(value) && localDate.getFullYear() === (value).getFullYear()) {
917
920
  addClass([tdEle], SELECTED);
918
921
  }
@@ -4142,7 +4145,9 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4142
4145
  };
4143
4146
  DatePicker.prototype.createCalendar = function () {
4144
4147
  var _this = this;
4145
- this.popupWrapper = this.createElement('div', { className: '' + ROOT$1 + ' ' + POPUPWRAPPER });
4148
+ this.popupWrapper = this.createElement('div', { className: '' + ROOT$1 + ' ' + POPUPWRAPPER, id: this.inputElement.id + '_options' });
4149
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
4150
+ this.popupWrapper.setAttribute('role', 'dialog');
4146
4151
  if (!isNullOrUndefined(this.cssClass)) {
4147
4152
  this.popupWrapper.className += ' ' + this.cssClass;
4148
4153
  }
@@ -4986,6 +4991,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4986
4991
  if (this.isCalendar()) {
4987
4992
  Input.addAttributes({ 'aria-expanded': 'true' }, this.inputElement);
4988
4993
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
4994
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
4989
4995
  if (this.value) {
4990
4996
  attributes(this.inputElement, { 'aria-activedescendant': '' + this.setActiveDescendant() });
4991
4997
  }
@@ -4993,6 +4999,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4993
4999
  else {
4994
5000
  Input.addAttributes({ 'aria-expanded': 'false' }, this.inputElement);
4995
5001
  this.inputElement.removeAttribute('aria-owns');
5002
+ this.inputElement.removeAttribute('aria-controls');
4996
5003
  this.inputElement.removeAttribute('aria-activedescendant');
4997
5004
  }
4998
5005
  };
@@ -6048,6 +6055,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6048
6055
  }
6049
6056
  }
6050
6057
  this.popupWrapper = createElement('div', { id: this.element.id + '_popup', className: ROOT$2 + ' ' + POPUP$1 });
6058
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
6059
+ this.popupWrapper.setAttribute('role', 'dialog');
6051
6060
  this.adjustLongHeaderWidth();
6052
6061
  var isPreset = (!this.isCustomRange || this.isMobile);
6053
6062
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
@@ -6236,8 +6245,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6236
6245
  if (range.length > 1) {
6237
6246
  this.invalidValueString = null;
6238
6247
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6239
- var start = new Date(range[0]);
6240
- var end = new Date(range[1]);
6248
+ var start = this.globalize.parseDate(range[0], dateOptions);
6249
+ var end = this.globalize.parseDate(range[1], dateOptions);
6241
6250
  var startDate = this.getStartEndDate(start, false, range, dateOptions);
6242
6251
  var endDate = this.getStartEndDate(end, true, range, dateOptions);
6243
6252
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -8201,7 +8210,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8201
8210
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8202
8211
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8203
8212
  var listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8204
- attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0' });
8213
+ attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0', 'aria-label': 'daterangepicker-preset' });
8205
8214
  this.presetElement.appendChild(listTag);
8206
8215
  this.popupWrapper.appendChild(this.presetElement);
8207
8216
  var customElement = this.presetElement.querySelector('#custom_range');
@@ -8288,7 +8297,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8288
8297
  EventHandler.add(_this.calendarElement.querySelector(".e-content.e-month"), "touchstart", _this.touchStartRangeHandler, _this);
8289
8298
  }
8290
8299
  }
8291
- attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.inputElement.id + '_options' });
8300
+ attributes(_this.inputElement, { 'aria-expanded': 'true', 'aria-owns': _this.element.id, 'aria-controls': _this.inputElement.id });
8292
8301
  if (_this.value) {
8293
8302
  attributes(_this.inputElement, { 'aria-activedescendant': _this.inputElement.id });
8294
8303
  }
@@ -8343,6 +8352,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8343
8352
  close: function () {
8344
8353
  attributes(_this.inputElement, { 'aria-expanded': 'false' });
8345
8354
  _this.inputElement.removeAttribute('aria-owns');
8355
+ _this.inputElement.removeAttribute('aria-controls');
8346
8356
  _this.inputElement.removeAttribute('aria-activedescendant');
8347
8357
  removeClass([_this.inputWrapper.buttons[0]], ACTIVE$1);
8348
8358
  if (_this.isRangeIconClicked) {
@@ -8363,7 +8373,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8363
8373
  }
8364
8374
  }, targetExitViewport: function () {
8365
8375
  var popupEle = _this.popupObj && _this.popupObj.element;
8366
- if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < popupEle.parentElement.getBoundingClientRect().height) {
8376
+ if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < window.innerHeight) {
8367
8377
  _this.hide();
8368
8378
  }
8369
8379
  }
@@ -8696,10 +8706,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8696
8706
  'autocomplete': 'off', 'aria-disabled': !this.enabled ? 'true' : 'false',
8697
8707
  'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false'
8698
8708
  });
8699
- Input.addAttributes({ 'aria-label': 'select' }, this.inputWrapper.buttons[0]);
8700
- if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8701
- Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8702
- }
8709
+ Input.addAttributes({ 'aria-label': 'select', 'role': 'button' }, this.inputWrapper.buttons[0]);
8710
+ // if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8711
+ // Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8712
+ // }
8703
8713
  this.setEleWidth(this.width);
8704
8714
  addClass([this.inputWrapper.container], DATERANGEWRAPPER);
8705
8715
  if (isNullOrUndefined(this.inputElement.getAttribute('name'))) {
@@ -10415,6 +10425,8 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10415
10425
  className: ROOT$3 + ' ' + POPUP$2,
10416
10426
  attrs: { 'id': this.element.id + '_popup', 'style': 'visibility:hidden' }
10417
10427
  });
10428
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
10429
+ this.popupWrapper.setAttribute('role', 'dialog');
10418
10430
  if (!isNullOrUndefined(this.cssClass)) {
10419
10431
  this.popupWrapper.className += ' ' + this.cssClass;
10420
10432
  }
@@ -10974,6 +10986,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10974
10986
  removeClass([_this.inputWrapper.container], [ICONANIMATION]);
10975
10987
  attributes(_this.inputElement, { 'aria-expanded': 'false' });
10976
10988
  _this.inputElement.removeAttribute('aria-owns');
10989
+ _this.inputElement.removeAttribute('aria-controls');
10977
10990
  _this.inputElement.removeAttribute('aria-activedescendant');
10978
10991
  EventHandler.remove(document, 'mousedown touchstart', _this.documentClickHandler);
10979
10992
  }
@@ -12085,6 +12098,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
12085
12098
  _this.setActiveDescendant();
12086
12099
  attributes(_this.inputElement, { 'aria-expanded': 'true' });
12087
12100
  attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options' });
12101
+ attributes(_this.inputElement, { 'aria-controls': _this.inputElement.id });
12088
12102
  addClass([_this.inputWrapper.container], FOCUS);
12089
12103
  EventHandler.add(document, 'mousedown touchstart', _this.documentClickHandler, _this);
12090
12104
  _this.setOverlayIndex(_this.mobileTimePopupWrap, _this.popupObj.element, _this.modal, Browser.isDevice);
@@ -12554,6 +12568,8 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12554
12568
  _this.valueWithMinutes = null;
12555
12569
  _this.scrollInvoked = false;
12556
12570
  _this.moduleName = _this.getModuleName();
12571
+ _this.formatRegex = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yyy|yy|y|'[^']*'|'[^']*'/g;
12572
+ _this.dateFormatString = '';
12557
12573
  _this.dateTimeOptions = options;
12558
12574
  return _this;
12559
12575
  }
@@ -12973,8 +12989,9 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12973
12989
  DateTimePicker.prototype.listCreation = function () {
12974
12990
  var dateObject;
12975
12991
  if (this.calendarMode === 'Gregorian') {
12992
+ this.cldrDateTimeFormat().replace(this.formatRegex, this.TimePopupFormat());
12976
12993
  dateObject = this.globalize.parseDate(this.inputElement.value, {
12977
- format: this.cldrDateTimeFormat(), type: 'datetime'
12994
+ format: this.dateFormatString, type: 'datetime'
12978
12995
  });
12979
12996
  }
12980
12997
  else {
@@ -13005,7 +13022,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13005
13022
  if (type === 'date') {
13006
13023
  if (!this.readonly && this.popupWrapper) {
13007
13024
  addClass([this.popupWrapper], DATETIMEPOPUPWRAPPER);
13008
- attributes(this.popupWrapper, { 'id': this.element.id + '_datepopup' });
13025
+ attributes(this.popupWrapper, { 'id': this.element.id + '_options' });
13009
13026
  }
13010
13027
  }
13011
13028
  else {
@@ -13064,6 +13081,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13064
13081
  addClass([_this.inputWrapper.container], [ICONANIMATION$1]);
13065
13082
  attributes(_this.inputElement, { 'aria-expanded': 'true' });
13066
13083
  attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options' });
13084
+ attributes(_this.inputElement, { 'aria-controls': _this.inputElement.id });
13067
13085
  EventHandler.add(document, 'mousedown touchstart', _this.documentClickHandler, _this);
13068
13086
  }
13069
13087
  });
@@ -13463,6 +13481,40 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13463
13481
  }
13464
13482
  return this.calculateStartEnd(tempStartValue, start, 'starttime');
13465
13483
  };
13484
+ DateTimePicker.prototype.TimePopupFormat = function () {
13485
+ var format = '';
13486
+ var formatCount = 0;
13487
+ var proxy = this;
13488
+ function formatValueSpecifier(formattext) {
13489
+ switch (formattext) {
13490
+ case 'd':
13491
+ case 'dd':
13492
+ case 'ddd':
13493
+ case 'dddd':
13494
+ case 'M':
13495
+ case 'MM':
13496
+ case 'MMM':
13497
+ case 'MMMM':
13498
+ case 'y':
13499
+ case 'yy':
13500
+ case 'yyy':
13501
+ case 'yyyy':
13502
+ if (format == '') {
13503
+ format = format + formattext;
13504
+ }
13505
+ else {
13506
+ format = format + "/" + formattext;
13507
+ }
13508
+ formatCount = formatCount + 1;
13509
+ break;
13510
+ }
13511
+ if (formatCount > 2) {
13512
+ proxy.dateFormatString = format;
13513
+ }
13514
+ return format;
13515
+ }
13516
+ return formatValueSpecifier;
13517
+ };
13466
13518
  DateTimePicker.prototype.endTime = function (date) {
13467
13519
  var tempEndValue;
13468
13520
  var end;
@@ -13543,6 +13595,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13543
13595
  this.inputWrapper.container.classList.remove(ICONANIMATION$1);
13544
13596
  attributes(this.inputElement, { 'aria-expanded': 'false' });
13545
13597
  this.inputElement.removeAttribute('aria-owns');
13598
+ this.inputElement.removeAttribute('aria-controls');
13546
13599
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
13547
13600
  }
13548
13601
  };