@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.
@@ -302,7 +302,7 @@ let CalendarBase = class CalendarBase extends Component {
302
302
  }
303
303
  this.tableHeadElement = this.createElement('thead', { className: WEEKHEADER });
304
304
  if (this.weekNumber) {
305
- html += '<th class="e-week-number"></th>';
305
+ html += '<th class="e-week-number" aria-hidden="true"></th>';
306
306
  if (this.getModuleName() === 'calendar') {
307
307
  addClass([this.element], '' + WEEKNUMBER);
308
308
  }
@@ -700,6 +700,7 @@ let CalendarBase = class CalendarBase extends Component {
700
700
  }
701
701
  if (currentMonth !== localDate.getMonth()) {
702
702
  addClass([tdEle], OTHERMONTH);
703
+ dayLink.setAttribute('aria-disabled', 'true');
703
704
  }
704
705
  if (localDate.getDay() === 0 || localDate.getDay() === 6) {
705
706
  addClass([tdEle], WEEKEND);
@@ -735,6 +736,7 @@ let CalendarBase = class CalendarBase extends Component {
735
736
  if (this.renderDayCellArgs.isDisabled && !tdEle.classList.contains(SELECTED)) {
736
737
  addClass([tdEle], DISABLED);
737
738
  addClass([tdEle], OVERLAY);
739
+ dayLink.setAttribute('aria-disabled', 'true');
738
740
  if (+this.renderDayCellArgs.date === +this.todayDate) {
739
741
  this.todayDisabled = true;
740
742
  }
@@ -896,6 +898,7 @@ let CalendarBase = class CalendarBase extends Component {
896
898
  });
897
899
  if ((year < startFullYr) || (year > endFullYr)) {
898
900
  addClass([tdEle], OTHERDECADE);
901
+ dayLink.setAttribute('aria-disabled', 'true');
899
902
  if (!isNullOrUndefined(value) && localDate.getFullYear() === (value).getFullYear()) {
900
903
  addClass([tdEle], SELECTED);
901
904
  }
@@ -4097,7 +4100,9 @@ let DatePicker = class DatePicker extends Calendar {
4097
4100
  }
4098
4101
  }
4099
4102
  createCalendar() {
4100
- this.popupWrapper = this.createElement('div', { className: '' + ROOT$1 + ' ' + POPUPWRAPPER });
4103
+ this.popupWrapper = this.createElement('div', { className: '' + ROOT$1 + ' ' + POPUPWRAPPER, id: this.inputElement.id + '_options' });
4104
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
4105
+ this.popupWrapper.setAttribute('role', 'dialog');
4101
4106
  if (!isNullOrUndefined(this.cssClass)) {
4102
4107
  this.popupWrapper.className += ' ' + this.cssClass;
4103
4108
  }
@@ -4936,6 +4941,7 @@ let DatePicker = class DatePicker extends Calendar {
4936
4941
  if (this.isCalendar()) {
4937
4942
  Input.addAttributes({ 'aria-expanded': 'true' }, this.inputElement);
4938
4943
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
4944
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
4939
4945
  if (this.value) {
4940
4946
  attributes(this.inputElement, { 'aria-activedescendant': '' + this.setActiveDescendant() });
4941
4947
  }
@@ -4943,6 +4949,7 @@ let DatePicker = class DatePicker extends Calendar {
4943
4949
  else {
4944
4950
  Input.addAttributes({ 'aria-expanded': 'false' }, this.inputElement);
4945
4951
  this.inputElement.removeAttribute('aria-owns');
4952
+ this.inputElement.removeAttribute('aria-controls');
4946
4953
  this.inputElement.removeAttribute('aria-activedescendant');
4947
4954
  }
4948
4955
  }
@@ -5971,6 +5978,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5971
5978
  }
5972
5979
  }
5973
5980
  this.popupWrapper = createElement('div', { id: this.element.id + '_popup', className: ROOT$2 + ' ' + POPUP$1 });
5981
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
5982
+ this.popupWrapper.setAttribute('role', 'dialog');
5974
5983
  this.adjustLongHeaderWidth();
5975
5984
  const isPreset = (!this.isCustomRange || this.isMobile);
5976
5985
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
@@ -6159,8 +6168,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6159
6168
  if (range.length > 1) {
6160
6169
  this.invalidValueString = null;
6161
6170
  const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6162
- const start = new Date(range[0]);
6163
- const end = new Date(range[1]);
6171
+ const start = this.globalize.parseDate(range[0], dateOptions);
6172
+ const end = this.globalize.parseDate(range[1], dateOptions);
6164
6173
  const startDate = this.getStartEndDate(start, false, range, dateOptions);
6165
6174
  const endDate = this.getStartEndDate(end, true, range, dateOptions);
6166
6175
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -8108,7 +8117,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8108
8117
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8109
8118
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8110
8119
  const listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8111
- attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0' });
8120
+ attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0', 'aria-label': 'daterangepicker-preset' });
8112
8121
  this.presetElement.appendChild(listTag);
8113
8122
  this.popupWrapper.appendChild(this.presetElement);
8114
8123
  const customElement = this.presetElement.querySelector('#custom_range');
@@ -8194,7 +8203,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8194
8203
  EventHandler.add(this.calendarElement.querySelector(".e-content.e-month"), "touchstart", this.touchStartRangeHandler, this);
8195
8204
  }
8196
8205
  }
8197
- attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.inputElement.id + '_options' });
8206
+ attributes(this.inputElement, { 'aria-expanded': 'true', 'aria-owns': this.element.id, 'aria-controls': this.inputElement.id });
8198
8207
  if (this.value) {
8199
8208
  attributes(this.inputElement, { 'aria-activedescendant': this.inputElement.id });
8200
8209
  }
@@ -8249,6 +8258,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8249
8258
  close: () => {
8250
8259
  attributes(this.inputElement, { 'aria-expanded': 'false' });
8251
8260
  this.inputElement.removeAttribute('aria-owns');
8261
+ this.inputElement.removeAttribute('aria-controls');
8252
8262
  this.inputElement.removeAttribute('aria-activedescendant');
8253
8263
  removeClass([this.inputWrapper.buttons[0]], ACTIVE$1);
8254
8264
  if (this.isRangeIconClicked) {
@@ -8269,7 +8279,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8269
8279
  }
8270
8280
  }, targetExitViewport: () => {
8271
8281
  let popupEle = this.popupObj && this.popupObj.element;
8272
- if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < popupEle.parentElement.getBoundingClientRect().height) {
8282
+ if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < window.innerHeight) {
8273
8283
  this.hide();
8274
8284
  }
8275
8285
  }
