@syncfusion/ej2-filemanager 20.1.47 → 20.1.52-10459

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 (203) hide show
  1. package/.eslintrc.json +20 -3
  2. package/README.md +54 -43
  3. package/dist/ej2-filemanager.min.js +1 -0
  4. package/dist/ej2-filemanager.umd.min.js +1 -10
  5. package/dist/ej2-filemanager.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-filemanager.es2015.js +2353 -659
  7. package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
  8. package/dist/es6/ej2-filemanager.es5.js +2422 -709
  9. package/dist/es6/ej2-filemanager.es5.js.map +1 -1
  10. package/dist/global/ej2-filemanager.min.js +1 -10
  11. package/dist/global/ej2-filemanager.min.js.map +1 -1
  12. package/dist/global/index.d.ts +0 -9
  13. package/helpers/e2e/filemanagerHelper.js +183 -166
  14. package/package.json +71 -71
  15. package/src/file-manager/actions/breadcrumb-bar.js +1 -5
  16. package/src/file-manager/actions/index.d.ts +1 -0
  17. package/src/file-manager/actions/index.js +1 -0
  18. package/src/file-manager/actions/toolbar.d.ts +1 -0
  19. package/src/file-manager/actions/toolbar.js +129 -17
  20. package/src/file-manager/actions/virtualization.d.ts +93 -0
  21. package/src/file-manager/actions/virtualization.js +279 -0
  22. package/src/file-manager/base/file-manager-model.d.ts +154 -28
  23. package/src/file-manager/base/file-manager.d.ts +176 -27
  24. package/src/file-manager/base/file-manager.js +244 -28
  25. package/src/file-manager/base/interface.d.ts +329 -3
  26. package/src/file-manager/base/interface.js +0 -1
  27. package/src/file-manager/common/operations.d.ts +7 -0
  28. package/src/file-manager/common/operations.js +830 -185
  29. package/src/file-manager/common/utility.d.ts +46 -3
  30. package/src/file-manager/common/utility.js +249 -73
  31. package/src/file-manager/index.d.ts +1 -0
  32. package/src/file-manager/index.js +1 -0
  33. package/src/file-manager/layout/details-view.d.ts +10 -0
  34. package/src/file-manager/layout/details-view.js +203 -94
  35. package/src/file-manager/layout/large-icons-view.d.ts +4 -2
  36. package/src/file-manager/layout/large-icons-view.js +122 -73
  37. package/src/file-manager/layout/navigation-pane.d.ts +2 -0
  38. package/src/file-manager/layout/navigation-pane.js +97 -73
  39. package/src/file-manager/models/column-model.d.ts +23 -5
  40. package/src/file-manager/models/column.d.ts +21 -2
  41. package/src/file-manager/models/column.js +6 -0
  42. package/src/file-manager/models/default-locale.js +0 -1
  43. package/src/file-manager/models/details-view-settings-model.d.ts +1 -1
  44. package/src/file-manager/models/details-view-settings.js +8 -3
  45. package/src/file-manager/models/search-settings.d.ts +5 -0
  46. package/src/file-manager/models/toolbar-settings-model.d.ts +177 -2
  47. package/src/file-manager/models/toolbar-settings.d.ts +157 -2
  48. package/src/file-manager/models/toolbar-settings.js +64 -2
  49. package/src/file-manager/models/upload-settings-model.d.ts +13 -0
  50. package/src/file-manager/models/upload-settings.d.ts +12 -0
  51. package/src/file-manager/models/upload-settings.js +3 -0
  52. package/src/file-manager/pop-up/context-menu.d.ts +2 -1
  53. package/src/file-manager/pop-up/context-menu.js +111 -36
  54. package/src/file-manager/pop-up/dialog.d.ts +1 -2
  55. package/src/file-manager/pop-up/dialog.js +19 -40
  56. package/src/global.js +1 -1
  57. package/styles/bootstrap-dark-lite.css +1058 -0
  58. package/styles/bootstrap-dark-lite.scss +16 -0
  59. package/styles/bootstrap-dark.css +371 -665
  60. package/styles/bootstrap-dark.scss +17 -1
  61. package/styles/bootstrap-lite.css +1040 -0
  62. package/styles/bootstrap-lite.scss +16 -0
  63. package/styles/bootstrap.css +353 -644
  64. package/styles/bootstrap.scss +17 -1
  65. package/styles/bootstrap4-lite.css +1068 -0
  66. package/styles/bootstrap4-lite.scss +16 -0
  67. package/styles/bootstrap4.css +381 -680
  68. package/styles/bootstrap4.scss +17 -1
  69. package/styles/bootstrap5-dark-lite.css +1078 -0
  70. package/styles/bootstrap5-dark-lite.scss +16 -0
  71. package/styles/bootstrap5-dark.css +376 -694
  72. package/styles/bootstrap5-dark.scss +17 -1
  73. package/styles/bootstrap5-lite.css +1078 -0
  74. package/styles/bootstrap5-lite.scss +16 -0
  75. package/styles/bootstrap5.3-lite.css +1035 -0
  76. package/styles/bootstrap5.3-lite.scss +16 -0
  77. package/styles/bootstrap5.3.css +1603 -0
  78. package/styles/bootstrap5.3.scss +17 -0
  79. package/styles/bootstrap5.css +376 -694
  80. package/styles/bootstrap5.scss +17 -1
  81. package/styles/fabric-dark-lite.css +1039 -0
  82. package/styles/fabric-dark-lite.scss +16 -0
  83. package/styles/fabric-dark.css +358 -642
  84. package/styles/fabric-dark.scss +17 -1
  85. package/styles/fabric-lite.css +1039 -0
  86. package/styles/fabric-lite.scss +16 -0
  87. package/styles/fabric.css +357 -641
  88. package/styles/fabric.scss +17 -1
  89. package/styles/file-manager/_all.scss +1 -1
  90. package/styles/file-manager/_bds-definition.scss +236 -0
  91. package/styles/file-manager/_bigger.scss +758 -0
  92. package/styles/file-manager/_bootstrap-dark-definition.scss +6 -2
  93. package/styles/file-manager/_bootstrap-definition.scss +6 -2
  94. package/styles/file-manager/_bootstrap4-definition.scss +6 -2
  95. package/styles/file-manager/_bootstrap5-definition.scss +20 -15
  96. package/styles/file-manager/_bootstrap5.3-definition.scss +242 -0
  97. package/styles/file-manager/_fabric-dark-definition.scss +6 -2
  98. package/styles/file-manager/_fabric-definition.scss +6 -2
  99. package/styles/file-manager/_fluent-definition.scss +20 -16
  100. package/styles/file-manager/_fluent2-definition.scss +255 -0
  101. package/styles/file-manager/_fusionnew-definition.scss +241 -0
  102. package/styles/file-manager/_highcontrast-definition.scss +6 -2
  103. package/styles/file-manager/_highcontrast-light-definition.scss +6 -2
  104. package/styles/file-manager/_layout.scss +367 -921
  105. package/styles/file-manager/_material-dark-definition.scss +7 -2
  106. package/styles/file-manager/_material-definition.scss +7 -2
  107. package/styles/file-manager/_material3-dark-definition.scss +1 -0
  108. package/styles/file-manager/_material3-definition.scss +235 -0
  109. package/styles/file-manager/_tailwind-definition.scss +20 -16
  110. package/styles/file-manager/_theme.scss +126 -102
  111. package/styles/file-manager/bootstrap-dark.css +371 -665
  112. package/styles/file-manager/bootstrap-dark.scss +2 -1
  113. package/styles/file-manager/bootstrap.css +353 -644
  114. package/styles/file-manager/bootstrap.scss +2 -1
  115. package/styles/file-manager/bootstrap4.css +381 -680
  116. package/styles/file-manager/bootstrap4.scss +2 -1
  117. package/styles/file-manager/bootstrap5-dark.css +376 -694
  118. package/styles/file-manager/bootstrap5-dark.scss +2 -1
  119. package/styles/file-manager/bootstrap5.3.css +1603 -0
  120. package/styles/file-manager/bootstrap5.3.scss +17 -0
  121. package/styles/file-manager/bootstrap5.css +376 -694
  122. package/styles/file-manager/bootstrap5.scss +2 -1
  123. package/styles/file-manager/fabric-dark.css +358 -642
  124. package/styles/file-manager/fabric-dark.scss +2 -1
  125. package/styles/file-manager/fabric.css +357 -641
  126. package/styles/file-manager/fabric.scss +2 -1
  127. package/styles/file-manager/fluent-dark.css +359 -641
  128. package/styles/file-manager/fluent-dark.scss +2 -1
  129. package/styles/file-manager/fluent.css +358 -641
  130. package/styles/file-manager/fluent.scss +2 -1
  131. package/styles/file-manager/fluent2.css +1886 -0
  132. package/styles/file-manager/fluent2.scss +17 -0
  133. package/styles/file-manager/highcontrast-light.css +354 -644
  134. package/styles/file-manager/highcontrast-light.scss +2 -1
  135. package/styles/file-manager/highcontrast.css +377 -647
  136. package/styles/file-manager/highcontrast.scss +2 -1
  137. package/styles/file-manager/icons/_bds.scss +235 -0
  138. package/styles/file-manager/icons/_bootstrap.scss +0 -1
  139. package/styles/file-manager/icons/_bootstrap4.scss +0 -1
  140. package/styles/file-manager/icons/_bootstrap5.3.scss +235 -0
  141. package/styles/file-manager/icons/_fabric-dark.scss +0 -1
  142. package/styles/file-manager/icons/_fabric.scss +0 -1
  143. package/styles/file-manager/icons/_fluent2.scss +235 -0
  144. package/styles/file-manager/icons/_fusionnew.scss +235 -0
  145. package/styles/file-manager/icons/_material3-dark.scss +1 -0
  146. package/styles/file-manager/icons/_material3.scss +235 -0
  147. package/styles/file-manager/material-dark.css +392 -671
  148. package/styles/file-manager/material-dark.scss +2 -1
  149. package/styles/file-manager/material.css +391 -654
  150. package/styles/file-manager/material.scss +2 -1
  151. package/styles/file-manager/material3-dark.css +1633 -0
  152. package/styles/file-manager/material3-dark.scss +18 -0
  153. package/styles/file-manager/material3.css +1635 -0
  154. package/styles/file-manager/material3.scss +18 -0
  155. package/styles/file-manager/tailwind-dark.css +347 -664
  156. package/styles/file-manager/tailwind-dark.scss +2 -1
  157. package/styles/file-manager/tailwind.css +347 -664
  158. package/styles/file-manager/tailwind.scss +2 -1
  159. package/styles/fluent-dark-lite.css +1037 -0
  160. package/styles/fluent-dark-lite.scss +16 -0
  161. package/styles/fluent-dark.css +359 -641
  162. package/styles/fluent-dark.scss +17 -1
  163. package/styles/fluent-lite.css +1036 -0
  164. package/styles/fluent-lite.scss +16 -0
  165. package/styles/fluent.css +358 -641
  166. package/styles/fluent.scss +17 -1
  167. package/styles/fluent2-lite.css +1272 -0
  168. package/styles/fluent2-lite.scss +16 -0
  169. package/styles/fluent2.css +1886 -0
  170. package/styles/fluent2.scss +17 -0
  171. package/styles/highcontrast-light-lite.css +1039 -0
  172. package/styles/highcontrast-light-lite.scss +16 -0
  173. package/styles/highcontrast-light.css +354 -644
  174. package/styles/highcontrast-light.scss +17 -1
  175. package/styles/highcontrast-lite.css +1059 -0
  176. package/styles/highcontrast-lite.scss +16 -0
  177. package/styles/highcontrast.css +377 -647
  178. package/styles/highcontrast.scss +17 -1
  179. package/styles/material-dark-lite.css +1092 -0
  180. package/styles/material-dark-lite.scss +16 -0
  181. package/styles/material-dark.css +392 -671
  182. package/styles/material-dark.scss +17 -1
  183. package/styles/material-lite.css +1097 -0
  184. package/styles/material-lite.scss +16 -0
  185. package/styles/material.css +391 -654
  186. package/styles/material.scss +17 -1
  187. package/styles/material3-dark-lite.css +1090 -0
  188. package/styles/material3-dark-lite.scss +16 -0
  189. package/styles/material3-dark.css +1633 -0
  190. package/styles/material3-dark.scss +19 -0
  191. package/styles/material3-lite.css +1092 -0
  192. package/styles/material3-lite.scss +16 -0
  193. package/styles/material3.css +1635 -0
  194. package/styles/material3.scss +19 -0
  195. package/styles/tailwind-dark-lite.css +1060 -0
  196. package/styles/tailwind-dark-lite.scss +16 -0
  197. package/styles/tailwind-dark.css +347 -664
  198. package/styles/tailwind-dark.scss +17 -1
  199. package/styles/tailwind-lite.css +1060 -0
  200. package/styles/tailwind-lite.scss +16 -0
  201. package/styles/tailwind.css +347 -664
  202. package/styles/tailwind.scss +17 -1
  203. package/CHANGELOG.md +0 -404
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import { Toolbar as BaseToolbar } from '@syncfusion/ej2-navigations';
2
3
  import { select, isNullOrUndefined as isNOU, closest, selectAll } from '@syncfusion/ej2-base';
