dockview-core 4.3.1 → 4.4.1

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 (51) hide show
  1. package/dist/cjs/api/component.api.d.ts +1 -0
  2. package/dist/cjs/api/component.api.js +7 -0
  3. package/dist/cjs/dockview/components/tab/tab.d.ts +1 -0
  4. package/dist/cjs/dockview/components/tab/tab.js +4 -1
  5. package/dist/cjs/dockview/components/titlebar/tabs.d.ts +1 -0
  6. package/dist/cjs/dockview/components/titlebar/tabs.js +16 -0
  7. package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +2 -0
  8. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +4 -0
  9. package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +1 -0
  10. package/dist/cjs/dockview/components/titlebar/voidContainer.js +4 -1
  11. package/dist/cjs/dockview/dockviewComponent.d.ts +4 -0
  12. package/dist/cjs/dockview/dockviewComponent.js +81 -42
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +10 -8
  14. package/dist/cjs/dockview/dockviewGroupPanelModel.js +3 -0
  15. package/dist/dockview-core.amd.js +61 -14
  16. package/dist/dockview-core.amd.js.map +1 -1
  17. package/dist/dockview-core.amd.min.js +2 -2
  18. package/dist/dockview-core.amd.min.js.map +1 -1
  19. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  20. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  21. package/dist/dockview-core.amd.noStyle.js +61 -14
  22. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  23. package/dist/dockview-core.cjs.js +61 -14
  24. package/dist/dockview-core.cjs.js.map +1 -1
  25. package/dist/dockview-core.esm.js +61 -14
  26. package/dist/dockview-core.esm.js.map +1 -1
  27. package/dist/dockview-core.esm.min.js +2 -2
  28. package/dist/dockview-core.esm.min.js.map +1 -1
  29. package/dist/dockview-core.js +61 -14
  30. package/dist/dockview-core.js.map +1 -1
  31. package/dist/dockview-core.min.js +2 -2
  32. package/dist/dockview-core.min.js.map +1 -1
  33. package/dist/dockview-core.min.noStyle.js +2 -2
  34. package/dist/dockview-core.min.noStyle.js.map +1 -1
  35. package/dist/dockview-core.noStyle.js +61 -14
  36. package/dist/dockview-core.noStyle.js.map +1 -1
  37. package/dist/esm/api/component.api.d.ts +1 -0
  38. package/dist/esm/api/component.api.js +3 -0
  39. package/dist/esm/dockview/components/tab/tab.d.ts +1 -0
  40. package/dist/esm/dockview/components/tab/tab.js +4 -1
  41. package/dist/esm/dockview/components/titlebar/tabs.d.ts +1 -0
  42. package/dist/esm/dockview/components/titlebar/tabs.js +5 -0
  43. package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +2 -0
  44. package/dist/esm/dockview/components/titlebar/tabsContainer.js +4 -0
  45. package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +1 -0
  46. package/dist/esm/dockview/components/titlebar/voidContainer.js +4 -1
  47. package/dist/esm/dockview/dockviewComponent.d.ts +4 -0
  48. package/dist/esm/dockview/dockviewComponent.js +37 -11
  49. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +10 -8
  50. package/dist/esm/dockview/dockviewGroupPanelModel.js +3 -0
  51. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 4.3.1
3
+ * @version 4.4.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3656,6 +3656,9 @@
3656
3656
  get onDidPopoutGroupPositionChange() {
3657
3657
  return this.component.onDidPopoutGroupPositionChange;
3658
3658
  }
3659
+ get onDidOpenPopoutWindowFail() {
3660
+ return this.component.onDidOpenPopoutWindowFail;
3661
+ }
3659
3662
  /**
3660
3663
  * All panel objects.
3661
3664
  */
@@ -5024,7 +5027,7 @@
5024
5027
  this._element = document.createElement('div');
5025
5028
  this._element.className = 'dv-tab';
5026
5029
  this._element.tabIndex = 0;
5027
- this._element.draggable = true;
5030
+ this._element.draggable = !this.accessor.options.disableDnd;
5028
5031
  toggleClass(this.element, 'dv-inactive-tab', true);
5029
5032
  const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
5030
5033
  this.dropTarget = new Droptarget(this._element, {
@@ -5072,6 +5075,9 @@
5072
5075
  this.content = part;
5073
5076
  this._element.appendChild(this.content.element);
5074
5077
  }
5078
+ updateDragAndDropState() {
5079
+ this._element.draggable = !this.accessor.options.disableDnd;
5080
+ }
5075
5081
  dispose() {
5076
5082
  super.dispose();
5077
5083
  }
@@ -5143,7 +5149,7 @@
5143
5149
  this.onDragStart = this._onDragStart.event;
5144
5150
  this._element = document.createElement('div');
5145
5151
  this._element.className = 'dv-void-container';
5146
- this._element.draggable = true;
5152
+ this._element.draggable = !this.accessor.options.disableDnd;
5147
5153
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5148
5154
  this.accessor.doSetGroupActive(this.group);
5149
5155
  }));
@@ -5166,6 +5172,9 @@
5166
5172
  this._onDrop.fire(event);
5167
5173
  }), this.dropTarget);
5168
5174
  }
5175
+ updateDragAndDropState() {
5176
+ this._element.draggable = !this.accessor.options.disableDnd;
5177
+ }
5169
5178
  }
5170
5179
 
5171
5180
  class Scrollbar extends CompositeDisposable {
@@ -5426,6 +5435,11 @@
5426
5435
  .map((x) => x.value.panel.id);
5427
5436
  this._onOverflowTabsChange.fire({ tabs, reset: options.reset });
5428
5437
  }
