UNPKG

@jswf/core

Version:

JavaScript Window Framework

62 lines 2.4 kB
"use strict"; 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/CheckBox.scss"); var CheckBox = /** @class */ (function (_super) { __extends(CheckBox, _super); function CheckBox(params) { var _this = _super.call(this) || this; _this.setJwfStyle("CheckBox"); _this.setAutoSize(true); var client = _this.getClient(); var node = document.createElement("div"); client.appendChild(node); var textArea = document.createElement("label"); node.appendChild(textArea); var nodeCheck = document.createElement("input"); _this.nodeCheck = nodeCheck; nodeCheck.type = "checkbox"; textArea.appendChild(nodeCheck); if (params && params.checked != null) nodeCheck.checked = params.checked; var nodeText = document.createElement("span"); _this.nodeText = nodeText; textArea.appendChild(nodeText); if (params && params.text) _this.setText(params.text); return _this; } CheckBox.prototype.isCheck = function () { return this.nodeCheck.checked; }; CheckBox.prototype.setCheck = function (check) { this.nodeCheck.checked = check; }; CheckBox.prototype.setText = function (text) { var nodeText = this.nodeText; nodeText.textContent = text; }; CheckBox.prototype.getText = function () { var nodeText = this.nodeText; return nodeText.textContent; }; CheckBox.prototype.getTextNode = function () { return this.nodeText; }; return CheckBox; }(BaseView_1.BaseView)); exports.CheckBox = CheckBox; //# sourceMappingURL=CheckBox.js.map