@@ -7,6 +7,7 @@ var canvassplit;
7
7
var canvaslayout = "default" ;
8
8
var bomlayout = "default" ;
9
9
var highlightedRefs = [ ] ;
10
+ var bomCheckboxes = "" ;
10
11
11
12
function readStorage ( key ) {
12
13
return window . localStorage . getItem ( storagePrefix + '#' + key ) ;
@@ -81,6 +82,41 @@ function populateBomTable() {
81
82
while ( bom . firstChild ) {
82
83
bom . removeChild ( bom . firstChild ) ;
83
84
}
85
+ while ( bomhead . firstChild ) {
86
+ bomhead . removeChild ( bomhead . firstChild ) ;
87
+ }
88
+ // Populate header
89
+ var tr = document . createElement ( "TR" ) ;
90
+ var td = document . createElement ( "TH" ) ;
91
+ td . classList . add ( "numCol" ) ;
92
+ tr . appendChild ( td ) ;
93
+ checkboxes = bomCheckboxes . split ( "," ) ;
94
+ for ( checkbox of checkboxes ) {
95
+ if ( checkbox ) {
96
+ td = document . createElement ( "TH" ) ;
97
+ td . classList . add ( "bom-checkbox" ) ;
98
+ td . innerHTML = checkbox ;
99
+ tr . appendChild ( td ) ;
100
+ }
101
+ }
102
+ td = document . createElement ( "TH" ) ;
103
+ td . classList . add ( "References" ) ;
104
+ td . innerHTML = "References" ;
105
+ tr . appendChild ( td ) ;
106
+ td = document . createElement ( "TH" ) ;
107
+ td . classList . add ( "Value" ) ;
108
+ td . innerHTML = "Value" ;
109
+ tr . appendChild ( td ) ;
110
+ td = document . createElement ( "TH" ) ;
111
+ td . classList . add ( "Footprint" ) ;
112
+ td . innerHTML = "Footprint" ;
113
+ tr . appendChild ( td ) ;
114
+ td = document . createElement ( "TH" ) ;
115
+ td . classList . add ( "Quantity" ) ;
116
+ td . innerHTML = "Quantity" ;
117
+ tr . appendChild ( td ) ;
118
+ bomhead . appendChild ( tr ) ;
119
+ // Populate table body
84
120
var first = true ;
85
121
switch ( canvaslayout ) {
86
122
case 'F' :
@@ -111,6 +147,16 @@ function populateBomTable() {
111
147
tr . id = "bomrow" + rownum ;
112
148
td . textContent = rownum ;
113
149
tr . appendChild ( td ) ;
150
+ // Checkboxes
151
+ for ( checkbox of checkboxes ) {
152
+ if ( checkbox ) {
153
+ td = document . createElement ( "TD" ) ;
154
+ input = document . createElement ( "input" ) ;
155
+ input . type = "checkbox" ;
156
+ td . appendChild ( input ) ;
157
+ tr . appendChild ( td ) ;
158
+ }
159
+ }
114
160
// References
115
161
td = document . createElement ( "TD" ) ;
116
162
td . innerHTML = highlightFilter ( references . join ( ", " ) ) ;
@@ -185,7 +231,7 @@ function changeCanvasLayout(layout) {
185
231
canvaslayout = layout ;
186
232
writeStorage ( "canvaslayout" , layout ) ;
187
233
resizeAll ( ) ;
188
- populateBomTable ( layout ) ;
234
+ populateBomTable ( ) ;
189
235
}
190
236
191
237
function populateMetadata ( ) {
@@ -289,11 +335,18 @@ function cleanGutters() {
289
335
removeGutterNode ( document . getElementById ( "canvasdiv" ) ) ;
290
336
}
291
337
338
+ function setBomCheckboxes ( value ) {
339
+ bomCheckboxes = value ;
340
+ writeStorage ( "bomCheckboxes" , value ) ;
341
+ populateBomTable ( ) ;
342
+ }
343
+
292
344
window . onload = function ( e ) {
293
345
cleanGutters ( ) ;
294
346
initRender ( ) ;
295
347
dbgdiv = document . getElementById ( "dbg" ) ;
296
348
bom = document . getElementById ( "bombody" ) ;
349
+ bomhead = document . getElementById ( "bomhead" ) ;
297
350
bomlayout = readStorage ( "bomlayout" ) ;
298
351
if ( ! bomlayout ) {
299
352
bomlayout = "LR" ;
@@ -305,6 +358,11 @@ window.onload = function(e) {
305
358
filter = "" ;
306
359
reflookup = "" ;
307
360
populateMetadata ( ) ;
361
+ bomCheckboxes = readStorage ( "bomCheckboxes" ) ;
362
+ if ( bomCheckboxes === null ) {
363
+ bomCheckboxes = "Sourced,Placed" ;
364
+ }
365
+ document . getElementById ( "bomCheckboxes" ) . value = bomCheckboxes ;
308
366
changeBomLayout ( bomlayout ) ;
309
367
if ( readStorage ( "silkscreenVisible" ) === "false" ) {
310
368
document . getElementById ( "silkscreenCheckbox" ) . checked = false ;
0 commit comments