dockview-core 1.11.0 → 1.13.0

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 (73) hide show
  1. package/dist/cjs/api/component.api.d.ts +2 -1
  2. package/dist/cjs/api/component.api.js +7 -0
  3. package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -1
  4. package/dist/cjs/api/dockviewGroupPanelApi.js +19 -1
  5. package/dist/cjs/api/dockviewPanelApi.d.ts +6 -0
  6. package/dist/cjs/api/panelApi.d.ts +4 -0
  7. package/dist/cjs/dnd/droptarget.d.ts +1 -1
  8. package/dist/cjs/dnd/droptarget.js +4 -10
  9. package/dist/cjs/dockview/components/panel/content.js +2 -10
  10. package/dist/cjs/dockview/components/titlebar/tabsContainer.js +12 -1
  11. package/dist/cjs/dockview/dockviewComponent.d.ts +8 -4
  12. package/dist/cjs/dockview/dockviewComponent.js +83 -68
  13. package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +12 -1
  14. package/dist/cjs/dockview/dockviewGroupPanelModel.js +48 -21
  15. package/dist/cjs/dockview/dockviewPanelModel.js +21 -24
  16. package/dist/cjs/dockview/framework.d.ts +38 -0
  17. package/dist/cjs/dockview/framework.js +2 -0
  18. package/dist/cjs/dockview/options.d.ts +68 -46
  19. package/dist/cjs/dockview/options.js +43 -1
  20. package/dist/cjs/dockview/types.d.ts +4 -10
  21. package/dist/cjs/framwork.d.ts +4 -0
  22. package/dist/cjs/framwork.js +2 -0
  23. package/dist/cjs/index.d.ts +2 -1
  24. package/dist/cjs/index.js +1 -1
  25. package/dist/cjs/overlayRenderContainer.d.ts +1 -1
  26. package/dist/dockview-core.amd.js +1972 -1886
  27. package/dist/dockview-core.amd.js.map +1 -1
  28. package/dist/dockview-core.amd.min.js +2 -2
  29. package/dist/dockview-core.amd.min.js.map +1 -1
  30. package/dist/dockview-core.amd.min.noStyle.js +2 -2
  31. package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
  32. package/dist/dockview-core.amd.noStyle.js +1972 -1886
  33. package/dist/dockview-core.amd.noStyle.js.map +1 -1
  34. package/dist/dockview-core.cjs.js +1972 -1886
  35. package/dist/dockview-core.cjs.js.map +1 -1
  36. package/dist/dockview-core.esm.js +1971 -1887
  37. package/dist/dockview-core.esm.js.map +1 -1
  38. package/dist/dockview-core.esm.min.js +2 -2
  39. package/dist/dockview-core.esm.min.js.map +1 -1
  40. package/dist/dockview-core.js +1972 -1886
  41. package/dist/dockview-core.js.map +1 -1
  42. package/dist/dockview-core.min.js +2 -2
  43. package/dist/dockview-core.min.js.map +1 -1
  44. package/dist/dockview-core.min.noStyle.js +2 -2
  45. package/dist/dockview-core.min.noStyle.js.map +1 -1
  46. package/dist/dockview-core.noStyle.js +1972 -1886
  47. package/dist/dockview-core.noStyle.js.map +1 -1
  48. package/dist/esm/api/component.api.d.ts +2 -1
  49. package/dist/esm/api/component.api.js +3 -0
  50. package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -1
  51. package/dist/esm/api/dockviewGroupPanelApi.js +18 -1
  52. package/dist/esm/api/dockviewPanelApi.d.ts +6 -0
  53. package/dist/esm/api/panelApi.d.ts +4 -0
  54. package/dist/esm/dnd/droptarget.d.ts +1 -1
  55. package/dist/esm/dnd/droptarget.js +4 -10
  56. package/dist/esm/dockview/components/panel/content.js +2 -10
  57. package/dist/esm/dockview/components/titlebar/tabsContainer.js +12 -1
  58. package/dist/esm/dockview/dockviewComponent.d.ts +8 -4
  59. package/dist/esm/dockview/dockviewComponent.js +78 -69
  60. package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +12 -1
  61. package/dist/esm/dockview/dockviewGroupPanelModel.js +36 -21
  62. package/dist/esm/dockview/dockviewPanelModel.js +21 -13
  63. package/dist/esm/dockview/framework.d.ts +38 -0
  64. package/dist/esm/dockview/framework.js +1 -0
  65. package/dist/esm/dockview/options.d.ts +68 -46
  66. package/dist/esm/dockview/options.js +36 -0
  67. package/dist/esm/dockview/types.d.ts +4 -10
  68. package/dist/esm/framwork.d.ts +4 -0
  69. package/dist/esm/framwork.js +1 -0
  70. package/dist/esm/index.d.ts +2 -1
  71. package/dist/esm/index.js +1 -1
  72. package/dist/esm/overlayRenderContainer.d.ts +1 -1
  73. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { IDockviewComponent, SerializedDockview } from '../dockview/dockviewComponent';
