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
  */
@@ -130,6 +130,17 @@ class DockviewEvent {
130
130
  this._defaultPrevented = true;
131
131
  }
132
132
  }
133
+ class AcceptableEvent {
134
+ constructor() {
135
+ this._isAccepted = false;
136
+ }
137
+ get isAccepted() {
138
+ return this._isAccepted;
139
+ }
140
+ accept() {
141
+ this._isAccepted = true;
142
+ }
143
+ }
133
144
  class LeakageMonitor {
134
145
  constructor() {
135
146
  this.events = new Map();
@@ -1521,6 +1532,23 @@ class Splitview {
1521
1532
  }
1522
1533
  }
1523
1534
 
1535
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1536
+ /**
1537
+ * by readong the keys from an empty value object TypeScript will error
1538
+ * when we add or remove new properties to `DockviewOptions`
1539
+ */
1540
+ const properties = {
1541
+ orientation: undefined,
1542
+ descriptor: undefined,
1543
+ proportionalLayout: undefined,
1544
+ styles: undefined,
1545
+ margin: undefined,
1546
+ disableAutoResizing: undefined,
1547
+ className: undefined,
1548
+ };
1549
+ return Object.keys(properties);
1550
+ })();
1551
+
1524
1552
  class Paneview extends CompositeDisposable {
1525
1553
  get onDidAddView() {
1526
1554
  return this.splitview.onDidAddView;
@@ -2650,6 +2678,21 @@ class Gridview {
2650
2678
  }
2651
2679
  }
2652
2680
 
2681
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2682
+ /**
2683
+ * by readong the keys from an empty value object TypeScript will error
2684
+ * when we add or remove new properties to `DockviewOptions`
2685
+ */
2686
+ const properties = {
2687
+ disableAutoResizing: undefined,
2688
+ proportionalLayout: undefined,
2689
+ orientation: undefined,
2690
+ hideBorders: undefined,
2691
+ className: undefined,
2692
+ };
2693
+ return Object.keys(properties);
2694
+ })();
2695
+
2653
2696
  class Resizable extends CompositeDisposable {
2654
2697
  get element() {
2655
2698
  return this._element;
@@ -3127,15 +3170,10 @@ class PaneviewApi {
3127
3170
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3128
3171
  */
3129
3172
  get onDidDrop() {
3130
- const emitter = new Emitter();
3131
- const disposable = this.component.onDidDrop((e) => {
3132
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3133
- });
3134
- emitter.dispose = () => {
3135
- disposable.dispose();
3136
- emitter.dispose();
3137
- };
3138
- return emitter.event;
3173
+ return this.component.onDidDrop;
3174
+ }
3175
+ get onUnhandledDragOverEvent() {
3176
+ return this.component.onUnhandledDragOverEvent;
3139
3177
  }
3140
3178
  constructor(component) {
3141
3179
  this.component = component;
@@ -4062,6 +4100,28 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
4062
4100
  return 'center';
4063
4101
  }
4064
4102
 
4103
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4104
+ /**
4105
+ * by readong the keys from an empty value object TypeScript will error
4106
+ * when we add or remove new properties to `DockviewOptions`
4107
+ */
4108
+ const properties = {
4109
+ disableAutoResizing: undefined,
4110
+ disableDnd: undefined,
4111
+ className: undefined,
4112
+ };
4113
+ return Object.keys(properties);
4114
+ })();
4115
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4116
+ constructor(nativeEvent, position, getData, panel) {
4117
+ super();
4118
+ this.nativeEvent = nativeEvent;
4119
+ this.position = position;
4120
+ this.getData = getData;
4121
+ this.panel = panel;
4122
+ }
4123
+ }
4124
+
4065
4125
  class WillFocusEvent extends DockviewEvent {
4066
4126
  constructor() {
4067
4127
  super();
@@ -4485,6 +4545,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4485
4545
  this.accessor = accessor;
4486
4546
  this._onDidDrop = new Emitter();
4487
4547
  this.onDidDrop = this._onDidDrop.event;
4548
+ this._onUnhandledDragOverEvent = new Emitter();
4549
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4550
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4488
4551
  if (!disableDnd) {
4489
4552
  this.initDragFeatures();
4490
4553
  }
@@ -4511,7 +4574,7 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4511
4574
  overlayModel: {
4512
4575
  activationSize: { type: 'percentage', value: 50 },
4513
4576
  },
4514
- canDisplayOverlay: (event) => {
4577
+ canDisplayOverlay: (event, position) => {
4515
4578
  const data = getPaneData();
4516
4579
  if (data) {
4517
4580
  if (data.paneId !== this.id &&
@@ -4519,14 +4582,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4519
4582
  return true;
4520
4583
  }
4521
4584
  }
4522
- if (this.accessor.options.showDndOverlay) {
4523
- return this.accessor.options.showDndOverlay({
4524
- nativeEvent: event,
4525
- getData: getPaneData,
4526
- panel: this,
4527
- });
4528
- }
4529
- return false;
4585
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4586
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4587
+ return firedEvent.isAccepted;
4530
4588
  },
4531
4589
  });
4532
4590
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4981,15 +5039,7 @@ class TabsContainer extends CompositeDisposable {
4981
5039
  this._element.appendChild(this.leftActionsContainer);
4982
5040
  this._element.appendChild(this.voidContainer.element);
4983
5041
  this._element.appendChild(this.rightActionsContainer);
4984
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4985
- if (e.api.group === this.group) {
4986
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4987
- }
4988
- }), this.accessor.onDidRemovePanel((e) => {
4989
- if (e.api.group === this.group) {
4990
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4991
- }
4992
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5042
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4993
5043
  this._onGroupDragStart.fire({
4994
5044
  nativeEvent: event,
4995
5045
  group: this.group,
@@ -5034,20 +5084,6 @@ class TabsContainer extends CompositeDisposable {
5034
5084
  setActive(_isGroupActive) {
5035
5085
  // noop
5036
5086
  }
5037
- addTab(tab, index = this.tabs.length) {
5038
- if (index < 0 || index > this.tabs.length) {
5039
- throw new Error('invalid location');
5040
- }
5041
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5042
- this.tabs = [
5043
- ...this.tabs.slice(0, index),
5044
- tab,
5045
- ...this.tabs.slice(index),
5046
- ];
5047
- if (this.selectedIndex < 0) {
5048
- this.selectedIndex = index;
5049
- }
5050
- }
5051
5087
  delete(id) {
5052
5088
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5053
5089
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5055,6 +5091,7 @@ class TabsContainer extends CompositeDisposable {
5055
5091
  disposable.dispose();
5056
5092
  value.dispose();
5057
5093
  value.element.remove();
5094
+ this.updateClassnames();
5058
5095
  }
5059
5096
  setActivePanel(panel) {
5060
5097
  this.tabs.forEach((tab) => {
@@ -5123,25 +5160,37 @@ class TabsContainer extends CompositeDisposable {
5123
5160
  }
5124
5161
  this.tabs = [];
5125
5162
  }
5163
+ addTab(tab, index = this.tabs.length) {
5164
+ if (index < 0 || index > this.tabs.length) {
5165
+ throw new Error('invalid location');
5166
+ }
5167
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5168
+ this.tabs = [
5169
+ ...this.tabs.slice(0, index),
5170
+ tab,
5171
+ ...this.tabs.slice(index),
5172
+ ];
5173
+ if (this.selectedIndex < 0) {
5174
+ this.selectedIndex = index;
5175
+ }
5176
+ this.updateClassnames();
5177
+ }
5178
+ updateClassnames() {
5179
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5180
+ }
5126
5181
  }
5127
5182
 
5128
- class DockviewUnhandledDragOverEvent {
5129
- get isAccepted() {
5130
- return this._isAccepted;
5131
- }
5183
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5132
5184
  constructor(nativeEvent, target, position, getData, group) {
5185
+ super();
5133
5186
  this.nativeEvent = nativeEvent;
5134
5187
  this.target = target;
5135
5188
  this.position = position;
5136
5189
  this.getData = getData;
5137
5190
  this.group = group;
5138
- this._isAccepted = false;
5139
- }
5140
- accept() {
5141
- this._isAccepted = true;
5142
5191
  }
5143
5192
  }
5144
- const PROPERTY_KEYS = (() => {
5193
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5145
5194
  /**
5146
5195
  * by readong the keys from an empty value object TypeScript will error
5147
5196
  * when we add or remove new properties to `DockviewOptions`
@@ -7641,10 +7690,6 @@ class DockviewComponent extends BaseGrid {
7641
7690
  this._api = new DockviewApi(this);
7642
7691
  this.updateWatermark();
7643
7692
  }
7644
- dispose() {
7645
- this.clear(); // explicitly clear the layout before cleaning up
7646
- super.dispose();
7647
- }
7648
7693
  setVisible(panel, visible) {
7649
7694
  switch (panel.api.location.type) {
7650
7695
  case 'grid':
@@ -7828,30 +7873,29 @@ class DockviewComponent extends BaseGrid {
7828
7873
  }
7829
7874
  }
7830
7875
  else if (this.getPanel(group.id)) {
7831
- const removedGroup = group;
7876
+ group.model.renderContainer =
7877
+ this.overlayRenderContainer;
7878
+ returnedGroup = group;
7832
7879
  if (floatingBox) {
7833
- this.addFloatingGroup(removedGroup, {
7880
+ this.addFloatingGroup(group, {
7834
7881
  height: floatingBox.height,
7835
7882
  width: floatingBox.width,
7836
7883
  position: floatingBox,
7837
7884
  });
7838
7885
  }
7839
7886
  else {
7840
- this.doRemoveGroup(removedGroup, {
7887
+ this.doRemoveGroup(group, {
7841
7888
  skipDispose: true,
7842
7889
  skipActive: true,
7843
7890
  skipPopoutReturn: true,
7844
7891
  });
7845
- removedGroup.model.renderContainer =
7846
- this.overlayRenderContainer;
7847
- removedGroup.model.location = { type: 'grid' };
7848
- returnedGroup = removedGroup;
7892
+ group.model.location = { type: 'grid' };
7849
7893
  this.movingLock(() => {
7850
7894
  // suppress group add events since the group already exists
7851
- this.doAddGroup(removedGroup, [0]);
7895
+ this.doAddGroup(group, [0]);
7852
7896
  });
7853
7897
  }
7854
- this.doSetGroupAndPanelActive(removedGroup);
7898
+ this.doSetGroupAndPanelActive(group);
7855
7899
  }
7856
7900
  }));
7857
7901
  this._popoutGroups.push(value);
@@ -8992,31 +9036,6 @@ class DockviewComponent extends BaseGrid {
8992
9036
  }
8993
9037
  }
8994
9038
 
8995
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8996
- const Component = typeof componentName === 'string'
8997
- ? components[componentName]
8998
- : undefined;
8999
- const FrameworkComponent = typeof componentName === 'string'
9000
- ? frameworkComponents[componentName]
9001
- : undefined;
9002
- if (Component && FrameworkComponent) {
9003
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
9004
- }
9005
- if (FrameworkComponent) {
9006
- if (!createFrameworkComponent) {
9007
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9008
- }
9009
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9010
- }
9011
- if (!Component) {
9012
- if (fallback) {
9013
- return fallback();
9014
- }
9015
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9016
- }
9017
- return new Component(id, componentName);
9018
- }
9019
-
9020
9039
  class GridviewComponent extends BaseGrid {
9021
9040
  get orientation() {
9022
9041
  return this.gridview.orientation;
@@ -9034,10 +9053,13 @@ class GridviewComponent extends BaseGrid {
9034
9053
  this._deserializer = value;
9035
9054
  }
9036
9055
  constructor(parentElement, options) {
9056
+ var _a;
9037
9057
  super(parentElement, {
9038
- proportionalLayout: options.proportionalLayout,
9058
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9039
9059
  orientation: options.orientation,
9040
- styles: options.styles,
9060
+ styles: options.hideBorders
9061
+ ? { separatorBorder: 'transparent' }
9062
+ : undefined,
9041
9063
  disableAutoResizing: options.disableAutoResizing,
9042
9064
  className: options.className,
9043
9065
  });
@@ -9057,12 +9079,6 @@ class GridviewComponent extends BaseGrid {
9057
9079
  }), this.onDidActiveChange((event) => {
9058
9080
  this._onDidActiveGroupChange.fire(event);
9059
9081
  }));
9060
- if (!this.options.components) {
9061
- this.options.components = {};
9062
- }
9063
- if (!this.options.frameworkComponents) {
9064
- this.options.frameworkComponents = {};
9065
- }
9066
9082
  }
9067
9083
  updateOptions(options) {
9068
9084
  super.updateOptions(options);
@@ -9112,14 +9128,11 @@ class GridviewComponent extends BaseGrid {
9112
9128
  const height = this.height;
9113
9129
  this.gridview.deserialize(grid, {
9114
9130
  fromJSON: (node) => {
9115
- var _a, _b;
9116
9131
  const { data } = node;
9117
- 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
9118
- ? {
9119
- createComponent: this.options.frameworkComponentFactory
9120
- .createComponent,
9121
- }
9122
- : undefined);
9132
+ const view = this.options.createComponent({
9133
+ id: data.id,
9134
+ name: data.component,
9135
+ });
9123
9136
  queue.push(() => view.init({
9124
9137
  params: data.params,
9125
9138
  minimumWidth: data.minimumWidth,
@@ -9197,7 +9210,7 @@ class GridviewComponent extends BaseGrid {
9197
9210
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9198
9211
  }
9199
9212
  addPanel(options) {
9200
- var _a, _b, _c, _d, _e, _f;
9213
+ var _a, _b, _c, _d;
9201
9214
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9202
9215
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9203
9216
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9213,14 +9226,12 @@ class GridviewComponent extends BaseGrid {
9213
9226
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9214
9227
  }
9215
9228
  }
9216
- 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
9217
- ? {
9218
- createComponent: this.options.frameworkComponentFactory
9219
- .createComponent,
9220
- }
9221
- : undefined);
9229
+ const view = this.options.createComponent({
9230
+ id: options.id,
9231
+ name: options.component,
9232
+ });
9222
9233
  view.init({
9223
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9234
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9224
9235
  minimumWidth: options.minimumWidth,
9225
9236
  maximumWidth: options.maximumWidth,
9226
9237
  minimumHeight: options.minimumHeight,
@@ -9348,12 +9359,6 @@ class SplitviewComponent extends Resizable {
9348
9359
  this._classNames = new Classnames(this.element);
9349
9360
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9350
9361
  this._options = options;
9351
- if (!options.components) {
9352
- options.components = {};
9353
- }
9354
- if (!options.frameworkComponents) {
9355
- options.frameworkComponents = {};
9356
- }
9357
9362
  this.splitview = new Splitview(this.element, options);
9358
9363
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9359
9364
  }
@@ -9416,18 +9421,17 @@ class SplitviewComponent extends Resizable {
9416
9421
  return this.panels.find((view) => view.id === id);
9417
9422
  }
9418
9423
  addPanel(options) {
9419
- var _a, _b, _c;
9424
+ var _a;
9420
9425
  if (this._panels.has(options.id)) {
9421
9426
  throw new Error(`panel ${options.id} already exists`);
9422
9427
  }
9423
- 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
9424
- ? {
9425
- createComponent: this.options.frameworkWrapper.createComponent,
9426
- }
9427
- : undefined);
9428
+ const view = this.options.createComponent({
9429
+ id: options.id,
9430
+ name: options.component,
9431
+ });
9428
9432
  view.orientation = this.splitview.orientation;
9429
9433
  view.init({
9430
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9434
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9431
9435
  minimumSize: options.minimumSize,
9432
9436
  maximumSize: options.maximumSize,
9433
9437
  snap: options.snap,
@@ -9489,17 +9493,14 @@ class SplitviewComponent extends Resizable {
9489
9493
  descriptor: {
9490
9494
  size,
9491
9495
  views: views.map((view) => {
9492
- var _a, _b;
9493
9496
  const data = view.data;
9494
9497
  if (this._panels.has(data.id)) {
9495
9498
  throw new Error(`panel ${data.id} already exists`);
9496
9499
  }
9497
- 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
9498
- ? {
9499
- createComponent: this.options.frameworkWrapper
9500
- .createComponent,
9501
- }
9502
- : undefined);
9500
+ const panel = this.options.createComponent({
9501
+ id: data.id,
9502
+ name: data.component,
9503
+ });
9503
9504
  queue.push(() => {
9504
9505
  var _a;
9505
9506
  panel.init({
@@ -9682,16 +9683,12 @@ class PaneviewComponent extends Resizable {
9682
9683
  this.onDidAddView = this._onDidAddView.event;
9683
9684
  this._onDidRemoveView = new Emitter();
9684
9685
  this.onDidRemoveView = this._onDidRemoveView.event;
9685
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9686
+ this._onUnhandledDragOverEvent = new Emitter();
9687
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9688
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9686
9689
  this._classNames = new Classnames(this.element);
9687
9690
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9688
9691
  this._options = options;
9689
- if (!options.components) {
9690
- options.components = {};
9691
- }
9692
- if (!options.frameworkComponents) {
9693
- options.frameworkComponents = {};
9694
- }
9695
9692
  this.paneview = new Paneview(this.element, {
9696
9693
  // only allow paneview in the vertical orientation for now
9697
9694
  orientation: Orientation.VERTICAL,
@@ -9716,22 +9713,19 @@ class PaneviewComponent extends Resizable {
9716
9713
  this._options = Object.assign(Object.assign({}, this.options), options);
9717
9714
  }
9718
9715
  addPanel(options) {
9719
- var _a, _b, _c, _d;
9720
- 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
9721
- ? {
9722
- createComponent: this.options.frameworkWrapper.body.createComponent,
9723
- }
9724
- : undefined);
9716
+ var _a;
9717
+ const body = this.options.createComponent({
9718
+ id: options.id,
9719
+ name: options.component,
9720
+ });
9725
9721
  let header;
9726
- if (options.headerComponent) {
9727
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9728
- ? {
9729
- createComponent: this.options.frameworkWrapper.header
9730
- .createComponent,
9731
- }
9732
- : undefined);
9722
+ if (options.headerComponent && this.options.createHeaderComponent) {
9723
+ header = this.options.createHeaderComponent({
9724
+ id: options.id,
9725
+ name: options.headerComponent,
9726
+ });
9733
9727
  }
9734
- else {
9728
+ if (!header) {
9735
9729
  header = new DefaultHeader();
9736
9730
  }
9737
9731
  const view = new PaneFramework({
@@ -9749,7 +9743,7 @@ class PaneviewComponent extends Resizable {
9749
9743
  const size = typeof options.size === 'number' ? options.size : Sizing.Distribute;
9750
9744
  const index = typeof options.index === 'number' ? options.index : undefined;
9751
9745
  view.init({
9752
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9746
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9753
9747
  minimumBodySize: options.minimumBodySize,
9754
9748
  maximumBodySize: options.maximumBodySize,
9755
9749
  isExpanded: options.isExpanded,
@@ -9814,24 +9808,20 @@ class PaneviewComponent extends Resizable {
9814
9808
  descriptor: {
9815
9809
  size,
9816
9810
  views: views.map((view) => {
9817
- var _a, _b, _c, _d;
9818
9811
  const data = view.data;
9819
- 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
9820
- ? {
9821
- createComponent: this.options.frameworkWrapper.body
9822
- .createComponent,
9823
- }
9824
- : undefined);
9812
+ const body = this.options.createComponent({
9813
+ id: data.id,
9814
+ name: data.component,
9815
+ });
9825
9816
  let header;
9826
- if (data.headerComponent) {
9827
- 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
9828
- ? {
9829
- createComponent: this.options.frameworkWrapper.header
9830
- .createComponent,
9831
- }
9832
- : undefined);
9817
+ if (data.headerComponent &&
9818
+ this.options.createHeaderComponent) {
9819
+ header = this.options.createHeaderComponent({
9820
+ id: data.id,
9821
+ name: data.headerComponent,
9822
+ });
9833
9823
  }
9834
- else {
9824
+ if (!header) {
9835
9825
  header = new DefaultHeader();
9836
9826
  }
9837
9827
  const panel = new PaneFramework({
@@ -9879,9 +9869,11 @@ class PaneviewComponent extends Resizable {
9879
9869
  this.paneview.dispose();
9880
9870
  }
9881
9871
  doAddPanel(panel) {
9882
- const disposable = panel.onDidDrop((event) => {
9872
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9883
9873
  this._onDidDrop.fire(event);
9884
- });
9874
+ }), panel.onUnhandledDragOverEvent((event) => {
9875
+ this._onUnhandledDragOverEvent.fire(event);
9876
+ }));
9885
9877
  this._viewDisposables.set(panel.id, disposable);
9886
9878
  }
9887
9879
  doRemovePanel(panel) {
@@ -10164,7 +10156,7 @@ class ReactPanelContentPart {
10164
10156
  this._onDidBlur = new Emitter();
10165
10157
  this.onDidBlur = this._onDidBlur.event;
10166
10158
  this._element = document.createElement('div');
10167
- this._element.className = 'dockview-react-part';
10159
+ this._element.className = 'dv-react-part';
10168
10160
  this._element.style.height = '100%';
10169
10161
  this._element.style.width = '100%';
10170
10162
  }
@@ -10202,7 +10194,7 @@ class ReactPanelHeaderPart {
10202
10194
  this.component = component;
10203
10195
  this.reactPortalStore = reactPortalStore;
10204
10196
  this._element = document.createElement('div');
10205
- this._element.className = 'dockview-react-part';
10197
+ this._element.className = 'dv-react-part';
10206
10198
  this._element.style.height = '100%';
10207
10199
  this._element.style.width = '100%';
10208
10200
  }
@@ -10238,7 +10230,7 @@ class ReactWatermarkPart {
10238
10230
  this.component = component;
10239
10231
  this.reactPortalStore = reactPortalStore;
10240
10232
  this._element = document.createElement('div');
10241
- this._element.className = 'dockview-react-part';
10233
+ this._element.className = 'dv-react-part';
10242
10234
  this._element.style.height = '100%';
10243
10235
  this._element.style.width = '100%';
10244
10236
  }
@@ -10280,7 +10272,7 @@ class ReactHeaderActionsRendererPart {
10280
10272
  this._group = _group;
10281
10273
  this.mutableDisposable = new MutableDisposable();
10282
10274
  this._element = document.createElement('div');
10283
- this._element.className = 'dockview-react-part';
10275
+ this._element.className = 'dv-react-part';
10284
10276
  this._element.style.height = '100%';
10285
10277
  this._element.style.width = '100%';
10286
10278
  }
@@ -10339,8 +10331,8 @@ function createGroupControlElement(component, store) {
10339
10331
  : undefined;
10340
10332
  }
10341
10333
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10342
- function extractCoreOptions(props) {
10343
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10334
+ function extractCoreOptions$3(props) {
10335
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10344
10336
  if (key in props) {
10345
10337
  obj[key] = props[key];
10346
10338
  }
@@ -10356,7 +10348,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10356
10348
  const prevProps = React.useRef({});
10357
10349
  React.useEffect(() => {
10358
10350
  const changes = {};
10359
- PROPERTY_KEYS.forEach((propKey) => {
10351
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10360
10352
  const key = propKey;
10361
10353
  const propValue = props[key];
10362
10354
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10367,7 +10359,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10367
10359
  dockviewRef.current.updateOptions(changes);
10368
10360
  }
10369
10361
  prevProps.current = props;
10370
- }, PROPERTY_KEYS.map((key) => props[key]));
10362
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10371
10363
  React.useEffect(() => {
10372
10364
  var _a;
10373
10365
  if (!domRef.current) {
@@ -10403,7 +10395,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10403
10395
  ? DEFAULT_REACT_TAB
10404
10396
  : undefined,
10405
10397
  };
10406
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10398
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10407
10399
  const { clientWidth, clientHeight } = domRef.current;
10408
10400
  api.layout(clientWidth, clientHeight);
10409
10401
  if (props.onReady) {
@@ -10591,31 +10583,47 @@ class ReactPanelView extends SplitviewPanel {
10591
10583
  }
10592
10584
  }
10593
10585
 
10586
+ function extractCoreOptions$2(props) {
10587
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10588
+ if (key in props) {
10589
+ obj[key] = props[key];
10590
+ }
10591
+ return obj;
10592
+ }, {});
10593
+ return coreOptions;
10594
+ }
10594
10595
  const SplitviewReact = React.forwardRef((props, ref) => {
10595
10596
  const domRef = React.useRef(null);
10596
10597
  const splitviewRef = React.useRef();
10597
10598
  const [portals, addPortal] = usePortalsLifecycle();
10598
10599
  React.useImperativeHandle(ref, () => domRef.current, []);
10600
+ const prevProps = React.useRef({});
10599
10601
  React.useEffect(() => {
10600
- var _a;
10601
- const api = createSplitview(domRef.current, {
10602
- disableAutoResizing: props.disableAutoResizing,
10603
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : Orientation.HORIZONTAL,
10604
- frameworkComponents: props.components,
10605
- frameworkWrapper: {
10606
- createComponent: (id, componentId, component) => {
10607
- return new ReactPanelView(id, componentId, component, {
10608
- addPortal,
10609
- });
10610
- },
10611
- },
10612
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10613
- ? props.proportionalLayout
10614
- : true,
10615
- styles: props.hideBorders
10616
- ? { separatorBorder: 'transparent' }
10617
- : undefined,
10602
+ const changes = {};
10603
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10604
+ const key = propKey;
10605
+ const propValue = props[key];
10606
+ if (key in props && propValue !== prevProps.current[key]) {
10607
+ changes[key] = propValue;
10608
+ }
10618
10609
  });
10610
+ if (splitviewRef.current) {
10611
+ splitviewRef.current.updateOptions(changes);
10612
+ }
10613
+ prevProps.current = props;
10614
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10615
+ React.useEffect(() => {
10616
+ if (!domRef.current) {
10617
+ return () => {
10618
+ // noop
10619
+ };
10620
+ }
10621
+ const frameworkOptions = {
10622
+ createComponent: (options) => {
10623
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10624
+ },
10625
+ };
10626
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10619
10627
  const { clientWidth, clientHeight } = domRef.current;
10620
10628
  api.layout(clientWidth, clientHeight);
10621
10629
  if (props.onReady) {
@@ -10631,7 +10639,9 @@ const SplitviewReact = React.forwardRef((props, ref) => {
10631
10639
  return;
10632
10640
  }
10633
10641
  splitviewRef.current.updateOptions({
10634
- frameworkComponents: props.components,
10642
+ createComponent: (options) => {
10643
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10644
+ },
10635
10645
  });
10636
10646
  }, [props.components]);
10637
10647
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10656,36 +10666,47 @@ class ReactGridPanelView extends GridviewPanel {
10656
10666
  }
10657
10667
  }
10658
10668
 
10669
+ function extractCoreOptions$1(props) {
10670
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10671
+ if (key in props) {
10672
+ obj[key] = props[key];
10673
+ }
10674
+ return obj;
10675
+ }, {});
10676
+ return coreOptions;
10677
+ }
10659
10678
  const GridviewReact = React.forwardRef((props, ref) => {
10660
10679
  const domRef = React.useRef(null);
10661
10680
  const gridviewRef = React.useRef();
10662
10681
  const [portals, addPortal] = usePortalsLifecycle();
10663
10682
  React.useImperativeHandle(ref, () => domRef.current, []);
10683
+ const prevProps = React.useRef({});
10684
+ React.useEffect(() => {
10685
+ const changes = {};
10686
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10687
+ const key = propKey;
10688
+ const propValue = props[key];
10689
+ if (key in props && propValue !== prevProps.current[key]) {
10690
+ changes[key] = propValue;
10691
+ }
10692
+ });
10693
+ if (gridviewRef.current) {
10694
+ gridviewRef.current.updateOptions(changes);
10695
+ }
10696
+ prevProps.current = props;
10697
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10664
10698
  React.useEffect(() => {
10665
- var _a;
10666
10699
  if (!domRef.current) {
10667
10700
  return () => {
10668
10701
  // noop
10669
10702
  };
10670
10703
  }
10671
- const api = createGridview(domRef.current, {
10672
- disableAutoResizing: props.disableAutoResizing,
10673
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10674
- ? props.proportionalLayout
10675
- : true,
10676
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : Orientation.HORIZONTAL,
10677
- frameworkComponents: props.components,
10678
- frameworkComponentFactory: {
10679
- createComponent: (id, componentId, component) => {
10680
- return new ReactGridPanelView(id, componentId, component, {
10681
- addPortal,
10682
- });
10683
- },
10704
+ const frameworkOptions = {
10705
+ createComponent: (options) => {
10706
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10684
10707
  },
10685
- styles: props.hideBorders
10686
- ? { separatorBorder: 'transparent' }
10687
- : undefined,
10688
- });
10708
+ };
10709
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10689
10710
  const { clientWidth, clientHeight } = domRef.current;
10690
10711
  api.layout(clientWidth, clientHeight);
10691
10712
  if (props.onReady) {
@@ -10701,7 +10722,9 @@ const GridviewReact = React.forwardRef((props, ref) => {
10701
10722
  return;
10702
10723
  }
10703
10724
  gridviewRef.current.updateOptions({
10704
- frameworkComponents: props.components,
10725
+ createComponent: (options) => {
10726
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10727
+ },
10705
10728
  });
10706
10729
  }, [props.components]);
10707
10730
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10743,32 +10766,52 @@ class PanePanelSection {
10743
10766
  }
10744
10767
  }
10745
10768
 
10769
+ function extractCoreOptions(props) {
10770
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10771
+ if (key in props) {
10772
+ obj[key] = props[key];
10773
+ }
10774
+ return obj;
10775
+ }, {});
10776
+ return coreOptions;
10777
+ }
10746
10778
  const PaneviewReact = React.forwardRef((props, ref) => {
10747
10779
  const domRef = React.useRef(null);
10748
10780
  const paneviewRef = React.useRef();
10749
10781
  const [portals, addPortal] = usePortalsLifecycle();
10750
10782
  React.useImperativeHandle(ref, () => domRef.current, []);
10783
+ const prevProps = React.useRef({});
10751
10784
  React.useEffect(() => {
10752
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10753
- addPortal,
10785
+ const changes = {};
10786
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10787
+ const key = propKey;
10788
+ const propValue = props[key];
10789
+ if (key in props && propValue !== prevProps.current[key]) {
10790
+ changes[key] = propValue;
10791
+ }
10754
10792
  });
10755
- const api = createPaneview(domRef.current, {
10756
- disableAutoResizing: props.disableAutoResizing,
10757
- frameworkComponents: props.components,
10758
- components: {},
10759
- headerComponents: {},
10760
- disableDnd: props.disableDnd,
10761
- headerframeworkComponents: props.headerComponents,
10762
- frameworkWrapper: {
10763
- header: {
10764
- createComponent,
10765
- },
10766
- body: {
10767
- createComponent,
10768
- },
10793
+ if (paneviewRef.current) {
10794
+ paneviewRef.current.updateOptions(changes);
10795
+ }
10796
+ prevProps.current = props;
10797
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10798
+ React.useEffect(() => {
10799
+ var _a;
10800
+ if (!domRef.current) {
10801
+ return () => {
10802
+ // noop
10803
+ };
10804
+ }
10805
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10806
+ const frameworkOptions = {
10807
+ createComponent: (options) => {
10808
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10769
10809
  },
10770
- showDndOverlay: props.showDndOverlay,
10771
- });
10810
+ createHeaderComponent: (options) => {
10811
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10812
+ },
10813
+ };
10814
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10772
10815
  const { clientWidth, clientHeight } = domRef.current;
10773
10816
  api.layout(clientWidth, clientHeight);
10774
10817
  if (props.onReady) {
@@ -10784,44 +10827,41 @@ const PaneviewReact = React.forwardRef((props, ref) => {
10784
10827
  return;
10785
10828
  }
10786
10829
  paneviewRef.current.updateOptions({
10787
- frameworkComponents: props.components,
10830
+ createComponent: (options) => {
10831
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10832
+ },
10788
10833
  });
10789
10834
  }, [props.components]);
10790
10835
  React.useEffect(() => {
10836
+ var _a;
10791
10837
  if (!paneviewRef.current) {
10792
10838
  return;
10793
10839
  }
10840
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10794
10841
  paneviewRef.current.updateOptions({
10795
- headerframeworkComponents: props.headerComponents,
10842
+ createHeaderComponent: (options) => {
10843
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10844
+ },
10796
10845
  });
10797
10846
  }, [props.headerComponents]);
10798
10847
  React.useEffect(() => {
10799
10848
  if (!paneviewRef.current) {
10800
10849
  return () => {
10801
- //
10850
+ // noop
10802
10851
  };
10803
10852
  }
10804
- const api = paneviewRef.current;
10805
- const disposable = api.onDidDrop((event) => {
10853
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10806
10854
  if (props.onDidDrop) {
10807
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10855
+ props.onDidDrop(event);
10808
10856
  }
10809
10857
  });
10810
10858
  return () => {
10811
10859
  disposable.dispose();
10812
10860
  };
10813
10861
  }, [props.onDidDrop]);
10814
- React.useEffect(() => {
10815
- if (!paneviewRef.current) {
10816
- return;
10817
- }
10818
- paneviewRef.current.updateOptions({
10819
- showDndOverlay: props.showDndOverlay,
10820
- });
10821
- }, [props.showDndOverlay]);
10822
10862
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10823
10863
  });
10824
10864
  PaneviewReact.displayName = 'PaneviewComponent';
10825
10865
 
10826
- export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, Orientation, PROPERTY_KEYS, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, WillShowOverlayLocationEvent, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactComponent, orthogonal, positionToDirection, toTarget, usePortalsLifecycle };
10866
+ export { BaseGrid, ContentContainer, DefaultDockviewDeserialzier, DefaultTab, DockviewApi, DockviewComponent, CompositeDisposable as DockviewCompositeDisposable, DockviewDefaultTab, DockviewDidDropEvent, Disposable as DockviewDisposable, Emitter as DockviewEmitter, Event as DockviewEvent, DockviewGroupPanel, DockviewGroupPanelModel, MutableDisposable as DockviewMutableDisposable, DockviewPanel, DockviewReact, DockviewUnhandledDragOverEvent, DockviewWillDropEvent, DraggablePaneviewPanel, Gridview, GridviewApi, GridviewComponent, GridviewPanel, GridviewReact, LayoutPriority, Orientation, PROPERTY_KEYS_DOCKVIEW, PROPERTY_KEYS_GRIDVIEW, PROPERTY_KEYS_PANEVIEW, PROPERTY_KEYS_SPLITVIEW, PaneFramework, PaneTransfer, PanelTransfer, Paneview, PaneviewApi, PaneviewComponent, PaneviewPanel, PaneviewReact, PaneviewUnhandledDragOverEvent, ReactPart, ReactPartContext, SashState, Sizing, Splitview, SplitviewApi, SplitviewComponent, SplitviewPanel, SplitviewReact, Tab, WillShowOverlayLocationEvent, createDockview, createGridview, createPaneview, createSplitview, directionToPosition, getDirectionOrientation, getGridLocation, getLocationOrientation, getPaneData, getPanelData, getRelativeLocation, indexInParent, isGridBranchNode, isGroupOptionsWithGroup, isGroupOptionsWithPanel, isPanelOptionsWithGroup, isPanelOptionsWithPanel, isReactComponent, orthogonal, positionToDirection, toTarget, usePortalsLifecycle };
10827
10867
  //# sourceMappingURL=dockview-react.esm.js.map