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
  */
@@ -1452,6 +1452,9 @@
1452
1452
  this._onDidChange.fire();
1453
1453
  }));
1454
1454
  }
1455
+ setViewVisible(index, visible) {
1456
+ this.splitview.setViewVisible(index, visible);
1457
+ }
1455
1458
  addPane(pane, size, index = this.splitview.length, skipLayout = false) {
1456
1459
  const disposable = pane.onDidChangeExpansionState(() => {
1457
1460
  this.setupAnimation();
@@ -2956,19 +2959,27 @@
2956
2959
  return this.component.onWillDrop;
2957
2960
  }
2958
2961
  /**
2962
+ * Invoked before an overlay is shown indicating a drop target.
2959
2963
  *
2964
+ * Calling `event.preventDefault()` will prevent the overlay being shown and prevent
2965
+ * the any subsequent drop event.
2960
2966
  */
2961
2967
  get onWillShowOverlay() {
2962
2968
  return this.component.onWillShowOverlay;
2963
2969
  }
2964
2970
  /**
2965
- * Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality.
2971
+ * Invoked before a group is dragged.
2972
+ *
2973
+ * Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting.
2974
+ *
2966
2975
  */
2967
2976
  get onWillDragGroup() {
2968
2977
  return this.component.onWillDragGroup;
2969
2978
  }
2970
2979
  /**
2971
- * Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality.
2980
+ * Invoked before a panel is dragged.
2981
+ *
2982
+ * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
2972
2983
  */
2973
2984
  get onWillDragPanel() {
2974
2985
  return this.component.onWillDragPanel;
@@ -3512,7 +3523,7 @@
3512
3523
  data.groupId === this.group.id;
3513
3524
  return !groupHasOnePanelAndIsActiveDragElement;
3514
3525
  }
3515
- return this.group.canDisplayOverlay(event, position, 'panel');
3526
+ return this.group.canDisplayOverlay(event, position, 'content');
3516
3527
  },
3517
3528
  });
3518
3529
  this.addDisposables(this.dropTarget);
@@ -3835,7 +3846,7 @@
3835
3846
  // don't show the overlay if the tab being dragged is the last panel of this group
3836
3847
  return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
3837
3848
  }
3838
- return group.model.canDisplayOverlay(event, position, 'panel');
3849
+ return group.model.canDisplayOverlay(event, position, 'header_space');
3839
3850
  },
3840
3851
  });
3841
3852
  this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
@@ -4964,9 +4975,6 @@
4964
4975
  get isVisible() {
4965
4976
  return this._isVisible;
4966
4977
  }
4967
- get isHidden() {
4968
- return this._isHidden;
4969
- }
4970
4978
  get width() {
4971
4979
  return this._width;
4972
4980
  }
@@ -4979,7 +4987,6 @@
4979
4987
  this._isFocused = false;
4980
4988
  this._isActive = false;
4981
4989
  this._isVisible = true;
4982
- this._isHidden = false;
4983
4990
  this._width = 0;
4984
4991
  this._height = 0;
4985
4992
  this.panelUpdatesDisposable = new MutableDisposable();
@@ -4993,8 +5000,8 @@
4993
5000
  //
4994
5001
  this._onDidVisibilityChange = new Emitter();
4995
5002
  this.onDidVisibilityChange = this._onDidVisibilityChange.event;
4996
- this._onDidHiddenChange = new Emitter();
4997
- this.onDidHiddenChange = this._onDidHiddenChange.event;
5003
+ this._onWillVisibilityChange = new Emitter();
5004
+ this.onWillVisibilityChange = this._onWillVisibilityChange.event;
4998
5005
  this._onDidActiveChange = new Emitter();
4999
5006
  this.onDidActiveChange = this._onDidActiveChange.event;
5000
5007
  this._onActiveChange = new Emitter();
@@ -5007,12 +5014,10 @@
5007
5014
  this._isActive = event.isActive;
5008
5015
  }), this.onDidVisibilityChange((event) => {
5009
5016
  this._isVisible = event.isVisible;
5010
- }), this.onDidHiddenChange((event) => {
5011
- this._isHidden = event.isHidden;
5012
5017
  }), this.onDidDimensionsChange((event) => {
5013
5018
  this._width = event.width;
5014
5019
  this._height = event.height;
5015
- }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters);
5020
+ }), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters);
5016
5021
  }
5017
5022
  initialize(panel) {
5018
5023
  this.panelUpdatesDisposable.value = this._onUpdateParameters.event((parameters) => {
@@ -5021,8 +5026,8 @@
5021
5026
  });
5022
5027
  });
5023
5028
  }
