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
  */
@@ -129,6 +129,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
129
129
  this._defaultPrevented = true;
130
130
  }
131
131
  }
132
+ class AcceptableEvent {
133
+ constructor() {
134
+ this._isAccepted = false;
135
+ }
136
+ get isAccepted() {
137
+ return this._isAccepted;
138
+ }
139
+ accept() {
140
+ this._isAccepted = true;
141
+ }
142
+ }
132
143
  class LeakageMonitor {
133
144
  constructor() {
134
145
  this.events = new Map();
@@ -1520,6 +1531,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1520
1531
  }
1521
1532
  }
1522
1533
 
1534
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1535
+ /**
1536
+ * by readong the keys from an empty value object TypeScript will error
1537
+ * when we add or remove new properties to `DockviewOptions`
1538
+ */
1539
+ const properties = {
1540
+ orientation: undefined,
1541
+ descriptor: undefined,
1542
+ proportionalLayout: undefined,
1543
+ styles: undefined,
1544
+ margin: undefined,
1545
+ disableAutoResizing: undefined,
1546
+ className: undefined,
1547
+ };
1548
+ return Object.keys(properties);
1549
+ })();
1550
+
1523
1551
  class Paneview extends CompositeDisposable {
1524
1552
  get onDidAddView() {
1525
1553
  return this.splitview.onDidAddView;
@@ -2649,6 +2677,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2649
2677
  }
2650
2678
  }
2651
2679
 
