@haniffalab/cherita-react 1.4.1-dev.2025-10-22.61540191 → 1.4.1-dev.2025-10-23.3179e534
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/cjs/components/controls/Controls.js +38 -30
- package/dist/cjs/components/dotplot/Dotplot.js +40 -33
- package/dist/cjs/components/dotplot/DotplotControls.js +103 -83
- package/dist/cjs/components/full-page/FullPage.js +92 -69
- package/dist/cjs/components/full-page/PlotAlert.js +25 -16
- package/dist/cjs/components/full-page/PlotTypeSelector.js +43 -36
- package/dist/cjs/components/heatmap/Heatmap.js +40 -33
- package/dist/cjs/components/heatmap/HeatmapControls.js +6 -3
- package/dist/cjs/components/icons/DotPlotIcon.js +16 -10
- package/dist/cjs/components/icons/HeatmapIcon.js +17 -11
- package/dist/cjs/components/icons/MatrixPlotIcon.1.js +22 -16
- package/dist/cjs/components/icons/MatrixPlotIcon.js +22 -16
- package/dist/cjs/components/icons/ScatterplotIcon.1.js +21 -15
- package/dist/cjs/components/icons/ScatterplotIcon.js +21 -15
- package/dist/cjs/components/icons/ViolinPlotIcon.js +22 -14
- package/dist/cjs/components/matrixplot/Matrixplot.js +40 -33
- package/dist/cjs/components/matrixplot/MatrixplotControls.js +8 -5
- package/dist/cjs/components/obs-list/ObsItem.js +238 -190
- package/dist/cjs/components/obs-list/ObsList.js +106 -87
- package/dist/cjs/components/obs-list/ObsToolbar.js +2 -3
- package/dist/cjs/components/obsm-list/ObsmList.js +47 -32
- package/dist/cjs/components/offcanvas/index.js +61 -31
- package/dist/cjs/components/pseudospatial/Pseudospatial.js +46 -36
- package/dist/cjs/components/pseudospatial/PseudospatialToolbar.js +98 -68
- package/dist/cjs/components/scatterplot/Scatterplot.js +87 -65
- package/dist/cjs/components/scatterplot/ScatterplotControls.js +35 -27
- package/dist/cjs/components/scatterplot/SpatialControls.js +134 -107
- package/dist/cjs/components/scatterplot/Toolbox.js +41 -30
- package/dist/cjs/components/search-bar/SearchBar.js +157 -110
- package/dist/cjs/components/search-bar/SearchInfo.js +73 -47
- package/dist/cjs/components/search-bar/SearchResults.js +93 -71
- package/dist/cjs/components/toolbar/Toolbar.js +43 -34
- package/dist/cjs/components/var-list/VarItem.js +106 -79
- package/dist/cjs/components/var-list/VarList.js +67 -53
- package/dist/cjs/components/var-list/VarListToolbar.js +56 -51
- package/dist/cjs/components/var-list/VarSet.js +115 -97
- package/dist/cjs/components/violin/Violin.js +77 -58
- package/dist/cjs/components/violin/ViolinControls.js +8 -5
- package/dist/cjs/context/DatasetContext.js +20 -13
- package/dist/cjs/context/FilterContext.js +9 -7
- package/dist/cjs/context/SettingsContext.js +11 -9
- package/dist/cjs/context/ZarrDataContext.js +6 -5
- package/dist/cjs/utils/Histogram.js +35 -33
- package/dist/cjs/utils/ImageViewer.js +9 -6
- package/dist/cjs/utils/Legend.js +36 -29
- package/dist/cjs/utils/LoadingIndicators.js +14 -12
- package/dist/cjs/utils/Skeleton.js +10 -10
- package/dist/cjs/utils/StyledTooltip.js +7 -2
- package/dist/cjs/utils/VirtualizedList.js +32 -25
- package/dist/cjs/utils/errors.js +1 -1
- package/dist/css/cherita.css +6 -1
- package/dist/css/cherita.css.map +1 -1
- package/dist/esm/components/controls/Controls.js +38 -30
- package/dist/esm/components/dotplot/Dotplot.js +40 -33
- package/dist/esm/components/dotplot/DotplotControls.js +103 -82
- package/dist/esm/components/full-page/FullPage.js +92 -69
- package/dist/esm/components/full-page/PlotAlert.js +25 -16
- package/dist/esm/components/full-page/PlotTypeSelector.js +43 -36
- package/dist/esm/components/heatmap/Heatmap.js +40 -33
- package/dist/esm/components/heatmap/HeatmapControls.js +6 -2
- package/dist/esm/components/icons/DotPlotIcon.js +16 -10
- package/dist/esm/components/icons/HeatmapIcon.js +17 -11
- package/dist/esm/components/icons/MatrixPlotIcon.1.js +22 -16
- package/dist/esm/components/icons/MatrixPlotIcon.js +22 -16
- package/dist/esm/components/icons/ScatterplotIcon.1.js +21 -15
- package/dist/esm/components/icons/ScatterplotIcon.js +21 -15
- package/dist/esm/components/icons/ViolinPlotIcon.js +22 -14
- package/dist/esm/components/matrixplot/Matrixplot.js +40 -33
- package/dist/esm/components/matrixplot/MatrixplotControls.js +8 -4
- package/dist/esm/components/obs-list/ObsItem.js +237 -186
- package/dist/esm/components/obs-list/ObsList.js +106 -86
- package/dist/esm/components/obs-list/ObsToolbar.js +2 -2
- package/dist/esm/components/obsm-list/ObsmList.js +47 -31
- package/dist/esm/components/offcanvas/index.js +61 -31
- package/dist/esm/components/pseudospatial/Pseudospatial.js +46 -36
- package/dist/esm/components/pseudospatial/PseudospatialToolbar.js +98 -68
- package/dist/esm/components/scatterplot/Scatterplot.js +87 -64
- package/dist/esm/components/scatterplot/ScatterplotControls.js +35 -26
- package/dist/esm/components/scatterplot/SpatialControls.js +134 -106
- package/dist/esm/components/scatterplot/Toolbox.js +41 -29
- package/dist/esm/components/search-bar/SearchBar.js +157 -109
- package/dist/esm/components/search-bar/SearchInfo.js +73 -46
- package/dist/esm/components/search-bar/SearchResults.js +93 -70
- package/dist/esm/components/toolbar/Toolbar.js +43 -33
- package/dist/esm/components/var-list/VarItem.js +106 -78
- package/dist/esm/components/var-list/VarList.js +67 -52
- package/dist/esm/components/var-list/VarListToolbar.js +56 -50
- package/dist/esm/components/var-list/VarSet.js +115 -96
- package/dist/esm/components/violin/Violin.js +77 -58
- package/dist/esm/components/violin/ViolinControls.js +8 -4
- package/dist/esm/context/DatasetContext.js +20 -12
- package/dist/esm/context/FilterContext.js +9 -6
- package/dist/esm/context/SettingsContext.js +11 -8
- package/dist/esm/context/ZarrDataContext.js +6 -4
- package/dist/esm/utils/Histogram.js +35 -33
- package/dist/esm/utils/ImageViewer.js +9 -5
- package/dist/esm/utils/Legend.js +36 -28
- package/dist/esm/utils/LoadingIndicators.js +14 -11
- package/dist/esm/utils/Skeleton.js +10 -9
- package/dist/esm/utils/StyledTooltip.js +7 -2
- package/dist/esm/utils/VirtualizedList.js +32 -24
- package/dist/esm/utils/errors.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
import { faCrosshairs, faDrawPolygon, faHand, faList, faMinus, faPen, faPlus, faSearch, faSliders, faTrash } from "@fortawesome/free-solid-svg-icons";
|
|
3
3
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
4
|
import { JoinInner } from "@mui/icons-material";
|
|
@@ -12,6 +12,7 @@ import { OffcanvasControls } from "../offcanvas";
|
|
|
12
12
|
import { ScatterplotControls } from "./ScatterplotControls";
|
|
13
13
|
import { BREAKPOINTS } from "../../constants/constants";
|
|
14
14
|
import { useSettings, useSettingsDispatch } from "../../context/SettingsContext";
|
|
15
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
export function SpatialControls(_ref) {
|
|
16
17
|
var _features$features;
|
|
17
18
|
let {
|
|
@@ -63,109 +64,136 @@ export function SpatialControls(_ref) {
|
|
|
63
64
|
features: []
|
|
64
65
|
});
|
|
65
66
|
};
|
|
66
|
-
const polygonControls = /*#__PURE__*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
67
|
+
const polygonControls = /*#__PURE__*/_jsxs(_Fragment, {
|
|
68
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
69
|
+
active: settings.sliceBy.polygons,
|
|
70
|
+
title: "Filter data with polygons",
|
|
71
|
+
onClick: () => {
|
|
72
|
+
setMode(() => ViewMode);
|
|
73
|
+
dispatch({
|
|
74
|
+
type: "toggle.slice.polygons"
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
children: /*#__PURE__*/_jsx(JoinInner, {})
|
|
78
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
79
|
+
title: "Delete selected polygons",
|
|
80
|
+
onClick: () => {
|
|
81
|
+
const newFeatures = features.features.filter((_f, i) => !selectedFeatureIndexes.includes(i));
|
|
82
|
+
setFeatures({
|
|
83
|
+
type: "FeatureCollection",
|
|
84
|
+
features: newFeatures
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
disabled: !selectedFeatureIndexes.length,
|
|
88
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
89
|
+
icon: faTrash
|
|
90
|
+
})
|
|
91
|
+
})]
|
|
92
|
+
});
|
|
93
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
94
|
+
className: "cherita-spatial-controls",
|
|
95
|
+
children: [(showObsBtn || showVarsBtn) && /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
96
|
+
vertical: true,
|
|
97
|
+
className: "w-100 mb-1",
|
|
98
|
+
children: [showObsBtn && /*#__PURE__*/_jsx(OverlayTrigger, {
|
|
99
|
+
placement: "right",
|
|
100
|
+
overlay: /*#__PURE__*/_jsx(Tooltip, {
|
|
101
|
+
id: "tooltip-obs",
|
|
102
|
+
children: "Browse categories"
|
|
103
|
+
}),
|
|
104
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
105
|
+
onClick: () => setShowObs(true),
|
|
106
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
107
|
+
icon: faList
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
}), showVarsBtn && /*#__PURE__*/_jsx(OverlayTrigger, {
|
|
111
|
+
placement: "right",
|
|
112
|
+
overlay: /*#__PURE__*/_jsx(Tooltip, {
|
|
113
|
+
id: "tooltip-vars",
|
|
114
|
+
children: "Search features"
|
|
115
|
+
}),
|
|
116
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
117
|
+
onClick: () => setShowVars(true),
|
|
118
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
119
|
+
icon: faSearch
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})]
|
|
123
|
+
}), /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
124
|
+
vertical: true,
|
|
125
|
+
className: "w-100",
|
|
126
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
127
|
+
onClick: () => setMode(() => ViewMode),
|
|
128
|
+
title: "Set dragging mode",
|
|
129
|
+
active: mode === ViewMode,
|
|
130
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
131
|
+
icon: faHand
|
|
132
|
+
})
|
|
133
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
134
|
+
onClick: increaseZoom,
|
|
135
|
+
title: "Increase zoom",
|
|
136
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
137
|
+
icon: faPlus
|
|
138
|
+
})
|
|
139
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
140
|
+
onClick: decreaseZoom,
|
|
141
|
+
title: "Decrease zoom",
|
|
142
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
143
|
+
icon: faMinus
|
|
144
|
+
})
|
|
145
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
146
|
+
className: "border-bottom"
|
|
147
|
+
}), " ", /*#__PURE__*/_jsx(Button, {
|
|
148
|
+
onClick: resetBounds,
|
|
149
|
+
title: "Reset zoom and center",
|
|
150
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
151
|
+
icon: faCrosshairs
|
|
152
|
+
})
|
|
153
|
+
}), /*#__PURE__*/_jsxs(Dropdown, {
|
|
154
|
+
as: ButtonGroup,
|
|
155
|
+
className: "caret-off",
|
|
156
|
+
drop: "end",
|
|
157
|
+
onSelect: onSelect,
|
|
158
|
+
children: [/*#__PURE__*/_jsx(Dropdown.Toggle, {
|
|
159
|
+
id: "dropdown-autoclose-outside",
|
|
160
|
+
className: "caret-off ".concat(mode === DrawPolygonByDraggingMode || mode === ModifyMode ? "active" : ""),
|
|
161
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
162
|
+
icon: faDrawPolygon
|
|
163
|
+
})
|
|
164
|
+
}), /*#__PURE__*/_jsxs(Dropdown.Menu, {
|
|
165
|
+
children: [/*#__PURE__*/_jsx(Dropdown.Header, {
|
|
166
|
+
children: "Polygon tools"
|
|
167
|
+
}), /*#__PURE__*/_jsxs(Dropdown.Item, {
|
|
168
|
+
eventKey: "DrawPolygonByDraggingMode",
|
|
169
|
+
children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
170
|
+
icon: faDrawPolygon,
|
|
171
|
+
className: "nav-icon"
|
|
172
|
+
}), "Draw a polygon"]
|
|
173
|
+
}), /*#__PURE__*/_jsxs(Dropdown.Item, {
|
|
174
|
+
eventKey: "ModifyMode",
|
|
175
|
+
children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
176
|
+
icon: faPen,
|
|
177
|
+
className: "nav-icon"
|
|
178
|
+
}), "Modify polygons"]
|
|
179
|
+
}), /*#__PURE__*/_jsxs(Dropdown.Item, {
|
|
180
|
+
onClick: deleteFeatures,
|
|
181
|
+
children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
182
|
+
icon: faTrash,
|
|
183
|
+
className: "nav-icon"
|
|
184
|
+
}), "Delete polygons"]
|
|
185
|
+
})]
|
|
186
|
+
})]
|
|
187
|
+
}), !!(features !== null && features !== void 0 && (_features$features = features.features) !== null && _features$features !== void 0 && _features$features.length) && polygonControls, /*#__PURE__*/_jsx(Button, {
|
|
188
|
+
onClick: handleShowControls,
|
|
189
|
+
children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
190
|
+
icon: faSliders
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
}), /*#__PURE__*/_jsx(OffcanvasControls, {
|
|
194
|
+
show: showControls,
|
|
195
|
+
handleClose: handleCloseControls,
|
|
196
|
+
Controls: ScatterplotControls
|
|
197
|
+
})]
|
|
198
|
+
});
|
|
171
199
|
}
|
|
@@ -1,38 +1,50 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Button, ButtonGroup, OverlayTrigger, Tooltip } from "react-bootstrap";
|
|
3
2
|
import { formatNumerical } from "../../utils/string";
|
|
4
3
|
import { ObsmKeysList } from "../obsm-list/ObsmList";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
export function Toolbox(_ref) {
|
|
6
6
|
let {
|
|
7
7
|
mode,
|
|
8
8
|
obsLength,
|
|
9
|
-
slicedLength
|
|
9
|
+
slicedLength,
|
|
10
|
+
setHasObsm
|
|
10
11
|
} = _ref;
|
|
11
|
-
return /*#__PURE__*/
|
|
12
|
-
className: "cherita-toolbox"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
return /*#__PURE__*/_jsx("div", {
|
|
13
|
+
className: "cherita-toolbox",
|
|
14
|
+
children: /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
15
|
+
children: [/*#__PURE__*/_jsx(ObsmKeysList, {
|
|
16
|
+
setHasObsm: setHasObsm
|
|
17
|
+
}), (mode || !isNaN(obsLength)) && (mode !== null && !isNaN(slicedLength) && slicedLength !== obsLength ? /*#__PURE__*/_jsx(OverlayTrigger, {
|
|
18
|
+
placement: "top",
|
|
19
|
+
overlay: /*#__PURE__*/_jsxs(Tooltip, {
|
|
20
|
+
id: "tooltip-dropped-mode",
|
|
21
|
+
children: ["You have selected ", formatNumerical(slicedLength), " out of", " ", formatNumerical(obsLength), " cells"]
|
|
22
|
+
}),
|
|
23
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
24
|
+
size: "sm",
|
|
25
|
+
variant: "primary",
|
|
26
|
+
style: {
|
|
27
|
+
cursor: "default"
|
|
28
|
+
},
|
|
29
|
+
"aria-disabled": "true",
|
|
30
|
+
children: [formatNumerical(slicedLength), " of ", formatNumerical(obsLength), " ", "cells"]
|
|
31
|
+
})
|
|
32
|
+
}) : /*#__PURE__*/_jsx(OverlayTrigger, {
|
|
33
|
+
placement: "top",
|
|
34
|
+
overlay: /*#__PURE__*/_jsxs(Tooltip, {
|
|
35
|
+
id: "tooltip-dropped-mode",
|
|
36
|
+
children: ["You are viewing ", formatNumerical(obsLength), " cells"]
|
|
37
|
+
}),
|
|
38
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
39
|
+
size: "sm",
|
|
40
|
+
variant: "primary",
|
|
41
|
+
style: {
|
|
42
|
+
cursor: "default"
|
|
43
|
+
},
|
|
44
|
+
"aria-disabled": "true",
|
|
45
|
+
children: [formatNumerical(obsLength), " cells"]
|
|
46
|
+
})
|
|
47
|
+
}))]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
38
50
|
}
|
|
@@ -3,7 +3,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import
|
|
6
|
+
import { useState } from "react";
|
|
7
7
|
import CloseIcon from "@mui/icons-material/Close";
|
|
8
8
|
import SearchIcon from "@mui/icons-material/Search";
|
|
9
9
|
import _ from "lodash";
|
|
@@ -16,6 +16,7 @@ import Tab from "react-bootstrap/Tab";
|
|
|
16
16
|
import { DiseaseInfo, VarInfo } from "./SearchInfo";
|
|
17
17
|
import { DiseasesSearchResults, VarSearchResults } from "./SearchResults";
|
|
18
18
|
import { COLOR_ENCODINGS } from "../../constants/constants";
|
|
19
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
const select = (dispatch, item) => {
|
|
20
21
|
dispatch({
|
|
21
22
|
type: "select.var",
|
|
@@ -74,98 +75,136 @@ export function SearchModal(_ref2) {
|
|
|
74
75
|
});
|
|
75
76
|
const [varResultsLength, setVarResultsLength] = useState(null);
|
|
76
77
|
const [diseaseResultsLength, setDiseaseResultsLength] = useState(null);
|
|
77
|
-
return /*#__PURE__*/
|
|
78
|
+
return /*#__PURE__*/_jsxs(Modal, {
|
|
78
79
|
show: show,
|
|
79
80
|
onHide: handleClose,
|
|
80
|
-
size: "xl"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
81
|
+
size: "xl",
|
|
82
|
+
children: [/*#__PURE__*/_jsx(Modal.Header, {
|
|
83
|
+
className: "bg-primary",
|
|
84
|
+
children: /*#__PURE__*/_jsx(Container, {
|
|
85
|
+
className: "gx-0",
|
|
86
|
+
children: /*#__PURE__*/_jsx(Row, {
|
|
87
|
+
children: /*#__PURE__*/_jsx(Col, {
|
|
88
|
+
xs: 12,
|
|
89
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
90
|
+
onSubmit: e => {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
},
|
|
93
|
+
children: /*#__PURE__*/_jsx(FormGroup, {
|
|
94
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
95
|
+
className: "d-flex align-items-center",
|
|
96
|
+
children: /*#__PURE__*/_jsxs(InputGroup, {
|
|
97
|
+
children: [/*#__PURE__*/_jsx(InputGroup.Text, {
|
|
98
|
+
children: /*#__PURE__*/_jsx(SearchIcon, {})
|
|
99
|
+
}), /*#__PURE__*/_jsx(Form.Control, {
|
|
100
|
+
autoFocus: true,
|
|
101
|
+
type: "text",
|
|
102
|
+
placeholder: "Search " + displayText,
|
|
103
|
+
value: text,
|
|
104
|
+
onChange: e => {
|
|
105
|
+
setText(e.target.value);
|
|
106
|
+
setSelectedResult({
|
|
107
|
+
var: null,
|
|
108
|
+
disease: null
|
|
109
|
+
});
|
|
110
|
+
setVarResultsLength(null);
|
|
111
|
+
setDiseaseResultsLength(null);
|
|
112
|
+
}
|
|
113
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
114
|
+
variant: "light",
|
|
115
|
+
onClick: handleClose,
|
|
116
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {})
|
|
117
|
+
})]
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
}), /*#__PURE__*/_jsx(Modal.Body, {
|
|
126
|
+
className: "p-0",
|
|
127
|
+
children: /*#__PURE__*/_jsx(Container, {
|
|
128
|
+
children: /*#__PURE__*/_jsxs(Row, {
|
|
129
|
+
children: [/*#__PURE__*/_jsx(Col, {
|
|
130
|
+
xs: 12,
|
|
131
|
+
md: 8,
|
|
132
|
+
children: /*#__PURE__*/_jsx(Tab.Container, {
|
|
133
|
+
activeKey: tab,
|
|
134
|
+
onSelect: k => setTab(k),
|
|
135
|
+
children: /*#__PURE__*/_jsxs(Row, {
|
|
136
|
+
className: "w-100",
|
|
137
|
+
children: [/*#__PURE__*/_jsx(Col, {
|
|
138
|
+
sm: 3,
|
|
139
|
+
className: "py-3 border-end",
|
|
140
|
+
children: /*#__PURE__*/_jsxs(Nav, {
|
|
141
|
+
variant: "pills",
|
|
142
|
+
className: "flex-column",
|
|
143
|
+
children: [searchVar && /*#__PURE__*/_jsx(Nav.Item, {
|
|
144
|
+
children: /*#__PURE__*/_jsxs(Nav.Link, {
|
|
145
|
+
eventKey: FEATURE_TYPE.VAR,
|
|
146
|
+
children: ["Genes", " ", !!varResultsLength && "(".concat(varResultsLength, ")")]
|
|
147
|
+
})
|
|
148
|
+
}), searchDiseases && /*#__PURE__*/_jsx(Nav.Item, {
|
|
149
|
+
children: /*#__PURE__*/_jsxs(Nav.Link, {
|
|
150
|
+
eventKey: FEATURE_TYPE.DISEASE,
|
|
151
|
+
children: ["Diseases", " ", !!diseaseResultsLength && "(".concat(diseaseResultsLength, ")")]
|
|
152
|
+
})
|
|
153
|
+
})]
|
|
154
|
+
})
|
|
155
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
156
|
+
sm: 9,
|
|
157
|
+
className: "py-3",
|
|
158
|
+
children: /*#__PURE__*/_jsxs(Tab.Content, {
|
|
159
|
+
children: [searchVar && /*#__PURE__*/_jsx(Tab.Pane, {
|
|
160
|
+
eventKey: FEATURE_TYPE.VAR,
|
|
161
|
+
children: /*#__PURE__*/_jsx(VarSearchResults, {
|
|
162
|
+
text: text,
|
|
163
|
+
handleSelect: handleSelect,
|
|
164
|
+
selectedResult: selectedResult.var,
|
|
165
|
+
setSelectedResult: item => setSelectedResult(prev => {
|
|
166
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
167
|
+
var: item
|
|
168
|
+
});
|
|
169
|
+
}),
|
|
170
|
+
setResultsLength: setVarResultsLength
|
|
171
|
+
})
|
|
172
|
+
}), searchDiseases && /*#__PURE__*/_jsx(Tab.Pane, {
|
|
173
|
+
eventKey: FEATURE_TYPE.DISEASE,
|
|
174
|
+
children: /*#__PURE__*/_jsx(DiseasesSearchResults, {
|
|
175
|
+
text: text,
|
|
176
|
+
selectedResult: selectedResult.disease,
|
|
177
|
+
setSelectedResult: item => setSelectedResult(prev => {
|
|
178
|
+
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
179
|
+
disease: item
|
|
180
|
+
});
|
|
181
|
+
}),
|
|
182
|
+
setResultsLength: setDiseaseResultsLength
|
|
183
|
+
})
|
|
184
|
+
})]
|
|
185
|
+
})
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
190
|
+
xs: 12,
|
|
191
|
+
md: 4,
|
|
192
|
+
className: "bg-light p-3 search-modal-info",
|
|
193
|
+
children: selectedResult[tab] ? tab === FEATURE_TYPE.DISEASE ? /*#__PURE__*/_jsx(DiseaseInfo, {
|
|
194
|
+
disease: selectedResult.disease,
|
|
195
|
+
handleSelect: handleSelect,
|
|
196
|
+
addVarSet: addVarSet
|
|
197
|
+
}) : /*#__PURE__*/_jsx(VarInfo, {
|
|
198
|
+
varItem: selectedResult.var
|
|
199
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
200
|
+
className: "text-muted",
|
|
201
|
+
children: "No result selected"
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
})
|
|
205
|
+
})
|
|
206
|
+
})]
|
|
207
|
+
});
|
|
169
208
|
}
|
|
170
209
|
export function SearchBar(_ref3) {
|
|
171
210
|
let {
|
|
@@ -175,22 +214,31 @@ export function SearchBar(_ref3) {
|
|
|
175
214
|
const [text, setText] = useState("");
|
|
176
215
|
const displayText = [...(searchVar ? ["features"] : []), ...(searchDiseases ? ["diseases"] : [])].join(" and ");
|
|
177
216
|
const [showModal, setShowModal] = useState(false);
|
|
178
|
-
return /*#__PURE__*/
|
|
179
|
-
|
|
180
|
-
e
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
217
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
218
|
+
children: [/*#__PURE__*/_jsx(Form, {
|
|
219
|
+
onSubmit: e => {
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
},
|
|
222
|
+
children: /*#__PURE__*/_jsx(FormGroup, {
|
|
223
|
+
children: /*#__PURE__*/_jsxs(InputGroup, {
|
|
224
|
+
children: [/*#__PURE__*/_jsx(InputGroup.Text, {
|
|
225
|
+
children: /*#__PURE__*/_jsx(SearchIcon, {})
|
|
226
|
+
}), /*#__PURE__*/_jsx(Form.Control, {
|
|
227
|
+
onClick: () => setShowModal(true),
|
|
228
|
+
type: "text",
|
|
229
|
+
placeholder: "Search " + displayText,
|
|
230
|
+
defaultValue: text
|
|
231
|
+
})]
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
}), /*#__PURE__*/_jsx(SearchModal, {
|
|
235
|
+
show: showModal,
|
|
236
|
+
text: text,
|
|
237
|
+
setText: setText,
|
|
238
|
+
displayText: displayText,
|
|
239
|
+
searchVar: searchVar,
|
|
240
|
+
searchDiseases: searchDiseases,
|
|
241
|
+
handleClose: () => setShowModal(false)
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
196
244
|
}
|