@@ -8602,10 +8612,10 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8602
8612
  'autocomplete': 'off', 'aria-disabled': !this.enabled ? 'true' : 'false',
8603
8613
  'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false'
8604
8614
  });
8605
- Input.addAttributes({ 'aria-label': 'select' }, this.inputWrapper.buttons[0]);
8606
- if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8607
- Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8608
- }
8615
+ Input.addAttributes({ 'aria-label': 'select', 'role': 'button' }, this.inputWrapper.buttons[0]);
8616
+ // if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8617
+ // Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8618
+ // }
8609
8619
  this.setEleWidth(this.width);
8610
8620
  addClass([this.inputWrapper.container], DATERANGEWRAPPER);
8611
8621
  if (isNullOrUndefined(this.inputElement.getAttribute('name'))) {
@@ -10297,6 +10307,8 @@ let TimePicker = class TimePicker extends Component {
10297
10307
  className: ROOT$3 + ' ' + POPUP$2,
10298
10308
  attrs: { 'id': this.element.id + '_popup', 'style': 'visibility:hidden' }
10299
10309
  });
10310
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
10311
+ this.popupWrapper.setAttribute('role', 'dialog');
10300
10312
  if (!isNullOrUndefined(this.cssClass)) {
10301
10313
  this.popupWrapper.className += ' ' + this.cssClass;
10302
10314
  }
@@ -10852,6 +10864,7 @@ let TimePicker = class TimePicker extends Component {
10852
10864
  removeClass([this.inputWrapper.container], [ICONANIMATION]);
10853
10865
  attributes(this.inputElement, { 'aria-expanded': 'false' });
10854
10866
  this.inputElement.removeAttribute('aria-owns');
10867
+ this.inputElement.removeAttribute('aria-controls');
10855
10868
  this.inputElement.removeAttribute('aria-activedescendant');
10856
10869
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
10857
10870
  }
