dockview 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.
Files changed (49) hide show
  1. package/dist/cjs/dockview/dockview.d.ts +0 -1
  2. package/dist/cjs/dockview/dockview.js +3 -3
  3. package/dist/cjs/dockview/headerActionsRenderer.js +1 -1
  4. package/dist/cjs/dockview/reactContentPart.js +1 -1
  5. package/dist/cjs/dockview/reactHeaderPart.js +1 -1
  6. package/dist/cjs/dockview/reactWatermarkPart.js +1 -1
  7. package/dist/cjs/gridview/gridview.d.ts +2 -7
  8. package/dist/cjs/gridview/gridview.js +47 -20
  9. package/dist/cjs/paneview/paneview.d.ts +2 -6
  10. package/dist/cjs/paneview/paneview.js +54 -36
  11. package/dist/cjs/paneview/view.d.ts +2 -2
  12. package/dist/cjs/splitview/splitview.d.ts +2 -7
  13. package/dist/cjs/splitview/splitview.js +52 -20
  14. package/dist/dockview.amd.js +287 -238
  15. package/dist/dockview.amd.js.map +1 -1
  16. package/dist/dockview.amd.min.js +2 -2
  17. package/dist/dockview.amd.min.js.map +1 -1
  18. package/dist/dockview.amd.min.noStyle.js +2 -2
  19. package/dist/dockview.amd.min.noStyle.js.map +1 -1
  20. package/dist/dockview.amd.noStyle.js +287 -238
  21. package/dist/dockview.amd.noStyle.js.map +1 -1
  22. package/dist/dockview.cjs.js +287 -238
  23. package/dist/dockview.cjs.js.map +1 -1
  24. package/dist/dockview.esm.js +283 -238
  25. package/dist/dockview.esm.js.map +1 -1
  26. package/dist/dockview.esm.min.js +2 -2
  27. package/dist/dockview.esm.min.js.map +1 -1
  28. package/dist/dockview.js +287 -238
  29. package/dist/dockview.js.map +1 -1
  30. package/dist/dockview.min.js +2 -2
  31. package/dist/dockview.min.js.map +1 -1
  32. package/dist/dockview.min.noStyle.js +2 -2
  33. package/dist/dockview.min.noStyle.js.map +1 -1
  34. package/dist/dockview.noStyle.js +287 -238
  35. package/dist/dockview.noStyle.js.map +1 -1
  36. package/dist/esm/dockview/dockview.d.ts +0 -1
  37. package/dist/esm/dockview/dockview.js +4 -4
  38. package/dist/esm/dockview/headerActionsRenderer.js +1 -1
  39. package/dist/esm/dockview/reactContentPart.js +1 -1
  40. package/dist/esm/dockview/reactHeaderPart.js +1 -1
  41. package/dist/esm/dockview/reactWatermarkPart.js +1 -1
  42. package/dist/esm/gridview/gridview.d.ts +2 -7
  43. package/dist/esm/gridview/gridview.js +36 -20
  44. package/dist/esm/paneview/paneview.d.ts +2 -6
  45. package/dist/esm/paneview/paneview.js +53 -33
  46. package/dist/esm/paneview/view.d.ts +2 -2
  47. package/dist/esm/splitview/splitview.d.ts +2 -7
  48. package/dist/esm/splitview/splitview.js +41 -20
  49. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview
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) {
@@ -10611,31 +10608,47 @@ class ReactPanelView extends SplitviewPanel {
10611
10608
  }
10612
10609
  }
10613
10610
 
