@syncfusion/ej2-ribbon 33.2.3 → 33.2.5

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.
@@ -2518,7 +2518,16 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
2518
2518
  }
2519
2519
  },
2520
2520
  beforeItemRender: dropDownSettings.beforeItemRender,
2521
- beforeOpen: dropDownSettings.beforeOpen,
2521
+ beforeOpen: function (e) {
2522
+ var ddb = getComponent(buttonEle, DropDownButton);
2523
+ var target = _this.parent.getAppendToElement();
2524
+ if (ddb && ddb.dropDown && !target.contains(ddb.dropDown.element)) {
2525
+ target.appendChild(ddb.dropDown.element);
2526
+ }
2527
+ if (dropDownSettings.beforeOpen) {
2528
+ dropDownSettings.beforeOpen.call(_this, e);
2529
+ }
2530
+ },
2522
2531
  close: function (e) {
2523
2532
  if (dropDownSettings.close) {
2524
2533
  dropDownSettings.close.call(_this, e);
@@ -2624,6 +2633,12 @@ var RibbonDropDown = /** @__PURE__ @class */ (function () {
2624
2633
  cssClass: VERTICAL_DDB + SPACE + RIBBON_GROUP_OVERFLOW_DDB,
2625
2634
  iconPosition: 'Top',
2626
2635
  content: name,
2636
+ beforeOpen: function () {
2637
+ var target = _this.parent.getAppendToElement();
2638
+ if (dropdown && dropdown.dropDown && !target.contains(dropdown.dropDown.element)) {
2639
+ target.appendChild(dropdown.dropDown.element);
2640
+ }
2641
+ },
2627
2642
  beforeClose: function (args) {
2628
2643
  args.cancel = !isNullOrUndefined(args.event && closest(args.event.target, '.' + RIBBON_POPUP_CONTROL));
2629
2644
  }
@@ -2965,7 +2980,16 @@ var RibbonSplitButton = /** @__PURE__ @class */ (function () {
2965
2980
  }
2966
2981
  },
2967
2982
  beforeItemRender: splitButtonSettings.beforeItemRender,
2968
- beforeOpen: splitButtonSettings.beforeOpen,
2983
+ beforeOpen: function () {
2984
+ var popupEl = splitbutton.dropDown.element;
2985
+ var target = _this.parent.getAppendToElement();
2986
+ if (popupEl && !target.contains(popupEl)) {
2987
+ target.appendChild(popupEl);
2988
+ }
2989
+ if (splitButtonSettings.beforeOpen) {
2990
+ splitButtonSettings.beforeOpen.call(_this);
2991
+ }
2992
+ },
2969
2993
  close: function () {
2970
2994
  splitbutton['wrapper'].classList.remove(RIBBON_POPUP_OPEN);
2971
2995
  if (splitButtonSettings.close) {
@@ -4322,7 +4346,7 @@ var RibbonGallery = /** @__PURE__ @class */ (function () {
4322
4346
  RibbonGallery.prototype.setWrapperStyle = function (popup, popupContainerItems) {
4323
4347
  if (popup.width !== 'auto') {
4324
4348
  popupContainerItems.forEach(function (ele) {
4325
- ele.style.flexFlow = 'wrap';
4349
+ ele.style.flexFlow = 'column wrap';
4326
4350
  });
4327
4351
  }
4328
4352
  };
@@ -4552,12 +4576,12 @@ var RibbonGallery = /** @__PURE__ @class */ (function () {
4552
4576
  RibbonGallery.prototype.addOverFlowEvents = function (item, itemEle) {
4553
4577
  var _this = this;
4554
4578
  if (itemEle.closest('.e-ribbon-overflow-target')) {
4555
- var buttonEle = this.parent.createElement('button', {
4579
+ var buttonEle_1 = this.parent.createElement('button', {
4556
4580
  id: item.id
4557
4581
  });
4558
- itemEle.appendChild(buttonEle);
4582
+ itemEle.appendChild(buttonEle_1);
4559
4583
  if (itemEle.querySelector('.e-ribbon-gallery-wrapper').classList.contains('e-disabled')) {
4560
- buttonEle.classList.add('e-disabled');
4584
+ buttonEle_1.classList.add('e-disabled');
4561
4585
  }
4562
4586
  itemEle.querySelector('.e-ribbon-gallery-wrapper').classList.add('e-hidden');
4563
4587
  itemEle.querySelectorAll('.e-ribbon-gallery-container').forEach(function (ele) {
@@ -4597,6 +4621,9 @@ var RibbonGallery = /** @__PURE__ @class */ (function () {
4597
4621
  var popupContainerItems = popupContainerEle_1.querySelectorAll('.e-ribbon-gallery-container');
4598
4622
  _this.setWrapperStyle(popup_1, popupContainerItems);
4599
4623
  _this.setFoucsToFirstItem(popupContainerEle_1, true, item.id);
4624
+ if (popup_1.width !== 'auto') {
4625
+ _this.alignGalleryPopupLeft(popupContainerEle_1, buttonEle_1);
4626
+ }
4600
4627
  },
4601
4628
  beforeClose: function (args) {
4602
4629
  var isCancelled = _this.popupEvents(args.event, item.gallerySettings, 'popupClose', false);
@@ -4604,7 +4631,7 @@ var RibbonGallery = /** @__PURE__ @class */ (function () {
4604
4631
  args.cancel = true;
4605
4632
  }
4606
4633
  }
4607
- }, buttonEle);
4634
+ }, buttonEle_1);
4608
4635
  if (popup_1.width !== 'auto') {
4609
4636
  dropdown.dropDown.width = formatUnit(popup_1.width);
4610
4637
  }
@@ -4768,6 +4795,22 @@ var RibbonGallery = /** @__PURE__ @class */ (function () {
4768
4795
  _this.handleGalleryPopupNavigation(e, popupEle, isDropdown, itemID, popup, gallerySettings);
4769
4796
  };
4770
4797
  };
4798
+ RibbonGallery.prototype.alignGalleryPopupLeft = function (popup, buttonEle) {
4799
+ var popupEl = popup.parentElement;
4800
+ if (!popupEl) {
4801
+ return;
4802
+ }
4803
+ var currentLeft = parseFloat(popupEl.style.left);
4804
+ var buttonRect = buttonEle.getBoundingClientRect();
4805
+ var popupWidth = popupEl.offsetWidth;
4806
+ var targetLeft = buttonRect.left - popupWidth - 1;
4807
+ if (targetLeft < 0) {
4808
+ targetLeft = 1;
4809
+ }
4810
+ if (Math.abs(currentLeft - targetLeft) > 1) {
4811
+ popupEl.style.left = targetLeft + "px";
4812
+ }
4813
+ };
4771
4814
  RibbonGallery.prototype.handleGalleryPopupNavigation = function (e, popupEle, isDropdown, itemID, popup, gallerySettings) {
4772
4815
  var galleryPopupEle = popupEle.querySelectorAll('.e-ribbon-gallery-item');
4773
4816
  if (galleryPopupEle) {
@@ -4950,6 +4993,16 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
4950
4993
  }
4951
4994
  return modules;
4952
4995
  };
4996
+ Ribbon.prototype.getAppendToElement = function () {
4997
+ if (this.isAngular) {
4998
+ var cdkPane = this.element.closest('.cdk-overlay-pane');
4999
+ var popoverEl = this.element.closest('[popover]');
5000
+ if (cdkPane && popoverEl) {
5001
+ return cdkPane;
5002
+ }
5003
+ }
5004
+ return document.body;
5005
+ };
4953
5006
  Ribbon.prototype.initialize = function () {
4954
5007
  this.element.id = this.element.id || getUniqueID('e-' + this.getModuleName());
4955
5008
  this.initializeLocale();
@@ -6952,6 +7005,10 @@ var Ribbon = /** @__PURE__ @class */ (function (_super) {
6952
7005
  enableRtl: this.enableRtl,
6953
7006
  enablePersistence: this.enablePersistence,
6954
7007
  beforeOpen: function (args) {
7008
+ var target = _this.getAppendToElement();
7009
+ if (overflowDDB && overflowDDB.dropDown && !target.contains(overflowDDB.dropDown.element)) {
7010
+ target.appendChild(overflowDDB.dropDown.element);
7011
+ }
6955
7012
  var eventArgs = { element: args.element, event: args.event, cancel: args.cancel };
6956
7013
  _this.trigger('overflowPopupOpen', eventArgs, function (ribbonArgs) {
6957
7014
  if (ribbonArgs.cancel) {