@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.
Files changed (32) hide show
  1. package/dist/App.scss +58 -24
  2. package/dist/components/Offcanvas/index.js +9 -6
  3. package/dist/components/dotplot/Dotplot.js +5 -189
  4. package/dist/components/dotplot/DotplotControls.js +197 -0
  5. package/dist/components/heatmap/Heatmap.js +5 -31
  6. package/dist/components/heatmap/HeatmapControls.js +36 -0
  7. package/dist/components/matrixplot/Matrixplot.js +5 -59
  8. package/dist/components/matrixplot/MatrixplotControls.js +65 -0
  9. package/dist/components/obs-list/ObsList.js +231 -113
  10. package/dist/components/obs-list/ObsValueList.js +101 -0
  11. package/dist/components/obsm-list/ObsmList.js +13 -20
  12. package/dist/components/scatterplot/Legend.js +28 -36
  13. package/dist/components/scatterplot/Scatterplot.js +302 -124
  14. package/dist/components/scatterplot/ScatterplotControls.js +93 -0
  15. package/dist/components/scatterplot/SpatialControls.js +68 -17
  16. package/dist/components/scatterplot/Toolbox.js +14 -18
  17. package/dist/components/search-bar/SearchBar.js +2 -2
  18. package/dist/components/search-bar/SearchResults.js +2 -2
  19. package/dist/components/var-list/VarList.js +51 -24
  20. package/dist/components/violin/Violin.js +7 -46
  21. package/dist/components/violin/ViolinControls.js +50 -0
  22. package/dist/constants/colorscales.js +28 -0
  23. package/dist/constants/constants.js +11 -43
  24. package/dist/context/DatasetContext.js +122 -23
  25. package/dist/helpers/color-helper.js +54 -21
  26. package/dist/helpers/zarr-helper.js +39 -17
  27. package/dist/index.js +17 -11
  28. package/dist/utils/LoadingIndicators.js +33 -0
  29. package/dist/utils/requests.js +1 -1
  30. package/dist/utils/search.js +4 -3
  31. package/package.json +10 -4
  32. package/dist/utils/LoadingSpinner.js +0 -44
package/dist/App.scss CHANGED
@@ -1,6 +1,19 @@
1
1
  @import "bootstrap/scss/bootstrap";
2
2
 
3
3
  // Theme CSS
4
+
5
+ .loading-spinner {
6
+ @extend .bg-light;
7
+ height: 100%;
8
+ width: 100%;
9
+ display: flex;
10
+ z-index: 1;
11
+ opacity: 75%;
12
+ position: absolute;
13
+ justify-content: center;
14
+ align-items: center;
15
+ }
16
+
4
17
  .cherita-container {
5
18
  margin: 40px auto;
6
19
  background-color: #fff;
@@ -13,11 +26,13 @@
13
26
  }
14
27
 
15
28
  .cherita-navbar {
29
+ @extend .mx-1;
30
+ @extend .my-2;
16
31
  position: absolute;
17
32
  z-index: 11;
18
- top: 20px;
19
- right: 20px;
20
- left: 20px;
33
+ top: 0;
34
+ left: 0;
35
+ right: 0;
21
36
  border-radius: 0.25rem;
22
37
  }
23
38
 
@@ -59,55 +74,74 @@
59
74
 
60
75
  .cherita-container-scatterplot {
61
76
  position: relative;
62
- min-height: 300px;
77
+ min-height: 500px;
63
78
  height: 100%;
64
79
  }
65
80
 
