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
  */
@@ -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`
@@ -8986,31 +9035,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
8986
9035
  }
8987
9036
  }
8988
9037
 
8989
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8990
- const Component = typeof componentName === 'string'
8991
- ? components[componentName]
8992
- : undefined;
8993
- const FrameworkComponent = typeof componentName === 'string'
8994
- ? frameworkComponents[componentName]
8995
- : undefined;
8996
- if (Component && FrameworkComponent) {
8997
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8998
- }
8999
- if (FrameworkComponent) {
9000
- if (!createFrameworkComponent) {
9001
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9002
- }
9003
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9004
- }
9005
- if (!Component) {
9006
- if (fallback) {
9007
- return fallback();
9008
- }
9009
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9010
- }
9011
- return new Component(id, componentName);
9012
- }
9013
-
9014
9038
  class GridviewComponent extends BaseGrid {
9015
9039
  get orientation() {
9016
9040
  return this.gridview.orientation;
@@ -9028,10 +9052,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9028
9052
  this._deserializer = value;
9029
9053
  }
9030
9054
  constructor(parentElement, options) {
9055
+ var _a;
9031
9056
  super(parentElement, {
9032
- proportionalLayout: options.proportionalLayout,
9057
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9033
9058
  orientation: options.orientation,
9034
- styles: options.styles,
9059
+ styles: options.hideBorders
9060
+ ? { separatorBorder: 'transparent' }
9061
+ : undefined,
9035
9062
  disableAutoResizing: options.disableAutoResizing,
9036
9063
  className: options.className,
9037
9064
  });
@@ -9051,12 +9078,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9051
9078
  }), this.onDidActiveChange((event) => {
9052
9079
  this._onDidActiveGroupChange.fire(event);
9053
9080
  }));
9054
- if (!this.options.components) {
9055
- this.options.components = {};
9056
- }
9057
- if (!this.options.frameworkComponents) {
9058
- this.options.frameworkComponents = {};
9059
- }
9060
9081
  }
9061
9082
  updateOptions(options) {
9062
9083
  super.updateOptions(options);
@@ -9106,14 +9127,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9106
9127
  const height = this.height;
9107
9128
  this.gridview.deserialize(grid, {
9108
9129
  fromJSON: (node) => {
9109
- var _a, _b;
9110
9130
  const { data } = node;
9111
- 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
9112
- ? {
9113
- createComponent: this.options.frameworkComponentFactory
9114
- .createComponent,
9115
- }
9116
- : undefined);
9131
+ const view = this.options.createComponent({
9132
+ id: data.id,
9133
+ name: data.component,
9134
+ });
9117
9135
  queue.push(() => view.init({
9118
9136
  params: data.params,
9119
9137
  minimumWidth: data.minimumWidth,
@@ -9191,7 +9209,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9191
9209
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9192
9210
  }
9193
9211
  addPanel(options) {
9194
- var _a, _b, _c, _d, _e, _f;
9212
+ var _a, _b, _c, _d;
9195
9213
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9196
9214
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9197
9215
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9207,14 +9225,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9207
9225
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9208
9226
  }
9209
9227
  }
9210
- 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
9211
- ? {
9212
- createComponent: this.options.frameworkComponentFactory
9213
- .createComponent,
9214
- }
9215
- : undefined);
9228
+ const view = this.options.createComponent({
9229
+ id: options.id,
9230
+ name: options.component,
9231
+ });
9216
9232
  view.init({
9217
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9233
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9218
9234
  minimumWidth: options.minimumWidth,
9219
9235
  maximumWidth: options.maximumWidth,
9220
9236
  minimumHeight: options.minimumHeight,
@@ -9342,12 +9358,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9342
9358
  this._classNames = new Classnames(this.element);
9343
9359
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9344
9360
  this._options = options;
9345
- if (!options.components) {
9346
- options.components = {};
9347
- }
9348
- if (!options.frameworkComponents) {
9349
- options.frameworkComponents = {};
9350
- }
9351
9361
  this.splitview = new Splitview(this.element, options);
9352
9362
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9353
9363
  }
@@ -9410,18 +9420,17 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9410
9420
  return this.panels.find((view) => view.id === id);
9411
9421
  }
9412
9422
  addPanel(options) {
9413
- var _a, _b, _c;
9423
+ var _a;
9414
9424
  if (this._panels.has(options.id)) {
9415
9425
  throw new Error(`panel ${options.id} already exists`);
9416
9426
  }
9417
- 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
9418
- ? {
9419
- createComponent: this.options.frameworkWrapper.createComponent,
9420
- }
9421
- : undefined);
9427
+ const view = this.options.createComponent({
9428
+ id: options.id,
9429
+ name: options.component,
9430
+ });
9422
9431
  view.orientation = this.splitview.orientation;
9423
9432
  view.init({
9424
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9433
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9425
9434
  minimumSize: options.minimumSize,
9426
9435
  maximumSize: options.maximumSize,
9427
9436
  snap: options.snap,
@@ -9483,17 +9492,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9483
9492
  descriptor: {
9484
9493
  size,
9485
9494
  views: views.map((view) => {
9486
- var _a, _b;
9487
9495
  const data = view.data;
9488
9496
  if (this._panels.has(data.id)) {
9489
9497
  throw new Error(`panel ${data.id} already exists`);
9490
9498
  }
9491
- 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
9492
- ? {
9493
- createComponent: this.options.frameworkWrapper
9494
- .createComponent,
9495
- }
9496
- : undefined);
9499
+ const panel = this.options.createComponent({
9500
+ id: data.id,
9501
+ name: data.component,
9502
+ });
9497
9503
  queue.push(() => {
9498
9504
  var _a;
9499
9505
  panel.init({
@@ -9676,16 +9682,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9676
9682
  this.onDidAddView = this._onDidAddView.event;
9677
9683
  this._onDidRemoveView = new Emitter();
9678
9684
  this.onDidRemoveView = this._onDidRemoveView.event;
9679
- 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);
9680
9688
  this._classNames = new Classnames(this.element);
9681
9689
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9682
9690
  this._options = options;
9683
- if (!options.components) {
9684
- options.components = {};
9685
- }
9686
- if (!options.frameworkComponents) {
9687
- options.frameworkComponents = {};
9688
- }
9689
9691
  this.paneview = new Paneview(this.element, {
9690
9692
  // only allow paneview in the vertical orientation for now
9691
9693
  orientation: exports.Orientation.VERTICAL,
@@ -9710,22 +9712,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9710
9712
  this._options = Object.assign(Object.assign({}, this.options), options);
9711
9713
  }
9712
9714
  addPanel(options) {
9713
- var _a, _b, _c, _d;
9714
- 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
9715
- ? {
9716
- createComponent: this.options.frameworkWrapper.body.createComponent,
9717
- }
9718
- : undefined);
9715
+ var _a;
9716
+ const body = this.options.createComponent({
9717
+ id: options.id,
9718
+ name: options.component,
9719
+ });
9719
9720
  let header;
9720
- if (options.headerComponent) {
9721
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9722
- ? {
9723
- createComponent: this.options.frameworkWrapper.header
9724
- .createComponent,
9725
- }
9726
- : undefined);
9721
+ if (options.headerComponent && this.options.createHeaderComponent) {
9722
+ header = this.options.createHeaderComponent({
9723
+ id: options.id,
9724
+ name: options.headerComponent,
9725
+ });
9727
9726
  }
9728
- else {
9727
+ if (!header) {
9729
9728
  header = new DefaultHeader();
9730
9729
  }
9731
9730
  const view = new PaneFramework({
@@ -9743,7 +9742,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9743
9742
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9744
9743
  const index = typeof options.index === 'number' ? options.index : undefined;
9745
9744
  view.init({
9746
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9745
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9747
9746
  minimumBodySize: options.minimumBodySize,
9748
9747
  maximumBodySize: options.maximumBodySize,
9749
9748
  isExpanded: options.isExpanded,
@@ -9808,24 +9807,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9808
9807
  descriptor: {
9809
9808
  size,
9810
9809
  views: views.map((view) => {
9811
- var _a, _b, _c, _d;
9812
9810
  const data = view.data;
9813
- 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
9814
- ? {
9815
- createComponent: this.options.frameworkWrapper.body
9816
- .createComponent,
9817
- }
9818
- : undefined);
9811
+ const body = this.options.createComponent({
9812
+ id: data.id,
9813
+ name: data.component,
9814
+ });
9819
9815
  let header;
9820
- if (data.headerComponent) {
9821
- 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
9822
- ? {
9823
- createComponent: this.options.frameworkWrapper.header
9824
- .createComponent,
9825
- }
9826
- : undefined);
9816
+ if (data.headerComponent &&
9817
+ this.options.createHeaderComponent) {
9818
+ header = this.options.createHeaderComponent({
9819
+ id: data.id,
9820
+ name: data.headerComponent,
9821
+ });
9827
9822
  }
9828
- else {
9823
+ if (!header) {
9829
9824
  header = new DefaultHeader();
9830
9825
  }
9831
9826
  const panel = new PaneFramework({
@@ -9873,9 +9868,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
9873
9868
  this.paneview.dispose();
9874
9869
  }
9875
9870
  doAddPanel(panel) {
9876
- const disposable = panel.onDidDrop((event) => {
9871
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9877
9872
  this._onDidDrop.fire(event);
9878
- });
9873
+ }), panel.onUnhandledDragOverEvent((event) => {
9874
+ this._onUnhandledDragOverEvent.fire(event);
9875
+ }));
9879
9876
  this._viewDisposables.set(panel.id, disposable);
9880
9877
  }
9881
9878
  doRemovePanel(panel) {
@@ -10158,7 +10155,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10158
10155
  this._onDidBlur = new Emitter();
10159
10156
  this.onDidBlur = this._onDidBlur.event;
10160
10157
  this._element = document.createElement('div');
10161
- this._element.className = 'dockview-react-part';
10158
+ this._element.className = 'dv-react-part';
10162
10159
  this._element.style.height = '100%';
10163
10160
  this._element.style.width = '100%';
10164
10161
  }
@@ -10196,7 +10193,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10196
10193
  this.component = component;
10197
10194
  this.reactPortalStore = reactPortalStore;
10198
10195
  this._element = document.createElement('div');
10199
- this._element.className = 'dockview-react-part';
10196
+ this._element.className = 'dv-react-part';
10200
10197
  this._element.style.height = '100%';
10201
10198
  this._element.style.width = '100%';
10202
10199
  }
@@ -10232,7 +10229,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10232
10229
  this.component = component;
10233
10230
  this.reactPortalStore = reactPortalStore;
10234
10231
  this._element = document.createElement('div');
10235
- this._element.className = 'dockview-react-part';
10232
+ this._element.className = 'dv-react-part';
10236
10233
  this._element.style.height = '100%';
10237
10234
  this._element.style.width = '100%';
10238
10235
  }
@@ -10274,7 +10271,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10274
10271
  this._group = _group;
10275
10272
  this.mutableDisposable = new MutableDisposable();
10276
10273
  this._element = document.createElement('div');
10277
- this._element.className = 'dockview-react-part';
10274
+ this._element.className = 'dv-react-part';
10278
10275
  this._element.style.height = '100%';
10279
10276
  this._element.style.width = '100%';
10280
10277
  }
@@ -10333,8 +10330,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10333
10330
  : undefined;
10334
10331
  }
10335
10332
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10336
- function extractCoreOptions(props) {
10337
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10333
+ function extractCoreOptions$3(props) {
10334
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10338
10335
  if (key in props) {
10339
10336
  obj[key] = props[key];
10340
10337
  }
@@ -10350,7 +10347,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10350
10347
  const prevProps = React.useRef({});
10351
10348
  React.useEffect(() => {
10352
10349
  const changes = {};
10353
- PROPERTY_KEYS.forEach((propKey) => {
10350
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10354
10351
  const key = propKey;
10355
10352
  const propValue = props[key];
10356
10353
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10361,7 +10358,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10361
10358
  dockviewRef.current.updateOptions(changes);
10362
10359
  }
10363
10360
  prevProps.current = props;
10364
- }, PROPERTY_KEYS.map((key) => props[key]));
10361
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10365
10362
  React.useEffect(() => {
10366
10363
  var _a;
10367
10364
  if (!domRef.current) {
@@ -10397,7 +10394,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10397
10394
  ? DEFAULT_REACT_TAB
10398
10395
  : undefined,
10399
10396
  };
10400
- 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));
10401
10398
  const { clientWidth, clientHeight } = domRef.current;
10402
10399
  api.layout(clientWidth, clientHeight);
10403
10400
  if (props.onReady) {
@@ -10585,31 +10582,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10585
10582
  }
10586
10583
  }
10587
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
+ }
10588
10594
  const SplitviewReact = React.forwardRef((props, ref) => {
10589
10595
  const domRef = React.useRef(null);
10590
10596
  const splitviewRef = React.useRef();
10591
10597
  const [portals, addPortal] = usePortalsLifecycle();
10592
10598
  React.useImperativeHandle(ref, () => domRef.current, []);
10599
+ const prevProps = React.useRef({});
10593
10600
  React.useEffect(() => {
10594
- var _a;
10595
- const api = createSplitview(domRef.current, {
10596
- disableAutoResizing: props.disableAutoResizing,
10597
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10598
- frameworkComponents: props.components,
10599
- frameworkWrapper: {
10600
- createComponent: (id, componentId, component) => {
10601
- return new ReactPanelView(id, componentId, component, {
10602
- addPortal,
10603
- });
10604
- },
10605
- },
10606
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10607
- ? props.proportionalLayout
10608
- : true,
10609
- styles: props.hideBorders
10610
- ? { separatorBorder: 'transparent' }
10611
- : 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
+ }
10612
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));
10613
10626
  const { clientWidth, clientHeight } = domRef.current;
10614
10627
  api.layout(clientWidth, clientHeight);
10615
10628
  if (props.onReady) {
@@ -10625,7 +10638,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10625
10638
  return;
10626
10639
  }
10627
10640
  splitviewRef.current.updateOptions({
10628
- frameworkComponents: props.components,
10641
+ createComponent: (options) => {
10642
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10643
+ },
10629
10644
  });
10630
10645
  }, [props.components]);
10631
10646
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10650,36 +10665,47 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10650
10665
  }
10651
10666
  }
10652
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
+ }
10653
10677
  const GridviewReact = React.forwardRef((props, ref) => {
10654
10678
  const domRef = React.useRef(null);
10655
10679
  const gridviewRef = React.useRef();
10656
10680
  const [portals, addPortal] = usePortalsLifecycle();
10657
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]));
10658
10697
  React.useEffect(() => {
10659
- var _a;
10660
10698
  if (!domRef.current) {
10661
10699
  return () => {
10662
10700
  // noop
10663
10701
  };
10664
10702
  }
10665
- const api = createGridview(domRef.current, {
10666
- disableAutoResizing: props.disableAutoResizing,
10667
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10668
- ? props.proportionalLayout
10669
- : true,
10670
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10671
- frameworkComponents: props.components,
10672
- frameworkComponentFactory: {
10673
- createComponent: (id, componentId, component) => {
10674
- return new ReactGridPanelView(id, componentId, component, {
10675
- addPortal,
10676
- });
10677
- },
10703
+ const frameworkOptions = {
10704
+ createComponent: (options) => {
10705
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10678
10706
  },
10679
- styles: props.hideBorders
10680
- ? { separatorBorder: 'transparent' }
10681
- : undefined,
10682
- });
10707
+ };
10708
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10683
10709
  const { clientWidth, clientHeight } = domRef.current;
10684
10710
  api.layout(clientWidth, clientHeight);
10685
10711
  if (props.onReady) {
@@ -10695,7 +10721,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10695
10721
  return;
10696
10722
  }
10697
10723
  gridviewRef.current.updateOptions({
10698
- frameworkComponents: props.components,
10724
+ createComponent: (options) => {
10725
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10726
+ },
10699
10727
  });
10700
10728
  }, [props.components]);
10701
10729
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10737,32 +10765,52 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10737
10765
  }
10738
10766
  }
10739
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
+ }
10740
10777
  const PaneviewReact = React.forwardRef((props, ref) => {
10741
10778
  const domRef = React.useRef(null);
10742
10779
  const paneviewRef = React.useRef();
10743
10780
  const [portals, addPortal] = usePortalsLifecycle();
10744
10781
  React.useImperativeHandle(ref, () => domRef.current, []);
10782
+ const prevProps = React.useRef({});
10745
10783
  React.useEffect(() => {
10746
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10747
- 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
+ }
10748
10791
  });
10749
- const api = createPaneview(domRef.current, {
10750
- disableAutoResizing: props.disableAutoResizing,
10751
- frameworkComponents: props.components,
10752
- components: {},
10753
- headerComponents: {},
10754
- disableDnd: props.disableDnd,
10755
- headerframeworkComponents: props.headerComponents,
10756
- frameworkWrapper: {
10757
- header: {
10758
- createComponent,
10759
- },
10760
- body: {
10761
- createComponent,
10762
- },
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 });
10763
10808
  },
10764
- showDndOverlay: props.showDndOverlay,
10765
- });
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));
10766
10814
  const { clientWidth, clientHeight } = domRef.current;
10767
10815
  api.layout(clientWidth, clientHeight);
10768
10816
  if (props.onReady) {
@@ -10778,41 +10826,38 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10778
10826
  return;
10779
10827
  }
10780
10828
  paneviewRef.current.updateOptions({
10781
- frameworkComponents: props.components,
10829
+ createComponent: (options) => {
10830
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10831
+ },
10782
10832
  });
10783
10833
  }, [props.components]);
10784
10834
  React.useEffect(() => {
10835
+ var _a;
10785
10836
  if (!paneviewRef.current) {
10786
10837
  return;
10787
10838
  }
10839
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10788
10840
  paneviewRef.current.updateOptions({
10789
- headerframeworkComponents: props.headerComponents,
10841
+ createHeaderComponent: (options) => {
10842
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10843
+ },
10790
10844
  });
10791
10845
  }, [props.headerComponents]);
10792
10846
  React.useEffect(() => {
10793
10847
  if (!paneviewRef.current) {
10794
10848
  return () => {
10795
- //
10849
+ // noop
10796
10850
  };
10797
10851
  }
10798
- const api = paneviewRef.current;
10799
- const disposable = api.onDidDrop((event) => {
10852
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10800
10853
  if (props.onDidDrop) {
10801
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10854
+ props.onDidDrop(event);
10802
10855
  }
10803
10856
  });
10804
10857
  return () => {
10805
10858
  disposable.dispose();
10806
10859
  };
10807
10860
  }, [props.onDidDrop]);
10808
- React.useEffect(() => {
10809
- if (!paneviewRef.current) {
10810
- return;
10811
- }
10812
- paneviewRef.current.updateOptions({
10813
- showDndOverlay: props.showDndOverlay,
10814
- });
10815
- }, [props.showDndOverlay]);
10816
10861
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10817
10862
  });
10818
10863
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10840,7 +10885,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10840
10885
  exports.GridviewComponent = GridviewComponent;
10841
10886
  exports.GridviewPanel = GridviewPanel;
10842
10887
  exports.GridviewReact = GridviewReact;
10843
- 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;
10844
10892
  exports.PaneFramework = PaneFramework;
10845
10893
  exports.PaneTransfer = PaneTransfer;
10846
10894
  exports.PanelTransfer = PanelTransfer;
@@ -10849,6 +10897,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
10849
10897
  exports.PaneviewComponent = PaneviewComponent;
10850
10898
  exports.PaneviewPanel = PaneviewPanel;
10851
10899
  exports.PaneviewReact = PaneviewReact;
10900
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10852
10901
  exports.ReactPart = ReactPart;
10853
10902
  exports.ReactPartContext = ReactPartContext;
10854
10903
  exports.Splitview = Splitview;