dockview-core 1.10.0 → 1.10.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 (69) hide show
  1. package/dist/cjs/api/component.api.d.ts +10 -2
  2. package/dist/cjs/api/component.api.js +10 -2
  3. package/dist/cjs/api/dockviewPanelApi.d.ts +1 -0
  4. package/dist/cjs/api/dockviewPanelApi.js +33 -24
  5. package/dist/cjs/api/panelApi.d.ts +4 -13
  6. package/dist/cjs/api/panelApi.js +5 -15
  7. package/dist/cjs/dockview/components/panel/content.js +1 -1
  8. package/dist/cjs/dockview/components/titlebar/voidContainer.js +1 -1
  9. package/dist/cjs/dockview/dockviewComponent.js +15 -7
  10. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +3 -4
  11. package/dist/cjs/dockview/options.d.ts +3 -3
  12. package/dist/cjs/dockview/types.d.ts +0 -1
  13. package/dist/cjs/gridview/gridviewPanel.js +3 -3
  14. package/dist/cjs/lifecycle.d.ts +1 -1
  15. package/dist/cjs/paneview/paneview.d.ts +1 -0
  16. package/dist/cjs/paneview/paneview.js +3 -0
  17. package/dist/cjs/paneview/paneviewComponent.d.ts +2 -0
  18. package/dist/cjs/paneview/paneviewComponent.js +6 -0
  19. package/dist/cjs/paneview/paneviewPanel.d.ts +2 -0
  20. package/dist/cjs/paneview/paneviewPanel.js +5 -1
  21. package/dist/cjs/splitview/splitviewComponent.d.ts +1 -1
  22. package/dist/cjs/splitview/splitviewComponent.js +5 -5
  23. package/dist/cjs/splitview/splitviewPanel.js +3 -3
  24. package/dist/dockview-core.amd.js +90 -58
  25. package/dist/dockview-core.amd.js.map +1 -1
  26. package/dist/dockview-core.amd.min.js +2 -2
  27. package/dist/dockview-core.amd.min.js.map +1 -1
  28. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  29. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  30. package/dist/dockview-core.amd.noStyle.js +90 -58
  31. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  32. package/dist/dockview-core.cjs.js +90 -58
  33. package/dist/dockview-core.cjs.js.map +1 -1
  34. package/dist/dockview-core.esm.js +90 -58
  35. package/dist/dockview-core.esm.js.map +1 -1
  36. package/dist/dockview-core.esm.min.js +2 -2
  37. package/dist/dockview-core.esm.min.js.map +1 -1
  38. package/dist/dockview-core.js +90 -58
  39. package/dist/dockview-core.js.map +1 -1
  40. package/dist/dockview-core.min.js +2 -2
  41. package/dist/dockview-core.min.js.map +1 -1
  42. package/dist/dockview-core.min.noStyle.js +2 -2
  43. package/dist/dockview-core.min.noStyle.js.map +1 -1
  44. package/dist/dockview-core.noStyle.js +90 -58
  45. package/dist/dockview-core.noStyle.js.map +1 -1
  46. package/dist/esm/api/component.api.d.ts +10 -2
  47. package/dist/esm/api/component.api.js +10 -2
  48. package/dist/esm/api/dockviewPanelApi.d.ts +1 -0
  49. package/dist/esm/api/dockviewPanelApi.js +32 -23
  50. package/dist/esm/api/panelApi.d.ts +4 -13
  51. package/dist/esm/api/panelApi.js +5 -11
  52. package/dist/esm/dockview/components/panel/content.js +1 -1
  53. package/dist/esm/dockview/components/titlebar/voidContainer.js +1 -1
  54. package/dist/esm/dockview/dockviewComponent.js +16 -8
  55. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +3 -4
  56. package/dist/esm/dockview/options.d.ts +3 -3
  57. package/dist/esm/dockview/types.d.ts +0 -1
  58. package/dist/esm/gridview/gridviewPanel.js +3 -3
  59. package/dist/esm/lifecycle.d.ts +1 -1
  60. package/dist/esm/paneview/paneview.d.ts +1 -0
  61. package/dist/esm/paneview/paneview.js +3 -0
  62. package/dist/esm/paneview/paneviewComponent.d.ts +2 -0
  63. package/dist/esm/paneview/paneviewComponent.js +6 -0
  64. package/dist/esm/paneview/paneviewPanel.d.ts +2 -0
  65. package/dist/esm/paneview/paneviewPanel.js +5 -1
  66. package/dist/esm/splitview/splitviewComponent.d.ts +1 -1
  67. package/dist/esm/splitview/splitviewComponent.js +5 -5
  68. package/dist/esm/splitview/splitviewPanel.js +3 -3
  69. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.10.0
