@complat/react-spectra-editor 1.0.1 → 1.1.1
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/README.md +15 -0
- package/dist/__tests__/units/components/common/comps.test.js +26 -0
- package/dist/__tests__/units/components/common/draw.test.js +183 -19
- package/dist/__tests__/units/components/panel/info.test.js +10 -1
- package/dist/actions/detector.js +14 -0
- package/dist/actions/manager.js +6 -2
- package/dist/components/cmd_bar/04_integration.js +3 -3
- package/dist/components/cmd_bar/07_pecker.js +2 -2
- package/dist/components/cmd_bar/index.js +2 -1
- package/dist/components/cmd_bar/r05_submit_btn.js +10 -6
- package/dist/components/cmd_bar/r09_detector.js +99 -0
- package/dist/components/common/draw.js +1 -3
- package/dist/components/d3_line/line_focus.js +34 -36
- package/dist/components/d3_multi/multi_focus.js +42 -44
- package/dist/components/d3_rect/rect_focus.js +5 -7
- package/dist/components/panel/cyclic_voltamery_data.js +3 -1
- package/dist/components/panel/info.js +26 -4
- package/dist/constants/action_type.js +6 -2
- package/dist/constants/list_detectors.js +15 -0
- package/dist/helpers/brush.js +8 -10
- package/dist/helpers/chem.js +5 -2
- package/dist/helpers/compass.js +17 -17
- package/dist/helpers/init.js +1 -3
- package/dist/helpers/mount.js +2 -2
- package/dist/helpers/zoom.js +5 -7
- package/dist/index.js +7 -0
- package/dist/layer_init.js +7 -2
- package/dist/reducers/index.js +3 -1
- package/dist/reducers/reducer_detector.js +52 -0
- package/package.json +10 -5
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.XRD = exports.UI = exports.THRESHOLD = exports.SUBMIT = exports.STATUS = exports.SIMULATION = exports.SHIFT = exports.SCAN = exports.MULTIPLICITY = exports.META = exports.MANAGER = exports.LAYOUT = exports.JCAMP = exports.INTEGRATION = exports.FORECAST = exports.EDITPEAK = exports.CYCLIC_VOLTA_METRY = exports.CURVE = exports.AXES = void 0;
|
|
6
|
+
exports.XRD = exports.UI = exports.THRESHOLD = exports.SUBMIT = exports.STATUS = exports.SIMULATION = exports.SHIFT = exports.SEC = exports.SCAN = exports.MULTIPLICITY = exports.META = exports.MANAGER = exports.LAYOUT = exports.JCAMP = exports.INTEGRATION = exports.FORECAST = exports.EDITPEAK = exports.CYCLIC_VOLTA_METRY = exports.CURVE = exports.AXES = void 0;
|
|
7
7
|
const THRESHOLD = exports.THRESHOLD = {
|
|
8
8
|
UPDATE_VALUE: 'THRESHOLD_UPDATE_VALUE',
|
|
9
9
|
RESET_VALUE: 'THRESHOLD_RESET_VALUE',
|
|
@@ -29,7 +29,8 @@ const MANAGER = exports.MANAGER = {
|
|
|
29
29
|
RESET_INIT_COMMON: 'RESET_INIT_COMMON',
|
|
30
30
|
RESET_INIT_NMR: 'RESET_INIT_NMR',
|
|
31
31
|
RESET_INIT_MS: 'RESET_INIT_MS',
|
|
32
|
-
RESET_INIT_COMMON_WITH_INTERGATION: 'RESET_INIT_COMMON_WITH_INTERGATION'
|
|
32
|
+
RESET_INIT_COMMON_WITH_INTERGATION: 'RESET_INIT_COMMON_WITH_INTERGATION',
|
|
33
|
+
RESET_DETECTOR: 'RESET_DETECTOR'
|
|
33
34
|
};
|
|
34
35
|
const LAYOUT = exports.LAYOUT = {
|
|
35
36
|
UPDATE: 'UPDATE_LAYOUT'
|
|
@@ -139,4 +140,7 @@ const CURVE = exports.CURVE = {
|
|
|
139
140
|
const AXES = exports.AXES = {
|
|
140
141
|
UPDATE_X_AXIS: 'UPDATE_X_AXIS',
|
|
141
142
|
UPDATE_Y_AXIS: 'UPDATE_Y_AXIS'
|
|
143
|
+
};
|
|
144
|
+
const SEC = exports.SEC = {
|
|
145
|
+
UPDATE_DETECTOR: 'UPDATE_DETECTOR'
|
|
142
146
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LIST_DETECTORS = void 0;
|
|
7
|
+
const rI = {
|
|
8
|
+
name: 'Refractive index',
|
|
9
|
+
label: 'RI'
|
|
10
|
+
};
|
|
11
|
+
const uV = {
|
|
12
|
+
name: 'Ultraviolet',
|
|
13
|
+
label: 'UV'
|
|
14
|
+
};
|
|
15
|
+
const LIST_DETECTORS = exports.LIST_DETECTORS = [rI, uV];
|
package/dist/helpers/brush.js
CHANGED
|
@@ -4,25 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
8
7
|
var _compass = require("./compass");
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
8
|
/* eslint-disable prefer-object-spread */
|
|
12
9
|
|
|
13
|
-
const
|
|
10
|
+
const d3 = require('d3');
|
|
11
|
+
const wheeled = (focus, event) => {
|
|
14
12
|
const {
|
|
15
13
|
currentExtent,
|
|
16
14
|
scrollUiWheelAct
|
|
17
15
|
} = focus;
|
|
18
16
|
// WORKAROUND: firefox wheel compatibilty
|
|
19
|
-
const wheelEvent = focus.isFirefox ? -
|
|
17
|
+
const wheelEvent = focus.isFirefox ? -event.deltaY : event.wheelDelta; // eslint-disable-line
|
|
20
18
|
const direction = wheelEvent > 0;
|
|
21
19
|
scrollUiWheelAct(Object.assign({}, currentExtent, {
|
|
22
20
|
direction
|
|
23
21
|
}));
|
|
24
22
|
};
|
|
25
|
-
const brushed = (focus, isUiAddIntgSt) => {
|
|
23
|
+
const brushed = (focus, isUiAddIntgSt, event) => {
|
|
26
24
|
const {
|
|
27
25
|
selectUiSweepAct,
|
|
28
26
|
data,
|
|
@@ -32,7 +30,7 @@ const brushed = (focus, isUiAddIntgSt) => {
|
|
|
32
30
|
h,
|
|
33
31
|
scales
|
|
34
32
|
} = focus;
|
|
35
|
-
const selection =
|
|
33
|
+
const selection = event.selection && event.selection.reverse();
|
|
36
34
|
if (!selection) return;
|
|
37
35
|
let xes = [w, 0].map(scales.x.invert).sort((a, b) => a - b);
|
|
38
36
|
let yes = [h, 0].map(scales.y.invert).sort((a, b) => a - b);
|
|
@@ -82,15 +80,15 @@ const MountBrush = (focus, isUiAddIntgSt, isUiNoBrushSt) => {
|
|
|
82
80
|
} = focus;
|
|
83
81
|
svg.selectAll('.brush').remove();
|
|
84
82
|
svg.selectAll('.brushX').remove();
|
|
85
|
-
const brushedCb =
|
|
86
|
-
const wheeledCb =
|
|
83
|
+
const brushedCb = event => brushed(focus, isUiAddIntgSt, event);
|
|
84
|
+
const wheeledCb = event => wheeled(focus, event);
|
|
87
85
|
if (isUiNoBrushSt) {
|
|
88
86
|
const target = isUiAddIntgSt ? brushX : brush;
|
|
89
87
|
target.handleSize(10).extent([[0, 0], [w, h]]).on('end', brushedCb);
|
|
90
88
|
|
|
91
89
|
// append brush components
|
|
92
90
|
const klass = isUiAddIntgSt ? 'brushX' : 'brush';
|
|
93
|
-
root.append('g').attr('class', klass).on('mousemove',
|
|
91
|
+
root.append('g').attr('class', klass).on('mousemove', event => (0, _compass.MouseMove)(event, focus)).call(target);
|
|
94
92
|
}
|
|
95
93
|
svg.on('wheel', wheeledCb);
|
|
96
94
|
};
|
package/dist/helpers/chem.js
CHANGED
|
@@ -773,7 +773,10 @@ const extrFeaturesCylicVolta = (jcamp, layout, peakUp) => {
|
|
|
773
773
|
const lowerThres = _format.default.isXRDLayout(layout) ? 100 : calcLowerThres(s);
|
|
774
774
|
const cpo = buildPeakFeature(jcamp, layout, peakUp, s, 100, upperThres, lowerThres);
|
|
775
775
|
const bnd = getBoundary(s);
|
|
776
|
-
|
|
776
|
+
const detector = _format.default.isSECLayout(layout) && jcamp.info.$DETECTOR ? jcamp.info.$DETECTOR : '';
|
|
777
|
+
return Object.assign({}, base, cpo, bnd, {
|
|
778
|
+
detector
|
|
779
|
+
});
|
|
777
780
|
}).filter(r => r != null);
|
|
778
781
|
return features;
|
|
779
782
|
};
|
|
@@ -819,7 +822,7 @@ const extractTemperature = jcamp => {
|
|
|
819
822
|
const ExtractJcamp = source => {
|
|
820
823
|
const jcamp = _jcampconverter.default.convert(source, {
|
|
821
824
|
xy: true,
|
|
822
|
-
keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA)/ // eslint-disable-line
|
|
825
|
+
keepRecordsRegExp: /(\$CSTHRESHOLD|\$CSSCANAUTOTARGET|\$CSSCANEDITTARGET|\$CSSCANCOUNT|\$CSSOLVENTNAME|\$CSSOLVENTVALUE|\$CSSOLVENTX|\$CSCATEGORY|\$CSITAREA|\$CSITFACTOR|\$OBSERVEDINTEGRALS|\$OBSERVEDMULTIPLETS|\$OBSERVEDMULTIPLETSPEAKS|\.SOLVENTNAME|\.OBSERVEFREQUENCY|\$CSSIMULATIONPEAKS|\$CSUPPERTHRESHOLD|\$CSLOWERTHRESHOLD|\$CSCYCLICVOLTAMMETRYDATA|UNITS|SYMBOL|CSAUTOMETADATA|\$DETECTOR)/ // eslint-disable-line
|
|
823
826
|
});
|
|
824
827
|
const layout = readLayout(jcamp);
|
|
825
828
|
const peakUp = !_format.default.isIrLayout(layout);
|
package/dist/helpers/compass.js
CHANGED
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.TfRescale = exports.MouseMove = exports.MountCompass = exports.ClickCompass = void 0;
|
|
8
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
9
8
|
var _format = _interopRequireDefault(require("./format"));
|
|
10
9
|
var _chem = require("./chem");
|
|
11
|
-
|
|
12
|
-
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; }
|
|
10
|
+
const d3 = require('d3');
|
|
13
11
|
const TfRescale = focus => {
|
|
14
12
|
const xt = focus.scales.x;
|
|
15
13
|
const yt = focus.scales.y;
|
|
@@ -19,11 +17,11 @@ const TfRescale = focus => {
|
|
|
19
17
|
};
|
|
20
18
|
};
|
|
21
19
|
exports.TfRescale = TfRescale;
|
|
22
|
-
const fetchPt = (focus, xt) => {
|
|
20
|
+
const fetchPt = (event, focus, xt) => {
|
|
23
21
|
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
24
22
|
// ? d3.event.offsetX
|
|
25
23
|
// : d3.mouse(focus.root.node())[0];
|
|
26
|
-
const rawMouseX = d3.
|
|
24
|
+
const rawMouseX = d3.pointer(event, focus.root.node())[0];
|
|
27
25
|
const mouseX = xt.invert(rawMouseX);
|
|
28
26
|
const bisectDate = d3.bisector(d => +d.x).left;
|
|
29
27
|
const dt = focus.data;
|
|
@@ -32,15 +30,15 @@ const fetchPt = (focus, xt) => {
|
|
|
32
30
|
const idx = bisectDate(sortData, +mouseX);
|
|
33
31
|
return sortData[idx];
|
|
34
32
|
};
|
|
35
|
-
const fetchFreePt = (focus, xt, yt) => {
|
|
33
|
+
const fetchFreePt = (event, focus, xt, yt) => {
|
|
36
34
|
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
37
35
|
// ? d3.event.offsetX
|
|
38
36
|
// : d3.mouse(focus.root.node())[0];
|
|
39
37
|
// const rawMouseY = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
40
38
|
// ? d3.event.offsetY
|
|
41
39
|
// : d3.mouse(focus.root.node())[1];
|
|
42
|
-
const rawMouseX = d3.
|
|
43
|
-
const rawMouseY = d3.
|
|
40
|
+
const rawMouseX = d3.pointer(event, focus.root.node())[0];
|
|
41
|
+
const rawMouseY = d3.pointer(event, focus.root.node())[1];
|
|
44
42
|
const mouseX = xt.invert(rawMouseX);
|
|
45
43
|
const mouseY = yt.invert(rawMouseY);
|
|
46
44
|
const distance2 = (x1, x2, y1, y2) => {
|
|
@@ -60,7 +58,7 @@ const fetchFreePt = (focus, xt, yt) => {
|
|
|
60
58
|
});
|
|
61
59
|
return selectPoint;
|
|
62
60
|
};
|
|
63
|
-
const MouseMove = focus => {
|
|
61
|
+
const MouseMove = (event, focus) => {
|
|
64
62
|
const {
|
|
65
63
|
xt,
|
|
66
64
|
yt
|
|
@@ -71,7 +69,7 @@ const MouseMove = focus => {
|
|
|
71
69
|
wavelength
|
|
72
70
|
} = focus;
|
|
73
71
|
if (_format.default.isCyclicVoltaLayout(layout)) {
|
|
74
|
-
const pt = fetchFreePt(focus, xt, yt);
|
|
72
|
+
const pt = fetchFreePt(event, focus, xt, yt);
|
|
75
73
|
if (pt) {
|
|
76
74
|
const tx = xt(pt.x);
|
|
77
75
|
const ty = yt(pt.y);
|
|
@@ -85,7 +83,7 @@ const MouseMove = focus => {
|
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
} else {
|
|
88
|
-
const pt = fetchPt(focus, xt);
|
|
86
|
+
const pt = fetchPt(event, focus, xt);
|
|
89
87
|
if (pt) {
|
|
90
88
|
const tx = xt(pt.x);
|
|
91
89
|
const ty = yt(pt.y);
|
|
@@ -99,6 +97,8 @@ const MouseMove = focus => {
|
|
|
99
97
|
dValue = (0, _chem.Convert2DValue)(pt.x).toExponential(2);
|
|
100
98
|
}
|
|
101
99
|
focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${ty - 30})`).text(`2Theta: ${pt.x.toExponential(2)}, d-value: ${dValue}`);
|
|
100
|
+
} else if (_format.default.isTGALayout(layout)) {
|
|
101
|
+
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(`X: ${pt.x.toFixed(3)}, Y: ${pt.y.toFixed(3)}`);
|
|
102
102
|
} else {
|
|
103
103
|
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(pt.x.toFixed(3));
|
|
104
104
|
if (freq) {
|
|
@@ -111,21 +111,21 @@ const MouseMove = focus => {
|
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
exports.MouseMove = MouseMove;
|
|
114
|
-
const ClickCompass = focus => {
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const ClickCompass = (event, focus) => {
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
event.preventDefault();
|
|
117
117
|
const {
|
|
118
118
|
xt,
|
|
119
119
|
yt
|
|
120
120
|
} = TfRescale(focus);
|
|
121
|
-
let pt = fetchPt(focus, xt);
|
|
121
|
+
let pt = fetchPt(event, focus, xt);
|
|
122
122
|
const {
|
|
123
123
|
layout,
|
|
124
124
|
cyclicvoltaSt,
|
|
125
125
|
jcampIdx
|
|
126
126
|
} = focus;
|
|
127
127
|
if (_format.default.isCyclicVoltaLayout(layout)) {
|
|
128
|
-
pt = fetchFreePt(focus, xt, yt);
|
|
128
|
+
pt = fetchFreePt(event, focus, xt, yt);
|
|
129
129
|
const onPeak = false;
|
|
130
130
|
if (cyclicvoltaSt) {
|
|
131
131
|
const {
|
|
@@ -155,6 +155,6 @@ const MountCompass = focus => {
|
|
|
155
155
|
compass.append('circle').attr('r', 4).attr('fill', 'none').attr('stroke', '#777').attr('stroke-width', 2);
|
|
156
156
|
cursor.append('text').attr('class', 'cursor-txt').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle');
|
|
157
157
|
cursor.append('text').attr('class', 'cursor-txt-hz').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').style('fill', '#D68910');
|
|
158
|
-
overlay.on('mousemove',
|
|
158
|
+
overlay.on('mousemove', event => MouseMove(event, focus)).on('click', event => ClickCompass(event, focus));
|
|
159
159
|
};
|
|
160
160
|
exports.MountCompass = MountCompass;
|
package/dist/helpers/init.js
CHANGED
|
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.InitTip = exports.InitScale = exports.InitPathCall = exports.InitAxisCall = void 0;
|
|
8
|
-
var d3 = _interopRequireWildcard(require("d3"));
|
|
9
8
|
var _d3Tip = _interopRequireDefault(require("d3-tip"));
|
|
10
9
|
var _format = _interopRequireDefault(require("./format"));
|
|
11
|
-
|
|
12
|
-
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; }
|
|
10
|
+
const d3 = require('d3');
|
|
13
11
|
const InitScale = function (target) {
|
|
14
12
|
let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
15
13
|
const xRange = reverse ? [target.w, 0] : [0, target.w];
|
package/dist/helpers/mount.js
CHANGED
|
@@ -45,13 +45,13 @@ const MountRef = target => {
|
|
|
45
45
|
};
|
|
46
46
|
exports.MountRef = MountRef;
|
|
47
47
|
const MountPath = (target, color) => {
|
|
48
|
-
const path = target.root.append('g').attr('class', 'line-clip').attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-width', 1).on('click',
|
|
48
|
+
const path = target.root.append('g').attr('class', 'line-clip').attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-width', 1).on('click', event => (0, _compass.ClickCompass)(event, target));
|
|
49
49
|
return path;
|
|
50
50
|
};
|
|
51
51
|
exports.MountPath = MountPath;
|
|
52
52
|
const MountComparePath = function (target, color, id) {
|
|
53
53
|
let alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
54
|
-
const path = target.root.append('g').attr('class', 'line-clip-compare').attr('id', id).attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-opacity', alpha).style('stroke-width', 1).style('stroke-dasharray', '30, 3').on('click',
|
|
54
|
+
const path = target.root.append('g').attr('class', 'line-clip-compare').attr('id', id).attr('clip-path', 'url(#clip)').append('path').attr('class', 'line').style('fill', 'none').style('stroke', color).style('stroke-opacity', alpha).style('stroke-width', 1).style('stroke-dasharray', '30, 3').on('click', event => (0, _compass.ClickCompass)(event, target));
|
|
55
55
|
return path;
|
|
56
56
|
};
|
|
57
57
|
exports.MountComparePath = MountComparePath;
|
package/dist/helpers/zoom.js
CHANGED
|
@@ -4,18 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
7
|
+
const d3 = require('d3');
|
|
10
8
|
const resetZoom = main => {
|
|
11
9
|
main.svg.call(main.zoom.transform, d3.zoomIdentity);
|
|
12
10
|
main.svg.selectAll('.brush').call(main.brush.move, null);
|
|
13
11
|
};
|
|
14
12
|
const MountZoom = (main, zoomed) => {
|
|
15
|
-
const zoomedCb =
|
|
16
|
-
const resetZoomCb =
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const zoomedCb = event => zoomed(event, main);
|
|
14
|
+
const resetZoomCb = event => {
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
event.preventDefault();
|
|
19
17
|
resetZoom(main);
|
|
20
18
|
};
|
|
21
19
|
main.zoom.on('zoom', zoomedCb);
|
package/dist/index.js
CHANGED
|
@@ -604,30 +604,35 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
604
604
|
},
|
|
605
605
|
onClick: this.onClick('raman')
|
|
606
606
|
}, "RAMAN"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
607
|
+
id: "btn-uv-vis",
|
|
607
608
|
variant: "contained",
|
|
608
609
|
style: {
|
|
609
610
|
margin: '0 10px 0 10px'
|
|
610
611
|
},
|
|
611
612
|
onClick: this.onClick('uv/vis')
|
|
612
613
|
}, "UV/VIS"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
614
|
+
id: "btn-hplc",
|
|
613
615
|
variant: "contained",
|
|
614
616
|
style: {
|
|
615
617
|
margin: '0 10px 0 10px'
|
|
616
618
|
},
|
|
617
619
|
onClick: this.onClick('hplc uv/vis')
|
|
618
620
|
}, "HPLC UV/VIS"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
621
|
+
id: "btn-tga",
|
|
619
622
|
variant: "contained",
|
|
620
623
|
style: {
|
|
621
624
|
margin: '0 10px 0 10px'
|
|
622
625
|
},
|
|
623
626
|
onClick: this.onClick('tga')
|
|
624
627
|
}, "TGA"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
628
|
+
id: "btn-xrd",
|
|
625
629
|
variant: "contained",
|
|
626
630
|
style: {
|
|
627
631
|
margin: '0 10px 0 10px'
|
|
628
632
|
},
|
|
629
633
|
onClick: this.onClick('xrd')
|
|
630
634
|
}, "XRD"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
635
|
+
id: "btn-cv",
|
|
631
636
|
variant: "contained",
|
|
632
637
|
style: {
|
|
633
638
|
margin: '0 10px 0 10px'
|
|
@@ -640,12 +645,14 @@ class DemoWriteIr extends _react.default.Component {
|
|
|
640
645
|
},
|
|
641
646
|
onClick: this.onClick('cds')
|
|
642
647
|
}, "CDS"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
648
|
+
id: "btn-sec",
|
|
643
649
|
variant: "contained",
|
|
644
650
|
style: {
|
|
645
651
|
margin: '0 10px 0 10px'
|
|
646
652
|
},
|
|
647
653
|
onClick: this.onClick('sec')
|
|
648
654
|
}, "SEC"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
655
|
+
id: "btn-sod",
|
|
649
656
|
variant: "contained",
|
|
650
657
|
style: {
|
|
651
658
|
margin: '0 10px 0 10px'
|
package/dist/layer_init.js
CHANGED
|
@@ -60,9 +60,11 @@ class LayerInit extends _react.default.Component {
|
|
|
60
60
|
resetInitCommonAct,
|
|
61
61
|
resetInitMsAct,
|
|
62
62
|
resetInitNmrAct,
|
|
63
|
-
resetInitCommonWithIntergationAct
|
|
63
|
+
resetInitCommonWithIntergationAct,
|
|
64
|
+
resetDetectorAct
|
|
64
65
|
} = this.props;
|
|
65
66
|
resetInitCommonAct();
|
|
67
|
+
resetDetectorAct();
|
|
66
68
|
const {
|
|
67
69
|
layout,
|
|
68
70
|
features
|
|
@@ -185,6 +187,7 @@ const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
|
|
|
185
187
|
resetInitNmrAct: _manager.resetInitNmr,
|
|
186
188
|
resetInitMsAct: _manager.resetInitMs,
|
|
187
189
|
resetInitCommonWithIntergationAct: _manager.resetInitCommonWithIntergation,
|
|
190
|
+
resetDetectorAct: _manager.resetDetector,
|
|
188
191
|
updateOperationAct: _submit.updateOperation,
|
|
189
192
|
updateMetaPeaksAct: _meta.updateMetaPeaks,
|
|
190
193
|
addOthersAct: _jcamp.addOthers,
|
|
@@ -217,7 +220,9 @@ LayerInit.propTypes = {
|
|
|
217
220
|
onDescriptionChanged: _propTypes.default.func,
|
|
218
221
|
// eslint-disable-line
|
|
219
222
|
setAllCurvesAct: _propTypes.default.func.isRequired,
|
|
220
|
-
userManualLink: _propTypes.default.object
|
|
223
|
+
userManualLink: _propTypes.default.object,
|
|
224
|
+
// eslint-disable-line
|
|
225
|
+
resetDetectorAct: _propTypes.default.func.isRequired
|
|
221
226
|
};
|
|
222
227
|
var _default = exports.default = (0, _reactRedux.connect)(
|
|
223
228
|
// eslint-disable-line
|
package/dist/reducers/index.js
CHANGED
|
@@ -25,6 +25,7 @@ var _reducer_wavelength = _interopRequireDefault(require("./reducer_wavelength")
|
|
|
25
25
|
var _reducer_voltammetry = _interopRequireDefault(require("./reducer_voltammetry"));
|
|
26
26
|
var _reducer_curve = _interopRequireDefault(require("./reducer_curve"));
|
|
27
27
|
var _reducer_axes = _interopRequireDefault(require("./reducer_axes"));
|
|
28
|
+
var _reducer_detector = _interopRequireDefault(require("./reducer_detector"));
|
|
28
29
|
const rootReducer = (0, _redux.combineReducers)({
|
|
29
30
|
threshold: _reducer_threshold.default,
|
|
30
31
|
editPeak: _reducer_edit_peak.default,
|
|
@@ -44,6 +45,7 @@ const rootReducer = (0, _redux.combineReducers)({
|
|
|
44
45
|
wavelength: _reducer_wavelength.default,
|
|
45
46
|
cyclicvolta: _reducer_voltammetry.default,
|
|
46
47
|
curve: _reducer_curve.default,
|
|
47
|
-
axesUnits: _reducer_axes.default
|
|
48
|
+
axesUnits: _reducer_axes.default,
|
|
49
|
+
detector: _reducer_detector.default
|
|
48
50
|
});
|
|
49
51
|
var _default = exports.default = rootReducer;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _action_type = require("../constants/action_type");
|
|
8
|
+
/* eslint-disable no-case-declarations */
|
|
9
|
+
/* eslint-disable default-param-last */
|
|
10
|
+
|
|
11
|
+
const initialState = {
|
|
12
|
+
curves: [{
|
|
13
|
+
curveIdx: 0,
|
|
14
|
+
selectedDetector: ''
|
|
15
|
+
}]
|
|
16
|
+
};
|
|
17
|
+
const findCurveIndex = (curves, targetCurveIdx) => curves.findIndex(curve => curve.curveIdx === targetCurveIdx);
|
|
18
|
+
const updateOrAppendCurve = (curves, targetCurveIdx, newCurve) => {
|
|
19
|
+
const existingCurveIndex = findCurveIndex(curves, targetCurveIdx);
|
|
20
|
+
if (existingCurveIndex !== -1) {
|
|
21
|
+
return curves.map((curve, index) => index === existingCurveIndex ? {
|
|
22
|
+
...curve,
|
|
23
|
+
...newCurve
|
|
24
|
+
} : curve);
|
|
25
|
+
}
|
|
26
|
+
return [...curves, newCurve];
|
|
27
|
+
};
|
|
28
|
+
const detectorReducer = function () {
|
|
29
|
+
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
30
|
+
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
31
|
+
switch (action.type) {
|
|
32
|
+
case _action_type.SEC.UPDATE_DETECTOR:
|
|
33
|
+
const {
|
|
34
|
+
curveIdx,
|
|
35
|
+
selectedDetector
|
|
36
|
+
} = action.payload;
|
|
37
|
+
// eslint-disable-next-line max-len
|
|
38
|
+
const updatedCurves = updateOrAppendCurve(state.curves, curveIdx, {
|
|
39
|
+
curveIdx,
|
|
40
|
+
selectedDetector
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
...state,
|
|
44
|
+
curves: updatedCurves
|
|
45
|
+
};
|
|
46
|
+
case _action_type.MANAGER.RESET_DETECTOR:
|
|
47
|
+
return initialState;
|
|
48
|
+
default:
|
|
49
|
+
return state;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var _default = exports.default = detectorReducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@complat/react-spectra-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
24
24
|
"browserslist": "^4.21.5",
|
|
25
25
|
"classnames": "^2.3.2",
|
|
26
|
-
"d3": "^
|
|
27
|
-
"d3-brush": "3.0.0",
|
|
28
|
-
"d3-selection": "^2.0.0",
|
|
26
|
+
"d3": "^7.8.5",
|
|
29
27
|
"d3-tip": "^0.9.1",
|
|
30
28
|
"jcampconverter": "4.1.0",
|
|
31
29
|
"ml-savitzky-golay-generalized": "1.1.1",
|
|
@@ -48,7 +46,8 @@
|
|
|
48
46
|
"test:coverage": "CI=true react-scripts test --env=jsdom --verbose --testPathIgnorePatterns=./src/__tests__/fixtures/ --coverage",
|
|
49
47
|
"eject": "react-scripts eject",
|
|
50
48
|
"storybook": "start-storybook -p 3001 -c .storybook",
|
|
51
|
-
"buildbook": "build-storybook -c .storybook -o .out"
|
|
49
|
+
"buildbook": "build-storybook -c .storybook -o .out",
|
|
50
|
+
"e2e": "cypress open"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
53
|
"react": "^17.0.2",
|
|
@@ -65,6 +64,7 @@
|
|
|
65
64
|
"@types/enzyme": "^3.10.13",
|
|
66
65
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
67
66
|
"babel-loader": "8.2.5",
|
|
67
|
+
"cypress": "^13.6.2",
|
|
68
68
|
"enzyme": "^3.11.0",
|
|
69
69
|
"enzyme-to-json": "^3.6.2",
|
|
70
70
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -90,5 +90,10 @@
|
|
|
90
90
|
],
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
|
+
},
|
|
94
|
+
"jest": {
|
|
95
|
+
"transformIgnorePatterns": [
|
|
96
|
+
"/node_modules/(?!d3|d3-array|internmap|delaunator|robust-predicates)"
|
|
97
|
+
]
|
|
93
98
|
}
|
|
94
99
|
}
|