66
- .cherita-toolbox {
81
+ .cherita-alert {
67
82
  position: absolute;
68
83
  z-index: 10;
69
- bottom: 20px;
84
+ bottom: 40px;
70
85
  left: 20px;
71
86
  }
72
87
  .cherita-spatial-controls {
73
88
  position: absolute;
74
89
  z-index: 10;
75
- top: 20px;
76
- left: 20px;
90
+ top: 1rem;
91
+ left: 1rem;
92
+ width: 3rem;
77
93
  }
78
94
 
79
- @include media-breakpoint-down(xl) {
80
- .cherita-spatial-controls {
81
- top: 100px;
82
- }
83
- .cherita-toolbox {
84
- right: 20px;
85
- left: auto;
95
+ .cherita-spatial-footer {
96
+ position: absolute;
97
+ z-index: 10;
98
+ bottom: 1rem;
99
+ display: flex;
100
+ justify-content: space-between;
101
+ align-items: flex-end;
102
+ flex-wrap: wrap;
103
+ width: 100%;
104
+ padding-left: 2rem;
105
+ padding-right: 2rem;
106
+ padding-bottom: 1rem;
107
+ pointer-events: none;
108
+ > * {
109
+ pointer-events: auto;
86
110
  }
87
- }
88
-
89
-
111
+ }
90
112
 
113
+ .cherita-toolbox {
114
+ order: 1;
115
+ }
91
116
 
92
117
  .cherita-legend {
93
- position: absolute;
94
- z-index: 10;
95
- bottom: 20px;
96
- right: 20px;
97
- width: 200px;
118
+ order: 2;
119
+ width: 12rem;
98
120
  }
99
121
 
122
+ @include media-breakpoint-down(xl) {
123
+ .cherita-spatial-controls {
124
+ top: 100px;
125
+ }
126
+ }
127
+
100
128
  .cherita-accordion-active .accordion-button {
101
129
  background-color: $accordion-button-active-bg
102
130
  }
103
131
 
132
+ .obs-value-list-check {
133
+ padding-right: 1rem;
134
+ word-break: auto-phrase;
135
+ overflow-wrap: anywhere;
136
+ }
137
+
104
138
  .grad-step {
105
139
  display: inline-block;
106
140
  height: 20px;
107
141
  width: 1%;
108
142
  }
109
143
  .gradient {
110
- width: 85%;
144
+ width: 100%;
111
145
  white-space: nowrap;
112
146
  position: relative;
113
147
  display: inline-block;
@@ -10,10 +10,13 @@ exports.OffcanvasObsm = OffcanvasObsm;
10
10
  exports.OffcanvasVars = OffcanvasVars;
11
11
  var _react = require("react");
12
12
  var _Offcanvas = _interopRequireDefault(require("react-bootstrap/Offcanvas"));
13
- var _cheritaReact = require("@haniffalab/cherita-react");
13
+ var _constants = require("../../constants/constants");
14
+ var _ObsList = require("../obs-list/ObsList");
15
+ var _ObsmList = require("../obsm-list/ObsmList");
14
16
  var _SearchBar = require("../search-bar/SearchBar");
17
+ var _VarList = require("../var-list/VarList");
15
18
  var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
20
  function OffcanvasObs(_ref) {
18
21
  let {
19
22
  show,
@@ -30,7 +33,7 @@ function OffcanvasObs(_ref) {
30
33
  children: "Categories"
31
34
  })
32
35
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Body, {
33
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_cheritaReact.ObsColsList, {})
36
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ObsList.ObsColsList, {})
34
37
  })]
35
38
  });
36
39
  }
@@ -48,7 +51,7 @@ function OffcanvasObsm(_ref2) {
48
51
  children: "Embedding space"
49
52
  })
50
53
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Body, {
51
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_cheritaReact.ObsmKeysList, {})
54
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ObsmList.ObsmKeysList, {})
52
55
  })]
53
56
  });
54
57
  }
