@jswf/core
Version:
JavaScript Window Framework
57 lines • 2.07 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 (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var BaseView_1 = require("./BaseView");
require("../scss/Label.scss");
var Label = /** @class */ (function (_super) {
__extends(Label, _super);
function Label(text) {
var _this = _super.call(this) || this;
_this.setJwfStyle("Label");
var client = _this.getClient();
var node = document.createElement("div");
_this.node = node;
client.appendChild(node);
var nodeText = document.createElement("span");
node.appendChild(nodeText);
_this.nodeText = nodeText;
if (text)
_this.setText(text);
_this.setAutoSize(true);
return _this;
}
Label.prototype.setFontSize = function (size) {
var nodeText = this.nodeText;
nodeText.style.fontSize = size + "px";
this.layout();
};
Label.prototype.setText = function (text) {
var nodeText = this.nodeText;
nodeText.innerText = text;
};
Label.prototype.getText = function () {
return this.nodeText.innerText;
};
Label.prototype.getTextNode = function () {
return this.nodeText;
};
Label.prototype.setAlign = function (style) {
var node = this.node;
node.style.justifyContent = style;
};
return Label;
}(BaseView_1.BaseView));
exports.Label = Label;
//# sourceMappingURL=Label.js.map