@syncfusion/ej2-filemanager 33.2.3 → 33.2.4

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.
@@ -5457,9 +5457,11 @@ var LargeIconsView = /** @__PURE__ @class */ (function () {
5457
5457
  }
5458
5458
  }
5459
5459
  }
5460
- var targetItem = this.getFocusedItem() || mappedItem || this.parent.visitedItem || this.getFirstItem();
5461
- if (targetItem) {
5462
- this.addFocus(targetItem);
5460
+ if (this.parent.activeModule !== 'navigationpane') {
5461
+ var targetItem = this.getFocusedItem() || mappedItem || this.parent.visitedItem || this.getFirstItem();
5462
+ if (targetItem) {
5463
+ this.addFocus(targetItem);
5464
+ }
5463
5465
  }
5464
5466
  }
5465
5467
  };
@@ -7225,10 +7227,16 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
7225
7227
  }
7226
7228
  else if (!isNullOrUndefined(closest(target, 'tr.e-row'))) {
7227
7229
  uid = this.targetElement.getAttribute('data-uid');
7228
- data = this.parent.detailsviewModule.gridObj.getRowObjectFromUID(uid).data;
7229
- if (isNullOrUndefined(this.targetElement.getAttribute('aria-selected'))) {
7230
- /* istanbul ignore next */
7231
- this.parent.detailsviewModule.gridObj.selectRows([parseInt(this.targetElement.getAttribute('aria-rowindex'), 10) - 1]);
7230
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7231
+ var gridObj = this.parent.detailsviewModule && this.parent.detailsviewModule.gridObj;
7232
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7233
+ var rowObj = (!isNullOrUndefined(uid) && !isNullOrUndefined(gridObj)) ? gridObj.getRowObjectFromUID(uid) : null;
7234
+ if (!isNullOrUndefined(rowObj)) {
7235
+ data = rowObj.data;
7236
+ if (isNullOrUndefined(this.targetElement.getAttribute('aria-selected'))) {
7237
+ /* istanbul ignore next */
7238
+ gridObj.selectRows([parseInt(this.targetElement.getAttribute('aria-rowindex'), 10) - 1]);
7239
+ }
7232
7240
  }
7233
7241
  selected = true;
7234
7242
  /* istanbul ignore next */
@@ -7424,10 +7432,12 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
7424
7432
  this.menuType = 'layout';
7425
7433
  this.contextMenu.items = this.getItemData(this.parent.contextMenuSettings.layout.map(function (item) { return item.trim(); }));
7426
7434
  this.contextMenu.dataBind();
7427
- if (!this.parent.allowMultiSelection || ((this.parent.view === 'LargeIcons' &&
7428
- (closest(target, '#' + this.parent.element.id + LARGEICON_ID).getElementsByClassName(EMPTY).length !== 0))
7429
- || (this.parent.view === 'Details' &&
7430
- (closest(target, '#' + this.parent.element.id + GRID_ID).getElementsByClassName(EMPTY).length !== 0)))) {
7435
+ var largeIconsEle = closest(target, '#' + this.parent.element.id + LARGEICON_ID);
7436
+ var detailsViewEle = closest(target, '#' + this.parent.element.id + GRID_ID);
7437
+ if (!this.parent.allowMultiSelection || ((this.parent.view === 'LargeIcons' && !isNullOrUndefined(largeIconsEle) &&
7438
+ (largeIconsEle.getElementsByClassName(EMPTY).length !== 0))
7439
+ || (this.parent.view === 'Details' && !isNullOrUndefined(detailsViewEle) &&
7440
+ (detailsViewEle.getElementsByClassName(EMPTY).length !== 0)))) {
7431
7441
  this.disabledItems.push('SelectAll');
7432
7442
  }
7433
7443
  else {
@@ -8657,41 +8667,74 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
8657
8667
  return;
8658
8668
  }
8659
8669
  }
8670
+ var contentElem = this.viewElem.firstChild;
8671
+ var isLargeIcons = this.viewElem.classList.contains('e-large-icons');
8672
+ if (isLargeIcons) {
8673
+ this.dragContainer = (contentElem && contentElem.tagName === 'UL') ? contentElem : this.viewElem;
8674
+ }
8675
+ else {
8676
+ this.dragContainer = this.viewElem.firstChild;
8677
+ }
8678
+ if (!this.dragContainer) {
8679
+ return;
8680
+ }
8660
8681
  event.preventDefault();
8661
- this.dragX = event.pageX;
8662
- this.dragY = event.pageY;
8682
+ this.lastDragEvent = event;
8683
+ var ulRect = this.dragContainer.getBoundingClientRect();
8684
+ this.dragX = event.clientX - ulRect.left - this.dragContainer.clientLeft + this.dragContainer.scrollLeft;
8685
+ this.dragY = event.clientY - ulRect.top - this.dragContainer.clientTop + this.dragContainer.scrollTop;
8663
8686
  if (!this.dragSelectElement) {
8664
8687
  this.dragSelectElement = createElement('div', {
8665
8688
  id: this.element.id + '_drag',
8666
- className: 'e-filemanager e-drag-select',
8667
- styles: 'left: ' + this.dragX + 'px;top: ' + this.dragY + 'px;'
8689
+ className: 'e-filemanager e-drag-select'
8690
+ });
8691
+ setStyleAttribute(this.dragSelectElement, {
8692
+ position: 'absolute',
8693
+ left: this.dragX + 'px',
8694
+ top: this.dragY + 'px',
8695
+ width: '0px',
8696
+ height: '0px',
8697
+ pointerEvents: 'none'
8668
8698
  });
8669
- document.body.append(this.dragSelectElement);
8699
+ this.dragContainer.appendChild(this.dragSelectElement);
8700
+ this.dragContainer.style.position = 'relative';
8670
8701
  }
8702
+ EventHandler.add(this.dragContainer, 'scroll', this.onDragScroll, this);
8671
8703
  EventHandler.add(document, 'mouseup', this.onDragStop, this);
8672
- EventHandler.add(this.viewElem, 'mousemove', this.onDrag, this);
8704
+ EventHandler.add(this.dragContainer, 'mousemove', this.onDrag, this);
8673
8705
  EventHandler.add(this.dragSelectElement, 'mousemove', this.onDrag, this);
8674
8706
  }
8675
8707
  };
