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
  */
@@ -99,6 +99,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
99
99
  this._defaultPrevented = true;
100
100
  }
101
101
  }
102
+ class AcceptableEvent {
103
+ constructor() {
104
+ this._isAccepted = false;
105
+ }
106
+ get isAccepted() {
107
+ return this._isAccepted;
108
+ }
109
+ accept() {
110
+ this._isAccepted = true;
111
+ }
112
+ }
102
113
  class LeakageMonitor {
103
114
  constructor() {
104
115
  this.events = new Map();
@@ -1490,6 +1501,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
1490
1501
  }
1491
1502
  }
1492
1503
 
1504
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1505
+ /**
1506
+ * by readong the keys from an empty value object TypeScript will error
1507
+ * when we add or remove new properties to `DockviewOptions`
1508
+ */
1509
+ const properties = {
1510
+ orientation: undefined,
1511
+ descriptor: undefined,
1512
+ proportionalLayout: undefined,
1513
+ styles: undefined,
1514
+ margin: undefined,
1515
+ disableAutoResizing: undefined,
1516
+ className: undefined,
1517
+ };
1518
+ return Object.keys(properties);
1519
+ })();
1520
+
1493
1521
  class Paneview extends CompositeDisposable {
1494
1522
  get onDidAddView() {
1495
1523
  return this.splitview.onDidAddView;
@@ -2619,6 +2647,21 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
2619
2647
  }
2620
2648
  }
2621
2649
 