3
+ * @version 1.10.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -1482,6 +1482,9 @@
1482
1482
  this._onDidChange.fire();
1483
1483
  }));
1484
1484
  }
1485
+ setViewVisible(index, visible) {
1486
+ this.splitview.setViewVisible(index, visible);
1487
+ }
1485
1488
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1486
1489
  const disposable = pane.onDidChangeExpansionState(() => {
1487
1490
  this.setupAnimation();
@@ -2986,19 +2989,27 @@
2986
2989
  return this.component.onWillDrop;
2987
2990
  }
2988
2991
  /**
2992
+ * Invoked before an overlay is shown indicating a drop target.
2989
2993
  *
2994
+ * Calling `event.preventDefault()` will prevent the overlay being shown and prevent
2995
+ * the any subsequent drop event.
2990
2996
  */
2991
2997
  get onWillShowOverlay() {
2992
2998
  return this.component.onWillShowOverlay;
2993
2999
  }
2994
3000
  /**
2995
- * Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
3001
+ * Invoked before a group is dragged.
3002
+ *
3003
+ * Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
3004
+ *
2996
3005
  */
2997
3006
  get onWillDragGroup() {
2998
3007
  return this.component.onWillDragGroup;
2999
3008
  }
3000
3009
  /**
3001
- * Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality.
3010
+ * Invoked before a panel is dragged.
3011
+ *
3012
+ * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
3002
3013
  */
3003
3014
  get onWillDragPanel() {
3004
3015
  return this.component.onWillDragPanel;
@@ -3542,7 +3553,7 @@
3542
3553
  data.groupId === this.group.id;
3543
3554
  return !groupHasOnePanelAndIsActiveDragElement;
3544
3555
  }
3545
- return this.group.canDisplayOverlay(event, position, 'panel');
3556
+ return this.group.canDisplayOverlay(event, position, 'content');
3546
3557
  },
3547
3558
  });
3548
3559
  this.addDisposables(this.dropTarget);
@@ -3865,7 +3876,7 @@
3865
3876
  // don't show the overlay if the tab being dragged is the last panel of this group
3866
3877
  return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
3867
3878
  }
3868
- return group.model.canDisplayOverlay(event, position, 'panel');
3879
+ return group.model.canDisplayOverlay(event, position, 'header_space');
3869
3880
  },
3870
3881
  });
3871
3882
  this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
@@ -4994,9 +5005,6 @@
4994
5005
  get isVisible() {
4995
5006
  return this._isVisible;
4996
5007
  }
4997
- get isHidden() {
4998
- return this._isHidden;
4999
- }
5000
5008
  get width() {
5001
5009
  return this._width;
5002
5010
  }
@@ -5009,7 +5017,6 @@
5009
5017
  this._isFocused = false;
5010
5018
  this._isActive = false;
5011
5019
  this._isVisible = true;
5012
- this._isHidden = false;
5013
5020
  this._width = 0;
5014
5021
  this._height = 0;
5015
5022
  this.panelUpdatesDisposable = new MutableDisposable();
@@ -5023,8 +5030,8 @@
5023
5030
  //
