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
  */
@@ -3626,6 +3626,9 @@
3626
3626
  get onDidPopoutGroupPositionChange() {
3627
3627
  return this.component.onDidPopoutGroupPositionChange;
3628
3628
  }
3629
+ get onDidOpenPopoutWindowFail() {
3630
+ return this.component.onDidOpenPopoutWindowFail;
3631
+ }
3629
3632
  /**
3630
3633
  * All panel objects.
3631
3634
  */
@@ -4994,7 +4997,7 @@
4994
4997
  this._element = document.createElement('div');
4995
4998
  this._element.className = 'dv-tab';
4996
4999
  this._element.tabIndex = 0;
4997
- this._element.draggable = true;
5000
+ this._element.draggable = !this.accessor.options.disableDnd;
4998
5001
  toggleClass(this.element, 'dv-inactive-tab', true);
4999
5002
  const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
5000
5003
  this.dropTarget = new Droptarget(this._element, {
@@ -5042,6 +5045,9 @@
5042
5045
  this.content = part;
5043
5046
  this._element.appendChild(this.content.element);
5044
5047
  }
5048
+ updateDragAndDropState() {
5049
+ this._element.draggable = !this.accessor.options.disableDnd;
5050
+ }
5045
5051
  dispose() {
5046
5052
  super.dispose();
5047
5053
  }
@@ -5113,7 +5119,7 @@
5113
5119
  this.onDragStart = this._onDragStart.event;
5114
5120
  this._element = document.createElement('div');
5115
5121
  this._element.className = 'dv-void-container';
5116
- this._element.draggable = true;
5122
+ this._element.draggable = !this.accessor.options.disableDnd;
5117
5123
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5118
5124
  this.accessor.doSetGroupActive(this.group);
5119
5125
  }));
@@ -5136,6 +5142,9 @@
5136
5142
  this._onDrop.fire(event);
5137
5143
  }), this.dropTarget);
5138
5144
  }
5145
+ updateDragAndDropState() {
5146
+ this._element.draggable = !this.accessor.options.disableDnd;
5147
+ }
5139
5148
  }
5140
5149
 
5141
5150
  class Scrollbar extends CompositeDisposable {
@@ -5396,6 +5405,11 @@
5396
5405
  .map((x) => x.value.panel.id);
5397
5406
  this._onOverflowTabsChange.fire({ tabs, reset: options.reset });
5398
5407
  }
5408
+ updateDragAndDropState() {
5409
+ for (const tab of this._tabs) {
5410
+ tab.value.updateDragAndDropState();
5411
+ }
5412
+ }
5399
5413
  }
5400
5414
 
5401
5415
  const createSvgElementFromPath = (params) => {
@@ -5668,6 +5682,10 @@
5668
5682
  });
5669
5683
  }));
5670
5684
  }
5685
+ updateDragAndDropState() {
5686
+ this.tabs.updateDragAndDropState();
5687
+ this.voidContainer.updateDragAndDropState();
5688
+ }
5671
5689
  }
5672
5690
 
5673
5691
  class DockviewUnhandledDragOverEvent extends AcceptableEvent {
@@ -6373,6 +6391,9 @@
6373
6391
  }));
6374
6392
  }
6375
6393
  }
6394
+ updateDragAndDropState() {
6395
+ this.tabsContainer.updateDragAndDropState();
6396
+ }
6376
6397
  dispose() {
6377
6398
  var _a, _b, _c;
6378
6399
  super.dispose();
@@ -8228,6 +8249,8 @@
8228
8249
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8229
8250
  this._onDidPopoutGroupPositionChange = new Emitter();
8230
8251
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8252
+ this._onDidOpenPopoutWindowFail = new Emitter();
8253
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8231
8254
  this._onDidLayoutFromJSON = new Emitter();
8232
8255
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8233
8256
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8292,7 +8315,7 @@
8292
8315
  if (options.debug) {
8293
8316
  this.addDisposables(new StrictEventsSequencing(this));
8294
8317
  }
8295
- 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(() => {
8318
+ 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(() => {
8296
8319
  this.updateWatermark();
8297
8320
  }), this.onDidAdd((event) => {
8298
8321
  if (!this._moving) {
@@ -8438,13 +8461,6 @@
8438
8461
  if (_window.isDisposed) {
8439
8462
  return false;
8440
8463
  }
8441
- if (popoutContainer === null) {
8442
- popoutWindowDisposable.dispose();
8443
- return false;
8444
- }
8445
- const gready = document.createElement('div');
8446
- gready.className = 'dv-overlay-render-container';
8447
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8448
8464
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8449
8465
  ? options.referenceGroup
8450
8466
  : itemToPopout instanceof DockviewPanel
@@ -8452,7 +8468,7 @@
8452
8468
  : itemToPopout;
8453
8469
  const referenceLocation = itemToPopout.api.location.type;
8454
8470
  /**
8455
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8471
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8456
8472
  * of this case is when being called from the `fromJSON(...)` method
8457
8473
  */
8458
8474
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8465,8 +8481,28 @@
8465
8481
  }
8466
8482
  else {
8467
8483
  group = this.createGroup({ id: groupId });
8468
- this._onDidAddGroup.fire(group);
8484
+ if (popoutContainer) {
8485
+ this._onDidAddGroup.fire(group);
8486
+ }
8487
+ }
8488
+ if (popoutContainer === null) {
8489
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8490
+ popoutWindowDisposable.dispose();
8491
+ this._onDidOpenPopoutWindowFail.fire();
8492
+ // if the popout window was blocked, we need to move the group back to the reference group
8493
+ // and set it to visible
8494
+ this.movingLock(() => moveGroupWithoutDestroying({
8495
+ from: group,
8496
+ to: referenceGroup,
8497
+ }));
8498
+ if (!referenceGroup.api.isVisible) {
8499
+ referenceGroup.api.setVisible(true);
8500
+ }
8501
+ return false;
8469
8502
  }
8503
+ const gready = document.createElement('div');
8504
+ gready.className = 'dv-overlay-render-container';
8505
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8470
8506
  group.model.renderContainer = overlayRenderContainer;
8471
8507
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8472
8508
  let floatingBox;
@@ -8623,7 +8659,7 @@
8623
8659
  return true;
8624
8660
  })
8625
8661
  .catch((err) => {
8626
- console.error('dockview: failed to create popout window', err);
8662
+ console.error('dockview: failed to create popout.', err);
8627
8663
  return false;
8628
8664
  });
8629
8665
  }
@@ -8830,7 +8866,12 @@
8830
8866
  }
8831
8867
  }
8832
8868
  this.updateDropTargetModel(options);
8869
+ const oldDisableDnd = this.options.disableDnd;
8833
8870
  this._options = Object.assign(Object.assign({}, this.options), options);
8871
+ const newDisableDnd = this.options.disableDnd;
8872
+ if (oldDisableDnd !== newDisableDnd) {
8873
+ this.updateDragAndDropState();
8874
+ }
8834
8875
  if ('theme' in options) {
8835
8876
  this.updateTheme();
8836
8877
  }
@@ -8845,6 +8886,12 @@
8845
8886
  }
8846
8887
  }
8847
8888
  }
8889
+ updateDragAndDropState() {
8890
+ // Update draggable state for all tabs and void containers
8891
+ for (const group of this.groups) {
8892
+ group.model.updateDragAndDropState();
8893
+ }
8894
+ }
8848
8895
  focus() {
8849
8896
  var _a;
8850
8897
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();