2
- import { AddGroupOptions, AddPanelOptions, MovementOptions } from '../dockview/options';
2
+ import { AddGroupOptions, AddPanelOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options';
3
3
  import { Parameters } from '../panel/types';
4
4
  import { Direction } from '../gridview/baseComponentGridview';
5
5
  import { AddComponentOptions, IGridviewComponent, SerializedGridviewComponent } from '../gridview/gridviewComponent';
@@ -393,6 +393,7 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
393
393
  * Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting.
394
394
  */
395
395
  get onWillDragPanel(): Event<TabDragEvent>;
396
+ get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>;
396
397
  /**
397
398
  * All panel objects.
398
399
  */
@@ -790,6 +790,13 @@ var DockviewApi = /** @class */ (function () {
790
790
  enumerable: false,
791
791
  configurable: true
792
792
  });
793
+ Object.defineProperty(DockviewApi.prototype, "onUnhandledDragOverEvent", {
794
+ get: function () {
795
+ return this.component.onUnhandledDragOverEvent;
796
+ },
797
+ enumerable: false,
798
+ configurable: true
799
+ });
793
800
  Object.defineProperty(DockviewApi.prototype, "panels", {
794
801
  /**
795
802
  * All panel objects.
@@ -1,11 +1,12 @@
1
1
  import { Position } from '../dnd/droptarget';
2
2
  import { DockviewComponent } from '../dockview/dockviewComponent';
3
3
  import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
4
- import { DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
4
+ import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
5
5
  import { Emitter, Event } from '../events';
6
6
  import { GridviewPanelApi, GridviewPanelApiImpl } from './gridviewPanelApi';
7
7
  export interface DockviewGroupPanelApi extends GridviewPanelApi {
8
8
  readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
9
+ readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
9
10
  readonly location: DockviewGroupLocation;
10
11
  /**
11
12
  * If you require the Window object
@@ -25,9 +26,12 @@ export interface DockviewGroupPanelFloatingChangeEvent {
25
26
  }
26
27
  export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
27
28
  private readonly accessor;
29
+ private readonly _mutableDisposable;
28
30
  private _group;
29
31
  readonly _onDidLocationChange: Emitter<DockviewGroupPanelFloatingChangeEvent>;
30
32
  readonly onDidLocationChange: Event<DockviewGroupPanelFloatingChangeEvent>;
33
+ private readonly _onDidActivePanelChange;
34
+ readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
31
35
  get location(): DockviewGroupLocation;
32
36
  constructor(id: string, accessor: DockviewComponent);
33
37
  close(): void;
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.DockviewGroupPanelApiImpl = void 0;
19
19
  var droptarget_1 = require("../dnd/droptarget");
20
20
  var events_1 = require("../events");
21
+ var lifecycle_1 = require("../lifecycle");
21
22
  var gridviewPanelApi_1 = require("./gridviewPanelApi");
22
23
  // TODO find a better way to initialize and avoid needing null checks
23
24
  var NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
@@ -26,9 +27,12 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
26
27
  function DockviewGroupPanelApiImpl(id, accessor) {
27
28
  var _this = _super.call(this, id, '__dockviewgroup__') || this;
28
29
  _this.accessor = accessor;
30
+ _this._mutableDisposable = new lifecycle_1.MutableDisposable();
29
31
  _this._onDidLocationChange = new events_1.Emitter();
30
32
  _this.onDidLocationChange = _this._onDidLocationChange.event;
31
- _this.addDisposables(_this._onDidLocationChange);
33
+ _this._onDidActivePanelChange = new events_1.Emitter();
34
+ _this.onDidActivePanelChange = _this._onDidActivePanelChange.event;
35
+ _this.addDisposables(_this._onDidLocationChange, _this._onDidActivePanelChange, _this._mutableDisposable);
32
36
  return _this;
33
37
  }
34
38
  Object.defineProperty(DockviewGroupPanelApiImpl.prototype, "location", {
@@ -96,7 +100,21 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
96
100
  }
97
101
  };
98
102
  DockviewGroupPanelApiImpl.prototype.initialize = function (group) {
103
+ var _this = this;
99
104
  this._group = group;
105
+ /**
106
+ * TODO: Annoying initialization order caveat
107
+ *
108
+ * Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
109
+ * By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
110
+ * finished ensuring the `model` is defined.
111
+ */
112
+ queueMicrotask(function () {
113
+ _this._mutableDisposable.value =
114
+ _this._group.model.onDidActivePanelChange(function (event) {
115
+ _this._onDidActivePanelChange.fire(event);
116
+ });
117
+ });
100
118
  };
101
119
  return DockviewGroupPanelApiImpl;
102
120
  }(gridviewPanelApi_1.GridviewPanelApiImpl));
