@syncfusion/ej2-filemanager 33.2.3 → 33.2.6

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.
@@ -5299,9 +5299,11 @@ class LargeIconsView {
5299
5299
  }
5300
5300
  }
5301
5301
  }
5302
- const targetItem = this.getFocusedItem() || mappedItem || this.parent.visitedItem || this.getFirstItem();
5303
- if (targetItem) {
5304
- this.addFocus(targetItem);
5302
+ if (this.parent.activeModule !== 'navigationpane') {
5303
+ const targetItem = this.getFocusedItem() || mappedItem || this.parent.visitedItem || this.getFirstItem();
5304
+ if (targetItem) {
5305
+ this.addFocus(targetItem);
5306
+ }
5305
5307
  }
5306
5308
  }
5307
5309
  }
@@ -5538,13 +5540,15 @@ class LargeIconsView {
5538
5540
  }
5539
5541
  }
5540
5542
  destroy() {
5541
- if (this.parent.isDestroyed) {
5542
- return;
5543
- }
5544
5543
  this.removeEventListener();
5545
5544
  if (this.listObj) {
5546
5545
  this.unWireEvents();
5547
5546
  }
5547
+ if (this.itemList) {
5548
+ this.itemList.forEach((el) => {
5549
+ el.ondragstart = null;
5550
+ });
5551
+ }
5548
5552
  this.startItem = null;
5549
5553
  this.listElements = null;
5550
5554
  }
@@ -6526,10 +6530,14 @@ class BreadCrumbBar {
6526
6530
  this.addressBarLink = '';
6527
6531
  this.searchTimer = null;
6528
6532
  this.searchWrapWidth = null;
6533
+ this.searchIcon = null;
6534
+ this.searchSibling = null;
6529
6535
  this.parent = parent;
6530
6536
  this.keyConfigs = {
6531
6537
  enter: 'enter'
6532
6538
  };
6539
+ this.boundSearchChangeHandler = this.searchChangeHandler.bind(this);
6540
+ this.boundOnKeyUp = this.onKeyUp.bind(this);
6533
6541
  this.render();
6534
6542
  }
6535
6543
  onPropertyChanged(e) {
@@ -6553,8 +6561,15 @@ class BreadCrumbBar {
6553
6561
  }
6554
6562
  }
6555
6563
  render() {
6564
+ this.setBreadcrumbNavAttributes();
6556
6565
  this.addEventListener();
6557
6566
  }
6567
+ setBreadcrumbNavAttributes() {
6568
+ const navElement = this.parent && this.parent.breadCrumbNavElement;
6569
+ if (navElement) {
6570
+ navElement.setAttribute('aria-label', 'Breadcrumb');
6571
+ }
6572
+ }
6558
6573
  onPathChange() {
6559
6574
  const pathNames = this.parent.pathNames;
6560
6575
  const paths = this.parent.path.split('/');
@@ -6575,7 +6590,6 @@ class BreadCrumbBar {
6575
6590
  addressbarLI.appendChild(icon);
6576
6591
  }
6577
6592
  addressbarLI.setAttribute('tabindex', '0');
6578
- addressbarLI.setAttribute('role', 'link');
6579
6593
  const pathLabel = pathNames.slice(0, i + 1).join(' / ');
6580
6594
  addressbarLI.setAttribute('aria-label', pathLabel);
6581
6595
  if (pathNamesLen - i === 1) {
@@ -6583,24 +6597,24 @@ class BreadCrumbBar {
6583
6597
  }
6584
6598
  id = '';
6585
6599
  addressATag = createElement('a', { className: LIST_TEXT });
6586
- addressATag.setAttribute('role', 'presentation');
6600
+ addressATag.setAttribute('role', 'link');
6587
6601
  addressATag.innerText = pathNames[i];
6588
6602
  addressbarLI.appendChild(addressATag);
6589
6603
  addressbarUL.appendChild(addressbarLI);
6590
6604
  }
6591
- const ulElement = this.parent.breadCrumbBarNavigation.querySelector('.e-addressbar-ul');
6605
+ const ulElement = this.parent.breadCrumbNavElement.querySelector('.e-addressbar-ul');
6592
6606
  if (!isNullOrUndefined(ulElement)) {
6593
6607
  if (!isNullOrUndefined(this.subMenuObj)) {
6594
6608
  this.subMenuObj.destroy();
6595
6609
  }
6596
6610
  remove(ulElement);
6597
6611
  }
6598
- const searchWrap = this.parent.breadCrumbBarNavigation.querySelector('.e-search-wrap');
6612
+ const searchWrap = this.parent.breadCrumbNavElement.querySelector('.e-search-wrap');
6599
6613
  if (!searchWrap) {
6600
- this.parent.breadCrumbBarNavigation.insertBefore(addressbarUL, searchWrap);
6614
+ this.parent.breadCrumbNavElement.insertBefore(addressbarUL, searchWrap);
6601
6615
  }
6602
6616
  else {
6603
- this.parent.breadCrumbBarNavigation.appendChild(addressbarUL);
6617
+ this.parent.breadCrumbNavElement.appendChild(addressbarUL);
6604
6618
  }
6605
6619
  this.updateBreadCrumbBar(addressbarUL);
6606
6620
  }
