cloudmr-ux 4.3.6 → 4.3.8
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/CmrComponents/niivue-contrast-adjustments/NiivueContrastAdjustments.js +4 -4
- package/dist/CmrComponents/niivue-slice-position/NiivueSlicePosition.js +2 -2
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.d.ts +38 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivuePanel.js +197 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.d.ts +41 -0
- package/dist/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +1239 -0
- package/dist/CmrComponents/niivue-viewer/ColorPicker.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/ColorPicker.js +65 -0
- package/dist/CmrComponents/niivue-viewer/Layer.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/Layer.js +122 -0
- package/dist/CmrComponents/niivue-viewer/LayersPanel.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/LayersPanel.js +107 -0
- package/dist/CmrComponents/niivue-viewer/Niivue.css +8 -0
- package/dist/CmrComponents/niivue-viewer/NiivuePatcher.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/NiivuePatcher.js +1402 -0
- package/dist/CmrComponents/niivue-viewer/NumberPicker.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/NumberPicker.js +40 -0
- package/dist/CmrComponents/niivue-viewer/SettingsPanel.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/SettingsPanel.js +30 -0
- package/dist/CmrComponents/niivue-viewer/Switch.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/Switch.js +27 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.d.ts +48 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.js +276 -0
- package/dist/CmrComponents/niivue-viewer/Toolbar.scss +40 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.js +61 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/EraserPlatte.js +56 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.d.ts +2 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MaskPlatte.js +148 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +177 -0
- package/dist/CmrComponents/niivue-viewer/niivuePenType.d.ts +10 -0
- package/dist/CmrComponents/niivue-viewer/niivuePenType.js +10 -0
- package/dist/CmrTable/CmrTable.css +31 -7
- package/dist/CmrTable/CmrTable.d.ts +19 -0
- package/dist/CmrTable/CmrTable.js +39 -26
- package/dist/core/common/components/NiivueTools/NiivuePatcher.d.ts +2 -0
- package/dist/core/common/components/NiivueTools/components/ControlThemes.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ControlThemes.js +123 -0
- package/dist/core/common/components/NiivueTools/components/Example.d.ts +10 -0
- package/dist/core/common/components/NiivueTools/components/Example.js +326 -0
- package/dist/core/common/components/NiivueTools/components/ImageList.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ImageList.js +22 -0
- package/dist/core/common/components/NiivueTools/components/ImageListItem.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/components/ImageListItem.js +103 -0
- package/dist/core/common/components/NiivueTools/main.d.ts +1 -0
- package/dist/core/common/components/NiivueTools/main.js +16 -0
- package/dist/core/common/components/NiivueTools/util.d.ts +21 -0
- package/dist/core/features/rois/resultSlice.js +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -1
- package/package.json +3 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Stack, IconButton, Typography, Box } from "@mui/material";
|
|
4
|
+
import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord";
|
|
5
|
+
import CheckIcon from "@mui/icons-material/Check";
|
|
6
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
7
|
+
import { InvertibleDualSlider, CmrCheckbox } from "cloudmr-ux";
|
|
8
|
+
var __assign = function () {
|
|
9
|
+
__assign =
|
|
10
|
+
Object.assign ||
|
|
11
|
+
function (t) {
|
|
12
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13
|
+
s = arguments[i];
|
|
14
|
+
for (var p in s)
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
}
|
|
18
|
+
return t;
|
|
19
|
+
};
|
|
20
|
+
return __assign.apply(this, arguments);
|
|
21
|
+
};
|
|
22
|
+
var MaskPlatte = function (_a) {
|
|
23
|
+
var expanded = _a.expanded, nv = _a.nv, setMaskColor = _a.setMaskColor, resampleImage = _a.resampleImage, unfocus = _a.unfocus;
|
|
24
|
+
var _b = useState(0), colorIndex = _b[0], storeColorIndex = _b[1];
|
|
25
|
+
var _c = useState("red"), maskColor = _c[0], storeMaskColor = _c[1];
|
|
26
|
+
var _d = useState(false), checked = _d[0], setChecked = _d[1];
|
|
27
|
+
var _e = useState(undefined), original = _e[0], setOriginal = _e[1];
|
|
28
|
+
var colors = ["red", "green", "blue", "yellow", "cyan", "#e81ce8"];
|
|
29
|
+
var filledOptions = colors.map(function (color, i) {
|
|
30
|
+
return _jsx(FiberManualRecordIcon, { sx: { color: color } }, i);
|
|
31
|
+
});
|
|
32
|
+
if (expanded) {
|
|
33
|
+
setMaskColor(maskColor);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
setMaskColor(undefined);
|
|
37
|
+
}
|
|
38
|
+
var _f = useState(nv.volumes[0] ? nv.volumes[0].vox_min : 0), min = _f[0], setMin = _f[1];
|
|
39
|
+
var _g = useState(nv.volumes[0] ? nv.volumes[0].vox_max : 1), max = _g[0], setMax = _g[1];
|
|
40
|
+
var cancelMask = function () {
|
|
41
|
+
if (original)
|
|
42
|
+
nv.drawBitmap = new Uint8Array(original);
|
|
43
|
+
else
|
|
44
|
+
return;
|
|
45
|
+
nv.refreshDrawing(true);
|
|
46
|
+
resampleImage();
|
|
47
|
+
setOriginal(undefined);
|
|
48
|
+
};
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
if (!expanded) {
|
|
51
|
+
cancelMask();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (colorIndex !== -1)
|
|
55
|
+
nv.fillRange(min, max, colorIndex + 1, checked, original, setOriginal);
|
|
56
|
+
resampleImage();
|
|
57
|
+
}
|
|
58
|
+
}, [expanded]);
|
|
59
|
+
useEffect(function () {
|
|
60
|
+
if (colorIndex !== -1 && expanded)
|
|
61
|
+
nv.fillRange(min, max, colorIndex + 1, checked, original, setOriginal);
|
|
62
|
+
}, [min, max, checked]);
|
|
63
|
+
return _jsxs(Stack, __assign({
|
|
64
|
+
style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
top: "100%",
|
|
67
|
+
left: 0,
|
|
68
|
+
zIndex: 1500,
|
|
69
|
+
border: "".concat(expanded ? "1px" : 0, " solid #bbb"),
|
|
70
|
+
maxWidth: expanded ? 450 : 0,
|
|
71
|
+
overflow: expanded ? "visible" : "hidden",
|
|
72
|
+
borderRadius: "16px",
|
|
73
|
+
borderTopLeftRadius: "6pt",
|
|
74
|
+
borderTopRightRadius: "6pt",
|
|
75
|
+
background: "#333"
|
|
76
|
+
},
|
|
77
|
+
direction: "column"
|
|
78
|
+
}, {
|
|
79
|
+
children: [
|
|
80
|
+
_jsx(Stack, __assign({ alignItems: "center" }, {
|
|
81
|
+
children: _jsx(Typography, __assign({
|
|
82
|
+
color: "white",
|
|
83
|
+
gutterBottom: true,
|
|
84
|
+
width: "100%",
|
|
85
|
+
marginLeft: "10pt",
|
|
86
|
+
fontSize: "11pt",
|
|
87
|
+
alignItems: "start"
|
|
88
|
+
}, { children: "Mask range:" }))
|
|
89
|
+
})),
|
|
90
|
+
_jsxs(Stack, __assign({ direction: "row", flexDirection: "row", justifyContent: "center" }, {
|
|
91
|
+
children: [
|
|
92
|
+
filledOptions.map(function (value, index) {
|
|
93
|
+
return _jsx(IconButton, __assign({
|
|
94
|
+
onClick: function () {
|
|
95
|
+
storeColorIndex(index);
|
|
96
|
+
storeMaskColor(colors[index]);
|
|
97
|
+
setMaskColor(colors[index]);
|
|
98
|
+
nv.fillRange(min, max, index + 1, checked, original, setOriginal);
|
|
99
|
+
resampleImage();
|
|
100
|
+
}
|
|
101
|
+
}, { children: value }), index);
|
|
102
|
+
}),
|
|
103
|
+
_jsx(CmrCheckbox, __assign({
|
|
104
|
+
style: { color: "white" },
|
|
105
|
+
onChange: function (e) {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
setChecked(e.target.checked);
|
|
108
|
+
resampleImage();
|
|
109
|
+
}
|
|
110
|
+
}, { children: "Inverted" })),
|
|
111
|
+
]
|
|
112
|
+
})),
|
|
113
|
+
_jsx(Stack, __assign({ direction: "row", sx: { mb: 1 } }, {
|
|
114
|
+
children: _jsx(Box, __assign({ width: 400, style: { paddingLeft: "10px", paddingRight: "10px" } }, {
|
|
115
|
+
children: _jsx(InvertibleDualSlider, {
|
|
116
|
+
name: "",
|
|
117
|
+
min: nv.volumes[0] ? nv.volumes[0].vox_min : 0,
|
|
118
|
+
max: nv.volumes[0] ? nv.volumes[0].vox_max : 1,
|
|
119
|
+
reverse: checked,
|
|
120
|
+
setMin: setMin,
|
|
121
|
+
setMax: setMax,
|
|
122
|
+
onFinalize: function () {
|
|
123
|
+
resampleImage();
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}))
|
|
127
|
+
})),
|
|
128
|
+
_jsxs(Stack, __assign({ direction: "row", flexDirection: "row", justifyContent: "center" }, {
|
|
129
|
+
children: [
|
|
130
|
+
_jsx(IconButton, __assign({
|
|
131
|
+
onClick: function () {
|
|
132
|
+
setOriginal(undefined);
|
|
133
|
+
nv.drawAddUndoBitmapWithHiddenVoxels();
|
|
134
|
+
unfocus();
|
|
135
|
+
}
|
|
136
|
+
}, { children: _jsx(CheckIcon, { style: { color: "green" } }) })),
|
|
137
|
+
_jsx(IconButton, __assign({
|
|
138
|
+
onClick: function () {
|
|
139
|
+
cancelMask();
|
|
140
|
+
unfocus();
|
|
141
|
+
}
|
|
142
|
+
}, { children: _jsx(CloseIcon, { style: { color: "red" } }) })),
|
|
143
|
+
]
|
|
144
|
+
})),
|
|
145
|
+
]
|
|
146
|
+
}));
|
|
147
|
+
};
|
|
148
|
+
export default MaskPlatte;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function MroDrawToolkit(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* MROptimum fork of cloudmr-ux DrawToolkit.
|
|
15
|
+
* Click-away exits drawing mode when you focus elsewhere (slice controls, histogram, etc.),
|
|
16
|
+
* but clicks on `#niiCanvas` are ignored so you can keep drawing on the viewer.
|
|
17
|
+
*
|
|
18
|
+
* Layout matches {@link NiivueSlicePosition}: outer wrapper → `.title` → `Card` + `CardContent` (no custom fill).
|
|
19
|
+
*/
|
|
20
|
+
import React, { useState } from "react";
|
|
21
|
+
import { Box, Card, CardContent, IconButton, Slider, Stack, Tooltip, Typography, } from "@mui/material";
|
|
22
|
+
import DrawIcon from "@mui/icons-material/Draw";
|
|
23
|
+
import CropSquareOutlinedIcon from "@mui/icons-material/CropSquareOutlined";
|
|
24
|
+
import CircleOutlinedIcon from "@mui/icons-material/CircleOutlined";
|
|
25
|
+
import AutoFixNormalOutlinedIcon from "@mui/icons-material/AutoFixNormalOutlined";
|
|
26
|
+
import ReplyIcon from "@mui/icons-material/Reply";
|
|
27
|
+
import CameraAltIcon from "@mui/icons-material/CameraAlt";
|
|
28
|
+
import SvgIcon from "@mui/material/SvgIcon";
|
|
29
|
+
import FormatColorFillIcon from "@mui/icons-material/FormatColorFill";
|
|
30
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
31
|
+
import VisibilityIcon from "@mui/icons-material/Visibility";
|
|
32
|
+
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
33
|
+
import OpacityIcon from "@mui/icons-material/Opacity";
|
|
34
|
+
import ClickAwayListener from "@mui/material/ClickAwayListener";
|
|
35
|
+
import DrawColorPlatte from "./DrawColorPlatte";
|
|
36
|
+
import EraserPlatte from "./EraserPlatte";
|
|
37
|
+
import MaskPlatte from "./MaskPlatte";
|
|
38
|
+
/** True if the event target is the main NiiVue canvas (drawing surface). Clicks there must not exit draw mode. */
|
|
39
|
+
function clickTargetIsNiivueCanvas(target) {
|
|
40
|
+
if (typeof document === "undefined" || !(target instanceof Element))
|
|
41
|
+
return false;
|
|
42
|
+
return !!target.closest("#niiCanvas");
|
|
43
|
+
}
|
|
44
|
+
/** Same icon tone as typical MUI on-paper controls (matches slice panel body). */
|
|
45
|
+
var ICON_COLOR = "#212121";
|
|
46
|
+
function EraserIcon(props) {
|
|
47
|
+
return (_jsxs(SvgIcon, __assign({}, props, { viewBox: "0 0 25 25", sx: { color: "inherit" } }, { children: [_jsx("rect", { x: "6", y: "3", width: "12", height: "22", rx: "2", ry: "2", transform: "rotate(230 12 12)", fill: "currentColor" }), _jsx("rect", { x: "7", y: "4", width: "10", height: "8", rx: "2", ry: "2", transform: "rotate(230 12 12)", fill: "#FFFFFF" })] })));
|
|
48
|
+
}
|
|
49
|
+
function OpacityPlatte(_a) {
|
|
50
|
+
var drawingOpacity = _a.drawingOpacity, setDrawingOpacity = _a.setDrawingOpacity, expanded = _a.expanded;
|
|
51
|
+
return (_jsx(Stack, __assign({ style: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
top: "100%",
|
|
54
|
+
left: 0,
|
|
55
|
+
zIndex: 1500,
|
|
56
|
+
border: "".concat(expanded ? "1px" : 0, " solid #bbb"),
|
|
57
|
+
maxWidth: expanded ? 300 : 0,
|
|
58
|
+
overflow: expanded ? "visible" : "hidden",
|
|
59
|
+
borderRadius: "16px",
|
|
60
|
+
borderTopLeftRadius: "6pt",
|
|
61
|
+
borderTopRightRadius: "6pt",
|
|
62
|
+
background: "#333",
|
|
63
|
+
width: 150
|
|
64
|
+
}, direction: "column" }, { children: _jsxs(Stack, __assign({ sx: { mb: 1 }, alignItems: "center" }, { children: [_jsxs(Typography, __assign({ color: "white", noWrap: true, gutterBottom: true, width: "100%", marginLeft: "10pt", fontSize: "11pt", alignItems: "start" }, { children: ["Opacity: ", drawingOpacity] })), _jsx(Slider, { sx: { width: "80%" }, value: drawingOpacity, step: 0.01, min: 0, max: 1, onChange: function (_e, value) { return setDrawingOpacity(value); } })] })) })));
|
|
65
|
+
}
|
|
66
|
+
export function MroDrawToolkit(props) {
|
|
67
|
+
var _a;
|
|
68
|
+
var drawShapeTool = props.drawShapeTool, onDrawShapeToolChange = props.onDrawShapeToolChange;
|
|
69
|
+
var _b = useState("n"), expandedOption = _b[0], setExpandedOption = _b[1];
|
|
70
|
+
var _c = useState(false), expandOpacityOptions = _c[0], setExpandOpacityOptions = _c[1];
|
|
71
|
+
var _d = useState(undefined), setMaskColor = _d[1];
|
|
72
|
+
var filled = props.drawPen > 7;
|
|
73
|
+
var shapeSelectedSx = function (shape) {
|
|
74
|
+
return drawShapeTool === shape
|
|
75
|
+
? { backgroundColor: "rgba(88, 15, 139, 0.12)", color: "#580f8b" }
|
|
76
|
+
: {};
|
|
77
|
+
};
|
|
78
|
+
function clickPen() {
|
|
79
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("pen");
|
|
80
|
+
if (expandedOption === "d") {
|
|
81
|
+
setExpandedOption("n");
|
|
82
|
+
props.setDrawingEnabled(false);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setExpandedOption("d");
|
|
86
|
+
setExpandOpacityOptions(false);
|
|
87
|
+
props.setDrawingEnabled(true);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function clickRectangle() {
|
|
91
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("rectangle");
|
|
92
|
+
if (expandedOption === "r") {
|
|
93
|
+
setExpandedOption("n");
|
|
94
|
+
props.setDrawingEnabled(false);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
setExpandedOption("r");
|
|
98
|
+
setExpandOpacityOptions(false);
|
|
99
|
+
props.setDrawingEnabled(true);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function clickEllipse() {
|
|
103
|
+
onDrawShapeToolChange === null || onDrawShapeToolChange === void 0 ? void 0 : onDrawShapeToolChange("ellipse");
|
|
104
|
+
if (expandedOption === "l") {
|
|
105
|
+
setExpandedOption("n");
|
|
106
|
+
props.setDrawingEnabled(false);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
setExpandedOption("l");
|
|
110
|
+
setExpandOpacityOptions(false);
|
|
111
|
+
props.setDrawingEnabled(true);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function clickEraser() {
|
|
115
|
+
if (expandedOption === "e") {
|
|
116
|
+
setExpandedOption("n");
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
props.updateDrawPen({ target: { value: 8 } });
|
|
120
|
+
setExpandedOption("e");
|
|
121
|
+
}
|
|
122
|
+
props.setDrawingEnabled(expandedOption !== "e");
|
|
123
|
+
}
|
|
124
|
+
function clickMask() {
|
|
125
|
+
if (expandedOption === "m") {
|
|
126
|
+
setExpandedOption("n");
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
setExpandedOption("m");
|
|
130
|
+
}
|
|
131
|
+
props.setDrawingEnabled(false);
|
|
132
|
+
}
|
|
133
|
+
var vol = (_a = props.volumes) === null || _a === void 0 ? void 0 : _a[props.selectedVolume];
|
|
134
|
+
var toolBtnSx = {
|
|
135
|
+
color: ICON_COLOR,
|
|
136
|
+
p: 0.5,
|
|
137
|
+
"&:hover": { backgroundColor: "rgba(0,0,0,0.04)" },
|
|
138
|
+
"&.Mui-disabled": { color: "rgba(0,0,0,0.26)" }
|
|
139
|
+
};
|
|
140
|
+
return (_jsx(ClickAwayListener, __assign({ onClickAway: function (event) {
|
|
141
|
+
var _a;
|
|
142
|
+
if (clickTargetIsNiivueCanvas(event.target))
|
|
143
|
+
return;
|
|
144
|
+
setExpandedOption("n");
|
|
145
|
+
setExpandOpacityOptions(false);
|
|
146
|
+
props.setDrawingEnabled(false);
|
|
147
|
+
(_a = props.onExitDrawMode) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
148
|
+
} }, { children: _jsxs("div", __assign({ style: __assign({ width: "100%", position: "relative", zIndex: 1080 }, props.style) }, { children: [_jsx("div", __assign({ className: "title", style: { width: "100%" } }, { children: "ROI Tools" })), _jsx(Card, __assign({ variant: "outlined", sx: {
|
|
149
|
+
mb: 2,
|
|
150
|
+
borderTopLeftRadius: 0,
|
|
151
|
+
borderTopRightRadius: 0,
|
|
152
|
+
overflow: "visible"
|
|
153
|
+
} }, { children: _jsx(CardContent, __assign({ sx: {
|
|
154
|
+
overflow: "visible",
|
|
155
|
+
"&:last-child": { paddingBottom: 2 }
|
|
156
|
+
} }, { children: _jsx("div", __assign({ style: { display: "flex", flexDirection: "column", overflow: "visible" } }, { children: _jsxs("div", __assign({ style: {
|
|
157
|
+
display: "flex",
|
|
158
|
+
flexDirection: "row",
|
|
159
|
+
flexWrap: "wrap",
|
|
160
|
+
alignItems: "center",
|
|
161
|
+
gap: 4,
|
|
162
|
+
overflow: "visible"
|
|
163
|
+
} }, { children: [_jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "d" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Pen" }, { children: _jsx(IconButton, __assign({ "aria-label": "pen", size: "small", onClick: clickPen, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("pen")) }, { children: _jsx(DrawIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "d", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "r" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Rectangle" }, { children: _jsx(IconButton, __assign({ "aria-label": "rectangle", size: "small", onClick: clickRectangle, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("rectangle")) }, { children: _jsx(CropSquareOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "r", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "l" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Ellipse" }, { children: _jsx(IconButton, __assign({ "aria-label": "ellipse", size: "small", onClick: clickEllipse, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("ellipse")) }, { children: _jsx(CircleOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "l", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "e" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Eraser" }, { children: _jsx(IconButton, __assign({ "aria-label": "erase", size: "small", onClick: clickEraser, sx: toolBtnSx }, { children: filled || expandedOption !== "e" ? (_jsx(EraserIcon, {})) : (_jsx(AutoFixNormalOutlinedIcon, { sx: { color: ICON_COLOR } })) })) })), _jsx(EraserPlatte, { expandEraseOptions: expandedOption === "e", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsx(Tooltip, __assign({ title: "Undo" }, { children: _jsx(IconButton, __assign({ "aria-label": "revert", size: "small", onClick: function () { return props.drawUndo(); }, sx: toolBtnSx }, { children: _jsx(ReplyIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "Save screenshot" }, { children: _jsx("span", { children: _jsx(IconButton, __assign({ "aria-label": "capture", size: "small", disabled: !vol, onClick: function () { return vol && props.nv.saveScene("".concat(vol.name, "_drawing.png")); }, sx: toolBtnSx }, { children: _jsx(CameraAltIcon, { sx: { color: ICON_COLOR } }) })) }) })), _jsx(Tooltip, __assign({ title: "Clear drawing" }, { children: _jsx(IconButton, __assign({ "aria-label": "delete", size: "small", onClick: function () {
|
|
164
|
+
props.nv.clearDrawing();
|
|
165
|
+
props.resampleImage();
|
|
166
|
+
props.setDrawingChanged(false);
|
|
167
|
+
}, sx: toolBtnSx }, { children: _jsx(DeleteIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "ROI visibility" }, { children: _jsx(IconButton, __assign({ "aria-label": "visible", size: "small", onClick: function () { return props.toggleROIVisible(); }, sx: toolBtnSx }, { children: props.roiVisible ? (_jsx(VisibilityIcon, { sx: { color: ICON_COLOR } })) : (_jsx(VisibilityOffIcon, { sx: { color: ICON_COLOR, opacity: 0.45 } })) })) })), _jsxs(Box, __assign({ sx: {
|
|
168
|
+
position: "relative",
|
|
169
|
+
zIndex: expandOpacityOptions ? 1600 : "auto",
|
|
170
|
+
display: "inline-flex",
|
|
171
|
+
alignItems: "center",
|
|
172
|
+
color: ICON_COLOR
|
|
173
|
+
} }, { children: [_jsx(Tooltip, __assign({ title: "Drawing opacity" }, { children: _jsx(IconButton, __assign({ "aria-label": "opaque", size: "small", onClick: function () { return setExpandOpacityOptions(!expandOpacityOptions); }, sx: toolBtnSx }, { children: _jsx(OpacityIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Typography, __assign({ component: "span", sx: { fontSize: "0.7rem", mr: 0.25, userSelect: "none", color: ICON_COLOR } }, { children: props.drawingOpacity.toFixed(2) })), _jsx(OpacityPlatte, { drawingOpacity: props.drawingOpacity, setDrawingOpacity: props.setDrawingOpacity, expanded: expandOpacityOptions })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "m" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Mask by intensity range" }, { children: _jsx(IconButton, __assign({ "aria-label": "fill", size: "small", onClick: clickMask, sx: toolBtnSx }, { children: _jsx(FormatColorFillIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(MaskPlatte, { resampleImage: function () {
|
|
174
|
+
props.resampleImage();
|
|
175
|
+
props.setDrawingChanged(true);
|
|
176
|
+
}, expanded: expandedOption === "m", nv: props.nv, setMaskColor: setMaskColor, unfocus: function () { return setExpandedOption("n"); } })] }))] })) })) })) }))] })) })));
|
|
177
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values match @niivue/niivue PEN_TYPE. Import them locally because Vite's
|
|
3
|
+
* optimizeDeps pre-bundle for @niivue/niivue currently omits the PEN_TYPE export
|
|
4
|
+
* (see node_modules/.vite/deps/@niivue_niivue.js export list).
|
|
5
|
+
*/
|
|
6
|
+
export declare const NI_PEN_TYPE: {
|
|
7
|
+
readonly PEN: 0;
|
|
8
|
+
readonly RECTANGLE: 1;
|
|
9
|
+
readonly ELLIPSE: 2;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values match @niivue/niivue PEN_TYPE. Import them locally because Vite's
|
|
3
|
+
* optimizeDeps pre-bundle for @niivue/niivue currently omits the PEN_TYPE export
|
|
4
|
+
* (see node_modules/.vite/deps/@niivue_niivue.js export list).
|
|
5
|
+
*/
|
|
6
|
+
export var NI_PEN_TYPE = {
|
|
7
|
+
PEN: 0,
|
|
8
|
+
RECTANGLE: 1,
|
|
9
|
+
ELLIPSE: 2
|
|
10
|
+
};
|
|
@@ -6,18 +6,42 @@
|
|
|
6
6
|
margin-bottom: 0;
|
|
7
7
|
} */
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* CmrTable root — colors are driven by CSS variables set on `.cmr-table` from props.
|
|
11
|
+
* Defaults preserve the package purple accent (#580f8b). Host apps can override per instance
|
|
12
|
+
* via `headerIconColor` / `checkboxCheckedColor` / `checkboxUncheckedColor`, or by setting
|
|
13
|
+
* variables on a parent: `--cmr-table-header-icon`, etc.
|
|
14
|
+
*/
|
|
15
|
+
.cmr-table {
|
|
16
|
+
/* Fallbacks = package defaults */
|
|
17
|
+
--cmr-table-header-bg: #f3e5f5;
|
|
18
|
+
--cmr-table-header-text: #333;
|
|
19
|
+
--cmr-table-header-icon: #580f8b;
|
|
20
|
+
--cmr-table-checkbox-unchecked: rgba(88, 15, 139, 0.54);
|
|
21
|
+
--cmr-table-checkbox-checked: #580f8b;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.cmr-table .MuiDataGrid-columnHeaders {
|
|
25
|
+
background: var(--cmr-table-header-bg);
|
|
26
|
+
color: var(--cmr-table-header-text);
|
|
12
27
|
font-weight: bold;
|
|
13
28
|
}
|
|
14
29
|
|
|
15
|
-
.MuiDataGrid-columnHeaders .MuiSvgIcon-root {
|
|
16
|
-
color:
|
|
30
|
+
.cmr-table .MuiDataGrid-columnHeaders .MuiSvgIcon-root {
|
|
31
|
+
color: var(--cmr-table-header-icon) !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cmr-table .MuiCheckbox-root {
|
|
35
|
+
color: var(--cmr-table-checkbox-unchecked);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cmr-table .MuiCheckbox-root.Mui-checked,
|
|
39
|
+
.cmr-table .MuiCheckbox-root.MuiCheckbox-indeterminate {
|
|
40
|
+
color: var(--cmr-table-checkbox-checked) !important;
|
|
17
41
|
}
|
|
18
42
|
|
|
19
|
-
/*
|
|
20
|
-
.MuiDataGrid-columnHeaderCheckbox .MuiDataGrid-columnHeaderTitleContainerContent {
|
|
43
|
+
/* Religning MUI checkbox in the header */
|
|
44
|
+
.cmr-table .MuiDataGrid-columnHeaderCheckbox .MuiDataGrid-columnHeaderTitleContainerContent {
|
|
21
45
|
padding: 0 !important;
|
|
22
46
|
margin: 0 !important;
|
|
23
47
|
display: flex;
|
|
@@ -2,15 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import './CmrTable.css';
|
|
3
3
|
import { DataGridProps } from '@mui/x-data-grid';
|
|
4
4
|
import { CSSProperties } from 'react';
|
|
5
|
+
/** Default header icon / selection accent (purple). Exposed for host apps that want the package default explicitly. */
|
|
6
|
+
export declare const CMR_TABLE_DEFAULT_HEADER_ICON = "#580f8b";
|
|
5
7
|
export interface CmrTableProps extends Omit<DataGridProps, 'rows'> {
|
|
6
8
|
dataSource: any[];
|
|
7
9
|
idAlias?: string;
|
|
8
10
|
name?: string;
|
|
9
11
|
style?: CSSProperties;
|
|
10
12
|
showCheckbox?: boolean;
|
|
13
|
+
/** Column header background. @default `#F3E5F5` */
|
|
11
14
|
headerBgColor?: string;
|
|
15
|
+
/** Column header text color. @default `#333` */
|
|
12
16
|
headerTextColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Sort icons, menu icons, and header “select all” checkbox accent.
|
|
19
|
+
* Also the default for {@link checkboxCheckedColor} when that prop is omitted.
|
|
20
|
+
* @default `#580f8b`
|
|
21
|
+
*/
|
|
13
22
|
headerIconColor?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Row / header checkbox color when checked or indeterminate.
|
|
25
|
+
* @default same as `headerIconColor` (`#580f8b` when defaults apply)
|
|
26
|
+
*/
|
|
27
|
+
checkboxCheckedColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Row / header checkbox color when unchecked (non-checked outline state).
|
|
30
|
+
* @default `rgba(88, 15, 139, 0.54)` (pairs with default purple accent)
|
|
31
|
+
*/
|
|
32
|
+
checkboxUncheckedColor?: string;
|
|
14
33
|
/**
|
|
15
34
|
* Optional function to customize how rows are filtered/sorted before display.
|
|
16
35
|
* Receives the mapped rows; return a new array in the desired order.
|
|
@@ -32,6 +32,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
32
32
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
33
|
import './CmrTable.css';
|
|
34
34
|
import { DataGrid } from '@mui/x-data-grid';
|
|
35
|
+
/** Default header icon / selection accent (purple). Exposed for host apps that want the package default explicitly. */
|
|
36
|
+
export var CMR_TABLE_DEFAULT_HEADER_ICON = '#580f8b';
|
|
37
|
+
var DEFAULT_HEADER_BG = '#F3E5F5';
|
|
38
|
+
var DEFAULT_HEADER_TEXT = '#333';
|
|
39
|
+
/** Unchecked row/header checkbox tint that pairs with {@link CMR_TABLE_DEFAULT_HEADER_ICON}. */
|
|
40
|
+
var DEFAULT_CHECKBOX_UNCHECKED = 'rgba(88, 15, 139, 0.54)';
|
|
35
41
|
/** Extracts a comparable timestamp from a row for sorting. Supports createdAt, created_at, or similar date fields. */
|
|
36
42
|
function getSubmittedTimestamp(row) {
|
|
37
43
|
var _a, _b, _c;
|
|
@@ -46,38 +52,45 @@ function defaultSortByRecent(rows) {
|
|
|
46
52
|
return __spreadArray([], rows, true).sort(function (a, b) { return getSubmittedTimestamp(b) - getSubmittedTimestamp(a); });
|
|
47
53
|
}
|
|
48
54
|
var CmrTable = function (props) {
|
|
49
|
-
var
|
|
55
|
+
var _a;
|
|
56
|
+
var dataSource = props.dataSource, columns = props.columns, idAlias = props.idAlias, className = props.className, onRowSelectionModelChange = props.onRowSelectionModelChange, style = props.style, _b = props.showCheckbox, showCheckbox = _b === void 0 ? true : _b, _c = props.headerBgColor, headerBgColor = _c === void 0 ? DEFAULT_HEADER_BG : _c, _d = props.headerTextColor, headerTextColor = _d === void 0 ? DEFAULT_HEADER_TEXT : _d, _e = props.headerIconColor, headerIconColor = _e === void 0 ? CMR_TABLE_DEFAULT_HEADER_ICON : _e, checkboxCheckedColor = props.checkboxCheckedColor, checkboxUncheckedColor = props.checkboxUncheckedColor, processRows = props.processRows, userSx = props.sx, rest = __rest(props, ["dataSource", "columns", "idAlias", "className", "onRowSelectionModelChange", "style", "showCheckbox", "headerBgColor", "headerTextColor", "headerIconColor", "checkboxCheckedColor", "checkboxUncheckedColor", "processRows", "sx"]);
|
|
57
|
+
var resolvedCheckboxChecked = checkboxCheckedColor !== null && checkboxCheckedColor !== void 0 ? checkboxCheckedColor : headerIconColor;
|
|
58
|
+
var resolvedCheckboxUnchecked = checkboxUncheckedColor !== null && checkboxUncheckedColor !== void 0 ? checkboxUncheckedColor : DEFAULT_CHECKBOX_UNCHECKED;
|
|
59
|
+
var wrapperStyle = __assign(__assign({ height: '400px', width: '100%' }, (style !== null && style !== void 0 ? style : {})), (_a = {}, _a['--cmr-table-header-bg'] = headerBgColor, _a['--cmr-table-header-text'] = headerTextColor, _a['--cmr-table-header-icon'] = headerIconColor, _a['--cmr-table-checkbox-checked'] = resolvedCheckboxChecked, _a['--cmr-table-checkbox-unchecked'] = resolvedCheckboxUnchecked, _a));
|
|
60
|
+
var tableClassName = ['cmr-table', className].filter(Boolean).join(' ');
|
|
50
61
|
var mappedRows = dataSource
|
|
51
62
|
? dataSource.map(function (row) { return (__assign({ id: idAlias ? row[idAlias] : row['id'] }, row)); })
|
|
52
63
|
: [];
|
|
53
64
|
var displayRows = processRows ? processRows(mappedRows) : defaultSortByRecent(mappedRows);
|
|
54
|
-
|
|
65
|
+
var baseSx = {
|
|
66
|
+
'& .MuiDataGrid-columnHeaders': {
|
|
67
|
+
backgroundColor: headerBgColor,
|
|
68
|
+
color: headerTextColor
|
|
69
|
+
},
|
|
70
|
+
'&& .MuiDataGrid-columnHeader .MuiSvgIcon-root': {
|
|
71
|
+
color: "".concat(headerIconColor, " !important")
|
|
72
|
+
},
|
|
73
|
+
'&& .MuiDataGrid-columnHeader .MuiDataGrid-sortIcon': {
|
|
74
|
+
color: "".concat(headerIconColor, " !important")
|
|
75
|
+
},
|
|
76
|
+
'&& .MuiDataGrid-columnHeader .MuiDataGrid-menuIconButton .MuiSvgIcon-root': {
|
|
77
|
+
color: "".concat(headerIconColor, " !important")
|
|
78
|
+
},
|
|
79
|
+
'&& .MuiDataGrid-columnHeader .MuiDataGrid-iconButtonContainer .MuiSvgIcon-root': {
|
|
80
|
+
color: "".concat(headerIconColor, " !important")
|
|
81
|
+
},
|
|
82
|
+
'& .MuiDataGrid-columnHeaderTitle': {
|
|
83
|
+
fontWeight: 'bold'
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var mergedSx = userSx == null
|
|
87
|
+
? baseSx
|
|
88
|
+
: Array.isArray(userSx)
|
|
89
|
+
? __spreadArray([baseSx], userSx, true) : [baseSx, userSx];
|
|
90
|
+
return (_jsx("div", __assign({ style: wrapperStyle, className: tableClassName }, { children: _jsx(DataGrid, __assign({ rows: displayRows, columns: columns, checkboxSelection: showCheckbox, onRowSelectionModelChange: onRowSelectionModelChange, initialState: {
|
|
55
91
|
pagination: {
|
|
56
92
|
paginationModel: { pageSize: 50, page: 0 }
|
|
57
93
|
}
|
|
58
|
-
}, sx: {
|
|
59
|
-
'& .MuiDataGrid-columnHeaders': {
|
|
60
|
-
backgroundColor: headerBgColor,
|
|
61
|
-
color: headerTextColor
|
|
62
|
-
},
|
|
63
|
-
// '& .MuiDataGrid-columnHeaders .MuiSvgIcon-root': {
|
|
64
|
-
// color: headerIconColor,
|
|
65
|
-
// },
|
|
66
|
-
'&& .MuiDataGrid-columnHeader .MuiSvgIcon-root': {
|
|
67
|
-
color: "".concat(headerIconColor, " !important")
|
|
68
|
-
},
|
|
69
|
-
'&& .MuiDataGrid-columnHeader .MuiDataGrid-sortIcon': {
|
|
70
|
-
color: "".concat(headerIconColor, " !important")
|
|
71
|
-
},
|
|
72
|
-
'&& .MuiDataGrid-columnHeader .MuiDataGrid-menuIconButton .MuiSvgIcon-root': {
|
|
73
|
-
color: "".concat(headerIconColor, " !important")
|
|
74
|
-
},
|
|
75
|
-
'&& .MuiDataGrid-columnHeader .MuiDataGrid-iconButtonContainer .MuiSvgIcon-root': {
|
|
76
|
-
color: "".concat(headerIconColor, " !important")
|
|
77
|
-
},
|
|
78
|
-
'& .MuiDataGrid-columnHeaderTitle': {
|
|
79
|
-
fontWeight: 'bold'
|
|
80
|
-
}
|
|
81
|
-
}, localeText: { noRowsLabel: 'No Rows' } }, rest)) })));
|
|
94
|
+
}, sx: mergedSx, localeText: { noRowsLabel: 'No Rows' } }, rest)) })));
|
|
82
95
|
};
|
|
83
96
|
export default CmrTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|