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
  */
@@ -103,6 +103,17 @@
103
103
  this._defaultPrevented = true;
104
104
  }
105
105
  }
106
+ class AcceptableEvent {
107
+ constructor() {
108
+ this._isAccepted = false;
109
+ }
110
+ get isAccepted() {
111
+ return this._isAccepted;
112
+ }
113
+ accept() {
114
+ this._isAccepted = true;
115
+ }
116
+ }
106
117
  class LeakageMonitor {
107
118
  constructor() {
108
119
  this.events = new Map();
@@ -1494,6 +1505,23 @@
1494
1505
  }
1495
1506
  }
1496
1507
 
1508
+ const PROPERTY_KEYS_SPLITVIEW = (() => {
1509
+ /**
1510
+ * by readong the keys from an empty value object TypeScript will error
1511
+ * when we add or remove new properties to `DockviewOptions`
1512
+ */
1513
+ const properties = {
1514
+ orientation: undefined,
1515
+ descriptor: undefined,
1516
+ proportionalLayout: undefined,
1517
+ styles: undefined,
1518
+ margin: undefined,
1519
+ disableAutoResizing: undefined,
1520
+ className: undefined,
1521
+ };
1522
+ return Object.keys(properties);
1523
+ })();
1524
+
1497
1525
  class Paneview extends CompositeDisposable {
1498
1526
  get onDidAddView() {
1499
1527
  return this.splitview.onDidAddView;
@@ -2623,6 +2651,21 @@
2623
2651
  }
2624
2652
  }
2625
2653
 
