@syncfusion/ej2-filemanager 33.1.44 → 33.1.45

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 33.1.44
3
+ * version : 33.1.45
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-filemanager",
3
- "version": "33.1.44",
3
+ "version": "33.1.45",
4
4
  "description": "Essential JS 2 FileManager Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,14 +8,14 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-filemanager.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~33.1.44",
11
+ "@syncfusion/ej2-base": "~33.1.45",
12
12
  "@syncfusion/ej2-buttons": "~33.1.44",
13
- "@syncfusion/ej2-data": "~33.1.44",
14
- "@syncfusion/ej2-grids": "~33.1.44",
13
+ "@syncfusion/ej2-data": "~33.1.45",
14
+ "@syncfusion/ej2-grids": "~33.1.45",
15
15
  "@syncfusion/ej2-inputs": "~33.1.44",
16
16
  "@syncfusion/ej2-layouts": "~33.1.44",
17
17
  "@syncfusion/ej2-lists": "~33.1.44",
18
- "@syncfusion/ej2-navigations": "~33.1.44",
18
+ "@syncfusion/ej2-navigations": "~33.1.45",
19
19
  "@syncfusion/ej2-popups": "~33.1.44",
20
20
  "@syncfusion/ej2-splitbuttons": "~33.1.44"
21
21
  },
@@ -890,4 +890,5 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
890
890
  * @returns {void}
891
891
  */
892
892
  private setRtl;
893
+ restoreFocus(): void;
893
894
  }
@@ -1413,6 +1413,20 @@ var FileManager = /** @class */ (function (_super) {
1413
1413
  this.uploadObj.enableRtl = rtl;
1414
1414
  }
1415
1415
  };
1416
+ FileManager.prototype.restoreFocus = function () {
1417
+ if (this.activeModule === 'detailsview') {
1418
+ if (this.detailsviewModule.gridObj) {
1419
+ this.detailsviewModule.addFocus(this.detailsviewModule.gridObj.selectedRowIndex > -1
1420
+ ? this.detailsviewModule.gridObj.selectedRowIndex : 0);
1421
+ }
1422
+ return;
1423
+ }
1424
+ var targetItem = this.largeiconsviewModule.getFocusedItem()
1425
+ || this.visitedItem || this.largeiconsviewModule.getFirstItem();
1426
+ if (targetItem && this.largeiconsviewModule) {
1427
+ this.largeiconsviewModule.addFocus(targetItem);
1428
+ }
1429
+ };
1416
1430
  var FileManager_1;
