@syncfusion/ej2-navigations 20.4.40 → 20.4.43

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.
@@ -1217,7 +1217,7 @@ let MenuBase = class MenuBase extends Component {
1217
1217
  }
1218
1218
  }
1219
1219
  if (this.cssClass) {
1220
- addClass([wrapper], this.cssClass.split(' '));
1220
+ addClass([wrapper], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
1221
1221
  }
1222
1222
  if (this.enableRtl) {
1223
1223
  wrapper.classList.add(RTL);
@@ -1415,14 +1415,6 @@ let MenuBase = class MenuBase extends Component {
1415
1415
  if (fliIdx === (e.action === DOWNARROW ? cul.childElementCount : -1)) {
1416
1416
  fliIdx = defaultIdx;
1417
1417
  }
1418
- if (cul.children[fliIdx].classList.contains(HIDE)) {
1419
- if (e.action === DOWNARROW && fliIdx === cul.childElementCount - 1) {
1420
- fliIdx = defaultIdx;
1421
- }
1422
- else if (e.action === UPARROW && fliIdx === 0) {
1423
- fliIdx = defaultIdx;
1424
- }
1425
- }
1426
1418
  }
1427
1419
  }
1428
1420
  const cli = cul.children[fliIdx];
@@ -1432,8 +1424,15 @@ let MenuBase = class MenuBase extends Component {
1432
1424
  }
1433
1425
  isValidLI(cli, index, action) {
1434
1426
  const cul = this.getUlByNavIdx();
1427
+ const defaultIdx = (action === DOWNARROW || action === HOME || action === TAB) ? 0 : cul.childElementCount - 1;
1435
1428
  if (cli.classList.contains(SEPARATOR) || cli.classList.contains(DISABLED) || cli.classList.contains(HIDE)) {
1436
- if ((action === DOWNARROW) || (action === RIGHTARROW)) {
1429
+ if (action === DOWNARROW && index === cul.childElementCount - 1) {
1430
+ index = defaultIdx;
1431
+ }
1432
+ else if (action === UPARROW && index === 0) {
1433
+ index = defaultIdx;
1434
+ }
1435
+ else if ((action === DOWNARROW) || (action === RIGHTARROW)) {
1437
1436
  index++;
1438
1437
  }
1439
1438
  else {
@@ -1761,7 +1760,7 @@ let MenuBase = class MenuBase extends Component {
1761
1760
  }
1762
1761
  else {
1763
1762
  if (this.cssClass) {
1764
- addClass([this.popupWrapper], this.cssClass.split(' '));
1763
+ addClass([this.popupWrapper], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
1765
1764
  }
1766
1765
  this.popupObj.hide();
1767
1766
  }
@@ -2167,7 +2166,12 @@ let MenuBase = class MenuBase extends Component {
2167
2166
  }
2168
2167
  const ul = ListBase.createList(this.createElement, items, listBaseOptions, !this.template, this);
2169
2168
  ul.setAttribute('tabindex', '0');
2170
- this.isMenu ? ul.setAttribute('role', 'menu') : ul.setAttribute('role', 'menubar');
2169
+ if (this.isMenu) {
2170
+ ul.setAttribute('role', 'menu');
2171
+ }
2172
+ else {
2173
+ ul.setAttribute('role', 'menubar');
2174
+ }
2171
2175
  return ul;
2172
2176
  }
2173
2177
  moverHandler(e) {
@@ -2554,7 +2558,7 @@ let MenuBase = class MenuBase extends Component {
2554
2558
  removeClass([wrapper], oldProp.cssClass.split(' '));
2555
2559
  }
2556
2560
  if (newProp.cssClass) {
2557
- addClass([wrapper], newProp.cssClass.split(' '));
2561
+ addClass([wrapper], newProp.cssClass.replace(/\s+/g, ' ').trim().split(' '));
2558
2562
  }
2559
2563
  break;
2560
2564
  case 'enableRtl':
@@ -7327,9 +7331,7 @@ let Tab = class Tab extends Component {
7327
7331
  this.tbObj = null;
7328
7332
  }
7329
7333
  this.unWireEvents();
7330
- ['role', 'aria-disabled', 'aria-activedescendant', 'tabindex', 'aria-orientation', 'aria-owns'].forEach((val) => {
7331
- this.element.removeAttribute(val);
7332
- });
7334
+ this.element.removeAttribute('aria-disabled');
7333
7335
  this.expTemplateContent();
7334
7336
  if (!this.isTemplate) {
7335
7337
  while (this.element.firstElementChild) {
@@ -7408,7 +7410,7 @@ let Tab = class Tab extends Component {
7408
7410
  const css = (name === 'msie') ? 'e-ie' : (name === 'edge') ? 'e-edge' : (name === 'safari') ? 'e-safari' : '';
7409
7411
  setStyleAttribute(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
7410
7412
  this.setCssClass(this.element, this.cssClass, true);
7411
- attributes(this.element, { role: 'tablist', 'aria-disabled': 'false', 'aria-activedescendant': '', 'aria-owns': this.element.id + '_' + 'tab_header_items' });
7413
+ attributes(this.element, { 'aria-disabled': 'false' });
7412
7414
  this.setCssClass(this.element, css, true);
7413
7415
  this.updatePopAnimationConfig();
7414
7416
  }
@@ -7503,8 +7505,7 @@ let Tab = class Tab extends Component {
7503
7505
  hdrItems.forEach((item, index) => {
7504
7506
  this.lastIndex = index;
7505
7507
  const attr = {
7506
- className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index,
7507
- attrs: { role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-selected': 'false' }
7508
+ className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index
7508
7509
  };
7509
7510
  const txt = this.createElement('span', {
7510
7511
  className: CLS_TEXT, innerHTML: item, attrs: { 'role': 'presentation' }
@@ -7512,7 +7513,10 @@ let Tab = class Tab extends Component {
7512
7513
  const cont = this.createElement('div', {
7513
7514
  className: CLS_TEXT_WRAP, innerHTML: txt + this.btnCls.outerHTML
7514
7515
  }).outerHTML;
7515
- const wrap = this.createElement('div', { className: CLS_WRAP, innerHTML: cont, attrs: { tabIndex: '-1' } });
7516
+ const wrap = this.createElement('div', {
7517
+ className: CLS_WRAP, innerHTML: cont,
7518
+ attrs: { role: 'tab', tabIndex: '-1', 'aria-selected': 'false', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index }
7519
+ });
7516
7520
  tabItems.appendChild(this.createElement('div', attr));
7517
7521
  selectAll('.' + CLS_ITEM$2, tabItems)[index].appendChild(wrap);
7518
7522
  });
@@ -7531,15 +7535,13 @@ let Tab = class Tab extends Component {
7531
7535
  this.tbObj.isStringTemplate = true;
7532
7536
  this.tbObj.createElement = this.createElement;
7533
7537
  this.tbObj.appendTo(this.hdrEle);
7534
- attributes(this.hdrEle, { 'aria-label': 'tab-header' });
7535
- this.updateOrientationAttribute();
7538
+ attributes(this.hdrEle, { role: 'tablist' });
7536
7539
  this.setCloseButton(this.showCloseButton);
7537
7540
  const toolbarHeader = this.tbObj.element.querySelector('.' + CLS_TB_ITEMS);
7538
7541
  if (!isNullOrUndefined(toolbarHeader)) {
7539
7542
  if (isNullOrUndefined(toolbarHeader.id) || toolbarHeader.id === '') {
7540
7543
  toolbarHeader.id = this.element.id + '_' + 'tab_header_items';
7541
7544
  }
7542
- this.element.setAttribute('aria-owns', toolbarHeader.id);
7543
7545
  }
7544
7546
  }
7545
7547
  renderContent() {
@@ -7633,7 +7635,7 @@ let Tab = class Tab extends Component {
7633
7635
  }
7634
7636
  }
7635
7637
  const tabIndex = isNullOrUndefined(item.tabIndex) ? '-1' : item.tabIndex.toString();
7636
- const wrapAttrs = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex };
7638
+ const wrapAttrs = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-selected': 'false' };
7637
7639
  tCont.appendChild(this.btnCls.cloneNode(true));
7638
7640
  const wrap = this.createElement('div', { className: CLS_WRAP, attrs: wrapAttrs });
7639
7641
  wrap.appendChild(tCont);
@@ -7644,7 +7646,7 @@ let Tab = class Tab extends Component {
7644
7646
  this.itemIndexArray.splice((index + i), 0, CLS_ITEM$2 + this.tabId + '_' + this.lastIndex);
7645
7647
  }
7646
7648
  const attrObj = {
7647
- id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex, role: 'tab', 'aria-selected': 'false'
7649
+ id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex
7648
7650
  };
7649
7651
  const tItem = { htmlAttributes: attrObj, template: wrap };
7650
7652
  tItem.cssClass = ((item.cssClass !== undefined) ? item.cssClass : ' ') + ' ' + disabled + ' ' + hidden + ' '
@@ -7673,6 +7675,7 @@ let Tab = class Tab extends Component {
7673
7675
  if (tabHeader) {
7674
7676
  const tabItems = selectAll('.' + CLS_TB_ITEM + '.' + CLS_ACTIVE$1, tabHeader);
7675
7677
  [].slice.call(tabItems).forEach((node) => node.classList.remove(CLS_ACTIVE$1));
7678
+ [].slice.call(tabItems).forEach((node) => node.firstElementChild.setAttribute('aria-selected', 'false'));
7676
7679
  }
7677
7680
  }
7678
7681
  checkPopupOverflow(ele) {
@@ -7715,9 +7718,6 @@ let Tab = class Tab extends Component {
7715
7718
  }
7716
7719
  return selectAll('.' + CLS_TB_ITEM, this.tbItems).length - 1;
7717
7720
  }
7718
- updateOrientationAttribute() {
7719
- attributes(this.element, { 'aria-orientation': (this.isVertical() ? 'vertical' : 'horizontal') });
7720
- }
7721
7721
  setCloseButton(val) {
7722
7722
  const trg = select('.' + CLS_HEADER$1, this.element);
7723
7723
  if (val === true) {
@@ -8021,7 +8021,6 @@ let Tab = class Tab extends Component {
8021
8021
  }
8022
8022
  }
8023
8023
  this.addVerticalClass();
8024
- this.updateOrientationAttribute();
8025
8024
  this.setActiveBorder();
8026
8025
  this.focusItem();
8027
8026
  }
@@ -8205,20 +8204,18 @@ let Tab = class Tab extends Component {
8205
8204
  if (!this.isTemplate) {
8206
8205
  const prev = this.tbItem[this.prevIndex];
8207
8206
  if (!isNullOrUndefined(prev)) {
8208
- prev.removeAttribute('aria-controls');
8207
+ prev.firstElementChild.removeAttribute('aria-controls');
8209
8208
  }
8210
- attributes(trg, { 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + value });
8209
+ attributes(trg.firstElementChild, { 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + value });
8211
8210
  }
8212
8211
  const id = trg.id;
8213
8212
  this.removeActiveClass();
8214
8213
  trg.classList.add(CLS_ACTIVE$1);
8215
- this.tbItem[this.prevIndex].setAttribute('aria-selected', 'false');
8216
- trg.setAttribute('aria-selected', 'true');
8214
+ trg.firstElementChild.setAttribute('aria-selected', 'true');
8217
8215
  const no = Number(this.extIndex(id));
8218
8216
  if (isNullOrUndefined(this.prevActiveEle)) {
8219
8217
  this.prevActiveEle = CLS_CONTENT$1 + this.tabId + '_' + no;
8220
8218
  }
8221
- attributes(this.element, { 'aria-activedescendant': id });
8222
8219
  if (this.isTemplate) {
8223
8220
  if (select('.' + CLS_CONTENT$1, this.element).children.length > 0) {
8224
8221
  const trg = this.findEle(select('.' + CLS_CONTENT$1, this.element).children, CLS_CONTENT$1 + this.tabId + '_' + no);
@@ -8887,7 +8884,7 @@ let Tab = class Tab extends Component {
8887
8884
  (textValue.length === 0) && !isNullOrUndefined(item.header) && isNullOrUndefined(item.header.iconCss))) {
8888
8885
  if (tabItems[place]) {
8889
8886
  if (isNullOrUndefined(item.id)) {
8890
- item.id = TABITEMPREFIX + (lastEleIndex + place).toString();
8887
+ item.id = CLS_ITEM$2 + this.tabId + '_' + TABITEMPREFIX + (lastEleIndex + place).toString();
8891
8888
  }
8892
8889
  tabItems[place].htmlAttributes['data-id'] = item.id;
8893
8890
  }
@@ -9314,7 +9311,7 @@ let Tab = class Tab extends Component {
9314
9311
  }
9315
9312
  }
9316
9313
  const tabIndex = isNullOrUndefined(item.tabIndex) ? '-1' : item.tabIndex.toString();
9317
- const wrapAtt = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex };
9314
+ const wrapAtt = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-selected': 'true' };
9318
9315
  tConts.appendChild(this.btnCls.cloneNode(true));
9319
9316
  const wraper = this.createElement('div', { className: CLS_WRAP, attrs: wrapAtt });
9320
9317
  wraper.appendChild(tConts);
@@ -9365,11 +9362,7 @@ let Tab = class Tab extends Component {
9365
9362
  detach(element);
9366
9363
  detach(detachContent);
9367
9364
  const attr = {
9368
- className: CLS_TB_ITEM + ' ' + CLS_TEMPLATE$1 + ' ' + CLS_ACTIVE$1, id: CLS_ITEM$2 + this.tabId + '_' + index,
9369
- attrs: {
9370
- role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index,
9371
- 'aria-disabled': 'false', 'aria-selected': 'true'
9372
- }
9365
+ className: CLS_TB_ITEM + ' ' + CLS_TEMPLATE$1 + ' ' + CLS_ACTIVE$1, id: CLS_ITEM$2 + this.tabId + '_' + index
9373
9366
  };
9374
9367
  const txtString = this.createElement('span', {
9375
9368
  className: CLS_TEXT, innerHTML: header, attrs: { 'role': 'presentation' }
@@ -9379,7 +9372,8 @@ let Tab = class Tab extends Component {
9379
9372
  }).outerHTML;
9380
9373
  const tabIndex = element.firstElementChild.getAttribute('data-tabindex');
9381
9374
  const wrap = this.createElement('div', {
9382
- className: CLS_WRAP, innerHTML: conte, attrs: { tabIndex: tabIndex, 'data-tabindex': tabIndex }
9375
+ className: CLS_WRAP, innerHTML: conte,
9376
+ attrs: { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-selected': 'true' }
9383
9377
  });
9384
9378
  tabItems.insertBefore(this.createElement('div', attr), tabItems.children[index + 1]);
9385
9379
  this.element.querySelector('.' + CLS_TB_ITEM + '.' + CLS_ACTIVE$1).appendChild(wrap);
@@ -9669,6 +9663,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
9669
9663
  this.isFirstRender = false;
9670
9664
  // Specifies whether the node is dropped or not
9671
9665
  this.isNodeDropped = false;
9666
+ this.isInteracted = false;
9672
9667
  this.mouseDownStatus = false;
9673
9668
  }
9674
9669
  /**
@@ -10922,7 +10917,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10922
10917
  }
10923
10918
  }
10924
10919
  clickHandler(event) {
10925
- let target = event.originalEvent.target;
10920
+ let target = Browser.isDevice ? document.elementFromPoint(event.originalEvent.changedTouches[0].clientX, event.originalEvent.changedTouches[0].clientY) : event.originalEvent.target;
10926
10921
  EventHandler.remove(this.element, 'contextmenu', this.preventContextMenu);
10927
10922
  if (!target || this.dragStartAction) {
10928
10923
  return;
@@ -11060,6 +11055,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11060
11055
  }
11061
11056
  if (this.isLoaded && this.expandArgs && !this.isRefreshed) {
11062
11057
  this.expandArgs = this.getExpandEvent(currLi, null);
11058
+ this.expandArgs.isInteracted = this.isInteracted;
11063
11059
  this.trigger('nodeExpanded', this.expandArgs);
11064
11060
  }
11065
11061
  }
@@ -11081,6 +11077,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11081
11077
  let colArgs;
11082
11078
  if (this.isLoaded) {
11083
11079
  colArgs = this.getExpandEvent(currLi, e);
11080
+ this.isInteracted = colArgs.isInteracted;
11084
11081
  this.trigger('nodeCollapsing', colArgs, (observedArgs) => {
11085
11082
  if (observedArgs.cancel) {
11086
11083
  removeClass([icon], PROCESS);
@@ -11140,6 +11137,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11140
11137
  this.removeExpand(liEle);
11141
11138
  if (this.isLoaded) {
11142
11139
  colArgs = this.getExpandEvent(liEle, null);
11140
+ colArgs.isInteracted = this.isInteracted;
11143
11141
  this.trigger('nodeCollapsed', colArgs);
11144
11142
  }
11145
11143
  }
@@ -11546,6 +11544,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11546
11544
  }
11547
11545
  if (this.isLoaded && !this.isRefreshed) {
11548
11546
  this.expandArgs = this.getExpandEvent(currLi, e);
11547
+ this.isInteracted = this.expandArgs.isInteracted;
11549
11548
  this.trigger('nodeExpanding', this.expandArgs, (observedArgs) => {
11550
11549
  if (observedArgs.cancel) {
11551
11550
  removeClass([icon], PROCESS);
@@ -15314,7 +15313,7 @@ let Breadcrumb = class Breadcrumb extends Component {
15314
15313
  this._maxItems = this.maxItems;
15315
15314
  this.element.setAttribute('aria-label', 'breadcrumb');
15316
15315
  if (this.cssClass) {
15317
- addClass([this.element], this.cssClass.split(' '));
15316
+ addClass([this.element], this.cssClass.replace(/\s+/g, ' ').trim().split(' '));
15318
15317
  }
15319
15318
  if (this.enableRtl) {
15320
15319
  this.element.classList.add('e-rtl');
@@ -15824,7 +15823,7 @@ let Breadcrumb = class Breadcrumb extends Component {
15824
15823
  removeClass([this.element], oldProp.cssClass.split(' '));
15825
15824
  }
15826
15825
  if (newProp.cssClass) {
15827
- addClass([this.element], newProp.cssClass.split(' '));
15826
+ addClass([this.element], newProp.cssClass.replace(/\s+/g, ' ').trim().split(' '));
15828
15827
  }
15829
15828
  if ((oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) && !(newProp.cssClass &&
15830
15829
  newProp.cssClass.indexOf(ICONRIGHT) > -1) || !(oldProp.cssClass && oldProp.cssClass.indexOf(ICONRIGHT) > -1) &&