@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.
@@ -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
  }
@@ -5038,8 +5045,10 @@ let DatePicker = class DatePicker extends Calendar {
5038
5045
  case 'locale':
5039
5046
  this.globalize = new Internationalization(this.locale);
5040
5047
  this.l10n.setLocale(this.locale);
5041
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
5042
- Input.setPlaceholder(this.placeholder, this.inputElement);
5048
+ if (this.datepickerOptions && this.datepickerOptions.placeholder == null) {
5049
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
5050
+ Input.setPlaceholder(this.placeholder, this.inputElement);
5051
+ }
5043
5052
  this.updateInput();
5044
5053
  if (this.enableMask) {
5045
5054
  this.notify('createMask', {
@@ -5969,6 +5978,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5969
5978
  }
5970
5979
  }
5971
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');
5972
5983
  this.adjustLongHeaderWidth();
5973
5984
  const isPreset = (!this.isCustomRange || this.isMobile);
5974
5985
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
@@ -6157,8 +6168,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6157
6168
  if (range.length > 1) {
6158
6169
  this.invalidValueString = null;
6159
6170
  const dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6160
- const start = new Date(range[0]);
6161
- const end = new Date(range[1]);
6171
+ const start = this.globalize.parseDate(range[0], dateOptions);
6172
+ const end = this.globalize.parseDate(range[1], dateOptions);
6162
6173
  const startDate = this.getStartEndDate(start, false, range, dateOptions);
6163
6174
  const endDate = this.getStartEndDate(end, true, range, dateOptions);
6164
6175
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
@@ -8106,7 +8117,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8106
8117
  if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8107
8118
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8108
8119
  const listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8109
- 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' });
8110
8121
  this.presetElement.appendChild(listTag);
8111
8122
  this.popupWrapper.appendChild(this.presetElement);
8112
8123
  const customElement = this.presetElement.querySelector('#custom_range');
@@ -8192,7 +8203,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8192
8203
  EventHandler.add(this.calendarElement.querySelector(".e-content.e-month"), "touchstart", this.touchStartRangeHandler, this);
8193
8204
  }
8194
8205
  }
8195
- 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 });
8196
8207
  if (this.value) {
8197
8208
  attributes(this.inputElement, { 'aria-activedescendant': this.inputElement.id });
8198
8209
  }
@@ -8247,6 +8258,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8247
8258
  close: () => {
8248
8259
  attributes(this.inputElement, { 'aria-expanded': 'false' });
8249
8260
  this.inputElement.removeAttribute('aria-owns');
8261
+ this.inputElement.removeAttribute('aria-controls');
8250
8262
  this.inputElement.removeAttribute('aria-activedescendant');
8251
8263
  removeClass([this.inputWrapper.buttons[0]], ACTIVE$1);
8252
8264
  if (this.isRangeIconClicked) {
@@ -8267,7 +8279,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8267
8279
  }
8268
8280
  }, targetExitViewport: () => {
8269
8281
  let popupEle = this.popupObj && this.popupObj.element;
8270
- if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < popupEle.parentElement.getBoundingClientRect().height) {
8282
+ if (!Browser.isDevice && popupEle && popupEle.getBoundingClientRect().height < window.innerHeight) {
8271
8283
  this.hide();
8272
8284
  }
8273
8285
  }
@@ -8600,10 +8612,10 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8600
8612
  'autocomplete': 'off', 'aria-disabled': !this.enabled ? 'true' : 'false',
8601
8613
  'autocorrect': 'off', 'autocapitalize': 'off', 'spellcheck': 'false'
8602
8614
  });
8603
- Input.addAttributes({ 'aria-label': 'select' }, this.inputWrapper.buttons[0]);
8604
- if (!isNullOrUndefined(this.placeholder) && this.placeholder.trim() !== '') {
8605
- Input.addAttributes({ 'aria-placeholder': this.placeholder }, this.inputElement);
8606
- }
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
+ // }
8607
8619
  this.setEleWidth(this.width);
8608
8620
  addClass([this.inputWrapper.container], DATERANGEWRAPPER);
