@syncfusion/ej2-calendars 23.2.6 → 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
  };
@@ -5089,8 +5096,10 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
5089
5096
  case 'locale':
5090
5097
  this.globalize = new Internationalization(this.locale);
5091
5098
  this.l10n.setLocale(this.locale);
5092
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
5093
- Input.setPlaceholder(this.placeholder, this.inputElement);
5099
+ if (this.datepickerOptions && this.datepickerOptions.placeholder == null) {
5100
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
5101
+ Input.setPlaceholder(this.placeholder, this.inputElement);
5102
+ }
5094
5103
  this.updateInput();
5095
5104
  if (this.enableMask) {
5096
5105
  this.notify('createMask', {
@@ -6046,6 +6055,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6046
6055
  }
6047
6056
  }
6048
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');
6049
6060
  this.adjustLongHeaderWidth();
6050
6061
  var isPreset = (!this.isCustomRange || this.isMobile);
6051
6062
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
@@ -6234,8 +6245,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6234
6245
  if (range.length > 1) {
6235
6246
  this.invalidValueString = null;
6236
6247
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6237
- var start = new Date(range[0]);
6238
- var end = new Date(range[1]);
6248
+ var start = this.globalize.parseDate(range[0], dateOptions);
6249
+ var end = this.globalize.parseDate(range[1], dateOptions);
6239
6250
  var startDate = this.getStartEndDate(start, false, range, dateOptions);
6240
6251
  var endDate = this.getStartEndDate(end, true, range, dateOptions);
6241
6252
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -8199,7 +8210,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8199
8210
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8200
8211
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8201
8212
  var listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8202
- 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' });
8203
8214
  this.presetElement.appendChild(listTag);
8204
8215
  this.popupWrapper.appendChild(this.presetElement);
8205
8216
  var customElement = this.presetElement.querySelector('#custom_range');
@@ -8286,7 +8297,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8286
8297
  EventHandler.add(_this.calendarElement.querySelector(".e-content.e-month"), "touchstart", _this.touchStartRangeHandler, _this);
8287
8298
  }
8288
8299
  }
8289
- 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 });
8290
8301
  if (_this.value) {
8291
8302
  attributes(_this.inputElement, { 'aria-activedescendant': _this.inputElement.id });
8292
8303
  }
@@ -8341,6 +8352,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8341
8352
  close: function () {
8342
8353
  attributes(_this.inputElement, { 'aria-expanded': 'false' });
8343
8354
  _this.inputElement.removeAttribute('aria-owns');
8355
+ _this.inputElement.removeAttribute('aria-controls');
8344
8356
  _this.inputElement.removeAttribute('aria-activedescendant');
8345
8357
  removeClass([_this.inputWrapper.buttons[0]], ACTIVE$1);
8346
8358
  if (_this.isRangeIconClicked) {
@@ -8361,7 +8373,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8361
8373
  }
8362
8374
  }, targetExitViewport: function () {
8363
8375
  var popupEle = _this.popupObj && _this.popupObj.element;
8364
- if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < popupEle.parentElement.getBoundingClientRect().height) {
8376
+ if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < window.innerHeight) {
8365
8377
  _this.hide();
8366
8378
  }
8367
8379
  }
@@ -8694,10 +8706,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8694
8706
  'autocomplete': 'off', 'aria-disabled': !this.enabled ? 'true' : 'false',
8695
8707
  'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false'
8696
8708
  });
8697
- Input.addAttributes({ 'aria-label': 'select' }, this.inputWrapper.buttons[0]);
8698
- if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8699
- Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8700
- }
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
+ // }
8701
8713
  this.setEleWidth(this.width);
8702
8714
  addClass([this.inputWrapper.container], DATERANGEWRAPPER);