@@ -11960,6 +11973,7 @@ let TimePicker = class TimePicker extends Component {
11960
11973
  this.setActiveDescendant();
11961
11974
  attributes(this.inputElement, { 'aria-expanded': 'true' });
11962
11975
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
11976
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
11963
11977
  addClass([this.inputWrapper.container], FOCUS);
11964
11978
  EventHandler.add(document, 'mousedown touchstart', this.documentClickHandler, this);
11965
11979
  this.setOverlayIndex(this.mobileTimePopupWrap, this.popupObj.element, this.modal, Browser.isDevice);
@@ -12413,6 +12427,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12413
12427
  this.valueWithMinutes = null;
12414
12428
  this.scrollInvoked = false;
12415
12429
  this.moduleName = this.getModuleName();
12430
+ this.formatRegex = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yyy|yy|y|'[^']*'|'[^']*'/g;
12431
+ this.dateFormatString = '';
12416
12432
  this.dateTimeOptions = options;
12417
12433
  }
12418
12434
  focusHandler() {
@@ -12830,8 +12846,9 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12830
12846
  listCreation() {
12831
12847
  let dateObject;
12832
12848
  if (this.calendarMode === 'Gregorian') {
12849
+ this.cldrDateTimeFormat().replace(this.formatRegex, this.TimePopupFormat());
12833
12850
  dateObject = this.globalize.parseDate(this.inputElement.value, {
12834
- format: this.cldrDateTimeFormat(), type: 'datetime'
12851
+ format: this.dateFormatString, type: 'datetime'
12835
12852
  });
12836
12853
  }
12837
12854
  else {
@@ -12862,7 +12879,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12862
12879
  if (type === 'date') {
12863
12880
  if (!this.readonly && this.popupWrapper) {
12864
12881
  addClass([this.popupWrapper], DATETIMEPOPUPWRAPPER);
12865
- attributes(this.popupWrapper, { 'id': this.element.id + '_datepopup' });
12882
+ attributes(this.popupWrapper, { 'id': this.element.id + '_options' });
12866
12883
  }
12867
12884
  }
12868
12885
  else {
@@ -12920,6 +12937,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12920
12937
  addClass([this.inputWrapper.container], [ICONANIMATION$1]);
12921
12938
  attributes(this.inputElement, { 'aria-expanded': 'true' });
12922
12939
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
12940
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
12923
12941
  EventHandler.add(document, 'mousedown touchstart', this.documentClickHandler, this);
12924
12942
  }
12925
12943
  });
@@ -13318,6 +13336,40 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
13318
13336
  }
13319
13337
  return this.calculateStartEnd(tempStartValue, start, 'starttime');
13320
13338
  }
13339
+ TimePopupFormat() {
13340
+ var format = '';
13341
+ var formatCount = 0;
13342
+ const proxy = this;
13343
+ function formatValueSpecifier(formattext) {
13344
+ switch (formattext) {
13345
+ case 'd':
13346
+ case 'dd':
13347
+ case 'ddd':
13348
+ case 'dddd':
13349
+ case 'M':
13350
+ case 'MM':
13351
+ case 'MMM':
13352
+ case 'MMMM':
13353
+ case 'y':
13354
+ case 'yy':
13355
+ case 'yyy':
13356
+ case 'yyyy':
13357
+ if (format == '') {
13358
+ format = format + formattext;
13359
+ }
13360
+ else {
13361
+ format = format + "/" + formattext;
13362
+ }
13363
+ formatCount = formatCount + 1;
13364
+ break;
13365
+ }
13366
+ if (formatCount > 2) {
13367
+ proxy.dateFormatString = format;
13368
+ }
13369
+ return format;
13370
+ }
13371
+ return formatValueSpecifier;
13372
+ }
13321
13373
  endTime(date) {
13322
13374
  let tempEndValue;
13323
13375
  let end;
@@ -13397,6 +13449,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
13397
13449
  this.inputWrapper.container.classList.remove(ICONANIMATION$1);
13398
13450
  attributes(this.inputElement, { 'aria-expanded': 'false' });
13399
13451
  this.inputElement.removeAttribute('aria-owns');
13452
+ this.inputElement.removeAttribute('aria-controls');
13400
13453
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
13401
13454
  }
13402
13455
  }