@complat/react-spectra-editor 1.0.0-rc8 → 1.0.0-rc9

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.
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const aifJcamp1 = `
8
+ ##TITLE=Spectrum
9
+ ##JCAMP-DX=5.00 $$ chemotion-converter-app (0.1.0)
10
+ ##DATA TYPE=SORPTION-DESORPTION MEASUREMENT
11
+ ##DATA CLASS=XYDATA
12
+ ##ORIGIN=
13
+ ##OWNER=
14
+ ##XUNITS=p/p0
15
+ ##YUNITS=ml/g
16
+ ##OPERATOR=Volodymyr
17
+ ##DATE=2020-04-30T00:00:00
18
+ ##SERIAL=BEL 00218
19
+ ##ADSORPTIVE=CH4
20
+ ##TEMPERATURE=384.15
21
+ ##AMOUNT=0.00980
22
+ ##SAMPLE_CID=aus der BOX
23
+ ##SAMPLE_MAT_ID=DUT-140(Cu)
24
+ ##SOFTWARE=raw2aif
25
+ ##SOFTWARE_VERSION=v004
26
+ ##FIRSTX=0.000213204381723083
27
+ ##LASTX=0.9634757722293498
28
+ ##MINX=0.000213204381723083
29
+ ##MAXX=0.9634757722293498
30
+ ##MINY=10.631
31
+ ##MAXY=1481.2
32
+ ##NPOINTS=96
33
+ ##FIRSTY=10.631
34
+ ##XUNITS=p/p0
35
+ ##YUNITS=ml/g
36
+ ##XYDATA=(XY..XY)
37
+ 0.000213204381723083, 10.631
38
+ 0.0008993091878022303, 66.609
39
+ 0.0016908121977696636, 120.28
40
+ 0.002905260041448732, 170.14
41
+ 0.004614526793644528, 214.69
42
+ 0.008697226882463239, 282.5
43
+ 0.012181979670383893, 322.52
44
+ 0.016622915227474586, 360.27
45
+ 0.022689233198460477, 401.55
46
+ 0.024416263692884636, 412.09
47
+ 0.030442119806572587, 445.23
48
+ 0.03634757722293497, 475.88
49
+ 0.037632487910786536, 482.6
50
+ 0.04695253133326754, 528.34
51
+ 0.049001282936938714, 538.13
52
+ 0.05896378170334551, 588.18
53
+ 0.06089213460969111, 598.56
54
+ 0.06715878811803021, 632.29
55
+ 0.0724217901904668, 664.8
56
+ 0.0735468271982631, 673.66
57
+ 0.12681338201914535, 551.43
58
+ 0.13605052797789402, 552.89
59
+ 0.14818908516727525, 554.89
60
+ 0.16031777361097405, 557.43
61
+ 0.17252541202013225, 559.16
62
+ 0.1847034441922432, 560.83
63
+ 0.19691108260140136, 562.66
64
+ 0.20912858975624196, 563.62
65
+ 0.22129675318267047, 565.09
66
+ 0.2334353103720517, 566.49
67
+ 0.24568242376393962, 568.2
68
+ 0.2578111122076384, 569.8
69
+ 0.26974242573768875, 571.86
70
+ 0.2820388828579888, 573.23
71
+ 0.29420704628441724, 574.73
72
+ 0.3063456034737985, 576.8
73
+ 0.3184742919174973, 577.93
74
+ 0.33048455541300703, 580.66
75
+ 0.34253429389124646, 583.42
76
+ 0.3546728510806277, 586.22
77
+ 0.3664363959340768, 590.5
78
+ 0.37840718444685684, 595.32
79
+ 0.3900621730977993, 602.39
80
+ 0.4011052995164315, 612.81
81
+ 0.4143294187308793, 644.21
82
+ 0.425175170235863, 680.11
83
+ 0.43460969110826014, 719.33
84
+ 0.43827099575643935, 737.27
85
+ 0.4470245731767492, 774.86
86
+ 0.45003454060988846, 794.41
87
+ 0.4586795618276917, 834.82
88
+ 0.46289351623408664, 862.67
89
+ 0.4716865686371262, 897.89
90
+ 0.4746669298332182, 916.08
91
+ 0.4841804006710747, 949.07
92
+ 0.48683509325964675, 967.72
93
+ 0.4977992697128195, 1006.3
94
+ 0.5086055462350735, 1041.7
95
+ 0.5107766702852068, 1051.9
96
+ 0.5232310273364256, 1084.8
97
+ 0.5350833909010165, 1108.9
98
+ 0.5475377479522353, 1130.8
99
+ 0.5602289548998323, 1151.2
100
+ 0.5729596368301589, 1170.2
101
+ 0.5835685384387644, 1182.7
102
+ 0.5969900325668608, 1201.7
103
+ 0.6076778841409257, 1215.4
104
+ 0.6213362281654002, 1234.2
105
+ 0.6324583045494918, 1246.5
106
+ 0.6460376986085068, 1265.7
107
+ 0.6567650251653014, 1277.2
108
+ 0.6686568637126221, 1290.4
109
+ 0.6803414586006118, 1305.8
110
+ 0.6943649462153361, 1327.4
111
+ 0.7055363663278398, 1338.5
112
+ 0.7174676798578901, 1353.9
113
+ 0.7297937432152374, 1364.5
114
+ 0.7422875752491858, 1376.9
115
+ 0.7547814072831344, 1386.7
116
+ 0.767117339386164, 1395.1
117
+ 0.7788019342741538, 1404.7
118
+ 0.7906542978387447, 1415.0
119
+ 0.8027040363169841, 1425.7
120
+ 0.8154445869929933, 1433.9
121
+ 0.827898944044212, 1442.2
122
+ 0.8404322510608901, 1449.0
123
+ 0.8528471331293792, 1454.4
124
+ 0.8653409651633278, 1458.8
125
+ 0.8776275535379454, 1462.7
126
+ 0.8899240106582453, 1466.3
127
+ 0.9024178426921937, 1469.2
128
+ 0.9143886312049738, 1473.3
129
+ 0.9270403631698411, 1473.8
130
+ 0.9390506266653508, 1476.2
131
+ 0.9511003651435903, 1479.6
132
+ 0.9634757722293498, 1481.2
133
+ ##END=$$ End of the data block
134
+
135
+ `;
136
+ var _default = aifJcamp1;
137
+ exports.default = _default;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const aifJcamp2 = `
8
+ ##TITLE=Spectrum
9
+ ##JCAMP-DX=5.00 $$ chemotion-converter-app (0.1.0)
10
+ ##DATA TYPE=SORPTION-DESORPTION MEASUREMENT
11
+ ##DATA CLASS=XYDATA
12
+ ##ORIGIN=
13
+ ##OWNER=
14
+ ##XUNITS=p/p0
15
+ ##YUNITS=ml/g
16
+ ##OPERATOR=Volodymyr
17
+ ##DATE=2020-04-30T00:00:00
18
+ ##SERIAL=BEL 00218
19
+ ##ADSORPTIVE=CH4
20
+ ##AMOUNT=0.00980
21
+ ##SAMPLE_CID=aus der BOX
22
+ ##SAMPLE_MAT_ID=DUT-140(Cu)
23
+ ##SOFTWARE=raw2aif
24
+ ##SOFTWARE_VERSION=v004
25
+ ##FIRSTX=0.9562025066614033
26
+ ##LASTX=0.0013190565479127604
27
+ ##MINX=0.0013190565479127604
28
+ ##MAXX=0.9562025066614033
29
+ ##MINY=383.81
30
+ ##MAXY=1479.7
31
+ ##NPOINTS=82
32
+ ##FIRSTY=1479.7
33
+ ##XUNITS=p/p0
34
+ ##YUNITS=ml/g
35
+ ##XYDATA=(XY..XY)
36
+ 0.9562025066614033, 1479.7
37
+ 0.9443106681140827, 1477.3
38
+ 0.9321819796703839, 1475.6
39
+ 0.9204480410539821, 1472.5
40
+ 0.9083588275930129, 1469.0
41
+ 0.8962696141320439, 1465.6
42
+ 0.8837757820980954, 1462.7
43
+ 0.8719234185335044, 1459.8
44
+ 0.8599131550379947, 1456.7
45
+ 0.8474193230040462, 1454.9
46
+ 0.8352906345603474, 1452.7
47
+ 0.8232310273364256, 1449.4
48
+ 0.8112602388236455, 1446.8
49
+ 0.7988947004835686, 1444.5
50
+ 0.7868350932596467, 1441.8
51
+ 0.7746274548504885, 1439.6
52
+ 0.7625382413895194, 1438.1
53
+ 0.7503996842001381, 1435.6
54
+ 0.7383894207046284, 1432.6
55
+ 0.7260633573472812, 1430.5
56
+ 0.7139248001578999, 1428.5
57
+ 0.7020329616105793, 1427.2
58
+ 0.6899042731668805, 1426.8
59
+ 0.6789006217309781, 1424.4
60
+ 0.664995559064443, 1422.2
61
+ 0.6509819401954011, 1420.1
62
+ 0.6373630711536564, 1417.9
63
+ 0.623379058521662, 1415.6
64
+ 0.6097996644626468, 1413.5
65
+ 0.5956577518997336, 1411.1
66
+ 0.5819599328925293, 1408.7
67
+ 0.5679857890062173, 1406.1
68
+ 0.5540807263396823, 1403.4
69
+ 0.5401460574360999, 1400.6
70
+ 0.5263199447350242, 1397.8
71
+ 0.5124247508141715, 1394.8
72
+ 0.49864798184150794, 1392.3
73
+ 0.48498963781703347, 1388.9
74
+ 0.4709661502023093, 1386.0
75
+ 0.45703148129872695, 1382.9
76
+ 0.44316589361492154, 1379.9
77
+ 0.42934964965952827, 1376.6
78
+ 0.4154939307214053, 1372.9
79
+ 0.4016283430376, 1369.5
80
+ 0.38781209908220665, 1365.7
81
+ 0.3739563801440837, 1361.6
82
+ 0.3600118424948189, 1357.8
83
+ 0.34627454850488504, 1353.7
84
+ 0.33229053587289054, 1349.8
85
+ 0.3185927168656864, 1345.5
86
+ 0.3047369979275634, 1340.4
87
+ 0.28991414191256293, 1335.0
88
+ 0.27569327938419025, 1329.6
89
+ 0.26235073522155333, 1324.0
90
+ 0.24861344123161946, 1317.6
91
+ 0.23503404717260434, 1310.7
92
+ 0.22129675318267047, 1302.6
93
+ 0.20763840915819598, 1293.8
94
+ 0.19478930227968025, 1284.5
95
+ 0.1684298825619264, 1242.6
96
+ 0.1667818020329616, 1235.8
97
+ 0.15903483667225896, 1176.6
98
+ 0.1511990526004145, 1093.3
99
+ 0.14665942958649955, 1030.0
100
+ 0.14400473699792757, 986.68
101
+ 0.14155728806868648, 942.29
102
+ 0.1387841705319254, 870.19
103
+ 0.13701766505477153, 816.27
104
+ 0.13480706602190862, 742.71
105
+ 0.13319846047567355, 683.09
106
+ 0.1316391986578506, 633.49
107
+ 0.1289845060692786, 581.11
108
+ 0.1115859074311655, 544.44
109
+ 0.09708773314911674, 537.71
110
+ 0.08266554820882266, 533.49
111
+ 0.0688868054870226, 529.35
112
+ 0.05518799960525017, 524.71
113
+ 0.04177045297542682, 518.59
114
+ 0.00863692884634363, 482.67
115
+ 0.003195993289252936, 448.59
116
+ 0.0018709168064738972, 415.76
117
+ 0.0013190565479127604, 383.81
118
+ ##END=$$ End of the data block
119
+
120
+
121
+ `;
122
+ var _default = aifJcamp2;
123
+ exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setAllCurves = exports.selectCurve = void 0;
6
+ exports.toggleShowAllCurves = exports.setAllCurves = exports.selectCurve = void 0;
7
7
  var _action_type = require("../constants/action_type");
