@syncfusion/ej2-navigations 31.2.12 → 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.
@@ -3815,6 +3815,10 @@ let Toolbar = class Toolbar extends Component {
3815
3815
  }
3816
3816
  docEvent(e) {
3817
3817
  const popEle = closest(e.target, '.e-popup');
3818
+ if (this.popupTriggeredByToolbar) {
3819
+ this.popupTriggeredByToolbar = false;
3820
+ return;
3821
+ }
3818
3822
  if (this.popObj && isVisible(this.popObj.element) && !popEle && this.overflowMode === 'Popup') {
3819
3823
  this.popObj.hide({ name: 'FadeOut', duration: 100 });
3820
3824
  }
@@ -4189,6 +4193,10 @@ let Toolbar = class Toolbar extends Component {
4189
4193
  const isPopupElement = !isNullOrUndefined(closest(trgt, '.' + CLS_POPUPCLASS));
4190
4194
  let clsList = trgt.classList;
4191
4195
  let popupNav = closest(trgt, ('.' + CLS_TBARNAV));
4196
+ const popupDownIcon = closest(trgt, ('.' + CLS_POPUPDOWN));
4197
+ if (popupDownIcon || popupNav) {
4198
+ this.popupTriggeredByToolbar = true;
4199
+ }
4192
4200
  if (!popupNav) {
4193
4201
  popupNav = trgt;
4194
4202
  }
@@ -11278,25 +11286,23 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11278
11286
  const childKey = typeof this.fields.child === 'string' ? this.fields.child : null;
11279
11287
  const dataId = this.fields.id;
11280
11288
  const parentKey = this.fields.parentID;
11289
+ if (!this.nodeIndex) {
11290
+ this.nodeIndex = new Map();
11291
+ this.buildNodeIndex(this.treeData);
11292
+ }
11281
11293
  const matchesDataUid = (childNode) => {
11282
11294
  if (!isNullOrUndefined(childKey) && childKey in childNode && Array.isArray(childNode[childKey])) {
11283
11295
  const matchNode = childNode[dataId];
11284
- if (!isNullOrUndefined(matchNode)) {
11285
- return matchNode.toString() === dataUid;
11286
- }
11296
+ return !isNullOrUndefined(matchNode) &&
11297
+ matchNode.toString() === dataUid;
11287
11298
  }
11288
11299
  else {
11289
11300
  const childNodePid = childNode[parentKey];
11290
- if (!isNullOrUndefined(childNodePid)) {
11291
- return childNodePid.toString() === dataUid;
11292
- }
11301
+ return !isNullOrUndefined(childNodePid) && childNodePid.toString() === dataUid;
11293
11302
  }
11294
- return false;
11295
11303
  };
11296
11304
  return this.checkedNodes
11297
- .map((checkedNodeId) => {
11298
- return this.getNodeObject(checkedNodeId);
11299
- })
11305
+ .map((id) => this.nodeIndex.get(id))
11300
11306
  .filter((childNode) => {
11301
11307
  if (childNode && typeof childNode === 'object' && (childKey in childNode)) {
11302
11308
  return matchesDataUid(childNode);
@@ -11307,6 +11313,24 @@ let TreeView = TreeView_1 = class TreeView extends Component {
11307
11313
  return false;
11308
11314
  });
11309
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
+ }
11310
11334
  getAllChildNodes(data, parentId) {
11311
11335
  if (isNullOrUndefined(data) || isNullOrUndefined(parentId)) {
11312
11336
  return [];