@syncfusion/ej2-navigations 31.2.5 → 31.2.16

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.
@@ -1139,6 +1139,7 @@ let MenuBase = class MenuBase extends Component {
1139
1139
  this.isTapHold = false;
1140
1140
  this.tempItem = [];
1141
1141
  this.showSubMenuOn = 'Auto';
1142
+ this.isOpenCalled = false;
1142
1143
  this.isAnimationNone = false;
1143
1144
  this.isKBDAction = false;
1144
1145
  }
@@ -2258,7 +2259,7 @@ let MenuBase = class MenuBase extends Component {
2258
2259
  }
2259
2260
  }
2260
2261
  this.toggleVisiblity(ul, false);
2261
- if (this.isCMenu && this.enableScrolling && ul) {
2262
+ if ((this.isCMenu || this.isOpenCalled) && this.enableScrolling && ul) {
2262
2263
  ul.style.height = '';
2263
2264
  ul.style.top = '';
2264
2265
  ul.style.left = '';
@@ -3814,6 +3815,10 @@ let Toolbar = class Toolbar extends Component {
3814
3815
  }
3815
3816
  docEvent(e) {
3816
3817
  const popEle = closest(e.target, '.e-popup');
3818
+ if (this.popupTriggeredByToolbar) {
3819
+ this.popupTriggeredByToolbar = false;
3820
+ return;
3821
+ }
3817
3822
  if (this.popObj && isVisible(this.popObj.element) && !popEle && this.overflowMode === 'Popup') {
3818
3823
  this.popObj.hide({ name: 'FadeOut', duration: 100 });
3819
3824
  }
@@ -4188,6 +4193,10 @@ let Toolbar = class Toolbar extends Component {
4188
4193
  const isPopupElement = !isNullOrUndefined(closest(trgt, '.' + CLS_POPUPCLASS));
4189
4194
  let clsList = trgt.classList;
4190
4195
  let popupNav = closest(trgt, ('.' + CLS_TBARNAV));
4196
+ const popupDownIcon = closest(trgt, ('.' + CLS_POPUPDOWN));
4197
+ if (popupDownIcon || popupNav) {
4198
+ this.popupTriggeredByToolbar = true;
4199
+ }
4191
4200
  if (!popupNav) {
4192
4201
  popupNav = trgt;
4193
4202
  }
@@ -7387,7 +7396,9 @@ let ContextMenu = class ContextMenu extends MenuBase {
7387
7396
  * @returns {void}
7388
7397
  */
7389
7398
  open(top, left, target) {
7399
+ this.isOpenCalled = true;
7390
7400
  super.openMenu(null, null, top, left, null, target);
7401
+ this.isOpenCalled = false;
7391
7402
  }
7392
7403
  /**
7393
7404
  * Closes the ContextMenu if it is opened.
@@ -11275,25 +11286,23 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11275
11286
  const childKey = typeof this.fields.child === 'string' ? this.fields.child : null;
11276
11287
  const dataId = this.fields.id;
11277
11288
  const parentKey = this.fields.parentID;
11289
+ if (!this.nodeIndex) {
11290
+ this.nodeIndex = new Map();
11291
+ this.buildNodeIndex(this.treeData);
11292
+ }
11278
11293
  const matchesDataUid = (childNode) => {
11279
11294
  if (!isNullOrUndefined(childKey) && childKey in childNode && Array.isArray(childNode[childKey])) {
11280
11295
  const matchNode = childNode[dataId];
11281
- if (!isNullOrUndefined(matchNode)) {
11282
- return matchNode.toString() === dataUid;
11283
- }
11296
+ return !isNullOrUndefined(matchNode) &&
11297
+ matchNode.toString() === dataUid;
11284
11298
  }
11285
11299
  else {
11286
11300
  const childNodePid = childNode[parentKey];
11287
- if (!isNullOrUndefined(childNodePid)) {
11288
- return childNodePid.toString() === dataUid;
11289
- }
11301
+ return !isNullOrUndefined(childNodePid) && childNodePid.toString() === dataUid;
11290
11302
  }
11291
- return false;
11292
11303
  };
11293
11304
  return this.checkedNodes
11294
- .map((checkedNodeId) => {
11295
- return this.getNodeObject(checkedNodeId);
11296
- })
11305
+ .map((id) => this.nodeIndex.get(id))
11297
11306
  .filter((childNode) => {
11298
11307
  if (childNode && typeof childNode === 'object' && (childKey in childNode)) {
11299
11308
  return matchesDataUid(childNode);
@@ -11304,6 +11313,24 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11304
11313
  return false;
11305
11314
  });
11306
11315
  }
11316
+ buildNodeIndex(nodes) {
11317
+ const childKey = typeof this.fields.child === 'string' ? this.fields.child : null;
11318
+ nodes.forEach((node) => {
11319
+ const idVal = getValue(this.fields.id, node);
11320
+ if (idVal != null) {
11321
+ if (!this.nodeIndex) {
11322
+ this.nodeIndex = new Map();
11323
+ }
11324
+ this.nodeIndex.set(idVal.toString(), node);
11325
+ }
11326
+ if (childKey) {
11327
+ const children = getValue(childKey, node);
11328
+ if (Array.isArray(children)) {
11329
+ this.buildNodeIndex(children);
11330
+ }
11331
+ }
11332
+ });
11333
+ }
11307
11334
  getAllChildNodes(data, parentId) {
11308
11335
  if (isNullOrUndefined(data) || isNullOrUndefined(parentId)) {
11309
11336
  return [];