nmrium 0.55.0 → 0.57.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 (202) hide show
  1. package/lib/component/1d/Chart1D.js +3 -1
  2. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +0 -1
  3. package/lib/component/1d/Viewer1D.js +36 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +14 -19
  5. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +0 -1
  6. package/lib/component/1d/matrix/Boxplot.d.ts +6 -0
  7. package/lib/component/1d/matrix/Boxplot.js +97 -0
  8. package/lib/component/1d/matrix/Stocsy.d.ts +5 -0
  9. package/lib/component/1d/matrix/Stocsy.js +101 -0
  10. package/lib/component/1d/matrix/useMatrix.d.ts +29 -0
  11. package/lib/component/1d/matrix/useMatrix.js +93 -0
  12. package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts +0 -1
  13. package/lib/component/1d/peaks/PeakEditionManager.js +16 -10
  14. package/lib/component/1d/utilities/getDecimalsCount.js +1 -1
  15. package/lib/component/1d/utilities/intersectionResolver.js +1 -1
  16. package/lib/component/1d/utilities/scale.d.ts +2 -1
  17. package/lib/component/1d/utilities/scale.js +6 -1
  18. package/lib/component/1d-2d/FieldEdition.d.ts +3 -1
  19. package/lib/component/1d-2d/FieldEdition.js +26 -10
  20. package/lib/component/2d/1d-tracer/Left1DChart.d.ts +0 -1
  21. package/lib/component/2d/1d-tracer/Top1DChart.d.ts +0 -1
  22. package/lib/component/2d/XAxis.d.ts +0 -1
  23. package/lib/component/2d/YAxis.d.ts +0 -1
  24. package/lib/component/2d/ft/Contours.js +7 -7
  25. package/lib/component/assignment/AssignmentsContext.d.ts +0 -1
  26. package/lib/component/context/ChartContext.d.ts +0 -1
  27. package/lib/component/context/DispatchContext.d.ts +0 -1
  28. package/lib/component/context/GlobalContext.d.ts +0 -1
  29. package/lib/component/context/KeyModifierContext.js +1 -1
  30. package/lib/component/context/LoaderContext.d.ts +0 -1
  31. package/lib/component/context/PreferencesContext.d.ts +0 -1
  32. package/lib/component/context/PrepareExportContext.d.ts +21 -0
  33. package/lib/component/context/PrepareExportContext.js +124 -0
  34. package/lib/component/context/ScaleContext.d.ts +0 -1
  35. package/lib/component/elements/ActionButtons.d.ts +1 -0
  36. package/lib/component/elements/ActionButtons.js +4 -4
  37. package/lib/component/elements/ColorInput.d.ts +0 -1
  38. package/lib/component/elements/ColorPickerDropdownController.d.ts +2 -0
  39. package/lib/component/elements/ColorPickerDropdownController.js +8 -0
  40. package/lib/component/elements/ColumnWrapper.d.ts +0 -1
  41. package/lib/component/elements/ContextMenu.d.ts +0 -1
  42. package/lib/component/elements/Input.d.ts +1 -0
  43. package/lib/component/elements/Input.js +2 -1
  44. package/lib/component/elements/Input2.d.ts +13 -0
  45. package/lib/component/elements/Input2.js +118 -0
  46. package/lib/component/elements/Input2Controller.d.ts +12 -0
  47. package/lib/component/elements/Input2Controller.js +22 -0
  48. package/lib/component/elements/MoleculeSelection.js +1 -1
  49. package/lib/component/elements/NumberInput.js +1 -1
  50. package/lib/component/elements/NumberInput2.d.ts +12 -0
  51. package/lib/component/elements/NumberInput2.js +65 -0
  52. package/lib/component/elements/NumberInput2Controller.d.ts +8 -0
  53. package/lib/component/elements/NumberInput2Controller.js +15 -0
  54. package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +3 -3
  55. package/lib/component/elements/ReactTable/Style.d.ts +3 -1
  56. package/lib/component/elements/ReactTable/Style.js +11 -1
  57. package/lib/component/elements/ReactTable/utility/ReactTableContext.d.ts +0 -1
  58. package/lib/component/elements/Select2.d.ts +26 -0
  59. package/lib/component/elements/Select2.js +25 -0
  60. package/lib/component/elements/Select2Controller.d.ts +7 -0
  61. package/lib/component/elements/Select2Controller.js +12 -0
  62. package/lib/component/elements/draggable/useDraggable.d.ts +0 -1
  63. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +2 -4
  64. package/lib/component/elements/dropDownButton/DropDownButton.js +11 -37
  65. package/lib/component/elements/dropDownButton/DropDownList.js +3 -32
  66. package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
  67. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +0 -1
  68. package/lib/component/elements/formik/FormikInput.d.ts +0 -1
  69. package/lib/component/elements/formik/FormikInput2.d.ts +11 -0
  70. package/lib/component/elements/formik/FormikInput2.js +26 -0
  71. package/lib/component/elements/formik/FormikOnChange.d.ts +0 -1
  72. package/lib/component/elements/popup/Modal/Context.d.ts +0 -1
  73. package/lib/component/elements/popup/Modal/ModalContent.d.ts +0 -1
  74. package/lib/component/elements/resizer/SVGResizer.d.ts +0 -1
  75. package/lib/component/elements/useFormValidateField.d.ts +1 -0
  76. package/lib/component/elements/useFormValidateField.js +9 -0
  77. package/lib/component/header/ApodizationOptionsPanel.js +26 -11
  78. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +1 -4
  79. package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -16
  80. package/lib/component/header/BaseLineCorrectionPanel.js +49 -27
  81. package/lib/component/header/Header.js +1 -1
  82. package/lib/component/header/PhaseCorrectionPanel.js +12 -24
  83. package/lib/component/header/RangesPickingOptionPanel.js +12 -12
  84. package/lib/component/header/ZeroFillingOptionsPanel.js +18 -7
  85. package/lib/component/header/Zones2DOptionPanel.js +19 -18
  86. package/lib/component/hooks/useExport.d.ts +1 -1
  87. package/lib/component/hooks/useExport.js +4 -4
  88. package/lib/component/hooks/usePanelPreferences.d.ts +2 -3
  89. package/lib/component/hooks/usePanelPreferences.js +3 -1
  90. package/lib/component/hooks/useToggleSpectraVisibility.d.ts +10 -0
  91. package/lib/component/hooks/useToggleSpectraVisibility.js +41 -0
  92. package/lib/component/hooks/useWorkspaceAction.d.ts +1 -1
  93. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +0 -1
  94. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +0 -1
  95. package/lib/component/modal/setting/GeneralSettings.d.ts +5 -1
  96. package/lib/component/modal/setting/GeneralSettings.js +107 -111
  97. package/lib/component/modal/setting/WorkspaceItem.js +4 -9
  98. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  99. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +95 -59
  100. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +33 -25
  101. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +15 -4
  102. package/lib/component/modal/setting/settings-tabs/ImportationFiltersTabContent.js +56 -39
  103. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +36 -36
  104. package/lib/component/modal/setting/settings-tabs/NucleiTabContent.js +44 -36
  105. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +16 -11
  106. package/lib/component/modal/setting/settings-tabs/SpectraColorsTabContent.js +47 -40
  107. package/lib/component/modal/setting/settings-tabs/ToolsTabContent.js +50 -40
  108. package/lib/component/modal/setting/settingsValidation.js +8 -34
  109. package/lib/component/panels/AutomaticAssignment/AutomaticAssignmentTable.d.ts +0 -1
  110. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +0 -1
  111. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.d.ts +0 -1
  112. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -2
  113. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +121 -36
  114. package/lib/component/panels/Panels.js +32 -9
  115. package/lib/component/panels/PeaksPanel/PeaksPreferences.d.ts +0 -1
  116. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts +0 -1
  117. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +0 -1
  118. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.d.ts +0 -1
  119. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +4 -27
  120. package/lib/component/panels/SpectraPanel/SpectraPreferences.d.ts +0 -1
  121. package/lib/component/panels/SpectraPanel/SpectraPreferences.js +32 -24
  122. package/lib/component/panels/SpectraPanel/SpectraTable.js +17 -2
  123. package/lib/component/panels/SpectraPanel/SpectrumListPanel.d.ts +0 -1
  124. package/lib/component/panels/SpectraPanel/base/ColorIndicator.d.ts +0 -1
  125. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.d.ts +3 -3
  126. package/lib/component/panels/SpectraPanel/base/SpectraColumnsManager.js +25 -16
  127. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DHistogram.d.ts +0 -1
  128. package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +15 -5
  129. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DHistogram.d.ts +0 -1
  130. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +44 -6
  131. package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.d.ts +0 -1
  132. package/lib/component/panels/SummaryPanel/Overview.d.ts +0 -1
  133. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts +0 -1
  134. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +1 -1
  135. package/lib/component/panels/ZonesPanel/ZonesPreferences.d.ts +0 -1
  136. package/lib/component/panels/databasePanel/DatabasePanel.js +17 -3
  137. package/lib/component/panels/databasePanel/DatabasePreferences.d.ts +0 -1
  138. package/lib/component/panels/databasePanel/DatabaseTable.d.ts +11 -4
  139. package/lib/component/panels/databasePanel/DatabaseTable.js +22 -7
  140. package/lib/component/panels/informationPanel/InformationEditionModal.d.ts +6 -0
  141. package/lib/component/panels/informationPanel/InformationEditionModal.js +105 -0
  142. package/lib/component/panels/informationPanel/InformationPanel.d.ts +1 -0
  143. package/lib/component/panels/{InformationPanel.js → informationPanel/InformationPanel.js} +2 -2
  144. package/lib/component/panels/multipleAnalysisPanel/preferences/MultipleAnalysisCodeEditor.d.ts +0 -1
  145. package/lib/component/panels/multipleAnalysisPanel/preferences/index.d.ts +0 -1
  146. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +0 -1
  147. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +1 -1
  148. package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +0 -1
  149. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +0 -1
  150. package/lib/component/reducer/Reducer.d.ts +7 -1
  151. package/lib/component/reducer/Reducer.js +2 -0
  152. package/lib/component/reducer/actions/DatabaseActions.js +22 -5
  153. package/lib/component/reducer/actions/DomainActions.d.ts +5 -2
  154. package/lib/component/reducer/actions/DomainActions.js +6 -4
  155. package/lib/component/reducer/actions/FiltersActions.js +2 -2
  156. package/lib/component/reducer/actions/LoadActions.js +5 -2
  157. package/lib/component/reducer/actions/SpectraActions.d.ts +9 -2
  158. package/lib/component/reducer/actions/SpectraActions.js +65 -23
  159. package/lib/component/reducer/actions/ToolsActions.js +3 -4
  160. package/lib/component/reducer/preferences/actions/matrixGeneration.d.ts +47 -2
  161. package/lib/component/reducer/preferences/actions/matrixGeneration.js +62 -25
  162. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +11 -8
  163. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +19 -1
  164. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -26
  165. package/lib/component/reducer/preferences/preferencesReducer.js +7 -1
  166. package/lib/component/toolbar/ToolBar.js +6 -7
  167. package/lib/component/utility/PathBuilder.d.ts +1 -0
  168. package/lib/component/utility/PathBuilder.js +8 -1
  169. package/lib/component/utility/checkUniqueByKey.d.ts +2 -0
  170. package/lib/component/utility/checkUniqueByKey.js +40 -0
  171. package/lib/component/utility/colorToHexWithAlpha.d.ts +9 -0
  172. package/lib/component/utility/colorToHexWithAlpha.js +4 -0
  173. package/lib/component/workspaces/exercise.js +2 -0
  174. package/lib/component/workspaces/process1D.js +0 -1
  175. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  176. package/lib/data/PredictionManager.js +3 -5
  177. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +13 -13
  178. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +9 -9
  179. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +13 -13
  180. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +13 -13
  181. package/lib/data/data1d/database.d.ts +1 -0
  182. package/lib/data/data1d/database.js +4 -2
  183. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -22
  184. package/lib/data/data2d/Spectrum2D/contours.js +88 -67
  185. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +4 -2
  186. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +20 -20
  187. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +20 -20
  188. package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
  189. package/lib/data/initiateFilters.d.ts +1 -1
  190. package/lib/data/matrixGeneration.js +1 -2
  191. package/lib/data/types/common/DeepPartial.d.ts +3 -0
  192. package/lib/data/types/common/DeepPartial.js +1 -0
  193. package/lib/data/types/common/Keys.d.ts +3 -0
  194. package/lib/data/types/common/Keys.js +1 -0
  195. package/lib/data/utilities/generateNumbersPowerOfX.d.ts +2 -2
  196. package/lib/versionInfo.js +1 -1
  197. package/package.json +39 -38
  198. package/lib/component/elements/CustomToolTip.d.ts +0 -8
  199. package/lib/component/elements/CustomToolTip.js +0 -107
  200. package/lib/component/elements/formik/FormikSlider.d.ts +0 -6
  201. package/lib/component/elements/formik/FormikSlider.js +0 -15
  202. package/lib/component/panels/InformationPanel.d.ts +0 -1
