@syncfusion/ej2-filemanager 19.4.48 → 19.4.50-117124

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 (109) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +6 -20
  3. package/README.md +54 -43
  4. package/dist/ej2-filemanager.min.js +10 -0
  5. package/dist/ej2-filemanager.umd.min.js +2 -2
  6. package/dist/ej2-filemanager.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-filemanager.es2015.js +445 -129
  8. package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
  9. package/dist/es6/ej2-filemanager.es5.js +473 -136
  10. package/dist/es6/ej2-filemanager.es5.js.map +1 -1
  11. package/dist/global/ej2-filemanager.min.js +2 -2
  12. package/dist/global/ej2-filemanager.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/helpers/e2e/filemanagerHelper.js +183 -166
  15. package/package.json +11 -12
  16. package/src/file-manager/actions/breadcrumb-bar.js +1 -1
  17. package/src/file-manager/actions/index.d.ts +1 -0
  18. package/src/file-manager/actions/index.js +1 -0
  19. package/src/file-manager/actions/toolbar.js +6 -4
  20. package/src/file-manager/actions/virtualization.d.ts +38 -0
  21. package/src/file-manager/actions/virtualization.js +179 -0
  22. package/src/file-manager/base/classes.d.ts +2 -0
  23. package/src/file-manager/base/classes.js +2 -0
  24. package/src/file-manager/base/file-manager-model.d.ts +24 -2
  25. package/src/file-manager/base/file-manager.d.ts +28 -2
  26. package/src/file-manager/base/file-manager.js +32 -3
  27. package/src/file-manager/base/interface.d.ts +5 -1
  28. package/src/file-manager/common/operations.js +2 -0
  29. package/src/file-manager/common/utility.js +21 -5
  30. package/src/file-manager/layout/details-view.d.ts +2 -0
  31. package/src/file-manager/layout/details-view.js +46 -7
  32. package/src/file-manager/layout/large-icons-view.d.ts +2 -1
  33. package/src/file-manager/layout/large-icons-view.js +13 -5
  34. package/src/file-manager/layout/navigation-pane.js +29 -17
  35. package/src/file-manager/models/index.d.ts +2 -0
  36. package/src/file-manager/models/index.js +1 -0
  37. package/src/file-manager/models/navigation-pane-settings-model.d.ts +11 -0
  38. package/src/file-manager/models/navigation-pane-settings.d.ts +10 -0
  39. package/src/file-manager/models/navigation-pane-settings.js +3 -0
  40. package/src/file-manager/models/upload-settings-model.d.ts +13 -0
  41. package/src/file-manager/models/upload-settings.d.ts +12 -0
  42. package/src/file-manager/models/upload-settings.js +3 -0
  43. package/src/file-manager/models/virtualization-settings-model.d.ts +29 -0
  44. package/src/file-manager/models/virtualization-settings.d.ts +24 -0
  45. package/src/file-manager/models/virtualization-settings.js +40 -0
  46. package/src/file-manager/pop-up/context-menu.js +1 -1
  47. package/src/file-manager/pop-up/dialog.js +11 -4
  48. package/src/global.js +1 -1
  49. package/styles/bootstrap-dark.css +55 -399
  50. package/styles/bootstrap.css +55 -396
  51. package/styles/bootstrap4.css +55 -404
  52. package/styles/bootstrap5-dark.css +56 -408
  53. package/styles/bootstrap5.css +56 -408
  54. package/styles/fabric-dark.css +54 -392
  55. package/styles/fabric.css +54 -392
  56. package/styles/file-manager/_all.scss +1 -1
  57. package/styles/file-manager/_bootstrap-dark-definition.scss +1 -1
  58. package/styles/file-manager/_bootstrap-definition.scss +1 -1
  59. package/styles/file-manager/_bootstrap4-definition.scss +1 -1
  60. package/styles/file-manager/_bootstrap5-definition.scss +3 -3
  61. package/styles/file-manager/_fabric-dark-definition.scss +1 -1
  62. package/styles/file-manager/_fabric-definition.scss +1 -1
  63. package/styles/file-manager/_fluent-dark-definition.scss +1 -0
  64. package/styles/file-manager/_fluent-definition.scss +10 -10
  65. package/styles/file-manager/_fusionnew-definition.scss +237 -0
  66. package/styles/file-manager/_highcontrast-definition.scss +1 -1
  67. package/styles/file-manager/_highcontrast-light-definition.scss +1 -1
  68. package/styles/file-manager/_layout.scss +65 -16
  69. package/styles/file-manager/_material-dark-definition.scss +1 -1
  70. package/styles/file-manager/_material-definition.scss +1 -1
  71. package/styles/file-manager/_material3-definition.scss +237 -0
  72. package/styles/file-manager/_tailwind-definition.scss +2 -2
  73. package/styles/file-manager/_theme.scss +39 -10
  74. package/styles/file-manager/bootstrap-dark.css +55 -399
  75. package/styles/file-manager/bootstrap.css +55 -396
  76. package/styles/file-manager/bootstrap4.css +55 -404
  77. package/styles/file-manager/bootstrap5-dark.css +56 -408
  78. package/styles/file-manager/bootstrap5.css +56 -408
  79. package/styles/file-manager/fabric-dark.css +54 -392
  80. package/styles/file-manager/fabric.css +54 -392
  81. package/styles/file-manager/fluent-dark.css +1568 -0
  82. package/styles/file-manager/fluent-dark.scss +16 -0
  83. package/styles/file-manager/fluent.css +1567 -0
  84. package/styles/file-manager/fluent.scss +16 -0
  85. package/styles/file-manager/highcontrast-light.css +54 -394
  86. package/styles/file-manager/highcontrast.css +73 -393
  87. package/styles/file-manager/icons/_bootstrap.scss +0 -1
  88. package/styles/file-manager/icons/_bootstrap4.scss +0 -1
  89. package/styles/file-manager/icons/_fabric-dark.scss +0 -1
  90. package/styles/file-manager/icons/_fabric.scss +0 -1
  91. package/styles/file-manager/icons/_fluent-dark.scss +1 -0
  92. package/styles/file-manager/icons/_fluent.scss +19 -19
  93. package/styles/file-manager/icons/_fusionnew.scss +235 -0
  94. package/styles/file-manager/icons/_material3.scss +235 -0
  95. package/styles/file-manager/icons/_tailwind.scss +49 -49
  96. package/styles/file-manager/material-dark.css +55 -403
  97. package/styles/file-manager/material.css +55 -400
  98. package/styles/file-manager/tailwind-dark.css +76 -424
  99. package/styles/file-manager/tailwind.css +76 -424
  100. package/styles/fluent-dark.css +1568 -0
  101. package/styles/fluent-dark.scss +1 -0
  102. package/styles/fluent.css +1567 -0
  103. package/styles/fluent.scss +1 -0
  104. package/styles/highcontrast-light.css +54 -394
  105. package/styles/highcontrast.css +73 -393
  106. package/styles/material-dark.css +55 -403
  107. package/styles/material.css +55 -400
  108. package/styles/tailwind-dark.css +76 -424
  109. package/styles/tailwind.css +76 -424
