dockview-react 2.1.3 → 3.0.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 2.1.3
3
+ * @version 3.0.0
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -132,6 +132,17 @@ class DockviewEvent {
132
132
  this._defaultPrevented = true;
133
133
  }
134
134
  }
135
+ class AcceptableEvent {
136
+ constructor() {
137
+ this._isAccepted = false;
138
+ }
139
+ get isAccepted() {
140
+ return this._isAccepted;
141
+ }
142
+ accept() {
143
+ this._isAccepted = true;
144
+ }
145
+ }
135
146
  class LeakageMonitor {
136
147
  constructor() {
137
148
  this.events = new Map();
@@ -1523,6 +1534,23 @@ class Splitview {
1523
1534
  }
1524
1535
  }
1525
1536
 
1537
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1538
+ /**
1539
+ * by readong the keys from an empty value object TypeScript will error
1540
+ * when we add or remove new properties to `DockviewOptions`
1541
+ */
1542
+ const properties = {
1543
+ orientation: undefined,
1544
+ descriptor: undefined,
1545
+ proportionalLayout: undefined,
1546
+ styles: undefined,
1547
+ margin: undefined,
1548
+ disableAutoResizing: undefined,
1549
+ className: undefined,
1550
+ };
1551
+ return Object.keys(properties);
1552
+ })();
1553
+
1526
1554
  class Paneview extends CompositeDisposable {
1527
1555
  get onDidAddView() {
1528
1556
  return this.splitview.onDidAddView;
@@ -2652,6 +2680,21 @@ class Gridview {
2652
2680
  }
2653
2681
  }
2654
2682
 
2683
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2684
+ /**
2685
+ * by readong the keys from an empty value object TypeScript will error
2686
+ * when we add or remove new properties to `DockviewOptions`
2687
+ */
2688
+ const properties = {
2689
+ disableAutoResizing: undefined,
2690
+ proportionalLayout: undefined,
2691
+ orientation: undefined,
2692
+ hideBorders: undefined,
2693
+ className: undefined,
2694
+ };
2695
+ return Object.keys(properties);
2696
+ })();
2697
+
2655
2698
  class Resizable extends CompositeDisposable {
2656
2699
  get element() {
2657
2700
  return this._element;
@@ -3129,15 +3172,10 @@ class PaneviewApi {
3129
3172
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3130
3173
  */
3131
3174
  get onDidDrop() {
3132
- const emitter = new Emitter();
3133
- const disposable = this.component.onDidDrop((e) => {
3134
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3135
- });
3136
- emitter.dispose = () => {
3137
- disposable.dispose();
3138
- emitter.dispose();
3139
- };
3140
- return emitter.event;
3175
+ return this.component.onDidDrop;
3176
+ }
3177
+ get onUnhandledDragOverEvent() {
3178
+ return this.component.onUnhandledDragOverEvent;
3141
3179
  }
3142
3180
  constructor(component) {
3143
3181
  this.component = component;
@@ -4064,6 +4102,28 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
4064
4102
  return 'center';
4065
4103
  }
4066
4104
 
4105
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4106
+ /**
4107
+ * by readong the keys from an empty value object TypeScript will error
4108
+ * when we add or remove new properties to `DockviewOptions`
4109
+ */
4110
+ const properties = {
4111
+ disableAutoResizing: undefined,
4112
+ disableDnd: undefined,
4113
+ className: undefined,
4114
+ };
4115
+ return Object.keys(properties);
4116
+ })();
4117
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4118
+ constructor(nativeEvent, position, getData, panel) {
4119
+ super();
4120
+ this.nativeEvent = nativeEvent;
4121
+ this.position = position;
4122
+ this.getData = getData;
4123
+ this.panel = panel;
4124
+ }
4125
+ }
4126
+
4067
4127
  class WillFocusEvent extends DockviewEvent {
4068
4128
  constructor() {
4069
4129
  super();
@@ -4487,6 +4547,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4487
4547
  this.accessor = accessor;
4488
4548
  this._onDidDrop = new Emitter();
4489
4549
  this.onDidDrop = this._onDidDrop.event;
4550
+ this._onUnhandledDragOverEvent = new Emitter();
4551
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4552
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4490
4553
  if (!disableDnd) {
4491
4554
  this.initDragFeatures();
4492
4555
  }
@@ -4513,7 +4576,7 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4513
4576
  overlayModel: {
4514
4577
  activationSize: { type: 'percentage', value: 50 },
4515
4578
  },
4516
- canDisplayOverlay: (event) => {
4579
+ canDisplayOverlay: (event, position) => {
4517
4580
  const data = getPaneData();
4518
4581
  if (data) {
4519
4582
  if (data.paneId !== this.id &&
@@ -4521,14 +4584,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4521
4584
  return true;
4522
4585
  }
4523
4586
  }
4524
- if (this.accessor.options.showDndOverlay) {
4525
- return this.accessor.options.showDndOverlay({
4526
- nativeEvent: event,
4527
- getData: getPaneData,
4528
- panel: this,
4529
- });
4530
- }
4531
- return false;
4587
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4588
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4589
+ return firedEvent.isAccepted;
4532
4590
  },
4533
4591
  });
4534
4592
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4983,15 +5041,7 @@ class TabsContainer extends CompositeDisposable {
4983
5041
  this._element.appendChild(this.leftActionsContainer);
4984
5042
  this._element.appendChild(this.voidContainer.element);
4985
5043
  this._element.appendChild(this.rightActionsContainer);
4986
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4987
- if (e.api.group === this.group) {
4988
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4989
- }
4990
- }), this.accessor.onDidRemovePanel((e) => {
4991
- if (e.api.group === this.group) {
4992
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4993
- }
4994
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5044
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4995
5045
  this._onGroupDragStart.fire({
4996
5046
  nativeEvent: event,
4997
5047
  group: this.group,
@@ -5036,20 +5086,6 @@ class TabsContainer extends CompositeDisposable {
5036
5086
  setActive(_isGroupActive) {
5037
5087
  // noop
5038
5088
  }
5039
- addTab(tab, index = this.tabs.length) {
5040
- if (index < 0 || index > this.tabs.length) {
5041
- throw new Error('invalid location');
5042
- }
5043
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5044
- this.tabs = [
5045
- ...this.tabs.slice(0, index),
5046
- tab,
5047
- ...this.tabs.slice(index),
5048
- ];
5049
- if (this.selectedIndex < 0) {
5050
- this.selectedIndex = index;
5051
- }
5052
- }
5053
5089
  delete(id) {
5054
5090
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5055
5091
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5057,6 +5093,7 @@ class TabsContainer extends CompositeDisposable {
5057
5093
  disposable.dispose();
5058
5094
  value.dispose();
5059
5095
  value.element.remove();
5096
+ this.updateClassnames();
5060
5097
  }
5061
5098
  setActivePanel(panel) {
5062
5099
  this.tabs.forEach((tab) => {
@@ -5125,25 +5162,37 @@ class TabsContainer extends CompositeDisposable {
5125
5162
  }
5126
5163
  this.tabs = [];
5127
5164
  }
5165
+ addTab(tab, index = this.tabs.length) {
5166
+ if (index < 0 || index > this.tabs.length) {
5167
+ throw new Error('invalid location');
5168
+ }
5169
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5170
+ this.tabs = [
5171
+ ...this.tabs.slice(0, index),
5172
+ tab,
5173
+ ...this.tabs.slice(index),
5174
+ ];
5175
+ if (this.selectedIndex < 0) {
5176
+ this.selectedIndex = index;
5177
+ }
5178
+ this.updateClassnames();
5179
+ }
5180
+ updateClassnames() {
5181
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5182
+ }
5128
5183
  }
5129
5184
 
5130
- class DockviewUnhandledDragOverEvent {
5131
- get isAccepted() {
5132
- return this._isAccepted;
5133
- }
5185
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5134
5186
  constructor(nativeEvent, target, position, getData, group) {
5187
+ super();
5135
5188
  this.nativeEvent = nativeEvent;
5136
5189
  this.target = target;
5137
5190
  this.position = position;
5138
5191
  this.getData = getData;
5139
5192
  this.group = group;
5140
- this._isAccepted = false;
5141
- }
5142
- accept() {
5143
- this._isAccepted = true;
5144
5193
  }
5145
5194
  }
5146
- const PROPERTY_KEYS = (() => {
5195
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5147
5196
  /**
5148
5197
  * by readong the keys from an empty value object TypeScript will error
5149
5198
  * when we add or remove new properties to `DockviewOptions`
@@ -7643,10 +7692,6 @@ class DockviewComponent extends BaseGrid {
7643
7692
  this._api = new DockviewApi(this);
7644
7693
  this.updateWatermark();
7645
7694
  }
7646
- dispose() {
7647
- this.clear(); // explicitly clear the layout before cleaning up
7648
- super.dispose();
7649
- }
7650
7695
  setVisible(panel, visible) {
7651
7696
  switch (panel.api.location.type) {
7652
7697
  case 'grid':
@@ -7830,30 +7875,29 @@ class DockviewComponent extends BaseGrid {
7830
7875
  }
7831
7876
  }
7832
7877
  else if (this.getPanel(group.id)) {
7833
- const removedGroup = group;
7878
+ group.model.renderContainer =
7879
+ this.overlayRenderContainer;
7880
+ returnedGroup = group;
7834
7881
  if (floatingBox) {
7835
- this.addFloatingGroup(removedGroup, {
7882
+ this.addFloatingGroup(group, {
7836
7883
  height: floatingBox.height,
7837
7884
  width: floatingBox.width,
7838
7885
  position: floatingBox,
7839
7886
  });
7840
7887
  }
7841
7888
  else {
7842
- this.doRemoveGroup(removedGroup, {
7889
+ this.doRemoveGroup(group, {
7843
7890
  skipDispose: true,
7844
7891
  skipActive: true,
7845
7892
  skipPopoutReturn: true,
7846
7893
  });
7847
- removedGroup.model.renderContainer =
7848
- this.overlayRenderContainer;
7849
- removedGroup.model.location = { type: 'grid' };
7850
- returnedGroup = removedGroup;
7894
+ group.model.location = { type: 'grid' };
7851
7895
  this.movingLock(() => {
7852
7896
  // suppress group add events since the group already exists
7853
- this.doAddGroup(removedGroup, [0]);
7897
+ this.doAddGroup(group, [0]);
7854
7898
  });
7855
7899
  }
7856
- this.doSetGroupAndPanelActive(removedGroup);
7900
+ this.doSetGroupAndPanelActive(group);
7857
7901
  }
7858
7902
  }));
7859
7903
  this._popoutGroups.push(value);
@@ -8994,31 +9038,6 @@ class DockviewComponent extends BaseGrid {
8994
9038
  }
8995
9039
  }
8996
9040
 
8997
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8998
- const Component = typeof componentName === 'string'
8999
- ? components[componentName]
9000
- : undefined;
9001
- const FrameworkComponent = typeof componentName === 'string'
9002
- ? frameworkComponents[componentName]
9003
- : undefined;
9004
- if (Component && FrameworkComponent) {
9005
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
9006
- }
9007
- if (FrameworkComponent) {
9008
- if (!createFrameworkComponent) {
9009
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9010
- }
9011
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9012
- }
9013
- if (!Component) {
9014
- if (fallback) {
9015
- return fallback();
9016
- }
9017
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9018
- }
9019
- return new Component(id, componentName);
9020
- }
9021
-
9022
9041
  class GridviewComponent extends BaseGrid {
9023
9042
  get orientation() {
9024
9043
  return this.gridview.orientation;
@@ -9036,10 +9055,13 @@ class GridviewComponent extends BaseGrid {
9036
9055
  this._deserializer = value;
9037
9056
  }
9038
9057
  constructor(parentElement, options) {
9058
+ var _a;
9039
9059
  super(parentElement, {
9040
- proportionalLayout: options.proportionalLayout,
9060
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9041
9061
  orientation: options.orientation,
9042
- styles: options.styles,
9062
+ styles: options.hideBorders
9063
+ ? { separatorBorder: 'transparent' }
9064
+ : undefined,
9043
9065
  disableAutoResizing: options.disableAutoResizing,
9044
9066
  className: options.className,
9045
9067
  });
@@ -9059,12 +9081,6 @@ class GridviewComponent extends BaseGrid {
9059
9081
  }), this.onDidActiveChange((event) => {
9060
9082
  this._onDidActiveGroupChange.fire(event);
9061
9083
  }));
9062
- if (!this.options.components) {
9063
- this.options.components = {};
9064
- }
9065
- if (!this.options.frameworkComponents) {
9066
- this.options.frameworkComponents = {};
9067
- }
9068
9084
  }
9069
9085
  updateOptions(options) {
9070
9086
  super.updateOptions(options);
@@ -9114,14 +9130,11 @@ class GridviewComponent extends BaseGrid {
9114
9130
  const height = this.height;
9115
9131
  this.gridview.deserialize(grid, {
9116
9132
  fromJSON: (node) => {
9117
- var _a, _b;
9118
9133
  const { data } = node;
9119
- const view = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkComponentFactory
9120
- ? {
9121
- createComponent: this.options.frameworkComponentFactory
9122
- .createComponent,
9123
- }
9124
- : undefined);
9134
+ const view = this.options.createComponent({
9135
+ id: data.id,
9136
+ name: data.component,
9137
+ });
9125
9138
  queue.push(() => view.init({
9126
9139
  params: data.params,
9127
9140
  minimumWidth: data.minimumWidth,
@@ -9199,7 +9212,7 @@ class GridviewComponent extends BaseGrid {
9199
9212
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9200
9213
  }
9201
9214
  addPanel(options) {
9202
- var _a, _b, _c, _d, _e, _f;
9215
+ var _a, _b, _c, _d;
9203
9216
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9204
9217
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9205
9218
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9215,14 +9228,12 @@ class GridviewComponent extends BaseGrid {
9215
9228
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9216
9229
  }
9217
9230
  }
9218
- const view = createComponent(options.id, options.component, (_d = this.options.components) !== null && _d !== void 0 ? _d : {}, (_e = this.options.frameworkComponents) !== null && _e !== void 0 ? _e : {}, this.options.frameworkComponentFactory
9219
- ? {
9220
- createComponent: this.options.frameworkComponentFactory
9221
- .createComponent,
9222
- }
9223
- : undefined);
9231
+ const view = this.options.createComponent({
9232
+ id: options.id,
9233
+ name: options.component,
9234
+ });
9224
9235
  view.init({
9225
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9236
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9226
9237
  minimumWidth: options.minimumWidth,
9227
9238
  maximumWidth: options.maximumWidth,
9228
9239
  minimumHeight: options.minimumHeight,
@@ -9350,12 +9361,6 @@ class SplitviewComponent extends Resizable {
9350
9361
  this._classNames = new Classnames(this.element);
9351
9362
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9352
9363
  this._options = options;
9353
- if (!options.components) {
9354
- options.components = {};
9355
- }
9356
- if (!options.frameworkComponents) {
9357
- options.frameworkComponents = {};
9358
- }
9359
9364
  this.splitview = new Splitview(this.element, options);
9360
9365
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9361
9366
  }
@@ -9418,18 +9423,17 @@ class SplitviewComponent extends Resizable {
9418
9423
  return this.panels.find((view) => view.id === id);
9419
9424
  }
9420
9425
  addPanel(options) {
9421
- var _a, _b, _c;
9426
+ var _a;
9422
9427
  if (this._panels.has(options.id)) {
9423
9428
  throw new Error(`panel ${options.id} already exists`);
9424
9429
  }
9425
- const view = createComponent(options.id, options.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9426
- ? {
9427
- createComponent: this.options.frameworkWrapper.createComponent,
9428
- }
9429
- : undefined);
9430
+ const view = this.options.createComponent({
9431
+ id: options.id,
9432
+ name: options.component,
9433
+ });
9430
9434
  view.orientation = this.splitview.orientation;
9431
9435
  view.init({
9432
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9436
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9433
9437
  minimumSize: options.minimumSize,
9434
9438
  maximumSize: options.maximumSize,
9435
9439
  snap: options.snap,
@@ -9491,17 +9495,14 @@ class SplitviewComponent extends Resizable {
9491
9495
  descriptor: {
9492
9496
  size,
9493
9497
  views: views.map((view) => {
9494
- var _a, _b;
9495
9498
  const data = view.data;
9496
9499
  if (this._panels.has(data.id)) {
9497
9500
  throw new Error(`panel ${data.id} already exists`);
9498
9501
  }
9499
- const panel = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9500
- ? {
9501
- createComponent: this.options.frameworkWrapper
9502
- .createComponent,
9503
- }
9504
- : undefined);
9502
+ const panel = this.options.createComponent({
9503
+ id: data.id,
9504
+ name: data.component,
9505
+ });
9505
9506
  queue.push(() => {
9506
9507
  var _a;
9507
9508
  panel.init({
@@ -9684,16 +9685,12 @@ class PaneviewComponent extends Resizable {
9684
9685
  this.onDidAddView = this._onDidAddView.event;
9685
9686
  this._onDidRemoveView = new Emitter();
9686
9687
  this.onDidRemoveView = this._onDidRemoveView.event;
9687
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9688
+ this._onUnhandledDragOverEvent = new Emitter();
9689
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9690
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9688
9691
  this._classNames = new Classnames(this.element);
9689
9692
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9690
9693
  this._options = options;
9691
- if (!options.components) {
9692
- options.components = {};
9693
- }
9694
- if (!options.frameworkComponents) {
9695
- options.frameworkComponents = {};
9696
- }
9697
9694
  this.paneview = new Paneview(this.element, {
9698
9695
  // only allow paneview in the vertical orientation for now
9699
9696
  orientation: exports.Orientation.VERTICAL,
@@ -9718,22 +9715,19 @@ class PaneviewComponent extends Resizable {
9718
9715
  this._options = Object.assign(Object.assign({}, this.options), options);
9719
9716
  }
9720
9717
  addPanel(options) {
9721
- var _a, _b, _c, _d;
9722
- const body = createComponent(options.id, options.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9723
- ? {
9724
- createComponent: this.options.frameworkWrapper.body.createComponent,
9725
- }
9726
- : undefined);
9718
+ var _a;
9719
+ const body = this.options.createComponent({
9720
+ id: options.id,
9721
+ name: options.component,
9722
+ });
9727
9723
  let header;
9728
- if (options.headerComponent) {
9729
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9730
- ? {
9731
- createComponent: this.options.frameworkWrapper.header
9732
- .createComponent,
9733
- }
9734
- : undefined);
9724
+ if (options.headerComponent && this.options.createHeaderComponent) {
9725
+ header = this.options.createHeaderComponent({
9726
+ id: options.id,
9727
+ name: options.headerComponent,
9728
+ });
9735
9729
  }
9736
- else {
9730
+ if (!header) {
9737
9731
  header = new DefaultHeader();
9738
9732
  }
9739
9733
  const view = new PaneFramework({
@@ -9751,7 +9745,7 @@ class PaneviewComponent extends Resizable {
9751
9745
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9752
9746
  const index = typeof options.index === 'number' ? options.index : undefined;
9753
9747
  view.init({
9754
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9748
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9755
9749
  minimumBodySize: options.minimumBodySize,
9756
9750
  maximumBodySize: options.maximumBodySize,
9757
9751
  isExpanded: options.isExpanded,
@@ -9816,24 +9810,20 @@ class PaneviewComponent extends Resizable {
9816
9810
  descriptor: {
9817
9811
  size,
9818
9812
  views: views.map((view) => {
9819
- var _a, _b, _c, _d;
9820
9813
  const data = view.data;
9821
- const body = createComponent(data.id, data.component, (_a = this.options.components) !== null && _a !== void 0 ? _a : {}, (_b = this.options.frameworkComponents) !== null && _b !== void 0 ? _b : {}, this.options.frameworkWrapper
9822
- ? {
9823
- createComponent: this.options.frameworkWrapper.body
9824
- .createComponent,
9825
- }
9826
- : undefined);
9814
+ const body = this.options.createComponent({
9815
+ id: data.id,
9816
+ name: data.component,
9817
+ });
9827
9818
  let header;
9828
- if (data.headerComponent) {
9829
- header = createComponent(data.id, data.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, (_d = this.options.headerframeworkComponents) !== null && _d !== void 0 ? _d : {}, this.options.frameworkWrapper
9830
- ? {
9831
- createComponent: this.options.frameworkWrapper.header
9832
- .createComponent,
9833
- }
9834
- : undefined);
9819
+ if (data.headerComponent &&
9820
+ this.options.createHeaderComponent) {
9821
+ header = this.options.createHeaderComponent({
9822
+ id: data.id,
9823
+ name: data.headerComponent,
9824
+ });
9835
9825
  }
9836
- else {
9826
+ if (!header) {
9837
9827
  header = new DefaultHeader();
9838
9828
  }
9839
9829
  const panel = new PaneFramework({
@@ -9881,9 +9871,11 @@ class PaneviewComponent extends Resizable {
9881
9871
  this.paneview.dispose();
9882
9872
  }
9883
9873
  doAddPanel(panel) {
9884
- const disposable = panel.onDidDrop((event) => {
9874
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9885
9875
  this._onDidDrop.fire(event);
9886
- });
9876
+ }), panel.onUnhandledDragOverEvent((event) => {
9877
+ this._onUnhandledDragOverEvent.fire(event);
9878
+ }));
9887
9879
  this._viewDisposables.set(panel.id, disposable);
9888
9880
  }
9889
9881
  doRemovePanel(panel) {
@@ -10166,7 +10158,7 @@ class ReactPanelContentPart {
10166
10158
  this._onDidBlur = new Emitter();
10167
10159
  this.onDidBlur = this._onDidBlur.event;
10168
10160
  this._element = document.createElement('div');
10169
- this._element.className = 'dockview-react-part';
10161
+ this._element.className = 'dv-react-part';
10170
10162
  this._element.style.height = '100%';
10171
10163
  this._element.style.width = '100%';
10172
10164
  }
@@ -10204,7 +10196,7 @@ class ReactPanelHeaderPart {
10204
10196
  this.component = component;
10205
10197
  this.reactPortalStore = reactPortalStore;
10206
10198
  this._element = document.createElement('div');
10207
- this._element.className = 'dockview-react-part';
10199
+ this._element.className = 'dv-react-part';
10208
10200
  this._element.style.height = '100%';
10209
10201
  this._element.style.width = '100%';
10210
10202
  }
@@ -10240,7 +10232,7 @@ class ReactWatermarkPart {
10240
10232
  this.component = component;
10241
10233
  this.reactPortalStore = reactPortalStore;
10242
10234
  this._element = document.createElement('div');
10243
- this._element.className = 'dockview-react-part';
10235
+ this._element.className = 'dv-react-part';
10244
10236
  this._element.style.height = '100%';
10245
10237
  this._element.style.width = '100%';
10246
10238
  }
@@ -10282,7 +10274,7 @@ class ReactHeaderActionsRendererPart {
10282
10274
  this._group = _group;
10283
10275
  this.mutableDisposable = new MutableDisposable();
10284
10276
  this._element = document.createElement('div');
10285
- this._element.className = 'dockview-react-part';
10277
+ this._element.className = 'dv-react-part';
10286
10278
  this._element.style.height = '100%';
10287
10279
  this._element.style.width = '100%';
10288
10280
  }
@@ -10341,8 +10333,8 @@ function createGroupControlElement(component, store) {
10341
10333
  : undefined;
10342
10334
  }
10343
10335
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10344
- function extractCoreOptions(props) {
10345
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10336
+ function extractCoreOptions$3(props) {
10337
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10346
10338
  if (key in props) {
10347
10339
  obj[key] = props[key];
10348
10340
  }
@@ -10358,7 +10350,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10358
10350
  const prevProps = React.useRef({});
10359
10351
  React.useEffect(() => {
10360
10352
  const changes = {};
10361
- PROPERTY_KEYS.forEach((propKey) => {
10353
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10362
10354
  const key = propKey;
10363
10355
  const propValue = props[key];
10364
10356
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10369,7 +10361,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10369
10361
  dockviewRef.current.updateOptions(changes);
10370
10362
  }
10371
10363
  prevProps.current = props;
10372
- }, PROPERTY_KEYS.map((key) => props[key]));
10364
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10373
10365
  React.useEffect(() => {
10374
10366
  var _a;
10375
10367
  if (!domRef.current) {
@@ -10405,7 +10397,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10405
10397
  ? DEFAULT_REACT_TAB
10406
10398
  : undefined,
10407
10399
  };
10408
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10400
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10409
10401
  const { clientWidth, clientHeight } = domRef.current;
10410
10402
  api.layout(clientWidth, clientHeight);
10411
10403
  if (props.onReady) {
@@ -10593,31 +10585,47 @@ class ReactPanelView extends SplitviewPanel {
10593
10585
  }
10594
10586
  }
10595
10587
 
10588
+ function extractCoreOptions$2(props) {
10589
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10590
+ if (key in props) {
10591
+ obj[key] = props[key];
10592
+ }
10593
+ return obj;
10594
+ }, {});
10595
+ return coreOptions;
10596
+ }
10596
10597
  const SplitviewReact = React.forwardRef((props, ref) => {
10597
10598
  const domRef = React.useRef(null);
10598
10599
  const splitviewRef = React.useRef();
10599
10600
  const [portals, addPortal] = usePortalsLifecycle();
10600
10601
  React.useImperativeHandle(ref, () => domRef.current, []);
10602
+ const prevProps = React.useRef({});
10601
10603
  React.useEffect(() => {
10602
- var _a;
10603
- const api = createSplitview(domRef.current, {
10604
- disableAutoResizing: props.disableAutoResizing,
10605
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10606
- frameworkComponents: props.components,
10607
- frameworkWrapper: {
10608
- createComponent: (id, componentId, component) => {
10609
- return new ReactPanelView(id, componentId, component, {
10610
- addPortal,
10611
- });
10612
- },
10613
- },
10614
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10615
- ? props.proportionalLayout
10616
- : true,
10617
- styles: props.hideBorders
10618
- ? { separatorBorder: 'transparent' }
10619
- : undefined,
10604
+ const changes = {};
10605
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10606
+ const key = propKey;
10607
+ const propValue = props[key];
10608
+ if (key in props && propValue !== prevProps.current[key]) {
10609
+ changes[key] = propValue;
10610
+ }
10620
10611
  });
10612
+ if (splitviewRef.current) {
10613
+ splitviewRef.current.updateOptions(changes);
10614
+ }
10615
+ prevProps.current = props;
10616
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10617
+ React.useEffect(() => {
10618
+ if (!domRef.current) {
10619
+ return () => {
10620
+ // noop
10621
+ };
10622
+ }
10623
+ const frameworkOptions = {
10624
+ createComponent: (options) => {
10625
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10626
+ },
10627
+ };
10628
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10621
10629
  const { clientWidth, clientHeight } = domRef.current;
10622
10630
  api.layout(clientWidth, clientHeight);
10623
10631
  if (props.onReady) {
@@ -10633,7 +10641,9 @@ const SplitviewReact = React.forwardRef((props, ref) => {
10633
10641
  return;
10634
10642
  }
10635
10643
  splitviewRef.current.updateOptions({
10636
- frameworkComponents: props.components,
10644
+ createComponent: (options) => {
10645
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10646
+ },
10637
10647
  });
10638
10648
  }, [props.components]);
10639
10649
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10658,36 +10668,47 @@ class ReactGridPanelView extends GridviewPanel {
10658
10668
  }
10659
10669
  }
10660
10670
 
10671
+ function extractCoreOptions$1(props) {
10672
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10673
+ if (key in props) {
10674
+ obj[key] = props[key];
10675
+ }
10676
+ return obj;
10677
+ }, {});
10678
+ return coreOptions;
10679
+ }
10661
10680
  const GridviewReact = React.forwardRef((props, ref) => {
10662
10681
  const domRef = React.useRef(null);
10663
10682
  const gridviewRef = React.useRef();
10664
10683
  const [portals, addPortal] = usePortalsLifecycle();
10665
10684
  React.useImperativeHandle(ref, () => domRef.current, []);
10685
+ const prevProps = React.useRef({});
10686
+ React.useEffect(() => {
10687
+ const changes = {};
10688
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10689
+ const key = propKey;
10690
+ const propValue = props[key];
10691
+ if (key in props && propValue !== prevProps.current[key]) {
10692
+ changes[key] = propValue;
10693
+ }
10694
+ });
10695
+ if (gridviewRef.current) {
10696
+ gridviewRef.current.updateOptions(changes);
10697
+ }
10698
+ prevProps.current = props;
10699
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10666
10700
  React.useEffect(() => {
10667
- var _a;
10668
10701
  if (!domRef.current) {
10669
10702
  return () => {
10670
10703
  // noop
10671
10704
  };
10672
10705
  }
10673
- const api = createGridview(domRef.current, {
10674
- disableAutoResizing: props.disableAutoResizing,
10675
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10676
- ? props.proportionalLayout
10677
- : true,
10678
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10679
- frameworkComponents: props.components,
10680
- frameworkComponentFactory: {
10681
- createComponent: (id, componentId, component) => {
10682
- return new ReactGridPanelView(id, componentId, component, {
10683
- addPortal,
10684
- });
10685
- },
10706
+ const frameworkOptions = {
10707
+ createComponent: (options) => {
10708
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10686
10709
  },
10687
- styles: props.hideBorders
10688
- ? { separatorBorder: 'transparent' }
10689
- : undefined,
10690
- });
10710
+ };
10711
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10691
10712
  const { clientWidth, clientHeight } = domRef.current;
10692
10713
  api.layout(clientWidth, clientHeight);
10693
10714
  if (props.onReady) {
@@ -10703,7 +10724,9 @@ const GridviewReact = React.forwardRef((props, ref) => {
10703
10724
  return;
10704
10725
  }
10705
10726
  gridviewRef.current.updateOptions({
10706
- frameworkComponents: props.components,
10727
+ createComponent: (options) => {
10728
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10729
+ },
10707
10730
  });
10708
10731
  }, [props.components]);
10709
10732
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10745,32 +10768,52 @@ class PanePanelSection {
10745
10768
  }
10746
10769
  }
10747
10770
 
10771
+ function extractCoreOptions(props) {
10772
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10773
+ if (key in props) {
10774
+ obj[key] = props[key];
10775
+ }
10776
+ return obj;
10777
+ }, {});
10778
+ return coreOptions;
10779
+ }
10748
10780
  const PaneviewReact = React.forwardRef((props, ref) => {
10749
10781
  const domRef = React.useRef(null);
10750
10782
  const paneviewRef = React.useRef();
10751
10783
  const [portals, addPortal] = usePortalsLifecycle();
10752
10784
  React.useImperativeHandle(ref, () => domRef.current, []);
10785
+ const prevProps = React.useRef({});
10753
10786
  React.useEffect(() => {
10754
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10755
- addPortal,
10787
+ const changes = {};
10788
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10789
+ const key = propKey;
10790
+ const propValue = props[key];
10791
+ if (key in props && propValue !== prevProps.current[key]) {
10792
+ changes[key] = propValue;
10793
+ }
10756
10794
  });
10757
- const api = createPaneview(domRef.current, {
10758
- disableAutoResizing: props.disableAutoResizing,
10759
- frameworkComponents: props.components,
10760
- components: {},
10761
- headerComponents: {},
10762
- disableDnd: props.disableDnd,
10763
- headerframeworkComponents: props.headerComponents,
10764
- frameworkWrapper: {
10765
- header: {
10766
- createComponent,
10767
- },
10768
- body: {
10769
- createComponent,
10770
- },
10795
+ if (paneviewRef.current) {
10796
+ paneviewRef.current.updateOptions(changes);
10797
+ }
10798
+ prevProps.current = props;
10799
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10800
+ React.useEffect(() => {
10801
+ var _a;
10802
+ if (!domRef.current) {
10803
+ return () => {
10804
+ // noop
10805
+ };
10806
+ }
10807
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10808
+ const frameworkOptions = {
10809
+ createComponent: (options) => {
10810
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10771
10811
  },
10772
- showDndOverlay: props.showDndOverlay,
10773
- });
10812
+ createHeaderComponent: (options) => {
10813
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10814
+ },
10815
+ };
10816
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10774
10817
  const { clientWidth, clientHeight } = domRef.current;
10775
10818
  api.layout(clientWidth, clientHeight);
10776
10819
  if (props.onReady) {
@@ -10786,41 +10829,38 @@ const PaneviewReact = React.forwardRef((props, ref) => {
10786
10829
  return;
10787
10830
  }
10788
10831
  paneviewRef.current.updateOptions({
10789
- frameworkComponents: props.components,
10832
+ createComponent: (options) => {
10833
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10834
+ },
10790
10835
  });
10791
10836
  }, [props.components]);
10792
10837
  React.useEffect(() => {
10838
+ var _a;
10793
10839
  if (!paneviewRef.current) {
10794
10840
  return;
10795
10841
  }
10842
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10796
10843
  paneviewRef.current.updateOptions({
10797
- headerframeworkComponents: props.headerComponents,
10844
+ createHeaderComponent: (options) => {
10845
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10846
+ },
10798
10847
  });
10799
10848
  }, [props.headerComponents]);
10800
10849
  React.useEffect(() => {
10801
10850
  if (!paneviewRef.current) {
10802
10851
  return () => {
10803
- //
10852
+ // noop
10804
10853
  };
10805
10854
  }
10806
- const api = paneviewRef.current;
10807
- const disposable = api.onDidDrop((event) => {
10855
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10808
10856
  if (props.onDidDrop) {
10809
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10857
+ props.onDidDrop(event);
10810
10858
  }
10811
10859
  });
10812
10860
  return () => {
10813
10861
  disposable.dispose();
10814
10862
  };
10815
10863
  }, [props.onDidDrop]);
10816
- React.useEffect(() => {
10817
- if (!paneviewRef.current) {
10818
- return;
10819
- }
10820
- paneviewRef.current.updateOptions({
10821
- showDndOverlay: props.showDndOverlay,
10822
- });
10823
- }, [props.showDndOverlay]);
10824
10864
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10825
10865
  });
10826
10866
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10848,7 +10888,10 @@ exports.GridviewApi = GridviewApi;
10848
10888
  exports.GridviewComponent = GridviewComponent;
10849
10889
  exports.GridviewPanel = GridviewPanel;
10850
10890
  exports.GridviewReact = GridviewReact;
10851
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10891
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10892
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10893
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10894
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10852
10895
  exports.PaneFramework = PaneFramework;
10853
10896
  exports.PaneTransfer = PaneTransfer;
10854
10897
  exports.PanelTransfer = PanelTransfer;
@@ -10857,6 +10900,7 @@ exports.PaneviewApi = PaneviewApi;
10857
10900
  exports.PaneviewComponent = PaneviewComponent;
10858
10901
  exports.PaneviewPanel = PaneviewPanel;
10859
10902
  exports.PaneviewReact = PaneviewReact;
10903
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10860
10904
  exports.ReactPart = ReactPart;
10861
10905
  exports.ReactPartContext = ReactPartContext;
10862
10906
  exports.Splitview = Splitview;