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
  }
@@ -14,17 +14,6 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
17
  Object.defineProperty(exports, "__esModule", { value: true });
29
18
  exports.DefaultTab = void 0;
30
19
  var lifecycle_1 = require("../../../lifecycle");
@@ -34,20 +23,15 @@ var DefaultTab = /** @class */ (function (_super) {
34
23
  __extends(DefaultTab, _super);
35
24
  function DefaultTab() {
36
25
  var _this = _super.call(this) || this;
37
- //
38
- _this.params = {};
39
26
  _this._element = document.createElement('div');
40
27
  _this._element.className = 'dv-default-tab';
41
- //
42
28
  _this._content = document.createElement('div');
43
29
  _this._content.className = 'dv-default-tab-content';
44
30
  _this.action = document.createElement('div');
45
31
  _this.action.className = 'dv-default-tab-action';
46
32
  _this.action.appendChild((0, svg_1.createCloseButton)());
47
- //
48
33
  _this._element.appendChild(_this._content);
49
34
  _this._element.appendChild(_this.action);
50
- //
51
35
  _this.addDisposables((0, events_1.addDisposableListener)(_this.action, 'mousedown', function (ev) {
52
36
  ev.preventDefault();
53
37
  }));
@@ -61,34 +45,27 @@ var DefaultTab = /** @class */ (function (_super) {
61
45
  enumerable: false,
62
46
  configurable: true
63
47
  });
64
- DefaultTab.prototype.update = function (event) {
65
- this.params = __assign(__assign({}, this.params), event.params);
66
- this.render();
67
- };
68
- DefaultTab.prototype.focus = function () {
69
- //noop
70
- };
71
48
  DefaultTab.prototype.init = function (params) {
72
49
  var _this = this;
73
- this.params = params;
74
- this._content.textContent = params.title;
75
- (0, events_1.addDisposableListener)(this.action, 'click', function (ev) {
76
- ev.preventDefault(); //
77
- _this.params.api.close();
78
- });
79
- };
80
- DefaultTab.prototype.onGroupChange = function (_group) {
81
- this.render();
82
- };
83
- DefaultTab.prototype.onPanelVisibleChange = function (_isPanelVisible) {
50
+ this._title = params.title;
51
+ this.addDisposables(params.api.onDidTitleChange(function (event) {
52
+ _this._title = event.title;
53
+ _this.render();
54
+ }), (0, events_1.addDisposableListener)(this.action, 'mousedown', function (ev) {
55
+ ev.preventDefault();
56
+ }), (0, events_1.addDisposableListener)(this.action, 'click', function (ev) {
57
+ if (ev.defaultPrevented) {
58
+ return;
59
+ }
60
+ ev.preventDefault();
61
+ params.api.close();
62
+ }));
84
63
  this.render();
85
64
  };
86
- DefaultTab.prototype.layout = function (_width, _height) {
87
- // noop
88
- };
89
65
  DefaultTab.prototype.render = function () {
90
- if (this._content.textContent !== this.params.title) {
91
- this._content.textContent = this.params.title;
66
+ var _a;
67
+ if (this._content.textContent !== this._title) {
68
+ this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';
92
69
  }
93
70
  };
94
71
  return DefaultTab;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * dockview-core
3
- * @version 1.14.1
3
+ * @version 1.14.2
4
4
  * @link https://github.com/mathuo/dockview
5
5
  * @license MIT
6
6
  */
@@ -6207,52 +6207,40 @@ define(['exports'], (function (exports) { 'use strict';
6207
6207
  }
6208
6208
  constructor() {
6209
6209
  super();
6210
- //
6211
- this.params = {};
6212
6210
  this._element = document.createElement('div');
6213
6211
  this._element.className = 'dv-default-tab';
6214
- //
6215
6212
  this._content = document.createElement('div');
6216
6213
  this._content.className = 'dv-default-tab-content';
6217
6214
  this.action = document.createElement('div');
6218
6215
  this.action.className = 'dv-default-tab-action';
6219
6216
  this.action.appendChild(createCloseButton());
6220
- //
6221
6217
  this._element.appendChild(this._content);
6222
6218
  this._element.appendChild(this.action);
6223
- //
6224
6219
  this.addDisposables(addDisposableListener(this.action, 'mousedown', (ev) => {
6225
6220
  ev.preventDefault();
6226
6221
  }));
6227
6222
  this.render();
6228
6223
  }
6229
- update(event) {
6230
- this.params = Object.assign(Object.assign({}, this.params), event.params);
6231
- this.render();
6232
- }
6233
- focus() {
6234
- //noop
6235
- }
6236
6224
  init(params) {
6237
- this.params = params;
6238
- this._content.textContent = params.title;
6239
- addDisposableListener(this.action, 'click', (ev) => {
6240
- ev.preventDefault(); //
6241
- this.params.api.close();
6242
- });
6243
- }
6244
- onGroupChange(_group) {
6245
- this.render();
6246
- }
6247
- onPanelVisibleChange(_isPanelVisible) {
6225
+ this._title = params.title;
6226
+ this.addDisposables(params.api.onDidTitleChange((event) => {
6227
+ this._title = event.title;
6228
+ this.render();
6229
+ }), addDisposableListener(this.action, 'mousedown', (ev) => {
6230
+ ev.preventDefault();
6231
+ }), addDisposableListener(this.action, 'click', (ev) => {
6232
+ if (ev.defaultPrevented) {
6233
+ return;
6234
+ }
6235
+ ev.preventDefault();
6236
+ params.api.close();
6237
+ }));
6248
6238
  this.render();
6249
6239
  }
6250
- layout(_width, _height) {
6251
- // noop
6252
- }
6253
6240
  render() {
6254
- if (this._content.textContent !== this.params.title) {
6255
- this._content.textContent = this.params.title;
6241
+ var _a;
6242
+ if (this._content.textContent !== this._title) {
6243
+ this._content.textContent = (_a = this._title) !== null && _a !== void 0 ? _a : '';
6256
6244
  }
6257
6245
  }
6258
6246
  }