@syncfusion/ej2-filemanager 20.4.43 → 20.4.48

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 (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/ej2-filemanager.min.js +2 -2
  3. package/dist/ej2-filemanager.umd.min.js +2 -2
  4. package/dist/ej2-filemanager.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-filemanager.es2015.js +320 -206
  6. package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
  7. package/dist/es6/ej2-filemanager.es5.js +326 -229
  8. package/dist/es6/ej2-filemanager.es5.js.map +1 -1
  9. package/dist/global/ej2-filemanager.min.js +2 -2
  10. package/dist/global/ej2-filemanager.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +15 -15
  13. package/src/file-manager/actions/toolbar.js +1 -1
  14. package/src/file-manager/actions/virtualization.d.ts +40 -5
  15. package/src/file-manager/actions/virtualization.js +131 -59
  16. package/src/file-manager/base/file-manager-model.d.ts +10 -14
  17. package/src/file-manager/base/file-manager.d.ts +8 -12
  18. package/src/file-manager/base/file-manager.js +5 -5
  19. package/src/file-manager/base/interface.d.ts +1 -0
  20. package/src/file-manager/layout/details-view.d.ts +6 -0
  21. package/src/file-manager/layout/details-view.js +43 -20
  22. package/src/file-manager/layout/large-icons-view.js +41 -10
  23. package/src/file-manager/layout/navigation-pane.js +7 -3
  24. package/src/file-manager/models/column-model.d.ts +7 -0
  25. package/src/file-manager/models/column.d.ts +6 -0
  26. package/src/file-manager/models/column.js +3 -0
  27. package/src/file-manager/models/details-view-settings.js +1 -1
  28. package/src/file-manager/models/index.d.ts +0 -2
  29. package/src/file-manager/models/index.js +0 -1
  30. package/src/file-manager/pop-up/context-menu.js +3 -0
@@ -113,14 +113,14 @@ var DetailsView = /** @class */ (function () {
113
113
  allowResizing: this.parent.detailsViewSettings.columnResizing,
114
114
  selectionSettings: {
115
115
  type: this.parent.allowMultiSelection ? 'Multiple' : 'Single',
116
- checkboxMode: 'ResetOnRowClick'
116
+ checkboxMode: 'ResetOnRowClick',
117
+ persistSelection: (this.parent.enableVirtualization) ? true : false
117
118
  },
118
119
  enableRtl: this.parent.enableRtl,
119
120
  pageSettings: { pageSize: 20 },
120
- // enableVirtualization: this.parent.virtualizationSettings.enable,
121
+ enableVirtualization: this.parent.enableVirtualization,
121
122
  enablePersistence: this.parent.enablePersistence,
122
- // enableVirtualMaskRow: true,
123
- // pageSettings: { pageSize: this.parent.virtualizationSettings.detailsViewItemsCount },
123
+ enableVirtualMaskRow: true,
124
124
  sortSettings: { allowUnsort: false, columns: sortSettings },
125
125
  columns: columns,
126
126
  recordDoubleClick: this.DblClickEvents.bind(this),
@@ -130,6 +130,7 @@ var DetailsView = /** @class */ (function () {
130
130
  actionBegin: this.onActionBegin.bind(this),
131
131
  headerCellInfo: this.onHeaderCellInfo.bind(this),
132
132
  width: '100%',
133
+ height: (this.parent.enableVirtualization) ? this.getGridHeight() : 'auto',
133
134
  beforeCopy: function (args) { args.cancel = true; },
134
135
  // eslint-disable-next-line
135
136
  load: function (args) {
@@ -144,6 +145,20 @@ var DetailsView = /** @class */ (function () {
144
145
  this.emptyArgs = args;
145
146
  }
146
147
  };
148
+ /**
149
+ * Gets the grid height.
150
+ * @returns The grid height.
151
+ * @private
152
+ */
153
+ DetailsView.prototype.getGridHeight = function () {
154
+ // Get the content pane and breadcrumb bar elements
155
+ var pane = select('#' + this.parent.element.id + CLS.CONTENT_ID, this.parent.element);
156
+ var bar = select('#' + this.parent.element.id + CLS.BREADCRUMBBAR_ID, this.parent.element);
157
+ // The maximum height of the header is 36
158
+ var headerMaxHeight = 36;
159
+ // Calculate and return the grid height
160
+ return (pane.offsetHeight - bar.offsetHeight - headerMaxHeight);
161
+ };
147
162
  DetailsView.prototype.checkNameWidth = function () {
148
163
  var initialColumn = this.parent.detailsViewSettings.columns;
149
164
  this.isNameWidth = false;
@@ -329,20 +344,17 @@ var DetailsView = /** @class */ (function () {
329
344
  }
330
345
  };
331
346
  DetailsView.prototype.onBeforeDataBound = function (args) {
332
- // if (!this.parent.virtualizationSettings.enable) {
333
347
  showSpinner(this.parent.element);
334
348
  // eslint-disable-next-line
335
- var items = getSortedData(this.parent, this.gridObj.dataSource);
349
+ var items = getSortedData(this.parent, (this.parent.enableVirtualization) ? args.result : this.gridObj.dataSource);
336
350
  args.result = items;
337
- // }
338
351
  };
339
352
  /* istanbul ignore next */
340
353
  DetailsView.prototype.onDataBound = function () {
341
354
  this.createDragObj();
342
- // if ((this.parent.selectedItems.length !== 0 && !this.parent.virtualizationSettings.enable) ||
343
- // ((this.parent.selectedItems.length !== 0 && this.parent.virtualizationSettings.enable &&
344
- // this.element.querySelector('.e-content').scrollTop == 0))) {
345
- if (this.parent.selectedItems.length !== 0) {
355
+ if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) ||
356
+ ((this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization &&
357
+ this.element.querySelector('.e-content').scrollTop == 0))) {
346
358
  this.selectRecords(this.parent.selectedItems);
347
359
  }
348
360
  if (this.isPasteOperation === true) {
@@ -461,6 +473,9 @@ var DetailsView = /** @class */ (function () {
461
473
  // eslint-disable-next-line
462
474
  this.gridObj.dataSource = getSortedData(this.parent, this.gridObj.dataSource);
463
475
  }
476
+ if (this.element.querySelector('.e-content').scrollTop !== 0) {
477
+ this.gridObj.freezeRefresh();
478
+ }
464
479
  };
465
480
  DetailsView.prototype.onPropertyChanged = function (e) {
466
481
  if (e.module !== this.getModuleName() && e.module !== 'common') {
@@ -540,6 +555,7 @@ var DetailsView = /** @class */ (function () {
540
555
  showSpinner(this.parent.element);
541
556
  this.parent.setProperties({ selectedItems: [] }, true);
542
557
  this.gridObj.dataSource = getSortedData(this.parent, args.files);
558
+ this.gridObj.freezeRefresh();
543
559
  }
544
560
  this.emptyArgs = args;
545
561
  };
@@ -625,12 +641,18 @@ var DetailsView = /** @class */ (function () {
625
641
  _this.parent.isFiltered = false;
626
642
  }
627
643
  _this.element.focus();
644
+ if (_this.parent.enableVirtualization) {
645
+ _this.parent.element.querySelector('#' + _this.parent.element.id + CLS.IMG_DIALOG_ID).focus();
646
+ }
628
647
  }
629
648
  });
630
649
  };
631
650
  /* istanbul ignore next */
632
651
  DetailsView.prototype.onLayoutChange = function (args) {
633
652
  if (this.parent.view === 'Details') {
653
+ if (this.parent.enableVirtualization) {
654
+ this.parent.setProperties({ selectedItems: [] }, true);
655
+ }
634
656
  if (!this.gridObj) {
635
657
  this.render(args);
636
658
  }
@@ -1103,11 +1125,10 @@ var DetailsView = /** @class */ (function () {
1103
1125
  }
1104
1126
  }
1105
1127
  var len = rows.length;
1106
- if (len > 0) {
1107
- // if (this.parent.virtualizationSettings.enable) {
1108
- // this.parent.currentItemText = getValue('name', args.data);
1109
- // }
1110
- // else if (len > 0) {
1128
+ if (this.parent.enableVirtualization) {
1129
+ this.parent.currentItemText = getValue('name', args.data);
1130
+ }
1131
+ else if (len > 0) {
1111
1132
  // eslint-disable-next-line
1112
1133
  var data = this.gridObj.getRowsObject()[rows[len - 1]].data;
1113
1134
  this.parent.currentItemText = getValue('name', data);
@@ -1121,11 +1142,13 @@ var DetailsView = /** @class */ (function () {
1121
1142
  }
1122
1143
  }
1123
1144
  this.parent.visitedItem = args.row;
1124
- if (this.parent.allowMultiSelection && !isNOU(item) && !isNOU(item.querySelector('.e-checkselect'))) {
1125
- var checkItem = item.querySelector('.e-checkselect');
1126
- checkItem.focus();
1145
+ if ((!this.parent.enableVirtualization) || (!args.isHeaderCheckboxClicked)) {
1146
+ if (this.parent.allowMultiSelection && !isNOU(item) && !isNOU(item.querySelector('.e-checkselect'))) {
1147
+ var checkItem = item.querySelector('.e-checkselect');
1148
+ checkItem.focus();
1149
+ }
1150
+ this.addFocus(this.gridObj.selectedRowIndex);
1127
1151
  }
1128
- this.addFocus(this.gridObj.selectedRowIndex);
1129
1152
  if (!this.parent.isLayoutChange) {
1130
1153
  this.isInteracted = true;
1131
1154
  }
@@ -112,16 +112,19 @@ var LargeIconsView = /** @class */ (function () {
112
112
  this.items = [];
113
113
  this.items = this.renderList(args);
114
114
  this.items = this.allItems = getSortedData(this.parent, this.items);
115
- // if (this.parent.virtualizationSettings.enable) {
116
- // this.items = this.allItems.slice(0, this.parent.virtualizationSettings.largeIconsViewItemsCount);
117
- // }
115
+ iconsView.classList.remove(CLS.DISPLAY_NONE);
116
+ if (this.parent.enableVirtualization && this.allItems.length > 0) {
117
+ if (!this.element.style.height) {
118
+ this.adjustHeight();
119
+ }
120
+ this.parent.virtualizationModule.setUIVirtualization();
121
+ }
118
122
  // eslint-disable-next-line
119
123
  this.listElements = ListBase.createListFromJson(createElement, this.items, this.listObj);
120
124
  this.itemList = Array.prototype.slice.call(selectAll('.' + CLS.LIST_ITEM, this.listElements));
121
125
  this.element.appendChild(this.listElements);
122
126
  this.preventImgDrag();
123
127
  this.createDragObj();
124
- iconsView.classList.remove(CLS.DISPLAY_NONE);
125
128
  if (this.itemList.length === 0) {
126
129
  var emptyList = this.element.querySelector('.' + CLS.LIST_PARENT);
127
130
  this.element.removeChild(emptyList);
@@ -156,10 +159,10 @@ var LargeIconsView = /** @class */ (function () {
156
159
  this.getItemCount();
157
160
  this.addEventListener();
158
161
  this.wireEvents();
159
- // if (this.parent.virtualizationSettings.enable && this.allItems.length > 0) {
160
- // this.parent.virtualizationModule.setUlElementHeight();
161
- // this.parent.virtualizationModule.wireScrollEvent(false);
162
- // }
162
+ if (this.parent.enableVirtualization && this.allItems.length > 0) {
163
+ this.parent.virtualizationModule.setUlElementHeight();
164
+ this.parent.virtualizationModule.wireScrollEvent(false);
165
+ }
163
166
  this.isRendered = true;
164
167
  hideSpinner(this.parent.element);
165
168
  if (this.parent.selectedItems.length) {
@@ -289,6 +292,9 @@ var LargeIconsView = /** @class */ (function () {
289
292
  LargeIconsView.prototype.onLayoutChange = function (args) {
290
293
  if (this.parent.view === 'LargeIcons') {
291
294
  this.destroy();
295
+ if (this.parent.enableVirtualization) {
296
+ this.parent.setProperties({ selectedItems: [] }, true);
297
+ }
292
298
  this.render(args);
293
299
  /* istanbul ignore next */
294
300
  if (getValue('name', args) === 'layout-change' && this.parent.fileAction === 'move' &&
@@ -943,6 +949,7 @@ var LargeIconsView = /** @class */ (function () {
943
949
  /* istanbul ignore next */
944
950
  // eslint:disable-next-line
945
951
  LargeIconsView.prototype.keyActionHandler = function (e) {
952
+ var _this = this;
946
953
  if (!this.isRendered) {
947
954
  return;
948
955
  }
@@ -951,10 +958,28 @@ var LargeIconsView = /** @class */ (function () {
951
958
  var lastItem = this.getLastItem();
952
959
  switch (e.action) {
953
960
  case 'end':
954
- this.navigateItem(lastItem);
961
+ if (this.parent.enableVirtualization) {
962
+ this.clearSelect();
963
+ this.element.firstElementChild.scrollTo(0, this.element.firstElementChild.scrollHeight);
964
+ setTimeout(function () {
965
+ _this.navigateItem(_this.itemList[_this.itemList.length - 1]);
966
+ }, 10);
967
+ }
968
+ else {
969
+ this.navigateItem(lastItem);
970
+ }
955
971
  break;
956
972
  case 'home':
957
- this.navigateItem(firstItem);
973
+ if (this.parent.enableVirtualization) {
974
+ this.clearSelect();
975
+ this.element.firstElementChild.scrollTop = 0;
976
+ setTimeout(function () {
977
+ _this.navigateItem(_this.itemList[0]);
978
+ }, 10);
979
+ }
980
+ else {
981
+ this.navigateItem(firstItem);
982
+ }
958
983
  break;
959
984
  case 'tab':
960
985
  if (!isNOU(fItem)) {
@@ -1123,6 +1148,12 @@ var LargeIconsView = /** @class */ (function () {
1123
1148
  index = perRow ? index - perRow : index - 1;
1124
1149
  }
1125
1150
  nextItem = this.itemList[index];
1151
+ if (this.parent.enableVirtualization && isNOU(nextItem)) {
1152
+ var marginValue = parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-top'), 10) +
1153
+ parseInt(window.getComputedStyle(this.itemList[0]).getPropertyValue('margin-bottom'), 10);
1154
+ var scrollHeight = this.itemList[0].getBoundingClientRect().height + marginValue;
1155
+ this.element.firstElementChild.scrollTo(this.element.firstElementChild.scrollTop, this.element.firstElementChild.scrollTop + scrollHeight);
1156
+ }
1126
1157
  if (isNOU(nextItem)) {
1127
1158
  return li;
1128
1159
  }
@@ -198,8 +198,8 @@ var NavigationPane = /** @class */ (function () {
198
198
  args.cancel = eventArgs.cancel;
199
199
  if (args.cancel) {
200
200
  this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] !== args.node.getAttribute('data-uid') : false;
201
- this.treeObj.selectedNodes = this.isNodeClickCalled ? this.previousSelected : this.treeObj.selectedNodes;
202
201
  this.previousSelected = this.treeObj.selectedNodes;
202
+ this.treeObj.selectedNodes = [args.node.getAttribute("data-uid")];
203
203
  if (!isNOU(this.parent) && !isNOU(this.parent.contextmenuModule)) {
204
204
  this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
205
205
  }
@@ -236,13 +236,17 @@ var NavigationPane = /** @class */ (function () {
236
236
  this.parent.selectedItems = [];
237
237
  this.parent.itemData = nodeData;
238
238
  var previousPath = this.parent.path;
239
- updatePath(args.node, this.parent.itemData[0], this.parent);
239
+ if (!this.isRightClick) {
240
+ updatePath(args.node, this.parent.itemData[0], this.parent);
241
+ }
240
242
  if (previousPath !== this.parent.path) {
241
243
  this.expandNodeTarget = null;
242
244
  if (args.node.querySelector('.' + CLS.ICONS) && args.node.querySelector('.' + CLS.LIST_ITEM) === null) {
243
245
  this.expandNodeTarget = 'add';
244
246
  }
245
- read(this.parent, this.isPathDragged ? events.pasteEnd : events.pathChanged, this.parent.path);
247
+ if (!this.isRightClick) {
248
+ read(this.parent, this.isPathDragged ? events.pasteEnd : events.pathChanged, this.parent.path);
249
+ }
246
250
  this.parent.visitedItem = args.node;
247
251
  }
248
252
  this.isPathDragged = this.isRenameParent = this.isRightClick = false;
@@ -134,4 +134,11 @@ export interface ColumnModel {
134
134
  /* eslint-disable */
135
135
  customFormat?: { [x: string]: Object };
136
136
 
137
+ /**
138
+ * If `isPrimaryKey` is set to true, considers this column as the primary key constraint.
139
+ *
140
+ * @default false
141
+ */
142
+ isPrimaryKey?: boolean;
143
+
137
144
  }
@@ -157,4 +157,10 @@ export declare class Column extends ChildProperty<Column> {
157
157
  customFormat: {
158
158
  [x: string]: Object;
159
159
  };
160
+ /**
161
+ * If `isPrimaryKey` is set to true, considers this column as the primary key constraint.
162
+ *
163
+ * @default false
164
+ */
165
+ isPrimaryKey: boolean;
160
166
  }
@@ -75,6 +75,9 @@ var Column = /** @class */ (function (_super) {
75
75
  __decorate([
76
76
  Property(null)
77
77
  ], Column.prototype, "customFormat", void 0);
78
+ __decorate([
79
+ Property(false)
80
+ ], Column.prototype, "isPrimaryKey", void 0);
78
81
  return Column;
79
82
  }(ChildProperty));
80
83
  export { Column };
@@ -23,7 +23,7 @@ import { Property, ChildProperty } from '@syncfusion/ej2-base';
23
23
  */
24
24
  export var columnArray = [
25
25
  {
26
- field: 'name', headerText: 'Name', minWidth: 120,
26
+ field: 'name', headerText: 'Name', minWidth: 120, isPrimaryKey: true,
27
27
  template: '<span class="e-fe-text">${name}</span>', customAttributes: { class: 'e-fe-grid-name' }
28
28
  },
29
29
  {
@@ -9,8 +9,6 @@ export * from './search-settings';
9
9
  export * from './search-settings-model';
10
10
  export * from './details-view-settings-model';
11
11
  export * from './details-view-settings';
12
- export * from './virtualization-settings-model';
13
- export * from './virtualization-settings';
14
12
  export * from './contextMenu-settings';
15
13
  export * from './contextMenu-settings-model';
16
14
  export * from './navigation-pane-settings-model';
@@ -5,7 +5,6 @@ export * from './ajax-settings';
5
5
  export * from './toolbar-settings';
6
6
  export * from './search-settings';
7
7
  export * from './details-view-settings';
8
- export * from './virtualization-settings';
9
8
  export * from './contextMenu-settings';
10
9
  export * from './navigation-pane-settings';
11
10
  export * from './upload-settings';
@@ -80,6 +80,9 @@ var ContextMenu = /** @class */ (function () {
80
80
  this.menuTarget = this.targetNodeElement = target;
81
81
  }
82
82
  this.targetElement = this.parent.view === 'Details' ? closest(target, 'tr.e-row') : target;
83
+ if (this.parent.enableVirtualization && (target.classList.contains('e-virtual-bottom') || target.classList.contains('e-virtualtable'))) {
84
+ target = target.parentElement.closest("div");
85
+ }
83
86
  var view = this.getTargetView(target);
84
87
  this.updateActiveModule();
85
88
  /* istanbul ignore next */