@@ -1,9 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CheckBoxCell } from '../../../elements/CheckBoxCell';
2
+ import { Checkbox } from '@blueprintjs/core';
3
+ import { useMemo } from 'react';
4
+ import { Controller, useFormContext } from 'react-hook-form';
3
5
  import { GroupPane } from '../../../elements/GroupPane';
6
+ import { Input2Controller } from '../../../elements/Input2Controller';
4
7
  import ReactTable from '../../../elements/ReactTable/ReactTable';
5
- import FormikInput from '../../../elements/formik/FormikInput';
6
- import FormikSelect from '../../../elements/formik/FormikSelect';
8
+ import { Select2 } from '../../../elements/Select2';
7
9
  const DataSelectionOptions = [
8
10
  { label: 'FT', value: 'ft' },
9
11
  { label: 'FID', value: 'fid' },
@@ -14,22 +16,22 @@ const DataSelectionOptions = [
14
16
  const GENERAL_LIST = [
15
17
  {
16
18
  label: 'Keep 1D',
17
- name: 'general.keep1D',
19
+ name: 'nmrLoaders.general.keep1D',
18
20
  fieldType: 'checkbox',
19
21
  },
20
22
  {
21
23
  label: 'Keep 2D',
22
- name: 'general.keep2D',
24
+ name: 'nmrLoaders.general.keep2D',
23
25
  fieldType: 'checkbox',
24
26
  },
25
27
  {
26
28
  label: 'Only Real',
27
- name: 'general.onlyReal',
29
+ name: 'nmrLoaders.general.onlyReal',
28
30
  fieldType: 'checkbox',
29
31
  },
30
32
  {
31
33
  label: 'Data Selection',
32
- name: 'general.dataSelection',
34
+ name: 'nmrLoaders.general.dataSelection',
33
35
  fieldType: 'select',
34
36
  options: DataSelectionOptions,
35
37
  },
@@ -37,49 +39,64 @@ const GENERAL_LIST = [
37
39
  const BRUKER_LIST = [
38
40
  {
39
41
  label: 'Processing Numbers',
40
- name: 'bruker.processingNumbers',
42
+ name: 'nmrLoaders.bruker.processingNumbers',
41
43
  fieldType: 'input',
42
44
  },
43
45
  {
44
46
  label: 'Experiment Numbers',
45
- name: 'bruker.experimentNumbers',
47
+ name: 'nmrLoaders.bruker.experimentNumbers',
46
48
  fieldType: 'input',
47
49
  },
48
50
  {
49
51
  label: 'Only First Processed Data',
50
- name: 'bruker.onlyFirstProcessedData',
52
+ name: 'nmrLoaders.bruker.onlyFirstProcessedData',
51
53
  fieldType: 'checkbox',
52
54
  },
53
55
  ];
54
- const COLUMNS = [
55
- {
56
- Header: '#',
57
- style: { width: '10px' },
58
- accessor: (_, index) => index + 1,
59
- },
60
- {
61
- Header: 'Feature',
62
- accessor: 'label',
63
- style: { width: '70%' },
64
- },
65
- {
66
- Header: ' ',
67
- Cell: ({ row }) => {
68
- const fieldType = row.original.fieldType;
69
- switch (fieldType) {
70
- case 'checkbox':
71
- return (_jsx(CheckBoxCell, { name: `nmrLoaders.${row.original.name}`, defaultValue: false }));
72
- case 'input':
73
- return (_jsx(FormikInput, { name: `nmrLoaders.${row.original.name}`, type: "string", style: { input: { width: '100%', padding: 0 } } }));
74
- case 'select':
75
- return (_jsx(FormikSelect, { name: `nmrLoaders.${row.original.name}`, style: { width: '100%' }, items: row.original.options }));
76
- default:
77
- return _jsx("span", {});
78
- }
79
- },
80
- },
81
- ];
82
56
  function ImportationFiltersTabContent() {
83
- return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "General", children: _jsx(ReactTable, { columns: COLUMNS, data: GENERAL_LIST }) }), _jsx(GroupPane, { text: "Bruker", children: _jsx(ReactTable, { columns: COLUMNS, data: BRUKER_LIST }) })] }));
57
+ const { register, control } = useFormContext();
58
+ const COLUMNS = useMemo(() => [
59
+ {
60
+ Header: '#',
61
+ style: { width: '10px' },
62
+ accessor: (_, index) => index + 1,
63
+ },
64
+ {
65
+ Header: 'Feature',
66
+ accessor: 'label',
67
+ style: { width: '70%' },
68
+ },
69
+ {
70
+ Header: ' ',
71
+ style: { textAlign: 'center' },
72
+ Cell: ({ row }) => {
73
+ const fieldType = row.original.fieldType;
74
+ const name = row.original.name;
75
+ switch (fieldType) {
76
+ case 'checkbox':
77
+ return _jsx(Checkbox, { style: { margin: 0 }, ...register(name) });
78
+ case 'input': {
79
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
80
+ }
81
+ case 'select': {
82
+ const data = row.original;
83
+ return (_jsx(Controller, { control: control, name: name, render: ({ field }) => {
84
+ const { onChange, value, ...otherProps } = field;
85
+ return (_jsx(Select2, { ...otherProps, items: data.options, itemTextKey: "label", itemValueKey: "value", selectedItemValue: field.value, onItemSelect: (item) => field.onChange(item.value), fill: true }));
86
+ } }));
87
+ }
88
+ default:
89
+ return _jsx("span", {});
90
+ }
91
+ },
92
+ },
93
+ ], [control, register]);
94
+ return (_jsxs(_Fragment, { children: [_jsx(GroupPane, { text: "General", children: _jsx(ReactTable, { columns: COLUMNS, data: GENERAL_LIST, rowStyle: {
95
+ hover: { backgroundColor: '#f7f7f7' },
96
+ active: { backgroundColor: '#f5f5f5' },
97
+ } }) }), _jsx(GroupPane, { text: "Bruker", children: _jsx(ReactTable, { columns: COLUMNS, data: BRUKER_LIST, rowStyle: {
98
+ hover: { backgroundColor: '#f7f7f7' },
99
+ active: { backgroundColor: '#f5f5f5' },
100
+ } }) })] }));
84
101
  }
