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