Support non-indexed values in annotation tables
Change-Id: I33f37c05c0b6a3ee741f9890db1e628187bc1e79
diff --git a/dev/js/spec/queryCreatorSpec.js b/dev/js/spec/queryCreatorSpec.js
index c3e041d..16b8c36 100644
--- a/dev/js/spec/queryCreatorSpec.js
+++ b/dev/js/spec/queryCreatorSpec.js
@@ -72,7 +72,7 @@
" <th>corenlp</th>" +
" <th>p</th>" +
" <td>ART</td>" +
- " <td>ADJA</td>" +
+ " <td class=\"notinindex\">ADJA</td>" +
" <td>ADJA<br>ADJD</td>" +
" <td class=\"matchkeyvalues mark\">" +
" <div>case:nom</div>" +
@@ -86,7 +86,7 @@
" <td class=\"matchkeyvalues\">" +
" <div>case:nom</div>" +
" <div>gender:masc</div>" +
- " <div>number:sg</div>" +
+ " <div class=\"notinindex\">number:sg</div>" +
" <div>morphemes:.::_SORSZ \\ZERO::NOM 'period::PUNCT'</div>" +
" <div>morphemes:ZERO::NOM</div>" +
" </td>" +
@@ -626,6 +626,27 @@
expect(cell.classList.contains("chosen")).toBe(false);
expect(qc.toString()).toEqual("");
+ // notinindex
+ cell = matchTable.querySelector("tbody > tr:nth-child(2) > td > div:nth-child(3)");
+ expect(cell.innerString()).toEqual("number:sg");
+ expect(cell.classList.contains("chosen")).toBe(false);
+ cell.click();
+ expect(cell.classList.contains("chosen")).toBe(false);
+ expect(qc.toString()).toEqual("");
+ cell.click()
+ expect(cell.classList.contains("chosen")).toBe(false);
+ expect(qc.toString()).toEqual("");
+
+ cell = matchTable.querySelector("tbody > tr:nth-child(1) > td.notinindex");
+ expect(cell.innerString()).toEqual("ADJA");
+ expect(cell.classList.contains("chosen")).toBe(false);
+ cell.click();
+ expect(cell.classList.contains("chosen")).toBe(false);
+ expect(qc.toString()).toEqual("");
+ cell.click()
+ expect(cell.classList.contains("chosen")).toBe(false);
+ expect(qc.toString()).toEqual("");
+
cell = matchTable.querySelector("tbody > tr:nth-child(3) > td:nth-child(3)");
expect(cell.classList.contains("chosen")).toBe(false);
cell.click();
diff --git a/dev/js/src/match/querycreator.js b/dev/js/src/match/querycreator.js
index f4b819f..12614d3 100644
--- a/dev/js/src/match/querycreator.js
+++ b/dev/js/src/match/querycreator.js
@@ -121,7 +121,7 @@
if (target.tagName == 'TD') {
- if (target.innerText == '')
+ if (target.innerText == '' || target.classList.contains("notinindex"))
return;
if (target.classList.contains('matchkeyvalues'))
@@ -154,7 +154,7 @@
// The annotation is part of a key-value-pair
else if (target.tagName == 'SPAN' || target.tagName == 'DIV') {
- if (target.innerText == '')
+ if (target.innerText == '' || target.classList.contains("notinindex"))
return;
if (target.tagName == 'SPAN') {
diff --git a/dev/js/src/match/table.js b/dev/js/src/match/table.js
index a8ccdc6..59ebf75 100644
--- a/dev/js/src/match/table.js
+++ b/dev/js/src/match/table.js
@@ -17,7 +17,8 @@
*/
const _TermRE = new RegExp("^(?:([^\/]+?)\/)?([^:]+?):(.+?)$");
const d = document;
-
+ const notinindexSuffix = "_NOTININDEX";
+
return {
/**
@@ -149,7 +150,11 @@
};
value = RegExp.$3;
-
+
+ if (c.classList.contains("notinindex")) {
+ value += notinindexSuffix;
+ };
+
if (found[foundry + "/" + layer] === undefined) {
found[foundry + "/" + layer] = [value];
}
@@ -232,7 +237,14 @@
let e, anno;
value.forEach(function(v) {
+
e = c.addE('div');
+
+ if (v.endsWith(notinindexSuffix)) {
+ v = v.slice(0, -11);
+ e.classList.add("notinindex");
+ };
+
e.addT(v);
anno = ah.getDesc(key, v);
@@ -247,6 +259,11 @@
if (value instanceof Array)
value = value[0];
+ if (value.endsWith(notinindexSuffix)) {
+ value = value.slice(0, -11);
+ c.classList.add("notinindex");
+ };
+
c.addT(value);
// Add tooltip