5024
- setHidden(isHidden) {
5025
- this._onDidHiddenChange.fire({ isHidden });
5029
+ setVisible(isVisible) {
5030
+ this._onWillVisibilityChange.fire({ isVisible });
5026
5031
  }
5027
5032
  setActive() {
5028
5033
  this._onActiveChange.fire();
@@ -5240,7 +5245,11 @@
5240
5245
  this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
5241
5246
  this._orientation = orientation;
5242
5247
  this.element.classList.add('pane');
5243
- this.addDisposables(this.api.onDidSizeChange((event) => {
5248
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5249
+ const { isVisible } = event;
5250
+ const { accessor } = this._params;
5251
+ accessor.setVisible(this, isVisible);
5252
+ }), this.api.onDidSizeChange((event) => {
5244
5253
  this._onDidChange.fire({ size: event.size });
5245
5254
  }), addDisposableListener(this.element, 'mouseenter', (ev) => {
5246
5255
  this.api._onMouseEnter.fire(ev);
@@ -5544,10 +5553,10 @@
5544
5553
  this._maximumHeight = options.maximumHeight;
5545
5554
  }
5546
5555
  this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement
5547
- this.addDisposables(this.api.onDidHiddenChange((event) => {
5548
- const { isHidden } = event;
5556
+ this.addDisposables(this.api.onWillVisibilityChange((event) => {
5557
+ const { isVisible } = event;
5549
5558
  const { accessor } = this._params;
5550
- accessor.setVisible(this, !isHidden);
5559
+ accessor.setVisible(this, isVisible);
5551
5560
  }), this.api.onActiveChange(() => {
5552
5561
  const { accessor } = this._params;
5553
5562
  accessor.doSetGroupActive(this);
@@ -5788,32 +5797,11 @@
5788
5797
  return this.panel.renderer;
5789
5798
  }
5790
5799
  set group(value) {
5791
- const isOldGroupActive = this.isGroupActive;
5800
+ const oldGroup = this._group;
5792
5801
  if (this._group !== value) {
5793
5802
  this._group = value;
5794
5803
  this._onDidGroupChange.fire({});
5795
- let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state
5796
- this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => {
5797
- if (this.group !== this.panel.group) {
5798
- return;
5799
- }
5800
- this._onDidLocationChange.fire(event);
5801
- }), this.group.api.onDidActiveChange(() => {
5802
- if (this.group !== this.panel.group) {
5803
- return;
5804
- }
5805
- if (_trackGroupActive !== this.isGroupActive) {
5806
- _trackGroupActive = this.isGroupActive;
5807
- this._onDidActiveGroupChange.fire({
5808
- isActive: this.isGroupActive,
5809
- });
5810
- }
5811
- }));
5812
- // if (this.isGroupActive !== isOldGroupActive) {
5813
- // this._onDidActiveGroupChange.fire({
5814
- // isActive: this.isGroupActive,
5815
- // });
5816
- // }
5804
+ this.setupGroupEventListeners(oldGroup);
5817
5805
  this._onDidLocationChange.fire({
5818
5806
  location: this.group.api.location,
5819
5807
  });
@@ -5839,6 +5827,7 @@
5839
5827
  this.groupEventsDisposable = new MutableDisposable();
5840
5828
  this.initialize(panel);
5841
5829
  this._group = group;
5830
+ this.setupGroupEventListeners();
5842
5831
  this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange);
5843
5832
  }
5844
5833
  getWindow() {
@@ -5873,6 +5862,35 @@
5873
5862
  exitMaximized() {
5874
5863
  this.group.api.exitMaximized();
5875
5864
  }
5865
+ setupGroupEventListeners(previousGroup) {
5866
+ var _a;
5867
+ let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state
5868
+ this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => {
5869
+ if (!event.isVisible && this.isVisible) {
5870
+ this._onDidVisibilityChange.fire(event);
5871
+ }
5872
+ else if (event.isVisible &&
5873
+ !this.isVisible &&
5874
+ this.group.model.isPanelActive(this.panel)) {
5875
+ this._onDidVisibilityChange.fire(event);
5876
+ }
5877
+ }), this.group.api.onDidLocationChange((event) => {
5878
+ if (this.group !== this.panel.group) {
5879
+ return;
5880
+ }
5881
+ this._onDidLocationChange.fire(event);
5882
+ }), this.group.api.onDidActiveChange(() => {
5883
+ if (this.group !== this.panel.group) {
5884
+ return;
5885
+ }
5886
+ if (_trackGroupActive !== this.isGroupActive) {
5887
+ _trackGroupActive = this.isGroupActive;
5888
+ this._onDidActiveGroupChange.fire({
5889
+ isActive: this.isGroupActive,
5890
+ });
5891
+ }
5892
+ }));
5893
+ }
5876
5894
  }
5877
5895
 
5878
5896
  class DockviewPanel extends CompositeDisposable {
@@ -7053,7 +7071,15 @@
7053
7071
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
7054
7072
  overlayModel: (_b = this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
7055
7073
  });
7056
- this.addDisposables(this._rootDropTarget.onDrop((event) => {
7074
+ this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
7075
+ if (this.gridview.length > 0 && event.position === 'center') {
7076
+ // option only available when no panels in primary grid
7077
+ return;
7078
+ }
7079
+ this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
7080
+ kind: 'edge',
7081
+ }));
7082
+ }), this._rootDropTarget.onDrop((event) => {
7057
7083
  var _a;
7058
7084
  const willDropEvent = new DockviewWillDropEvent({
7059
7085
  nativeEvent: event.nativeEvent,
@@ -7062,7 +7088,7 @@
7062
7088
  api: this._api,
7063
7089
  group: undefined,
7064
7090
  getData: getPanelData,
7065
- kind: 'content',
7091
+ kind: 'edge',
7066
7092
  });
7067
7093
  this._onWillDrop.fire(willDropEvent);
7068
7094
  if (willDropEvent.defaultPrevented) {
@@ -7118,7 +7144,7 @@
7118
7144
  const box = getBox();
7119
7145
  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;
7120
7146
  if (itemToPopout.api.location.type === 'grid') {
7121
- itemToPopout.api.setHidden(true);
7147
+ itemToPopout.api.setVisible(false);
7122
7148
  }
7123
7149
  const _window = new PopoutWindow(`${this.id}-${groupId}`, // unique id
7124
7150
  theme !== null && theme !== void 0 ? theme : '', {
@@ -7169,7 +7195,7 @@
7169
7195
  }));
7170
7196
  switch (referenceLocation) {
7171
7197
  case 'grid':
7172
- referenceGroup.api.setHidden(true);
7198
+ referenceGroup.api.setVisible(false);
7173
7199
  break;
7174
7200
  case 'floating':
7175
7201
  case 'popout':
@@ -7223,8 +7249,8 @@
7223
7249
  from: group,
7224
7250
  to: referenceGroup,
7225
7251
  }));
7226
- if (referenceGroup.api.isHidden) {
7227
- referenceGroup.api.setHidden(false);
7252
+ if (!referenceGroup.api.isVisible) {
7253
+ referenceGroup.api.setVisible(true);
7228
7254
  }
7229
7255
  if (this.getPanel(group.id)) {
7230
7256
  this.doRemoveGroup(group, {
@@ -7797,7 +7823,7 @@
7797
7823
  }
7798
7824
  updateWatermark() {
7799
7825
  var _a, _b;
7800
- if (this.groups.filter((x) => x.api.location.type === 'grid' && !x.api.isHidden).length === 0) {
7826
+ if (this.groups.filter((x) => x.api.location.type === 'grid' && x.api.isVisible).length === 0) {
7801
7827
  if (!this.watermark) {
7802
7828
  this.watermark = this.createWatermarkComponent();
7803
7829
  this.watermark.init({
@@ -8580,19 +8606,19 @@
8580
8606
  const index = this.panels.indexOf(panel);
8581
8607
  this.splitview.setViewVisible(index, visible);
8582
8608
  }
8583
- setActive(view, skipFocus) {
8584
- this._activePanel = view;
8609
+ setActive(panel, skipFocus) {
8610
+ this._activePanel = panel;
8585
8611
  this.panels
8586
- .filter((v) => v !== view)
8612
+ .filter((v) => v !== panel)
8587
8613
  .forEach((v) => {
8588
8614
  v.api._onDidActiveChange.fire({ isActive: false });
8589
8615
  if (!skipFocus) {
8590
8616
  v.focus();
8591
8617
  }
8592
8618
  });
8593
- view.api._onDidActiveChange.fire({ isActive: true });
8619
+ panel.api._onDidActiveChange.fire({ isActive: true });
8594
8620
  if (!skipFocus) {
8595
- view.focus();
8621
+ panel.focus();
8596
8622
  }
8597
8623
  }
8598
8624
  removePanel(panel, sizing) {
@@ -8891,6 +8917,10 @@
8891
8917
  });
8892
8918
  this.addDisposables(this._disposable);
8893
8919
  }
8920
+ setVisible(panel, visible) {
8921
+ const index = this.panels.indexOf(panel);
8922
+ this.paneview.setViewVisible(index, visible);
8923
+ }
8894
8924
  focus() {
8895
8925
  //noop
8896
8926
  }
@@ -8937,6 +8967,7 @@
8937
8967
  isExpanded: options.isExpanded,
8938
8968
  title: options.title,
8939
8969
  containerApi: new PaneviewApi(this),
8970
+ accessor: this,
8940
8971
  });
8941
8972
  this.paneview.addPane(view, size, index);
8942
8973
  view.orientation = this.paneview.orientation;
@@ -9036,6 +9067,7 @@
9036
9067
  title: data.title,
9037
9068
  isExpanded: !!view.expanded,
9038
9069
  containerApi: new PaneviewApi(this),
9070
+ accessor: this,
9039
9071
  });
9040
9072
  panel.orientation = this.paneview.orientation;
9041
9073
  });
@@ -9124,10 +9156,10 @@
9124
9156
  this._onDidChange = new Emitter();
9125
9157
  this.onDidChange = this._onDidChange.event;
9126
9158
  this.api.initialize(this);
9127
- this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => {
9128
- const { isHidden } = event;
9159
+ this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => {
9160
+ const { isVisible } = event;
9129
9161
  const { accessor } = this._params;
9130
- accessor.setVisible(this, !isHidden);
9162
+ accessor.setVisible(this, isVisible);
9131
9163
  }), this.api.onActiveChange(() => {
9132
9164
  const { accessor } = this._params;
9133
9165
  accessor.setActive(this);