@syncfusion/ej2-navigations 20.3.47 → 20.3.49

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.
@@ -3036,7 +3036,7 @@ let MenuBase = class MenuBase extends Component {
3036
3036
  menuitem = new MenuItem(iitems[0], 'items', items[i], true);
3037
3037
  iitems.splice(isAfter ? idx + 1 : idx, 0, menuitem);
3038
3038
  const uls = this.isMenu ? [this.getWrapper()].concat(this.getPopups()) : [].slice.call(this.getWrapper().children);
3039
- if (navIdx.length < uls.length) {
3039
+ if (!isNullOrUndefined(idx) && navIdx.length < uls.length) {
3040
3040
  idx = isAfter ? idx + 1 : idx;
3041
3041
  li = this.createItems(iitems).children[idx];
3042
3042
  const ul = this.isMenu ? select('.e-menu-parent', uls[navIdx.length]) : uls[navIdx.length];
@@ -5568,9 +5568,7 @@ let Accordion = class Accordion extends Component {
5568
5568
  }
5569
5569
  ele.classList.remove(CLS_ACRDN_ROOT);
5570
5570
  ele.removeAttribute('style');
5571
- ['aria-disabled', 'aria-multiselectable', 'role', 'data-ripple'].forEach((attrb) => {
5572
- this.element.removeAttribute(attrb);
5573
- });
5571
+ this.element.removeAttribute('data-ripple');
5574
5572
  if (!this.isNested && isRippleEnabled) {
5575
5573
  this.removeRippleEffect();
5576
5574
  }
@@ -5619,19 +5617,12 @@ let Accordion = class Accordion extends Component {
5619
5617
  const width = formatUnit(this.width);
5620
5618
  const height = formatUnit(this.height);
5621
5619
  setStyleAttribute(this.element, { 'width': width, 'height': height });
5622
- const ariaAttr = {
5623
- 'aria-disabled': 'false', 'role': 'presentation', 'aria-multiselectable': 'true'
5624
- };
5625
5620
  if (isNullOrUndefined(this.initExpand)) {
5626
5621
  this.initExpand = [];
5627
5622
  }
5628
5623
  if (this.expandedIndices.length > 0) {
5629
5624
  this.initExpand = this.expandedIndices;
5630
5625
  }
5631
- attributes(this.element, ariaAttr);
5632
- if (this.expandMode === 'Single') {
5633
- this.element.setAttribute('aria-multiselectable', 'false');
5634
- }
5635
5626
  }
5636
5627
  renderControl() {
5637
5628
  this.trgtEle = (this.element.children.length > 0) ? select('div', this.element) : null;
@@ -5938,18 +5929,15 @@ let Accordion = class Accordion extends Component {
5938
5929
  }
5939
5930
  headerEleGenerate() {
5940
5931
  const header = this.createElement('div', { className: CLS_HEADER, id: getUniqueID('acrdn_header') });
5941
- const items = this.getItems();
5942
5932
  const ariaAttr = {
5943
- 'tabindex': '0', 'role': 'heading', 'aria-label': 'collapsed',
5944
- 'aria-disabled': 'false', 'aria-level': items.length.toString()
5933
+ 'tabindex': '0', 'role': 'button', 'aria-disabled': 'false', 'aria-expanded': 'false'
5945
5934
  };
5946
5935
  attributes(header, ariaAttr);
5947
5936
  return header;
5948
5937
  }
5949
5938
  renderInnerItem(item, index) {
5950
5939
  const innerEle = this.createElement('div', {
5951
- className: CLS_ITEM$1, id: item.id || getUniqueID('acrdn_item'),
5952
- attrs: { 'aria-expanded': 'false', 'role': 'row' }
5940
+ className: CLS_ITEM$1, id: item.id || getUniqueID('acrdn_item')
5953
5941
  });
5954
5942
  if (this.headerTemplate) {
5955
5943
  const ctnEle = this.headerEleGenerate();
@@ -6097,7 +6085,7 @@ let Accordion = class Accordion extends Component {
6097
6085
  const content = select('.' + CLS_CONTENT, itemEle);
6098
6086
  header.setAttribute('aria-controls', content.id);
6099
6087
  content.setAttribute('aria-labelledby', header.id);
6100
- content.setAttribute('role', 'definition');
6088
+ content.setAttribute('role', 'region');
6101
6089
  }
6102
6090
  contentRendering(index) {
6103
6091
  const itemcnt = this.createElement('div', { className: CLS_CONTENT + ' ' + CLS_CTNHIDE, id: getUniqueID('acrdn_panel') });
@@ -6194,8 +6182,7 @@ let Accordion = class Accordion extends Component {
6194
6182
  if (progress === 'end') {
6195
6183
  this.add(trgtItemEle, CLS_ACTIVE);
6196
6184
  trgt.setAttribute('aria-hidden', 'false');
6197
- attributes(trgtItemEle, { 'aria-expanded': 'true' });
6198
- attributes(trgt.previousElementSibling, { 'aria-label': 'expanded' });
6185
+ attributes(trgt.previousElementSibling, { 'aria-expanded': 'true' });
6199
6186
  icon.classList.remove(CLS_TOGANIMATE);
6200
6187
  this.trigger('expanded', eventArgs);
6201
6188
  }
@@ -6309,8 +6296,7 @@ let Accordion = class Accordion extends Component {
6309
6296
  icon.classList.remove(CLS_TOGANIMATE);
6310
6297
  this.remove(trgtItemEle, CLS_ACTIVE);
6311
6298
  trgt.setAttribute('aria-hidden', 'true');
6312
- attributes(trgtItemEle, { 'aria-expanded': 'false' });
6313
- attributes(trgt.previousElementSibling, { 'aria-label': 'collapsed' });
6299
+ attributes(trgt.previousElementSibling, { 'aria-expanded': 'false' });
6314
6300
  this.trigger('expanded', eventArgs);
6315
6301
  }
6316
6302
  }
@@ -6323,14 +6309,6 @@ let Accordion = class Accordion extends Component {
6323
6309
  getModuleName() {
6324
6310
  return 'accordion';
6325
6311
  }
6326
- itemAttribUpdate() {
6327
- const items = this.getItems();
6328
- const itemEle = this.getItemElements();
6329
- const itemLen = items.length;
6330
- itemEle.forEach((ele) => {
6331
- select('.' + CLS_HEADER, ele).setAttribute('aria-level', '' + itemLen);
6332
- });
6333
- }
6334
6312
  getItems() {
6335
6313
  let items;
6336
6314
  if (this.itemTemplate && this.headerTemplate) {
@@ -6370,7 +6348,6 @@ let Accordion = class Accordion extends Component {
6370
6348
  }
6371
6349
  EventHandler.add(innerItemEle.querySelector('.' + CLS_HEADER), 'focus', this.focusIn, this);
6372
6350
  EventHandler.add(innerItemEle.querySelector('.' + CLS_HEADER), 'blur', this.focusOut, this);
6373
- this.itemAttribUpdate();
6374
6351
  this.expandedIndices = [];
6375
6352
  this.expandedItemRefresh(ele);
6376
6353
  if (addItem && addItem.expanded) {
@@ -6410,7 +6387,6 @@ let Accordion = class Accordion extends Component {
6410
6387
  this.restoreContent(index);
6411
6388
  detach(ele);
6412
6389
  items.splice(index, 1);
6413
- this.itemAttribUpdate();
6414
6390
  this.expandedIndices = [];
6415
6391
  this.expandedItemRefresh(this.element);
6416
6392
  }
@@ -6628,8 +6604,12 @@ let Accordion = class Accordion extends Component {
6628
6604
  this.updateItem(item, index);
6629
6605
  }
6630
6606
  if (property === 'cssClass' && !isNullOrUndefined(item)) {
6631
- item.classList.remove(oldVal);
6632
- item.classList.add(newVal);
6607
+ if (oldVal) {
6608
+ removeClass([item], oldVal.split(' '));
6609
+ }
6610
+ if (newVal) {
6611
+ addClass([item], newVal.split(' '));
6612
+ }
6633
6613
  }
6634
6614
  if (property === 'visible' && !isNullOrUndefined(item)) {
6635
6615
  if (Object(newProp.items[index])[property] === false) {
@@ -6691,14 +6671,8 @@ let Accordion = class Accordion extends Component {
6691
6671
  setStyleAttribute(this.element, { 'width': formatUnit(newProp.width) });
6692
6672
  break;
6693
6673
  case 'expandMode':
6694
- if (newProp.expandMode === 'Single') {
6695
- this.element.setAttribute('aria-multiselectable', 'false');
6696
- if (this.expandedIndices.length > 1) {
6697
- this.expandItem(false);
6698
- }
6699
- }
6700
- else {
6701
- this.element.setAttribute('aria-multiselectable', 'true');
6674
+ if (newProp.expandMode === 'Single' && this.expandedIndices.length > 1) {
6675
+ this.expandItem(false);
6702
6676
  }
6703
6677
  break;
6704
6678
  }
@@ -9654,6 +9628,8 @@ let TreeView = TreeView_1 = class TreeView extends Component {
9654
9628
  this.changeDataSource = false;
9655
9629
  this.hasTemplate = false;
9656
9630
  this.isFirstRender = false;
9631
+ // Specifies whether the node is dropped or not
9632
+ this.isNodeDropped = false;
9657
9633
  this.mouseDownStatus = false;
9658
9634
  }
9659
9635
  /**
@@ -10859,11 +10835,12 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10859
10835
  this.updateCheckedProp();
10860
10836
  this.isAnimate = true;
10861
10837
  this.isInitalExpand = false;
10862
- if (!this.isLoaded || this.isFieldChange) {
10838
+ if ((!this.isLoaded || this.isFieldChange) && !this.isNodeDropped) {
10863
10839
  let eventArgs = { data: this.treeData };
10864
10840
  this.trigger('dataBound', eventArgs);
10865
10841
  }
10866
10842
  this.isLoaded = true;
10843
+ this.isNodeDropped = false;
10867
10844
  }
10868
10845
  doSelectionAction() {
10869
10846
  let sNodes = selectAll('.' + SELECTED$1, this.element);
@@ -12076,8 +12053,9 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12076
12053
  let expanded = (currLi.getAttribute('aria-expanded') === 'true') ? true : false;
12077
12054
  let hasChildren = currLi.getAttribute('aria-expanded') !== null ? true : (select('.' + EXPANDABLE, currLi) || select('.' + COLLAPSIBLE, currLi)) != null ? true : false;
12078
12055
  let checked = null;
12079
- if (this.showCheckBox) {
12080
- checked = select('.' + CHECKBOXWRAP, currLi).getAttribute('aria-checked');
12056
+ const checkboxElement = select('.' + CHECKBOXWRAP, currLi);
12057
+ if (this.showCheckBox && checkboxElement) {
12058
+ checked = checkboxElement.getAttribute('aria-checked');
12081
12059
  }
12082
12060
  return {
12083
12061
  id: id, text: text, parentID: pid, selected: selected, expanded: expanded,
@@ -12585,6 +12563,8 @@ let TreeView = TreeView_1 = class TreeView extends Component {
12585
12563
  this.trigger('nodeDropped', this.getDragEvent(e.event, dragObj, dropTarget, e.target, e.dragData.draggedElement, null, level, drop));
12586
12564
  if (dragObj.element.id !== this.element.id) {
12587
12565
  dragObj.triggerEvent();
12566
+ this.isNodeDropped = true;
12567
+ this.fields.dataSource = this.treeData;
12588
12568
  }
12589
12569
  this.triggerEvent();
12590
12570
  }
@@ -14616,7 +14596,7 @@ let Sidebar = class Sidebar extends Component {
14616
14596
  if (!isNullOrUndefined(classELement || this.targetEle)) {
14617
14597
  addClass([classELement || this.targetEle], [MAINCONTENTANIMATION]);
14618
14598
  }
14619
- this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : '0';
14599
+ this.tabIndex = this.element.hasAttribute('tabindex') ? this.element.getAttribute('tabindex') : null;
14620
14600
  if (!this.enableDock && this.type !== 'Auto') {
14621
14601
  addClass([this.element], [VISIBILITY]);
14622
14602
  }
@@ -14626,7 +14606,9 @@ let Sidebar = class Sidebar extends Component {
14626
14606
  if (this.enableDock) {
14627
14607
  addClass([this.element], DOCKER);
14628
14608
  }
14629
- this.element.setAttribute('tabindex', this.tabIndex);
14609
+ if (!isNullOrUndefined(this.tabIndex)) {
14610
+ this.element.setAttribute('tabindex', this.tabIndex);
14611
+ }
14630
14612
  if (this.type === 'Auto' && !Browser.isDevice) {
14631
14613
  this.show();
14632
14614
  }