@syncfusion/ej2-filemanager 20.4.43 → 20.4.51

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.
Files changed (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/GitLeaksReport.json +1 -0
  3. package/dist/ej2-filemanager.min.js +2 -2
  4. package/dist/ej2-filemanager.umd.min.js +2 -2
  5. package/dist/ej2-filemanager.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-filemanager.es2015.js +326 -207
  7. package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
  8. package/dist/es6/ej2-filemanager.es5.js +332 -230
  9. package/dist/es6/ej2-filemanager.es5.js.map +1 -1
  10. package/dist/global/ej2-filemanager.min.js +2 -2
  11. package/dist/global/ej2-filemanager.min.js.map +1 -1
  12. package/dist/global/index.d.ts +1 -1
  13. package/gitleaks-ci/gitleaks +0 -0
  14. package/gitleaks-ci.tar.gz +0 -0
  15. package/package.json +15 -15
  16. package/src/file-manager/actions/toolbar.js +1 -1
  17. package/src/file-manager/actions/virtualization.d.ts +40 -5
  18. package/src/file-manager/actions/virtualization.js +131 -59
  19. package/src/file-manager/base/file-manager-model.d.ts +10 -14
  20. package/src/file-manager/base/file-manager.d.ts +8 -12
  21. package/src/file-manager/base/file-manager.js +5 -5
  22. package/src/file-manager/base/interface.d.ts +1 -0
  23. package/src/file-manager/layout/details-view.d.ts +6 -0
  24. package/src/file-manager/layout/details-view.js +43 -20
  25. package/src/file-manager/layout/large-icons-view.js +41 -10
  26. package/src/file-manager/layout/navigation-pane.js +14 -5
  27. package/src/file-manager/models/column-model.d.ts +7 -0
  28. package/src/file-manager/models/column.d.ts +6 -0
  29. package/src/file-manager/models/column.js +3 -0
  30. package/src/file-manager/models/details-view-settings.js +1 -1
  31. package/src/file-manager/models/index.d.ts +0 -2
  32. package/src/file-manager/models/index.js +0 -1
  33. package/src/file-manager/pop-up/context-menu.js +3 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.4.43
3
+ * version : 20.4.51
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. 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
Binary file
Binary file
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-filemanager@*",
3
- "_id": "@syncfusion/ej2-filemanager@20.4.42",
3
+ "_id": "@syncfusion/ej2-filemanager@20.4.48",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-3gn1vs7ZNL/58mrRQN2jKIQuMYFuCw96OSSU54F3jKeh2hCr+xcheEnRYHaQ6+rIAeg3HyC4ijxOjN42g/azeg==",
5
+ "_integrity": "sha512-z0ncUKyRMWeiBTK+Oe0uxJnZZoYzRcCWPbJYjAvSpLJIG+7S04niL7CAEgfetqaUlGWp6rRgrnOxEOFJXpWKqQ==",
6
6
  "_location": "/@syncfusion/ej2-filemanager",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,8 +25,8 @@
25
25
  "/@syncfusion/ej2-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-filemanager"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-filemanager/-/ej2-filemanager-20.4.42.tgz",
29
- "_shasum": "f0327d1e9d398dd268b2c4c865a7b646b303a040",
28
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-filemanager/-/ej2-filemanager-20.4.48.tgz",
29
+ "_shasum": "ead0ae91d0e9af5fb740f4a1c2cddbee10613282",
30
30
  "_spec": "@syncfusion/ej2-filemanager@*",
31
31
  "_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
32
32
  "author": {
@@ -37,16 +37,16 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
- "@syncfusion/ej2-base": "~20.4.42",
41
- "@syncfusion/ej2-buttons": "~20.4.42",
42
- "@syncfusion/ej2-data": "~20.4.42",
43
- "@syncfusion/ej2-grids": "~20.4.43",
44
- "@syncfusion/ej2-inputs": "~20.4.42",
45
- "@syncfusion/ej2-layouts": "~20.4.42",
46
- "@syncfusion/ej2-lists": "~20.4.42",
47
- "@syncfusion/ej2-navigations": "~20.4.43",
48
- "@syncfusion/ej2-popups": "~20.4.43",
49
- "@syncfusion/ej2-splitbuttons": "~20.4.42"
40
+ "@syncfusion/ej2-base": "~20.4.51",
41
+ "@syncfusion/ej2-buttons": "~20.4.50",
42
+ "@syncfusion/ej2-data": "~20.4.48",
43
+ "@syncfusion/ej2-grids": "~20.4.51",
44
+ "@syncfusion/ej2-inputs": "~20.4.51",
45
+ "@syncfusion/ej2-layouts": "~20.4.48",
46
+ "@syncfusion/ej2-lists": "~20.4.50",
47
+ "@syncfusion/ej2-navigations": "~20.4.51",
48
+ "@syncfusion/ej2-popups": "~20.4.51",
49
+ "@syncfusion/ej2-splitbuttons": "~20.4.50"
50
50
  },
51
51
  "deprecated": false,
52
52
  "description": "Essential JS 2 FileManager Component",
@@ -76,6 +76,6 @@
76
76
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
77
77
  },
