@haniffalab/cherita-react 0.2.0-dev.2024-02-13.eda2add3 → 0.2.0-dev.2024-02-14.667fdce7
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/components/dotplot/Dotplot.js +172 -125
- package/dist/components/heatmap/Heatmap.js +38 -26
- package/dist/components/matrixplot/Matrixplot.js +60 -33
- package/dist/components/obs-list/ObsList.js +70 -40
- package/dist/components/obsm-list/ObsmList.js +17 -11
- package/dist/components/scatterplot/Legend.js +19 -13
- package/dist/components/scatterplot/Scatterplot.js +31 -22
- package/dist/components/scatterplot/Toolbox.js +39 -25
- package/dist/components/var-list/VarList.js +65 -49
- package/dist/components/violin/Violin.js +52 -29
- package/dist/context/DatasetContext.js +12 -8
- package/dist/utils/LoadingSpinner.js +27 -21
- package/dist/utils/requests.js +2 -2
- package/package.json +2 -2
|
@@ -14,6 +14,7 @@ var _constants = require("../../constants/constants");
|
|
|
14
14
|
var _requests = require("../../utils/requests");
|
|
15
15
|
var _reactBootstrap = require("react-bootstrap");
|
|
16
16
|
var _LoadingSpinner = require("../../utils/LoadingSpinner");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
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); }
|
|
18
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; }
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -37,125 +38,165 @@ function DotplotControls() {
|
|
|
37
38
|
}
|
|
38
39
|
}));
|
|
39
40
|
}, [dataset.controls.colorAxis.cmin, dataset.controls.colorAxis.cmax]);
|
|
40
|
-
const colorScaleList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/
|
|
41
|
-
key: item,
|
|
41
|
+
const colorScaleList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
|
|
42
42
|
active: dataset.controls.colorScale === item,
|
|
43
43
|
onClick: () => {
|
|
44
44
|
dispatch({
|
|
45
45
|
type: "set.controls.colorScale",
|
|
46
46
|
colorScale: item
|
|
47
47
|
});
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
children: item
|
|
49
50
|
}, item));
|
|
50
|
-
const standardScaleList = _constants.DOTPLOT_STANDARDSCALES.map(item => /*#__PURE__*/
|
|
51
|
-
key: item.value,
|
|
51
|
+
const standardScaleList = _constants.DOTPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.default.Item, {
|
|
52
52
|
active: dataset.controls.standardScale === item.value,
|
|
53
53
|
onClick: () => {
|
|
54
54
|
dispatch({
|
|
55
55
|
type: "set.controls.standardScale",
|
|
56
56
|
standardScale: item.value
|
|
57
57
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
+
});
|
|
159
200
|
}
|
|
160
201
|
function Dotplot() {
|
|
161
202
|
const ENDPOINT = "dotplot";
|
|
@@ -245,26 +286,32 @@ function Dotplot() {
|
|
|
245
286
|
}, [dataset.controls.colorAxis.cmin, dataset.controls.colorAxis.cmax]);
|
|
246
287
|
if (!serverError) {
|
|
247
288
|
if (hasSelections) {
|
|
248
|
-
return /*#__PURE__*/
|
|
249
|
-
className: "cherita-dotplot position-relative"
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
289
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
290
|
+
className: "cherita-dotplot position-relative",
|
|
291
|
+
children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingSpinner.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
|
|
292
|
+
data: data,
|
|
293
|
+
layout: layout,
|
|
294
|
+
useResizeHandler: true,
|
|
295
|
+
style: {
|
|
296
|
+
maxWidth: "100%",
|
|
297
|
+
maxHeight: "100%"
|
|
298
|
+
}
|
|
299
|
+
})]
|
|
300
|
+
});
|
|
259
301
|
}
|
|
260
|
-
return /*#__PURE__*/
|
|
261
|
-
className: "cherita-dotplot"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
302
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
303
|
+
className: "cherita-dotplot",
|
|
304
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
305
|
+
variant: "light",
|
|
306
|
+
children: "Select features and a category"
|
|
307
|
+
})
|
|
308
|
+
});
|
|
265
309
|
} else {
|
|
266
|
-
return /*#__PURE__*/
|
|
267
|
-
|
|
268
|
-
|
|
310
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
311
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
312
|
+
variant: "danger",
|
|
313
|
+
children: serverError.message
|
|
314
|
+
})
|
|
315
|
+
});
|
|
269
316
|
}
|
|
270
317
|
}
|
|
@@ -13,26 +13,32 @@ var _DatasetContext = require("../../context/DatasetContext");
|
|
|
13
13
|
var _constants = require("../../constants/constants");
|
|
14
14
|
var _requests = require("../../utils/requests");
|
|
15
15
|
var _LoadingSpinner = require("../../utils/LoadingSpinner");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
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); }
|
|
18
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; }
|
|
19
20
|
function HeatmapControls() {
|
|
20
21
|
const dataset = (0, _DatasetContext.useDataset)();
|
|
21
22
|
const dispatch = (0, _DatasetContext.useDatasetDispatch)();
|
|
22
|
-
const colormapList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/
|
|
23
|
-
key: item,
|
|
23
|
+
const colormapList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
24
24
|
active: dataset.controls.colorScale === item,
|
|
25
25
|
onClick: () => {
|
|
26
26
|
dispatch({
|
|
27
27
|
type: "set.controls.colorScale",
|
|
28
28
|
colorScale: item
|
|
29
29
|
});
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
children: item
|
|
31
32
|
}, item));
|
|
32
|
-
return /*#__PURE__*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
});
|
|
36
42
|
}
|
|
37
43
|
function Heatmap() {
|
|
38
44
|
const ENDPOINT = "heatmap";
|
|
@@ -92,26 +98,32 @@ function Heatmap() {
|
|
|
92
98
|
}, [dataset.controls.colorScale, updateColorscale]);
|
|
93
99
|
if (!serverError) {
|
|
94
100
|
if (hasSelections) {
|
|
95
|
-
return /*#__PURE__*/
|
|
96
|
-
className: "cherita-heatmap position-relative"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
102
|
+
className: "cherita-heatmap position-relative",
|
|
103
|
+
children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingSpinner.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
|
|
104
|
+
data: data,
|
|
105
|
+
layout: layout,
|
|
106
|
+
useResizeHandler: true,
|
|
107
|
+
style: {
|
|
108
|
+
maxWidth: "100%",
|
|
109
|
+
maxHeight: "100%"
|
|
110
|
+
}
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
106
113
|
}
|
|
107
|
-
return /*#__PURE__*/
|
|
108
|
-
className: "cherita-heatmap"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
115
|
+
className: "cherita-heatmap",
|
|
116
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
117
|
+
variant: "light",
|
|
118
|
+
children: "Select features and a category"
|
|
119
|
+
})
|
|
120
|
+
});
|
|
112
121
|
} else {
|
|
113
|
-
return /*#__PURE__*/
|
|
114
|
-
|
|
115
|
-
|
|
122
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
124
|
+
variant: "danger",
|
|
125
|
+
children: serverError.message
|
|
126
|
+
})
|
|
127
|
+
});
|
|
116
128
|
}
|
|
117
129
|
}
|
|
@@ -13,39 +13,60 @@ var _constants = require("../../constants/constants");
|
|
|
13
13
|
var _reactBootstrap = require("react-bootstrap");
|
|
14
14
|
var _requests = require("../../utils/requests");
|
|
15
15
|
var _LoadingSpinner = require("../../utils/LoadingSpinner");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
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); }
|
|
18
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; }
|
|
19
20
|
function MatrixplotControls() {
|
|
20
21
|
const dataset = (0, _DatasetContext.useDataset)();
|
|
21
22
|
const dispatch = (0, _DatasetContext.useDatasetDispatch)();
|
|
22
|
-
const colorScaleList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/
|
|
23
|
-
key: item,
|
|
23
|
+
const colorScaleList = _constants.PLOTLY_COLORSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
24
24
|
active: dataset.controls.colorScale === item,
|
|
25
25
|
onClick: () => {
|
|
26
26
|
dispatch({
|
|
27
27
|
type: "set.controls.colorScale",
|
|
28
28
|
colorScale: item
|
|
29
29
|
});
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
children: item
|
|
31
32
|
}, item));
|
|
32
|
-
const standardScaleList = _constants.MATRIXPLOT_STANDARDSCALES.map(item => /*#__PURE__*/
|
|
33
|
-
key: item.value,
|
|
33
|
+
const standardScaleList = _constants.MATRIXPLOT_STANDARDSCALES.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
34
34
|
active: dataset.controls.standardScale === item.name,
|
|
35
35
|
onClick: () => {
|
|
36
36
|
dispatch({
|
|
37
37
|
type: "set.controls.standardScale",
|
|
38
38
|
standardScale: item.value
|
|
39
39
|
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
},
|
|
41
|
+
children: item.name
|
|
42
|
+
}, item.value));
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonToolbar, {
|
|
44
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
|
|
45
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Dropdown, {
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Toggle, {
|
|
47
|
+
id: "dropdownColorscale",
|
|
48
|
+
variant: "light",
|
|
49
|
+
children: dataset.controls.colorScale
|
|
50
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Menu, {
|
|
51
|
+
children: colorScaleList
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ButtonGroup, {
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
56
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
|
|
57
|
+
children: "Standard scale"
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Dropdown, {
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Toggle, {
|
|
60
|
+
id: "dropdownStandardScale",
|
|
61
|
+
variant: "light",
|
|
62
|
+
children: dataset.controls.standardScale
|
|
63
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Menu, {
|
|
64
|
+
children: standardScaleList
|
|
65
|
+
})]
|
|
66
|
+
})]
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
49
70
|
}
|
|
50
71
|
function Matrixplot() {
|
|
51
72
|
const ENDPOINT = "matrixplot";
|
|
@@ -107,26 +128,32 @@ function Matrixplot() {
|
|
|
107
128
|
}, [dataset.controls.colorScale, updateColorscale]);
|
|
108
129
|
if (!serverError) {
|
|
109
130
|
if (hasSelections) {
|
|
110
|
-
return /*#__PURE__*/
|
|
111
|
-
className: "cherita-matrixplot position-relative"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
132
|
+
className: "cherita-matrixplot position-relative",
|
|
133
|
+
children: [isPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingSpinner.LoadingSpinner, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactPlotly.default, {
|
|
134
|
+
data: data,
|
|
135
|
+
layout: layout,
|
|
136
|
+
useResizeHandler: true,
|
|
137
|
+
style: {
|
|
138
|
+
maxWidth: "100%",
|
|
139
|
+
maxHeight: "100%"
|
|
140
|
+
}
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
121
143
|
}
|
|
122
|
-
return /*#__PURE__*/
|
|
123
|
-
className: "cherita-matrixplot"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
144
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
145
|
+
className: "cherita-matrixplot",
|
|
146
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
147
|
+
variant: "light",
|
|
148
|
+
children: "Select features and a category"
|
|
149
|
+
})
|
|
150
|
+
});
|
|
127
151
|
} else {
|
|
128
|
-
return /*#__PURE__*/
|
|
129
|
-
|
|
130
|
-
|
|
152
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
153
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
154
|
+
variant: "danger",
|
|
155
|
+
children: serverError.message
|
|
156
|
+
})
|
|
157
|
+
});
|
|
131
158
|
}
|
|
132
159
|
}
|