diff --git a/src/frontend/lib/index.ts b/src/frontend/lib/index.ts index 6544d038e0..23b72da45d 100644 --- a/src/frontend/lib/index.ts +++ b/src/frontend/lib/index.ts @@ -9,6 +9,7 @@ export { // Common type definitions export { ApiEndpoints } from './enums/ApiEndpoints'; export { ModelType } from './enums/ModelType'; +export type { ModelDict } from './enums/ModelInformation'; export { UserRoles, UserPermissions } from './enums/Roles'; export type { InvenTreePluginContext } from './types/Plugins'; diff --git a/src/frontend/lib/types/Plugins.tsx b/src/frontend/lib/types/Plugins.tsx index 0f1bb08901..465195fc13 100644 --- a/src/frontend/lib/types/Plugins.tsx +++ b/src/frontend/lib/types/Plugins.tsx @@ -2,6 +2,7 @@ import type { MantineColorScheme, MantineTheme } from '@mantine/core'; import type { QueryClient } from '@tanstack/react-query'; import type { AxiosInstance } from 'axios'; import type { NavigateFunction } from 'react-router-dom'; +import type { ModelDict } from '../enums/ModelInformation'; import type { ModelType } from '../enums/ModelType'; import type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms'; import type { UseModalReturn } from './Modals'; @@ -43,6 +44,7 @@ export type InvenTreeFormsContext = { * @param host - The current host URL * @param locale - The current locale string (e.g. 'en' / 'de') * @param model - The model type associated with the rendered component (if applicable) + * @param modelInformation - A dictionary of available model information * @param id - The ID (primary key) of the model instance for the plugin (if applicable) * @param instance - The model instance data (if available) * @param reloadContent - A function which can be called to reload the plugin content @@ -56,6 +58,7 @@ export type InvenTreePluginContext = { user: UserStateProps; userSettings: SettingsStateProps; globalSettings: SettingsStateProps; + modelInformation: ModelDict; host: string; locale: string; navigate: NavigateFunction; diff --git a/src/frontend/package.json b/src/frontend/package.json index 361d5bd58c..a8cf935080 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@inventreedb/ui", "description": "UI components for the InvenTree project", - "version": "0.2.2", + "version": "0.2.3", "private": false, "type": "module", "license": "MIT", diff --git a/src/frontend/src/components/plugins/PluginContext.tsx b/src/frontend/src/components/plugins/PluginContext.tsx index fea256c204..91bd46f402 100644 --- a/src/frontend/src/components/plugins/PluginContext.tsx +++ b/src/frontend/src/components/plugins/PluginContext.tsx @@ -10,6 +10,7 @@ import { } from '../../states/SettingsState'; import { useUserState } from '../../states/UserState'; +import { ModelInformationDict } from '@lib/enums/ModelInformation'; import { INVENTREE_MANTINE_VERSION, INVENTREE_PLUGIN_VERSION, @@ -48,6 +49,7 @@ export const useInvenTreeContext = () => { navigate: navigate, globalSettings: globalSettings, userSettings: userSettings, + modelInformation: ModelInformationDict, theme: theme, colorScheme: colorScheme, forms: {