8703
8715
  if (isNullOrUndefined(this.inputElement.getAttribute('name'))) {
@@ -9425,8 +9437,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9425
9437
  DateRangePicker.prototype.setLocale = function () {
9426
9438
  this.globalize = new Internationalization(this.locale);
9427
9439
  this.l10n.setLocale(this.locale);
9428
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9429
- Input.setPlaceholder(this.placeholder, this.inputElement);
9440
+ if (this.dateRangeOptions && this.dateRangeOptions.placeholder == null) {
9441
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9442
+ Input.setPlaceholder(this.placeholder, this.inputElement);
9443
+ }
9430
9444
  this.updateInput();
9431
9445
  this.updateHiddenInput();
9432
9446
  this.changeTrigger();
@@ -9583,8 +9597,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9583
9597
  case 'locale':
9584
9598
  this.globalize = new Internationalization(this.locale);
9585
9599
  this.l10n.setLocale(this.locale);
9586
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9587
- Input.setPlaceholder(this.placeholder, this.inputElement);
9600
+ if (this.dateRangeOptions && this.dateRangeOptions.placeholder == null) {
9601
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9602
+ Input.setPlaceholder(this.placeholder, this.inputElement);
9603
+ }
9588
9604
  this.setLocale();
9589
9605
  break;
9590
9606
  case 'htmlAttributes':
@@ -10409,6 +10425,8 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10409
10425
  className: ROOT$3 + ' ' + POPUP$2,
10410
10426
  attrs: { 'id': this.element.id + '_popup', 'style': 'visibility:hidden' }
10411
10427
  });
10428
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
10429
+ this.popupWrapper.setAttribute('role', 'dialog');
10412
10430
  if (!isNullOrUndefined(this.cssClass)) {
10413
10431
  this.popupWrapper.className += ' ' + this.cssClass;
10414
10432
  }
@@ -10968,6 +10986,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
10968
10986
  removeClass([_this.inputWrapper.container], [ICONANIMATION]);
10969
10987
  attributes(_this.inputElement, { 'aria-expanded': 'false' });
10970
10988
  _this.inputElement.removeAttribute('aria-owns');
10989
+ _this.inputElement.removeAttribute('aria-controls');
10971
10990
  _this.inputElement.removeAttribute('aria-activedescendant');
10972
10991
  EventHandler.remove(document, 'mousedown touchstart', _this.documentClickHandler);
10973
10992
  }
@@ -12079,6 +12098,7 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
12079
12098
  _this.setActiveDescendant();
12080
12099
  attributes(_this.inputElement, { 'aria-expanded': 'true' });
12081
12100
  attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options' });
12101
+ attributes(_this.inputElement, { 'aria-controls': _this.inputElement.id });
12082
12102
  addClass([_this.inputWrapper.container], FOCUS);
12083
12103
  EventHandler.add(document, 'mousedown touchstart', _this.documentClickHandler, _this);
12084
12104
  _this.setOverlayIndex(_this.mobileTimePopupWrap, _this.popupObj.element, _this.modal, Browser.isDevice);
