2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 19:20:55 +00:00

Expose ModelInformationDict to plugins (#9810)

* Expose ModelInformationDict to plugins

* Expose internal modal dict

* Add comment

* Fix import string
This commit is contained in:
Oliver
2025-06-19 21:42:34 +10:00
committed by GitHub
parent 0bbc020a95
commit 6a23341f2a
4 changed files with 7 additions and 1 deletions

View File

@ -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';

View File

@ -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;

View File

@ -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",

View File

@ -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: {