@syncfusion/ej2-filemanager 21.1.35 → 21.1.37

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.
@@ -5953,10 +5953,11 @@ class ContextMenu$2 {
5953
5953
  this.menuType = 'folder';
5954
5954
  this.contextMenu.items = this.getItemData(this.parent.contextMenuSettings.folder.map((item) => item.trim()));
5955
5955
  this.contextMenu.dataBind();
5956
- if (isTree) {
5956
+ const selectedTreeNode = select('[data-uid="' + this.parent.navigationpaneModule.treeObj.selectedNodes[0] + '"]', this.parent.navigationpaneModule.treeObj.element);
5957
+ if (this.parent.pathNames[this.parent.pathNames.length - 1] === selectedTreeNode.querySelector('.e-list-text').innerHTML && this.parent.activeModule === 'navigationpane') {
5957
5958
  this.disabledItems.push('Open');
5958
5959
  }
5959
- else if (this.parent.selectedItems.length !== 1) {
5960
+ else if (this.parent.selectedItems.length !== 1 && this.parent.activeModule !== 'navigationpane') {
5960
5961
  this.disabledItems.push('Rename', 'Paste');
5961
5962
  }
5962
5963
  }
@@ -6099,10 +6100,13 @@ class ContextMenu$2 {
6099
6100
  refresh(this.parent);
6100
6101
  break;
6101
6102
  case 'open':
6102
- if (this.parent.visitedItem) {
6103
+ if (this.parent.visitedItem && this.parent.activeModule !== 'navigationpane') {
6103
6104
  this.parent.notify(openInit, { target: this.parent.visitedItem });
6104
6105
  }
6105
6106
  else if (this.parent.activeModule === 'navigationpane') {
6107
+ if (this.parent.visitedItem) {
6108
+ this.parent.notify(openInit, { target: this.parent.visitedItem });
6109
+ }
6106
6110
  this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(this.targetNodeElement, 'li'));
6107
6111
  }
6108
6112
  break;
@@ -8420,6 +8424,7 @@ class NavigationPane {
8420
8424
  this.isPathDragged = false;
8421
8425
  this.isRenameParent = false;
8422
8426
  this.isRightClick = false;
8427
+ this.isSameNodeClicked = false;
8423
8428
  this.renameParent = null;
8424
8429
  // Specifies the previously selected nodes in the treeview control.
8425
8430
  this.previousSelected = null;
@@ -8574,7 +8579,7 @@ class NavigationPane {
8574
8579
  }
8575
8580
  // Node Selecting event handler
8576
8581
  onNodeSelecting(args) {
8577
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8582
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8578
8583
  this.restrictSelecting = false;
8579
8584
  this.isNodeClickCalled = false;
8580
8585
  return;
@@ -8583,19 +8588,30 @@ class NavigationPane {
8583
8588
  this.parent.activeModule = 'navigationpane';
8584
8589
  // eslint-disable-next-line
8585
8590
  const nodeData = this.getTreeData(getValue('id', args.nodeData));
8586
- const eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8587
- this.parent.trigger('fileOpen', eventArgs);
8588
- const selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8589
- this.parent.trigger('fileSelect', selecEventArgs);
8590
- args.cancel = eventArgs.cancel;
8591
- if (args.cancel) {
8592
- this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
8593
- this.previousSelected = this.treeObj.selectedNodes;
8594
- this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
8595
- if (!isNullOrUndefined(this.parent) && !isNullOrUndefined(this.parent.contextmenuModule)) {
8596
- this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
8591
+ if (args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1] && !this.isRightClick && !this.isNodeClickCalled || this.isSameNodeClicked) {
8592
+ this.isNodeClickCalled = false;
8593
+ if (!this.isSameNodeClicked) {
8594
+ this.isSameNodeClicked = true;
8595
+ const selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8596
+ this.parent.trigger('fileSelect', selecEventArgs);
8597
+ }
8598
+ if (!this.isRightClick) {
8599
+ const eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8600
+ this.parent.trigger('fileOpen', eventArgs);
8601
+ args.cancel = eventArgs.cancel;
8602
+ }
8603
+ if (args.cancel) {
8604
+ this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
8605
+ this.isNodeClickCalled = true;
8606
+ this.isSameNodeClicked = false;
8607
+ this.previousSelected = this.treeObj.selectedNodes;
8608
+ this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
8597
8609
  }
8598
8610
  }
8611
+ else if (this.previousSelected[0] !== args.node.getAttribute('data-uid')) {
8612
+ const selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8613
+ this.parent.trigger('fileSelect', selecEventArgs);
8614
+ }
8599
8615
  }
8600
8616
  }
8601
8617
  // Opens the folder while clicking open context menu item in the treeview.
@@ -8606,19 +8622,25 @@ class NavigationPane {
8606
8622
  this.parent.itemData = data;
8607
8623
  this.activeNode = node;
8608
8624
  this.parent.activeModule = 'navigationpane';
8609
- updatePath(node, this.parent.itemData[0], this.parent);
8610
- read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8611
- this.parent.visitedItem = node;
8612
- this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8613
- this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8625
+ const eventArgs = { cancel: false, fileDetails: data[0], module: 'NavigationPane' };
8626
+ this.parent.trigger('fileOpen', eventArgs);
8627
+ this.isNodeClickCalled = true;
8628
+ if (!eventArgs.cancel) {
8629
+ updatePath(node, this.parent.itemData[0], this.parent);
8630
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8631
+ this.parent.visitedItem = node;
8632
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8633
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8634
+ }
8614
8635
  }
8615
8636
  onNodeSelected(args) {
8616
8637
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8617
8638
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
8618
8639
  this.parent.isFiltered = false;
8640
+ this.isNodeClickCalled = false;
8619
8641
  }
8620
8642
  this.parent.searchedItems = [];
8621
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent) {
8643
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent) {
8622
8644
  this.parent.pathId = getPathId(args.node);
8623
8645
  return;
8624
8646
  }
@@ -8629,7 +8651,8 @@ class NavigationPane {
8629
8651
  this.parent.selectedItems = [];
8630
8652
  this.parent.itemData = nodeData;
8631
8653
  const previousPath = this.parent.path;
8632
- if (!this.isRightClick) {
8654
+ const sNode = select('[data-uid="' + this.treeObj.selectedNodes[0] + '"]', this.treeObj.element);
8655
+ if (!this.isRightClick && this.isSameNodeClicked && sNode.querySelector('.e-list-text').innerHTML !== this.parent.pathNames[this.parent.pathNames.length - 1]) {
8633
8656
  updatePath(args.node, this.parent.itemData[0], this.parent);
8634
8657
  }
8635
8658
  else {
@@ -8641,12 +8664,13 @@ class NavigationPane {
8641
8664
  if (args.node.querySelector('.' + ICONS) && args.node.querySelector('.' + LIST_ITEM) === null) {
8642
8665
  this.expandNodeTarget = 'add';
8643
8666
  }
8644
- if (!this.isRightClick) {
8667
+ if (!this.isRightClick && this.isSameNodeClicked) {
8645
8668
  read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8669
+ this.isNodeClickCalled = true;
8646
8670
  }
8647
8671
  this.parent.visitedItem = args.node;
8648
8672
  }
8649
- this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8673
+ this.isPathDragged = this.isRenameParent = this.isRightClick = this.isSameNodeClicked = false;
8650
8674
  }
8651
8675
  /* istanbul ignore next */
8652
8676
  // eslint-disable-next-line
@@ -8690,6 +8714,14 @@ class NavigationPane {
8690
8714
  const layout = (this.parent.view === 'LargeIcons') ? 'largeiconsview' : 'detailsview';
8691
8715
  this.parent.notify(modelChanged, { module: layout, newProp: { selectedItems: [] } });
8692
8716
  }
8717
+ else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && !this.isNodeClickCalled) {
8718
+ if (args.event.which === 3) {
8719
+ this.isRightClick = true;
8720
+ }
8721
+ this.isSameNodeClicked = true;
8722
+ this.isNodeClickCalled = true;
8723
+ this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8724
+ }
8693
8725
  }
8694
8726
  /* istanbul ignore next */
8695
8727
  onNodeEditing(args) {