@complat/react-spectra-editor 1.0.0-rc2 → 1.0.0-rc20.patch-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.
Files changed (202) hide show
  1. package/README.md +16 -0
  2. package/dist/__tests__/fixtures/aif_jcamp_1.js +136 -0
  3. package/dist/__tests__/fixtures/aif_jcamp_2.js +122 -0
  4. package/dist/__tests__/fixtures/backup/nmr1h_a.js +3518 -0
  5. package/dist/__tests__/fixtures/backup/xrd_jcamp_1.js +10705 -0
  6. package/dist/__tests__/fixtures/cds_jcamp.js +861 -0
  7. package/dist/__tests__/fixtures/compare_ir_1_jcamp.js +585 -0
  8. package/dist/__tests__/fixtures/compare_ir_2_jcamp.js +515 -0
  9. package/dist/__tests__/fixtures/compare_uv_vis_jcamp.js +640 -0
  10. package/dist/__tests__/fixtures/cyclic_voltammetry_1.js +778 -0
  11. package/dist/__tests__/fixtures/cyclic_voltammetry_2.js +758 -0
  12. package/dist/__tests__/fixtures/cyclic_voltammetry_3.js +759 -0
  13. package/dist/__tests__/fixtures/dls_acf_jcamp.js +148 -0
  14. package/dist/__tests__/fixtures/dls_intensity_jcamp.js +151 -0
  15. package/dist/__tests__/fixtures/emissions_jcamp.js +883 -0
  16. package/dist/__tests__/fixtures/hplc_uvvis_jcamp.js +638 -0
  17. package/dist/__tests__/fixtures/hplc_uvvis_jcamp_2.js +221 -0
  18. package/dist/__tests__/fixtures/ir_jcamp.js +148 -0
  19. package/dist/__tests__/fixtures/ir_result.js +46 -0
  20. package/dist/__tests__/fixtures/ir_svg.js +8 -0
  21. package/dist/__tests__/fixtures/ms_jcamp.js +64 -0
  22. package/dist/__tests__/fixtures/nmr13c_dept_jcamp.js +3543 -0
  23. package/dist/__tests__/fixtures/nmr13c_jcamp.js +1229 -0
  24. package/dist/__tests__/fixtures/nmr15n_jcamp.js +7177 -0
  25. package/dist/__tests__/fixtures/nmr19f_jcamp.js +6560 -0
  26. package/dist/__tests__/fixtures/nmr1h_2_jcamp.js +2005 -0
  27. package/dist/__tests__/fixtures/nmr1h_jcamp.js +4516 -0
  28. package/dist/__tests__/fixtures/nmr29si_jcamp.js +3029 -0
  29. package/dist/__tests__/fixtures/nmr31p_jcamp.js +3418 -0
  30. package/dist/__tests__/fixtures/nmr_result.js +68 -0
  31. package/dist/__tests__/fixtures/nmr_svg.js +8 -0
  32. package/dist/__tests__/fixtures/phenylalanin.js +142 -0
  33. package/dist/__tests__/fixtures/qDescValue.js +65 -0
  34. package/dist/__tests__/fixtures/raman_jcamp.js +410 -0
  35. package/dist/__tests__/fixtures/sec_1_jcamp.js +425 -0
  36. package/dist/__tests__/fixtures/sec_2_jcamp.js +407 -0
  37. package/dist/__tests__/fixtures/sec_3_jcamp.js +408 -0
  38. package/dist/__tests__/fixtures/sec_4_jcamp.js +407 -0
  39. package/dist/__tests__/fixtures/tga_jcamp.js +4157 -0
  40. package/dist/__tests__/fixtures/uv_vis_jcamp.js +249 -0
  41. package/dist/__tests__/fixtures/xrd_jcamp_1.js +436 -0
  42. package/dist/__tests__/fixtures/xrd_jcamp_2.js +955 -0
  43. package/dist/__tests__/fixtures/xrd_jcamp_3.js +1871 -0
  44. package/dist/__tests__/units/components/panel/graph_selection.test.js +72 -0
  45. package/dist/__tests__/units/components/panel/peaks.test.js +87 -0
  46. package/dist/actions/curve.js +15 -14
  47. package/dist/actions/cyclic_voltammetry.js +40 -60
  48. package/dist/actions/edit_peak.js +8 -12
  49. package/dist/actions/forecast.js +16 -24
  50. package/dist/actions/integration.js +12 -18
  51. package/dist/actions/jcamp.js +16 -24
  52. package/dist/actions/layout.js +4 -6
  53. package/dist/actions/manager.js +20 -30
  54. package/dist/actions/meta.js +4 -6
  55. package/dist/actions/multiplicity.js +24 -36
  56. package/dist/actions/scan.js +12 -18
  57. package/dist/actions/shift.js +8 -12
  58. package/dist/actions/status.js +12 -18
  59. package/dist/actions/submit.js +16 -24
  60. package/dist/actions/threshold.js +20 -30
  61. package/dist/actions/ui.js +25 -31
  62. package/dist/actions/wavelength.js +4 -6
  63. package/dist/app.js +25 -23
  64. package/dist/components/cmd_bar/01_viewer.js +24 -34
  65. package/dist/components/cmd_bar/02_zoom.js +18 -28
  66. package/dist/components/cmd_bar/03_peak.js +50 -66
  67. package/dist/components/cmd_bar/04_integration.js +70 -84
  68. package/dist/components/cmd_bar/05_multiplicity.js +42 -56
  69. package/dist/components/cmd_bar/06_undo_redo.js +22 -36
  70. package/dist/components/cmd_bar/07_pecker.js +24 -34
  71. package/dist/components/cmd_bar/common.js +11 -7
  72. package/dist/components/cmd_bar/index.js +17 -23
  73. package/dist/components/cmd_bar/r01_layout.js +79 -56
  74. package/dist/components/cmd_bar/r02_scan.js +70 -87
  75. package/dist/components/cmd_bar/r03_threshold.js +54 -68
  76. package/dist/components/cmd_bar/r04_submit.js +71 -83
  77. package/dist/components/cmd_bar/r05_submit_btn.js +64 -72
  78. package/dist/components/cmd_bar/r06_predict_btn.js +142 -152
  79. package/dist/components/cmd_bar/r07_wavelength_btn.js +28 -36
  80. package/dist/components/cmd_bar/tri_btn.js +91 -113
  81. package/dist/components/common/chem.js +2 -3
  82. package/dist/components/common/comps.js +2 -2
  83. package/dist/components/common/draw.js +30 -11
  84. package/dist/components/d3_line/index.js +154 -176
  85. package/dist/components/d3_line/line_focus.js +595 -739
  86. package/dist/components/d3_multi/index.js +153 -174
  87. package/dist/components/d3_multi/multi_focus.js +725 -850
  88. package/dist/components/d3_rect/index.js +112 -134
  89. package/dist/components/d3_rect/rect_focus.js +163 -208
  90. package/dist/components/forecast/comps.js +60 -68
  91. package/dist/components/forecast/ir_comps.js +49 -56
  92. package/dist/components/forecast/ir_viewer.js +61 -68
  93. package/dist/components/forecast/nmr_comps.js +62 -72
  94. package/dist/components/forecast/nmr_viewer.js +59 -68
  95. package/dist/components/forecast/section_loading.js +39 -63
  96. package/dist/components/forecast_viewer.js +109 -119
  97. package/dist/components/multi_jcamps_viewer.js +97 -113
  98. package/dist/components/panel/compare.js +183 -192
  99. package/dist/components/panel/cyclic_voltamery_data.js +149 -165
  100. package/dist/components/panel/graph_selection.js +143 -132
  101. package/dist/components/panel/index.js +112 -144
  102. package/dist/components/panel/info.js +125 -132
  103. package/dist/components/panel/multiplicity.js +215 -223
  104. package/dist/components/panel/multiplicity_coupling.js +108 -136
  105. package/dist/components/panel/multiplicity_select.js +43 -51
  106. package/dist/components/panel/peaks.js +130 -132
  107. package/dist/constants/action_type.js +23 -39
  108. package/dist/constants/list_layout.js +7 -4
  109. package/dist/constants/list_shift.js +117 -103
  110. package/dist/constants/list_ui.js +3 -6
  111. package/dist/constants/list_wavelength.js +7 -8
  112. package/dist/fn.js +2 -3
  113. package/dist/helpers/brush.js +49 -65
  114. package/dist/helpers/calc.js +2 -4
  115. package/dist/helpers/carbonFeatures.js +22 -20
  116. package/dist/helpers/cfg.js +49 -67
  117. package/dist/helpers/chem.js +450 -393
  118. package/dist/helpers/compass.js +92 -83
  119. package/dist/helpers/converter.js +52 -65
  120. package/dist/helpers/extractParams.js +60 -52
  121. package/dist/helpers/extractPeaksEdit.js +29 -25
  122. package/dist/helpers/focus.js +2 -6
  123. package/dist/helpers/format.js +416 -361
  124. package/dist/helpers/init.js +41 -37
  125. package/dist/helpers/integration.js +18 -21
  126. package/dist/helpers/mount.js +57 -61
  127. package/dist/helpers/multiplicity.js +19 -24
  128. package/dist/helpers/multiplicity_calc.js +39 -50
  129. package/dist/helpers/multiplicity_complat.js +21 -47
  130. package/dist/helpers/multiplicity_manual.js +49 -55
  131. package/dist/helpers/multiplicity_verify_basic.js +108 -111
  132. package/dist/helpers/shift.js +15 -23
  133. package/dist/helpers/zoom.js +7 -11
  134. package/dist/index.js +680 -630
  135. package/dist/layer_content.js +40 -43
  136. package/dist/layer_init.js +162 -184
  137. package/dist/layer_prism.js +38 -41
  138. package/dist/reducers/index.js +2 -3
  139. package/dist/reducers/reducer_curve.js +35 -26
  140. package/dist/reducers/reducer_edit_peak.js +122 -98
  141. package/dist/reducers/reducer_forecast.js +57 -44
  142. package/dist/reducers/reducer_integration.js +135 -103
  143. package/dist/reducers/reducer_jcamp.js +49 -44
  144. package/dist/reducers/reducer_layout.js +5 -6
  145. package/dist/reducers/reducer_manager.js +5 -6
  146. package/dist/reducers/reducer_meta.js +5 -6
  147. package/dist/reducers/reducer_multiplicity.js +100 -77
  148. package/dist/reducers/reducer_scan.js +17 -20
  149. package/dist/reducers/reducer_shift.js +115 -70
  150. package/dist/reducers/reducer_simulation.js +7 -8
  151. package/dist/reducers/reducer_status.js +5 -6
  152. package/dist/reducers/reducer_submit.js +12 -15
  153. package/dist/reducers/reducer_threshold.js +5 -6
  154. package/dist/reducers/reducer_ui.js +5 -6
  155. package/dist/reducers/reducer_voltammetry.js +156 -96
  156. package/dist/reducers/reducer_wavelength.js +5 -6
  157. package/dist/reducers/undo_redo_config.js +3 -5
  158. package/dist/sagas/index.js +2 -15
  159. package/dist/sagas/saga_edit_peak.js +54 -68
  160. package/dist/sagas/saga_manager.js +86 -130
  161. package/dist/sagas/saga_meta.js +25 -31
  162. package/dist/sagas/saga_multi_entities.js +40 -103
  163. package/dist/sagas/saga_multiplicity.js +336 -406
  164. package/dist/sagas/saga_ui.js +296 -475
  165. package/dist/setupTests.js +8 -0
  166. package/dist/third_party/jAnalyzer.js +66 -67
  167. package/dist/third_party/peakInterval.js +34 -34
  168. package/package.json +14 -14
  169. package/dist/components/cmd_bar/03_peak_bk.js +0 -139
  170. package/dist/components/cmd_bar/04_integration_bk.js +0 -180
  171. package/dist/components/cmd_bar/05_multiplicity_bk.js +0 -131
  172. package/dist/components/cmd_bar/r01_layout_bk.js +0 -186
  173. package/dist/components/cmd_bar/r06_predict_btn_bk.js +0 -220
  174. package/dist/components/d3_line/line_focus_bk.js +0 -825
  175. package/dist/components/d3_multi/index_bk.js +0 -210
  176. package/dist/components/d3_multi/multi_focus_bk.js +0 -533
  177. package/dist/components/panel/compare_bk.js +0 -256
  178. package/dist/components/panel/cyclic_voltamery_data_bk.js +0 -292
  179. package/dist/components/panel/index_bk.js +0 -178
  180. package/dist/components/panel/info_bk.js +0 -235
  181. package/dist/components/panel/multiplicity_bk.js +0 -280
  182. package/dist/helpers/carbonFeatures_bk.js +0 -45
  183. package/dist/helpers/cfg_bk.js +0 -80
  184. package/dist/helpers/chem_bk.js +0 -787
  185. package/dist/helpers/compass_bk.js +0 -149
  186. package/dist/helpers/converter_bk.js +0 -96
  187. package/dist/helpers/extractPeaksEdit_bk.js +0 -53
  188. package/dist/helpers/format_bk.js +0 -497
  189. package/dist/index_bk.js +0 -640
  190. package/dist/layer_content_bk.js +0 -105
  191. package/dist/layer_init_bk.js +0 -235
  192. package/dist/layer_prism_bk.js +0 -133
  193. package/dist/reducers/reducer_edit_peak_bk.js +0 -108
  194. package/dist/reducers/reducer_integration_bk.js +0 -134
  195. package/dist/reducers/reducer_jcamp_bk.js +0 -71
  196. package/dist/reducers/reducer_multiplicity_bk.js +0 -126
  197. package/dist/reducers/reducer_shift_bk.js +0 -88
  198. package/dist/reducers/reducer_voltammetry_bk.js +0 -287
  199. package/dist/sagas/saga_edit_peak_bk.js +0 -73
  200. package/dist/sagas/saga_multi_entities_bk.js +0 -106
  201. package/dist/sagas/saga_multiplicity_bk.js +0 -351
  202. package/dist/sagas/saga_ui_bk.js +0 -453
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
+ var _jcampconverter = _interopRequireDefault(require("jcampconverter"));
10
9
  var _converter = require("./converter");