@@ -19,6 +19,12 @@ export interface ActiveGroupEvent {
19
19
  export interface GroupChangedEvent {
20
20
  }
21
21
  export interface DockviewPanelApi extends Omit<GridviewPanelApi, 'setVisible' | 'onDidConstraintsChange' | 'setConstraints'> {
22
+ /**
23
+ * The id of the tab component renderer
24
+ *
25
+ * Undefined if no custom tab renderer is provided
26
+ */
27
+ readonly tabComponent: string | undefined;
22
28
  readonly group: DockviewGroupPanel;
23
29
  readonly isGroupActive: boolean;
24
30
  readonly renderer: DockviewPanelRenderer;
@@ -23,6 +23,10 @@ export interface PanelApi {
23
23
  setActive(): void;
24
24
  setVisible(isVisible: boolean): void;
25
25
  updateParameters(parameters: Parameters): void;
26
+ /**
27
+ * The id of the component renderer
28
+ */
29
+ readonly component: string;
26
30
  /**
27
31
  * The id of the panel that would have been assigned when the panel was created
28
32
  */
@@ -18,7 +18,7 @@ export declare class WillShowOverlayEvent extends DockviewEvent implements Dropt
18
18
  export declare function directionToPosition(direction: Direction): Position;
19
19
  export declare function positionToDirection(position: Position): Direction;
20
20
  export type Position = 'top' | 'bottom' | 'left' | 'right' | 'center';
21
- export type CanDisplayOverlay = boolean | ((dragEvent: DragEvent, state: Position) => boolean);
21
+ export type CanDisplayOverlay = (dragEvent: DragEvent, state: Position) => boolean;
22
22
  export type MeasuredValue = {
23
23
  value: number;
24
24
  type: 'pixels' | 'percentage';
@@ -127,6 +127,10 @@ var Droptarget = /** @class */ (function (_super) {
127
127
  _this.removeDropTarget();
128
128
  return;
129
129
  }
130
+ if (!_this.options.canDisplayOverlay(e, quadrant)) {
131
+ _this.removeDropTarget();
132
+ return;
133
+ }
130
134
  var willShowOverlayEvent = new WillShowOverlayEvent({
131
135
  nativeEvent: e,
132
136
  position: quadrant,
@@ -140,16 +144,6 @@ var Droptarget = /** @class */ (function (_super) {
140
144
  _this.removeDropTarget();
141
145
  return;
142
146
  }
143
- if (typeof _this.options.canDisplayOverlay === 'boolean') {
144
- if (!_this.options.canDisplayOverlay) {
145
- _this.removeDropTarget();
146
- return;
147
- }
148
- }
149
- else if (!_this.options.canDisplayOverlay(e, quadrant)) {
150
- _this.removeDropTarget();
151
- return;
152
- }
153
147
  _this.markAsUsed(e);
154
148
  if (!_this.targetElement) {
155
149
  _this.targetElement = document.createElement('div');
@@ -98,7 +98,7 @@ var ContentContainer = /** @class */ (function (_super) {
98
98
  this.panel = panel;
99
99
  var container;
100
100
  switch (panel.api.renderer) {
101
- case 'onlyWhenVisibile':
101
+ case 'onlyWhenVisible':
102
102
  this.group.renderContainer.detatch(panel);
103
103
  if (this.panel) {
104
104
  if (doRender) {
@@ -118,17 +118,9 @@ var ContentContainer = /** @class */ (function (_super) {
118
118
  break;
119
119
  }
120
120
  if (doRender) {
121
- var _onDidFocus = panel.view.content.onDidFocus;
122
- var _onDidBlur = panel.view.content.onDidBlur;
123
121
  var focusTracker = (0, dom_1.trackFocus)(container);
124
122
  var disposable = new lifecycle_1.CompositeDisposable();
125
123
  disposable.addDisposables(focusTracker, focusTracker.onDidFocus(function () { return _this._onDidFocus.fire(); }), focusTracker.onDidBlur(function () { return _this._onDidBlur.fire(); }));
126
- if (_onDidFocus) {
127
- disposable.addDisposables(_onDidFocus(function () { return _this._onDidFocus.fire(); }));
128
- }
129
- if (_onDidBlur) {
130
- disposable.addDisposables(_onDidBlur(function () { return _this._onDidBlur.fire(); }));
131
- }
132
124
  this.disposable.value = disposable;
133
125
  }
134
126
  };
@@ -144,7 +136,7 @@ var ContentContainer = /** @class */ (function (_super) {
144
136
  ContentContainer.prototype.closePanel = function () {
145
137
  var _a;
146
138
  if (this.panel) {
147
- if (this.panel.api.renderer === 'onlyWhenVisibile') {
139
+ if (this.panel.api.renderer === 'onlyWhenVisible') {
148
140
  (_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
149
141
  }
150
142
  }
@@ -58,6 +58,7 @@ var tab_1 = require("../tab/tab");
58
58
  var voidContainer_1 = require("./voidContainer");
59
59
  var dom_1 = require("../../../dom");
60
60
  var dockviewGroupPanelModel_1 = require("../../dockviewGroupPanelModel");
61
+ var dataTransfer_1 = require("../../../dnd/dataTransfer");
61
62
  var TabsContainer = /** @class */ (function (_super) {
62
63
  __extends(TabsContainer, _super);
63
64
  function TabsContainer(accessor, group) {
@@ -113,6 +114,10 @@ var TabsContainer = /** @class */ (function (_super) {
113
114
  }), _this.voidContainer.onWillShowOverlay(function (event) {
114
115
  _this._onWillShowOverlay.fire(new dockviewGroupPanelModel_1.WillShowOverlayLocationEvent(event, {
115
116
  kind: 'header_space',
117
+ panel: _this.group.activePanel,
118
+ api: _this.accessor.api,
119
+ group: _this.group,
120
+ getData: dataTransfer_1.getPanelData,
116
121
  }));
117
122
  }), (0, events_1.addDisposableListener)(_this.voidContainer.element, 'mousedown', function (event) {
118
123
  var isFloatingGroupsEnabled = !_this.accessor.options.disableFloatingGroups;
@@ -298,7 +303,13 @@ var TabsContainer = /** @class */ (function (_super) {
298
303
  index: _this.tabs.findIndex(function (x) { return x.value === tab; }),
299
304
  });
300
305
  }), tab.onWillShowOverlay(function (event) {
301
- _this._onWillShowOverlay.fire(new dockviewGroupPanelModel_1.WillShowOverlayLocationEvent(event, { kind: 'tab' }));
306
+ _this._onWillShowOverlay.fire(new dockviewGroupPanelModel_1.WillShowOverlayLocationEvent(event, {
307
+ kind: 'tab',
308
+ panel: _this.group.activePanel,
309
+ api: _this.accessor.api,
310
+ group: _this.group,
311
+ getData: dataTransfer_1.getPanelData,
312
+ }));
302
313
  }));
303
314
  var value = { value: tab, disposable: disposable };
304
315
  this.addTab(value, index);
@@ -3,8 +3,9 @@ import { Position } from '../dnd/droptarget';
3
3
  import { DockviewPanel, IDockviewPanel } from './dockviewPanel';
4
4
  import { Event, Emitter } from '../events';
5
5
  import { IWatermarkRenderer, GroupviewPanelState } from './types';
6
- import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, MovementOptions } from './options';
6
+ import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, DockviewOptions, MovementOptions } from './options';
7
7
  import { BaseGrid, IBaseGrid } from '../gridview/baseComponentGridview';
8
+ import { DockviewApi } from '../api/component.api';
8
9
  import { Orientation } from '../splitview/splitview';
9
10
  import { GroupOptions, GroupPanelViewState, DockviewDidDropEvent, DockviewWillDropEvent, WillShowOverlayLocationEvent } from './dockviewGroupPanelModel';
10
11
  import { DockviewGroupPanel } from './dockviewGroupPanel';
@@ -41,7 +42,6 @@ export interface SerializedDockview {
41
42
  floatingGroups?: SerializedFloatingGroup[];
42
43
  popoutGroups?: SerializedPopoutGroup[];
43
44
  }
44
- export type DockviewComponentUpdateOptions = Pick<DockviewComponentOptions, 'orientation' | 'components' | 'frameworkComponents' | 'tabComponents' | 'frameworkTabComponents' | 'showDndOverlay' | 'watermarkFrameworkComponent' | 'defaultTabComponent' | 'createLeftHeaderActionsElement' | 'createRightHeaderActionsElement' | 'createPrefixHeaderActionsElement' | 'disableFloatingGroups' | 'floatingGroupBounds' | 'rootOverlayModel' | 'disableDnd'>;
45
45
  type MoveGroupOptions = {
46
46
  from: {
47
47
  group: DockviewGroupPanel;
@@ -79,8 +79,9 @@ export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> {
79
79
  readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
80
80
  readonly onDidAddGroup: Event<DockviewGroupPanel>;
81
81
  readonly onDidActiveGroupChange: Event<DockviewGroupPanel | undefined>;
82
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
82
83
  readonly options: DockviewComponentOptions;
83
- updateOptions(options: DockviewComponentUpdateOptions): void;
84
+ updateOptions(options: DockviewOptions): void;
84
85
  moveGroupOrPanel(options: MoveGroupOrPanelOptions): void;
85
86
  moveGroup(options: MoveGroupOptions): void;
86
87
  doSetGroupActive: (group: DockviewGroupPanel, skipFocus?: boolean) => void;
@@ -131,6 +132,8 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
131
132
  readonly onWillDrop: Event<DockviewWillDropEvent>;
132
133
  private readonly _onWillShowOverlay;
133
134
  readonly onWillShowOverlay: Event<WillShowOverlayLocationEvent>;
135
+ private readonly _onUnhandledDragOverEvent;
136
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
134
137
  private readonly _onDidRemovePanel;
135
138
  readonly onDidRemovePanel: Event<IDockviewPanel>;
136
139
  private readonly _onDidAddPanel;
@@ -156,6 +159,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
156
159
  get options(): DockviewComponentOptions;
157
160
  get activePanel(): IDockviewPanel | undefined;
158
161
  get renderer(): DockviewPanelRenderer;
162
+ get api(): DockviewApi;
159
163
  constructor(options: DockviewComponentOptions);
160
164
  addPopoutGroup(itemToPopout: DockviewPanel | DockviewGroupPanel, options?: {
161
165
  skipRemoveGroup?: boolean;
@@ -182,7 +186,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
182
186
  skipActiveGroup?: boolean;
183
187
  }): void;
184
188
  private orthogonalize;
185
- updateOptions(options: DockviewComponentUpdateOptions): void;
189
+ updateOptions(options: Partial<DockviewComponentOptions>): void;
186
190
  layout(width: number, height: number, forceResize?: boolean | undefined): void;
187
191
  focus(): void;
188
192
  getGroupPanel(id: string): IDockviewPanel | undefined;
@@ -72,7 +72,6 @@ var events_1 = require("../events");
72
72
  var watermark_1 = require("./components/watermark/watermark");
73
73
  var math_1 = require("../math");
74
74
  var deserializer_1 = require("./deserializer");
75
- var componentFactory_1 = require("../panel/componentFactory");
76
75
  var options_1 = require("./options");
77
76
  var baseComponentGridview_1 = require("../gridview/baseComponentGridview");
78
77
  var component_api_1 = require("../api/component.api");
@@ -189,11 +188,13 @@ function typeValidate(data) {
189
188
  var DockviewComponent = /** @class */ (function (_super) {
190
189
  __extends(DockviewComponent, _super);
191
190
  function DockviewComponent(options) {
192
- var _a, _b;
191
+ var _a;
193
192
  var _this = _super.call(this, {
194
193
  proportionalLayout: true,
195
- orientation: (_a = options.orientation) !== null && _a !== void 0 ? _a : splitview_1.Orientation.HORIZONTAL,
196
- styles: options.styles,
194
+ orientation: splitview_1.Orientation.HORIZONTAL,
195
+ styles: options.hideBorders
196
+ ? { separatorBorder: 'transparent' }
197
+ : undefined,
197
198
  parentElement: options.parentElement,
198
199
  disableAutoResizing: options.disableAutoResizing,
199
200
  locked: options.locked,
@@ -211,6 +212,8 @@ var DockviewComponent = /** @class */ (function (_super) {
211
212
  _this.onWillDrop = _this._onWillDrop.event;
212
213
  _this._onWillShowOverlay = new events_1.Emitter();
213
214
  _this.onWillShowOverlay = _this._onWillShowOverlay.event;
215
+ _this._onUnhandledDragOverEvent = new events_1.Emitter();
216
+ _this.onUnhandledDragOverEvent = _this._onUnhandledDragOverEvent.event;
214
217
  _this._onDidRemovePanel = new events_1.Emitter();
215
218
  _this.onDidRemovePanel = _this._onDidRemovePanel.event;
216
219
  _this._onDidAddPanel = new events_1.Emitter();
@@ -236,7 +239,7 @@ var DockviewComponent = /** @class */ (function (_super) {
236
239
  _this.overlayRenderContainer = new overlayRenderContainer_1.OverlayRenderContainer(gready);
237
240
  (0, dom_1.toggleClass)(_this.gridview.element, 'dv-dockview', true);
238
241
  (0, dom_1.toggleClass)(_this.element, 'dv-debug', !!options.debug);
239
- _this.addDisposables(_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.onDidAdd(function (event) {
242
+ _this.addDisposables(_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.onDidAdd(function (event) {
240
243
  if (!_this._moving) {
241
244
  _this._onDidAddGroup.fire(event);
242
245
  }
@@ -284,22 +287,6 @@ var DockviewComponent = /** @class */ (function (_super) {
284
287
  }
285
288
  }));
286
289
  _this._options = options;
287
- if (!_this.options.components) {
288
- _this.options.components = {};
289
- }
290
- if (!_this.options.frameworkComponents) {
291
- _this.options.frameworkComponents = {};
292
- }
293
- if (!_this.options.frameworkTabComponents) {
294
- _this.options.frameworkTabComponents = {};
295
- }
296
- if (!_this.options.tabComponents) {
297
- _this.options.tabComponents = {};
298
- }
299
- if (!_this.options.watermarkComponent &&
300
- !_this.options.watermarkFrameworkComponent) {
301
- _this.options.watermarkComponent = watermark_1.Watermark;
302
- }
303
290
  _this._rootDropTarget = new droptarget_1.Droptarget(_this.element, {
304
291
  canDisplayOverlay: function (event, position) {
305
292
  var data = (0, dataTransfer_1.getPanelData)();
@@ -314,26 +301,20 @@ var DockviewComponent = /** @class */ (function (_super) {
314
301
  }
315
302
  return true;
316
303
  }
317
- if (_this.options.showDndOverlay) {
318
- if (position === 'center' && _this.gridview.length !== 0) {
319
- /**
320
- * for external events only show the four-corner drag overlays, disable
321
- * the center position so that external drag events can fall through to the group
322
- * and panel drop target handlers
323
- */
324
- return false;
325
- }
326
- return _this.options.showDndOverlay({
327
- nativeEvent: event,
328
- position: position,
329
- target: 'edge',
330
- getData: dataTransfer_1.getPanelData,
331
- });
304
+ if (position === 'center' && _this.gridview.length !== 0) {
305
+ /**
306
+ * for external events only show the four-corner drag overlays, disable
307
+ * the center position so that external drag events can fall through to the group
308
+ * and panel drop target handlers
309
+ */
310
+ return false;
332
311
  }
333
- return false;
312
+ var firedEvent = new options_1.DockviewUnhandledDragOverEvent(event, 'edge', position, dataTransfer_1.getPanelData);
313
+ _this._onUnhandledDragOverEvent.fire(firedEvent);
314
+ return firedEvent.isAccepted;
334
315
  },
335
316
  acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
336
- overlayModel: (_b = _this.options.rootOverlayModel) !== null && _b !== void 0 ? _b : DEFAULT_ROOT_OVERLAY_MODEL,
317
+ overlayModel: (_a = _this.options.rootOverlayModel) !== null && _a !== void 0 ? _a : DEFAULT_ROOT_OVERLAY_MODEL,
337
318
  });
338
319
  _this.addDisposables(_this._rootDropTarget, _this._rootDropTarget.onWillShowOverlay(function (event) {
339
320
  if (_this.gridview.length > 0 && event.position === 'center') {
@@ -342,6 +323,10 @@ var DockviewComponent = /** @class */ (function (_super) {
342
323
  }
343
324
  _this._onWillShowOverlay.fire(new dockviewGroupPanelModel_1.WillShowOverlayLocationEvent(event, {
344
325
  kind: 'edge',
326
+ panel: undefined,
327
+ api: _this._api,
328
+ group: undefined,
329
+ getData: dataTransfer_1.getPanelData,
345
330
  }));
346
331
  }), _this._rootDropTarget.onDrop(function (event) {
347
332
  var _a;
@@ -428,7 +413,14 @@ var DockviewComponent = /** @class */ (function (_super) {
428
413
  Object.defineProperty(DockviewComponent.prototype, "renderer", {
429
414
  get: function () {
430
415
  var _a;
431
- return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisibile';
416
+ return (_a = this.options.defaultRenderer) !== null && _a !== void 0 ? _a : 'onlyWhenVisible';
417
+ },
418
+ enumerable: false,
419
+ configurable: true
420
+ });
421
+ Object.defineProperty(DockviewComponent.prototype, "api", {
422
+ get: function () {
423
+ return this._api;
432
424
  },
433
425
  enumerable: false,
434
426
  configurable: true
@@ -609,7 +601,9 @@ var DockviewComponent = /** @class */ (function (_super) {
609
601
  skipSetActiveGroup: true,
610
602
  });
611
603
  });
612
- group.model.openPanel(item, { skipSetGroupActive: true });
604
+ this.movingLock(function () {
605
+ return group.model.openPanel(item, { skipSetGroupActive: true });
606
+ });
613
607
  }
614
608
  else {
615
609
  group = item;
@@ -684,7 +678,7 @@ var DockviewComponent = /** @class */ (function (_super) {
684
678
  // this is either a resize or a move
685
679
  // to inform the panels .layout(...) the group with it's current size
686
680
  // don't care about resize since the above watcher handles that
687
- group.layout(group.height, group.width);
681
+ group.layout(group.width, group.height);
688
682
  }), overlay.onDidChangeEnd(function () {
689
683
  _this._bufferOnDidLayoutChange.fire();
690
684
  }), group.onDidChange(function (event) {
@@ -742,16 +736,11 @@ var DockviewComponent = /** @class */ (function (_super) {
742
736
  DockviewComponent.prototype.updateOptions = function (options) {
743
737
  var e_3, _a;
744
738
  var _b, _c;
745
- var changed_orientation = typeof options.orientation === 'string' &&
746
- this.gridview.orientation !== options.orientation;
747
- var changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
739
+ var changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
748
740
  options.floatingGroupBounds !== this.options.floatingGroupBounds;
749
- var changed_rootOverlayOptions = options.rootOverlayModel !== undefined &&
741
+ var changed_rootOverlayOptions = 'rootOverlayModel' in options &&
750
742
  options.rootOverlayModel !== this.options.rootOverlayModel;
751
743
  this._options = __assign(__assign({}, this.options), options);
752
- if (changed_orientation) {
753
- this.gridview.orientation = options.orientation;
754
- }
755
744
  if (changed_floatingGroupBounds) {
756
745
  try {
757
746
  for (var _d = __values(this._floatingGroups), _e = _d.next(); !_e.done; _e = _d.next()) {
@@ -1167,7 +1156,7 @@ var DockviewComponent = /** @class */ (function (_super) {
1167
1156
  ? this.getGroupPanel(options.position.referencePanel)
1168
1157
  : options.position.referencePanel;
1169
1158
  if (!referencePanel) {
1170
- throw new Error("referencePanel ".concat(options.position.referencePanel, " does not exist"));
1159
+ throw new Error("referencePanel '".concat(options.position.referencePanel, "' does not exist"));
1171
1160
  }
1172
1161
  referenceGroup = this.findGroup(referencePanel);
1173
1162
  }
@@ -1177,14 +1166,19 @@ var DockviewComponent = /** @class */ (function (_super) {
1177
1166
  ? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
1178
1167
  : options.position.referenceGroup;
1179
1168
  if (!referenceGroup) {
1180
- throw new Error("referencePanel ".concat(options.position.referenceGroup, " does not exist"));
1169
+ throw new Error("referenceGroup '".concat(options.position.referenceGroup, "' does not exist"));
1181
1170
  }
1182
1171
  }
1183
1172
  else {
1184
1173
  var group = this.orthogonalize((0, droptarget_1.directionToPosition)(options.position.direction));
1185
1174
  var panel_1 = this.createPanel(options, group);
1186
- group.model.openPanel(panel_1);
1187
- this.doSetGroupAndPanelActive(group);
1175
+ group.model.openPanel(panel_1, {
1176
+ skipSetActive: options.inactive,
1177
+ skipSetGroupActive: options.inactive,
1178
+ });
1179
+ if (!options.inactive) {
1180
+ this.doSetGroupAndPanelActive(group);
1181
+ }
1188
1182
  return panel_1;
1189
1183
  }
1190
1184
  }
@@ -1207,43 +1201,64 @@ var DockviewComponent = /** @class */ (function (_super) {
1207
1201
  skipActiveGroup: true,
1208
1202
  });
1209
1203
  panel = this.createPanel(options, group);
1210
- group.model.openPanel(panel);
1204
+ group.model.openPanel(panel, {
1205
+ skipSetActive: options.inactive,
1206
+ skipSetGroupActive: options.inactive,
1207
+ });
1211
1208
  }
1212
1209
  else if (referenceGroup.api.location.type === 'floating' ||
1213
1210
  target === 'center') {
1214
1211
  panel = this.createPanel(options, referenceGroup);
1215
- referenceGroup.model.openPanel(panel);
1216
- this.doSetGroupAndPanelActive(referenceGroup);
1212
+ referenceGroup.model.openPanel(panel, {
1213
+ skipSetActive: options.inactive,
1214
+ skipSetGroupActive: options.inactive,
1215
+ });
1216
+ if (!options.inactive) {
1217
+ this.doSetGroupAndPanelActive(referenceGroup);
1218
+ }
1217
1219
  }
1218
1220
  else {
1219
1221
  var location_1 = (0, gridview_1.getGridLocation)(referenceGroup.element);
1220
1222
  var relativeLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, location_1, target);
1221
1223
  var group = this.createGroupAtLocation(relativeLocation);
1222
1224
  panel = this.createPanel(options, group);
1223
- group.model.openPanel(panel);
1224
- this.doSetGroupAndPanelActive(group);
1225
+ group.model.openPanel(panel, {
1226
+ skipSetActive: options.inactive,
1227
+ skipSetGroupActive: options.inactive,
1228
+ });
1229
+ if (!options.inactive) {
1230
+ this.doSetGroupAndPanelActive(group);
1231
+ }
1225
1232
  }
1226
1233
  }
1227
1234
  else if (options.floating) {
1228
1235
  var group = this.createGroup();
1229
1236
  this._onDidAddGroup.fire(group);
1230
- var o = typeof options.floating === 'object' &&
1237
+ var coordinates = typeof options.floating === 'object' &&
1231
1238
  options.floating !== null
1232
1239
  ? options.floating
1233
1240
  : {};
1234
- this.addFloatingGroup(group, o, {
1241
+ this.addFloatingGroup(group, coordinates, {
1235
1242
  inDragMode: false,
1236
1243
  skipRemoveGroup: true,
1237
1244
  skipActiveGroup: true,
1238
1245
  });
1239
1246
  panel = this.createPanel(options, group);
1240
- group.model.openPanel(panel);
1247
+ group.model.openPanel(panel, {
1248
+ skipSetActive: options.inactive,
1249
+ skipSetGroupActive: options.inactive,
1250
+ });
1241
1251
  }
1242
1252
  else {
1243
1253
  var group = this.createGroupAtLocation();
1244
1254
  panel = this.createPanel(options, group);
1245
- group.model.openPanel(panel);
1246
- this.doSetGroupAndPanelActive(group);
1255
+ group.model.openPanel(panel, {
1256
+ skipSetActive: options.inactive,
1257
+ skipSetGroupActive: options.inactive,
1258
+ });
1259
+ if (!options.inactive) {
1260
+ this.doSetGroupAndPanelActive(group);
1261
+ }
1247
1262
  }
1248
1263
  return panel;
1249
1264
  };
@@ -1268,12 +1283,10 @@ var DockviewComponent = /** @class */ (function (_super) {
1268
1283
  }
1269
1284
  };
1270
1285
  DockviewComponent.prototype.createWatermarkComponent = function () {
1271
- var _a;
1272
- return (0, componentFactory_1.createComponent)('watermark-id', 'watermark-name', this.options.watermarkComponent
1273
- ? { 'watermark-name': this.options.watermarkComponent }
1274
- : {}, this.options.watermarkFrameworkComponent
1275
- ? { 'watermark-name': this.options.watermarkFrameworkComponent }
1276
- : {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
1286
+ if (this.options.createWatermarkComponent) {
1287
+ return this.options.createWatermarkComponent();
1288
+ }
1289
+ return new watermark_1.Watermark();
1277
1290
  };
1278
1291
  DockviewComponent.prototype.updateWatermark = function () {
1279
1292
  var _a, _b;
@@ -1693,6 +1706,8 @@ var DockviewComponent = /** @class */ (function (_super) {
1693
1706
  return;
1694
1707
  }
1695
1708
  _this._onWillShowOverlay.fire(event);
1709
+ }), view.model.onUnhandledDragOverEvent(function (event) {
1710
+ _this._onUnhandledDragOverEvent.fire(event);
1696
1711
  }), view.model.onDidAddPanel(function (event) {
1697
1712
  if (_this._moving) {
1698
1713
  return;
@@ -9,6 +9,7 @@ import { IPanel, PanelInitParameters, PanelUpdateEvent, Parameters } from '../pa
9
9
  import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer';
10
10
  import { DockviewGroupPanel } from './dockviewGroupPanel';
11
11
  import { IDockviewPanel } from './dockviewPanel';
12
+ import { DockviewDndOverlayEvent } from './options';
12
13
  import { OverlayRenderContainer } from '../overlayRenderContainer';
13
14
  import { TitleEvent } from '../api/dockviewPanelApi';
14
15
  interface GroupMoveEvent {
@@ -118,14 +119,22 @@ export type DockviewGroupLocation = {
118
119
  };
119
120
  export declare class WillShowOverlayLocationEvent implements IDockviewEvent {
120
121
  private readonly event;
121
- private _kind;
122
+ private readonly options;
122
123
  get kind(): DockviewGroupDropLocation;
123
124
  get nativeEvent(): DragEvent;
124
125
  get position(): Position;
125
126
  get defaultPrevented(): boolean;
127
+ get panel(): IDockviewPanel | undefined;
128
+ get api(): DockviewApi;
129
+ get group(): DockviewGroupPanel | undefined;
126
130
  preventDefault(): void;
131
+ getData(): PanelTransfer | undefined;
127
132
  constructor(event: WillShowOverlayEvent, options: {
128
133
  kind: DockviewGroupDropLocation;
134
+ panel: IDockviewPanel | undefined;
135
+ api: DockviewApi;
136
+ group: DockviewGroupPanel | undefined;
137
+ getData: () => PanelTransfer | undefined;
129
138
  });
130
139
  }
131
140
  export declare class DockviewGroupPanelModel extends CompositeDisposable implements IDockviewGroupPanelModel {
@@ -173,6 +182,8 @@ export declare class DockviewGroupPanelModel extends CompositeDisposable impleme
173
182
  readonly onDidRemovePanel: Event<DockviewGroupChangeEvent>;
174
183
  private readonly _onDidActivePanelChange;
175
184
  readonly onDidActivePanelChange: Event<DockviewGroupChangeEvent>;
185
+ private readonly _onUnhandledDragOverEvent;
186
+ readonly onUnhandledDragOverEvent: Event<DockviewDndOverlayEvent>;
176
187
  private readonly _api;
177
188
  get element(): HTMLElement;
178
189
  get activePanel(): IDockviewPanel | undefined;