@complat/react-spectra-editor 0.10.13-alpha.5

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 (109) hide show
  1. package/LICENSE +662 -0
  2. package/README.md +37 -0
  3. package/dist/actions/edit_peak.js +25 -0
  4. package/dist/actions/forecast.js +41 -0
  5. package/dist/actions/integration.js +33 -0
  6. package/dist/actions/jcamp.js +41 -0
  7. package/dist/actions/layout.js +17 -0
  8. package/dist/actions/manager.js +49 -0
  9. package/dist/actions/meta.js +17 -0
  10. package/dist/actions/multiplicity.js +57 -0
  11. package/dist/actions/scan.js +33 -0
  12. package/dist/actions/shift.js +25 -0
  13. package/dist/actions/status.js +33 -0
  14. package/dist/actions/submit.js +41 -0
  15. package/dist/actions/threshold.js +33 -0
  16. package/dist/actions/ui.js +50 -0
  17. package/dist/app.js +125 -0
  18. package/dist/components/cmd_bar/01_viewer.js +133 -0
  19. package/dist/components/cmd_bar/02_zoom.js +119 -0
  20. package/dist/components/cmd_bar/03_peak.js +176 -0
  21. package/dist/components/cmd_bar/04_integration.js +273 -0
  22. package/dist/components/cmd_bar/05_multiplicity.js +228 -0
  23. package/dist/components/cmd_bar/06_undo_redo.js +137 -0
  24. package/dist/components/cmd_bar/common.js +104 -0
  25. package/dist/components/cmd_bar/index.js +113 -0
  26. package/dist/components/cmd_bar/r01_layout.js +351 -0
  27. package/dist/components/cmd_bar/r02_scan.js +226 -0
  28. package/dist/components/cmd_bar/r03_threshold.js +209 -0
  29. package/dist/components/cmd_bar/r04_submit.js +349 -0
  30. package/dist/components/cmd_bar/r05_submit_btn.js +147 -0
  31. package/dist/components/cmd_bar/r06_predict_btn.js +307 -0
  32. package/dist/components/cmd_bar/tri_btn.js +202 -0
  33. package/dist/components/common/chem.js +115 -0
  34. package/dist/components/common/comps.js +29 -0
  35. package/dist/components/common/draw.js +41 -0
  36. package/dist/components/d3_line/index.js +236 -0
  37. package/dist/components/d3_line/line_focus.js +765 -0
  38. package/dist/components/d3_rect/index.js +200 -0
  39. package/dist/components/d3_rect/rect_focus.js +301 -0
  40. package/dist/components/forecast/comps.js +337 -0
  41. package/dist/components/forecast/ir_comps.js +224 -0
  42. package/dist/components/forecast/ir_viewer.js +172 -0
  43. package/dist/components/forecast/nmr_comps.js +253 -0
  44. package/dist/components/forecast/nmr_viewer.js +170 -0
  45. package/dist/components/forecast/section_loading.js +95 -0
  46. package/dist/components/forecast_viewer.js +190 -0
  47. package/dist/components/panel/compare.js +370 -0
  48. package/dist/components/panel/index.js +191 -0
  49. package/dist/components/panel/info.js +335 -0
  50. package/dist/components/panel/multiplicity.js +405 -0
  51. package/dist/components/panel/multiplicity_coupling.js +195 -0
  52. package/dist/components/panel/multiplicity_select.js +114 -0
  53. package/dist/components/panel/peaks.js +296 -0
  54. package/dist/constants/action_type.js +140 -0
  55. package/dist/constants/list_layout.js +23 -0
  56. package/dist/constants/list_shift.js +480 -0
  57. package/dist/constants/list_ui.js +33 -0
  58. package/dist/fn.js +31 -0
  59. package/dist/helpers/brush.js +109 -0
  60. package/dist/helpers/calc.js +10 -0
  61. package/dist/helpers/carbonFeatures.js +47 -0
  62. package/dist/helpers/cfg.js +89 -0
  63. package/dist/helpers/chem.js +594 -0
  64. package/dist/helpers/compass.js +91 -0
  65. package/dist/helpers/converter.js +74 -0
  66. package/dist/helpers/extractParams.js +77 -0
  67. package/dist/helpers/extractPeaksEdit.js +69 -0
  68. package/dist/helpers/focus.js +15 -0
  69. package/dist/helpers/format.js +403 -0
  70. package/dist/helpers/init.js +80 -0
  71. package/dist/helpers/integration.js +30 -0
  72. package/dist/helpers/mount.js +112 -0
  73. package/dist/helpers/multiplicity.js +44 -0
  74. package/dist/helpers/multiplicity_calc.js +117 -0
  75. package/dist/helpers/multiplicity_complat.js +126 -0
  76. package/dist/helpers/multiplicity_manual.js +94 -0
  77. package/dist/helpers/multiplicity_verify_basic.js +196 -0
  78. package/dist/helpers/shift.js +48 -0
  79. package/dist/helpers/zoom.js +32 -0
  80. package/dist/index.js +705 -0
  81. package/dist/layer_content.js +125 -0
  82. package/dist/layer_init.js +231 -0
  83. package/dist/layer_prism.js +186 -0
  84. package/dist/reducers/index.js +89 -0
  85. package/dist/reducers/reducer_edit_peak.js +111 -0
  86. package/dist/reducers/reducer_forecast.js +113 -0
  87. package/dist/reducers/reducer_integration.js +136 -0
  88. package/dist/reducers/reducer_jcamp.js +74 -0
  89. package/dist/reducers/reducer_layout.js +27 -0
  90. package/dist/reducers/reducer_manager.js +20 -0
  91. package/dist/reducers/reducer_meta.js +30 -0
  92. package/dist/reducers/reducer_multiplicity.js +131 -0
  93. package/dist/reducers/reducer_scan.js +55 -0
  94. package/dist/reducers/reducer_shift.js +99 -0
  95. package/dist/reducers/reducer_simulation.js +30 -0
  96. package/dist/reducers/reducer_status.js +41 -0
  97. package/dist/reducers/reducer_submit.js +54 -0
  98. package/dist/reducers/reducer_threshold.js +34 -0
  99. package/dist/reducers/reducer_ui.js +46 -0
  100. package/dist/reducers/undo_redo_config.js +24 -0
  101. package/dist/sagas/index.js +50 -0
  102. package/dist/sagas/saga_edit_peak.js +84 -0
  103. package/dist/sagas/saga_manager.js +116 -0
  104. package/dist/sagas/saga_meta.js +46 -0
  105. package/dist/sagas/saga_multiplicity.js +387 -0
  106. package/dist/sagas/saga_ui.js +392 -0
  107. package/dist/third_party/jAnalyzer.js +596 -0
  108. package/dist/third_party/peakInterval.js +107 -0
  109. package/package.json +77 -0
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var _list_shift = require('../constants/list_shift');
10
+
11
+ var _shift = require('../helpers/shift');
12
+
13
+ var shiftNone = _list_shift.LIST_SHIFT_1H[0];
14
+
15
+ var initialState = {
16
+ ref: shiftNone,
17
+ peak: false,
18
+ enable: true
19
+ };
20
+
21
+ var resetRef = function resetRef(payload) {
22
+ var shift = payload.shift,
23
+ layout = payload.layout;
24
+
25
+ if (!shift || !shift.solventName || !shift.solventValue) return shiftNone;
26
+
27
+ var name = shift.solventName;
28
+ var target = false;
29
+ var listShift = (0, _list_shift.getListShift)(layout);
30
+ listShift.forEach(function (l) {
31
+ if (l.name === name) {
32
+ target = l;
33
+ }
34
+ });
35
+ return target || shiftNone[0];
36
+ };
37
+
38
+ var resetEnable = function resetEnable(payload) {
39
+ var typ = payload.operation.typ;
40
+
41
+ switch (typ) {
42
+ case 'NMR':
43
+ return true;
44
+ default:
45
+ return false;
46
+ }
47
+ };
48
+
49
+ var shiftReducer = function shiftReducer() {
50
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
51
+ var action = arguments[1];
52
+
53
+ switch (action.type) {
54
+ case _action_type.SHIFT.SET_REF:
55
+ return Object.assign({}, state, {
56
+ ref: action.payload,
57
+ enable: true
58
+ });
59
+ case _action_type.SHIFT.SET_PEAK:
60
+ {
61
+ var resX = (0, _shift.CalcResidualX)(state.ref, state.peak, action.payload);
62
+ var trueApex = (0, _shift.RealPts)([action.payload], resX)[0];
63
+ var isSamePt = state.peak.x === trueApex.x;
64
+ var truePeak = trueApex && trueApex.x && !isSamePt ? trueApex : false;
65
+ return Object.assign({}, state, {
66
+ peak: truePeak,
67
+ enable: true
68
+ });
69
+ }
70
+ case _action_type.SHIFT.RM_PEAK:
71
+ return Object.assign({}, state, {
72
+ peak: false,
73
+ enable: true
74
+ });
75
+ case _action_type.EDITPEAK.ADD_NEGATIVE:
76
+ {
77
+ var rmApex = state.peak.x === action.payload.x;
78
+ return !rmApex ? state : Object.assign({}, state, {
79
+ peak: false,
80
+ enable: true
81
+ });
82
+ }
83
+ case _action_type.LAYOUT.UPDATE:
84
+ return Object.assign({}, initialState, {
85
+ peak: false,
86
+ enable: state.enable
87
+ });
88
+ case _action_type.MANAGER.RESETSHIFT:
89
+ // case MANAGER.RESETALL:
90
+ return Object.assign({}, initialState, {
91
+ ref: resetRef(action.payload),
92
+ enable: resetEnable(action.payload)
93
+ });
94
+ default:
95
+ return state;
96
+ }
97
+ };
98
+
99
+ exports.default = shiftReducer;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var initialState = {
10
+ nmrSimPeaks: []
11
+ };
12
+
13
+ var resetAll = function resetAll(state, action) {
14
+ var newState = action.payload;
15
+ return Object.assign({}, state, newState);
16
+ };
17
+
18
+ var simulatioinReducer = function simulatioinReducer() {
19
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
20
+ var action = arguments[1];
21
+
22
+ switch (action.type) {
23
+ case _action_type.SIMULATION.RESET_ALL_RDC:
24
+ return resetAll(state, action);
25
+ default:
26
+ return state;
27
+ }
28
+ };
29
+
30
+ exports.default = simulatioinReducer;
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var initialState = {
10
+ btnSubmit: false
11
+ };
12
+
13
+ var statusReducer = function statusReducer() {
14
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
15
+ var action = arguments[1];
16
+
17
+ switch (action.type) {
18
+ case _action_type.STATUS.TOGGLEBTNSUBMIT:
19
+ return Object.assign({}, state, { btnSubmit: false } // !state.btnSubmit
20
+ );
21
+ case _action_type.STATUS.TOGGLEBTNALL:
22
+ return Object.assign({}, state, { btnSubmit: false } // !state.btnSubmit
23
+ );
24
+ case _action_type.STATUS.ENABLEBTNALL:
25
+ case _action_type.EDITPEAK.ADDPOSITIVE:
26
+ case _action_type.EDITPEAK.RMPOSITIVE:
27
+ case _action_type.EDITPEAK.ADDNEGATIVE:
28
+ case _action_type.EDITPEAK.RMNEGATIVE:
29
+ case _action_type.THRESHOLD.UPDATE_VALUE:
30
+ case _action_type.THRESHOLD.RESET_VALUE:
31
+ return Object.assign({}, state, { btnSubmit: false });
32
+ case _action_type.LAYOUT.UPDATE:
33
+ return Object.assign({}, state, { btnSubmit: false });
34
+ case _action_type.MANAGER.RESETALL:
35
+ return initialState;
36
+ default:
37
+ return initialState;
38
+ }
39
+ };
40
+
41
+ exports.default = statusReducer;
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var _format = require('../helpers/format');
10
+
11
+ var _format2 = _interopRequireDefault(_format);
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ var initialState = {
16
+ isAscend: false,
17
+ isIntensity: true,
18
+ decimal: 2,
19
+ operation: { name: 'empty' }
20
+ };
21
+
22
+ var updateOperation = function updateOperation(action) {
23
+ return { operation: action.payload || initialState.operation };
24
+ };
25
+
26
+ var submitReducer = function submitReducer() {
27
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
28
+ var action = arguments[1];
29
+
30
+ switch (action.type) {
31
+ case _action_type.SUBMIT.TOGGLE_IS_ASCEND:
32
+ return Object.assign({}, state, { isAscend: !state.isAscend });
33
+ case _action_type.SUBMIT.TOGGLE_IS_INTENSITY:
34
+ return Object.assign({}, state, { isIntensity: !state.isIntensity });
35
+ case _action_type.SUBMIT.UPDATE_OPERATION:
36
+ return Object.assign({}, state, updateOperation(action));
37
+ case _action_type.SUBMIT.UPDATE_DECIMAL:
38
+ return Object.assign({}, state, { decimal: action.payload.target.value });
39
+ case _action_type.LAYOUT.UPDATE:
40
+ {
41
+ var decimal = _format2.default.spectraDigit(action.payload);
42
+ return Object.assign({}, state, { decimal: decimal });
43
+ }
44
+ case _action_type.MANAGER.RESETALL:
45
+ {
46
+ var _decimal = _format2.default.spectraDigit(action.payload.operation.layout);
47
+ return Object.assign({}, state, { decimal: _decimal, isIntensity: true, isAscend: false });
48
+ }
49
+ default:
50
+ return state;
51
+ }
52
+ };
53
+
54
+ exports.default = submitReducer;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var initialState = {
10
+ isEdit: true,
11
+ value: false
12
+ };
13
+
14
+ var thresholdReducer = function thresholdReducer() {
15
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
16
+ var action = arguments[1];
17
+
18
+ switch (action.type) {
19
+ case _action_type.THRESHOLD.UPDATE_VALUE:
20
+ return Object.assign({}, state, { value: action.payload });
21
+ case _action_type.THRESHOLD.RESET_VALUE:
22
+ return Object.assign({}, state, { value: action.payload });
23
+ case _action_type.THRESHOLD.TOGGLE_ISEDIT:
24
+ return Object.assign({}, state, { isEdit: !state.isEdit });
25
+ case _action_type.MANAGER.RESET_INIT_COMMON:
26
+ return Object.assign({}, state, { isEdit: true });
27
+ case _action_type.MANAGER.RESETALL:
28
+ return Object.assign({}, state, { value: action.payload && action.payload.thresRef });
29
+ default:
30
+ return state;
31
+ }
32
+ };
33
+
34
+ exports.default = thresholdReducer;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _action_type = require('../constants/action_type');
8
+
9
+ var _list_ui = require('../constants/list_ui');
10
+
11
+ var initialState = {
12
+ viewer: _list_ui.LIST_UI_VIEWER_TYPE.SPECTRUM,
13
+ sweepType: _list_ui.LIST_UI_SWEEP_TYPE.ZOOMIN,
14
+ sweepExtent: { xExtent: false, yExtent: false }
15
+ };
16
+
17
+ var uiReducer = function uiReducer() {
18
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
19
+ var action = arguments[1];
20
+
21
+ switch (action.type) {
22
+ case _action_type.UI.VIEWER.SET_TYPE:
23
+ return Object.assign({}, state, {
24
+ viewer: action.payload
25
+ });
26
+ case _action_type.UI.SWEEP.SET_TYPE:
27
+ if (action.payload === _list_ui.LIST_UI_SWEEP_TYPE.ZOOMRESET) {
28
+ return Object.assign({}, state, {
29
+ sweepExtent: { xExtent: false, yExtent: false }
30
+ });
31
+ }
32
+ return Object.assign({}, state, {
33
+ sweepType: action.payload
34
+ });
35
+ case _action_type.UI.SWEEP.SELECT_ZOOMIN:
36
+ return Object.assign({}, state, {
37
+ sweepExtent: action.payload
38
+ });
39
+ case _action_type.MANAGER.RESETALL:
40
+ return initialState;
41
+ default:
42
+ return state;
43
+ }
44
+ };
45
+
46
+ exports.default = uiReducer;
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.undoRedoActions = exports.undoRedoConfig = undefined;
7
+
8
+ var _reduxUndo = require('redux-undo');
9
+
10
+ var _action_type = require('../constants/action_type');
11
+
12
+ var undoRedoActions = [_action_type.EDITPEAK.ADD_POSITIVE, _action_type.EDITPEAK.ADD_NEGATIVE, _action_type.EDITPEAK.RM_POSITIVE, _action_type.EDITPEAK.RM_NEGATIVE, _action_type.EDITPEAK.SHIFT, _action_type.MANAGER.RESETALL, _action_type.MANAGER.RESETSHIFT, _action_type.MANAGER.RESET_INIT_COMMON, _action_type.MANAGER.RESET_INIT_NMR, _action_type.MANAGER.RESET_INIT_MS, _action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION, _action_type.UI.SWEEP.SELECT_INTEGRATION, _action_type.UI.SWEEP.SELECT_MULTIPLICITY_RDC, _action_type.INTEGRATION.RM_ONE, _action_type.INTEGRATION.SET_REF, _action_type.INTEGRATION.SET_FKR, _action_type.INTEGRATION.RESET_ALL, _action_type.INTEGRATION.CLEAR_ALL, _action_type.MULTIPLICITY.PEAK_RM_BY_PANEL_RDC, _action_type.MULTIPLICITY.PEAK_RM_BY_UI_RDC, _action_type.MULTIPLICITY.PEAK_ADD_BY_UI_RDC, _action_type.MULTIPLICITY.RESET_ONE_RDC, _action_type.MULTIPLICITY.UPDATE_J, _action_type.MULTIPLICITY.TYPE_SELECT_RDC, _action_type.MULTIPLICITY.ONE_CLICK, _action_type.MULTIPLICITY.ONE_CLICK_BY_UI, _action_type.MULTIPLICITY.RESET_ALL_RDC, _action_type.MULTIPLICITY.CLEAR_ALL];
13
+
14
+ var undoRedoConfig = {
15
+ debug: false,
16
+ limit: 10,
17
+ ignoreInitialState: true,
18
+ filter: (0, _reduxUndo.includeAction)(undoRedoActions),
19
+ clearHistoryType: [_action_type.EDITPEAK.SHIFT, _action_type.MANAGER.RESETALL, _action_type.MANAGER.RESETSHIFT, _action_type.MANAGER.RESET_INIT_COMMON, _action_type.MANAGER.RESET_INIT_NMR, _action_type.MANAGER.RESET_INIT_MS, _action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION],
20
+ neverSkipReducer: [_action_type.EDITPEAK.SHIFT, _action_type.MANAGER.RESETALL, _action_type.MANAGER.RESETSHIFT, _action_type.MANAGER.RESET_INIT_COMMON, _action_type.MANAGER.RESET_INIT_NMR, _action_type.MANAGER.RESET_INIT_MS, _action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION]
21
+ };
22
+
23
+ exports.undoRedoConfig = undoRedoConfig;
24
+ exports.undoRedoActions = undoRedoActions;
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = rootSaga;
7
+
8
+ var _effects = require('redux-saga/effects');
9
+
10
+ var _saga_edit_peak = require('./saga_edit_peak');
11
+
12
+ var _saga_edit_peak2 = _interopRequireDefault(_saga_edit_peak);
13
+
14
+ var _saga_manager = require('./saga_manager');
15
+
16
+ var _saga_manager2 = _interopRequireDefault(_saga_manager);
17
+
18
+ var _saga_ui = require('./saga_ui');
19
+
20
+ var _saga_ui2 = _interopRequireDefault(_saga_ui);
21
+
22
+ var _saga_meta = require('./saga_meta');
23
+
24
+ var _saga_meta2 = _interopRequireDefault(_saga_meta);
25
+
26
+ var _saga_multiplicity = require('./saga_multiplicity');
27
+
28
+ var _saga_multiplicity2 = _interopRequireDefault(_saga_multiplicity);
29
+
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
+
32
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(rootSaga);
33
+
34
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
35
+
36
+ function rootSaga() {
37
+ return regeneratorRuntime.wrap(function rootSaga$(_context) {
38
+ while (1) {
39
+ switch (_context.prev = _context.next) {
40
+ case 0:
41
+ _context.next = 2;
42
+ return (0, _effects.all)([].concat(_toConsumableArray(_saga_edit_peak2.default), _toConsumableArray(_saga_manager2.default), _toConsumableArray(_saga_ui2.default), _toConsumableArray(_saga_meta2.default), _toConsumableArray(_saga_multiplicity2.default)));
43
+
44
+ case 2:
45
+ case 'end':
46
+ return _context.stop();
47
+ }
48
+ }
49
+ }, _marked);
50
+ }
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _effects = require('redux-saga/effects');
8
+
9
+ var _action_type = require('../constants/action_type');
10
+
11
+ var _shift = require('../helpers/shift');
12
+
13
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(addVirtualFactor);
14
+
15
+ var getShiftRef = function getShiftRef(state) {
16
+ return state.shift.ref;
17
+ };
18
+ var getShiftPeak = function getShiftPeak(state) {
19
+ return state.shift.peak;
20
+ };
21
+ var getEditPeak = function getEditPeak(state) {
22
+ return state.editPeak.present;
23
+ };
24
+
25
+ function addVirtualFactor(action) {
26
+ var origRef, origApex, origEPeak, payload, prevOffset, pos, neg, absOffset, relOffset, nextPos, nextNeg;
27
+ return regeneratorRuntime.wrap(function addVirtualFactor$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ _context.next = 2;
32
+ return (0, _effects.select)(getShiftRef);
33
+
34
+ case 2:
35
+ origRef = _context.sent;
36
+ _context.next = 5;
37
+ return (0, _effects.select)(getShiftPeak);
38
+
39
+ case 5:
40
+ origApex = _context.sent;
41
+ _context.next = 8;
42
+ return (0, _effects.select)(getEditPeak);
43
+
44
+ case 8:
45
+ origEPeak = _context.sent;
46
+ payload = action.payload;
47
+ prevOffset = origEPeak.prevOffset, pos = origEPeak.pos, neg = origEPeak.neg;
48
+ absOffset = (0, _shift.FromManualToOffset)(origRef, origApex);
49
+ relOffset = prevOffset - absOffset;
50
+ nextPos = (0, _shift.VirtalPts)(pos, relOffset);
51
+ nextNeg = (0, _shift.VirtalPts)(neg, relOffset);
52
+ _context.next = 17;
53
+ return (0, _effects.put)({
54
+ type: _action_type.EDITPEAK.SHIFT,
55
+ payload: Object.assign({}, payload, {
56
+ prevOffset: absOffset,
57
+ pos: nextPos,
58
+ neg: nextNeg
59
+ })
60
+ });
61
+
62
+ case 17:
63
+ case 'end':
64
+ return _context.stop();
65
+ }
66
+ }
67
+ }, _marked);
68
+ }
69
+
70
+ var editPeakSagas = [(0, _effects.takeEvery)(_action_type.SHIFT.SET_REF, addVirtualFactor), (0, _effects.takeEvery)(_action_type.SHIFT.SET_PEAK, addVirtualFactor)];
71
+
72
+ exports.default = editPeakSagas;
73
+
74
+ /* LOGIC
75
+ -no po - tg
76
+ | picked | another | absoffset | prevOffset | relative | newOffset
77
+ -------------------------------------------------------------------
78
+ 0 | 40 20 - - - 0
79
+ 1 | 180 160 -140 0 140 140
80
+ 2 | 80 60 -40 -140 -100 100
81
+ 3 | 20 0 +20 -100 -120
82
+ -------------------------------------------------------------------
83
+
84
+ */
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _effects = require('redux-saga/effects');
8
+
9
+ var _action_type = require('../constants/action_type');
10
+
11
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(resetShift),
12
+ _marked2 = /*#__PURE__*/regeneratorRuntime.mark(resetInitNmr),
13
+ _marked3 = /*#__PURE__*/regeneratorRuntime.mark(resetInitCommonWithIntergation);
14
+
15
+ var getLayout = function getLayout(state) {
16
+ return state.layout;
17
+ };
18
+
19
+ function resetShift(action) {
20
+ var layout, payload;
21
+ return regeneratorRuntime.wrap(function resetShift$(_context) {
22
+ while (1) {
23
+ switch (_context.prev = _context.next) {
24
+ case 0:
25
+ _context.next = 2;
26
+ return (0, _effects.select)(getLayout);
27
+
28
+ case 2:
29
+ layout = _context.sent;
30
+ payload = action.payload;
31
+ _context.next = 6;
32
+ return (0, _effects.put)({
33
+ type: _action_type.MANAGER.RESETSHIFT,
34
+ payload: Object.assign({}, payload, {
35
+ layout: layout
36
+ })
37
+ });
38
+
39
+ case 6:
40
+ case 'end':
41
+ return _context.stop();
42
+ }
43
+ }
44
+ }, _marked);
45
+ }
46
+
47
+ function resetInitNmr(action) {
48
+ var _action$payload, integration, simulation;
49
+
50
+ return regeneratorRuntime.wrap(function resetInitNmr$(_context2) {
51
+ while (1) {
52
+ switch (_context2.prev = _context2.next) {
53
+ case 0:
54
+ _action$payload = action.payload, integration = _action$payload.integration, simulation = _action$payload.simulation;
55
+
56
+ if (!integration) {
57
+ _context2.next = 4;
58
+ break;
59
+ }
60
+
61
+ _context2.next = 4;
62
+ return (0, _effects.put)({
63
+ type: _action_type.INTEGRATION.RESET_ALL_RDC,
64
+ payload: integration
65
+ });
66
+
67
+ case 4:
68
+ if (!simulation) {
69
+ _context2.next = 7;
70
+ break;
71
+ }
72
+
73
+ _context2.next = 7;
74
+ return (0, _effects.put)({
75
+ type: _action_type.SIMULATION.RESET_ALL_RDC,
76
+ payload: simulation
77
+ });
78
+
79
+ case 7:
80
+ case 'end':
81
+ return _context2.stop();
82
+ }
83
+ }
84
+ }, _marked2);
85
+ }
86
+
87
+ function resetInitCommonWithIntergation(action) {
88
+ var integration;
89
+ return regeneratorRuntime.wrap(function resetInitCommonWithIntergation$(_context3) {
90
+ while (1) {
91
+ switch (_context3.prev = _context3.next) {
92
+ case 0:
93
+ integration = action.payload.integration;
94
+
95
+ if (!integration) {
96
+ _context3.next = 4;
97
+ break;
98
+ }
99
+
100
+ _context3.next = 4;
101
+ return (0, _effects.put)({
102
+ type: _action_type.INTEGRATION.RESET_ALL_RDC,
103
+ payload: integration
104
+ });
105
+
106
+ case 4:
107
+ case 'end':
108
+ return _context3.stop();
109
+ }
110
+ }
111
+ }, _marked3);
112
+ }
113
+
114
+ var managerSagas = [(0, _effects.takeEvery)(_action_type.MANAGER.RESETALL, resetShift), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_NMR, resetInitNmr), (0, _effects.takeEvery)(_action_type.MANAGER.RESET_INIT_COMMON_WITH_INTERGATION, resetInitCommonWithIntergation)];
115
+
116
+ exports.default = managerSagas;
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _effects = require('redux-saga/effects');
8
+
9
+ var _action_type = require('../constants/action_type');
10
+
11
+ var _peakInterval = require('../third_party/peakInterval');
12
+
13
+ var _marked = /*#__PURE__*/regeneratorRuntime.mark(updateMetaPeaks);
14
+
15
+ function updateMetaPeaks(action) {
16
+ var payload, _getPeakIntervals, intervalL, intervalR, _payload$spectra$, observeFrequency, data, deltaX;
17
+
18
+ return regeneratorRuntime.wrap(function updateMetaPeaks$(_context) {
19
+ while (1) {
20
+ switch (_context.prev = _context.next) {
21
+ case 0:
22
+ payload = action.payload;
23
+ _getPeakIntervals = (0, _peakInterval.getPeakIntervals)(payload), intervalL = _getPeakIntervals.intervalL, intervalR = _getPeakIntervals.intervalR;
24
+ _payload$spectra$ = payload.spectra[0], observeFrequency = _payload$spectra$.observeFrequency, data = _payload$spectra$.data;
25
+ deltaX = Math.abs(data[0].x[0] - data[0].x[1]);
26
+ _context.next = 6;
27
+ return (0, _effects.put)({
28
+ type: _action_type.META.UPDATE_PEAKS_RDC,
29
+ payload: {
30
+ peaks: {
31
+ intervalL: intervalL, intervalR: intervalR, observeFrequency: observeFrequency, deltaX: deltaX
32
+ }
33
+ }
34
+ });
35
+
36
+ case 6:
37
+ case 'end':
38
+ return _context.stop();
39
+ }
40
+ }
41
+ }, _marked);
42
+ }
43
+
44
+ var metaSagas = [(0, _effects.takeEvery)(_action_type.META.UPDATE_PEAKS, updateMetaPeaks)];
45
+
46
+ exports.default = metaSagas;