@syncfusion/ej2-filemanager 21.1.35 → 21.1.39

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.
@@ -1457,7 +1457,7 @@ function sortbyClickHandler(parent, args) {
1457
1457
  tick = false;
1458
1458
  }
1459
1459
  if (!tick) {
1460
- parent.sortBy = getSortField(args.item.id);
1460
+ parent.sortBy = getSortField(args.item.id, parent);
1461
1461
  }
1462
1462
  else {
1463
1463
  parent.sortOrder = getSortField(args.item.id);
@@ -1484,12 +1484,24 @@ function sortbyClickHandler(parent, args) {
1484
1484
  * @returns {string} - returns the sorted fields
1485
1485
  * @private
1486
1486
  */
1487
- function getSortField(id) {
1487
+ function getSortField(id, parent) {
1488
1488
  var text = id.substring(id.lastIndexOf('_') + 1);
1489
1489
  var field = text;
1490
+ var column;
1491
+ if (parent) {
1492
+ column = parent.detailsViewSettings.columns;
1493
+ }
1490
1494
  switch (text) {
1491
1495
  case 'date':
1492
- field = '_fm_modified';
1496
+ for (var i = 0, len = column.length; i < len; i++) {
1497
+ if (column[i].field === 'dateModified' || column[i].field === 'dateCreated') {
1498
+ field = column[i].field;
1499
+ break;
1500
+ }
1501
+ else {
1502
+ field = '_fm_modified';
1503
+ }
1504
+ }
1493
1505
  break;
1494
1506
  case 'ascending':
1495
1507
  field = 'Ascending';
@@ -2689,10 +2701,15 @@ function renameSuccess(parent, result, path) {
2689
2701
  var args = { action: 'rename', result: result };
2690
2702
  parent.trigger('success', args);
2691
2703
  parent.renamedItem = result.files[0];
2704
+ if (getValue('filterPath', parent.renamedItem) === getValue('filterPath', parent.itemData[0]) && parent.pathNames.length > 1) {
2705
+ parent.pathNames[parent.pathNames.length - 1] = parent.renameText;
2706
+ }
2692
2707
  if (parent.activeModule === 'navigationpane') {
2693
2708
  parent.pathId.pop();
2694
2709
  parent.itemData = [getValue(parent.pathId[parent.pathId.length - 1], parent.feParent)];
2695
- read(parent, renameEndParent, getParentPath(parent.path));
2710
+ read(parent, renameEndParent, getValue('filterPath', parent.renamedItem).replace(/\\/g, '/'));
2711
+ parent.itemData[0] = parent.renamedItem;
2712
+ read(parent, pathChanged, parent.path === '/' ? parent.path : getValue('filterPath', parent.renamedItem).replace(/\\/g, '/') + parent.renamedItem.name + '/');
2696
2713
  }
2697
2714
  else {
2698
2715
  parent.itemData = [getPathObject(parent)];
@@ -3710,7 +3727,8 @@ function onReSubmit(parent) {
3710
3727
  parent.dialogObj.hide();
3711
3728
  return;
3712
3729
  }
3713
- var newPath = (parent.activeModule === 'navigationpane') ? getParentPath(parent.path) : parent.path;
3730
+ var newPath = (parent.activeModule === 'navigationpane') ? getValue('filterPath', parent.itemData[0]).replace(/\\/g, '/') : parent.path;
3731
+ parent.renamedId = getValue('id', parent.itemData[0]);
3714
3732
  parent.renamedId = getValue('id', parent.itemData[0]);
3715
3733
  if (parent.isFile) {
3716
3734
  var oldExtension = (oIndex === -1) ? '' : parent.currentItemText.substr(oIndex);
@@ -6109,10 +6127,11 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6109
6127
  this.menuType = 'folder';
6110
6128
  this.contextMenu.items = this.getItemData(this.parent.contextMenuSettings.folder.map(function (item) { return item.trim(); }));
6111
6129
  this.contextMenu.dataBind();
6112
- if (isTree) {
6130
+ var selectedTreeNode = select('[data-uid="' + this.parent.navigationpaneModule.treeObj.selectedNodes[0] + '"]', this.parent.navigationpaneModule.treeObj.element);
6131
+ if (this.parent.pathNames[this.parent.pathNames.length - 1] === selectedTreeNode.querySelector('.e-list-text').innerHTML && this.parent.activeModule === 'navigationpane') {
6113
6132
  this.disabledItems.push('Open');
6114
6133
  }
6115
- else if (this.parent.selectedItems.length !== 1) {
6134
+ else if (this.parent.selectedItems.length !== 1 && this.parent.activeModule !== 'navigationpane') {
6116
6135
  this.disabledItems.push('Rename', 'Paste');
6117
6136
  }
6118
6137
  };
@@ -6256,10 +6275,13 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6256
6275
  refresh(_this.parent);
6257
6276
  break;
6258
6277
  case 'open':
6259
- if (_this.parent.visitedItem) {
6278
+ if (_this.parent.visitedItem && _this.parent.activeModule !== 'navigationpane') {
6260
6279
  _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6261
6280
  }
6262
6281
  else if (_this.parent.activeModule === 'navigationpane') {
6282
+ if (_this.parent.visitedItem) {
6283
+ _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6284
+ }
6263
6285
  _this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(_this.targetNodeElement, 'li'));
6264
6286
  }
6265
6287
  break;
@@ -8070,7 +8092,12 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
8070
8092
  items[itemCount].iconCss = this.parent.sortBy === 'size' ? TB_OPTION_DOT : '';
8071
8093
  }
8072
8094
  else if (items[itemCount].id === this.getPupupId('date')) {
8073
- items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? TB_OPTION_DOT : '';
8095
+ if (this.parent.sortBy === 'dateModified' || this.parent.sortBy === 'dateCreated') {
8096
+ items[itemCount].iconCss = this.parent.sortBy === this.parent.sortBy ? TB_OPTION_DOT : '';
8097
+ }
8098
+ else {
8099
+ items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? TB_OPTION_DOT : '';
8100
+ }
8074
8101
  }
8075
8102
  else if (items[itemCount].id === this.getPupupId('ascending')) {
8076
8103
  items[itemCount].iconCss = this.parent.sortOrder === 'Ascending' ? TB_OPTION_TICK : '';
@@ -8608,6 +8635,8 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8608
8635
  this.isPathDragged = false;
8609
8636
  this.isRenameParent = false;
8610
8637
  this.isRightClick = false;
8638
+ this.isSameNodeClicked = false;
8639
+ this.isNodeExpandCalled = false;
8611
8640
  this.renameParent = null;
8612
8641
  // Specifies the previously selected nodes in the treeview control.
8613
8642
  this.previousSelected = null;
@@ -8763,7 +8792,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8763
8792
  };
8764
8793
  // Node Selecting event handler
8765
8794
  NavigationPane.prototype.onNodeSelecting = function (args) {
8766
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8795
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8767
8796
  this.restrictSelecting = false;
8768
8797
  this.isNodeClickCalled = false;
8769
8798
  return;
@@ -8772,19 +8801,30 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8772
8801
  this.parent.activeModule = 'navigationpane';
8773
8802
  // eslint-disable-next-line
8774
8803
  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);
8804
+ if (args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1] && !this.isRightClick && !this.isNodeClickCalled || this.isSameNodeClicked) {
8805
+ this.isNodeClickCalled = false;
8806
+ if (!this.isSameNodeClicked) {
8807
+ this.isSameNodeClicked = true;
8808
+ var selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8809
+ this.parent.trigger('fileSelect', selecEventArgs);
8810
+ }
8811
+ if (!this.isRightClick && args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1]) {
8812
+ var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8813
+ this.parent.trigger('fileOpen', eventArgs);
8814
+ args.cancel = eventArgs.cancel;
8815
+ }
8816
+ if (args.cancel) {
8817
+ this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
8818
+ this.isNodeClickCalled = true;
8819
+ this.isSameNodeClicked = false;
8820
+ this.previousSelected = this.treeObj.selectedNodes;
8821
+ this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
8786
8822
  }
8787
8823
  }
8824
+ else if (this.previousSelected[0] !== args.node.getAttribute('data-uid')) {
8825
+ var selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8826
+ this.parent.trigger('fileSelect', selecEventArgs);
8827
+ }
8788
8828
  }
8789
8829
  };
8790
8830
  // Opens the folder while clicking open context menu item in the treeview.
@@ -8795,19 +8835,25 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8795
8835
  this.parent.itemData = data;
8796
8836
  this.activeNode = node;
8797
8837
  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')];
8838
+ var eventArgs = { cancel: false, fileDetails: data[0], module: 'NavigationPane' };
8839
+ this.parent.trigger('fileOpen', eventArgs);
8840
+ this.isNodeClickCalled = true;
8841
+ if (!eventArgs.cancel) {
8842
+ updatePath(node, this.parent.itemData[0], this.parent);
8843
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8844
+ this.parent.visitedItem = node;
8845
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8846
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8847
+ }
8803
8848
  };
8804
8849
  NavigationPane.prototype.onNodeSelected = function (args) {
8805
8850
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8806
8851
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
8807
8852
  this.parent.isFiltered = false;
8853
+ this.isNodeClickCalled = false;
8808
8854
  }
8809
8855
  this.parent.searchedItems = [];
8810
- if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent) {
8856
+ if (!args.isInteracted && !this.isRightClick && !this.isSameNodeClicked && !this.isPathDragged && !this.isRenameParent) {
8811
8857
  this.parent.pathId = getPathId(args.node);
8812
8858
  return;
8813
8859
  }
@@ -8818,7 +8864,8 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8818
8864
  this.parent.selectedItems = [];
8819
8865
  this.parent.itemData = nodeData;
8820
8866
  var previousPath = this.parent.path;
8821
- if (!this.isRightClick) {
8867
+ var sNode = select('[data-uid="' + this.treeObj.selectedNodes[0] + '"]', this.treeObj.element);
8868
+ if (!this.isRightClick && this.isSameNodeClicked && sNode.querySelector('.e-list-text').innerHTML !== this.parent.pathNames[this.parent.pathNames.length - 1]) {
8822
8869
  updatePath(args.node, this.parent.itemData[0], this.parent);
8823
8870
  }
8824
8871
  else {
@@ -8830,12 +8877,13 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8830
8877
  if (args.node.querySelector('.' + ICONS) && args.node.querySelector('.' + LIST_ITEM) === null) {
8831
8878
  this.expandNodeTarget = 'add';
8832
8879
  }
8833
- if (!this.isRightClick) {
8880
+ if (!this.isRightClick && this.isSameNodeClicked) {
8834
8881
  read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8882
+ this.isNodeClickCalled = true;
8835
8883
  }
8836
8884
  this.parent.visitedItem = args.node;
8837
8885
  }
8838
- this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8886
+ this.isPathDragged = this.isRenameParent = this.isRightClick = this.isSameNodeClicked = false;
8839
8887
  };
8840
8888
  /* istanbul ignore next */
8841
8889
  // eslint-disable-next-line
@@ -8858,12 +8906,14 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8858
8906
  this.parent.expandedId = this.expandNodeTarget;
8859
8907
  this.parent.itemData = this.getTreeData(getValue('id', args.nodeData));
8860
8908
  read(this.parent, nodeExpand, path);
8909
+ this.isNodeExpandCalled = true;
8861
8910
  }
8862
8911
  };
8863
8912
  /* istanbul ignore next */
8864
8913
  NavigationPane.prototype.onNodeExpanded = function (args) {
8865
8914
  this.addChild(args.files, this.expandNodeTarget, false);
8866
8915
  this.parent.expandedId = null;
8916
+ this.isNodeExpandCalled = false;
8867
8917
  };
8868
8918
  NavigationPane.prototype.onNodeClicked = function (args) {
8869
8919
  this.parent.activeModule = 'navigationpane';
@@ -8879,6 +8929,14 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8879
8929
  var layout = (this.parent.view === 'LargeIcons') ? 'largeiconsview' : 'detailsview';
8880
8930
  this.parent.notify(modelChanged, { module: layout, newProp: { selectedItems: [] } });
8881
8931
  }
8932
+ else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && !this.isNodeClickCalled && !this.isNodeExpandCalled) {
8933
+ if (args.event.which === 3) {
8934
+ this.isRightClick = true;
8935
+ }
8936
+ this.isSameNodeClicked = true;
8937
+ this.isNodeClickCalled = true;
8938
+ this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8939
+ }
8882
8940
  };
8883
8941
  /* istanbul ignore next */
8884
8942
  NavigationPane.prototype.onNodeEditing = function (args) {