@haniffalab/cherita-react 1.3.0-dev.2025-06-04.d986a94b → 1.3.0
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/dotplot/Dotplot.js +5 -35
- package/dist/cjs/components/full-page/FullPage.js +50 -108
- package/dist/cjs/components/full-page/FullPagePseudospatial.js +157 -0
- package/dist/cjs/components/heatmap/Heatmap.js +5 -35
- package/dist/cjs/components/matrixplot/Matrixplot.js +5 -35
- package/dist/cjs/components/obs-list/ObsList.js +3 -4
- package/dist/cjs/components/scatterplot/SpatialControls.js +3 -3
- package/dist/cjs/components/violin/Violin.js +6 -37
- package/dist/cjs/constants/constants.js +2 -14
- package/dist/cjs/index.js +21 -15
- package/dist/css/cherita.css +23 -76
- package/dist/css/cherita.css.map +1 -1
- package/dist/esm/components/dotplot/Dotplot.js +6 -36
- package/dist/esm/components/full-page/FullPage.js +50 -110
- package/dist/esm/components/full-page/FullPagePseudospatial.js +149 -0
- package/dist/esm/components/heatmap/Heatmap.js +6 -36
- package/dist/esm/components/matrixplot/Matrixplot.js +6 -36
- package/dist/esm/components/obs-list/ObsList.js +3 -4
- package/dist/esm/components/scatterplot/SpatialControls.js +3 -3
- package/dist/esm/components/violin/Violin.js +8 -39
- package/dist/esm/constants/constants.js +1 -13
- package/dist/esm/index.js +4 -4
- package/package.json +3 -4
- package/scss/cherita.scss +1 -0
- package/scss/components/layouts.scss +1 -69
- package/scss/components/plotly.scss +14 -19
- package/dist/cjs/components/full-page/PlotTypeSelector.js +0 -57
- package/dist/cjs/components/toolbar/Toolbar.js +0 -102
- package/dist/esm/components/full-page/PlotTypeSelector.js +0 -50
- package/dist/esm/components/toolbar/Toolbar.js +0 -91
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
const _excluded = ["children", "varMode", "searchDiseases"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
6
|
+
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
+
import { Button, Card, Container, Modal } from "react-bootstrap";
|
|
9
|
+
import { SELECTION_MODES } from "../../constants/constants";
|
|
10
|
+
import { DatasetProvider } from "../../context/DatasetContext";
|
|
11
|
+
import { ObsColsList } from "../obs-list/ObsList";
|
|
12
|
+
import { OffcanvasControls, OffcanvasObs, OffcanvasObsm, OffcanvasVars } from "../offcanvas";
|
|
13
|
+
import { Pseudospatial } from "../pseudospatial/Pseudospatial";
|
|
14
|
+
import { PseudospatialToolbar } from "../pseudospatial/PseudospatialToolbar";
|
|
15
|
+
import { Scatterplot } from "../scatterplot/Scatterplot";
|
|
16
|
+
import { ScatterplotControls } from "../scatterplot/ScatterplotControls";
|
|
17
|
+
import { SearchBar } from "../search-bar/SearchBar";
|
|
18
|
+
import { VarNamesList } from "../var-list/VarList";
|
|
19
|
+
export function FullPage(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
varMode = SELECTION_MODES.SINGLE,
|
|
23
|
+
searchDiseases = false
|
|
24
|
+
} = _ref,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
const appRef = useRef();
|
|
27
|
+
const [appDimensions, setAppDimensions] = useState({
|
|
28
|
+
width: 0,
|
|
29
|
+
height: 0
|
|
30
|
+
});
|
|
31
|
+
const [showObs, setShowObs] = useState(false);
|
|
32
|
+
const [showObsm, setShowObsm] = useState(false);
|
|
33
|
+
const [showVars, setShowVars] = useState(false);
|
|
34
|
+
const [showControls, setShowControls] = useState(false);
|
|
35
|
+
const [showPseudospatialControls, setShowPseudospatialControls] = useState(false);
|
|
36
|
+
const [showModal, setShowModal] = useState(false);
|
|
37
|
+
const [pseudospatialPlotType, setpseudospatialPlotType] = useState(null);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const updateDimensions = () => {
|
|
40
|
+
if (appRef.current) {
|
|
41
|
+
// Get the distance from the top of the page to the target element
|
|
42
|
+
const rect = appRef.current.getBoundingClientRect();
|
|
43
|
+
const distanceFromTop = rect.top + window.scrollY;
|
|
44
|
+
|
|
45
|
+
// Calculate the available height for the Cherita app
|
|
46
|
+
const availableHeight = window.innerHeight - distanceFromTop;
|
|
47
|
+
|
|
48
|
+
// Update the dimensions to fit the viewport minus the navbar height
|
|
49
|
+
setAppDimensions({
|
|
50
|
+
width: appRef.current.offsetWidth,
|
|
51
|
+
height: availableHeight
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
window.addEventListener("resize", updateDimensions);
|
|
56
|
+
updateDimensions(); // Initial update
|
|
57
|
+
return () => window.removeEventListener("resize", updateDimensions);
|
|
58
|
+
}, []);
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: appRef,
|
|
61
|
+
className: "cherita-app",
|
|
62
|
+
style: {
|
|
63
|
+
height: appDimensions.height
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/React.createElement(DatasetProvider, props, /*#__PURE__*/React.createElement(Container, {
|
|
66
|
+
fluid: true,
|
|
67
|
+
className: "d-flex g-0",
|
|
68
|
+
style: {
|
|
69
|
+
height: appDimensions.height
|
|
70
|
+
}
|
|
71
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
72
|
+
className: "cherita-app-obs modern-scrollbars border-end h-100"
|
|
73
|
+
}, /*#__PURE__*/React.createElement(ObsColsList, props)), /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: "cherita-app-canvas flex-grow-1"
|
|
75
|
+
}, children({
|
|
76
|
+
setShowObs,
|
|
77
|
+
setShowVars
|
|
78
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: "cherita-app-sidebar p-3"
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Card.Header, {
|
|
81
|
+
className: "d-flex justify-content-evenly align-items-center"
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
+
variant: "link",
|
|
84
|
+
onClick: () => setShowModal(true)
|
|
85
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
86
|
+
icon: faArrowUpRightFromSquare
|
|
87
|
+
}))), /*#__PURE__*/React.createElement(Card.Body, {
|
|
88
|
+
className: "d-flex flex-column p-0"
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "sidebar-pseudospatial"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(Pseudospatial, {
|
|
92
|
+
className: "sidebar-pseudospatial",
|
|
93
|
+
plotType: pseudospatialPlotType,
|
|
94
|
+
setPlotType: setpseudospatialPlotType,
|
|
95
|
+
setShowControls: setShowPseudospatialControls
|
|
96
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
97
|
+
className: "sidebar-features modern-scrollbars"
|
|
98
|
+
}, /*#__PURE__*/React.createElement(SearchBar, {
|
|
99
|
+
searchDiseases: searchDiseases,
|
|
100
|
+
searchVar: true
|
|
101
|
+
}), /*#__PURE__*/React.createElement(VarNamesList, {
|
|
102
|
+
mode: varMode
|
|
103
|
+
})))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Modal, {
|
|
104
|
+
show: showModal,
|
|
105
|
+
onHide: () => setShowModal(false),
|
|
106
|
+
centered: true
|
|
107
|
+
}, /*#__PURE__*/React.createElement(Modal.Header, {
|
|
108
|
+
closeButton: true
|
|
109
|
+
}), /*#__PURE__*/React.createElement(Modal.Body, null, /*#__PURE__*/React.createElement(Pseudospatial, {
|
|
110
|
+
plotType: pseudospatialPlotType,
|
|
111
|
+
setPlotType: setpseudospatialPlotType,
|
|
112
|
+
setShowControls: setShowPseudospatialControls,
|
|
113
|
+
height: 500
|
|
114
|
+
}))), /*#__PURE__*/React.createElement(OffcanvasObs, {
|
|
115
|
+
show: showObs,
|
|
116
|
+
handleClose: () => setShowObs(false)
|
|
117
|
+
}), /*#__PURE__*/React.createElement(OffcanvasVars, {
|
|
118
|
+
show: showVars,
|
|
119
|
+
handleClose: () => setShowVars(false),
|
|
120
|
+
mode: varMode
|
|
121
|
+
}), /*#__PURE__*/React.createElement(OffcanvasControls, {
|
|
122
|
+
show: showControls,
|
|
123
|
+
handleClose: () => setShowControls(false),
|
|
124
|
+
Controls: ScatterplotControls
|
|
125
|
+
}), /*#__PURE__*/React.createElement(OffcanvasControls, {
|
|
126
|
+
show: showPseudospatialControls,
|
|
127
|
+
handleClose: () => setShowPseudospatialControls(false),
|
|
128
|
+
Controls: PseudospatialToolbar,
|
|
129
|
+
plotType: pseudospatialPlotType
|
|
130
|
+
}), /*#__PURE__*/React.createElement(OffcanvasObsm, {
|
|
131
|
+
show: showObsm,
|
|
132
|
+
handleClose: () => setShowObsm(false)
|
|
133
|
+
}))));
|
|
134
|
+
}
|
|
135
|
+
export function FullPagePseudospatial(props) {
|
|
136
|
+
return /*#__PURE__*/React.createElement(FullPage, _extends({}, props, {
|
|
137
|
+
varMode: SELECTION_MODES.SINGLE
|
|
138
|
+
}), _ref2 => {
|
|
139
|
+
let {
|
|
140
|
+
setShowObs,
|
|
141
|
+
setShowVars
|
|
142
|
+
} = _ref2;
|
|
143
|
+
return /*#__PURE__*/React.createElement(Scatterplot, {
|
|
144
|
+
setShowObs: setShowObs,
|
|
145
|
+
setShowVars: setShowVars,
|
|
146
|
+
isFullscreen: true
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -5,25 +5,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
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
6
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import _ from "lodash";
|
|
8
|
-
import { Alert
|
|
8
|
+
import { Alert } from "react-bootstrap";
|
|
9
9
|
import Plot from "react-plotly.js";
|
|
10
|
-
import { PLOTLY_MODEBAR_BUTTONS } from "../../constants/constants";
|
|
11
10
|
import { useDataset } from "../../context/DatasetContext";
|
|
12
11
|
import { useFilteredData } from "../../context/FilterContext";
|
|
13
12
|
import { useSettings } from "../../context/SettingsContext";
|
|
14
13
|
import { LoadingSpinner } from "../../utils/LoadingIndicators";
|
|
15
14
|
import { useDebouncedFetch } from "../../utils/requests";
|
|
16
|
-
|
|
17
|
-
export function Heatmap(_ref) {
|
|
15
|
+
export function Heatmap() {
|
|
18
16
|
var _settings$selectedObs, _settings$selectedObs2, _settings$selectedObs3;
|
|
19
|
-
let {
|
|
20
|
-
showObsBtn = false,
|
|
21
|
-
showVarsBtn = false,
|
|
22
|
-
showCtrlsBtn = false,
|
|
23
|
-
setShowObs,
|
|
24
|
-
setShowVars,
|
|
25
|
-
setShowControls
|
|
26
|
-
} = _ref;
|
|
27
17
|
const ENDPOINT = "heatmap";
|
|
28
18
|
const dataset = useDataset();
|
|
29
19
|
const settings = useSettings();
|
|
@@ -100,29 +90,17 @@ export function Heatmap(_ref) {
|
|
|
100
90
|
colorscale.current = settings.controls.colorScale;
|
|
101
91
|
updateColorscale(colorscale.current);
|
|
102
92
|
}, [settings.controls.colorScale, updateColorscale]);
|
|
103
|
-
const customModeBarButtons = _.compact([showObsBtn && ObsPlotlyToolbar({
|
|
104
|
-
onClick: setShowObs
|
|
105
|
-
}), showVarsBtn && VarPlotlyToolbar({
|
|
106
|
-
onClick: setShowVars
|
|
107
|
-
}), showCtrlsBtn && ControlsPlotlyToolbar({
|
|
108
|
-
onClick: setShowControls
|
|
109
|
-
})]);
|
|
110
|
-
const modeBarButtons = customModeBarButtons.length ? [customModeBarButtons, PLOTLY_MODEBAR_BUTTONS] : [PLOTLY_MODEBAR_BUTTONS];
|
|
111
93
|
if (!serverError) {
|
|
112
94
|
if (hasSelections) {
|
|
113
95
|
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
-
className: "cherita-
|
|
96
|
+
className: "cherita-heatmap position-relative"
|
|
115
97
|
}, isPending && /*#__PURE__*/React.createElement(LoadingSpinner, null), /*#__PURE__*/React.createElement(Plot, {
|
|
116
98
|
data: data,
|
|
117
99
|
layout: layout,
|
|
118
100
|
useResizeHandler: true,
|
|
119
101
|
style: {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
config: {
|
|
124
|
-
displaylogo: false,
|
|
125
|
-
modeBarButtons: modeBarButtons
|
|
102
|
+
maxWidth: "100%",
|
|
103
|
+
maxHeight: "100%"
|
|
126
104
|
}
|
|
127
105
|
}));
|
|
128
106
|
}
|
|
@@ -130,15 +108,7 @@ export function Heatmap(_ref) {
|
|
|
130
108
|
className: "cherita-heatmap"
|
|
131
109
|
}, /*#__PURE__*/React.createElement(Alert, {
|
|
132
110
|
variant: "light"
|
|
133
|
-
}, "Select
|
|
134
|
-
variant: "link",
|
|
135
|
-
className: "border-0 p-0 align-baseline",
|
|
136
|
-
onClick: setShowVars
|
|
137
|
-
}, "features") : "features", " ", "and a", " ", showObsBtn ? /*#__PURE__*/React.createElement(Button, {
|
|
138
|
-
variant: "link",
|
|
139
|
-
className: "border-0 p-0 align-baseline",
|
|
140
|
-
onClick: setShowObs
|
|
141
|
-
}, "category") : "category"));
|
|
111
|
+
}, "Select features and a category"));
|
|
142
112
|
} else {
|
|
143
113
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Alert, {
|
|
144
114
|
variant: "danger"
|
|
@@ -5,25 +5,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
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
6
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import _ from "lodash";
|
|
8
|
-
import { Alert
|
|
8
|
+
import { Alert } from "react-bootstrap";
|
|
9
9
|
import Plot from "react-plotly.js";
|
|
10
|
-
import { PLOTLY_MODEBAR_BUTTONS } from "../../constants/constants";
|
|
11
10
|
import { useDataset } from "../../context/DatasetContext";
|
|
12
11
|
import { useFilteredData } from "../../context/FilterContext";
|
|
13
12
|
import { useSettings } from "../../context/SettingsContext";
|
|
14
13
|
import { LoadingSpinner } from "../../utils/LoadingIndicators";
|
|
15
14
|
import { useDebouncedFetch } from "../../utils/requests";
|
|
16
|
-
|
|
17
|
-
export function Matrixplot(_ref) {
|
|
15
|
+
export function Matrixplot() {
|
|
18
16
|
var _settings$selectedObs, _settings$selectedObs2, _settings$selectedObs3;
|
|
19
|
-
let {
|
|
20
|
-
showObsBtn = false,
|
|
21
|
-
showVarsBtn = false,
|
|
22
|
-
showCtrlsBtn = false,
|
|
23
|
-
setShowObs,
|
|
24
|
-
setShowVars,
|
|
25
|
-
setShowControls
|
|
26
|
-
} = _ref;
|
|
27
17
|
const ENDPOINT = "matrixplot";
|
|
28
18
|
const dataset = useDataset();
|
|
29
19
|
const settings = useSettings();
|
|
@@ -102,29 +92,17 @@ export function Matrixplot(_ref) {
|
|
|
102
92
|
colorscale.current = settings.controls.colorScale;
|
|
103
93
|
updateColorscale(colorscale.current);
|
|
104
94
|
}, [settings.controls.colorScale, updateColorscale]);
|
|
105
|
-
const customModeBarButtons = _.compact([showObsBtn && ObsPlotlyToolbar({
|
|
106
|
-
onClick: setShowObs
|
|
107
|
-
}), showVarsBtn && VarPlotlyToolbar({
|
|
108
|
-
onClick: setShowVars
|
|
109
|
-
}), showCtrlsBtn && ControlsPlotlyToolbar({
|
|
110
|
-
onClick: setShowControls
|
|
111
|
-
})]);
|
|
112
|
-
const modeBarButtons = customModeBarButtons.length ? [customModeBarButtons, PLOTLY_MODEBAR_BUTTONS] : [PLOTLY_MODEBAR_BUTTONS];
|
|
113
95
|
if (!serverError) {
|
|
114
96
|
if (hasSelections) {
|
|
115
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
-
className: "cherita-
|
|
98
|
+
className: "cherita-matrixplot position-relative"
|
|
117
99
|
}, isPending && /*#__PURE__*/React.createElement(LoadingSpinner, null), /*#__PURE__*/React.createElement(Plot, {
|
|
118
100
|
data: data,
|
|
119
101
|
layout: layout,
|
|
120
102
|
useResizeHandler: true,
|
|
121
103
|
style: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
config: {
|
|
126
|
-
displaylogo: false,
|
|
127
|
-
modeBarButtons: modeBarButtons
|
|
104
|
+
maxWidth: "100%",
|
|
105
|
+
maxHeight: "100%"
|
|
128
106
|
}
|
|
129
107
|
}));
|
|
130
108
|
}
|
|
@@ -132,15 +110,7 @@ export function Matrixplot(_ref) {
|
|
|
132
110
|
className: "cherita-matrixplot"
|
|
133
111
|
}, /*#__PURE__*/React.createElement(Alert, {
|
|
134
112
|
variant: "light"
|
|
135
|
-
}, "Select
|
|
136
|
-
variant: "link",
|
|
137
|
-
className: "border-0 p-0 align-baseline",
|
|
138
|
-
onClick: setShowVars
|
|
139
|
-
}, "features") : "features", " ", "and a", " ", showObsBtn ? /*#__PURE__*/React.createElement(Button, {
|
|
140
|
-
variant: "link",
|
|
141
|
-
className: "border-0 p-0 align-baseline",
|
|
142
|
-
onClick: setShowObs
|
|
143
|
-
}, "category") : "category"));
|
|
113
|
+
}, "Select features and a category"));
|
|
144
114
|
} else {
|
|
145
115
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Alert, {
|
|
146
116
|
variant: "danger"
|
|
@@ -48,8 +48,7 @@ export function ObsColsList(_ref2) {
|
|
|
48
48
|
var _settings$selectedObs;
|
|
49
49
|
let {
|
|
50
50
|
showColor = true,
|
|
51
|
-
enableObsGroups = true
|
|
52
|
-
showSelectedAsActive = false
|
|
51
|
+
enableObsGroups = true
|
|
53
52
|
} = _ref2;
|
|
54
53
|
const ENDPOINT = "obs/cols";
|
|
55
54
|
const dataset = useDataset();
|
|
@@ -216,7 +215,7 @@ export function ObsColsList(_ref2) {
|
|
|
216
215
|
}
|
|
217
216
|
const inLabelObs = _.some(settings.labelObs, i => i.name === item.name);
|
|
218
217
|
const inSliceObs = settings.sliceBy.obs && ((_settings$selectedObs5 = settings.selectedObs) === null || _settings$selectedObs5 === void 0 ? void 0 : _settings$selectedObs5.name) === item.name;
|
|
219
|
-
const isColorEncoding =
|
|
218
|
+
const isColorEncoding = settings.colorEncoding === COLOR_ENCODINGS.OBS && ((_settings$selectedObs6 = settings.selectedObs) === null || _settings$selectedObs6 === void 0 ? void 0 : _settings$selectedObs6.name) === item.name;
|
|
220
219
|
return /*#__PURE__*/React.createElement("div", {
|
|
221
220
|
className: "accordion-item",
|
|
222
221
|
key: item.name
|
|
@@ -243,7 +242,7 @@ export function ObsColsList(_ref2) {
|
|
|
243
242
|
event.stopPropagation();
|
|
244
243
|
toggleColor(item);
|
|
245
244
|
},
|
|
246
|
-
title:
|
|
245
|
+
title: "Is color encoding"
|
|
247
246
|
}, /*#__PURE__*/React.createElement(WaterDropIcon, null)))), /*#__PURE__*/React.createElement(Accordion.Collapse, {
|
|
248
247
|
eventKey: item.name
|
|
249
248
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -8,9 +8,9 @@ import { OverlayTrigger, Tooltip } from "react-bootstrap";
|
|
|
8
8
|
import Button from "react-bootstrap/Button";
|
|
9
9
|
import ButtonGroup from "react-bootstrap/ButtonGroup";
|
|
10
10
|
import Dropdown from "react-bootstrap/Dropdown";
|
|
11
|
+
import { useDataset } from "../../context/DatasetContext";
|
|
11
12
|
import { OffcanvasControls } from "../offcanvas";
|
|
12
13
|
import { ScatterplotControls } from "./ScatterplotControls";
|
|
13
|
-
import { BREAKPOINTS } from "../../constants/constants";
|
|
14
14
|
import { useSettings, useSettingsDispatch } from "../../context/SettingsContext";
|
|
15
15
|
export function SpatialControls(_ref) {
|
|
16
16
|
var _features$features;
|
|
@@ -32,8 +32,8 @@ export function SpatialControls(_ref) {
|
|
|
32
32
|
const [showControls, setShowControls] = useState(false);
|
|
33
33
|
const handleCloseControls = () => setShowControls(false);
|
|
34
34
|
const handleShowControls = () => setShowControls(true);
|
|
35
|
-
const LgBreakpoint = useMediaQuery(
|
|
36
|
-
const XlBreakpoint = useMediaQuery(
|
|
35
|
+
const LgBreakpoint = useMediaQuery("(max-width: 991.98px)");
|
|
36
|
+
const XlBreakpoint = useMediaQuery("(max-width: 1199.98px)");
|
|
37
37
|
const showObsBtn = isFullscreen ? LgBreakpoint : true;
|
|
38
38
|
const showVarsBtn = isFullscreen ? XlBreakpoint : true;
|
|
39
39
|
const onSelect = (eventKey, event) => {
|
|
@@ -7,25 +7,18 @@ import React, { useEffect, useState } from "react";
|
|
|
7
7
|
import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
|
|
8
8
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
9
9
|
import _ from "lodash";
|
|
10
|
-
import { Alert,
|
|
10
|
+
import { Alert, OverlayTrigger, Tooltip } from "react-bootstrap";
|
|
11
11
|
import Plot from "react-plotly.js";
|
|
12
|
-
import {
|
|
12
|
+
import { VIOLIN_MODES } from "../../constants/constants";
|
|
13
13
|
import { useDataset } from "../../context/DatasetContext";
|
|
14
14
|
import { useFilteredData } from "../../context/FilterContext";
|
|
15
15
|
import { useSettings } from "../../context/SettingsContext";
|
|
16
16
|
import { LoadingSpinner } from "../../utils/LoadingIndicators";
|
|
17
17
|
import { useDebouncedFetch } from "../../utils/requests";
|
|
18
|
-
import { ControlsPlotlyToolbar, ObsPlotlyToolbar, VarPlotlyToolbar } from "../toolbar/Toolbar";
|
|
19
18
|
export function Violin(_ref) {
|
|
20
19
|
var _settings$selectedVar, _settings$selectedVar2, _settings$selectedVar3, _settings$selectedVar4, _settings$selectedObs, _settings$selectedObs2, _settings$selectedObs3;
|
|
21
20
|
let {
|
|
22
|
-
mode = VIOLIN_MODES.MULTIKEY
|
|
23
|
-
showObsBtn = false,
|
|
24
|
-
showVarsBtn = false,
|
|
25
|
-
showCtrlsBtn = false,
|
|
26
|
-
setShowObs,
|
|
27
|
-
setShowVars,
|
|
28
|
-
setShowControls
|
|
21
|
+
mode = VIOLIN_MODES.MULTIKEY
|
|
29
22
|
} = _ref;
|
|
30
23
|
const ENDPOINT = "violin";
|
|
31
24
|
const dataset = useDataset();
|
|
@@ -124,29 +117,17 @@ export function Violin(_ref) {
|
|
|
124
117
|
setLayout(fetchedData.layout);
|
|
125
118
|
}
|
|
126
119
|
}, [fetchedData, hasSelections, isPending, serverError]);
|
|
127
|
-
const customModeBarButtons = _.compact([showObsBtn && ObsPlotlyToolbar({
|
|
128
|
-
onClick: setShowObs
|
|
129
|
-
}), showVarsBtn && VarPlotlyToolbar({
|
|
130
|
-
onClick: setShowVars
|
|
131
|
-
}), showCtrlsBtn && ControlsPlotlyToolbar({
|
|
132
|
-
onClick: setShowControls
|
|
133
|
-
})]);
|
|
134
|
-
const modeBarButtons = customModeBarButtons.length ? [customModeBarButtons, PLOTLY_MODEBAR_BUTTONS] : [PLOTLY_MODEBAR_BUTTONS];
|
|
135
120
|
if (!serverError) {
|
|
136
121
|
if (hasSelections) {
|
|
137
122
|
return /*#__PURE__*/React.createElement("div", {
|
|
138
|
-
className: "cherita-
|
|
123
|
+
className: "cherita-violin position-relative"
|
|
139
124
|
}, isPending && /*#__PURE__*/React.createElement(LoadingSpinner, null), /*#__PURE__*/React.createElement(Plot, {
|
|
140
125
|
data: data,
|
|
141
126
|
layout: layout,
|
|
142
127
|
useResizeHandler: true,
|
|
143
128
|
style: {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
config: {
|
|
148
|
-
displaylogo: false,
|
|
149
|
-
modeBarButtons: modeBarButtons
|
|
129
|
+
maxWidth: "100%",
|
|
130
|
+
maxHeight: "100%"
|
|
150
131
|
}
|
|
151
132
|
}), (fetchedData === null || fetchedData === void 0 ? void 0 : fetchedData.resampled) && /*#__PURE__*/React.createElement(Alert, {
|
|
152
133
|
variant: "warning"
|
|
@@ -161,21 +142,9 @@ export function Violin(_ref) {
|
|
|
161
142
|
className: "cherita-violin"
|
|
162
143
|
}, mode === VIOLIN_MODES.MULTIKEY && /*#__PURE__*/React.createElement(Alert, {
|
|
163
144
|
variant: "light"
|
|
164
|
-
}, "Select",
|
|
165
|
-
variant: "link",
|
|
166
|
-
className: "border-0 p-0 align-baseline",
|
|
167
|
-
onClick: setShowVars
|
|
168
|
-
}, "features") : "features"), mode === VIOLIN_MODES.GROUPBY && /*#__PURE__*/React.createElement(Alert, {
|
|
145
|
+
}, "Select features"), mode === VIOLIN_MODES.GROUPBY && /*#__PURE__*/React.createElement(Alert, {
|
|
169
146
|
variant: "light"
|
|
170
|
-
}, "Select
|
|
171
|
-
variant: "link",
|
|
172
|
-
className: "border-0 p-0 align-baseline",
|
|
173
|
-
onClick: setShowObs
|
|
174
|
-
}, "categories") : "categories", " ", "and a", " ", showVarsBtn ? /*#__PURE__*/React.createElement(Button, {
|
|
175
|
-
variant: "link",
|
|
176
|
-
className: "border-0 p-0 align-baseline",
|
|
177
|
-
onClick: setShowVars
|
|
178
|
-
}, "feature") : "feature"));
|
|
147
|
+
}, "Select categories and a feature"));
|
|
179
148
|
} else {
|
|
180
149
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Alert, {
|
|
181
150
|
variant: "danger"
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
export const LOCAL_STORAGE_KEY = "CHERITA";
|
|
2
|
-
export const PLOT_TYPES = {
|
|
3
|
-
SCATTERPLOT: "scatterplot",
|
|
4
|
-
DOTPLOT: "dotplot",
|
|
5
|
-
HEATMAP: "heatmap",
|
|
6
|
-
MATRIXPLOT: "matrixplot",
|
|
7
|
-
VIOLINPLOT: "violinplot"
|
|
8
|
-
};
|
|
9
2
|
export const COLOR_ENCODINGS = {
|
|
10
3
|
VAR: "var",
|
|
11
4
|
OBS: "obs"
|
|
@@ -92,9 +85,4 @@ export const PSEUDOSPATIAL_CATEGORICAL_MODES = {
|
|
|
92
85
|
|
|
93
86
|
// `default` cols to be shown out of accordion, at top of obslist
|
|
94
87
|
// default values from cellxgene schema
|
|
95
|
-
export const DEFAULT_OBS_GROUP = ["assay", "cell_type", "development_stage", "disease", "donor_id", "organism", "self_reported_ethnicity", "sex", "suspension_type", "tissue", "tissue_type"];
|
|
96
|
-
export const PLOTLY_MODEBAR_BUTTONS = ["toImage", "zoom2d", "pan2d", "zoomIn2d", "zoomOut2d", "autoScale2d", "resetScale2d"];
|
|
97
|
-
export const BREAKPOINTS = {
|
|
98
|
-
LG: "(max-width: 991.98px)",
|
|
99
|
-
XL: "(max-width: 1199.98px)"
|
|
100
|
-
};
|
|
88
|
+
export const DEFAULT_OBS_GROUP = ["assay", "cell_type", "development_stage", "disease", "donor_id", "organism", "self_reported_ethnicity", "sex", "suspension_type", "tissue", "tissue_type"];
|
package/dist/esm/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export { Dotplot } from "./components/dotplot/Dotplot";
|
|
2
2
|
export { DotplotControls } from "./components/dotplot/DotplotControls";
|
|
3
|
-
export { FullPage } from "./components/full-page/FullPage";
|
|
4
3
|
export { Heatmap } from "./components/heatmap/Heatmap";
|
|
5
4
|
export { HeatmapControls } from "./components/heatmap/HeatmapControls";
|
|
6
5
|
export { Matrixplot } from "./components/matrixplot/Matrixplot";
|
|
7
6
|
export { MatrixplotControls } from "./components/matrixplot/MatrixplotControls";
|
|
8
7
|
export { ObsColsList } from "./components/obs-list/ObsList";
|
|
9
8
|
export { ObsmKeysList } from "./components/obsm-list/ObsmList";
|
|
10
|
-
export { OffcanvasControls, OffcanvasObs, OffcanvasObsm, OffcanvasVars } from "./components/offcanvas";
|
|
11
9
|
export { Pseudospatial } from "./components/pseudospatial/Pseudospatial";
|
|
12
10
|
export { Scatterplot } from "./components/scatterplot/Scatterplot";
|
|
13
11
|
export { ScatterplotControls } from "./components/scatterplot/ScatterplotControls";
|
|
14
12
|
export { SearchBar } from "./components/search-bar/SearchBar";
|
|
15
|
-
export { Toolbar } from "./components/toolbar/Toolbar";
|
|
16
13
|
export { VarNamesList } from "./components/var-list/VarList";
|
|
17
14
|
export { Violin } from "./components/violin/Violin";
|
|
18
15
|
export { ViolinControls } from "./components/violin/ViolinControls";
|
|
16
|
+
export { FullPage, FullPagePlots, FullPageScatterplot } from "./components/full-page/FullPage";
|
|
17
|
+
export { FullPagePseudospatial } from "./components/full-page/FullPagePseudospatial";
|
|
18
|
+
export { OffcanvasControls, OffcanvasObs, OffcanvasObsm, OffcanvasVars } from "./components/offcanvas";
|
|
19
19
|
export { COLORSCALES } from "./constants/colorscales";
|
|
20
|
-
export {
|
|
20
|
+
export { SELECTION_MODES, VIOLIN_MODES } from "./constants/constants";
|
|
21
21
|
export { DatasetProvider } from "./context/DatasetContext";
|
|
22
22
|
export { FilterProvider } from "./context/FilterContext";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haniffalab/cherita-react",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"author": "Haniffa Lab",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -125,6 +125,5 @@
|
|
|
125
125
|
"bugs": {
|
|
126
126
|
"url": "https://github.com/haniffalab/cherita-react/issues"
|
|
127
127
|
},
|
|
128
|
-
"homepage": "https://github.com/haniffalab/cherita-react#readme"
|
|
129
|
-
|
|
130
|
-
}
|
|
128
|
+
"homepage": "https://github.com/haniffalab/cherita-react#readme"
|
|
129
|
+
}
|
package/scss/cherita.scss
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
.cherita-app {
|
|
2
2
|
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
3
|
}
|
|
5
4
|
|
|
6
5
|
.cherita-app {
|
|
@@ -51,21 +50,6 @@
|
|
|
51
50
|
overflow-y: hidden;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
.sidebar-plotselector {
|
|
55
|
-
padding: 6px;
|
|
56
|
-
border-bottom: 1px solid #dee2e6;
|
|
57
|
-
|
|
58
|
-
.plotselector-icon {
|
|
59
|
-
padding-bottom: 2px;
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
|
|
62
|
-
.active {
|
|
63
|
-
opacity: 1;
|
|
64
|
-
border-bottom: 2px solid #007bff;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
53
|
.sidebar-pseudospatial {
|
|
70
54
|
padding: 10px;
|
|
71
55
|
border-bottom: 1px solid #dee2e6;
|
|
@@ -124,58 +108,6 @@
|
|
|
124
108
|
border-left: 1px solid #dee2e6;
|
|
125
109
|
}
|
|
126
110
|
|
|
127
|
-
.cherita-app-canvas {
|
|
128
|
-
.cherita-plot {
|
|
129
|
-
height: 100%;
|
|
130
|
-
min-height: 400px;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.cherita-app-container {
|
|
135
|
-
@extend .p-0;
|
|
136
|
-
display: flex;
|
|
137
|
-
flex-wrap: nowrap;
|
|
138
|
-
width: 100%;
|
|
139
|
-
height: 100%;
|
|
140
|
-
|
|
141
|
-
.cherita-app-obs {
|
|
142
|
-
flex: 0 0 auto;
|
|
143
|
-
min-width: 350px;
|
|
144
|
-
max-width: 20%;
|
|
145
|
-
overflow-y: auto;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.cherita-app-canvas {
|
|
149
|
-
@extend .p-1;
|
|
150
|
-
flex: 1 1 auto;
|
|
151
|
-
min-width: 400px;
|
|
152
|
-
position: relative;
|
|
153
|
-
max-height: 100%;
|
|
154
|
-
display: flex;
|
|
155
|
-
flex-direction: column;
|
|
156
|
-
|
|
157
|
-
.cherita-navbar {
|
|
158
|
-
@extend .m-0;
|
|
159
|
-
@extend .d-block;
|
|
160
|
-
position: relative;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.cherita-app-sidebar {
|
|
165
|
-
flex: 0 0 auto;
|
|
166
|
-
min-width: 350px;
|
|
167
|
-
max-width: 20%;
|
|
168
|
-
position: relative;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
@media (max-width: 1400px) {
|
|
172
|
-
.cherita-app-obs,
|
|
173
|
-
.cherita-app-sidebar {
|
|
174
|
-
max-width: 25%;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
111
|
.ps-xs-1 {
|
|
180
112
|
padding-left: 0.15rem !important;
|
|
181
|
-
}
|
|
113
|
+
}
|
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
.js-plotly-plot .plotly .modebar {
|
|
2
|
+
border-radius: 5px;
|
|
3
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
4
|
+
padding: 0 4px !important;
|
|
2
5
|
|
|
3
6
|
.modebar-group {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
padding: 4px !important;
|
|
7
|
+
margin: 0 !important;
|
|
8
|
+
padding: 0 !important;
|
|
9
|
+
background-color: transparent !important;
|
|
8
10
|
|
|
9
11
|
.modebar-btn {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
fill: white !important; /* Ensures white icons */
|
|
13
|
+
color: white !important; /* Ensures text/icons are visible */
|
|
12
14
|
position: relative;
|
|
13
|
-
font-size:
|
|
14
|
-
padding:
|
|
15
|
+
font-size: 16px;
|
|
16
|
+
padding: 4px;
|
|
15
17
|
height: auto;
|
|
16
18
|
cursor: pointer;
|
|
17
19
|
line-height: normal;
|
|
18
20
|
|
|
19
21
|
svg {
|
|
20
22
|
position: relative;
|
|
21
|
-
top:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
color: white !important;
|
|
26
|
-
}
|
|
23
|
+
top: auto;
|
|
24
|
+
bottom: auto;
|
|
25
|
+
left: auto;
|
|
26
|
+
right: auto;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
.js-plotly-plot .plotly .modebar--hover > :not(.watermark) {
|
|
33
|
-
opacity: 0.5;
|
|
34
|
-
transition: opacity 0.3s;
|
|
35
|
-
}
|