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
  */
@@ -103,6 +103,17 @@
103
103
  this._defaultPrevented = true;
104
104
  }
105
105
  }
106
+ class AcceptableEvent {
107
+ constructor() {
108
+ this._isAccepted = false;
109
+ }
110
+ get isAccepted() {
111
+ return this._isAccepted;
112
+ }
113
+ accept() {
114
+ this._isAccepted = true;
115
+ }
116
+ }
106
117
  class LeakageMonitor {
107
118
  constructor() {
108
119
  this.events = new Map();
@@ -1494,6 +1505,23 @@
1494
1505
  }
1495
1506
  }
1496
1507
 
1508
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1509
+ /**
1510
+ * by readong the keys from an empty value object TypeScript will error
1511
+ * when we add or remove new properties to `DockviewOptions`
1512
+ */
1513
+ const properties = {
1514
+ orientation: undefined,
1515
+ descriptor: undefined,
1516
+ proportionalLayout: undefined,
1517
+ styles: undefined,
1518
+ margin: undefined,
1519
+ disableAutoResizing: undefined,
1520
+ className: undefined,
1521
+ };
1522
+ return Object.keys(properties);
1523
+ })();
1524
+
1497
1525
  class Paneview extends CompositeDisposable {
1498
1526
  get onDidAddView() {
1499
1527
  return this.splitview.onDidAddView;
@@ -2623,6 +2651,21 @@
2623
2651
  }
2624
2652
  }
2625
2653
 
