@syncfusion/ej2-filemanager 26.2.5 → 26.2.10

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.
@@ -3063,11 +3063,17 @@ function createAjax(parent, data, fn, event, operation, targetPath) {
3063
3063
  var action = getValue('action', data);
3064
3064
  var isFileOperation = (action === 'move' || action === 'rename' || action === 'copy' || action === 'delete' || action === 'search') && event !== 'rename-end';
3065
3065
  if (action === 'read' || action === 'create' || event === 'rename-end') {
3066
+ var rootId = parent.fileSystemData
3067
+ .filter(function (item) { return isNullOrUndefined(item.parentId); })
3068
+ .length > 0
3069
+ ? parent.fileSystemData
3070
+ .filter(function (item) { return isNullOrUndefined(item.parentId); })[0].id
3071
+ : 0;
3066
3072
  parent.responseData = {
3067
- cwd: filterById(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? 0 : idValue),
3073
+ cwd: filterById(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? rootId : idValue),
3068
3074
  details: null,
3069
3075
  error: null,
3070
- files: filterByParent(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? 0 : idValue)
3076
+ files: filterByParent(parent, parent.path === '/' && event !== 'node-expand' && event !== 'rename-end-parent' ? rootId : idValue)
3071
3077
  };
3072
3078
  if (isNullOrUndefined(parent.responseData.cwd)) {
3073
3079
  var message = 'Cannot load empty data within the File Manager.';
@@ -3291,19 +3297,33 @@ function triggerAjaxFailure(parent, beforeSendArgs, fn, result, event, operation
3291
3297
  * @private
3292
3298
  */
3293
3299
  function readSuccess(parent, result, event) {
3294
- if (!isNullOrUndefined(result.files)) {
3295
- parent.notify(event, result);
3296
- parent.notify(selectionChanged, {});
3297
- var args = { action: 'read', result: result };
3298
- parent.trigger('success', args);
3299
- }
3300
- else {
3301
- if (result.error.code === '401') {
3302
- result.files = [];
3300
+ try {
3301
+ if (!isNullOrUndefined(result.files)) {
3303
3302
  parent.notify(event, result);
3304
3303
  parent.notify(selectionChanged, {});
3304
+ var args = { action: 'read', result: result };
3305
+ parent.trigger('success', args);
3305
3306
  }
3306
- onFailure(parent, result, 'read');
3307
+ else {
3308
+ if (!isNullOrUndefined(result.error) && result.error.code === '401') {
3309
+ result.files = [];
3310
+ parent.notify(event, result);
3311
+ parent.notify(selectionChanged, {});
3312
+ }
3313
+ onFailure(parent, result, 'read');
3314
+ parent.setProperties({ path: parent.oldPath }, true);
3315
+ parent.pathNames.pop();
3316
+ }
3317
+ }
3318
+ catch (error) {
3319
+ var errorResult = {
3320
+ files: null,
3321
+ error: {
3322
+ message: error.message,
3323
+ fileExists: null
3324
+ }
3325
+ };
3326
+ onFailure(parent, errorResult, 'read');
3307
3327
  parent.setProperties({ path: parent.oldPath }, true);
3308
3328
  parent.pathNames.pop();
3309
3329
  }
@@ -6805,6 +6825,9 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
6805
6825
  }
6806
6826
  else if (closest(target, '#' + this.parent.element.id + TREE_ID)) {
6807
6827
  uid = closest(target, 'li').getAttribute('data-uid');
6828
+ if (!isNullOrUndefined(uid)) {
6829
+ this.parent.navigationpaneModule.treeObj.selectedNodes = [uid];
6830
+ }
6808
6831
  treeFolder = true;
6809
6832
  }
6810
6833
  /* istanbul ignore next */
@@ -7063,12 +7086,7 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
7063
7086
  break;
7064
7087
  case 'paste':
7065
7088
  if (_this.menuType === 'folder') {
7066
- if ((_this.parent.activeModule === 'largeiconsview') || (_this.parent.activeModule === 'detailsview')) {
7067
- _this.parent.folderPath = getFullPath(_this.parent, _this.menuItemData, _this.parent.path);
7068
- }
7069
- else {
7070
- _this.parent.folderPath = '';
7071
- }
7089
+ _this.parent.folderPath = getFullPath(_this.parent, _this.menuItemData, _this.parent.path);
7072
7090
  }
7073
7091
  else {
7074
7092
  _this.parent.folderPath = '';