@@ -0,0 +1,179 @@
1
+ import { EventHandler, isNullOrUndefined, detach, formatUnit, getValue, addClass, select, closest } 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.largeIconsViewItemsCount = 40;
8
+ this.filemanagerInstance = instance;
9
+ this.largeIconInstance = instance.largeiconsviewModule;
10
+ }
11
+ // Update the scroller height based on the items count.
12
+ 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;
16
+ this.topElement = this.filemanagerInstance.createElement('div');
17
+ this.largeIconInstance.element.firstElementChild.insertBefore(this.topElement, this.largeIconInstance.element.firstElementChild.firstChild);
18
+ this.bottomElement = this.filemanagerInstance.createElement('div');
19
+ 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'));
22
+ this.listItemHeight = this.largeIconInstance.itemList[0].getBoundingClientRect().height + marginValue;
23
+ this.totalHeight = (Object.keys(this.largeIconInstance.allItems).length / this.rowItemCount) * this.listItemHeight;
24
+ this.topElement.style.height = 0 + 'px';
25
+ this.bottomElement.style.height = this.totalHeight + 'px';
26
+ this.topElementHeight = 0;
27
+ this.bottomElementHeight = this.totalHeight;
28
+ this.listDiff = 0;
29
+ this.renderedCount = this.largeIconsViewItemsCount;
30
+ };
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));
37
+ if (itemCount > dataSourceLength) {
38
+ itemCount = dataSourceLength;
39
+ }
40
+ return itemCount;
41
+ };
42
+ // Bind the scroll event for large icons view ul element.
43
+ Virtualization.prototype.wireScrollEvent = function (destroy) {
44
+ if (!destroy) {
45
+ EventHandler.add(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll, this);
46
+ }
47
+ else {
48
+ EventHandler.remove(this.largeIconInstance.element.firstElementChild, 'scroll', this.onVirtualUiScroll);
49
+ }
50
+ };
51
+ // Update the top and bottom element height and update the scroll position.
52
+ Virtualization.prototype.onVirtualUiScroll = function (e) {
53
+ var _a;
54
+ var startingHeight = 0;
55
+ this.scrollPosition = isNullOrUndefined(this.scrollPosition) ? 0 : this.scrollPosition;
56
+ var scroll = this.getscrollerHeight(startingHeight);
57
+ this.topElementHeight = this.listItemHeight * Math.floor(scroll / this.listItemHeight);
58
+ this.bottomElementHeight = this.totalHeight - this.topElementHeight;
59
+ _a = scroll <= this.totalHeight ?
60
+ [this.topElementHeight, this.bottomElementHeight] : [this.totalHeight, 0], this.topElementHeight = _a[0], this.bottomElementHeight = _a[1];
61
+ if (this.topElementHeight !== parseFloat(this.topElement.style.height)) {
62
+ this.topElement.style.height = this.topElementHeight + 'px';
63
+ this.bottomElement.style.height = this.bottomElementHeight + 'px';
64
+ // checked whether the scrolling is upward/downward
65
+ if (scroll > this.scrollPosition) {
66
+ var listDiff = Math.round(((this.topElementHeight / this.listItemHeight) - this.listDiff));
67
+ this.onNormalScroll(listDiff, true);
68
+ }
69
+ else {
70
+ var listDiff = Math.round((this.listDiff - (this.topElementHeight / this.listItemHeight)));
71
+ this.onNormalScroll(listDiff, false);
72
+ }
73
+ }
74
+ this.listDiff = Math.round(this.topElementHeight / this.listItemHeight);
75
+ this.scrollPosition = scroll;
76
+ this.largeIconInstance.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.largeIconInstance.element));
77
+ this.largeIconInstance.items = this.largeIconInstance.allItems.slice(this.renderedCount -
78
+ this.largeIconsViewItemsCount, this.renderedCount);
79
+ };
80
+ // Calculated the scroller height.
81
+ Virtualization.prototype.getscrollerHeight = function (startingHeight) {
82
+ return ((this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight) <= 0) ? 0 :
83
+ (this.largeIconInstance.element.firstElementChild.scrollTop - startingHeight);
84
+ };
85
+ // Update the UI based on the scrolled position.
86
+ Virtualization.prototype.onNormalScroll = function (listDiff, isScrollingDown) {
87
+ for (var i = 0; i < listDiff; i++) {
88
+ this.updateUI(isScrollingDown);
89
+ }
90
+ this.updateSelection();
91
+ };
92
+ // Updating the items in large icons view dynamically.
93
+ Virtualization.prototype.updateUI = function (isScrollingDown) {
94
+ var _this = this;
95
+ if (isScrollingDown) {
96
+ this.items = this.largeIconInstance.allItems.slice(this.renderedCount, this.renderedCount + this.rowItemCount);
97
+ 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));
100
+ this.itemList.forEach(function (liEle) {
101
+ _this.largeIconInstance.element.firstElementChild.insertBefore(liEle, _this.bottomElement);
102
+ });
103
+ this.renderedCount = (this.largeIconInstance.allItems.length >= this.renderedCount + this.rowItemCount) ?
104
+ this.renderedCount + this.rowItemCount : this.renderedCount + this.lastRowCount;
105
+ for (var i_1 = 0; i_1 < this.rowItemCount; i_1++) {
106
+ detach(this.topElement.nextElementSibling);
107
+ }
108
+ }
109
+ }
110
+ else {
111
+ var lastItemIndex = void 0;
112
+ 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);
117
+ isAllRendered = true;
118
+ }
119
+ else {
120
+ lastItemIndex = this.renderedCount - this.largeIconsViewItemsCount;
121
+ this.renderedCount = ((this.renderedCount - this.rowItemCount) < this.largeIconsViewItemsCount) ?
122
+ this.largeIconsViewItemsCount : (this.renderedCount - this.rowItemCount);
123
+ }
124
+ var startItemIndex = (lastItemIndex - this.rowItemCount > 0) ? lastItemIndex - this.rowItemCount : 0;
125
+ this.items = this.largeIconInstance.allItems.slice(startItemIndex, lastItemIndex);
126
+ 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));
129
+ for (var len = this.itemList.length; len > 0; len--) {
130
+ this.largeIconInstance.element.firstElementChild.insertBefore(this.itemList[len - 1], this.topElement.nextElementSibling);
131
+ }
132
+ for (var i = 0; i < ((isAllRendered) ? this.lastRowCount : this.rowItemCount); i++) {
133
+ detach(this.bottomElement.previousElementSibling);
134
+ }
135
+ }
136
+ }
137
+ };
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
+ /**
161
+ * For internal use only - Get the module name.
162
+ *
163
+ * @returns {string} - returns the module name.
164
+ * @private
165
+ */
166
+ Virtualization.prototype.getModuleName = function () {
167
+ return 'virtualization';
168
+ };
169
+ Virtualization.prototype.destroy = function () {
170
+ if (this.filemanagerInstance.isDestroyed) {
171
+ return;
172
+ }
173
+ if (!isNullOrUndefined(this.largeIconInstance.element.firstElementChild)) {
174
+ this.wireScrollEvent(true);
175
+ }
176
+ };
177
+ return Virtualization;
178
+ }());
179
+ export { Virtualization };
@@ -149,6 +149,8 @@ export declare const SUBMENU_ICON: string;
149
149
  /** @hidden */