8
8
  const selectCurve = payload => ({
9
9
  type: _action_type.CURVE.SELECT_WORKING_CURVE,
@@ -14,4 +14,9 @@ const setAllCurves = payload => ({
14
14
  type: _action_type.CURVE.SET_ALL_CURVES,
15
15
  payload
16
16
  });
17
- exports.setAllCurves = setAllCurves;
17
+ exports.setAllCurves = setAllCurves;
18
+ const toggleShowAllCurves = payload => ({
19
+ type: _action_type.CURVE.SET_SHOULD_SHOW_ALL_CURVES,
20
+ payload
21
+ });
22
+ exports.toggleShowAllCurves = toggleShowAllCurves;
@@ -155,7 +155,11 @@ const layoutSelect = (classes, layoutSt, updateLayoutAct) => {
155
155
  value: _list_layout.LIST_LAYOUT.SEC
156
156
  }, /*#__PURE__*/_react.default.createElement("span", {
157
157
  className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
158
- }, "SEC"))));
158
+ }, "SEC")), /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
159
+ value: _list_layout.LIST_LAYOUT.AIF
160
+ }, /*#__PURE__*/_react.default.createElement("span", {
161
+ className: (0, _classnames.default)(classes.txtOpt, 'option-sv-bar-layout')
162
+ }, "AIF"))));
159
163
  };