10611
+ function extractCoreOptions$2(props) {
10612
+ const coreOptions = PROPERTY_KEYS_SPLITVIEW.reduce((obj, key) => {
10613
+ if (key in props) {
10614
+ obj[key] = props[key];
10615
+ }
10616
+ return obj;
10617
+ }, {});
10618
+ return coreOptions;
10619
+ }
10614
10620
  const SplitviewReact = React.forwardRef((props, ref) => {
10615
10621
  const domRef = React.useRef(null);
10616
10622
  const splitviewRef = React.useRef();
10617
10623
  const [portals, addPortal] = usePortalsLifecycle();
10618
10624
  React.useImperativeHandle(ref, () => domRef.current, []);
10625
+ const prevProps = React.useRef({});
10619
10626
  React.useEffect(() => {
10620
- var _a;
10621
- const api = createSplitview(domRef.current, {
10622
- disableAutoResizing: props.disableAutoResizing,
10623
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10624
- frameworkComponents: props.components,
10625
- frameworkWrapper: {
10626
- createComponent: (id, componentId, component) => {
10627
- return new ReactPanelView(id, componentId, component, {
10628
- addPortal,
10629
- });
10630
- },
10631
- },
10632
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10633
- ? props.proportionalLayout
10634
- : true,
10635
- styles: props.hideBorders
10636
- ? { separatorBorder: 'transparent' }
10637
- : undefined,
10627
+ const changes = {};
10628
+ PROPERTY_KEYS_SPLITVIEW.forEach((propKey) => {
10629
+ const key = propKey;
10630
+ const propValue = props[key];
10631
+ if (key in props && propValue !== prevProps.current[key]) {
10632
+ changes[key] = propValue;
10633
+ }
10638
10634
  });
10635
+ if (splitviewRef.current) {
10636
+ splitviewRef.current.updateOptions(changes);
10637
+ }
10638
+ prevProps.current = props;
10639
+ }, PROPERTY_KEYS_SPLITVIEW.map((key) => props[key]));
10640
+ React.useEffect(() => {
10641
+ if (!domRef.current) {
10642
+ return () => {
10643
+ // noop
10644
+ };
10645
+ }
10646
+ const frameworkOptions = {
10647
+ createComponent: (options) => {
10648
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10649
+ },
10650
+ };
10651
+ const api = createSplitview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$2(props)), frameworkOptions));
10639
10652
  const { clientWidth, clientHeight } = domRef.current;
10640
10653
  api.layout(clientWidth, clientHeight);
10641
10654
  if (props.onReady) {
@@ -10651,7 +10664,9 @@ const SplitviewReact = React.forwardRef((props, ref) => {
10651
10664
  return;
10652
10665
  }
10653
10666
  splitviewRef.current.updateOptions({
10654
- frameworkComponents: props.components,
10667
+ createComponent: (options) => {
10668
+ return new ReactPanelView(options.id, options.name, props.components[options.name], { addPortal });
10669
+ },
10655
10670
  });
10656
10671
  }, [props.components]);
10657
10672
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10676,36 +10691,47 @@ class ReactGridPanelView extends GridviewPanel {
10676
10691
  }
10677
10692
  }
10678
10693
 
10694
+ function extractCoreOptions$1(props) {
10695
+ const coreOptions = PROPERTY_KEYS_GRIDVIEW.reduce((obj, key) => {
10696
+ if (key in props) {
10697
+ obj[key] = props[key];
10698
+ }
10699
+ return obj;
10700
+ }, {});
10701
+ return coreOptions;
10702
+ }
10679
10703
  const GridviewReact = React.forwardRef((props, ref) => {
10680
10704
  const domRef = React.useRef(null);
10681
10705
  const gridviewRef = React.useRef();
10682
10706
  const [portals, addPortal] = usePortalsLifecycle();
10683
10707
  React.useImperativeHandle(ref, () => domRef.current, []);
10708
+ const prevProps = React.useRef({});
10709
+ React.useEffect(() => {
10710
+ const changes = {};
10711
+ PROPERTY_KEYS_GRIDVIEW.forEach((propKey) => {
10712
+ const key = propKey;
10713
+ const propValue = props[key];
10714
+ if (key in props && propValue !== prevProps.current[key]) {
10715
+ changes[key] = propValue;
10716
+ }
10717
+ });
10718
+ if (gridviewRef.current) {
10719
+ gridviewRef.current.updateOptions(changes);
10720
+ }
10721
+ prevProps.current = props;
10722
+ }, PROPERTY_KEYS_GRIDVIEW.map((key) => props[key]));
10684
10723
  React.useEffect(() => {
10685
- var _a;
10686
10724
  if (!domRef.current) {
10687
10725
  return () => {
10688
10726
  // noop
10689
10727
  };
10690
10728
  }
10691
- const api = createGridview(domRef.current, {
10692
- disableAutoResizing: props.disableAutoResizing,
10693
- proportionalLayout: typeof props.proportionalLayout === 'boolean'
10694
- ? props.proportionalLayout
10695
- : true,
10696
- orientation: (_a = props.orientation) !== null && _a !== void 0 ? _a : exports.Orientation.HORIZONTAL,
10697
- frameworkComponents: props.components,
10698
- frameworkComponentFactory: {
10699
- createComponent: (id, componentId, component) => {
10700
- return new ReactGridPanelView(id, componentId, component, {
10701
- addPortal,
10702
- });
10703
- },
10729
+ const frameworkOptions = {
10730
+ createComponent: (options) => {
10731
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10704
10732
  },
10705
- styles: props.hideBorders
10706
- ? { separatorBorder: 'transparent' }
10707
- : undefined,
10708
- });
10733
+ };
10734
+ const api = createGridview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions$1(props)), frameworkOptions));
10709
10735
  const { clientWidth, clientHeight } = domRef.current;
10710
10736
  api.layout(clientWidth, clientHeight);
10711
10737
  if (props.onReady) {
@@ -10721,7 +10747,9 @@ const GridviewReact = React.forwardRef((props, ref) => {
10721
10747
  return;
10722
10748
  }
10723
10749
  gridviewRef.current.updateOptions({
10724
- frameworkComponents: props.components,
10750
+ createComponent: (options) => {
10751
+ return new ReactGridPanelView(options.id, options.name, props.components[options.name], { addPortal });
10752
+ },
10725
10753
  });
10726
10754
  }, [props.components]);
10727
10755
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
@@ -10763,32 +10791,52 @@ class PanePanelSection {
10763
10791
  }
10764
10792
  }
10765
10793
 
10794
+ function extractCoreOptions(props) {
10795
+ const coreOptions = PROPERTY_KEYS_PANEVIEW.reduce((obj, key) => {
10796
+ if (key in props) {
10797
+ obj[key] = props[key];
10798
+ }
10799
+ return obj;
10800
+ }, {});
10801
+ return coreOptions;
10802
+ }
10766
10803
  const PaneviewReact = React.forwardRef((props, ref) => {
10767
10804
  const domRef = React.useRef(null);
10768
10805
  const paneviewRef = React.useRef();
10769
10806
  const [portals, addPortal] = usePortalsLifecycle();
10770
10807
  React.useImperativeHandle(ref, () => domRef.current, []);
10808
+ const prevProps = React.useRef({});
10771
10809
  React.useEffect(() => {
10772
- const createComponent = (id, _componentId, component) => new PanePanelSection(id, component, {
10773
- addPortal,
10810
+ const changes = {};
10811
+ PROPERTY_KEYS_PANEVIEW.forEach((propKey) => {
10812
+ const key = propKey;
10813
+ const propValue = props[key];
10814
+ if (key in props && propValue !== prevProps.current[key]) {
10815
+ changes[key] = propValue;
10816
+ }
10774
10817
  });
10775
- const api = createPaneview(domRef.current, {
10776
- disableAutoResizing: props.disableAutoResizing,
10777
- frameworkComponents: props.components,
10778
- components: {},
10779
- headerComponents: {},
10780
- disableDnd: props.disableDnd,
10781
- headerframeworkComponents: props.headerComponents,
10782
- frameworkWrapper: {
10783
- header: {
10784
- createComponent,
10785
- },
10786
- body: {
10787
- createComponent,
10788
- },
10818
+ if (paneviewRef.current) {
10819
+ paneviewRef.current.updateOptions(changes);
10820
+ }
10821
+ prevProps.current = props;
10822
+ }, PROPERTY_KEYS_PANEVIEW.map((key) => props[key]));
10823
+ React.useEffect(() => {
10824
+ var _a;
10825
+ if (!domRef.current) {
10826
+ return () => {
10827
+ // noop
10828
+ };
10829
+ }
10830
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10831
+ const frameworkOptions = {
10832
+ createComponent: (options) => {
10833
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10789
10834
  },
10790
- showDndOverlay: props.showDndOverlay,
10791
- });
10835
+ createHeaderComponent: (options) => {
10836
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10837
+ },
10838
+ };
10839
+ const api = createPaneview(domRef.current, Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
10792
10840
  const { clientWidth, clientHeight } = domRef.current;
10793
10841
  api.layout(clientWidth, clientHeight);
10794
10842
  if (props.onReady) {
@@ -10804,41 +10852,38 @@ const PaneviewReact = React.forwardRef((props, ref) => {
10804
10852
  return;
10805
10853
  }
10806
10854
  paneviewRef.current.updateOptions({
10807
- frameworkComponents: props.components,
10855
+ createComponent: (options) => {
10856
+ return new PanePanelSection(options.id, props.components[options.name], { addPortal });
10857
+ },
10808
10858
  });
10809
10859
  }, [props.components]);
10810
10860
  React.useEffect(() => {
10861
+ var _a;
10811
10862
  if (!paneviewRef.current) {
10812
10863
  return;
10813
10864
  }
10865
+ const headerComponents = (_a = props.headerComponents) !== null && _a !== void 0 ? _a : {};
10814
10866
  paneviewRef.current.updateOptions({
10815
- headerframeworkComponents: props.headerComponents,
10867
+ createHeaderComponent: (options) => {
10868
+ return new PanePanelSection(options.id, headerComponents[options.name], { addPortal });
10869
+ },
10816
10870
  });
10817
10871
  }, [props.headerComponents]);
10818
10872
  React.useEffect(() => {
10819
10873
  if (!paneviewRef.current) {
10820
10874
  return () => {
10821
- //
10875
+ // noop
10822
10876
  };
10823
10877
  }
10824
- const api = paneviewRef.current;
10825
- const disposable = api.onDidDrop((event) => {
10878
+ const disposable = paneviewRef.current.onDidDrop((event) => {
10826
10879
  if (props.onDidDrop) {
10827
- props.onDidDrop(Object.assign(Object.assign({}, event), { api }));
10880
+ props.onDidDrop(event);
10828
10881
  }
10829
10882
  });
10830
10883
  return () => {
10831
10884
  disposable.dispose();
10832
10885
  };
10833
10886
  }, [props.onDidDrop]);
10834
- React.useEffect(() => {
10835
- if (!paneviewRef.current) {
10836
- return;
10837
- }
10838
- paneviewRef.current.updateOptions({
10839
- showDndOverlay: props.showDndOverlay,
10840
- });
10841
- }, [props.showDndOverlay]);
10842
10887
  return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
10843
10888
  });
10844
10889
  PaneviewReact.displayName = 'PaneviewComponent';
@@ -10866,7 +10911,10 @@ exports.GridviewApi = GridviewApi;
10866
10911
  exports.GridviewComponent = GridviewComponent;
10867
10912
  exports.GridviewPanel = GridviewPanel;
10868
10913
  exports.GridviewReact = GridviewReact;
10869
- exports.PROPERTY_KEYS = PROPERTY_KEYS;
10914
+ exports.PROPERTY_KEYS_DOCKVIEW = PROPERTY_KEYS_DOCKVIEW;
10915
+ exports.PROPERTY_KEYS_GRIDVIEW = PROPERTY_KEYS_GRIDVIEW;
10916
+ exports.PROPERTY_KEYS_PANEVIEW = PROPERTY_KEYS_PANEVIEW;
10917
+ exports.PROPERTY_KEYS_SPLITVIEW = PROPERTY_KEYS_SPLITVIEW;
10870
10918
  exports.PaneFramework = PaneFramework;
10871
10919
  exports.PaneTransfer = PaneTransfer;
10872
10920
  exports.PanelTransfer = PanelTransfer;
@@ -10875,6 +10923,7 @@ exports.PaneviewApi = PaneviewApi;
10875
10923
  exports.PaneviewComponent = PaneviewComponent;
10876
10924
  exports.PaneviewPanel = PaneviewPanel;
10877
10925
  exports.PaneviewReact = PaneviewReact;
10926
+ exports.PaneviewUnhandledDragOverEvent = PaneviewUnhandledDragOverEvent;
10878
10927
  exports.ReactPart = ReactPart;
10879
10928
  exports.ReactPartContext = ReactPartContext;
10880
10929
  exports.Splitview = Splitview;