dockview-react 2.1.4 → 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.4
3
+ * @version 3.0.0
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;
@@ -3129,15 +3172,10 @@ class PaneviewApi {
3129
3172
  * Invoked when a Drag'n'Drop event occurs that the component was unable to handle. Exposed for custom Drag'n'Drop functionality.
3130
3173
  */
3131
3174
  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;
3175
+ return this.component.onDidDrop;
3176
+ }
3177
+ get onUnhandledDragOverEvent() {
3178
+ return this.component.onUnhandledDragOverEvent;
3141
3179
  }
3142
3180
  constructor(component) {
3143
3181
  this.component = component;
@@ -4064,6 +4102,28 @@ function calculateQuadrantAsPixels(overlayType, x, y, width, height, threshold)
4064
4102
  return 'center';
4065
4103
  }
4066
4104
 
4105
+ const PROPERTY_KEYS_PANEVIEW = (() => {
4106
+ /**
4107
+ * by readong the keys from an empty value object TypeScript will error
4108
+ * when we add or remove new properties to `DockviewOptions`
4109
+ */
4110
+ const properties = {
4111
+ disableAutoResizing: undefined,
4112
+ disableDnd: undefined,
4113
+ className: undefined,
4114
+ };
4115
+ return Object.keys(properties);
4116
+ })();
4117
+ class PaneviewUnhandledDragOverEvent extends AcceptableEvent {
4118
+ constructor(nativeEvent, position, getData, panel) {
4119
+ super();
4120
+ this.nativeEvent = nativeEvent;
4121
+ this.position = position;
4122
+ this.getData = getData;
4123
+ this.panel = panel;
4124
+ }
4125
+ }
4126
+
4067
4127
  class WillFocusEvent extends DockviewEvent {
4068
4128
  constructor() {
4069
4129
  super();
@@ -4487,6 +4547,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4487
4547
  this.accessor = accessor;
4488
4548
  this._onDidDrop = new Emitter();
4489
4549
  this.onDidDrop = this._onDidDrop.event;
4550
+ this._onUnhandledDragOverEvent = new Emitter();
4551
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
4552
+ this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent);
4490
4553
  if (!disableDnd) {
4491
4554
  this.initDragFeatures();
4492
4555
  }
@@ -4513,7 +4576,7 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4513
4576
  overlayModel: {
4514
4577
  activationSize: { type: 'percentage', value: 50 },
4515
4578
  },
4516
- canDisplayOverlay: (event) => {
4579
+ canDisplayOverlay: (event, position) => {
4517
4580
  const data = getPaneData();
4518
4581
  if (data) {
4519
4582
  if (data.paneId !== this.id &&
@@ -4521,14 +4584,9 @@ class DraggablePaneviewPanel extends PaneviewPanel {
4521
4584
  return true;
4522
4585
  }
4523
4586
  }
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;
4587
+ const firedEvent = new PaneviewUnhandledDragOverEvent(event, position, getPaneData, this);
4588
+ this._onUnhandledDragOverEvent.fire(firedEvent);
4589
+ return firedEvent.isAccepted;
4532
4590
  },
4533
4591
  });
4534
4592
  this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
@@ -4983,15 +5041,7 @@ class TabsContainer extends CompositeDisposable {
4983
5041
  this._element.appendChild(this.leftActionsContainer);
4984
5042
  this._element.appendChild(this.voidContainer.element);
4985
5043
  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) => {
5044
+ this.addDisposables(this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
4995
5045
  this._onGroupDragStart.fire({
4996
5046
  nativeEvent: event,
4997
5047
  group: this.group,
@@ -5036,20 +5086,6 @@ class TabsContainer extends CompositeDisposable {
5036
5086
  setActive(_isGroupActive) {
5037
5087
  // noop
5038
5088
  }
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
5089
  delete(id) {
5054
5090
  const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
5055
5091
  const tabToRemove = this.tabs.splice(index, 1)[0];
@@ -5057,6 +5093,7 @@ class TabsContainer extends CompositeDisposable {
5057
5093
  disposable.dispose();
5058
5094
  value.dispose();
5059
5095
  value.element.remove();
5096
+ this.updateClassnames();
5060
5097
  }
5061
5098
  setActivePanel(panel) {
5062
5099
  this.tabs.forEach((tab) => {
@@ -5125,25 +5162,37 @@ class TabsContainer extends CompositeDisposable {
5125
5162
  }
5126
5163
  this.tabs = [];
5127
5164
  }
5165
+ addTab(tab, index = this.tabs.length) {
5166
+ if (index < 0 || index > this.tabs.length) {
5167
+ throw new Error('invalid location');
5168
+ }
5169
+ this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
5170
+ this.tabs = [
5171
+ ...this.tabs.slice(0, index),
5172
+ tab,
5173
+ ...this.tabs.slice(index),
5174
+ ];
5175
+ if (this.selectedIndex < 0) {
5176
+ this.selectedIndex = index;
5177
+ }
5178
+ this.updateClassnames();
5179
+ }
5180
+ updateClassnames() {
5181
+ toggleClass(this._element, 'dv-single-tab', this.size === 1);
5182
+ }
5128
5183
  }
5129
5184
 
5130
- class DockviewUnhandledDragOverEvent {
5131
- get isAccepted() {
5132
- return this._isAccepted;
5133
- }
5185
+ class DockviewUnhandledDragOverEvent extends AcceptableEvent {
5134
5186
  constructor(nativeEvent, target, position, getData, group) {
5187
+ super();
5135
5188
  this.nativeEvent = nativeEvent;
5136
5189
  this.target = target;
5137
5190
  this.position = position;
5138
5191
  this.getData = getData;
5139
5192
  this.group = group;
5140
- this._isAccepted = false;
5141
- }
5142
- accept() {
5143
- this._isAccepted = true;
5144
5193
  }
5145
5194
  }
5146
- const PROPERTY_KEYS = (() => {
5195
+ const PROPERTY_KEYS_DOCKVIEW = (() => {
5147
5196
  /**
5148
5197
  * by readong the keys from an empty value object TypeScript will error
5149
5198
  * when we add or remove new properties to `DockviewOptions`
@@ -8989,31 +9038,6 @@ class DockviewComponent extends BaseGrid {
8989
9038
  }
8990
9039
  }
8991
9040
 
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
9041
  class GridviewComponent extends BaseGrid {
9018
9042
  get orientation() {
9019
9043
  return this.gridview.orientation;
@@ -9031,10 +9055,13 @@ class GridviewComponent extends BaseGrid {
9031
9055
  this._deserializer = value;
9032
9056
  }
9033
9057
  constructor(parentElement, options) {
9058
+ var _a;
9034
9059
  super(parentElement, {
9035
- proportionalLayout: options.proportionalLayout,
9060
+ proportionalLayout: (_a = options.proportionalLayout) !== null && _a !== void 0 ? _a : true,
9036
9061
  orientation: options.orientation,
9037
- styles: options.styles,
9062
+ styles: options.hideBorders
9063
+ ? { separatorBorder: 'transparent' }
9064
+ : undefined,
9038
9065
  disableAutoResizing: options.disableAutoResizing,
9039
9066
  className: options.className,
9040
9067
  });
@@ -9054,12 +9081,6 @@ class GridviewComponent extends BaseGrid {
9054
9081
  }), this.onDidActiveChange((event) => {
9055
9082
  this._onDidActiveGroupChange.fire(event);
9056
9083
  }));
9057
- if (!this.options.components) {
9058
- this.options.components = {};
9059
- }
9060
- if (!this.options.frameworkComponents) {
9061
- this.options.frameworkComponents = {};
9062
- }
9063
9084
  }
9064
9085
  updateOptions(options) {
9065
9086
  super.updateOptions(options);
@@ -9109,14 +9130,11 @@ class GridviewComponent extends BaseGrid {
9109
9130
  const height = this.height;
9110
9131
  this.gridview.deserialize(grid, {
9111
9132
  fromJSON: (node) => {
9112
- var _a, _b;
9113
9133
  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);
9134
+ const view = this.options.createComponent({
9135
+ id: data.id,
9136
+ name: data.component,
9137
+ });
9120
9138
  queue.push(() => view.init({
9121
9139
  params: data.params,
9122
9140
  minimumWidth: data.minimumWidth,
@@ -9194,7 +9212,7 @@ class GridviewComponent extends BaseGrid {
9194
9212
  this.doAddGroup(removedPanel, relativeLocation, options.size);
9195
9213
  }
9196
9214
  addPanel(options) {
9197
- var _a, _b, _c, _d, _e, _f;
9215
+ var _a, _b, _c, _d;
9198
9216
  let relativeLocation = (_a = options.location) !== null && _a !== void 0 ? _a : [0];
9199
9217
  if ((_b = options.position) === null || _b === void 0 ? void 0 : _b.referencePanel) {
9200
9218
  const referenceGroup = (_c = this._groups.get(options.position.referencePanel)) === null || _c === void 0 ? void 0 : _c.value;
@@ -9210,14 +9228,12 @@ class GridviewComponent extends BaseGrid {
9210
9228
  relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
9211
9229
  }
9212
9230
  }
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);
9231
+ const view = this.options.createComponent({
9232
+ id: options.id,
9233
+ name: options.component,
9234
+ });
9219
9235
  view.init({
9220
- params: (_f = options.params) !== null && _f !== void 0 ? _f : {},
9236
+ params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9221
9237
  minimumWidth: options.minimumWidth,
9222
9238
  maximumWidth: options.maximumWidth,
9223
9239
  minimumHeight: options.minimumHeight,
@@ -9345,12 +9361,6 @@ class SplitviewComponent extends Resizable {
9345
9361
  this._classNames = new Classnames(this.element);
9346
9362
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9347
9363
  this._options = options;
9348
- if (!options.components) {
9349
- options.components = {};
9350
- }
9351
- if (!options.frameworkComponents) {
9352
- options.frameworkComponents = {};
9353
- }
9354
9364
  this.splitview = new Splitview(this.element, options);
9355
9365
  this.addDisposables(this._onDidAddView, this._onDidLayoutfromJSON, this._onDidRemoveView, this._onDidLayoutChange);
9356
9366
  }
@@ -9413,18 +9423,17 @@ class SplitviewComponent extends Resizable {
9413
9423
  return this.panels.find((view) => view.id === id);
9414
9424
  }
9415
9425
  addPanel(options) {
9416
- var _a, _b, _c;
9426
+ var _a;
9417
9427
  if (this._panels.has(options.id)) {
9418
9428
  throw new Error(`panel ${options.id} already exists`);
9419
9429
  }
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);
9430
+ const view = this.options.createComponent({
9431
+ id: options.id,
9432
+ name: options.component,
9433
+ });
9425
9434
  view.orientation = this.splitview.orientation;
9426
9435
  view.init({
9427
- params: (_c = options.params) !== null && _c !== void 0 ? _c : {},
9436
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9428
9437
  minimumSize: options.minimumSize,
9429
9438
  maximumSize: options.maximumSize,
9430
9439
  snap: options.snap,
@@ -9486,17 +9495,14 @@ class SplitviewComponent extends Resizable {
9486
9495
  descriptor: {
9487
9496
  size,
9488
9497
  views: views.map((view) => {
9489
- var _a, _b;
9490
9498
  const data = view.data;
9491
9499
  if (this._panels.has(data.id)) {
9492
9500
  throw new Error(`panel ${data.id} already exists`);
9493
9501
  }
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);
9502
+ const panel = this.options.createComponent({
9503
+ id: data.id,
9504
+ name: data.component,
9505
+ });
9500
9506
  queue.push(() => {
9501
9507
  var _a;
9502
9508
  panel.init({
@@ -9679,16 +9685,12 @@ class PaneviewComponent extends Resizable {
9679
9685
  this.onDidAddView = this._onDidAddView.event;
9680
9686
  this._onDidRemoveView = new Emitter();
9681
9687
  this.onDidRemoveView = this._onDidRemoveView.event;
9682
- this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView);
9688
+ this._onUnhandledDragOverEvent = new Emitter();
9689
+ this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
9690
+ this.addDisposables(this._onDidLayoutChange, this._onDidLayoutfromJSON, this._onDidDrop, this._onDidAddView, this._onDidRemoveView, this._onUnhandledDragOverEvent);
9683
9691
  this._classNames = new Classnames(this.element);
9684
9692
  this._classNames.setClassNames((_a = options.className) !== null && _a !== void 0 ? _a : '');
9685
9693
  this._options = options;
9686
- if (!options.components) {
9687
- options.components = {};
9688
- }
9689
- if (!options.frameworkComponents) {
9690
- options.frameworkComponents = {};
9691
- }
9692
9694
  this.paneview = new Paneview(this.element, {
9693
9695
  // only allow paneview in the vertical orientation for now
9694
9696
  orientation: exports.Orientation.VERTICAL,
@@ -9713,22 +9715,19 @@ class PaneviewComponent extends Resizable {
9713
9715
  this._options = Object.assign(Object.assign({}, this.options), options);
9714
9716
  }
9715
9717
  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);
9718
+ var _a;
9719
+ const body = this.options.createComponent({
9720
+ id: options.id,
9721
+ name: options.component,
9722
+ });
9722
9723
  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);
9724
+ if (options.headerComponent && this.options.createHeaderComponent) {
9725
+ header = this.options.createHeaderComponent({
9726
+ id: options.id,
9727
+ name: options.headerComponent,
9728
+ });
9730
9729
  }
9731
- else {
9730
+ if (!header) {
9732
9731
  header = new DefaultHeader();
9733
9732
  }
9734
9733
  const view = new PaneFramework({
@@ -9746,7 +9745,7 @@ class PaneviewComponent extends Resizable {
9746
9745
  const size = typeof options.size === 'number' ? options.size : exports.Sizing.Distribute;
9747
9746
  const index = typeof options.index === 'number' ? options.index : undefined;
9748
9747
  view.init({
9749
- params: (_d = options.params) !== null && _d !== void 0 ? _d : {},
9748
+ params: (_a = options.params) !== null && _a !== void 0 ? _a : {},
9750
9749
  minimumBodySize: options.minimumBodySize,
9751
9750
  maximumBodySize: options.maximumBodySize,
9752
9751
  isExpanded: options.isExpanded,
@@ -9811,24 +9810,20 @@ class PaneviewComponent extends Resizable {
9811
9810
  descriptor: {
9812
9811
  size,
9813
9812
  views: views.map((view) => {
9814
- var _a, _b, _c, _d;
9815
9813
  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);
9814
+ const body = this.options.createComponent({
9815
+ id: data.id,
9816
+ name: data.component,
9817
+ });
9822
9818
  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);
9819
+ if (data.headerComponent &&
9820
+ this.options.createHeaderComponent) {
9821
+ header = this.options.createHeaderComponent({
9822
+ id: data.id,
9823
+ name: data.headerComponent,
9824
+ });
9830
9825
  }
9831
- else {
9826
+ if (!header) {
9832
9827
  header = new DefaultHeader();
9833
9828
  }
9834
9829
  const panel = new PaneFramework({
@@ -9876,9 +9871,11 @@ class PaneviewComponent extends Resizable {
9876
9871
  this.paneview.dispose();
9877
9872
  }
9878
9873
  doAddPanel(panel) {
9879
- const disposable = panel.onDidDrop((event) => {
9874
+ const disposable = new CompositeDisposable(panel.onDidDrop((event) => {
9880
9875
  this._onDidDrop.fire(event);
9881
- });
9876
+ }), panel.onUnhandledDragOverEvent((event) => {
9877
+ this._onUnhandledDragOverEvent.fire(event);
9878
+ }));
9882
9879
  this._viewDisposables.set(panel.id, disposable);
9883
9880
  }
9884
9881
  doRemovePanel(panel) {
@@ -10161,7 +10158,7 @@ class ReactPanelContentPart {
10161
10158
  this._onDidBlur = new Emitter();
10162
10159
  this.onDidBlur = this._onDidBlur.event;
10163
10160
  this._element = document.createElement('div');
10164
- this._element.className = 'dockview-react-part';
10161
+ this._element.className = 'dv-react-part';
10165
10162
  this._element.style.height = '100%';
10166
10163
  this._element.style.width = '100%';
10167
10164
  }
@@ -10199,7 +10196,7 @@ class ReactPanelHeaderPart {
10199
10196
  this.component = component;
10200
10197
  this.reactPortalStore = reactPortalStore;
10201
10198
  this._element = document.createElement('div');
10202
- this._element.className = 'dockview-react-part';
10199
+ this._element.className = 'dv-react-part';
10203
10200
  this._element.style.height = '100%';
10204
10201
  this._element.style.width = '100%';
10205
10202
  }
@@ -10235,7 +10232,7 @@ class ReactWatermarkPart {
10235
10232
  this.component = component;
10236
10233
  this.reactPortalStore = reactPortalStore;
10237
10234
  this._element = document.createElement('div');
10238
- this._element.className = 'dockview-react-part';
10235
+ this._element.className = 'dv-react-part';
10239
10236
  this._element.style.height = '100%';
10240
10237
  this._element.style.width = '100%';
10241
10238
  }
@@ -10277,7 +10274,7 @@ class ReactHeaderActionsRendererPart {
10277
10274
  this._group = _group;
10278
10275
  this.mutableDisposable = new MutableDisposable();
10279
10276
  this._element = document.createElement('div');
10280
- this._element.className = 'dockview-react-part';
10277
+ this._element.className = 'dv-react-part';
10281
10278
  this._element.style.height = '100%';
10282
10279
  this._element.style.width = '100%';
10283
10280
  }
@@ -10336,8 +10333,8 @@ function createGroupControlElement(component, store) {
10336
10333
  : undefined;
10337
10334
  }
10338
10335
  const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
10339
- function extractCoreOptions(props) {
10340
- const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
10336
+ function extractCoreOptions$3(props) {
10337
+ const coreOptions = PROPERTY_KEYS_DOCKVIEW.reduce((obj, key) => {
10341
10338
  if (key in props) {
10342
10339
  obj[key] = props[key];
10343
10340
  }
@@ -10353,7 +10350,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10353
10350
  const prevProps = React.useRef({});
10354
10351
  React.useEffect(() => {
10355
10352
  const changes = {};
10356
- PROPERTY_KEYS.forEach((propKey) => {
10353
+ PROPERTY_KEYS_DOCKVIEW.forEach((propKey) => {
10357
10354
  const key = propKey;
10358
10355
  const propValue = props[key];
10359
10356
  if (key in props && propValue !== prevProps.current[key]) {
@@ -10364,7 +10361,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10364
10361
  dockviewRef.current.updateOptions(changes);
10365
10362
  }
10366
10363
  prevProps.current = props;
10367
- }, PROPERTY_KEYS.map((key) => props[key]));
10364
+ }, PROPERTY_KEYS_DOCKVIEW.map((key) => props[key]));
10368
10365
  React.useEffect(() => {
10369
10366
  var _a;
10370
10367
  if (!domRef.current) {
@@ -10400,7 +10397,7 @@ const DockviewReact = React.forwardRef((props, ref) => {
10400
10397
  ? DEFAULT_REACT_TAB
10401
10398
  : undefined,
10402
10399
  };
10403
- const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10400
+ const api = createDockview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$3(props)), frameworkOptions));
10404
10401
  const { clientWidth, clientHeight } = domRef.current;
10405
10402
  api.layout(clientWidth, clientHeight);
10406
10403
  if (props.onReady) {
@@ -10588,31 +10585,47 @@ class ReactPanelView extends SplitviewPanel {
10588
10585
  }
10589
10586
  }
10590
10587
 
10588
+ function extractCoreOptions$2(props) {
10589
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10590
+ if (key in props) {
10591
+ obj[key] = props[key];
10592
+ }
10593
+ return obj;
10594
+ }, {});
10595
+ return coreOptions;
10596
+ }
10591
10597
  const SplitviewReact = React.forwardRef((props, ref) => {
10592
10598
  const domRef = React.useRef(null);
10593
10599
  const splitviewRef = React.useRef();
10594
10600
  const [portals, addPortal] = usePortalsLifecycle();
10595
10601
  React.useImperativeHandle(ref, () => domRef.current, []);
10602
+ const prevProps = React.useRef({});
10596
10603
  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,
10604
+ const changes = {};
10605
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10606
+ const key = propKey;
10607
+ const propValue = props[key];
10608
+ if (key in props && propValue !== prevProps.current[key]) {
10609
+ changes[key] = propValue;
10610
+ }
10615
10611
  });
10612
+ if (splitviewRef.current) {
10613
+ splitviewRef.current.updateOptions(changes);
10614
+ }
10615
+ prevProps.current = props;
10616
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10617
+ React.useEffect(() => {
10618
+ if (!domRef.current) {
10619
+ return () => {
10620
+ // noop
10621
+ };
10622
+ }
10623
+ const frameworkOptions = {
10624
+ createComponent: (options) => {
10625
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10626
+ },
10627
+ };
10628
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10616
10629
  const { clientWidth, clientHeight } = domRef.current;
10617
10630
  api.layout(clientWidth, clientHeight);
10618
10631
  if (props.onReady) {
@@ -10628,7 +10641,9 @@ const SplitviewReact = React.forwardRef((props, ref) => {
10628
10641
  return;
10629
10642
  }
10630
10643
  splitviewRef.current.updateOptions({
10631
- frameworkComponents: props.components,
10644
+ createComponent: (options) => {
10645
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10646
+ },
10632
10647
  });
10633
10648
  }, [props.components]);
10634
10649
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10653,36 +10668,47 @@ class ReactGridPanelView extends GridviewPanel {
10653
10668
  }
10654
10669
  }
10655
10670
 
10671
+ function extractCoreOptions$1(props) {
10672
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10673
+ if (key in props) {
10674
+ obj[key] = props[key];
10675
+ }
10676
+ return obj;
10677
+ }, {});
10678
+ return coreOptions;
10679
+ }
10656
10680
  const GridviewReact = React.forwardRef((props, ref) => {
10657
10681
  const domRef = React.useRef(null);
10658
10682
  const gridviewRef = React.useRef();
10659
10683
  const [portals, addPortal] = usePortalsLifecycle();
10660
10684
  React.useImperativeHandle(ref, () => domRef.current, []);
10685
+ const prevProps = React.useRef({});
10686
+ React.useEffect(() => {
10687
+ const changes = {};
10688
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10689
+ const key = propKey;
10690
+ const propValue = props[key];
10691
+ if (key in props && propValue !== prevProps.current[key]) {
10692
+ changes[key] = propValue;
10693
+ }
10694
+ });
10695
+ if (gridviewRef.current) {
10696
+ gridviewRef.current.updateOptions(changes);
10697
+ }
10698
+ prevProps.current = props;
10699
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10661
10700
  React.useEffect(() => {
10662
- var _a;
10663
10701
  if (!domRef.current) {
10664
10702
  return () => {
10665
10703
  // noop
10666
10704
  };
10667
10705
  }
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
- },
10706
+ const frameworkOptions = {
10707
+ createComponent: (options) => {
10708
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10681
10709
  },
10682
- styles: props.hideBorders
10683
- ? { separatorBorder: 'transparent' }
10684
- : undefined,
10685
- });
10710
+ };
10711
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10686
10712
  const { clientWidth, clientHeight } = domRef.current;
10687
10713
  api.layout(clientWidth, clientHeight);
10688
10714
  if (props.onReady) {
@@ -10698,7 +10724,9 @@ const GridviewReact = React.forwardRef((props, ref) => {
10698
10724
  return;
10699
10725
  }
10700
10726
  gridviewRef.current.updateOptions({
10701
- frameworkComponents: props.components,
10727
+ createComponent: (options) => {
10728
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10729
+ },
10702
10730
  });
10703
10731
  }, [props.components]);
10704
10732
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10740,32 +10768,52 @@ class PanePanelSection {
10740
10768
  }
10741
10769
  }
10742
10770
 
10771
+ function extractCoreOptions(props) {
10772
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10773
+ if (key in props) {
10774
+ obj[key] = props[key];
10775
+ }
10776
+ return obj;
10777
+ }, {});
10778
+ return coreOptions;
10779
+ }
10743
10780
  const PaneviewReact = React.forwardRef((props, ref) => {
10744
10781
  const domRef = React.useRef(null);
10745
10782
  const paneviewRef = React.useRef();
10746
10783
  const [portals, addPortal] = usePortalsLifecycle();
10747
10784
  React.useImperativeHandle(ref, () => domRef.current, []);
10785
+ const prevProps = React.useRef({});
10748
10786
  React.useEffect(() => {
10749
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10750
- addPortal,
10787
+ const changes = {};
10788
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10789
+ const key = propKey;
10790
+ const propValue = props[key];
10791
+ if (key in props && propValue !== prevProps.current[key]) {
10792
+ changes[key] = propValue;
10793
+ }
10751
10794
  });
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
- },
10795
+ if (paneviewRef.current) {
10796
+ paneviewRef.current.updateOptions(changes);
10797
+ }
10798
+ prevProps.current = props;
10799
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10800
+ React.useEffect(() => {
10801
+ var _a;
10802
+ if (!domRef.current) {
10803
+ return () => {
10804
+ // noop
10805
+ };
10806
+ }
10807
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10808
+ const frameworkOptions = {
10809
+ createComponent: (options) => {
10810
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10766
10811
  },
10767
- showDndOverlay: props.showDndOverlay,
10768
- });
10812
+ createHeaderComponent: (options) => {
10813
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10814
+ },
10815
+ };
10816
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10769
10817
  const { clientWidth, clientHeight } = domRef.current;
10770
10818
  api.layout(clientWidth, clientHeight);
10771
10819
  if (props.onReady) {
@@ -10781,41 +10829,38 @@ const PaneviewReact = React.forwardRef((props, ref) => {
10781
10829
  return;
10782
10830
  }
10783
10831
  paneviewRef.current.updateOptions({
10784
- frameworkComponents: props.components,
10832
+ createComponent: (options) => {
10833
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10834
+ },
10785
10835
  });
10786
10836
  }, [props.components]);
10787
10837
  React.useEffect(() => {
10838
+ var _a;
10788
10839
  if (!paneviewRef.current) {
10789
10840
  return;
10790
10841
  }
10842
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10791
10843
  paneviewRef.current.updateOptions({
10792
- headerframeworkComponents: props.headerComponents,
10844
+ createHeaderComponent: (options) => {
10845
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10846
+ },
10793
10847
  });
10794
10848
  }, [props.headerComponents]);
10795
10849
  React.useEffect(() => {
10796
10850
  if (!paneviewRef.current) {
10797
10851
  return () => {
10798
- //
10852
+ // noop
10799
10853
  };
10800
10854
  }
10801
- const api = paneviewRef.current;
10802
- const disposable = api.onDidDrop((event) => {
10855
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10803
10856
  if (props.onDidDrop) {
10804
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10857
+ props.onDidDrop(event);
10805
10858
  }
10806
10859
  });
10807
10860
  return () => {
10808
10861
  disposable.dispose();
10809
10862
  };
10810
10863
  }, [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
10864
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10820
10865
  });
10821
10866
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10843,7 +10888,10 @@ exports.GridviewApi = GridviewApi;
10843
10888
  exports.GridviewComponent = GridviewComponent;
10844
10889
  exports.GridviewPanel = GridviewPanel;
10845
10890
  exports.GridviewReact = GridviewReact;
10846
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10891
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10892
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10893
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10894
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10847
10895
  exports.PaneFramework = PaneFramework;
10848
10896
  exports.PaneTransfer = PaneTransfer;
10849
10897
  exports.PanelTransfer = PanelTransfer;
@@ -10852,6 +10900,7 @@ exports.PaneviewApi = PaneviewApi;
10852
10900
  exports.PaneviewComponent = PaneviewComponent;
10853
10901
  exports.PaneviewPanel = PaneviewPanel;
10854
10902
  exports.PaneviewReact = PaneviewReact;
10903
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10855
10904
  exports.ReactPart = ReactPart;
10856
10905
  exports.ReactPartContext = ReactPartContext;
10857
10906
  exports.Splitview = Splitview;