160
164
  const Layout = _ref => {
161
165
  let {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.drawMain = exports.drawLabel = exports.drawDisplay = exports.drawDestroy = void 0;
6
+ exports.drawMain = exports.drawLabel = exports.drawDisplay = exports.drawDestroy = exports.drawArrowOnCurve = void 0;
7
7
  var d3 = _interopRequireWildcard(require("d3"));
8
8
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -28,4 +28,26 @@ const drawDisplay = (klass, isHidden) => {
28
28
  };
29
29
  exports.drawDisplay = drawDisplay;
30
30
  const drawDestroy = klass => d3.select(`${klass} > *`).remove();
31
- exports.drawDestroy = drawDestroy;
31
+ exports.drawDestroy = drawDestroy;
32
+ const drawArrowOnCurve = (klass, isHidden) => {
33
+ if (isHidden) {
34
+ d3.select(klass).selectAll('marker').remove();
35
+ } else {
36
+ d3.select(klass).selectAll('marker').remove();
37
+ const arrowLeft = d3.select(klass).selectAll('defs').append('marker').attr('id', 'arrow-left').attr('viewBox', '0 0 10 10').attr('refX', 5).attr('refY', 5).attr('markerWidth', 6).attr('markerHeight', 6).attr('orient', 'auto').attr('fill', '#00AA0099');
38
+ arrowLeft.append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z');
39
+
40
+ // const arrowRight = d3.select(klass).selectAll('defs')
41
+ // .append('marker')
42
+ // .attr('id', 'arrow-right')
43
+ // .attr('viewBox', '0 0 10 10')
44
+ // .attr('refX', 5)
45
+ // .attr('refY', 5)
46
+ // .attr('markerWidth', 6)
47
+ // .attr('markerHeight', 6)
48
+ // .attr('orient', 'auto-start-reverse');
49
+ // arrowRight.append('path')
50
+ // .attr('d', 'M 0 0 L 10 5 L 0 10 z');
51
+ }
52
+ };
53
+ exports.drawArrowOnCurve = drawArrowOnCurve;
@@ -84,6 +84,7 @@ class ViewerMulti extends _react.default.Component {
84
84
  });
85
85
  (0, _draw.drawLabel)(this.rootKlass, cLabel, xLabel, yLabel);
86
86
  (0, _draw.drawDisplay)(this.rootKlass, isHidden);
87
+ (0, _draw.drawArrowOnCurve)(this.rootKlass, isHidden);
87
88
  }
