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