UNPKG

@wcardinal/wcardinal-geditor

Version:

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

291 lines 10.6 kB
import { __extends } from "tslib"; import { DDialogLayered, DInputLabel, DInputReal, DInputText, DLayoutHorizontal, DLayoutSpace, DSelect, EShapeTextAlignHorizontal } from "@wcardinal/wcardinal-ui"; import { EShapeTableColumnValue, EShapeTableColumnValueType } from "./e-shape-table-column-value"; import { EShapeTableColumnValueBody } from "./e-shape-table-column-value-body"; import { EShapeTableColumnValueHeader } from "./e-shape-table-column-value-header"; var EDialogTableColumn = /** @class */ (function (_super) { __extends(EDialogTableColumn, _super); function EDialogTableColumn() { return _super !== null && _super.apply(this, arguments) || this; } EDialogTableColumn.prototype.newContentChildren = function (theme, options) { var _this = this; var result = _super.prototype.newContentChildren.call(this, theme, options); // Type result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getSelectColumnValueTypeLabel() } }), new DSelect({ weight: 1, value: EShapeTableColumnValueType.TEXT, menu: { items: [ { value: EShapeTableColumnValueType.TEXT, text: { value: theme.toSelectColumnValueTypeLabel(EShapeTableColumnValueType.TEXT) } }, { value: EShapeTableColumnValueType.NUMBER, text: { value: theme.toSelectColumnValueTypeLabel(EShapeTableColumnValueType.NUMBER) } } ] }, on: { init: function (self) { _this._selectType = self; } } }), new DLayoutSpace({ width: 60 }) ] })); // Label result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getInputLabelLabel() } }), new DInputText({ weight: 1, text: { value: "" }, on: { init: function (self) { _this._inputLabel = self; }, enter: function () { _this.ok(); } } }), new DLayoutSpace({ width: 60 }) ] })); // Width Weight result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getInputWidthLabel() } }), new DInputReal({ weight: 1, text: { value: 0 }, min: 0, on: { init: function (self) { _this._inputWidth = self; }, enter: function () { _this.ok(); } } }), new DLayoutSpace({ width: 60 }) ] })); // Getter / setter result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getInputGetterLabel() } }), new DInputText({ weight: 1, text: { value: "" }, on: { init: function (self) { _this._inputGetter = self; }, enter: function () { _this.ok(); } } }), new DLayoutSpace({ width: 60 }) ] })); result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getInputSetterLabel() } }), new DInputText({ weight: 1, text: { value: "" }, on: { init: function (self) { _this._inputSetter = self; }, enter: function () { _this.ok(); } } }), new DLayoutSpace({ width: 60 }) ] })); // Format result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getInputFormatLabel() } }), new DInputText({ weight: 1, text: { value: "" }, on: { init: function (self) { _this._inputFormat = self; }, enter: function () { _this.ok(); } } }), new DLayoutSpace({ width: 60 }) ] })); // Align result.push(new DLayoutHorizontal({ width: "padding", height: "auto", children: [ new DInputLabel({ width: 60, text: { value: theme.getSelectTextAlignLabel() } }), new DSelect({ weight: 1, value: EShapeTextAlignHorizontal.CENTER, menu: { items: [ { value: EShapeTextAlignHorizontal.LEFT, text: { value: theme.toTextAlignLabel(EShapeTextAlignHorizontal.LEFT) } }, { value: EShapeTextAlignHorizontal.CENTER, text: { value: theme.toTextAlignLabel(EShapeTextAlignHorizontal.CENTER) } }, { value: EShapeTextAlignHorizontal.RIGHT, text: { value: theme.toTextAlignLabel(EShapeTextAlignHorizontal.RIGHT) } } ] }, on: { init: function (self) { _this._selectAlign = self; } } }), new DLayoutSpace({ width: 60 }) ] })); return result; }; EDialogTableColumn.prototype.reset = function () { this._selectType.value = EShapeTableColumnValueType.TEXT; this._inputLabel.value = this.theme.newInputLabel(); this._inputWidth.value = 1; this._inputGetter.value = ""; this._inputSetter.value = ""; this._inputFormat.value = ""; this._selectAlign.value = EShapeTextAlignHorizontal.CENTER; return this; }; Object.defineProperty(EDialogTableColumn.prototype, "value", { get: function () { return new EShapeTableColumnValue(this._inputWidth.value, this._selectType.value || EShapeTableColumnValueType.TEXT, this._inputGetter.value, this._inputSetter.value, this._inputFormat.value, this._selectAlign.value || EShapeTextAlignHorizontal.LEFT, new EShapeTableColumnValueHeader(this._inputLabel.value), new EShapeTableColumnValueBody()); }, set: function (value) { if (value != null) { this._selectType.value = value.type; this._inputLabel.value = value.header.label; this._inputWidth.value = value.weight; this._inputGetter.value = value.getter; this._inputSetter.value = value.setter; this._inputFormat.value = value.format; this._selectAlign.value = value.align; } }, enumerable: false, configurable: true }); EDialogTableColumn.prototype.getResolvedValue = function () { return this.value; }; EDialogTableColumn.prototype.getType = function () { return "EDialogShapeTableColumn"; }; return EDialogTableColumn; }(DDialogLayered)); export { EDialogTableColumn }; //# sourceMappingURL=e-dialog-shape-table-column.js.map