nmrium 1.12.0 → 2.0.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.
- package/lib/component/1d/database/DatabaseSpectrum.d.ts.map +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.d.ts.map +1 -1
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +3 -17
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js.map +1 -1
- package/lib/component/2d/ft/Contours.d.ts.map +1 -1
- package/lib/component/2d/ft/Contours.js +10 -12
- package/lib/component/2d/ft/Contours.js.map +1 -1
- package/lib/component/elements/ActionsButtonsPopover.js +1 -1
- package/lib/component/elements/ActionsButtonsPopover.js.map +1 -1
- package/lib/component/hooks/reduce2DSpectrum.d.ts +4 -0
- package/lib/component/hooks/reduce2DSpectrum.d.ts.map +1 -0
- package/lib/component/hooks/reduce2DSpectrum.js +60 -0
- package/lib/component/hooks/reduce2DSpectrum.js.map +1 -0
- package/lib/component/hooks/use2DReducer.d.ts +14 -0
- package/lib/component/hooks/use2DReducer.d.ts.map +1 -0
- package/lib/component/hooks/use2DReducer.js +30 -0
- package/lib/component/hooks/use2DReducer.js.map +1 -0
- package/lib/component/hooks/useCreateNmriumZip.d.ts +3 -0
- package/lib/component/hooks/useCreateNmriumZip.d.ts.map +1 -0
- package/lib/component/hooks/useCreateNmriumZip.js +28 -0
- package/lib/component/hooks/useCreateNmriumZip.js.map +1 -0
- package/lib/component/hooks/useExport.d.ts +8 -5
- package/lib/component/hooks/useExport.d.ts.map +1 -1
- package/lib/component/hooks/useExport.js +4 -21
- package/lib/component/hooks/useExport.js.map +1 -1
- package/lib/component/loader/useLoadFiles.d.ts.map +1 -1
- package/lib/component/loader/useLoadFiles.js +4 -5
- package/lib/component/loader/useLoadFiles.js.map +1 -1
- package/lib/component/main/InnerNMRium.d.ts.map +1 -1
- package/lib/component/main/InnerNMRium.js +2 -2
- package/lib/component/main/InnerNMRium.js.map +1 -1
- package/lib/component/main/NMRium.d.ts +48 -3
- package/lib/component/main/NMRium.d.ts.map +1 -1
- package/lib/component/main/NMRium.js.map +1 -1
- package/lib/component/main/NMRiumRefAPI.d.ts +2 -0
- package/lib/component/main/NMRiumRefAPI.d.ts.map +1 -1
- package/lib/component/main/NMRiumRefAPI.js +4 -1
- package/lib/component/main/NMRiumRefAPI.js.map +1 -1
- package/lib/component/main/NMRiumStateProvider.d.ts +5 -2
- package/lib/component/main/NMRiumStateProvider.d.ts.map +1 -1
- package/lib/component/main/NMRiumStateProvider.js +36 -30
- package/lib/component/main/NMRiumStateProvider.js.map +1 -1
- package/lib/component/modal/LoadJCAMPModal.js +4 -4
- package/lib/component/modal/LoadJCAMPModal.js.map +1 -1
- package/lib/component/modal/setting/general_settings.d.ts.map +1 -1
- package/lib/component/modal/setting/general_settings.js +3 -3
- package/lib/component/modal/setting/general_settings.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts +4 -2
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +46 -29
- package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js +10 -2
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +1353 -6
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js +43 -32
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.d.ts +1353 -6
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.js +88 -83
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +466 -0
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.js +59 -0
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js +32 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.js +80 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js +37 -9
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.js +58 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.js +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.js +65 -112
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +920 -188
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.js +3 -3
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.js +142 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js +112 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +1354 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.js +38 -0
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table.d.ts +68 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table.js +133 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.d.ts +10 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.js +31 -0
- package/lib/component/modal/setting/tanstack_general_settings/ui/table_section.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.d.ts +71 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.js +67 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.d.ts → validation/check_unique_by_key.d.ts} +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/check_unique_by_key.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.js → validation/check_unique_by_key.js} +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/check_unique_by_key.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.d.ts +11 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.js +20 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.d.ts +32 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.js +11 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.d.ts +2 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.js +3 -6
- package/lib/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.d.ts +12 -4
- package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.js +4 -3
- package/lib/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.d.ts +20 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.js +12 -4
- package/lib/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.d.ts +54 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.js +22 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.d.ts +55 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.js +18 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.d.ts +32 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.js +34 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/utils.d.ts +13 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/utils.d.ts.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/utils.js +20 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation/utils.js.map +1 -0
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +255 -39
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation.js +16 -27
- package/lib/component/modal/setting/tanstack_general_settings/validation.js.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.d.ts.map +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js +27 -0
- package/lib/component/panels/MoleculesPanel/MoleculeStructure.js.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.d.ts.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js +3 -2
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.js.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts +2 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +8 -3
- package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js.map +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js +1 -1
- package/lib/component/panels/SpectraPanel/base/setting/SpectrumSetting.js.map +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.d.ts.map +1 -1
- package/lib/component/panels/databasePanel/DatabasePanel.js +2 -2
- package/lib/component/panels/databasePanel/DatabasePanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +26 -33
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
- package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
- package/lib/component/reducer/Reducer.d.ts.map +1 -1
- package/lib/component/reducer/Reducer.js +1 -3
- package/lib/component/reducer/Reducer.js.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -4
- package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +14 -5
- package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
- package/lib/component/reducer/actions/LoadAction.d.ts +1 -4
- package/lib/component/reducer/actions/LoadAction.d.ts.map +1 -1
- package/lib/component/reducer/actions/LoadAction.js +8 -17
- package/lib/component/reducer/actions/LoadAction.js.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/MoleculeActions.js +3 -0
- package/lib/component/reducer/actions/MoleculeActions.js.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts +5 -1
- package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/SpectraActions.js +4 -2
- package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
- package/lib/component/reducer/preferences/actions/applyGeneralPreferences.d.ts.map +1 -1
- package/lib/component/reducer/preferences/actions/applyGeneralPreferences.js.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -3
- package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +9 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/PredictionManager.d.ts.map +1 -1
- package/lib/data/PredictionManager.js +3 -0
- package/lib/data/PredictionManager.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts +7 -6
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +22 -6
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -10
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -1
- package/lib/data/molecules/Molecule.d.ts.map +1 -1
- package/lib/data/molecules/Molecule.js +9 -7
- package/lib/data/molecules/Molecule.js.map +1 -1
- package/lib/data/molecules/MoleculeManager.d.ts +0 -6
- package/lib/data/molecules/MoleculeManager.d.ts.map +1 -1
- package/lib/data/molecules/MoleculeManager.js +25 -25
- package/lib/data/molecules/MoleculeManager.js.map +1 -1
- package/lib/versionInfo.d.ts.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/lib/versionInfo.js.map +1 -1
- package/package.json +30 -29
- package/src/component/1d/database/DatabaseSpectrum.tsx +3 -1
- package/src/component/1d-2d/components/SpectrumInfoBlock.tsx +10 -22
- package/src/component/2d/ft/Contours.tsx +14 -27
- package/src/component/elements/ActionsButtonsPopover.tsx +1 -1
- package/src/component/hooks/reduce2DSpectrum.ts +98 -0
- package/src/component/hooks/use2DReducer.tsx +56 -0
- package/src/component/hooks/useCreateNmriumZip.ts +37 -0
- package/src/component/hooks/useExport.tsx +16 -31
- package/src/component/loader/useLoadFiles.ts +6 -10
- package/src/component/main/InnerNMRium.tsx +4 -2
- package/src/component/main/NMRium.tsx +50 -2
- package/src/component/main/NMRiumRefAPI.ts +7 -1
- package/src/component/main/NMRiumStateProvider.tsx +57 -35
- package/src/component/modal/LoadJCAMPModal.tsx +4 -4
- package/src/component/modal/setting/general_settings.tsx +4 -3
- package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +80 -54
- package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.tsx +48 -1
- package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.tsx +75 -68
- package/src/component/modal/setting/tanstack_general_settings/general_settings_dialog_header_actions_buttons.tsx +165 -184
- package/src/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.ts +95 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.tsx +81 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/database_tab.tsx +210 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.tsx +48 -8
- package/src/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.tsx +150 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/general_tab.tsx +3 -3
- package/src/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.tsx +164 -233
- package/src/component/modal/setting/tanstack_general_settings/tabs/panels_tab.tsx +10 -10
- package/src/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.tsx +352 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.tsx +248 -0
- package/src/component/modal/setting/tanstack_general_settings/tabs/tools_tab.tsx +155 -0
- package/src/component/modal/setting/tanstack_general_settings/ui/table.tsx +163 -0
- package/src/component/modal/setting/tanstack_general_settings/ui/table_section.tsx +52 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/auto_processing_tab_validation.ts +73 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/database_tab_validation.ts +23 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/external_apis_validation.ts +12 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/general_tab_validation.ts +4 -6
- package/src/component/modal/setting/tanstack_general_settings/validation/nuclei_tab_validation.ts +11 -8
- package/src/component/modal/setting/tanstack_general_settings/validation/panels_tab_validation.ts +17 -9
- package/src/component/modal/setting/tanstack_general_settings/validation/spectra_colors_tab_validation.ts +29 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/title_block_tab_validation.ts +26 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/tools_tab_validation.ts +34 -0
- package/src/component/modal/setting/tanstack_general_settings/validation/utils.ts +30 -0
- package/src/component/modal/setting/tanstack_general_settings/validation.ts +16 -31
- package/src/component/panels/MoleculesPanel/MoleculeStructure.tsx +35 -0
- package/src/component/panels/SpectraPanel/base/setting/Spectrum1DSetting.tsx +3 -2
- package/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx +12 -4
- package/src/component/panels/SpectraPanel/base/setting/SpectrumSetting.tsx +1 -1
- package/src/component/panels/databasePanel/DatabasePanel.tsx +6 -4
- package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +34 -49
- package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -1
- package/src/component/reducer/Reducer.ts +1 -3
- package/src/component/reducer/actions/FiltersActions.ts +16 -10
- package/src/component/reducer/actions/LoadAction.ts +12 -27
- package/src/component/reducer/actions/MoleculeActions.ts +3 -0
- package/src/component/reducer/actions/SpectraActions.ts +14 -6
- package/src/component/reducer/actions/ToolsActions.ts +3 -1
- package/src/component/reducer/preferences/actions/applyGeneralPreferences.ts +1 -2
- package/src/component/reducer/preferences/preferencesReducer.ts +4 -4
- package/src/component/workspaces/workspaceDefaultProperties.ts +9 -0
- package/src/data/PredictionManager.ts +3 -0
- package/src/data/data2d/Spectrum2D/contours.ts +28 -12
- package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +1 -17
- package/src/data/molecules/Molecule.ts +17 -7
- package/src/data/molecules/MoleculeManager.ts +31 -29
- package/src/versionInfo.ts +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/utils/checkUniqueByKey.d.ts.map +0 -1
- package/lib/component/modal/setting/tanstack_general_settings/utils/checkUniqueByKey.js.map +0 -1
- /package/src/component/modal/setting/tanstack_general_settings/{utils/checkUniqueByKey.ts → validation/check_unique_by_key.ts} +0 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { Classes } from '@blueprintjs/core';
|
|
2
|
+
import { useField } from '@tanstack/react-form';
|
|
3
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
|
+
import { FaPlus, FaRegTrashAlt } from 'react-icons/fa';
|
|
6
|
+
import { Button, withFieldGroup, withForm } from 'react-science/ui';
|
|
7
|
+
import type { z } from 'zod/v4';
|
|
8
|
+
|
|
9
|
+
import { useChartData } from '../../../../context/ChartContext.tsx';
|
|
10
|
+
import { getSpectraObjectPaths } from '../../../../utility/getSpectraObjectPaths.ts';
|
|
11
|
+
import {
|
|
12
|
+
CellActions,
|
|
13
|
+
CellActionsButton,
|
|
14
|
+
CellColorPicker,
|
|
15
|
+
CellInput,
|
|
16
|
+
TableSettings,
|
|
17
|
+
} from '../ui/table.tsx';
|
|
18
|
+
import { TableSection } from '../ui/table_section.tsx';
|
|
19
|
+
import type {
|
|
20
|
+
spectraColorsTabOneDimensionWithUUIDValidation,
|
|
21
|
+
spectraColorsTabTwoDimensionWithUUIDValidation,
|
|
22
|
+
} from '../validation/spectra_colors_tab_validation.ts';
|
|
23
|
+
import { defaultGeneralSettingsFormValues } from '../validation.ts';
|
|
24
|
+
|
|
25
|
+
export const SpectraColorsTab = withForm({
|
|
26
|
+
defaultValues: defaultGeneralSettingsFormValues,
|
|
27
|
+
render: function Render({ form }) {
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<GeneralColors form={form} fields="spectraColors" />
|
|
31
|
+
<Spectra1DColors form={form} />
|
|
32
|
+
<Spectra2DColors form={form} />
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const GeneralColors = withFieldGroup({
|
|
39
|
+
defaultValues: defaultGeneralSettingsFormValues.spectraColors,
|
|
40
|
+
render: ({ group }) => {
|
|
41
|
+
return (
|
|
42
|
+
<group.Section title="General">
|
|
43
|
+
<group.AppField name="highlightColor">
|
|
44
|
+
{(field) => <field.ColorPicker label="Assignment highlight color" />}
|
|
45
|
+
</group.AppField>
|
|
46
|
+
<group.AppField name="indicatorLineColor">
|
|
47
|
+
{(field) => <field.ColorPicker label="Indicator line color" />}
|
|
48
|
+
</group.AppField>
|
|
49
|
+
</group.Section>
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
type OneDimensionData = z.input<
|
|
55
|
+
typeof spectraColorsTabOneDimensionWithUUIDValidation
|
|
56
|
+
>;
|
|
57
|
+
const Spectra1DColors = withForm({
|
|
58
|
+
defaultValues: defaultGeneralSettingsFormValues,
|
|
59
|
+
render: function Render({ form }) {
|
|
60
|
+
const { Field } = form;
|
|
61
|
+
|
|
62
|
+
const field = useField({
|
|
63
|
+
form,
|
|
64
|
+
name: 'spectraColors.oneDimension',
|
|
65
|
+
mode: 'array',
|
|
66
|
+
});
|
|
67
|
+
const { insertValue, removeValue } = field;
|
|
68
|
+
|
|
69
|
+
const { data: chartData } = useChartData();
|
|
70
|
+
const { datalist } = useMemo(() => {
|
|
71
|
+
return getSpectraObjectPaths(chartData);
|
|
72
|
+
}, [chartData]);
|
|
73
|
+
|
|
74
|
+
const handleAdd = useCallback(
|
|
75
|
+
(index: number) => {
|
|
76
|
+
insertValue(index, {
|
|
77
|
+
uuid: crypto.randomUUID(),
|
|
78
|
+
value: '',
|
|
79
|
+
jpath: 'info.experiment',
|
|
80
|
+
color: 'red',
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
[insertValue],
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const handleDelete = useCallback(
|
|
87
|
+
(index: number) => {
|
|
88
|
+
removeValue(index);
|
|
89
|
+
},
|
|
90
|
+
[removeValue],
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const COLUMNS = useMemo(() => {
|
|
94
|
+
const helper = createColumnHelper<OneDimensionData>();
|
|
95
|
+
return [
|
|
96
|
+
helper.accessor('jpath', {
|
|
97
|
+
header: 'Field',
|
|
98
|
+
cell: ({ row: { index } }) => (
|
|
99
|
+
<Field name={`spectraColors.oneDimension[${index}].jpath`}>
|
|
100
|
+
{(field) => (
|
|
101
|
+
<CellInput
|
|
102
|
+
name={field.name}
|
|
103
|
+
value={field.state.value}
|
|
104
|
+
filterItems={datalist}
|
|
105
|
+
onChange={field.handleChange}
|
|
106
|
+
onBlur={field.handleBlur}
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</Field>
|
|
110
|
+
),
|
|
111
|
+
}),
|
|
112
|
+
helper.accessor('value', {
|
|
113
|
+
header: 'Value',
|
|
114
|
+
cell: ({ row: { index } }) => (
|
|
115
|
+
<Field name={`spectraColors.oneDimension[${index}].value`}>
|
|
116
|
+
{(field) => (
|
|
117
|
+
<CellInput
|
|
118
|
+
name={field.name}
|
|
119
|
+
value={field.state.value}
|
|
120
|
+
onBlur={field.handleBlur}
|
|
121
|
+
onChange={field.handleChange}
|
|
122
|
+
/>
|
|
123
|
+
)}
|
|
124
|
+
</Field>
|
|
125
|
+
),
|
|
126
|
+
}),
|
|
127
|
+
helper.accessor('color', {
|
|
128
|
+
header: 'Color',
|
|
129
|
+
cell: ({ row: { index } }) => (
|
|
130
|
+
<Field name={`spectraColors.oneDimension[${index}].color`}>
|
|
131
|
+
{(field) => (
|
|
132
|
+
<CellColorPicker
|
|
133
|
+
color={{ hex: field.state.value }}
|
|
134
|
+
onChangeComplete={({ hex }) => field.handleChange(hex)}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
</Field>
|
|
138
|
+
),
|
|
139
|
+
}),
|
|
140
|
+
helper.display({
|
|
141
|
+
id: 'actions',
|
|
142
|
+
header: '',
|
|
143
|
+
cell: ({ row: { index, original } }) => (
|
|
144
|
+
<CellActions>
|
|
145
|
+
<CellActionsButton
|
|
146
|
+
intent="success"
|
|
147
|
+
onClick={() => handleAdd(index + 1)}
|
|
148
|
+
>
|
|
149
|
+
<FaPlus className={Classes.ICON} />
|
|
150
|
+
</CellActionsButton>
|
|
151
|
+
{!('name' in original) && (
|
|
152
|
+
<CellActionsButton
|
|
153
|
+
intent="danger"
|
|
154
|
+
onClick={() => handleDelete(index)}
|
|
155
|
+
>
|
|
156
|
+
<FaRegTrashAlt className={Classes.ICON} />
|
|
157
|
+
</CellActionsButton>
|
|
158
|
+
)}
|
|
159
|
+
</CellActions>
|
|
160
|
+
),
|
|
161
|
+
}),
|
|
162
|
+
];
|
|
163
|
+
}, [Field, datalist, handleAdd, handleDelete]);
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<TableSection
|
|
167
|
+
title="1D Spectra"
|
|
168
|
+
actions={
|
|
169
|
+
<Button
|
|
170
|
+
size="small"
|
|
171
|
+
variant="outlined"
|
|
172
|
+
intent="success"
|
|
173
|
+
onClick={() => handleAdd(0)}
|
|
174
|
+
>
|
|
175
|
+
Add custom color
|
|
176
|
+
</Button>
|
|
177
|
+
}
|
|
178
|
+
>
|
|
179
|
+
<TableSettings
|
|
180
|
+
data={field.state.value}
|
|
181
|
+
columns={COLUMNS}
|
|
182
|
+
getRowId={get1DRowId}
|
|
183
|
+
emptyContent="No criteria colors"
|
|
184
|
+
/>
|
|
185
|
+
</TableSection>
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
function get1DRowId(row: OneDimensionData) {
|
|
191
|
+
return row.uuid;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
type TwoDimensionData = z.input<
|
|
195
|
+
typeof spectraColorsTabTwoDimensionWithUUIDValidation
|
|
196
|
+
>;
|
|
197
|
+
const Spectra2DColors = withForm({
|
|
198
|
+
defaultValues: defaultGeneralSettingsFormValues,
|
|
199
|
+
render: function Render({ form }) {
|
|
200
|
+
const { Field } = form;
|
|
201
|
+
|
|
202
|
+
const field = useField({
|
|
203
|
+
form,
|
|
204
|
+
name: 'spectraColors.twoDimensions',
|
|
205
|
+
mode: 'array',
|
|
206
|
+
});
|
|
207
|
+
const { insertValue, removeValue } = field;
|
|
208
|
+
|
|
209
|
+
const handleAdd = useCallback(
|
|
210
|
+
(index: number) => {
|
|
211
|
+
insertValue(index, {
|
|
212
|
+
uuid: crypto.randomUUID(),
|
|
213
|
+
value: '',
|
|
214
|
+
jpath: 'info.experiment',
|
|
215
|
+
positiveColor: 'red',
|
|
216
|
+
negativeColor: 'blue',
|
|
217
|
+
});
|
|
218
|
+
},
|
|
219
|
+
[insertValue],
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const handleDelete = useCallback(
|
|
223
|
+
(index: number) => {
|
|
224
|
+
removeValue(index);
|
|
225
|
+
},
|
|
226
|
+
[removeValue],
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
const { data: chartData } = useChartData();
|
|
230
|
+
const { datalist } = useMemo(() => {
|
|
231
|
+
return getSpectraObjectPaths(chartData);
|
|
232
|
+
}, [chartData]);
|
|
233
|
+
|
|
234
|
+
const COLUMNS = useMemo(() => {
|
|
235
|
+
const helper = createColumnHelper<TwoDimensionData>();
|
|
236
|
+
return [
|
|
237
|
+
helper.accessor('jpath', {
|
|
238
|
+
header: 'Field',
|
|
239
|
+
cell: ({ row: { index } }) => (
|
|
240
|
+
<Field name={`spectraColors.twoDimensions[${index}].jpath`}>
|
|
241
|
+
{(field) => (
|
|
242
|
+
<CellInput
|
|
243
|
+
name={field.name}
|
|
244
|
+
value={field.state.value}
|
|
245
|
+
filterItems={datalist}
|
|
246
|
+
onChange={field.handleChange}
|
|
247
|
+
onBlur={field.handleBlur}
|
|
248
|
+
/>
|
|
249
|
+
)}
|
|
250
|
+
</Field>
|
|
251
|
+
),
|
|
252
|
+
}),
|
|
253
|
+
helper.accessor('value', {
|
|
254
|
+
header: 'Value',
|
|
255
|
+
cell: ({ row: { index } }) => (
|
|
256
|
+
<Field name={`spectraColors.twoDimensions[${index}].value`}>
|
|
257
|
+
{(field) => (
|
|
258
|
+
<CellInput
|
|
259
|
+
name={field.name}
|
|
260
|
+
value={field.state.value}
|
|
261
|
+
onChange={field.handleChange}
|
|
262
|
+
onBlur={field.handleBlur}
|
|
263
|
+
/>
|
|
264
|
+
)}
|
|
265
|
+
</Field>
|
|
266
|
+
),
|
|
267
|
+
}),
|
|
268
|
+
helper.accessor('positiveColor', {
|
|
269
|
+
header: 'Positive color',
|
|
270
|
+
cell: ({ row: { index } }) => (
|
|
271
|
+
<Field name={`spectraColors.twoDimensions[${index}].positiveColor`}>
|
|
272
|
+
{(field) => (
|
|
273
|
+
<CellColorPicker
|
|
274
|
+
color={{ hex: field.state.value }}
|
|
275
|
+
onChangeComplete={({ hex }) => {
|
|
276
|
+
field.handleChange(hex);
|
|
277
|
+
field.handleBlur();
|
|
278
|
+
}}
|
|
279
|
+
/>
|
|
280
|
+
)}
|
|
281
|
+
</Field>
|
|
282
|
+
),
|
|
283
|
+
}),
|
|
284
|
+
helper.accessor('negativeColor', {
|
|
285
|
+
header: 'Negative color',
|
|
286
|
+
cell: ({ row: { index } }) => (
|
|
287
|
+
<Field name={`spectraColors.twoDimensions[${index}].negativeColor`}>
|
|
288
|
+
{(field) => (
|
|
289
|
+
<CellColorPicker
|
|
290
|
+
color={{ hex: field.state.value }}
|
|
291
|
+
onChangeComplete={({ hex }) => {
|
|
292
|
+
field.handleChange(hex);
|
|
293
|
+
field.handleBlur();
|
|
294
|
+
}}
|
|
295
|
+
/>
|
|
296
|
+
)}
|
|
297
|
+
</Field>
|
|
298
|
+
),
|
|
299
|
+
}),
|
|
300
|
+
helper.display({
|
|
301
|
+
id: 'actions',
|
|
302
|
+
header: '',
|
|
303
|
+
cell: ({ row: { index, original } }) => (
|
|
304
|
+
<CellActions>
|
|
305
|
+
<CellActionsButton
|
|
306
|
+
intent="success"
|
|
307
|
+
onClick={() => handleAdd(index + 1)}
|
|
308
|
+
>
|
|
309
|
+
<FaPlus className={Classes.ICON} />
|
|
310
|
+
</CellActionsButton>
|
|
311
|
+
{!('name' in original) && (
|
|
312
|
+
<CellActionsButton
|
|
313
|
+
intent="danger"
|
|
314
|
+
onClick={() => handleDelete(index)}
|
|
315
|
+
>
|
|
316
|
+
<FaRegTrashAlt className={Classes.ICON} />
|
|
317
|
+
</CellActionsButton>
|
|
318
|
+
)}
|
|
319
|
+
</CellActions>
|
|
320
|
+
),
|
|
321
|
+
}),
|
|
322
|
+
];
|
|
323
|
+
}, [Field, datalist, handleAdd, handleDelete]);
|
|
324
|
+
|
|
325
|
+
return (
|
|
326
|
+
<TableSection
|
|
327
|
+
title="2D Spectra"
|
|
328
|
+
actions={
|
|
329
|
+
<Button
|
|
330
|
+
size="small"
|
|
331
|
+
variant="outlined"
|
|
332
|
+
intent="success"
|
|
333
|
+
onClick={() => handleAdd(0)}
|
|
334
|
+
>
|
|
335
|
+
Add custom color
|
|
336
|
+
</Button>
|
|
337
|
+
}
|
|
338
|
+
>
|
|
339
|
+
<TableSettings
|
|
340
|
+
data={field.state.value}
|
|
341
|
+
columns={COLUMNS}
|
|
342
|
+
getRowId={get2DRowId}
|
|
343
|
+
emptyContent="No criteria colors"
|
|
344
|
+
/>
|
|
345
|
+
</TableSection>
|
|
346
|
+
);
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
function get2DRowId(row: TwoDimensionData) {
|
|
351
|
+
return row.uuid;
|
|
352
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { Classes } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { useField, useStore } from '@tanstack/react-form';
|
|
4
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
5
|
+
import { FaRegTrashAlt } from 'react-icons/fa';
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
FieldGroupSVGTextStyleFields,
|
|
9
|
+
TableDragRowHandler,
|
|
10
|
+
createTableColumnHelper,
|
|
11
|
+
withForm,
|
|
12
|
+
} from 'react-science/ui';
|
|
13
|
+
import type { z } from 'zod';
|
|
14
|
+
|
|
15
|
+
import { useChartData } from '../../../../context/ChartContext.js';
|
|
16
|
+
import { getSpectraObjectPaths } from '../../../../utility/getSpectraObjectPaths.js';
|
|
17
|
+
import {
|
|
18
|
+
CellActions,
|
|
19
|
+
CellActionsButton,
|
|
20
|
+
CellCheckbox,
|
|
21
|
+
CellInput,
|
|
22
|
+
TableSettings,
|
|
23
|
+
} from '../ui/table.js';
|
|
24
|
+
import { TableSection } from '../ui/table_section.js';
|
|
25
|
+
import type { infoBlockFieldTabValidationWithUUID } from '../validation/title_block_tab_validation.js';
|
|
26
|
+
import { defaultGeneralSettingsFormValues } from '../validation.js';
|
|
27
|
+
|
|
28
|
+
export const TitleBlockTab = withForm({
|
|
29
|
+
defaultValues: defaultGeneralSettingsFormValues,
|
|
30
|
+
render: ({ form }) => {
|
|
31
|
+
const { Section, AppField } = form;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<Section title="Visibility">
|
|
36
|
+
<AppField name="infoBlock.visible">
|
|
37
|
+
{({ Checkbox }) => <Checkbox label="Display spectrum info block" />}
|
|
38
|
+
</AppField>
|
|
39
|
+
</Section>
|
|
40
|
+
|
|
41
|
+
<TableFields form={form} />
|
|
42
|
+
|
|
43
|
+
<Section title="Styling">
|
|
44
|
+
<FieldGroupSVGTextStyleFields
|
|
45
|
+
form={form}
|
|
46
|
+
fields="infoBlock.nameStyle"
|
|
47
|
+
label="Field label"
|
|
48
|
+
previewText="Pulse sequence :"
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<FieldGroupSVGTextStyleFields
|
|
52
|
+
form={form}
|
|
53
|
+
fields="infoBlock.valueStyle"
|
|
54
|
+
label="Field value"
|
|
55
|
+
previewText="lon1027"
|
|
56
|
+
/>
|
|
57
|
+
</Section>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
type Field = z.input<typeof infoBlockFieldTabValidationWithUUID>;
|
|
64
|
+
function getEmptyField(): Field {
|
|
65
|
+
return {
|
|
66
|
+
label: '',
|
|
67
|
+
format: '',
|
|
68
|
+
jpath: '',
|
|
69
|
+
visible: true,
|
|
70
|
+
uuid: crypto.randomUUID(),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const TableFields = withForm({
|
|
74
|
+
defaultValues: defaultGeneralSettingsFormValues,
|
|
75
|
+
render: function Fields({ form }) {
|
|
76
|
+
const { Field } = form;
|
|
77
|
+
const fields = useField({
|
|
78
|
+
form,
|
|
79
|
+
name: 'infoBlock.fields',
|
|
80
|
+
mode: 'array',
|
|
81
|
+
});
|
|
82
|
+
const { removeValue, setValue, pushValue, name } = fields;
|
|
83
|
+
|
|
84
|
+
const [autoFocus, setAutoFocus] = useState<string>('');
|
|
85
|
+
function onAddField() {
|
|
86
|
+
const value = getEmptyField();
|
|
87
|
+
pushValue(value, { dontRunListeners: true });
|
|
88
|
+
setAutoFocus(value.uuid);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const { data } = useChartData();
|
|
92
|
+
const { datalist } = useMemo(() => getSpectraObjectPaths(data), [data]);
|
|
93
|
+
|
|
94
|
+
const onDeleteAt = useCallback(
|
|
95
|
+
(index: number) => {
|
|
96
|
+
removeValue(index);
|
|
97
|
+
},
|
|
98
|
+
[removeValue],
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const columns = useMemo(() => {
|
|
102
|
+
const columnHelper = createTableColumnHelper<Field>();
|
|
103
|
+
return [
|
|
104
|
+
columnHelper.display({
|
|
105
|
+
id: 'dnd',
|
|
106
|
+
header: '',
|
|
107
|
+
meta: {
|
|
108
|
+
tdStyle: { textAlign: 'center' },
|
|
109
|
+
},
|
|
110
|
+
cell: () => <TableDragRowHandlerStyled size="small" />,
|
|
111
|
+
}),
|
|
112
|
+
columnHelper.accessor('label', {
|
|
113
|
+
header: () => 'Label',
|
|
114
|
+
cell: ({ row: { index, original } }) => (
|
|
115
|
+
<Field name={`${name}[${index}].label`}>
|
|
116
|
+
{(field) => (
|
|
117
|
+
<CellInput
|
|
118
|
+
autoFocus={original.uuid === autoFocus ? true : undefined}
|
|
119
|
+
name={field.name}
|
|
120
|
+
value={field.state.value}
|
|
121
|
+
onChange={field.handleChange}
|
|
122
|
+
onBlur={() => {
|
|
123
|
+
field.handleBlur();
|
|
124
|
+
setAutoFocus('');
|
|
125
|
+
}}
|
|
126
|
+
intent={!field.state.meta.isValid ? 'danger' : undefined}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</Field>
|
|
130
|
+
),
|
|
131
|
+
}),
|
|
132
|
+
columnHelper.accessor('jpath', {
|
|
133
|
+
header: 'Field',
|
|
134
|
+
cell: ({ row: { index } }) => (
|
|
135
|
+
<Field name={`${name}[${index}].jpath`}>
|
|
136
|
+
{(field) => (
|
|
137
|
+
<CellInput
|
|
138
|
+
name={field.name}
|
|
139
|
+
value={field.state.value}
|
|
140
|
+
onChange={field.handleChange}
|
|
141
|
+
filterItems={datalist}
|
|
142
|
+
intent={!field.state.meta.isValid ? 'danger' : undefined}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
</Field>
|
|
146
|
+
),
|
|
147
|
+
}),
|
|
148
|
+
columnHelper.accessor('format', {
|
|
149
|
+
header: 'Format',
|
|
150
|
+
cell: ({ row: { index } }) => (
|
|
151
|
+
<Field name={`${name}[${index}].format`}>
|
|
152
|
+
{(field) => (
|
|
153
|
+
<CellInput
|
|
154
|
+
name={field.name}
|
|
155
|
+
value={field.state.value}
|
|
156
|
+
onChange={field.handleChange}
|
|
157
|
+
intent={!field.state.meta.isValid ? 'danger' : undefined}
|
|
158
|
+
/>
|
|
159
|
+
)}
|
|
160
|
+
</Field>
|
|
161
|
+
),
|
|
162
|
+
}),
|
|
163
|
+
columnHelper.accessor('visible', {
|
|
164
|
+
header: 'Visible',
|
|
165
|
+
meta: {
|
|
166
|
+
tdStyle: { textAlign: 'center' },
|
|
167
|
+
},
|
|
168
|
+
cell: ({ row: { index } }) => (
|
|
169
|
+
<Field name={`${name}[${index}].visible`}>
|
|
170
|
+
{(field) => (
|
|
171
|
+
<CellCheckbox
|
|
172
|
+
name={field.name}
|
|
173
|
+
checked={field.state.value}
|
|
174
|
+
onChange={(e) => field.handleChange(e.currentTarget.checked)}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</Field>
|
|
178
|
+
),
|
|
179
|
+
}),
|
|
180
|
+
columnHelper.display({
|
|
181
|
+
id: 'actions',
|
|
182
|
+
header: '',
|
|
183
|
+
meta: {
|
|
184
|
+
thStyle: {
|
|
185
|
+
width: '60px',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
cell: ({ row: { index } }) => {
|
|
189
|
+
return (
|
|
190
|
+
<CellActions>
|
|
191
|
+
<CellActionsButton
|
|
192
|
+
intent="danger"
|
|
193
|
+
onClick={() => onDeleteAt(index)}
|
|
194
|
+
>
|
|
195
|
+
<FaRegTrashAlt className={Classes.ICON} />
|
|
196
|
+
</CellActionsButton>
|
|
197
|
+
</CellActions>
|
|
198
|
+
);
|
|
199
|
+
},
|
|
200
|
+
}),
|
|
201
|
+
];
|
|
202
|
+
}, [Field, autoFocus, datalist, name, onDeleteAt]);
|
|
203
|
+
|
|
204
|
+
const onRowOrderChanged = useCallback(
|
|
205
|
+
(value: Field[]) => {
|
|
206
|
+
setValue(value);
|
|
207
|
+
},
|
|
208
|
+
[setValue],
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
// It seems fields.setValue don't always trigger rerender
|
|
212
|
+
// so fields.state.value can de-sync and cause weird behavior with DnD reorder.
|
|
213
|
+
const fieldsData = useStore(fields.store, (s) => s.value);
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<TableSection
|
|
217
|
+
title="Fields"
|
|
218
|
+
actions={
|
|
219
|
+
<Button
|
|
220
|
+
size="small"
|
|
221
|
+
variant="outlined"
|
|
222
|
+
intent="primary"
|
|
223
|
+
icon="plus"
|
|
224
|
+
onClick={onAddField}
|
|
225
|
+
>
|
|
226
|
+
Add Field
|
|
227
|
+
</Button>
|
|
228
|
+
}
|
|
229
|
+
>
|
|
230
|
+
<TableSettings
|
|
231
|
+
data={fieldsData}
|
|
232
|
+
columns={columns}
|
|
233
|
+
onRowOrderChanged={onRowOrderChanged}
|
|
234
|
+
getRowId={getRowId}
|
|
235
|
+
emptyContent="No Fields"
|
|
236
|
+
/>
|
|
237
|
+
</TableSection>
|
|
238
|
+
);
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
function getRowId(row: Field) {
|
|
243
|
+
return row.uuid;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const TableDragRowHandlerStyled = styled(TableDragRowHandler)`
|
|
247
|
+
margin: 0 2px;
|
|
248
|
+
`;
|