@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.
@@ -6109,10 +6109,11 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6109
6109
  this.menuType = 'folder';
6110
6110
  this.contextMenu.items = this.getItemData(this.parent.contextMenuSettings.folder.map(function (item) { return item.trim(); }));
6111
6111
  this.contextMenu.dataBind();
6112
- if (isTree) {
6112
+ var selectedTreeNode = select('[data-uid="' + this.parent.navigationpaneModule.treeObj.selectedNodes[0] + '"]', this.parent.navigationpaneModule.treeObj.element);
6113
+ if (this.parent.pathNames[this.parent.pathNames.length - 1] === selectedTreeNode.querySelector('.e-list-text').innerHTML && this.parent.activeModule === 'navigationpane') {
6113
6114
  this.disabledItems.push('Open');
6114
6115
  }
6115
- else if (this.parent.selectedItems.length !== 1) {
6116
+ else if (this.parent.selectedItems.length !== 1 && this.parent.activeModule !== 'navigationpane') {
6116
6117
  this.disabledItems.push('Rename', 'Paste');
6117
6118
  }
6118
6119
  };
@@ -6256,10 +6257,13 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6256
6257
  refresh(_this.parent);
6257
6258
  break;
6258
6259
  case 'open':
6259
- if (_this.parent.visitedItem) {
6260
+ if (_this.parent.visitedItem && _this.parent.activeModule !== 'navigationpane') {
6260
6261
  _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6261
6262
  }
6262
6263
  else if (_this.parent.activeModule === 'navigationpane') {
6264
+ if (_this.parent.visitedItem) {
6265
+ _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6266
+ }
6263
6267
  _this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(_this.targetNodeElement, 'li'));
6264
6268
  }
6265
6269
  break;
@@ -8608,6 +8612,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8608
8612
  this.isPathDragged = false;
8609
8613
  this.isRenameParent = false;
8610
8614
  this.isRightClick = false;
8615
+ this.isSameNodeClicked = false;
8611
8616
  this.renameParent = null;
8612
8617
  // Specifies the previously selected nodes in the treeview control.
8613
8618
  this.previousSelected = null;
@@ -8763,7 +8768,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8763
8768
  };
8764
8769
  // Node Selecting event handler
8765
8770
  NavigationPane.prototype.onNodeSelecting = function (args) {
8766
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8771
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8767
8772
  this.restrictSelecting = false;
8768
8773
  this.isNodeClickCalled = false;
8769
8774
  return;
@@ -8772,19 +8777,30 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8772
8777
  this.parent.activeModule = 'navigationpane';
8773
8778
  // eslint-disable-next-line
8774
8779
  var nodeData = this.getTreeData(getValue('id', args.nodeData));
8775
- var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8776
- this.parent.trigger('fileOpen', eventArgs);
8777
- var selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8778
- this.parent.trigger('fileSelect', selecEventArgs);
8779
- args.cancel = eventArgs.cancel;
8780
- if (args.cancel) {
8781
- this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
8782
- this.previousSelected = this.treeObj.selectedNodes;
8783
- this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
8784
- if (!isNullOrUndefined(this.parent) && !isNullOrUndefined(this.parent.contextmenuModule)) {
8785
- this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
8780
+ if (args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1] && !this.isRightClick && !this.isNodeClickCalled || this.isSameNodeClicked) {
8781
+ this.isNodeClickCalled = false;
8782
+ if (!this.isSameNodeClicked) {
8783
+ this.isSameNodeClicked = true;
8784
+ var selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8785
+ this.parent.trigger('fileSelect', selecEventArgs);
8786
+ }
8787
+ if (!this.isRightClick) {
8788
+ var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8789
+ this.parent.trigger('fileOpen', eventArgs);
8790
+ args.cancel = eventArgs.cancel;
8791
+ }
8792
+ if (args.cancel) {
8793
+ this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
8794
+ this.isNodeClickCalled = true;
8795
+ this.isSameNodeClicked = false;
8796
+ this.previousSelected = this.treeObj.selectedNodes;
8797
+ this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
8786
8798
  }
8787
8799
  }
8800
+ else if (this.previousSelected[0] !== args.node.getAttribute('data-uid')) {
8801
+ var selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8802
+ this.parent.trigger('fileSelect', selecEventArgs);
8803
+ }
8788
8804
  }
8789
8805
  };
