dockview-core 4.2.1 → 4.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.
Files changed (35) hide show
  1. package/dist/cjs/dockview/components/popupService.d.ts +1 -0
  2. package/dist/cjs/dockview/components/popupService.js +6 -1
  3. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +5 -1
  4. package/dist/cjs/dockview/dockviewComponent.js +19 -17
  5. package/dist/cjs/dom.d.ts +4 -0
  6. package/dist/cjs/dom.js +42 -1
  7. package/dist/dockview-core.amd.js +68 -20
  8. package/dist/dockview-core.amd.js.map +1 -1
  9. package/dist/dockview-core.amd.min.js +2 -2
  10. package/dist/dockview-core.amd.min.js.map +1 -1
  11. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  12. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  13. package/dist/dockview-core.amd.noStyle.js +68 -20
  14. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  15. package/dist/dockview-core.cjs.js +68 -20
  16. package/dist/dockview-core.cjs.js.map +1 -1
  17. package/dist/dockview-core.esm.js +68 -20
  18. package/dist/dockview-core.esm.js.map +1 -1
  19. package/dist/dockview-core.esm.min.js +2 -2
  20. package/dist/dockview-core.esm.min.js.map +1 -1
  21. package/dist/dockview-core.js +68 -20
  22. package/dist/dockview-core.js.map +1 -1
  23. package/dist/dockview-core.min.js +2 -2
  24. package/dist/dockview-core.min.js.map +1 -1
  25. package/dist/dockview-core.min.noStyle.js +2 -2
  26. package/dist/dockview-core.min.noStyle.js.map +1 -1
  27. package/dist/dockview-core.noStyle.js +68 -20
  28. package/dist/dockview-core.noStyle.js.map +1 -1
  29. package/dist/esm/dockview/components/popupService.d.ts +1 -0
  30. package/dist/esm/dockview/components/popupService.js +6 -1
  31. package/dist/esm/dockview/components/titlebar/tabsContainer.js +6 -2
  32. package/dist/esm/dockview/dockviewComponent.js +19 -17
  33. package/dist/esm/dom.d.ts +4 -0
  34. package/dist/esm/dom.js +38 -0
  35. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.2.1
3
+ * @version 4.2.4
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -642,6 +642,44 @@
642
642
  }));
643
643
  return disposable;
644
644
  }
645
+ function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
646
+ const buffer = options.buffer;
647
+ const rect = element.getBoundingClientRect();
648
+ const rootRect = element.getBoundingClientRect();
649
+ const viewportWidth = root.clientWidth;
650
+ const viewportHeight = root.clientHeight;
651
+ let translateX = 0;
652
+ let translateY = 0;
653
+ const left = rect.left - rootRect.left;
654
+ const top = rect.top - rootRect.top;
655
+ const bottom = rect.bottom - rootRect.bottom;
656
+ const right = rect.right - rootRect.right;
657
+ // Check horizontal overflow
658
+ if (left < buffer) {
659
+ translateX = buffer - left;
660
+ }
661
+ else if (right > viewportWidth - buffer) {
662
+ translateX = viewportWidth - right - buffer;
663
+ }
664
+ // Check vertical overflow
665
+ if (top < buffer) {
666
+ translateY = buffer - top;
667
+ }
668
+ else if (bottom > viewportHeight - buffer) {
669
+ translateY = viewportHeight - bottom - buffer;
670
+ }
671
+ // Apply the translation if needed
672
+ if (translateX !== 0 || translateY !== 0) {
673
+ element.style.transform = `translate(${translateX}px, ${translateY}px)`;
674
+ }
675
+ }
676
+ function findRelativeZIndexParent(el) {
677
+ let tmp = el;
678
+ while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
679
+ tmp = tmp.parentElement;
680
+ }
681
+ return tmp;
682
+ }
645
683
 
646
684
  function tail(arr) {
647
685
  if (arr.length === 0) {
@@ -5609,7 +5647,7 @@
5609
5647
  toggleClass(wrapper, 'dv-tab', true);
5610
5648
  toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
5611
5649
  toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
5612
- wrapper.addEventListener('mousedown', () => {
5650
+ wrapper.addEventListener('pointerdown', () => {
5613
5651
  this.accessor.popupService.close();
5614
5652
  tab.element.scrollIntoView();
5615
5653
  tab.panel.api.setActive();
@@ -5617,9 +5655,13 @@
5617
5655
  wrapper.appendChild(child);
5618
5656
  el.appendChild(wrapper);
5619
5657
  }
5658
+ const relativeParent = findRelativeZIndexParent(root);
5620
5659
  this.accessor.popupService.openPopover(el, {
5621
5660
  x: event.clientX,
5622
5661
  y: event.clientY,
5662
+ zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
5663
+ ? `calc(${relativeParent.style.zIndex} * 2)`
5664
+ : undefined,
5623
5665
  });
5624
5666
  }));
5625
5667
  }
@@ -7984,10 +8026,11 @@
7984
8026
  }), this._activeDisposable);
7985
8027
  }
7986
8028
  openPopover(element, position) {
8029
+ var _a;
7987
8030
  this.close();
7988
8031
  const wrapper = document.createElement('div');
7989
8032
  wrapper.style.position = 'absolute';
7990
- wrapper.style.zIndex = '99';
8033
+ wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
7991
8034
  wrapper.appendChild(element);
7992
8035
  const anchorBox = this._element.getBoundingClientRect();
7993
8036
  const offsetX = anchorBox.left;
@@ -8011,6 +8054,9 @@
8011
8054
  }
8012
8055
  this.close();
8013
8056
  }));
8057
+ requestAnimationFrame(() => {
8058
+ shiftAbsoluteElementIntoView(wrapper, this.root);
8059
+ });
8014
8060
  }
8015
8061
  close() {
8016
8062
  if (this._active) {
@@ -9544,24 +9590,26 @@
9544
9590
  selectedPopoutGroup.disposable.dispose();
9545
9591
  }
9546
9592
  }
9547
- const referenceLocation = getGridLocation(to.element);
9548
- const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9549
- let size;
9550
- switch (this.gridview.orientation) {
9551
- case exports.Orientation.VERTICAL:
9552
- size =
9553
- referenceLocation.length % 2 == 0
9554
- ? from.api.width
9555
- : from.api.height;
9556
- break;
9557
- case exports.Orientation.HORIZONTAL:
9558
- size =
9559
- referenceLocation.length % 2 == 0
9560
- ? from.api.height
9561
- : from.api.width;
9562
- break;
9593
+ if (from.api.location.type !== 'popout') {
9594
+ const referenceLocation = getGridLocation(to.element);
9595
+ const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9596
+ let size;
9597
+ switch (this.gridview.orientation) {
9598
+ case exports.Orientation.VERTICAL:
9599
+ size =
9600
+ referenceLocation.length % 2 == 0
9601
+ ? from.api.width
9602
+ : from.api.height;
9603
+ break;
9604
+ case exports.Orientation.HORIZONTAL:
9605
+ size =
9606
+ referenceLocation.length % 2 == 0
9607
+ ? from.api.height
9608
+ : from.api.width;
9609
+ break;
9610
+ }
9611
+ this.gridview.addView(from, size, dropLocation);
9563
9612
  }
9564
- this.gridview.addView(from, size, dropLocation);
9565
9613
  }
9566
9614
  from.panels.forEach((panel) => {
9567
9615
  this._onDidMovePanel.fire({ panel, from });