85
102
  export default ImportationFiltersTabContent;
@@ -1,30 +1,27 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useFormikContext } from 'formik';
2
+ import { Checkbox, Classes } from '@blueprintjs/core';
3
3
  import { useCallback, useMemo } from 'react';
4
- import { FaPlus, FaTimes } from 'react-icons/fa';
4
+ import { useFormContext, useWatch } from 'react-hook-form';
5
+ import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
6
+ import { Button } from 'react-science/ui';
5
7
  import { useChartData } from '../../../context/ChartContext';
6
- import Button from '../../../elements/Button';
7
- import { CheckBoxCell } from '../../../elements/CheckBoxCell';
8
8
  import { GroupPane } from '../../../elements/GroupPane';
9
+ import { Input2Controller } from '../../../elements/Input2Controller';
9
10
  import Label from '../../../elements/Label';
10
11
  import ReactTable from '../../../elements/ReactTable/ReactTable';
11
- import FormikCheckBox from '../../../elements/formik/FormikCheckBox';
12
- import FormikInput from '../../../elements/formik/FormikInput';
13
12
  import { convertPathArrayToString } from '../../../utility/convertPathArrayToString';
14
13
  import { getSpectraObjectPaths } from '../../../utility/getSpectraObjectPaths';
15
- const styles = {
16
- input: {
17
- width: '100%',
18
- },
19
- column: {
20
- padding: '2px',
21
- },
22
- };
14
+ import { Section } from '../GeneralSettings';
15
+ function getKeyPath(index, key) {
16
+ return `infoBlock.fields.${index}.${key}`;
17
+ }
23
18
  function InfoBlockTabContent() {
24
- const { values, setFieldValue } = useFormikContext();
19
+ const { control, setValue, register } = useFormContext();
25
20
  const { data } = useChartData();
26
21
  const { datalist, paths } = useMemo(() => getSpectraObjectPaths(data), [data]);
27
- const fields = values?.infoBlock.fields;
22
+ const fields = useWatch({
23
+ name: 'infoBlock.fields',
24
+ }) || [];
28
25
  const addHandler = useCallback((data, index) => {
29
26
  let columns = [];
30
27
  const emptyField = {
@@ -38,62 +35,65 @@ function InfoBlockTabContent() {
38
35
  else {
39
36
  columns.push(emptyField);
40
37
  }
41
- void setFieldValue('infoBlock.fields', columns);
42
- }, [setFieldValue]);
38
+ setValue('infoBlock.fields', columns);
39
+ }, [setValue]);
43
40
  const deleteHandler = useCallback((data, index) => {
44
41
  const _fields = data.filter((_, columnIndex) => columnIndex !== index);
45
- void setFieldValue('infoBlock.fields', _fields);
46
- }, [setFieldValue]);
42
+ setValue('infoBlock.fields', _fields);
43
+ }, [setValue]);
47
44
  const COLUMNS = useMemo(() => [
48
45
  {
49
46
  Header: '#',
50
- style: { width: '25px', ...styles.column },
47
+ style: { width: '25px', textAlign: 'center' },
51
48
  accessor: (_, index) => index + 1,
52
49
  },
53
50
  {
54
51
  Header: 'Label',
55
- style: { padding: 0, ...styles.column },
56
52
  Cell: ({ row }) => {
57
- return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.label`, style: { input: styles.input } }));
53
+ const name = getKeyPath(row.index, 'label');
54
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
58
55
  },
59
56
  },
60
57
  {
61
58
  Header: 'Field',
62
- style: { padding: 0, ...styles.column },
63
59
  Cell: ({ row }) => {
64
- return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => paths?.[key] || key, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
60
+ const name = getKeyPath(row.index, 'jpath');
61
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' }, filterItems: datalist, mapOnChangeValue: (value) => paths?.[value.trim()] || value, mapValue: convertPathArrayToString }));
65
62
  },
66
63
  },
67
64
  {
68
65
  Header: 'Format',
69
- style: { padding: 0, ...styles.column },
70
66
  Cell: ({ row }) => {
71
- return (_jsx(FormikInput, { name: `infoBlock.fields.${row.index}.format`, style: { input: styles.input } }));
67
+ const name = getKeyPath(row.index, 'format');
68
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
72
69
  },
73
70
  },
74
71
  {
75
72
  Header: 'Visible',
76
- style: { width: '30px', ...styles.column },
77
- Cell: ({ row }) => (_jsx(CheckBoxCell, { name: `infoBlock.fields.${row.index}.visible`, defaultValue: true })),
73
+ style: { width: '30px', textAlign: 'center' },
74
+ Cell: ({ row }) => (_jsx(Checkbox, { style: { margin: 0 }, ...register(getKeyPath(row.index, 'visible')) })),
78
75
  },
79
76
  {
80
77
  Header: '',
81
- style: { width: '70px', ...styles.column },
78
+ style: { width: '60px' },
82
79
  id: 'add-button',
83
80
  Cell: ({ data, row }) => {
84
81
  const record = row.original;
85
- return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: _jsx(FaTimes, {}) }))] }));
82
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-evenly' }, children: [_jsx(Button, { small: true, intent: "success", outlined: true, tooltipProps: { content: '', disabled: true }, onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, { className: Classes.ICON }) }), !record?.name && (_jsx(Button, { small: true, outlined: true, intent: "danger", tooltipProps: { content: '', disabled: true }, onClick: () => deleteHandler(data, row.index), children: _jsx(FaRegTrashAlt, { className: Classes.ICON }) }))] }));
86
83
  },
87
84
  },
88
- ], [addHandler, datalist, deleteHandler, paths]);
89
- return (_jsxs("div", { children: [_jsx(Label, { title: "Display spectrum info block", style: { wrapper: { padding: '10px 0' } }, children: _jsx(FormikCheckBox, { name: "infoBlock.visible" }) }), _jsx(GroupPane, { text: "Fields", renderHeader: (text) => {
85
+ ], [addHandler, control, datalist, deleteHandler, paths, register]);
86
+ return (_jsxs("div", { children: [_jsx(Label, { title: "Display spectrum info block", style: { wrapper: { padding: '10px 0' } }, children: _jsx(Checkbox, { style: { margin: 0 }, ...register('infoBlock.visible') }) }), _jsx(GroupPane, { text: "Fields", renderHeader: (text) => {
90
87
  return (_jsx(FieldsBlockHeader, { text: text, onAdd: () => addHandler(fields, 0) }));
91
88
  }, children: _jsx(ReactTable, { style: {
92
- 'table, table td, table th': { border: 'none' },
93
- 'table thead': { borderBottom: '1px solid #f9f9f9' },
89
+ 'thead tr th': { zIndex: 1 },
90
+ td: { padding: 0 },
91
+ }, rowStyle: {
92
+ hover: { backgroundColor: '#f7f7f7' },
93
+ active: { backgroundColor: '#f5f5f5' },
94
94
  }, data: fields, columns: COLUMNS, emptyDataRowText: "No Fields" }) })] }));
95
95
  }
96
96
  function FieldsBlockHeader({ onAdd, text }) {
97
- return (_jsxs("div", { className: "section-header", style: { display: 'flex' }, children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button.Done, { fill: "outline", size: "xSmall", onClick: onAdd, children: "Add Field" })] }));
97
+ return (_jsxs(Section, { children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button, { outlined: true, small: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: onAdd, children: "Add Field" })] }));
98
98
  }
99
99
  export default InfoBlockTabContent;
@@ -1,22 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useFormikContext } from 'formik';
2
+ import { Classes } from '@blueprintjs/core';
3
3
  import { useCallback, useMemo } from 'react';
4
- import { FaPlus, FaTimes } from 'react-icons/fa';
5
- import Button from '../../../elements/Button';
4
+ import { useFormContext, useWatch } from 'react-hook-form';
5
+ import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
6
+ import { Button } from 'react-science/ui';
6
7
  import { GroupPane } from '../../../elements/GroupPane';
8
+ import { Input2Controller } from '../../../elements/Input2Controller';
9
+ import { NumberInput2Controller } from '../../../elements/NumberInput2Controller';
7
10
  import ReactTable from '../../../elements/ReactTable/ReactTable';
8
- import FormikInput from '../../../elements/formik/FormikInput';
9
- const styles = {
10
- input: {
11
- width: '100%',
12
- },
13
- column: {
14
- padding: '2px',
15
- },
16
- };
11
+ import { Section } from '../GeneralSettings';
12
+ function getKeyPath(index, key) {
13
+ return `nuclei.${index}.${key}`;
14
+ }
17
15
  function NucleiTabContent() {
18
- const { values, setFieldValue } = useFormikContext();
19
- const fields = values?.nuclei || [];
16
+ const { control, setValue } = useFormContext();
17
+ const fields = useWatch({
18
+ name: 'nuclei',
19
+ }) || [];
20
20
  const addHandler = useCallback((data, index) => {
21
21
  let columns = [];
22
22
  const emptyField = {
@@ -30,70 +30,78 @@ function NucleiTabContent() {
30
30
  else {
31
31
  columns.push(emptyField);
32
32
  }
33
- void setFieldValue('nuclei', columns);
34
- }, [setFieldValue]);
33
+ setValue('nuclei', columns);
34
+ }, [setValue]);
35
35
  const deleteHandler = useCallback((data, index) => {
36
36
  const _fields = data.filter((_, columnIndex) => columnIndex !== index);
37
- void setFieldValue('nuclei', _fields);
38
- }, [setFieldValue]);
37
+ setValue('nuclei', _fields);
38
+ }, [setValue]);
39
39
  const COLUMNS = useMemo(() => [
40
40
  {
41
41
  Header: '#',
42
- style: { width: '25px', ...styles.column },
42
+ style: { width: '25px', textAlign: 'center' },
43
43
  accessor: (_, index) => index + 1,
44
44
  },
45
45
  {
46
46
  Header: 'Nucleus',
47
- style: { padding: 0, ...styles.column },
47
+ style: { padding: 0 },
48
48
  Cell: ({ row }) => {
49
- return (_jsx(FormikInput, { name: `nuclei.${row.index}.nucleus`, style: { input: styles.input } }));
49
+ const name = getKeyPath(row.index, 'nucleus');
50
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
50
51
  },
51
52
  },
52
53
  {
53
54
  Header: 'δ (ppm)',
54
- style: { padding: 0, ...styles.column },
55
+ style: { padding: 0 },
55
56
  Cell: ({ row }) => {
56
- return (_jsx(FormikInput, { name: `nuclei.${row.index}.ppmFormat`, style: { input: styles.input } }));
57
+ const name = getKeyPath(row.index, 'ppmFormat');
58
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
57
59
  },
58
60
  },
59
61
  {
60
62
  Header: 'Coupling (Hz)',
61
- style: { padding: 0, ...styles.column },
63
+ style: { padding: 0 },
62
64
  Cell: ({ row }) => {
63
- return (_jsx(FormikInput, { name: `nuclei.${row.index}.hzFormat`, style: { input: styles.input } }));
65
+ const name = getKeyPath(row.index, 'hzFormat');
66
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
64
67
  },
65
68
  },
66
69
  {
67
70
  Header: 'Axis from',
68
- style: { padding: 0, ...styles.column },
71
+ style: { padding: 0 },
69
72
  Cell: ({ row }) => {
70
- return (_jsx(FormikInput, { name: `nuclei.${row.index}.axisFrom`, style: { input: styles.input }, type: "number" }));
73
+ const name = getKeyPath(row.index, 'axisFrom');
74
+ return (_jsx(NumberInput2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' }, fill: true }));
71
75
  },
72
76
  },
73
77
  {
74
78
  Header: 'Axis to',
75
- style: { padding: 0, ...styles.column },
79
+ style: { padding: 0 },
76
80
  Cell: ({ row }) => {
77
- return (_jsx(FormikInput, { name: `nuclei.${row.index}.axisTo`, style: { input: styles.input }, type: "number" }));
81
+ const name = getKeyPath(row.index, 'axisTo');
82
+ return (_jsx(NumberInput2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' }, fill: true }));
78
83
  },
79
84
  },
80
85
  {
81
86
  Header: '',
82
- style: { width: '70px', ...styles.column },
83
- id: 'add-button',
87
+ style: { width: '60px' },
88
+ id: 'op-buttons',
84
89
  Cell: ({ data, row }) => {
85
- return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, {}) }), _jsx(Button.Danger, { fill: "outline", onClick: () => deleteHandler(data, row.index), children: _jsx(FaTimes, {}) })] }));
90
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-evenly' }, children: [_jsx(Button, { small: true, outlined: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: () => addHandler(data, row.index + 1), children: _jsx(FaPlus, { className: Classes.ICON }) }), _jsx(Button, { small: true, outlined: true, intent: "danger", tooltipProps: { content: '', disabled: true }, onClick: () => deleteHandler(data, row.index), children: _jsx(FaRegTrashAlt, { className: Classes.ICON }) })] }));
86
91
  },
87
92
  },
88
- ], [addHandler, deleteHandler]);
93
+ ], [addHandler, control, deleteHandler]);
89
94
  return (_jsx("div", { children: _jsx(GroupPane, { text: "Number formatting for crosshair and info line and axis domain", renderHeader: (text) => {
90
95
  return (_jsx(FieldsBlockHeader, { text: text, onAdd: () => addHandler(fields, 0) }));
91
96
  }, children: _jsx(ReactTable, { style: {
92
- 'table, table td, table th': { border: 'none' },
93
- 'table thead': { borderBottom: '1px solid #f9f9f9' },
97
+ 'thead tr th': { zIndex: 1 },
98
+ td: { padding: 0 },
99
+ }, rowStyle: {
100
+ hover: { backgroundColor: '#f7f7f7' },
101
+ active: { backgroundColor: '#f5f5f5' },
94
102
  }, data: fields, columns: COLUMNS, emptyDataRowText: "No Nucleus" }) }) }));
95
103
  }
96
104
  function FieldsBlockHeader({ onAdd, text }) {
97
- return (_jsxs("div", { className: "section-header", style: { display: 'flex' }, children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button.Done, { fill: "outline", size: "xSmall", onClick: onAdd, children: "Add nuclei preferences" })] }));
105
+ return (_jsxs(Section, { children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button, { small: true, outlined: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: onAdd, children: "Add nuclei preferences" })] }));
98
106
  }
99
107
  export default NucleiTabContent;
@@ -1,19 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Tab, Tabs } from '@blueprintjs/core';
3
- import { useFormikContext } from 'formik';
4
- import { CheckBoxCell } from '../../../elements/CheckBoxCell';
2
+ import { Checkbox, Tab, Tabs } from '@blueprintjs/core';
3
+ import { useFormContext, useWatch } from 'react-hook-form';
5
4
  import IsotopesViewer from '../../../elements/IsotopesViewer';
6
5
  import Label from '../../../elements/Label';
7
6
  import ReactTable from '../../../elements/ReactTable/ReactTable';
8
- import FormikCheckBox from '../../../elements/formik/FormikCheckBox';
9
7
  function OnLoadProcessingTabContent() {
10
- const { values } = useFormikContext();
11
- const isExperimentalFeatures = values.display?.general?.experimentalFeatures?.display || false;
12
- return (_jsxs("div", { children: [_jsx(Label, { title: "Enable auto processing on load", style: { wrapper: { padding: '10px 0' } }, children: _jsx(FormikCheckBox, { name: "onLoadProcessing.autoProcessing" }) }), isExperimentalFeatures && _jsx(AutoProcessingFilters, {})] }));
8
+ const { register, control } = useFormContext();
9
+ const isExperimentalFeatures = useWatch({
10
+ control,
11
+ name: 'display.general.experimentalFeatures.display',
12
+ }) || false;
13
+ return (_jsxs("div", { children: [_jsx(Label, { title: "Enable auto processing on load", style: { wrapper: { padding: '10px 0' } }, children: _jsx(Checkbox, { style: { margin: 0 }, ...register('onLoadProcessing.autoProcessing'), defaultChecked: false }) }), isExperimentalFeatures && _jsx(AutoProcessingFilters, {})] }));
13
14
  }
14
15
  function AutoProcessingFilters() {
15
- const { values } = useFormikContext();
16
- const autoProcessingFilters = values?.onLoadProcessing?.filters || {};
16
+ const { getValues } = useFormContext();
17
+ const autoProcessingFilters = getValues('onLoadProcessing.filters') || {};
17
18
  const tabItems = Object.keys(autoProcessingFilters).map((nucleus) => ({
18
19
  id: nucleus,
19
20
  title: _jsx(IsotopesViewer, { value: nucleus }),
@@ -22,6 +23,7 @@ function AutoProcessingFilters() {
22
23
  return (_jsx("div", { style: { width: '100%', overflow: 'hidden' }, children: _jsx(Tabs, { children: tabItems.map((item) => (_jsx(Tab, { id: item.id, title: item.title, panel: item.content }, item.id))) }) }));
23
24
  }
24
25
  function FiltersTable({ data, nucleus }) {
26
+ const { register } = useFormContext();
25
27
  const COLUMNS = [
26
28
  {
27
29
  index: 1,
@@ -37,9 +39,12 @@ function FiltersTable({ data, nucleus }) {
37
39
  {
38
40
  index: 2,
39
41
  Header: 'Enable',
40
- Cell: ({ row }) => (_jsx(CheckBoxCell, { name: `onLoadProcessing.filters.${nucleus}.${row.index}.flag`, defaultValue: false })),
42
+ Cell: ({ row }) => (_jsx(Checkbox, { style: { margin: 0 }, ...register(`onLoadProcessing.filters.${nucleus}.${row.index}.flag`), defaultChecked: false })),
41
43
  },
42
44
  ];
43
- return _jsx(ReactTable, { columns: COLUMNS, data: data });
45
+ return (_jsx(ReactTable, { columns: COLUMNS, data: data, rowStyle: {
46
+ hover: { backgroundColor: '#f7f7f7' },
47
+ active: { backgroundColor: '#f5f5f5' },
48
+ } }));
44
49
  }
45
50
  export default OnLoadProcessingTabContent;
@@ -1,47 +1,44 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useFormikContext } from 'formik';
2
+ import { Classes } from '@blueprintjs/core';
3
3
  import { useCallback, useMemo } from 'react';
4
- import { FaPlus, FaTimes } from 'react-icons/fa';
4
+ import { useFormContext, useWatch } from 'react-hook-form';
5
+ import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
6
+ import { Button } from 'react-science/ui';
5
7
  import { useChartData } from '../../../context/ChartContext';
6
- import Button from '../../../elements/Button';
8
+ import { ColorPickerDropdownController } from '../../../elements/ColorPickerDropdownController';
7
9
  import { GroupPane } from '../../../elements/GroupPane';
10
+ import { Input2Controller } from '../../../elements/Input2Controller';
8
11
  import ReactTable from '../../../elements/ReactTable/ReactTable';
9
- import FormikColorPickerDropdown from '../../../elements/formik/FormikColorPickerDropdown';
10
- import FormikInput from '../../../elements/formik/FormikInput';
11
12
  import { convertPathArrayToString } from '../../../utility/convertPathArrayToString';
12
13
  import { getSpectraObjectPaths } from '../../../utility/getSpectraObjectPaths';
13
- const styles = {
14
- input: {
15
- width: '100%',
16
- },
17
- column: {
18
- padding: '2px',
19
- },
20
- };
14
+ import { Section } from '../GeneralSettings';
21
15
  const colorInputStyle = {
22
- padding: 0,
23
16
  minWidth: '80px',
24
17
  width: '80px',
25
- ...styles.column,
26
18
  };
27
19
  function getObjectKey(key) {
28
20
  return `spectraColors.${key}`;
29
21
  }
22
+ function getKeyPath(key, index, fieldKey) {
23
+ return `${getObjectKey(key)}.${index}.${fieldKey}`;
24
+ }
30
25
  function SpectraColorsTabContent() {
31
- const { values, setFieldValue } = useFormikContext();
26
+ const { setValue } = useFormContext();
32
27
  const { data } = useChartData();
33
28
  const { datalist, paths } = useMemo(() => getSpectraObjectPaths(data), [data]);
34
- const { oneDimension = [], twoDimensions = [] } = values?.spectraColors || {};
29
+ const { oneDimension = [], twoDimensions = [] } = useWatch({
30
+ name: 'spectraColors',
31
+ }) || {};
35
32
  const addHandler = useCallback((data, index, key) => {
36
33
  let columns = [];
37
34
  const emptyField = key === 'oneDimension'
38
35
  ? {
39
- value: null,
36
+ value: '',
40
37
  jpath: ['info', 'experiment'],
41
38
  color: 'red',
42
39
  }
43
40
  : {
44
- value: null,
41
+ value: '',
45
42
  jpath: ['info', 'experiment'],
46
43
  positiveColor: 'red',
47
44
  negativeColor: 'blue',
@@ -52,55 +49,56 @@ function SpectraColorsTabContent() {
52
49
  else {
53
50
  columns.push(emptyField);
54
51
  }
55
- void setFieldValue(getObjectKey(key), columns);
56
- }, [setFieldValue]);
52
+ setValue(getObjectKey(key), columns);
53
+ }, [setValue]);
57
54
  const deleteHandler = useCallback((data, index, key) => {
58
55
  const _fields = data.filter((_, columnIndex) => columnIndex !== index);
59
- void setFieldValue(getObjectKey(key), _fields);
60
- }, [setFieldValue]);
56
+ setValue(getObjectKey(key), _fields);
57
+ }, [setValue]);
61
58
  return (_jsxs("div", { children: [_jsx(SpectraColorsFields, { groupLabel: "One dimension", baseObjectPath: "oneDimension", data: oneDimension, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler }), _jsx(SpectraColorsFields, { groupLabel: "Two dimensions", baseObjectPath: "twoDimensions", data: twoDimensions, datalist: datalist, paths: paths, onAdd: addHandler, onDelete: deleteHandler })] }));
62
59
  }
63
60
  function SpectraColorsFields(props) {
64
61
  const { onAdd, onDelete, datalist, paths, data, baseObjectPath, groupLabel } = props;
62
+ const { control } = useFormContext();
65
63
  const COLUMNS = useMemo(() => {
66
- const objectPath = getObjectKey(baseObjectPath);
67
64
  const baseColumns = [
68
65
  {
69
66
  Header: '#',
70
- style: { width: '25px', ...styles.column },
67
+ style: { width: '25px', textAlign: 'center' },
71
68
  accessor: (_, index) => index + 1,
72
69
  },
73
70
  {
74
71
  Header: 'Field',
75
- style: { padding: 0, ...styles.column },
76
72
  Cell: ({ row }) => {
77
- return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.jpath`, style: { input: styles.input }, mapOnChangeValue: (key) => {
78
- return paths?.[key.toString().trim()] || key;
79
- }, mapValue: (paths) => convertPathArrayToString(paths), datalist: datalist }));
73
+ const name = getKeyPath(baseObjectPath, row.index, 'jpath');
74
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, filterItems: datalist, mapOnChangeValue: (value) => paths?.[value.trim()] || value, mapValue: convertPathArrayToString, style: { backgroundColor: 'transparent' } }));
80
75
  },
