Skip to content

Commit 292314f

Browse files
committed
fix ref attribute
1 parent b94e8d9 commit 292314f

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

InteractiveHtmlBom/web/ibom.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,25 @@ function highlightFilter(s) {
362362
return r;
363363
}
364364

365+
function getSelectedBomList() {
366+
if (settings.bommode == "netlist") {
367+
return pcbdata.nets.slice();
368+
}
369+
var out = [];
370+
switch (settings.canvaslayout) {
371+
case 'F':
372+
out = pcbdata.bom.F.slice();
373+
break;
374+
case 'FB':
375+
out = pcbdata.bom.both.slice();
376+
break;
377+
case 'B':
378+
out = pcbdata.bom.B.slice();
379+
break;
380+
}
381+
return (settings.bommode == "ungrouped") ? out.flat() : out;
382+
}
383+
365384
function checkboxSetUnsetAllHandler(checkboxname) {
366385
return function () {
367386
var checkboxnum = 0;
@@ -619,31 +638,9 @@ function populateBomBody(placeholderColumn = null, placeHolderElements = null) {
619638
var first = true;
620639
var style = getComputedStyle(topmostdiv);
621640
var defaultNetColor = style.getPropertyValue('--track-color').trim();
622-
if (settings.bommode == "netlist") {
623-
bomtable = pcbdata.nets.slice();
624-
} else {
625-
switch (settings.canvaslayout) {
626-
case 'F':
627-
bomtable = pcbdata.bom.F.slice();
628-
break;
629-
case 'FB':
630-
bomtable = pcbdata.bom.both.slice();
631-
break;
632-
case 'B':
633-
bomtable = pcbdata.bom.B.slice();
634-
break;
635-
}
636-
if (settings.bommode == "ungrouped") {
637-
// expand bom table
638-
expandedTable = []
639-
for (var bomentry of bomtable) {
640-
for (var ref of bomentry) {
641-
expandedTable.push([ref]);
642-
}
643-
}
644-
bomtable = expandedTable;
645-
}
646-
}
641+
642+
bomtable = getSelectedBomList();
643+
647644
if (bomSortFunction) {
648645
bomtable = bomtable.sort(bomSortFunction);
649646
}
@@ -1294,10 +1291,10 @@ function topToggle() {
12941291
}
12951292

12961293
window.onload = function (e) {
1297-
initUtils();
12981294
initRender();
12991295
initStorage();
13001296
initDefaults();
1297+
initUtils();
13011298
cleanGutters();
13021299
populateMetadata();
13031300
dbgdiv = document.getElementById("dbg");

InteractiveHtmlBom/web/util.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ function initUtils() {
206206
if (config.fields.includes("Value")) {
207207
var index = config.fields.indexOf("Value");
208208
pcbdata.bom["parsedValues"] = {};
209+
var bomList = getSelectedBomList().flat();
209210
for (var id in pcbdata.bom.fields) {
210-
pcbdata.bom.parsedValues[id] = parseValue(pcbdata.bom.fields[id][index])
211+
var ref_row = bomList.find(item => item[1] == id) || [];
212+
pcbdata.bom.parsedValues[id] = parseValue(pcbdata.bom.fields[id][index], ref_row[0] ||'');
211213
}
212214
}
213215
}

0 commit comments

Comments
 (0)