@vitessce/feature-list 3.8.8 → 3.8.9
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/dist/index.js +3684 -3959
- package/dist-tsc/FeatureList.d.ts.map +1 -1
- package/dist-tsc/FeatureList.js +18 -21
- package/package.json +5 -5
- package/src/FeatureList.js +21 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureList.d.ts","sourceRoot":"","sources":["../src/FeatureList.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FeatureList.d.ts","sourceRoot":"","sources":["../src/FeatureList.js"],"names":[],"mappings":"AAkBA,oEA8HC"}
|
package/dist-tsc/FeatureList.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, {
|
|
3
|
-
import { every } from 'lodash-es';
|
|
2
|
+
import React, { useState, useMemo } from 'react';
|
|
4
3
|
import { makeStyles } from '@vitessce/styles';
|
|
5
4
|
import { cleanFeatureId } from '@vitessce/utils';
|
|
6
5
|
import { SelectableTable } from './selectable-table/index.js';
|
|
@@ -20,32 +19,30 @@ export default function FeatureList(props) {
|
|
|
20
19
|
const { width, height, hasColorEncoding, geneList = [], featureLabelsMap, geneSelection = [], geneFilter = null, setGeneSelection, enableMultiSelect, showFeatureTable, featureListSort, featureListSortKey, hasFeatureLabels, primaryColumnName, } = props;
|
|
21
20
|
const { classes } = useStyles();
|
|
22
21
|
const [searchTerm, setSearchTerm] = useState('');
|
|
23
|
-
const [searchResults, setSearchResults] = useState(geneList);
|
|
24
22
|
// In FeatureListSubscriber, we think in terms of 'featureIndex' and 'featureLabels'.
|
|
25
23
|
// Here in FeatureList, we need to map these to 'key' or 'name' before
|
|
26
24
|
// passing to the SelectableTable component.
|
|
27
25
|
const selectableTableSortKey = (featureListSortKey === 'featureIndex' ? 'key' : 'name');
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
?.toLowerCase().includes(searchTerm.toLowerCase())));
|
|
35
|
-
setSearchResults(results);
|
|
36
|
-
}, [searchTerm, geneList, featureLabelsMap]);
|
|
26
|
+
const searchResults = useMemo(() => geneList
|
|
27
|
+
.filter(gene => (gene.toLowerCase().includes(searchTerm.toLowerCase())
|
|
28
|
+
|| featureLabelsMap?.get(gene)
|
|
29
|
+
?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
30
|
+
|| featureLabelsMap?.get(cleanFeatureId(gene))
|
|
31
|
+
?.toLowerCase().includes(searchTerm.toLowerCase()))), [geneList, searchTerm, featureLabelsMap]);
|
|
37
32
|
function onChange(selection) {
|
|
38
33
|
if (setGeneSelection && selection) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
const selectedHiddenKeys = (geneSelection || []).filter(key => !searchResults.includes(key));
|
|
35
|
+
const selectionArray = Array.isArray(selection)
|
|
36
|
+
? selection
|
|
37
|
+
: [selection];
|
|
38
|
+
const selectedVisibleKeys = selectionArray.map(s => s.key).filter(key => searchResults.includes(key));
|
|
39
|
+
const newSelection = [...selectedHiddenKeys, ...selectedVisibleKeys]
|
|
40
|
+
.filter(Boolean);
|
|
41
|
+
if (newSelection.length > 0) {
|
|
42
|
+
setGeneSelection(newSelection);
|
|
46
43
|
}
|
|
47
|
-
else
|
|
48
|
-
setGeneSelection(
|
|
44
|
+
else {
|
|
45
|
+
setGeneSelection(null);
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/feature-list",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.9",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"react-virtualized": "^9.22.6",
|
|
22
22
|
"uuid": "^9.0.0",
|
|
23
23
|
"react-aria": "^3.28.0",
|
|
24
|
-
"@vitessce/styles": "3.8.
|
|
25
|
-
"@vitessce/constants-internal": "3.8.
|
|
26
|
-
"@vitessce/utils": "3.8.
|
|
27
|
-
"@vitessce/vit-s": "3.8.
|
|
24
|
+
"@vitessce/styles": "3.8.9",
|
|
25
|
+
"@vitessce/constants-internal": "3.8.9",
|
|
26
|
+
"@vitessce/utils": "3.8.9",
|
|
27
|
+
"@vitessce/vit-s": "3.8.9"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@testing-library/jest-dom": "^6.6.3",
|
package/src/FeatureList.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { every } from 'lodash-es';
|
|
1
|
+
import React, { useState, useMemo } from 'react';
|
|
3
2
|
import { makeStyles } from '@vitessce/styles';
|
|
4
3
|
import { cleanFeatureId } from '@vitessce/utils';
|
|
5
4
|
import { SelectableTable } from './selectable-table/index.js';
|
|
@@ -38,35 +37,39 @@ export default function FeatureList(props) {
|
|
|
38
37
|
const { classes } = useStyles();
|
|
39
38
|
|
|
40
39
|
const [searchTerm, setSearchTerm] = useState('');
|
|
41
|
-
const [searchResults, setSearchResults] = useState(geneList);
|
|
42
40
|
|
|
43
41
|
// In FeatureListSubscriber, we think in terms of 'featureIndex' and 'featureLabels'.
|
|
44
42
|
// Here in FeatureList, we need to map these to 'key' or 'name' before
|
|
45
43
|
// passing to the SelectableTable component.
|
|
46
44
|
const selectableTableSortKey = (featureListSortKey === 'featureIndex' ? 'key' : 'name');
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
gene.toLowerCase().includes(searchTerm.toLowerCase())
|
|
46
|
+
const searchResults = useMemo(() => geneList
|
|
47
|
+
.filter(gene => (
|
|
48
|
+
gene.toLowerCase().includes(searchTerm.toLowerCase())
|
|
52
49
|
|| featureLabelsMap?.get(gene)
|
|
53
50
|
?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
54
51
|
|| featureLabelsMap?.get(cleanFeatureId(gene))
|
|
55
52
|
?.toLowerCase().includes(searchTerm.toLowerCase())
|
|
56
|
-
|
|
57
|
-
setSearchResults(results);
|
|
58
|
-
}, [searchTerm, geneList, featureLabelsMap]);
|
|
53
|
+
)), [geneList, searchTerm, featureLabelsMap]);
|
|
59
54
|
|
|
60
55
|
function onChange(selection) {
|
|
61
56
|
if (setGeneSelection && selection) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
const selectedHiddenKeys = (geneSelection || []).filter(
|
|
58
|
+
key => !searchResults.includes(key),
|
|
59
|
+
);
|
|
60
|
+
const selectionArray = Array.isArray(selection)
|
|
61
|
+
? selection
|
|
62
|
+
: [selection];
|
|
63
|
+
const selectedVisibleKeys = selectionArray.map(s => s.key).filter(
|
|
64
|
+
key => searchResults.includes(key),
|
|
65
|
+
);
|
|
66
|
+
const newSelection = [...selectedHiddenKeys, ...selectedVisibleKeys]
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
|
|
69
|
+
if (newSelection.length > 0) {
|
|
70
|
+
setGeneSelection(newSelection);
|
|
71
|
+
} else {
|
|
72
|
+
setGeneSelection(null);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
}
|