@syncfusion/ej2-navigations 27.1.48 → 27.1.51

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.
@@ -1698,6 +1698,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1698
1698
  detach(popupEle);
1699
1699
  }
1700
1700
  else {
1701
+ _this.isContextMenuClosed = false;
1701
1702
  _this.toggleAnimation(ul_1, false);
1702
1703
  }
1703
1704
  closeArgs = { element: ul_1, parentItem: item_1, items: items_1 };
@@ -2103,6 +2104,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
2103
2104
  case 'none':
2104
2105
  _this.top = observedOpenArgs.top;
2105
2106
  _this.left = observedOpenArgs.left;
2107
+ _this.isContextMenuClosed = true;
2106
2108
  break;
2107
2109
  case 'hamburger':
2108
2110
  if (!observedOpenArgs.cancel) {
@@ -3040,7 +3042,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3040
3042
  }
3041
3043
  };
3042
3044
  MenuBase.prototype.end = function (ul, isMenuOpen) {
3043
- if (isMenuOpen) {
3045
+ if (isMenuOpen && (this.isMenu || (!this.isMenu && this.isContextMenuClosed))) {
3044
3046
  if (this.isMenu || !Browser.isDevice) {
3045
3047
  ul.style.display = 'block';
3046
3048
  }
@@ -12722,7 +12724,7 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
12722
12724
  currentItem = isNullOrUndefined(currentItem) ? currentItem : this.getNodeObject(resultId);
12723
12725
  if (!isNullOrUndefined(currentItem)) {
12724
12726
  var htmlAttributes = currentItem[this.fields.htmlAttributes];
12725
- if (htmlAttributes && htmlAttributes.class.indexOf(DISABLE) !== -1) {
12727
+ if (htmlAttributes && !isNullOrUndefined(htmlAttributes.class) && htmlAttributes.class.indexOf(DISABLE) !== -1) {
12726
12728
  shouldPreventUpdate = false;
12727
12729
  }
12728
12730
  }
@@ -13454,6 +13456,24 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13454
13456
  removeClass([this.element], DRAGGING);
13455
13457
  this.dragStartAction = false;
13456
13458
  };
13459
+ TreeView.prototype.getOffsetX = function (event, target) {
13460
+ var touchList = event.changedTouches;
13461
+ if (touchList && touchList.length > 0) {
13462
+ return touchList[0].clientX - target.getBoundingClientRect().left;
13463
+ }
13464
+ else {
13465
+ return event.offsetX;
13466
+ }
13467
+ };
13468
+ TreeView.prototype.getOffsetY = function (event, target) {
13469
+ var touchList = event.changedTouches;
13470
+ if (touchList && touchList.length > 0) {
13471
+ return touchList[0].clientY - target.getBoundingClientRect().top;
13472
+ }
13473
+ else {
13474
+ return event.offsetY;
13475
+ }
13476
+ };
13457
13477
  TreeView.prototype.dragAction = function (e, virtualEle) {
13458
13478
  var dropRoot = closest(e.target, '.' + DROPPABLE);
13459
13479
  var dropWrap = closest(e.target, '.' + TEXTWRAP);
@@ -13463,6 +13483,9 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13463
13483
  this.removeVirtualEle();
13464
13484
  document.body.style.cursor = '';
13465
13485
  var classList = e.target.classList;
13486
+ var event = e.event;
13487
+ var offsetY = this.getOffsetY(event, e.target);
13488
+ var offsetX = this.getOffsetX(event, e.target);
13466
13489
  if (this.fullRowSelect && !dropWrap && !isNullOrUndefined(classList) && classList.contains(FULLROW)) {
13467
13490
  dropWrap = e.target.nextElementSibling;
13468
13491
  }
@@ -13475,14 +13498,14 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13475
13498
  (!dropLi.isSameNode(this.dragLi) && !this.isDescendant(this.dragLi, dropLi)))) {
13476
13499
  if (this.hasTemplate && dropLi) {
13477
13500
  var templateTarget = select(this.fullRowSelect ? '.' + FULLROW : '.' + TEXTWRAP, dropLi);
13478
- if ((e && (!expand && !collapse) && e.event.offsetY < 7 && !checkWrapper) ||
13479
- (((expand && e.event.offsetY < 5) || (collapse && e.event.offsetX < 3)))) {
13501
+ if ((e && (!expand && !collapse) && offsetY < 7 && !checkWrapper) ||
13502
+ (((expand && offsetY < 5) || (collapse && offsetX < 3)))) {
13480
13503
  var index = this.fullRowSelect ? (1) : (0);
13481
13504
  this.appendIndicator(dropLi, icon, index);
13482
13505
  }
13483
13506
  else if ((e && (!expand && !collapse) &&
13484
- !checkWrapper && templateTarget && e.event.offsetY > templateTarget.offsetHeight - 10) ||
13485
- ((expand && e.event.offsetY > 19) || (collapse && e.event.offsetX > 19))) {
13507
+ !checkWrapper && templateTarget && offsetY > templateTarget.offsetHeight - 10) ||
13508
+ ((expand && offsetY > 19) || (collapse && offsetX > 19))) {
13486
13509
  var index = this.fullRowSelect ? (2) : (1);
13487
13510
  this.appendIndicator(dropLi, icon, index);
13488
13511
  }
@@ -13492,14 +13515,14 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13492
13515
  }
13493
13516
  }
13494
13517
  else {
13495
- if ((dropLi && e && (!expand && !collapse) && (e.event.offsetY < 7) && !checkWrapper) ||
13496
- (((expand && e.event.offsetY < 5) || (collapse && e.event.offsetX < 3)))) {
13518
+ if ((dropLi && e && (!expand && !collapse) && (offsetY < 7) && !checkWrapper) ||
13519
+ (((expand && offsetY < 5) || (collapse && offsetX < 3)))) {
13497
13520
  var index = this.fullRowSelect ? (1) : (0);
13498
13521
  this.appendIndicator(dropLi, icon, index);
13499
13522
  }
13500
13523
  else if ((dropLi && e && (!expand && !collapse) &&
13501
- (e.target.offsetHeight > 0 && e.event.offsetY > (e.target.offsetHeight - 10)) && !checkWrapper) ||
13502
- (((expand && e.event.offsetY > 19) || (collapse && e.event.offsetX > 19)))) {
13524
+ (e.target.offsetHeight > 0 && offsetY > (e.target.offsetHeight - 10)) && !checkWrapper) ||
13525
+ (((expand && offsetY > 19) || (collapse && offsetX > 19)))) {
13503
13526
  var index = this.fullRowSelect ? (2) : (1);
13504
13527
  this.appendIndicator(dropLi, icon, index);
13505
13528
  }
@@ -13544,7 +13567,8 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13544
13567
  dropLi.insertBefore(virEle, dropLi.children[parseInt(index.toString(), 10)]);
13545
13568
  };
13546
13569
  TreeView.prototype.dropAction = function (e) {
13547
- var offsetY = e.event.offsetY;
13570
+ var event = e.event;
13571
+ var offsetY = this.getOffsetY(event, e.target);
13548
13572
  var dropTarget = e.target;
13549
13573
  var dragObj;
13550
13574
  var level;
@@ -13835,10 +13859,12 @@ var TreeView = /** @__PURE__ @class */ (function (_super) {
13835
13859
  };
13836
13860
  TreeView.prototype.renderVirtualEle = function (e) {
13837
13861
  var pre;
13838
- if (e.event.offsetY > e.target.offsetHeight - 2) {
13862
+ var event = e.event;
13863
+ var offsetY = this.getOffsetY(event, e.target);
13864
+ if (offsetY > e.target.offsetHeight - 2) {
13839
13865
  pre = false;
13840
13866
  }
13841
- else if (e.event.offsetY < 2) {
13867
+ else if (offsetY < 2) {
13842
13868
  pre = true;
13843
13869
  }
13844
13870
  var virEle = this.createElement('div', { className: SIBLING });
@@ -15732,7 +15758,9 @@ var SIDEBARABSOLUTE = 'e-sidebar-absolute';
15732
15758
  var Sidebar = /** @__PURE__ @class */ (function (_super) {
15733
15759
  __extends$9(Sidebar, _super);
15734
15760
  function Sidebar(options, element) {
15735
- return _super.call(this, options, element) || this;
15761
+ var _this = _super.call(this, options, element) || this;
15762
+ _this.documentClickContext = _this.documentclickHandler.bind(_this);
15763
+ return _this;
15736
15764
  }
15737
15765
  Sidebar.prototype.preRender = function () {
15738
15766
  this.setWidth();
@@ -15792,10 +15820,12 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
15792
15820
  };
15793
15821
  Sidebar.prototype.setCloseOnDocumentClick = function () {
15794
15822
  if (this.closeOnDocumentClick) {
15795
- EventHandler.add(document, 'mousedown touchstart', this.documentclickHandler, this);
15823
+ document.addEventListener('mousedown', this.documentClickContext);
15824
+ document.addEventListener('touchstart', this.documentClickContext);
15796
15825
  }
15797
15826
  else {
15798
- EventHandler.remove(document, 'mousedown touchstart', this.documentclickHandler);
15827
+ document.removeEventListener('mousedown', this.documentClickContext);
15828
+ document.removeEventListener('touchstart', this.documentClickContext);
15799
15829
  }
15800
15830
  };
15801
15831
  Sidebar.prototype.setWidth = function () {
@@ -16097,10 +16127,10 @@ var Sidebar = /** @__PURE__ @class */ (function (_super) {
16097
16127
  this.show();
16098
16128
  }
16099
16129
  else if (this.isOpen && this.position === 'Left' && args.swipeDirection === 'Left') {
16100
- this.hide();
16130
+ this.hide(args.originalEvent);
16101
16131
  }
16102
16132
  else if (this.isOpen && this.position === 'Right' && args.swipeDirection === 'Right') {
16103
- this.hide();
16133
+ this.hide(args.originalEvent);
16104
16134
  }
16105
16135
  else if (!this.isOpen && this.position === 'Right' && args.swipeDirection === 'Left'
16106
16136
  && (window.innerWidth - args.startX <= 20 && args.distanceX >= 50 && args.velocity >= 0.5)) {
@@ -19245,7 +19275,7 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
19245
19275
  if (this.stepperItemList && this.progressbar && this.element.classList.contains(HORIZSTEP)) {
19246
19276
  this.setProgressPosition(this.element, true);
19247
19277
  }
19248
- this.navigateToStep(this.activeStep, null, null, false);
19278
+ this.navigateToStep(this.activeStep, null, null, false, false);
19249
19279
  };
19250
19280
  Stepper.prototype.updateStepFocus = function () {
19251
19281
  if (this.isKeyNavFocus) {
@@ -19953,7 +19983,7 @@ var Stepper = /** @__PURE__ @class */ (function (_super) {
19953
19983
  if (this.stepperItemList && this.progressbar) {
19954
19984
  this.setProgressPosition(this.element);
19955
19985
  }
19956
- this.navigateToStep(this.activeStep, null, null, false);
19986
+ this.navigateToStep(this.activeStep, null, null, false, false);
19957
19987
  };
19958
19988
  Stepper.prototype.updateElementClassArray = function () {
19959
19989
  var classArray = [RTL$3, READONLY, 'e-steps-focus', LABELAFTER, LABELBEFORE, 'e-label-top',