@complat/react-spectra-editor 1.5.0 → 1.5.2

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.
@@ -97,19 +97,6 @@ class MultiFocus {
97
97
  this.isFirefox = typeof InstallTrigger !== 'undefined';
98
98
  this.cyclicvoltaSt = null;
99
99
  }
100
- getGlobalXExtent() {
101
- let allData = [...this.data];
102
- if (this.otherLineData) {
103
- this.otherLineData.forEach(lineData => {
104
- allData = [...allData, ...lineData.data];
105
- });
106
- }
107
- const xes = d3.extent(allData, d => d.x).sort((a, b) => a - b);
108
- return {
109
- xL: xes[0],
110
- xU: xes[1]
111
- };
112
- }
113
100
  getShouldUpdate(nextEpSt) {
114
101
  const {
115
102
  prevXt,
@@ -296,14 +283,6 @@ class MultiFocus {
296
283
  drawOtherLines(layout) {
297
284
  d3.selectAll('.line-clip-compare').remove();
298
285
  if (!this.otherLineData) return null;
299
- const {
300
- yt
301
- } = (0, _compass.TfRescale)(this);
302
- const globalXExtent = this.getGlobalXExtent();
303
- const reverse = this.reverseXAxis(this.layout);
304
- const xRange = reverse ? [this.w, 0] : [0, this.w];
305
- const xtGlobal = d3.scaleLinear().domain([globalXExtent.xL, globalXExtent.xU]).range(xRange);
306
- const globalPathCall = d3.line().x(d => xtGlobal(d.x)).y(d => yt(d.y));
307
286
  this.otherLineData.forEach((entry, idx) => {
308
287
  const {
309
288
  data,
@@ -311,7 +290,7 @@ class MultiFocus {
311
290
  } = entry;
312
291
  const pathColor = color ? color : _format.default.mutiEntitiesColors(idx);
313
292
  const path = (0, _mount.MountComparePath)(this, pathColor, idx, 0.4);
314
- path.attr('d', globalPathCall(data));
293
+ path.attr('d', this.pathCall(data));
315
294
  if (this.layout === _list_layout.LIST_LAYOUT.AIF && this.isShowAllCurves === true) {
316
295
  path.attr('marker-mid', 'url(#arrow-left)');
317
296
  }
@@ -66,7 +66,10 @@ class MultiJcampsViewer extends _react.default.Component {
66
66
  molSvg,
67
67
  exactMass,
68
68
  layoutSt,
69
- integrationSt
69
+ integrationSt,
70
+ descriptions,
71
+ canChangeDescription,
72
+ onDescriptionChanged
70
73
  } = this.props;
71
74
  if (!entities || entities.length === 0) return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
72
75
  const separateCondition = _format.default.isGCLayout(layoutSt) ? 'yUnit' : 'xUnit';
@@ -117,9 +120,9 @@ class MultiJcampsViewer extends _react.default.Component {
117
120
  exactMass: exactMass,
118
121
  subLayoutsInfo: seperatedSubLayouts,
119
122
  integration: currentIntegration,
120
- descriptions: "",
121
- canChangeDescription: () => {},
122
- onDescriptionChanged: () => {}
123
+ descriptions: descriptions,
124
+ canChangeDescription: canChangeDescription,
125
+ onDescriptionChanged: onDescriptionChanged
123
126
  })
124
127
  })]
125
128
  })
@@ -159,7 +162,10 @@ MultiJcampsViewer.propTypes = {
159
162
  entities: _propTypes.default.array,
160
163
  layoutSt: _propTypes.default.string.isRequired,
161
164
  exactMass: _propTypes.default.string,
162
- integrationSt: _propTypes.default.object.isRequired
165
+ integrationSt: _propTypes.default.object.isRequired,
166
+ descriptions: _propTypes.default.array.isRequired,
167
+ canChangeDescription: _propTypes.default.bool.isRequired,
168
+ onDescriptionChanged: _propTypes.default.func
163
169
  };
164
170
  MultiJcampsViewer.defaultProps = {
165
171
  multiEntities: [],
@@ -168,6 +174,8 @@ MultiJcampsViewer.defaultProps = {
168
174
  cLabel: '',
169
175
  xLabel: '',
170
176
  yLabel: '',
171
- entities: []
177
+ entities: [],
178
+ descriptions: [],
179
+ canChangeDescription: false
172
180
  };
173
181
  var _default = exports.default = (0, _redux.compose)((0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps), (0, _styles.withStyles)(styles))(MultiJcampsViewer);
@@ -224,7 +224,15 @@ const ComparePanel = ({
224
224
  }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Accordion, {
225
225
  expanded: expand,
226
226
  onChange: onExapnd,
227
- className: (0, _classnames.default)(classes.panel),
227
+ disableGutters: true,
228
+ sx: {
229
+ '&.MuiAccordion-root.Mui-expanded': {
230
+ margin: 0
231
+ },
232
+ '&:before': {
233
+ display: 'none'
234
+ }
235
+ },
228
236
  TransitionProps: {
229
237
  unmountOnExit: true
230
238
  } // increase Accordion performance
@@ -173,6 +173,15 @@ const CyclicVoltammetryPanel = ({
173
173
  }));
174
174
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Accordion, {
175
175
  "data-testid": "PanelVoltammetry",
176
+ disableGutters: true,
177
+ sx: {
178
+ '&.MuiAccordion-root.Mui-expanded': {
179
+ margin: 0
180
+ },
181
+ '&:before': {
182
+ display: 'none'
183
+ }
184
+ },
176
185
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AccordionSummary, {
177
186
  expandIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}),
178
187
  className: (0, _classnames.default)(classes.panelSummary),
@@ -128,6 +128,15 @@ const GraphSelectionPanel = ({
128
128
  });
129
129
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Accordion, {
130
130
  "data-testid": "GraphSelectionPanel",
131
+ disableGutters: true,
132
+ sx: {
133
+ '&.MuiAccordion-root.Mui-expanded': {
134
+ margin: 0
135
+ },
136
+ '&:before': {
137
+ display: 'none'
138
+ }
139
+ },
131
140
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.AccordionSummary, {
132
141
  expandIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {}),
133
142
  className: (0, _classnames.default)(classes.panelSummary),
@@ -31,11 +31,7 @@ const styles = () => ({
31
31
  },
32
32
  panelSummary: {
33
33
  backgroundColor: '#eee',
34
- height: 32,
35
- minHeight: 32,
36
- '& .MuiAccordionSummary-content': {
37
- margin: 0
38
- }
34
+ height: 32
39
35
  },
40
36
  subSectionHeader: {
41
37
  backgroundColor: '#eee',
@@ -341,7 +337,15 @@ const InfoPanel = ({
341
337
  "data-testid": "PanelInfo",
342
338
  expanded: expand,
343
339
  onChange: onExapnd,
344
- className: (0, _classnames.default)(classes.panel),
340
+ disableGutters: true,
341
+ sx: {
342
+ '&.MuiAccordion-root.Mui-expanded': {
343
+ margin: 0
344
+ },
345
+ '&:before': {
346
+ display: 'none'
347
+ }
348
+ },
345
349
  TransitionProps: {
346
350
  unmountOnExit: true
347
351
  } // increase Accordion performance
@@ -435,9 +439,10 @@ const InfoPanel = ({
435
439
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
436
440
  className: classes.quillContainer,
437
441
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactQuill.default, {
442
+ className: (0, _classnames.default)(classes.quill, 'card-sv-quill'),
438
443
  value: normalizeQuillValue(descriptions),
439
- placeholder: canChangeDescription ? 'Add text here...' : undefined,
440
- readOnly: !canChangeDescription,
444
+ placeholder: canChangeDescription ? 'Peaks will be written here...' : undefined,
445
+ readOnly: true,
441
446
  modules: {
442
447
  toolbar: false
443
448
  },
@@ -257,7 +257,15 @@ const MultiplicityPanel = ({
257
257
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Accordion, {
258
258
  expanded: expand,
259
259
  onChange: onExapnd,
260
- className: (0, _classnames.default)(classes.panel),
260
+ disableGutters: true,
261
+ sx: {
262
+ '&.MuiAccordion-root.Mui-expanded': {
263
+ margin: 0
264
+ },
265
+ '&:before': {
266
+ display: 'none'
267
+ }
268
+ },
261
269
  TransitionProps: {
262
270
  unmountOnExit: true
263
271
  } // increase Accordion performance
@@ -185,7 +185,15 @@ const PeakPanel = ({
185
185
  "data-testid": "PeaksPanelInfo",
186
186
  expanded: expand,
187
187
  onChange: onExapnd,
188
- className: (0, _classnames.default)(classes.panel),
188
+ disableGutters: true,
189
+ sx: {
190
+ '&.MuiAccordion-root.Mui-expanded': {
191
+ margin: 0
192
+ },
193
+ '&:before': {
194
+ display: 'none'
195
+ }
196
+ },
189
197
  TransitionProps: {
190
198
  unmountOnExit: true
191
199
  } // increase Accordion performance
package/dist/index.js CHANGED
@@ -800,6 +800,7 @@ class DemoWriteIr extends _react.default.Component {
800
800
  multiEntities: multiEntities,
801
801
  others: others,
802
802
  editorOnly: false,
803
+ descriptions: desc,
803
804
  canChangeDescription: true,
804
805
  onDescriptionChanged: this.onDescriptionChanged,
805
806
  molSvg: molSvg,
@@ -155,7 +155,10 @@ class LayerInit extends _react.default.Component {
155
155
  userManualLink: userManualLink,
156
156
  molSvg: molSvg,
157
157
  exactMass: exactMass,
158
- operations: operations
158
+ operations: operations,
159
+ descriptions: descriptions,
160
+ canChangeDescription: canChangeDescription,
161
+ onDescriptionChanged: onDescriptionChanged
159
162
  });
160
163
  } else if (_format.default.isCyclicVoltaLayout(layout)) {
161
164
  // eslint-disable-line
@@ -165,7 +168,10 @@ class LayerInit extends _react.default.Component {
165
168
  userManualLink: userManualLink,
166
169
  molSvg: molSvg,
167
170
  exactMass: exactMass,
168
- operations: operations
171
+ operations: operations,
172
+ descriptions: descriptions,
173
+ canChangeDescription: canChangeDescription,
174
+ onDescriptionChanged: onDescriptionChanged
169
175
  });
170
176
  }
171
177
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_layer_prism.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complat/react-spectra-editor",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "An editor to View and Edit Chemical Spectra data (NMR, IR, MS, CV, UIVIS, XRD, GC, and DSC).",
5
5
  "repository": {
6
6
  "type": "git",