@@ -56,7 +59,7 @@ function OffcanvasVars(_ref3) {
56
59
  let {
57
60
  show,
58
61
  handleClose,
59
- mode = _cheritaReact.SELECTION_MODES.MULTIPLE
62
+ mode = _constants.SELECTION_MODES.MULTIPLE
60
63
  } = _ref3;
61
64
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default, {
62
65
  show: show,
@@ -69,7 +72,7 @@ function OffcanvasVars(_ref3) {
69
72
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default.Body, {
70
73
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBar.SearchBar, {
71
74
  searchDiseases: true
72
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_cheritaReact.VarNamesList, {
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_VarList.VarNamesList, {
73
76
  mode: mode
74
77
  })]
75
78
  })]
@@ -4,200 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Dotplot = Dotplot;
7
- exports.DotplotControls = DotplotControls;
8
- require("bootstrap/dist/css/bootstrap.min.css");
9
- var _Dropdown = _interopRequireDefault(require("react-bootstrap/Dropdown"));
10
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _reactBootstrap = require("react-bootstrap");
11
9
  var _reactPlotly = _interopRequireDefault(require("react-plotly.js"));
12
10
  var _DatasetContext = require("../../context/DatasetContext");
13
- var _constants = require("../../constants/constants");
11
+ var _LoadingIndicators = require("../../utils/LoadingIndicators");
14
12
  var _requests = require("../../utils/requests");
15
- var _reactBootstrap = require("react-bootstrap");
16
- var _LoadingSpinner = require("../../utils/LoadingSpinner");
17
13
  var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
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); }
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 && Object.prototype.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; }
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
- function DotplotControls() {
22
- const dataset = (0, _DatasetContext.useDataset)();
23
- const dispatch = (0, _DatasetContext.useDatasetDispatch)();
24
- const [controls, setControls] = (0, _react.useState)({
25
- standardScale: dataset.controls.standardScale,
26
- expressionCutoff: dataset.controls.expressionCutoff,
27
- colorAxis: {
28
- cmin: dataset.controls.colorAxis.cmin,
29
- cmax: dataset.controls.colorAxis.cmax
30
- }
31
- });
32
- (0, _react.useEffect)(() => {
33
- setControls(c => ({
34
- ...c,
35
- colorAxis: {
36
- cmin: dataset.controls.colorAxis.cmin,
37
- cmax: dataset.controls.colorAxis.cmax
38
- }
39
- }));
40
- }, [dataset.controls.colorAxis.cmin, dataset.controls.colorAxis.cmax]);
41
- const colorScaleList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
42
- active: dataset.controls.colorScale === item,
43
- onClick: () => {
44
- dispatch({
45
- type: "set.controls.colorScale",
46
- colorScale: item
47
- });
48
- },
49
- children: item
50
- }, item));
51
- const standardScaleList = _constants.DOTPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
52
- active: dataset.controls.standardScale === item.value,
53
- onClick: () => {
54
- dispatch({
55
- type: "set.controls.standardScale",
56
- standardScale: item.value
57
- });
58
- },
59
- children: item.name
60
- }, item.value));
61
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonToolbar, {
62
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
63
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
64
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Toggle, {
65
- id: "dropdownColorscale",
66
- variant: "light",
67
- children: dataset.controls.colorScale
68
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Menu, {
69
- children: colorScaleList
70
- })]
71
- })
72
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
73
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
74
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
75
- children: "Standard scale"
76
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
77
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Toggle, {
78
- id: "dropdownStandardScale",
79
- variant: "light",
80
- children: dataset.controls.standardScale
81
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Menu, {
82
- children: standardScaleList
83
- })]
84
- })]
85
- })
86
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
87
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ToggleButton, {
88
- id: "toggleMeanOnlyExpressed",
89
- type: "checkbox",
90
- variant: "outline-primary",
91
- checked: dataset.controls.meanOnlyExpressed,
92
- onChange: () => {
93
- dispatch({
94
- type: "set.controls.meanOnlyExpressed",
95
- meanOnlyExpressed: !dataset.controls.meanOnlyExpressed
96
- });
97
- },
98
- children: "Average only above cutoff"
99
- })
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form, {
101
- onSubmit: e => {
102
- e.preventDefault();
103
- dispatch({
104
- type: "set.controls.expressionCutoff",
105
- expressionCutoff: parseFloat(controls.expressionCutoff)
106
- });
107
- },
108
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
109
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
110
- children: "Expression Cutoff"
111
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
112
- size: "sm",
113
- type: "number",
114
- step: "0.1",
115
- min: 0.0,
116
- value: controls.expressionCutoff,
117
- onChange: e => {
118
- setControls({
119
- ...controls,
120
- expressionCutoff: e.target.value
121
- });
122
- }
123
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
124
- type: "submit",
125
- variant: "outline-primary",
126
- children: "Apply"
127
- })]
128
- })
129
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form, {
130
- onSubmit: e => {
131
- e.preventDefault();
132
- dispatch({
133
- type: "set.controls.colorAxis.crange",
134
- cmin: controls.colorAxis.cmin,
135
- cmax: controls.colorAxis.cmax
136
- });
137
- },
138
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
139
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
140
- children: "Colorscale"
141
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
142
- children: "min"
143
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
144
- name: "scaleMin",
145
- size: "sm",
146
- type: "number",
147
- value: controls.colorAxis.cmin,
148
- step: 0.1,
149
- min: Math.min(dataset.controls.colorAxis.dmin, 0.0),
150
- max: dataset.controls.colorAxis.dmax,
151
- onChange: e => {
152
- setControls({
153
- ...controls,
154
- colorAxis: {
155
- ...controls.colorAxis,
156
- cmin: e.target.value
157
- }
158
- });
159
- }
160
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
161
- children: "max"
162
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
163
- name: "scaleMax",
164
- size: "sm",
165
- type: "number",
166
- value: controls.colorAxis.cmax,
167
- step: 0.1,
168
- min: controls.colorAxis.cmin,
169
- max: dataset.controls.colorAxis.dmax,
170
- onChange: e => {
171
- if (parseFloat(e.target.value) > dataset.controls.colorAxis.dmax) {
172
- e.target.value = dataset.controls.colorAxis.dmax.toFixed(1);
173
- }
174
- setControls({
175
- ...controls,
176
- colorAxis: {
177
- ...controls.colorAxis,
178
- cmax: e.target.value
179
- }
180
- });
181
- }
182
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
183
- type: "submit",
184
- variant: "outline-primary",
185
- children: "Apply"
186
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
187
- variant: "outline-primary",
188
- onClick: () => {
189
- dispatch({
190
- type: "set.controls.colorAxis.crange",
191
- cmin: dataset.controls.colorAxis.dmin,
192
- cmax: dataset.controls.colorAxis.dmax
193
- });
194
- },
195
- children: "Autoscale"
196
- })]
197
- })
198
- })]
199
- });
200
- }
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; }
201
17
  function Dotplot() {
202
18
  const ENDPOINT = "dotplot";
203
19
  const dataset = (0, _DatasetContext.useDataset)();
@@ -290,7 +106,7 @@ function Dotplot() {
290
106
  if (hasSelections) {
291
107
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
292
108
  className: "cherita-dotplot position-relative",
293
- children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingSpinner.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
109
+ children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingIndicators.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
294
110
  data: data,
295
111
  layout: layout,
296
112
  useResizeHandler: true,
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DotplotControls = DotplotControls;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _lodash = _interopRequireDefault(require("lodash"));
9
+ var _reactBootstrap = require("react-bootstrap");
10
+ var _Dropdown = _interopRequireDefault(require("react-bootstrap/Dropdown"));
11
+ var _colorscales = require("../../constants/colorscales");
12
+ var _constants = require("../../constants/constants");
13
+ var _DatasetContext = require("../../context/DatasetContext");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
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; }
18
+ function DotplotControls() {
19
+ const dataset = (0, _DatasetContext.useDataset)();
20
+ const dispatch = (0, _DatasetContext.useDatasetDispatch)();
21
+ const [controls, setControls] = (0, _react.useState)({
22
+ standardScale: dataset.controls.standardScale,
23
+ expressionCutoff: dataset.controls.expressionCutoff,
24
+ colorAxis: {
25
+ cmin: dataset.controls.colorAxis.cmin,
26
+ cmax: dataset.controls.colorAxis.cmax
27
+ }
28
+ });
29
+ (0, _react.useEffect)(() => {
30
+ setControls(c => ({
31
+ ...c,
32
+ colorAxis: {
33
+ cmin: dataset.controls.colorAxis.cmin,
34
+ cmax: dataset.controls.colorAxis.cmax
35
+ }
36
+ }));
37
+ }, [dataset.controls.colorAxis.cmin, dataset.controls.colorAxis.cmax]);
38
+ const colorScaleList = _lodash.default.keys(_colorscales.COLORSCALES).map(key => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
39
+ active: dataset.controls.colorScale === key,
40
+ onClick: () => {
41
+ dispatch({
42
+ type: "set.controls.colorScale",
43
+ colorScale: key
44
+ });
45
+ },
46
+ children: key
47
+ }, key));
48
+ const standardScaleList = _constants.DOTPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
49
+ active: dataset.controls.standardScale === item.value,
50
+ onClick: () => {
51
+ dispatch({
52
+ type: "set.controls.standardScale",
53
+ standardScale: item.value
54
+ });
55
+ },
56
+ children: item.name
57
+ }, item.value));
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonToolbar, {
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
61
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Toggle, {
62
+ id: "dropdownColorscale",
63
+ variant: "light",
64
+ children: dataset.controls.colorScale
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Menu, {
66
+ children: colorScaleList
67
+ })]
68
+ })
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
71
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
72
+ children: "Standard scale"
73
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dropdown.default, {
74
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Toggle, {
75
+ id: "dropdownStandardScale",
76
+ variant: "light",
77
+ children: dataset.controls.standardScale
78
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Menu, {
79
+ children: standardScaleList
80
+ })]
81
+ })]
82
+ })
83
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
84
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ToggleButton, {
85
+ id: "toggleMeanOnlyExpressed",
86
+ type: "checkbox",
87
+ variant: "outline-primary",
88
+ checked: dataset.controls.meanOnlyExpressed,
89
+ onChange: () => {
90
+ dispatch({
91
+ type: "set.controls.meanOnlyExpressed",
92
+ meanOnlyExpressed: !dataset.controls.meanOnlyExpressed
93
+ });
94
+ },
95
+ children: "Average only above cutoff"
96
+ })
97
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form, {
98
+ onSubmit: e => {
99
+ e.preventDefault();
100
+ dispatch({
101
+ type: "set.controls.expressionCutoff",
102
+ expressionCutoff: parseFloat(controls.expressionCutoff)
103
+ });
104
+ },
105
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
106
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
107
+ children: "Expression Cutoff"
108
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
109
+ size: "sm",
110
+ type: "number",
111
+ step: "0.1",
112
+ min: 0.0,
113
+ value: controls.expressionCutoff,
114
+ onChange: e => {
115
+ setControls({
116
+ ...controls,
117
+ expressionCutoff: e.target.value
118
+ });
119
+ }
120
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
121
+ type: "submit",
122
+ variant: "outline-primary",
123
+ children: "Apply"
124
+ })]
125
+ })
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form, {
127
+ onSubmit: e => {
128
+ e.preventDefault();
129
+ dispatch({
130
+ type: "set.controls.colorAxis.crange",
131
+ cmin: controls.colorAxis.cmin,
132
+ cmax: controls.colorAxis.cmax
133
+ });
134
+ },
135
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
136
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
137
+ children: "Colorscale"
138
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
139
+ children: "min"
140
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
141
+ name: "scaleMin",
142
+ size: "sm",
143
+ type: "number",
144
+ value: controls.colorAxis.cmin,
145
+ step: 0.1,
146
+ min: Math.min(dataset.controls.colorAxis.dmin, 0.0),
147
+ max: dataset.controls.colorAxis.dmax,
148
+ onChange: e => {
149
+ setControls({
150
+ ...controls,
151
+ colorAxis: {
152
+ ...controls.colorAxis,
153
+ cmin: e.target.value
154
+ }
155
+ });
156
+ }
157
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
158
+ children: "max"
159
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
160
+ name: "scaleMax",
161
+ size: "sm",
162
+ type: "number",
163
+ value: controls.colorAxis.cmax,
164
+ step: 0.1,
165
+ min: controls.colorAxis.cmin,
166
+ max: dataset.controls.colorAxis.dmax,
167
+ onChange: e => {
168
+ if (parseFloat(e.target.value) > dataset.controls.colorAxis.dmax) {
169
+ e.target.value = dataset.controls.colorAxis.dmax.toFixed(1);
170
+ }
171
+ setControls({
172
+ ...controls,
173
+ colorAxis: {
174
+ ...controls.colorAxis,
175
+ cmax: e.target.value
176
+ }
177
+ });
178
+ }
179
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
180
+ type: "submit",
181
+ variant: "outline-primary",
182
+ children: "Apply"
183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
184
+ variant: "outline-primary",
185
+ onClick: () => {
186
+ dispatch({
187
+ type: "set.controls.colorAxis.crange",
188
+ cmin: dataset.controls.colorAxis.dmin,
189
+ cmax: dataset.controls.colorAxis.dmax
190
+ });
191
+ },
192
+ children: "Autoscale"
193
+ })]
194
+ })
195
+ })]
196
+ });
197
+ }
@@ -4,42 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Heatmap = Heatmap;
7
- exports.HeatmapControls = HeatmapControls;
8
- require("bootstrap/dist/css/bootstrap.min.css");
9
- var _reactBootstrap = require("react-bootstrap");
10
7
  var _react = _interopRequireWildcard(require("react"));