78
78
  "typings": "index.d.ts",
79
- "version": "20.4.43",
79
+ "version": "20.4.51",
80
80
  "sideEffects": false
81
81
  }
@@ -384,7 +384,7 @@ var Toolbar = /** @class */ (function () {
384
384
  this.hideItems(this.selection, true);
385
385
  }
386
386
  var ele = select('#' + this.getId('Selection'), this.toolbarObj.element);
387
- if (this.parent.selectedItems.length > 0 && ele) {
387
+ if (this.parent.selectedItems.length > 0 && ele && !this.parent.enableVirtualization) {
388
388
  var txt = void 0;
389
389
  if (this.parent.selectedItems.length === 1) {
390
390
  txt = this.parent.selectedItems.length + ' ' + getLocaleText(this.parent, 'Item-Selection');
@@ -3,8 +3,8 @@ export declare class Virtualization {
3
3
  constructor(instance: FileManager);
4
4
  private filemanagerInstance;
5
5
  private largeIconInstance;
6
+ private itemCount;
6
7
  private rowItemCount;
7
- private listElements;
8
8
  private items;
9
9
  private itemList;
10
10
  private scrollPosition;
@@ -17,16 +17,48 @@ export declare class Virtualization {
17
17
  private topElement;
18
18
  private bottomElement;
19
19
  private listDiff;
20
- private largeIconsViewItemsCount;
20
+ /**
21
+ * Sets up UI virtualization for the large icon view.
22
+ */
23
+ setUIVirtualization(): void;
24
+ /**
25
+ * Sets the height of the top and bottom elements that are used for virtualization.
26
+ * These elements are used to give the appearance of an infinitely scrolling list.
27
+ */
21
28
  setUlElementHeight(): void;
22
- private ValidateItemCount;
29
+ /**
30
+ * Calculates the number of items to display in the list based on the available width and height.
31
+ * @param dataSourceLength The length of the data source.
32
+ * @returns The number of items to display.
33
+ */
34
+ private getItemCount;
35
+ /**
36
+ * Wires or un wires the scroll event for the list element.
37
+ * @param destroy - Set `true` to unwire the scroll event.
38
+ */
23
39
  wireScrollEvent(destroy: boolean): void;
40
+ /**
41
+ * Handles the scroll event for the list element.
42
+ * This method updates the top and bottom elements and the displayed items based on the scroll position.
43
+ */
24
44
  private onVirtualUiScroll;
45
+ /**
46
+ * Calculates the current scroll position of the list element.
47
+ * @param startingHeight The starting height from which to calculate the scroll position.
48
+ * @returns The current scroll position.
49
+ */
25
50
  private getscrollerHeight;
51
+ /**
52
+ * This method updates the displayed items and the selection based on the scroll direction.
53
+ * @param listDiff The number of rows to update.
54
+ * @param isScrollingDown If set to true, the scroll direction is downward.
55
+ */
26
56
  private onNormalScroll;
57
+ /**
58
+ * Updates the items in the large icons view.
59
+ * @param isScrollingDown If set to true, the scroll direction is downward.
60
+ */
27
61
  private updateUI;
28
- private updateSelection;
29
- private updateCheckState;
30
62
  /**
31
63
  * For internal use only - Get the module name.
32
64
  *
@@ -34,5 +66,8 @@ export declare class Virtualization {
34
66
  * @private
35
67
  */
36
68
  private getModuleName;
69
+ /**
70
+ * Destroys the component.
71
+ */
37
72
  destroy(): void;
38
73
  }
@@ -1,162 +1,229 @@
1
- import { EventHandler, isNullOrUndefined, detach, formatUnit, getValue, addClass, select, closest } from '@syncfusion/ej2-base';
1
+ import { EventHandler, isNullOrUndefined, detach, formatUnit } from '@syncfusion/ej2-base';
2
2
  import { ListBase } from '@syncfusion/ej2-lists';
3
- import { createElement, selectAll, } from '@syncfusion/ej2-base';
3
+ import { createElement, selectAll } from '@syncfusion/ej2-base';
4
4
  import * as CLS from '../base/classes';
5
5
  var Virtualization = /** @class */ (function () {
6
6
  function Virtualization(instance) {
7
- this.largeIconsViewItemsCount = 40;
8
7
  this.filemanagerInstance = instance;
9
8
  this.largeIconInstance = instance.largeiconsviewModule;
10
9
  }
11
- // Update the scroller height based on the items count.
10
+ /**
11
+ * Sets up UI virtualization for the large icon view.
12
+ */
13
+ Virtualization.prototype.setUIVirtualization = function () {
14
+ // Get the current view data source
15
+ var currentViewItems = this.largeIconInstance.items;
16
+ // Get the first item in the data source
17
+ var firstItem = currentViewItems.slice(0, 1);
18
+ // Create a list element from the first item in the data source
19
+ var listElements = ListBase.createListFromJson(createElement, firstItem, this.largeIconInstance.listObj);
20
+ // Get the list items from the list element
21
+ this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
22
+ // Append the list element to the large icon element
23
+ this.largeIconInstance.element.appendChild(listElements);
24
+ // Get the total number of items
25
+ this.itemCount = this.getItemCount(Object.keys(this.largeIconInstance.allItems).length);
26
+ // Remove the first child element from the large icon element
27
+ this.largeIconInstance.element.firstChild.remove();
28
+ // Set the items for the large icon view to the current view data source, limited to the number of items to display
29
+ this.largeIconInstance.items = currentViewItems.slice(0, this.itemCount);
30
+ };
31
+ /**
32
+ * Sets the height of the top and bottom elements that are used for virtualization.
33
+ * These elements are used to give the appearance of an infinitely scrolling list.
34
+ */
12
35
  Virtualization.prototype.setUlElementHeight = function () {
13
- this.rowItemCount = this.ValidateItemCount(Object.keys(this.largeIconInstance.allItems).length);
14
- this.lastRowCount = (this.largeIconInstance.allItems.length - this.largeIconsViewItemsCount) % this.rowItemCount ?
15
- (this.largeIconInstance.allItems.length - this.largeIconsViewItemsCount) % this.rowItemCount : this.rowItemCount;
36
+ // Calculate the number of items in the last row
37
+ this.lastRowCount = (this.largeIconInstance.allItems.length - this.itemCount) % this.rowItemCount ?
38
+ (this.largeIconInstance.allItems.length - this.itemCount) % this.rowItemCount : this.rowItemCount;
39
+ // Create top and bottom elements
16
40
  this.topElement = this.filemanagerInstance.createElement('div');
41
+ this.topElement.classList.add("e-virtual-top");
17
42
  this.largeIconInstance.element.firstElementChild.insertBefore(this.topElement, this.largeIconInstance.element.firstElementChild.firstChild);
18
43
  this.bottomElement = this.filemanagerInstance.createElement('div');
44
+ this.bottomElement.classList.add("e-virtual-bottom");
19
45
  this.largeIconInstance.element.firstElementChild.insertBefore(this.bottomElement, null);
20
- var marginValue = parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-top')) +
21
- parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-bottom'));
46
+ // Get the margin value for list items
47
+ var marginValue = parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-top'), 10) +
48
+ parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-bottom'), 10);
49
+ // Calculate the height of a single list item
22
50
  this.listItemHeight = this.largeIconInstance.itemList[0].getBoundingClientRect().height + marginValue;
51
+ // Calculate the total height of the list
23
52
  this.totalHeight = (Object.keys(this.largeIconInstance.allItems).length / this.rowItemCount) * this.listItemHeight;
53
+ // Set the initial height of the top and bottom elements
24
54
  this.topElement.style.height = 0 + 'px';
25
55
  this.bottomElement.style.height = this.totalHeight + 'px';
56
+ // Initialize the top and bottom element heights
26
57
  this.topElementHeight = 0;
27
58
  this.bottomElementHeight = this.totalHeight;
59
+ // Initialize the list difference variable
28
60
  this.listDiff = 0;
29
- this.renderedCount = this.largeIconsViewItemsCount;
61
+ // Set the initial rendered count
62
+ this.renderedCount = this.itemCount;
30
63
  };
31
- // Calculated the maximum number of items can be rendered in each row.
32
- Virtualization.prototype.ValidateItemCount = function (dataSourceLength) {
33
- var width = parseFloat(formatUnit(this.largeIconInstance.element.firstElementChild.clientWidth));
34
- var marginValue = parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-right')) +
35
- parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-left'));
36
- var itemCount = Math.floor(width / (this.largeIconInstance.itemList[0].offsetWidth + marginValue));
64
+ /**
65
+ * Calculates the number of items to display in the list based on the available width and height.
66
+ * @param dataSourceLength The length of the data source.
67
+ * @returns The number of items to display.
68
+ */
69
+ Virtualization.prototype.getItemCount = function (dataSourceLength) {
70
+ // Get the margin values for list items
71
+ var widthMargin = parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-right'), 10) +
72
+ parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-left'), 10);
73
+ // Calculate the number of items that can fit in a single row
74
+ this.rowItemCount = Math.floor(parseFloat(formatUnit(this.largeIconInstance.element.firstElementChild.clientWidth)) / (this.itemList[0].offsetWidth + widthMargin));
75
+ // Calculate the number of items that can fit in the available height
76
+ var itemCount = this.rowItemCount * (Math.round(parseFloat(formatUnit(this.largeIconInstance.element.clientHeight)) / this.itemList[0].offsetHeight));
77
+ // If the calculated item count is greater than the data source length, set the item count to the data source length
37
78
  if (itemCount > dataSourceLength) {
38
79
  itemCount = dataSourceLength;
39
80
  }
40
81
  return itemCount;
41
82
  };
42
- // Bind the scroll event for large icons view ul element.
83
+ /**
84
+ * Wires or un wires the scroll event for the list element.
85
+ * @param destroy - Set `true` to unwire the scroll event.
86
+ */
43
87
  Virtualization.prototype.wireScrollEvent = function (destroy) {
44
88
  if (!destroy) {
89
+ // Wire the scroll event
45
90
  EventHandler.add(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll, this);
46
91
  }
47
92
  else {
93
+ // Unwire the scroll event
48
94
  EventHandler.remove(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll);
49
95
  }
50
96
  };
51
- // Update the top and bottom element height and update the scroll position.
52
- Virtualization.prototype.onVirtualUiScroll = function (e) {
97
+ /**
98
+ * Handles the scroll event for the list element.
99
+ * This method updates the top and bottom elements and the displayed items based on the scroll position.
100
+ */
101
+ Virtualization.prototype.onVirtualUiScroll = function () {
53
102
  var _a;
103
+ // Set the starting height to 0
54
104
  var startingHeight = 0;
105
+ // Get the current scroll position
55
106
  this.scrollPosition = isNullOrUndefined(this.scrollPosition) ? 0 : this.scrollPosition;
56
107
  var scroll = this.getscrollerHeight(startingHeight);
108
+ // Calculate the height of the top element
57
109
  this.topElementHeight = this.listItemHeight * Math.floor(scroll / this.listItemHeight);
110
+ // Calculate the height of the bottom element
58
111
  this.bottomElementHeight = this.totalHeight - this.topElementHeight;
112
+ // If the scroll position is less than or equal to the total height, set the top and bottom element heights.
113
+ // Otherwise, set the top element height to the total height and the bottom element height to 0.
59
114
  _a = scroll <= this.totalHeight ?
60
115
  [this.topElementHeight, this.bottomElementHeight] : [this.totalHeight, 0], this.topElementHeight = _a[0], this.bottomElementHeight = _a[1];
116
+ // If the top element height has changed, update the top and bottom element heights and re-render the items.
61
117
  if (this.topElementHeight !== parseFloat(this.topElement.style.height)) {
62
118
  this.topElement.style.height = this.topElementHeight + 'px';
63
119
  this.bottomElement.style.height = this.bottomElementHeight + 'px';
64
- // checked whether the scrolling is upward/downward
120
+ // Check whether the scroll direction is upward or downward
65
121
  if (scroll > this.scrollPosition) {
122
+ // Scrolling is upward
66
123
  var listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
67
124
  this.onNormalScroll(listDiff, true);
68
125
  }
69
126
  else {
127
+ // Scrolling is downward
70
128
  var listDiff = Math.round((this.listDiff - (this.topElementHeight / this.listItemHeight)));
71
129
  this.onNormalScroll(listDiff, false);
72
130
  }
73
131
  }
132
+ // Update the list difference and scroll position variables
74
133
  this.listDiff = Math.round(this.topElementHeight / this.listItemHeight);
75
134
  this.scrollPosition = scroll;
135
+ // Update the list of items and the items property of the largeIconInstance
76
136
  this.largeIconInstance.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.largeIconInstance.element));
77
137
  this.largeIconInstance.items = this.largeIconInstance.allItems.slice(this.renderedCount -
78
- this.largeIconsViewItemsCount, this.renderedCount);
138
+ this.itemCount, this.renderedCount);
79
139
  };
80
- // Calculated the scroller height.
140
+ /**
141
+ * Calculates the current scroll position of the list element.
142
+ * @param startingHeight The starting height from which to calculate the scroll position.
143
+ * @returns The current scroll position.
144
+ */
81
145
  Virtualization.prototype.getscrollerHeight = function (startingHeight) {
146
+ // If the scroll position is less than or equal to the starting height, return 0.
147
+ // Otherwise, return the scroll position minus the starting height.
82
148
  return ((this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight) <= 0) ? 0 :
83
149
  (this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight);
84
150
  };
85
- // Update the UI based on the scrolled position.
151
+ /**
152
+ * This method updates the displayed items and the selection based on the scroll direction.
153
+ * @param listDiff The number of rows to update.
154
+ * @param isScrollingDown If set to true, the scroll direction is downward.
155
+ */
86
156
  Virtualization.prototype.onNormalScroll = function (listDiff, isScrollingDown) {
157
+ // Update the displayed items
87
158
  for (var i = 0; i < listDiff; i++) {
88
159
  this.updateUI(isScrollingDown);
89
160
  }
90
- this.updateSelection();
91
161
  };
92
- // Updating the items in large icons view dynamically.
162
+ /**
163
+ * Updates the items in the large icons view.
164
+ * @param isScrollingDown If set to true, the scroll direction is downward.
165
+ */
93
166
  Virtualization.prototype.updateUI = function (isScrollingDown) {
94
167
  var _this = this;
95
168
  if (isScrollingDown) {
169
+ // Get the next batch of items to be displayed
96
170
  this.items = this.largeIconInstance.allItems.slice(this.renderedCount, this.renderedCount + this.rowItemCount);
171
+ // If there are items to be displayed, create list elements for them and append them to the list
97
172
  if (this.items.length > 0) {
98
- this.listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
99
- this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.listElements));
173
+ var listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
174
+ this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
100
175
  this.itemList.forEach(function (liEle) {
101
176
  _this.largeIconInstance.element.firstElementChild.insertBefore(liEle, _this.bottomElement);
102
177
  });
178
+ // Update the rendered count variable
103
179
  this.renderedCount = (this.largeIconInstance.allItems.length >= this.renderedCount + this.rowItemCount) ?
104
180
  this.renderedCount + this.rowItemCount : this.renderedCount + this.lastRowCount;
105
- for (var i_1 = 0; i_1 < this.rowItemCount; i_1++) {
181
+ // Remove the first batch of items from the list
182
+ for (var i = 0; i < this.rowItemCount; i++) {
106
183
  detach(this.topElement.nextElementSibling);
107
184
  }
108
185
  }
109
186
  }
110
187
  else {
188
+ // Scrolling up
111
189
  var lastItemIndex = void 0;
112
190
  var isAllRendered = void 0;
113
- if (this.renderedCount == this.largeIconInstance.allItems.length) {
114
- lastItemIndex = this.renderedCount - (this.largeIconsViewItemsCount - this.rowItemCount + this.lastRowCount);
115
- this.renderedCount = ((this.renderedCount - this.lastRowCount) < this.largeIconsViewItemsCount) ?
116
- this.largeIconsViewItemsCount : (this.renderedCount - this.lastRowCount);
191
+ if (this.renderedCount === this.largeIconInstance.allItems.length) {
192
+ // Set lastItemIndex to the last item in the last row
193
+ lastItemIndex = this.renderedCount - (this.itemCount - this.rowItemCount + this.lastRowCount);
194
+ // Set renderedCount to the total number of items that have been rendered, except for the items in the last row
195
+ this.renderedCount = ((this.renderedCount - this.lastRowCount) < this.itemCount) ?
196
+ this.itemCount : (this.renderedCount - this.lastRowCount);
197
+ // Set isAllRendered to true to indicate that all items have been rendered
117
198
  isAllRendered = true;
118
199
  }
119
200
  else {
120
- lastItemIndex = this.renderedCount - this.largeIconsViewItemsCount;
121
- this.renderedCount = ((this.renderedCount - this.rowItemCount) < this.largeIconsViewItemsCount) ?
122
- this.largeIconsViewItemsCount : (this.renderedCount - this.rowItemCount);
201
+ // Set lastItemIndex to the last item in the current row
202
+ lastItemIndex = this.renderedCount - this.itemCount;
203
+ // Set renderedCount to the total number of items that have been rendered, except for the items in the current row
204
+ this.renderedCount = ((this.renderedCount - this.rowItemCount) < this.itemCount) ?
205
+ this.itemCount : (this.renderedCount - this.rowItemCount);
123
206
  }
207
+ // Set startItemIndex to the first item in the current or previous row
124
208
  var startItemIndex = (lastItemIndex - this.rowItemCount > 0) ? lastItemIndex - this.rowItemCount : 0;
209
+ // Set the items array to the items in the current or previous row
125
210
  this.items = this.largeIconInstance.allItems.slice(startItemIndex, lastItemIndex);
126
211
  if (this.items.length > 0) {
127
- this.listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
128
- this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.listElements));
212
+ // Create a list of elements from the items array
213
+ var listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
214
+ // Set the itemList array to the list items in the list elements
215
+ this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
216
+ // Add the items to the beginning of the list
129
217
  for (var len = this.itemList.length; len > 0; len--) {
130
218
  this.largeIconInstance.element.firstElementChild.insertBefore(this.itemList[len - 1], this.topElement.nextElementSibling);
131
219
  }
220
+ // Remove the last row of items from the list
132
221
  for (var i = 0; i < ((isAllRendered) ? this.lastRowCount : this.rowItemCount); i++) {
133
222
  detach(this.bottomElement.previousElementSibling);
134
223
  }
135
224
  }
136
225
  }
137
226
  };
138
- // Update the selected item state.
139
- Virtualization.prototype.updateSelection = function () {
140
- for (var i = 0; i < this.filemanagerInstance.selectedItems.length; i++) {
141
- for (var j = 0; j < this.items.length; j++) {
142
- if (this.filemanagerInstance.selectedItems[i] == getValue('name', this.items[j])) {
143
- this.updateCheckState(this.itemList[j]);
144
- }
145
- }
146
- }
147
- };
148
- // Update the check state for items.
149
- Virtualization.prototype.updateCheckState = function (liItem) {
150
- if (this.filemanagerInstance.allowMultiSelection) {
151
- addClass([liItem], [CLS.ACTIVE]);
152
- liItem.setAttribute('aria-selected', 'true');
153
- var checkEle = select('.' + CLS.FRAME, liItem);
154
- if (!checkEle.classList.contains(CLS.CHECK)) {
155
- addClass([checkEle], CLS.CHECK);
156
- closest(checkEle, '.' + CLS.CB_WRAP).setAttribute('aria-checked', 'true');
157
- }
158
- }
159
- };
160
227
  /**
161
228
  * For internal use only - Get the module name.
162
229
  *
@@ -166,10 +233,15 @@ var Virtualization = /** @class */ (function () {
166
233
  Virtualization.prototype.getModuleName = function () {
167
234
  return 'virtualization';
168
235
  };
236
+ /**
237
+ * Destroys the component.
238
+ */
169
239
  Virtualization.prototype.destroy = function () {
240
+ // If the file manager has already been destroyed, return immediately
170
241
  if (this.filemanagerInstance.isDestroyed) {
171
242
  return;
172
243
  }
244
+ // If the large icon element has a child element, unwire the scroll event
173
245
  if (!isNullOrUndefined(this.largeIconInstance.element.firstElementChild)) {
174
246
  this.wireScrollEvent(true);
175
247
  }
@@ -1,4 +1,4 @@
1
- import { Component, EmitType, ModuleDeclaration, isNullOrUndefined, L10n, closest } from '@syncfusion/ej2-base';import { Property, INotifyPropertyChanged, NotifyPropertyChanges, Complex, select } from '@syncfusion/ej2-base';import { createElement, addClass, removeClass, setStyleAttribute as setAttr, getUniqueID } from '@syncfusion/ej2-base';import { isNullOrUndefined as isNOU, formatUnit, Browser, KeyboardEvents, KeyboardEventArgs } from '@syncfusion/ej2-base';import { Event, EventHandler, getValue, setValue } from '@syncfusion/ej2-base';import { Splitter, PanePropertiesModel } from '@syncfusion/ej2-layouts';import { Dialog, createSpinner, hideSpinner, showSpinner, BeforeOpenEventArgs, BeforeCloseEventArgs } from '@syncfusion/ej2-popups';import { createDialog, createExtDialog } from '../pop-up/dialog';import { ToolbarSettings, ToolbarSettingsModel, AjaxSettings, NavigationPaneSettings, DetailsViewSettings, VirtualizationSettings } from '../models/index';import { NavigationPaneSettingsModel, DetailsViewSettingsModel, VirtualizationSettingsModel } from '../models/index';import { AjaxSettingsModel, SearchSettings, SearchSettingsModel } from '../models/index';import { Toolbar } from '../actions/toolbar';import { DetailsView } from '../layout/details-view';import { LargeIconsView } from '../layout/large-icons-view';import { Uploader, UploadingEventArgs, SelectedEventArgs, FileInfo, CancelEventArgs } from '@syncfusion/ej2-inputs';import { UploadSettingsModel } from '../models/upload-settings-model';import { UploadSettings } from '../models/upload-settings';import * as events from './constant';import * as CLS from './classes';import { read, filter, createFolder } from '../common/operations';import { ITreeView, IContextMenu, ViewType, SortOrder, FileDragEventArgs, RetryArgs, ReadArgs, FileSelectionEventArgs } from './interface';import { BeforeSendEventArgs, SuccessEventArgs, FailureEventArgs, FileLoadEventArgs } from './interface';import { FileOpenEventArgs, FileSelectEventArgs, MenuClickEventArgs, MenuOpenEventArgs } from './interface';import { ToolbarClickEventArgs, ToolbarCreateEventArgs, UploadListCreateArgs } from './interface';import { PopupOpenCloseEventArgs, BeforePopupOpenCloseEventArgs, BeforeDownloadEventArgs, BeforeImageLoadEventArgs } from './interface';import { refresh, getPathObject, getLocaleText, setNextPath, createDeniedDialog, getCssClass } from '../common/utility';import { hasContentAccess, hasUploadAccess, updateLayout, createNewFolder, uploadItem } from '../common/utility';import { TreeView as BaseTreeView } from '@syncfusion/ej2-navigations';import { ContextMenuSettingsModel } from '../models/contextMenu-settings-model';import { ContextMenuSettings } from '../models/contextMenu-settings';import { BreadCrumbBar } from '../actions/breadcrumb-bar';import { ContextMenu } from '../pop-up/context-menu';import { defaultLocale } from '../models/default-locale';import { PositionModel } from '@syncfusion/ej2-base/src/draggable-model';import { Virtualization } from '../actions/virtualization';
1
+ import { Component, EmitType, ModuleDeclaration, isNullOrUndefined, L10n, closest } from '@syncfusion/ej2-base';import { Property, INotifyPropertyChanged, NotifyPropertyChanges, Complex, select } from '@syncfusion/ej2-base';import { createElement, addClass, removeClass, setStyleAttribute as setAttr, getUniqueID } from '@syncfusion/ej2-base';import { isNullOrUndefined as isNOU, formatUnit, Browser, KeyboardEvents, KeyboardEventArgs } from '@syncfusion/ej2-base';import { Event, EventHandler, getValue, setValue } from '@syncfusion/ej2-base';import { Splitter, PanePropertiesModel } from '@syncfusion/ej2-layouts';import { Dialog, createSpinner, hideSpinner, showSpinner, BeforeOpenEventArgs, BeforeCloseEventArgs } from '@syncfusion/ej2-popups';import { createDialog, createExtDialog } from '../pop-up/dialog';import { ToolbarSettings, ToolbarSettingsModel, AjaxSettings, NavigationPaneSettings, DetailsViewSettings } from '../models/index';import { NavigationPaneSettingsModel, DetailsViewSettingsModel } from '../models/index';import { AjaxSettingsModel, SearchSettings, SearchSettingsModel } from '../models/index';import { Toolbar } from '../actions/toolbar';import { DetailsView } from '../layout/details-view';import { LargeIconsView } from '../layout/large-icons-view';import { Uploader, UploadingEventArgs, SelectedEventArgs, FileInfo, CancelEventArgs } from '@syncfusion/ej2-inputs';import { UploadSettingsModel } from '../models/upload-settings-model';import { UploadSettings } from '../models/upload-settings';import * as events from './constant';import * as CLS from './classes';import { read, filter, createFolder } from '../common/operations';import { ITreeView, IContextMenu, ViewType, SortOrder, FileDragEventArgs, RetryArgs, ReadArgs, FileSelectionEventArgs } from './interface';import { BeforeSendEventArgs, SuccessEventArgs, FailureEventArgs, FileLoadEventArgs } from './interface';import { FileOpenEventArgs, FileSelectEventArgs, MenuClickEventArgs, MenuOpenEventArgs } from './interface';import { ToolbarClickEventArgs, ToolbarCreateEventArgs, UploadListCreateArgs } from './interface';import { PopupOpenCloseEventArgs, BeforePopupOpenCloseEventArgs, BeforeDownloadEventArgs, BeforeImageLoadEventArgs } from './interface';import { refresh, getPathObject, getLocaleText, setNextPath, createDeniedDialog, getCssClass } from '../common/utility';import { hasContentAccess, hasUploadAccess, updateLayout, createNewFolder, uploadItem } from '../common/utility';import { TreeView as BaseTreeView } from '@syncfusion/ej2-navigations';import { ContextMenuSettingsModel } from '../models/contextMenu-settings-model';import { ContextMenuSettings } from '../models/contextMenu-settings';import { BreadCrumbBar } from '../actions/breadcrumb-bar';import { ContextMenu } from '../pop-up/context-menu';import { defaultLocale } from '../models/default-locale';import { PositionModel } from '@syncfusion/ej2-base/src/draggable-model';import { Virtualization } from '../actions/virtualization';
2
2
  import {ComponentModel} from '@syncfusion/ej2-base';
3
3
 
4
4
  /**
@@ -65,19 +65,6 @@ export interface FileManagerModel extends ComponentModel{
65
65
  */
66
66
  detailsViewSettings?: DetailsViewSettingsModel;
67
67
 
68
- /**
69
- * Gets or sets the virtualization settings of the File Manager to load a large set of files/folders.
70
- * When `virtualizationSettings.enable` is true, the file and folders will be loaded based on the count specified in corresponding views.
71
- * By default, 20 files/folders render in the details view and 40 files and folders render in the large icons view.
72
- * The remaining files/folders will be rendered on vertical scroll within File Manager content.
73
- * @default {
74
- * enable: false
75
- * detailsViewItemsCount: 20,
76
- * largeIconsViewItemsCount: 40
77
- * }
78
- */
79
- virtualizationSettings?: VirtualizationSettingsModel;
80
-
81
68
  /**
82
69
  * Defines whether to allow the cross-scripting site or not.
83
70
  *
@@ -95,6 +82,15 @@ export interface FileManagerModel extends ComponentModel{
95
82
  */
96
83
  enablePersistence?: boolean;
97
84
 
85
+ /**
86
+ * Gets or sets a value that enables/disables the virtualization feature of the File Manager.
87
+ * When enabled, the File Manager will only load a subset of files and folders based on the size of the view port, with the rest being loaded dynamically as the user scrolls vertically through the list.
88
+ * This can improve performance when dealing with a large number of files and folders, as it reduces the initial load time and memory usage.
89
+ *
90
+ * @default false
91
+ */
92
+ enableVirtualization?: boolean;
93
+
98
94
  /**
99
95
  * Specifies the height of the file manager.
100
96
  *
@@ -200,18 +200,6 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
200
200
  * }
201
201
  */
202
202
  detailsViewSettings: DetailsViewSettingsModel;
203
- /**
204
- * Gets or sets the virtualization settings of the File Manager to load a large set of files/folders.
205
- * When `virtualizationSettings.enable` is true, the file and folders will be loaded based on the count specified in corresponding views.
206
- * By default, 20 files/folders render in the details view and 40 files and folders render in the large icons view.
207
- * The remaining files/folders will be rendered on vertical scroll within File Manager content.
208
- * @default {
209
- * enable: false
210
- * detailsViewItemsCount: 20,
211
- * largeIconsViewItemsCount: 40
212
- * }
213
- */
214
- private virtualizationSettings;
215
203
  /**
216
204
  * Defines whether to allow the cross-scripting site or not.
217
205
  *
@@ -227,6 +215,14 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
227
215
  * @default false
228
216
  */
229
217
  enablePersistence: boolean;
218
+ /**
219
+ * Gets or sets a value that enables/disables the virtualization feature of the File Manager.
220
+ * When enabled, the File Manager will only load a subset of files and folders based on the size of the view port, with the rest being loaded dynamically as the user scrolls vertically through the list.
221
+ * This can improve performance when dealing with a large number of files and folders, as it reduces the initial load time and memory usage.
222
+ *
223
+ * @default false
224
+ */
225
+ enableVirtualization: boolean;
230
226
  /**
231
227
  * Specifies the height of the file manager.
232
228
  *
@@ -25,7 +25,7 @@ import { Event, EventHandler, getValue, setValue } from '@syncfusion/ej2-base';
25
25
  import { Splitter } from '@syncfusion/ej2-layouts';
26
26
  import { Dialog, createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
27
27
  import { createDialog, createExtDialog } from '../pop-up/dialog';
28
- import { ToolbarSettings, AjaxSettings, NavigationPaneSettings, DetailsViewSettings, VirtualizationSettings } from '../models/index';
28
+ import { ToolbarSettings, AjaxSettings, NavigationPaneSettings, DetailsViewSettings } from '../models/index';
29
29
  import { SearchSettings } from '../models/index';
30
30
  import { LargeIconsView } from '../layout/large-icons-view';
31
31
  import { Uploader } from '@syncfusion/ej2-inputs';
@@ -199,7 +199,7 @@ var FileManager = /** @class */ (function (_super) {
199
199
  args: [this]
200
200
  });
201
201
  }
202
- if (this.virtualizationSettings.enable) {
202
+ if (this.enableVirtualization) {
203
203
  modules.push({
204
204
  member: 'virtualization',
205
205
  args: [this]
@@ -1150,15 +1150,15 @@ var FileManager = /** @class */ (function (_super) {
1150
1150
  __decorate([
1151
1151
  Complex({}, DetailsViewSettings)
1152
1152
  ], FileManager.prototype, "detailsViewSettings", void 0);
1153
- __decorate([
1154
- Complex({}, VirtualizationSettings)
1155
- ], FileManager.prototype, "virtualizationSettings", void 0);
1156
1153
  __decorate([
1157
1154
  Property(true)
1158
1155
  ], FileManager.prototype, "enableHtmlSanitizer", void 0);
1159
1156
  __decorate([
1160
1157
  Property(false)
1161
1158
  ], FileManager.prototype, "enablePersistence", void 0);
1159
+ __decorate([
1160
+ Property(false)
1161
+ ], FileManager.prototype, "enableVirtualization", void 0);
1162
1162
  __decorate([
1163
1163
  Property('400px')
1164
1164
  ], FileManager.prototype, "height", void 0);
@@ -563,6 +563,7 @@ export interface IFileManager extends Component<HTMLElement> {
563
563
  folderPath: string;
564
564
  showFileExtension: boolean;
565
565
  enablePersistence: boolean;
566
+ enableVirtualization: boolean;
566
567
  showHiddenItems: boolean;
567
568
  persistData: boolean;
568
569
  localeObj: L10n;
@@ -38,6 +38,12 @@ export declare class DetailsView {
38
38
  */
39
39
  constructor(parent?: FileManager);
40
40
  private render;
41
+ /**
42
+ * Gets the grid height.
43
+ * @returns The grid height.
44
+ * @private
45
+ */
46
+ private getGridHeight;
41
47
  private checkNameWidth;
42
48
  private adjustWidth;
43
49
  private getColumns;