@syncfusion/ej2-filemanager 19.4.56 → 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 (208) 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 +2371 -664
  7. package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
  8. package/dist/es6/ej2-filemanager.es5.js +2440 -714
  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 +135 -20
  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 +161 -28
  23. package/src/file-manager/base/file-manager.d.ts +182 -28
  24. package/src/file-manager/base/file-manager.js +254 -29
  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 +204 -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/navigation-pane-settings.d.ts +8 -8
  46. package/src/file-manager/models/search-settings.d.ts +5 -0
  47. package/src/file-manager/models/toolbar-settings-model.d.ts +177 -2
  48. package/src/file-manager/models/toolbar-settings.d.ts +157 -2
  49. package/src/file-manager/models/toolbar-settings.js +64 -2
  50. package/src/file-manager/models/upload-settings-model.d.ts +13 -0
  51. package/src/file-manager/models/upload-settings.d.ts +12 -0
  52. package/src/file-manager/models/upload-settings.js +3 -0
  53. package/src/file-manager/pop-up/context-menu.d.ts +2 -1
  54. package/src/file-manager/pop-up/context-menu.js +111 -36
  55. package/src/file-manager/pop-up/dialog.d.ts +1 -2
  56. package/src/file-manager/pop-up/dialog.js +19 -40
  57. package/src/global.js +1 -1
  58. package/styles/bootstrap-dark-lite.css +1058 -0
  59. package/styles/bootstrap-dark-lite.scss +16 -0
  60. package/styles/bootstrap-dark.css +371 -665
  61. package/styles/bootstrap-dark.scss +17 -1
  62. package/styles/bootstrap-lite.css +1040 -0
  63. package/styles/bootstrap-lite.scss +16 -0
  64. package/styles/bootstrap.css +353 -644
  65. package/styles/bootstrap.scss +17 -1
  66. package/styles/bootstrap4-lite.css +1068 -0
  67. package/styles/bootstrap4-lite.scss +16 -0
  68. package/styles/bootstrap4.css +381 -680
  69. package/styles/bootstrap4.scss +17 -1
  70. package/styles/bootstrap5-dark-lite.css +1078 -0
  71. package/styles/bootstrap5-dark-lite.scss +16 -0
  72. package/styles/bootstrap5-dark.css +377 -695
  73. package/styles/bootstrap5-dark.scss +17 -1
  74. package/styles/bootstrap5-lite.css +1078 -0
  75. package/styles/bootstrap5-lite.scss +16 -0
  76. package/styles/bootstrap5.3-lite.css +1035 -0
  77. package/styles/bootstrap5.3-lite.scss +16 -0
  78. package/styles/bootstrap5.3.css +1603 -0
  79. package/styles/bootstrap5.3.scss +17 -0
  80. package/styles/bootstrap5.css +377 -695
  81. package/styles/bootstrap5.scss +17 -1
  82. package/styles/fabric-dark-lite.css +1039 -0
  83. package/styles/fabric-dark-lite.scss +16 -0
  84. package/styles/fabric-dark.css +358 -642
  85. package/styles/fabric-dark.scss +17 -1
  86. package/styles/fabric-lite.css +1039 -0
  87. package/styles/fabric-lite.scss +16 -0
  88. package/styles/fabric.css +357 -641
  89. package/styles/fabric.scss +17 -1
  90. package/styles/file-manager/_all.scss +1 -1
  91. package/styles/file-manager/_bds-definition.scss +236 -0
  92. package/styles/file-manager/_bigger.scss +758 -0
  93. package/styles/file-manager/_bootstrap-dark-definition.scss +6 -2
  94. package/styles/file-manager/_bootstrap-definition.scss +6 -2
  95. package/styles/file-manager/_bootstrap4-definition.scss +6 -2
  96. package/styles/file-manager/_bootstrap5-definition.scss +21 -16
  97. package/styles/file-manager/_bootstrap5.3-definition.scss +242 -0
  98. package/styles/file-manager/_fabric-dark-definition.scss +6 -2
  99. package/styles/file-manager/_fabric-definition.scss +6 -2
  100. package/styles/file-manager/_fluent-dark-definition.scss +1 -0
  101. package/styles/file-manager/_fluent-definition.scss +26 -22
  102. package/styles/file-manager/_fluent2-definition.scss +255 -0
  103. package/styles/file-manager/_fusionnew-definition.scss +241 -0
  104. package/styles/file-manager/_highcontrast-definition.scss +6 -2
  105. package/styles/file-manager/_highcontrast-light-definition.scss +6 -2
  106. package/styles/file-manager/_layout.scss +373 -912
  107. package/styles/file-manager/_material-dark-definition.scss +7 -2
  108. package/styles/file-manager/_material-definition.scss +7 -2
  109. package/styles/file-manager/_material3-dark-definition.scss +1 -0
  110. package/styles/file-manager/_material3-definition.scss +235 -0
  111. package/styles/file-manager/_tailwind-definition.scss +20 -16
  112. package/styles/file-manager/_theme.scss +130 -99
  113. package/styles/file-manager/bootstrap-dark.css +371 -665
  114. package/styles/file-manager/bootstrap-dark.scss +2 -1
  115. package/styles/file-manager/bootstrap.css +353 -644
  116. package/styles/file-manager/bootstrap.scss +2 -1
  117. package/styles/file-manager/bootstrap4.css +381 -680
  118. package/styles/file-manager/bootstrap4.scss +2 -1
  119. package/styles/file-manager/bootstrap5-dark.css +377 -695
  120. package/styles/file-manager/bootstrap5-dark.scss +2 -1
  121. package/styles/file-manager/bootstrap5.3.css +1603 -0
  122. package/styles/file-manager/bootstrap5.3.scss +17 -0
  123. package/styles/file-manager/bootstrap5.css +377 -695
  124. package/styles/file-manager/bootstrap5.scss +2 -1
  125. package/styles/file-manager/fabric-dark.css +358 -642
  126. package/styles/file-manager/fabric-dark.scss +2 -1
  127. package/styles/file-manager/fabric.css +357 -641
  128. package/styles/file-manager/fabric.scss +2 -1
  129. package/styles/file-manager/fluent-dark.css +1616 -0
  130. package/styles/file-manager/fluent-dark.scss +17 -0
  131. package/styles/file-manager/fluent.css +1615 -0
  132. package/styles/file-manager/fluent.scss +17 -0
  133. package/styles/file-manager/fluent2.css +1886 -0
  134. package/styles/file-manager/fluent2.scss +17 -0
  135. package/styles/file-manager/highcontrast-light.css +354 -644
  136. package/styles/file-manager/highcontrast-light.scss +2 -1
  137. package/styles/file-manager/highcontrast.css +377 -647
  138. package/styles/file-manager/highcontrast.scss +2 -1
  139. package/styles/file-manager/icons/_bds.scss +235 -0
  140. package/styles/file-manager/icons/_bootstrap.scss +0 -1
  141. package/styles/file-manager/icons/_bootstrap4.scss +0 -1
  142. package/styles/file-manager/icons/_bootstrap5.3.scss +235 -0
  143. package/styles/file-manager/icons/_fabric-dark.scss +0 -1
  144. package/styles/file-manager/icons/_fabric.scss +0 -1
  145. package/styles/file-manager/icons/_fluent-dark.scss +1 -0
  146. package/styles/file-manager/icons/_fluent.scss +19 -19
  147. package/styles/file-manager/icons/_fluent2.scss +235 -0
  148. package/styles/file-manager/icons/_fusionnew.scss +235 -0
  149. package/styles/file-manager/icons/_material3-dark.scss +1 -0
  150. package/styles/file-manager/icons/_material3.scss +235 -0
  151. package/styles/file-manager/icons/_tailwind.scss +49 -49
  152. package/styles/file-manager/material-dark.css +392 -671
  153. package/styles/file-manager/material-dark.scss +2 -1
  154. package/styles/file-manager/material.css +391 -654
  155. package/styles/file-manager/material.scss +2 -1
  156. package/styles/file-manager/material3-dark.css +1633 -0
  157. package/styles/file-manager/material3-dark.scss +18 -0
  158. package/styles/file-manager/material3.css +1635 -0
  159. package/styles/file-manager/material3.scss +18 -0
  160. package/styles/file-manager/tailwind-dark.css +369 -686
  161. package/styles/file-manager/tailwind-dark.scss +2 -1
  162. package/styles/file-manager/tailwind.css +369 -686
  163. package/styles/file-manager/tailwind.scss +2 -1
  164. package/styles/fluent-dark-lite.css +1037 -0
  165. package/styles/fluent-dark-lite.scss +16 -0
  166. package/styles/fluent-dark.css +1616 -0
  167. package/styles/fluent-dark.scss +17 -0
  168. package/styles/fluent-lite.css +1036 -0
  169. package/styles/fluent-lite.scss +16 -0
  170. package/styles/fluent.css +1615 -0
  171. package/styles/fluent.scss +17 -0
  172. package/styles/fluent2-lite.css +1272 -0
  173. package/styles/fluent2-lite.scss +16 -0
  174. package/styles/fluent2.css +1886 -0
  175. package/styles/fluent2.scss +17 -0
  176. package/styles/highcontrast-light-lite.css +1039 -0
  177. package/styles/highcontrast-light-lite.scss +16 -0
  178. package/styles/highcontrast-light.css +354 -644
  179. package/styles/highcontrast-light.scss +17 -1
  180. package/styles/highcontrast-lite.css +1059 -0
  181. package/styles/highcontrast-lite.scss +16 -0
  182. package/styles/highcontrast.css +377 -647
  183. package/styles/highcontrast.scss +17 -1
  184. package/styles/material-dark-lite.css +1092 -0
  185. package/styles/material-dark-lite.scss +16 -0
  186. package/styles/material-dark.css +392 -671
  187. package/styles/material-dark.scss +17 -1
  188. package/styles/material-lite.css +1097 -0
  189. package/styles/material-lite.scss +16 -0
  190. package/styles/material.css +391 -654
  191. package/styles/material.scss +17 -1
  192. package/styles/material3-dark-lite.css +1090 -0
  193. package/styles/material3-dark-lite.scss +16 -0
  194. package/styles/material3-dark.css +1633 -0
  195. package/styles/material3-dark.scss +19 -0
  196. package/styles/material3-lite.css +1092 -0
  197. package/styles/material3-lite.scss +16 -0
  198. package/styles/material3.css +1635 -0
  199. package/styles/material3.scss +19 -0
  200. package/styles/tailwind-dark-lite.css +1060 -0
  201. package/styles/tailwind-dark-lite.scss +16 -0
  202. package/styles/tailwind-dark.css +369 -686
  203. package/styles/tailwind-dark.scss +17 -1
  204. package/styles/tailwind-lite.css +1060 -0
  205. package/styles/tailwind-lite.scss +16 -0
  206. package/styles/tailwind.css +369 -686
  207. package/styles/tailwind.scss +17 -1
  208. package/CHANGELOG.md +0 -466