11
10
  var _list_layout = require("../constants/list_layout");
12
11
  var _multiplicity_calc = require("./multiplicity_calc");
13
- var _spectraOps;
12
+ /* eslint-disable prefer-destructuring */
14
13
  /* eslint-disable no-mixed-operators, prefer-object-spread,
15
14
  function-paren-newline, no-unused-vars, default-param-last */
16
- var spectraDigit = function spectraDigit(layout) {
15
+
16
+ const spectraDigit = layout => {
17
17
  switch (layout) {
18
18
  case _list_layout.LIST_LAYOUT.IR:
19
19
  case _list_layout.LIST_LAYOUT.RAMAN:
@@ -38,231 +38,285 @@ var spectraDigit = function spectraDigit(layout) {
38
38
  return 2;
39
39
  }
40
40
  };
41
- var fixDigit = function fixDigit(input, precision) {
42
- var output = input || 0.0;
41
+ const fixDigit = (input, precision) => {
42
+ const output = input || 0.0;
43
43
  return output.toFixed(precision);
44
44
  };
45
- var buildData = function buildData(entity) {
45
+ const buildData = entity => {
46
46
  if (!entity) return {
47
47
  isExist: false
48
48
  };
49
- var sp = entity && entity.spectrum;
50
- var xLabel = sp ? "X (".concat(sp.xUnit, ")") : '';
51
- var yLabel = sp ? "Y (".concat(sp.yUnit, ")") : '';
49
+ const sp = entity && entity.spectrum;
50
+ const xLabel = sp ? `X (${sp.xUnit})` : '';
51
+ const yLabel = sp ? `Y (${sp.yUnit})` : '';
52
52
  return {
53
- entity: entity,
54
- xLabel: xLabel,
55
- yLabel: yLabel,
53
+ entity,
54
+ xLabel,
55
+ yLabel,
56
56
  isExist: true
57
57
  };
58
58
  };
59
- var toPeakStr = function toPeakStr(peaks) {
60
- var arr = peaks.map(function (p) {
61
- return "".concat(p.x, ",").concat(p.y);
62
- });
63
- var str = arr.join('#');
59
+ const toPeakStr = peaks => {
60
+ const arr = peaks.map(p => `${p.x},${p.y}`);
61
+ const str = arr.join('#');
64
62
  return str;
65
63
  };
66
- var spectraOps = (_spectraOps = {}, (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.PLAIN, {
67
- head: '',
68
- tail: '.'
69
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.H1, {
70
- head: '1H',
71
- tail: '.'
72
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.C13, {
73
- head: '13C',
74
- tail: '.'
75
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.F19, {
76
- head: '19F',
77
- tail: '.'
78
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.P31, {
79
- head: '31P',
80
- tail: '.'
81
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.N15, {
82
- head: '15N',
83
- tail: '.'
84
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.Si29, {
85
- head: '29Si',
86
- tail: '.'
87
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.IR, {
88
- head: 'IR',
89
- tail: ' cm-1'
90
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.RAMAN, {
91
- head: 'RAMAN',
92
- tail: ' cm-1'
93
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.UVVIS, {
94
- head: 'UV-VIS (absorption, solvent), λmax',
95
- tail: ' nm'
96
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.HPLC_UVVIS, {
97
- head: 'HPLC UV/VIS (transmittance)',
98
- tail: ''
99
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.TGA, {
100
- head: 'THERMOGRAVIMETRIC ANALYSIS',
101
- tail: ' SECONDS'
102
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.MS, {
103
- head: 'MASS',
104
- tail: ' m/z'
105
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.XRD, {
106
- head: 'X-RAY DIFFRACTION',
107
- tail: '.'
108
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, {
109
- head: 'CYCLIC VOLTAMMETRY',
110
- tail: '.'
111
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.CDS, {
112
- head: 'CIRCULAR DICHROISM SPECTROSCOPY',
113
- tail: '.'
114
- }), (0, _defineProperty2.default)(_spectraOps, _list_layout.LIST_LAYOUT.SEC, {
115
- head: 'SIZE EXCLUSION CHROMATOGRAPHY',
116
- tail: '.'
117
- }), _spectraOps);
118
- var rmRef = function rmRef(peaks, shift) {
119
- var atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
120
- if (!shift) return peaks;
121
- var shifts = shift.shifts;
122
- var selectedShift = shifts[atIndex];
123
- var refValue = selectedShift.ref.value || selectedShift.peak.x;
124
- return peaks.map(function (p) {
125
- return (0, _converter.IsSame)(p.x, refValue) ? null : p;
126
- }).filter(function (r) {
127
- return r != null;
128
- });
64
+ const spectraOps = {
65
+ [_list_layout.LIST_LAYOUT.PLAIN]: {
66
+ head: '',
67
+ tail: '.'
68
+ },
69
+ [_list_layout.LIST_LAYOUT.H1]: {
70
+ head: '1H',
71
+ tail: '.'
72
+ },
73
+ [_list_layout.LIST_LAYOUT.C13]: {
74
+ head: '13C',
75
+ tail: '.'
76
+ },
77
+ [_list_layout.LIST_LAYOUT.F19]: {
78
+ head: '19F',
79
+ tail: '.'
80
+ },
81
+ [_list_layout.LIST_LAYOUT.P31]: {
82
+ head: '31P',
83
+ tail: '.'
84
+ },
85
+ [_list_layout.LIST_LAYOUT.N15]: {
86
+ head: '15N',
87
+ tail: '.'
88
+ },
89
+ [_list_layout.LIST_LAYOUT.Si29]: {
90
+ head: '29Si',
91
+ tail: '.'
92
+ },
93
+ [_list_layout.LIST_LAYOUT.IR]: {
94
+ head: 'IR',
95
+ tail: ' cm-1'
96
+ },
97
+ [_list_layout.LIST_LAYOUT.RAMAN]: {
98
+ head: 'RAMAN',
99
+ tail: ' cm-1'
100
+ },
101
+ [_list_layout.LIST_LAYOUT.UVVIS]: {
102
+ head: 'UV-VIS (absorption, solvent), λmax',
103
+ tail: ' nm'
104
+ },
105
+ [_list_layout.LIST_LAYOUT.HPLC_UVVIS]: {
106
+ head: 'HPLC UV/VIS (transmittance)',
107
+ tail: ''
108
+ },
109
+ [_list_layout.LIST_LAYOUT.TGA]: {
110
+ head: 'THERMOGRAVIMETRIC ANALYSIS',
111
+ tail: ' SECONDS'
112
+ },
113
+ [_list_layout.LIST_LAYOUT.MS]: {
114
+ head: 'MASS',
115
+ tail: ' m/z'
116
+ },
117
+ [_list_layout.LIST_LAYOUT.XRD]: {
118
+ head: 'XRD',
119
+ tail: '.'
120
+ },
121
+ [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY]: {
122
+ head: 'CYCLIC VOLTAMMETRY',
123
+ tail: '.'
124
+ },
125
+ [_list_layout.LIST_LAYOUT.CDS]: {
126
+ head: 'CIRCULAR DICHROISM SPECTROSCOPY',
127
+ tail: '.'
128
+ },
129
+ [_list_layout.LIST_LAYOUT.SEC]: {
130
+ head: 'SIZE EXCLUSION CHROMATOGRAPHY',
131
+ tail: '.'
132
+ },
133
+ [_list_layout.LIST_LAYOUT.EMISSIONS]: {
134
+ head: 'EMISSION',
135
+ tail: '.'
136
+ },
137
+ [_list_layout.LIST_LAYOUT.DLS_INTENSITY]: {
138
+ head: 'DLS',
139
+ tail: '.'
140
+ }
129
141
  };
130
- var formatedMS = function formatedMS(peaks, maxY) {
131
- var decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
132
- var isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
133
- var ascendFunc = function ascendFunc(a, b) {
134
- return parseFloat(a) - parseFloat(b);
135
- };
136
- var descendFunc = function descendFunc(a, b) {
137
- return parseFloat(b) - parseFloat(a);
138
- };
139
- var sortFunc = isAscend ? ascendFunc : descendFunc;
140
- var ordered = {};
141
- peaks.forEach(function (p) {
142
- var x = fixDigit(p.x, decimal);
143
- var better = !ordered[x] || p.y > ordered[x];
142
+ const rmRef = function (peaks, shift) {
143
+ let atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
144
+ if (!shift) return peaks;
145
+ const {
146
+ shifts
147
+ } = shift;
148
+ const selectedShift = shifts[atIndex];
149
+ const refValue = selectedShift.ref.value || selectedShift.peak.x;
150
+ return peaks.map(p => (0, _converter.IsSame)(p.x, refValue) ? null : p).filter(r => r != null);
151
+ };
152
+ const formatedMS = function (peaks, maxY) {
153
+ let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
154
+ let isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
155
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
156
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
157
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
158
+ let ordered = {};
159
+ peaks.forEach(p => {
160
+ const x = fixDigit(p.x, decimal);
161
+ const better = !ordered[x] || p.y > ordered[x];
144
162
  if (better) {
145
- ordered = Object.assign({}, ordered, (0, _defineProperty2.default)({}, x, p.y));
163
+ ordered = Object.assign({}, ordered, {
164
+ [x]: p.y
165
+ });
146
166
  }
147
167
  });
148
- ordered = Object.keys(ordered).sort(sortFunc).map(function (k) {
149
- return {
150
- x: k,
151
- y: ordered[k]
152
- };
153
- });
154
- return ordered.map(function (o) {
155
- return "".concat(o.x, " (").concat(parseInt(100 * o.y / maxY, 10), ")");
156
- }).join(', ');
157
- };
158
- var emLevel = function emLevel(boundary, val, lowerIsStronger) {
159
- var maxY = boundary.maxY,
160
- minY = boundary.minY;
161
- var ratio = lowerIsStronger ? 100 * (val - minY) / (maxY - minY) : 100 * (maxY - val) / (maxY - minY);
168
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
169
+ x: k,
170
+ y: ordered[k]
171
+ }));
172
+ return ordered.map(o => `${o.x} (${parseInt(100 * o.y / maxY, 10)})`).join(', ');
173
+ };
174
+ const emLevel = (boundary, val, lowerIsStronger) => {
175
+ const {
176
+ maxY,
177
+ minY
178
+ } = boundary;
179
+ const ratio = lowerIsStronger ? 100 * (val - minY) / (maxY - minY) : 100 * (maxY - val) / (maxY - minY);
162
180
  if (ratio > 85) return 'vw';
163
181
  if (ratio > 60) return 'w';
164
182
  if (ratio > 45) return 'm';
165
183
  if (ratio > 30) return 's';
166
184
  return 'vs';
167
185
  };
168
- var formatedEm = function formatedEm(peaks, maxY) {
169
- var decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
170
- var isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
171
- var isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
172
- var boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
173
- var lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
174
- var ascendFunc = function ascendFunc(a, b) {
175
- return parseFloat(a) - parseFloat(b);
176
- };
177
- var descendFunc = function descendFunc(a, b) {
178
- return parseFloat(b) - parseFloat(a);
179
- };
180
- var sortFunc = isAscend ? ascendFunc : descendFunc;
181
- var ordered = {};
182
- peaks.forEach(function (p) {
183
- var x = fixDigit(p.x, decimal);
184
- var better = !ordered[x] || p.y > ordered[x];
186
+ const formatedEm = function (peaks, maxY) {
187
+ let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
188
+ let isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
189
+ let isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
190
+ let boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
191
+ let lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
192
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
193
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
194
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
195
+ let ordered = {};
196
+ peaks.forEach(p => {
197
+ const x = fixDigit(p.x, decimal);
198
+ const better = !ordered[x] || p.y > ordered[x];
185
199
  if (better) {
186
- ordered = Object.assign({}, ordered, (0, _defineProperty2.default)({}, x, p.y));
200
+ ordered = Object.assign({}, ordered, {
201
+ [x]: p.y
202
+ });
187
203
  }
188
204
  });
189
- ordered = Object.keys(ordered).sort(sortFunc).map(function (k) {
190
- return {
191
- x: k,
192
- y: ordered[k]
193
- };
194
- });
205
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
206
+ x: k,
207
+ y: ordered[k]
208
+ }));
195
209
  if (isIntensity) {
196
- return ordered.map(function (o) {
197
- return "".concat(o.x, " (").concat(emLevel(boundary, o.y, lowerIsStronger), ")");
198
- }).join(', ');
210
+ return ordered.map(o => `${o.x} (${emLevel(boundary, o.y, lowerIsStronger)})`).join(', ');
199
211
  }
200
- return ordered.map(function (o) {
201
- return "".concat(o.x);
202
- }).join(', ');
203
- };
204
- var formatedUvVis = function formatedUvVis(peaks, maxY) {
205
- var decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
206
- var isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
207
- var isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
208
- var boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
209
- var lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
210
- var ascendFunc = function ascendFunc(a, b) {
211
- return parseFloat(a) - parseFloat(b);
212
- };
213
- var descendFunc = function descendFunc(a, b) {
214
- return parseFloat(b) - parseFloat(a);
215
- };
216
- var sortFunc = isAscend ? ascendFunc : descendFunc;
217
- var ordered = {};
218
- peaks.forEach(function (p) {
219
- var x = fixDigit(p.x, decimal);
220
- var better = !ordered[x] || p.y > ordered[x];
212
+ return ordered.map(o => `${o.x}`).join(', ');
213
+ };
214
+ const formatedUvVis = function (peaks, maxY) {
215
+ let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
216
+ let isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
217
+ let isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
218
+ let boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
219
+ let lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
220
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
221
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
222
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
223
+ let ordered = {};
224
+ peaks.forEach(p => {
225
+ const x = fixDigit(p.x, decimal);
226
+ const better = !ordered[x] || p.y > ordered[x];
221
227
  if (better) {
222
- ordered = Object.assign({}, ordered, (0, _defineProperty2.default)({}, x, p.y));
228
+ ordered = Object.assign({}, ordered, {
229
+ [x]: p.y
230
+ });
223
231
  }
224
232
  });
225
- ordered = Object.keys(ordered).sort(sortFunc).map(function (k) {
226
- return {
227
- x: k,
228
- y: ordered[k]
229
- };
230
- });
233
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
234
+ x: k,
235
+ y: ordered[k]
236
+ }));
231
237
 
232
238
  // return ordered.map(o => `${o.x} (${o.y.toFixed(2)})`)
233
239
  // .join(', ');
234
- return ordered.map(function (o) {
235
- return "".concat(o.x);
236
- }).join(', ');
237
- };
238
- var formatedHplcUvVis = function formatedHplcUvVis(peaks) {
239
- var decimal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
240
- var integration = arguments.length > 2 ? arguments[2] : undefined;
241
- var stack = [];
240
+ return ordered.map(o => `${o.x}`).join(', ');
241
+ };
242
+ const formatedEmissions = function (peaks, maxY) {
243
+ let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
244
+ let isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
245
+ let isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
246
+ let boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
247
+ let lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
248
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
249
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
250
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
251
+ let ordered = {};
252
+ peaks.forEach(p => {
253
+ const x = fixDigit(p.x, decimal);
254
+ const better = !ordered[x] || p.y > ordered[x];
255
+ if (better) {
256
+ ordered = Object.assign({}, ordered, {
257
+ [x]: p.y
258
+ });
259
+ }
260
+ });
261
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
262
+ x: k,
263
+ y: ordered[k]
264
+ }));
265
+ return ordered.map(o => `${o.x} nm (${fixDigit(o.y, 2)} a.u.)`).join(', ');
266
+ };
267
+ const formatedDLSIntensity = function (peaks, maxY) {
268
+ let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
269
+ let isAscend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
270
+ let isIntensity = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
271
+ let boundary = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
272
+ let lowerIsStronger = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
273
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
274
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
275
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
276
+ let ordered = {};
277
+ peaks.forEach(p => {
278
+ const x = fixDigit(p.x, decimal);
279
+ const better = !ordered[x] || p.y > ordered[x];
280
+ if (better) {
281
+ ordered = Object.assign({}, ordered, {
282
+ [x]: fixDigit(p.y, 2)
283
+ });
284
+ }
285
+ });
286
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
287
+ x: k,
288
+ y: ordered[k]
289
+ }));
290
+ return ordered.map(o => `${o.x} nm (${o.y} %)`).join(', ');
291
+ };
292
+ const formatedHplcUvVis = function (peaks) {
293
+ let decimal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
294
+ let integration = arguments.length > 2 ? arguments[2] : undefined;
295
+ let stack = [];
242
296
  if (integration) {
243
297
  stack = integration.stack;
244
298
  }
245
- var ordered = {};
246
- peaks.forEach(function (p) {
247
- var x = fixDigit(p.x, decimal);
248
- var better = !ordered[x] || p.y > ordered[x];
299
+ let ordered = {};
300
+ peaks.forEach(p => {
301
+ const x = fixDigit(p.x, decimal);
302
+ const better = !ordered[x] || p.y > ordered[x];
249
303
  if (better) {
250
- ordered = Object.assign({}, ordered, (0, _defineProperty2.default)({}, x, p.y));
304
+ ordered = Object.assign({}, ordered, {
305
+ [x]: p.y
306
+ });
251
307
  }
252
308
  });
253
- ordered = Object.keys(ordered).map(function (k) {
254
- return {
255
- x: k,
256
- y: ordered[k]
257
- };
258
- });
259
- var arrResult = [];
260
- ordered.forEach(function (o) {
261
- var pStr = "".concat(o.x, " (").concat(o.y.toFixed(2), ")");
309
+ ordered = Object.keys(ordered).map(k => ({
310
+ x: k,
311
+ y: ordered[k]
312
+ }));
313
+ const arrResult = [];
314
+ ordered.forEach(o => {
315
+ let pStr = `${o.x} (${o.y.toFixed(2)})`;
262
316
  if (stack) {
263
- stack.forEach(function (s) {
317
+ stack.forEach(s => {
264
318
  if (s.xL <= o.x && s.xU >= o.x) {
265
- pStr = "".concat(o.x, " (").concat(o.y.toFixed(2), ", AUC=").concat(s.absoluteArea, ")");
319
+ pStr = `${o.x} (${o.y.toFixed(2)}, AUC=${s.absoluteArea})`;
266
320
  }
267
321
  });
268
322
  }
@@ -270,55 +324,75 @@ var formatedHplcUvVis = function formatedHplcUvVis(peaks) {
270
324
  });
271
325
  return arrResult.join(', ');
272
326
  };
273
- var rmShiftFromPeaks = function rmShiftFromPeaks(peaks, shift) {
274
- var atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
275
- var peaksXY = (0, _converter.ToXY)(peaks);
276
- var shifts = shift.shifts;
277
- var selectedShift = shifts[atIndex];
327
+ const formatedXRD = function (peaks) {
328
+ let isAscend = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
329
+ let waveLength = arguments.length > 2 ? arguments[2] : undefined;
330
+ let temperature = arguments.length > 3 ? arguments[3] : undefined;
331
+ const ascendFunc = (a, b) => parseFloat(a) - parseFloat(b);
332
+ const descendFunc = (a, b) => parseFloat(b) - parseFloat(a);
333
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
334
+ let ordered = {};
335
+ peaks.forEach(p => {
336
+ const x = fixDigit(p.x, 1);
337
+ const better = !ordered[x] || p.y > ordered[x];
338
+ if (better) {
339
+ ordered = Object.assign({}, ordered, {
340
+ [x]: p.y
341
+ });
342
+ }
343
+ });
344
+ const XRDSource = waveLength.label;
345
+ const XRDWavelength = `${waveLength.value} ${waveLength.unit}`;
346
+ ordered = Object.keys(ordered).sort(sortFunc).map(k => ({
347
+ x: k,
348
+ y: ordered[k]
349
+ }));
350
+ return `(${XRDSource}, ${XRDWavelength}, ${temperature} °C), 2θ [°] (d [nm]): ${ordered.map(o => `${o.x} (${fixDigit(o.y, 2)})`).join(', ')}`;
351
+ };
352
+ const rmShiftFromPeaks = function (peaks, shift) {
353
+ let atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
354
+ const peaksXY = (0, _converter.ToXY)(peaks);
355
+ const {
356
+ shifts
357
+ } = shift;
358
+ const selectedShift = shifts[atIndex];
278
359
  if (!selectedShift) {
279
360
  return peaks;
280
361
  }
281
362
  // const digit = spectraDigit(layout);
282
- var rmShiftX = selectedShift.ref.value || selectedShift.peak.x;
283
- var result = peaksXY.map(function (p) {
284
- var srcX = parseFloat(p[0]);
285
- var x = (0, _converter.IsSame)(srcX, rmShiftX) ? null : srcX;
363
+ const rmShiftX = selectedShift.ref.value || selectedShift.peak.x;
364
+ const result = peaksXY.map(p => {
365
+ const srcX = parseFloat(p[0]);
366
+ const x = (0, _converter.IsSame)(srcX, rmShiftX) ? null : srcX;
286
367
  if (!x) return null;
287
- var y = parseFloat(p[1]);
368
+ const y = parseFloat(p[1]);
288
369
  return {
289
- x: x,
290
- y: y
370
+ x,
371
+ y
291
372
  };
292
- }).filter(function (r) {
293
- return r != null;
294
- });
373
+ }).filter(r => r != null);
295
374
  return result;
296
375
  };
297
- var peaksBody = function peaksBody(_ref) {
298
- var peaks = _ref.peaks,
299
- layout = _ref.layout,
300
- decimal = _ref.decimal,
301
- shift = _ref.shift,
302
- isAscend = _ref.isAscend,
303
- _ref$isIntensity = _ref.isIntensity,
304
- isIntensity = _ref$isIntensity === void 0 ? false : _ref$isIntensity,
305
- _ref$boundary = _ref.boundary,
306
- boundary = _ref$boundary === void 0 ? {} : _ref$boundary,
307
- integration = _ref.integration,
308
- _ref$atIndex = _ref.atIndex,
309
- atIndex = _ref$atIndex === void 0 ? 0 : _ref$atIndex;
310
- var result = rmShiftFromPeaks(peaks, shift, atIndex);
311
- var ascendFunc = function ascendFunc(a, b) {
312
- return parseFloat(a.x) - parseFloat(b.x);
313
- };
314
- var descendFunc = function descendFunc(a, b) {
315
- return parseFloat(b.x) - parseFloat(a.x);
316
- };
317
- var sortFunc = isAscend ? ascendFunc : descendFunc;
318
- var ordered = result.sort(sortFunc);
319
- var maxY = Math.max.apply(Math, (0, _toConsumableArray2.default)(ordered.map(function (o) {
320
- return o.y;
321
- })));
376
+ const peaksBody = _ref => {
377
+ let {
378
+ peaks,
379
+ layout,
380
+ decimal,
381
+ shift,
382
+ isAscend,
383
+ isIntensity = false,
384
+ boundary = {},
385
+ integration,
386
+ atIndex = 0,
387
+ waveLength,
388
+ temperature
389
+ } = _ref;
390
+ const result = rmShiftFromPeaks(peaks, shift, atIndex);
391
+ const ascendFunc = (a, b) => parseFloat(a.x) - parseFloat(b.x);
392
+ const descendFunc = (a, b) => parseFloat(b.x) - parseFloat(a.x);
393
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
394
+ const ordered = result.sort(sortFunc);
395
+ const maxY = Math.max(...ordered.map(o => o.y));
322
396
  if (layout === _list_layout.LIST_LAYOUT.MS) {
323
397
  return formatedMS(ordered, maxY, decimal, isAscend);
324
398
  }
@@ -331,88 +405,66 @@ var peaksBody = function peaksBody(_ref) {
331
405
  if (layout === _list_layout.LIST_LAYOUT.HPLC_UVVIS) {
332
406
  return formatedHplcUvVis(ordered, decimal, integration);
333
407
  }
334
- if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.XRD || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC) {
408
+ if (layout === _list_layout.LIST_LAYOUT.EMISSIONS) {
409
+ return formatedEmissions(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
410
+ }
411
+ if (layout === _list_layout.LIST_LAYOUT.DLS_INTENSITY) {
412
+ return formatedDLSIntensity(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
413
+ }
414
+ if (layout === _list_layout.LIST_LAYOUT.RAMAN || layout === _list_layout.LIST_LAYOUT.TGA || layout === _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY || layout === _list_layout.LIST_LAYOUT.CDS || layout === _list_layout.LIST_LAYOUT.SEC) {
335
415
  return formatedEm(ordered, maxY, decimal, isAscend, isIntensity, boundary, false);
336
416
  }
337
- return ordered.map(function (o) {
338
- return fixDigit(o.x, decimal);
339
- }).join(', ');
340
- };
341
- var peaksWrapper = function peaksWrapper(layout, shift) {
342
- var atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
343
- var solvTxt = '';
344
- var shifts = shift.shifts;
345
- var selectedShift = shifts[atIndex];
417
+ if (layout === _list_layout.LIST_LAYOUT.XRD) {
418
+ return formatedXRD(ordered, isAscend, waveLength, temperature);
419
+ }
420
+ return ordered.map(o => fixDigit(o.x, decimal)).join(', ');
421
+ };
422
+ const peaksWrapper = function (layout, shift) {
423
+ let atIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
424
+ let solvTxt = '';
425
+ const {
426
+ shifts
427
+ } = shift;
428
+ const selectedShift = shifts[atIndex];
346
429
  if (selectedShift.ref.label) {
347
- solvTxt = " (".concat(selectedShift.ref.label, ")");
430
+ solvTxt = ` (${selectedShift.ref.label})`;
348
431
  }
349
- if (layout === _list_layout.LIST_LAYOUT.PLAIN) {
432
+ if (layout === _list_layout.LIST_LAYOUT.PLAIN || layout === _list_layout.LIST_LAYOUT.DLS_ACF) {
350
433
  return {
351
434
  head: '',
352
435
  tail: ''
353
436
  };
354
437
  }
355
- var ops = spectraOps[layout];
438
+ const ops = spectraOps[layout];
356
439
  return {
357
- head: "".concat(ops.head).concat(solvTxt, " = "),
440
+ head: `${ops.head}${solvTxt} = `,
358
441
  tail: ops.tail
359
442
  };
360
443
  };
361
- var isNmrLayout = function isNmrLayout(layoutSt) {
362
- return [_list_layout.LIST_LAYOUT.H1, _list_layout.LIST_LAYOUT.C13, _list_layout.LIST_LAYOUT.F19, _list_layout.LIST_LAYOUT.P31, _list_layout.LIST_LAYOUT.N15, _list_layout.LIST_LAYOUT.Si29].indexOf(layoutSt) >= 0;
363
- };
364
- var is29SiLayout = function is29SiLayout(layoutSt) {
365
- return _list_layout.LIST_LAYOUT.Si29 === layoutSt;
366
- };
367
- var is15NLayout = function is15NLayout(layoutSt) {
368
- return _list_layout.LIST_LAYOUT.N15 === layoutSt;
369
- };
370
- var is31PLayout = function is31PLayout(layoutSt) {
371
- return _list_layout.LIST_LAYOUT.P31 === layoutSt;
372
- };
373
- var is19FLayout = function is19FLayout(layoutSt) {
374
- return _list_layout.LIST_LAYOUT.F19 === layoutSt;
375
- };
376
- var is13CLayout = function is13CLayout(layoutSt) {
377
- return _list_layout.LIST_LAYOUT.C13 === layoutSt;
378
- };
379
- var is1HLayout = function is1HLayout(layoutSt) {
380
- return _list_layout.LIST_LAYOUT.H1 === layoutSt;
381
- };
382
- var isMsLayout = function isMsLayout(layoutSt) {
383
- return _list_layout.LIST_LAYOUT.MS === layoutSt;
384
- };
385
- var isIrLayout = function isIrLayout(layoutSt) {
386
- return [_list_layout.LIST_LAYOUT.IR, 'INFRARED'].indexOf(layoutSt) >= 0;
387
- };
388
- var isRamanLayout = function isRamanLayout(layoutSt) {
389
- return _list_layout.LIST_LAYOUT.RAMAN === layoutSt;
390
- };
391
- var isUvVisLayout = function isUvVisLayout(layoutSt) {
392
- return _list_layout.LIST_LAYOUT.UVVIS === layoutSt;
393
- };
394
- var isHplcUvVisLayout = function isHplcUvVisLayout(layoutSt) {
395
- return _list_layout.LIST_LAYOUT.HPLC_UVVIS === layoutSt;
396
- };
397
- var isTGALayout = function isTGALayout(layoutSt) {
398
- return _list_layout.LIST_LAYOUT.TGA === layoutSt;
399
- };
400
- var isXRDLayout = function isXRDLayout(layoutSt) {
401
- return _list_layout.LIST_LAYOUT.XRD === layoutSt;
402
- };
403
- var isCyclicVoltaLayout = function isCyclicVoltaLayout(layoutSt) {
404
- return _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt;
405
- };
406
- var isCDSLayout = function isCDSLayout(layoutSt) {
407
- return _list_layout.LIST_LAYOUT.CDS === layoutSt;
408
- };
409
- var isSECLayout = function isSECLayout(layoutSt) {
410
- return _list_layout.LIST_LAYOUT.SEC === layoutSt;
411
- };
412
- var isEmWaveLayout = function isEmWaveLayout(layoutSt) {
413
- return [_list_layout.LIST_LAYOUT.IR, _list_layout.LIST_LAYOUT.RAMAN, _list_layout.LIST_LAYOUT.UVVIS, _list_layout.LIST_LAYOUT.HPLC_UVVIS].indexOf(layoutSt) >= 0;
414
- };
415
- var getNmrTyp = function getNmrTyp(layout) {
444
+ const isNmrLayout = layoutSt => [_list_layout.LIST_LAYOUT.H1, _list_layout.LIST_LAYOUT.C13, _list_layout.LIST_LAYOUT.F19, _list_layout.LIST_LAYOUT.P31, _list_layout.LIST_LAYOUT.N15, _list_layout.LIST_LAYOUT.Si29].indexOf(layoutSt) >= 0;
445
+ const is29SiLayout = layoutSt => _list_layout.LIST_LAYOUT.Si29 === layoutSt;
446
+ const is15NLayout = layoutSt => _list_layout.LIST_LAYOUT.N15 === layoutSt;
447
+ const is31PLayout = layoutSt => _list_layout.LIST_LAYOUT.P31 === layoutSt;
448
+ const is19FLayout = layoutSt => _list_layout.LIST_LAYOUT.F19 === layoutSt;
449
+ const is13CLayout = layoutSt => _list_layout.LIST_LAYOUT.C13 === layoutSt;
450
+ const is1HLayout = layoutSt => _list_layout.LIST_LAYOUT.H1 === layoutSt;
451
+ const isMsLayout = layoutSt => _list_layout.LIST_LAYOUT.MS === layoutSt;
452
+ const isIrLayout = layoutSt => [_list_layout.LIST_LAYOUT.IR, 'INFRARED'].indexOf(layoutSt) >= 0;
453
+ const isRamanLayout = layoutSt => _list_layout.LIST_LAYOUT.RAMAN === layoutSt;
454
+ const isUvVisLayout = layoutSt => _list_layout.LIST_LAYOUT.UVVIS === layoutSt;
455
+ const isHplcUvVisLayout = layoutSt => _list_layout.LIST_LAYOUT.HPLC_UVVIS === layoutSt;
456
+ const isTGALayout = layoutSt => _list_layout.LIST_LAYOUT.TGA === layoutSt;
457
+ const isXRDLayout = layoutSt => _list_layout.LIST_LAYOUT.XRD === layoutSt;
458
+ const isCyclicVoltaLayout = layoutSt => _list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY === layoutSt;
459
+ const isCDSLayout = layoutSt => _list_layout.LIST_LAYOUT.CDS === layoutSt;
460
+ const isSECLayout = layoutSt => _list_layout.LIST_LAYOUT.SEC === layoutSt;
461
+ 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;
462
+ const hasMultiCurves = layoutSt => [_list_layout.LIST_LAYOUT.CYCLIC_VOLTAMMETRY, _list_layout.LIST_LAYOUT.SEC, _list_layout.LIST_LAYOUT.AIF].indexOf(layoutSt) >= 0;
463
+ const isAIFLayout = layoutSt => _list_layout.LIST_LAYOUT.AIF === layoutSt;
464
+ const isEmissionsLayout = layoutSt => _list_layout.LIST_LAYOUT.EMISSIONS === layoutSt;
465
+ const isDLSACFLayout = layoutSt => _list_layout.LIST_LAYOUT.DLS_ACF === layoutSt;
466
+ const isDLSIntensityLayout = layoutSt => _list_layout.LIST_LAYOUT.DLS_INTENSITY === layoutSt;
467
+ const getNmrTyp = layout => {
416
468
  switch (layout) {
417
469
  case _list_layout.LIST_LAYOUT.H1:
418
470
  return 'H';
@@ -430,81 +482,84 @@ var getNmrTyp = function getNmrTyp(layout) {
430
482
  return '';
431
483
  }
432
484
  };
433
- var formatPeaksByPrediction = function formatPeaksByPrediction(peaks, layout, isAscend, decimal) {
434
- var predictions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
435
- var pDict = {};
436
- peaks.forEach(function (p) {
485
+ const formatPeaksByPrediction = function (peaks, layout, isAscend, decimal) {
486
+ let predictions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
487
+ const pDict = {};
488
+ peaks.forEach(p => {
437
489
  pDict[p.x.toFixed(decimal)] = 0;
438
490
  });
439
- predictions.forEach(function (p) {
440
- var key = p.real.toFixed(decimal);
491
+ predictions.forEach(p => {
492
+ const key = p.real.toFixed(decimal);
441
493
  if (typeof pDict[key] === 'number') {
442
494
  pDict[key] += 1;
443
495
  }
444
496
  });
445
- var typ = getNmrTyp(layout);
446
- var ascendFunc = function ascendFunc(a, b) {
447
- return parseFloat(a.k) - parseFloat(b.k);
448
- };
449
- var descendFunc = function descendFunc(a, b) {
450
- return parseFloat(b.k) - parseFloat(a.k);
451
- };
452
- var sortFunc = isAscend ? ascendFunc : descendFunc;
453
- var pArr = Object.keys(pDict).map(function (k) {
497
+ const typ = getNmrTyp(layout);
498
+ const ascendFunc = (a, b) => parseFloat(a.k) - parseFloat(b.k);
499
+ const descendFunc = (a, b) => parseFloat(b.k) - parseFloat(a.k);
500
+ const sortFunc = isAscend ? ascendFunc : descendFunc;
501
+ const pArr = Object.keys(pDict).map(k => {
454
502
  if (pDict[k] === 1) return {
455
- k: k,
503
+ k,
456
504
  v: k
457
505
  };
458
506
  return {
459
- k: k,
460
- v: "".concat(k, " (").concat(pDict[k]).concat(typ, ")")
507
+ k,
508
+ v: `${k} (${pDict[k]}${typ})`
461
509
  };
462
510
  }).sort(sortFunc);
463
- var body = pArr.map(function (p) {
464
- return p.v;
465
- }).join(', ');
511
+ const body = pArr.map(p => p.v).join(', ');
466
512
  return body;
467
513
  };
468
- var compareColors = function compareColors(idx) {
469
- return ['#ABB2B9', '#EDBB99', '#ABEBC6', '#D2B4DE', '#F9E79F'][idx % 5];
470
- };
471
- var mutiEntitiesColors = function mutiEntitiesColors(idx) {
472
- return ['#fa8231', '#f7b731', '#0fb9b1', '#2d98da', '#3867d6', '#8854d0', '#4b6584'][idx % 7];
473
- };
474
- var Format = {
475
- toPeakStr: toPeakStr,
476
- buildData: buildData,
477
- spectraDigit: spectraDigit,
478
- spectraOps: spectraOps,
479
- peaksBody: peaksBody,
480
- peaksWrapper: peaksWrapper,
481
- rmRef: rmRef,
482
- rmShiftFromPeaks: rmShiftFromPeaks,
483
- isNmrLayout: isNmrLayout,
484
- is13CLayout: is13CLayout,
485
- is1HLayout: is1HLayout,
486
- is19FLayout: is19FLayout,
487
- is31PLayout: is31PLayout,
488
- is15NLayout: is15NLayout,
489
- is29SiLayout: is29SiLayout,
490
- isMsLayout: isMsLayout,
491
- isIrLayout: isIrLayout,
492
- isRamanLayout: isRamanLayout,
493
- isUvVisLayout: isUvVisLayout,
494
- isHplcUvVisLayout: isHplcUvVisLayout,
495
- isTGALayout: isTGALayout,
496
- isXRDLayout: isXRDLayout,
497
- isCyclicVoltaLayout: isCyclicVoltaLayout,
498
- isCDSLayout: isCDSLayout,
499
- isSECLayout: isSECLayout,
500
- isEmWaveLayout: isEmWaveLayout,
501
- fixDigit: fixDigit,
502
- formatPeaksByPrediction: formatPeaksByPrediction,
503
- formatedMS: formatedMS,
504
- formatedEm: formatedEm,
514
+ const compareColors = idx => ['#ABB2B9', '#EDBB99', '#ABEBC6', '#D2B4DE', '#F9E79F'][idx % 5];
515
+ const mutiEntitiesColors = idx => ['#fa8231', '#f7b731', '#0fb9b1', '#2d98da', '#3867d6', '#8854d0', '#4b6584'][idx % 7];
516
+ const strNumberFixedDecimal = function (number) {
517
+ let decimal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
518
+ if (decimal <= 0) {
519
+ return `${number}`;
520
+ }
521
+ return number.toFixed(Math.max(decimal, (number.toString().split('.')[1] || []).length));
522
+ };
523
+ const Format = {
524
+ toPeakStr,
525
+ buildData,
526
+ spectraDigit,
527
+ spectraOps,
528
+ peaksBody,
529
+ peaksWrapper,
530
+ rmRef,
531
+ rmShiftFromPeaks,
532
+ isNmrLayout,
533
+ is13CLayout,
534
+ is1HLayout,
535
+ is19FLayout,
536
+ is31PLayout,
537
+ is15NLayout,
538
+ is29SiLayout,
539
+ isMsLayout,
540
+ isIrLayout,
541
+ isRamanLayout,
542
+ isUvVisLayout,
543
+ isHplcUvVisLayout,
544
+ isTGALayout,
545
+ isXRDLayout,
546
+ isCyclicVoltaLayout,
547
+ isCDSLayout,
548
+ isSECLayout,
549
+ isEmissionsLayout,
550
+ isDLSIntensityLayout,
551
+ isEmWaveLayout,
552
+ fixDigit,
553
+ formatPeaksByPrediction,
554
+ formatedMS,
555
+ formatedEm,
505
556
  calcMpyCenter: _multiplicity_calc.calcMpyCenter,
506
- compareColors: compareColors,
507
- mutiEntitiesColors: mutiEntitiesColors
508
- };
509
- var _default = Format;
510
- exports.default = _default;
557
+ compareColors,
558
+ mutiEntitiesColors,
559
+ hasMultiCurves,
560
+ isAIFLayout,
561
+ isDLSACFLayout,
562
+ strNumberFixedDecimal,
563
+ formatedXRD
564
+ };
565
+ var _default = exports.default = Format;