Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 1 | /** |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 2 | * Table representation of token-based |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 3 | * annotations of a match. |
| 4 | */ |
Akron | e51eaa3 | 2020-11-10 09:35:53 +0100 | [diff] [blame] | 5 | "use strict"; |
| 6 | |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 7 | define([ |
| 8 | 'match/querycreator', |
| 9 | "util" |
| 10 | ], function (matchQueryCreator) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 11 | |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 12 | /* |
| 13 | * TODO: |
| 14 | * Create base object for all matchinfo classes! |
| 15 | * TODO: |
| 16 | * Rename to match/annotationtable |
| 17 | */ |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 18 | const _TermRE = new RegExp("^(?:([^\/]+?)\/)?([^:]+?):(.+?)$"); |
| 19 | const d = document; |
| 20 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 21 | return { |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * Create new table view for a match |
| 25 | * based on a snippet string. |
| 26 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 27 | create : function (snippet) { |
| 28 | return Object.create(this)._init(snippet); |
| 29 | }, |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 30 | |
| 31 | // Initialize table based on snippet |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 32 | _init : function (snippet) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 33 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 34 | // Create html for traversal |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 35 | const html = d.createElement("div"); |
| 36 | const t = this; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 37 | html.innerHTML = snippet; |
| 38 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 39 | t._pos = 0; |
| 40 | t._token = []; |
| 41 | t._mark = []; |
| 42 | t._markE = undefined; |
| 43 | t._cutted = []; |
| 44 | t._info = []; |
| 45 | t._foundry = {}; |
| 46 | t._layer = {}; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 47 | |
| 48 | // Parse the snippet |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 49 | t._parse(html.childNodes, false); |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 50 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 51 | html.innerHTML = ''; |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 52 | return t; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 53 | }, |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 54 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 55 | |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 56 | // TODO: Destroy match! |
| 57 | destroy : function () { |
| 58 | this._matchCreator = undefined; |
| 59 | }, |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 60 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 61 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 62 | /** |
| 63 | * Length of the table (columns), |
| 64 | * aka the number of tokens |
| 65 | * in the snippet. |
| 66 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 67 | length : function () { |
| 68 | return this._pos; |
| 69 | }, |
| 70 | |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Move the viewport to the match |
| 74 | */ |
| 75 | toMark : function () { |
| 76 | if (this._markE === undefined) |
| 77 | return; |
| 78 | this._markE.scrollIntoView({ |
| 79 | inline: "start", |
| 80 | block: "nearest" |
| 81 | }); |
| 82 | }, |
| 83 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 84 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 85 | /** |
| 86 | * Get the token in the snippet |
| 87 | * At a given position. |
| 88 | * |
| 89 | * @param pos |
| 90 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 91 | getToken : function (pos) { |
| 92 | if (pos === undefined) |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 93 | return this._token; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 94 | return this._token[pos]; |
| 95 | }, |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 96 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 97 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 98 | /** |
| 99 | * Get the annotation of a token |
| 100 | * in the snippet based on the position, |
| 101 | * the foundry, and the layer. |
| 102 | * |
| 103 | * @param pos |
| 104 | * @param foundry |
| 105 | * @param layer |
| 106 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 107 | getValue : function (pos, foundry, layer) { |
| 108 | return this._info[pos][foundry + '/' + layer] |
| 109 | }, |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 110 | |
Akron | aeceda7 | 2018-02-02 20:44:06 +0100 | [diff] [blame] | 111 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 112 | // Parse the snippet |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 113 | _parse : function (children, mark) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 114 | |
| 115 | // Get all children |
Akron | 678c26f | 2020-10-09 08:52:50 +0200 | [diff] [blame] | 116 | children.forEach(function(c) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 117 | const t = this; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 118 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 119 | // Create object on position unless it exists |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 120 | if (t._info[t._pos] === undefined) { |
| 121 | t._info[t._pos] = {}; |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 122 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 123 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 124 | // Store at position in foundry/layer as array |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 125 | const found = t._info[t._pos]; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 126 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 127 | // Element with title |
| 128 | if (c.nodeType === 1) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 129 | let newMark = mark; |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 130 | |
| 131 | if (c.tagName === 'MARK') { |
| 132 | newMark = true; |
| 133 | } |
| 134 | |
Akron | 083ec57 | 2019-05-16 18:30:40 +0200 | [diff] [blame] | 135 | else if (c.hasAttribute("title") && |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 136 | _TermRE.exec(c.getAttribute("title"))) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 137 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 138 | // Fill position with info |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 139 | let foundry, layer, value; |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 140 | if (RegExp.$2) { |
| 141 | foundry = RegExp.$1; |
| 142 | layer = RegExp.$2; |
| 143 | } |
| 144 | else { |
| 145 | foundry = "base"; |
| 146 | layer = RegExp.$1 |
| 147 | }; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 148 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 149 | value = RegExp.$3; |
| 150 | |
| 151 | if (found[foundry + "/" + layer] === undefined) { |
| 152 | found[foundry + "/" + layer] = [value]; |
| 153 | } |
| 154 | else { |
Akron | 3b253d3 | 2018-07-15 10:16:06 +0200 | [diff] [blame] | 155 | // if (found[foundry + "/" + layer].indexOf(value) === -1) { |
| 156 | if (!found[foundry + "/" + layer].includes(value)) { |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 157 | // Push value to foundry/layer at correct position |
| 158 | found[foundry + "/" + layer].push(value); |
| 159 | }; |
| 160 | } |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 161 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 162 | // Set foundry |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 163 | if (t._foundry[foundry] === undefined) |
| 164 | t._foundry[foundry] = {}; |
| 165 | t._foundry[foundry][layer] = 1; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 166 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 167 | // Set layer |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 168 | if (t._layer[layer] === undefined) |
| 169 | t._layer[layer] = {}; |
| 170 | t._layer[layer][foundry] = 1; |
Akron | 083ec57 | 2019-05-16 18:30:40 +0200 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | // The current position marks a cut |
| 174 | else if (c.hasAttribute("class") && c.getAttribute("class") == "cutted") { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 175 | t._cutted.push(t._pos); |
| 176 | t._token[t._pos++] = ""; |
Akron | 083ec57 | 2019-05-16 18:30:40 +0200 | [diff] [blame] | 177 | } |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 178 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 179 | // depth search |
| 180 | if (c.hasChildNodes()) |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 181 | t._parse(c.childNodes, newMark); |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 182 | } |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 183 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 184 | // Leaf node |
| 185 | // store string on position and go to next string |
| 186 | else if (c.nodeType === 3) { |
Akron | 158fce1 | 2019-12-17 14:43:29 +0100 | [diff] [blame] | 187 | if (c.nodeValue.match(/[a-z0-9\u25ae]/iu)) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 188 | t._mark[t._pos] = mark ? true : false; |
| 189 | t._token[t._pos++] = c.nodeValue; |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 190 | }; |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 191 | }; |
Akron | 678c26f | 2020-10-09 08:52:50 +0200 | [diff] [blame] | 192 | }, this); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 193 | |
| 194 | delete this._info[this._pos]; |
| 195 | }, |
| 196 | |
| 197 | |
| 198 | /** |
| 199 | * Get HTML table view of annotations. |
| 200 | */ |
| 201 | element : function () { |
| 202 | if (this._element !== undefined) |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 203 | return this._element; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 204 | |
| 205 | // First the legend table |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 206 | const wrap = d.createElement('div'); |
Akron | aeceda7 | 2018-02-02 20:44:06 +0100 | [diff] [blame] | 207 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 208 | const table = wrap.addE('table'); |
Akron | aeceda7 | 2018-02-02 20:44:06 +0100 | [diff] [blame] | 209 | |
| 210 | this._element = wrap; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 211 | |
| 212 | // Single row in head |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 213 | let tr = table.addE('thead').addE('tr'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 214 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 215 | const ah = KorAP.annotationHelper || { "getDesc" : function () {}}; |
| 216 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 217 | // Add cell to row |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 218 | const addCell = function (type, key, value) { |
| 219 | const c = this.addE(type); |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 220 | |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 221 | if (value === undefined) |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 222 | return c; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 223 | |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 224 | if (key && value instanceof Array && value[1] !== undefined) { |
Akron | 4e47d0b | 2017-07-03 17:58:37 +0200 | [diff] [blame] | 225 | |
| 226 | // There are multiple values to add |
Akron | 856af1e | 2017-07-03 19:57:46 +0200 | [diff] [blame] | 227 | c.classList.add('matchkeyvalues'); |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 228 | |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 229 | let e, anno; |
| 230 | value.forEach(function(v) { |
| 231 | e = c.addE('div'); |
| 232 | e.addT(v); |
| 233 | |
| 234 | anno = ah.getDesc(key, v); |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 235 | |
| 236 | if (anno) |
| 237 | e.setAttribute("title", anno); |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 238 | }); |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 239 | } |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 240 | |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 241 | else { |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 242 | |
| 243 | if (value instanceof Array) |
| 244 | value = value[0]; |
| 245 | |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 246 | c.addT(value); |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 247 | |
| 248 | // Add tooltip |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 249 | const anno = ah.getDesc(key, value); |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 250 | if (anno) |
| 251 | c.setAttribute("title", anno); |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 252 | }; |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 253 | |
| 254 | return c; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | tr.addCell = addCell; |
| 258 | |
| 259 | // Add header information |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 260 | tr.addCell('th', undefined, 'Foundry'); |
| 261 | tr.addCell('th', undefined, 'Layer'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 262 | |
| 263 | // Add tokens |
Akron | 678c26f | 2020-10-09 08:52:50 +0200 | [diff] [blame] | 264 | Object.keys(this._token).forEach(function(i) { |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 265 | const surface = this.getToken(i); |
| 266 | const c = tr.addCell('th', undefined, surface); |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 267 | if (this._mark[i]) { |
| 268 | c.classList.add('mark'); |
| 269 | if (this._markE === undefined) { |
| 270 | this._markE = c; |
| 271 | }; |
Akron | 083ec57 | 2019-05-16 18:30:40 +0200 | [diff] [blame] | 272 | } |
Akron | 1a780fe | 2019-05-21 15:59:00 +0200 | [diff] [blame] | 273 | else if (this._cutted[0] == i || this._cutted[1] == i) { |
Akron | 083ec57 | 2019-05-16 18:30:40 +0200 | [diff] [blame] | 274 | c.classList.add('cutted'); |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 275 | }; |
Akron | 5dc3117 | 2019-05-15 18:43:48 +0200 | [diff] [blame] | 276 | |
| 277 | // In case the title is very long - add a title attribute |
| 278 | if (surface.length > 20) { |
| 279 | c.setAttribute("title", surface) |
| 280 | } |
Akron | 678c26f | 2020-10-09 08:52:50 +0200 | [diff] [blame] | 281 | }, this); |
Akron | 916ec25 | 2016-11-10 17:06:32 +0100 | [diff] [blame] | 282 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 283 | const tbody = table.addE('tbody'); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 284 | |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 285 | let layerList, key, v, value, cell; |
| 286 | |
Akron | ff1b1f3 | 2020-10-18 11:41:29 +0200 | [diff] [blame] | 287 | Object.keys(this._foundry).sort().forEach(function(foundry) { |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 288 | let layerList = |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 289 | Object.keys(this._foundry[foundry]).sort(); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 290 | |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 291 | layerList.forEach(function(layer) { |
| 292 | |
Akron | 0b489ad | 2018-02-02 16:49:32 +0100 | [diff] [blame] | 293 | tr = tbody.addE('tr'); |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 294 | tr.setAttribute('tabindex', 0); |
| 295 | tr.addCell = addCell; |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 296 | tr.addCell('th', undefined, foundry); |
| 297 | tr.addCell('th', undefined, layer); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 298 | |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 299 | key = foundry + '/' + layer + '='; |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 300 | |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 301 | for (v = 0; v < this.length(); v++) { |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 302 | |
| 303 | // Get the cell value |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 304 | value = this.getValue(v, foundry, layer); |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 305 | |
| 306 | // Add cell to row |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 307 | cell = tr.addCell( |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 308 | 'td', |
Akron | f2279c4 | 2017-12-21 13:48:46 +0100 | [diff] [blame] | 309 | key, |
Akron | 8005599 | 2017-12-20 16:30:52 +0100 | [diff] [blame] | 310 | value |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 311 | ); |
Akron | ad1e46a | 2018-09-19 15:55:40 +0200 | [diff] [blame] | 312 | |
| 313 | if (this._mark[v]) { |
| 314 | cell.classList.add('mark'); |
| 315 | }; |
Akron | 99713ef | 2017-06-28 18:19:28 +0200 | [diff] [blame] | 316 | }; |
Akron | b50964a | 2020-10-12 11:44:37 +0200 | [diff] [blame] | 317 | }, this); |
| 318 | }, this); |
Akron | b6685bb | 2018-02-04 00:44:47 +0100 | [diff] [blame] | 319 | |
| 320 | // Add query creator |
| 321 | this._matchCreator = matchQueryCreator.create(this._element); |
| 322 | |
Akron | aeceda7 | 2018-02-02 20:44:06 +0100 | [diff] [blame] | 323 | return this._element; |
| 324 | }, |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 325 | }; |
| 326 | }); |