@syncfusion/ej2-filemanager 19.4.38 → 19.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.
@@ -1,4 +1,4 @@
1
- import { Ajax, Browser, ChildProperty, Complex, Component, Draggable, Event, EventHandler, Internationalization, KeyboardEvents, L10n, NotifyPropertyChanges, Property, Touch, addClass, closest, createElement, detach, extend, formatUnit, getValue, isNullOrUndefined, isVisible, matches, remove, removeClass, select, selectAll, setStyleAttribute, setValue } from '@syncfusion/ej2-base';
1
+ import { Ajax, Browser, ChildProperty, Complex, Component, Draggable, Event, EventHandler, Internationalization, KeyboardEvents, L10n, NotifyPropertyChanges, Property, Touch, addClass, closest, createElement, detach, extend, formatUnit, getUniqueID, getValue, isNullOrUndefined, isVisible, matches, remove, removeClass, select, selectAll, setStyleAttribute, setValue } from '@syncfusion/ej2-base';
2
2
  import { Splitter } from '@syncfusion/ej2-layouts';
3
3
  import { Dialog, createSpinner, hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
4
4
  import { DataManager, Query } from '@syncfusion/ej2-data';
@@ -1019,7 +1019,13 @@ function searchWordHandler(parent, value, isLayoutChange) {
1019
1019
  }
1020
1020
  else {
1021
1021
  if (!parent.isFiltered) {
1022
- read(parent, isLayoutChange ? layoutChange : search, parent.path);
1022
+ if (parent.isSortByClicked) {
1023
+ parent.notify(layoutChange, { files: parent.largeiconsviewModule.items });
1024
+ parent.isSortByClicked = false;
1025
+ }
1026
+ else {
1027
+ read(parent, isLayoutChange ? layoutChange : search, parent.path);
1028
+ }
1023
1029
  }
1024
1030
  else {
1025
1031
  filter(parent, layoutChange);
@@ -1200,7 +1206,7 @@ function fileType(file) {
1200
1206
  function getImageUrl(parent, item) {
1201
1207
  var baseUrl = parent.ajaxSettings.getImageUrl ? parent.ajaxSettings.getImageUrl : parent.ajaxSettings.url;
1202
1208
  var imgUrl;
1203
- var fileName = getValue('name', item);
1209
+ var fileName = encodeURIComponent(getValue('name', item));
1204
1210
  var fPath = getValue('filterPath', item);
1205
1211
  if (parent.hasId) {
1206
1212
  var imgId = getValue('id', item);
@@ -1430,6 +1436,7 @@ function getCssClass(parent, css) {
1430
1436
  */
1431
1437
  function sortbyClickHandler(parent, args) {
1432
1438
  var tick;
1439
+ parent.isSortByClicked = true;
1433
1440
  if (args.item.id.indexOf('ascending') !== -1 || args.item.id.indexOf('descending') !== -1 || args.item.id.indexOf('none') !== -1) {
1434
1441
  tick = true;
1435
1442
  }
@@ -5856,14 +5863,11 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
5856
5863
  var data;
5857
5864
  var treeFolder = false;
5858
5865
  var target = args.event.target;
5859
- this.menuTarget = target;
5866
+ this.menuTarget = this.targetNodeElement = target;
5860
5867
  this.currentElement = args.element;
5861
5868
  if (target.classList.contains('e-spinner-pane')) {
5862
5869
  target = this.parent.navigationpaneModule.activeNode.getElementsByClassName(FULLROW)[0];
5863
- this.menuTarget = target;
5864
- }
5865
- if (target.classList.contains(FULLROW)) {
5866
- this.parent.selectedItems.length = 0;
5870
+ this.menuTarget = this.targetNodeElement = target;
5867
5871
  }
5868
5872
  this.targetElement = this.parent.view === 'Details' ? closest(target, 'tr.e-row') : target;
5869
5873
  var view = this.getTargetView(target);
@@ -5974,7 +5978,7 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
5974
5978
  _this.enableItems(_this.disabledItems, false, true);
5975
5979
  args.cancel = menuOpenArgs.cancel;
5976
5980
  if (menuOpenArgs.cancel) {
5977
- _this.menuTarget = _this.currentElement = null;
5981
+ _this.menuTarget = _this.targetNodeElement = _this.currentElement = null;
5978
5982
  }
5979
5983
  });
5980
5984
  };
@@ -6094,7 +6098,12 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6094
6098
  }
6095
6099
  else {
6096
6100
  this.parent.notify(selectedData, {});
6097
- details = this.parent.itemData;
6101
+ if (this.parent.activeModule === 'navigationpane' && itemText === 'open') {
6102
+ details = [this.menuItemData];
6103
+ }
6104
+ else {
6105
+ details = this.parent.itemData;
6106
+ }
6098
6107
  }
6099
6108
  var eventArgs = {
6100
6109
  cancel: false,
@@ -6171,6 +6180,9 @@ var ContextMenu$2 = /** @__PURE__ @class */ (function () {
6171
6180
  if (_this.parent.visitedItem) {
6172
6181
  _this.parent.notify(openInit, { target: _this.parent.visitedItem });
6173
6182
  }
6183
+ else if (_this.parent.activeModule === 'navigationpane') {
6184
+ _this.parent.navigationpaneModule.openFileOnContextMenuClick(closest(_this.targetNodeElement, 'li'));
6185
+ }
6174
6186
  break;
6175
6187
  case 'details':
6176
6188
  _this.parent.notify(detailsInit, {});
@@ -6543,6 +6555,8 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
6543
6555
  _this.folderPath = '';
6544
6556
  _this.isSameAction = false;
6545
6557
  _this.isFiltered = false;
6558
+ // Specifies whether the sort by option is clicked or not.
6559
+ _this.isSortByClicked = false;
6546
6560
  _this.enablePaste = false;
6547
6561
  _this.persistData = false;
6548
6562
  _this.retryArgs = [];
@@ -6586,6 +6600,9 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
6586
6600
  * @returns {void}
6587
6601
  */
6588
6602
  FileManager.prototype.preRender = function () {
6603
+ if (isNullOrUndefined(this.element.id) || this.element.id === '') {
6604
+ this.element.setAttribute('id', getUniqueID('filemanager'));
6605
+ }
6589
6606
  this.ensurePath();
6590
6607
  this.feParent = [];
6591
6608
  this.feFiles = [];
@@ -8232,6 +8249,12 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8232
8249
  this.isRenameParent = false;
8233
8250
  this.isRightClick = false;
8234
8251
  this.renameParent = null;
8252
+ // Specifies the previously selected nodes in the treeview control.
8253
+ this.previousSelected = null;
8254
+ // Specifies whether the nodeClicked event of the treeview control is triggered or not.
8255
+ this.isNodeClickCalled = false;
8256
+ // Specifies whether to restrict node selection in the treeview control.
8257
+ this.restrictSelecting = false;
8235
8258
  this.parent = parent;
8236
8259
  this.addEventListener();
8237
8260
  this.keyConfigs = {
@@ -8271,6 +8294,7 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8271
8294
  hasChildren: 'hasChild', iconCss: '_fm_icon', htmlAttributes: '_fm_htmlAttr', tooltip: 'name'
8272
8295
  },
8273
8296
  enableHtmlSanitizer: this.parent.enableHtmlSanitizer,
8297
+ nodeSelecting: this.onNodeSelecting.bind(this),
8274
8298
  nodeSelected: this.onNodeSelected.bind(this),
8275
8299
  nodeExpanding: this.onNodeExpand.bind(this),
8276
8300
  nodeClicked: this.onNodeClicked.bind(this),
@@ -8376,6 +8400,44 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8376
8400
  this.treeObj.addNodes(directories, target, null, prevent);
8377
8401
  }
8378
8402
  };
8403
+ // Node Selecting event handler
8404
+ NavigationPane.prototype.onNodeSelecting = function (args) {
8405
+ if (!args.isInteracted && !this.isRightClick && !this.isPathDragged && !this.isRenameParent || this.restrictSelecting) {
8406
+ this.restrictSelecting = false;
8407
+ this.isNodeClickCalled = false;
8408
+ return;
8409
+ }
8410
+ if (!this.renameParent) {
8411
+ this.parent.activeModule = 'navigationpane';
8412
+ // eslint-disable-next-line
8413
+ var nodeData = this.getTreeData(getValue('id', args.nodeData));
8414
+ var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8415
+ this.parent.trigger('fileOpen', eventArgs);
8416
+ args.cancel = eventArgs.cancel;
8417
+ if (args.cancel) {
8418
+ this.restrictSelecting = this.isNodeClickCalled ? this.previousSelected[0] != args.node.getAttribute('data-uid') : false;
8419
+ this.treeObj.selectedNodes = this.isNodeClickCalled ? this.previousSelected : this.treeObj.selectedNodes;
8420
+ this.previousSelected = this.treeObj.selectedNodes;
8421
+ if (!isNullOrUndefined(this.parent) && !isNullOrUndefined(this.parent.contextmenuModule)) {
8422
+ this.parent.contextmenuModule.contextMenu.enableItems(['Open'], true);
8423
+ }
8424
+ }
8425
+ }
8426
+ };
8427
+ // Opens the folder while clicking open context menu item in the treeview.
8428
+ NavigationPane.prototype.openFileOnContextMenuClick = function (node) {
8429
+ var data = this.treeObj.getTreeData(node);
8430
+ // eslint-disable-next-line
8431
+ this.parent.selectedItems = [];
8432
+ this.parent.itemData = data;
8433
+ this.activeNode = node;
8434
+ this.parent.activeModule = 'navigationpane';
8435
+ updatePath(node, this.parent.itemData[0], this.parent);
8436
+ read(this.parent, this.isPathDragged ? pasteEnd : pathChanged, this.parent.path);
8437
+ this.parent.visitedItem = node;
8438
+ this.isPathDragged = this.isRenameParent = this.isRightClick = false;
8439
+ this.treeObj.selectedNodes = [node.getAttribute('data-uid')];
8440
+ };
8379
8441
  NavigationPane.prototype.onNodeSelected = function (args) {
8380
8442
  if (this.parent.breadcrumbbarModule && this.parent.breadcrumbbarModule.searchObj && !this.renameParent) {
8381
8443
  this.parent.breadcrumbbarModule.searchObj.element.value = '';
@@ -8389,11 +8451,6 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8389
8451
  this.parent.activeModule = 'navigationpane';
8390
8452
  // eslint-disable-next-line
8391
8453
  var nodeData = this.getTreeData(getValue('id', args.nodeData));
8392
- if (!this.renameParent) {
8393
- var eventArgs = { cancel: false, fileDetails: nodeData[0], module: 'NavigationPane' };
8394
- delete eventArgs.cancel;
8395
- this.parent.trigger('fileOpen', eventArgs);
8396
- }
8397
8454
  this.parent.selectedItems = [];
8398
8455
  this.parent.itemData = nodeData;
8399
8456
  updatePath(args.node, this.parent.itemData[0], this.parent);
@@ -8435,9 +8492,11 @@ var NavigationPane = /** @__PURE__ @class */ (function () {
8435
8492
  };
8436
8493
  NavigationPane.prototype.onNodeClicked = function (args) {
8437
8494
  this.parent.activeModule = 'navigationpane';
8495
+ this.previousSelected = this.treeObj.selectedNodes;
8438
8496
  this.activeNode = args.node;
8439
8497
  if ((args.event.which === 3) && (args.node.getAttribute('data-uid') !== this.treeObj.selectedNodes[0])) {
8440
8498
  this.isRightClick = true;
8499
+ this.isNodeClickCalled = true;
8441
8500
  this.treeObj.selectedNodes = [args.node.getAttribute('data-uid')];
8442
8501
  }
8443
8502
  else if (args.node.getAttribute('data-uid') === this.treeObj.selectedNodes[0] && this.parent.selectedItems.length !== 0) {