@syncfusion/ej2-filemanager 20.1.52-10459 → 20.1.52-10460
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.
- package/.eslintrc.json +3 -20
- package/CHANGELOG.md +410 -0
- package/README.md +43 -54
- package/dist/ej2-filemanager.umd.min.js +10 -1
- package/dist/ej2-filemanager.umd.min.js.map +1 -1
- package/dist/es6/ej2-filemanager.es2015.js +659 -2353
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +708 -2421
- package/dist/es6/ej2-filemanager.es5.js.map +1 -1
- package/dist/global/ej2-filemanager.min.js +10 -1
- package/dist/global/ej2-filemanager.min.js.map +1 -1
- package/dist/global/index.d.ts +9 -0
- package/helpers/e2e/filemanagerHelper.js +166 -183
- package/package.json +71 -71
- package/src/file-manager/actions/breadcrumb-bar.js +5 -1
- package/src/file-manager/actions/index.d.ts +0 -1
- package/src/file-manager/actions/index.js +0 -1
- package/src/file-manager/actions/toolbar.d.ts +0 -1
- package/src/file-manager/actions/toolbar.js +17 -129
- package/src/file-manager/base/file-manager-model.d.ts +28 -154
- package/src/file-manager/base/file-manager.d.ts +27 -176
- package/src/file-manager/base/file-manager.js +28 -244
- package/src/file-manager/base/interface.d.ts +3 -329
- package/src/file-manager/base/interface.js +1 -0
- package/src/file-manager/common/operations.d.ts +0 -7
- package/src/file-manager/common/operations.js +185 -830
- package/src/file-manager/common/utility.d.ts +3 -46
- package/src/file-manager/common/utility.js +73 -249
- package/src/file-manager/index.d.ts +0 -1
- package/src/file-manager/index.js +0 -1
- package/src/file-manager/layout/details-view.d.ts +0 -10
- package/src/file-manager/layout/details-view.js +94 -203
- package/src/file-manager/layout/large-icons-view.d.ts +2 -4
- package/src/file-manager/layout/large-icons-view.js +72 -121
- package/src/file-manager/layout/navigation-pane.d.ts +0 -2
- package/src/file-manager/layout/navigation-pane.js +73 -97
- package/src/file-manager/models/column-model.d.ts +5 -23
- package/src/file-manager/models/column.d.ts +2 -21
- package/src/file-manager/models/column.js +0 -6
- package/src/file-manager/models/default-locale.js +1 -0
- package/src/file-manager/models/details-view-settings-model.d.ts +1 -1
- package/src/file-manager/models/details-view-settings.js +3 -8
- package/src/file-manager/models/search-settings.d.ts +0 -5
- package/src/file-manager/models/toolbar-settings-model.d.ts +2 -177
- package/src/file-manager/models/toolbar-settings.d.ts +2 -157
- package/src/file-manager/models/toolbar-settings.js +2 -64
- package/src/file-manager/models/upload-settings-model.d.ts +0 -13
- package/src/file-manager/models/upload-settings.d.ts +0 -12
- package/src/file-manager/models/upload-settings.js +0 -3
- package/src/file-manager/pop-up/context-menu.d.ts +1 -2
- package/src/file-manager/pop-up/context-menu.js +36 -111
- package/src/file-manager/pop-up/dialog.d.ts +2 -1
- package/src/file-manager/pop-up/dialog.js +40 -19
- package/src/global.js +1 -1
- package/styles/bootstrap-dark.css +665 -371
- package/styles/bootstrap-dark.scss +1 -17
- package/styles/bootstrap.css +644 -353
- package/styles/bootstrap.scss +1 -17
- package/styles/bootstrap4.css +680 -381
- package/styles/bootstrap4.scss +1 -17
- package/styles/bootstrap5-dark.css +694 -376
- package/styles/bootstrap5-dark.scss +1 -17
- package/styles/bootstrap5.css +695 -377
- package/styles/bootstrap5.scss +1 -17
- package/styles/fabric-dark.css +642 -358
- package/styles/fabric-dark.scss +1 -17
- package/styles/fabric.css +641 -357
- package/styles/fabric.scss +1 -17
- package/styles/file-manager/_all.scss +1 -1
- package/styles/file-manager/_bootstrap-dark-definition.scss +2 -6
- package/styles/file-manager/_bootstrap-definition.scss +2 -6
- package/styles/file-manager/_bootstrap4-definition.scss +2 -6
- package/styles/file-manager/_bootstrap5-definition.scss +15 -20
- package/styles/file-manager/_fabric-dark-definition.scss +2 -6
- package/styles/file-manager/_fabric-definition.scss +2 -6
- package/styles/file-manager/_fluent-definition.scss +15 -18
- package/styles/file-manager/_highcontrast-definition.scss +2 -6
- package/styles/file-manager/_highcontrast-light-definition.scss +2 -6
- package/styles/file-manager/_layout.scss +932 -369
- package/styles/file-manager/_material-dark-definition.scss +2 -7
- package/styles/file-manager/_material-definition.scss +2 -7
- package/styles/file-manager/_tailwind-definition.scss +16 -20
- package/styles/file-manager/_theme.scss +102 -123
- package/styles/file-manager/bootstrap-dark.css +665 -371
- package/styles/file-manager/bootstrap-dark.scss +1 -2
- package/styles/file-manager/bootstrap.css +644 -353
- package/styles/file-manager/bootstrap.scss +1 -2
- package/styles/file-manager/bootstrap4.css +680 -381
- package/styles/file-manager/bootstrap4.scss +1 -2
- package/styles/file-manager/bootstrap5-dark.css +694 -376
- package/styles/file-manager/bootstrap5-dark.scss +1 -2
- package/styles/file-manager/bootstrap5.css +695 -377
- package/styles/file-manager/bootstrap5.scss +1 -2
- package/styles/file-manager/fabric-dark.css +642 -358
- package/styles/file-manager/fabric-dark.scss +1 -2
- package/styles/file-manager/fabric.css +641 -357
- package/styles/file-manager/fabric.scss +1 -2
- package/styles/file-manager/fluent-dark.css +641 -356
- package/styles/file-manager/fluent-dark.scss +1 -2
- package/styles/file-manager/fluent.css +640 -355
- package/styles/file-manager/fluent.scss +1 -2
- package/styles/file-manager/highcontrast-light.css +644 -354
- package/styles/file-manager/highcontrast-light.scss +1 -2
- package/styles/file-manager/highcontrast.css +647 -377
- package/styles/file-manager/highcontrast.scss +1 -2
- package/styles/file-manager/icons/_bootstrap.scss +1 -0
- package/styles/file-manager/icons/_bootstrap4.scss +1 -0
- package/styles/file-manager/icons/_fabric-dark.scss +1 -0
- package/styles/file-manager/icons/_fabric.scss +1 -0
- package/styles/file-manager/material-dark.css +671 -392
- package/styles/file-manager/material-dark.scss +1 -2
- package/styles/file-manager/material.css +654 -391
- package/styles/file-manager/material.scss +1 -2
- package/styles/file-manager/tailwind-dark.css +667 -350
- package/styles/file-manager/tailwind-dark.scss +1 -2
- package/styles/file-manager/tailwind.css +667 -350
- package/styles/file-manager/tailwind.scss +1 -2
- package/styles/fluent-dark.css +641 -356
- package/styles/fluent-dark.scss +1 -17
- package/styles/fluent.css +640 -355
- package/styles/fluent.scss +1 -17
- package/styles/highcontrast-light.css +644 -354
- package/styles/highcontrast-light.scss +1 -17
- package/styles/highcontrast.css +647 -377
- package/styles/highcontrast.scss +1 -17
- package/styles/material-dark.css +671 -392
- package/styles/material-dark.scss +1 -17
- package/styles/material.css +654 -391
- package/styles/material.scss +1 -17
- package/styles/tailwind-dark.css +667 -350
- package/styles/tailwind-dark.scss +1 -17
- package/styles/tailwind.css +667 -350
- package/styles/tailwind.scss +1 -17
- package/dist/ej2-filemanager.min.js +0 -1
- package/src/file-manager/actions/virtualization.d.ts +0 -93
- package/src/file-manager/actions/virtualization.js +0 -279
- package/styles/bootstrap-dark-lite.css +0 -1058
- package/styles/bootstrap-dark-lite.scss +0 -16
- package/styles/bootstrap-lite.css +0 -1040
- package/styles/bootstrap-lite.scss +0 -16
- package/styles/bootstrap4-lite.css +0 -1068
- package/styles/bootstrap4-lite.scss +0 -16
- package/styles/bootstrap5-dark-lite.css +0 -1078
- package/styles/bootstrap5-dark-lite.scss +0 -16
- package/styles/bootstrap5-lite.css +0 -1078
- package/styles/bootstrap5-lite.scss +0 -16
- package/styles/bootstrap5.3-lite.css +0 -1035
- package/styles/bootstrap5.3-lite.scss +0 -16
- package/styles/bootstrap5.3.css +0 -1603
- package/styles/bootstrap5.3.scss +0 -17
- package/styles/fabric-dark-lite.css +0 -1039
- package/styles/fabric-dark-lite.scss +0 -16
- package/styles/fabric-lite.css +0 -1039
- package/styles/fabric-lite.scss +0 -16
- package/styles/file-manager/_bds-definition.scss +0 -236
- package/styles/file-manager/_bigger.scss +0 -758
- package/styles/file-manager/_bootstrap5.3-definition.scss +0 -242
- package/styles/file-manager/_fluent2-definition.scss +0 -255
- package/styles/file-manager/_fusionnew-definition.scss +0 -241
- package/styles/file-manager/_material3-dark-definition.scss +0 -1
- package/styles/file-manager/_material3-definition.scss +0 -235
- package/styles/file-manager/bootstrap5.3.css +0 -1603
- package/styles/file-manager/bootstrap5.3.scss +0 -17
- package/styles/file-manager/fluent2.css +0 -1886
- package/styles/file-manager/fluent2.scss +0 -17
- package/styles/file-manager/icons/_bds.scss +0 -235
- package/styles/file-manager/icons/_bootstrap5.3.scss +0 -235
- package/styles/file-manager/icons/_fluent2.scss +0 -235
- package/styles/file-manager/icons/_fusionnew.scss +0 -235
- package/styles/file-manager/icons/_material3-dark.scss +0 -1
- package/styles/file-manager/icons/_material3.scss +0 -235
- package/styles/file-manager/material3-dark.css +0 -1633
- package/styles/file-manager/material3-dark.scss +0 -18
- package/styles/file-manager/material3.css +0 -1635
- package/styles/file-manager/material3.scss +0 -18
- package/styles/fluent-dark-lite.css +0 -1037
- package/styles/fluent-dark-lite.scss +0 -16
- package/styles/fluent-lite.css +0 -1036
- package/styles/fluent-lite.scss +0 -16
- package/styles/fluent2-lite.css +0 -1272
- package/styles/fluent2-lite.scss +0 -16
- package/styles/fluent2.css +0 -1886
- package/styles/fluent2.scss +0 -17
- package/styles/highcontrast-light-lite.css +0 -1039
- package/styles/highcontrast-light-lite.scss +0 -16
- package/styles/highcontrast-lite.css +0 -1059
- package/styles/highcontrast-lite.scss +0 -16
- package/styles/material-dark-lite.css +0 -1092
- package/styles/material-dark-lite.scss +0 -16
- package/styles/material-lite.css +0 -1097
- package/styles/material-lite.scss +0 -16
- package/styles/material3-dark-lite.css +0 -1090
- package/styles/material3-dark-lite.scss +0 -16
- package/styles/material3-dark.css +0 -1633
- package/styles/material3-dark.scss +0 -19
- package/styles/material3-lite.css +0 -1092
- package/styles/material3-lite.scss +0 -16
- package/styles/material3.css +0 -1635
- package/styles/material3.scss +0 -19
- package/styles/tailwind-dark-lite.css +0 -1060
- package/styles/tailwind-dark-lite.scss +0 -16
- package/styles/tailwind-lite.css +0 -1060
- package/styles/tailwind-lite.scss +0 -16
@@ -1,93 +0,0 @@
|
|
1
|
-
import { FileManager } from '../base';
|
2
|
-
export declare class Virtualization {
|
3
|
-
constructor(instance: FileManager);
|
4
|
-
private filemanagerInstance;
|
5
|
-
private largeIconInstance;
|
6
|
-
private itemCount;
|
7
|
-
private rowItemCount;
|
8
|
-
private items;
|
9
|
-
private itemList;
|
10
|
-
private scrollPosition;
|
11
|
-
private totalHeight;
|
12
|
-
private listItemHeight;
|
13
|
-
private topElementHeight;
|
14
|
-
private bottomElementHeight;
|
15
|
-
private renderedCount;
|
16
|
-
private lastRowCount;
|
17
|
-
private topElement;
|
18
|
-
private bottomElement;
|
19
|
-
private listDiff;
|
20
|
-
/**
|
21
|
-
* Sets up UI virtualization for the large icon view.
|
22
|
-
*
|
23
|
-
* @returns {void}
|
24
|
-
*/
|
25
|
-
setUIVirtualization(): void;
|
26
|
-
/**
|
27
|
-
* Sets the height of the top and bottom elements that are used for virtualization.
|
28
|
-
* These elements are used to give the appearance of an infinitely scrolling list.
|
29
|
-
*
|
30
|
-
* @returns {void}
|
31
|
-
*/
|
32
|
-
setUlElementHeight(): void;
|
33
|
-
/**
|
34
|
-
* Calculates the number of items to display in the list based on the available width and height.
|
35
|
-
*
|
36
|
-
* @param {number} dataSourceLength The length of the data source.
|
37
|
-
* @returns {number} The number of items to display.
|
38
|
-
*/
|
39
|
-
private getItemCount;
|
40
|
-
/**
|
41
|
-
* Wires or un wires the scroll event for the list element.
|
42
|
-
*
|
43
|
-
* @param {boolean} destroy - Set `true` to unwire the scroll event.
|
44
|
-
* @returns {void}
|
45
|
-
*/
|
46
|
-
wireScrollEvent(destroy: boolean): void;
|
47
|
-
/**
|
48
|
-
* Handles the scroll event for the list element.
|
49
|
-
* This method updates the top and bottom elements and the displayed items based on the scroll position.
|
50
|
-
*
|
51
|
-
* @returns {void}
|
52
|
-
* @private
|
53
|
-
*/
|
54
|
-
private onVirtualUiScroll;
|
55
|
-
/**
|
56
|
-
* Calculates the current scroll position of the list element.
|
57
|
-
*
|
58
|
-
* @param {number} startingHeight The starting height from which to calculate the scroll position.
|
59
|
-
* @returns {number} The current scroll position.
|
60
|
-
* @private
|
61
|
-
*/
|
62
|
-
private getscrollerHeight;
|
63
|
-
/**
|
64
|
-
* This method updates the displayed items and the selection based on the scroll direction.
|
65
|
-
*
|
66
|
-
* @param {number} listDiff The number of rows to update.
|
67
|
-
* @param {boolean} isScrollingDown If set to true, the scroll direction is downward.
|
68
|
-
* @returns {void}
|
69
|
-
* @private
|
70
|
-
*/
|
71
|
-
private onNormalScroll;
|
72
|
-
/**
|
73
|
-
* Updates the items in the large icons view.
|
74
|
-
*
|
75
|
-
* @param {boolean} isScrollingDown - If set to true, the scroll direction is downward.
|
76
|
-
* @returns {void}
|
77
|
-
* @private
|
78
|
-
*/
|
79
|
-
private updateUI;
|
80
|
-
/**
|
81
|
-
* For internal use only - Get the module name.
|
82
|
-
*
|
83
|
-
* @returns {string} - returns the module name.
|
84
|
-
* @private
|
85
|
-
*/
|
86
|
-
private getModuleName;
|
87
|
-
/**
|
88
|
-
* Destroys the component.
|
89
|
-
*
|
90
|
-
* @returns {void}
|
91
|
-
*/
|
92
|
-
destroy(): void;
|
93
|
-
}
|
@@ -1,279 +0,0 @@
|
|
1
|
-
import { EventHandler, isNullOrUndefined, detach, formatUnit } from '@syncfusion/ej2-base';
|
2
|
-
import { ListBase } from '@syncfusion/ej2-lists';
|
3
|
-
import { createElement, selectAll } from '@syncfusion/ej2-base';
|
4
|
-
import * as CLS from '../base/classes';
|
5
|
-
var Virtualization = /** @class */ (function () {
|
6
|
-
function Virtualization(instance) {
|
7
|
-
this.filemanagerInstance = instance;
|
8
|
-
this.largeIconInstance = instance.largeiconsviewModule;
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* Sets up UI virtualization for the large icon view.
|
12
|
-
*
|
13
|
-
* @returns {void}
|
14
|
-
*/
|
15
|
-
Virtualization.prototype.setUIVirtualization = function () {
|
16
|
-
// Get the current view data source
|
17
|
-
var currentViewItems = this.largeIconInstance.items;
|
18
|
-
// Get the first item in the data source
|
19
|
-
var firstItem = currentViewItems.slice(0, 1);
|
20
|
-
// Create a list element from the first item in the data source
|
21
|
-
var listElements = ListBase.createListFromJson(createElement, firstItem, this.largeIconInstance.listObj);
|
22
|
-
// Get the list items from the list element
|
23
|
-
this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
|
24
|
-
// Append the list element to the large icon element
|
25
|
-
this.largeIconInstance.element.appendChild(listElements);
|
26
|
-
if (this.itemList.length !== 0 && this.largeIconInstance.element.querySelector('.' + CLS.EMPTY)) {
|
27
|
-
this.largeIconInstance.element.removeChild(this.largeIconInstance.element.querySelector('.' + CLS.EMPTY));
|
28
|
-
}
|
29
|
-
// Get the total number of items
|
30
|
-
this.itemCount = this.getItemCount(Object.keys(this.largeIconInstance.allItems).length);
|
31
|
-
// Remove the first child element from the large icon element
|
32
|
-
this.largeIconInstance.element.firstChild.remove();
|
33
|
-
// Set the items for the large icon view to the current view data source, limited to the number of items to display
|
34
|
-
this.largeIconInstance.items = currentViewItems.slice(0, this.itemCount);
|
35
|
-
};
|
36
|
-
/**
|
37
|
-
* Sets the height of the top and bottom elements that are used for virtualization.
|
38
|
-
* These elements are used to give the appearance of an infinitely scrolling list.
|
39
|
-
*
|
40
|
-
* @returns {void}
|
41
|
-
*/
|
42
|
-
Virtualization.prototype.setUlElementHeight = function () {
|
43
|
-
// Calculate the number of items in the last row
|
44
|
-
this.lastRowCount = (this.largeIconInstance.allItems.length - this.itemCount) % this.rowItemCount ?
|
45
|
-
(this.largeIconInstance.allItems.length - this.itemCount) % this.rowItemCount : this.rowItemCount;
|
46
|
-
// Create top and bottom elements
|
47
|
-
this.topElement = this.filemanagerInstance.createElement('div');
|
48
|
-
this.topElement.classList.add('e-virtual-top');
|
49
|
-
this.largeIconInstance.element.firstElementChild.insertBefore(this.topElement, this.largeIconInstance.element.firstElementChild.firstChild);
|
50
|
-
this.bottomElement = this.filemanagerInstance.createElement('div');
|
51
|
-
this.bottomElement.classList.add('e-virtual-bottom');
|
52
|
-
this.largeIconInstance.element.firstElementChild.insertBefore(this.bottomElement, null);
|
53
|
-
// Get the margin value for list items
|
54
|
-
var marginValue = parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-top'), 10) +
|
55
|
-
parseInt(window.getComputedStyle(this.largeIconInstance.itemList[0]).getPropertyValue('margin-bottom'), 10);
|
56
|
-
// Calculate the height of a single list item
|
57
|
-
this.listItemHeight = this.largeIconInstance.itemList[0].getBoundingClientRect().height + marginValue;
|
58
|
-
// Calculate the total height of the list
|
59
|
-
this.totalHeight = (Object.keys(this.largeIconInstance.allItems).length / this.rowItemCount) * this.listItemHeight;
|
60
|
-
// Set the initial height of the top and bottom elements
|
61
|
-
this.topElement.style.height = 0 + 'px';
|
62
|
-
this.bottomElement.style.height = this.totalHeight + 'px';
|
63
|
-
// Initialize the top and bottom element heights
|
64
|
-
this.topElementHeight = 0;
|
65
|
-
this.bottomElementHeight = this.totalHeight;
|
66
|
-
// Initialize the list difference variable
|
67
|
-
this.listDiff = 0;
|
68
|
-
// Set the initial rendered count
|
69
|
-
this.renderedCount = this.itemCount;
|
70
|
-
};
|
71
|
-
/**
|
72
|
-
* Calculates the number of items to display in the list based on the available width and height.
|
73
|
-
*
|
74
|
-
* @param {number} dataSourceLength The length of the data source.
|
75
|
-
* @returns {number} The number of items to display.
|
76
|
-
*/
|
77
|
-
Virtualization.prototype.getItemCount = function (dataSourceLength) {
|
78
|
-
// Get the margin values for list items
|
79
|
-
var widthMargin = parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-right'), 10) +
|
80
|
-
parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-left'), 10);
|
81
|
-
// Calculate the number of items that can fit in a single row
|
82
|
-
this.rowItemCount =
|
83
|
-
Math.floor(parseFloat(formatUnit(this.largeIconInstance.element.firstElementChild.clientWidth)) /
|
84
|
-
(this.itemList[0].offsetWidth + widthMargin));
|
85
|
-
// Calculate the number of items that can fit in the available height
|
86
|
-
var itemCount = this.rowItemCount *
|
87
|
-
(Math.round(parseFloat(formatUnit(this.largeIconInstance.element.clientHeight)) / this.itemList[0].offsetHeight));
|
88
|
-
// If the calculated item count is greater than the data source length, set the item count to the data source length
|
89
|
-
if (itemCount > dataSourceLength) {
|
90
|
-
itemCount = dataSourceLength;
|
91
|
-
}
|
92
|
-
return itemCount;
|
93
|
-
};
|
94
|
-
/**
|
95
|
-
* Wires or un wires the scroll event for the list element.
|
96
|
-
*
|
97
|
-
* @param {boolean} destroy - Set `true` to unwire the scroll event.
|
98
|
-
* @returns {void}
|
99
|
-
*/
|
100
|
-
Virtualization.prototype.wireScrollEvent = function (destroy) {
|
101
|
-
if (!destroy) {
|
102
|
-
// Wire the scroll event
|
103
|
-
EventHandler.add(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll, this);
|
104
|
-
}
|
105
|
-
else {
|
106
|
-
// Unwire the scroll event
|
107
|
-
EventHandler.remove(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll);
|
108
|
-
}
|
109
|
-
};
|
110
|
-
/**
|
111
|
-
* Handles the scroll event for the list element.
|
112
|
-
* This method updates the top and bottom elements and the displayed items based on the scroll position.
|
113
|
-
*
|
114
|
-
* @returns {void}
|
115
|
-
* @private
|
116
|
-
*/
|
117
|
-
Virtualization.prototype.onVirtualUiScroll = function () {
|
118
|
-
var _a;
|
119
|
-
// Set the starting height to 0
|
120
|
-
var startingHeight = 0;
|
121
|
-
// Get the current scroll position
|
122
|
-
this.scrollPosition = isNullOrUndefined(this.scrollPosition) ? 0 : this.scrollPosition;
|
123
|
-
var scroll = this.getscrollerHeight(startingHeight);
|
124
|
-
// Calculate the height of the top element
|
125
|
-
this.topElementHeight = this.listItemHeight * Math.floor(scroll / this.listItemHeight);
|
126
|
-
// Calculate the height of the bottom element
|
127
|
-
this.bottomElementHeight = this.totalHeight - this.topElementHeight;
|
128
|
-
// If the scroll position is less than or equal to the total height, set the top and bottom element heights.
|
129
|
-
// Otherwise, set the top element height to the total height and the bottom element height to 0.
|
130
|
-
_a = scroll <= this.totalHeight ?
|
131
|
-
[this.topElementHeight, this.bottomElementHeight] : [this.totalHeight, 0], this.topElementHeight = _a[0], this.bottomElementHeight = _a[1];
|
132
|
-
// If the top element height has changed, update the top and bottom element heights and re-render the items.
|
133
|
-
if (this.topElementHeight !== parseFloat(this.topElement.style.height)) {
|
134
|
-
this.topElement.style.height = this.topElementHeight + 'px';
|
135
|
-
this.bottomElement.style.height = this.bottomElementHeight + 'px';
|
136
|
-
// Check whether the scroll direction is upward or downward
|
137
|
-
if (scroll > this.scrollPosition) {
|
138
|
-
// Scrolling is upward
|
139
|
-
var listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
|
140
|
-
this.onNormalScroll(listDiff, true);
|
141
|
-
}
|
142
|
-
else {
|
143
|
-
// Scrolling is downward
|
144
|
-
var listDiff = Math.round((this.listDiff - (this.topElementHeight / this.listItemHeight)));
|
145
|
-
this.onNormalScroll(listDiff, false);
|
146
|
-
}
|
147
|
-
}
|
148
|
-
// Update the list difference and scroll position variables
|
149
|
-
this.listDiff = Math.round(this.topElementHeight / this.listItemHeight);
|
150
|
-
this.scrollPosition = scroll;
|
151
|
-
// Update the list of items and the items property of the largeIconInstance
|
152
|
-
this.largeIconInstance.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.largeIconInstance.element));
|
153
|
-
this.itemCount = this.itemCount !== this.largeIconInstance.itemList.length ?
|
154
|
-
this.largeIconInstance.itemList.length : this.itemCount;
|
155
|
-
this.largeIconInstance.items = this.largeIconInstance.allItems.slice(this.renderedCount -
|
156
|
-
this.itemCount, this.renderedCount);
|
157
|
-
};
|
158
|
-
/**
|
159
|
-
* Calculates the current scroll position of the list element.
|
160
|
-
*
|
161
|
-
* @param {number} startingHeight The starting height from which to calculate the scroll position.
|
162
|
-
* @returns {number} The current scroll position.
|
163
|
-
* @private
|
164
|
-
*/
|
165
|
-
Virtualization.prototype.getscrollerHeight = function (startingHeight) {
|
166
|
-
// If the scroll position is less than or equal to the starting height, return 0.
|
167
|
-
// Otherwise, return the scroll position minus the starting height.
|
168
|
-
return ((this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight) <= 0) ? 0 :
|
169
|
-
(this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight);
|
170
|
-
};
|
171
|
-
/**
|
172
|
-
* This method updates the displayed items and the selection based on the scroll direction.
|
173
|
-
*
|
174
|
-
* @param {number} listDiff The number of rows to update.
|
175
|
-
* @param {boolean} isScrollingDown If set to true, the scroll direction is downward.
|
176
|
-
* @returns {void}
|
177
|
-
* @private
|
178
|
-
*/
|
179
|
-
Virtualization.prototype.onNormalScroll = function (listDiff, isScrollingDown) {
|
180
|
-
// Update the displayed items
|
181
|
-
for (var i = 0; i < listDiff; i++) {
|
182
|
-
this.updateUI(isScrollingDown);
|
183
|
-
}
|
184
|
-
};
|
185
|
-
/**
|
186
|
-
* Updates the items in the large icons view.
|
187
|
-
*
|
188
|
-
* @param {boolean} isScrollingDown - If set to true, the scroll direction is downward.
|
189
|
-
* @returns {void}
|
190
|
-
* @private
|
191
|
-
*/
|
192
|
-
Virtualization.prototype.updateUI = function (isScrollingDown) {
|
193
|
-
var _this = this;
|
194
|
-
if (isScrollingDown) {
|
195
|
-
// Get the next batch of items to be displayed
|
196
|
-
this.items = this.largeIconInstance.allItems.slice(this.renderedCount, this.renderedCount + this.rowItemCount);
|
197
|
-
// If there are items to be displayed, create list elements for them and append them to the list
|
198
|
-
if (this.items.length > 0) {
|
199
|
-
var listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
|
200
|
-
this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
|
201
|
-
this.itemList.forEach(function (liEle) {
|
202
|
-
_this.largeIconInstance.element.firstElementChild.insertBefore(liEle, _this.bottomElement);
|
203
|
-
});
|
204
|
-
// Update the rendered count variable
|
205
|
-
this.renderedCount = (this.largeIconInstance.allItems.length >= this.renderedCount + this.rowItemCount) ?
|
206
|
-
this.renderedCount + this.rowItemCount : this.renderedCount + this.lastRowCount;
|
207
|
-
// Remove the first batch of items from the list
|
208
|
-
for (var i = 0; i < this.rowItemCount; i++) {
|
209
|
-
detach(this.topElement.nextElementSibling);
|
210
|
-
}
|
211
|
-
}
|
212
|
-
}
|
213
|
-
else {
|
214
|
-
// Scrolling up
|
215
|
-
var lastItemIndex = void 0;
|
216
|
-
var isAllRendered = void 0;
|
217
|
-
if (this.renderedCount === this.largeIconInstance.allItems.length) {
|
218
|
-
// Set lastItemIndex to the last item in the last row
|
219
|
-
lastItemIndex = this.renderedCount - (this.itemCount - this.rowItemCount + this.lastRowCount);
|
220
|
-
// Set renderedCount to the total number of items that have been rendered, except for the items in the last row
|
221
|
-
this.renderedCount = ((this.renderedCount - this.lastRowCount) < this.itemCount) ?
|
222
|
-
this.itemCount : (this.renderedCount - this.lastRowCount);
|
223
|
-
// Set isAllRendered to true to indicate that all items have been rendered
|
224
|
-
isAllRendered = true;
|
225
|
-
}
|
226
|
-
else {
|
227
|
-
// Set lastItemIndex to the last item in the current row
|
228
|
-
lastItemIndex = this.renderedCount - this.itemCount;
|
229
|
-
// Set renderedCount to the total number of items that have been rendered, except for the items in the current row
|
230
|
-
this.renderedCount = ((this.renderedCount - this.rowItemCount) < this.itemCount) ?
|
231
|
-
this.itemCount : (this.renderedCount - this.rowItemCount);
|
232
|
-
}
|
233
|
-
// Set startItemIndex to the first item in the current or previous row
|
234
|
-
var startItemIndex = (lastItemIndex - this.rowItemCount > 0) ? lastItemIndex - this.rowItemCount : 0;
|
235
|
-
// Set the items array to the items in the current or previous row
|
236
|
-
this.items = this.largeIconInstance.allItems.slice(startItemIndex, lastItemIndex);
|
237
|
-
if (this.items.length > 0) {
|
238
|
-
// Create a list of elements from the items array
|
239
|
-
var listElements = ListBase.createListFromJson(createElement, this.items, this.largeIconInstance.listObj);
|
240
|
-
// Set the itemList array to the list items in the list elements
|
241
|
-
this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, listElements));
|
242
|
-
// Add the items to the beginning of the list
|
243
|
-
for (var len = this.itemList.length; len > 0; len--) {
|
244
|
-
this.largeIconInstance.element.firstElementChild.insertBefore(this.itemList[len - 1], this.topElement.nextElementSibling);
|
245
|
-
}
|
246
|
-
// Remove the last row of items from the list
|
247
|
-
for (var i = 0; i < ((isAllRendered) ? this.lastRowCount : this.rowItemCount); i++) {
|
248
|
-
detach(this.bottomElement.previousElementSibling);
|
249
|
-
}
|
250
|
-
}
|
251
|
-
}
|
252
|
-
};
|
253
|
-
/**
|
254
|
-
* For internal use only - Get the module name.
|
255
|
-
*
|
256
|
-
* @returns {string} - returns the module name.
|
257
|
-
* @private
|
258
|
-
*/
|
259
|
-
Virtualization.prototype.getModuleName = function () {
|
260
|
-
return 'virtualization';
|
261
|
-
};
|
262
|
-
/**
|
263
|
-
* Destroys the component.
|
264
|
-
*
|
265
|
-
* @returns {void}
|
266
|
-
*/
|
267
|
-
Virtualization.prototype.destroy = function () {
|
268
|
-
// If the file manager has already been destroyed, return immediately
|
269
|
-
if (this.filemanagerInstance.isDestroyed) {
|
270
|
-
return;
|
271
|
-
}
|
272
|
-
// If the large icon element has a child element, unwire the scroll event
|
273
|
-
if (!isNullOrUndefined(this.largeIconInstance.element.firstElementChild)) {
|
274
|
-
this.wireScrollEvent(true);
|
275
|
-
}
|
276
|
-
};
|
277
|
-
return Virtualization;
|
278
|
-
}());
|
279
|
-
export { Virtualization };
|