dockview
Version:
Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support
100 lines • 3.97 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Watermark = void 0;
var actionsContainer_1 = require("../../../actionbar/actionsContainer");
var events_1 = require("../../../events");
var dom_1 = require("../../../dom");
var lifecycle_1 = require("../../../lifecycle");
var Watermark = /** @class */ (function (_super) {
__extends(Watermark, _super);
function Watermark() {
var _this = _super.call(this) || this;
_this._element = document.createElement('div');
_this._element.className = 'watermark';
var title = document.createElement('div');
title.className = 'watermark-title';
var emptySpace = document.createElement('span');
emptySpace.style.flexGrow = '1';
var content = document.createElement('div');
content.className = 'watermark-content';
_this._element.appendChild(title);
_this._element.appendChild(content);
var actions = new actionsContainer_1.ActionContainer();
title.appendChild(emptySpace);
title.appendChild(actions.element);
var closeAnchor = document.createElement('a');
closeAnchor.className = 'close-action';
actions.add(closeAnchor);
_this.addDisposables((0, events_1.addDisposableListener)(closeAnchor, 'click', function (ev) {
var _a;
ev.preventDefault();
if (_this.group) {
(_a = _this.params) === null || _a === void 0 ? void 0 : _a.containerApi.removeGroup(_this.group);
}
}));
return _this;
}
Object.defineProperty(Watermark.prototype, "id", {
get: function () {
return 'watermark';
},
enumerable: false,
configurable: true
});
Watermark.prototype.update = function (event) {
// noop
};
Watermark.prototype.focus = function () {
// noop
};
Watermark.prototype.toJSON = function () {
return {};
};
Watermark.prototype.layout = function (width, height) {
// noop
};
Watermark.prototype.init = function (params) {
var _this = this;
this.params = params;
this.addDisposables(this.params.containerApi.onDidLayoutChange(function (event) {
_this.render();
}));
this.render();
};
Watermark.prototype.updateParentGroup = function (group, visible) {
this.group = group;
this.render();
};
Object.defineProperty(Watermark.prototype, "element", {
get: function () {
return this._element;
},
enumerable: false,
configurable: true
});
Watermark.prototype.render = function () {
var isOneGroup = !!(this.params && this.params.containerApi.size <= 1);
(0, dom_1.toggleClass)(this.element, 'has-actions', isOneGroup);
};
Watermark.prototype.dispose = function () {
_super.prototype.dispose.call(this);
};
return Watermark;
}(lifecycle_1.CompositeDisposable));
exports.Watermark = Watermark;
//# sourceMappingURL=watermark.js.map