dockview-core 1.14.1 → 1.14.2

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,19 +1,12 @@
1
1
  import { CompositeDisposable } from '../../../lifecycle';
2
2
  import { ITabRenderer, GroupPanelPartInitParameters } from '../../types';
3
- import { PanelUpdateEvent } from '../../../panel/types';
4
- import { DockviewGroupPanel } from '../../dockviewGroupPanel';
5
3
  export declare class DefaultTab extends CompositeDisposable implements ITabRenderer {
6
4
  private _element;
7
5
  private _content;
8
6
  private action;
9
- private params;
7
+ private _title;
10
8
  get element(): HTMLElement;
11
9
  constructor();
12
- update(event: PanelUpdateEvent): void;
13
- focus(): void;
14
10
  init(params: GroupPanelPartInitParameters): void;
15
- onGroupChange(_group: DockviewGroupPanel): void;
16
- onPanelVisibleChange(_isPanelVisible: boolean): void;
17
- layout(_width: number, _height: number): void;
18
11
  private render;
19
12
  }
@@ -7,52 +7,40 @@ export class DefaultTab extends CompositeDisposable {
7
7
  }
8
8
  constructor() {
9
9
  super();
10
- //
11
- this.params = {};
12
10
  this._element = document.createElement('div');
13
11
  this._element.className = 'dv-default-tab';
14
- //
15
12
  this._content = document.createElement('div');
16
13
  this._content.className = 'dv-default-tab-content';
17
14
  this.action = document.createElement('div');
18
15
  this.action.className = 'dv-default-tab-action';
19
16
  this.action.appendChild(createCloseButton());
20
- //
21
17
  this._element.appendChild(this._content);
22
18
  this._element.appendChild(this.action);
23
- //
24
19
  this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
25
20
  ev.preventDefault();
26
21
  }));
27
22
  this.render();
28
23
  }
29
- update(event) {
30
- this.params = Object.assign(Object.assign({}, this.params), event.params);
31
- this.render();
32
- }
33
- focus() {
34
- //noop
35
- }
36
24
  init(params) {
37
- this.params = params;
38
- this._content.textContent = params.title;
39
- addDisposableListener(this.action, 'click', (ev) => {
40
- ev.preventDefault(); //
41
- this.params.api.close();
42
- });
43
- }
44
- onGroupChange(_group) {
45
- this.render();
46
- }
47
- onPanelVisibleChange(_isPanelVisible) {
25
+ this._title = params.title;
26
+ this.addDisposables(params.api.onDidTitleChange((event) => {
27
+ this._title = event.title;
28
+ this.render();
29
+ }), addDisposableListener(this.action, 'mousedown', (ev) => {
30
+ ev.preventDefault();
31
+ }), addDisposableListener(this.action, 'click', (ev) => {
32
+ if (ev.defaultPrevented) {
33
+ return;
34
+ }
35
+ ev.preventDefault();
36
+ params.api.close();
37
+ }));
48
38
  this.render();
49
39
  }
50
- layout(_width, _height) {
51
- // noop
52
- }
53
40
  render() {
54
- if (this._content.textContent !== this.params.title) {
55
- this._content.textContent = this.params.title;
41
+ var _a;
42
+ if (this._content.textContent !== this._title) {
43
+ this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';
56
44
  }
57
45
  }
58
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dockview-core",
3
- "version": "1.14.1",
3
+ "version": "1.14.2",
4
4
  "description": "Zero dependency layout manager supporting tabs, grids and splitviews",
5
5
  "keywords": [
6
6
  "splitview",