88
89
  componentDidUpdate(prevProps) {
89
90
  const {
@@ -125,6 +126,7 @@ class ViewerMulti extends _react.default.Component {
125
126
  });
126
127
  (0, _draw.drawLabel)(this.rootKlass, cLabel, xLabel, yLabel);
127
128
  (0, _draw.drawDisplay)(this.rootKlass, isHidden);
129
+ (0, _draw.drawArrowOnCurve)(this.rootKlass, isHidden);
128
130
  }
129
131
  componentWillUnmount() {
130
132
  (0, _draw.drawDestroy)(this.rootKlass);
@@ -36,6 +36,7 @@ class MultiFocus {
36
36
  } = props;
37
37
  this.entities = entities;
38
38
  this.jcampIdx = 0;
39
+ this.isShowAllCurves = false;
39
40
  this.rootKlass = '.d3Line';
40
41
  this.margin = {
41
42
  t: 5,
@@ -251,6 +252,9 @@ class MultiFocus {
251
252
  this.updatePathCall(xt, yt);
252
253
  this.path.attr('d', this.pathCall(this.data));
253
254
  this.path.style('stroke', this.pathColor);
255
+ if (this.layout === _list_layout.LIST_LAYOUT.AIF) {
256
+ this.path.attr('marker-mid', 'url(#arrow-left)');
257
+ }
254
258
  }
255
259
  drawOtherLines(layout) {
256
260
  d3.selectAll('.line-clip-compare').remove();
@@ -263,6 +267,9 @@ class MultiFocus {
263
267
  const pathColor = color ? color : _format.default.mutiEntitiesColors(idx);
264
268
  const path = (0, _mount.MountComparePath)(this, pathColor, idx, 0.4);
265
269
  path.attr('d', this.pathCall(data));
270
+ if (this.layout === _list_layout.LIST_LAYOUT.AIF && this.isShowAllCurves === true) {
271
+ path.attr('marker-mid', 'url(#arrow-left)');
272
+ }
266
273
  });
267
274
  return null;
268
275
  }
@@ -730,7 +737,7 @@ class MultiFocus {
730
737
  ccp.enter().append('path').attr('d', lineSymbol).attr('class', 'enter-ref').attr('fill', 'green').attr('fill-opacity', 0.8).merge(ccp).attr('transform', d => `translate(${xt(d.x)}, ${yt(d.y)})`);
731
738
  }
732
739
  reverseXAxis(layoutSt) {
733
- return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC].indexOf(layoutSt) < 0;
740
+ return [_list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS, _list_layout.LIST_LAYOUT.TGA, _list_layout.LIST_LAYOUT.XRD, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.CDS, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) < 0;
734
741
  }