2680
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2681
+ /**
2682
+ * by readong the keys from an empty value object TypeScript will error
2683
+ * when we add or remove new properties to `DockviewOptions`
2684
+ */
2685
+ const properties = {
2686
+ disableAutoResizing: undefined,
2687
+ proportionalLayout: undefined,
2688
+ orientation: undefined,
2689
+ hideBorders: undefined,
2690
+ className: undefined,
2691
+ };
2692
+ return Object.keys(properties);
2693
+ })();
2694
+
2652
2695
  class Resizable extends CompositeDisposable {
2653
2696
  get element() {
2654
2697
  return this._element;
@@ -3126,15 +3169,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3126
3169
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3127
3170
  */
3128
3171
  get onDidDrop() {
3129
- const emitter = new Emitter();
3130
- const disposable = this.component.onDidDrop((e) => {
3131
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3132
- });
3133
- emitter.dispose = () => {
3134
- disposable.dispose();
3135
- emitter.dispose();
3136
- };
3137
- return emitter.event;
3172
+ return this.component.onDidDrop;
3173
+ }
3174
+ get onUnhandledDragOverEvent() {
3175
+ return this.component.onUnhandledDragOverEvent;
3138
3176
  }
3139
3177
  constructor(component) {
3140
3178
  this.component = component;
@@ -4061,6 +4099,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4061
4099
  return 'center';
4062
4100
  }
4063
4101
 
4102
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4103
+ /**
4104
+ * by readong the keys from an empty value object TypeScript will error
4105
+ * when we add or remove new properties to `DockviewOptions`
4106
+ */
4107
+ const properties = {
4108
+ disableAutoResizing: undefined,
4109
+ disableDnd: undefined,
4110
+ className: undefined,
4111
+ };
4112
+ return Object.keys(properties);
4113
+ })();
4114
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4115
+ constructor(nativeEvent, position, getData, panel) {
4116
+ super();
4117
+ this.nativeEvent = nativeEvent;
4118
+ this.position = position;
4119
+ this.getData = getData;
4120
+ this.panel = panel;
4121
+ }
4122
+ }
4123
+
4064
4124
  class WillFocusEvent extends DockviewEvent {
4065
4125
  constructor() {
4066
4126
  super();
@@ -4484,6 +4544,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4484
4544
  this.accessor = accessor;
4485
4545
  this._onDidDrop = new Emitter();
4486
4546
  this.onDidDrop = this._onDidDrop.event;
4547
+ this._onUnhandledDragOverEvent = new Emitter();
4548
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4549
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4487
4550
  if (!disableDnd) {
4488
4551
  this.initDragFeatures();
4489
4552
  }
@@ -4510,7 +4573,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4510
4573
  overlayModel: {
4511
4574
  activationSize: { type: 'percentage', value: 50 },
4512
4575
  },
4513
- canDisplayOverlay: (event) => {
4576
+ canDisplayOverlay: (event, position) => {
4514
4577
  const data = getPaneData();
4515
4578
  if (data) {
4516
4579
  if (data.paneId !== this.id &&
@@ -4518,14 +4581,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4518
4581
  return true;
4519
4582
  }
4520
4583
  }
4521
- if (this.accessor.options.showDndOverlay) {
4522
- return this.accessor.options.showDndOverlay({
4523
- nativeEvent: event,
4524
- getData: getPaneData,
4525
- panel: this,
4526
- });
4527
- }
4528
- return false;
4584
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4585
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4586
+ return firedEvent.isAccepted;
4529
4587
  },
4530
4588
  });
4531
4589
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4980,15 +5038,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4980
5038
  this._element.appendChild(this.leftActionsContainer);
4981
5039
  this._element.appendChild(this.voidContainer.element);
4982
5040
  this._element.appendChild(this.rightActionsContainer);
4983
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4984
- if (e.api.group === this.group) {
4985
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4986
- }
4987
- }), this.accessor.onDidRemovePanel((e) => {
4988
- if (e.api.group === this.group) {
4989
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4990
- }
4991
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5041
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4992
5042
  this._onGroupDragStart.fire({
4993
5043
  nativeEvent: event,
4994
5044
  group: this.group,
@@ -5033,20 +5083,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5033
5083
  setActive(_isGroupActive) {
5034
5084
  // noop
5035
5085
  }
5036
- addTab(tab, index = this.tabs.length) {
5037
- if (index < 0 || index > this.tabs.length) {
5038
- throw new Error('invalid location');
5039
- }
5040
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5041
- this.tabs = [
5042
- ...this.tabs.slice(0, index),
5043
- tab,
5044
- ...this.tabs.slice(index),
5045
- ];
5046
- if (this.selectedIndex < 0) {
5047
- this.selectedIndex = index;
5048
- }
5049
- }
5050
5086
  delete(id) {
5051
5087
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5052
5088
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5054,6 +5090,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5054
5090
  disposable.dispose();
5055
5091
  value.dispose();
5056
5092
  value.element.remove();
5093
+ this.updateClassnames();
5057
5094
  }
5058
5095
  setActivePanel(panel) {
5059
5096
  this.tabs.forEach((tab) => {
@@ -5122,25 +5159,37 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5122
5159
  }
5123
5160
  this.tabs = [];
5124
5161
  }
5162
+ addTab(tab, index = this.tabs.length) {
5163
+ if (index < 0 || index > this.tabs.length) {
5164
+ throw new Error('invalid location');
5165
+ }
5166
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5167
+ this.tabs = [
5168
+ ...this.tabs.slice(0, index),
5169
+ tab,
5170
+ ...this.tabs.slice(index),
5171
+ ];
5172
+ if (this.selectedIndex < 0) {
5173
+ this.selectedIndex = index;
5174
+ }
5175
+ this.updateClassnames();
5176
+ }
5177
+ updateClassnames() {
5178
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5179
+ }
5125
5180
  }
5126
5181
 
5127
- class DockviewUnhandledDragOverEvent {
5128
- get isAccepted() {
5129
- return this._isAccepted;
5130
- }
5182
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5131
5183
  constructor(nativeEvent, target, position, getData, group) {
5184
+ super();
5132
5185
  this.nativeEvent = nativeEvent;
5133
5186
  this.target = target;
5134
5187
  this.position = position;
5135
5188
  this.getData = getData;
5136
5189
  this.group = group;
5137
- this._isAccepted = false;
5138
- }
5139
- accept() {
5140
- this._isAccepted = true;
5141
5190
  }
5142
5191
  }
5143
- const PROPERTY_KEYS = (() => {
5192
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5144
5193
  /**
5145
5194
  * by readong the keys from an empty value object TypeScript will error
5146
5195
  * when we add or remove new properties to `DockviewOptions`
@@ -7640,10 +7689,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7640
7689
  this._api = new DockviewApi(this);
7641
7690
  this.updateWatermark();
7642
7691
  }
7643
- dispose() {
7644
- this.clear(); // explicitly clear the layout before cleaning up
7645
- super.dispose();
7646
- }
7647
7692
  setVisible(panel, visible) {
7648
7693
  switch (panel.api.location.type) {
7649
7694
  case 'grid':
@@ -7827,30 +7872,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7827
7872
  }
7828
7873
  }
7829
7874
  else if (this.getPanel(group.id)) {
7830
- const removedGroup = group;
7875
+ group.model.renderContainer =
7876
+ this.overlayRenderContainer;
7877
+ returnedGroup = group;
7831
7878
  if (floatingBox) {
7832
- this.addFloatingGroup(removedGroup, {
7879
+ this.addFloatingGroup(group, {
7833
7880
  height: floatingBox.height,
7834
7881
  width: floatingBox.width,
7835
7882
  position: floatingBox,
7836
7883
  });
7837
7884
  }
7838
7885
  else {
7839
- this.doRemoveGroup(removedGroup, {
7886
+ this.doRemoveGroup(group, {
7840
7887
  skipDispose: true,
7841
7888
  skipActive: true,
7842
7889
  skipPopoutReturn: true,
7843
7890
  });
7844
- removedGroup.model.renderContainer =
7845
- this.overlayRenderContainer;
7846
- removedGroup.model.location = { type: 'grid' };
7847
- returnedGroup = removedGroup;
7891
+ group.model.location = { type: 'grid' };
7848
7892
  this.movingLock(() => {
7849
7893
  // suppress group add events since the group already exists
7850
- this.doAddGroup(removedGroup, [0]);
7894
+ this.doAddGroup(group, [0]);
7851
7895
  });
7852
7896
  }
7853
- this.doSetGroupAndPanelActive(removedGroup);
7897
+ this.doSetGroupAndPanelActive(group);
7854
7898
  }
7855
7899
  }));
7856
7900
  this._popoutGroups.push(value);
@@ -8991,31 +9035,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8991
9035
  }
8992
9036
  }
8993
9037
 
8994
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8995
- const Component = typeof componentName === 'string'
8996
- ? components[componentName]
8997
- : undefined;
8998
- const FrameworkComponent = typeof componentName === 'string'
8999
- ? frameworkComponents[componentName]
9000
- : undefined;
9001
- if (Component && FrameworkComponent) {
9002
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
9003
- }
9004
- if (FrameworkComponent) {
9005
- if (!createFrameworkComponent) {
9006
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9007
- }
9008
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9009
- }
9010
- if (!Component) {
9011
- if (fallback) {
9012
- return fallback();
9013
- }
9014
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9015
- }
9016
- return new Component(id, componentName);
9017
- }
9018
-
9019
9038
  class GridviewComponent extends BaseGrid {
9020
9039
  get orientation() {
9021
9040
  return this.gridview.orientation;
@@ -9033,10 +9052,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9033
9052
  this._deserializer = value;
9034
9053
  }
9035
9054
  constructor(parentElement, options) {
9055
+ var _a;
9036
9056
  super(parentElement, {
9037
- proportionalLayout: options.proportionalLayout,
9057
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9038
9058
  orientation: options.orientation,
9039
- styles: options.styles,
9059
+ styles: options.hideBorders
9060
+ ? { separatorBorder: 'transparent' }
9061
+ : undefined,
9040
9062
  disableAutoResizing: options.disableAutoResizing,
9041
9063
  className: options.className,
9042
9064
  });
@@ -9056,12 +9078,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9056
9078
  }), this.onDidActiveChange((event) => {
9057
9079
  this._onDidActiveGroupChange.fire(event);
9058
9080
  }));
9059
- if (!this.options.components) {
9060
- this.options.components = {};
9061
- }
9062
- if (!this.options.frameworkComponents) {
9063
- this.options.frameworkComponents = {};
9064
- }
9065
9081
  }
9066
9082
  updateOptions(options) {
9067
9083
  super.updateOptions(options);
@@ -9111,14 +9127,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9111
9127
  const height = this.height;
9112
9128
  this.gridview.deserialize(grid, {
9113
9129
  fromJSON: (node) => {
9114
- var _a, _b;
9115
9130
  const { data } = node;
9116
- 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
9117
- ? {
9118
- createComponent: this.options.frameworkComponentFactory
9119
- .createComponent,
9120
- }
9121
- : undefined);
9131
+ const view = this.options.createComponent({
9132
+ id: data.id,
9133
+ name: data.component,
9134
+ });
9122
9135
  queue.push(() => view.init({
9123
9136
  params: data.params,
9124
9137
  minimumWidth: data.minimumWidth,
@@ -9196,7 +9209,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9196
9209
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9197
9210
  }
9198
9211
  addPanel(options) {
9199
- var _a, _b, _c, _d, _e, _f;
9212
+ var _a, _b, _c, _d;
9200
9213
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9201
9214
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9202
9215
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9212,14 +9225,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9212
9225
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9213
9226
  }
9214
9227
  }
9215
- 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
9216
- ? {
9217
- createComponent: this.options.frameworkComponentFactory
9218
- .createComponent,
9219
- }
9220
- : undefined);
9228
+ const view = this.options.createComponent({
9229
+ id: options.id,
9230
+ name: options.component,
9231
+ });
9221
9232
  view.init({
9222
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9233
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9223
9234
  minimumWidth: options.minimumWidth,
9224
9235
  maximumWidth: options.maximumWidth,
9225
9236
  minimumHeight: options.minimumHeight,
@@ -9347,12 +9358,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9347
9358
  this._classNames = new Classnames(this.element);
9348
9359
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9349
9360
  this._options = options;
9350
- if (!options.components) {
9351
- options.components = {};
9352
- }
9353
- if (!options.frameworkComponents) {
9354
- options.frameworkComponents = {};
9355
- }
9356
9361
  this.splitview = new Splitview(this.element, options);
9357
9362
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9358
9363
  }
@@ -9415,18 +9420,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9415
9420
  return this.panels.find((view) => view.id === id);
9416
9421
  }
9417
9422
  addPanel(options) {
9418
- var _a, _b, _c;
9423
+ var _a;
9419
9424
  if (this._panels.has(options.id)) {
9420
9425
  throw new Error(`panel ${options.id} already exists`);
9421
9426
  }
9422
- 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
9423
- ? {
9424
- createComponent: this.options.frameworkWrapper.createComponent,
9425
- }
9426
- : undefined);
9427
+ const view = this.options.createComponent({
9428
+ id: options.id,
9429
+ name: options.component,
9430
+ });
9427
9431
  view.orientation = this.splitview.orientation;
9428
9432
  view.init({
9429
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9433
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9430
9434
  minimumSize: options.minimumSize,
9431
9435
  maximumSize: options.maximumSize,
9432
9436
  snap: options.snap,
@@ -9488,17 +9492,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9488
9492
  descriptor: {
9489
9493
  size,
9490
9494
  views: views.map((view) => {
9491
- var _a, _b;
9492
9495
  const data = view.data;
9493
9496
  if (this._panels.has(data.id)) {
9494
9497
  throw new Error(`panel ${data.id} already exists`);
9495
9498
  }
9496
- 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
9497
- ? {
9498
- createComponent: this.options.frameworkWrapper
9499
- .createComponent,
9500
- }
9501
- : undefined);
9499
+ const panel = this.options.createComponent({
9500
+ id: data.id,
9501
+ name: data.component,
9502
+ });
9502
9503
  queue.push(() => {
9503
9504
  var _a;
9504
9505
  panel.init({
@@ -9681,16 +9682,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9681
9682
  this.onDidAddView = this._onDidAddView.event;
9682
9683
  this._onDidRemoveView = new Emitter();
9683
9684
  this.onDidRemoveView = this._onDidRemoveView.event;
9684
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9685
+ this._onUnhandledDragOverEvent = new Emitter();
9686
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9687
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9685
9688
  this._classNames = new Classnames(this.element);
9686
9689
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9687
9690
  this._options = options;
9688
- if (!options.components) {
9689
- options.components = {};
9690
- }
9691
- if (!options.frameworkComponents) {
9692
- options.frameworkComponents = {};
9693
- }
9694
9691
  this.paneview = new Paneview(this.element, {
9695
9692
  // only allow paneview in the vertical orientation for now
9696
9693
  orientation: exports.Orientation.VERTICAL,
@@ -9715,22 +9712,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9715
9712
  this._options = Object.assign(Object.assign({}, this.options), options);
9716
9713
  }
9717
9714
  addPanel(options) {
9718
- var _a, _b, _c, _d;
9719
- 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
9720
- ? {
9721
- createComponent: this.options.frameworkWrapper.body.createComponent,
9722
- }
9723
- : undefined);
9715
+ var _a;
9716
+ const body = this.options.createComponent({
9717
+ id: options.id,
9718
+ name: options.component,
9719
+ });
9724
9720
  let header;
9725
- if (options.headerComponent) {
9726
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9727
- ? {
9728
- createComponent: this.options.frameworkWrapper.header
9729
- .createComponent,
9730
- }
9731
- : undefined);
9721
+ if (options.headerComponent && this.options.createHeaderComponent) {
9722
+ header = this.options.createHeaderComponent({
9723
+ id: options.id,
9724
+ name: options.headerComponent,
9725
+ });
9732
9726
  }
9733
- else {
9727
+ if (!header) {
9734
9728
  header = new DefaultHeader();
9735
9729
  }
9736
9730
  const view = new PaneFramework({
@@ -9748,7 +9742,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9748
9742
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9749
9743
  const index = typeof options.index === 'number' ? options.index : undefined;
9750
9744
  view.init({
9751
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9745
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9752
9746
  minimumBodySize: options.minimumBodySize,
9753
9747
  maximumBodySize: options.maximumBodySize,
9754
9748
  isExpanded: options.isExpanded,
@@ -9813,24 +9807,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9813
9807
  descriptor: {
9814
9808
  size,
9815
9809
  views: views.map((view) => {
9816
- var _a, _b, _c, _d;
9817
9810
  const data = view.data;
9818
- 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
9819
- ? {
9820
- createComponent: this.options.frameworkWrapper.body
9821
- .createComponent,
9822
- }
9823
- : undefined);
9811
+ const body = this.options.createComponent({
9812
+ id: data.id,
9813
+ name: data.component,
9814
+ });
9824
9815
  let header;
9825
- if (data.headerComponent) {
9826
- 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
9827
- ? {
9828
- createComponent: this.options.frameworkWrapper.header
9829
- .createComponent,
9830
- }
9831
- : undefined);
9816
+ if (data.headerComponent &&
9817
+ this.options.createHeaderComponent) {
9818
+ header = this.options.createHeaderComponent({
9819
+ id: data.id,
9820
+ name: data.headerComponent,
9821
+ });
9832
9822
  }
9833
- else {
9823
+ if (!header) {
9834
9824
  header = new DefaultHeader();
9835
9825
  }
9836
9826
  const panel = new PaneFramework({
@@ -9878,9 +9868,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9878
9868
  this.paneview.dispose();
9879
9869
  }
9880
9870
  doAddPanel(panel) {
9881
- const disposable = panel.onDidDrop((event) => {
9871
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9882
9872
  this._onDidDrop.fire(event);
9883
- });
9873
+ }), panel.onUnhandledDragOverEvent((event) => {
9874
+ this._onUnhandledDragOverEvent.fire(event);
9875
+ }));
9884
9876
  this._viewDisposables.set(panel.id, disposable);
9885
9877
  }
9886
9878
  doRemovePanel(panel) {
@@ -10163,7 +10155,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10163
10155
  this._onDidBlur = new Emitter();
10164
10156
  this.onDidBlur = this._onDidBlur.event;
10165
10157
  this._element = document.createElement('div');
10166
- this._element.className = 'dockview-react-part';
10158
+ this._element.className = 'dv-react-part';
10167
10159
  this._element.style.height = '100%';
10168
10160
  this._element.style.width = '100%';
10169
10161
  }
@@ -10201,7 +10193,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10201
10193
  this.component = component;
10202
10194
  this.reactPortalStore = reactPortalStore;
10203
10195
  this._element = document.createElement('div');
10204
- this._element.className = 'dockview-react-part';
10196
+ this._element.className = 'dv-react-part';
10205
10197
  this._element.style.height = '100%';
10206
10198
  this._element.style.width = '100%';
10207
10199
  }
@@ -10237,7 +10229,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10237
10229
  this.component = component;
10238
10230
  this.reactPortalStore = reactPortalStore;
10239
10231
  this._element = document.createElement('div');
10240
- this._element.className = 'dockview-react-part';
10232
+ this._element.className = 'dv-react-part';
10241
10233
  this._element.style.height = '100%';
10242
10234
  this._element.style.width = '100%';
10243
10235
  }
@@ -10279,7 +10271,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10279
10271
  this._group = _group;
10280
10272
  this.mutableDisposable = new MutableDisposable();
10281
10273
  this._element = document.createElement('div');
10282
- this._element.className = 'dockview-react-part';
10274
+ this._element.className = 'dv-react-part';
10283
10275
  this._element.style.height = '100%';
10284
10276
  this._element.style.width = '100%';
10285
10277
  }
@@ -10338,8 +10330,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10338
10330
  : undefined;
10339
10331
  }
10340
10332
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10341
- function extractCoreOptions(props) {
10342
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10333
+ function extractCoreOptions$3(props) {
10334
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10343
10335
  if (key in props) {
10344
10336
  obj[key] = props[key];
10345
10337
  }
@@ -10355,7 +10347,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10355
10347
  const prevProps = React.useRef({});
10356
10348
  React.useEffect(() => {
10357
10349
  const changes = {};
10358
- PROPERTY_KEYS.forEach((propKey) => {
10350
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10359
10351
  const key = propKey;
10360
10352
  const propValue = props[key];
10361
10353
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10366,7 +10358,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10366
10358
  dockviewRef.current.updateOptions(changes);
10367
10359
  }
10368
10360
  prevProps.current = props;
10369
- }, PROPERTY_KEYS.map((key) => props[key]));
10361
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10370
10362
  React.useEffect(() => {
10371
10363
  var _a;
10372
10364
  if (!domRef.current) {
@@ -10402,7 +10394,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10402
10394
  ? DEFAULT_REACT_TAB
10403
10395
  : undefined,
10404
10396
  };
10405
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10397
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10406
10398
  const { clientWidth, clientHeight } = domRef.current;
10407
10399
  api.layout(clientWidth, clientHeight);
10408
10400
  if (props.onReady) {
@@ -10590,31 +10582,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10590
10582
  }
10591
10583
  }
10592
10584
 
10585
+ function extractCoreOptions$2(props) {
10586
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10587
+ if (key in props) {
10588
+ obj[key] = props[key];
10589
+ }
10590
+ return obj;
10591
+ }, {});
10592
+ return coreOptions;
10593
+ }
10593
10594
  const SplitviewReact = React.forwardRef((props, ref) => {
10594
10595
  const domRef = React.useRef(null);
10595
10596
  const splitviewRef = React.useRef();
10596
10597
  const [portals, addPortal] = usePortalsLifecycle();
10597
10598
  React.useImperativeHandle(ref, () => domRef.current, []);
10599
+ const prevProps = React.useRef({});
10598
10600
  React.useEffect(() => {
10599
- var _a;
10600
- const api = createSplitview(domRef.current, {
10601
- disableAutoResizing: props.disableAutoResizing,
10602
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10603
- frameworkComponents: props.components,
10604
- frameworkWrapper: {
10605
- createComponent: (id, componentId, component) => {
10606
- return new ReactPanelView(id, componentId, component, {
10607
- addPortal,
10608
- });
10609
- },
10610
- },
10611
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10612
- ? props.proportionalLayout
10613
- : true,
10614
- styles: props.hideBorders
10615
- ? { separatorBorder: 'transparent' }
10616
- : undefined,
10601
+ const changes = {};
10602
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10603
+ const key = propKey;
10604
+ const propValue = props[key];
10605
+ if (key in props && propValue !== prevProps.current[key]) {
10606
+ changes[key] = propValue;
10607
+ }
10617
10608
  });
10609
+ if (splitviewRef.current) {
10610
+ splitviewRef.current.updateOptions(changes);
10611
+ }
10612
+ prevProps.current = props;
10613
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10614
+ React.useEffect(() => {
10615
+ if (!domRef.current) {
10616
+ return () => {
10617
+ // noop
10618
+ };
10619
+ }
10620
+ const frameworkOptions = {
10621
+ createComponent: (options) => {
10622
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10623
+ },
10624
+ };
10625
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10618
10626
  const { clientWidth, clientHeight } = domRef.current;
10619
10627
  api.layout(clientWidth, clientHeight);
10620
10628
  if (props.onReady) {
@@ -10630,7 +10638,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10630
10638
  return;
10631
10639
  }
10632
10640
  splitviewRef.current.updateOptions({
10633
- frameworkComponents: props.components,
10641
+ createComponent: (options) => {
10642
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10643
+ },
10634
10644
  });
10635
10645
  }, [props.components]);
10636
10646
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10655,36 +10665,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10655
10665
  }
10656
10666
  }
10657
10667
 
10668
+ function extractCoreOptions$1(props) {
10669
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10670
+ if (key in props) {
10671
+ obj[key] = props[key];
10672
+ }
10673
+ return obj;
10674
+ }, {});
10675
+ return coreOptions;
10676
+ }
10658
10677
  const GridviewReact = React.forwardRef((props, ref) => {
10659
10678
  const domRef = React.useRef(null);
10660
10679
  const gridviewRef = React.useRef();
10661
10680
  const [portals, addPortal] = usePortalsLifecycle();
10662
10681
  React.useImperativeHandle(ref, () => domRef.current, []);
10682
+ const prevProps = React.useRef({});
10683
+ React.useEffect(() => {
10684
+ const changes = {};
10685
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10686
+ const key = propKey;
10687
+ const propValue = props[key];
10688
+ if (key in props && propValue !== prevProps.current[key]) {
10689
+ changes[key] = propValue;
10690
+ }
10691
+ });
10692
+ if (gridviewRef.current) {
10693
+ gridviewRef.current.updateOptions(changes);
10694
+ }
10695
+ prevProps.current = props;
10696
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10663
10697
  React.useEffect(() => {
10664
- var _a;
10665
10698
  if (!domRef.current) {
10666
10699
  return () => {
10667
10700
  // noop
10668
10701
  };
10669
10702
  }
10670
- const api = createGridview(domRef.current, {
10671
- disableAutoResizing: props.disableAutoResizing,
10672
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10673
- ? props.proportionalLayout
10674
- : true,
10675
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10676
- frameworkComponents: props.components,
10677
- frameworkComponentFactory: {
10678
- createComponent: (id, componentId, component) => {
10679
- return new ReactGridPanelView(id, componentId, component, {
10680
- addPortal,
10681
- });
10682
- },
10703
+ const frameworkOptions = {
10704
+ createComponent: (options) => {
10705
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10683
10706
  },
10684
- styles: props.hideBorders
10685
- ? { separatorBorder: 'transparent' }
10686
- : undefined,
10687
- });
10707
+ };
10708
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10688
10709
  const { clientWidth, clientHeight } = domRef.current;
10689
10710
  api.layout(clientWidth, clientHeight);
10690
10711
  if (props.onReady) {
@@ -10700,7 +10721,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10700
10721
  return;
10701
10722
  }
10702
10723
  gridviewRef.current.updateOptions({
10703
- frameworkComponents: props.components,
10724
+ createComponent: (options) => {
10725
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10726
+ },
10704
10727
  });
10705
10728
  }, [props.components]);
10706
10729
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10742,32 +10765,52 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10742
10765
  }
10743
10766
  }
10744
10767
 
10768
+ function extractCoreOptions(props) {
10769
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10770
+ if (key in props) {
10771
+ obj[key] = props[key];
10772
+ }
10773
+ return obj;
10774
+ }, {});
10775
+ return coreOptions;
10776
+ }
10745
10777
  const PaneviewReact = React.forwardRef((props, ref) => {
10746
10778
  const domRef = React.useRef(null);
10747
10779
  const paneviewRef = React.useRef();
10748
10780
  const [portals, addPortal] = usePortalsLifecycle();
10749
10781
  React.useImperativeHandle(ref, () => domRef.current, []);
10782
+ const prevProps = React.useRef({});
10750
10783
  React.useEffect(() => {
10751
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10752
- addPortal,
10784
+ const changes = {};
10785
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10786
+ const key = propKey;
10787
+ const propValue = props[key];
10788
+ if (key in props && propValue !== prevProps.current[key]) {
10789
+ changes[key] = propValue;
10790
+ }
10753
10791
  });
10754
- const api = createPaneview(domRef.current, {
10755
- disableAutoResizing: props.disableAutoResizing,
10756
- frameworkComponents: props.components,
10757
- components: {},
10758
- headerComponents: {},
10759
- disableDnd: props.disableDnd,
10760
- headerframeworkComponents: props.headerComponents,
10761
- frameworkWrapper: {
10762
- header: {
10763
- createComponent,
10764
- },
10765
- body: {
10766
- createComponent,
10767
- },
10792
+ if (paneviewRef.current) {
10793
+ paneviewRef.current.updateOptions(changes);
10794
+ }
10795
+ prevProps.current = props;
10796
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10797
+ React.useEffect(() => {
10798
+ var _a;
10799
+ if (!domRef.current) {
10800
+ return () => {
10801
+ // noop
10802
+ };
10803
+ }
10804
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10805
+ const frameworkOptions = {
10806
+ createComponent: (options) => {
10807
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10768
10808
  },
10769
- showDndOverlay: props.showDndOverlay,
10770
- });
10809
+ createHeaderComponent: (options) => {
10810
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10811
+ },
10812
+ };
10813
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10771
10814
  const { clientWidth, clientHeight } = domRef.current;
10772
10815
  api.layout(clientWidth, clientHeight);
10773
10816
  if (props.onReady) {
@@ -10783,41 +10826,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10783
10826
  return;
10784
10827
  }
10785
10828
  paneviewRef.current.updateOptions({
10786
- frameworkComponents: props.components,
10829
+ createComponent: (options) => {
10830
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10831
+ },
10787
10832
  });
10788
10833
  }, [props.components]);
10789
10834
  React.useEffect(() => {
10835
+ var _a;
10790
10836
  if (!paneviewRef.current) {
10791
10837
  return;
10792
10838
  }
10839
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10793
10840
  paneviewRef.current.updateOptions({
10794
- headerframeworkComponents: props.headerComponents,
10841
+ createHeaderComponent: (options) => {
10842
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10843
+ },
10795
10844
  });
10796
10845
  }, [props.headerComponents]);
10797
10846
  React.useEffect(() => {
10798
10847
  if (!paneviewRef.current) {
10799
10848
  return () => {
10800
- //
10849
+ // noop
10801
10850
  };
10802
10851
  }
10803
- const api = paneviewRef.current;
10804
- const disposable = api.onDidDrop((event) => {
10852
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10805
10853
  if (props.onDidDrop) {
10806
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10854
+ props.onDidDrop(event);
10807
10855
  }
10808
10856
  });
10809
10857
  return () => {
10810
10858
  disposable.dispose();
10811
10859
  };
10812
10860
  }, [props.onDidDrop]);
10813
- React.useEffect(() => {
10814
- if (!paneviewRef.current) {
10815
- return;
10816
- }
10817
- paneviewRef.current.updateOptions({
10818
- showDndOverlay: props.showDndOverlay,
10819
- });
10820
- }, [props.showDndOverlay]);
10821
10861
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10822
10862
  });
10823
10863
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10845,7 +10885,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10845
10885
  exports.GridviewComponent = GridviewComponent;
10846
10886
  exports.GridviewPanel = GridviewPanel;
10847
10887
  exports.GridviewReact = GridviewReact;
10848
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10888
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10889
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10890
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10891
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10849
10892
  exports.PaneFramework = PaneFramework;
10850
10893
  exports.PaneTransfer = PaneTransfer;
10851
10894
  exports.PanelTransfer = PanelTransfer;
@@ -10854,6 +10897,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10854
10897
  exports.PaneviewComponent = PaneviewComponent;
10855
10898
  exports.PaneviewPanel = PaneviewPanel;
10856
10899
  exports.PaneviewReact = PaneviewReact;
10900
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10857
10901
  exports.ReactPart = ReactPart;
10858
10902
  exports.ReactPartContext = ReactPartContext;
10859
10903
  exports.Splitview = Splitview;