@syncfusion/ej2-filemanager 28.2.6 → 28.2.11

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.
@@ -1398,7 +1398,7 @@ function getFullPath(parent, data, path) {
1398
1398
  var filePath = getValue(parent.hasId ? 'id' : 'name', data) + '/';
1399
1399
  var fPath = getValue(parent.hasId ? 'filterId' : 'filterPath', data);
1400
1400
  if (!isNullOrUndefined(fPath)) {
1401
- return fPath.replace(/\\/g, '/') + filePath;
1401
+ return fPath.replace(/\\/g, '/').replace(/^.*?(?=\/)/, '') + filePath;
1402
1402
  }
1403
1403
  else {
1404
1404
  return path + filePath;
@@ -4926,7 +4926,7 @@ var LargeIconsView = /** @__PURE__ @class */ (function () {
4926
4926
  this.items = this.allItems = getSortedData(this.parent, this.items);
4927
4927
  }
4928
4928
  iconsView.classList.remove(DISPLAY_NONE);
4929
- if (this.parent.enableVirtualization && this.allItems.length > 0) {
4929
+ if (this.parent.enableVirtualization && this.allItems.length > 0 && !isNullOrUndefined(this.parent.virtualizationModule)) {
4930
4930
  this.parent.virtualizationModule.setUIVirtualization();
4931
4931
  }
4932
4932
  this.listElements = ListBase.createListFromJson(createElement, this.items, this.listObj);
@@ -4968,7 +4968,7 @@ var LargeIconsView = /** @__PURE__ @class */ (function () {
4968
4968
  this.getItemCount();
4969
4969
  this.addEventListener();
4970
4970
  this.wireEvents();
4971
- if (this.parent.enableVirtualization && this.allItems.length > 0) {
4971
+ if (this.parent.enableVirtualization && this.allItems.length > 0 && !isNullOrUndefined(this.parent.virtualizationModule)) {
4972
4972
  this.parent.virtualizationModule.setUlElementHeight();
4973
4973
  this.parent.virtualizationModule.wireScrollEvent(false);
4974
4974
  }
@@ -7211,7 +7211,9 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
7211
7211
  this.parent.trigger('menuClick', eventArgs, function (menuClickArgs) {
7212
7212
  var sItems;
7213
7213
  if (!menuClickArgs.cancel) {
7214
- _this.isMenuItemClicked = true;
7214
+ if (itemText !== 'cut' && itemText !== 'copy') {
7215
+ _this.isMenuItemClicked = true;
7216
+ }
7215
7217
  switch (itemText) {
7216
7218
  case 'cut':
7217
7219
  cutFiles(_this.parent);
@@ -7670,6 +7672,11 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
7670
7672
  //Specifies whether the operating system is MAC or not
7671
7673
  _this.isMac = false;
7672
7674
  _this.dragSelectedItems = [];
7675
+ _this.onScrollHandler = function () {
7676
+ if (!isNullOrUndefined(_this.contextmenuModule) && !isNullOrUndefined(_this.contextmenuModule.contextMenu)) {
7677
+ _this.contextmenuModule.contextMenu.close();
7678
+ }
7679
+ };
7673
7680
  FileManager_1.Inject(BreadCrumbBar, LargeIconsView, ContextMenu);
7674
7681
  return _this;
7675
7682
  }
@@ -8296,6 +8303,9 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
8296
8303
  this.wireSelectOnDragEvent(true);
8297
8304
  }
8298
8305
  EventHandler.add(window, 'resize', this.resizeHandler, this);
8306
+ if (this.contextMenuSettings.visible) {
8307
+ this.element.addEventListener('scroll', this.onScrollHandler, true);
8308
+ }
8299
8309
  this.keyboardModule = new KeyboardEvents(this.element, {
8300
8310
  keyAction: this.keyActionHandler.bind(this),
8301
8311
  keyConfigs: this.keyConfigs,
@@ -8305,6 +8315,9 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
8305
8315
  FileManager.prototype.unWireEvents = function () {
8306
8316
  this.wireSelectOnDragEvent(false);
8307
8317
  EventHandler.remove(window, 'resize', this.resizeHandler);
8318
+ if (this.contextMenuSettings.visible) {
8319
+ this.element.removeEventListener('scroll', this.onScrollHandler, true);
8320
+ }
8308
8321
  this.keyboardModule.destroy();
8309
8322
  };
8310
8323
  FileManager.prototype.onDragStart = function (event) {
@@ -10643,7 +10656,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
10643
10656
  this.updateItemData();
10644
10657
  }
10645
10658
  this.moveNames = [];
10646
- var obj = this.parent.isDragDrop || isFileSystemData(this.parent) ? this.parent.dragData : this.parent.actionRecords;
10659
+ var obj = this.parent.isDragDrop ? this.parent.dragData : this.parent.actionRecords;
10647
10660
  for (var i = 0; i < obj.length; i++) {
10648
10661
  if (getValue('isFile', obj[i]) === false) {
10649
10662
  this.moveNames.push(getValue('_fm_id', obj[i]));
@@ -11014,6 +11027,9 @@ var DetailsView = /** @__PURE__ @class */ (function () {
11014
11027
  }
11015
11028
  this.gridObj.isStringTemplate = true;
11016
11029
  this.gridObj.appendTo('#' + this.parent.element.id + GRID_ID);
11030
+ if (this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization && this.parent.enablePersistence) {
11031
+ this.isLoaded = true;
11032
+ }
11017
11033
  this.wireEvents();
11018
11034
  this.adjustHeight();
11019
11035
  this.emptyArgs = args;
@@ -11272,9 +11288,7 @@ var DetailsView = /** @__PURE__ @class */ (function () {
11272
11288
  /* istanbul ignore next */
11273
11289
  DetailsView.prototype.onDataBound = function () {
11274
11290
  this.createDragObj();
11275
- if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) ||
11276
- ((this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization &&
11277
- this.element.querySelector('.e-content').scrollTop === 0))) {
11291
+ if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) || this.isLoaded) {
11278
11292
  this.selectRecords(this.parent.selectedItems);
11279
11293
  }
11280
11294
  if (this.isPasteOperation === true && (!isNullOrUndefined(this.gridObj.getDataRows()) && this.gridObj.getDataRows().length > 0)) {
@@ -11347,7 +11361,7 @@ var DetailsView = /** @__PURE__ @class */ (function () {
11347
11361
  this.isLoaded = false;
11348
11362
  };
11349
11363
  DetailsView.prototype.selectRecords = function (nodes) {
11350
- var gridRecords = this.gridObj.getCurrentViewRecords();
11364
+ var gridRecords = this.gridObj.dataSource;
11351
11365
  var sRecords = [];
11352
11366
  for (var i = 0, len = gridRecords.length; i < len; i++) {
11353
11367
  var node = this.parent.hasId ? getValue('id', gridRecords[i]) : getName(this.parent, gridRecords[i]);
@@ -12037,7 +12051,9 @@ var DetailsView = /** @__PURE__ @class */ (function () {
12037
12051
  if (this.gridObj.getSelectedRowIndexes().length !== 1) {
12038
12052
  var lastItemIndex = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
12039
12053
  var lastItem = this.gridObj.getRowByIndex(lastItemIndex);
12040
- lastItem.querySelector('.e-checkselect').setAttribute('tabindex', '-1');
12054
+ if (!isNullOrUndefined(lastItem)) {
12055
+ lastItem.querySelector('.e-checkselect').setAttribute('tabindex', '-1');
12056
+ }
12041
12057
  }
12042
12058
  item.querySelector('.e-rowcell.e-fe-checkbox').removeAttribute('tabindex');
12043
12059
  }
@@ -12102,11 +12118,17 @@ var DetailsView = /** @__PURE__ @class */ (function () {
12102
12118
  DetailsView.prototype.onDeSelection = function (args) {
12103
12119
  /* istanbul ignore next */
12104
12120
  if (!this.parent.allowMultiSelection && isNullOrUndefined(args.data)) {
12105
- this.gridObj.getRowByIndex(args.rowIndex).removeAttribute('tabindex');
12121
+ var item = this.gridObj.getRowByIndex(args.rowIndex);
12122
+ if (!isNullOrUndefined(item)) {
12123
+ item.removeAttribute('tabindex');
12124
+ }
12106
12125
  }
12107
12126
  else if (this.gridObj.getSelectedRowIndexes().length > 1) {
12108
12127
  var lastItemIndex = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
12109
- this.gridObj.getRowByIndex(lastItemIndex).querySelector('.e-checkselect').removeAttribute('tabindex');
12128
+ var lastItem = this.gridObj.getRowByIndex(lastItemIndex);
12129
+ if (!isNullOrUndefined(lastItem)) {
12130
+ lastItem.querySelector('.e-checkselect').removeAttribute('tabindex');
12131
+ }
12110
12132
  }
12111
12133
  if (this.gridObj.selectedRowIndex === -1) {
12112
12134
  this.gridObj.element.setAttribute('tabindex', '0');