Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
878 changes: 453 additions & 425 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@hookform/resolvers": "^5.2.2",
"@tanstack/react-form": "^1.28.6",
"@tanstack/react-form": "^1.29.0",
"@tanstack/react-table": "^8.21.3",
"@zakodium/nmr-types": "^0.5.5",
"@zakodium/nmrium-core": "^0.7.8",
"@zakodium/nmrium-core-plugins": "^0.7.11",
"@zakodium/nmr-types": "^0.5.7",
"@zakodium/nmrium-core": "^0.7.11",
"@zakodium/nmrium-core-plugins": "^0.7.14",
"@zakodium/pdnd-esm": "^1.0.2",
"@zip.js/zip.js": "^2.8.26",
"cheminfo-font": "^1.25.0",
"cheminfo-font": "^1.26.0",
"cheminfo-types": "^1.15.0",
"clipboard-polyfill": "^4.1.1",
"d3-array": "^3.2.4",
Expand All @@ -89,16 +89,16 @@
"get-jpaths": "^1.4.0",
"immer": "^11.1.4",
"lodash": "^4.18.1",
"mf-parser": "^3.8.0",
"ml-array-mean": "^1.1.6",
"ml-array-median": "^1.1.6",
"mf-parser": "^3.9.0",
"ml-array-mean": "^2.0.0",
"ml-array-median": "^2.0.0",
"ml-conrec": "^5.0.3",
"ml-gsd": "^13.1.1",
"ml-signal-processing": "^2.2.0",
"ml-spectra-processing": "^14.23.0",
"ml-spectra-processing": "^14.27.0",
"ml-tree-similarity": "^2.2.0",
"nmr-correlation": "2.3.3",
"nmr-processing": "^22.8.1",
"nmr-processing": "^22.8.2",
"numeral": "^2.0.6",
"openchemlib": "^9.22.0",
"openchemlib-utils": "^8.15.0",
Expand Down Expand Up @@ -143,22 +143,22 @@
"@vitest/coverage-v8": "^4.1.4",
"@zakodium/tsconfig": "^1.0.5",
"cross-env": "^10.1.0",
"cspell": "^9.7.0",
"cspell": "^10.0.0",
"eslint": "^9.39.2",
"eslint-config-cheminfo-react": "^19.2.0",
"eslint-config-cheminfo-typescript": "^21.2.0",
"knip": "^6.3.1",
"eslint-config-cheminfo-react": "^20.0.0",
"eslint-config-cheminfo-typescript": "^22.0.0",
"knip": "^6.4.1",
"modern-normalize": "^3.0.1",
"postcss": "^8.5.9",
"postcss-styled-syntax": "^0.7.1",
"prettier": "^3.8.2",
"prettier": "^3.8.3",
"rc-menu": "^9.16.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^7.14.0",
"react-router-dom": "^7.14.1",
"rimraf": "^6.1.3",
"serve": "^14.2.6",
"stylelint": "^17.6.0",
"stylelint": "^17.7.0",
"stylelint-config-standard": "^40.0.0",
"typescript": "~6.0.2",
"vite": "^8.0.8",
Expand Down
12 changes: 6 additions & 6 deletions src/component/1d-2d/tools/BrushXY.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ export default function BrushXY(props: BrushXYProps) {
let x1;

if (brush.type === 'X') {
y1 = Math.max(brushTracker.startY, margin.top);
y1 = Math.max(startY, margin.top);
} else if (brush.type === 'XY') {
y1 = Math.round((brushTracker.endY + brushTracker.startY) / 2);
y1 = Math.round((endY + startY) / 2);
}
if (brush.type === 'Y') {
x1 = Math.max(brushTracker.startX, margin.left);
x1 = Math.max(startX, margin.left);
} else if (brush.type === 'XY') {
x1 = Math.round((brushTracker.endX + brushTracker.startX) / 2);
x1 = Math.round((endX + startX) / 2);
}

const invScaleX = 1 / scaleX;
Expand Down Expand Up @@ -247,8 +247,8 @@ export default function BrushXY(props: BrushXYProps) {

if (scaleX === 0 || scaleY === 0) return;

const centerX = Math.round((brushTracker.endX + brushTracker.startX) / 2);
const centerY = Math.round((brushTracker.endY + brushTracker.startY) / 2);
const centerX = Math.round((endX + startX) / 2);
const centerY = Math.round((endY + startY) / 2);

return (
<div
Expand Down
8 changes: 4 additions & 4 deletions src/component/1d/multiplicityTree/MultiplicityTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
assignment: assignmentLabel,
},
} = props;
const { from, to, id: rangeID } = range;
const { from, to, id: rangeId } = range;
const { width } = useChartData();
const { scaleX, shiftY } = useScaleChecked();
const dispatch = useDispatch();
Expand All @@ -95,7 +95,7 @@
const assignment = useAssignment(signalKey);
const highlight = useHighlight(extractID(signalKey, assignment), {
type: 'SIGNAL_1D',
extra: { id: signalKey, rangeId: rangeID },
extra: { id: signalKey, rangeId },
});

let widthRatio: number;
Expand Down Expand Up @@ -135,7 +135,7 @@
isUnAssignLabelButtonVisible: !!assignmentLabel,
onAssign: assignHandler,
onUnAssign: unAssignHandler,
rangeId: range.id,
rangeId,
});

