dockview-core 4.2.3 → 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.3
3
+ * @version 4.2.4
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -672,6 +672,44 @@
672
672
  }));
673
673
  return disposable;
674
674
  }
675
+ function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
676
+ const buffer = options.buffer;
677
+ const rect = element.getBoundingClientRect();
678
+ const rootRect = element.getBoundingClientRect();
679
+ const viewportWidth = root.clientWidth;
680
+ const viewportHeight = root.clientHeight;
681
+ let translateX = 0;
682
+ let translateY = 0;
683
+ const left = rect.left - rootRect.left;
684
+ const top = rect.top - rootRect.top;
685
+ const bottom = rect.bottom - rootRect.bottom;
686
+ const right = rect.right - rootRect.right;
687
+ // Check horizontal overflow
688
+ if (left < buffer) {
689
+ translateX = buffer - left;
690
+ }
691
+ else if (right > viewportWidth - buffer) {
692
+ translateX = viewportWidth - right - buffer;
693
+ }
694
+ // Check vertical overflow
695
+ if (top < buffer) {
696
+ translateY = buffer - top;
697
+ }
698
+ else if (bottom > viewportHeight - buffer) {
699
+ translateY = viewportHeight - bottom - buffer;
700
+ }
701
+ // Apply the translation if needed
702
+ if (translateX !== 0 || translateY !== 0) {
703
+ element.style.transform = `translate(${translateX}px, ${translateY}px)`;
704
+ }
705
+ }
706
+ function findRelativeZIndexParent(el) {
707
+ let tmp = el;
708
+ while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
709
+ tmp = tmp.parentElement;
710
+ }
711
+ return tmp;
712
+ }
675
713
 
676
714
  function tail(arr) {
677
715
  if (arr.length === 0) {
@@ -5639,7 +5677,7 @@
5639
5677
  toggleClass(wrapper, 'dv-tab', true);
5640
5678
  toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
5641
5679
  toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
5642
- wrapper.addEventListener('mousedown', () => {
5680
+ wrapper.addEventListener('pointerdown', () => {
5643
5681
  this.accessor.popupService.close();
5644
5682
  tab.element.scrollIntoView();
5645
5683
  tab.panel.api.setActive();
@@ -5647,9 +5685,13 @@
5647
5685
  wrapper.appendChild(child);
5648
5686
  el.appendChild(wrapper);
5649
5687
  }
5688
+ const relativeParent = findRelativeZIndexParent(root);
5650
5689
  this.accessor.popupService.openPopover(el, {
5651
5690
  x: event.clientX,
5652
5691
  y: event.clientY,
5692
+ zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
5693
+ ? `calc(${relativeParent.style.zIndex} * 2)`
5694
+ : undefined,
5653
5695
  });
5654
5696
  }));
5655
5697
  }
@@ -8014,10 +8056,11 @@
8014
8056
  }), this._activeDisposable);
8015
8057
  }
8016
8058
  openPopover(element, position) {
8059
+ var _a;
8017
8060
  this.close();
8018
8061
  const wrapper = document.createElement('div');
8019
8062
  wrapper.style.position = 'absolute';
8020
- wrapper.style.zIndex = '99';
8063
+ wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
8021
8064
  wrapper.appendChild(element);
8022
8065
  const anchorBox = this._element.getBoundingClientRect();
8023
8066
  const offsetX = anchorBox.left;
@@ -8041,6 +8084,9 @@
8041
8084
  }
8042
8085
  this.close();
8043
8086
  }));
8087
+ requestAnimationFrame(() => {
8088
+ shiftAbsoluteElementIntoView(wrapper, this.root);
8089
+ });
8044
8090
  }
8045
8091
  close() {
8046
8092
  if (this._active) {
@@ -9574,24 +9620,26 @@
9574
9620
  selectedPopoutGroup.disposable.dispose();
9575
9621
  }
9576
9622
  }
9577
- const referenceLocation = getGridLocation(to.element);
9578
- const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9579
- let size;
9580
- switch (this.gridview.orientation) {
9581
- case exports.Orientation.VERTICAL:
9582
- size =
9583
- referenceLocation.length % 2 == 0
9584
- ? from.api.width
9585
- : from.api.height;
9586
- break;
9587
- case exports.Orientation.HORIZONTAL:
9588
- size =
9589
- referenceLocation.length % 2 == 0
9590
- ? from.api.height
9591
- : from.api.width;
9592
- break;
9623
+ if (from.api.location.type !== 'popout') {
9624
+ const referenceLocation = getGridLocation(to.element);
9625
+ const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
9626
+ let size;
9627
+ switch (this.gridview.orientation) {
9628
+ case exports.Orientation.VERTICAL:
9629
+ size =
9630
+ referenceLocation.length % 2 == 0
9631
+ ? from.api.width
9632
+ : from.api.height;
9633
+ break;
9634
+ case exports.Orientation.HORIZONTAL:
9635
+ size =
9636
+ referenceLocation.length % 2 == 0
9637
+ ? from.api.height
9638
+ : from.api.width;
9639
+ break;
9640
+ }
9641
+ this.gridview.addView(from, size, dropLocation);
9593
9642
  }
9594
- this.gridview.addView(from, size, dropLocation);
9595
9643
  }
9596
9644
  from.panels.forEach((panel) => {
9597
9645
  this._onDidMovePanel.fire({ panel, from });