@@ -6608,7 +6622,7 @@ class BreadCrumbBar {
6608
6622
  /* istanbul ignore next */
6609
6623
  updateBreadCrumbBar(addresBarUL) {
6610
6624
  const liElements = addresBarUL.querySelectorAll('li');
6611
- const ulElement = this.parent.breadCrumbBarNavigation.querySelector('.e-addressbar-ul');
6625
+ const ulElement = this.parent.breadCrumbNavElement.querySelector('.e-addressbar-ul');
6612
6626
  const style = window.getComputedStyle(ulElement, null);
6613
6627
  const pRight = parseFloat(style.getPropertyValue('padding-right'));
6614
6628
  const pLeft = parseFloat(style.getPropertyValue('padding-left'));
@@ -6630,12 +6644,12 @@ class BreadCrumbBar {
6630
6644
  const searchInput = createElement('input', { id: id,
6631
6645
  attrs: { autocomplete: 'off', 'aria-label': getLocaleText(this.parent, 'Search') } });
6632
6646
  searchContainer.appendChild(searchInput);
6633
- const searchEle = this.parent.breadCrumbBarNavigation.querySelector('.e-search-wrap .e-input');
6647
+ const searchEle = this.parent.breadCrumbNavElement.querySelector('.e-search-wrap .e-input');
6634
6648
  if (isNullOrUndefined(searchEle)) {
6635
- this.parent.breadCrumbBarNavigation.appendChild(searchContainer);
6636
- const span = createElement('span', { className: 'e-icons e-fe-search' });
6637
- EventHandler.add(span, 'click', this.onShowInput, this);
6638
- searchInput.parentElement.insertBefore(span, searchInput);
6649
+ this.parent.breadCrumbNavElement.appendChild(searchContainer);
6650
+ this.searchIcon = createElement('span', { className: 'e-icons e-fe-search' });
6651
+ EventHandler.add(this.searchIcon, 'click', this.onShowInput, this);
6652
+ searchInput.parentElement.insertBefore(this.searchIcon, searchInput);
6639
6653
  this.searchObj = new TextBox({
6640
6654
  value: '',
6641
6655
  showClearButton: true,
@@ -6645,11 +6659,11 @@ class BreadCrumbBar {
6645
6659
  });
6646
6660
  this.searchObj.appendTo('#' + this.parent.element.id + SEARCH_ID);
6647
6661
  this.searchEventBind(this.parent.searchSettings.allowSearchOnTyping);
6648
- const search = this.searchObj.element.nextElementSibling;
6649
- EventHandler.add(search, 'mousedown', this.searchChangeHandler.bind(this), this);
6650
- EventHandler.add(this.searchObj.element, 'keyup', this.onKeyUp.bind(this), this);
6662
+ this.searchSibling = this.searchObj.element.nextElementSibling;
6663
+ EventHandler.add(this.searchSibling, 'mousedown', this.boundSearchChangeHandler, this);
6664
+ EventHandler.add(this.searchObj.element, 'keyup', this.boundOnKeyUp, this);
6651
6665
  }
6652
- const searchWrap = this.parent.breadCrumbBarNavigation.querySelector('.e-search-wrap');
6666
+ const searchWrap = this.parent.breadCrumbNavElement.querySelector('.e-search-wrap');
6653
6667
  breadCrumbBarWidth = breadCrumbBarWidth - (this.searchWrapWidth ? this.searchWrapWidth : searchWrap.offsetWidth);
6654
6668
  if (liElementsWidth > breadCrumbBarWidth) {
6655
6669
  let i = liElements.length;
@@ -6687,10 +6701,10 @@ class BreadCrumbBar {
6687
6701
  break;
6688
6702
  }
6689
6703
  }
6690
- this.parent.breadCrumbBarNavigation.insertBefore(addressbarUL, searchWrap);
6704
+ this.parent.breadCrumbNavElement.insertBefore(addressbarUL, searchWrap);
6691
6705
  }
6692
6706
  else {
6693
- this.parent.breadCrumbBarNavigation.insertBefore(addresBarUL, searchWrap);
6707
+ this.parent.breadCrumbNavElement.insertBefore(addresBarUL, searchWrap);
6694
6708
  }
6695
6709
  }
6696
6710
  /* istanbul ignore next */
@@ -6768,7 +6782,7 @@ class BreadCrumbBar {
6768
6782
  this.searchWrapWidth = null;
6769
6783
  }
6770
6784
  else {
6771
- const searchWrap = this.parent.breadCrumbBarNavigation.querySelector('.e-search-wrap');
6785
+ const searchWrap = this.parent.breadCrumbNavElement.querySelector('.e-search-wrap');
6772
6786
  this.searchWrapWidth = searchWrap.offsetWidth;
6773
6787
  addClass([this.parent.element], FILTER);
6774
6788
  this.searchObj.element.focus();
@@ -6869,6 +6883,18 @@ class BreadCrumbBar {
6869
6883
  this.parent.off(dropInit, this.onDropInit);
6870
6884
  this.parent.off(layoutRefresh, this.onResize);
6871
6885
  this.parent.off(dropPath, this.onPathChange);
6886
+ if (this.parent.breadCrumbBarNavigation) {
6887
+ EventHandler.remove(this.parent.breadCrumbBarNavigation, 'click', this.addressPathClickHandler);
6888
+ }
6889
+ if (this.searchIcon) {
6890
+ EventHandler.remove(this.searchIcon, 'click', this.onShowInput);
6891
+ }
6892
+ if (this.searchSibling) {
6893
+ EventHandler.remove(this.searchSibling, 'mousedown', this.boundSearchChangeHandler);
6894
+ }
6895
+ if (this.searchObj && this.searchObj.element) {
6896
+ EventHandler.remove(this.searchObj.element, 'keyup', this.boundOnKeyUp);
6897
+ }
6872
6898
  }
6873
6899
  /* istanbul ignore next */
6874
6900
  onDropInit(args) {
@@ -7056,10 +7082,16 @@ class ContextMenu {
7056
7082
  }
7057
7083
  else if (!isNullOrUndefined(closest(target, 'tr.e-row'))) {
7058
7084
  uid = this.targetElement.getAttribute('data-uid');
7059
- data = this.parent.detailsviewModule.gridObj.getRowObjectFromUID(uid).data;
7060
- if (isNullOrUndefined(this.targetElement.getAttribute('aria-selected'))) {
7061
- /* istanbul ignore next */
7062
- this.parent.detailsviewModule.gridObj.selectRows([parseInt(this.targetElement.getAttribute('aria-rowindex'), 10) - 1]);
7085
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7086
+ const gridObj = this.parent.detailsviewModule && this.parent.detailsviewModule.gridObj;
7087
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7088
+ const rowObj = (!isNullOrUndefined(uid) && !isNullOrUndefined(gridObj)) ? gridObj.getRowObjectFromUID(uid) : null;
7089
+ if (!isNullOrUndefined(rowObj)) {
7090
+ data = rowObj.data;
7091
+ if (isNullOrUndefined(this.targetElement.getAttribute('aria-selected'))) {
7092
+ /* istanbul ignore next */
7093
+ gridObj.selectRows([parseInt(this.targetElement.getAttribute('aria-rowindex'), 10) - 1]);
7094
+ }
7063
7095
  }
7064
7096
  selected = true;
7065
7097
  /* istanbul ignore next */
@@ -7255,10 +7287,12 @@ class ContextMenu {
7255
7287
  this.menuType = 'layout';
7256
7288
  this.contextMenu.items = this.getItemData(this.parent.contextMenuSettings.layout.map((item) => item.trim()));
7257
7289
  this.contextMenu.dataBind();
7258
- if (!this.parent.allowMultiSelection || ((this.parent.view === 'LargeIcons' &&
7259
- (closest(target, '#' + this.parent.element.id + LARGEICON_ID).getElementsByClassName(EMPTY).length !== 0))
7260
- || (this.parent.view === 'Details' &&
7261
- (closest(target, '#' + this.parent.element.id + GRID_ID).getElementsByClassName(EMPTY).length !== 0)))) {
7290
+ const largeIconsEle = closest(target, '#' + this.parent.element.id + LARGEICON_ID);
7291
+ const detailsViewEle = closest(target, '#' + this.parent.element.id + GRID_ID);
7292
+ if (!this.parent.allowMultiSelection || ((this.parent.view === 'LargeIcons' && !isNullOrUndefined(largeIconsEle) &&
7293
+ (largeIconsEle.getElementsByClassName(EMPTY).length !== 0))
7294
+ || (this.parent.view === 'Details' && !isNullOrUndefined(detailsViewEle) &&
7295
+ (detailsViewEle.getElementsByClassName(EMPTY).length !== 0)))) {
7262
7296
  this.disabledItems.push('SelectAll');
7263
7297
  }
7264
7298
  else {
@@ -7971,6 +8005,8 @@ let FileManager = FileManager_1 = class FileManager extends Component {
7971
8005
  id: this.element.id + BREADCRUMBBAR_ID,
7972
8006
  className: BREADCRUMBS
7973
8007
  });
8008
+ this.breadCrumbNavElement = this.createElement('nav');
8009
+ this.breadCrumbBarNavigation.appendChild(this.breadCrumbNavElement);
7974
8010
  contentWrap.appendChild(this.breadCrumbBarNavigation);
7975
8011
  const gridWrap = this.createElement('div', {
7976
8012
  id: this.element.id + GRID_ID
@@ -8470,41 +8506,74 @@ let FileManager = FileManager_1 = class FileManager extends Component {
8470
8506
  return;
8471
8507
  }
8472
8508
  }
8509
+ const contentElem = this.viewElem.firstChild;
8510
+ const isLargeIcons = this.viewElem.classList.contains('e-large-icons');
8511
+ if (isLargeIcons) {
8512
+ this.dragContainer = (contentElem && contentElem.tagName === 'UL') ? contentElem : this.viewElem;
8513
+ }
8514
+ else {
8515
+ this.dragContainer = this.viewElem.firstChild;
8516
+ }
8517
+ if (!this.dragContainer) {
8518
+ return;
8519
+ }
8473
8520
  event.preventDefault();
8474
- this.dragX = event.pageX;
8475
- this.dragY = event.pageY;
8521
+ this.lastDragEvent = event;
8522
+ const ulRect = this.dragContainer.getBoundingClientRect();
8523
+ this.dragX = event.clientX - ulRect.left - this.dragContainer.clientLeft + this.dragContainer.scrollLeft;
8524
+ this.dragY = event.clientY - ulRect.top - this.dragContainer.clientTop + this.dragContainer.scrollTop;
8476
8525
  if (!this.dragSelectElement) {
8477
8526
  this.dragSelectElement = createElement('div', {
8478
8527
  id: this.element.id + '_drag',
8479
- className: 'e-filemanager e-drag-select',
8480
- styles: 'left: ' + this.dragX + 'px;top: ' + this.dragY + 'px;'
8528
+ className: 'e-filemanager e-drag-select'
8481
8529
  });
8482
- document.body.append(this.dragSelectElement);
8530
+ setStyleAttribute(this.dragSelectElement, {
8531
+ position: 'absolute',
8532
+ left: this.dragX + 'px',
8533
+ top: this.dragY + 'px',
8534
+ width: '0px',
8535
+ height: '0px',
8536
+ pointerEvents: 'none'
8537
+ });
8538
+ this.dragContainer.appendChild(this.dragSelectElement);
8539
+ this.dragContainer.style.position = 'relative';
8483
8540
  }
8541
+ EventHandler.add(this.dragContainer, 'scroll', this.onDragScroll, this);
8484
8542
  EventHandler.add(document, 'mouseup', this.onDragStop, this);
8485
- EventHandler.add(this.viewElem, 'mousemove', this.onDrag, this);
8543
+ EventHandler.add(this.dragContainer, 'mousemove', this.onDrag, this);
8486
8544
  EventHandler.add(this.dragSelectElement, 'mousemove', this.onDrag, this);
8487
8545
  }
8488
8546
  }
8489
8547
  onDrag(event) {
8548
+ this.lastDragEvent = event;
8490
8549
  event.stopPropagation();
8491
- if (this.dragSelectElement) {
8492
- const diffX = event.pageX - this.dragX;
8493
- const diffY = event.pageY - this.dragY;
8550
+ if (this.dragSelectElement && this.dragContainer) {
8551
+ const ulRect = this.dragContainer.getBoundingClientRect();
8552
+ const currentX = event.clientX - ulRect.left - this.dragContainer.clientLeft + this.dragContainer.scrollLeft;
8553
+ const currentY = event.clientY - ulRect.top - this.dragContainer.clientTop + this.dragContainer.scrollTop;
8494
8554
  setStyleAttribute(this.dragSelectElement, {
8495
- 'left': diffX < 0 ? this.dragX + diffX + 'px' : this.dragX + 'px', 'top': diffY < 0 ? this.dragY + diffY + 'px' : this.dragY + 'px',
8496
- 'height': Math.abs(diffY) + 'px', 'width': Math.abs(diffX) + 'px'
8555
+ left: Math.min(this.dragX, currentX) + 'px',
8556
+ top: Math.min(this.dragY, currentY) + 'px',
8557
+ height: Math.abs(currentY - this.dragY) + 'px',
8558
+ width: Math.abs(currentX - this.dragX) + 'px'
8497
8559
  });
8498
8560
  this.selectItems();
8499
8561
  }
8500
- else {
8501
- EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
8562
+ else if (this.dragContainer) {
8563
+ EventHandler.remove(this.dragContainer, 'mousemove', this.onDrag);
8502
8564
  }
8503
8565
  }
8566
+ onDragScroll() {
8567
+ if (!this.dragSelectElement || !this.lastDragEvent) {
8568
+ return;
8569
+ }
8570
+ this.onDrag(this.lastDragEvent);
8571
+ }
8504
8572
  onDragStop() {
8505
- if (this.viewElem) {
8506
- EventHandler.remove(document, 'mouseup', this.onDragStop);
8507
- EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
8573
+ EventHandler.remove(document, 'mouseup', this.onDragStop);
8574
+ if (this.dragContainer) {
8575
+ EventHandler.remove(this.dragContainer, 'mousemove', this.onDrag);
8576
+ EventHandler.remove(this.dragContainer, 'scroll', this.onDragScroll);
8508
8577
  }
8509
8578
  if (this.dragSelectElement) {
8510
8579
  EventHandler.remove(this.dragSelectElement, 'mousemove', this.onDrag);
@@ -8515,6 +8584,7 @@ let FileManager = FileManager_1 = class FileManager extends Component {
8515
8584
  detach(this.dragSelectElement);
8516
8585
  this.dragSelectElement = null;
8517
8586
  }
8587
+ this.dragContainer = null;
8518
8588
  }
8519
8589
  selectItems() {
8520
8590
  const dragRect = this.dragSelectElement.getBoundingClientRect();
@@ -8802,6 +8872,7 @@ let FileManager = FileManager_1 = class FileManager extends Component {
8802
8872
  removeClass([this.element], [RTL, MOBILE, CHECK_SELECT]);
8803
8873
  this.element.innerHTML = '';
8804
8874
  this.breadCrumbBarNavigation = null;
8875
+ this.breadCrumbNavElement = null;
8805
8876
  this.activeElements = null;
8806
8877
  this.virtualDragElement = null;
8807
8878
  this.visitedItem = null;