8
+ var _reactBootstrap = require("react-bootstrap");
11
9
  var _reactPlotly = _interopRequireDefault(require("react-plotly.js"));
12
10
  var _DatasetContext = require("../../context/DatasetContext");
13
- var _constants = require("../../constants/constants");
11
+ var _LoadingIndicators = require("../../utils/LoadingIndicators");
14
12
  var _requests = require("../../utils/requests");
15
- var _LoadingSpinner = require("../../utils/LoadingSpinner");
16
13
  var _jsxRuntime = require("react/jsx-runtime");
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
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); }
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 && Object.prototype.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; }
20
- function HeatmapControls() {
21
- const dataset = (0, _DatasetContext.useDataset)();
22
- const dispatch = (0, _DatasetContext.useDatasetDispatch)();
23
- const colormapList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
24
- active: dataset.controls.colorScale === item,
25
- onClick: () => {
26
- dispatch({
27
- type: "set.controls.colorScale",
28
- colorScale: item
29
- });
30
- },
31
- children: item
32
- }, item));
33
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Dropdown, {
34
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Toggle, {
35
- id: "dropdownColorscale",
36
- variant: "light",
37
- children: dataset.controls.colorScale
38
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Menu, {
39
- children: colormapList
40
- })]
41
- });
42
- }
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; }
43
17
  function Heatmap() {
44
18
  const ENDPOINT = "heatmap";
45
19
  const dataset = (0, _DatasetContext.useDataset)();
@@ -102,7 +76,7 @@ function Heatmap() {
102
76
  if (hasSelections) {
103
77
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
104
78
  className: "cherita-heatmap position-relative",
105
- children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingSpinner.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
79
+ children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingIndicators.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
106
80
  data: data,
107
81
  layout: layout,
108
82
  useResizeHandler: true,