81
76
  },
82
77
  {
83
78
  Header: 'Value',
84
- style: { padding: 0, ...styles.column },
85
79
  Cell: ({ row }) => {
86
- return (_jsx(FormikInput, { name: `${objectPath}.${row.index}.value`, style: { input: styles.input } }));
80
+ const name = getKeyPath(baseObjectPath, row.index, 'value');
81
+ return (_jsx(Input2Controller, { control: control, name: name, noShadowBox: true, style: { backgroundColor: 'transparent' } }));
87
82
  },
88
83
  },
89
84
  ];
90
85
  const operationsField = {
91
86
  Header: '',
92
- style: { width: '70px', ...styles.column },
87
+ style: { width: '60px' },
93
88
  id: 'operation-button',
94
89
  Cell: ({ data, row }) => {
95
90
  const record = row.original;
96
- return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-around' }, children: [_jsx(Button.Done, { fill: "outline", onClick: () => onAdd(data, row.index + 1, baseObjectPath), children: _jsx(FaPlus, {}) }), !record?.name && (_jsx(Button.Danger, { fill: "outline", onClick: () => onDelete(data, row.index, baseObjectPath), children: _jsx(FaTimes, {}) }))] }));
91
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'space-evenly' }, children: [_jsx(Button, { small: true, outlined: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: () => onAdd(data, row.index + 1, baseObjectPath), children: _jsx(FaPlus, { className: Classes.ICON }) }), !record?.name && (_jsx(Button, { small: true, outlined: true, intent: "danger", tooltipProps: { content: '', disabled: true }, onClick: () => onDelete(data, row.index, baseObjectPath), children: _jsx(FaRegTrashAlt, { className: Classes.ICON }) }))] }));
97
92
  },