3
4
  import { createDialog } from '../pop-up/dialog';
@@ -44,6 +45,7 @@ var Toolbar = /** @class */ (function () {
44
45
  enableRtl: _this.parent.enableRtl
45
46
  });
46
47
  _this.toolbarObj.isStringTemplate = true;
48
+ _this.toolbarObj.root = _this.parent.root ? _this.parent.root : _this.parent;
47
49
  _this.toolbarObj.appendTo('#' + _this.parent.element.id + CLS.TOOLBAR_ID);
48
50
  });
49
51
  };
@@ -61,6 +63,9 @@ var Toolbar = /** @class */ (function () {
61
63
  if (this.parent.isDevice && this.parent.allowMultiSelection) {
62
64
  currItems.push('SelectAll');
63
65
  }
66
+ if (this.parent.toolbarItems.length > 0) {
67
+ currItems = this.parent.toolbarItems.map(function (item) { return item.name; });
68
+ }
64
69
  return currItems;
65
70
  };
66
71
  /* istanbul ignore next */
@@ -70,7 +75,6 @@ var Toolbar = /** @class */ (function () {
70
75
  return;
71
76
  }
72
77
  var tool = args.item.id.substr((this.parent.element.id + '_tb_').length);
73
- // eslint-disable-next-line
74
78
  var details;
75
79
  if (tool === 'refresh' || tool === 'newfolder' || tool === 'upload') {
76
80
  details = [getPathObject(this.parent)];
@@ -151,6 +155,7 @@ var Toolbar = /** @class */ (function () {
151
155
  });
152
156
  };
153
157
  Toolbar.prototype.toolbarCreateHandler = function () {
158
+ var _this = this;
154
159
  if (!isNOU(select('#' + this.getId('SortBy'), this.parent.element))) {
155
160
  var items = [
156
161
  { id: this.getPupupId('name'), text: getLocaleText(this.parent, 'Name'),
@@ -177,15 +182,15 @@ var Toolbar = /** @class */ (function () {
177
182
  this.buttonObj.appendTo('#' + this.getId('SortBy'));
178
183
  }
179
184
  if (!isNOU(select('#' + this.getId('View'), this.parent.element))) {
180
- var gridSpan = '<span class="' + CLS.ICON_GRID + ' ' + CLS.MENU_ICON + '"></span>';
181
- var largeIconSpan = '<span class="' + CLS.ICON_LARGE + ' ' + CLS.MENU_ICON + '"></span>';
185
+ var gridSpan_1 = '<span class="' + CLS.ICON_GRID + ' ' + CLS.MENU_ICON + '"></span>';
186
+ var largeIconSpan_1 = '<span class="' + CLS.ICON_LARGE + ' ' + CLS.MENU_ICON + '"></span>';
182
187
  var layoutItems = [
183
188
  {
184
- id: this.getPupupId('large'), text: largeIconSpan + getLocaleText(this.parent, 'View-LargeIcons'),
189
+ id: this.getPupupId('large'), text: getLocaleText(this.parent, 'View-LargeIcons'),
185
190
  iconCss: this.parent.view === 'Details' ? '' : CLS.TB_OPTION_TICK
186
191
  },
187
192
  {
188
- id: this.getPupupId('details'), text: gridSpan + getLocaleText(this.parent, 'View-Details'),
193
+ id: this.getPupupId('details'), text: getLocaleText(this.parent, 'View-Details'),
189
194
  iconCss: this.parent.view === 'Details' ? CLS.TB_OPTION_TICK : ''
190
195
  }
191
196
  ];
@@ -194,14 +199,27 @@ var Toolbar = /** @class */ (function () {
194
199
  cssClass: getCssClass(this.parent, 'e-caret-hide ' + CLS.ROOT_POPUP),
195
200
  items: layoutItems, select: this.layoutChange.bind(this),
196
201
  enableRtl: this.parent.enableRtl,
197
- enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
198
- content: '<span class="e-tbar-btn-text">' + getLocaleText(this.parent, 'View') + '</span>'
202
+ content: '<span class="e-tbar-btn-text">' + getLocaleText(this.parent, 'View') + '</span>',
203
+ beforeItemRender: function (args) {
204
+ var tickIcon = args.item.iconCss;
205
+ var viewText = args.item.text === getLocaleText(_this.parent, 'View-LargeIcons');
206
+ var iconClass = tickIcon ? ' e-menu-icon ' + tickIcon : '';
207
+ args.element.innerHTML = '<span class="' + iconClass + '"></span>' + (viewText ? largeIconSpan_1 : gridSpan_1) + args.item.text;
208
+ var span = args.element.firstChild;
209
+ if (span && span.className === '') {
210
+ args.element.removeChild(span);
211
+ }
212
+ }
199
213
  });
200
214
  this.layoutBtnObj.isStringTemplate = true;
201
215
  this.layoutBtnObj.appendTo('#' + this.getId('View'));
202
216
  }
203
217
  this.hideItems(this.default, true);
204
218
  this.hideStatus();
219
+ if (this.parent.portals && this.toolbarObj.portals) {
220
+ this.parent.portals = this.parent.portals.concat(this.toolbarObj.portals);
221
+ this.parent['renderReactTemplates']();
222
+ }
205
223
  var btnElement = selectAll('.e-btn', this.toolbarObj.element);
206
224
  var _loop_1 = function (btnCount) {
207
225
  /* istanbul ignore next */
@@ -232,7 +250,12 @@ var Toolbar = /** @class */ (function () {
232
250
  items[itemCount].iconCss = this.parent.sortBy === 'size' ? CLS.TB_OPTION_DOT : '';
233
251
  }
234
252
  else if (items[itemCount].id === this.getPupupId('date')) {
235
- items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? CLS.TB_OPTION_DOT : '';
253
+ if (this.parent.sortBy === 'dateModified' || this.parent.sortBy === 'dateCreated') {
254
+ items[itemCount].iconCss = this.parent.sortBy === this.parent.sortBy ? CLS.TB_OPTION_DOT : '';
255
+ }
256
+ else {
257
+ items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? CLS.TB_OPTION_DOT : '';
258
+ }
236
259
  }
237
260
  else if (items[itemCount].id === this.getPupupId('ascending')) {
238
261
  items[itemCount].iconCss = this.parent.sortOrder === 'Ascending' ? CLS.TB_OPTION_TICK : '';
@@ -269,10 +292,13 @@ var Toolbar = /** @class */ (function () {
269
292
  }
270
293
  for (var i = 0; i < data.length; i++) {
271
294
  var item = void 0;
295
+ var propItem = void 0;
296
+ if (this.parent.toolbarItems.length > 0) {
297
+ propItem = this.getItemModel(this.parent.toolbarItems[parseInt(i.toString(), 10)]);
298
+ }
272
299
  var itemId = this.getId(data[i]);
273
300
  var itemText = getLocaleText(this.parent, data[i]);
274
301
  var itemTooltip = getLocaleText(this.parent, 'Tooltip-' + data[i]);
275
- var spanElement = '<span class="e-tbar-btn-text e-tbar-ddb-text">' + itemText + '</span>';
276
302
  switch (data[i]) {
277
303
  case '|':
278
304
  item = { type: 'Separator' };
@@ -280,12 +306,17 @@ var Toolbar = /** @class */ (function () {
280
306
  case 'Upload':
281
307
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_UPLOAD, showTextOn: mode };
282
308
  break;
283
- case 'SortBy':
309
+ case 'SortBy': {
310
+ var spanElement = '<span class="e-tbar-btn-text e-tbar-ddb-text">' + itemText + '</span>';
311
+ if (propItem && propItem.text) {
312
+ spanElement = '<span class="e-tbar-btn-text e-tbar-ddb-text">' + propItem.text + '</span>';
313
+ }
284
314
  item = {
285
315
  id: itemId, tooltipText: itemTooltip,
286
316
  template: '<button id="' + itemId + '" class="e-tbar-btn e-tbtn-txt" tabindex="-1">' + spanElement + '</button>'
287
317
  };
288
318
  break;
319
+ }
289
320
  case 'Refresh':
290
321
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_REFRESH, showTextOn: mode };
291
322
  break;
@@ -295,14 +326,22 @@ var Toolbar = /** @class */ (function () {
295
326
  align: 'Right'
296
327
  };
297
328
  break;
298
- case 'View':
329
+ case 'View': {
330
+ var viewText = void 0;
331
+ if (propItem && propItem.text) {
332
+ viewText = propItem.text;
333
+ }
334
+ else {
335
+ viewText = getLocaleText(this.parent, 'View');
336
+ }
299
337
  item = {
300
338
  id: itemId, tooltipText: itemTooltip, prefixIcon: this.parent.view === 'Details' ? CLS.ICON_GRID : CLS.ICON_LARGE,
301
339
  overflow: 'Show', align: 'Right', text: itemText, showTextOn: 'Overflow',
302
340
  template: '<button id="' + itemId + '" class="e-tbar-btn e-tbtn-txt" tabindex="-1" aria-label=' +
303
- getLocaleText(this.parent, 'View') + '></button>'
341
+ viewText + '></button>'
304
342
  };
305
343
  break;
344
+ }
306
345
  case 'Details':
307
346
  item = {
308
347
  id: itemId, tooltipText: itemTooltip, prefixIcon: CLS.ICON_DETAILS, overflow: 'Show', align: 'Right',
@@ -334,13 +373,74 @@ var Toolbar = /** @class */ (function () {
334
373
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_SELECTALL, showTextOn: mode };
335
374
  break;
336
375
  default:
337
- item = { id: itemId, text: itemText, tooltipText: itemTooltip };
376
+ item = { id: itemId, text: itemText, tooltipText: itemTooltip, template: '' };
338
377
  break;
339
378
  }
340
- items.push(item);
379
+ if (this.parent.toolbarItems.length > 0 && propItem) {
380
+ var mergedItems = Object.assign({}, item, propItem);
381
+ items.push(mergedItems);
382
+ }
383
+ else {
384
+ items.push(item);
385
+ }
341
386
  }
342
387
  return items;
343
388
  };
389
+ Toolbar.prototype.getItemModel = function (propItem) {
390
+ var item = {};
391
+ if (propItem.id) {
392
+ item.id = propItem.id;
393
+ }
394
+ if (propItem.text) {
395
+ item.text = propItem.text;
396
+ }
397
+ if (propItem.tooltipText) {
398
+ item.tooltipText = propItem.tooltipText;
399
+ }
400
+ if (propItem.prefixIcon) {
401
+ item.prefixIcon = propItem.prefixIcon;
402
+ }
403
+ if (propItem.cssClass) {
404
+ item.cssClass = propItem.cssClass;
405
+ }
406
+ if (propItem.showTextOn !== 'Both') {
407
+ item.showTextOn = propItem.showTextOn;
408
+ }
409
+ if (propItem.template) {
410
+ item.template = propItem.template;
411
+ }
412
+ if (propItem.disabled) {
413
+ item.disabled = propItem.disabled;
414
+ }
415
+ if (propItem.width !== 'auto') {
416
+ item.width = propItem.width;
417
+ }
418
+ if (propItem.suffixIcon) {
419
+ item.suffixIcon = propItem.suffixIcon;
420
+ }
421
+ if (propItem.align !== 'Left') {
422
+ item.align = propItem.align;
423
+ }
424
+ if (propItem.overflow !== 'None') {
425
+ item.overflow = propItem.overflow;
426
+ }
427
+ if (propItem.htmlAttributes) {
428
+ item.htmlAttributes = propItem.htmlAttributes;
429
+ }
430
+ if (propItem.type !== 'Button') {
431
+ item.type = propItem.type;
432
+ }
433
+ if (propItem.visible !== true) {
434
+ item.visible = propItem.visible;
435
+ }
436
+ if (propItem.showAlwaysInPopup) {
437
+ item.showAlwaysInPopup = propItem.showAlwaysInPopup;
438
+ }
439
+ if (propItem.tabIndex !== -1) {
440
+ item.tabIndex = propItem.tabIndex;
441
+ }
442
+ return item;
443
+ };
344
444
  Toolbar.prototype.getId = function (id) {
345
445
  return this.parent.element.id + '_tb_' + id.toLowerCase();
346
446
  };
@@ -355,8 +455,19 @@ var Toolbar = /** @class */ (function () {
355
455
  };
356
456
  Toolbar.prototype.reRenderToolbar = function (e) {
357
457
  var _this = this;
358
- if (e.newProp.toolbarSettings.items !== undefined) {
359
- this.items = this.toolbarItemData(this.getItems(e.newProp.toolbarSettings.items.map(function (item) { return item.trim(); })));
458
+ var itemsToProcess = [];
459
+ if (this.parent.toolbarItems.length > 0) {
460
+ itemsToProcess = this.parent.toolbarItems.map(function (item) {
461
+ return item.name;
462
+ });
463
+ }
464
+ else if (e.newProp.toolbarSettings.items !== undefined) {
465
+ itemsToProcess = e.newProp.toolbarSettings.items.map(function (item) {
466
+ return item.trim();
467
+ });
468
+ }
469
+ if (itemsToProcess.length > 0) {
470
+ this.items = this.toolbarItemData(this.getItems(itemsToProcess));
360
471
  var eventArgs = { items: this.items };
361
472
  this.parent.trigger('toolbarCreate', eventArgs, function (toolbarCreateArgs) {
362
473
  if (_this.buttonObj) {
@@ -385,7 +496,7 @@ var Toolbar = /** @class */ (function () {
385
496
  this.hideItems(this.selection, true);
386
497
  }
387
498
  var ele = select('#' + this.getId('Selection'), this.toolbarObj.element);
388
- if (this.parent.selectedItems.length > 0 && ele) {
499
+ if (this.parent.selectedItems.length > 0 && ele && !this.parent.enableVirtualization) {
389
500
  var txt = void 0;
390
501
  if (this.parent.selectedItems.length === 1) {
391
502
  txt = this.parent.selectedItems.length + ' ' + getLocaleText(this.parent, 'Item-Selection');
@@ -470,6 +581,7 @@ var Toolbar = /** @class */ (function () {
470
581
  this.toolbarObj.refreshOverflow();
471
582
  break;
472
583
  case 'toolbarSettings':
584
+ case 'toolbarItems':
473
585
  this.reRenderToolbar(e);
474
586
  break;
475
587
  }
@@ -0,0 +1,93 @@
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
+ }
@@ -0,0 +1,279 @@
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 };