5438
+ updateDragAndDropState() {
5439
+ for (const tab of this._tabs) {
5440
+ tab.value.updateDragAndDropState();
5441
+ }
5442
+ }
5429
5443
  }
5430
5444
 
5431
5445
  const createSvgElementFromPath = (params) => {
@@ -5698,6 +5712,10 @@
5698
5712
  });
5699
5713
  }));
5700
5714
  }
5715
+ updateDragAndDropState() {
5716
+ this.tabs.updateDragAndDropState();
5717
+ this.voidContainer.updateDragAndDropState();
5718
+ }
5701
5719
  }
5702
5720
 
5703
5721
  class DockviewUnhandledDragOverEvent extends AcceptableEvent {
@@ -6403,6 +6421,9 @@
6403
6421
  }));
6404
6422
  }
6405
6423
  }
6424
+ updateDragAndDropState() {
6425
+ this.tabsContainer.updateDragAndDropState();
6426
+ }
6406
6427
  dispose() {
6407
6428
  var _a, _b, _c;
6408
6429
  super.dispose();
@@ -8258,6 +8279,8 @@
8258
8279
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8259
8280
  this._onDidPopoutGroupPositionChange = new Emitter();
8260
8281
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8282
+ this._onDidOpenPopoutWindowFail = new Emitter();
8283
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8261
8284
  this._onDidLayoutFromJSON = new Emitter();
8262
8285
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8263
8286
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8322,7 +8345,7 @@
8322
8345
  if (options.debug) {
8323
8346
  this.addDisposables(new StrictEventsSequencing(this));
8324
8347
  }
8325
- this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8348
+ this.addDisposables(this.rootDropTargetContainer, this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this._onDidMaximizedGroupChange, this._onDidOptionsChange, this._onDidPopoutGroupSizeChange, this._onDidPopoutGroupPositionChange, this._onDidOpenPopoutWindowFail, this.onDidViewVisibilityChangeMicroTaskQueue(() => {
8326
8349
  this.updateWatermark();
8327
8350
  }), this.onDidAdd((event) => {
8328
8351
  if (!this._moving) {
@@ -8468,13 +8491,6 @@
8468
8491
  if (_window.isDisposed) {
8469
8492
  return false;
8470
8493
  }
8471
- if (popoutContainer === null) {
8472
- popoutWindowDisposable.dispose();
8473
- return false;
8474
- }
8475
- const gready = document.createElement('div');
8476
- gready.className = 'dv-overlay-render-container';
8477
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8478
8494
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8479
8495
  ? options.referenceGroup
8480
8496
  : itemToPopout instanceof DockviewPanel
@@ -8482,7 +8498,7 @@
8482
8498
  : itemToPopout;
8483
8499
  const referenceLocation = itemToPopout.api.location.type;
8484
8500
  /**
8485
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8501
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8486
8502
  * of this case is when being called from the `fromJSON(...)` method
8487
8503
  */
8488
8504
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8495,8 +8511,28 @@
8495
8511
  }
8496
8512
  else {
8497
8513
  group = this.createGroup({ id: groupId });
8498
- this._onDidAddGroup.fire(group);
8514
+ if (popoutContainer) {
8515
+ this._onDidAddGroup.fire(group);
8516
+ }
8517
+ }
8518
+ if (popoutContainer === null) {
8519
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8520
+ popoutWindowDisposable.dispose();
8521
+ this._onDidOpenPopoutWindowFail.fire();
8522
+ // if the popout window was blocked, we need to move the group back to the reference group
8523
+ // and set it to visible
8524
+ this.movingLock(() => moveGroupWithoutDestroying({
8525
+ from: group,
8526
+ to: referenceGroup,
8527
+ }));
8528
+ if (!referenceGroup.api.isVisible) {
8529
+ referenceGroup.api.setVisible(true);
8530
+ }
8531
+ return false;
8499
8532
  }
8533
+ const gready = document.createElement('div');
8534
+ gready.className = 'dv-overlay-render-container';
8535
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8500
8536
  group.model.renderContainer = overlayRenderContainer;
8501
8537
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8502
8538
  let floatingBox;
@@ -8653,7 +8689,7 @@
8653
8689
  return true;
8654
8690
  })
8655
8691
  .catch((err) => {
8656
- console.error('dockview: failed to create popout window', err);
8692
+ console.error('dockview: failed to create popout.', err);
8657
8693
  return false;
8658
8694
  });
8659
8695
  }
@@ -8860,7 +8896,12 @@
8860
8896
  }
8861
8897
  }
8862
8898
  this.updateDropTargetModel(options);
8899
+ const oldDisableDnd = this.options.disableDnd;
8863
8900
  this._options = Object.assign(Object.assign({}, this.options), options);
8901
+ const newDisableDnd = this.options.disableDnd;
8902
+ if (oldDisableDnd !== newDisableDnd) {
8903
+ this.updateDragAndDropState();
8904
+ }
8864
8905
  if ('theme' in options) {
8865
8906
  this.updateTheme();
8866
8907
  }
@@ -8875,6 +8916,12 @@
8875
8916
  }
8876
8917
  }
8877
8918
  }
8919
+ updateDragAndDropState() {
8920
+ // Update draggable state for all tabs and void containers
8921
+ for (const group of this.groups) {
8922
+ group.model.updateDragAndDropState();
8923
+ }
8924
+ }
8878
8925
  focus() {
8879
8926
  var _a;
8880
8927
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();