98
93
  };
99
94
  if (baseObjectPath === 'oneDimension') {
100
95
  const colorField = {
101
96
  Header: 'Color',
102
97
  style: colorInputStyle,
103
- Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.color` })),
98
+ Cell: ({ row }) => {
99
+ const name = getKeyPath(baseObjectPath, row.index, 'color');
100
+ return (_jsx(ColorPickerDropdownController, { control: control, name: name }));
101
+ },
104
102
  };
105
103
  return [...baseColumns, colorField, operationsField];
106
104
  }
@@ -108,24 +106,33 @@ function SpectraColorsFields(props) {
108
106
  {
109
107
  Header: 'Positive color',
110
108
  style: colorInputStyle,
111
- Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.positiveColor` })),
109
+ Cell: ({ row }) => {
110
+ const name = getKeyPath(baseObjectPath, row.index, 'positiveColor');
111
+ return (_jsx(ColorPickerDropdownController, { control: control, name: name }));
112
+ },
112
113
  },
113
114
  {
114
115
  Header: 'Negative color',
115
116
  style: colorInputStyle,
116
- Cell: ({ row }) => (_jsx(FormikColorPickerDropdown, { name: `${objectPath}.${row.index}.negativeColor` })),
117
+ Cell: ({ row }) => {
118
+ const name = getKeyPath(baseObjectPath, row.index, 'negativeColor');
119
+ return (_jsx(ColorPickerDropdownController, { control: control, name: name }));
120
+ },
117
121
  },