2654
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2655
+ /**
2656
+ * by readong the keys from an empty value object TypeScript will error
2657
+ * when we add or remove new properties to `DockviewOptions`
2658
+ */
2659
+ const properties = {
2660
+ disableAutoResizing: undefined,
2661
+ proportionalLayout: undefined,
2662
+ orientation: undefined,
2663
+ hideBorders: undefined,
2664
+ className: undefined,
2665
+ };
2666
+ return Object.keys(properties);
2667
+ })();
2668
+
2626
2669
  class Resizable extends CompositeDisposable {
2627
2670
  get element() {
2628
2671
  return this._element;
@@ -3100,15 +3143,10 @@
3100
3143
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3101
3144
  */
3102
3145
  get onDidDrop() {
3103
- const emitter = new Emitter();
3104
- const disposable = this.component.onDidDrop((e) => {
3105
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3106
- });
3107
- emitter.dispose = () => {
3108
- disposable.dispose();
3109
- emitter.dispose();
3110
- };
3111
- return emitter.event;
3146
+ return this.component.onDidDrop;
3147
+ }
3148
+ get onUnhandledDragOverEvent() {
3149
+ return this.component.onUnhandledDragOverEvent;
3112
3150
  }
3113
3151
  constructor(component) {
3114
3152
  this.component = component;
@@ -4035,6 +4073,28 @@
4035
4073
  return 'center';
4036
4074
  }
4037
4075
 
4076
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4077
+ /**
4078
+ * by readong the keys from an empty value object TypeScript will error
4079
+ * when we add or remove new properties to `DockviewOptions`
4080
+ */
4081
+ const properties = {
4082
+ disableAutoResizing: undefined,
4083
+ disableDnd: undefined,
4084
+ className: undefined,
4085
+ };
4086
+ return Object.keys(properties);
4087
+ })();
4088
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4089
+ constructor(nativeEvent, position, getData, panel) {
4090
+ super();
4091
+ this.nativeEvent = nativeEvent;
4092
+ this.position = position;
4093
+ this.getData = getData;
4094
+ this.panel = panel;
4095
+ }
4096
+ }
4097
+
4038
4098
  class WillFocusEvent extends DockviewEvent {
4039
4099
  constructor() {
4040
4100
  super();
@@ -4458,6 +4518,9 @@
4458
4518
  this.accessor = accessor;
4459
4519
  this._onDidDrop = new Emitter();
4460
4520
  this.onDidDrop = this._onDidDrop.event;
4521
+ this._onUnhandledDragOverEvent = new Emitter();
4522
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4523
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4461
4524
  if (!disableDnd) {
4462
4525
  this.initDragFeatures();
4463
4526
  }
@@ -4484,7 +4547,7 @@
4484
4547
  overlayModel: {
4485
4548
  activationSize: { type: 'percentage', value: 50 },
4486
4549
  },
4487
- canDisplayOverlay: (event) => {
4550
+ canDisplayOverlay: (event, position) => {
4488
4551
  const data = getPaneData();
4489
4552
  if (data) {
4490
4553
  if (data.paneId !== this.id &&
@@ -4492,14 +4555,9 @@
4492
4555
  return true;
4493
4556
  }
4494
4557
  }
4495
- if (this.accessor.options.showDndOverlay) {
4496
- return this.accessor.options.showDndOverlay({
4497
- nativeEvent: event,
4498
- getData: getPaneData,
4499
- panel: this,
4500
- });
4501
- }
4502
- return false;
4558
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4559
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4560
+ return firedEvent.isAccepted;
4503
4561
  },
4504
4562
  });
4505
4563
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4954,15 +5012,7 @@
4954
5012
  this._element.appendChild(this.leftActionsContainer);
4955
5013
  this._element.appendChild(this.voidContainer.element);
4956
5014
  this._element.appendChild(this.rightActionsContainer);
4957
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4958
- if (e.api.group === this.group) {
4959
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4960
- }
4961
- }), this.accessor.onDidRemovePanel((e) => {
4962
- if (e.api.group === this.group) {
4963
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4964
- }
4965
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5015
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4966
5016
  this._onGroupDragStart.fire({
4967
5017
  nativeEvent: event,
4968
5018
  group: this.group,
@@ -5007,20 +5057,6 @@
5007
5057
  setActive(_isGroupActive) {
5008
5058
  // noop
5009
5059
  }
5010
- addTab(tab, index = this.tabs.length) {
5011
- if (index < 0 || index > this.tabs.length) {
5012
- throw new Error('invalid location');
5013
- }
5014
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5015
- this.tabs = [
5016
- ...this.tabs.slice(0, index),
5017
- tab,
5018
- ...this.tabs.slice(index),
5019
- ];
5020
- if (this.selectedIndex < 0) {
5021
- this.selectedIndex = index;
5022
- }
5023
- }
5024
5060
  delete(id) {
5025
5061
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5026
5062
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5028,6 +5064,7 @@
5028
5064
  disposable.dispose();
5029
5065
  value.dispose();
5030
5066
  value.element.remove();
5067
+ this.updateClassnames();
5031
5068
  }
5032
5069
  setActivePanel(panel) {
5033
5070
  this.tabs.forEach((tab) => {
@@ -5096,25 +5133,37 @@
5096
5133
  }
5097
5134
  this.tabs = [];
5098
5135
  }
5136
+ addTab(tab, index = this.tabs.length) {
5137
+ if (index < 0 || index > this.tabs.length) {
5138
+ throw new Error('invalid location');
5139
+ }
5140
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5141
+ this.tabs = [
5142
+ ...this.tabs.slice(0, index),
5143
+ tab,
5144
+ ...this.tabs.slice(index),
5145
+ ];
5146
+ if (this.selectedIndex < 0) {
5147
+ this.selectedIndex = index;
5148
+ }
5149
+ this.updateClassnames();
5150
+ }
5151
+ updateClassnames() {
5152
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5153
+ }
5099
5154
  }
5100
5155
 
5101
- class DockviewUnhandledDragOverEvent {
5102
- get isAccepted() {
5103
- return this._isAccepted;
5104
- }
5156
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5105
5157
  constructor(nativeEvent, target, position, getData, group) {
5158
+ super();
5106
5159
  this.nativeEvent = nativeEvent;
5107
5160
  this.target = target;
5108
5161
  this.position = position;
5109
5162
  this.getData = getData;
5110
5163
  this.group = group;
5111
- this._isAccepted = false;
5112
- }
5113
- accept() {
5114
- this._isAccepted = true;
5115
5164
  }
5116
5165
  }
5117
- const PROPERTY_KEYS = (() => {
5166
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5118
5167
  /**
5119
5168
  * by readong the keys from an empty value object TypeScript will error
5120
5169
  * when we add or remove new properties to `DockviewOptions`
@@ -7614,10 +7663,6 @@
7614
7663
  this._api = new DockviewApi(this);
7615
7664
  this.updateWatermark();
7616
7665
  }
7617
- dispose() {
7618
- this.clear(); // explicitly clear the layout before cleaning up
7619
- super.dispose();
7620
- }
7621
7666
  setVisible(panel, visible) {
7622
7667
  switch (panel.api.location.type) {
7623
7668
  case 'grid':
@@ -7801,30 +7846,29 @@
7801
7846
  }
7802
7847
  }
7803
7848
  else if (this.getPanel(group.id)) {
7804
- const removedGroup = group;
7849
+ group.model.renderContainer =
7850
+ this.overlayRenderContainer;
7851
+ returnedGroup = group;
7805
7852
  if (floatingBox) {
7806
- this.addFloatingGroup(removedGroup, {
7853
+ this.addFloatingGroup(group, {
7807
7854
  height: floatingBox.height,
7808
7855
  width: floatingBox.width,
7809
7856
  position: floatingBox,
7810
7857
  });
7811
7858
  }
7812
7859
  else {
7813
- this.doRemoveGroup(removedGroup, {
7860
+ this.doRemoveGroup(group, {
7814
7861
  skipDispose: true,
7815
7862
  skipActive: true,
7816
7863
  skipPopoutReturn: true,
7817
7864
  });
7818
- removedGroup.model.renderContainer =
7819
- this.overlayRenderContainer;
7820
- removedGroup.model.location = { type: 'grid' };
7821
- returnedGroup = removedGroup;
7865
+ group.model.location = { type: 'grid' };
7822
7866
  this.movingLock(() => {
7823
7867
  // suppress group add events since the group already exists
7824
- this.doAddGroup(removedGroup, [0]);
7868
+ this.doAddGroup(group, [0]);
7825
7869
  });
7826
7870
  }
7827
- this.doSetGroupAndPanelActive(removedGroup);
7871
+ this.doSetGroupAndPanelActive(group);
7828
7872
  }
7829
7873
  }));
7830
7874
  this._popoutGroups.push(value);
@@ -8965,31 +9009,6 @@
8965
9009
  }
8966
9010
  }
8967
9011
 
8968
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8969
- const Component = typeof componentName === 'string'
8970
- ? components[componentName]
8971
- : undefined;
8972
- const FrameworkComponent = typeof componentName === 'string'
8973
- ? frameworkComponents[componentName]
8974
- : undefined;
8975
- if (Component && FrameworkComponent) {
8976
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8977
- }
8978
- if (FrameworkComponent) {
8979
- if (!createFrameworkComponent) {
8980
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8981
- }
8982
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8983
- }
8984
- if (!Component) {
8985
- if (fallback) {
8986
- return fallback();
8987
- }
8988
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8989
- }
8990
- return new Component(id, componentName);
8991
- }
8992
-
8993
9012
  class GridviewComponent extends BaseGrid {
8994
9013
  get orientation() {
8995
9014
  return this.gridview.orientation;
@@ -9007,10 +9026,13 @@
9007
9026
  this._deserializer = value;
9008
9027
  }
9009
9028
  constructor(parentElement, options) {
9029
+ var _a;
9010
9030
  super(parentElement, {
9011
- proportionalLayout: options.proportionalLayout,
9031
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9012
9032
  orientation: options.orientation,
9013
- styles: options.styles,
9033
+ styles: options.hideBorders
9034
+ ? { separatorBorder: 'transparent' }
9035
+ : undefined,
9014
9036
  disableAutoResizing: options.disableAutoResizing,
9015
9037
  className: options.className,
9016
9038
  });
@@ -9030,12 +9052,6 @@
9030
9052
  }), this.onDidActiveChange((event) => {
9031
9053
  this._onDidActiveGroupChange.fire(event);
9032
9054
  }));
9033
- if (!this.options.components) {
9034
- this.options.components = {};
9035
- }
9036
- if (!this.options.frameworkComponents) {
9037
- this.options.frameworkComponents = {};
9038
- }
9039
9055
  }
9040
9056
  updateOptions(options) {
9041
9057
  super.updateOptions(options);
@@ -9085,14 +9101,11 @@
9085
9101
  const height = this.height;
9086
9102
  this.gridview.deserialize(grid, {
9087
9103
  fromJSON: (node) => {
9088
- var _a, _b;
9089
9104
  const { data } = node;
9090
- 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
9091
- ? {
9092
- createComponent: this.options.frameworkComponentFactory
9093
- .createComponent,
9094
- }
9095
- : undefined);
9105
+ const view = this.options.createComponent({
9106
+ id: data.id,
9107
+ name: data.component,
9108
+ });
9096
9109
  queue.push(() => view.init({
9097
9110
  params: data.params,
9098
9111
  minimumWidth: data.minimumWidth,
@@ -9170,7 +9183,7 @@
9170
9183
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9171
9184
  }
9172
9185
  addPanel(options) {
9173
- var _a, _b, _c, _d, _e, _f;
9186
+ var _a, _b, _c, _d;
9174
9187
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9175
9188
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9176
9189
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9186,14 +9199,12 @@
9186
9199
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9187
9200
  }
9188
9201
  }
9189
- 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
9190
- ? {
9191
- createComponent: this.options.frameworkComponentFactory
9192
- .createComponent,
9193
- }
9194
- : undefined);
9202
+ const view = this.options.createComponent({
9203
+ id: options.id,
9204
+ name: options.component,
9205
+ });
9195
9206
  view.init({
9196
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9207
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9197
9208
  minimumWidth: options.minimumWidth,
9198
9209
  maximumWidth: options.maximumWidth,
9199
9210
  minimumHeight: options.minimumHeight,
@@ -9321,12 +9332,6 @@
9321
9332
  this._classNames = new Classnames(this.element);
9322
9333
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9323
9334
  this._options = options;
9324
- if (!options.components) {
9325
- options.components = {};
9326
- }
9327
- if (!options.frameworkComponents) {
9328
- options.frameworkComponents = {};
9329
- }
9330
9335
  this.splitview = new Splitview(this.element, options);
9331
9336
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9332
9337
  }
@@ -9389,18 +9394,17 @@
9389
9394
  return this.panels.find((view) => view.id === id);
9390
9395
  }
9391
9396
  addPanel(options) {
9392
- var _a, _b, _c;
9397
+ var _a;
9393
9398
  if (this._panels.has(options.id)) {
9394
9399
  throw new Error(`panel ${options.id} already exists`);
9395
9400
  }
9396
- 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
9397
- ? {
9398
- createComponent: this.options.frameworkWrapper.createComponent,
9399
- }
9400
- : undefined);
9401
+ const view = this.options.createComponent({
9402
+ id: options.id,
9403
+ name: options.component,
9404
+ });
9401
9405
  view.orientation = this.splitview.orientation;
9402
9406
  view.init({
9403
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9407
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9404
9408
  minimumSize: options.minimumSize,
9405
9409
  maximumSize: options.maximumSize,
9406
9410
  snap: options.snap,
@@ -9462,17 +9466,14 @@
9462
9466
  descriptor: {
9463
9467
  size,
9464
9468
  views: views.map((view) => {
9465
- var _a, _b;
9466
9469
  const data = view.data;
9467
9470
  if (this._panels.has(data.id)) {
9468
9471
  throw new Error(`panel ${data.id} already exists`);
9469
9472
  }
9470
- 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
9471
- ? {
9472
- createComponent: this.options.frameworkWrapper
9473
- .createComponent,
9474
- }
9475
- : undefined);
9473
+ const panel = this.options.createComponent({
9474
+ id: data.id,
9475
+ name: data.component,
9476
+ });
9476
9477
  queue.push(() => {
9477
9478
  var _a;
9478
9479
  panel.init({
@@ -9655,16 +9656,12 @@
9655
9656
  this.onDidAddView = this._onDidAddView.event;
9656
9657
  this._onDidRemoveView = new Emitter();
9657
9658
  this.onDidRemoveView = this._onDidRemoveView.event;
9658
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9659
+ this._onUnhandledDragOverEvent = new Emitter();
9660
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9661
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9659
9662
  this._classNames = new Classnames(this.element);
9660
9663
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9661
9664
  this._options = options;
9662
- if (!options.components) {
9663
- options.components = {};
9664
- }
9665
- if (!options.frameworkComponents) {
9666
- options.frameworkComponents = {};
9667
- }
9668
9665
  this.paneview = new Paneview(this.element, {
9669
9666
  // only allow paneview in the vertical orientation for now
9670
9667
  orientation: exports.Orientation.VERTICAL,
@@ -9689,22 +9686,19 @@
9689
9686
  this._options = Object.assign(Object.assign({}, this.options), options);
9690
9687
  }
9691
9688
  addPanel(options) {
9692
- var _a, _b, _c, _d;
9693
- 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
9694
- ? {
9695
- createComponent: this.options.frameworkWrapper.body.createComponent,
9696
- }
9697
- : undefined);
9689
+ var _a;
9690
+ const body = this.options.createComponent({
9691
+ id: options.id,
9692
+ name: options.component,
9693
+ });
9698
9694
  let header;
9699
- if (options.headerComponent) {
9700
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9701
- ? {
9702
- createComponent: this.options.frameworkWrapper.header
9703
- .createComponent,
9704
- }
9705
- : undefined);
9695
+ if (options.headerComponent && this.options.createHeaderComponent) {
9696
+ header = this.options.createHeaderComponent({
9697
+ id: options.id,
9698
+ name: options.headerComponent,
9699
+ });
9706
9700
  }
9707
- else {
9701
+ if (!header) {
9708
9702
  header = new DefaultHeader();
9709
9703
  }
9710
9704
  const view = new PaneFramework({
@@ -9722,7 +9716,7 @@
9722
9716
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9723
9717
  const index = typeof options.index === 'number' ? options.index : undefined;
9724
9718
  view.init({
9725
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9719
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9726
9720
  minimumBodySize: options.minimumBodySize,
9727
9721
  maximumBodySize: options.maximumBodySize,
9728
9722
  isExpanded: options.isExpanded,
@@ -9787,24 +9781,20 @@
9787
9781
  descriptor: {
9788
9782
  size,
9789
9783
  views: views.map((view) => {
9790
- var _a, _b, _c, _d;
9791
9784
  const data = view.data;
9792
- 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
9793
- ? {
9794
- createComponent: this.options.frameworkWrapper.body
9795
- .createComponent,
9796
- }
9797
- : undefined);
9785
+ const body = this.options.createComponent({
9786
+ id: data.id,
9787
+ name: data.component,
9788
+ });
9798
9789
  let header;
9799
- if (data.headerComponent) {
9800
- 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
9801
- ? {
9802
- createComponent: this.options.frameworkWrapper.header
9803
- .createComponent,
9804
- }
9805
- : undefined);
9790
+ if (data.headerComponent &&
9791
+ this.options.createHeaderComponent) {
9792
+ header = this.options.createHeaderComponent({
9793
+ id: data.id,
9794
+ name: data.headerComponent,
9795
+ });
9806
9796
  }
9807
- else {
9797
+ if (!header) {
9808
9798
  header = new DefaultHeader();
9809
9799
  }
9810
9800
  const panel = new PaneFramework({
@@ -9852,9 +9842,11 @@
9852
9842
  this.paneview.dispose();
9853
9843
  }
9854
9844
  doAddPanel(panel) {
9855
- const disposable = panel.onDidDrop((event) => {
9845
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9856
9846
  this._onDidDrop.fire(event);
9857
- });
9847
+ }), panel.onUnhandledDragOverEvent((event) => {
9848
+ this._onUnhandledDragOverEvent.fire(event);
9849
+ }));
9858
9850
  this._viewDisposables.set(panel.id, disposable);
9859
9851
  }
9860
9852
  doRemovePanel(panel) {
@@ -10137,7 +10129,7 @@
10137
10129
  this._onDidBlur = new Emitter();
10138
10130
  this.onDidBlur = this._onDidBlur.event;
10139
10131
  this._element = document.createElement('div');
10140
- this._element.className = 'dockview-react-part';
10132
+ this._element.className = 'dv-react-part';
10141
10133
  this._element.style.height = '100%';
10142
10134
  this._element.style.width = '100%';
10143
10135
  }
@@ -10175,7 +10167,7 @@
10175
10167
  this.component = component;
10176
10168
  this.reactPortalStore = reactPortalStore;
10177
10169
  this._element = document.createElement('div');
10178
- this._element.className = 'dockview-react-part';
10170
+ this._element.className = 'dv-react-part';
10179
10171
  this._element.style.height = '100%';
10180
10172
  this._element.style.width = '100%';
10181
10173
  }
@@ -10211,7 +10203,7 @@
10211
10203
  this.component = component;
10212
10204
  this.reactPortalStore = reactPortalStore;
10213
10205
  this._element = document.createElement('div');
10214
- this._element.className = 'dockview-react-part';
10206
+ this._element.className = 'dv-react-part';
10215
10207
  this._element.style.height = '100%';
10216
10208
  this._element.style.width = '100%';
10217
10209
  }
@@ -10253,7 +10245,7 @@
10253
10245
  this._group = _group;
10254
10246
  this.mutableDisposable = new MutableDisposable();
10255
10247
  this._element = document.createElement('div');
10256
- this._element.className = 'dockview-react-part';
10248
+ this._element.className = 'dv-react-part';
10257
10249
  this._element.style.height = '100%';
10258
10250
  this._element.style.width = '100%';
10259
10251
  }
@@ -10312,8 +10304,8 @@
10312
10304
  : undefined;
10313
10305
  }
10314
10306
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10315
- function extractCoreOptions(props) {
10316
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10307
+ function extractCoreOptions$3(props) {
10308
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10317
10309
  if (key in props) {
10318
10310
  obj[key] = props[key];
10319
10311
  }
@@ -10329,7 +10321,7 @@
10329
10321
  const prevProps = React.useRef({});
10330
10322
  React.useEffect(() => {
10331
10323
  const changes = {};
10332
- PROPERTY_KEYS.forEach((propKey) => {
10324
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10333
10325
  const key = propKey;
10334
10326
  const propValue = props[key];
10335
10327
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10340,7 +10332,7 @@
10340
10332
  dockviewRef.current.updateOptions(changes);
10341
10333
  }
10342
10334
  prevProps.current = props;
10343
- }, PROPERTY_KEYS.map((key) => props[key]));
10335
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10344
10336
  React.useEffect(() => {
10345
10337
  var _a;
10346
10338
  if (!domRef.current) {
@@ -10376,7 +10368,7 @@
10376
10368
  ? DEFAULT_REACT_TAB
10377
10369
  : undefined,
10378
10370
  };
10379
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10371
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10380
10372
  const { clientWidth, clientHeight } = domRef.current;
10381
10373
  api.layout(clientWidth, clientHeight);
10382
10374
  if (props.onReady) {
@@ -10564,31 +10556,47 @@
10564
10556
  }
10565
10557
  }
10566
10558
 
10559
+ function extractCoreOptions$2(props) {
10560
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10561
+ if (key in props) {
10562
+ obj[key] = props[key];
10563
+ }
10564
+ return obj;
10565
+ }, {});
10566
+ return coreOptions;
10567
+ }
10567
10568
  const SplitviewReact = React.forwardRef((props, ref) => {
10568
10569
  const domRef = React.useRef(null);
10569
10570
  const splitviewRef = React.useRef();
10570
10571
  const [portals, addPortal] = usePortalsLifecycle();
10571
10572
  React.useImperativeHandle(ref, () => domRef.current, []);
10573
+ const prevProps = React.useRef({});
10572
10574
  React.useEffect(() => {
10573
- var _a;
10574
- const api = createSplitview(domRef.current, {
10575
- disableAutoResizing: props.disableAutoResizing,
10576
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10577
- frameworkComponents: props.components,
10578
- frameworkWrapper: {
10579
- createComponent: (id, componentId, component) => {
10580
- return new ReactPanelView(id, componentId, component, {
10581
- addPortal,
10582
- });
10583
- },
10584
- },
10585
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10586
- ? props.proportionalLayout
10587
- : true,
10588
- styles: props.hideBorders
10589
- ? { separatorBorder: 'transparent' }
10590
- : undefined,
10575
+ const changes = {};
10576
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10577
+ const key = propKey;
10578
+ const propValue = props[key];
10579
+ if (key in props && propValue !== prevProps.current[key]) {
10580
+ changes[key] = propValue;
10581
+ }
10591
10582
  });
10583
+ if (splitviewRef.current) {
10584
+ splitviewRef.current.updateOptions(changes);
10585
+ }
10586
+ prevProps.current = props;
10587
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10588
+ React.useEffect(() => {
10589
+ if (!domRef.current) {
10590
+ return () => {
10591
+ // noop
10592
+ };
10593
+ }
10594
+ const frameworkOptions = {
10595
+ createComponent: (options) => {
10596
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10597
+ },
10598
+ };
10599
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10592
10600
  const { clientWidth, clientHeight } = domRef.current;
10593
10601
  api.layout(clientWidth, clientHeight);
10594
10602
  if (props.onReady) {
@@ -10604,7 +10612,9 @@
10604
10612
  return;
10605
10613
  }
10606
10614
  splitviewRef.current.updateOptions({
10607
- frameworkComponents: props.components,
10615
+ createComponent: (options) => {
10616
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10617
+ },
10608
10618
  });
10609
10619
  }, [props.components]);
10610
10620
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10629,36 +10639,47 @@
10629
10639
  }
10630
10640
  }
10631
10641
 
10642
+ function extractCoreOptions$1(props) {
10643
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10644
+ if (key in props) {
10645
+ obj[key] = props[key];
10646
+ }
10647
+ return obj;
10648
+ }, {});
10649
+ return coreOptions;
10650
+ }
10632
10651
  const GridviewReact = React.forwardRef((props, ref) => {
10633
10652
  const domRef = React.useRef(null);
10634
10653
  const gridviewRef = React.useRef();
10635
10654
  const [portals, addPortal] = usePortalsLifecycle();
10636
10655
  React.useImperativeHandle(ref, () => domRef.current, []);
10656
+ const prevProps = React.useRef({});
10657
+ React.useEffect(() => {
10658
+ const changes = {};
10659
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10660
+ const key = propKey;
10661
+ const propValue = props[key];
10662
+ if (key in props && propValue !== prevProps.current[key]) {
10663
+ changes[key] = propValue;
10664
+ }
10665
+ });
10666
+ if (gridviewRef.current) {
10667
+ gridviewRef.current.updateOptions(changes);
10668
+ }
10669
+ prevProps.current = props;
10670
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10637
10671
  React.useEffect(() => {
10638
- var _a;
10639
10672
  if (!domRef.current) {
10640
10673
  return () => {
10641
10674
  // noop
10642
10675
  };
10643
10676
  }
10644
- const api = createGridview(domRef.current, {
10645
- disableAutoResizing: props.disableAutoResizing,
10646
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10647
- ? props.proportionalLayout
10648
- : true,
10649
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10650
- frameworkComponents: props.components,
10651
- frameworkComponentFactory: {
10652
- createComponent: (id, componentId, component) => {
10653
- return new ReactGridPanelView(id, componentId, component, {
10654
- addPortal,
10655
- });
10656
- },
10677
+ const frameworkOptions = {
10678
+ createComponent: (options) => {
10679
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10657
10680
  },
10658
- styles: props.hideBorders
10659
- ? { separatorBorder: 'transparent' }
10660
- : undefined,
10661
- });
10681
+ };
10682
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10662
10683
  const { clientWidth, clientHeight } = domRef.current;
10663
10684
  api.layout(clientWidth, clientHeight);
10664
10685
  if (props.onReady) {
@@ -10674,7 +10695,9 @@
10674
10695
  return;
10675
10696
  }
10676
10697
  gridviewRef.current.updateOptions({
10677
- frameworkComponents: props.components,
10698
+ createComponent: (options) => {
10699
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10700
+ },
10678
10701
  });
10679
10702
  }, [props.components]);
10680
10703
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10716,32 +10739,52 @@
10716
10739
  }
10717
10740
  }
10718
10741
 
10742
+ function extractCoreOptions(props) {
10743
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10744
+ if (key in props) {
10745
+ obj[key] = props[key];
10746
+ }
10747
+ return obj;
10748
+ }, {});
10749
+ return coreOptions;
10750
+ }
10719
10751
  const PaneviewReact = React.forwardRef((props, ref) => {
10720
10752
  const domRef = React.useRef(null);
10721
10753
  const paneviewRef = React.useRef();
10722
10754
  const [portals, addPortal] = usePortalsLifecycle();
10723
10755
  React.useImperativeHandle(ref, () => domRef.current, []);
10756
+ const prevProps = React.useRef({});
10724
10757
  React.useEffect(() => {
10725
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10726
- addPortal,
10758
+ const changes = {};
10759
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10760
+ const key = propKey;
10761
+ const propValue = props[key];
10762
+ if (key in props && propValue !== prevProps.current[key]) {
10763
+ changes[key] = propValue;
10764
+ }
10727
10765
  });
10728
- const api = createPaneview(domRef.current, {
10729
- disableAutoResizing: props.disableAutoResizing,
10730
- frameworkComponents: props.components,
10731
- components: {},
10732
- headerComponents: {},
10733
- disableDnd: props.disableDnd,
10734
- headerframeworkComponents: props.headerComponents,
10735
- frameworkWrapper: {
10736
- header: {
10737
- createComponent,
10738
- },
10739
- body: {
10740
- createComponent,
10741
- },
10766
+ if (paneviewRef.current) {
10767
+ paneviewRef.current.updateOptions(changes);
10768
+ }
10769
+ prevProps.current = props;
10770
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10771
+ React.useEffect(() => {
10772
+ var _a;
10773
+ if (!domRef.current) {
10774
+ return () => {
10775
+ // noop
10776
+ };
10777
+ }
10778
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10779
+ const frameworkOptions = {
10780
+ createComponent: (options) => {
10781
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10742
10782
  },
10743
- showDndOverlay: props.showDndOverlay,
10744
- });
10783
+ createHeaderComponent: (options) => {
10784
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10785
+ },
10786
+ };
10787
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10745
10788
  const { clientWidth, clientHeight } = domRef.current;
10746
10789
  api.layout(clientWidth, clientHeight);
10747
10790
  if (props.onReady) {
@@ -10757,41 +10800,38 @@
10757
10800
  return;
10758
10801
  }
10759
10802
  paneviewRef.current.updateOptions({
10760
- frameworkComponents: props.components,
10803
+ createComponent: (options) => {
10804
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10805
+ },
10761
10806
  });
10762
10807
  }, [props.components]);
10763
10808
  React.useEffect(() => {
10809
+ var _a;
10764
10810
  if (!paneviewRef.current) {
10765
10811
  return;
10766
10812
  }
10813
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10767
10814
  paneviewRef.current.updateOptions({
10768
- headerframeworkComponents: props.headerComponents,
10815
+ createHeaderComponent: (options) => {
10816
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10817
+ },
10769
10818
  });
10770
10819
  }, [props.headerComponents]);
10771
10820
  React.useEffect(() => {
10772
10821
  if (!paneviewRef.current) {
10773
10822
  return () => {
10774
- //
10823
+ // noop
10775
10824
  };
10776
10825
  }
10777
- const api = paneviewRef.current;
10778
- const disposable = api.onDidDrop((event) => {
10826
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10779
10827
  if (props.onDidDrop) {
10780
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10828
+ props.onDidDrop(event);
10781
10829
  }
10782
10830
  });
10783
10831
  return () => {
10784
10832
  disposable.dispose();
10785
10833
  };
10786
10834
  }, [props.onDidDrop]);
10787
- React.useEffect(() => {
10788
- if (!paneviewRef.current) {
10789
- return;
10790
- }
10791
- paneviewRef.current.updateOptions({
10792
- showDndOverlay: props.showDndOverlay,
10793
- });
10794
- }, [props.showDndOverlay]);
10795
10835
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10796
10836
  });
10797
10837
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10819,7 +10859,10 @@
10819
10859
  exports.GridviewComponent = GridviewComponent;
10820
10860
  exports.GridviewPanel = GridviewPanel;
10821
10861
  exports.GridviewReact = GridviewReact;
10822
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10862
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10863
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10864
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10865
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10823
10866
  exports.PaneFramework = PaneFramework;
10824
10867
  exports.PaneTransfer = PaneTransfer;
10825
10868
  exports.PanelTransfer = PanelTransfer;
@@ -10828,6 +10871,7 @@
10828
10871
  exports.PaneviewComponent = PaneviewComponent;
10829
10872
  exports.PaneviewPanel = PaneviewPanel;
10830
10873
  exports.PaneviewReact = PaneviewReact;
10874
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10831
10875
  exports.ReactPart = ReactPart;
10832
10876
  exports.ReactPartContext = ReactPartContext;
10833
10877
  exports.Splitview = Splitview;