735
742
  create(_ref) {
736
743
  let {
@@ -751,9 +758,11 @@ class MultiFocus {
751
758
  (0, _mount.MountMainFrame)(this, 'focus');
752
759
  (0, _mount.MountClip)(this);
753
760
  const {
754
- curveIdx
761
+ curveIdx,
762
+ isShowAllCurve
755
763
  } = curveSt;
756
764
  const jcampIdx = curveIdx;
765
+ this.isShowAllCurves = isShowAllCurve;
757
766
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
758
767
  this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
759
768
  this.setTip();
@@ -799,9 +808,11 @@ class MultiFocus {
799
808
  this.root = d3.select(this.rootKlass).selectAll('.focus-main');
800
809
  this.scales = (0, _init.InitScale)(this, this.reverseXAxis(layoutSt));
801
810
  const {
802
- curveIdx
811
+ curveIdx,
812
+ isShowAllCurve
803
813
  } = curveSt;
804
814
  const jcampIdx = curveIdx;
815
+ this.isShowAllCurves = isShowAllCurve;
805
816
  this.entities = entities;
806
817
  this.setDataParams(filterPeak, tTrEndPts, tSfPeaks, layoutSt, cyclicvoltaSt, jcampIdx);
807
818
  if (this.data && this.data.length > 0) {
@@ -52,7 +52,7 @@ class MultiJcampsViewer extends _react.default.Component {
52
52
  render() {
53
53
  const {
54
54
  classes,
55
- curvSt,
55
+ curveSt,
56
56
  operations,
57
57
  entityFileNames,
58
58
  entities,
@@ -60,7 +60,10 @@ class MultiJcampsViewer extends _react.default.Component {
60
60
  } = this.props;
61
61
  if (!entities || entities.length === 0) return /*#__PURE__*/_react.default.createElement("div", null);
62
62
  const seperatedSubLayouts = seperatingSubLayout(entities, 'xUnit');
63
- const entity = entities[curvSt.curveIdx];
63
+ const {
64
+ curveIdx
65
+ } = curveSt;
66
+ const entity = entities[curveIdx];
64
67
  const {
65
68
  feature,
66
69
  topic,
@@ -91,7 +94,7 @@ class MultiJcampsViewer extends _react.default.Component {
91
94
  xs: 3,
92
95
  align: "center"
93
96
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
94
- jcampIdx: curvSt.curveIdx,
97
+ jcampIdx: curveIdx,
95
98
  entityFileNames: entityFileNames,
96
99
  userManualLink: userManualLink,
97
100
  feature: feature,
@@ -106,7 +109,7 @@ class MultiJcampsViewer extends _react.default.Component {
106
109
  const mapStateToProps = (state, _) => (
107
110
  // eslint-disable-line
108
111
  {
109
- curvSt: state.curve,
112
+ curveSt: state.curve,
110
113
  cyclicVoltaSt: state.cyclicvolta,
111
114
  entities: state.curve.listCurves
112
115
  });
@@ -123,7 +126,7 @@ MultiJcampsViewer.propTypes = {
123
126
  entityFileNames: _propTypes.default.array.isRequired,
124
127
  molSvg: _propTypes.default.string.isRequired,
125
128
  setAllCurvesAct: _propTypes.default.func.isRequired,
126
- curvSt: _propTypes.default.object.isRequired,
129
+ curveSt: _propTypes.default.object.isRequired,
127
130
  cyclicVoltaSt: _propTypes.default.object.isRequired,
128
131
  addNewCylicVoltaPairPeakAct: _propTypes.default.func.isRequired,
129
132
  addCylicVoltaMaxPeakAct: _propTypes.default.func.isRequired,
@@ -16,6 +16,7 @@ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography")
16
16
  var _styles = require("@material-ui/core/styles");
17
17
  var _core = require("@material-ui/core");
18
18
  var _curve = require("../../actions/curve");
19
+ var _list_layout = require("../../constants/list_layout");
19
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
21
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
22
  /* eslint-disable react/function-component-definition, function-paren-newline,
@@ -51,9 +52,11 @@ const GraphSelectionPanel = _ref => {
51
52
  let {
52
53
  classes,
53
54
  curveSt,
54
- selectCurveAct,
55
55
  entityFileNames,
56
- subLayoutsInfo
56
+ subLayoutsInfo,
57
+ layoutSt,
58
+ selectCurveAct,
59
+ toggleShowAllCurveAct
57
60
  } = _ref;
58
61
  let subLayoutValues = [];
59
62
  if (subLayoutsInfo !== undefined && subLayoutsInfo !== null) {
@@ -65,7 +68,8 @@ const GraphSelectionPanel = _ref => {
65
68
  }
66
69
  const {
67
70
  curveIdx,
68
- listCurves
71
+ listCurves,
72
+ isShowAllCurve
69
73
  } = curveSt;
70
74
  if (!listCurves) {
71
75
  return /*#__PURE__*/_react.default.createElement("span", null);
@@ -76,6 +80,9 @@ const GraphSelectionPanel = _ref => {
76
80
  const onChangeTabSubLayout = (event, newValue) => {
77
81
  setSelectedSublayout(newValue);
78
82
  };
83
+ const onChangeSwitch = event => {
84
+ toggleShowAllCurveAct(event.target.checked);
85
+ };
79
86
  let itemsSubLayout = [];
80
87
  if (selectedSubLayout && subLayoutValues.length > 1) {
81
88
  const subLayout = subLayoutsInfo[selectedSubLayout];
@@ -120,7 +127,13 @@ const GraphSelectionPanel = _ref => {
120
127
  className: "txt-panel-header"
121
128
  }, /*#__PURE__*/_react.default.createElement("span", {
122
129
  className: (0, _classnames.default)(classes.txtBadge, 'txt-sv-panel-title')
123
- }, "Graph selection"))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), subLayoutValues && subLayoutValues.length > 1 ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.Tabs, {
130
+ }, "Graph selection"))), /*#__PURE__*/_react.default.createElement(_Divider.default, null), layoutSt === _list_layout.LIST_LAYOUT.AIF ? /*#__PURE__*/_react.default.createElement(_core.FormControlLabel, {
131
+ control: /*#__PURE__*/_react.default.createElement(_core.Switch, {
132
+ checked: isShowAllCurve,
133
+ onChange: onChangeSwitch
134
+ }),
135
+ label: "Show all curves"
136
+ }) : null, subLayoutValues && subLayoutValues.length > 1 ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_core.Tabs, {
124
137
  value: selectedSubLayout,
125
138
  onChange: onChangeTabSubLayout
126
139
  }, subLayoutValues.map((subLayout, i) => {
@@ -184,7 +197,8 @@ const mapStateToProps = (state, props) => (
184
197
  curveSt: state.curve
185
198
  });
186
199
  const mapDispatchToProps = dispatch => (0, _redux.bindActionCreators)({
187
- selectCurveAct: _curve.selectCurve
200
+ selectCurveAct: _curve.selectCurve,
201
+ toggleShowAllCurveAct: _curve.toggleShowAllCurves
188
202
  }, dispatch);
189
203
  GraphSelectionPanel.propTypes = {
190
204
  classes: _propTypes.default.object.isRequired,
@@ -194,7 +208,8 @@ GraphSelectionPanel.propTypes = {
194
208
  curveSt: _propTypes.default.object.isRequired,
195
209
  selectCurveAct: _propTypes.default.func.isRequired,
196
210
  entityFileNames: _propTypes.default.array.isRequired,
197
- subLayoutsInfo: _propTypes.default.array
211
+ subLayoutsInfo: _propTypes.default.array,
212
+ toggleShowAllCurveAct: _propTypes.default.func.isRequired
198
213
  };
199
214
  var _default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)((0, _styles.withStyles)(styles)(GraphSelectionPanel));
200
215
  exports.default = _default;
@@ -148,6 +148,7 @@ const CYCLIC_VOLTA_METRY = {
148
148
  exports.CYCLIC_VOLTA_METRY = CYCLIC_VOLTA_METRY;
149
149
  const CURVE = {
150
150
  SELECT_WORKING_CURVE: 'SELECT_WORKING_CURVE',
151
- SET_ALL_CURVES: 'SET_ALL_CURVES'
151
+ SET_ALL_CURVES: 'SET_ALL_CURVES',
152
+ SET_SHOULD_SHOW_ALL_CURVES: 'SET_SHOULD_SHOW_ALL_CURVES'
152
153
  };
153
154
  exports.CURVE = CURVE;
@@ -21,6 +21,7 @@ const LIST_LAYOUT = {
21
21
  HPLC_UVVIS: 'HPLC UV/VIS',
22
22
  CYCLIC_VOLTAMMETRY: 'CYCLIC VOLTAMMETRY',
23
23
  CDS: 'CIRCULAR DICHROISM SPECTROSCOPY',
24
- SEC: 'SIZE EXCLUSION CHROMATOGRAPHY'
24
+ SEC: 'SIZE EXCLUSION CHROMATOGRAPHY',
25
+ AIF: 'AIF'
25
26
  };
26
27
  exports.LIST_LAYOUT = LIST_LAYOUT;
@@ -368,6 +368,9 @@ const readLayout = jcamp => {
368
368
  if (dataType.includes('SIZE EXCLUSION CHROMATOGRAPHY')) {
369
369
  return _list_layout.LIST_LAYOUT.SEC;
370
370
  }
371
+ if (dataType.includes('SORPTION-DESORPTION MEASUREMENT')) {
372
+ return _list_layout.LIST_LAYOUT.AIF;
373
+ }
371
374
  }
372
375
  return false;
373
376
  };
@@ -759,7 +762,7 @@ const ExtractJcamp = source => {
759
762
  features = extrFeaturesMs(jcamp, layout, peakUp);
760
763
  } else if (_format.default.isXRDLayout(layout) || _format.default.isCDSLayout(layout)) {
761
764
  features = extrFeaturesXrd(jcamp, layout, peakUp);
762
- } else if (_format.default.isCyclicVoltaLayout(layout) || _format.default.isSECLayout(layout)) {
765
+ } else if (_format.default.isCyclicVoltaLayout(layout) || _format.default.isSECLayout(layout) || _format.default.isAIFLayout(layout)) {
763
766
  features = extrFeaturesCylicVolta(jcamp, layout, peakUp);
764
767
  } else {
765
768
  features = extrFeaturesNi(jcamp, layout, peakUp, spectra);
@@ -362,6 +362,8 @@ const isCyclicVoltaLayout = layoutSt => _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMME
362
362
  const isCDSLayout = layoutSt => _list_layout.LIST_LAYOUT.CDS === layoutSt;
363
363
  const isSECLayout = layoutSt => _list_layout.LIST_LAYOUT.SEC === layoutSt;
364
364
  const isEmWaveLayout = layoutSt => [_list_layout.LIST_LAYOUT.IR, _list_layout.LIST_LAYOUT.RAMAN, _list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0;
365
+ const hasMultiCurves = layoutSt => [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) >= 0;
366
+ const isAIFLayout = layoutSt => _list_layout.LIST_LAYOUT.AIF === layoutSt;
365
367
  const getNmrTyp = layout => {
366
368
  switch (layout) {
367
369
  case _list_layout.LIST_LAYOUT.H1:
@@ -444,7 +446,9 @@ const Format = {
444
446
  formatedEm,
445
447
  calcMpyCenter: _multiplicity_calc.calcMpyCenter,
446
448
  compareColors,
447
- mutiEntitiesColors
449
+ mutiEntitiesColors,
450
+ hasMultiCurves,
451
+ isAIFLayout
448
452
  };
449
453
  var _default = Format;
450
454
  exports.default = _default;
package/dist/index.js CHANGED
@@ -39,6 +39,8 @@ var _sec_1_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_1_jc
39
39
  var _sec_2_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_2_jcamp"));
40
40
  var _sec_3_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_3_jcamp"));
41
41
  var _sec_4_jcamp = _interopRequireDefault(require("./__tests__/fixtures/sec_4_jcamp"));
42
+ var _aif_jcamp_ = _interopRequireDefault(require("./__tests__/fixtures/aif_jcamp_1"));
43
+ var _aif_jcamp_2 = _interopRequireDefault(require("./__tests__/fixtures/aif_jcamp_2"));
42
44
  var _qDescValue = require("./__tests__/fixtures/qDescValue");
43
45
  require("./__tests__/style/svg.css");
44
46
  /* eslint-disable prefer-object-spread, default-param-last, no-nested-ternary */
@@ -71,6 +73,8 @@ const secEntity1 = _app.FN.ExtractJcamp(_sec_1_jcamp.default);
71
73
  const secEntity2 = _app.FN.ExtractJcamp(_sec_2_jcamp.default);
72
74
  const secEntity3 = _app.FN.ExtractJcamp(_sec_3_jcamp.default);
73
75
  const secEntity4 = _app.FN.ExtractJcamp(_sec_4_jcamp.default);
76
+ const aifEntity1 = _app.FN.ExtractJcamp(_aif_jcamp_.default);
77
+ const aifEntity2 = _app.FN.ExtractJcamp(_aif_jcamp_2.default);
74
78
  class DemoWriteIr extends _react.default.Component {
75
79
  constructor(props) {
76
80
  super(props);
@@ -156,6 +160,8 @@ class DemoWriteIr extends _react.default.Component {
156
160
  return cdsEntity;
157
161
  case 'sec':
158
162
  return secEntity1;
163
+ case 'aif':
164
+ return aifEntity1;
159
165
  case 'ms':
160
166
  default:
161
167
  return msEntity;
@@ -178,6 +184,8 @@ class DemoWriteIr extends _react.default.Component {
178
184
  return [xrdEntity1, xrdEntity2];
179
185
  case 'sec':
180
186
  return [secEntity1, secEntity2, secEntity3, secEntity4];
187
+ case 'aif':
188
+ return [aifEntity1, aifEntity2];
181
189
  default:
182
190
  return false;
183
191
  }
@@ -208,6 +216,7 @@ class DemoWriteIr extends _react.default.Component {
208
216
  case 'cyclic volta':
209
217
  case 'cds':
210
218
  case 'sec':
219
+ case 'aif':
211
220
  default:
212
221
  return false;
213
222
  }
@@ -343,7 +352,7 @@ class DemoWriteIr extends _react.default.Component {
343
352
  multiplicity,
344
353
  integration
345
354
  } = _ref3;
346
- if (['1H', '13C', '19F'].indexOf(layout) < 0) return;
355
+ if (!_app.FN.isNmrLayout(layout)) return;
347
356
  const desc = this.formatMpy({
348
357
  multiplicity,
349
358
  integration,
@@ -490,7 +499,7 @@ class DemoWriteIr extends _react.default.Component {
490
499
  name: 'save',
491
500
  value: this.savePeaks
492
501
  }].filter(r => r.value);
493
- if (['1H', '13C', '19F', '31P', '15N', '29Si'].indexOf(entity.layout) >= 0) {
502
+ if (_app.FN.isNmrLayout(entity.layout)) {
494
503
  operations = [{
495
504
  name: 'write multiplicity',
496
505
  value: this.writeMpy
@@ -611,6 +620,12 @@ class DemoWriteIr extends _react.default.Component {
611
620
  },
612
621
  onClick: this.onClick('sec')
613
622
  }, "SEC"), /*#__PURE__*/_react.default.createElement(_Button.default, {
623
+ variant: "contained",
624
+ style: {
625
+ margin: '0 10px 0 10px'
626
+ },
627
+ onClick: this.onClick('aif')
628
+ }, "AIF"), /*#__PURE__*/_react.default.createElement(_Button.default, {
614
629
  variant: "contained",
615
630
  style: {
616
631
  margin: '0 10px 0 10px'
@@ -13,7 +13,8 @@ var _format = _interopRequireDefault(require("../helpers/format"));
13
13
 
14
14
  const initialState = {
15
15
  listCurves: [],
16
- curveIdx: 0
16
+ curveIdx: 0,
17
+ isShowAllCurve: false
17
18
  };
18
19
  const setAllCurves = (state, action) => {
19
20
  const {
@@ -64,6 +65,10 @@ const curveReducer = function () {
64
65
  });
65
66
  case _action_type.CURVE.SET_ALL_CURVES:
66
67
  return setAllCurves(state, action);
68
+ case _action_type.CURVE.SET_SHOULD_SHOW_ALL_CURVES:
69
+ return Object.assign({}, state, {
70
+ isShowAllCurve: action.payload
71
+ });
67
72
  default:
68
73
  return state;
69
74
  }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _enzyme = _interopRequireDefault(require("enzyme"));
5
+ var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));
6
+ _enzyme.default.configure({
7
+ adapter: new _enzymeAdapterReact.default()
8
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.0.0-rc8",
3
+ "version": "1.0.0-rc9",
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",
@@ -63,7 +63,11 @@
63
63
  "@babel/preset-env": "^7.21.5",
64
64
  "@babel/preset-react": "^7.18.6",
65
65
  "@storybook/react": "7.0.7",
66
+ "@types/enzyme": "^3.10.13",
66
67
  "babel-loader": "8.2.5",
68
+ "enzyme": "^3.11.0",
69
+ "enzyme-adapter-react-16": "^1.15.7",
70
+ "enzyme-to-json": "^3.6.2",
67
71
  "eslint-config-airbnb": "^19.0.4",
68
72
  "eslint-plugin-import": "^2.25.0",
69
73
  "eslint-plugin-jsx-a11y": "^6.5.1",