5024
5031
  this._onDidVisibilityChange = new Emitter();
5025
5032
  this.onDidVisibilityChange = this._onDidVisibilityChange.event;
5026
- this._onDidHiddenChange = new Emitter();
5027
- this.onDidHiddenChange = this._onDidHiddenChange.event;
5033
+ this._onWillVisibilityChange = new Emitter();
5034
+ this.onWillVisibilityChange = this._onWillVisibilityChange.event;
5028
5035
  this._onDidActiveChange = new Emitter();
5029
5036
  this.onDidActiveChange = this._onDidActiveChange.event;
5030
5037
  this._onActiveChange = new Emitter();
@@ -5037,12 +5044,10 @@
5037
5044
  this._isActive = event.isActive;
5038
5045
  }), this.onDidVisibilityChange((event) => {
5039
5046
  this._isVisible = event.isVisible;
5040
- }), this.onDidHiddenChange((event) => {
5041
- this._isHidden = event.isHidden;
5042
5047
  }), this.onDidDimensionsChange((event) => {
5043
5048
  this._width = event.width;
5044
5049
  this._height = event.height;
5045
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
5050
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5046
5051
  }
5047
5052
  initialize(panel) {
5048
5053
  this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
@@ -5051,8 +5056,8 @@
5051
5056
  });
5052
5057
  });
5053
5058
  }
5054
- setHidden(isHidden) {
5055
- this._onDidHiddenChange.fire({ isHidden });
5059
+ setVisible(isVisible) {
5060
+ this._onWillVisibilityChange.fire({ isVisible });
5056
5061
  }
5057
5062
  setActive() {
5058
5063
  this._onActiveChange.fire();
@@ -5270,7 +5275,11 @@
5270
5275
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5271
5276
  this._orientation = orientation;
5272
5277
  this.element.classList.add('pane');
5273
- this.addDisposables(this.api.onDidSizeChange((event) => {
5278
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5279
+ const { isVisible } = event;
5280
+ const { accessor } = this._params;
5281
+ accessor.setVisible(this, isVisible);
5282
+ }), this.api.onDidSizeChange((event) => {
5274
5283
  this._onDidChange.fire({ size: event.size });
5275
5284
  }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5276
5285
  this.api._onMouseEnter.fire(ev);
@@ -5574,10 +5583,10 @@
5574
5583
  this._maximumHeight = options.maximumHeight;
5575
5584
  }
5576
5585
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
5577
- this.addDisposables(this.api.onDidHiddenChange((event) => {
5578
- const { isHidden } = event;
5586
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5587
+ const { isVisible } = event;
5579
5588
  const { accessor } = this._params;
5580
- accessor.setVisible(this, !isHidden);
5589
+ accessor.setVisible(this, isVisible);
5581
5590
  }), this.api.onActiveChange(() => {
5582
5591
  const { accessor } = this._params;
5583
5592
  accessor.doSetGroupActive(this);
@@ -5818,32 +5827,11 @@
5818
5827
  return this.panel.renderer;
5819
5828
  }
5820
5829
  set group(value) {
5821
- const isOldGroupActive = this.isGroupActive;
5830
+ const oldGroup = this._group;
5822
5831
  if (this._group !== value) {
5823
5832
  this._group = value;
5824
5833
  this._onDidGroupChange.fire({});
5825
- let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
5826
- this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
5827
- if (this.group !== this.panel.group) {
5828
- return;
5829
- }
5830
- this._onDidLocationChange.fire(event);
5831
- }), this.group.api.onDidActiveChange(() => {
5832
- if (this.group !== this.panel.group) {
5833
- return;
5834
- }
5835
- if (_trackGroupActive !== this.isGroupActive) {
5836
- _trackGroupActive = this.isGroupActive;
5837
- this._onDidActiveGroupChange.fire({
5838
- isActive: this.isGroupActive,
5839
- });
5840
- }
5841
- }));
5842
- // if (this.isGroupActive !== isOldGroupActive) {
5843
- // this._onDidActiveGroupChange.fire({
5844
- // isActive: this.isGroupActive,
5845
- // });
5846
- // }
5834
+ this.setupGroupEventListeners(oldGroup);
5847
5835
  this._onDidLocationChange.fire({
5848
5836
  location: this.group.api.location,
5849
5837
  });
@@ -5869,6 +5857,7 @@
5869
5857
  this.groupEventsDisposable = new MutableDisposable();
5870
5858
  this.initialize(panel);
5871
5859
  this._group = group;
5860
+ this.setupGroupEventListeners();
5872
5861
  this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
5873
5862
  }
5874
5863
  getWindow() {
@@ -5903,6 +5892,35 @@
5903
5892
  exitMaximized() {
5904
5893
  this.group.api.exitMaximized();
5905
5894
  }
5895
+ setupGroupEventListeners(previousGroup) {
5896
+ var _a;
5897
+ let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
5898
+ this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
5899
+ if (!event.isVisible && this.isVisible) {
5900
+ this._onDidVisibilityChange.fire(event);
5901
+ }
5902
+ else if (event.isVisible &&
5903
+ !this.isVisible &&
5904
+ this.group.model.isPanelActive(this.panel)) {
5905
+ this._onDidVisibilityChange.fire(event);
5906
+ }
5907
+ }), this.group.api.onDidLocationChange((event) => {
5908
+ if (this.group !== this.panel.group) {
5909
+ return;
5910
+ }
5911
+ this._onDidLocationChange.fire(event);
5912
+ }), this.group.api.onDidActiveChange(() => {
5913
+ if (this.group !== this.panel.group) {
5914
+ return;
5915
+ }
5916
+ if (_trackGroupActive !== this.isGroupActive) {
5917
+ _trackGroupActive = this.isGroupActive;
5918
+ this._onDidActiveGroupChange.fire({
5919
+ isActive: this.isGroupActive,
5920
+ });
5921
+ }
5922
+ }));
5923
+ }
5906
5924
  }
