@@ -69,6 +69,17 @@ var __extends = (this && this.__extends) || (function () {
69
69
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
70
70
};
71
71
})();
72
+ var __rest = (this && this.__rest) || function (s, e) {
73
+ var t = {};
74
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
75
+ t[p] = s[p];
76
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
77
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
78
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
79
+ t[p[i]] = s[p[i]];
80
+ }
81
+ return t;
82
+ };
72
83
function deepClone(obj) {
73
84
var _out = new obj.constructor;
74
85
var getType = function (n) {
@@ -3834,7 +3845,7 @@ var Electro_Item = /** @class */ (function (_super) {
3834
3845
// -- Displays the Expand button for the Electro_item, in case the item is expandable --
3835
3846
Electro_Item.prototype.toHTMLFooter = function () {
3836
3847
if (this.isExpandable()) {
3837
- return (" <button title=\"Meerdere schakelaars omzetten in indivuele schakelaars \" style=\"background-color:lightblue;\" onclick=\"HLExpand(".concat(this.id, ")\">Uitpakken</button>"));
3848
+ return (" <button title=\"Meerdere elementen (bvb schakelaars) omzetten in indivuele elementen \" style=\"background-color:lightblue;\" onclick=\"HLExpand(".concat(this.id, ")\">Uitpakken</button>"));
3838
3849
}
3839
3850
else {
3840
3851
return ("");
@@ -4611,8 +4622,58 @@ var Lichtcircuit = /** @class */ (function (_super) {
4611
4622
}
4612
4623
output += ", Aantal lichtpunten: " + this.selectPropToHTML('aantal_lichtpunten', ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]);
4613
4624
output += ", Adres/tekst: " + this.stringPropToHTML('adres', 5);
4625
+ output += this.toHTMLFooter();
4614
4626
return (output);
4615
4627
};
4628
+ Lichtcircuit.prototype.countExpandableElements = function () {
4629
+ var countExpandableElements = (this.props.aantal_lichtpunten == "0") ? 0 : 1;
4630
+ switch (this.props.type_schakelaar) {
4631
+ case "enkelpolig":
4632
+ case "dubbelpolig":
4633
+ countExpandableElements += (+this.props.aantal_schakelaars);
4634
+ break;
4635
+ default:
4636
+ countExpandableElements += 1;
4637
+ }
4638
+ return countExpandableElements;
4639
+ };
4640
+ Lichtcircuit.prototype.isExpandable = function () {
4641
+ return this.countExpandableElements() > 1;
4642
+ };
4643
+ Lichtcircuit.prototype.expand = function () {
4644
+ //Nieuwe schakelaars maken, alle eigenschappen kopieren behalve type en aantal_lichtpunten
4645
+ //Het adres nemen we over van het this element
4646
+ var schakelaars = new Schakelaars(this.sourcelist);
4647
+ var _a = this.props, type = _a.type, aantal_lichtpunten = _a.aantal_lichtpunten, rest = __rest(_a, ["type", "aantal_lichtpunten"]);
4648
+ Object.assign(schakelaars.props, rest);
4649
+ schakelaars.props.adres = this.props.adres;
4650
+ if (+(this.props.aantal_lichtpunten) > 0) { // Er is minstens 1 lichtpunt
4651
+ // Eerst schakelaars in het schema hangen vlak voor het this element zodat ze een id krijgen
4652
+ this.sourcelist.insertItemBeforeId(schakelaars, this.id);
4653
+ // Dan het this element door een nieuw lichtpunt vervangen
4654
+ var lichtpunt = new Lichtpunt(this.sourcelist);
4655
+ lichtpunt.props.aantal = this.props.aantal_lichtpunten;
4656
+ lichtpunt.props.is_halfwaterdicht = this.props.is_halfwaterdicht;
4657
+ lichtpunt.id = this.id;
4658
+ if (this.getParent().props.type == "Meerdere verbruikers") {
4659
+ lichtpunt.parent = this.getParent().id;
4660
+ }
4661
+ else {
4662
+ lichtpunt.parent = schakelaars.id;
4663
+ }
4664
+ var ordinal = this.sourcelist.getOrdinalById(this.id); // Deze kan hier pas komen want de ordinal is gewijzigd door het invoegen van de schakelaars
4665
+ this.sourcelist.data[ordinal] = lichtpunt;
4666
+ }
4667
+ else { // enkel schakelaars
4668
+ // Het this element door de schakelaars vervangen
4669
+ schakelaars.id = this.id;
4670
+ schakelaars.parent = this.getParent().id;
4671
+ var ordinal = this.sourcelist.getOrdinalById(this.id);
4672
+ this.sourcelist.data[ordinal] = schakelaars;
4673
+ }
4674
+ // schakelaars uitpakken in elementen
4675
+ schakelaars.expand();
4676
+ };
4616
4677
Lichtcircuit.prototype.toSVG = function (sitplan, mirrortext) {
4617
4678
var _a;
4618
4679
if (sitplan === void 0) { sitplan = false; }
@@ -4633,7 +4694,7 @@ var Lichtcircuit = /** @class */ (function (_super) {
4633
4694
}
4634
4695
if (this.props.aantal_lichtpunten >= 1) { //1 of meerdere lampen
4635
4696
// Teken de lamp
4636
- endx = startx + 30 ;
4697
+ endx = startx + 29 ;
4637
4698
mySVG.data += '<line x1="' + startx + '" x2="' + endx + '" y1="25" y2="25" stroke="black" />'
4638
4699
+ '<use xlink:href="#lamp" x="' + endx + '" y="25" />';
4639
4700
// Teken aantal lampen en symbool 'h' voor halfwaterdicht
@@ -4654,6 +4715,7 @@ var Lichtcircuit = /** @class */ (function (_super) {
4654
4715
mySVG.data += "<text transform=\"scale(-1,1) translate(".concat(-2 * endx, ",0)\" x=\"").concat(endx, "\" y=\"10\" ").concat(textoptions, ">").concat(htmlspecialchars(print_str_upper), "</text>");
4655
4716
}
4656
4717
// Teken een leiding achter de lamp indien er nog kinderen zijn
4718
+ endx++;
4657
4719
if (this.heeftVerbruikerAlsKind())
4658
4720
mySVG.data += '<line x1="' + endx + '" y1="25" x2="' + (endx + 10) + '" y2="25" stroke="black" />';
4659
4721
// Bepaal finale Bounding Box om het geheel te tekenen
0 commit comments