@@ -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,11 +155,15 @@ 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
- { id: this.getPupupId('name'), text: getLocaleText(this.parent, 'Name'), iconCss: CLS.TB_OPTION_DOT },
157
- { id: this.getPupupId('size'), text: getLocaleText(this.parent, 'Size') },
158
- { id: this.getPupupId('date'), text: getLocaleText(this.parent, 'DateModified') },
161
+ { id: this.getPupupId('name'), text: getLocaleText(this.parent, 'Name'),
162
+ iconCss: this.parent.sortBy === 'name' ? CLS.TB_OPTION_DOT : '' },
163
+ { id: this.getPupupId('size'), text: getLocaleText(this.parent, 'Size'),
164
+ iconCss: this.parent.sortBy === 'size' ? CLS.TB_OPTION_DOT : '' },
165
+ { id: this.getPupupId('date'), text: getLocaleText(this.parent, 'DateModified'),
166
+ iconCss: this.parent.sortBy === '_fm_modified' ? CLS.TB_OPTION_DOT : '' },
159
167
  { separator: true },
160
168
  { id: this.getPupupId('ascending'), text: getLocaleText(this.parent, 'Ascending'),
161
169
  iconCss: this.parent.sortOrder === 'Ascending' ? CLS.TB_OPTION_TICK : '' },
