@jswf/core
Version:
JavaScript Window Framework
54 lines • 2.1 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/SelectBox.scss");
var SelectBox = /** @class */ (function (_super) {
__extends(SelectBox, _super);
function SelectBox(option) {
var _this = _super.call(this) || this;
_this.setJwfStyle("SelectBox");
_this.setSize(80, 0);
_this.setAutoSize(true);
var node = _this.getClient();
var select = document.createElement("select");
_this.select = select;
select.name = name;
var options = option.options;
for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
var o = options_1[_i];
var opNode = document.createElement("option");
opNode.textContent = o.label;
opNode.value = o.value;
select.appendChild(opNode);
}
node.appendChild(select);
var event = option.event;
if (event) {
for (var _a = 0, _b = Object.keys(event); _a < _b.length; _a++) {
var key = _b[_a];
var proc = event[key];
select.addEventListener(key, proc);
}
}
return _this;
}
SelectBox.prototype.getValue = function () {
return this.select.value;
};
return SelectBox;
}(BaseView_1.BaseView));
exports.SelectBox = SelectBox;
//# sourceMappingURL=SelectBox.js.map