@jield/solodb-react-components 1.0.32 → 1.1.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.
@@ -0,0 +1,2 @@
1
+ import { RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
+ export declare const ACTION_VARIANT: Record<RunStepPartActionEnum, string>;
@@ -1,14 +1,9 @@
1
1
  import { RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
- export interface PartActionsDropdownProps {
3
- availableActions: Set<RunStepPartActionEnum>;
2
+ export interface PartActionsButtonsProps {
3
+ availableActions: {
4
+ id: RunStepPartActionEnum;
5
+ name: string;
6
+ }[];
4
7
  onActionSelected: (action: RunStepPartActionEnum) => void;
5
- showInitAction?: boolean;
6
- onInitSelected?: () => void;
7
8
  }
8
- /**
9
- * Dropdown component for bulk part actions
10
- *
11
- * Renders a dropdown menu with available actions (Start, Finish, Failed, Repair, Testing, Rework)
12
- * and optionally an Init action for production runs.
13
- */
14
- export declare const PartActionsButtons: ({ availableActions, onActionSelected, showInitAction, onInitSelected, }: PartActionsDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
9
+ export declare const PartActionsButtons: ({ availableActions, onActionSelected }: PartActionsButtonsProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,14 +1,14 @@
1
1
  import { RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
2
  export interface PartActionsDropdownProps {
3
- availableActions: Set<RunStepPartActionEnum>;
3
+ availableActions: {
4
+ id: RunStepPartActionEnum;
5
+ name: string;
6
+ }[];
4
7
  onActionSelected: (action: RunStepPartActionEnum) => void;
5
- showInitAction?: boolean;
6
- onInitSelected?: () => void;
7
8
  }
8
9
  /**
9
- * Dropdown component for bulk part actions
10
+ * Dropdown component for bulk part actions.
10
11
  *
11
- * Renders a dropdown menu with available actions (Start, Finish, Failed, Repair, Testing, Rework)
12
- * and optionally an Init action for production runs.
12
+ * Renders a dropdown menu driven by the server-provided `available_actions` array.
13
13
  */
14
- export declare const PartActionsDropdown: ({ availableActions, onActionSelected, showInitAction, onInitSelected, }: PartActionsDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
14
+ export declare const PartActionsDropdown: ({ availableActions, onActionSelected }: PartActionsDropdownProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import { RunStepPartActionEnum, RunStepPart } from '@jield/solodb-typescript-core';
1
+ import { RunStepPart, RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
2
  type Props = {
3
3
  runStepPart: RunStepPart;
4
4
  setRunStepPartAction: ({ runStepPart, runStepPartAction, }: {
@@ -6,5 +6,5 @@ type Props = {
6
6
  runStepPartAction: RunStepPartActionEnum;
7
7
  }) => void;
8
8
  };
9
- declare const RunPartProductionActionsButtons: ({ runStepPart, setRunStepPartAction }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ declare const RunPartProductionActionsButtons: ({ runStepPart, setRunStepPartAction }: Props) => import("react/jsx-runtime").JSX.Element | null;
10
10
  export default RunPartProductionActionsButtons;
@@ -1,4 +1,4 @@
1
- import { RunStepPartActionEnum, RunStepPart } from '@jield/solodb-typescript-core';
1
+ import { RunStepPart, RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
2
  type Props = {
3
3
  runStepPart: RunStepPart;
4
4
  createRunStepPart: () => void;
@@ -7,5 +7,5 @@ type Props = {
7
7
  runStepPartAction: RunStepPartActionEnum;
8
8
  }) => void;
9
9
  };
10
- declare const RunPartProductionActionsDropdown: ({ runStepPart, setRunStepPartAction, createRunStepPart }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ declare const RunPartProductionActionsDropdown: ({ runStepPart, setRunStepPartAction, createRunStepPart, }: Props) => import("react/jsx-runtime").JSX.Element;
11
11
  export default RunPartProductionActionsDropdown;
@@ -1,4 +1,4 @@
1
- import { RunPart, RunStepPart, RunStep } from '@jield/solodb-typescript-core';
1
+ import { RunPart, RunStep, RunStepPart } from '@jield/solodb-typescript-core';
2
2
  type Props = {
3
3
  runPart: RunPart;
4
4
  partIsSelected?: boolean;
@@ -9,12 +9,16 @@ export interface UsePartActionsOptions {
9
9
  }
10
10
  export interface UsePartActionsResult {
11
11
  performActionToSelectedParts: (action: RunStepPartActionEnum) => void;
12
- getAvailableActionsForSelection: () => Set<RunStepPartActionEnum>;
12
+ getAvailableActionsForSelection: () => {
13
+ id: RunStepPartActionEnum;
14
+ name: string;
15
+ }[];
13
16
  }
14
17
  /**
15
- * Hook for managing bulk actions on selected parts
18
+ * Hook for managing bulk actions on selected parts.
16
19
  *
17
- * @param options Configuration object with parts, selection state, and action mappings
18
- * @returns Functions for performing and querying available actions
20
+ * With the new backend architecture, the frontend no longer computes which actions
21
+ * are allowed it reads `runStepPart.available_actions` (server-provided) directly
22
+ * and forwards the chosen action id to `performRunStepPartAction`.
19
23
  */
20
- export declare function usePartActions({ runStep, parts, selectedParts, getRunPart, getRunStepPart, actionsFromScanner, }: UsePartActionsOptions): UsePartActionsResult;
24
+ export declare function usePartActions({ parts, selectedParts, getRunPart, getRunStepPart, actionsFromScanner, }: UsePartActionsOptions): UsePartActionsResult;
@@ -1,9 +1,8 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
- import { RunStep, RunStepPart, RunStepPartActionEnum } from '@jield/solodb-typescript-core';
2
+ import { RunStep, RunStepPart, RunStepPartState } from '@jield/solodb-typescript-core';
3
3
  type UpdateRunStepPartCacheOptions = {
4
4
  runStepPart: RunStepPart;
5
- action: RunStepPartActionEnum;
6
- latestAction?: RunStepPart["latest_action"] | null;
5
+ latestAction: RunStepPartState;
7
6
  };
8
7
  export declare const updateRunStepPartCache: (queryClient: QueryClient, options: UpdateRunStepPartCacheOptions) => void;
9
8
  export declare const updateRunStepPartCacheByRunStep: (queryClient: QueryClient, runStep: RunStep, options: UpdateRunStepPartCacheOptions) => void;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@jield/solodb-react-components",
3
- "version": "1.0.32",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "repository": "jield-webdev/solodb-react-components",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
8
+ "types": "./dist/src/index.d.ts",
9
9
  "sideEffects": false,
10
10
  "exports": {
11
11
  ".": {
12
- "types": "./dist/index.d.ts",
12
+ "types": "./dist/src/index.d.ts",
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs",
15
15
  "default": "./dist/index.js"
@@ -27,7 +27,7 @@
27
27
  "coverage": "vitest run --coverage"
28
28
  },
29
29
  "dependencies": {
30
- "@jield/solodb-typescript-core": "^1.0.24",
30
+ "@jield/solodb-typescript-core": "^1.1.1",
31
31
  "@testing-library/dom": "^10.4.1",
32
32
  "moment": "^2.30.1",
33
33
  "moment-timezone": "^0.6.1",
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}