if (!multiplicity) return null;
Expand All @@ -149,7 +149,7 @@
dispatch({
type: 'UNASSIGN_1D_SIGNAL',
payload: {
rangeKey: range.id,
rangeKey: rangeId,
signalIndex,
},
});
Expand Down Expand Up @@ -242,7 +242,7 @@

return (
<text
key={index}

Check warning on line 245 in src/component/1d/multiplicityTree/MultiplicityTree.tsx

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Do not use Array index in keys
x={x1}
y={startY + y}
textAnchor="middle"
Expand Down
6 changes: 3 additions & 3 deletions src/component/1d/ranges/Range.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function Range(options: RangeProps) {
dispatch({
type: 'UNASSIGN_1D_SIGNAL',
payload: {
rangeKey: range.id,
rangeKey: id,
signalIndex: 0,
},
});
Expand All @@ -141,7 +141,7 @@ function Range(options: RangeProps) {
isUnAssignLabelButtonVisible: hasOnlyOneSignal && !!signal.assignment,
onAssign: assignHandler,
onUnAssign: unAssignHandler,
rangeId: range.id,
rangeId: id,
});

const isOpen = isAssignBtnTrigged.current ? isAssignmentActive : undefined;
Expand Down Expand Up @@ -200,7 +200,7 @@ function Range(options: RangeProps) {
fill={isHighlighted || isActive ? '#ff6f0057' : 'transparent'}
data-no-export="true"
/>
{range.signals.map((signal) => (
{signals.map((signal) => (
<AssignmentLabel
key={signal.id}
stackIndex={signalsStackIndexes?.[signal.id] || 0}
Expand Down
4 changes: 2 additions & 2 deletions src/component/2d/utilities/extractSpectrumSignals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export function extractSpectrumSignals<T extends object = object>(
const { signals = [] } = range;
let index = 0;
for (const signal of signals) {
const { kind } = signal;
const { kind, assignment } = signal;
if (kind && signalKindsToInclude.has(kind)) {
result.push({
...signal,
assignment: index === 0 ? signal.assignment : '',
assignment: index === 0 ? assignment : '',
...include?.(range),
} as ExtractedSignal<T>);
index++;
Expand Down
4 changes: 2 additions & 2 deletions src/component/2d/zones/SignalsGuideLines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function useSignalsOverlap(axis: IndicationLinesAxis, spectrum: Spectrum1D) {
const isOverXAxis = axis === 'x';

const processedSignals: ProcessedSignal[] = signals.map((signal) => {
const { delta } = signal;
const text = signal.assignment ?? '';
const { delta, assignment } = signal;
const text = assignment ?? '';
const labelWidth = getTextWidth(text);

return {
Expand Down
20 changes: 14 additions & 6 deletions src/component/EventsTrackers/BrushTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,17 @@ export function BrushTracker(options: BrushTrackerProps) {

function moveCallback(event: globalThis.PointerEvent) {
isDraggingRef.current = true; // set flag to true to skip click event if the user dragged the mouse
const { clientX, clientY, shiftKey, altKey, ctrlKey } = event;
const {
clientX,
clientY,
screenX,
screenY,
shiftKey,
altKey,
ctrlKey,
} = event;

if (event.ctrlKey) {
if (ctrlKey) {
if (boundingRectRef.current) {
const boundingRect = boundingRectRef.current;

Expand Down Expand Up @@ -281,10 +289,10 @@ export function BrushTracker(options: BrushTrackerProps) {
dispatch({
type: 'MOVE',
payload: {
screenX: event.screenX,
screenY: event.screenY,
clientX: event.clientX,
clientY: event.clientY,
screenX,
screenY,
clientX,
clientY,
},
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/component/SVGTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,9 @@ export function SVGTable<T>(props: SVGTableProps<T>) {
cellBoxProps,
cellTextProps,
_columnOptions: { key: columnKey },
rowSpanGroupKey,
} = col;
const groupKey = col.rowSpanGroupKey
? row?.[col.rowSpanGroupKey]
: '';
const groupKey = rowSpanGroupKey ? row?.[rowSpanGroupKey] : '';
const cellKey = formatKey({
groupKey: String(groupKey),
columnKey,
Expand Down
3 changes: 2 additions & 1 deletion src/component/elements/ReactTable/Elements/ReactTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function ReactTableRow(props: ReactTableRowPropsWithHighlight) {
const {
column: { style },
isRowSpanned,
rowSpan,
} = cell;
if (isRowSpanned) {
return null;
Expand All @@ -131,7 +132,7 @@ function ReactTableRow(props: ReactTableRowPropsWithHighlight) {

return (
<td
rowSpan={cell.rowSpan}
rowSpan={rowSpan}
key={columnKey}
{...otherColumnProps}
onContextMenu={(e) => {
Expand Down
4 changes: 2 additions & 2 deletions src/component/elements/Sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ function SectionBody(props: HTMLAttributes<HTMLDivElement>) {

function SectionItem(props: SectionItemProps) {
const {
dragLabel = props.title,
id = props.title,
title,
dragLabel = title,
id = title,
onClick,
serial,
rightElement,
Expand Down
5 changes: 1 addition & 4 deletions src/component/loader/useLoadFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export function useLoadFiles(onOpenMetaInformation?: (file: File) => void) {
[core, dispatchPayload],
);

const currentPreferences = preferences.current;
const loadUserFiles = useCallback(
async (files: File[] | FileCollection) => {
if (
Expand All @@ -96,8 +95,7 @@ export function useLoadFiles(onOpenMetaInformation?: (file: File) => void) {
return;
}

const { onLoadProcessing } = workspacePreferences;
const { nmrLoaders: selector } = currentPreferences;
const { onLoadProcessing, nmrLoaders: selector } = workspacePreferences;

const parsingOptions: Partial<ParsingOptions> = {
selector,
Expand Down Expand Up @@ -129,7 +127,6 @@ export function useLoadFiles(onOpenMetaInformation?: (file: File) => void) {
loadNmriumArchives,
logger,
onOpenMetaInformation,
currentPreferences,
workspacePreferences,
],
);
Expand Down
6 changes: 3 additions & 3 deletions src/component/main/NMRiumStateProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ export default function NMRiumStateProvider(props: NMRiumStateProviderProps) {

const spectra = useMemo(() => {
if (sortOptions) {
return sortSpectra(state.data, sortOptions);
return sortSpectra(spectraData, sortOptions);
}
return state.data;
}, [sortOptions, state.data]);
return spectraData;
}, [sortOptions, spectraData]);

const updatedState = useMemo(() => {
return produce(state, (draft) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const AutoProcessingTab = withForm({
const AutoProcessingFilters = withFieldGroup({
defaultValues: defaultGeneralSettingsFormValues.onLoadProcessing.filters,
render: function Render({ group }) {
const { Section } = group;
const { Section, state } = group;

const nuclei = Object.keys(group.state.values);
const nuclei = Object.keys(state.values);

return (
<>
Expand All @@ -59,9 +59,9 @@ const defaultValuesNucleus: z.input<typeof filtersValidation> = [
const NucleusFilters = withFieldGroup({
defaultValues: defaultValuesNucleus,
render: function Render({ group }) {
const { AppField } = group;
const { AppField, state } = group;

const filters = group.state.values;
const filters = state.values;
if (!filters) return null;

return filters.map(({ name }, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const DatabaseTab = withForm({
defaultValues: defaultGeneralSettingsFormValues,
render: function Render({ form }) {
const field = useField({ form, name: 'databases.data', mode: 'array' });
const { removeValue, insertValue } = field;
const { removeValue, insertValue, state } = field;
const { resetField, Field } = form;

const handleDelete = useCallback(
Expand Down Expand Up @@ -172,7 +172,7 @@ export const DatabaseTab = withForm({
}
>
<TableSettings
data={field.state.value}
data={state.value}
columns={COLUMNS}
getRowId={getRowId}
emptyContent="No database item"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ExternalApiTab = withForm({
render: function ExternalApiTab({ form }) {
const { Field } = form;
const field = useField({ form, name: 'externalAPIs', mode: 'array' });
const { name, pushValue, insertValue, removeValue } = field;
const { name, pushValue, insertValue, removeValue, state } = field;

const columns = useMemo(() => {
const helper = createColumnHelper<API>();
Expand Down Expand Up @@ -108,7 +108,7 @@ export const ExternalApiTab = withForm({
}
>
<TableSettings
data={field.state.value}
data={state.value}
columns={columns}
getRowId={getRowId}
emptyContent="No external APIs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const NucleiTab = withForm({
const nucleiField = useField({ form, name: 'nuclei', mode: 'array' });

const { Field } = form;
const { insertValue, removeValue, pushValue } = nucleiField;
const { insertValue, removeValue, pushValue, state } = nucleiField;

const insertNucleus = useCallback(
(index: number) => {
Expand Down Expand Up @@ -137,7 +137,7 @@ export const NucleiTab = withForm({
}
>
<TableSettings
data={nucleiField.state.value}
data={state.value}
columns={COLUMNS}
emptyContent="No nucleus"
getRowId={getRowId}
Expand Down
Loading
Loading