@syncfusion/ej2-filemanager 19.4.42 → 19.4.43

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.
@@ -5701,11 +5701,11 @@ class ContextMenu$2 {
5701
5701
  let data;
5702
5702
  let treeFolder = false;
5703
5703
  let target = args.event.target;
5704
- this.menuTarget = target;
5704
+ this.menuTarget = this.targetNodeElement = target;
5705
5705
  this.currentElement = args.element;
5706
5706
  if (target.classList.contains('e-spinner-pane')) {
5707
5707
  target = this.parent.navigationpaneModule.activeNode.getElementsByClassName(FULLROW)[0];
5708
- this.menuTarget = target;
5708
+ this.menuTarget = this.targetNodeElement = target;
5709
5709
  }
5710
5710
  if (target.classList.contains(FULLROW)) {
5711
5711
  this.parent.selectedItems.length = 0;
@@ -5819,7 +5819,7 @@ class ContextMenu$2 {
5819
5819
  this.enableItems(this.disabledItems, false, true);
5820
5820
  args.cancel = menuOpenArgs.cancel;
5821
5821
  if (menuOpenArgs.cancel) {
5822
- this.menuTarget = this.currentElement = null;
5822
+ this.menuTarget = this.targetNodeElement = this.currentElement = null;
5823
5823
  }
5824
5824
  });
5825
5825
  }
@@ -5938,7 +5938,12 @@ class ContextMenu$2 {
5938
5938
  }
5939
5939
  else {
5940
5940
  this.parent.notify(selectedData, {});
5941
- details = this.parent.itemData;
5941
+ if (this.parent.activeModule === 'navigationpane' && itemText === 'open') {
5942
+ details = [this.menuItemData];
5943
+ }
5944
+ else {
5945
+ details = this.parent.itemData;
5946
+ }
5942
5947
  }
5943
5948
  const eventArgs = {
5944
5949
  cancel: false,
@@ -6015,6 +6020,9 @@ class ContextMenu$2 {
6015
6020
  if (this.parent.visitedItem) {
6016
6021
  this.parent.notify(openInit, { target: this.parent.visitedItem });
6017
6022
  }
6023
+ else if (this.parent.activeModule === 'navigationpane') {
6024
+ this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(this.targetNodeElement, 'li'));
6025
+ }
6018
6026
  break;
6019
6027
  case 'details':
6020
6028
  this.parent.notify(detailsInit, {});
@@ -8051,6 +8059,12 @@ class NavigationPane {
8051
8059
  this.isRenameParent = false;
8052
8060
  this.isRightClick = false;
8053
8061
  this.renameParent = null;
8062
+ // Specifies the previously selected nodes in the treeview control.
8063
+ this.previousSelected = null;
8064
+ // Specifies whether the nodeClicked event of the treeview control is triggered or not.
8065
+ this.isNodeClickCalled = false;
8066
+ // Specifies whether to restrict node selection in the treeview control.
8067
+ this.restrictSelecting = false;
8054
8068
  this.parent = parent;
8055
8069
  this.addEventListener();
8056
8070
  this.keyConfigs = {
@@ -8090,6 +8104,7 @@ class NavigationPane {
8090
8104
  hasChildren: 'hasChild', iconCss: '_fm_icon', htmlAttributes: '_fm_htmlAttr', tooltip: 'name'
8091
8105
  },
8092
8106
  enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
8107
+ nodeSelecting: this.onNodeSelecting.bind(this),
8093
8108
  nodeSelected: this.onNodeSelected.bind(this),
8094
8109
  nodeExpanding: this.onNodeExpand.bind(this),
8095
8110
  nodeClicked: this.onNodeClicked.bind(this),
@@ -8194,6 +8209,44 @@ class NavigationPane {
8194
8209
  this.treeObj.addNodes(directories, target, null, prevent);
8195
8210
  }
8196
8211
  }
8212
+ // Node Selecting event handler
8213
+ onNodeSelecting(args) {
8214
+ if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8215
+ this.restrictSelecting = false;
8216
+ return;
8217
+ }
8218
+ if (!this.renameParent) {
8219
+ this.parent.activeModule = 'navigationpane';
8220
+ // eslint-disable-next-line
8221
+ const nodeData = this.getTreeData(getValue('id', args.nodeData));
8222
+ const eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8223
+ delete eventArgs.cancel;
8224
+ this.parent.trigger('fileOpen', eventArgs);
8225
+ args.cancel = eventArgs.cancel;
8226
+ if (args.cancel) {
8227
+ this.restrictSelecting = true;
8228
+ this.treeObj.selectedNodes = this.isNodeClickCalled ? this.previousSelected : this.treeObj.selectedNodes;
8229
+ this.isNodeClickCalled = false;
8230
+ if (!isNullOrUndefined(this.parent) && !isNullOrUndefined(this.parent.contextmenuModule)) {
8231
+ this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
8232
+ }
8233
+ }
8234
+ }
8235
+ }
8236
+ // Opens the folder while clicking open context menu item in the treeview.
8237
+ openFileOnContextMenuClick(node) {
8238
+ const data = this.treeObj.getTreeData(node);
8239
+ // eslint-disable-next-line
8240
+ this.parent.selectedItems = [];
8241
+ this.parent.itemData = data;
8242
+ this.activeNode = node;
8243
+ this.parent.activeModule = 'navigationpane';
8244
+ updatePath(node, this.parent.itemData[0], this.parent);
8245
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8246
+ this.parent.visitedItem = node;
8247
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8248
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8249
+ }
8197
8250
  onNodeSelected(args) {
8198
8251
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8199
8252
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
@@ -8207,11 +8260,6 @@ class NavigationPane {
8207
8260
  this.parent.activeModule = 'navigationpane';
8208
8261
  // eslint-disable-next-line
8209
8262
  const nodeData = this.getTreeData(getValue('id', args.nodeData));
8210
- if (!this.renameParent) {
8211
- const eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8212
- delete eventArgs.cancel;
8213
- this.parent.trigger('fileOpen', eventArgs);
8214
- }
8215
8263
  this.parent.selectedItems = [];
8216
8264
  this.parent.itemData = nodeData;
8217
8265
  updatePath(args.node, this.parent.itemData[0], this.parent);
@@ -8256,6 +8304,8 @@ class NavigationPane {
8256
8304
  this.activeNode = args.node;
8257
8305
  if ((args.event.which === 3) && (args.node.getAttribute('data-uid') !== this.treeObj.selectedNodes[0])) {
8258
8306
  this.isRightClick = true;
8307
+ this.isNodeClickCalled = true;
8308
+ this.previousSelected = this.treeObj.selectedNodes;
8259
8309
  this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8260
8310
  }
8261
8311
  else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && this.parent.selectedItems.length !== 0) {