dockview 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
  import React from 'react';
2
2
  import { IDockviewPanelHeaderProps } from 'dockview-core';
3
- export type IDockviewDefaultTabProps = IDockviewPanelHeaderProps & React.DOMAttributes<HTMLDivElement> & {
3
+ export type IDockviewDefaultTabProps = IDockviewPanelHeaderProps & React.HtmlHTMLAttributes<HTMLDivElement> & {
4
4
  hideClose?: boolean;
5
5
  closeActionOverride?: () => void;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
3
- * @version 4.3.1
3
+ * @version 4.4.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3652,6 +3652,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3652
3652
  get onDidPopoutGroupPositionChange() {
3653
3653
  return this.component.onDidPopoutGroupPositionChange;
3654
3654
  }
3655
+ get onDidOpenPopoutWindowFail() {
3656
+ return this.component.onDidOpenPopoutWindowFail;
3657
+ }
3655
3658
  /**
3656
3659
  * All panel objects.
3657
3660
  */
@@ -5020,7 +5023,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5020
5023
  this._element = document.createElement('div');
5021
5024
  this._element.className = 'dv-tab';
5022
5025
  this._element.tabIndex = 0;
5023
- this._element.draggable = true;
5026
+ this._element.draggable = !this.accessor.options.disableDnd;
5024
5027
  toggleClass(this.element, 'dv-inactive-tab', true);
5025
5028
  const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
5026
5029
  this.dropTarget = new Droptarget(this._element, {
@@ -5068,6 +5071,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5068
5071
  this.content = part;
5069
5072
  this._element.appendChild(this.content.element);
5070
5073
  }
5074
+ updateDragAndDropState() {
5075
+ this._element.draggable = !this.accessor.options.disableDnd;
5076
+ }
5071
5077
  dispose() {
5072
5078
  super.dispose();
5073
5079
  }
@@ -5139,7 +5145,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5139
5145
  this.onDragStart = this._onDragStart.event;
5140
5146
  this._element = document.createElement('div');
5141
5147
  this._element.className = 'dv-void-container';
5142
- this._element.draggable = true;
5148
+ this._element.draggable = !this.accessor.options.disableDnd;
5143
5149
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5144
5150
  this.accessor.doSetGroupActive(this.group);
5145
5151
  }));
@@ -5162,6 +5168,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5162
5168
  this._onDrop.fire(event);
5163
5169
  }), this.dropTarget);
5164
5170
  }
5171
+ updateDragAndDropState() {
5172
+ this._element.draggable = !this.accessor.options.disableDnd;
5173
+ }
5165
5174
  }
5166
5175
 
5167
5176
  class Scrollbar extends CompositeDisposable {
@@ -5422,6 +5431,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5422
5431
  .map((x) => x.value.panel.id);
5423
5432
  this._onOverflowTabsChange.fire({ tabs, reset: options.reset });
5424
5433
  }
5434
+ updateDragAndDropState() {
5435
+ for (const tab of this._tabs) {
5436
+ tab.value.updateDragAndDropState();
5437
+ }
5438
+ }
5425
5439
  }
5426
5440
 
5427
5441
  const createSvgElementFromPath = (params) => {
@@ -5694,6 +5708,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5694
5708
  });
5695
5709
  }));
5696
5710
  }
5711
+ updateDragAndDropState() {
5712
+ this.tabs.updateDragAndDropState();
5713
+ this.voidContainer.updateDragAndDropState();
5714
+ }
5697
5715
  }
5698
5716
 
5699
5717
  class DockviewUnhandledDragOverEvent extends AcceptableEvent {
@@ -6399,6 +6417,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
6399
6417
  }));
6400
6418
  }
6401
6419
  }