2650
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2651
+ /**
2652
+ * by readong the keys from an empty value object TypeScript will error
2653
+ * when we add or remove new properties to `DockviewOptions`
2654
+ */
2655
+ const properties = {
2656
+ disableAutoResizing: undefined,
2657
+ proportionalLayout: undefined,
2658
+ orientation: undefined,
2659
+ hideBorders: undefined,
2660
+ className: undefined,
2661
+ };
2662
+ return Object.keys(properties);
2663
+ })();
2664
+
2622
2665
  class Resizable extends CompositeDisposable {
2623
2666
  get element() {
2624
2667
  return this._element;
@@ -3096,15 +3139,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
3096
3139
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3097
3140
  */
3098
3141
  get onDidDrop() {
3099
- const emitter = new Emitter();
3100
- const disposable = this.component.onDidDrop((e) => {
3101
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3102
- });
3103
- emitter.dispose = () => {
3104
- disposable.dispose();
3105
- emitter.dispose();
3106
- };
3107
- return emitter.event;
3142
+ return this.component.onDidDrop;
3143
+ }
3144
+ get onUnhandledDragOverEvent() {
3145
+ return this.component.onUnhandledDragOverEvent;
3108
3146
  }
3109
3147
  constructor(component) {
3110
3148
  this.component = component;
@@ -4031,6 +4069,28 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4031
4069
  return 'center';
4032
4070
  }
4033
4071
 
4072
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4073
+ /**
4074
+ * by readong the keys from an empty value object TypeScript will error
4075
+ * when we add or remove new properties to `DockviewOptions`
4076
+ */
4077
+ const properties = {
4078
+ disableAutoResizing: undefined,
4079
+ disableDnd: undefined,
4080
+ className: undefined,
4081
+ };
4082
+ return Object.keys(properties);
4083
+ })();
4084
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4085
+ constructor(nativeEvent, position, getData, panel) {
4086
+ super();
4087
+ this.nativeEvent = nativeEvent;
4088
+ this.position = position;
4089
+ this.getData = getData;
4090
+ this.panel = panel;
4091
+ }
4092
+ }
4093
+
4034
4094
  class WillFocusEvent extends DockviewEvent {
4035
4095
  constructor() {
4036
4096
  super();
@@ -4454,6 +4514,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4454
4514
  this.accessor = accessor;
4455
4515
  this._onDidDrop = new Emitter();
4456
4516
  this.onDidDrop = this._onDidDrop.event;
4517
+ this._onUnhandledDragOverEvent = new Emitter();
4518
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4519
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4457
4520
  if (!disableDnd) {
4458
4521
  this.initDragFeatures();
4459
4522
  }
@@ -4480,7 +4543,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4480
4543
  overlayModel: {
4481
4544
  activationSize: { type: 'percentage', value: 50 },
4482
4545
  },
4483
- canDisplayOverlay: (event) => {
4546
+ canDisplayOverlay: (event, position) => {
4484
4547
  const data = getPaneData();
4485
4548
  if (data) {
4486
4549
  if (data.paneId !== this.id &&
@@ -4488,14 +4551,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4488
4551
  return true;
4489
4552
  }
4490
4553
  }
4491
- if (this.accessor.options.showDndOverlay) {
4492
- return this.accessor.options.showDndOverlay({
4493
- nativeEvent: event,
4494
- getData: getPaneData,
4495
- panel: this,
4496
- });
4497
- }
4498
- return false;
4554
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4555
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4556
+ return firedEvent.isAccepted;
4499
4557
  },
4500
4558
  });
4501
4559
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4950,15 +5008,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4950
5008
  this._element.appendChild(this.leftActionsContainer);
4951
5009
  this._element.appendChild(this.voidContainer.element);
4952
5010
  this._element.appendChild(this.rightActionsContainer);
4953
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4954
- if (e.api.group === this.group) {
4955
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4956
- }
4957
- }), this.accessor.onDidRemovePanel((e) => {
4958
- if (e.api.group === this.group) {
4959
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4960
- }
4961
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5011
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4962
5012
  this._onGroupDragStart.fire({
4963
5013
  nativeEvent: event,
4964
5014
  group: this.group,
@@ -5003,20 +5053,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5003
5053
  setActive(_isGroupActive) {
5004
5054
  // noop
5005
5055
  }
5006
- addTab(tab, index = this.tabs.length) {
5007
- if (index < 0 || index > this.tabs.length) {
5008
- throw new Error('invalid location');
5009
- }
5010
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5011
- this.tabs = [
5012
- ...this.tabs.slice(0, index),
5013
- tab,
5014
- ...this.tabs.slice(index),
5015
- ];
5016
- if (this.selectedIndex < 0) {
5017
- this.selectedIndex = index;
5018
- }
5019
- }
5020
5056
  delete(id) {
5021
5057
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5022
5058
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5024,6 +5060,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5024
5060
  disposable.dispose();
5025
5061
  value.dispose();
5026
5062
  value.element.remove();
5063
+ this.updateClassnames();
5027
5064
  }
5028
5065
  setActivePanel(panel) {
5029
5066
  this.tabs.forEach((tab) => {
@@ -5092,25 +5129,37 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
5092
5129
  }
5093
5130
  this.tabs = [];
5094
5131
  }
5132
+ addTab(tab, index = this.tabs.length) {
5133
+ if (index < 0 || index > this.tabs.length) {
5134
+ throw new Error('invalid location');
5135
+ }
5136
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5137
+ this.tabs = [
5138
+ ...this.tabs.slice(0, index),
5139
+ tab,
5140
+ ...this.tabs.slice(index),
5141
+ ];
5142
+ if (this.selectedIndex < 0) {
5143
+ this.selectedIndex = index;
5144
+ }
5145
+ this.updateClassnames();
5146
+ }
5147
+ updateClassnames() {
5148
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5149
+ }
5095
5150
  }
5096
5151
 
5097
- class DockviewUnhandledDragOverEvent {
5098
- get isAccepted() {
5099
- return this._isAccepted;
5100
- }
5152
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5101
5153
  constructor(nativeEvent, target, position, getData, group) {
5154
+ super();
5102
5155
  this.nativeEvent = nativeEvent;
5103
5156
  this.target = target;
5104
5157
  this.position = position;
5105
5158
  this.getData = getData;
5106
5159
  this.group = group;
5107
- this._isAccepted = false;
5108
- }
5109
- accept() {
5110
- this._isAccepted = true;
5111
5160
  }
5112
5161
  }
5113
- const PROPERTY_KEYS = (() => {
5162
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5114
5163
  /**
5115
5164
  * by readong the keys from an empty value object TypeScript will error
5116
5165
  * when we add or remove new properties to `DockviewOptions`
@@ -7610,10 +7659,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7610
7659
  this._api = new DockviewApi(this);
7611
7660
  this.updateWatermark();
7612
7661
  }
7613
- dispose() {
7614
- this.clear(); // explicitly clear the layout before cleaning up
7615
- super.dispose();
7616
- }
7617
7662
  setVisible(panel, visible) {
7618
7663
  switch (panel.api.location.type) {
7619
7664
  case 'grid':
@@ -7797,30 +7842,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
7797
7842
  }
7798
7843
  }
7799
7844
  else if (this.getPanel(group.id)) {
7800
- const removedGroup = group;
7845
+ group.model.renderContainer =
7846
+ this.overlayRenderContainer;
7847
+ returnedGroup = group;
7801
7848
  if (floatingBox) {
7802
- this.addFloatingGroup(removedGroup, {
7849
+ this.addFloatingGroup(group, {
7803
7850
  height: floatingBox.height,
7804
7851
  width: floatingBox.width,
7805
7852
  position: floatingBox,
7806
7853
  });
7807
7854
  }
7808
7855
  else {
7809
- this.doRemoveGroup(removedGroup, {
7856
+ this.doRemoveGroup(group, {
7810
7857
  skipDispose: true,
7811
7858
  skipActive: true,
7812
7859
  skipPopoutReturn: true,
7813
7860
  });
7814
- removedGroup.model.renderContainer =
7815
- this.overlayRenderContainer;
7816
- removedGroup.model.location = { type: 'grid' };
7817
- returnedGroup = removedGroup;
7861
+ group.model.location = { type: 'grid' };
7818
7862
  this.movingLock(() => {
7819
7863
  // suppress group add events since the group already exists
7820
- this.doAddGroup(removedGroup, [0]);
7864
+ this.doAddGroup(group, [0]);
7821
7865
  });
7822
7866
  }
7823
- this.doSetGroupAndPanelActive(removedGroup);
7867
+ this.doSetGroupAndPanelActive(group);
7824
7868
  }
7825
7869
  }));
7826
7870
  this._popoutGroups.push(value);
@@ -8961,31 +9005,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8961
9005
  }
8962
9006
  }
8963
9007
 
8964
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8965
- const Component = typeof componentName === 'string'
8966
- ? components[componentName]
8967
- : undefined;
8968
- const FrameworkComponent = typeof componentName === 'string'
8969
- ? frameworkComponents[componentName]
8970
- : undefined;
8971
- if (Component && FrameworkComponent) {
8972
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8973
- }
8974
- if (FrameworkComponent) {
8975
- if (!createFrameworkComponent) {
8976
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8977
- }
8978
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8979
- }
8980
- if (!Component) {
8981
- if (fallback) {
8982
- return fallback();
8983
- }
8984
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8985
- }
8986
- return new Component(id, componentName);
8987
- }
8988
-
8989
9008
  class GridviewComponent extends BaseGrid {
8990
9009
  get orientation() {
8991
9010
  return this.gridview.orientation;
@@ -9003,10 +9022,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9003
9022
  this._deserializer = value;
9004
9023
  }
9005
9024
  constructor(parentElement, options) {
9025
+ var _a;
9006
9026
  super(parentElement, {
9007
- proportionalLayout: options.proportionalLayout,
9027
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9008
9028
  orientation: options.orientation,
9009
- styles: options.styles,
9029
+ styles: options.hideBorders
9030
+ ? { separatorBorder: 'transparent' }
9031
+ : undefined,
9010
9032
  disableAutoResizing: options.disableAutoResizing,
9011
9033
  className: options.className,
9012
9034
  });
@@ -9026,12 +9048,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9026
9048
  }), this.onDidActiveChange((event) => {
9027
9049
  this._onDidActiveGroupChange.fire(event);
9028
9050
  }));
9029
- if (!this.options.components) {
9030
- this.options.components = {};
9031
- }
9032
- if (!this.options.frameworkComponents) {
9033
- this.options.frameworkComponents = {};
9034
- }
9035
9051
  }
9036
9052
  updateOptions(options) {
9037
9053
  super.updateOptions(options);
@@ -9081,14 +9097,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9081
9097
  const height = this.height;
9082
9098
  this.gridview.deserialize(grid, {
9083
9099
  fromJSON: (node) => {
9084
- var _a, _b;
9085
9100
  const { data } = node;
9086
- 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
9087
- ? {
9088
- createComponent: this.options.frameworkComponentFactory
9089
- .createComponent,
9090
- }
9091
- : undefined);
9101
+ const view = this.options.createComponent({
9102
+ id: data.id,
9103
+ name: data.component,
9104
+ });
9092
9105
  queue.push(() => view.init({
9093
9106
  params: data.params,
9094
9107
  minimumWidth: data.minimumWidth,
@@ -9166,7 +9179,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9166
9179
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9167
9180
  }
9168
9181
  addPanel(options) {
9169
- var _a, _b, _c, _d, _e, _f;
9182
+ var _a, _b, _c, _d;
9170
9183
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9171
9184
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9172
9185
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9182,14 +9195,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9182
9195
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9183
9196
  }
9184
9197
  }
9185
- 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
9186
- ? {
9187
- createComponent: this.options.frameworkComponentFactory
9188
- .createComponent,
9189
- }
9190
- : undefined);
9198
+ const view = this.options.createComponent({
9199
+ id: options.id,
9200
+ name: options.component,
9201
+ });
9191
9202
  view.init({
9192
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9203
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9193
9204
  minimumWidth: options.minimumWidth,
9194
9205
  maximumWidth: options.maximumWidth,
9195
9206
  minimumHeight: options.minimumHeight,
@@ -9317,12 +9328,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9317
9328
  this._classNames = new Classnames(this.element);
9318
9329
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9319
9330
  this._options = options;
9320
- if (!options.components) {
9321
- options.components = {};
9322
- }
9323
- if (!options.frameworkComponents) {
9324
- options.frameworkComponents = {};
9325
- }
9326
9331
  this.splitview = new Splitview(this.element, options);
9327
9332
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9328
9333
  }
@@ -9385,18 +9390,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9385
9390
  return this.panels.find((view) => view.id === id);
9386
9391
  }
9387
9392
  addPanel(options) {
9388
- var _a, _b, _c;
9393
+ var _a;
9389
9394
  if (this._panels.has(options.id)) {
9390
9395
  throw new Error(`panel ${options.id} already exists`);
9391
9396
  }
9392
- 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
9393
- ? {
9394
- createComponent: this.options.frameworkWrapper.createComponent,
9395
- }
9396
- : undefined);
9397
+ const view = this.options.createComponent({
9398
+ id: options.id,
9399
+ name: options.component,
9400
+ });
9397
9401
  view.orientation = this.splitview.orientation;
9398
9402
  view.init({
9399
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9403
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9400
9404
  minimumSize: options.minimumSize,
9401
9405
  maximumSize: options.maximumSize,
9402
9406
  snap: options.snap,
@@ -9458,17 +9462,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9458
9462
  descriptor: {
9459
9463
  size,
9460
9464
  views: views.map((view) => {
9461
- var _a, _b;
9462
9465
  const data = view.data;
9463
9466
  if (this._panels.has(data.id)) {
9464
9467
  throw new Error(`panel ${data.id} already exists`);
9465
9468
  }
9466
- 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
9467
- ? {
9468
- createComponent: this.options.frameworkWrapper
9469
- .createComponent,
9470
- }
9471
- : undefined);
9469
+ const panel = this.options.createComponent({
9470
+ id: data.id,
9471
+ name: data.component,
9472
+ });
9472
9473
  queue.push(() => {
9473
9474
  var _a;
9474
9475
  panel.init({
@@ -9651,16 +9652,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9651
9652
  this.onDidAddView = this._onDidAddView.event;
9652
9653
  this._onDidRemoveView = new Emitter();
9653
9654
  this.onDidRemoveView = this._onDidRemoveView.event;
9654
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9655
+ this._onUnhandledDragOverEvent = new Emitter();
9656
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9657
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9655
9658
  this._classNames = new Classnames(this.element);
9656
9659
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9657
9660
  this._options = options;
9658
- if (!options.components) {
9659
- options.components = {};
9660
- }
9661
- if (!options.frameworkComponents) {
9662
- options.frameworkComponents = {};
9663
- }
9664
9661
  this.paneview = new Paneview(this.element, {
9665
9662
  // only allow paneview in the vertical orientation for now
9666
9663
  orientation: exports.Orientation.VERTICAL,
@@ -9685,22 +9682,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9685
9682
  this._options = Object.assign(Object.assign({}, this.options), options);
9686
9683
  }
9687
9684
  addPanel(options) {
9688
- var _a, _b, _c, _d;
9689
- 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
9690
- ? {
9691
- createComponent: this.options.frameworkWrapper.body.createComponent,
9692
- }
9693
- : undefined);
9685
+ var _a;
9686
+ const body = this.options.createComponent({
9687
+ id: options.id,
9688
+ name: options.component,
9689
+ });
9694
9690
  let header;
9695
- if (options.headerComponent) {
9696
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9697
- ? {
9698
- createComponent: this.options.frameworkWrapper.header
9699
- .createComponent,
9700
- }
9701
- : undefined);
9691
+ if (options.headerComponent && this.options.createHeaderComponent) {
9692
+ header = this.options.createHeaderComponent({
9693
+ id: options.id,
9694
+ name: options.headerComponent,
9695
+ });
9702
9696
  }
9703
- else {
9697
+ if (!header) {
9704
9698
  header = new DefaultHeader();
9705
9699
  }
9706
9700
  const view = new PaneFramework({
@@ -9718,7 +9712,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9718
9712
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9719
9713
  const index = typeof options.index === 'number' ? options.index : undefined;
9720
9714
  view.init({
9721
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9715
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9722
9716
  minimumBodySize: options.minimumBodySize,
9723
9717
  maximumBodySize: options.maximumBodySize,
9724
9718
  isExpanded: options.isExpanded,
@@ -9783,24 +9777,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9783
9777
  descriptor: {
9784
9778
  size,
9785
9779
  views: views.map((view) => {
9786
- var _a, _b, _c, _d;
9787
9780
  const data = view.data;
9788
- 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
9789
- ? {
9790
- createComponent: this.options.frameworkWrapper.body
9791
- .createComponent,
9792
- }
9793
- : undefined);
9781
+ const body = this.options.createComponent({
9782
+ id: data.id,
9783
+ name: data.component,
9784
+ });
9794
9785
  let header;
9795
- if (data.headerComponent) {
9796
- 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
9797
- ? {
9798
- createComponent: this.options.frameworkWrapper.header
9799
- .createComponent,
9800
- }
9801
- : undefined);
9786
+ if (data.headerComponent &&
9787
+ this.options.createHeaderComponent) {
9788
+ header = this.options.createHeaderComponent({
9789
+ id: data.id,
9790
+ name: data.headerComponent,
9791
+ });
9802
9792
  }
9803
- else {
9793
+ if (!header) {
9804
9794
  header = new DefaultHeader();
9805
9795
  }
9806
9796
  const panel = new PaneFramework({
@@ -9848,9 +9838,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9848
9838
  this.paneview.dispose();
9849
9839
  }
9850
9840
  doAddPanel(panel) {
9851
- const disposable = panel.onDidDrop((event) => {
9841
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9852
9842
  this._onDidDrop.fire(event);
9853
- });
9843
+ }), panel.onUnhandledDragOverEvent((event) => {
9844
+ this._onUnhandledDragOverEvent.fire(event);
9845
+ }));
9854
9846
  this._viewDisposables.set(panel.id, disposable);
9855
9847
  }
9856
9848
  doRemovePanel(panel) {
@@ -10133,7 +10125,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10133
10125
  this._onDidBlur = new Emitter();
10134
10126
  this.onDidBlur = this._onDidBlur.event;
10135
10127
  this._element = document.createElement('div');
10136
- this._element.className = 'dockview-react-part';
10128
+ this._element.className = 'dv-react-part';
10137
10129
  this._element.style.height = '100%';
10138
10130
  this._element.style.width = '100%';
10139
10131
  }
@@ -10171,7 +10163,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10171
10163
  this.component = component;
10172
10164
  this.reactPortalStore = reactPortalStore;
10173
10165
  this._element = document.createElement('div');
10174
- this._element.className = 'dockview-react-part';
10166
+ this._element.className = 'dv-react-part';
10175
10167
  this._element.style.height = '100%';
10176
10168
  this._element.style.width = '100%';
10177
10169
  }
@@ -10207,7 +10199,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10207
10199
  this.component = component;
10208
10200
  this.reactPortalStore = reactPortalStore;
10209
10201
  this._element = document.createElement('div');
10210
- this._element.className = 'dockview-react-part';
10202
+ this._element.className = 'dv-react-part';
10211
10203
  this._element.style.height = '100%';
10212
10204
  this._element.style.width = '100%';
10213
10205
  }
@@ -10249,7 +10241,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10249
10241
  this._group = _group;
10250
10242
  this.mutableDisposable = new MutableDisposable();
10251
10243
  this._element = document.createElement('div');
10252
- this._element.className = 'dockview-react-part';
10244
+ this._element.className = 'dv-react-part';
10253
10245
  this._element.style.height = '100%';
10254
10246
  this._element.style.width = '100%';
10255
10247
  }
@@ -10308,8 +10300,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10308
10300
  : undefined;
10309
10301
  }
10310
10302
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10311
- function extractCoreOptions(props) {
10312
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10303
+ function extractCoreOptions$3(props) {
10304
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10313
10305
  if (key in props) {
10314
10306
  obj[key] = props[key];
10315
10307
  }
@@ -10325,7 +10317,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10325
10317
  const prevProps = React.useRef({});
10326
10318
  React.useEffect(() => {
10327
10319
  const changes = {};
10328
- PROPERTY_KEYS.forEach((propKey) => {
10320
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10329
10321
  const key = propKey;
10330
10322
  const propValue = props[key];
10331
10323
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10336,7 +10328,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10336
10328
  dockviewRef.current.updateOptions(changes);
10337
10329
  }
10338
10330
  prevProps.current = props;
10339
- }, PROPERTY_KEYS.map((key) => props[key]));
10331
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10340
10332
  React.useEffect(() => {
10341
10333
  var _a;
10342
10334
  if (!domRef.current) {
@@ -10372,7 +10364,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10372
10364
  ? DEFAULT_REACT_TAB
10373
10365
  : undefined,
10374
10366
  };
10375
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10367
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10376
10368
  const { clientWidth, clientHeight } = domRef.current;
10377
10369
  api.layout(clientWidth, clientHeight);
10378
10370
  if (props.onReady) {
@@ -10560,31 +10552,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10560
10552
  }
10561
10553
  }
10562
10554
 
10555
+ function extractCoreOptions$2(props) {
10556
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10557
+ if (key in props) {
10558
+ obj[key] = props[key];
10559
+ }
10560
+ return obj;
10561
+ }, {});
10562
+ return coreOptions;
10563
+ }
10563
10564
  const SplitviewReact = React.forwardRef((props, ref) => {
10564
10565
  const domRef = React.useRef(null);
10565
10566
  const splitviewRef = React.useRef();
10566
10567
  const [portals, addPortal] = usePortalsLifecycle();
10567
10568
  React.useImperativeHandle(ref, () => domRef.current, []);
10569
+ const prevProps = React.useRef({});
10568
10570
  React.useEffect(() => {
10569
- var _a;
10570
- const api = createSplitview(domRef.current, {
10571
- disableAutoResizing: props.disableAutoResizing,
10572
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10573
- frameworkComponents: props.components,
10574
- frameworkWrapper: {
10575
- createComponent: (id, componentId, component) => {
10576
- return new ReactPanelView(id, componentId, component, {
10577
- addPortal,
10578
- });
10579
- },
10580
- },
10581
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10582
- ? props.proportionalLayout
10583
- : true,
10584
- styles: props.hideBorders
10585
- ? { separatorBorder: 'transparent' }
10586
- : undefined,
10571
+ const changes = {};
10572
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10573
+ const key = propKey;
10574
+ const propValue = props[key];
10575
+ if (key in props && propValue !== prevProps.current[key]) {
10576
+ changes[key] = propValue;
10577
+ }
10587
10578
  });
10579
+ if (splitviewRef.current) {
10580
+ splitviewRef.current.updateOptions(changes);
10581
+ }
10582
+ prevProps.current = props;
10583
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10584
+ React.useEffect(() => {
10585
+ if (!domRef.current) {
10586
+ return () => {
10587
+ // noop
10588
+ };
10589
+ }
10590
+ const frameworkOptions = {
10591
+ createComponent: (options) => {
10592
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10593
+ },
10594
+ };
10595
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10588
10596
  const { clientWidth, clientHeight } = domRef.current;
10589
10597
  api.layout(clientWidth, clientHeight);
10590
10598
  if (props.onReady) {
@@ -10600,7 +10608,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10600
10608
  return;
10601
10609
  }
10602
10610
  splitviewRef.current.updateOptions({
10603
- frameworkComponents: props.components,
10611
+ createComponent: (options) => {
10612
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10613
+ },
10604
10614
  });
10605
10615
  }, [props.components]);
10606
10616
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10625,36 +10635,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10625
10635
  }
10626
10636
  }
10627
10637
 
10638
+ function extractCoreOptions$1(props) {
10639
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10640
+ if (key in props) {
10641
+ obj[key] = props[key];
10642
+ }
10643
+ return obj;
10644
+ }, {});
10645
+ return coreOptions;
10646
+ }
10628
10647
  const GridviewReact = React.forwardRef((props, ref) => {
10629
10648
  const domRef = React.useRef(null);
10630
10649
  const gridviewRef = React.useRef();
10631
10650
  const [portals, addPortal] = usePortalsLifecycle();
10632
10651
  React.useImperativeHandle(ref, () => domRef.current, []);
10652
+ const prevProps = React.useRef({});
10653
+ React.useEffect(() => {
10654
+ const changes = {};
10655
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10656
+ const key = propKey;
10657
+ const propValue = props[key];
10658
+ if (key in props && propValue !== prevProps.current[key]) {
10659
+ changes[key] = propValue;
10660
+ }
10661
+ });
10662
+ if (gridviewRef.current) {
10663
+ gridviewRef.current.updateOptions(changes);
10664
+ }
10665
+ prevProps.current = props;
10666
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10633
10667
  React.useEffect(() => {
10634
- var _a;
10635
10668
  if (!domRef.current) {
10636
10669
  return () => {
10637
10670
  // noop
10638
10671
  };
10639
10672
  }
10640
- const api = createGridview(domRef.current, {
10641
- disableAutoResizing: props.disableAutoResizing,
10642
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10643
- ? props.proportionalLayout
10644
- : true,
10645
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10646
- frameworkComponents: props.components,
10647
- frameworkComponentFactory: {
10648
- createComponent: (id, componentId, component) => {
10649
- return new ReactGridPanelView(id, componentId, component, {
10650
- addPortal,
10651
- });
10652
- },
10673
+ const frameworkOptions = {
10674
+ createComponent: (options) => {
10675
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10653
10676
  },
10654
- styles: props.hideBorders
10655
- ? { separatorBorder: 'transparent' }
10656
- : undefined,
10657
- });
10677
+ };
10678
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10658
10679
  const { clientWidth, clientHeight } = domRef.current;
10659
10680
  api.layout(clientWidth, clientHeight);
10660
10681
  if (props.onReady) {
@@ -10670,7 +10691,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10670
10691
  return;
10671
10692
  }
10672
10693
  gridviewRef.current.updateOptions({
10673
- frameworkComponents: props.components,
10694
+ createComponent: (options) => {
10695
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10696
+ },
10674
10697
  });
10675
10698
  }, [props.components]);
10676
10699
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10712,32 +10735,52 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10712
10735
  }
10713
10736
  }
10714
10737
 
10738
+ function extractCoreOptions(props) {
10739
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10740
+ if (key in props) {
10741
+ obj[key] = props[key];
10742
+ }
10743
+ return obj;
10744
+ }, {});
10745
+ return coreOptions;
10746
+ }
10715
10747
  const PaneviewReact = React.forwardRef((props, ref) => {
10716
10748
  const domRef = React.useRef(null);
10717
10749
  const paneviewRef = React.useRef();
10718
10750
  const [portals, addPortal] = usePortalsLifecycle();
10719
10751
  React.useImperativeHandle(ref, () => domRef.current, []);
10752
+ const prevProps = React.useRef({});
10720
10753
  React.useEffect(() => {
10721
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10722
- addPortal,
10754
+ const changes = {};
10755
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10756
+ const key = propKey;
10757
+ const propValue = props[key];
10758
+ if (key in props && propValue !== prevProps.current[key]) {
10759
+ changes[key] = propValue;
10760
+ }
10723
10761
  });
10724
- const api = createPaneview(domRef.current, {
10725
- disableAutoResizing: props.disableAutoResizing,
10726
- frameworkComponents: props.components,
10727
- components: {},
10728
- headerComponents: {},
10729
- disableDnd: props.disableDnd,
10730
- headerframeworkComponents: props.headerComponents,
10731
- frameworkWrapper: {
10732
- header: {
10733
- createComponent,
10734
- },
10735
- body: {
10736
- createComponent,
10737
- },
10762
+ if (paneviewRef.current) {
10763
+ paneviewRef.current.updateOptions(changes);
10764
+ }
10765
+ prevProps.current = props;
10766
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10767
+ React.useEffect(() => {
10768
+ var _a;
10769
+ if (!domRef.current) {
10770
+ return () => {
10771
+ // noop
10772
+ };
10773
+ }
10774
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10775
+ const frameworkOptions = {
10776
+ createComponent: (options) => {
10777
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10738
10778
  },
10739
- showDndOverlay: props.showDndOverlay,
10740
- });
10779
+ createHeaderComponent: (options) => {
10780
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10781
+ },
10782
+ };
10783
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10741
10784
  const { clientWidth, clientHeight } = domRef.current;
10742
10785
  api.layout(clientWidth, clientHeight);
10743
10786
  if (props.onReady) {
@@ -10753,41 +10796,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10753
10796
  return;
10754
10797
  }
10755
10798
  paneviewRef.current.updateOptions({
10756
- frameworkComponents: props.components,
10799
+ createComponent: (options) => {
10800
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10801
+ },
10757
10802
  });
10758
10803
  }, [props.components]);
10759
10804
  React.useEffect(() => {
10805
+ var _a;
10760
10806
  if (!paneviewRef.current) {
10761
10807
  return;
10762
10808
  }
10809
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10763
10810
  paneviewRef.current.updateOptions({
10764
- headerframeworkComponents: props.headerComponents,
10811
+ createHeaderComponent: (options) => {
10812
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10813
+ },
10765
10814
  });
10766
10815
  }, [props.headerComponents]);
10767
10816
  React.useEffect(() => {
10768
10817
  if (!paneviewRef.current) {
10769
10818
  return () => {
10770
- //
10819
+ // noop
10771
10820
  };
10772
10821
  }
10773
- const api = paneviewRef.current;
10774
- const disposable = api.onDidDrop((event) => {
10822
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10775
10823
  if (props.onDidDrop) {
10776
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10824
+ props.onDidDrop(event);
10777
10825
  }
10778
10826
  });
10779
10827
  return () => {
10780
10828
  disposable.dispose();
10781
10829
  };
10782
10830
  }, [props.onDidDrop]);
10783
- React.useEffect(() => {
10784
- if (!paneviewRef.current) {
10785
- return;
10786
- }
10787
- paneviewRef.current.updateOptions({
10788
- showDndOverlay: props.showDndOverlay,
10789
- });
10790
- }, [props.showDndOverlay]);
10791
10831
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10792
10832
  });
10793
10833
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10815,7 +10855,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10815
10855
  exports.GridviewComponent = GridviewComponent;
10816
10856
  exports.GridviewPanel = GridviewPanel;
10817
10857
  exports.GridviewReact = GridviewReact;
10818
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10858
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10859
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10860
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10861
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10819
10862
  exports.PaneFramework = PaneFramework;
10820
10863
  exports.PaneTransfer = PaneTransfer;
10821
10864
  exports.PanelTransfer = PanelTransfer;
@@ -10824,6 +10867,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10824
10867
  exports.PaneviewComponent = PaneviewComponent;
10825
10868
  exports.PaneviewPanel = PaneviewPanel;
10826
10869
  exports.PaneviewReact = PaneviewReact;
10870
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10827
10871
  exports.ReactPart = ReactPart;
10828
10872
  exports.ReactPartContext = ReactPartContext;
10829
10873
  exports.Splitview = Splitview;