@@ -174,15 +182,15 @@ var Toolbar = /** @class */ (function () {
174
182
  this.buttonObj.appendTo('#' + this.getId('SortBy'));
175
183
  }
176
184
  if (!isNOU(select('#' + this.getId('View'), this.parent.element))) {
177
- var gridSpan = '<span class="' + CLS.ICON_GRID + ' ' + CLS.MENU_ICON + '"></span>';
178
- 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>';
179
187
  var layoutItems = [
180
188
  {
181
- id: this.getPupupId('large'), text: largeIconSpan + getLocaleText(this.parent, 'View-LargeIcons'),
189
+ id: this.getPupupId('large'), text: getLocaleText(this.parent, 'View-LargeIcons'),
182
190
  iconCss: this.parent.view === 'Details' ? '' : CLS.TB_OPTION_TICK
183
191
  },
184
192
  {
185
- id: this.getPupupId('details'), text: gridSpan + getLocaleText(this.parent, 'View-Details'),
193
+ id: this.getPupupId('details'), text: getLocaleText(this.parent, 'View-Details'),
186
194
  iconCss: this.parent.view === 'Details' ? CLS.TB_OPTION_TICK : ''
187
195
  }
188
196
  ];
@@ -191,14 +199,27 @@ var Toolbar = /** @class */ (function () {
191
199
  cssClass: getCssClass(this.parent, 'e-caret-hide ' + CLS.ROOT_POPUP),
192
200
  items: layoutItems, select: this.layoutChange.bind(this),
193
201
  enableRtl: this.parent.enableRtl,
194
- enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
195
- 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
+ }
196
213
  });
197
214
  this.layoutBtnObj.isStringTemplate = true;
198
215
  this.layoutBtnObj.appendTo('#' + this.getId('View'));
199
216
  }