8609
8621
  if (isNullOrUndefined(this.inputElement.getAttribute('name'))) {
@@ -9329,8 +9341,10 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9329
9341
  setLocale() {
9330
9342
  this.globalize = new Internationalization(this.locale);
9331
9343
  this.l10n.setLocale(this.locale);
9332
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9333
- Input.setPlaceholder(this.placeholder, this.inputElement);
9344
+ if (this.dateRangeOptions && this.dateRangeOptions.placeholder == null) {
9345
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9346
+ Input.setPlaceholder(this.placeholder, this.inputElement);
9347
+ }
9334
9348
  this.updateInput();
9335
9349
  this.updateHiddenInput();
9336
9350
  this.changeTrigger();
@@ -9486,8 +9500,10 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9486
9500
  case 'locale':
9487
9501
  this.globalize = new Internationalization(this.locale);
9488
9502
  this.l10n.setLocale(this.locale);
9489
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9490
- Input.setPlaceholder(this.placeholder, this.inputElement);
9503
+ if (this.dateRangeOptions && this.dateRangeOptions.placeholder == null) {
9504
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
9505
+ Input.setPlaceholder(this.placeholder, this.inputElement);
9506
+ }
9491
9507
  this.setLocale();
9492
9508
  break;
9493
9509
  case 'htmlAttributes':
@@ -10291,6 +10307,8 @@ let TimePicker = class TimePicker extends Component {
10291
10307
  className: ROOT$3 + ' ' + POPUP$2,
10292
10308
  attrs: { 'id': this.element.id + '_popup', 'style': 'visibility:hidden' }
10293
10309
  });
10310
+ this.popupWrapper.setAttribute('aria-label', this.element.id);
10311
+ this.popupWrapper.setAttribute('role', 'dialog');
10294
10312
  if (!isNullOrUndefined(this.cssClass)) {
10295
10313
  this.popupWrapper.className += ' ' + this.cssClass;
10296
10314
  }
@@ -10846,6 +10864,7 @@ let TimePicker = class TimePicker extends Component {
10846
10864
  removeClass([this.inputWrapper.container], [ICONANIMATION]);
10847
10865
  attributes(this.inputElement, { 'aria-expanded': 'false' });
10848
10866
  this.inputElement.removeAttribute('aria-owns');
10867
+ this.inputElement.removeAttribute('aria-controls');
10849
10868
  this.inputElement.removeAttribute('aria-activedescendant');
10850
10869
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
10851
10870
  }
@@ -11954,6 +11973,7 @@ let TimePicker = class TimePicker extends Component {
11954
11973
  this.setActiveDescendant();
11955
11974
  attributes(this.inputElement, { 'aria-expanded': 'true' });
11956
11975
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
11976
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
11957
11977
  addClass([this.inputWrapper.container], FOCUS);
11958
11978
  EventHandler.add(document, 'mousedown touchstart', this.documentClickHandler, this);
11959
11979
  this.setOverlayIndex(this.mobileTimePopupWrap, this.popupObj.element, this.modal, Browser.isDevice);
@@ -12114,7 +12134,9 @@ let TimePicker = class TimePicker extends Component {
12114
12134
  this.setProperties({ locale: newProp.locale }, true);
12115
12135
  this.globalize = new Internationalization(this.locale);
12116
12136
  this.l10n.setLocale(this.locale);
12117
- this.updatePlaceHolder();
12137
+ if (this.timeOptions && this.timeOptions.placeholder == null) {
12138
+ this.updatePlaceHolder();
12139
+ }
12118
12140
  this.setValue(this.value);
12119
12141
  if (this.enableMask) {
12120
12142
  this.notify('createMask', {
@@ -12405,6 +12427,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12405
12427
  this.valueWithMinutes = null;
12406
12428
  this.scrollInvoked = false;
12407
12429
  this.moduleName = this.getModuleName();
12430
+ this.formatRegex = /dddd|ddd|dd|d|MMMM|MMM|MM|M|yyyy|yyy|yy|y|'[^']*'|'[^']*'/g;
12431
+ this.dateFormatString = '';
12408
12432
  this.dateTimeOptions = options;
12409
12433
  }
12410
12434
  focusHandler() {
@@ -12822,8 +12846,9 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12822
12846
  listCreation() {
12823
12847
  let dateObject;
12824
12848
  if (this.calendarMode === 'Gregorian') {
12849
+ this.cldrDateTimeFormat().replace(this.formatRegex, this.TimePopupFormat());
12825
12850
  dateObject = this.globalize.parseDate(this.inputElement.value, {
12826
- format: this.cldrDateTimeFormat(), type: 'datetime'
12851
+ format: this.dateFormatString, type: 'datetime'
12827
12852
  });
12828
12853
  }
12829
12854
  else {
@@ -12854,7 +12879,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12854
12879
  if (type === 'date') {
12855
12880
  if (!this.readonly && this.popupWrapper) {
12856
12881
  addClass([this.popupWrapper], DATETIMEPOPUPWRAPPER);
12857
- attributes(this.popupWrapper, { 'id': this.element.id + '_datepopup' });
12882
+ attributes(this.popupWrapper, { 'id': this.element.id + '_options' });
12858
12883
  }
12859
12884
  }
12860
12885
  else {
@@ -12912,6 +12937,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12912
12937
  addClass([this.inputWrapper.container], [ICONANIMATION$1]);
12913
12938
  attributes(this.inputElement, { 'aria-expanded': 'true' });
12914
12939
  attributes(this.inputElement, { 'aria-owns': this.inputElement.id + '_options' });
12940
+ attributes(this.inputElement, { 'aria-controls': this.inputElement.id });
12915
12941
  EventHandler.add(document, 'mousedown touchstart', this.documentClickHandler, this);
12916
12942
  }
12917
12943
  });
@@ -13310,6 +13336,40 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
13310
13336
  }
13311
13337
  return this.calculateStartEnd(tempStartValue, start, 'starttime');
13312
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
+ }
13313
13373
  endTime(date) {
13314
13374
  let tempEndValue;
13315
13375
  let end;
@@ -13389,6 +13449,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
13389
13449
  this.inputWrapper.container.classList.remove(ICONANIMATION$1);
13390
13450
  attributes(this.inputElement, { 'aria-expanded': 'false' });
13391
13451
  this.inputElement.removeAttribute('aria-owns');
13452
+ this.inputElement.removeAttribute('aria-controls');
13392
13453
  EventHandler.remove(document, 'mousedown touchstart', this.documentClickHandler);
13393
13454
  }
13394
13455
  }
@@ -13754,8 +13815,10 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
13754
13815
  case 'locale':
13755
13816
  this.globalize = new Internationalization(this.locale);
13756
13817
  this.l10n.setLocale(this.locale);
13757
- this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
13758
- Input.setPlaceholder(this.l10n.getConstant('placeholder'), this.inputElement);
13818
+ if (this.dateTimeOptions && this.dateTimeOptions.placeholder == null) {
13819
+ this.setProperties({ placeholder: this.l10n.getConstant('placeholder') }, true);
13820
+ Input.setPlaceholder(this.l10n.getConstant('placeholder'), this.inputElement);
13821
+ }
13759
13822
  this.dateTimeFormat = this.cldrDateTimeFormat();
13760
13823
  super.updateInput();
13761
13824
  break;
@@ -14018,6 +14081,7 @@ class MaskedDateTime {
14018
14081
  this.isDateZero = false;
14019
14082
  this.isMonthZero = false;
14020
14083
  this.isYearZero = false;
14084
+ this.isLeadingZero = false;
14021
14085
  this.dayTypeCount = 0;
14022
14086
  this.monthTypeCount = 0;
14023
14087
  this.hourTypeCount = 0;
@@ -14261,7 +14325,18 @@ class MaskedDateTime {
14261
14325
  }
14262
14326
  if (month >= 1) {
14263
14327
  newDateValue.setMonth(month - 1);
14264
- this.isNavigate = month.toString().length === 2;
14328
+ if (month >= 10 || month == 1) {
14329
+ if (this.isLeadingZero && month == 1) {
14330
+ this.isNavigate = month.toString().length === 1;
14331
+ this.isLeadingZero = false;
14332
+ }
14333
+ else {
14334
+ this.isNavigate = month.toString().length === 2;
14335
+ }
14336
+ }
14337
+ else {
14338
+ this.isNavigate = month.toString().length === 1;
14339
+ }
14265
14340
  if (newDateValue.getMonth() !== month - 1) {
14266
14341
  newDateValue.setDate(1);
14267
14342
  newDateValue.setMonth(month - 1);
@@ -14279,6 +14354,7 @@ class MaskedDateTime {
14279
14354
  }
14280
14355
  else {
14281
14356
  newDateValue.setMonth(0);
14357
+ this.isLeadingZero = true;
14282
14358
  this.isMonthPart = false;
14283
14359
  this.monthTypeCount = this.isMonthZero ? this.monthTypeCount + 1 : this.monthTypeCount;
14284
14360
  }