150
150
  export declare const GRID_VIEW: string;
151
151
  /** @hidden */
152
+ export declare const GRID_CONTENT: string;
153
+ /** @hidden */
152
154
  export declare const ICON_VIEW: string;
153
155
  /** @hidden */
154
156
  export declare const ICON_OPEN: string;
@@ -149,6 +149,8 @@ export var SUBMENU_ICON = 'e-caret';
149
149
  /** @hidden */
150
150
  export var GRID_VIEW = 'e-content';
151
151
  /** @hidden */
152
+ export var GRID_CONTENT = 'e-gridcontent';
153
+ /** @hidden */
152
154
  export var ICON_VIEW = 'e-list-parent';
153
155
  /** @hidden */
154
156
  export var ICON_OPEN = 'e-icons e-fe-open';
@@ -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 } 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 } 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';
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';
2
2
  import {ComponentModel} from '@syncfusion/ej2-base';
3
3
 
4
4
  /**
@@ -65,6 +65,19 @@ 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
+
68
81
  /**
69
82
  * Defines whether to allow the cross-scripting site or not.
70
83
  *
@@ -106,6 +119,7 @@ export interface FileManagerModel extends ComponentModel{
106
119
  * maxWidth: '650px',
107
120
  * minWidth: '240px',
108
121
  * visible: true,
122
+ * sortOrder: 'None'
109
123
  * }
110
124
  */