200
217
  this.hideItems(this.default, true);
201
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
+ }
202
223
  var btnElement = selectAll('.e-btn', this.toolbarObj.element);
203
224
  var _loop_1 = function (btnCount) {
204
225
  /* istanbul ignore next */
@@ -229,7 +250,12 @@ var Toolbar = /** @class */ (function () {
229
250
  items[itemCount].iconCss = this.parent.sortBy === 'size' ? CLS.TB_OPTION_DOT : '';
230
251
  }
231
252
  else if (items[itemCount].id === this.getPupupId('date')) {
232
- 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
+ }
233
259
  }
234
260
  else if (items[itemCount].id === this.getPupupId('ascending')) {
235
261
  items[itemCount].iconCss = this.parent.sortOrder === 'Ascending' ? CLS.TB_OPTION_TICK : '';
@@ -266,10 +292,13 @@ var Toolbar = /** @class */ (function () {
266
292
  }
267
293
  for (var i = 0; i < data.length; i++) {
268
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
+ }
269
299
  var itemId = this.getId(data[i]);
270
300
  var itemText = getLocaleText(this.parent, data[i]);
271
301
  var itemTooltip = getLocaleText(this.parent, 'Tooltip-' + data[i]);
272
- var spanElement = '<span class="e-tbar-btn-text e-tbar-ddb-text">' + itemText + '</span>';
273
302
  switch (data[i]) {
274
303
  case '|':
275
304
  item = { type: 'Separator' };
@@ -277,12 +306,17 @@ var Toolbar = /** @class */ (function () {
277
306
  case 'Upload':
278
307
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_UPLOAD, showTextOn: mode };
279
308
  break;
280
- 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
+ }
281
314
  item = {
282
315
  id: itemId, tooltipText: itemTooltip,
283
316
  template: '<button id="' + itemId + '" class="e-tbar-btn e-tbtn-txt" tabindex="-1">' + spanElement + '</button>'
284
317
  };
285
318
  break;
319
+ }
286
320
  case 'Refresh':
287
321
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_REFRESH, showTextOn: mode };
288
322
  break;
@@ -292,14 +326,22 @@ var Toolbar = /** @class */ (function () {
292
326
  align: 'Right'
293
327
  };
294
328
  break;
295
- 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
+ }
296
337
  item = {
297
338
  id: itemId, tooltipText: itemTooltip, prefixIcon: this.parent.view === 'Details' ? CLS.ICON_GRID : CLS.ICON_LARGE,
298
339
  overflow: 'Show', align: 'Right', text: itemText, showTextOn: 'Overflow',
299
340
  template: '<button id="' + itemId + '" class="e-tbar-btn e-tbtn-txt" tabindex="-1" aria-label=' +
300
- getLocaleText(this.parent, 'View') + '></button>'
341
+ viewText + '></button>'
301
342
  };
302
343
  break;
344
+ }
303
345
  case 'Details':
304
346
  item = {
305
347
  id: itemId, tooltipText: itemTooltip, prefixIcon: CLS.ICON_DETAILS, overflow: 'Show', align: 'Right',
@@ -331,13 +373,74 @@ var Toolbar = /** @class */ (function () {
331
373
  item = { id: itemId, text: itemText, tooltipText: itemTooltip, prefixIcon: CLS.ICON_SELECTALL, showTextOn: mode };
332
374
  break;
333
375
  default:
334
- item = { id: itemId, text: itemText, tooltipText: itemTooltip };
376
+ item = { id: itemId, text: itemText, tooltipText: itemTooltip, template: '' };
335
377
  break;
336
378
  }
337
- 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
+ }
338
386
  }
339
387
  return items;
340
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
+ };
341
444
  Toolbar.prototype.getId = function (id) {
342
445
  return this.parent.element.id + '_tb_' + id.toLowerCase();
343
446
  };
