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
  */
@@ -133,6 +133,17 @@
133
133
  this._defaultPrevented = true;
134
134
  }
135
135
  }
136
+ class AcceptableEvent {
137
+ constructor() {
138
+ this._isAccepted = false;
139
+ }
140
+ get isAccepted() {
141
+ return this._isAccepted;
142
+ }
143
+ accept() {
144
+ this._isAccepted = true;
145
+ }
146
+ }
136
147
  class LeakageMonitor {
137
148
  constructor() {
138
149
  this.events = new Map();
@@ -1524,6 +1535,23 @@
1524
1535
  }
1525
1536
  }
1526
1537
 
1538
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1539
+ /**
1540
+ * by readong the keys from an empty value object TypeScript will error
1541
+ * when we add or remove new properties to `DockviewOptions`
1542
+ */
1543
+ const properties = {
1544
+ orientation: undefined,
1545
+ descriptor: undefined,
1546
+ proportionalLayout: undefined,
1547
+ styles: undefined,
1548
+ margin: undefined,
1549
+ disableAutoResizing: undefined,
1550
+ className: undefined,
1551
+ };
1552
+ return Object.keys(properties);
1553
+ })();
1554
+
1527
1555
  class Paneview extends CompositeDisposable {
1528
1556
  get onDidAddView() {
1529
1557
  return this.splitview.onDidAddView;
@@ -2653,6 +2681,21 @@
2653
2681
  }
2654
2682
  }
2655
2683
 