8790
8806
  // Opens the folder while clicking open context menu item in the treeview.
@@ -8795,19 +8811,25 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8795
8811
  this.parent.itemData = data;
8796
8812
  this.activeNode = node;
8797
8813
  this.parent.activeModule = 'navigationpane';
8798
- updatePath(node, this.parent.itemData[0], this.parent);
8799
- read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8800
- this.parent.visitedItem = node;
8801
- this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8802
- this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8814
+ var eventArgs = { cancel: false, fileDetails: data[0], module: 'NavigationPane' };
8815
+ this.parent.trigger('fileOpen', eventArgs);
8816
+ this.isNodeClickCalled = true;
8817
+ if (!eventArgs.cancel) {
8818
+ updatePath(node, this.parent.itemData[0], this.parent);
8819
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8820
+ this.parent.visitedItem = node;
8821
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8822
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8823
+ }
8803
8824
  };
8804
8825
  NavigationPane.prototype.onNodeSelected = function (args) {
8805
8826
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8806
8827
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
8807
8828
  this.parent.isFiltered = false;
8829
+ this.isNodeClickCalled = false;
8808
8830
  }
8809
8831
  this.parent.searchedItems = [];
8810
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent) {
8832
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent) {
8811
8833
  this.parent.pathId = getPathId(args.node);
8812
8834
  return;
8813
8835
  }
@@ -8818,7 +8840,8 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8818
8840
  this.parent.selectedItems = [];
8819
8841
  this.parent.itemData = nodeData;
8820
8842
  var previousPath = this.parent.path;
8821
- if (!this.isRightClick) {
8843
+ var sNode = select('[data-uid="' + this.treeObj.selectedNodes[0] + '"]', this.treeObj.element);
8844
+ if (!this.isRightClick && this.isSameNodeClicked && sNode.querySelector('.e-list-text').innerHTML !== this.parent.pathNames[this.parent.pathNames.length - 1]) {
8822
8845
  updatePath(args.node, this.parent.itemData[0], this.parent);
8823
8846
  }
8824
8847
  else {
@@ -8830,12 +8853,13 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8830
8853
  if (args.node.querySelector('.' + ICONS) && args.node.querySelector('.' + LIST_ITEM) === null) {
8831
8854
  this.expandNodeTarget = 'add';
8832
8855
  }
8833
- if (!this.isRightClick) {
8856
+ if (!this.isRightClick && this.isSameNodeClicked) {
8834
8857
  read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8858
+ this.isNodeClickCalled = true;
8835
8859
  }
8836
8860
  this.parent.visitedItem = args.node;
8837
8861
  }
8838
- this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8862
+ this.isPathDragged = this.isRenameParent = this.isRightClick = this.isSameNodeClicked = false;
8839
8863
  };
8840
8864
  /* istanbul ignore next */
8841
8865
  // eslint-disable-next-line
@@ -8879,6 +8903,14 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8879
8903
  var layout = (this.parent.view === 'LargeIcons') ? 'largeiconsview' : 'detailsview';
8880
8904
  this.parent.notify(modelChanged, { module: layout, newProp: { selectedItems: [] } });
8881
8905
  }
8906
+ else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && !this.isNodeClickCalled) {
8907
+ if (args.event.which === 3) {
8908
+ this.isRightClick = true;
8909
+ }
8910
+ this.isSameNodeClicked = true;
8911
+ this.isNodeClickCalled = true;
8912
+ this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8913
+ }
8882
8914
  };
8883
8915
  /* istanbul ignore next */
8884
8916
  NavigationPane.prototype.onNodeEditing = function (args) {