5907
5925
 
5908
5926
  class DockviewPanel extends CompositeDisposable {
@@ -7083,7 +7101,15 @@
7083
7101
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
7084
7102
  overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
7085
7103
  });
7086
- this.addDisposables(this._rootDropTarget.onDrop((event) => {
7104
+ this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
7105
+ if (this.gridview.length > 0 && event.position === 'center') {
7106
+ // option only available when no panels in primary grid
7107
+ return;
7108
+ }
7109
+ this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
7110
+ kind: 'edge',
7111
+ }));
7112
+ }), this._rootDropTarget.onDrop((event) => {
7087
7113
  var _a;
7088
7114
  const willDropEvent = new DockviewWillDropEvent({
7089
7115
  nativeEvent: event.nativeEvent,
@@ -7092,7 +7118,7 @@
7092
7118
  api: this._api,
7093
7119
  group: undefined,
7094
7120
  getData: getPanelData,
7095
- kind: 'content',
7121
+ kind: 'edge',
7096
7122
  });
7097
7123
  this._onWillDrop.fire(willDropEvent);
7098
7124
  if (willDropEvent.defaultPrevented) {
@@ -7148,7 +7174,7 @@
7148
7174
  const box = getBox();
7149
7175
  const groupId = (_b = (_a = options === null || options === void 0 ? void 0 : options.overridePopoutGroup) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this.getNextGroupId(); //item.id;
7150
7176
  if (itemToPopout.api.location.type === 'grid') {
7151
- itemToPopout.api.setHidden(true);
7177
+ itemToPopout.api.setVisible(false);
7152
7178
  }
7153
7179
  const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
7154
7180
  theme !== null && theme !== void 0 ? theme : '', {
@@ -7199,7 +7225,7 @@
7199
7225
  }));
7200
7226
  switch (referenceLocation) {
7201
7227
  case 'grid':
7202
- referenceGroup.api.setHidden(true);
7228
+ referenceGroup.api.setVisible(false);
7203
7229
  break;
7204
7230
  case 'floating':
7205
7231
  case 'popout':
@@ -7253,8 +7279,8 @@
7253
7279
  from: group,
7254
7280
  to: referenceGroup,
7255
7281
  }));