2684
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2685
+ /**
2686
+ * by readong the keys from an empty value object TypeScript will error
2687
+ * when we add or remove new properties to `DockviewOptions`
2688
+ */
2689
+ const properties = {
2690
+ disableAutoResizing: undefined,
2691
+ proportionalLayout: undefined,
2692
+ orientation: undefined,
2693
+ hideBorders: undefined,
2694
+ className: undefined,
2695
+ };
2696
+ return Object.keys(properties);
2697
+ })();
2698
+
2656
2699
  class Resizable extends CompositeDisposable {
2657
2700
  get element() {
2658
2701
  return this._element;
@@ -3130,15 +3173,10 @@
3130
3173
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3131
3174
  */
3132
3175
  get onDidDrop() {
3133
- const emitter = new Emitter();
3134
- const disposable = this.component.onDidDrop((e) => {
3135
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3136
- });
3137
- emitter.dispose = () => {
3138
- disposable.dispose();
3139
- emitter.dispose();
3140
- };
3141
- return emitter.event;
3176
+ return this.component.onDidDrop;
3177
+ }
3178
+ get onUnhandledDragOverEvent() {
3179
+ return this.component.onUnhandledDragOverEvent;
3142
3180
  }
3143
3181
  constructor(component) {
3144
3182
  this.component = component;
@@ -4065,6 +4103,28 @@
4065
4103
  return 'center';
4066
4104
  }
4067
4105
 
4106
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4107
+ /**
4108
+ * by readong the keys from an empty value object TypeScript will error
4109
+ * when we add or remove new properties to `DockviewOptions`
4110
+ */
4111
+ const properties = {
4112
+ disableAutoResizing: undefined,
4113
+ disableDnd: undefined,
4114
+ className: undefined,
4115
+ };
4116
+ return Object.keys(properties);
4117
+ })();
4118
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4119
+ constructor(nativeEvent, position, getData, panel) {
4120
+ super();
4121
+ this.nativeEvent = nativeEvent;
4122
+ this.position = position;
4123
+ this.getData = getData;
4124
+ this.panel = panel;
4125
+ }
4126
+ }
4127
+
4068
4128
  class WillFocusEvent extends DockviewEvent {
4069
4129
  constructor() {
4070
4130
  super();
@@ -4488,6 +4548,9 @@
4488
4548
  this.accessor = accessor;
4489
4549
  this._onDidDrop = new Emitter();
4490
4550
  this.onDidDrop = this._onDidDrop.event;
4551
+ this._onUnhandledDragOverEvent = new Emitter();
4552
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4553
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4491
4554
  if (!disableDnd) {
4492
4555
  this.initDragFeatures();
4493
4556
  }
@@ -4514,7 +4577,7 @@
4514
4577
  overlayModel: {
4515
4578
  activationSize: { type: 'percentage', value: 50 },
4516
4579
  },
4517
- canDisplayOverlay: (event) => {
4580
+ canDisplayOverlay: (event, position) => {
4518
4581
  const data = getPaneData();
4519
4582
  if (data) {
4520
4583
  if (data.paneId !== this.id &&
@@ -4522,14 +4585,9 @@
4522
4585
  return true;
4523
4586
  }
4524
4587
  }
4525
- if (this.accessor.options.showDndOverlay) {
4526
- return this.accessor.options.showDndOverlay({
4527
- nativeEvent: event,
4528
- getData: getPaneData,
4529
- panel: this,
4530
- });
4531
- }
4532
- return false;
4588
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4589
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4590
+ return firedEvent.isAccepted;
4533
4591
  },
4534
4592
  });
4535
4593
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4984,15 +5042,7 @@
4984
5042
  this._element.appendChild(this.leftActionsContainer);
4985
5043
  this._element.appendChild(this.voidContainer.element);
4986
5044
  this._element.appendChild(this.rightActionsContainer);
4987
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4988
- if (e.api.group === this.group) {
4989
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4990
- }
4991
- }), this.accessor.onDidRemovePanel((e) => {
4992
- if (e.api.group === this.group) {
4993
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4994
- }
4995
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5045
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4996
5046
  this._onGroupDragStart.fire({
4997
5047
  nativeEvent: event,
4998
5048
  group: this.group,
@@ -5037,20 +5087,6 @@
5037
5087
  setActive(_isGroupActive) {
5038
5088
  // noop
5039
5089
  }
5040
- addTab(tab, index = this.tabs.length) {
5041
- if (index < 0 || index > this.tabs.length) {
5042
- throw new Error('invalid location');
5043
- }
5044
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5045
- this.tabs = [
5046
- ...this.tabs.slice(0, index),
5047
- tab,
5048
- ...this.tabs.slice(index),
5049
- ];
5050
- if (this.selectedIndex < 0) {
5051
- this.selectedIndex = index;
5052
- }
5053
- }
5054
5090
  delete(id) {
5055
5091
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5056
5092
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5058,6 +5094,7 @@
5058
5094
  disposable.dispose();
5059
5095
  value.dispose();
5060
5096
  value.element.remove();
5097
+ this.updateClassnames();
5061
5098
  }
5062
5099
  setActivePanel(panel) {
5063
5100
  this.tabs.forEach((tab) => {
@@ -5126,25 +5163,37 @@
5126
5163
  }
5127
5164
  this.tabs = [];
5128
5165
  }
5166
+ addTab(tab, index = this.tabs.length) {
5167
+ if (index < 0 || index > this.tabs.length) {
5168
+ throw new Error('invalid location');
5169
+ }
5170
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5171
+ this.tabs = [
5172
+ ...this.tabs.slice(0, index),
5173
+ tab,
5174
+ ...this.tabs.slice(index),
5175
+ ];
5176
+ if (this.selectedIndex < 0) {
5177
+ this.selectedIndex = index;
5178
+ }
5179
+ this.updateClassnames();
5180
+ }
5181
+ updateClassnames() {
5182
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5183
+ }
5129
5184
  }
5130
5185
 
5131
- class DockviewUnhandledDragOverEvent {
5132
- get isAccepted() {
5133
- return this._isAccepted;
5134
- }
5186
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5135
5187
  constructor(nativeEvent, target, position, getData, group) {
5188
+ super();
5136
5189
  this.nativeEvent = nativeEvent;
5137
5190
  this.target = target;
5138
5191
  this.position = position;
5139
5192
  this.getData = getData;
5140
5193
  this.group = group;
5141
- this._isAccepted = false;
5142
- }
5143
- accept() {
5144
- this._isAccepted = true;
5145
5194
  }
5146
5195
  }
5147
- const PROPERTY_KEYS = (() => {
5196
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5148
5197
  /**
5149
5198
  * by readong the keys from an empty value object TypeScript will error
5150
5199
  * when we add or remove new properties to `DockviewOptions`
@@ -7644,10 +7693,6 @@
7644
7693
  this._api = new DockviewApi(this);
7645
7694
  this.updateWatermark();
7646
7695
  }
7647
- dispose() {
7648
- this.clear(); // explicitly clear the layout before cleaning up
7649
- super.dispose();
7650
- }
7651
7696
  setVisible(panel, visible) {
7652
7697
  switch (panel.api.location.type) {
7653
7698
  case 'grid':
@@ -7831,30 +7876,29 @@
7831
7876
  }
7832
7877
  }
7833
7878
  else if (this.getPanel(group.id)) {
7834
- const removedGroup = group;
7879
+ group.model.renderContainer =
7880
+ this.overlayRenderContainer;
7881
+ returnedGroup = group;
7835
7882
  if (floatingBox) {
7836
- this.addFloatingGroup(removedGroup, {
7883
+ this.addFloatingGroup(group, {
7837
7884
  height: floatingBox.height,
7838
7885
  width: floatingBox.width,
7839
7886
  position: floatingBox,
7840
7887
  });
7841
7888
  }
7842
7889
  else {
7843
- this.doRemoveGroup(removedGroup, {
7890
+ this.doRemoveGroup(group, {
7844
7891
  skipDispose: true,
7845
7892
  skipActive: true,
7846
7893
  skipPopoutReturn: true,
7847
7894
  });
7848
- removedGroup.model.renderContainer =
7849
- this.overlayRenderContainer;
7850
- removedGroup.model.location = { type: 'grid' };
7851
- returnedGroup = removedGroup;
7895
+ group.model.location = { type: 'grid' };
7852
7896
  this.movingLock(() => {
7853
7897
  // suppress group add events since the group already exists
7854
- this.doAddGroup(removedGroup, [0]);
7898
+ this.doAddGroup(group, [0]);
7855
7899
  });
7856
7900
  }
7857
- this.doSetGroupAndPanelActive(removedGroup);
7901
+ this.doSetGroupAndPanelActive(group);
7858
7902
  }
7859
7903
  }));
7860
7904
  this._popoutGroups.push(value);
@@ -8995,31 +9039,6 @@
8995
9039
  }
8996
9040
  }
8997
9041
 
8998
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8999
- const Component = typeof componentName === 'string'
9000
- ? components[componentName]
9001
- : undefined;
9002
- const FrameworkComponent = typeof componentName === 'string'
9003
- ? frameworkComponents[componentName]
9004
- : undefined;
9005
- if (Component && FrameworkComponent) {
9006
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
9007
- }
9008
- if (FrameworkComponent) {
9009
- if (!createFrameworkComponent) {
9010
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9011
- }
9012
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9013
- }
9014
- if (!Component) {
9015
- if (fallback) {
9016
- return fallback();
9017
- }
9018
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9019
- }
9020
- return new Component(id, componentName);
9021
- }
9022
-
9023
9042
  class GridviewComponent extends BaseGrid {
9024
9043
  get orientation() {
9025
9044
  return this.gridview.orientation;
@@ -9037,10 +9056,13 @@
9037
9056
  this._deserializer = value;
9038
9057
  }
9039
9058
  constructor(parentElement, options) {
9059
+ var _a;
9040
9060
  super(parentElement, {
9041
- proportionalLayout: options.proportionalLayout,
9061
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9042
9062
  orientation: options.orientation,
9043
- styles: options.styles,
9063
+ styles: options.hideBorders
9064
+ ? { separatorBorder: 'transparent' }
9065
+ : undefined,
9044
9066
  disableAutoResizing: options.disableAutoResizing,
9045
9067
  className: options.className,
9046
9068
  });
@@ -9060,12 +9082,6 @@
9060
9082
  }), this.onDidActiveChange((event) => {
9061
9083
  this._onDidActiveGroupChange.fire(event);
9062
9084
  }));
9063
- if (!this.options.components) {
9064
- this.options.components = {};
9065
- }
9066
- if (!this.options.frameworkComponents) {
9067
- this.options.frameworkComponents = {};
9068
- }
9069
9085
  }
9070
9086
  updateOptions(options) {
9071
9087
  super.updateOptions(options);
@@ -9115,14 +9131,11 @@
9115
9131
  const height = this.height;
9116
9132
  this.gridview.deserialize(grid, {
9117
9133
  fromJSON: (node) => {
9118
- var _a, _b;
9119
9134
  const { data } = node;
9120
- 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
9121
- ? {
9122
- createComponent: this.options.frameworkComponentFactory
9123
- .createComponent,
9124
- }
9125
- : undefined);
9135
+ const view = this.options.createComponent({
9136
+ id: data.id,
9137
+ name: data.component,
9138
+ });
9126
9139
  queue.push(() => view.init({
9127
9140
  params: data.params,
9128
9141
  minimumWidth: data.minimumWidth,
@@ -9200,7 +9213,7 @@
9200
9213
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9201
9214
  }
9202
9215
  addPanel(options) {
9203
- var _a, _b, _c, _d, _e, _f;
9216
+ var _a, _b, _c, _d;
9204
9217
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9205
9218
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9206
9219
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9216,14 +9229,12 @@
9216
9229
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9217
9230
  }
9218
9231
  }
9219
- 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
9220
- ? {
9221
- createComponent: this.options.frameworkComponentFactory
9222
- .createComponent,
9223
- }
9224
- : undefined);
9232
+ const view = this.options.createComponent({
9233
+ id: options.id,
9234
+ name: options.component,
9235
+ });
9225
9236
  view.init({
9226
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9237
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9227
9238
  minimumWidth: options.minimumWidth,
9228
9239
  maximumWidth: options.maximumWidth,
9229
9240
  minimumHeight: options.minimumHeight,
@@ -9351,12 +9362,6 @@
9351
9362
  this._classNames = new Classnames(this.element);
9352
9363
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9353
9364
  this._options = options;
9354
- if (!options.components) {
9355
- options.components = {};
9356
- }
9357
- if (!options.frameworkComponents) {
9358
- options.frameworkComponents = {};
9359
- }
9360
9365
  this.splitview = new Splitview(this.element, options);
9361
9366
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9362
9367
  }
@@ -9419,18 +9424,17 @@
9419
9424
  return this.panels.find((view) => view.id === id);
9420
9425
  }
9421
9426
  addPanel(options) {
9422
- var _a, _b, _c;
9427
+ var _a;
9423
9428
  if (this._panels.has(options.id)) {
9424
9429
  throw new Error(`panel ${options.id} already exists`);
9425
9430
  }
9426
- 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
9427
- ? {
9428
- createComponent: this.options.frameworkWrapper.createComponent,
9429
- }
9430
- : undefined);
9431
+ const view = this.options.createComponent({
9432
+ id: options.id,
9433
+ name: options.component,
9434
+ });
9431
9435
  view.orientation = this.splitview.orientation;
9432
9436
  view.init({
9433
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9437
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9434
9438
  minimumSize: options.minimumSize,
9435
9439
  maximumSize: options.maximumSize,
9436
9440
  snap: options.snap,
@@ -9492,17 +9496,14 @@
9492
9496
  descriptor: {
9493
9497
  size,
9494
9498
  views: views.map((view) => {
9495
- var _a, _b;
9496
9499
  const data = view.data;
9497
9500
  if (this._panels.has(data.id)) {
9498
9501
  throw new Error(`panel ${data.id} already exists`);
9499
9502
  }
9500
- 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
9501
- ? {
9502
- createComponent: this.options.frameworkWrapper
9503
- .createComponent,
9504
- }
9505
- : undefined);
9503
+ const panel = this.options.createComponent({
9504
+ id: data.id,
9505
+ name: data.component,
9506
+ });
9506
9507
  queue.push(() => {
9507
9508
  var _a;
9508
9509
  panel.init({
@@ -9685,16 +9686,12 @@
9685
9686
  this.onDidAddView = this._onDidAddView.event;
9686
9687
  this._onDidRemoveView = new Emitter();
9687
9688
  this.onDidRemoveView = this._onDidRemoveView.event;
9688
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9689
+ this._onUnhandledDragOverEvent = new Emitter();
9690
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9691
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9689
9692
  this._classNames = new Classnames(this.element);
9690
9693
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9691
9694
  this._options = options;
9692
- if (!options.components) {
9693
- options.components = {};
9694
- }
9695
- if (!options.frameworkComponents) {
9696
- options.frameworkComponents = {};
9697
- }
9698
9695
  this.paneview = new Paneview(this.element, {
9699
9696
  // only allow paneview in the vertical orientation for now
9700
9697
  orientation: exports.Orientation.VERTICAL,
@@ -9719,22 +9716,19 @@
9719
9716
  this._options = Object.assign(Object.assign({}, this.options), options);
9720
9717
  }
9721
9718
  addPanel(options) {
9722
- var _a, _b, _c, _d;
9723
- 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
9724
- ? {
9725
- createComponent: this.options.frameworkWrapper.body.createComponent,
9726
- }
9727
- : undefined);
9719
+ var _a;
9720
+ const body = this.options.createComponent({
9721
+ id: options.id,
9722
+ name: options.component,
9723
+ });
9728
9724
  let header;
9729
- if (options.headerComponent) {
9730
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9731
- ? {
9732
- createComponent: this.options.frameworkWrapper.header
9733
- .createComponent,
9734
- }
9735
- : undefined);
9725
+ if (options.headerComponent && this.options.createHeaderComponent) {
9726
+ header = this.options.createHeaderComponent({
9727
+ id: options.id,
9728
+ name: options.headerComponent,
9729
+ });
9736
9730
  }
9737
- else {
9731
+ if (!header) {
9738
9732
  header = new DefaultHeader();
9739
9733
  }
9740
9734
  const view = new PaneFramework({
@@ -9752,7 +9746,7 @@
9752
9746
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9753
9747
  const index = typeof options.index === 'number' ? options.index : undefined;
9754
9748
  view.init({
9755
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9749
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9756
9750
  minimumBodySize: options.minimumBodySize,
9757
9751
  maximumBodySize: options.maximumBodySize,
9758
9752
  isExpanded: options.isExpanded,
@@ -9817,24 +9811,20 @@
9817
9811
  descriptor: {
9818
9812
  size,
9819
9813
  views: views.map((view) => {
9820
- var _a, _b, _c, _d;
9821
9814
  const data = view.data;
9822
- 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
9823
- ? {
9824
- createComponent: this.options.frameworkWrapper.body
9825
- .createComponent,
9826
- }
9827
- : undefined);
9815
+ const body = this.options.createComponent({
9816
+ id: data.id,
9817
+ name: data.component,
9818
+ });
9828
9819
  let header;
9829
- if (data.headerComponent) {
9830
- 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
9831
- ? {
9832
- createComponent: this.options.frameworkWrapper.header
9833
- .createComponent,
9834
- }
9835
- : undefined);
9820
+ if (data.headerComponent &&
9821
+ this.options.createHeaderComponent) {
9822
+ header = this.options.createHeaderComponent({
9823
+ id: data.id,
9824
+ name: data.headerComponent,
9825
+ });
9836
9826
  }
9837
- else {
9827
+ if (!header) {
9838
9828
  header = new DefaultHeader();
9839
9829
  }
9840
9830
  const panel = new PaneFramework({
@@ -9882,9 +9872,11 @@
9882
9872
  this.paneview.dispose();
9883
9873
  }
9884
9874
  doAddPanel(panel) {
9885
- const disposable = panel.onDidDrop((event) => {
9875
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9886
9876
  this._onDidDrop.fire(event);
9887
- });
9877
+ }), panel.onUnhandledDragOverEvent((event) => {
9878
+ this._onUnhandledDragOverEvent.fire(event);
9879
+ }));
9888
9880
  this._viewDisposables.set(panel.id, disposable);
9889
9881
  }
9890
9882
  doRemovePanel(panel) {
@@ -10167,7 +10159,7 @@
10167
10159
  this._onDidBlur = new Emitter();
10168
10160
  this.onDidBlur = this._onDidBlur.event;
10169
10161
  this._element = document.createElement('div');
10170
- this._element.className = 'dockview-react-part';
10162
+ this._element.className = 'dv-react-part';
10171
10163
  this._element.style.height = '100%';
10172
10164
  this._element.style.width = '100%';
10173
10165
  }
@@ -10205,7 +10197,7 @@
10205
10197
  this.component = component;
10206
10198
  this.reactPortalStore = reactPortalStore;
10207
10199
  this._element = document.createElement('div');
10208
- this._element.className = 'dockview-react-part';
10200
+ this._element.className = 'dv-react-part';
10209
10201
  this._element.style.height = '100%';
10210
10202
  this._element.style.width = '100%';
10211
10203
  }
@@ -10241,7 +10233,7 @@
10241
10233
  this.component = component;
10242
10234
  this.reactPortalStore = reactPortalStore;
10243
10235
  this._element = document.createElement('div');
10244
- this._element.className = 'dockview-react-part';
10236
+ this._element.className = 'dv-react-part';
10245
10237
  this._element.style.height = '100%';
10246
10238
  this._element.style.width = '100%';
10247
10239
  }
@@ -10283,7 +10275,7 @@
10283
10275
  this._group = _group;
10284
10276
  this.mutableDisposable = new MutableDisposable();
10285
10277
  this._element = document.createElement('div');
10286
- this._element.className = 'dockview-react-part';
10278
+ this._element.className = 'dv-react-part';
10287
10279
  this._element.style.height = '100%';
10288
10280
  this._element.style.width = '100%';
10289
10281
  }
@@ -10342,8 +10334,8 @@
10342
10334
  : undefined;
10343
10335
  }
10344
10336
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10345
- function extractCoreOptions(props) {
10346
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10337
+ function extractCoreOptions$3(props) {
10338
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10347
10339
  if (key in props) {
10348
10340
  obj[key] = props[key];
10349
10341
  }
@@ -10359,7 +10351,7 @@
10359
10351
  const prevProps = React.useRef({});
10360
10352
  React.useEffect(() => {
10361
10353
  const changes = {};
10362
- PROPERTY_KEYS.forEach((propKey) => {
10354
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10363
10355
  const key = propKey;
10364
10356
  const propValue = props[key];
10365
10357
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10370,7 +10362,7 @@
10370
10362
  dockviewRef.current.updateOptions(changes);
10371
10363
  }
10372
10364
  prevProps.current = props;
10373
- }, PROPERTY_KEYS.map((key) => props[key]));
10365
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10374
10366
  React.useEffect(() => {
10375
10367
  var _a;
10376
10368
  if (!domRef.current) {
@@ -10406,7 +10398,7 @@
10406
10398
  ? DEFAULT_REACT_TAB
10407
10399
  : undefined,
10408
10400
  };
10409
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10401
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10410
10402
  const { clientWidth, clientHeight } = domRef.current;
10411
10403
  api.layout(clientWidth, clientHeight);
10412
10404
  if (props.onReady) {
@@ -10594,31 +10586,47 @@
10594
10586
  }
10595
10587
  }
10596
10588
 
10589
+ function extractCoreOptions$2(props) {
10590
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10591
+ if (key in props) {
10592
+ obj[key] = props[key];
10593
+ }
10594
+ return obj;
10595
+ }, {});
10596
+ return coreOptions;
10597
+ }
10597
10598
  const SplitviewReact = React.forwardRef((props, ref) => {
10598
10599
  const domRef = React.useRef(null);
10599
10600
  const splitviewRef = React.useRef();
10600
10601
  const [portals, addPortal] = usePortalsLifecycle();
10601
10602
  React.useImperativeHandle(ref, () => domRef.current, []);
10603
+ const prevProps = React.useRef({});
10602
10604
  React.useEffect(() => {
10603
- var _a;
10604
- const api = createSplitview(domRef.current, {
10605
- disableAutoResizing: props.disableAutoResizing,
10606
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10607
- frameworkComponents: props.components,
10608
- frameworkWrapper: {
10609
- createComponent: (id, componentId, component) => {
10610
- return new ReactPanelView(id, componentId, component, {
10611
- addPortal,
10612
- });
10613
- },
10614
- },
10615
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10616
- ? props.proportionalLayout
10617
- : true,
10618
- styles: props.hideBorders
10619
- ? { separatorBorder: 'transparent' }
10620
- : undefined,
10605
+ const changes = {};
10606
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10607
+ const key = propKey;
10608
+ const propValue = props[key];
10609
+ if (key in props && propValue !== prevProps.current[key]) {
10610
+ changes[key] = propValue;
10611
+ }
10621
10612
  });
10613
+ if (splitviewRef.current) {
10614
+ splitviewRef.current.updateOptions(changes);
10615
+ }
10616
+ prevProps.current = props;
10617
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10618
+ React.useEffect(() => {
10619
+ if (!domRef.current) {
10620
+ return () => {
10621
+ // noop
10622
+ };
10623
+ }
10624
+ const frameworkOptions = {
10625
+ createComponent: (options) => {
10626
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10627
+ },
10628
+ };
10629
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10622
10630
  const { clientWidth, clientHeight } = domRef.current;
10623
10631
  api.layout(clientWidth, clientHeight);
10624
10632
  if (props.onReady) {
@@ -10634,7 +10642,9 @@
10634
10642
  return;
10635
10643
  }
10636
10644
  splitviewRef.current.updateOptions({
10637
- frameworkComponents: props.components,
10645
+ createComponent: (options) => {
10646
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10647
+ },
10638
10648
  });
10639
10649
  }, [props.components]);
10640
10650
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10659,36 +10669,47 @@
10659
10669
  }
10660
10670
  }
10661
10671
 
10672
+ function extractCoreOptions$1(props) {
10673
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10674
+ if (key in props) {
10675
+ obj[key] = props[key];
10676
+ }
10677
+ return obj;
10678
+ }, {});
10679
+ return coreOptions;
10680
+ }
10662
10681
  const GridviewReact = React.forwardRef((props, ref) => {
10663
10682
  const domRef = React.useRef(null);
10664
10683
  const gridviewRef = React.useRef();
10665
10684
  const [portals, addPortal] = usePortalsLifecycle();
10666
10685
  React.useImperativeHandle(ref, () => domRef.current, []);
10686
+ const prevProps = React.useRef({});
10687
+ React.useEffect(() => {
10688
+ const changes = {};
10689
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10690
+ const key = propKey;
10691
+ const propValue = props[key];
10692
+ if (key in props && propValue !== prevProps.current[key]) {
10693
+ changes[key] = propValue;
10694
+ }
10695
+ });
10696
+ if (gridviewRef.current) {
10697
+ gridviewRef.current.updateOptions(changes);
10698
+ }
10699
+ prevProps.current = props;
10700
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10667
10701
  React.useEffect(() => {
10668
- var _a;
10669
10702
  if (!domRef.current) {
10670
10703
  return () => {
10671
10704
  // noop
10672
10705
  };
10673
10706
  }
10674
- const api = createGridview(domRef.current, {
10675
- disableAutoResizing: props.disableAutoResizing,
10676
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10677
- ? props.proportionalLayout
10678
- : true,
10679
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10680
- frameworkComponents: props.components,
10681
- frameworkComponentFactory: {
10682
- createComponent: (id, componentId, component) => {
10683
- return new ReactGridPanelView(id, componentId, component, {
10684
- addPortal,
10685
- });
10686
- },
10707
+ const frameworkOptions = {
10708
+ createComponent: (options) => {
10709
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10687
10710
  },
10688
- styles: props.hideBorders
10689
- ? { separatorBorder: 'transparent' }
10690
- : undefined,
10691
- });
10711
+ };
10712
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10692
10713
  const { clientWidth, clientHeight } = domRef.current;
10693
10714
  api.layout(clientWidth, clientHeight);
10694
10715
  if (props.onReady) {
@@ -10704,7 +10725,9 @@
10704
10725
  return;
10705
10726
  }
10706
10727
  gridviewRef.current.updateOptions({
10707
- frameworkComponents: props.components,
10728
+ createComponent: (options) => {
10729
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10730
+ },
10708
10731
  });
10709
10732
  }, [props.components]);
10710
10733
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10746,32 +10769,52 @@
10746
10769
  }
10747
10770
  }
10748
10771
 
10772
+ function extractCoreOptions(props) {
10773
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10774
+ if (key in props) {
10775
+ obj[key] = props[key];
10776
+ }
10777
+ return obj;
10778
+ }, {});
10779
+ return coreOptions;
10780
+ }
10749
10781
  const PaneviewReact = React.forwardRef((props, ref) => {
10750
10782
  const domRef = React.useRef(null);
10751
10783
  const paneviewRef = React.useRef();
10752
10784
  const [portals, addPortal] = usePortalsLifecycle();
10753
10785
  React.useImperativeHandle(ref, () => domRef.current, []);
10786
+ const prevProps = React.useRef({});
10754
10787
  React.useEffect(() => {
10755
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10756
- addPortal,
10788
+ const changes = {};
10789
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10790
+ const key = propKey;
10791
+ const propValue = props[key];
10792
+ if (key in props && propValue !== prevProps.current[key]) {
10793
+ changes[key] = propValue;
10794
+ }
10757
10795
  });
10758
- const api = createPaneview(domRef.current, {
10759
- disableAutoResizing: props.disableAutoResizing,
10760
- frameworkComponents: props.components,
10761
- components: {},
10762
- headerComponents: {},
10763
- disableDnd: props.disableDnd,
10764
- headerframeworkComponents: props.headerComponents,
10765
- frameworkWrapper: {
10766
- header: {
10767
- createComponent,
10768
- },
10769
- body: {
10770
- createComponent,
10771
- },
10796
+ if (paneviewRef.current) {
10797
+ paneviewRef.current.updateOptions(changes);
10798
+ }
10799
+ prevProps.current = props;
10800
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10801
+ React.useEffect(() => {
10802
+ var _a;
10803
+ if (!domRef.current) {
10804
+ return () => {
10805
+ // noop
10806
+ };
10807
+ }
10808
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10809
+ const frameworkOptions = {
10810
+ createComponent: (options) => {
10811
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10772
10812
  },
10773
- showDndOverlay: props.showDndOverlay,
10774
- });
10813
+ createHeaderComponent: (options) => {
10814
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10815
+ },
10816
+ };
10817
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10775
10818
  const { clientWidth, clientHeight } = domRef.current;
10776
10819
  api.layout(clientWidth, clientHeight);
10777
10820
  if (props.onReady) {
@@ -10787,41 +10830,38 @@
10787
10830
  return;
10788
10831
  }
10789
10832
  paneviewRef.current.updateOptions({
10790
- frameworkComponents: props.components,
10833
+ createComponent: (options) => {
10834
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10835
+ },
10791
10836
  });
10792
10837
  }, [props.components]);
10793
10838
  React.useEffect(() => {
10839
+ var _a;
10794
10840
  if (!paneviewRef.current) {
10795
10841
  return;
10796
10842
  }
10843
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10797
10844
  paneviewRef.current.updateOptions({
10798
- headerframeworkComponents: props.headerComponents,
10845
+ createHeaderComponent: (options) => {
10846
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10847
+ },
10799
10848
  });
10800
10849
  }, [props.headerComponents]);
10801
10850
  React.useEffect(() => {
10802
10851
  if (!paneviewRef.current) {
10803
10852
  return () => {
10804
- //
10853
+ // noop
10805
10854
  };
10806
10855
  }
10807
- const api = paneviewRef.current;
10808
- const disposable = api.onDidDrop((event) => {
10856
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10809
10857
  if (props.onDidDrop) {
10810
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10858
+ props.onDidDrop(event);
10811
10859
  }
10812
10860
  });
10813
10861
  return () => {
10814
10862
  disposable.dispose();
10815
10863
  };
10816
10864
  }, [props.onDidDrop]);
10817
- React.useEffect(() => {
10818
- if (!paneviewRef.current) {
10819
- return;
10820
- }
10821
- paneviewRef.current.updateOptions({
10822
- showDndOverlay: props.showDndOverlay,
10823
- });
10824
- }, [props.showDndOverlay]);
10825
10865
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10826
10866
  });
10827
10867
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10849,7 +10889,10 @@
10849
10889
  exports.GridviewComponent = GridviewComponent;
10850
10890
  exports.GridviewPanel = GridviewPanel;
10851
10891
  exports.GridviewReact = GridviewReact;
10852
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10892
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10893
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10894
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10895
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10853
10896
  exports.PaneFramework = PaneFramework;
10854
10897
  exports.PaneTransfer = PaneTransfer;
10855
10898
  exports.PanelTransfer = PanelTransfer;
@@ -10858,6 +10901,7 @@
10858
10901
  exports.PaneviewComponent = PaneviewComponent;
10859
10902
  exports.PaneviewPanel = PaneviewPanel;
10860
10903
  exports.PaneviewReact = PaneviewReact;
10904
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10861
10905
  exports.ReactPart = ReactPart;
10862
10906
  exports.ReactPartContext = ReactPartContext;
10863
10907
  exports.Splitview = Splitview;