mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 03:30:54 +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:
@ -9,6 +9,7 @@ export {
|
|||||||
// Common type definitions
|
// Common type definitions
|
||||||
export { ApiEndpoints } from './enums/ApiEndpoints';
|
export { ApiEndpoints } from './enums/ApiEndpoints';
|
||||||
export { ModelType } from './enums/ModelType';
|
export { ModelType } from './enums/ModelType';
|
||||||
|
export type { ModelDict } from './enums/ModelInformation';
|
||||||
export { UserRoles, UserPermissions } from './enums/Roles';
|
export { UserRoles, UserPermissions } from './enums/Roles';
|
||||||
|
|
||||||
export type { InvenTreePluginContext } from './types/Plugins';
|
export type { InvenTreePluginContext } from './types/Plugins';
|
||||||
|
@ -2,6 +2,7 @@ import type { MantineColorScheme, MantineTheme } from '@mantine/core';
|
|||||||
import type { QueryClient } from '@tanstack/react-query';
|
import type { QueryClient } from '@tanstack/react-query';
|
||||||
import type { AxiosInstance } from 'axios';
|
import type { AxiosInstance } from 'axios';
|
||||||
import type { NavigateFunction } from 'react-router-dom';
|
import type { NavigateFunction } from 'react-router-dom';
|
||||||
|
import type { ModelDict } from '../enums/ModelInformation';
|
||||||
import type { ModelType } from '../enums/ModelType';
|
import type { ModelType } from '../enums/ModelType';
|
||||||
import type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';
|
import type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';
|
||||||
import type { UseModalReturn } from './Modals';
|
import type { UseModalReturn } from './Modals';
|
||||||
@ -43,6 +44,7 @@ export type InvenTreeFormsContext = {
|
|||||||
* @param host - The current host URL
|
* @param host - The current host URL
|
||||||
* @param locale - The current locale string (e.g. 'en' / 'de')
|
* @param locale - The current locale string (e.g. 'en' / 'de')
|
||||||
* @param model - The model type associated with the rendered component (if applicable)
|
* @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 id - The ID (primary key) of the model instance for the plugin (if applicable)
|
||||||
* @param instance - The model instance data (if available)
|
* @param instance - The model instance data (if available)
|
||||||
* @param reloadContent - A function which can be called to reload the plugin content
|
* @param reloadContent - A function which can be called to reload the plugin content
|
||||||
@ -56,6 +58,7 @@ export type InvenTreePluginContext = {
|
|||||||
user: UserStateProps;
|
user: UserStateProps;
|
||||||
userSettings: SettingsStateProps;
|
userSettings: SettingsStateProps;
|
||||||
globalSettings: SettingsStateProps;
|
globalSettings: SettingsStateProps;
|
||||||
|
modelInformation: ModelDict;
|
||||||
host: string;
|
host: string;
|
||||||
locale: string;
|
locale: string;
|
||||||
navigate: NavigateFunction;
|
navigate: NavigateFunction;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@inventreedb/ui",
|
"name": "@inventreedb/ui",
|
||||||
"description": "UI components for the InvenTree project",
|
"description": "UI components for the InvenTree project",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
} from '../../states/SettingsState';
|
} from '../../states/SettingsState';
|
||||||
import { useUserState } from '../../states/UserState';
|
import { useUserState } from '../../states/UserState';
|
||||||
|
|
||||||
|
import { ModelInformationDict } from '@lib/enums/ModelInformation';
|
||||||
import {
|
import {
|
||||||
INVENTREE_MANTINE_VERSION,
|
INVENTREE_MANTINE_VERSION,
|
||||||
INVENTREE_PLUGIN_VERSION,
|
INVENTREE_PLUGIN_VERSION,
|
||||||
@ -48,6 +49,7 @@ export const useInvenTreeContext = () => {
|
|||||||
navigate: navigate,
|
navigate: navigate,
|
||||||
globalSettings: globalSettings,
|
globalSettings: globalSettings,
|
||||||
userSettings: userSettings,
|
userSettings: userSettings,
|
||||||
|
modelInformation: ModelInformationDict,
|
||||||
theme: theme,
|
theme: theme,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
forms: {
|
forms: {
|
||||||
|
Reference in New Issue
Block a user