7256
- if (referenceGroup.api.isHidden) {
7257
- referenceGroup.api.setHidden(false);
7282
+ if (!referenceGroup.api.isVisible) {
7283
+ referenceGroup.api.setVisible(true);
7258
7284
  }
7259
7285
  if (this.getPanel(group.id)) {
7260
7286
  this.doRemoveGroup(group, {
@@ -7827,7 +7853,7 @@
7827
7853
  }
7828
7854
  updateWatermark() {
7829
7855
  var _a, _b;
7830
- if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
7856
+ if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
7831
7857
  if (!this.watermark) {
7832
7858
  this.watermark = this.createWatermarkComponent();
7833
7859
  this.watermark.init({
@@ -8610,19 +8636,19 @@
8610
8636
  const index = this.panels.indexOf(panel);
8611
8637
  this.splitview.setViewVisible(index, visible);
8612
8638
  }
8613
- setActive(view, skipFocus) {
8614
- this._activePanel = view;
8639
+ setActive(panel, skipFocus) {
8640
+ this._activePanel = panel;
8615
8641
  this.panels
8616
- .filter((v) => v !== view)
8642
+ .filter((v) => v !== panel)
8617
8643
  .forEach((v) => {
8618
8644
  v.api._onDidActiveChange.fire({ isActive: false });
8619
8645
  if (!skipFocus) {
8620
8646
  v.focus();
8621
8647
  }
8622
8648
  });
8623
- view.api._onDidActiveChange.fire({ isActive: true });
8649
+ panel.api._onDidActiveChange.fire({ isActive: true });
8624
8650
  if (!skipFocus) {
8625
- view.focus();
8651
+ panel.focus();
8626
8652
  }
8627
8653
  }
8628
8654
  removePanel(panel, sizing) {
@@ -8921,6 +8947,10 @@
8921
8947
  });
8922
8948
  this.addDisposables(this._disposable);
8923
8949
  }
8950
+ setVisible(panel, visible) {
8951
+ const index = this.panels.indexOf(panel);
8952
+ this.paneview.setViewVisible(index, visible);
8953
+ }
8924
8954
  focus() {
8925
8955
  //noop
8926
8956
  }
@@ -8967,6 +8997,7 @@
8967
8997
  isExpanded: options.isExpanded,
8968
8998
  title: options.title,
8969
8999
  containerApi: new PaneviewApi(this),
9000
+ accessor: this,
8970
9001
  });
8971
9002
  this.paneview.addPane(view, size, index);
8972
9003
  view.orientation = this.paneview.orientation;
@@ -9066,6 +9097,7 @@
9066
9097
  title: data.title,
9067
9098
  isExpanded: !!view.expanded,
9068
9099
  containerApi: new PaneviewApi(this),
9100
+ accessor: this,
9069
9101
  });
9070
9102
  panel.orientation = this.paneview.orientation;
9071
9103
  });
@@ -9154,10 +9186,10 @@
9154
9186
  this._onDidChange = new Emitter();
9155
9187
  this.onDidChange = this._onDidChange.event;
9156
9188
  this.api.initialize(this);
9157
- this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
9158
- const { isHidden } = event;
9189
+ this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
9190
+ const { isVisible } = event;
9159
9191
  const { accessor } = this._params;
9160
- accessor.setVisible(this, !isHidden);
9192
+ accessor.setVisible(this, isVisible);
9161
9193
  }), this.api.onActiveChange(() => {
9162
9194
  const { accessor } = this._params;
9163
9195
  accessor.setActive(this);