@syncfusion/ej2-filemanager 21.1.37 → 21.1.41

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.
@@ -1313,7 +1313,7 @@ function sortbyClickHandler(parent, args) {
1313
1313
  tick = false;
1314
1314
  }
1315
1315
  if (!tick) {
1316
- parent.sortBy = getSortField(args.item.id);
1316
+ parent.sortBy = getSortField(args.item.id, parent);
1317
1317
  }
1318
1318
  else {
1319
1319
  parent.sortOrder = getSortField(args.item.id);
@@ -1340,12 +1340,24 @@ function sortbyClickHandler(parent, args) {
1340
1340
  * @returns {string} - returns the sorted fields
1341
1341
  * @private
1342
1342
  */
1343
- function getSortField(id) {
1343
+ function getSortField(id, parent) {
1344
1344
  const text = id.substring(id.lastIndexOf('_') + 1);
1345
1345
  let field = text;
1346
+ let column;
1347
+ if (parent) {
1348
+ column = parent.detailsViewSettings.columns;
1349
+ }
1346
1350
  switch (text) {
1347
1351
  case 'date':
1348
- field = '_fm_modified';
1352
+ for (let i = 0, len = column.length; i < len; i++) {
1353
+ if (column[i].field === 'dateModified' || column[i].field === 'dateCreated') {
1354
+ field = column[i].field;
1355
+ break;
1356
+ }
1357
+ else {
1358
+ field = '_fm_modified';
1359
+ }
1360
+ }
1349
1361
  break;
1350
1362
  case 'ascending':
1351
1363
  field = 'Ascending';
@@ -2545,10 +2557,15 @@ function renameSuccess(parent, result, path) {
2545
2557
  const args = { action: 'rename', result: result };
2546
2558
  parent.trigger('success', args);
2547
2559
  parent.renamedItem = result.files[0];
2560
+ if (getValue('filterPath', parent.renamedItem) === getValue('filterPath', parent.itemData[0]) && parent.pathNames.length > 1) {
2561
+ parent.pathNames[parent.pathNames.length - 1] = parent.renameText;
2562
+ }
2548
2563
  if (parent.activeModule === 'navigationpane') {
2549
2564
  parent.pathId.pop();
2550
2565
  parent.itemData = [getValue(parent.pathId[parent.pathId.length - 1], parent.feParent)];
2551
- read(parent, renameEndParent, getParentPath(parent.path));
2566
+ read(parent, renameEndParent, getValue('filterPath', parent.renamedItem).replace(/\\/g, '/'));
2567
+ parent.itemData[0] = parent.renamedItem;
2568
+ read(parent, pathChanged, parent.path === '/' ? parent.path : getValue('filterPath', parent.renamedItem).replace(/\\/g, '/') + parent.renamedItem.name + '/');
2552
2569
  }
2553
2570
  else {
2554
2571
  parent.itemData = [getPathObject(parent)];
@@ -3563,7 +3580,8 @@ function onReSubmit(parent) {
3563
3580
  parent.dialogObj.hide();
3564
3581
  return;
3565
3582
  }
3566
- const newPath = (parent.activeModule === 'navigationpane') ? getParentPath(parent.path) : parent.path;
3583
+ const newPath = (parent.activeModule === 'navigationpane') ? getValue('filterPath', parent.itemData[0]).replace(/\\/g, '/') : parent.path;
3584
+ parent.renamedId = getValue('id', parent.itemData[0]);
3567
3585
  parent.renamedId = getValue('id', parent.itemData[0]);
3568
3586
  if (parent.isFile) {
3569
3587
  const oldExtension = (oIndex === -1) ? '' : parent.currentItemText.substr(oIndex);
@@ -3763,6 +3781,7 @@ class LargeIconsView {
3763
3781
  this.count = 0;
3764
3782
  this.isRendered = true;
3765
3783
  this.tapCount = 0;
3784
+ this.isSelectAllCalled = false;
3766
3785
  this.isPasteOperation = false;
3767
3786
  this.isInteracted = true;
3768
3787
  this.parent = parent;
@@ -4509,6 +4528,9 @@ class LargeIconsView {
4509
4528
  && (e.ctrlKey || target.classList.contains(CHECK))) {
4510
4529
  action = 'unselect';
4511
4530
  }
4531
+ if (e.ctrlKey && e.shiftKey) {
4532
+ this.isSelectAllCalled = true;
4533
+ }
4512
4534
  const fileSelectionArgs = this.triggerSelection(action, item);
4513
4535
  if (fileSelectionArgs.cancel !== true) {
4514
4536
  if ((!this.parent.allowMultiSelection || (!this.multiSelect && (e && !e.ctrlKey)))
@@ -4555,9 +4577,13 @@ class LargeIconsView {
4555
4577
  }
4556
4578
  }
4557
4579
  else {
4580
+ if (this.parent.selectedItems.length === this.itemList.length) {
4581
+ this.isSelectAllCalled = true;
4582
+ }
4558
4583
  this.clearSelection();
4559
4584
  }
4560
4585
  if (!isNullOrUndefined(item)) {
4586
+ this.isSelectAllCalled = false;
4561
4587
  this.updateType(item);
4562
4588
  }
4563
4589
  }
@@ -5120,9 +5146,17 @@ class LargeIconsView {
5120
5146
  }
5121
5147
  triggerSelection(action, item) {
5122
5148
  // eslint-disable-next-line
5123
- const data = this.getItemObject(item);
5149
+ const data = [];
5150
+ if (this.isSelectAllCalled) {
5151
+ for (let i = 0, len = this.itemList.length; i < len; i++) {
5152
+ data[i] = this.getItemObject(this.itemList[i]);
5153
+ }
5154
+ }
5155
+ else {
5156
+ data[0] = this.getItemObject(item);
5157
+ }
5124
5158
  const eventArgs = {
5125
- action: action, fileDetails: data, isInteracted: this.isInteraction, cancel: false, target: item
5159
+ action: action, fileDetails: data.length > 1 ? data : data[0], isInteracted: this.isInteraction, cancel: false, target: this.isSelectAllCalled ? null : item
5126
5160
  };
5127
5161
  this.parent.trigger('fileSelection', eventArgs);
5128
5162
  this.isInteraction = true;
@@ -5130,9 +5164,18 @@ class LargeIconsView {
5130
5164
  }
5131
5165
  triggerSelect(action, item) {
5132
5166
  // eslint-disable-next-line
5133
- const data = this.getItemObject(item);
5134
- this.parent.visitedData = data;
5135
- const eventArgs = { action: action, fileDetails: data, isInteracted: this.isInteracted };
5167
+ const data = [];
5168
+ if (this.isSelectAllCalled) {
5169
+ for (let i = 0, len = this.itemList.length; i < len; i++) {
5170
+ data[i] = this.getItemObject(this.itemList[i]);
5171
+ }
5172
+ this.isSelectAllCalled = false;
5173
+ }
5174
+ else {
5175
+ data[0] = this.getItemObject(item);
5176
+ }
5177
+ this.parent.visitedData = data.length > 1 ? data[data.length - 1] : data[0];
5178
+ const eventArgs = { action: action, fileDetails: data.length > 1 ? data : data[0], isInteracted: this.isInteracted };
5136
5179
  this.parent.trigger('fileSelect', eventArgs);
5137
5180
  this.isInteracted = true;
5138
5181
  }
@@ -7892,7 +7935,12 @@ class Toolbar$1 {
7892
7935
  items[itemCount].iconCss = this.parent.sortBy === 'size' ? TB_OPTION_DOT : '';
7893
7936
  }
7894
7937
  else if (items[itemCount].id === this.getPupupId('date')) {
7895
- items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? TB_OPTION_DOT : '';
7938
+ if (this.parent.sortBy === 'dateModified' || this.parent.sortBy === 'dateCreated') {
7939
+ items[itemCount].iconCss = this.parent.sortBy === this.parent.sortBy ? TB_OPTION_DOT : '';
7940
+ }
7941
+ else {
7942
+ items[itemCount].iconCss = this.parent.sortBy === '_fm_modified' ? TB_OPTION_DOT : '';
7943
+ }
7896
7944
  }
7897
7945
  else if (items[itemCount].id === this.getPupupId('ascending')) {
7898
7946
  items[itemCount].iconCss = this.parent.sortOrder === 'Ascending' ? TB_OPTION_TICK : '';
@@ -8425,6 +8473,7 @@ class NavigationPane {
8425
8473
  this.isRenameParent = false;
8426
8474
  this.isRightClick = false;
8427
8475
  this.isSameNodeClicked = false;
8476
+ this.isNodeExpandCalled = false;
8428
8477
  this.renameParent = null;
8429
8478
  // Specifies the previously selected nodes in the treeview control.
8430
8479
  this.previousSelected = null;
@@ -8595,7 +8644,7 @@ class NavigationPane {
8595
8644
  const selecEventArgs = { action: args.action, fileDetails: nodeData[0], isInteracted: args.isInteracted };
8596
8645
  this.parent.trigger('fileSelect', selecEventArgs);
8597
8646
  }
8598
- if (!this.isRightClick) {
8647
+ if (!this.isRightClick && args.node.getAttribute('data-uid') !== this.parent.pathId[this.parent.pathId.length - 1]) {
8599
8648
  const eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8600
8649
  this.parent.trigger('fileOpen', eventArgs);
8601
8650
  args.cancel = eventArgs.cancel;
@@ -8693,12 +8742,14 @@ class NavigationPane {
8693
8742
  this.parent.expandedId = this.expandNodeTarget;
8694
8743
  this.parent.itemData = this.getTreeData(getValue('id', args.nodeData));
8695
8744
  read(this.parent, nodeExpand, path);
8745
+ this.isNodeExpandCalled = true;
8696
8746
  }
8697
8747
  }
8698
8748
  /* istanbul ignore next */
8699
8749
  onNodeExpanded(args) {
8700
8750
  this.addChild(args.files, this.expandNodeTarget, false);
8701
8751
  this.parent.expandedId = null;
8752
+ this.isNodeExpandCalled = false;
8702
8753
  }
8703
8754
  onNodeClicked(args) {
8704
8755
  this.parent.activeModule = 'navigationpane';
@@ -8714,7 +8765,7 @@ class NavigationPane {
8714
8765
  const layout = (this.parent.view === 'LargeIcons') ? 'largeiconsview' : 'detailsview';
8715
8766
  this.parent.notify(modelChanged, { module: layout, newProp: { selectedItems: [] } });
8716
8767
  }
8717
- else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && !this.isNodeClickCalled) {
8768
+ else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && !this.isNodeClickCalled && !this.isNodeExpandCalled) {
8718
8769
  if (args.event.which === 3) {
8719
8770
  this.isRightClick = true;
8720
8771
  }