118
122
  ];
119
123
  return [...baseColumns, ...colorFields, operationsField];
120
- }, [baseObjectPath, datalist, onAdd, onDelete, paths]);
124
+ }, [baseObjectPath, control, datalist, onAdd, onDelete, paths]);
121
125
  return (_jsx(GroupPane, { text: groupLabel, renderHeader: (text) => {
122
126
  return (_jsx(FieldsBlockHeader, { text: text, onAdd: () => onAdd(data, 0, baseObjectPath) }));
123
127
  }, children: _jsx(ReactTable, { style: {
124
- 'table, table td, table th': { border: 'none' },
125
- 'table thead': { borderBottom: '1px solid #f9f9f9' },
128
+ 'thead tr th': { zIndex: 1 },
129
+ td: { padding: 0 },
130
+ }, rowStyle: {
131
+ hover: { backgroundColor: '#f7f7f7' },
132
+ active: { backgroundColor: '#f5f5f5' },
126
133
  }, data: data, columns: COLUMNS, emptyDataRowText: "No Fields" }) }));
127
134
  }
128
135
  function FieldsBlockHeader({ onAdd, text }) {
129
- return (_jsxs("div", { className: "section-header", style: { display: 'flex' }, children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button.Done, { fill: "outline", size: "xSmall", onClick: onAdd, children: "Add custom color" })] }));
136
+ return (_jsxs(Section, { children: [_jsx("p", { style: { flex: 1 }, children: text }), _jsx(Button, { small: true, outlined: true, intent: "success", tooltipProps: { content: '', disabled: true }, onClick: onAdd, children: "Add custom color" })] }));
130
137
  }
131
138
  export default SpectraColorsTabContent;