Support non-indexed values in annotation tables
Change-Id: I33f37c05c0b6a3ee741f9890db1e628187bc1e79
diff --git a/Changes b/Changes
index 4170cfd..fc562ce 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.60 2025-03-26
+0.60 2025-06-11
- Tour stops gracefully if there are no results (closes #189; hebasta)
- Create top navbar and modify sidebar. (uyen-nhu)
- Improve appearance of title-addon on logo. (uyen-nhu)
@@ -15,6 +15,7 @@
- Fix access of iframe location in tutorials. (diewald)
- Fix test that wrongly required SSL support. (diewald)
- URLs for plugins are mandatory (closes #233; hebasta)
+ - Support non-indexed annotations in match tables (diewald)
0.59 2025-03-28
- Docker only release (diewald)
diff --git a/dev/demo/match-tabledemo.js b/dev/demo/match-tabledemo.js
index 91607ea..0ee426c 100644
--- a/dev/demo/match-tabledemo.js
+++ b/dev/demo/match-tabledemo.js
@@ -29,10 +29,10 @@
" <span title=\"cnx/p:A\">" +
" <span title=\"cnx/syn:@PREMOD\">" +
" <span title=\"mate/l:deutlich\">" +
- " <span title=\"mate/m:degree:pos\">" +
+ " <span title=\"mate/m:degree:pos\" class=\"notinindex\">" +
" <span title=\"mate/m:case:nom\">" +
" <span title=\"mate/p:ADJD\">" +
- " <span title=\"opennlp/p:ADJD\">deutlich</span>" +
+ " <span title=\"opennlp/p:ADJD\" class=\"notinindex\">deutlich</span>" +
" </span>" +
" </span>" +
" </span>" +
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
diff --git a/dev/scss/main/view/matchtable.scss b/dev/scss/main/view/matchtable.scss
index 4bed238..6e4fa0d 100644
--- a/dev/scss/main/view/matchtable.scss
+++ b/dev/scss/main/view/matchtable.scss
@@ -64,6 +64,13 @@
}
}
+ td, div {
+ &.notinindex {
+ background-color: $ids-grey-2 !important;
+ cursor: default;
+ }
+ }
+
tr {
outline: none;