dockview-react 2.1.4 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-react
3
- * @version 2.1.4
3
+ * @version 3.0.1
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -132,6 +132,17 @@ class DockviewEvent {
132
132
  this._defaultPrevented = true;
133
133
  }
134
134
  }
135
+ class AcceptableEvent {
136
+ constructor() {
137
+ this._isAccepted = false;
138
+ }
139
+ get isAccepted() {
140
+ return this._isAccepted;
141
+ }
142
+ accept() {
143
+ this._isAccepted = true;
144
+ }
145
+ }
135
146
  class LeakageMonitor {
136
147
  constructor() {
137
148
  this.events = new Map();
@@ -1523,6 +1534,23 @@ class Splitview {
1523
1534
  }
1524
1535
  }
1525
1536
 
1537
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1538
+ /**
1539
+ * by readong the keys from an empty value object TypeScript will error
1540
+ * when we add or remove new properties to `DockviewOptions`
1541
+ */
1542
+ const properties = {
1543
+ orientation: undefined,
1544
+ descriptor: undefined,
1545
+ proportionalLayout: undefined,
1546
+ styles: undefined,
1547
+ margin: undefined,
1548
+ disableAutoResizing: undefined,
1549
+ className: undefined,
1550
+ };
1551
+ return Object.keys(properties);
1552
+ })();
1553
+
1526
1554
  class Paneview extends CompositeDisposable {
1527
1555
  get onDidAddView() {
1528
1556
  return this.splitview.onDidAddView;
@@ -2652,6 +2680,21 @@ class Gridview {
2652
2680
  }
2653
2681
  }
2654
2682
 
2683
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2684
+ /**
2685
+ * by readong the keys from an empty value object TypeScript will error
2686
+ * when we add or remove new properties to `DockviewOptions`
2687
+ */
2688
+ const properties = {
2689
+ disableAutoResizing: undefined,
2690
+ proportionalLayout: undefined,
2691
+ orientation: undefined,
2692
+ hideBorders: undefined,
2693
+ className: undefined,
2694
+ };
2695
+ return Object.keys(properties);
2696
+ })();
2697
+
2655
2698
  class Resizable extends CompositeDisposable {
2656
2699
  get element() {
2657
2700
  return this._element;
@@ -2761,7 +2804,7 @@ class BaseGrid extends Resizable {
2761
2804
  }
2762
2805
  constructor(parentElement, options) {
2763
2806
  var _a;
2764
- super(document.createElement('div'), options.disableAutoResizing);
2807
+ super(parentElement, options.disableAutoResizing);
2765
2808
  this._id = nextLayoutId$1.next();
2766
2809
  this._groups = new Map();
2767
2810
  this._onDidRemove = new Emitter();
@@ -2780,7 +2823,6 @@ class BaseGrid extends Resizable {
2780
2823
  this.element.style.width = '100%';
2781
2824
  this._classNames = new Classnames(this.element);
2782
2825
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2783
- parentElement.appendChild(this.element);
2784
2826
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2785
2827
  this.gridview.locked = !!options.locked;
2786
2828
  this.element.appendChild(this.gridview.element);
@@ -3129,15 +3171,10 @@ class PaneviewApi {
3129
3171
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3130
3172
  */
3131
3173
  get onDidDrop() {
3132
- const emitter = new Emitter();
3133
- const disposable = this.component.onDidDrop((e) => {
3134
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3135
- });
3136
- emitter.dispose = () => {
3137
- disposable.dispose();
3138
- emitter.dispose();
3139
- };
3140
- return emitter.event;
3174
+ return this.component.onDidDrop;
3175
+ }
3176
+ get onUnhandledDragOverEvent() {
3177
+ return this.component.onUnhandledDragOverEvent;
3141
3178
  }
3142
3179
  constructor(component) {
3143
3180
  this.component = component;
@@ -4064,6 +4101,28 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
4064
4101
  return 'center';
4065
4102
  }
4066
4103
 
4104
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4105
+ /**
4106
+ * by readong the keys from an empty value object TypeScript will error
4107
+ * when we add or remove new properties to `DockviewOptions`
4108
+ */
4109
+ const properties = {
4110
+ disableAutoResizing: undefined,
4111
+ disableDnd: undefined,
4112
+ className: undefined,
4113
+ };
4114
+ return Object.keys(properties);
4115
+ })();
4116
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4117
+ constructor(nativeEvent, position, getData, panel) {
4118
+ super();
4119
+ this.nativeEvent = nativeEvent;
4120
+ this.position = position;
4121
+ this.getData = getData;
4122
+ this.panel = panel;
4123
+ }
4124
+ }
4125
+
4067
4126
  class WillFocusEvent extends DockviewEvent {
4068
4127
  constructor() {
4069
4128
  super();
@@ -4487,6 +4546,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4487
4546
  this.accessor = accessor;
4488
4547
  this._onDidDrop = new Emitter();
4489
4548
  this.onDidDrop = this._onDidDrop.event;
4549
+ this._onUnhandledDragOverEvent = new Emitter();
4550
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4551
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4490
4552
  if (!disableDnd) {
4491
4553
  this.initDragFeatures();
4492
4554
  }
@@ -4513,7 +4575,7 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4513
4575
  overlayModel: {
4514
4576
  activationSize: { type: 'percentage', value: 50 },
4515
4577
  },
4516
- canDisplayOverlay: (event) => {
4578
+ canDisplayOverlay: (event, position) => {
4517
4579
  const data = getPaneData();
4518
4580
  if (data) {
4519
4581
  if (data.paneId !== this.id &&
@@ -4521,14 +4583,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4521
4583
  return true;
4522
4584
  }
4523
4585
  }
4524
- if (this.accessor.options.showDndOverlay) {
4525
- return this.accessor.options.showDndOverlay({
4526
- nativeEvent: event,
4527
- getData: getPaneData,
4528
- panel: this,
4529
- });
4530
- }
4531
- return false;
4586
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4587
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4588
+ return firedEvent.isAccepted;
4532
4589
  },
4533
4590
  });
4534
4591
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4983,15 +5040,7 @@ class TabsContainer extends CompositeDisposable {
4983
5040
  this._element.appendChild(this.leftActionsContainer);
4984
5041
  this._element.appendChild(this.voidContainer.element);
4985
5042
  this._element.appendChild(this.rightActionsContainer);
4986
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4987
- if (e.api.group === this.group) {
4988
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4989
- }
4990
- }), this.accessor.onDidRemovePanel((e) => {
4991
- if (e.api.group === this.group) {
4992
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4993
- }
4994
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5043
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4995
5044
  this._onGroupDragStart.fire({
4996
5045
  nativeEvent: event,
4997
5046
  group: this.group,
@@ -5036,20 +5085,6 @@ class TabsContainer extends CompositeDisposable {
5036
5085
  setActive(_isGroupActive) {
5037
5086
  // noop
5038
5087
  }
5039
- addTab(tab, index = this.tabs.length) {
5040
- if (index < 0 || index > this.tabs.length) {
5041
- throw new Error('invalid location');
5042
- }
5043
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5044
- this.tabs = [
5045
- ...this.tabs.slice(0, index),
5046
- tab,
5047
- ...this.tabs.slice(index),
5048
- ];
5049
- if (this.selectedIndex < 0) {
5050
- this.selectedIndex = index;
5051
- }
5052
- }
5053
5088
  delete(id) {
5054
5089
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5055
5090
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5057,6 +5092,7 @@ class TabsContainer extends CompositeDisposable {
5057
5092
  disposable.dispose();
5058
5093
  value.dispose();
5059
5094
  value.element.remove();
5095
+ this.updateClassnames();
5060
5096
  }
5061
5097
  setActivePanel(panel) {
5062
5098
  this.tabs.forEach((tab) => {
@@ -5125,25 +5161,37 @@ class TabsContainer extends CompositeDisposable {
5125
5161
  }
5126
5162
  this.tabs = [];
5127
5163
  }
5164
+ addTab(tab, index = this.tabs.length) {
5165
+ if (index < 0 || index > this.tabs.length) {
5166
+ throw new Error('invalid location');
5167
+ }
5168
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5169
+ this.tabs = [
5170
+ ...this.tabs.slice(0, index),
5171
+ tab,
5172
+ ...this.tabs.slice(index),
5173
+ ];
5174
+ if (this.selectedIndex < 0) {
5175
+ this.selectedIndex = index;
5176
+ }
5177
+ this.updateClassnames();
5178
+ }
5179
+ updateClassnames() {
5180
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5181
+ }
5128
5182
  }
5129
5183
 
5130
- class DockviewUnhandledDragOverEvent {
5131
- get isAccepted() {
5132
- return this._isAccepted;
5133
- }
5184
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5134
5185
  constructor(nativeEvent, target, position, getData, group) {
5186
+ super();
5135
5187
  this.nativeEvent = nativeEvent;
5136
5188
  this.target = target;
5137
5189
  this.position = position;
5138
5190
  this.getData = getData;
5139
5191
  this.group = group;
5140
- this._isAccepted = false;
5141
- }
5142
- accept() {
5143
- this._isAccepted = true;
5144
5192
  }
5145
5193
  }
5146
- const PROPERTY_KEYS = (() => {
5194
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5147
5195
  /**
5148
5196
  * by readong the keys from an empty value object TypeScript will error
5149
5197
  * when we add or remove new properties to `DockviewOptions`
@@ -8989,31 +9037,6 @@ class DockviewComponent extends BaseGrid {
8989
9037
  }
8990
9038
  }
8991
9039
 
8992
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8993
- const Component = typeof componentName === 'string'
8994
- ? components[componentName]
8995
- : undefined;
8996
- const FrameworkComponent = typeof componentName === 'string'
8997
- ? frameworkComponents[componentName]
8998
- : undefined;
8999
- if (Component && FrameworkComponent) {
9000
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
9001
- }
9002
- if (FrameworkComponent) {
9003
- if (!createFrameworkComponent) {
9004
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
9005
- }
9006
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
9007
- }
9008
- if (!Component) {
9009
- if (fallback) {
9010
- return fallback();
9011
- }
9012
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
9013
- }
9014
- return new Component(id, componentName);
9015
- }
9016
-
9017
9040
  class GridviewComponent extends BaseGrid {
9018
9041
  get orientation() {
9019
9042
  return this.gridview.orientation;
@@ -9031,10 +9054,13 @@ class GridviewComponent extends BaseGrid {
9031
9054
  this._deserializer = value;
9032
9055
  }
9033
9056
  constructor(parentElement, options) {
9057
+ var _a;
9034
9058
  super(parentElement, {
9035
- proportionalLayout: options.proportionalLayout,
9059
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9036
9060
  orientation: options.orientation,
9037
- styles: options.styles,
9061
+ styles: options.hideBorders
9062
+ ? { separatorBorder: 'transparent' }
9063
+ : undefined,
9038
9064
  disableAutoResizing: options.disableAutoResizing,
9039
9065
  className: options.className,
9040
9066
  });
@@ -9054,12 +9080,6 @@ class GridviewComponent extends BaseGrid {
9054
9080
  }), this.onDidActiveChange((event) => {
9055
9081
  this._onDidActiveGroupChange.fire(event);
9056
9082
  }));
9057
- if (!this.options.components) {
9058
- this.options.components = {};
9059
- }
9060
- if (!this.options.frameworkComponents) {
9061
- this.options.frameworkComponents = {};
9062
- }
9063
9083
  }
9064
9084
  updateOptions(options) {
9065
9085
  super.updateOptions(options);
@@ -9109,14 +9129,11 @@ class GridviewComponent extends BaseGrid {
9109
9129
  const height = this.height;
9110
9130
  this.gridview.deserialize(grid, {
9111
9131
  fromJSON: (node) => {
9112
- var _a, _b;
9113
9132
  const { data } = node;
9114
- 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
9115
- ? {
9116
- createComponent: this.options.frameworkComponentFactory
9117
- .createComponent,
9118
- }
9119
- : undefined);
9133
+ const view = this.options.createComponent({
9134
+ id: data.id,
9135
+ name: data.component,
9136
+ });
9120
9137
  queue.push(() => view.init({
9121
9138
  params: data.params,
9122
9139
  minimumWidth: data.minimumWidth,
@@ -9194,7 +9211,7 @@ class GridviewComponent extends BaseGrid {
9194
9211
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9195
9212
  }
9196
9213
  addPanel(options) {
9197
- var _a, _b, _c, _d, _e, _f;
9214
+ var _a, _b, _c, _d;
9198
9215
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9199
9216
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9200
9217
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9210,14 +9227,12 @@ class GridviewComponent extends BaseGrid {
9210
9227
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9211
9228
  }
9212
9229
  }
9213
- 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
9214
- ? {
9215
- createComponent: this.options.frameworkComponentFactory
9216
- .createComponent,
9217
- }
9218
- : undefined);
9230
+ const view = this.options.createComponent({
9231
+ id: options.id,
9232
+ name: options.component,
9233
+ });
9219
9234
  view.init({
9220
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9235
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9221
9236
  minimumWidth: options.minimumWidth,
9222
9237
  maximumWidth: options.maximumWidth,
9223
9238
  minimumHeight: options.minimumHeight,
@@ -9345,12 +9360,6 @@ class SplitviewComponent extends Resizable {
9345
9360
  this._classNames = new Classnames(this.element);
9346
9361
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9347
9362
  this._options = options;
9348
- if (!options.components) {
9349
- options.components = {};
9350
- }
9351
- if (!options.frameworkComponents) {
9352
- options.frameworkComponents = {};
9353
- }
9354
9363
  this.splitview = new Splitview(this.element, options);
9355
9364
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9356
9365
  }
@@ -9413,18 +9422,17 @@ class SplitviewComponent extends Resizable {
9413
9422
  return this.panels.find((view) => view.id === id);
9414
9423
  }
9415
9424
  addPanel(options) {
9416
- var _a, _b, _c;
9425
+ var _a;
9417
9426
  if (this._panels.has(options.id)) {
9418
9427
  throw new Error(`panel ${options.id} already exists`);
9419
9428
  }
9420
- 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
9421
- ? {
9422
- createComponent: this.options.frameworkWrapper.createComponent,
9423
- }
9424
- : undefined);
9429
+ const view = this.options.createComponent({
9430
+ id: options.id,
9431
+ name: options.component,
9432
+ });
9425
9433
  view.orientation = this.splitview.orientation;
9426
9434
  view.init({
9427
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9435
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9428
9436
  minimumSize: options.minimumSize,
9429
9437
  maximumSize: options.maximumSize,
9430
9438
  snap: options.snap,
@@ -9486,17 +9494,14 @@ class SplitviewComponent extends Resizable {
9486
9494
  descriptor: {
9487
9495
  size,
9488
9496
  views: views.map((view) => {
9489
- var _a, _b;
9490
9497
  const data = view.data;
9491
9498
  if (this._panels.has(data.id)) {
9492
9499
  throw new Error(`panel ${data.id} already exists`);
9493
9500
  }
9494
- 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
9495
- ? {
9496
- createComponent: this.options.frameworkWrapper
9497
- .createComponent,
9498
- }
9499
- : undefined);
9501
+ const panel = this.options.createComponent({
9502
+ id: data.id,
9503
+ name: data.component,
9504
+ });
9500
9505
  queue.push(() => {
9501
9506
  var _a;
9502
9507
  panel.init({
@@ -9679,16 +9684,12 @@ class PaneviewComponent extends Resizable {
9679
9684
  this.onDidAddView = this._onDidAddView.event;
9680
9685
  this._onDidRemoveView = new Emitter();
9681
9686
  this.onDidRemoveView = this._onDidRemoveView.event;
9682
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9687
+ this._onUnhandledDragOverEvent = new Emitter();
9688
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9689
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9683
9690
  this._classNames = new Classnames(this.element);
9684
9691
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9685
9692
  this._options = options;
9686
- if (!options.components) {
9687
- options.components = {};
9688
- }
9689
- if (!options.frameworkComponents) {
9690
- options.frameworkComponents = {};
9691
- }
9692
9693
  this.paneview = new Paneview(this.element, {
9693
9694
  // only allow paneview in the vertical orientation for now
9694
9695
  orientation: exports.Orientation.VERTICAL,
@@ -9713,22 +9714,19 @@ class PaneviewComponent extends Resizable {
9713
9714
  this._options = Object.assign(Object.assign({}, this.options), options);
9714
9715
  }
9715
9716
  addPanel(options) {
9716
- var _a, _b, _c, _d;
9717
- 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
9718
- ? {
9719
- createComponent: this.options.frameworkWrapper.body.createComponent,
9720
- }
9721
- : undefined);
9717
+ var _a;
9718
+ const body = this.options.createComponent({
9719
+ id: options.id,
9720
+ name: options.component,
9721
+ });
9722
9722
  let header;
9723
- if (options.headerComponent) {
9724
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9725
- ? {
9726
- createComponent: this.options.frameworkWrapper.header
9727
- .createComponent,
9728
- }
9729
- : undefined);
9723
+ if (options.headerComponent && this.options.createHeaderComponent) {
9724
+ header = this.options.createHeaderComponent({
9725
+ id: options.id,
9726
+ name: options.headerComponent,
9727
+ });
9730
9728
  }
9731
- else {
9729
+ if (!header) {
9732
9730
  header = new DefaultHeader();
9733
9731
  }
9734
9732
  const view = new PaneFramework({
@@ -9746,7 +9744,7 @@ class PaneviewComponent extends Resizable {
9746
9744
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9747
9745
  const index = typeof options.index === 'number' ? options.index : undefined;
9748
9746
  view.init({
9749
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9747
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9750
9748
  minimumBodySize: options.minimumBodySize,
9751
9749
  maximumBodySize: options.maximumBodySize,
9752
9750
  isExpanded: options.isExpanded,
@@ -9811,24 +9809,20 @@ class PaneviewComponent extends Resizable {
9811
9809
  descriptor: {
9812
9810
  size,
9813
9811
  views: views.map((view) => {
9814
- var _a, _b, _c, _d;
9815
9812
  const data = view.data;
9816
- 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
9817
- ? {
9818
- createComponent: this.options.frameworkWrapper.body
9819
- .createComponent,
9820
- }
9821
- : undefined);
9813
+ const body = this.options.createComponent({
9814
+ id: data.id,
9815
+ name: data.component,
9816
+ });
9822
9817
  let header;
9823
- if (data.headerComponent) {
9824
- 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
9825
- ? {
9826
- createComponent: this.options.frameworkWrapper.header
9827
- .createComponent,
9828
- }
9829
- : undefined);
9818
+ if (data.headerComponent &&
9819
+ this.options.createHeaderComponent) {
9820
+ header = this.options.createHeaderComponent({
9821
+ id: data.id,
9822
+ name: data.headerComponent,
9823
+ });
9830
9824
  }
9831
- else {
9825
+ if (!header) {
9832
9826
  header = new DefaultHeader();
9833
9827
  }
9834
9828
  const panel = new PaneFramework({
@@ -9876,9 +9870,11 @@ class PaneviewComponent extends Resizable {
9876
9870
  this.paneview.dispose();
9877
9871
  }
9878
9872
  doAddPanel(panel) {
9879
- const disposable = panel.onDidDrop((event) => {
9873
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9880
9874
  this._onDidDrop.fire(event);
9881
- });
9875
+ }), panel.onUnhandledDragOverEvent((event) => {
9876
+ this._onUnhandledDragOverEvent.fire(event);
9877
+ }));
9882
9878
  this._viewDisposables.set(panel.id, disposable);
9883
9879
  }
9884
9880
  doRemovePanel(panel) {
@@ -10161,7 +10157,7 @@ class ReactPanelContentPart {
10161
10157
  this._onDidBlur = new Emitter();
10162
10158
  this.onDidBlur = this._onDidBlur.event;
10163
10159
  this._element = document.createElement('div');
10164
- this._element.className = 'dockview-react-part';
10160
+ this._element.className = 'dv-react-part';
10165
10161
  this._element.style.height = '100%';
10166
10162
  this._element.style.width = '100%';
10167
10163
  }
@@ -10199,7 +10195,7 @@ class ReactPanelHeaderPart {
10199
10195
  this.component = component;
10200
10196
  this.reactPortalStore = reactPortalStore;
10201
10197
  this._element = document.createElement('div');
10202
- this._element.className = 'dockview-react-part';
10198
+ this._element.className = 'dv-react-part';
10203
10199
  this._element.style.height = '100%';
10204
10200
  this._element.style.width = '100%';
10205
10201
  }
@@ -10235,7 +10231,7 @@ class ReactWatermarkPart {
10235
10231
  this.component = component;
10236
10232
  this.reactPortalStore = reactPortalStore;
10237
10233
  this._element = document.createElement('div');
10238
- this._element.className = 'dockview-react-part';
10234
+ this._element.className = 'dv-react-part';
10239
10235
  this._element.style.height = '100%';
10240
10236
  this._element.style.width = '100%';
10241
10237
  }
@@ -10277,7 +10273,7 @@ class ReactHeaderActionsRendererPart {
10277
10273
  this._group = _group;
10278
10274
  this.mutableDisposable = new MutableDisposable();
10279
10275
  this._element = document.createElement('div');
10280
- this._element.className = 'dockview-react-part';
10276
+ this._element.className = 'dv-react-part';
10281
10277
  this._element.style.height = '100%';
10282
10278
  this._element.style.width = '100%';
10283
10279
  }
@@ -10336,8 +10332,8 @@ function createGroupControlElement(component, store) {
10336
10332
  : undefined;
10337
10333
  }
10338
10334
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10339
- function extractCoreOptions(props) {
10340
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10335
+ function extractCoreOptions$3(props) {
10336
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10341
10337
  if (key in props) {
10342
10338
  obj[key] = props[key];
10343
10339
  }
@@ -10353,7 +10349,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10353
10349
  const prevProps = React.useRef({});
10354
10350
  React.useEffect(() => {
10355
10351
  const changes = {};
10356
- PROPERTY_KEYS.forEach((propKey) => {
10352
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10357
10353
  const key = propKey;
10358
10354
  const propValue = props[key];
10359
10355
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10364,7 +10360,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10364
10360
  dockviewRef.current.updateOptions(changes);
10365
10361
  }
10366
10362
  prevProps.current = props;
10367
- }, PROPERTY_KEYS.map((key) => props[key]));
10363
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10368
10364
  React.useEffect(() => {
10369
10365
  var _a;
10370
10366
  if (!domRef.current) {
@@ -10400,7 +10396,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10400
10396
  ? DEFAULT_REACT_TAB
10401
10397
  : undefined,
10402
10398
  };
10403
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10399
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10404
10400
  const { clientWidth, clientHeight } = domRef.current;
10405
10401
  api.layout(clientWidth, clientHeight);
10406
10402
  if (props.onReady) {
@@ -10588,31 +10584,47 @@ class ReactPanelView extends SplitviewPanel {
10588
10584
  }
10589
10585
  }
10590
10586
 
10587
+ function extractCoreOptions$2(props) {
10588
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10589
+ if (key in props) {
10590
+ obj[key] = props[key];
10591
+ }
10592
+ return obj;
10593
+ }, {});
10594
+ return coreOptions;
10595
+ }
10591
10596
  const SplitviewReact = React.forwardRef((props, ref) => {
10592
10597
  const domRef = React.useRef(null);
10593
10598
  const splitviewRef = React.useRef();
10594
10599
  const [portals, addPortal] = usePortalsLifecycle();
10595
10600
  React.useImperativeHandle(ref, () => domRef.current, []);
10601
+ const prevProps = React.useRef({});
10596
10602
  React.useEffect(() => {
10597
- var _a;
10598
- const api = createSplitview(domRef.current, {
10599
- disableAutoResizing: props.disableAutoResizing,
10600
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10601
- frameworkComponents: props.components,
10602
- frameworkWrapper: {
10603
- createComponent: (id, componentId, component) => {
10604
- return new ReactPanelView(id, componentId, component, {
10605
- addPortal,
10606
- });
10607
- },
10608
- },
10609
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10610
- ? props.proportionalLayout
10611
- : true,
10612
- styles: props.hideBorders
10613
- ? { separatorBorder: 'transparent' }
10614
- : undefined,
10603
+ const changes = {};
10604
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10605
+ const key = propKey;
10606
+ const propValue = props[key];
10607
+ if (key in props && propValue !== prevProps.current[key]) {
10608
+ changes[key] = propValue;
10609
+ }
10615
10610
  });
10611
+ if (splitviewRef.current) {
10612
+ splitviewRef.current.updateOptions(changes);
10613
+ }
10614
+ prevProps.current = props;
10615
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10616
+ React.useEffect(() => {
10617
+ if (!domRef.current) {
10618
+ return () => {
10619
+ // noop
10620
+ };
10621
+ }
10622
+ const frameworkOptions = {
10623
+ createComponent: (options) => {
10624
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10625
+ },
10626
+ };
10627
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10616
10628
  const { clientWidth, clientHeight } = domRef.current;
10617
10629
  api.layout(clientWidth, clientHeight);
10618
10630
  if (props.onReady) {
@@ -10628,7 +10640,9 @@ const SplitviewReact = React.forwardRef((props, ref) => {
10628
10640
  return;
10629
10641
  }
10630
10642
  splitviewRef.current.updateOptions({
10631
- frameworkComponents: props.components,
10643
+ createComponent: (options) => {
10644
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10645
+ },
10632
10646
  });
10633
10647
  }, [props.components]);
10634
10648
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10653,36 +10667,47 @@ class ReactGridPanelView extends GridviewPanel {
10653
10667
  }
10654
10668
  }
10655
10669
 
10670
+ function extractCoreOptions$1(props) {
10671
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10672
+ if (key in props) {
10673
+ obj[key] = props[key];
10674
+ }
10675
+ return obj;
10676
+ }, {});
10677
+ return coreOptions;
10678
+ }
10656
10679
  const GridviewReact = React.forwardRef((props, ref) => {
10657
10680
  const domRef = React.useRef(null);
10658
10681
  const gridviewRef = React.useRef();
10659
10682
  const [portals, addPortal] = usePortalsLifecycle();
10660
10683
  React.useImperativeHandle(ref, () => domRef.current, []);
10684
+ const prevProps = React.useRef({});
10685
+ React.useEffect(() => {
10686
+ const changes = {};
10687
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10688
+ const key = propKey;
10689
+ const propValue = props[key];
10690
+ if (key in props && propValue !== prevProps.current[key]) {
10691
+ changes[key] = propValue;
10692
+ }
10693
+ });
10694
+ if (gridviewRef.current) {
10695
+ gridviewRef.current.updateOptions(changes);
10696
+ }
10697
+ prevProps.current = props;
10698
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10661
10699
  React.useEffect(() => {
10662
- var _a;
10663
10700
  if (!domRef.current) {
10664
10701
  return () => {
10665
10702
  // noop
10666
10703
  };
10667
10704
  }
10668
- const api = createGridview(domRef.current, {
10669
- disableAutoResizing: props.disableAutoResizing,
10670
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10671
- ? props.proportionalLayout
10672
- : true,
10673
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10674
- frameworkComponents: props.components,
10675
- frameworkComponentFactory: {
10676
- createComponent: (id, componentId, component) => {
10677
- return new ReactGridPanelView(id, componentId, component, {
10678
- addPortal,
10679
- });
10680
- },
10705
+ const frameworkOptions = {
10706
+ createComponent: (options) => {
10707
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10681
10708
  },
10682
- styles: props.hideBorders
10683
- ? { separatorBorder: 'transparent' }
10684
- : undefined,
10685
- });
10709
+ };
10710
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10686
10711
  const { clientWidth, clientHeight } = domRef.current;
10687
10712
  api.layout(clientWidth, clientHeight);
10688
10713
  if (props.onReady) {
@@ -10698,7 +10723,9 @@ const GridviewReact = React.forwardRef((props, ref) => {
10698
10723
  return;
10699
10724
  }
10700
10725
  gridviewRef.current.updateOptions({
10701
- frameworkComponents: props.components,
10726
+ createComponent: (options) => {
10727
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10728
+ },
10702
10729
  });
10703
10730
  }, [props.components]);
10704
10731
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10740,32 +10767,52 @@ class PanePanelSection {
10740
10767
  }
10741
10768
  }
10742
10769
 
10770
+ function extractCoreOptions(props) {
10771
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10772
+ if (key in props) {
10773
+ obj[key] = props[key];
10774
+ }
10775
+ return obj;
10776
+ }, {});
10777
+ return coreOptions;
10778
+ }
10743
10779
  const PaneviewReact = React.forwardRef((props, ref) => {
10744
10780
  const domRef = React.useRef(null);
10745
10781
  const paneviewRef = React.useRef();
10746
10782
  const [portals, addPortal] = usePortalsLifecycle();
10747
10783
  React.useImperativeHandle(ref, () => domRef.current, []);
10784
+ const prevProps = React.useRef({});
10748
10785
  React.useEffect(() => {
10749
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10750
- addPortal,
10786
+ const changes = {};
10787
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10788
+ const key = propKey;
10789
+ const propValue = props[key];
10790
+ if (key in props && propValue !== prevProps.current[key]) {
10791
+ changes[key] = propValue;
10792
+ }
10751
10793
  });
10752
- const api = createPaneview(domRef.current, {
10753
- disableAutoResizing: props.disableAutoResizing,
10754
- frameworkComponents: props.components,
10755
- components: {},
10756
- headerComponents: {},
10757
- disableDnd: props.disableDnd,
10758
- headerframeworkComponents: props.headerComponents,
10759
- frameworkWrapper: {
10760
- header: {
10761
- createComponent,
10762
- },
10763
- body: {
10764
- createComponent,
10765
- },
10794
+ if (paneviewRef.current) {
10795
+ paneviewRef.current.updateOptions(changes);
10796
+ }
10797
+ prevProps.current = props;
10798
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10799
+ React.useEffect(() => {
10800
+ var _a;
10801
+ if (!domRef.current) {
10802
+ return () => {
10803
+ // noop
10804
+ };
10805
+ }
10806
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10807
+ const frameworkOptions = {
10808
+ createComponent: (options) => {
10809
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10766
10810
  },
10767
- showDndOverlay: props.showDndOverlay,
10768
- });
10811
+ createHeaderComponent: (options) => {
10812
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10813
+ },
10814
+ };
10815
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10769
10816
  const { clientWidth, clientHeight } = domRef.current;
10770
10817
  api.layout(clientWidth, clientHeight);
10771
10818
  if (props.onReady) {
@@ -10781,41 +10828,38 @@ const PaneviewReact = React.forwardRef((props, ref) => {
10781
10828
  return;
10782
10829
  }
10783
10830
  paneviewRef.current.updateOptions({
10784
- frameworkComponents: props.components,
10831
+ createComponent: (options) => {
10832
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10833
+ },
10785
10834
  });
10786
10835
  }, [props.components]);
10787
10836
  React.useEffect(() => {
10837
+ var _a;
10788
10838
  if (!paneviewRef.current) {
10789
10839
  return;
10790
10840
  }
10841
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10791
10842
  paneviewRef.current.updateOptions({
10792
- headerframeworkComponents: props.headerComponents,
10843
+ createHeaderComponent: (options) => {
10844
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10845
+ },
10793
10846
  });
10794
10847
  }, [props.headerComponents]);
10795
10848
  React.useEffect(() => {
10796
10849
  if (!paneviewRef.current) {
10797
10850
  return () => {
10798
- //
10851
+ // noop
10799
10852
  };
10800
10853
  }
10801
- const api = paneviewRef.current;
10802
- const disposable = api.onDidDrop((event) => {
10854
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10803
10855
  if (props.onDidDrop) {
10804
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10856
+ props.onDidDrop(event);
10805
10857
  }
10806
10858
  });
10807
10859
  return () => {
10808
10860
  disposable.dispose();
10809
10861
  };
10810
10862
  }, [props.onDidDrop]);
10811
- React.useEffect(() => {
10812
- if (!paneviewRef.current) {
10813
- return;
10814
- }
10815
- paneviewRef.current.updateOptions({
10816
- showDndOverlay: props.showDndOverlay,
10817
- });
10818
- }, [props.showDndOverlay]);
10819
10863
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10820
10864
  });
10821
10865
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10843,7 +10887,10 @@ exports.GridviewApi = GridviewApi;
10843
10887
  exports.GridviewComponent = GridviewComponent;
10844
10888
  exports.GridviewPanel = GridviewPanel;
10845
10889
  exports.GridviewReact = GridviewReact;
10846
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10890
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10891
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10892
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10893
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10847
10894
  exports.PaneFramework = PaneFramework;
10848
10895
  exports.PaneTransfer = PaneTransfer;
10849
10896
  exports.PanelTransfer = PanelTransfer;
@@ -10852,6 +10899,7 @@ exports.PaneviewApi = PaneviewApi;
10852
10899
  exports.PaneviewComponent = PaneviewComponent;
10853
10900
  exports.PaneviewPanel = PaneviewPanel;
10854
10901
  exports.PaneviewReact = PaneviewReact;
10902
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10855
10903
  exports.ReactPart = ReactPart;
10856
10904
  exports.ReactPartContext = ReactPartContext;
10857
10905
  exports.Splitview = Splitview;