@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.
@@ -1247,7 +1247,7 @@ function getFullPath(parent, data, path) {
1247
1247
  const filePath = getValue(parent.hasId ? 'id' : 'name', data) + '/';
1248
1248
  const fPath = getValue(parent.hasId ? 'filterId' : 'filterPath', data);
1249
1249
  if (!isNullOrUndefined(fPath)) {
1250
- return fPath.replace(/\\/g, '/') + filePath;
1250
+ return fPath.replace(/\\/g, '/').replace(/^.*?(?=\/)/, '') + filePath;
1251
1251
  }
1252
1252
  else {
1253
1253
  return path + filePath;
@@ -4770,7 +4770,7 @@ class LargeIconsView {
4770
4770
  this.items = this.allItems = getSortedData(this.parent, this.items);
4771
4771
  }
4772
4772
  iconsView.classList.remove(DISPLAY_NONE);
4773
- if (this.parent.enableVirtualization && this.allItems.length > 0) {
4773
+ if (this.parent.enableVirtualization && this.allItems.length > 0 && !isNullOrUndefined(this.parent.virtualizationModule)) {
4774
4774
  this.parent.virtualizationModule.setUIVirtualization();
4775
4775
  }
4776
4776
  this.listElements = ListBase.createListFromJson(createElement, this.items, this.listObj);
@@ -4812,7 +4812,7 @@ class LargeIconsView {
4812
4812
  this.getItemCount();
4813
4813
  this.addEventListener();
4814
4814
  this.wireEvents();
4815
- if (this.parent.enableVirtualization && this.allItems.length > 0) {
4815
+ if (this.parent.enableVirtualization && this.allItems.length > 0 && !isNullOrUndefined(this.parent.virtualizationModule)) {
4816
4816
  this.parent.virtualizationModule.setUlElementHeight();
4817
4817
  this.parent.virtualizationModule.wireScrollEvent(false);
4818
4818
  }
@@ -7043,7 +7043,9 @@ class ContextMenu {
7043
7043
  this.parent.trigger('menuClick', eventArgs, (menuClickArgs) => {
7044
7044
  let sItems;
7045
7045
  if (!menuClickArgs.cancel) {
7046
- this.isMenuItemClicked = true;
7046
+ if (itemText !== 'cut' && itemText !== 'copy') {
7047
+ this.isMenuItemClicked = true;
7048
+ }
7047
7049
  switch (itemText) {
7048
7050
  case 'cut':
7049
7051
  cutFiles(this.parent);
@@ -7487,6 +7489,11 @@ let FileManager = FileManager_1 = class FileManager extends Component {
7487
7489
  //Specifies whether the operating system is MAC or not
7488
7490
  this.isMac = false;
7489
7491
  this.dragSelectedItems = [];
7492
+ this.onScrollHandler = () => {
7493
+ if (!isNullOrUndefined(this.contextmenuModule) && !isNullOrUndefined(this.contextmenuModule.contextMenu)) {
7494
+ this.contextmenuModule.contextMenu.close();
7495
+ }
7496
+ };
7490
7497
  FileManager_1.Inject(BreadCrumbBar, LargeIconsView, ContextMenu);
7491
7498
  }
7492
7499
  /**
@@ -8111,6 +8118,9 @@ let FileManager = FileManager_1 = class FileManager extends Component {
8111
8118
  this.wireSelectOnDragEvent(true);
8112
8119
  }
8113
8120
  EventHandler.add(window, 'resize', this.resizeHandler, this);
8121
+ if (this.contextMenuSettings.visible) {
8122
+ this.element.addEventListener('scroll', this.onScrollHandler, true);
8123
+ }
8114
8124
  this.keyboardModule = new KeyboardEvents(this.element, {
8115
8125
  keyAction: this.keyActionHandler.bind(this),
8116
8126
  keyConfigs: this.keyConfigs,
@@ -8120,6 +8130,9 @@ let FileManager = FileManager_1 = class FileManager extends Component {
8120
8130
  unWireEvents() {
8121
8131
  this.wireSelectOnDragEvent(false);
8122
8132
  EventHandler.remove(window, 'resize', this.resizeHandler);
8133
+ if (this.contextMenuSettings.visible) {
8134
+ this.element.removeEventListener('scroll', this.onScrollHandler, true);
8135
+ }
8123
8136
  this.keyboardModule.destroy();
8124
8137
  }
8125
8138
  onDragStart(event) {
@@ -10439,7 +10452,7 @@ class NavigationPane {
10439
10452
  this.updateItemData();
10440
10453
  }
10441
10454
  this.moveNames = [];
10442
- const obj = this.parent.isDragDrop || isFileSystemData(this.parent) ? this.parent.dragData : this.parent.actionRecords;
10455
+ const obj = this.parent.isDragDrop ? this.parent.dragData : this.parent.actionRecords;
10443
10456
  for (let i = 0; i < obj.length; i++) {
10444
10457
  if (getValue('isFile', obj[i]) === false) {
10445
10458
  this.moveNames.push(getValue('_fm_id', obj[i]));
@@ -10808,6 +10821,9 @@ class DetailsView {
10808
10821
  }
10809
10822
  this.gridObj.isStringTemplate = true;
10810
10823
  this.gridObj.appendTo('#' + this.parent.element.id + GRID_ID);
10824
+ if (this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization && this.parent.enablePersistence) {
10825
+ this.isLoaded = true;
10826
+ }
10811
10827
  this.wireEvents();
10812
10828
  this.adjustHeight();
10813
10829
  this.emptyArgs = args;
@@ -11061,9 +11077,7 @@ class DetailsView {
11061
11077
  /* istanbul ignore next */
11062
11078
  onDataBound() {
11063
11079
  this.createDragObj();
11064
- if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) ||
11065
- ((this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization &&
11066
- this.element.querySelector('.e-content').scrollTop === 0))) {
11080
+ if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) || this.isLoaded) {
11067
11081
  this.selectRecords(this.parent.selectedItems);
11068
11082
  }
11069
11083
  if (this.isPasteOperation === true && (!isNullOrUndefined(this.gridObj.getDataRows()) && this.gridObj.getDataRows().length > 0)) {
@@ -11136,7 +11150,7 @@ class DetailsView {
11136
11150
  this.isLoaded = false;
11137
11151
  }
11138
11152
  selectRecords(nodes) {
11139
- const gridRecords = this.gridObj.getCurrentViewRecords();
11153
+ const gridRecords = this.gridObj.dataSource;
11140
11154
  const sRecords = [];
11141
11155
  for (let i = 0, len = gridRecords.length; i < len; i++) {
11142
11156
  const node = this.parent.hasId ? getValue('id', gridRecords[i]) : getName(this.parent, gridRecords[i]);
@@ -11823,7 +11837,9 @@ class DetailsView {
11823
11837
  if (this.gridObj.getSelectedRowIndexes().length !== 1) {
11824
11838
  const lastItemIndex = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
11825
11839
  const lastItem = this.gridObj.getRowByIndex(lastItemIndex);
11826
- lastItem.querySelector('.e-checkselect').setAttribute('tabindex', '-1');
11840
+ if (!isNullOrUndefined(lastItem)) {
11841
+ lastItem.querySelector('.e-checkselect').setAttribute('tabindex', '-1');
11842
+ }
11827
11843
  }
11828
11844
  item.querySelector('.e-rowcell.e-fe-checkbox').removeAttribute('tabindex');
11829
11845
  }
@@ -11888,11 +11904,17 @@ class DetailsView {
11888
11904
  onDeSelection(args) {
11889
11905
  /* istanbul ignore next */
11890
11906
  if (!this.parent.allowMultiSelection && isNullOrUndefined(args.data)) {
11891
- this.gridObj.getRowByIndex(args.rowIndex).removeAttribute('tabindex');
11907
+ const item = this.gridObj.getRowByIndex(args.rowIndex);
11908
+ if (!isNullOrUndefined(item)) {
11909
+ item.removeAttribute('tabindex');
11910
+ }
11892
11911
  }
11893
11912
  else if (this.gridObj.getSelectedRowIndexes().length > 1) {
11894
11913
  const lastItemIndex = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
11895
- this.gridObj.getRowByIndex(lastItemIndex).querySelector('.e-checkselect').removeAttribute('tabindex');
11914
+ const lastItem = this.gridObj.getRowByIndex(lastItemIndex);
11915
+ if (!isNullOrUndefined(lastItem)) {
11916
+ lastItem.querySelector('.e-checkselect').removeAttribute('tabindex');
11917
+ }
11896
11918
  }
11897
11919
  if (this.gridObj.selectedRowIndex === -1) {
11898
11920
  this.gridObj.element.setAttribute('tabindex', '0');