8676
8708
  FileManager.prototype.onDrag = function (event) {
8709
+ this.lastDragEvent = event;
8677
8710
  event.stopPropagation();
8678
- if (this.dragSelectElement) {
8679
- var diffX = event.pageX - this.dragX;
8680
- var diffY = event.pageY - this.dragY;
8711
+ if (this.dragSelectElement && this.dragContainer) {
8712
+ var ulRect = this.dragContainer.getBoundingClientRect();
8713
+ var currentX = event.clientX - ulRect.left - this.dragContainer.clientLeft + this.dragContainer.scrollLeft;
8714
+ var currentY = event.clientY - ulRect.top - this.dragContainer.clientTop + this.dragContainer.scrollTop;
8681
8715
  setStyleAttribute(this.dragSelectElement, {
8682
- 'left': diffX < 0 ? this.dragX + diffX + 'px' : this.dragX + 'px', 'top': diffY < 0 ? this.dragY + diffY + 'px' : this.dragY + 'px',
8683
- 'height': Math.abs(diffY) + 'px', 'width': Math.abs(diffX) + 'px'
8716
+ left: Math.min(this.dragX, currentX) + 'px',
8717
+ top: Math.min(this.dragY, currentY) + 'px',
8718
+ height: Math.abs(currentY - this.dragY) + 'px',
8719
+ width: Math.abs(currentX - this.dragX) + 'px'
8684
8720
  });
8685
8721
  this.selectItems();
8686
8722
  }
8687
- else {
8688
- EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
8723
+ else if (this.dragContainer) {
8724
+ EventHandler.remove(this.dragContainer, 'mousemove', this.onDrag);
8689
8725
  }
8690
8726
  };
8727
+ FileManager.prototype.onDragScroll = function () {
8728
+ if (!this.dragSelectElement || !this.lastDragEvent) {
8729
+ return;
8730
+ }
8731
+ this.onDrag(this.lastDragEvent);
8732
+ };
8691
8733
  FileManager.prototype.onDragStop = function () {
8692
- if (this.viewElem) {
8693
- EventHandler.remove(document, 'mouseup', this.onDragStop);
8694
- EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
8734
+ EventHandler.remove(document, 'mouseup', this.onDragStop);
8735
+ if (this.dragContainer) {
8736
+ EventHandler.remove(this.dragContainer, 'mousemove', this.onDrag);
8737
+ EventHandler.remove(this.dragContainer, 'scroll', this.onDragScroll);
8695
8738
  }
8696
8739
  if (this.dragSelectElement) {
8697
8740
  EventHandler.remove(this.dragSelectElement, 'mousemove', this.onDrag);
@@ -8702,6 +8745,7 @@ var FileManager = /** @__PURE__ @class */ (function (_super) {
8702
8745
  detach(this.dragSelectElement);
8703
8746
  this.dragSelectElement = null;
8704
8747
  }
8748
+ this.dragContainer = null;
8705
8749
  };
8706
8750
  FileManager.prototype.selectItems = function () {
8707
8751
  var dragRect = this.dragSelectElement.getBoundingClientRect();