6420
+ updateDragAndDropState() {
6421
+ this.tabsContainer.updateDragAndDropState();
6422
+ }
6402
6423
  dispose() {
6403
6424
  var _a, _b, _c;
6404
6425
  super.dispose();
@@ -8231,6 +8252,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8231
8252
  this.onDidPopoutGroupSizeChange = this._onDidPopoutGroupSizeChange.event;
8232
8253
  this._onDidPopoutGroupPositionChange = new Emitter();
8233
8254
  this.onDidPopoutGroupPositionChange = this._onDidPopoutGroupPositionChange.event;
8255
+ this._onDidOpenPopoutWindowFail = new Emitter();
8256
+ this.onDidOpenPopoutWindowFail = this._onDidOpenPopoutWindowFail.event;
8234
8257
  this._onDidLayoutFromJSON = new Emitter();
8235
8258
  this.onDidLayoutFromJSON = this._onDidLayoutFromJSON.event;
8236
8259
  this._onDidActivePanelChange = new Emitter({ replay: true });
@@ -8295,7 +8318,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8295
8318
  if (options.debug) {
8296
8319
  this.addDisposables(new StrictEventsSequencing(this));
8297
8320
  }
8298
- 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(() => {
8321
+ 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(() => {
8299
8322
  this.updateWatermark();
8300
8323
  }), this.onDidAdd((event) => {
8301
8324
  if (!this._moving) {
@@ -8441,13 +8464,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8441
8464
  if (_window.isDisposed) {
8442
8465
  return false;
8443
8466
  }
8444
- if (popoutContainer === null) {
8445
- popoutWindowDisposable.dispose();
8446
- return false;
8447
- }
8448
- const gready = document.createElement('div');
8449
- gready.className = 'dv-overlay-render-container';
8450
- const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8451
8467
  const referenceGroup = (options === null || options === void 0 ? void 0 : options.referenceGroup)
8452
8468
  ? options.referenceGroup
8453
8469
  : itemToPopout instanceof DockviewPanel
@@ -8455,7 +8471,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8455
8471
  : itemToPopout;
8456
8472
  const referenceLocation = itemToPopout.api.location.type;
8457
8473
  /**
8458
- * The group that is being added doesn't already exist within the DOM, the most likely occurance
8474
+ * The group that is being added doesn't already exist within the DOM, the most likely occurrence
8459
8475
  * of this case is when being called from the `fromJSON(...)` method
8460
8476
  */
8461
8477
  const isGroupAddedToDom = referenceGroup.element.parentElement !== null;
@@ -8468,8 +8484,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8468
8484
  }
8469
8485
  else {
8470
8486
  group = this.createGroup({ id: groupId });
8471
- this._onDidAddGroup.fire(group);
8487
+ if (popoutContainer) {
8488
+ this._onDidAddGroup.fire(group);
8489
+ }
8490
+ }
8491
+ if (popoutContainer === null) {
8492
+ console.error('dockview: failed to create popout. perhaps you need to allow pop-ups for this website');
8493
+ popoutWindowDisposable.dispose();
8494
+ this._onDidOpenPopoutWindowFail.fire();
8495
+ // if the popout window was blocked, we need to move the group back to the reference group
8496
+ // and set it to visible
8497
+ this.movingLock(() => moveGroupWithoutDestroying({
8498
+ from: group,
8499
+ to: referenceGroup,
8500
+ }));
8501
+ if (!referenceGroup.api.isVisible) {
8502
+ referenceGroup.api.setVisible(true);
8503
+ }
8504
+ return false;
8472
8505
  }
8506
+ const gready = document.createElement('div');
8507
+ gready.className = 'dv-overlay-render-container';
8508
+ const overlayRenderContainer = new OverlayRenderContainer(gready, this);
8473
8509
  group.model.renderContainer = overlayRenderContainer;
8474
8510
  group.layout(_window.window.innerWidth, _window.window.innerHeight);
8475
8511
  let floatingBox;
@@ -8626,7 +8662,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8626
8662
  return true;
8627
8663
  })
8628
8664
  .catch((err) => {
8629
- console.error('dockview: failed to create popout window', err);
8665
+ console.error('dockview: failed to create popout.', err);
8630
8666
  return false;
8631
8667
  });
8632
8668
  }
@@ -8833,7 +8869,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8833
8869
  }
8834
8870
  }
8835
8871
  this.updateDropTargetModel(options);
8872
+ const oldDisableDnd = this.options.disableDnd;
8836
8873
  this._options = Object.assign(Object.assign({}, this.options), options);
8874
+ const newDisableDnd = this.options.disableDnd;
8875
+ if (oldDisableDnd !== newDisableDnd) {
8876
+ this.updateDragAndDropState();
8877
+ }
8837
8878
  if ('theme' in options) {
8838
8879
  this.updateTheme();
8839
8880
  }
@@ -8848,6 +8889,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8848
8889
  }
8849
8890
  }
8850
8891
  }
8892
+ updateDragAndDropState() {
8893
+ // Update draggable state for all tabs and void containers
8894
+ for (const group of this.groups) {
8895
+ group.model.updateDragAndDropState();
8896
+ }
8897
+ }
8851
8898
  focus() {
8852
8899
  var _a;
8853
8900
  (_a = this.activeGroup) === null || _a === void 0 ? void 0 : _a.focus();