dockview 4.7.0 → 4.7.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
3
- * @version 4.7.0
3
+ * @version 4.7.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -3838,9 +3838,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3838
3838
  }
3839
3839
 
3840
3840
  class DragHandler extends CompositeDisposable {
3841
- constructor(el) {
3841
+ constructor(el, disabled) {
3842
3842
  super();
3843
3843
  this.el = el;
3844
+ this.disabled = disabled;
3844
3845
  this.dataDisposable = new MutableDisposable();
3845
3846
  this.pointerEventsDisposable = new MutableDisposable();
3846
3847
  this._onDragStart = new Emitter();
@@ -3848,12 +3849,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3848
3849
  this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
3849
3850
  this.configure();
3850
3851
  }
3852
+ setDisabled(disabled) {
3853
+ this.disabled = disabled;
3854
+ }
3851
3855
  isCancelled(_event) {
3852
3856
  return false;
3853
3857
  }
3854
3858
  configure() {
3855
3859
  this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
3856
- if (event.defaultPrevented || this.isCancelled(event)) {
3860
+ if (event.defaultPrevented || this.isCancelled(event) || this.disabled) {
3857
3861
  event.preventDefault();
3858
3862
  return;
3859
3863
  }
@@ -5053,8 +5057,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5053
5057
  }
5054
5058
 
5055
5059
  class TabDragHandler extends DragHandler {
5056
- constructor(element, accessor, group, panel) {
5057
- super(element);
5060
+ constructor(element, accessor, group, panel, disabled) {
5061
+ super(element, disabled);
5058
5062
  this.accessor = accessor;
5059
5063
  this.group = group;
5060
5064
  this.panel = panel;
@@ -5090,7 +5094,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5090
5094
  this._element.tabIndex = 0;
5091
5095
  this._element.draggable = !this.accessor.options.disableDnd;
5092
5096
  toggleClass(this.element, 'dv-inactive-tab', true);
5093
- const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
5097
+ this.dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel, !!this.accessor.options.disableDnd);
5094
5098
  this.dropTarget = new Droptarget(this._element, {
5095
5099
  acceptedTargetZones: ['left', 'right'],
5096
5100
  overlayModel: { activationSize: { value: 50, type: 'percentage' } },
@@ -5107,7 +5111,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5107
5111
  getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
5108
5112
  });
5109
5113
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
5110
- this.addDisposables(this._onPointDown, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
5114
+ this.addDisposables(this._onPointDown, this._onDropped, this._onDragStart, this.dragHandler.onDragStart((event) => {
5111
5115
  if (event.dataTransfer) {
5112
5116
  const style = getComputedStyle(this.element);
5113
5117
  const newNode = this.element.cloneNode(true);
@@ -5119,7 +5123,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5119
5123
  });
5120
5124
  }
5121
5125
  this._onDragStart.fire(event);
5122
- }), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
5126
+ }), this.dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
5123
5127
  this._onPointDown.fire(event);
5124
5128
  }), this.dropTarget.onDrop((event) => {
5125
5129
  this._onDropped.fire(event);
@@ -5138,6 +5142,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5138
5142
  }
5139
5143
  updateDragAndDropState() {
5140
5144
  this._element.draggable = !this.accessor.options.disableDnd;
5145
+ this.dragHandler.setDisabled(!!this.accessor.options.disableDnd);
5141
5146
  }
5142
5147
  dispose() {
5143
5148
  super.dispose();
@@ -5179,8 +5184,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5179
5184
  }
5180
5185
 
5181
5186
  class GroupDragHandler extends DragHandler {
5182
- constructor(element, accessor, group) {
5183
- super(element);
5187
+ constructor(element, accessor, group, disabled) {
5188
+ super(element, disabled);
5184
5189
  this.accessor = accessor;
5185
5190
  this.group = group;
5186
5191
  this.panelTransfer = LocalSelectionTransfer.getInstance();
@@ -5249,7 +5254,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5249
5254
  this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
5250
5255
  this.accessor.doSetGroupActive(this.group);
5251
5256
  }));
5252
- const handler = new GroupDragHandler(this._element, accessor, group);
5257
+ this.handler = new GroupDragHandler(this._element, accessor, group, !!this.accessor.options.disableDnd);
5253
5258
  this.dropTarget = new Droptarget(this._element, {
5254
5259
  acceptedTargetZones: ['center'],
5255
5260
  canDisplayOverlay: (event, position) => {
@@ -5262,7 +5267,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5262
5267
  getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
5263
5268
  });
5264
5269
  this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
5265
- this.addDisposables(handler, handler.onDragStart((event) => {
5270
+ this.addDisposables(this.handler, this.handler.onDragStart((event) => {
5266
5271
  this._onDragStart.fire(event);
5267
5272
  }), this.dropTarget.onDrop((event) => {
5268
5273
  this._onDrop.fire(event);
@@ -5271,6 +5276,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5271
5276
  updateDragAndDropState() {
5272
5277
  this._element.draggable = !this.accessor.options.disableDnd;
5273
5278
  toggleClass(this._element, 'dv-draggable', !this.accessor.options.disableDnd);
5279
+ this.handler.setDisabled(!!this.accessor.options.disableDnd);
5274
5280
  }
5275
5281
  }
5276
5282
 
@@ -9661,11 +9667,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9661
9667
  // remove the group and do not set a new group as active
9662
9668
  this.doRemoveGroup(sourceGroup, { skipActive: true });
9663
9669
  }
9670
+ // Check if destination group is empty - if so, force render the component
9671
+ const isDestinationGroupEmpty = destinationGroup.model.size === 0;
9664
9672
  this.movingLock(() => {
9665
9673
  var _a;
9666
9674
  return destinationGroup.model.openPanel(removedPanel, {
9667
9675
  index: destinationIndex,
9668
- skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
9676
+ skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
9669
9677
  skipSetGroupActive: true,
9670
9678
  });
9671
9679
  });