@teselagen/ui 0.10.18 → 0.10.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PromptUnsavedChanges/index.d.ts +3 -3
- package/index.cjs.js +30 -6
- package/index.es.js +30 -6
- package/index.umd.js +30 -6
- package/package.json +5 -4
- package/src/DataTable/FilterAndSortMenu.js +2 -2
- package/src/DataTable/utils/filterLocalEntitiesToHasura.js +17 -0
- package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +199 -0
- package/src/PromptUnsavedChanges/index.js +1 -4
- package/src/autoTooltip.js +10 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const defaultMessagge: "Are you sure you want to leave? There are unsaved changes.";
|
|
2
|
+
export default PromptUnsavedChanges;
|
|
3
|
+
declare function PromptUnsavedChanges({ message, when }: {
|
|
2
4
|
message?: string | undefined;
|
|
3
5
|
when?: boolean | undefined;
|
|
4
6
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
-
export const defaultMessagge: "Are you sure you want to leave? There are unsaved changes.";
|
|
6
|
-
export default PromptUnsavedChanges;
|
package/index.cjs.js
CHANGED
|
@@ -2923,6 +2923,13 @@ document.addEventListener("mouseup", () => {
|
|
|
2923
2923
|
isDragging = false;
|
|
2924
2924
|
});
|
|
2925
2925
|
let tippys = [];
|
|
2926
|
+
function isInAllowedContainer(element2) {
|
|
2927
|
+
if (window.onlyAllowTooltipsInVeEditor) {
|
|
2928
|
+
return element2.closest(".veEditor") !== null;
|
|
2929
|
+
}
|
|
2930
|
+
return true;
|
|
2931
|
+
}
|
|
2932
|
+
__name(isInAllowedContainer, "isInAllowedContainer");
|
|
2926
2933
|
let recentlyHidden = false;
|
|
2927
2934
|
let clearMe;
|
|
2928
2935
|
(function() {
|
|
@@ -2930,6 +2937,9 @@ let clearMe;
|
|
|
2930
2937
|
document.addEventListener("mouseover", function(event) {
|
|
2931
2938
|
var _a, _b;
|
|
2932
2939
|
const element2 = event.target;
|
|
2940
|
+
if (!isInAllowedContainer(element2)) {
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2933
2943
|
if (element2 instanceof Element && element2 !== lastMouseOverElement) {
|
|
2934
2944
|
let clearOldTippys = /* @__PURE__ */ __name(function(maybeInst) {
|
|
2935
2945
|
tippys = tippys.filter((t2) => {
|
|
@@ -20122,6 +20132,23 @@ function applyWhereClause(records, where) {
|
|
|
20122
20132
|
if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
|
|
20123
20133
|
return false;
|
|
20124
20134
|
break;
|
|
20135
|
+
case "_in":
|
|
20136
|
+
if (!some(conditionValue, (item) => isEqual(value, item)))
|
|
20137
|
+
return false;
|
|
20138
|
+
break;
|
|
20139
|
+
case "_nin":
|
|
20140
|
+
if (some(conditionValue, (item) => isEqual(value, item)))
|
|
20141
|
+
return false;
|
|
20142
|
+
break;
|
|
20143
|
+
case "_regex": {
|
|
20144
|
+
try {
|
|
20145
|
+
if (!isString$1(value) || !new RegExp(conditionValue).test(value))
|
|
20146
|
+
return false;
|
|
20147
|
+
} catch (e) {
|
|
20148
|
+
return false;
|
|
20149
|
+
}
|
|
20150
|
+
break;
|
|
20151
|
+
}
|
|
20125
20152
|
default:
|
|
20126
20153
|
if (operator.startsWith("_")) {
|
|
20127
20154
|
console.warn(`Unsupported operator: ${operator}`);
|
|
@@ -51100,7 +51127,7 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
|
|
|
51100
51127
|
filterValToUse = false;
|
|
51101
51128
|
} else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
|
|
51102
51129
|
if (dataType === "number") {
|
|
51103
|
-
filterValToUse = filterValue && filterValue.map((val) => parseFloat(val
|
|
51130
|
+
filterValToUse = filterValue && filterValue.map((val) => parseFloat(`${val}`.replaceAll(",", "")));
|
|
51104
51131
|
}
|
|
51105
51132
|
}
|
|
51106
51133
|
if (isInvalidFilterValue(filterValToUse)) {
|
|
@@ -51206,7 +51233,7 @@ const FilterInput = /* @__PURE__ */ __name(({
|
|
|
51206
51233
|
multi: true,
|
|
51207
51234
|
creatable: true,
|
|
51208
51235
|
value: (filterValue || []).map((val) => ({
|
|
51209
|
-
label: val
|
|
51236
|
+
label: `${val}`,
|
|
51210
51237
|
value: val
|
|
51211
51238
|
})),
|
|
51212
51239
|
onChange: /* @__PURE__ */ __name((selectedOptions) => {
|
|
@@ -67652,10 +67679,7 @@ const warnBeforeLeave = /* @__PURE__ */ __name((e) => {
|
|
|
67652
67679
|
(e || window.event).returnValue = defaultMessagge;
|
|
67653
67680
|
return defaultMessagge;
|
|
67654
67681
|
}, "warnBeforeLeave");
|
|
67655
|
-
function PromptUnsavedChanges({
|
|
67656
|
-
message = defaultMessagge,
|
|
67657
|
-
when = false
|
|
67658
|
-
}) {
|
|
67682
|
+
function PromptUnsavedChanges({ message = defaultMessagge, when = false }) {
|
|
67659
67683
|
React.useEffect(() => {
|
|
67660
67684
|
if (when) {
|
|
67661
67685
|
window.addEventListener("beforeunload", warnBeforeLeave);
|
package/index.es.js
CHANGED
|
@@ -2905,6 +2905,13 @@ document.addEventListener("mouseup", () => {
|
|
|
2905
2905
|
isDragging = false;
|
|
2906
2906
|
});
|
|
2907
2907
|
let tippys = [];
|
|
2908
|
+
function isInAllowedContainer(element2) {
|
|
2909
|
+
if (window.onlyAllowTooltipsInVeEditor) {
|
|
2910
|
+
return element2.closest(".veEditor") !== null;
|
|
2911
|
+
}
|
|
2912
|
+
return true;
|
|
2913
|
+
}
|
|
2914
|
+
__name(isInAllowedContainer, "isInAllowedContainer");
|
|
2908
2915
|
let recentlyHidden = false;
|
|
2909
2916
|
let clearMe;
|
|
2910
2917
|
(function() {
|
|
@@ -2912,6 +2919,9 @@ let clearMe;
|
|
|
2912
2919
|
document.addEventListener("mouseover", function(event) {
|
|
2913
2920
|
var _a, _b;
|
|
2914
2921
|
const element2 = event.target;
|
|
2922
|
+
if (!isInAllowedContainer(element2)) {
|
|
2923
|
+
return;
|
|
2924
|
+
}
|
|
2915
2925
|
if (element2 instanceof Element && element2 !== lastMouseOverElement) {
|
|
2916
2926
|
let clearOldTippys = /* @__PURE__ */ __name(function(maybeInst) {
|
|
2917
2927
|
tippys = tippys.filter((t2) => {
|
|
@@ -20104,6 +20114,23 @@ function applyWhereClause(records, where) {
|
|
|
20104
20114
|
if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
|
|
20105
20115
|
return false;
|
|
20106
20116
|
break;
|
|
20117
|
+
case "_in":
|
|
20118
|
+
if (!some(conditionValue, (item) => isEqual(value, item)))
|
|
20119
|
+
return false;
|
|
20120
|
+
break;
|
|
20121
|
+
case "_nin":
|
|
20122
|
+
if (some(conditionValue, (item) => isEqual(value, item)))
|
|
20123
|
+
return false;
|
|
20124
|
+
break;
|
|
20125
|
+
case "_regex": {
|
|
20126
|
+
try {
|
|
20127
|
+
if (!isString$1(value) || !new RegExp(conditionValue).test(value))
|
|
20128
|
+
return false;
|
|
20129
|
+
} catch (e) {
|
|
20130
|
+
return false;
|
|
20131
|
+
}
|
|
20132
|
+
break;
|
|
20133
|
+
}
|
|
20107
20134
|
default:
|
|
20108
20135
|
if (operator.startsWith("_")) {
|
|
20109
20136
|
console.warn(`Unsupported operator: ${operator}`);
|
|
@@ -51082,7 +51109,7 @@ const FilterAndSortMenu = /* @__PURE__ */ __name(({
|
|
|
51082
51109
|
filterValToUse = false;
|
|
51083
51110
|
} else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
|
|
51084
51111
|
if (dataType === "number") {
|
|
51085
|
-
filterValToUse = filterValue && filterValue.map((val) => parseFloat(val
|
|
51112
|
+
filterValToUse = filterValue && filterValue.map((val) => parseFloat(`${val}`.replaceAll(",", "")));
|
|
51086
51113
|
}
|
|
51087
51114
|
}
|
|
51088
51115
|
if (isInvalidFilterValue(filterValToUse)) {
|
|
@@ -51188,7 +51215,7 @@ const FilterInput = /* @__PURE__ */ __name(({
|
|
|
51188
51215
|
multi: true,
|
|
51189
51216
|
creatable: true,
|
|
51190
51217
|
value: (filterValue || []).map((val) => ({
|
|
51191
|
-
label: val
|
|
51218
|
+
label: `${val}`,
|
|
51192
51219
|
value: val
|
|
51193
51220
|
})),
|
|
51194
51221
|
onChange: /* @__PURE__ */ __name((selectedOptions) => {
|
|
@@ -67634,10 +67661,7 @@ const warnBeforeLeave = /* @__PURE__ */ __name((e) => {
|
|
|
67634
67661
|
(e || window.event).returnValue = defaultMessagge;
|
|
67635
67662
|
return defaultMessagge;
|
|
67636
67663
|
}, "warnBeforeLeave");
|
|
67637
|
-
function PromptUnsavedChanges({
|
|
67638
|
-
message = defaultMessagge,
|
|
67639
|
-
when = false
|
|
67640
|
-
}) {
|
|
67664
|
+
function PromptUnsavedChanges({ message = defaultMessagge, when = false }) {
|
|
67641
67665
|
useEffect(() => {
|
|
67642
67666
|
if (when) {
|
|
67643
67667
|
window.addEventListener("beforeunload", warnBeforeLeave);
|
package/index.umd.js
CHANGED
|
@@ -2918,6 +2918,13 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2918
2918
|
isDragging = false;
|
|
2919
2919
|
});
|
|
2920
2920
|
let tippys = [];
|
|
2921
|
+
function isInAllowedContainer(element2) {
|
|
2922
|
+
if (window.onlyAllowTooltipsInVeEditor) {
|
|
2923
|
+
return element2.closest(".veEditor") !== null;
|
|
2924
|
+
}
|
|
2925
|
+
return true;
|
|
2926
|
+
}
|
|
2927
|
+
__name(isInAllowedContainer, "isInAllowedContainer");
|
|
2921
2928
|
let recentlyHidden = false;
|
|
2922
2929
|
let clearMe;
|
|
2923
2930
|
(function() {
|
|
@@ -2925,6 +2932,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2925
2932
|
document.addEventListener("mouseover", function(event) {
|
|
2926
2933
|
var _a2, _b2;
|
|
2927
2934
|
const element2 = event.target;
|
|
2935
|
+
if (!isInAllowedContainer(element2)) {
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2928
2938
|
if (element2 instanceof Element && element2 !== lastMouseOverElement) {
|
|
2929
2939
|
let clearOldTippys = /* @__PURE__ */ __name(function(maybeInst) {
|
|
2930
2940
|
tippys = tippys.filter((t2) => {
|
|
@@ -44779,6 +44789,23 @@ ${latestSubscriptionCallbackError.current.stack}
|
|
|
44779
44789
|
if (!isString$1(value) || !new RegExp(conditionValue.replace(/%/g, ".*")).test(value))
|
|
44780
44790
|
return false;
|
|
44781
44791
|
break;
|
|
44792
|
+
case "_in":
|
|
44793
|
+
if (!some(conditionValue, (item) => isEqual(value, item)))
|
|
44794
|
+
return false;
|
|
44795
|
+
break;
|
|
44796
|
+
case "_nin":
|
|
44797
|
+
if (some(conditionValue, (item) => isEqual(value, item)))
|
|
44798
|
+
return false;
|
|
44799
|
+
break;
|
|
44800
|
+
case "_regex": {
|
|
44801
|
+
try {
|
|
44802
|
+
if (!isString$1(value) || !new RegExp(conditionValue).test(value))
|
|
44803
|
+
return false;
|
|
44804
|
+
} catch (e) {
|
|
44805
|
+
return false;
|
|
44806
|
+
}
|
|
44807
|
+
break;
|
|
44808
|
+
}
|
|
44782
44809
|
default:
|
|
44783
44810
|
if (operator.startsWith("_")) {
|
|
44784
44811
|
console.warn(`Unsupported operator: ${operator}`);
|
|
@@ -78535,7 +78562,7 @@ ${latestSubscriptionCallbackError.current.stack}
|
|
|
78535
78562
|
filterValToUse = false;
|
|
78536
78563
|
} else if (ccSelectedFilter2 === "inList" || ccSelectedFilter2 === "notInList") {
|
|
78537
78564
|
if (dataType === "number") {
|
|
78538
|
-
filterValToUse = filterValue && filterValue.map((val) => parseFloat(val
|
|
78565
|
+
filterValToUse = filterValue && filterValue.map((val) => parseFloat(`${val}`.replaceAll(",", "")));
|
|
78539
78566
|
}
|
|
78540
78567
|
}
|
|
78541
78568
|
if (isInvalidFilterValue(filterValToUse)) {
|
|
@@ -78641,7 +78668,7 @@ ${latestSubscriptionCallbackError.current.stack}
|
|
|
78641
78668
|
multi: true,
|
|
78642
78669
|
creatable: true,
|
|
78643
78670
|
value: (filterValue || []).map((val) => ({
|
|
78644
|
-
label: val
|
|
78671
|
+
label: `${val}`,
|
|
78645
78672
|
value: val
|
|
78646
78673
|
})),
|
|
78647
78674
|
onChange: /* @__PURE__ */ __name((selectedOptions) => {
|
|
@@ -95087,10 +95114,7 @@ ${latestSubscriptionCallbackError.current.stack}
|
|
|
95087
95114
|
(e || window.event).returnValue = defaultMessagge;
|
|
95088
95115
|
return defaultMessagge;
|
|
95089
95116
|
}, "warnBeforeLeave");
|
|
95090
|
-
function PromptUnsavedChanges({
|
|
95091
|
-
message = defaultMessagge,
|
|
95092
|
-
when = false
|
|
95093
|
-
}) {
|
|
95117
|
+
function PromptUnsavedChanges({ message = defaultMessagge, when = false }) {
|
|
95094
95118
|
reactExports.useEffect(() => {
|
|
95095
95119
|
if (when) {
|
|
95096
95120
|
window.addEventListener("beforeunload", warnBeforeLeave);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teselagen/ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.20",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/TeselaGen/tg-oss",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
},
|
|
12
12
|
"./style.css": "./style.css"
|
|
13
13
|
},
|
|
14
|
-
"devDependencies": {},
|
|
15
14
|
"dependencies": {
|
|
16
15
|
"@blueprintjs/core": "3.54.0",
|
|
17
16
|
"@blueprintjs/datetime": "^3.24.1",
|
|
@@ -20,7 +19,6 @@
|
|
|
20
19
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
21
20
|
"@dnd-kit/sortable": "^8.0.0",
|
|
22
21
|
"@teselagen/react-table": "6.10.18",
|
|
23
|
-
"chance": "1.1.11",
|
|
24
22
|
"classnames": "^2.3.2",
|
|
25
23
|
"color": "^3.2.1",
|
|
26
24
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -48,7 +46,6 @@
|
|
|
48
46
|
"recompose": "npm:react-recompose@0.31.1",
|
|
49
47
|
"redux": "^4.1.2",
|
|
50
48
|
"redux-form": "^8.3.10",
|
|
51
|
-
"redux-thunk": "2.4.1",
|
|
52
49
|
"remark-gfm": "^4.0.0",
|
|
53
50
|
"reselect": "^4.1.7",
|
|
54
51
|
"tippy.js": "^6.3.7",
|
|
@@ -58,5 +55,9 @@
|
|
|
58
55
|
"@dnd-kit/utilities": "3.2.2",
|
|
59
56
|
"@teselagen/file-utils": "0.3.23",
|
|
60
57
|
"@blueprintjs/icons": "3.33.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"chance": "1.1.11",
|
|
61
|
+
"redux-thunk": "2.4.1"
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -106,7 +106,7 @@ const FilterAndSortMenu = ({
|
|
|
106
106
|
if (dataType === "number") {
|
|
107
107
|
filterValToUse =
|
|
108
108
|
filterValue &&
|
|
109
|
-
filterValue.map(val => parseFloat(val
|
|
109
|
+
filterValue.map(val => parseFloat(`${val}`.replaceAll(",", "")));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -234,7 +234,7 @@ const FilterInput = ({
|
|
|
234
234
|
multi={true}
|
|
235
235
|
creatable={true}
|
|
236
236
|
value={(filterValue || []).map(val => ({
|
|
237
|
-
label: val
|
|
237
|
+
label: `${val}`,
|
|
238
238
|
value: val
|
|
239
239
|
}))}
|
|
240
240
|
onChange={selectedOptions => {
|
|
@@ -205,6 +205,23 @@ function applyWhereClause(records, where) {
|
|
|
205
205
|
)
|
|
206
206
|
return false;
|
|
207
207
|
break;
|
|
208
|
+
case "_in":
|
|
209
|
+
if (!some(conditionValue, item => isEqual(value, item)))
|
|
210
|
+
return false;
|
|
211
|
+
break;
|
|
212
|
+
case "_nin":
|
|
213
|
+
if (some(conditionValue, item => isEqual(value, item)))
|
|
214
|
+
return false;
|
|
215
|
+
break;
|
|
216
|
+
case "_regex": {
|
|
217
|
+
try {
|
|
218
|
+
if (!isString(value) || !new RegExp(conditionValue).test(value))
|
|
219
|
+
return false;
|
|
220
|
+
} catch (e) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
208
225
|
default:
|
|
209
226
|
if (operator.startsWith("_")) {
|
|
210
227
|
console.warn(`Unsupported operator: ${operator}`);
|
|
@@ -1282,4 +1282,203 @@ describe("filterLocalEntitiesToHasura", () => {
|
|
|
1282
1282
|
]);
|
|
1283
1283
|
expect(result.entityCount).toBe(5);
|
|
1284
1284
|
});
|
|
1285
|
+
|
|
1286
|
+
it("should filter protein features correctly", () => {
|
|
1287
|
+
const proteinFeatureEntities = [
|
|
1288
|
+
{
|
|
1289
|
+
type: "CDS",
|
|
1290
|
+
strand: 1,
|
|
1291
|
+
name: "araC",
|
|
1292
|
+
start: 3,
|
|
1293
|
+
end: 5,
|
|
1294
|
+
annotationTypePlural: "features",
|
|
1295
|
+
id: "WWBalzQw01Oq",
|
|
1296
|
+
forward: true,
|
|
1297
|
+
color: "#EF6500",
|
|
1298
|
+
size: 3
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
type: "protein_bind",
|
|
1302
|
+
strand: 1,
|
|
1303
|
+
name: "Operator I2 and I1",
|
|
1304
|
+
start: 3,
|
|
1305
|
+
end: 8,
|
|
1306
|
+
annotationTypePlural: "features",
|
|
1307
|
+
id: "yOsnjK_GkeAv",
|
|
1308
|
+
forward: true,
|
|
1309
|
+
color: "#2E2E2E",
|
|
1310
|
+
size: 6
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
type: "CDS",
|
|
1314
|
+
strand: 1,
|
|
1315
|
+
name: "signal_peptide",
|
|
1316
|
+
start: 3,
|
|
1317
|
+
end: 11,
|
|
1318
|
+
annotationTypePlural: "features",
|
|
1319
|
+
id: "aPKESKXj0qUR",
|
|
1320
|
+
forward: true,
|
|
1321
|
+
color: "#EF6500",
|
|
1322
|
+
size: 9
|
|
1323
|
+
}
|
|
1324
|
+
];
|
|
1325
|
+
const result_equal = filterLocalEntitiesToHasura(proteinFeatureEntities, {
|
|
1326
|
+
where: {
|
|
1327
|
+
_and: [
|
|
1328
|
+
{
|
|
1329
|
+
size: {
|
|
1330
|
+
_eq: 3
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
]
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
expect(result_equal.entities).toEqual([proteinFeatureEntities[0]]);
|
|
1337
|
+
|
|
1338
|
+
const result_in_list = filterLocalEntitiesToHasura(proteinFeatureEntities, {
|
|
1339
|
+
where: {
|
|
1340
|
+
_and: [
|
|
1341
|
+
{
|
|
1342
|
+
size: {
|
|
1343
|
+
_in: [3, 6]
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
]
|
|
1347
|
+
}
|
|
1348
|
+
});
|
|
1349
|
+
expect(result_in_list.entities).toEqual([
|
|
1350
|
+
proteinFeatureEntities[0],
|
|
1351
|
+
proteinFeatureEntities[1]
|
|
1352
|
+
]);
|
|
1353
|
+
|
|
1354
|
+
const result_not_in_list = filterLocalEntitiesToHasura(
|
|
1355
|
+
proteinFeatureEntities,
|
|
1356
|
+
{
|
|
1357
|
+
where: {
|
|
1358
|
+
_and: [
|
|
1359
|
+
{
|
|
1360
|
+
size: {
|
|
1361
|
+
_nin: [3, 6]
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
]
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
);
|
|
1368
|
+
expect(result_not_in_list.entities).toEqual([proteinFeatureEntities[2]]);
|
|
1369
|
+
|
|
1370
|
+
const result_valid_regex = filterLocalEntitiesToHasura(
|
|
1371
|
+
proteinFeatureEntities,
|
|
1372
|
+
{
|
|
1373
|
+
where: {
|
|
1374
|
+
_and: [
|
|
1375
|
+
{
|
|
1376
|
+
name: {
|
|
1377
|
+
_regex: "^signal_"
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
]
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
);
|
|
1384
|
+
expect(result_valid_regex.entities).toEqual([proteinFeatureEntities[2]]);
|
|
1385
|
+
|
|
1386
|
+
const result_invalid_regex = filterLocalEntitiesToHasura(
|
|
1387
|
+
proteinFeatureEntities,
|
|
1388
|
+
{
|
|
1389
|
+
where: {
|
|
1390
|
+
_and: [
|
|
1391
|
+
{
|
|
1392
|
+
name: {
|
|
1393
|
+
_regex: "["
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
]
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1400
|
+
expect(result_invalid_regex.entities).toEqual([]);
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
it("should filter DNA features correctly", () => {
|
|
1404
|
+
const dnaFeatureEntities = [
|
|
1405
|
+
{
|
|
1406
|
+
type: "CDS",
|
|
1407
|
+
strand: 1,
|
|
1408
|
+
name: "araC",
|
|
1409
|
+
start: 3,
|
|
1410
|
+
end: 5,
|
|
1411
|
+
annotationTypePlural: "features",
|
|
1412
|
+
id: "WWBalzQw01Oq",
|
|
1413
|
+
forward: true,
|
|
1414
|
+
color: "#EF6500",
|
|
1415
|
+
size: 3
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
type: "protein_bind",
|
|
1419
|
+
strand: 1,
|
|
1420
|
+
name: "Operator I2 and I1",
|
|
1421
|
+
start: 3,
|
|
1422
|
+
end: 8,
|
|
1423
|
+
annotationTypePlural: "features",
|
|
1424
|
+
id: "yOsnjK_GkeAv",
|
|
1425
|
+
forward: true,
|
|
1426
|
+
color: "#2E2E2E",
|
|
1427
|
+
size: 6
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
type: "CDS",
|
|
1431
|
+
strand: 1,
|
|
1432
|
+
name: "signal_peptide",
|
|
1433
|
+
start: 3,
|
|
1434
|
+
end: 11,
|
|
1435
|
+
annotationTypePlural: "features",
|
|
1436
|
+
id: "aPKESKXj0qUR",
|
|
1437
|
+
forward: true,
|
|
1438
|
+
color: "#EF6500",
|
|
1439
|
+
size: 9
|
|
1440
|
+
}
|
|
1441
|
+
];
|
|
1442
|
+
const result_equal = filterLocalEntitiesToHasura(dnaFeatureEntities, {
|
|
1443
|
+
where: {
|
|
1444
|
+
_and: [
|
|
1445
|
+
{
|
|
1446
|
+
size: {
|
|
1447
|
+
_eq: 3
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
expect(result_equal.entities).toEqual([dnaFeatureEntities[0]]);
|
|
1454
|
+
|
|
1455
|
+
const result_in_list = filterLocalEntitiesToHasura(dnaFeatureEntities, {
|
|
1456
|
+
where: {
|
|
1457
|
+
_and: [
|
|
1458
|
+
{
|
|
1459
|
+
size: {
|
|
1460
|
+
_in: [3, 6]
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
]
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
expect(result_in_list.entities).toEqual([
|
|
1467
|
+
dnaFeatureEntities[0],
|
|
1468
|
+
dnaFeatureEntities[1]
|
|
1469
|
+
]);
|
|
1470
|
+
|
|
1471
|
+
const result_not_in_list = filterLocalEntitiesToHasura(dnaFeatureEntities, {
|
|
1472
|
+
where: {
|
|
1473
|
+
_and: [
|
|
1474
|
+
{
|
|
1475
|
+
size: {
|
|
1476
|
+
_nin: [3, 6]
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
expect(result_not_in_list.entities).toEqual([dnaFeatureEntities[2]]);
|
|
1483
|
+
});
|
|
1285
1484
|
});
|
|
@@ -17,10 +17,7 @@ const warnBeforeLeave = e => {
|
|
|
17
17
|
return defaultMessagge; //Webkit, Safari, Chrome
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
message = defaultMessagge,
|
|
22
|
-
when = false
|
|
23
|
-
}) {
|
|
20
|
+
function PromptUnsavedChanges({ message = defaultMessagge, when = false }) {
|
|
24
21
|
useEffect(() => {
|
|
25
22
|
if (when) {
|
|
26
23
|
window.addEventListener("beforeunload", warnBeforeLeave);
|
package/src/autoTooltip.js
CHANGED
|
@@ -19,12 +19,22 @@ document.addEventListener("mouseup", () => {
|
|
|
19
19
|
|
|
20
20
|
let tippys = [];
|
|
21
21
|
|
|
22
|
+
function isInAllowedContainer(element) {
|
|
23
|
+
if (window.onlyAllowTooltipsInVeEditor) {
|
|
24
|
+
return element.closest(".veEditor") !== null;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
let recentlyHidden = false;
|
|
23
30
|
let clearMe;
|
|
24
31
|
(function () {
|
|
25
32
|
let lastMouseOverElement = null;
|
|
26
33
|
document.addEventListener("mouseover", function (event) {
|
|
27
34
|
const element = event.target;
|
|
35
|
+
if (!isInAllowedContainer(element)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
28
38
|
|
|
29
39
|
if (element instanceof Element && element !== lastMouseOverElement) {
|
|
30
40
|
lastMouseOverElement = element;
|