dockview 1.7.1 → 1.7.3

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
3
- * @version 1.7.1
3
+ * @version 1.7.3
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -4643,7 +4643,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4643
4643
  this.id = id;
4644
4644
  this.containerApi = containerApi;
4645
4645
  this.view = view;
4646
- this._title = '';
4647
4646
  this._group = group;
4648
4647
  this.api = new DockviewPanelApiImpl(this, this._group);
4649
4648
  this.addDisposables(this.api.onActiveChange(() => {
@@ -4656,8 +4655,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4656
4655
  }
4657
4656
  init(params) {
4658
4657
  this._params = params.params;
4659
- this.setTitle(params.title);
4660
4658
  this.view.init(Object.assign(Object.assign({}, params), { api: this.api, containerApi: this.containerApi }));
4659
+ this.setTitle(params.title);
4661
4660
  }
4662
4661
  focus() {
4663
4662
  this.api._onFocusEvent.fire();
@@ -4674,11 +4673,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4674
4673
  };
4675
4674
  }
4676
4675
  setTitle(title) {
4677
- var _a, _b;
4678
- const didTitleChange = title !== ((_a = this._params) === null || _a === void 0 ? void 0 : _a.title);
4676
+ const didTitleChange = title !== this.title;
4679
4677
  if (didTitleChange) {
4680
4678
  this._title = title;
4681
- (_b = this.view) === null || _b === void 0 ? void 0 : _b.update({
4679
+ this.view.update({
4682
4680
  params: {
4683
4681
  params: this._params,
4684
4682
  title: this.title,
@@ -4688,14 +4686,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4688
4686
  }
4689
4687
  }
4690
4688
  update(event) {
4691
- var _a;
4692
4689
  const params = event.params;
4693
4690
  this._params = Object.assign(Object.assign({}, (this._params || {})), event.params.params);
4694
4691
  if (params.title !== this.title) {
4695
4692
  this._title = params.title;
4696
- this.api._onDidTitleChange.fire({ title: this.title });
4693
+ this.api._onDidTitleChange.fire({ title: params.title });
4697
4694
  }
4698
- (_a = this.view) === null || _a === void 0 ? void 0 : _a.update({
4695
+ this.view.update({
4699
4696
  params: {
4700
4697
  params: this._params,
4701
4698
  title: this.title,
@@ -4833,7 +4830,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4833
4830
  return this._tab;
4834
4831
  }
4835
4832
  constructor(accessor, id, contentComponent, tabComponent) {
4836
- var _a;
4837
4833
  this.accessor = accessor;
4838
4834
  this.id = id;
4839
4835
  this.contentComponent = contentComponent;
@@ -4841,8 +4837,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4841
4837
  this._group = null;
4842
4838
  this._isPanelVisible = null;
4843
4839
  this._content = this.createContentComponent(this.id, contentComponent);
4844
- this._tab =
4845
- (_a = this.createTabComponent(this.id, tabComponent)) !== null && _a !== void 0 ? _a : new DefaultTab();
4840
+ this._tab = this.createTabComponent(this.id, tabComponent);
4846
4841
  }
4847
4842
  init(params) {
4848
4843
  this.content.init(Object.assign(Object.assign({}, params), { tab: this.tab }));
@@ -4887,8 +4882,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4887
4882
  return createComponent(id, componentName, this.accessor.options.components || {}, this.accessor.options.frameworkComponents, (_a = this.accessor.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.content);
4888
4883
  }
4889
4884
  createTabComponent(id, componentName) {
4890
- var _a;
4891
- return createComponent(id, componentName, this.accessor.options.tabComponents || {}, this.accessor.options.frameworkTabComponents, (_a = this.accessor.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
4885
+ var _a, _b;
4886
+ if (componentName) {
4887
+ return createComponent(id, componentName, this.accessor.options.tabComponents, this.accessor.options.frameworkTabComponents, (_a = this.accessor.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.tab, () => new DefaultTab());
4888
+ }
4889
+ else if (this.accessor.options.defaultTabComponent) {
4890
+ return createComponent(id, this.accessor.options.defaultTabComponent, this.accessor.options.tabComponents, this.accessor.options.frameworkTabComponents, (_b = this.accessor.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
4891
+ }
4892
+ else {
4893
+ return new DefaultTab();
4894
+ }
4892
4895
  }
4893
4896
  }
4894
4897
 
@@ -4897,7 +4900,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4897
4900
  this.layout = layout;
4898
4901
  }
4899
4902
  fromJSON(panelData, group) {
4900
- var _a, _b, _c;
4903
+ var _a;
4901
4904
  const panelId = panelData.id;
4902
4905
  const params = panelData.params;
4903
4906
  const title = panelData.title;
@@ -4908,15 +4911,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
4908
4911
  const tabComponent = viewData
4909
4912
  ? (_a = viewData.tab) === null || _a === void 0 ? void 0 : _a.id
4910
4913
  : panelData.tabComponent;
4911
- if (tabComponent) {
4912
- createComponent(panelId, tabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_b = this.layout.options.frameworkComponentFactory) === null || _b === void 0 ? void 0 : _b.tab, () => new DefaultTab());
4913
- }
4914
- else if (this.layout.options.defaultTabComponent) {
4915
- createComponent(panelId, this.layout.options.defaultTabComponent, this.layout.options.tabComponents, this.layout.options.frameworkTabComponents, (_c = this.layout.options.frameworkComponentFactory) === null || _c === void 0 ? void 0 : _c.tab, () => new DefaultTab());
4916
- }
4917
- else {
4918
- new DefaultTab();
4919
- }
4920
4914
  const view = new DockviewPanelModel(this.layout, panelId, contentComponent, tabComponent);
4921
4915
  const panel = new DockviewPanel(panelId, this.layout, new DockviewApi(this.layout), group, view);
4922
4916
  panel.init({