dockview-react 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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 4.3.1
3
+ * @version 4.4.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3622,6 +3622,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3622
3622
  get onDidPopoutGroupPositionChange() {
3623
3623
  return this.component.onDidPopoutGroupPositionChange;
3624
3624
  }
3625
+ get onDidOpenPopoutWindowFail() {
3626
+ return this.component.onDidOpenPopoutWindowFail;
3627
+ }
3625
3628
  /**
3626
3629
  * All panel objects.
3627
3630
  */
@@ -4990,7 +4993,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4990
4993
  this._element = document.createElement('div');
4991
4994
  this._element.className = 'dv-tab';
4992
4995
  this._element.tabIndex = 0;
4993
- this._element.draggable = true;
4996
+ this._element.draggable = !this.accessor.options.disableDnd;
4994
4997
  toggleClass(this.element, 'dv-inactive-tab', true);
4995
4998
  const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
4996
4999
  this.dropTarget = new Droptarget(this._element, {
@@ -5038,6 +5041,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5038
5041
  this.content = part;
5039
5042
  this._element.appendChild(this.content.element);
5040
5043
  }
5044
+ updateDragAndDropState() {
5045
+ this._element.draggable = !this.accessor.options.disableDnd;
5046
+ }
5041
5047
  dispose() {
5042
5048
  super.dispose();
5043
5049
  }
@@ -5109,7 +5115,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5109
5115
  this.onDragStart = this._onDragStart.event;
5110
5116
  this._element = document.createElement('div');
5111
5117
  this._element.className = 'dv-void-container';
5112
- this._element.draggable = true;
5118
+ this._element.draggable = !this.accessor.options.disableDnd;
5113
5119
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5114
5120
  this.accessor.doSetGroupActive(this.group);
5115
5121
  }));
@@ -5132,6 +5138,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5132
5138
  this._onDrop.fire(event);
5133
5139
  }), this.dropTarget);
5134
5140
  }
5141
+ updateDragAndDropState() {
5142
+ this._element.draggable = !this.accessor.options.disableDnd;
5143
+ }
5135
5144
  }
5136
5145
 
5137
5146
  class Scrollbar extends CompositeDisposable {
@@ -5392,6 +5401,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5392
5401
  .map((x) => x.value.panel.id);
5393
5402
  this._onOverflowTabsChange.fire({ tabs, reset: options.reset });
5394
5403
  }
5404
+ updateDragAndDropState() {
5405
+ for (const tab of this._tabs) {
5406
+ tab.value.updateDragAndDropState();
5407
+ }
5408
+ }
5395
5409
  }
5396
5410
 
5397
5411
  const createSvgElementFromPath = (params) => {
@@ -5664,6 +5678,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5664
5678
  });
5665
5679
  }));
5666
5680
  }
5681
+ updateDragAndDropState() {
5682
+ this.tabs.updateDragAndDropState();
5683
+ this.voidContainer.updateDragAndDropState();
5684
+ }
5667
5685
  }
5668
5686
 
5669
5687
  class DockviewUnhandledDragOverEvent extends AcceptableEvent {
@@ -6369,6 +6387,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6369
6387
  }));
6370
6388
  }
6371
6389
  }
6390
+ updateDragAndDropState() {
6391
+ this.tabsContainer.updateDragAndDropState();
6392
+ }
6372
6393
  dispose() {
6373
6394
  var _a, _b, _c;
6374
6395
  super.dispose();
@@ -8201,6 +8222,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8201
8222
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8202
8223
  this._onDidPopoutGroupPositionChange = new Emitter();
8203
8224
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8225
+ this._onDidOpenPopoutWindowFail = new Emitter();
8226
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8204
8227
  this._onDidLayoutFromJSON = new Emitter();
8205
8228
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8206
8229
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8265,7 +8288,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8265
8288
  if (options.debug) {
8266
8289
  this.addDisposables(new StrictEventsSequencing(this));
8267
8290
  }
8268
- 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(() => {
8291
+ 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(() => {
8269
8292
  this.updateWatermark();
8270
8293
  }), this.onDidAdd((event) => {
8271
8294
  if (!this._moving) {
@@ -8411,13 +8434,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8411
8434
  if (_window.isDisposed) {
8412
8435
  return false;
8413
8436
  }
8414
- if (popoutContainer === null) {
8415
- popoutWindowDisposable.dispose();
8416
- return false;
8417
- }
8418
- const gready = document.createElement('div');
8419
- gready.className = 'dv-overlay-render-container';
8420
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8421
8437
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8422
8438
  ? options.referenceGroup
8423
8439
  : itemToPopout instanceof DockviewPanel
@@ -8425,7 +8441,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8425
8441
  : itemToPopout;
8426
8442
  const referenceLocation = itemToPopout.api.location.type;
8427
8443
  /**
8428
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8444
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8429
8445
  * of this case is when being called from the `fromJSON(...)` method
8430
8446
  */
8431
8447
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8438,8 +8454,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8438
8454
  }
8439
8455
  else {
8440
8456
  group = this.createGroup({ id: groupId });
8441
- this._onDidAddGroup.fire(group);
8457
+ if (popoutContainer) {
8458
+ this._onDidAddGroup.fire(group);
8459
+ }
8460
+ }
8461
+ if (popoutContainer === null) {
8462
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8463
+ popoutWindowDisposable.dispose();
8464
+ this._onDidOpenPopoutWindowFail.fire();
8465
+ // if the popout window was blocked, we need to move the group back to the reference group
8466
+ // and set it to visible
8467
+ this.movingLock(() => moveGroupWithoutDestroying({
8468
+ from: group,
8469
+ to: referenceGroup,
8470
+ }));
8471
+ if (!referenceGroup.api.isVisible) {
8472
+ referenceGroup.api.setVisible(true);
8473
+ }
8474
+ return false;
8442
8475
  }
8476
+ const gready = document.createElement('div');
8477
+ gready.className = 'dv-overlay-render-container';
8478
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8443
8479
  group.model.renderContainer = overlayRenderContainer;
8444
8480
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8445
8481
  let floatingBox;
@@ -8596,7 +8632,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8596
8632
  return true;
8597
8633
  })
8598
8634
  .catch((err) => {
8599
- console.error('dockview: failed to create popout window', err);
8635
+ console.error('dockview: failed to create popout.', err);
8600
8636
  return false;
8601
8637
  });
8602
8638
  }
@@ -8803,7 +8839,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8803
8839
  }
8804
8840
  }
8805
8841
  this.updateDropTargetModel(options);
8842
+ const oldDisableDnd = this.options.disableDnd;
8806
8843
  this._options = Object.assign(Object.assign({}, this.options), options);
8844
+ const newDisableDnd = this.options.disableDnd;
8845
+ if (oldDisableDnd !== newDisableDnd) {
8846
+ this.updateDragAndDropState();
8847
+ }
8807
8848
  if ('theme' in options) {
8808
8849
  this.updateTheme();
8809
8850
  }
@@ -8818,6 +8859,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8818
8859
  }
8819
8860
  }
8820
8861
  }
8862
+ updateDragAndDropState() {
8863
+ // Update draggable state for all tabs and void containers
8864
+ for (const group of this.groups) {
8865
+ group.model.updateDragAndDropState();
8866
+ }
8867
+ }
8821
8868
  focus() {
8822
8869
  var _a;
8823
8870
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();