@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.
@@ -1212,6 +1212,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1212
1212
  _this.isTapHold = false;
1213
1213
  _this.tempItem = [];
1214
1214
  _this.showSubMenuOn = 'Auto';
1215
+ _this.isOpenCalled = false;
1215
1216
  _this.isAnimationNone = false;
1216
1217
  _this.isKBDAction = false;
1217
1218
  return _this;
@@ -2349,7 +2350,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
2349
2350
  }
2350
2351
  }
2351
2352
  this.toggleVisiblity(ul, false);
2352
- if (this.isCMenu && this.enableScrolling && ul) {
2353
+ if ((this.isCMenu || this.isOpenCalled) && this.enableScrolling && ul) {
2353
2354
  ul.style.height = '';
2354
2355
  ul.style.top = '';
2355
2356
  ul.style.left = '';
@@ -3954,6 +3955,10 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
3954
3955
  };
3955
3956
  Toolbar.prototype.docEvent = function (e) {
3956
3957
  var popEle = closest(e.target, '.e-popup');
3958
+ if (this.popupTriggeredByToolbar) {
3959
+ this.popupTriggeredByToolbar = false;
3960
+ return;
3961
+ }
3957
3962
  if (this.popObj && isVisible(this.popObj.element) && !popEle && this.overflowMode === 'Popup') {
3958
3963
  this.popObj.hide({ name: 'FadeOut', duration: 100 });
3959
3964
  }
@@ -4330,6 +4335,10 @@ var Toolbar = /** @__PURE__ @class */ (function (_super) {
4330
4335
  var isPopupElement = !isNullOrUndefined(closest(trgt, '.' + CLS_POPUPCLASS));
4331
4336
  var clsList = trgt.classList;
4332
4337
  var popupNav = closest(trgt, ('.' + CLS_TBARNAV));
4338
+ var popupDownIcon = closest(trgt, ('.' + CLS_POPUPDOWN));
4339
+ if (popupDownIcon || popupNav) {
4340
+ this.popupTriggeredByToolbar = true;
4341
+ }
4333
4342
  if (!popupNav) {
4334
4343
  popupNav = trgt;
4335
4344
  }
@@ -7604,7 +7613,9 @@ var ContextMenu = /** @__PURE__ @class */ (function (_super) {
7604
7613
  * @returns {void}
7605
7614
  */
7606
7615
  ContextMenu.prototype.open = function (top, left, target) {
7616
+ this.isOpenCalled = true;
7607
7617
  _super.prototype.openMenu.call(this, null, null, top, left, null, target);
7618
+ this.isOpenCalled = false;
7608
7619
  };
7609
7620
  /**
7610
7621
  * Closes the ContextMenu if it is opened.
@@ -11612,25 +11623,23 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11612
11623
  var childKey = typeof this.fields.child === 'string' ? this.fields.child : null;
11613
11624
  var dataId = this.fields.id;
11614
11625
  var parentKey = this.fields.parentID;
11626
+ if (!this.nodeIndex) {
11627
+ this.nodeIndex = new Map();
11628
+ this.buildNodeIndex(this.treeData);
11629
+ }
11615
11630
  var matchesDataUid = function (childNode) {
11616
11631
  if (!isNullOrUndefined(childKey) && childKey in childNode && Array.isArray(childNode[childKey])) {
11617
11632
  var matchNode = childNode[dataId];
11618
- if (!isNullOrUndefined(matchNode)) {
11619
- return matchNode.toString() === dataUid;
11620
- }
11633
+ return !isNullOrUndefined(matchNode) &&
11634
+ matchNode.toString() === dataUid;
11621
11635
  }
11622
11636
  else {
11623
11637
  var childNodePid = childNode[parentKey];
11624
- if (!isNullOrUndefined(childNodePid)) {
11625
- return childNodePid.toString() === dataUid;
11626
- }
11638
+ return !isNullOrUndefined(childNodePid) && childNodePid.toString() === dataUid;
11627
11639
  }
11628
- return false;
11629
11640
  };
11630
11641
  return this.checkedNodes
11631
- .map(function (checkedNodeId) {
11632
- return _this.getNodeObject(checkedNodeId);
11633
- })
11642
+ .map(function (id) { return _this.nodeIndex.get(id); })
11634
11643
  .filter(function (childNode) {
11635
11644
  if (childNode && typeof childNode === 'object' && (childKey in childNode)) {
11636
11645
  return matchesDataUid(childNode);
@@ -11641,6 +11650,25 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
11641
11650
  return false;
11642
11651
  });
11643
11652
  };
11653
+ TreeView.prototype.buildNodeIndex = function (nodes) {
11654
+ var _this = this;
11655
+ var childKey = typeof this.fields.child === 'string' ? this.fields.child : null;
11656
+ nodes.forEach(function (node) {
11657
+ var idVal = getValue(_this.fields.id, node);
11658
+ if (idVal != null) {
11659
+ if (!_this.nodeIndex) {
11660
+ _this.nodeIndex = new Map();
11661
+ }
11662
+ _this.nodeIndex.set(idVal.toString(), node);
11663
+ }
11664
+ if (childKey) {
11665
+ var children = getValue(childKey, node);
11666
+ if (Array.isArray(children)) {
11667
+ _this.buildNodeIndex(children);
11668
+ }
11669
+ }
11670
+ });
11671
+ };
11644
11672
  TreeView.prototype.getAllChildNodes = function (data, parentId) {
11645
11673
  if (isNullOrUndefined(data) || isNullOrUndefined(parentId)) {
11646
11674
  return [];