UNPKG

@wcardinal/wcardinal-geditor

Version:

WebGL-based graphic editor, tester and viewer for supervisory systems

138 lines 4.57 kB
import { __extends } from "tslib"; import { DBoard, DLayoutVertical, DList, DText, DThemes } from "@wcardinal/wcardinal-ui"; import { EDialogActionKeywordInput } from "./e-dialog-action-keyword-input"; var EDialogActionKeywordBoard = /** @class */ (function (_super) { __extends(EDialogActionKeywordBoard, _super); function EDialogActionKeywordBoard(options) { var _this = _super.call(this, options) || this; _this.addChild(new DLayoutVertical({ x: "padding", y: "padding", width: "padding", height: "padding", children: [_this.input, _this.list, _this.text] })); _this.onInputChange(""); return _this; } Object.defineProperty(EDialogActionKeywordBoard.prototype, "input", { // Input get: function () { var result = this._input; if (result == null) { result = this.newInput(); this._input = result; } return result; }, enumerable: false, configurable: true }); EDialogActionKeywordBoard.prototype.newInput = function () { var _this = this; return new EDialogActionKeywordInput({ width: "padding", on: { input: function (value) { _this.onInputChange(value); } } }); }; EDialogActionKeywordBoard.prototype.onInputChange = function (word) { this.list.data.clearAndAddAll(this.newKeywords(word)); }; EDialogActionKeywordBoard.prototype.newKeywords = function (word) { var _a; var keywords = ((_a = this._keywords) !== null && _a !== void 0 ? _a : (this._keywords = DThemes.get("EDialogAction").newKeywords())); if (0 < word.trim().length) { var filtered = []; for (var i = 0, imax = keywords.length; i < imax; ++i) { var keyword = keywords[i]; if (0 <= keyword.keyword.indexOf(word)) { filtered.push(keyword); } } return filtered; } else { return keywords; } }; Object.defineProperty(EDialogActionKeywordBoard.prototype, "list", { // List get: function () { var result = this._list; if (result == null) { result = this.newList(); this._list = result; } return result; }, enumerable: false, configurable: true }); EDialogActionKeywordBoard.prototype.newList = function () { var _this = this; return new DList({ weight: 1, width: "padding", data: { selection: { on: { change: function () { _this.onListSelectionChange(); } } }, toLabel: function (keyword) { return keyword.keyword; }, toId: function (keyword) { return keyword.keyword; } } }); }; EDialogActionKeywordBoard.prototype.onListSelectionChange = function () { var first = this.list.data.selection.first; if (first) { this.text.text = "".concat(first.keyword, ": ").concat(first.type, "\n").concat(first.description); } else { this.text.text = ""; } }; Object.defineProperty(EDialogActionKeywordBoard.prototype, "text", { // Text get: function () { var result = this._text; if (result == null) { result = this.newText(); this._text = result; } return result; }, enumerable: false, configurable: true }); EDialogActionKeywordBoard.prototype.newText = function () { return new DText({ width: "padding", height: 120, state: "READ_ONLY", text: { style: { wordWrap: "NORMAL" } }, theme: "DInputTextArea" }); }; EDialogActionKeywordBoard.prototype.getType = function () { return "DDialog"; }; return EDialogActionKeywordBoard; }(DBoard)); export { EDialogActionKeywordBoard }; //# sourceMappingURL=e-dialog-action-keyword-board.js.map