111
125
  navigationPaneSettings?: NavigationPaneSettingsModel;
@@ -182,6 +196,13 @@ export interface FileManagerModel extends ComponentModel{
182
196
  */
183
197
  sortOrder?: SortOrder;
184
198
 
199
+ /**
200
+ * Specifies the field name being used as the sorting criteria to sort the files of the file manager component.
201
+ *
202
+ * @default 'name'
203
+ */
204
+ sortBy?: string;
205
+
185
206
  /**
186
207
  * Specifies the group of items aligned horizontally in the toolbar.
187
208
  *
@@ -201,7 +222,8 @@ export interface FileManagerModel extends ComponentModel{
201
222
  * minFileSize: 0,
202
223
  * maxFileSize: 30000000,
203
224
  * allowedExtensions: '',
204
- * autoClose: false
225
+ * autoClose: false,
226
+ * directoryUpload: false
205
227
  * }
206
228
  */
207
229
  uploadSettings?: UploadSettingsModel;
@@ -20,6 +20,7 @@ import { TreeView as BaseTreeView } from '@syncfusion/ej2-navigations';
20
20
  import { ContextMenuSettingsModel } from '../models/contextMenu-settings-model';
21
21
  import { BreadCrumbBar } from '../actions/breadcrumb-bar';
22
22
  import { PositionModel } from '@syncfusion/ej2-base/src/draggable-model';
23
+ import { Virtualization } from '../actions/virtualization';
23
24
  /**
24
25
  * The FileManager component allows users to access and manage the file system through the web browser. It can performs the
25
26
  * functionalities like add, rename, search, sort, upload and delete files or folders. And also it
@@ -45,6 +46,8 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
45
46
  contextmenuModule: IContextMenu;
46
47
  /** @hidden */
47
48
  breadcrumbbarModule: BreadCrumbBar;
49
+ /** @hidden */
50
+ virtualizationModule: Virtualization;
48
51
  private keyboardModule;
49
52
  private keyConfigs;
50
53
  filterData: Object;
@@ -94,7 +97,6 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
94
97
  isMobile: boolean;
95
98
  isBigger: boolean;
96
99
  isFile: boolean;
97
- sortBy: string;
98
100
  actionRecords: Object[];
99
101
  activeRecords: Object[];
100
102
  isCut: boolean;
@@ -142,6 +144,9 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
142
144
  destinationPath: string;
143
145
  uploadingCount: number;
144
146
  uploadedCount: number;
147
+ isMac: boolean;
148
+ oldView: string;
149
+ oldPath: string;
145
150
  /**
146
151
  * Specifies the AJAX settings of the file manager.
147
152
  *
@@ -195,6 +200,18 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
195
200
  * }
196
201
  */
197
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;
198
215
  /**
199
216
  * Defines whether to allow the cross-scripting site or not.
200
217
  *
@@ -232,6 +249,7 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
232
249
  * maxWidth: '650px',
233
250
  * minWidth: '240px',
234
251
  * visible: true,
252
+ * sortOrder: 'None'
235
253
  * }
236
254
  */
237
255
  navigationPaneSettings: NavigationPaneSettingsModel;
@@ -298,6 +316,12 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
298
316
  * @default 'Ascending'
299
317
  */
300
318
  sortOrder: SortOrder;
319
+ /**
320
+ * Specifies the field name being used as the sorting criteria to sort the files of the file manager component.
321
+ *
322
+ * @default 'name'
323
+ */
324
+ sortBy: string;
301
325
  /**
302
326
  * Specifies the group of items aligned horizontally in the toolbar.
303
327
  *
@@ -316,7 +340,8 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
316
340
  * minFileSize: 0,
317
341
  * maxFileSize: 30000000,
318
342
  * allowedExtensions: '',
319
- * autoClose: false
343
+ * autoClose: false,
344
+ * directoryUpload: false
320
345
  * }
321
346
  */
322
347
  uploadSettings: UploadSettingsModel;
@@ -525,6 +550,7 @@ export declare class FileManager extends Component<HTMLElement> implements INoti
525
550
  private onClose;
526
551
  private onUploading;
527
552
  private onRemoving;
553
+ private onCancel;
528
554
  private onClearing;
529
555
  private onSelected;
530
556
  private onFileUploadSuccess;
@@ -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 } from '../models/index';
28
+ import { ToolbarSettings, AjaxSettings, NavigationPaneSettings, DetailsViewSettings, VirtualizationSettings } 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';
@@ -69,7 +69,6 @@ var FileManager = /** @class */ (function (_super) {
69
69
  _this.uploadItem = [];
70
70
  _this.deleteRecords = [];
71
71
  _this.isFile = false;
72
- _this.sortBy = 'name';
73
72
  _this.isCut = false;
74
73
  _this.isSearchCut = false;
75
74
  _this.isSearchDrag = false;
@@ -103,6 +102,8 @@ var FileManager = /** @class */ (function (_super) {
103
102
  _this.droppedObjects = [];
104
103
  _this.uploadingCount = 0;
105
104
  _this.uploadedCount = 0;
105
+ //Specifies whether the operating system is MAC or not
106
+ _this.isMac = false;
106
107
  FileManager_1.Inject(BreadCrumbBar, LargeIconsView, ContextMenu);
107
108
  return _this;
108
109
  }
@@ -198,6 +199,12 @@ var FileManager = /** @class */ (function (_super) {
198
199
  args: [this]
199
200
  });
200
201
  }
202
+ if (this.virtualizationSettings.enable) {
203
+ modules.push({
204
+ member: 'virtualization',
205
+ args: [this]
206
+ });
207
+ }
201
208
  return modules;
202
209
  };
203
210
  /**
@@ -212,6 +219,7 @@ var FileManager = /** @class */ (function (_super) {
212
219
  this.allowMultiSelection ? this.selectedItems : this.selectedItems.slice(this.selectedItems.length - 1);
213
220
  this.setProperties({ selectedItems: slItems }, true);
214
221
  this.fileView = this.view;
222
+ this.isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
215
223
  this.setRtl(this.enableRtl);
216
224
  this.addEventListeners();
217
225
  read(this, (this.path !== this.originalPath) ? events.initialEnd : events.finalizeEnd, this.path);
@@ -409,6 +417,7 @@ var FileManager = /** @class */ (function (_super) {
409
417
  enableRtl: this.enableRtl,
410
418
  uploading: this.onUploading.bind(this),
411
419
  removing: this.onRemoving.bind(this),
420
+ canceling: this.onCancel.bind(this),
412
421
  clearing: this.onClearing.bind(this),
413
422
  selected: this.onSelected.bind(this),
414
423
  success: this.onUploadSuccess.bind(this),
@@ -417,6 +426,7 @@ var FileManager = /** @class */ (function (_super) {
417
426
  minFileSize: this.uploadSettings.minFileSize,
418
427
  maxFileSize: this.uploadSettings.maxFileSize,
419
428
  allowedExtensions: this.uploadSettings.allowedExtensions,
429
+ directoryUpload: this.uploadSettings.directoryUpload,
420
430
  fileListRendering: this.onFileListRender.bind(this)
421
431
  });
422
432
  this.uploadObj.appendTo('#' + this.element.id + CLS.UPLOAD_ID);
@@ -429,6 +439,7 @@ var FileManager = /** @class */ (function (_super) {
429
439
  this.uploadObj.minFileSize = this.uploadSettings.minFileSize;
430
440
  this.uploadObj.maxFileSize = this.uploadSettings.maxFileSize;
431
441
  this.uploadObj.allowedExtensions = this.uploadSettings.allowedExtensions;
442
+ this.uploadObj.directoryUpload = this.uploadSettings.directoryUpload;
432
443
  this.uploadObj.dataBind();
433
444
  };
434
445
  FileManager.prototype.onBeforeOpen = function (args) {
@@ -478,7 +489,7 @@ var FileManager = /** @class */ (function (_super) {
478
489
  }
479
490
  }
480
491
  var data = JSON.stringify(getValue(this.pathId[this.pathId.length - 1], this.feParent));
481
- args.customFormData = [{ 'path': this.path }, { 'action': action }, { 'data': data }];
492
+ args.customFormData = [{ 'path': this.path }, { 'action': action }, { 'data': data }, { 'filename': args.fileData.name }];
482
493
  var uploadUrl = this.ajaxSettings.uploadUrl ? this.ajaxSettings.uploadUrl : this.ajaxSettings.url;
483
494
  // eslint-disable-next-line
484
495
  var ajaxSettings = {
@@ -516,6 +527,11 @@ var FileManager = /** @class */ (function (_super) {
516
527
  }
517
528
  };
518
529
  /* istanbul ignore next */
530
+ FileManager.prototype.onCancel = function (args) {
531
+ var data = JSON.stringify(getValue(this.pathId[this.pathId.length - 1], this.feParent));
532
+ args.customFormData = [{ 'path': this.path }, { 'action': 'remove' }, { 'data': data }];
533
+ };
534
+ /* istanbul ignore next */
519
535
  FileManager.prototype.onClearing = function () {
520
536
  if (this.isOpened) {
521
537
  this.uploadDialogObj.hide();
@@ -786,6 +802,13 @@ var FileManager = /** @class */ (function (_super) {
786
802
  refresh(this);
787
803
  this.notify(events.sortByChange, {});
788
804
  break;
805
+ case 'sortBy':
806
+ refresh(this);
807
+ this.notify(events.sortByChange, {});
808
+ if (this.view === 'Details') {
809
+ this.notify(events.sortColumn, {});
810
+ }
811
+ break;
789
812
  case 'popupTarget':
790
813
  if (this.uploadDialogObj) {
791
814
  this.uploadDialogObj.target = newProp.popupTarget;
@@ -1127,6 +1150,9 @@ var FileManager = /** @class */ (function (_super) {
1127
1150
  __decorate([
1128
1151
  Complex({}, DetailsViewSettings)
1129
1152
  ], FileManager.prototype, "detailsViewSettings", void 0);
1153
+ __decorate([
1154
+ Complex({}, VirtualizationSettings)
1155
+ ], FileManager.prototype, "virtualizationSettings", void 0);
1130
1156
  __decorate([
1131
1157
  Property(true)
1132
1158
  ], FileManager.prototype, "enableHtmlSanitizer", void 0);
@@ -1169,6 +1195,9 @@ var FileManager = /** @class */ (function (_super) {
1169
1195
  __decorate([
1170
1196
  Property('Ascending')
1171
1197
  ], FileManager.prototype, "sortOrder", void 0);
1198
+ __decorate([
1199
+ Property('name')
1200
+ ], FileManager.prototype, "sortBy", void 0);
1172
1201
  __decorate([
1173
1202
  Complex({}, ToolbarSettings)
1174
1203
  ], FileManager.prototype, "toolbarSettings", void 0);
@@ -11,7 +11,7 @@ import { ContextMenuSettingsModel } from '../models/contextMenu-settings-model';
11
11
  import { LargeIconsView } from '../layout';
12
12
  import { NavigationPaneSettingsModel } from '../models/navigation-pane-settings-model';
13
13
  import { Uploader } from '@syncfusion/ej2-inputs';
14
- import { BreadCrumbBar } from '../actions';
14
+ import { BreadCrumbBar, Virtualization } from '../actions';
15
15
  import { PositionModel } from '@syncfusion/ej2-base/src/draggable-model';
16
16
  /**
17
17
  * Defines the view type of the FileManager.
@@ -511,6 +511,7 @@ export interface IFileManager extends Component<HTMLElement> {
511
511
  navigationpaneModule: ITreeView;
512
512
  largeiconsviewModule: LargeIconsView;
513
513
  breadcrumbbarModule: BreadCrumbBar;
514
+ virtualizationModule: Virtualization;
514
515
  toolbarSelection: boolean;
515
516
  duplicateItems: string[];
516
517
  duplicateRecords: Object[];
@@ -593,6 +594,9 @@ export interface IFileManager extends Component<HTMLElement> {
593
594
  destinationPath: string;
594
595
  enableHtmlSanitizer: boolean;
595
596
  refreshLayout(): void;
597
+ isMac: boolean;
598
+ oldView: string;
599
+ oldPath: string;
596
600
  }
597
601
  /** @hidden */
598
602
  export interface ITreeView extends Component<HTMLElement> {
@@ -315,6 +315,8 @@ function readSuccess(parent, result, event) {
315
315
  parent.notify(events.selectionChanged, {});
316
316
  }
317
317
  onFailure(parent, result, 'read');
318
+ parent.setProperties({ path: parent.oldPath }, true);
319
+ parent.pathNames.pop();
318
320
  }
319
321
  if (parent.isDragDrop && parent.isDropEnd) {
320
322
  if (parent.droppedObjects.length !== 0) {
@@ -268,7 +268,7 @@ export function searchWordHandler(parent, value, isLayoutChange) {
268
268
  else {
269
269
  if (!parent.isFiltered) {
270
270
  if (parent.isSortByClicked) {
271
- parent.notify(events.layoutChange, { files: parent.largeiconsviewModule.items });
271
+ parent.notify(events.layoutChange, { files: (parent.oldView === 'Details') ? parent.detailsviewModule.gridObj.dataSource : parent.largeiconsviewModule.allItems });
272
272
  parent.isSortByClicked = false;
273
273
  }
274
274
  else {
@@ -289,6 +289,7 @@ export function searchWordHandler(parent, value, isLayoutChange) {
289
289
  * @private
290
290
  */
291
291
  export function updateLayout(parent, view) {
292
+ parent.oldView = parent.view;
292
293
  parent.setProperties({ view: view }, true);
293
294
  if (parent.breadcrumbbarModule.searchObj.element.value !== '' || parent.isFiltered) {
294
295
  parent.layoutSelectedItems = parent.selectedItems;
@@ -312,7 +313,7 @@ export function updateLayout(parent, view) {
312
313
  export function getTargetModule(parent, element) {
313
314
  var tartgetModule = '';
314
315
  if (element) {
315
- if (closest(element, '.e-gridcontent')) {
316
+ if (closest(element, '.' + CLS.ROOT + '.' + CLS.CONTROL + ' .' + CLS.GRID_CONTENT)) {
316
317
  tartgetModule = 'detailsview';
317
318
  }
318
319
  else if (closest(element, '.' + CLS.LARGE_ICONS)) {
@@ -453,18 +454,19 @@ export function fileType(file) {
453
454
  // eslint-disable-next-line
454
455
  export function getImageUrl(parent, item) {
455
456
  var baseUrl = parent.ajaxSettings.getImageUrl ? parent.ajaxSettings.getImageUrl : parent.ajaxSettings.url;
457
+ var pathUrl = (baseUrl.indexOf('?') !== -1) ? '&path=' : '?path=';
456
458
  var imgUrl;
457
459
  var fileName = encodeURIComponent(getValue('name', item));
458
460
  var fPath = getValue('filterPath', item);
459
461
  if (parent.hasId) {
460
462
  var imgId = getValue('id', item);
461
- imgUrl = baseUrl + '?path=' + parent.path + '&id=' + imgId;
463
+ imgUrl = baseUrl + pathUrl + parent.path + '&id=' + imgId;
462
464
  }
463
465
  else if (!isNOU(fPath)) {
464
- imgUrl = baseUrl + '?path=' + fPath.replace(/\\/g, '/') + fileName;
466
+ imgUrl = baseUrl + pathUrl + encodeURIComponent(fPath.replace(/\\/g, '/')) + fileName;
465
467
  }
466
468
  else {
467
- imgUrl = baseUrl + '?path=' + parent.path + fileName;
469
+ imgUrl = baseUrl + pathUrl + parent.path + fileName;
468
470
  }
469
471
  imgUrl = imgUrl + '&time=' + (new Date().getTime()).toString();
470
472
  var eventArgs = {
@@ -801,6 +803,15 @@ export function pasteHandler(parent) {
801
803
  parent.enablePaste = false;
802
804
  parent.notify(events.hidePaste, {});
803
805
  removeBlur(parent);
806
+ var result = {
807
+ files: null,
808
+ error: {
809
+ code: '402',
810
+ message: getLocaleText(parent, 'Same-Folder-Error'),
811
+ fileExists: null
812
+ }
813
+ };
814
+ createDialog(parent, 'Error', result);
804
815
  }
805
816
  }
806
817
  }
@@ -983,6 +994,11 @@ export function readDropPath(parent) {
983
994
  else {
984
995
  if (parent.navigationpaneModule) {
985
996
  var node = select('[data-uid="' + pathId + '"]', parent.navigationpaneModule.treeObj.element);
997
+ if (!node) {
998
+ var liElement = document.querySelector('[data-id = "' + getValue('id', parent.dropData) + '"]');
999
+ pathId = liElement.getAttribute("data-uid");
1000
+ node = select('[data-uid="' + pathId + '"]', parent.navigationpaneModule.treeObj.element);
1001
+ }
986
1002
  updatePath(node, parent.dropData, parent);
987
1003
  }
988
1004
  read(parent, events.dropPath, parent.dropPath);
@@ -115,6 +115,7 @@ export declare class DetailsView {
115
115
  private removeFocus;
116
116
  private getFocusedItemIndex;
117
117
  private keydownHandler;
118
+ actionDivert: boolean;
118
119
  private keyupHandler;
119
120
  gridSelectNodes(): Object[];
120
121
  private doDownload;
@@ -129,6 +130,7 @@ export declare class DetailsView {
129
130
  private InnerItems;
130
131
  private shiftSelectFocusItem;
131
132
  private addFocus;
133
+ private addHeaderFocus;
132
134
  private getFocusedItem;
133
135
  private isSelected;
134
136
  private shiftSelectedItem;