1417
1431
  __decorate([
1418
1432
  Complex({}, AjaxSettings)
@@ -926,6 +926,7 @@ export interface IFileManager extends Component<HTMLElement> {
926
926
  enableHtmlSanitizer: boolean;
927
927
  refreshLayout(): void;
928
928
  traverseBackward(): void;
929
+ restoreFocus(): void;
929
930
  isMac: boolean;
930
931
  oldView: string;
931
932
  oldPath: string;
@@ -74,6 +74,7 @@ export declare class DetailsView {
74
74
  private onCreateEnd;
75
75
  private onRenameInit;
76
76
  private onSelectedData;
77
+ private nextFocusIndex;
77
78
  private onDeleteInit;
78
79
  private onDeleteEnd;
79
80
  private onRefreshEnd;
@@ -138,7 +139,15 @@ export declare class DetailsView {
138
139
  private checkRowsKey;
139
140
  private InnerItems;
140
141
  private shiftSelectFocusItem;
141
- private addFocus;
142
+ /**
143
+ * Adds focus to the specified grid row.
144
+ *
145
+ * @param {number | null} item - The row index of the item to focus.
146
+ * If null or invalid, no focus is applied.
147
+ * @returns {void}
148
+ * @hidden
149
+ */
150
+ addFocus(item: number | null): void;
142
151
  private addHeaderFocus;
143
152
  private getFocusedItem;
144
153
  private isSelected;
@@ -42,6 +42,7 @@ var DetailsView = /** @class */ (function () {
42
42
  this.isMultiSelect = false;
43
43
  this.pasteOperation = false;
44
44
  this.uploadOperation = false;
45
+ this.nextFocusIndex = null;
45
46
  Grid.Inject(Resize, ContextMenu, Sort, VirtualScroll);
46
47
  this.parent = parent;
47
48
  this.element = select('#' + this.parent.element.id + CLS.GRID_ID, this.parent.element);
@@ -498,6 +499,13 @@ var DetailsView = /** @class */ (function () {
498
499
  sortIconElement.classList.remove('e-icon-ascending', 'e-ascending', 'e-icon-descending', 'e-descending');
499
500
  }
500
501
  }
502
+ if (typeof this.nextFocusIndex === 'number') {
503
+ var rowCount = this.gridObj.getRows().length;
504
+ if (rowCount > 0) {
505
+ this.addFocus(this.nextFocusIndex >= rowCount ? rowCount : this.nextFocusIndex);
506
+ }
507
+ this.nextFocusIndex = null;
508
+ }
501
509
  };
502
510
  DetailsView.prototype.selectRecords = function (nodes) {
503
511
  var gridRecords = this.gridObj.getCurrentViewRecords();
@@ -632,6 +640,21 @@ var DetailsView = /** @class */ (function () {
632
640
  showSpinner(this.parent.element);
633
641
  this.parent.setProperties({ selectedItems: [] }, true);
634
642
  this.gridObj.dataSource = getSortedData(this.parent, args.files);
643
+ if (this.parent._lastFocused && this.parent.pathId && this.parent.pathId.length) {
644
+ var key = this.parent.pathId[this.parent.pathId.length - 1];
645
+ // eslint-disable-next-line security/detect-object-injection
646
+ var mappedId = this.parent._lastFocused[key];
647
+ if (mappedId) {
648
+ var gridItems = getSortedData(this.parent, args.files);
649
+ for (var i = 0; i < gridItems.length; i++) {
650
+ // eslint-disable-next-line security/detect-object-injection
651
+ if (getValue('_fm_id', gridItems[i]) === mappedId || (this.parent.hasId && getValue('id', gridItems[i]) === mappedId) || getValue('name', gridItems[i]) === mappedId) {
652
+ this.nextFocusIndex = i;
653
+ break;
654
+ }
655
+ }
656
+ }
657
+ }
635
658
  this.gridObj.freezeRefresh();
636
659
  if (this.parent.isReact) {
637
660
  this.gridObj.on('reactTemplateRender', this.reactTemplateRender, this);
@@ -691,6 +714,7 @@ var DetailsView = /** @class */ (function () {
691
714
  }
692
715
  var eventArgs = { cancel: false, fileDetails: data, module: 'DetailsView' };
693
716
  this.parent.trigger('fileOpen', eventArgs, function (fileOpenArgs) {
717
+ var _a;
694
718
  if (!fileOpenArgs.cancel) {
695
719
  var name_2 = getValue('name', data);
696
720
  if (getValue('isFile', data)) {
@@ -703,6 +727,9 @@ var DetailsView = /** @class */ (function () {
703
727
  else {
704
728
  var val = _this.parent.breadcrumbbarModule.searchObj.element.value;
705
729
  if (val === '' && !_this.parent.isFiltered) {
730
+ if (_this.parent.pathId && _this.parent.pathId.length) {
731
+ _this.parent._lastFocused = Object.assign(_this.parent._lastFocused || {}, (_a = {}, _a[_this.parent.pathId[_this.parent.pathId.length - 1]] = getValue('_fm_id', data) || getValue('id', data) || name_2, _a));
732
+ }
706
733
  var id = getValue('id', data);
707
734
  _this.parent.oldPath = _this.parent.path;
708
735
  var newPath = _this.parent.path + (isNOU(id) ? name_2 : id) + '/';
@@ -823,6 +850,8 @@ var DetailsView = /** @class */ (function () {
823
850
  };
824
851
  DetailsView.prototype.onDeleteInit = function () {
825
852
  if (this.parent.activeModule === 'detailsview') {
853
+ var selectedIndex = this.gridObj.selectedRowIndex;
854
+ this.nextFocusIndex = selectedIndex >= 0 ? selectedIndex : this.nextFocusIndex;
826
855
  Delete(this.parent, this.parent.selectedItems, this.parent.path, 'delete');
827
856
  }
828
857
  };
@@ -1774,6 +1803,14 @@ var DetailsView = /** @class */ (function () {
1774
1803
  }
1775
1804
  this.startIndex = this.gridObj.selectedRowIndex;
1776
1805
  };
1806
+ /**
1807
+ * Adds focus to the specified grid row.
1808
+ *
1809
+ * @param {number | null} item - The row index of the item to focus.
1810
+ * If null or invalid, no focus is applied.
1811
+ * @returns {void}
1812
+ * @hidden
1813
+ */
1777
1814
  DetailsView.prototype.addFocus = function (item) {
1778
1815
  var fItem = this.getFocusedItem();
1779
1816
  var itemElement = this.gridObj.getRowByIndex(item);
@@ -63,6 +63,7 @@ export declare class LargeIconsView {
63
63
  private onFinalizeEnd;
64
64
  private onCreateEnd;
65
65
  private onSelectedData;
66
+ private nextFocusIndex;
66
67
  private onDeleteInit;
67
68
  private onDeleteEnd;
68
69
  private onRefreshEnd;
@@ -115,9 +116,23 @@ export declare class LargeIconsView {
115
116
  private performRename;
116
117
  private updateRenameData;
117
118
  private getVisitedItem;
118
- private getFocusedItem;
119
+ /**
120
+ *
121
+ * Gets the currently focused item element in the large icon view.
122
+ *
123
+ * @returns {Element} - The DOM element of the focused item, or null if none is focused.
124
+ * @hidden
125
+ */
126
+ getFocusedItem(): Element;
119
127
  private getActiveItem;
120
- private getFirstItem;
128
+ /**
129
+ *
130
+ * Gets the first item element in the large icon view.
131
+ *
132
+ * @returns {Element} - The DOM element representing the first item in the list.
133
+ * @hidden
134
+ */
135
+ getFirstItem(): Element;
121
136
  private getLastItem;
122
137
  private navigateItem;
123
138
  private navigateDown;
@@ -135,7 +150,15 @@ export declare class LargeIconsView {
135
150
  private addActive;
136
151
  private removeActive;
137
152
  private getDataName;
138
- private addFocus;
153
+ /**
154
+ *
155
+ * Adds focus to the specified item element in the large icon view.
156
+ *
157
+ * @param {Element} item - The DOM element representing the item to focus.
158
+ * @returns {void} - If null or invalid, no focus is applied.
159
+ * @hidden
160
+ */
161
+ addFocus(item: Element): void;
139
162
  private checkState;
140
163
  private clearSelect;
141
164
  private resizeHandler;
@@ -37,6 +37,7 @@ var LargeIconsView = /** @class */ (function () {
37
37
  this.isInteracted = true;
38
38
  this.imageEventArgsMap = new Map();
39
39
  this.imageUrlCache = new Map();
40
+ this.nextFocusIndex = null;
40
41
  this.parent = parent;
41
42
  this.element = select('#' + this.parent.element.id + CLS.LARGEICON_ID, this.parent.element);
42
43
  addClass([this.element], CLS.LARGE_ICONS);
@@ -445,6 +446,13 @@ var LargeIconsView = /** @class */ (function () {
445
446
  };
446
447
  LargeIconsView.prototype.onDeleteInit = function () {
447
448
  if (this.parent.activeModule === 'largeiconsview') {
449
+ var activeItem = this.getFocusedItem() || this.getActiveItem();
450
+ if (activeItem) {
451
+ var index = this.itemList.indexOf(activeItem);
452
+ if (index !== -1) {
453
+ this.nextFocusIndex = index;
454
+ }
455
+ }
448
456
  Delete(this.parent, this.parent.selectedItems, this.parent.path, 'delete');
449
457
  }
450
458
  };
@@ -455,6 +463,16 @@ var LargeIconsView = /** @class */ (function () {
455
463
  }
456
464
  this.onLayoutChange(args);
457
465
  this.parent.setProperties({ selectedItems: [] }, true);
466
+ if (typeof this.nextFocusIndex === 'number') {
467
+ var items = this.element.querySelectorAll('li.e-list-item');
468
+ if (items.length > 0) {
469
+ var focusIndex = this.nextFocusIndex >= items.length
470
+ ? (this.nextFocusIndex === items.length ? items.length - 1 : 0) : this.nextFocusIndex;
471
+ // eslint-disable-next-line security/detect-object-injection
472
+ this.addFocus(items[focusIndex]);
473
+ }
474
+ this.nextFocusIndex = null;
475
+ }
458
476
  this.clearSelect();
459
477
  };
460
478
  LargeIconsView.prototype.onRefreshEnd = function (args) {
@@ -482,6 +500,30 @@ var LargeIconsView = /** @class */ (function () {
482
500
  this.clearSelect();
483
501
  this.addSelection(this.parent.renamedItem);
484
502
  }
503
+ var mappedItem = null;
504
+ if (this.parent._lastFocused && this.parent.pathId && this.parent.pathId.length && this.items && this.itemList) {
505
+ var key = this.parent.pathId[this.parent.pathId.length - 1];
506
+ // eslint-disable-next-line security/detect-object-injection
507
+ var mappedId = this.parent._lastFocused[key];
508
+ if (mappedId) {
509
+ var foundIndex = -1;
510
+ for (var i = 0; i < this.items.length; i++) {
511
+ // eslint-disable-next-line security/detect-object-injection
512
+ if (getValue('_fm_id', this.items[i]) === mappedId || (this.parent.hasId && getValue('id', this.items[i]) === mappedId) || getValue('name', this.items[i]) === mappedId) {
513
+ foundIndex = i;
514
+ break;
515
+ }
516
+ }
517
+ // eslint-disable-next-line security/detect-object-injection
518
+ if (foundIndex > -1 && this.itemList[foundIndex]) {
519
+ mappedItem = this.itemList[foundIndex];
520
+ }
521
+ }
522
+ }
523
+ var targetItem = this.getFocusedItem() || mappedItem || this.parent.visitedItem || this.getFirstItem();
524
+ if (targetItem) {
525
+ this.addFocus(targetItem);
526
+ }
485
527
  }
486
528
  };
487
529
  LargeIconsView.prototype.onOpenInit = function (args) {
@@ -937,11 +979,15 @@ var LargeIconsView = /** @class */ (function () {
937
979
  }
938
980
  var eventArgs = { cancel: false, fileDetails: details_1, module: 'LargeIconsView' };
939
981
  this.parent.trigger('fileOpen', eventArgs, function (fileOpenArgs) {
982
+ var _a;
940
983
  if (!fileOpenArgs.cancel) {
941
984
  var text = getValue('name', details_1);
942
985
  if (!_this.parent.isFile) {
943
986
  var val = _this.parent.breadcrumbbarModule.searchObj.element.value;
944
987
  if (val === '' && !_this.parent.isFiltered) {
988
+ if (_this.parent.pathId && _this.parent.pathId.length) {
989
+ _this.parent._lastFocused = Object.assign(_this.parent._lastFocused || {}, (_a = {}, _a[_this.parent.pathId[_this.parent.pathId.length - 1]] = getValue('_fm_id', details_1) || getValue('id', details_1) || text, _a));
990
+ }
945
991
  var id = getValue('id', details_1);
946
992
  _this.parent.oldPath = _this.parent.path;
947
993
  var newPath = _this.parent.path + (isNOU(id) ? text : id) + '/';
@@ -1184,12 +1230,26 @@ var LargeIconsView = /** @class */ (function () {
1184
1230
  var indexes = this.getIndexes([item], this.parent.hasId);
1185
1231
  return this.itemList[indexes[0]];
1186
1232
  };
1233
+ /**
1234
+ *
1235
+ * Gets the currently focused item element in the large icon view.
1236
+ *
1237
+ * @returns {Element} - The DOM element of the focused item, or null if none is focused.
1238
+ * @hidden
1239
+ */
1187
1240
  LargeIconsView.prototype.getFocusedItem = function () {
1188
1241
  return select('.' + CLS.LIST_ITEM + '.' + CLS.FOCUS, this.element);
1189
1242
  };
1190
1243
  LargeIconsView.prototype.getActiveItem = function () {
1191
1244
  return select('.' + CLS.LIST_ITEM + '.' + CLS.ACTIVE, this.element);
1192
1245
  };
1246
+ /**
1247
+ *
1248
+ * Gets the first item element in the large icon view.
1249
+ *
1250
+ * @returns {Element} - The DOM element representing the first item in the list.
1251
+ * @hidden
1252
+ */
1193
1253
  LargeIconsView.prototype.getFirstItem = function () {
1194
1254
  return this.itemList[0];
1195
1255
  };
@@ -1394,6 +1454,14 @@ var LargeIconsView = /** @class */ (function () {
1394
1454
  var data = this.getItemObject(item);
1395
1455
  return getItemName(this.parent, data);
1396
1456
  };
1457
+ /**
1458
+ *
1459
+ * Adds focus to the specified item element in the large icon view.
1460
+ *
1461
+ * @param {Element} item - The DOM element representing the item to focus.
1462
+ * @returns {void} - If null or invalid, no focus is applied.
1463
+ * @hidden
1464
+ */
1397
1465
  LargeIconsView.prototype.addFocus = function (item) {
1398
1466
  this.element.setAttribute('tabindex', '-1');
1399
1467
  var fItem = this.getFocusedItem();
@@ -90,6 +90,9 @@ var ContextMenu = /** @class */ (function () {
90
90
  return;
91
91
  }
92
92
  });
93
+ if (!this.isMenuItemClicked && this.menuTarget) {
94
+ this.parent.restoreFocus();
95
+ }
93
96
  this.menuTarget = null;
94
97
  if (!this.isMenuItemClicked && this.parent.pathId.length > 1 && this.parent.activeModule === 'navigationpane') {
95
98
  this.parent.pathId.pop();
@@ -165,6 +165,9 @@ function triggerPopupOpen(parent, dlgModule, dialogName) {
165
165
  function triggerPopupClose(parent, dlgModule, dialogName) {
166
166
  var args = { popupModule: dlgModule, element: dlgModule.element, popupName: dialogName };
167
167
  parent.trigger('popupClose', args);
168
+ if (dialogName !== 'Duplicate Items') {
169
+ parent.restoreFocus();
170
+ }
168
171
  }
169
172
  /**
170
173
  *