@haniffalab/cherita-react 0.2.0-dev.2024-05-22.5ce64346 → 0.2.0-dev.2024-09-26.f9979478
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/App.scss +58 -24
- package/dist/components/Offcanvas/index.js +9 -6
- package/dist/components/dotplot/Dotplot.js +5 -189
- package/dist/components/dotplot/DotplotControls.js +197 -0
- package/dist/components/heatmap/Heatmap.js +5 -31
- package/dist/components/heatmap/HeatmapControls.js +36 -0
- package/dist/components/matrixplot/Matrixplot.js +5 -59
- package/dist/components/matrixplot/MatrixplotControls.js +65 -0
- package/dist/components/obs-list/ObsList.js +231 -113
- package/dist/components/obs-list/ObsValueList.js +101 -0
- package/dist/components/obsm-list/ObsmList.js +13 -20
- package/dist/components/scatterplot/Legend.js +28 -36
- package/dist/components/scatterplot/Scatterplot.js +302 -124
- package/dist/components/scatterplot/ScatterplotControls.js +93 -0
- package/dist/components/scatterplot/SpatialControls.js +68 -17
- package/dist/components/scatterplot/Toolbox.js +14 -18
- package/dist/components/search-bar/SearchBar.js +2 -2
- package/dist/components/search-bar/SearchResults.js +2 -2
- package/dist/components/var-list/VarList.js +51 -24
- package/dist/components/violin/Violin.js +7 -46
- package/dist/components/violin/ViolinControls.js +50 -0
- package/dist/constants/colorscales.js +28 -0
- package/dist/constants/constants.js +11 -43
- package/dist/context/DatasetContext.js +122 -23
- package/dist/helpers/color-helper.js +54 -21
- package/dist/helpers/zarr-helper.js +39 -17
- package/dist/index.js +17 -11
- package/dist/utils/LoadingIndicators.js +33 -0
- package/dist/utils/requests.js +1 -1
- package/dist/utils/search.js +4 -3
- package/package.json +10 -4
- package/dist/utils/LoadingSpinner.js +0 -44
|
@@ -4,30 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SpatialControls = SpatialControls;
|
|
7
|
-
require("
|
|
8
|
-
var
|
|
9
|
-
var
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
9
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
10
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
10
11
|
var _editModes = require("@nebula.gl/edit-modes");
|
|
11
12
|
var _Button = _interopRequireDefault(require("react-bootstrap/Button"));
|
|
12
|
-
var _DropdownButton = _interopRequireDefault(require("react-bootstrap/DropdownButton"));
|
|
13
13
|
var _ButtonGroup = _interopRequireDefault(require("react-bootstrap/ButtonGroup"));
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var _Dropdown = _interopRequireDefault(require("react-bootstrap/Dropdown"));
|
|
15
|
+
var _DropdownButton = _interopRequireDefault(require("react-bootstrap/DropdownButton"));
|
|
16
|
+
var _ScatterplotControls = require("./ScatterplotControls");
|
|
17
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
18
|
+
var _Offcanvas = require("../Offcanvas");
|
|
17
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
function _interopRequireDefault(
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
23
|
function SpatialControls(_ref) {
|
|
24
|
+
var _features$features;
|
|
20
25
|
let {
|
|
21
26
|
mode,
|
|
22
27
|
setMode,
|
|
23
28
|
features,
|
|
24
|
-
setFeatures
|
|
29
|
+
setFeatures,
|
|
30
|
+
selectedFeatureIndexes,
|
|
31
|
+
resetBounds,
|
|
32
|
+
increaseZoom,
|
|
33
|
+
decreaseZoom
|
|
25
34
|
} = _ref;
|
|
35
|
+
const dataset = (0, _DatasetContext.useDataset)();
|
|
36
|
+
const dispatch = (0, _DatasetContext.useDatasetDispatch)();
|
|
26
37
|
const [showControls, setShowControls] = (0, _react.useState)(false);
|
|
27
38
|
const handleCloseControls = () => setShowControls(false);
|
|
28
39
|
const handleShowControls = () => setShowControls(true);
|
|
29
40
|
const onSelect = (eventKey, event) => {
|
|
30
|
-
console.log(eventKey); // selected event will trigger
|
|
31
41
|
switch (eventKey) {
|
|
32
42
|
case "DrawPolygonMode":
|
|
33
43
|
setMode(() => _editModes.DrawPolygonMode);
|
|
@@ -48,30 +58,71 @@ function SpatialControls(_ref) {
|
|
|
48
58
|
setMode(() => _editModes.ViewMode);
|
|
49
59
|
}
|
|
50
60
|
};
|
|
51
|
-
const deleteFeatures = (
|
|
52
|
-
console.log(eventKey); // selected event will trigger
|
|
61
|
+
const deleteFeatures = (_eventKey, _event) => {
|
|
53
62
|
setFeatures({
|
|
54
63
|
type: "FeatureCollection",
|
|
55
64
|
features: []
|
|
56
65
|
});
|
|
57
66
|
};
|
|
67
|
+
const polygonControls = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
68
|
+
className: "mt-2",
|
|
69
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
70
|
+
vertical: true,
|
|
71
|
+
className: "w-100",
|
|
72
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
73
|
+
variant: dataset.sliceBy.polygons ? "primary" : "outline-primary",
|
|
74
|
+
title: "Filter data with polygons",
|
|
75
|
+
onClick: () => {
|
|
76
|
+
setMode(() => _editModes.ViewMode);
|
|
77
|
+
dispatch({
|
|
78
|
+
type: "toggle.slice.polygons"
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.JoinInner, {})
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
83
|
+
variant: "outline-primary",
|
|
84
|
+
title: "Delete selected polygons",
|
|
85
|
+
onClick: () => {
|
|
86
|
+
const newFeatures = features.features.filter((_f, i) => !selectedFeatureIndexes.includes(i));
|
|
87
|
+
setFeatures({
|
|
88
|
+
type: "FeatureCollection",
|
|
89
|
+
features: newFeatures
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
disabled: !selectedFeatureIndexes.length,
|
|
93
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
94
|
+
icon: _freeSolidSvgIcons.faTrash
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
});
|
|
58
99
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
59
100
|
className: "cherita-spatial-controls",
|
|
60
101
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
61
102
|
vertical: true,
|
|
103
|
+
className: "w-100",
|
|
62
104
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
105
|
+
onClick: increaseZoom,
|
|
106
|
+
title: "Increase zoom",
|
|
63
107
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
64
108
|
icon: _freeSolidSvgIcons.faPlus
|
|
65
109
|
})
|
|
66
110
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
111
|
+
onClick: decreaseZoom,
|
|
112
|
+
title: "Decrease zoom",
|
|
67
113
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
68
114
|
icon: _freeSolidSvgIcons.faMinus
|
|
69
115
|
})
|
|
70
116
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
117
|
+
onClick: resetBounds,
|
|
118
|
+
title: "Reset zoom and center",
|
|
71
119
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
72
120
|
icon: _freeSolidSvgIcons.faCrosshairs
|
|
73
121
|
})
|
|
74
122
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
123
|
+
onClick: () => setMode(() => _editModes.ViewMode),
|
|
124
|
+
title: "Set dragging mode",
|
|
125
|
+
variant: mode === _editModes.ViewMode ? "primary" : "outline-primary",
|
|
75
126
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
76
127
|
icon: _freeSolidSvgIcons.faHand
|
|
77
128
|
})
|
|
@@ -88,7 +139,7 @@ function SpatialControls(_ref) {
|
|
|
88
139
|
onSelect: onSelect,
|
|
89
140
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Header, {
|
|
90
141
|
children: "Selection tools"
|
|
91
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.
|
|
142
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
|
|
92
143
|
eventKey: "DrawPolygonMode",
|
|
93
144
|
children: "Draw a polygon"
|
|
94
145
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
|
|
@@ -99,12 +150,12 @@ function SpatialControls(_ref) {
|
|
|
99
150
|
children: "Modify polygons"
|
|
100
151
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
|
|
101
152
|
eventKey: "ViewMode",
|
|
102
|
-
children: "
|
|
153
|
+
children: "Viewing mode"
|
|
103
154
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default.Item, {
|
|
104
155
|
onClick: deleteFeatures,
|
|
105
156
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
106
157
|
icon: _freeSolidSvgIcons.faTrash
|
|
107
|
-
}), " Delete
|
|
158
|
+
}), " Delete polygons"]
|
|
108
159
|
})]
|
|
109
160
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
110
161
|
onClick: handleShowControls,
|
|
@@ -112,10 +163,10 @@ function SpatialControls(_ref) {
|
|
|
112
163
|
icon: _freeSolidSvgIcons.faSliders
|
|
113
164
|
})
|
|
114
165
|
})]
|
|
115
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
166
|
+
}), !!(features !== null && features !== void 0 && (_features$features = features.features) !== null && _features$features !== void 0 && _features$features.length) && polygonControls, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.OffcanvasControls, {
|
|
116
167
|
show: showControls,
|
|
117
168
|
handleClose: handleCloseControls,
|
|
118
|
-
Controls:
|
|
169
|
+
Controls: _ScatterplotControls.ScatterplotControls
|
|
119
170
|
})]
|
|
120
171
|
});
|
|
121
172
|
}
|
|
@@ -4,39 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Toolbox = Toolbox;
|
|
7
|
-
require("bootstrap/dist/css/bootstrap.min.css");
|
|
8
|
-
var _Dropdown = _interopRequireDefault(require("react-bootstrap/Dropdown"));
|
|
9
7
|
var _react = require("react");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var _cheritaReact = require("@haniffalab/cherita-react");
|
|
8
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
9
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
13
10
|
var _Button = _interopRequireDefault(require("react-bootstrap/Button"));
|
|
14
|
-
var _DropdownButton = _interopRequireDefault(require("react-bootstrap/DropdownButton"));
|
|
15
11
|
var _ButtonGroup = _interopRequireDefault(require("react-bootstrap/ButtonGroup"));
|
|
16
|
-
var
|
|
17
|
-
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
12
|
+
var _ObsmList = require("../obsm-list/ObsmList");
|
|
18
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
15
|
function Toolbox(_ref) {
|
|
21
16
|
let {
|
|
22
17
|
mode,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
setFeatures
|
|
18
|
+
obsLength,
|
|
19
|
+
slicedLength
|
|
26
20
|
} = _ref;
|
|
27
|
-
const dataset = (0, _DatasetContext.useDataset)();
|
|
28
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
29
22
|
className: "cherita-toolbox",
|
|
30
23
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
31
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
24
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ObsmList.ObsmKeysList, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
32
25
|
size: "sm",
|
|
33
26
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
34
27
|
icon: _freeSolidSvgIcons.faDroplet
|
|
35
|
-
}), "
|
|
36
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
28
|
+
}), " ", mode]
|
|
29
|
+
}), (mode || !Number.isNaN(obsLength)) && (mode !== null && !Number.isNaN(slicedLength) && slicedLength !== obsLength ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
30
|
+
size: "sm",
|
|
31
|
+
children: [slicedLength.toLocaleString(), " out of", " ", obsLength.toLocaleString(), " cells"]
|
|
32
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
37
33
|
size: "sm",
|
|
38
|
-
children: "
|
|
39
|
-
})]
|
|
34
|
+
children: [obsLength.toLocaleString(), " cells"]
|
|
35
|
+
}))]
|
|
40
36
|
})
|
|
41
37
|
});
|
|
42
38
|
}
|
|
@@ -9,9 +9,9 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
9
9
|
var _reactBootstrap = require("react-bootstrap");
|
|
10
10
|
var _SearchResults = require("./SearchResults");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
function SearchBar(_ref) {
|
|
16
16
|
let {
|
|
17
17
|
searchVar = true,
|
|
@@ -11,9 +11,9 @@ var _reactBootstrap = require("react-bootstrap");
|
|
|
11
11
|
var _DatasetContext = require("../../context/DatasetContext");
|
|
12
12
|
var _search = require("../../utils/search");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
function VarSearchResults(_ref) {
|
|
18
18
|
let {
|
|
19
19
|
text,
|
|
@@ -4,18 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VarNamesList = VarNamesList;
|
|
7
|
-
require("bootstrap/dist/css/bootstrap.min.css");
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
9
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
9
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
11
|
var _reactBootstrap = require("react-bootstrap");
|
|
11
|
-
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
12
|
-
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
13
|
-
var _DatasetContext = require("../../context/DatasetContext");
|
|
14
12
|
var _constants = require("../../constants/constants");
|
|
13
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
18
|
function VarNamesList(_ref) {
|
|
20
19
|
var _dataset$selectedVar, _dataset$selectedDise, _dataset$selectedDise2, _dataset$selectedDise3;
|
|
21
20
|
let {
|
|
@@ -33,7 +32,7 @@ function VarNamesList(_ref) {
|
|
|
33
32
|
if (dataset.selectedVar) {
|
|
34
33
|
return _lodash.default.unionWith(v, [dataset.selectedVar], _lodash.default.isEqual);
|
|
35
34
|
} else {
|
|
36
|
-
return
|
|
35
|
+
return v;
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
38
|
setActive((_dataset$selectedVar2 = dataset.selectedVar) === null || _dataset$selectedVar2 === void 0 ? void 0 : _dataset$selectedVar2.matrix_index);
|
|
@@ -45,7 +44,7 @@ function VarNamesList(_ref) {
|
|
|
45
44
|
if (dataset.selectedMultiVar.length) {
|
|
46
45
|
return _lodash.default.unionWith(v, dataset.selectedMultiVar, _lodash.default.isEqual);
|
|
47
46
|
} else {
|
|
48
|
-
return
|
|
47
|
+
return v;
|
|
49
48
|
}
|
|
50
49
|
});
|
|
51
50
|
setActive(dataset.selectedMultiVar.map(i => i.matrix_index));
|
|
@@ -54,7 +53,7 @@ function VarNamesList(_ref) {
|
|
|
54
53
|
const selectVar = (0, _react.useCallback)(item => {
|
|
55
54
|
if (mode === _constants.SELECTION_MODES.SINGLE) {
|
|
56
55
|
dispatch({
|
|
57
|
-
type: "
|
|
56
|
+
type: "select.var",
|
|
58
57
|
var: item
|
|
59
58
|
});
|
|
60
59
|
dispatch({
|
|
@@ -63,19 +62,38 @@ function VarNamesList(_ref) {
|
|
|
63
62
|
});
|
|
64
63
|
} else if (mode === _constants.SELECTION_MODES.MULTIPLE) {
|
|
65
64
|
dispatch({
|
|
66
|
-
type: "
|
|
65
|
+
type: "select.multivar",
|
|
67
66
|
var: item
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
}, [dispatch, mode]);
|
|
70
|
+
const removeVar = (0, _react.useCallback)(v => {
|
|
71
|
+
setVarButtons(b => {
|
|
72
|
+
return b.filter(i => i.name !== v.name);
|
|
73
|
+
});
|
|
74
|
+
if (mode === _constants.SELECTION_MODES.SINGLE) {
|
|
75
|
+
if (active === v.matrix_index) {
|
|
76
|
+
dispatch({
|
|
77
|
+
type: "deselect.var"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} else if (mode === _constants.SELECTION_MODES.MULTIPLE) {
|
|
81
|
+
if (active.includes(v.matrix_index)) {
|
|
82
|
+
dispatch({
|
|
83
|
+
type: "deselect.multivar",
|
|
84
|
+
var: v
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [active, dispatch, mode]);
|
|
71
89
|
const makeList = (0, _react.useCallback)(vars => {
|
|
72
90
|
return vars.map(item => {
|
|
73
91
|
if (item && mode === _constants.SELECTION_MODES.SINGLE) {
|
|
74
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
75
93
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
76
|
-
|
|
94
|
+
className: "d-flex gap-1",
|
|
77
95
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
78
|
-
|
|
96
|
+
className: "flex-grow-1",
|
|
79
97
|
children: item.name
|
|
80
98
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
81
99
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
@@ -84,37 +102,45 @@ function VarNamesList(_ref) {
|
|
|
84
102
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
85
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
86
104
|
type: "button",
|
|
87
|
-
|
|
105
|
+
variant: dataset.colorEncoding === _constants.COLOR_ENCODINGS.VAR && active === item.matrix_index ? "primary" : "outline-primary",
|
|
106
|
+
className: "m-0 p-0 px-1",
|
|
88
107
|
onClick: () => {
|
|
89
108
|
selectVar(item);
|
|
90
109
|
},
|
|
91
110
|
disabled: item.matrix_index === -1,
|
|
92
|
-
title: item.matrix_index === -1 ? "Not present in data" : "",
|
|
111
|
+
title: item.matrix_index === -1 ? "Not present in data" : "Set as color encoding",
|
|
93
112
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
94
113
|
icon: _freeSolidSvgIcons.faDroplet
|
|
95
114
|
})
|
|
96
115
|
}, item.matrix_index)
|
|
97
116
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
99
|
-
|
|
117
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
118
|
+
type: "button",
|
|
119
|
+
className: "m-0 p-0 px-1",
|
|
120
|
+
variant: "outline-secondary",
|
|
121
|
+
title: "Remove from list",
|
|
122
|
+
onClick: () => removeVar(item),
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
124
|
+
icon: _freeSolidSvgIcons.faTrash
|
|
125
|
+
})
|
|
100
126
|
})
|
|
101
127
|
})]
|
|
102
128
|
})
|
|
103
|
-
}, item);
|
|
129
|
+
}, item.name);
|
|
104
130
|
} else if (mode === _constants.SELECTION_MODES.MULTIPLE) {
|
|
105
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
106
132
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
107
|
-
|
|
133
|
+
className: "d-flex",
|
|
108
134
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
109
|
-
|
|
135
|
+
className: "flex-grow-1",
|
|
110
136
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
111
137
|
type: "button",
|
|
112
|
-
variant: item.matrix_index !== -1 ? "
|
|
113
|
-
className: "
|
|
138
|
+
variant: item.matrix_index !== -1 && _lodash.default.includes(active, item.matrix_index) ? "primary" : "outline-primary",
|
|
139
|
+
className: "m-0 p-0 px-1",
|
|
114
140
|
onClick: () => {
|
|
115
141
|
if (active.includes(item.matrix_index)) {
|
|
116
142
|
dispatch({
|
|
117
|
-
type: "
|
|
143
|
+
type: "deselect.multivar",
|
|
118
144
|
var: item
|
|
119
145
|
});
|
|
120
146
|
} else {
|
|
@@ -131,12 +157,12 @@ function VarNamesList(_ref) {
|
|
|
131
157
|
})]
|
|
132
158
|
})]
|
|
133
159
|
})
|
|
134
|
-
}, item);
|
|
160
|
+
}, item.name);
|
|
135
161
|
} else {
|
|
136
162
|
return null;
|
|
137
163
|
}
|
|
138
164
|
});
|
|
139
|
-
}, [active, dispatch, mode, selectVar]);
|
|
165
|
+
}, [active, dataset.colorEncoding, dispatch, mode, removeVar, selectVar]);
|
|
140
166
|
const varList = (0, _react.useMemo)(() => {
|
|
141
167
|
return makeList(varButtons);
|
|
142
168
|
}, [makeList, varButtons]);
|
|
@@ -155,6 +181,7 @@ function VarNamesList(_ref) {
|
|
|
155
181
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
156
182
|
variant: "link",
|
|
157
183
|
onClick: () => {
|
|
184
|
+
setVarButtons([]);
|
|
158
185
|
dispatch({
|
|
159
186
|
type: mode === _constants.SELECTION_MODES.SINGLE ? "reset.var" : "reset.multiVar"
|
|
160
187
|
});
|
|
@@ -4,58 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Violin = Violin;
|
|
7
|
-
exports.ViolinControls = ViolinControls;
|
|
8
|
-
require("bootstrap/dist/css/bootstrap.min.css");
|
|
9
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
11
8
|
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
9
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
10
|
+
var _reactBootstrap = require("react-bootstrap");
|
|
12
11
|
var _reactPlotly = _interopRequireDefault(require("react-plotly.js"));
|
|
13
|
-
var _DatasetContext = require("../../context/DatasetContext");
|
|
14
12
|
var _constants = require("../../constants/constants");
|
|
15
|
-
var
|
|
13
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
14
|
+
var _LoadingIndicators = require("../../utils/LoadingIndicators");
|
|
16
15
|
var _requests = require("../../utils/requests");
|
|
17
|
-
var _LoadingSpinner = require("../../utils/LoadingSpinner");
|
|
18
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
function _interopRequireDefault(
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
22
|
-
function ViolinControls() {
|
|
23
|
-
const dataset = (0, _DatasetContext.useDataset)();
|
|
24
|
-
const dispatch = (0, _DatasetContext.useDatasetDispatch)();
|
|
25
|
-
const [activeStandardScale, setActiveStandardScale] = (0, _react.useState)(dataset.controls.standardScale);
|
|
26
|
-
(0, _react.useEffect)(() => {
|
|
27
|
-
if (dataset.controls.standardScale) {
|
|
28
|
-
setActiveStandardScale(_constants.VIOLINPLOT_STANDARDSCALES.find(obs => obs.value === dataset.controls.standardScale).name);
|
|
29
|
-
}
|
|
30
|
-
}, [dataset.controls.standardScale]);
|
|
31
|
-
const standardScaleList = _constants.VIOLINPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
32
|
-
active: activeStandardScale === item.value,
|
|
33
|
-
onClick: () => {
|
|
34
|
-
dispatch({
|
|
35
|
-
type: "set.controls.standardScale",
|
|
36
|
-
standardScale: item.value
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
children: item.name
|
|
40
|
-
}, item.value));
|
|
41
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonToolbar, {
|
|
42
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
|
|
43
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
44
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
|
|
45
|
-
children: "Standard scale"
|
|
46
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Dropdown, {
|
|
47
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Toggle, {
|
|
48
|
-
id: "dropdownStandardScale",
|
|
49
|
-
variant: "light",
|
|
50
|
-
children: activeStandardScale
|
|
51
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Menu, {
|
|
52
|
-
children: standardScaleList
|
|
53
|
-
})]
|
|
54
|
-
})]
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
59
20
|
function Violin(_ref) {
|
|
60
21
|
let {
|
|
61
22
|
mode = _constants.VIOLIN_MODES.MULTIKEY
|
|
@@ -124,7 +85,7 @@ function Violin(_ref) {
|
|
|
124
85
|
if (hasSelections) {
|
|
125
86
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
126
87
|
className: "cherita-violin position-relative",
|
|
127
|
-
children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
88
|
+
children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingIndicators.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h5", {
|
|
128
89
|
children: mode
|
|
129
90
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
|
|
130
91
|
data: data,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ViolinControls = ViolinControls;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactBootstrap = require("react-bootstrap");
|
|
9
|
+
var _constants = require("../../constants/constants");
|
|
10
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function ViolinControls() {
|
|
15
|
+
const dataset = (0, _DatasetContext.useDataset)();
|
|
16
|
+
const dispatch = (0, _DatasetContext.useDatasetDispatch)();
|
|
17
|
+
const [activeStandardScale, setActiveStandardScale] = (0, _react.useState)(dataset.controls.standardScale);
|
|
18
|
+
(0, _react.useEffect)(() => {
|
|
19
|
+
if (dataset.controls.standardScale) {
|
|
20
|
+
setActiveStandardScale(_constants.VIOLINPLOT_STANDARDSCALES.find(obs => obs.value === dataset.controls.standardScale).name);
|
|
21
|
+
}
|
|
22
|
+
}, [dataset.controls.standardScale]);
|
|
23
|
+
const standardScaleList = _constants.VIOLINPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
24
|
+
active: activeStandardScale === item.value,
|
|
25
|
+
onClick: () => {
|
|
26
|
+
dispatch({
|
|
27
|
+
type: "set.controls.standardScale",
|
|
28
|
+
standardScale: item.value
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
children: item.name
|
|
32
|
+
}, item.value));
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonToolbar, {
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
36
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
|
|
37
|
+
children: "Standard scale"
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Dropdown, {
|
|
39
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Toggle, {
|
|
40
|
+
id: "dropdownStandardScale",
|
|
41
|
+
variant: "light",
|
|
42
|
+
children: activeStandardScale
|
|
43
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Menu, {
|
|
44
|
+
children: standardScaleList
|
|
45
|
+
})]
|
|
46
|
+
})]
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.COLORSCALES = void 0;
|
|
7
|
+
// From plotly https://github.com/plotly/plotly.js/blob/5bc25b490702e5ed61265207833dbd58e8ab27f1/src/components/colorscale/scales.js
|
|
8
|
+
const COLORSCALES = exports.COLORSCALES = {
|
|
9
|
+
Greys: ["#000000", "#ffffff"],
|
|
10
|
+
YlGnBu: ["#081d58", "#253494", "#225ea8", "#1d91c0", "#41b6c4", "#7fcdbb", "#c7e9b4", "#edf8d9", "#ffffd9"],
|
|
11
|
+
Greens: ["#00441b", "#006d2c", "#238b45", "#41ab5d", "#74c476", "#a1d9a5", "#c7e9c0", "#e5f5e0", "#f7fcf5"],
|
|
12
|
+
YlOrRd: ["#800026", "#bd0026", "#e31a1c", "#fc4e2a", "#fd8d3c", "#feb24c", "#fed976", "#ffed9f", "#ffffcc"],
|
|
13
|
+
Bluered: ["#0000ff", "#ff0000"],
|
|
14
|
+
RdBu: ["#050aac", "#6a89f7", "#bebebe", "#dcaa84", "#e6915a", "#b20a1c"],
|
|
15
|
+
Reds: ["#dcdcdc", "#f5c39d", "#f5a069", "#b20a1c"],
|
|
16
|
+
Blues: ["#050aac", "#283cba", "#4664f5", "#5a78f5", "#6a89f7", "#dcdcdc"],
|
|
17
|
+
Picnic: ["#0000ff", "#3399ff", "#66ccff", "#99ccff", "#ccccff", "#ffffff", "#ffccff", "#ff99ff", "#ff66cc", "#ff6666", "#ff0000"],
|
|
18
|
+
Rainbow: ["#96005a", "#0000c8", "#0019ff", "#0098ff", "#2cff96", "#97ff00", "#ffe600", "#ff6f00", "#ff0000"],
|
|
19
|
+
Portland: ["#0c3383", "#0a88ba", "#f2d338", "#f28f38", "#d91e1e"],
|
|
20
|
+
Jet: ["#000083", "#003caa", "#05ffff", "#ffff00", "#fa0000", "#800000"],
|
|
21
|
+
Hot: ["#000000", "#e60000", "#ffd200", "#ffffff"],
|
|
22
|
+
Blackbody: ["#000000", "#e60000", "#e6d200", "#ffffff", "#a0c8ff"],
|
|
23
|
+
Earth: ["#000082", "#00b4b4", "#28d228", "#e6e632", "#784614", "#ffffff"],
|
|
24
|
+
Electric: ["#000000", "#1e0064", "#780064", "#a05a00", "#e6c800", "#fffadc"],
|
|
25
|
+
Viridis: ["#440154", "#48186a", "#472d7b", "#424086", "#3b528b", "#33638d", "#2c728e", "#26828e", "#21918c", "#1fa088", "#28ae80", "#3fbc73", "#5ec962", "#84d44b", "#addc30", "#d8e219", "#fde725"],
|
|
26
|
+
Cividis: ["#00204c", "#002a66", "#00346e", "#273f6c", "#3c4a6c", "#4c556b", "#5b5f6d", "#686a70", "#757575", "#838178", "#929c78", "#a19676", "#b0a572", "#c0af6d", "#d1ba65", "#e1c75c", "#f3db4f", "#ffe945"],
|
|
27
|
+
Accent: ["#7fc97f", "#beaed4", "#fdc086", "#ffff99", "#386cb0", "#f0027f", "#bf5b17", "#666666"]
|
|
28
|
+
};
|