@jield/solodb-react-components 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export default function EditRunParents(): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ import { ParentRunSelection } from '../../../hooks/useParentRunSelection';
3
+ type ParentRunSelectProps = {
4
+ selection: ParentRunSelection;
5
+ /** When given, only runs available as parent for this run are offered. */
6
+ run?: Run;
7
+ };
8
+ export default function ParentRunSelect({ selection, run }: ParentRunSelectProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import { RunPart } from '@jield/solodb-typescript-core';
2
+ export type PartLevelGroup = {
3
+ level: number;
4
+ parts: RunPart[];
5
+ };
6
+ export declare const groupPartsByLevel: (parts: RunPart[]) => PartLevelGroup[];
7
+ export declare const getPartLabel: (part: RunPart) => string;
@@ -0,0 +1,10 @@
1
+ import { ParentRunSelection } from '../../../hooks/useParentRunSelection';
2
+ import { PartLevelGroup } from './partGrouping';
3
+ type PartLevelFieldsetProps = {
4
+ runId: number;
5
+ group: PartLevelGroup;
6
+ selection: ParentRunSelection;
7
+ experimentalEdit: boolean;
8
+ };
9
+ export default function PartLevelFieldset({ runId, group, selection, experimentalEdit }: PartLevelFieldsetProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ import { ParentRunSelection } from '../../../hooks/useParentRunSelection';
3
+ import { PartLevelGroup } from './partGrouping';
4
+ type RunPartPickerProps = {
5
+ run: Run;
6
+ selection: ParentRunSelection;
7
+ partGroups: PartLevelGroup[];
8
+ isLoadingParts: boolean;
9
+ experimentalEdit: boolean;
10
+ onToggleExperimentalEdit: () => void;
11
+ };
12
+ /**
13
+ * Description and part selection for a single parent run, grouped by part
14
+ * level. Parts can be picked as plain badges or, in experimental-edit mode,
15
+ * with a split amount per part.
16
+ */
17
+ export default function RunPartPicker({ run, selection, partGroups, isLoadingParts, experimentalEdit, onToggleExperimentalEdit, }: RunPartPickerProps): import("react").JSX.Element;
18
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ type SelectedRunListProps = {
3
+ selectedRuns: Run[];
4
+ onDeselect: (runId: number) => void;
5
+ };
6
+ export default function SelectedRunList({ selectedRuns, onDeselect }: SelectedRunListProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,24 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ import { SelectedSubstrate } from '../substrateSelect';
3
+ export type CreateRunFormValues = {
4
+ name: string;
5
+ motivation: string;
6
+ groupId: number;
7
+ teamId: number;
8
+ projectId: number;
9
+ parts: number;
10
+ location: string;
11
+ conclusion: string;
12
+ runType: "research" | "production";
13
+ };
14
+ type CreateRunFormProps = {
15
+ isSubmitting: boolean;
16
+ errorMessage?: string;
17
+ selectedRuns: Run[];
18
+ selectedSubstrates: SelectedSubstrate[];
19
+ partIdsByRunId: Record<number, number[]>;
20
+ onBack: () => void;
21
+ onSubmit: (values: CreateRunFormValues) => void;
22
+ };
23
+ export default function CreateRunForm({ isSubmitting, errorMessage, selectedRuns, selectedSubstrates, partIdsByRunId, onBack, onSubmit, }: CreateRunFormProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export default function FormSection({ title, isFirst, children, }: {
3
+ title: string;
4
+ isFirst?: boolean;
5
+ children: ReactNode;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ type OrganisationOption = {
2
+ id: number;
3
+ label: string;
4
+ };
5
+ type OrganisationSelectProps = {
6
+ controlId: string;
7
+ /** Capitalized singular entity name, e.g. "Group". */
8
+ label: string;
9
+ options: OrganisationOption[];
10
+ isLoading: boolean;
11
+ value: number | null;
12
+ onChange: (id: number | null) => void;
13
+ showError: boolean;
14
+ disabled: boolean;
15
+ helpText: string;
16
+ };
17
+ export default function OrganisationSelect({ controlId, label, options, isLoading, value, onChange, showError, disabled, helpText, }: OrganisationSelectProps): import("react").JSX.Element;
18
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ import { SelectedSubstrate } from '../substrateSelect';
3
+ type SelectionOverviewProps = {
4
+ selectedRuns: Run[];
5
+ selectedSubstrates: SelectedSubstrate[];
6
+ partIdsByRunId: Record<number, number[]>;
7
+ };
8
+ export default function SelectionOverview({ selectedRuns, selectedSubstrates, partIdsByRunId, }: SelectionOverviewProps): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1 @@
1
+ export declare const getCreateRunErrorMessage: (error: unknown) => string;
@@ -0,0 +1,12 @@
1
+ import { Substrate } from '@jield/solodb-typescript-core';
2
+ import { Dispatch, SetStateAction } from 'react';
3
+ export type SelectedSubstrate = {
4
+ substrate: Substrate;
5
+ amount: number;
6
+ };
7
+ type SubstrateSelectProps = {
8
+ selectedSubstrates: SelectedSubstrate[];
9
+ setSelectedSubstrates: Dispatch<SetStateAction<SelectedSubstrate[]>>;
10
+ };
11
+ export default function SubstrateSelect({ selectedSubstrates, setSelectedSubstrates }: SubstrateSelectProps): import("react").JSX.Element;
12
+ export {};
@@ -0,0 +1 @@
1
+ export default function NewRunWizard(): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { Run } from '@jield/solodb-typescript-core';
2
+ /**
3
+ * The data slices of a parent-run selection. This is the snapshot consumers
4
+ * pass to mutations (see buildRunParentPayloads).
5
+ */
6
+ export interface ParentRunSelectionState {
7
+ selectedRuns: Run[];
8
+ partIdsByRunId: Record<number, number[]>;
9
+ amountPerPartByRunId: Record<number, Record<number, number>>;
10
+ descriptionsByRunId: Record<number, string>;
11
+ }
12
+ export interface ParentRunSelection extends ParentRunSelectionState {
13
+ selectRun: (run: Run) => void;
14
+ deselectRun: (runId: number) => void;
15
+ getSelectedPartIds: (runId: number) => number[];
16
+ isPartSelected: (runId: number, partId: number) => boolean;
17
+ setRunPartIds: (runId: number, partIds: number[]) => void;
18
+ togglePart: (runId: number, partId: number) => void;
19
+ setPartsSelected: (runId: number, partIds: number[], selected: boolean) => void;
20
+ getPartAmount: (runId: number, partId: number) => number;
21
+ setPartAmount: (runId: number, partId: number, amount: number) => void;
22
+ setDescription: (runId: number, description: string) => void;
23
+ }
24
+ /**
25
+ * State for selecting parent runs together with their parts, experimental
26
+ * split amounts and descriptions. Shared by the new-run wizard and the
27
+ * edit-run-parents view.
28
+ */
29
+ export declare function useParentRunSelection(): ParentRunSelection;
@@ -0,0 +1,13 @@
1
+ import { ParentRunSelectionState } from '../hooks/useParentRunSelection';
2
+ export type RunParentPayload = {
3
+ run_id: number;
4
+ parent_run_id: number;
5
+ part_ids: number[];
6
+ amount_per_part: Record<number, number> | null;
7
+ description: string | null;
8
+ };
9
+ /**
10
+ * Builds one createRunParent payload per selected parent run. Parts without an
11
+ * explicit experimental split amount default to 1.
12
+ */
13
+ export declare function buildRunParentPayloads(runId: number, selection: ParentRunSelectionState): RunParentPayload[];
@@ -7,7 +7,10 @@ type UpdateRunStepPartCacheOptions = {
7
7
  type UpdateRunStepPartCacheByRunStepOptions = UpdateRunStepPartCacheOptions | {
8
8
  latestActions: RunStepPartState[] | ApiFormattedResponse<RunStepPartState>;
9
9
  };
10
+ type UpsertRunStepPartCacheOptions = {
11
+ updateSubsequent?: boolean;
12
+ };
10
13
  export declare const updateRunStepPartCache: (queryClient: QueryClient, options: UpdateRunStepPartCacheOptions) => void;
11
14
  export declare const updateRunStepPartCacheByRunStep: (queryClient: QueryClient, runStep: RunStep, options: UpdateRunStepPartCacheByRunStepOptions) => void;
12
- export declare const upsertRunStepPartCache: (queryClient: QueryClient, runStep: RunStep, runStepPart: RunStepPart) => void;
15
+ export declare const upsertRunStepPartCache: (queryClient: QueryClient, runStep: RunStep, runStepPart: RunStepPart, options?: UpsertRunStepPartCacheOptions) => void;
13
16
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jield/solodb-react-components",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "repository": "jield-webdev/solodb-react-components",
6
6
  "main": "./dist/index.cjs",
@@ -27,7 +27,7 @@
27
27
  "coverage": "vitest run --coverage"
28
28
  },
29
29
  "dependencies": {
30
- "@jield/solodb-typescript-core": "1.2.0",
30
+ "@jield/solodb-typescript-core": "1.2.2",
31
31
  "@testing-library/dom": "^10.4.1",
32
32
  "moment": "^2.30.1",
33
33
  "moment-timezone": "^0.6.2",
@@ -35,7 +35,7 @@
35
35
  "react-bootstrap": "^2.10.10",
36
36
  "react-dropzone": "^15.0.0",
37
37
  "react-google-charts": "^5.2.1",
38
- "react-hook-form": "^7.77.0",
38
+ "react-hook-form": "^7.79.0",
39
39
  "react-intersection-observer": "^10.0.3",
40
40
  "react-markdown": "^10.1.0",
41
41
  "react-select": "^5.10.2",
@@ -57,23 +57,23 @@
57
57
  "@testing-library/jest-dom": "^6.9.1",
58
58
  "@testing-library/react": "^16.3.2",
59
59
  "@testing-library/user-event": "^14.6.1",
60
- "@types/node": "^25.9.1",
61
- "@types/react": "^19.2.16",
60
+ "@types/node": "^25.9.3",
61
+ "@types/react": "^19.2.17",
62
62
  "@types/react-dom": "^19.2.3",
63
63
  "@types/react-router-dom": "^5.3.3",
64
64
  "@vitejs/plugin-react": "^6.0.2",
65
- "@vitest/coverage-v8": "^4.1.8",
66
- "axios": "^1.17.0",
65
+ "@vitest/coverage-v8": "^4.1.9",
66
+ "axios": "^1.18.0",
67
67
  "jsdom": "^29.1.1",
68
- "prettier": "^3.8.3",
68
+ "prettier": "^3.8.4",
69
69
  "prop-types": "^15.8.1",
70
70
  "react": "^19.2.7",
71
71
  "react-dom": "^19.2.7",
72
- "react-router-dom": "^7.17.0",
72
+ "react-router-dom": "^7.18.0",
73
73
  "typescript": "^6.0.3",
74
74
  "vite": "^8.0.16",
75
75
  "vite-plugin-dts": "^5.0.2",
76
- "vitest": "^4.1.8"
76
+ "vitest": "^4.1.9"
77
77
  },
78
- "packageManager": "yarn@4.16.0"
78
+ "packageManager": "yarn@4.17.0"
79
79
  }