Skip to content

Commit 94f2ca9

Browse files
committed
Laat toe schakelaars en lichtcircuit uit te pakken tijdens het bewerken van symbooleigenschappen in het situatieschema
1 parent 3088f2f commit 94f2ca9

File tree

4 files changed

+61
-11
lines changed

4 files changed

+61
-11
lines changed

builddate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var CONF_builddate="20250122-195057"
1+
var CONF_builddate="20250122-203525"

eendraadschema.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ var ElectroItemZoeker = /** @class */ (function () {
18011801
* 4. De ElectroItem wordt toegevoegd met de volgende structuur: {id: number, kringnaam: string, adres: string, type: string}
18021802
*/
18031803
ElectroItemZoeker.prototype.reCalculate = function () {
1804+
this.data = [];
18041805
for (var i = 0; i < structure.length; i++) {
18051806
if (structure.active[i]) {
18061807
var id = structure.id[i];
@@ -3428,20 +3429,43 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement, callbackOK) {
34283429
}
34293430
;
34303431
}
3432+
function handleExpandButton(electroItemId) {
3433+
if (electroItemId === void 0) { electroItemId = null; }
3434+
if (electroItemId == null)
3435+
return;
3436+
var element = structure.getElectroItemById(electroItemId);
3437+
if (element == null)
3438+
return;
3439+
element.expand();
3440+
adressen.reCalculate();
3441+
kringnamen = adressen.getUniqueKringnaam();
3442+
IdFieldChanged();
3443+
}
34313444
/**
34323445
* Toon het type verbruiker van het gekozen electro-item
34333446
*/
34343447
function updateElectroType() {
3435-
if (textInput.value == null || textInput.value.trim() == '')
3448+
if (textInput.value == null || textInput.value.trim() == '') {
34363449
feedback.innerHTML = '<span style="color: red;">Geen ID ingegeven</span>';
3450+
expandButton.style.display = 'none';
3451+
}
34373452
else {
3438-
var id = Number(textInput.value);
3439-
var element = structure.getElectroItemById(id);
3453+
var electroItemId_1 = Number(textInput.value);
3454+
var element = structure.getElectroItemById(electroItemId_1);
34403455
if (element != null) {
3456+
var type = element.getType();
34413457
feedback.innerHTML = '<span style="color:green;">' + element.getType() + '</span>';
3458+
if (element.isExpandable()) {
3459+
expandButton.style.display = 'block';
3460+
feedback.innerHTML += '<br><span style="color: black;">Klik op uitpakken indien u de onderliggende elementen in het situatieschema wil kunnen plaatsen.</span>';
3461+
expandButton.onclick = function () { handleExpandButton(electroItemId_1); };
3462+
}
3463+
else
3464+
expandButton.style.display = 'none';
34423465
}
34433466
else {
34443467
feedback.innerHTML = '<span style="color: red;">Element niet gevonden</span>';
3468+
expandButton.style.display = 'none';
34453469
}
34463470
}
34473471
}
@@ -3500,7 +3524,7 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement, callbackOK) {
35003524
* Eerst maken we de pop-up
35013525
*/
35023526
var div = document.createElement('div');
3503-
div.innerHTML = "\n <div id=\"popupOverlay\" style=\"position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; visibility: hidden; z-index: 9999;\">\n <div id=\"popupWindow\" style=\"width: 400px; background-color: white; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; justify-content: space-between;\">\n <div id=\"selectKringContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Kring:</label>\n <select id=\"selectKring\"></select>\n </div>\n <div id=\"selectElectroItemContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Element:</label>\n <select id=\"selectElectroItemBox\"></select>\n </div>\n <div id=\"textContainer\" style=\"display: flex; margin-bottom: 30px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">ID:</label>\n <input id=\"textInput\" style=\"width: 100px;\" type=\"number\" min=\"0\" step=\"1\" value=\"\">\n <div id=\"feedback\" style=\"margin-left: 10px; width: 100%; font-size: 12px\"></div>\n </div>\n <div id=\"selectContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Label type:</label>\n <select id=\"selectAdresType\">\n <option value=\"auto\">Automatisch</option>\n <option value=\"manueel\">Handmatig</option>\n </select>\n </div>\n <div id=\"adresContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Label tekst:</label>\n <input id=\"adresInput\" style=\"width: 100%;\" type=\"text\" value=\"\">\n <select id=\"selectAdresLocation\" style=\"margin-left: 10px; display: inline-block;\">\n <option value=\"links\">Links</option>\n <option value=\"rechts\">Rechts</option>\n <option value=\"boven\">Boven</option>\n <option value=\"onder\">Onder</option>\n </select>\n </div>\n <div id=\"fontSizeContainer\" style=\"display: flex; margin-bottom: 30px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Tekengrootte (px):</label>\n <input id=\"fontSizeInput\" style=\"width: 100px;\" type=\"number\" min=\"1\" max=\"72\" step=\"11\" value=\"11\">\n </div> \n <div style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Schaal (%):</label>\n <input id=\"scaleInput\" style=\"width: 100px;\" type=\"number\" min=\"10\" max=\"400\" step=\"10\" value=\"".concat(String(SITPLANVIEW_DEFAULT_SCALE * 100), "\">\n </div>\n <div style=\"display: flex; margin-bottom: 20px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Rotatie (\u00B0):</label>\n <input id=\"rotationInput\" style=\"width: 100px;\" type=\"number\" min=\"0\" max=\"360\" step=\"10\" value=\"0\">\n </div>\n <div id=\"setDefaultContainer\" style=\"display: flex; margin-bottom: 20px; align-items: flex-start;\">\n <input type=\"checkbox\" id=\"setDefaultCheckbox\">\n ").concat((sitplanElement == null) || ((sitplanElement != null) && (sitplanElement.getElectroItemId() != null))
3527+
div.innerHTML = "\n <div id=\"popupOverlay\" style=\"position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; visibility: hidden; z-index: 9999;\">\n <div id=\"popupWindow\" style=\"width: 500px; background-color: white; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; justify-content: space-between;\">\n <div id=\"selectKringContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Kring:</label>\n <select id=\"selectKring\"></select>\n </div>\n <div id=\"selectElectroItemContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Element:</label>\n <select id=\"selectElectroItemBox\"></select><span style=\"display: inline-block; width: 10px;\"></span>\n <button id=\"expandButton\" title=\"Omzetten in indivuele elementen\" style=\"background-color:lightblue;\">Uitpakken</button>\n </div>\n <div id=\"textContainer\" style=\"display: flex; margin-bottom: 30px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">ID:</label>\n <input id=\"textInput\" style=\"width: 100px;\" type=\"number\" min=\"0\" step=\"1\" value=\"\">\n <div id=\"feedback\" style=\"margin-left: 10px; width: 100%; font-size: 12px\"></div>\n </div>\n <div id=\"selectContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Label type:</label>\n <select id=\"selectAdresType\">\n <option value=\"auto\">Automatisch</option>\n <option value=\"manueel\">Handmatig</option>\n </select>\n </div>\n <div id=\"adresContainer\" style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Label tekst:</label>\n <input id=\"adresInput\" style=\"width: 100%;\" type=\"text\" value=\"\">\n <select id=\"selectAdresLocation\" style=\"margin-left: 10px; display: inline-block;\">\n <option value=\"links\">Links</option>\n <option value=\"rechts\">Rechts</option>\n <option value=\"boven\">Boven</option>\n <option value=\"onder\">Onder</option>\n </select>\n </div>\n <div id=\"fontSizeContainer\" style=\"display: flex; margin-bottom: 30px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block; white-space: nowrap;\">Tekengrootte (px):</label>\n <input id=\"fontSizeInput\" style=\"width: 100px;\" type=\"number\" min=\"1\" max=\"72\" step=\"11\" value=\"11\">\n </div> \n <div style=\"display: flex; margin-bottom: 10px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Schaal (%):</label>\n <input id=\"scaleInput\" style=\"width: 100px;\" type=\"number\" min=\"10\" max=\"400\" step=\"10\" value=\"".concat(String(SITPLANVIEW_DEFAULT_SCALE * 100), "\">\n </div>\n <div style=\"display: flex; margin-bottom: 20px; align-items: center;\">\n <label style=\"margin-right: 10px; display: inline-block;\">Rotatie (\u00B0):</label>\n <input id=\"rotationInput\" style=\"width: 100px;\" type=\"number\" min=\"0\" max=\"360\" step=\"10\" value=\"0\">\n </div>\n <div id=\"setDefaultContainer\" style=\"display: flex; margin-bottom: 20px; align-items: flex-start;\">\n <input type=\"checkbox\" id=\"setDefaultCheckbox\">\n ").concat((sitplanElement == null) || ((sitplanElement != null) && (sitplanElement.getElectroItemId() != null))
35043528
? "<label for=\"checkbox\" style=\"margin-left: 10px; flex-grow: 1; flex-wrap: wrap;\">Zet tekengrootte en schaal als standaard voor alle toekomstige nieuwe symbolen.</label>"
35053529
: "<label for=\"checkbox\" style=\"margin-left: 10px; flex-grow: 1; flex-wrap: wrap;\">Zet schaal als standaard voor alle toekomstige nieuwe symbolen.</label>", " \n </div>\n <div style=\"display: flex; justify-content: center;\">\n <button id=\"okButton\" style=\"margin-right: 10px;\">OK</button>\n <button id=\"cancelButton\" style=\"margin-keft: 10px;\">Cancel</button>\n </div>\n </div>\n </div>");
35063530
var popupOverlay = div.querySelector('#popupOverlay');
@@ -3509,6 +3533,7 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement, callbackOK) {
35093533
var selectKring = popupWindow.querySelector('#selectKring');
35103534
var selectElectroItemContainer = popupWindow.querySelector('#selectElectroItemContainer');
35113535
var selectElectroItemBox = popupWindow.querySelector('#selectElectroItemBox');
3536+
var expandButton = popupWindow.querySelector('#expandButton');
35123537
var textContainer = popupWindow.querySelector('#textContainer');
35133538
var textInput = popupWindow.querySelector('#textInput');
35143539
var feedback = popupWindow.querySelector('#feedback');

src/sitplan/ElectroItemZoeker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ElectroItemZoeker {
6666
*/
6767

6868
reCalculate() {
69+
this.data = [];
6970
for (let i = 0; i<structure.length; i++) {
7071
if (structure.active[i]) {
7172
let id:number = structure.id[i];

src/sitplan/SituationPlanView_ElementPropertiesPopup.ts

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,41 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement: SituationPlanE
177177
};
178178
}
179179

180+
function handleExpandButton(electroItemId: number = null) {
181+
if (electroItemId == null) return;
182+
183+
let element = structure.getElectroItemById(electroItemId);
184+
if (element == null) return;
185+
186+
element.expand();
187+
188+
adressen.reCalculate();
189+
kringnamen = adressen.getUniqueKringnaam();
190+
191+
IdFieldChanged();
192+
}
193+
180194
/**
181195
* Toon het type verbruiker van het gekozen electro-item
182196
*/
183197
function updateElectroType() {
184-
if (textInput.value == null || textInput.value.trim() == '')
198+
if (textInput.value == null || textInput.value.trim() == '') {
185199
feedback.innerHTML = '<span style="color: red;">Geen ID ingegeven</span>';
186-
else {
187-
let id = Number(textInput.value);
188-
let element = structure.getElectroItemById(id) as Electro_Item;
200+
expandButton.style.display = 'none';
201+
} else {
202+
let electroItemId = Number(textInput.value);
203+
let element = structure.getElectroItemById(electroItemId) as Electro_Item;
189204
if (element != null) {
205+
const type = element.getType();
190206
feedback.innerHTML = '<span style="color:green;">' + element.getType() + '</span>';
207+
if (element.isExpandable()) {
208+
expandButton.style.display = 'block';
209+
feedback.innerHTML += '<br><span style="color: black;">Klik op uitpakken indien u de onderliggende elementen in het situatieschema wil kunnen plaatsen.</span>';
210+
expandButton.onclick = () => { handleExpandButton(electroItemId) };
211+
} else expandButton.style.display = 'none';
191212
} else {
192213
feedback.innerHTML = '<span style="color: red;">Element niet gevonden</span>';
214+
expandButton.style.display = 'none';
193215
}
194216
}
195217
}
@@ -258,14 +280,15 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement: SituationPlanE
258280

259281
div.innerHTML = `
260282
<div id="popupOverlay" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; justify-content: center; align-items: center; visibility: hidden; z-index: 9999;">
261-
<div id="popupWindow" style="width: 400px; background-color: white; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; justify-content: space-between;">
283+
<div id="popupWindow" style="width: 500px; background-color: white; padding: 20px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; justify-content: space-between;">
262284
<div id="selectKringContainer" style="display: flex; margin-bottom: 10px; align-items: center;">
263285
<label style="margin-right: 10px; display: inline-block;">Kring:</label>
264286
<select id="selectKring"></select>
265287
</div>
266288
<div id="selectElectroItemContainer" style="display: flex; margin-bottom: 10px; align-items: center;">
267289
<label style="margin-right: 10px; display: inline-block;">Element:</label>
268-
<select id="selectElectroItemBox"></select>
290+
<select id="selectElectroItemBox"></select><span style="display: inline-block; width: 10px;"></span>
291+
<button id="expandButton" title="Omzetten in indivuele elementen" style="background-color:lightblue;">Uitpakken</button>
269292
</div>
270293
<div id="textContainer" style="display: flex; margin-bottom: 30px; align-items: center;">
271294
<label style="margin-right: 10px; display: inline-block;">ID:</label>
@@ -321,6 +344,7 @@ function SituationPlanView_ElementPropertiesPopup(sitplanElement: SituationPlanE
321344
const selectKring = popupWindow.querySelector('#selectKring') as HTMLSelectElement;
322345
const selectElectroItemContainer = popupWindow.querySelector('#selectElectroItemContainer') as HTMLSelectElement;
323346
const selectElectroItemBox = popupWindow.querySelector('#selectElectroItemBox') as HTMLSelectElement;
347+
const expandButton = popupWindow.querySelector('#expandButton') as HTMLButtonElement;
324348
const textContainer = popupWindow.querySelector('#textContainer') as HTMLElement;
325349
const textInput = popupWindow.querySelector('#textInput') as HTMLInputElement;
326350
const feedback = popupWindow.querySelector('#feedback') as HTMLElement;

0 commit comments

Comments
 (0)