@@ -352,8 +455,19 @@ var Toolbar = /** @class */ (function () {
352
455
  };
353
456
  Toolbar.prototype.reRenderToolbar = function (e) {
354
457
  var _this = this;
355
- if (e.newProp.toolbarSettings.items !== undefined) {
356
- 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));
357
471
  var eventArgs = { items: this.items };
358
472
  this.parent.trigger('toolbarCreate', eventArgs, function (toolbarCreateArgs) {
359
473
  if (_this.buttonObj) {
@@ -382,7 +496,7 @@ var Toolbar = /** @class */ (function () {
382
496
  this.hideItems(this.selection, true);
383
497
  }
384
498
  var ele = select('#' + this.getId('Selection'), this.toolbarObj.element);
385
- if (this.parent.selectedItems.length > 0 && ele) {
499
+ if (this.parent.selectedItems.length > 0 && ele && !this.parent.enableVirtualization) {
386
500
  var txt = void 0;
387
501
  if (this.parent.selectedItems.length === 1) {
388
502
  txt = this.parent.selectedItems.length + ' ' + getLocaleText(this.parent, 'Item-Selection');
@@ -467,6 +581,7 @@ var Toolbar = /** @class */ (function () {
467
581
  this.toolbarObj.refreshOverflow();
468
582
  break;
469
583
  case 'toolbarSettings':
584
+ case 'toolbarItems':
470
585
  this.reRenderToolbar(e);
471
586
  break;
472
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 };