dockview-react 2.1.4 → 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.4
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`
@@ -8956,31 +9005,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8956
9005
  }
8957
9006
  }
8958
9007
 
8959
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8960
- const Component = typeof componentName === 'string'
8961
- ? components[componentName]
8962
- : undefined;
8963
- const FrameworkComponent = typeof componentName === 'string'
8964
- ? frameworkComponents[componentName]
8965
- : undefined;
8966
- if (Component && FrameworkComponent) {
8967
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8968
- }
8969
- if (FrameworkComponent) {
8970
- if (!createFrameworkComponent) {
8971
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8972
- }
8973
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8974
- }
8975
- if (!Component) {
8976
- if (fallback) {
8977
- return fallback();
8978
- }
8979
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8980
- }
8981
- return new Component(id, componentName);
8982
- }
8983
-
8984
9008
  class GridviewComponent extends BaseGrid {
8985
9009
  get orientation() {
8986
9010
  return this.gridview.orientation;
@@ -8998,10 +9022,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8998
9022
  this._deserializer = value;
8999
9023
  }
9000
9024
  constructor(parentElement, options) {
9025
+ var _a;
9001
9026
  super(parentElement, {
9002
- proportionalLayout: options.proportionalLayout,
9027
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9003
9028
  orientation: options.orientation,
9004
- styles: options.styles,
9029
+ styles: options.hideBorders
9030
+ ? { separatorBorder: 'transparent' }
9031
+ : undefined,
9005
9032
  disableAutoResizing: options.disableAutoResizing,
9006
9033
  className: options.className,
9007
9034
  });
@@ -9021,12 +9048,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9021
9048
  }), this.onDidActiveChange((event) => {
9022
9049
  this._onDidActiveGroupChange.fire(event);
9023
9050
  }));
9024
- if (!this.options.components) {
9025
- this.options.components = {};
9026
- }
9027
- if (!this.options.frameworkComponents) {
9028
- this.options.frameworkComponents = {};
9029
- }
9030
9051
  }
9031
9052
  updateOptions(options) {
9032
9053
  super.updateOptions(options);
@@ -9076,14 +9097,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9076
9097
  const height = this.height;
9077
9098
  this.gridview.deserialize(grid, {
9078
9099
  fromJSON: (node) => {
9079
- var _a, _b;
9080
9100
  const { data } = node;
9081
- 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
9082
- ? {
9083
- createComponent: this.options.frameworkComponentFactory
9084
- .createComponent,
9085
- }
9086
- : undefined);
9101
+ const view = this.options.createComponent({
9102
+ id: data.id,
9103
+ name: data.component,
9104
+ });
9087
9105
  queue.push(() => view.init({
9088
9106
  params: data.params,
9089
9107
  minimumWidth: data.minimumWidth,
@@ -9161,7 +9179,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9161
9179
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9162
9180
  }
9163
9181
  addPanel(options) {
9164
- var _a, _b, _c, _d, _e, _f;
9182
+ var _a, _b, _c, _d;
9165
9183
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9166
9184
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9167
9185
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9177,14 +9195,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9177
9195
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9178
9196
  }
9179
9197
  }
9180
- 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
9181
- ? {
9182
- createComponent: this.options.frameworkComponentFactory
9183
- .createComponent,
9184
- }
9185
- : undefined);
9198
+ const view = this.options.createComponent({
9199
+ id: options.id,
9200
+ name: options.component,
9201
+ });
9186
9202
  view.init({
9187
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9203
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9188
9204
  minimumWidth: options.minimumWidth,
9189
9205
  maximumWidth: options.maximumWidth,
9190
9206
  minimumHeight: options.minimumHeight,
@@ -9312,12 +9328,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9312
9328
  this._classNames = new Classnames(this.element);
9313
9329
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9314
9330
  this._options = options;
9315
- if (!options.components) {
9316
- options.components = {};
9317
- }
9318
- if (!options.frameworkComponents) {
9319
- options.frameworkComponents = {};
9320
- }
9321
9331
  this.splitview = new Splitview(this.element, options);
9322
9332
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9323
9333
  }
@@ -9380,18 +9390,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9380
9390
  return this.panels.find((view) => view.id === id);
9381
9391
  }
9382
9392
  addPanel(options) {
9383
- var _a, _b, _c;
9393
+ var _a;
9384
9394
  if (this._panels.has(options.id)) {
9385
9395
  throw new Error(`panel ${options.id} already exists`);
9386
9396
  }
9387
- 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
9388
- ? {
9389
- createComponent: this.options.frameworkWrapper.createComponent,
9390
- }
9391
- : undefined);
9397
+ const view = this.options.createComponent({
9398
+ id: options.id,
9399
+ name: options.component,
9400
+ });
9392
9401
  view.orientation = this.splitview.orientation;
9393
9402
  view.init({
9394
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9403
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9395
9404
  minimumSize: options.minimumSize,
9396
9405
  maximumSize: options.maximumSize,
9397
9406
  snap: options.snap,
@@ -9453,17 +9462,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9453
9462
  descriptor: {
9454
9463
  size,
9455
9464
  views: views.map((view) => {
9456
- var _a, _b;
9457
9465
  const data = view.data;
9458
9466
  if (this._panels.has(data.id)) {
9459
9467
  throw new Error(`panel ${data.id} already exists`);
9460
9468
  }
9461
- 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
9462
- ? {
9463
- createComponent: this.options.frameworkWrapper
9464
- .createComponent,
9465
- }
9466
- : undefined);
9469
+ const panel = this.options.createComponent({
9470
+ id: data.id,
9471
+ name: data.component,
9472
+ });
9467
9473
  queue.push(() => {
9468
9474
  var _a;
9469
9475
  panel.init({
@@ -9646,16 +9652,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9646
9652
  this.onDidAddView = this._onDidAddView.event;
9647
9653
  this._onDidRemoveView = new Emitter();
9648
9654
  this.onDidRemoveView = this._onDidRemoveView.event;
9649
- 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);
9650
9658
  this._classNames = new Classnames(this.element);
9651
9659
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9652
9660
  this._options = options;
9653
- if (!options.components) {
9654
- options.components = {};
9655
- }
9656
- if (!options.frameworkComponents) {
9657
- options.frameworkComponents = {};
9658
- }
9659
9661
  this.paneview = new Paneview(this.element, {
9660
9662
  // only allow paneview in the vertical orientation for now
9661
9663
  orientation: exports.Orientation.VERTICAL,
@@ -9680,22 +9682,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9680
9682
  this._options = Object.assign(Object.assign({}, this.options), options);
9681
9683
  }
9682
9684
  addPanel(options) {
9683
- var _a, _b, _c, _d;
9684
- 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
9685
- ? {
9686
- createComponent: this.options.frameworkWrapper.body.createComponent,
9687
- }
9688
- : undefined);
9685
+ var _a;
9686
+ const body = this.options.createComponent({
9687
+ id: options.id,
9688
+ name: options.component,
9689
+ });
9689
9690
  let header;
9690
- if (options.headerComponent) {
9691
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9692
- ? {
9693
- createComponent: this.options.frameworkWrapper.header
9694
- .createComponent,
9695
- }
9696
- : undefined);
9691
+ if (options.headerComponent && this.options.createHeaderComponent) {
9692
+ header = this.options.createHeaderComponent({
9693
+ id: options.id,
9694
+ name: options.headerComponent,
9695
+ });
9697
9696
  }
9698
- else {
9697
+ if (!header) {
9699
9698
  header = new DefaultHeader();
9700
9699
  }
9701
9700
  const view = new PaneFramework({
@@ -9713,7 +9712,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9713
9712
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9714
9713
  const index = typeof options.index === 'number' ? options.index : undefined;
9715
9714
  view.init({
9716
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9715
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9717
9716
  minimumBodySize: options.minimumBodySize,
9718
9717
  maximumBodySize: options.maximumBodySize,
9719
9718
  isExpanded: options.isExpanded,
@@ -9778,24 +9777,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9778
9777
  descriptor: {
9779
9778
  size,
9780
9779
  views: views.map((view) => {
9781
- var _a, _b, _c, _d;
9782
9780
  const data = view.data;
9783
- 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
9784
- ? {
9785
- createComponent: this.options.frameworkWrapper.body
9786
- .createComponent,
9787
- }
9788
- : undefined);
9781
+ const body = this.options.createComponent({
9782
+ id: data.id,
9783
+ name: data.component,
9784
+ });
9789
9785
  let header;
9790
- if (data.headerComponent) {
9791
- 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
9792
- ? {
9793
- createComponent: this.options.frameworkWrapper.header
9794
- .createComponent,
9795
- }
9796
- : undefined);
9786
+ if (data.headerComponent &&
9787
+ this.options.createHeaderComponent) {
9788
+ header = this.options.createHeaderComponent({
9789
+ id: data.id,
9790
+ name: data.headerComponent,
9791
+ });
9797
9792
  }
9798
- else {
9793
+ if (!header) {
9799
9794
  header = new DefaultHeader();
9800
9795
  }
9801
9796
  const panel = new PaneFramework({
@@ -9843,9 +9838,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9843
9838
  this.paneview.dispose();
9844
9839
  }
9845
9840
  doAddPanel(panel) {
9846
- const disposable = panel.onDidDrop((event) => {
9841
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9847
9842
  this._onDidDrop.fire(event);
9848
- });
9843
+ }), panel.onUnhandledDragOverEvent((event) => {
9844
+ this._onUnhandledDragOverEvent.fire(event);
9845
+ }));
9849
9846
  this._viewDisposables.set(panel.id, disposable);
9850
9847
  }
9851
9848
  doRemovePanel(panel) {
@@ -10128,7 +10125,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10128
10125
  this._onDidBlur = new Emitter();
10129
10126
  this.onDidBlur = this._onDidBlur.event;
10130
10127
  this._element = document.createElement('div');
10131
- this._element.className = 'dockview-react-part';
10128
+ this._element.className = 'dv-react-part';
10132
10129
  this._element.style.height = '100%';
10133
10130
  this._element.style.width = '100%';
10134
10131
  }
@@ -10166,7 +10163,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10166
10163
  this.component = component;
10167
10164
  this.reactPortalStore = reactPortalStore;
10168
10165
  this._element = document.createElement('div');
10169
- this._element.className = 'dockview-react-part';
10166
+ this._element.className = 'dv-react-part';
10170
10167
  this._element.style.height = '100%';
10171
10168
  this._element.style.width = '100%';
10172
10169
  }
@@ -10202,7 +10199,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10202
10199
  this.component = component;
10203
10200
  this.reactPortalStore = reactPortalStore;
10204
10201
  this._element = document.createElement('div');
10205
- this._element.className = 'dockview-react-part';
10202
+ this._element.className = 'dv-react-part';
10206
10203
  this._element.style.height = '100%';
10207
10204
  this._element.style.width = '100%';
10208
10205
  }
@@ -10244,7 +10241,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10244
10241
  this._group = _group;
10245
10242
  this.mutableDisposable = new MutableDisposable();
10246
10243
  this._element = document.createElement('div');
10247
- this._element.className = 'dockview-react-part';
10244
+ this._element.className = 'dv-react-part';
10248
10245
  this._element.style.height = '100%';
10249
10246
  this._element.style.width = '100%';
10250
10247
  }
@@ -10303,8 +10300,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10303
10300
  : undefined;
10304
10301
  }
10305
10302
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10306
- function extractCoreOptions(props) {
10307
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10303
+ function extractCoreOptions$3(props) {
10304
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10308
10305
  if (key in props) {
10309
10306
  obj[key] = props[key];
10310
10307
  }
@@ -10320,7 +10317,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10320
10317
  const prevProps = React.useRef({});
10321
10318
  React.useEffect(() => {
10322
10319
  const changes = {};
10323
- PROPERTY_KEYS.forEach((propKey) => {
10320
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10324
10321
  const key = propKey;
10325
10322
  const propValue = props[key];
10326
10323
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10331,7 +10328,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10331
10328
  dockviewRef.current.updateOptions(changes);
10332
10329
  }
10333
10330
  prevProps.current = props;
10334
- }, PROPERTY_KEYS.map((key) => props[key]));
10331
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10335
10332
  React.useEffect(() => {
10336
10333
  var _a;
10337
10334
  if (!domRef.current) {
@@ -10367,7 +10364,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10367
10364
  ? DEFAULT_REACT_TAB
10368
10365
  : undefined,
10369
10366
  };
10370
- 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));
10371
10368
  const { clientWidth, clientHeight } = domRef.current;
10372
10369
  api.layout(clientWidth, clientHeight);
10373
10370
  if (props.onReady) {
@@ -10555,31 +10552,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10555
10552
  }
10556
10553
  }
10557
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
+ }
10558
10564
  const SplitviewReact = React.forwardRef((props, ref) => {
10559
10565
  const domRef = React.useRef(null);
10560
10566
  const splitviewRef = React.useRef();
10561
10567
  const [portals, addPortal] = usePortalsLifecycle();
10562
10568
  React.useImperativeHandle(ref, () => domRef.current, []);
10569
+ const prevProps = React.useRef({});
10563
10570
  React.useEffect(() => {
10564
- var _a;
10565
- const api = createSplitview(domRef.current, {
10566
- disableAutoResizing: props.disableAutoResizing,
10567
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10568
- frameworkComponents: props.components,
10569
- frameworkWrapper: {
10570
- createComponent: (id, componentId, component) => {
10571
- return new ReactPanelView(id, componentId, component, {
10572
- addPortal,
10573
- });
10574
- },
10575
- },
10576
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10577
- ? props.proportionalLayout
10578
- : true,
10579
- styles: props.hideBorders
10580
- ? { separatorBorder: 'transparent' }
10581
- : 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
+ }
10582
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));
10583
10596
  const { clientWidth, clientHeight } = domRef.current;
10584
10597
  api.layout(clientWidth, clientHeight);
10585
10598
  if (props.onReady) {
@@ -10595,7 +10608,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10595
10608
  return;
10596
10609
  }
10597
10610
  splitviewRef.current.updateOptions({
10598
- frameworkComponents: props.components,
10611
+ createComponent: (options) => {
10612
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10613
+ },
10599
10614
  });
10600
10615
  }, [props.components]);
10601
10616
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10620,36 +10635,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10620
10635
  }
10621
10636
  }
10622
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
+ }
10623
10647
  const GridviewReact = React.forwardRef((props, ref) => {
10624
10648
  const domRef = React.useRef(null);
10625
10649
  const gridviewRef = React.useRef();
10626
10650
  const [portals, addPortal] = usePortalsLifecycle();
10627
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]));
10628
10667
  React.useEffect(() => {
10629
- var _a;
10630
10668
  if (!domRef.current) {
10631
10669
  return () => {
10632
10670
  // noop
10633
10671
  };
10634
10672
  }
10635
- const api = createGridview(domRef.current, {
10636
- disableAutoResizing: props.disableAutoResizing,
10637
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10638
- ? props.proportionalLayout
10639
- : true,
10640
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10641
- frameworkComponents: props.components,
10642
- frameworkComponentFactory: {
10643
- createComponent: (id, componentId, component) => {
10644
- return new ReactGridPanelView(id, componentId, component, {
10645
- addPortal,
10646
- });
10647
- },
10673
+ const frameworkOptions = {
10674
+ createComponent: (options) => {
10675
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10648
10676
  },
10649
- styles: props.hideBorders
10650
- ? { separatorBorder: 'transparent' }
10651
- : undefined,
10652
- });
10677
+ };
10678
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10653
10679
  const { clientWidth, clientHeight } = domRef.current;
10654
10680
  api.layout(clientWidth, clientHeight);
10655
10681
  if (props.onReady) {
@@ -10665,7 +10691,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10665
10691
  return;
10666
10692
  }
10667
10693
  gridviewRef.current.updateOptions({
10668
- frameworkComponents: props.components,
10694
+ createComponent: (options) => {
10695
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10696
+ },
10669
10697
  });
10670
10698
  }, [props.components]);
10671
10699
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10707,32 +10735,52 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10707
10735
  }
10708
10736
  }
10709
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
+ }
10710
10747
  const PaneviewReact = React.forwardRef((props, ref) => {
10711
10748
  const domRef = React.useRef(null);
10712
10749
  const paneviewRef = React.useRef();
10713
10750
  const [portals, addPortal] = usePortalsLifecycle();
10714
10751
  React.useImperativeHandle(ref, () => domRef.current, []);
10752
+ const prevProps = React.useRef({});
10715
10753
  React.useEffect(() => {
10716
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10717
- 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
+ }
10718
10761
  });
10719
- const api = createPaneview(domRef.current, {
10720
- disableAutoResizing: props.disableAutoResizing,
10721
- frameworkComponents: props.components,
10722
- components: {},
10723
- headerComponents: {},
10724
- disableDnd: props.disableDnd,
10725
- headerframeworkComponents: props.headerComponents,
10726
- frameworkWrapper: {
10727
- header: {
10728
- createComponent,
10729
- },
10730
- body: {
10731
- createComponent,
10732
- },
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 });
10733
10778
  },
10734
- showDndOverlay: props.showDndOverlay,
10735
- });
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));
10736
10784
  const { clientWidth, clientHeight } = domRef.current;
10737
10785
  api.layout(clientWidth, clientHeight);
10738
10786
  if (props.onReady) {
@@ -10748,41 +10796,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10748
10796
  return;
10749
10797
  }
10750
10798
  paneviewRef.current.updateOptions({
10751
- frameworkComponents: props.components,
10799
+ createComponent: (options) => {
10800
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10801
+ },
10752
10802
  });
10753
10803
  }, [props.components]);
10754
10804
  React.useEffect(() => {
10805
+ var _a;
10755
10806
  if (!paneviewRef.current) {
10756
10807
  return;
10757
10808
  }
10809
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10758
10810
  paneviewRef.current.updateOptions({
10759
- headerframeworkComponents: props.headerComponents,
10811
+ createHeaderComponent: (options) => {
10812
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10813
+ },
10760
10814
  });
10761
10815
  }, [props.headerComponents]);
10762
10816
  React.useEffect(() => {
10763
10817
  if (!paneviewRef.current) {
10764
10818
  return () => {
10765
- //
10819
+ // noop
10766
10820
  };
10767
10821
  }
10768
- const api = paneviewRef.current;
10769
- const disposable = api.onDidDrop((event) => {
10822
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10770
10823
  if (props.onDidDrop) {
10771
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10824
+ props.onDidDrop(event);
10772
10825
  }
10773
10826
  });
10774
10827
  return () => {
10775
10828
  disposable.dispose();
10776
10829
  };
10777
10830
  }, [props.onDidDrop]);
10778
- React.useEffect(() => {
10779
- if (!paneviewRef.current) {
10780
- return;
10781
- }
10782
- paneviewRef.current.updateOptions({
10783
- showDndOverlay: props.showDndOverlay,
10784
- });
10785
- }, [props.showDndOverlay]);
10786
10831
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10787
10832
  });
10788
10833
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10810,7 +10855,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10810
10855
  exports.GridviewComponent = GridviewComponent;
10811
10856
  exports.GridviewPanel = GridviewPanel;
10812
10857
  exports.GridviewReact = GridviewReact;
10813
- 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;
10814
10862
  exports.PaneFramework = PaneFramework;
10815
10863
  exports.PaneTransfer = PaneTransfer;
10816
10864
  exports.PanelTransfer = PanelTransfer;
@@ -10819,6 +10867,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10819
10867
  exports.PaneviewComponent = PaneviewComponent;
10820
10868
  exports.PaneviewPanel = PaneviewPanel;
10821
10869
  exports.PaneviewReact = PaneviewReact;
10870
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10822
10871
  exports.ReactPart = ReactPart;
10823
10872
  exports.ReactPartContext = ReactPartContext;
10824
10873
  exports.Splitview = Splitview;