@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.
@@ -5856,11 +5856,11 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
5856
5856
  var data;
5857
5857
  var treeFolder = false;
5858
5858
  var target = args.event.target;
5859
- this.menuTarget = target;
5859
+ this.menuTarget = this.targetNodeElement = target;
5860
5860
  this.currentElement = args.element;
5861
5861
  if (target.classList.contains('e-spinner-pane')) {
5862
5862
  target = this.parent.navigationpaneModule.activeNode.getElementsByClassName(FULLROW)[0];
5863
- this.menuTarget = target;
5863
+ this.menuTarget = this.targetNodeElement = target;
5864
5864
  }
5865
5865
  if (target.classList.contains(FULLROW)) {
5866
5866
  this.parent.selectedItems.length = 0;
@@ -5974,7 +5974,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
5974
5974
  _this.enableItems(_this.disabledItems, false, true);
5975
5975
  args.cancel = menuOpenArgs.cancel;
5976
5976
  if (menuOpenArgs.cancel) {
5977
- _this.menuTarget = _this.currentElement = null;
5977
+ _this.menuTarget = _this.targetNodeElement = _this.currentElement = null;
5978
5978
  }
5979
5979
  });
5980
5980
  };
@@ -6094,7 +6094,12 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6094
6094
  }
6095
6095
  else {
6096
6096
  this.parent.notify(selectedData, {});
6097
- details = this.parent.itemData;
6097
+ if (this.parent.activeModule === 'navigationpane' && itemText === 'open') {
6098
+ details = [this.menuItemData];
6099
+ }
6100
+ else {
6101
+ details = this.parent.itemData;
6102
+ }
6098
6103
  }
6099
6104
  var eventArgs = {
6100
6105
  cancel: false,
@@ -6171,6 +6176,9 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6171
6176
  if (_this.parent.visitedItem) {
6172
6177
  _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6173
6178
  }
6179
+ else if (_this.parent.activeModule === 'navigationpane') {
6180
+ _this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(_this.targetNodeElement, 'li'));
6181
+ }
6174
6182
  break;
6175
6183
  case 'details':
6176
6184
  _this.parent.notify(detailsInit, {});
@@ -8235,6 +8243,12 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8235
8243
  this.isRenameParent = false;
8236
8244
  this.isRightClick = false;
8237
8245
  this.renameParent = null;
8246
+ // Specifies the previously selected nodes in the treeview control.
8247
+ this.previousSelected = null;
8248
+ // Specifies whether the nodeClicked event of the treeview control is triggered or not.
8249
+ this.isNodeClickCalled = false;
8250
+ // Specifies whether to restrict node selection in the treeview control.
8251
+ this.restrictSelecting = false;
8238
8252
  this.parent = parent;
8239
8253
  this.addEventListener();
8240
8254
  this.keyConfigs = {
@@ -8274,6 +8288,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8274
8288
  hasChildren: 'hasChild', iconCss: '_fm_icon', htmlAttributes: '_fm_htmlAttr', tooltip: 'name'
8275
8289
  },
8276
8290
  enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
8291
+ nodeSelecting: this.onNodeSelecting.bind(this),
8277
8292
  nodeSelected: this.onNodeSelected.bind(this),
8278
8293
  nodeExpanding: this.onNodeExpand.bind(this),
8279
8294
  nodeClicked: this.onNodeClicked.bind(this),
@@ -8379,6 +8394,44 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8379
8394
  this.treeObj.addNodes(directories, target, null, prevent);
8380
8395
  }
8381
8396
  };
8397
+ // Node Selecting event handler
8398
+ NavigationPane.prototype.onNodeSelecting = function (args) {
8399
+ if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8400
+ this.restrictSelecting = false;
8401
+ return;
8402
+ }
8403
+ if (!this.renameParent) {
8404
+ this.parent.activeModule = 'navigationpane';
8405
+ // eslint-disable-next-line
8406
+ var nodeData = this.getTreeData(getValue('id', args.nodeData));
8407
+ var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8408
+ delete eventArgs.cancel;
8409
+ this.parent.trigger('fileOpen', eventArgs);
8410
+ args.cancel = eventArgs.cancel;
8411
+ if (args.cancel) {
8412
+ this.restrictSelecting = true;
8413
+ this.treeObj.selectedNodes = this.isNodeClickCalled ? this.previousSelected : this.treeObj.selectedNodes;
8414
+ this.isNodeClickCalled = false;
8415
+ if (!isNullOrUndefined(this.parent) && !isNullOrUndefined(this.parent.contextmenuModule)) {
8416
+ this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
8417
+ }
8418
+ }
8419
+ }
8420
+ };
8421
+ // Opens the folder while clicking open context menu item in the treeview.
8422
+ NavigationPane.prototype.openFileOnContextMenuClick = function (node) {
8423
+ var data = this.treeObj.getTreeData(node);
8424
+ // eslint-disable-next-line
8425
+ this.parent.selectedItems = [];
8426
+ this.parent.itemData = data;
8427
+ this.activeNode = node;
8428
+ this.parent.activeModule = 'navigationpane';
8429
+ updatePath(node, this.parent.itemData[0], this.parent);
8430
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8431
+ this.parent.visitedItem = node;
8432
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8433
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8434
+ };
8382
8435
  NavigationPane.prototype.onNodeSelected = function (args) {
8383
8436
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8384
8437
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
@@ -8392,11 +8445,6 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8392
8445
  this.parent.activeModule = 'navigationpane';
8393
8446
  // eslint-disable-next-line
8394
8447
  var nodeData = this.getTreeData(getValue('id', args.nodeData));
8395
- if (!this.renameParent) {
8396
- var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8397
- delete eventArgs.cancel;
8398
- this.parent.trigger('fileOpen', eventArgs);
8399
- }
8400
8448
  this.parent.selectedItems = [];
8401
8449
  this.parent.itemData = nodeData;
8402
8450
  updatePath(args.node, this.parent.itemData[0], this.parent);
@@ -8441,6 +8489,8 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8441
8489
  this.activeNode = args.node;
8442
8490
  if ((args.event.which === 3) && (args.node.getAttribute('data-uid') !== this.treeObj.selectedNodes[0])) {
8443
8491
  this.isRightClick = true;
8492
+ this.isNodeClickCalled = true;
8493
+ this.previousSelected = this.treeObj.selectedNodes;
8444
8494
  this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8445
8495
  }
8446
8496
  else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && this.parent.selectedItems.length !== 0) {