2654
+ const PROPERTY_KEYS_GRIDVIEW = (() => {
2655
+ /**
2656
+ * by readong the keys from an empty value object TypeScript will error
2657
+ * when we add or remove new properties to `DockviewOptions`
2658
+ */
2659
+ const properties = {
2660
+ disableAutoResizing: undefined,
2661
+ proportionalLayout: undefined,
2662
+ orientation: undefined,
2663
+ hideBorders: undefined,
2664
+ className: undefined,
2665
+ };
2666
+ return Object.keys(properties);
2667
+ })();
2668
+
2626
2669
  class Resizable extends CompositeDisposable {
2627
2670
  get element() {
2628
2671
  return this._element;
@@ -2732,7 +2775,7 @@
2732
2775
  }
2733
2776
  constructor(parentElement, options) {
2734
2777
  var _a;
2735
- super(document.createElement('div'), options.disableAutoResizing);
2778
+ super(parentElement, options.disableAutoResizing);
2736
2779
  this._id = nextLayoutId$1.next();
2737
2780
  this._groups = new Map();
2738
2781
  this._onDidRemove = new Emitter();
@@ -2751,7 +2794,6 @@
2751
2794
  this.element.style.width = '100%';
2752
2795
  this._classNames = new Classnames(this.element);
2753
2796
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
2754
- parentElement.appendChild(this.element);
2755
2797
  this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation, options.locked, options.margin);
2756
2798
  this.gridview.locked = !!options.locked;
2757
2799
  this.element.appendChild(this.gridview.element);
@@ -3100,15 +3142,10 @@
3100
3142
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3101
3143
  */
3102
3144
  get onDidDrop() {
3103
- const emitter = new Emitter();
3104
- const disposable = this.component.onDidDrop((e) => {
3105
- emitter.fire(Object.assign(Object.assign({}, e), { api: this }));
3106
- });
3107
- emitter.dispose = () => {
3108
- disposable.dispose();
3109
- emitter.dispose();
3110
- };
3111
- return emitter.event;
3145
+ return this.component.onDidDrop;
3146
+ }
3147
+ get onUnhandledDragOverEvent() {
3148
+ return this.component.onUnhandledDragOverEvent;
3112
3149
  }
3113
3150
  constructor(component) {
3114
3151
  this.component = component;
@@ -4035,6 +4072,28 @@
4035
4072
  return 'center';
4036
4073
  }
4037
4074
 
4075
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4076
+ /**
4077
+ * by readong the keys from an empty value object TypeScript will error
4078
+ * when we add or remove new properties to `DockviewOptions`
4079
+ */
4080
+ const properties = {
4081
+ disableAutoResizing: undefined,
4082
+ disableDnd: undefined,
4083
+ className: undefined,
4084
+ };
4085
+ return Object.keys(properties);
4086
+ })();
4087
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4088
+ constructor(nativeEvent, position, getData, panel) {
4089
+ super();
4090
+ this.nativeEvent = nativeEvent;
4091
+ this.position = position;
4092
+ this.getData = getData;
4093
+ this.panel = panel;
4094
+ }
4095
+ }
4096
+
4038
4097
  class WillFocusEvent extends DockviewEvent {
4039
4098
  constructor() {
4040
4099
  super();
@@ -4458,6 +4517,9 @@
4458
4517
  this.accessor = accessor;
4459
4518
  this._onDidDrop = new Emitter();
4460
4519
  this.onDidDrop = this._onDidDrop.event;
4520
+ this._onUnhandledDragOverEvent = new Emitter();
4521
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4522
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4461
4523
  if (!disableDnd) {
4462
4524
  this.initDragFeatures();
4463
4525
  }
@@ -4484,7 +4546,7 @@
4484
4546
  overlayModel: {
4485
4547
  activationSize: { type: 'percentage', value: 50 },
4486
4548
  },
4487
- canDisplayOverlay: (event) => {
4549
+ canDisplayOverlay: (event, position) => {
4488
4550
  const data = getPaneData();
4489
4551
  if (data) {
4490
4552
  if (data.paneId !== this.id &&
@@ -4492,14 +4554,9 @@
4492
4554
  return true;
4493
4555
  }
4494
4556
  }
4495
- if (this.accessor.options.showDndOverlay) {
4496
- return this.accessor.options.showDndOverlay({
4497
- nativeEvent: event,
4498
- getData: getPaneData,
4499
- panel: this,
4500
- });
4501
- }
4502
- return false;
4557
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4558
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4559
+ return firedEvent.isAccepted;
4503
4560
  },
4504
4561
  });
4505
4562
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4954,15 +5011,7 @@
4954
5011
  this._element.appendChild(this.leftActionsContainer);
4955
5012
  this._element.appendChild(this.voidContainer.element);
4956
5013
  this._element.appendChild(this.rightActionsContainer);
4957
- this.addDisposables(this.accessor.onDidAddPanel((e) => {
4958
- if (e.api.group === this.group) {
4959
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4960
- }
4961
- }), this.accessor.onDidRemovePanel((e) => {
4962
- if (e.api.group === this.group) {
4963
- toggleClass(this._element, 'dv-single-tab', this.size === 1);
4964
- }
4965
- }), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
5014
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4966
5015
  this._onGroupDragStart.fire({
4967
5016
  nativeEvent: event,
4968
5017
  group: this.group,
@@ -5007,20 +5056,6 @@
5007
5056
  setActive(_isGroupActive) {
5008
5057
  // noop
5009
5058
  }
5010
- addTab(tab, index = this.tabs.length) {
5011
- if (index < 0 || index > this.tabs.length) {
5012
- throw new Error('invalid location');
5013
- }
5014
- this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5015
- this.tabs = [
5016
- ...this.tabs.slice(0, index),
5017
- tab,
5018
- ...this.tabs.slice(index),
5019
- ];
5020
- if (this.selectedIndex < 0) {
5021
- this.selectedIndex = index;
5022
- }
5023
- }
5024
5059
  delete(id) {
5025
5060
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5026
5061
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5028,6 +5063,7 @@
5028
5063
  disposable.dispose();
5029
5064
  value.dispose();
5030
5065
  value.element.remove();
5066
+ this.updateClassnames();
5031
5067
  }
5032
5068
  setActivePanel(panel) {
5033
5069
  this.tabs.forEach((tab) => {
@@ -5096,25 +5132,37 @@
5096
5132
  }
5097
5133
  this.tabs = [];
5098
5134
  }
5135
+ addTab(tab, index = this.tabs.length) {
5136
+ if (index < 0 || index > this.tabs.length) {
5137
+ throw new Error('invalid location');
5138
+ }
5139
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5140
+ this.tabs = [
5141
+ ...this.tabs.slice(0, index),
5142
+ tab,
5143
+ ...this.tabs.slice(index),
5144
+ ];
5145
+ if (this.selectedIndex < 0) {
5146
+ this.selectedIndex = index;
5147
+ }
5148
+ this.updateClassnames();
5149
+ }
5150
+ updateClassnames() {
5151
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5152
+ }
5099
5153
  }
5100
5154
 
5101
- class DockviewUnhandledDragOverEvent {
5102
- get isAccepted() {
5103
- return this._isAccepted;
5104
- }
5155
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5105
5156
  constructor(nativeEvent, target, position, getData, group) {
5157
+ super();
5106
5158
  this.nativeEvent = nativeEvent;
5107
5159
  this.target = target;
5108
5160
  this.position = position;
5109
5161
  this.getData = getData;
5110
5162
  this.group = group;
5111
- this._isAccepted = false;
5112
- }
5113
- accept() {
5114
- this._isAccepted = true;
5115
5163
  }
5116
5164
  }
5117
- const PROPERTY_KEYS = (() => {
5165
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5118
5166
  /**
5119
5167
  * by readong the keys from an empty value object TypeScript will error
5120
5168
  * when we add or remove new properties to `DockviewOptions`
@@ -8960,31 +9008,6 @@
8960
9008
  }
8961
9009
  }
8962
9010
 
8963
- function createComponent(id, componentName, components = {}, frameworkComponents = {}, createFrameworkComponent, fallback) {
8964
- const Component = typeof componentName === 'string'
8965
- ? components[componentName]
8966
- : undefined;
8967
- const FrameworkComponent = typeof componentName === 'string'
8968
- ? frameworkComponents[componentName]
8969
- : undefined;
8970
- if (Component && FrameworkComponent) {
8971
- throw new Error(`Cannot create '${id}'. component '${componentName}' registered as both a component and frameworkComponent`);
8972
- }
8973
- if (FrameworkComponent) {
8974
- if (!createFrameworkComponent) {
8975
- throw new Error(`Cannot create '${id}' for framework component '${componentName}'. you must register a frameworkPanelWrapper to use framework components`);
8976
- }
8977
- return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent);
8978
- }
8979
- if (!Component) {
8980
- if (fallback) {
8981
- return fallback();
8982
- }
8983
- throw new Error(`Cannot create '${id}', no component '${componentName}' provided`);
8984
- }
8985
- return new Component(id, componentName);
8986
- }
8987
-
8988
9011
  class GridviewComponent extends BaseGrid {
8989
9012
  get orientation() {
8990
9013
  return this.gridview.orientation;
@@ -9002,10 +9025,13 @@
9002
9025
  this._deserializer = value;
9003
9026
  }
9004
9027
  constructor(parentElement, options) {
9028
+ var _a;
9005
9029
  super(parentElement, {
9006
- proportionalLayout: options.proportionalLayout,
9030
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9007
9031
  orientation: options.orientation,
9008
- styles: options.styles,
9032
+ styles: options.hideBorders
9033
+ ? { separatorBorder: 'transparent' }
9034
+ : undefined,
9009
9035
  disableAutoResizing: options.disableAutoResizing,
9010
9036
  className: options.className,
9011
9037
  });
@@ -9025,12 +9051,6 @@
9025
9051
  }), this.onDidActiveChange((event) => {
9026
9052
  this._onDidActiveGroupChange.fire(event);
9027
9053
  }));
9028
- if (!this.options.components) {
9029
- this.options.components = {};
9030
- }
9031
- if (!this.options.frameworkComponents) {
9032
- this.options.frameworkComponents = {};
9033
- }
9034
9054
  }
9035
9055
  updateOptions(options) {
9036
9056
  super.updateOptions(options);
@@ -9080,14 +9100,11 @@
9080
9100
  const height = this.height;
9081
9101
  this.gridview.deserialize(grid, {
9082
9102
  fromJSON: (node) => {
9083
- var _a, _b;
9084
9103
  const { data } = node;
9085
- 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
9086
- ? {
9087
- createComponent: this.options.frameworkComponentFactory
9088
- .createComponent,
9089
- }
9090
- : undefined);
9104
+ const view = this.options.createComponent({
9105
+ id: data.id,
9106
+ name: data.component,
9107
+ });
9091
9108
  queue.push(() => view.init({
9092
9109
  params: data.params,
9093
9110
  minimumWidth: data.minimumWidth,
@@ -9165,7 +9182,7 @@
9165
9182
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9166
9183
  }
9167
9184
  addPanel(options) {
9168
- var _a, _b, _c, _d, _e, _f;
9185
+ var _a, _b, _c, _d;
9169
9186
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9170
9187
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9171
9188
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9181,14 +9198,12 @@
9181
9198
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9182
9199
  }
9183
9200
  }
9184
- 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
9185
- ? {
9186
- createComponent: this.options.frameworkComponentFactory
9187
- .createComponent,
9188
- }
9189
- : undefined);
9201
+ const view = this.options.createComponent({
9202
+ id: options.id,
9203
+ name: options.component,
9204
+ });
9190
9205
  view.init({
9191
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9206
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9192
9207
  minimumWidth: options.minimumWidth,
9193
9208
  maximumWidth: options.maximumWidth,
9194
9209
  minimumHeight: options.minimumHeight,
@@ -9316,12 +9331,6 @@
9316
9331
  this._classNames = new Classnames(this.element);
9317
9332
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9318
9333
  this._options = options;
9319
- if (!options.components) {
9320
- options.components = {};
9321
- }
9322
- if (!options.frameworkComponents) {
9323
- options.frameworkComponents = {};
9324
- }
9325
9334
  this.splitview = new Splitview(this.element, options);
9326
9335
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9327
9336
  }
@@ -9384,18 +9393,17 @@
9384
9393
  return this.panels.find((view) => view.id === id);
9385
9394
  }
9386
9395
  addPanel(options) {
9387
- var _a, _b, _c;
9396
+ var _a;
9388
9397
  if (this._panels.has(options.id)) {
9389
9398
  throw new Error(`panel ${options.id} already exists`);
9390
9399
  }
9391
- 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
9392
- ? {
9393
- createComponent: this.options.frameworkWrapper.createComponent,
9394
- }
9395
- : undefined);
9400
+ const view = this.options.createComponent({
9401
+ id: options.id,
9402
+ name: options.component,
9403
+ });
9396
9404
  view.orientation = this.splitview.orientation;
9397
9405
  view.init({
9398
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9406
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9399
9407
  minimumSize: options.minimumSize,
9400
9408
  maximumSize: options.maximumSize,
9401
9409
  snap: options.snap,
@@ -9457,17 +9465,14 @@
9457
9465
  descriptor: {
9458
9466
  size,
9459
9467
  views: views.map((view) => {
9460
- var _a, _b;
9461
9468
  const data = view.data;
9462
9469
  if (this._panels.has(data.id)) {
9463
9470
  throw new Error(`panel ${data.id} already exists`);
9464
9471
  }
9465
- 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
9466
- ? {
9467
- createComponent: this.options.frameworkWrapper
9468
- .createComponent,
9469
- }
9470
- : undefined);
9472
+ const panel = this.options.createComponent({
9473
+ id: data.id,
9474
+ name: data.component,
9475
+ });
9471
9476
  queue.push(() => {
9472
9477
  var _a;
9473
9478
  panel.init({
@@ -9650,16 +9655,12 @@
9650
9655
  this.onDidAddView = this._onDidAddView.event;
9651
9656
  this._onDidRemoveView = new Emitter();
9652
9657
  this.onDidRemoveView = this._onDidRemoveView.event;
9653
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9658
+ this._onUnhandledDragOverEvent = new Emitter();
9659
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9660
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9654
9661
  this._classNames = new Classnames(this.element);
9655
9662
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9656
9663
  this._options = options;
9657
- if (!options.components) {
9658
- options.components = {};
9659
- }
9660
- if (!options.frameworkComponents) {
9661
- options.frameworkComponents = {};
9662
- }
9663
9664
  this.paneview = new Paneview(this.element, {
9664
9665
  // only allow paneview in the vertical orientation for now
9665
9666
  orientation: exports.Orientation.VERTICAL,
@@ -9684,22 +9685,19 @@
9684
9685
  this._options = Object.assign(Object.assign({}, this.options), options);
9685
9686
  }
9686
9687
  addPanel(options) {
9687
- var _a, _b, _c, _d;
9688
- 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
9689
- ? {
9690
- createComponent: this.options.frameworkWrapper.body.createComponent,
9691
- }
9692
- : undefined);
9688
+ var _a;
9689
+ const body = this.options.createComponent({
9690
+ id: options.id,
9691
+ name: options.component,
9692
+ });
9693
9693
  let header;
9694
- if (options.headerComponent) {
9695
- header = createComponent(options.id, options.headerComponent, (_c = this.options.headerComponents) !== null && _c !== void 0 ? _c : {}, this.options.headerframeworkComponents, this.options.frameworkWrapper
9696
- ? {
9697
- createComponent: this.options.frameworkWrapper.header
9698
- .createComponent,
9699
- }
9700
- : undefined);
9694
+ if (options.headerComponent && this.options.createHeaderComponent) {
9695
+ header = this.options.createHeaderComponent({
9696
+ id: options.id,
9697
+ name: options.headerComponent,
9698
+ });
9701
9699
  }
9702
- else {
9700
+ if (!header) {
9703
9701
  header = new DefaultHeader();
9704
9702
  }
9705
9703
  const view = new PaneFramework({
@@ -9717,7 +9715,7 @@
9717
9715
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9718
9716
  const index = typeof options.index === 'number' ? options.index : undefined;
9719
9717
  view.init({
9720
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9718
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9721
9719
  minimumBodySize: options.minimumBodySize,
9722
9720
  maximumBodySize: options.maximumBodySize,
9723
9721
  isExpanded: options.isExpanded,
@@ -9782,24 +9780,20 @@
9782
9780
  descriptor: {
9783
9781
  size,
9784
9782
  views: views.map((view) => {
9785
- var _a, _b, _c, _d;
9786
9783
  const data = view.data;
9787
- 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
9788
- ? {
9789
- createComponent: this.options.frameworkWrapper.body
9790
- .createComponent,
9791
- }
9792
- : undefined);
9784
+ const body = this.options.createComponent({
9785
+ id: data.id,
9786
+ name: data.component,
9787
+ });
9793
9788
  let header;
9794
- if (data.headerComponent) {
9795
- 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
9796
- ? {
9797
- createComponent: this.options.frameworkWrapper.header
9798
- .createComponent,
9799
- }
9800
- : undefined);
9789
+ if (data.headerComponent &&
9790
+ this.options.createHeaderComponent) {
9791
+ header = this.options.createHeaderComponent({
9792
+ id: data.id,
9793
+ name: data.headerComponent,
9794
+ });
9801
9795
  }
9802
- else {
9796
+ if (!header) {
9803
9797
  header = new DefaultHeader();
9804
9798
  }
9805
9799
  const panel = new PaneFramework({
@@ -9847,9 +9841,11 @@
9847
9841
  this.paneview.dispose();
9848
9842
  }
9849
9843
  doAddPanel(panel) {
9850
- const disposable = panel.onDidDrop((event) => {
9844
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9851
9845
  this._onDidDrop.fire(event);
9852
- });
9846
+ }), panel.onUnhandledDragOverEvent((event) => {
9847
+ this._onUnhandledDragOverEvent.fire(event);
9848
+ }));
9853
9849
  this._viewDisposables.set(panel.id, disposable);
9854
9850
  }
9855
9851
  doRemovePanel(panel) {
@@ -10132,7 +10128,7 @@
10132
10128
  this._onDidBlur = new Emitter();
10133
10129
  this.onDidBlur = this._onDidBlur.event;
10134
10130
  this._element = document.createElement('div');
10135
- this._element.className = 'dockview-react-part';
10131
+ this._element.className = 'dv-react-part';
10136
10132
  this._element.style.height = '100%';
10137
10133
  this._element.style.width = '100%';
10138
10134
  }
@@ -10170,7 +10166,7 @@
10170
10166
  this.component = component;
10171
10167
  this.reactPortalStore = reactPortalStore;
10172
10168
  this._element = document.createElement('div');
10173
- this._element.className = 'dockview-react-part';
10169
+ this._element.className = 'dv-react-part';
10174
10170
  this._element.style.height = '100%';
10175
10171
  this._element.style.width = '100%';
10176
10172
  }
@@ -10206,7 +10202,7 @@
10206
10202
  this.component = component;
10207
10203
  this.reactPortalStore = reactPortalStore;
10208
10204
  this._element = document.createElement('div');
10209
- this._element.className = 'dockview-react-part';
10205
+ this._element.className = 'dv-react-part';
10210
10206
  this._element.style.height = '100%';
10211
10207
  this._element.style.width = '100%';
10212
10208
  }
@@ -10248,7 +10244,7 @@
10248
10244
  this._group = _group;
10249
10245
  this.mutableDisposable = new MutableDisposable();
10250
10246
  this._element = document.createElement('div');
10251
- this._element.className = 'dockview-react-part';
10247
+ this._element.className = 'dv-react-part';
10252
10248
  this._element.style.height = '100%';
10253
10249
  this._element.style.width = '100%';
10254
10250
  }
@@ -10307,8 +10303,8 @@
10307
10303
  : undefined;
10308
10304
  }
10309
10305
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10310
- function extractCoreOptions(props) {
10311
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10306
+ function extractCoreOptions$3(props) {
10307
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10312
10308
  if (key in props) {
10313
10309
  obj[key] = props[key];
10314
10310
  }
@@ -10324,7 +10320,7 @@
10324
10320
  const prevProps = React.useRef({});
10325
10321
  React.useEffect(() => {
10326
10322
  const changes = {};
10327
- PROPERTY_KEYS.forEach((propKey) => {
10323
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10328
10324
  const key = propKey;
10329
10325
  const propValue = props[key];
10330
10326
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10335,7 +10331,7 @@
10335
10331
  dockviewRef.current.updateOptions(changes);
10336
10332
  }
10337
10333
  prevProps.current = props;
10338
- }, PROPERTY_KEYS.map((key) => props[key]));
10334
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10339
10335
  React.useEffect(() => {
10340
10336
  var _a;
10341
10337
  if (!domRef.current) {
@@ -10371,7 +10367,7 @@
10371
10367
  ? DEFAULT_REACT_TAB
10372
10368
  : undefined,
10373
10369
  };
10374
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10370
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10375
10371
  const { clientWidth, clientHeight } = domRef.current;
10376
10372
  api.layout(clientWidth, clientHeight);
10377
10373
  if (props.onReady) {
@@ -10559,31 +10555,47 @@
10559
10555
  }
10560
10556
  }
10561
10557
 
10558
+ function extractCoreOptions$2(props) {
10559
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10560
+ if (key in props) {
10561
+ obj[key] = props[key];
10562
+ }
10563
+ return obj;
10564
+ }, {});
10565
+ return coreOptions;
10566
+ }
10562
10567
  const SplitviewReact = React.forwardRef((props, ref) => {
10563
10568
  const domRef = React.useRef(null);
10564
10569
  const splitviewRef = React.useRef();
10565
10570
  const [portals, addPortal] = usePortalsLifecycle();
10566
10571
  React.useImperativeHandle(ref, () => domRef.current, []);
10572
+ const prevProps = React.useRef({});
10567
10573
  React.useEffect(() => {
10568
- var _a;
10569
- const api = createSplitview(domRef.current, {
10570
- disableAutoResizing: props.disableAutoResizing,
10571
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10572
- frameworkComponents: props.components,
10573
- frameworkWrapper: {
10574
- createComponent: (id, componentId, component) => {
10575
- return new ReactPanelView(id, componentId, component, {
10576
- addPortal,
10577
- });
10578
- },
10579
- },
10580
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10581
- ? props.proportionalLayout
10582
- : true,
10583
- styles: props.hideBorders
10584
- ? { separatorBorder: 'transparent' }
10585
- : undefined,
10574
+ const changes = {};
10575
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10576
+ const key = propKey;
10577
+ const propValue = props[key];
10578
+ if (key in props && propValue !== prevProps.current[key]) {
10579
+ changes[key] = propValue;
10580
+ }
10586
10581
  });
10582
+ if (splitviewRef.current) {
10583
+ splitviewRef.current.updateOptions(changes);
10584
+ }
10585
+ prevProps.current = props;
10586
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10587
+ React.useEffect(() => {
10588
+ if (!domRef.current) {
10589
+ return () => {
10590
+ // noop
10591
+ };
10592
+ }
10593
+ const frameworkOptions = {
10594
+ createComponent: (options) => {
10595
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10596
+ },
10597
+ };
10598
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10587
10599
  const { clientWidth, clientHeight } = domRef.current;
10588
10600
  api.layout(clientWidth, clientHeight);
10589
10601
  if (props.onReady) {
@@ -10599,7 +10611,9 @@
10599
10611
  return;
10600
10612
  }
10601
10613
  splitviewRef.current.updateOptions({
10602
- frameworkComponents: props.components,
10614
+ createComponent: (options) => {
10615
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10616
+ },
10603
10617
  });
10604
10618
  }, [props.components]);
10605
10619
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10624,36 +10638,47 @@
10624
10638
  }
10625
10639
  }
10626
10640
 
10641
+ function extractCoreOptions$1(props) {
10642
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10643
+ if (key in props) {
10644
+ obj[key] = props[key];
10645
+ }
10646
+ return obj;
10647
+ }, {});
10648
+ return coreOptions;
10649
+ }
10627
10650
  const GridviewReact = React.forwardRef((props, ref) => {
10628
10651
  const domRef = React.useRef(null);
10629
10652
  const gridviewRef = React.useRef();
10630
10653
  const [portals, addPortal] = usePortalsLifecycle();
10631
10654
  React.useImperativeHandle(ref, () => domRef.current, []);
10655
+ const prevProps = React.useRef({});
10656
+ React.useEffect(() => {
10657
+ const changes = {};
10658
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10659
+ const key = propKey;
10660
+ const propValue = props[key];
10661
+ if (key in props && propValue !== prevProps.current[key]) {
10662
+ changes[key] = propValue;
10663
+ }
10664
+ });
10665
+ if (gridviewRef.current) {
10666
+ gridviewRef.current.updateOptions(changes);
10667
+ }
10668
+ prevProps.current = props;
10669
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10632
10670
  React.useEffect(() => {
10633
- var _a;
10634
10671
  if (!domRef.current) {
10635
10672
  return () => {
10636
10673
  // noop
10637
10674
  };
10638
10675
  }
10639
- const api = createGridview(domRef.current, {
10640
- disableAutoResizing: props.disableAutoResizing,
10641
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10642
- ? props.proportionalLayout
10643
- : true,
10644
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10645
- frameworkComponents: props.components,
10646
- frameworkComponentFactory: {
10647
- createComponent: (id, componentId, component) => {
10648
- return new ReactGridPanelView(id, componentId, component, {
10649
- addPortal,
10650
- });
10651
- },
10676
+ const frameworkOptions = {
10677
+ createComponent: (options) => {
10678
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10652
10679
  },
10653
- styles: props.hideBorders
10654
- ? { separatorBorder: 'transparent' }
10655
- : undefined,
10656
- });
10680
+ };
10681
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10657
10682
  const { clientWidth, clientHeight } = domRef.current;
10658
10683
  api.layout(clientWidth, clientHeight);
10659
10684
  if (props.onReady) {
@@ -10669,7 +10694,9 @@
10669
10694
  return;
10670
10695
  }
10671
10696
  gridviewRef.current.updateOptions({
10672
- frameworkComponents: props.components,
10697
+ createComponent: (options) => {
10698
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10699
+ },
10673
10700
  });
10674
10701
  }, [props.components]);
10675
10702
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10711,32 +10738,52 @@
10711
10738
  }
10712
10739
  }
10713
10740
 
10741
+ function extractCoreOptions(props) {
10742
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10743
+ if (key in props) {
10744
+ obj[key] = props[key];
10745
+ }
10746
+ return obj;
10747
+ }, {});
10748
+ return coreOptions;
10749
+ }
10714
10750
  const PaneviewReact = React.forwardRef((props, ref) => {
10715
10751
  const domRef = React.useRef(null);
10716
10752
  const paneviewRef = React.useRef();
10717
10753
  const [portals, addPortal] = usePortalsLifecycle();
10718
10754
  React.useImperativeHandle(ref, () => domRef.current, []);
10755
+ const prevProps = React.useRef({});
10719
10756
  React.useEffect(() => {
10720
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10721
- addPortal,
10757
+ const changes = {};
10758
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10759
+ const key = propKey;
10760
+ const propValue = props[key];
10761
+ if (key in props && propValue !== prevProps.current[key]) {
10762
+ changes[key] = propValue;
10763
+ }
10722
10764
  });
10723
- const api = createPaneview(domRef.current, {
10724
- disableAutoResizing: props.disableAutoResizing,
10725
- frameworkComponents: props.components,
10726
- components: {},
10727
- headerComponents: {},
10728
- disableDnd: props.disableDnd,
10729
- headerframeworkComponents: props.headerComponents,
10730
- frameworkWrapper: {
10731
- header: {
10732
- createComponent,
10733
- },
10734
- body: {
10735
- createComponent,
10736
- },
10765
+ if (paneviewRef.current) {
10766
+ paneviewRef.current.updateOptions(changes);
10767
+ }
10768
+ prevProps.current = props;
10769
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10770
+ React.useEffect(() => {
10771
+ var _a;
10772
+ if (!domRef.current) {
10773
+ return () => {
10774
+ // noop
10775
+ };
10776
+ }
10777
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10778
+ const frameworkOptions = {
10779
+ createComponent: (options) => {
10780
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10737
10781
  },
10738
- showDndOverlay: props.showDndOverlay,
10739
- });
10782
+ createHeaderComponent: (options) => {
10783
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10784
+ },
10785
+ };
10786
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10740
10787
  const { clientWidth, clientHeight } = domRef.current;
10741
10788
  api.layout(clientWidth, clientHeight);
10742
10789
  if (props.onReady) {
@@ -10752,41 +10799,38 @@
10752
10799
  return;
10753
10800
  }
10754
10801
  paneviewRef.current.updateOptions({
10755
- frameworkComponents: props.components,
10802
+ createComponent: (options) => {
10803
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10804
+ },
10756
10805
  });
10757
10806
  }, [props.components]);
10758
10807
  React.useEffect(() => {
10808
+ var _a;
10759
10809
  if (!paneviewRef.current) {
10760
10810
  return;
10761
10811
  }
10812
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10762
10813
  paneviewRef.current.updateOptions({
10763
- headerframeworkComponents: props.headerComponents,
10814
+ createHeaderComponent: (options) => {
10815
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10816
+ },
10764
10817
  });
10765
10818
  }, [props.headerComponents]);
10766
10819
  React.useEffect(() => {
10767
10820
  if (!paneviewRef.current) {
10768
10821
  return () => {
10769
- //
10822
+ // noop
10770
10823
  };
10771
10824
  }
10772
- const api = paneviewRef.current;
10773
- const disposable = api.onDidDrop((event) => {
10825
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10774
10826
  if (props.onDidDrop) {
10775
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10827
+ props.onDidDrop(event);
10776
10828
  }
10777
10829
  });
10778
10830
  return () => {
10779
10831
  disposable.dispose();
10780
10832
  };
10781
10833
  }, [props.onDidDrop]);
10782
- React.useEffect(() => {
10783
- if (!paneviewRef.current) {
10784
- return;
10785
- }
10786
- paneviewRef.current.updateOptions({
10787
- showDndOverlay: props.showDndOverlay,
10788
- });
10789
- }, [props.showDndOverlay]);
10790
10834
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10791
10835
  });
10792
10836
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10814,7 +10858,10 @@
10814
10858
  exports.GridviewComponent = GridviewComponent;
10815
10859
  exports.GridviewPanel = GridviewPanel;
10816
10860
  exports.GridviewReact = GridviewReact;
10817
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10861
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10862
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10863
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10864
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10818
10865
  exports.PaneFramework = PaneFramework;
10819
10866
  exports.PaneTransfer = PaneTransfer;
10820
10867
  exports.PanelTransfer = PanelTransfer;
@@ -10823,6 +10870,7 @@
10823
10870
  exports.PaneviewComponent = PaneviewComponent;
10824
10871
  exports.PaneviewPanel = PaneviewPanel;
10825
10872
  exports.PaneviewReact = PaneviewReact;
10873
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10826
10874
  exports.ReactPart = ReactPart;
10827
10875
  exports.ReactPartContext = ReactPartContext;
10828
10876
  exports.Splitview = Splitview;