@wcardinal/wcardinal-geditor
Version:
WebGL-based graphic editor, tester and viewer for supervisory systems
245 lines • 9.15 kB
JavaScript
import { __extends } from "tslib";
import { DButtonCheck, DDialogLayered, DInputLabel, DInputRealAndLabel, DInputTextAndLabel, DLayoutHorizontal, DLayoutSpace, DMenu, DSelectMultiple } from "@wcardinal/wcardinal-ui";
import { EShapeButtonLayerButtonValue } from "./e-shape-button-layer-button-value";
var EDialogShapeButtonLayerValue = /** @class */ (function (_super) {
__extends(EDialogShapeButtonLayerValue, _super);
function EDialogShapeButtonLayerValue() {
return _super !== null && _super.apply(this, arguments) || this;
}
EDialogShapeButtonLayerValue.prototype.newContentChildren = function (theme, options) {
var result = _super.prototype.newContentChildren.call(this, theme, options);
result.push(this.inputLabel, this.inputWidth, this.newLayoutOf(theme.getSelectLayerLabel(), this.selectLayer), this.newLayoutOf(null, this.checkBringToFront), this.newLayoutOf(null, this.checkIsGrouped), this.newLayoutOf(null, this.checkIsActive));
return result;
};
EDialogShapeButtonLayerValue.prototype.newLayoutOf = function (label, target) {
return new DLayoutHorizontal({
width: "padding",
height: "auto",
children: [this.newLayoutLabel(label), target, this.newLayoutSpace()]
});
};
EDialogShapeButtonLayerValue.prototype.newLayoutLabel = function (label) {
if (label != null) {
return new DInputLabel({
width: 60,
text: {
value: label
}
});
}
else {
return this.newLayoutSpace();
}
};
EDialogShapeButtonLayerValue.prototype.newLayoutSpace = function () {
return new DLayoutSpace({
width: 60
});
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "inputLabel", {
get: function () {
var _a;
return ((_a = this._inputLabel) !== null && _a !== void 0 ? _a : (this._inputLabel = this.newInputLabel()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newInputLabel = function () {
var _this = this;
return new DInputTextAndLabel({
width: "padding",
height: "auto",
label: {
width: 60,
text: {
value: this.theme.getInputLabelLabel()
}
},
input: {
weight: 1,
text: {
value: ""
},
on: {
enter: function () {
_this.ok();
}
}
},
space: {
width: 60
}
});
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "inputWidth", {
get: function () {
var _a;
return ((_a = this._inputWidth) !== null && _a !== void 0 ? _a : (this._inputWidth = this.newInputWidth()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newInputWidth = function () {
var _this = this;
return new DInputRealAndLabel({
width: "padding",
height: "auto",
label: {
width: 60,
text: {
value: this.theme.getInputWidthLabel()
}
},
input: {
weight: 1,
text: {
value: 0
},
min: 0,
on: {
enter: function () {
_this.ok();
}
}
},
space: {
width: 60
}
});
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "selectLayer", {
get: function () {
var _a;
return ((_a = this._selectLayer) !== null && _a !== void 0 ? _a : (this._selectLayer = this.newSelectLayer()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newSelectLayer = function () {
return new DSelectMultiple({
weight: 1
});
};
EDialogShapeButtonLayerValue.prototype.newSelectLayerMenuItemOptions = function () {
var _a;
var diagram = (_a = this.options) === null || _a === void 0 ? void 0 : _a.diagram;
if (diagram != null) {
var canvas = diagram.canvas;
if (canvas != null) {
var result = [];
var layers = canvas.layer.children;
for (var i = layers.length - 1; 0 <= i; --i) {
var layer = layers[i];
result.push({
value: i,
text: {
value: layer.name
},
check: true
});
}
return result;
}
}
return [];
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "checkBringToFront", {
get: function () {
var _a;
return ((_a = this._checkBringToFront) !== null && _a !== void 0 ? _a : (this._checkBringToFront = this.newCheckBringToFront()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newCheckBringToFront = function () {
return new DButtonCheck({
weight: 1,
text: {
value: this.theme.getCheckBringToFromLabel(),
align: {
horizontal: "LEFT"
}
}
});
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "checkIsGrouped", {
get: function () {
var _a;
return ((_a = this._checkIsGrouped) !== null && _a !== void 0 ? _a : (this._checkIsGrouped = this.newCheckIsGrouped()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newCheckIsGrouped = function () {
return new DButtonCheck({
weight: 1,
text: {
value: this.theme.getCheckIsGroupedLabel(),
align: {
horizontal: "LEFT"
}
}
});
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "checkIsActive", {
get: function () {
var _a;
return ((_a = this._checkIsActive) !== null && _a !== void 0 ? _a : (this._checkIsActive = this.newCheckIsActive()));
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.newCheckIsActive = function () {
return new DButtonCheck({
weight: 1,
text: {
value: this.theme.getCheckIsActiveLabel(),
align: {
horizontal: "LEFT"
}
}
});
};
EDialogShapeButtonLayerValue.prototype.reset = function () {
this.inputLabel.input.value = this.theme.newInputLabel();
this.inputWidth.input.value = 1;
this.selectLayer.values = [];
this.selectLayer.menu = new DMenu({
fit: true,
items: this.newSelectLayerMenuItemOptions()
});
this.checkBringToFront.state.isActive = false;
this.checkIsGrouped.state.isActive = true;
return this;
};
Object.defineProperty(EDialogShapeButtonLayerValue.prototype, "value", {
get: function () {
return new EShapeButtonLayerButtonValue(this.inputLabel.input.value, this.inputWidth.input.value, this.selectLayer.values.slice(0), this.checkBringToFront.state.isActive, this.checkIsGrouped.state.isActive, this.checkIsActive.state.isActive);
},
set: function (value) {
this.selectLayer.menu = new DMenu({
fit: true,
items: this.newSelectLayerMenuItemOptions()
});
if (value != null) {
this.inputLabel.input.value = value.label;
this.inputWidth.input.value = value.weight;
this.selectLayer.values = value.layers;
this.checkBringToFront.state.isActive = value.bringToFront;
this.checkIsGrouped.state.isActive = value.isGrouped;
this.checkIsActive.state.isActive = value.isActive;
}
},
enumerable: false,
configurable: true
});
EDialogShapeButtonLayerValue.prototype.getResolvedValue = function () {
return this.value;
};
EDialogShapeButtonLayerValue.prototype.getType = function () {
return "EDialogShapeButtonLayerValue";
};
return EDialogShapeButtonLayerValue;
}(DDialogLayered));
export { EDialogShapeButtonLayerValue };
//# sourceMappingURL=e-dialog-shape-button-layer-value.js.map