@@ -12240,7 +12260,9 @@ var TimePicker = /** @__PURE__ @class */ (function (_super) {
12240
12260
  this.setProperties({ locale: newProp.locale }, true);
12241
12261
  this.globalize = new Internationalization(this.locale);
12242
12262
  this.l10n.setLocale(this.locale);
12243
- this.updatePlaceHolder();
12263
+ if (this.timeOptions && this.timeOptions.placeholder == null) {
12264
+ this.updatePlaceHolder();
12265
+ }
12244
12266
  this.setValue(this.value);
12245
12267
  if (this.enableMask) {
12246
12268
  this.notify('createMask', {
@@ -12546,6 +12568,8 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12546
12568
  _this.valueWithMinutes = null;
12547
12569
  _this.scrollInvoked = false;
12548
12570
  _this.moduleName = _this.getModuleName();
12571
+ _this.formatRegex = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yyy|yy|y|'[^']*'|'[^']*'/g;
12572
+ _this.dateFormatString = '';
12549
12573
  _this.dateTimeOptions = options;
12550
12574
  return _this;
12551
12575
  }
@@ -12965,8 +12989,9 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12965
12989
  DateTimePicker.prototype.listCreation = function () {
12966
12990
  var dateObject;
12967
12991
  if (this.calendarMode === 'Gregorian') {
12992
+ this.cldrDateTimeFormat().replace(this.formatRegex, this.TimePopupFormat());
12968
12993
  dateObject = this.globalize.parseDate(this.inputElement.value, {
12969
- format: this.cldrDateTimeFormat(), type: 'datetime'
12994
+ format: this.dateFormatString, type: 'datetime'
12970
12995
  });
12971
12996
  }
12972
12997
  else {
@@ -12997,7 +13022,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12997
13022
  if (type === 'date') {
12998
13023
  if (!this.readonly && this.popupWrapper) {
12999
13024
  addClass([this.popupWrapper], DATETIMEPOPUPWRAPPER);
13000
- attributes(this.popupWrapper, { 'id': this.element.id + '_datepopup' });
13025
+ attributes(this.popupWrapper, { 'id': this.element.id + '_options' });
13001
13026
  }
13002
13027
  }
13003
13028
  else {
@@ -13056,6 +13081,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13056
13081
  addClass([_this.inputWrapper.container], [ICONANIMATION$1]);
13057
13082
  attributes(_this.inputElement, { 'aria-expanded': 'true' });
13058
13083
  attributes(_this.inputElement, { 'aria-owns': _this.inputElement.id + '_options' });
13084
+ attributes(_this.inputElement, { 'aria-controls': _this.inputElement.id });
13059
13085
  EventHandler.add(document, 'mousedown touchstart', _this.documentClickHandler, _this);
13060
13086
  }
13061
13087
  });
@@ -13455,6 +13481,40 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13455
13481
  }
13456
13482
  return this.calculateStartEnd(tempStartValue, start, 'starttime');
13457
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
+ };
13458
13518
  DateTimePicker.prototype.endTime = function (date) {
13459
13519
  var tempEndValue;
13460
13520
  var end;
@@ -13535,6 +13595,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13535
13595
  this.inputWrapper.container.classList.remove(ICONANIMATION$1);
13536
13596
  attributes(this.inputElement, { 'aria-expanded': 'false' });
13537
13597
  this.inputElement.removeAttribute('aria-owns');
13598
+ this.inputElement.removeAttribute('aria-controls');
13538
13599
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
13539
13600
  }
13540
13601
  };
@@ -13902,8 +13963,10 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
13902
13963
  case 'locale':
13903
13964
  this.globalize = new Internationalization(this.locale);
13904
13965
  this.l10n.setLocale(this.locale);
13905
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
13906
- Input.setPlaceholder(this.l10n.getConstant('placeholder'), this.inputElement);
13966
+ if (this.dateTimeOptions && this.dateTimeOptions.placeholder == null) {
13967
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
13968
+ Input.setPlaceholder(this.l10n.getConstant('placeholder'), this.inputElement);
13969
+ }
13907
13970
  this.dateTimeFormat = this.cldrDateTimeFormat();
13908
13971
  _super.prototype.updateInput.call(this);
13909
13972
  break;
@@ -14167,6 +14230,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14167
14230
  this.isDateZero = false;
14168
14231
  this.isMonthZero = false;
14169
14232
  this.isYearZero = false;
14233
+ this.isLeadingZero = false;
14170
14234
  this.dayTypeCount = 0;
14171
14235
  this.monthTypeCount = 0;
14172
14236
  this.hourTypeCount = 0;
@@ -14410,7 +14474,18 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14410
14474
  }
14411
14475
  if (month >= 1) {
14412
14476
  newDateValue.setMonth(month - 1);
14413
- this.isNavigate = month.toString().length === 2;
14477
+ if (month >= 10 || month == 1) {
14478
+ if (this.isLeadingZero && month == 1) {
14479
+ this.isNavigate = month.toString().length === 1;
14480
+ this.isLeadingZero = false;
14481
+ }
14482
+ else {
14483
+ this.isNavigate = month.toString().length === 2;
14484
+ }
14485
+ }
14486
+ else {
14487
+ this.isNavigate = month.toString().length === 1;
14488
+ }
14414
14489
  if (newDateValue.getMonth() !== month - 1) {
14415
14490
  newDateValue.setDate(1);
14416
14491
  newDateValue.setMonth(month - 1);
@@ -14428,6 +14503,7 @@ var MaskedDateTime = /** @__PURE__ @class */ (function () {
14428
14503
  }
14429
14504
  else {
14430
14505
  newDateValue.setMonth(0);
14506
+ this.isLeadingZero = true;
14431
14507
  this.isMonthPart = false;
14432
14508
  this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
14433
14509
  }