nmrium 0.28.0 → 0.29.0

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 (118) hide show
  1. package/lib/component/1d/database/DatabaseSpectrum.js +9 -6
  2. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +8 -6
  3. package/lib/component/2d/Contours.js +8 -8
  4. package/lib/component/context/PreferencesContext.d.ts +0 -2
  5. package/lib/component/elements/CheckBox.js +1 -1
  6. package/lib/component/elements/CheckBoxCell.d.ts +3 -0
  7. package/lib/component/elements/CheckBoxCell.js +8 -0
  8. package/lib/component/elements/formik/FormikCheckBox.d.ts +2 -1
  9. package/lib/component/elements/formik/FormikCheckBox.js +4 -2
  10. package/lib/component/header/BaseLineCorrectionPanel.js +6 -5
  11. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  12. package/lib/component/hooks/useCheckToolsVisibility.js +1 -1
  13. package/lib/component/modal/changeSum/ChangeSumModal.js +2 -2
  14. package/lib/component/modal/setting/DatabasesTabContent.js +3 -3
  15. package/lib/component/modal/setting/DisplayTabContent.d.ts +1 -5
  16. package/lib/component/modal/setting/DisplayTabContent.js +5 -14
  17. package/lib/component/modal/setting/GeneralSettings.js +19 -12
  18. package/lib/component/modal/setting/GeneralTabContent.d.ts +3 -0
  19. package/lib/component/modal/setting/{ControllersTabContent.js → GeneralTabContent.js} +3 -3
  20. package/lib/component/modal/setting/ToolsTabContent.d.ts +3 -0
  21. package/lib/component/modal/setting/ToolsTabContent.js +100 -0
  22. package/lib/component/panels/Panels.js +7 -4
  23. package/lib/component/panels/databasePanel/DatabasePanel.js +2 -2
  24. package/lib/component/reducer/actions/FiltersActions.js +11 -8
  25. package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
  26. package/lib/component/reducer/preferences/actions/initPreferences.js +4 -4
  27. package/lib/component/reducer/preferences/actions/removeWorkspace.js +1 -1
  28. package/lib/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  29. package/lib/component/reducer/preferences/actions/setPreferences.js +13 -16
  30. package/lib/component/reducer/preferences/actions/setWorkspace.js +1 -1
  31. package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -44
  32. package/lib/component/reducer/preferences/preferencesReducer.js +0 -3
  33. package/lib/component/reducer/preferences/{utilites → utilities}/checkKeysExists.d.ts +0 -0
  34. package/lib/component/reducer/preferences/{utilites → utilities}/checkKeysExists.js +0 -0
  35. package/lib/component/reducer/preferences/{utilites → utilities}/filterObject.d.ts +0 -0
  36. package/lib/component/reducer/preferences/{utilites → utilities}/filterObject.js +0 -0
  37. package/lib/component/reducer/preferences/{utilites → utilities}/flatObject.d.ts +0 -0
  38. package/lib/component/reducer/preferences/{utilites → utilities}/flatObject.js +0 -0
  39. package/lib/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.d.ts +2 -1
  40. package/lib/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.js +0 -0
  41. package/lib/component/reducer/preferences/{utilites → utilities}/getPreferencesByWorkspace.d.ts +2 -1
  42. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.js +6 -0
  43. package/lib/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.d.ts +0 -0
  44. package/lib/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.js +0 -0
  45. package/lib/component/utility/Evaluate.js +1 -0
  46. package/lib/component/workspaces/Workspace.d.ts +12 -8
  47. package/lib/component/workspaces/basic.d.ts +2 -2
  48. package/lib/component/workspaces/basic.js +18 -39
  49. package/lib/component/workspaces/embedded.d.ts +2 -2
  50. package/lib/component/workspaces/embedded.js +19 -12
  51. package/lib/component/workspaces/exercise.d.ts +2 -2
  52. package/lib/component/workspaces/exercise.js +4 -33
  53. package/lib/component/workspaces/index.d.ts +5 -5
  54. package/lib/component/workspaces/prediction.d.ts +2 -2
  55. package/lib/component/workspaces/prediction.js +19 -16
  56. package/lib/component/workspaces/process1D.d.ts +2 -2
  57. package/lib/component/workspaces/process1D.js +12 -18
  58. package/lib/component/workspaces/workspaceDefaultProperties.d.ts +2 -0
  59. package/lib/component/workspaces/workspaceDefaultProperties.js +71 -0
  60. package/lib/data/data1d/MultipleAnalysis.js +1 -0
  61. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.js +1 -1
  62. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +11 -12
  63. package/lib/data/data1d/database.js +3 -10
  64. package/lib/data/data1d/filter1d/autoPhaseCorrection.js +1 -1
  65. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +14 -10
  66. package/lib/types/PanelPreferencesType.d.ts +1 -7
  67. package/lib/versionInfo.js +1 -1
  68. package/lib-cjs/component/1d/database/DatabaseSpectrum.js +9 -6
  69. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +8 -6
  70. package/lib-cjs/component/2d/Contours.js +8 -8
  71. package/lib-cjs/component/elements/CheckBox.js +1 -1
  72. package/lib-cjs/component/elements/CheckBoxCell.js +15 -0
  73. package/lib-cjs/component/elements/formik/FormikCheckBox.js +4 -2
  74. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -5
  75. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
  76. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +1 -1
  77. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +2 -2
  78. package/lib-cjs/component/modal/setting/DatabasesTabContent.js +3 -3
  79. package/lib-cjs/component/modal/setting/DisplayTabContent.js +5 -14
  80. package/lib-cjs/component/modal/setting/GeneralSettings.js +19 -12
  81. package/lib-cjs/component/modal/setting/{ControllersTabContent.js → GeneralTabContent.js} +3 -3
  82. package/lib-cjs/component/modal/setting/ToolsTabContent.js +105 -0
  83. package/lib-cjs/component/panels/Panels.js +7 -4
  84. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +2 -2
  85. package/lib-cjs/component/reducer/actions/FiltersActions.js +11 -8
  86. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -2
  87. package/lib-cjs/component/reducer/preferences/actions/initPreferences.js +4 -4
  88. package/lib-cjs/component/reducer/preferences/actions/removeWorkspace.js +1 -1
  89. package/lib-cjs/component/reducer/preferences/actions/setPanelsPreferences.js +1 -1
  90. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +16 -16
  91. package/lib-cjs/component/reducer/preferences/actions/setWorkspace.js +1 -1
  92. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +0 -3
  93. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/checkKeysExists.js +0 -0
  94. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/filterObject.js +0 -0
  95. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/flatObject.js +0 -0
  96. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/getActiveWorkspace.js +0 -0
  97. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/getPreferencesByWorkspace.js +3 -1
  98. package/lib-cjs/component/reducer/preferences/{utilites → utilities}/mapNucleiFormatting.js +0 -0
  99. package/lib-cjs/component/utility/Evaluate.js +1 -0
  100. package/lib-cjs/component/workspaces/basic.js +18 -39
  101. package/lib-cjs/component/workspaces/embedded.js +19 -12
  102. package/lib-cjs/component/workspaces/exercise.js +4 -33
  103. package/lib-cjs/component/workspaces/prediction.js +19 -16
  104. package/lib-cjs/component/workspaces/process1D.js +12 -18
  105. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +74 -0
  106. package/lib-cjs/data/data1d/MultipleAnalysis.js +1 -0
  107. package/lib-cjs/data/data1d/Spectrum1D/convertDataToFloat64Array.js +1 -1
  108. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +11 -12
  109. package/lib-cjs/data/data1d/database.js +3 -10
  110. package/lib-cjs/data/data1d/filter1d/autoPhaseCorrection.js +1 -1
  111. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +14 -10
  112. package/lib-cjs/versionInfo.js +1 -1
  113. package/package.json +15 -14
  114. package/lib/component/modal/setting/ControllersTabContent.d.ts +0 -3
  115. package/lib/component/reducer/preferences/actions/resetPreferences.d.ts +0 -3
  116. package/lib/component/reducer/preferences/actions/resetPreferences.js +0 -14
  117. package/lib/component/reducer/preferences/utilites/getPreferencesByWorkspace.js +0 -4
  118. package/lib-cjs/component/reducer/preferences/actions/resetPreferences.js +0 -18
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.workspaceDefaultProperties = void 0;
4
+ exports.workspaceDefaultProperties = {
5
+ display: {
6
+ general: {
7
+ disableMultipletAnalysis: false,
8
+ hideSetSumFromMolecule: false,
9
+ hideGeneralSettings: false,
10
+ experimentalFeatures: { display: false },
11
+ hidePanelOnLoad: false,
12
+ },
13
+ panels: {
14
+ spectraPanel: { display: false, open: false },
15
+ informationPanel: { display: false, open: false },
16
+ integralsPanel: { display: false, open: false },
17
+ rangesPanel: { display: false, open: false },
18
+ structuresPanel: { display: false, open: false },
19
+ filtersPanel: { display: false, open: false },
20
+ zonesPanel: { display: false, open: false },
21
+ automaticAssignmentPanel: { display: false, open: false },
22
+ databasePanel: { display: false, open: false },
23
+ multipleSpectraAnalysisPanel: { display: false, open: false },
24
+ peaksPanel: { display: false, open: false },
25
+ predictionPanel: { display: false, open: false },
26
+ summaryPanel: { display: false, open: false },
27
+ },
28
+ toolBarButtons: {
29
+ baselineCorrectionTool: false,
30
+ exclusionZonesTool: false,
31
+ exportAs: false,
32
+ FFTTool: false,
33
+ import: false,
34
+ integralTool: false,
35
+ multipleSpectraAnalysisTool: false,
36
+ phaseCorrectionTool: false,
37
+ rangePickingTool: false,
38
+ realImaginary: false,
39
+ slicingTool: false,
40
+ spectraCenterAlignments: false,
41
+ spectraStackAlignments: false,
42
+ zeroFillingTool: false,
43
+ zonePickingTool: false,
44
+ zoomOutTool: false,
45
+ zoomTool: false,
46
+ peakTool: false,
47
+ },
48
+ },
49
+ general: {
50
+ dimmedSpectraTransparency: 0.1,
51
+ },
52
+ formatting: {
53
+ nuclei: {
54
+ '1h': { name: '1H', ppm: '0.00', hz: '0.00' },
55
+ '13c': { name: '13C', ppm: '0.00', hz: '0.00' },
56
+ '15n': { name: '15N', ppm: '0.00', hz: '0.00' },
57
+ '19f': { name: '19F', ppm: '0.00', hz: '0.00' },
58
+ '29si': { name: '29Si', ppm: '0.00', hz: '0.00' },
59
+ '31p': { name: '31P', ppm: '0.00', hz: '0.00' },
60
+ },
61
+ panels: {},
62
+ },
63
+ databases: {
64
+ defaultDatabase: '',
65
+ data: [
66
+ {
67
+ key: 'toc',
68
+ label: 'Toc',
69
+ url: 'https://data.cheminfo.org/nmr/database/toc.json',
70
+ enabled: true,
71
+ },
72
+ ],
73
+ },
74
+ };
@@ -192,6 +192,7 @@ function calculate(columns, data, formula = '') {
192
192
  const params = variables.map((key) => data[key] ? data[key][columns[key].valueKey] : null);
193
193
  let result;
194
194
  try {
195
+ // eslint-disable-next-line no-new-func
195
196
  result = new Function(...variables, `return ${formula}`)(...params);
196
197
  }
197
198
  catch (e) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertDataToFloat64Array = void 0;
4
- function convert(value) {
4
+ function convert(value = []) {
5
5
  return !ArrayBuffer.isView(value) && value ? Float64Array.from(value) : value;
6
6
  }
7
7
  function convertDataToFloat64Array(data) {
@@ -38,34 +38,33 @@ const initiateRanges_1 = require("./ranges/initiateRanges");
38
38
  function initiateDatum1D(options, usedColors = {}) {
39
39
  const datum = {};
40
40
  datum.id = options.id || (0, generateID_1.default)();
41
- datum.source = Object.assign({
41
+ datum.source = {
42
42
  jcampURL: null,
43
43
  file: {
44
44
  binary: null,
45
45
  name: '',
46
46
  extension: '',
47
47
  },
48
- }, options.source);
49
- datum.display = Object.assign({
48
+ ...options.source,
49
+ };
50
+ datum.display = {
50
51
  name: options.display?.name ? options.display.name : (0, generateID_1.default)(),
51
52
  ...getColor(options, usedColors),
52
53
  isVisible: true,
53
54
  isPeaksMarkersVisible: true,
54
55
  isRealSpectrumVisible: true,
55
- }, options.display);
56
- datum.info = Object.assign({
56
+ ...options.display,
57
+ };
58
+ datum.info = {
57
59
  nucleus: '1H',
58
60
  isFid: false,
59
61
  isComplex: false,
60
62
  dimension: 1,
61
- }, options.info);
63
+ ...options.info,
64
+ };
62
65
  datum.originalInfo = datum.info;
63
- datum.meta = Object.assign({}, options.meta);
64
- datum.data = Object.assign({
65
- x: [],
66
- re: [],
67
- im: [],
68
- }, (0, convertDataToFloat64Array_1.convertDataToFloat64Array)(options.data));
66
+ datum.meta = { ...options.meta };
67
+ datum.data = (0, convertDataToFloat64Array_1.convertDataToFloat64Array)(options.data);
69
68
  datum.originalData = datum.data;
70
69
  datum.filters = Object.assign([], options.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} }
71
70
  datum.peaks = (0, initiatePeaks_1.initiatePeaks)(options, datum);
@@ -52,26 +52,19 @@ function prepareGetSolvents(data) {
52
52
  function prepareMoleculesDB(array) {
53
53
  let moleculesDB = new openchemlib_utils_1.MoleculesDB(full_1.default);
54
54
  for (let entry of array) {
55
- //@ts-expect-error property will be defined in next release of nmr-processing
56
55
  if (entry.ocl) {
57
56
  try {
58
- const molecule = full_1.default.Molecule.fromIDCode(
59
- //@ts-expect-error property will be defined in next release of nmr-processing
60
- entry.ocl.idCode,
61
- //@ts-expect-error property will be defined in next release of nmr-processing
57
+ const molecule = full_1.default.Molecule.fromIDCode(entry.ocl.idCode,
58
+ //@ts-expect-error types will be fixed in next release of openchemlib
62
59
  entry.ocl.coordinates);
63
60
  moleculesDB.pushEntry(molecule, entry, {}, {
64
- //@ts-expect-error property will be defined in next release of nmr-processing
65
61
  idCode: entry.ocl.idCode,
66
- //@ts-expect-error property will be defined in next release of nmr-processing
67
62
  index: entry.ocl.index,
68
63
  });
69
64
  }
70
65
  catch (e) {
71
66
  // eslint-disable-next-line no-console
72
- console.log(`Could not parse idCode: ${JSON.stringify(
73
- //@ts-expect-error property will be defined in next release of nmr-processing
74
- entry.ocl)}`, e);
67
+ console.log(`Could not parse idCode: ${JSON.stringify(entry.ocl)}`, e);
75
68
  }
76
69
  }
77
70
  else if (entry.smiles) {
@@ -34,7 +34,7 @@ function isApplicable(datum1D) {
34
34
  }
35
35
  exports.isApplicable = isApplicable;
36
36
  function reduce(previousValue, newValue) {
37
- let reduced = Object.assign({}, previousValue);
37
+ let reduced = { ...previousValue };
38
38
  for (const k in reduced) {
39
39
  reduced[k] += newValue[k];
40
40
  }
@@ -34,10 +34,11 @@ const Processing2D_1 = __importStar(require("../Processing2D"));
34
34
  function initiateDatum2D(options, usedColors = {}) {
35
35
  const datum = {};
36
36
  datum.id = options.id || (0, generateID_1.default)();
37
- datum.source = Object.assign({
37
+ datum.source = {
38
38
  jcampURL: null,
39
- }, options.source);
40
- datum.display = Object.assign({
39
+ ...options.source,
40
+ };
41
+ datum.display = {
41
42
  name: options.display?.name ? options.display.name : (0, generateID_1.default)(),
42
43
  ...getColor(options, usedColors),
43
44
  isPositiveVisible: true,
@@ -45,26 +46,29 @@ function initiateDatum2D(options, usedColors = {}) {
45
46
  isVisible: true,
46
47
  contourOptions: Processing2D_1.defaultContourOptions,
47
48
  dimension: 2,
48
- }, options.display);
49
- datum.info = Object.assign({
49
+ ...options.display,
50
+ };
51
+ datum.info = {
50
52
  nucleus: ['1H', '1H'],
51
53
  isFt: true,
52
54
  isFid: false,
53
55
  isComplex: false,
54
56
  dimension: 2,
55
- }, options.info);
57
+ ...options.info,
58
+ };
56
59
  datum.originalInfo = datum.info;
57
- datum.meta = Object.assign({}, options.meta);
58
- datum.data = Object.assign({
60
+ datum.meta = { ...options.meta };
61
+ datum.data = {
59
62
  z: [],
60
63
  minX: 0,
61
64
  minY: 0,
62
65
  maxX: 0,
63
66
  maxY: 0,
64
- }, options.data);
67
+ ...options.data,
68
+ };
65
69
  datum.originalData = datum.data;
66
70
  datum.filters = Object.assign([], options.filters);
67
- datum.zones = Object.assign({ values: [], options: {} }, options.zones);
71
+ datum.zones = { values: [], options: {}, ...options.zones };
68
72
  datum.processingController = new Processing2D_1.default(datum.data, datum.display.contourOptions);
69
73
  //reapply filters after load the original data
70
74
  FiltersManager.reapplyFilters(datum);
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = { version: 'v0.28.0' };
3
+ exports.default = { version: 'v0.29.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.28.0",
4
+ "version": "0.29.0",
5
5
  "license": "MIT",
6
6
  "main": "lib-cjs/component/NMRium.js",
7
7
  "module": "lib/component/NMRium.js",
@@ -38,7 +38,8 @@
38
38
  "url": "git+https://github.com/cheminfo/nmrium.git"
39
39
  },
40
40
  "volta": {
41
- "node": "16.15.1"
41
+ "node": "16.16.0",
42
+ "npm": "8.15.0"
42
43
  },
43
44
  "overrides": {
44
45
  "react": "$react",
@@ -51,7 +52,7 @@
51
52
  "dependencies": {
52
53
  "@emotion/react": "^11.9.3",
53
54
  "analysis-ui-components": "^0.15.2",
54
- "cheminfo-font": "^1.8.1",
55
+ "cheminfo-font": "^1.9.0",
55
56
  "cheminfo-types": "^1.2.0",
56
57
  "d3": "^7.6.1",
57
58
  "eventemitter3": "^4.0.7",
@@ -69,12 +70,12 @@
69
70
  "ml-baseline-correction-regression": "^1.0.0",
70
71
  "ml-conrec": "^3.2.1",
71
72
  "ml-gsd": "^11.2.1",
72
- "ml-spectra-processing": "^11.7.0",
73
+ "ml-spectra-processing": "^11.9.0",
73
74
  "ml-stat": "^1.3.3",
74
75
  "multiplet-analysis": "^2.0.0",
75
76
  "nmr-correlation": "^2.3.2",
76
77
  "nmr-parser": "^1.9.0",
77
- "nmr-processing": "^8.2.0",
78
+ "nmr-processing": "^8.3.0",
78
79
  "nmredata": "^0.6.1",
79
80
  "numeral": "^2.0.6",
80
81
  "openchemlib": "^7.4.3",
@@ -94,25 +95,25 @@
94
95
  "react-table": "^7.8.0",
95
96
  "react-transition-group": "^4.4.2",
96
97
  "react-use": "^17.4.0",
97
- "smart-array-filter": "^3.1.3",
98
+ "smart-array-filter": "^3.2.0",
98
99
  "yup": "^0.32.11"
99
100
  },
100
101
  "devDependencies": {
101
102
  "@babel/plugin-transform-modules-commonjs": "^7.18.6",
102
103
  "@babel/preset-react": "^7.18.6",
103
104
  "@babel/preset-typescript": "^7.18.6",
104
- "@playwright/test": "^1.23.2",
105
+ "@playwright/test": "^1.24.0",
105
106
  "@simbathesailor/use-what-changed": "^2.0.0",
106
107
  "@types/d3": "^7.4.0",
107
- "@types/jest": "^28.1.4",
108
- "@types/node": "^18.0.3",
108
+ "@types/jest": "^28.1.6",
109
+ "@types/node": "^18.0.6",
109
110
  "@types/react": "^18.0.15",
110
111
  "@types/react-dom": "^18.0.6",
111
- "@vitejs/plugin-react": "^1.3.2",
112
+ "@vitejs/plugin-react": "^2.0.0",
112
113
  "@zakodium/eslint-config": "^6.0.0",
113
114
  "cross-env": "^7.0.3",
114
- "eslint": "^8.19.0",
115
- "jest": "^28.1.2",
115
+ "eslint": "^8.20.0",
116
+ "jest": "^28.1.3",
116
117
  "modern-normalize": "^1.1.0",
117
118
  "prettier": "^2.7.1",
118
119
  "rc-menu": "^9.6.0",
@@ -121,8 +122,8 @@
121
122
  "react-router-dom": "^6.3.0",
122
123
  "rimraf": "^3.0.2",
123
124
  "rollup-plugin-analyzer": "^4.0.0",
124
- "serve": "^13.0.4",
125
+ "serve": "^14.0.1",
125
126
  "typescript": "~4.7.4",
126
- "vite": "^2.9.14"
127
+ "vite": "^3.0.2"
127
128
  }
128
129
  }
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare function ControllersTabContent(): JSX.Element;
3
- export default ControllersTabContent;
@@ -1,3 +0,0 @@
1
- import { Draft } from 'immer';
2
- import { PreferencesState } from '../preferencesReducer';
3
- export declare function resetPreferences(draft: Draft<PreferencesState>): void;
@@ -1,14 +0,0 @@
1
- import { getLocalStorage, storeData } from '../../../utility/LocalStorage';
2
- import { getActiveWorkspace } from '../utilites/getActiveWorkspace';
3
- import { getPreferencesByWorkspace } from '../utilites/getPreferencesByWorkspace';
4
- export function resetPreferences(draft) {
5
- const currentWorkspacePreferences = getActiveWorkspace(draft);
6
- let localData = getLocalStorage('nmr-general-settings');
7
- const workSpaceDisplayPreferences = getPreferencesByWorkspace(draft.workspace.current).display;
8
- if (localData.workspaces[draft.workspace.current]) {
9
- localData.workspaces[draft.workspace.current].display =
10
- workSpaceDisplayPreferences;
11
- storeData('nmr-general-settings', JSON.stringify(localData));
12
- }
13
- currentWorkspacePreferences.display = workSpaceDisplayPreferences;
14
- }
@@ -1,4 +0,0 @@
1
- import Workspaces from '../../../workspaces';
2
- export function getPreferencesByWorkspace(workspace) {
3
- return Workspaces?.[workspace] || {};
4
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resetPreferences = void 0;
4
- const LocalStorage_1 = require("../../../utility/LocalStorage");
5
- const getActiveWorkspace_1 = require("../utilites/getActiveWorkspace");
6
- const getPreferencesByWorkspace_1 = require("../utilites/getPreferencesByWorkspace");
7
- function resetPreferences(draft) {
8
- const currentWorkspacePreferences = (0, getActiveWorkspace_1.getActiveWorkspace)(draft);
9
- let localData = (0, LocalStorage_1.getLocalStorage)('nmr-general-settings');
10
- const workSpaceDisplayPreferences = (0, getPreferencesByWorkspace_1.getPreferencesByWorkspace)(draft.workspace.current).display;
11
- if (localData.workspaces[draft.workspace.current]) {
12
- localData.workspaces[draft.workspace.current].display =
13
- workSpaceDisplayPreferences;
14
- (0, LocalStorage_1.storeData)('nmr-general-settings', JSON.stringify(localData));
15
- }
16
- currentWorkspacePreferences.display = workSpaceDisplayPreferences;
17
- }
18
- exports.resetPreferences = resetPreferences;