@inventreedb/ui 0.0.5 → 0.0.7
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.
- package/dist/.vite/manifest.json +6 -0
- package/dist/enums/Roles.js +25 -0
- package/dist/enums/Roles.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Plugins.d.ts +4 -0
- package/dist/types/Plugins.js +1 -1
- package/dist/types/Plugins.js.map +1 -1
- package/lib/index.ts +1 -0
- package/lib/types/Plugins.tsx +4 -0
- package/package.json +2 -2
package/dist/.vite/manifest.json
CHANGED
|
@@ -59,6 +59,11 @@
|
|
|
59
59
|
"name": "enums/ModelType",
|
|
60
60
|
"src": "lib/enums/ModelType.tsx"
|
|
61
61
|
},
|
|
62
|
+
"lib/enums/Roles.tsx": {
|
|
63
|
+
"file": "enums/Roles.js",
|
|
64
|
+
"name": "enums/Roles",
|
|
65
|
+
"src": "lib/enums/Roles.tsx"
|
|
66
|
+
},
|
|
62
67
|
"lib/functions/Api.tsx": {
|
|
63
68
|
"file": "functions/Api.js",
|
|
64
69
|
"name": "functions/Api",
|
|
@@ -95,6 +100,7 @@
|
|
|
95
100
|
"lib/types/Plugins.tsx",
|
|
96
101
|
"lib/enums/ApiEndpoints.tsx",
|
|
97
102
|
"lib/enums/ModelType.tsx",
|
|
103
|
+
"lib/enums/Roles.tsx",
|
|
98
104
|
"lib/functions/Api.tsx",
|
|
99
105
|
"lib/functions/Navigation.tsx",
|
|
100
106
|
"lib/functions/Plugins.tsx"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var UserRoles = /* @__PURE__ */ ((UserRoles2) => {
|
|
2
|
+
UserRoles2["admin"] = "admin";
|
|
3
|
+
UserRoles2["build"] = "build";
|
|
4
|
+
UserRoles2["part"] = "part";
|
|
5
|
+
UserRoles2["part_category"] = "part_category";
|
|
6
|
+
UserRoles2["purchase_order"] = "purchase_order";
|
|
7
|
+
UserRoles2["return_order"] = "return_order";
|
|
8
|
+
UserRoles2["sales_order"] = "sales_order";
|
|
9
|
+
UserRoles2["stock"] = "stock";
|
|
10
|
+
UserRoles2["stock_location"] = "stock_location";
|
|
11
|
+
UserRoles2["stocktake"] = "stocktake";
|
|
12
|
+
return UserRoles2;
|
|
13
|
+
})(UserRoles || {});
|
|
14
|
+
var UserPermissions = /* @__PURE__ */ ((UserPermissions2) => {
|
|
15
|
+
UserPermissions2["view"] = "view";
|
|
16
|
+
UserPermissions2["add"] = "add";
|
|
17
|
+
UserPermissions2["change"] = "change";
|
|
18
|
+
UserPermissions2["delete"] = "delete";
|
|
19
|
+
return UserPermissions2;
|
|
20
|
+
})(UserPermissions || {});
|
|
21
|
+
export {
|
|
22
|
+
UserPermissions,
|
|
23
|
+
UserRoles
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Roles.js","sources":["../../lib/enums/Roles.tsx"],"sourcesContent":["/*\n * Enumeration of available user role groups\n */\nexport enum UserRoles {\n admin = 'admin',\n build = 'build',\n part = 'part',\n part_category = 'part_category',\n purchase_order = 'purchase_order',\n return_order = 'return_order',\n sales_order = 'sales_order',\n stock = 'stock',\n stock_location = 'stock_location',\n stocktake = 'stocktake'\n}\n\n/*\n * Enumeration of available user permissions within each role group\n */\nexport enum UserPermissions {\n view = 'view',\n add = 'add',\n change = 'change',\n delete = 'delete'\n}\n"],"names":["UserRoles","admin","build","part","part_category","purchase_order","return_order","sales_order","stock","stock_location","stocktake","UserPermissions","view","add","change","delete"],"mappings":"AAGYA,IAAAA,8BAAAA,eAAL;AACLC,aAAAA,OAAQ,IAAA;AACRC,aAAAA,OAAQ,IAAA;AACRC,aAAAA,MAAO,IAAA;AACPC,aAAAA,eAAgB,IAAA;AAChBC,aAAAA,gBAAiB,IAAA;AACjBC,aAAAA,cAAe,IAAA;AACfC,aAAAA,aAAc,IAAA;AACdC,aAAAA,OAAQ,IAAA;AACRC,aAAAA,gBAAiB,IAAA;AACjBC,aAAAA,WAAY,IAAA;AAVFV,SAAAA;AAAAA,GAAAA,aAAAA,CAAAA,CAAAA;AAgBAW,IAAAA,oCAAAA,qBAAL;AACLC,mBAAAA,MAAO,IAAA;AACPC,mBAAAA,KAAM,IAAA;AACNC,mBAAAA,QAAS,IAAA;AACTC,mBAAAA,QAAS,IAAA;AAJCJ,SAAAA;AAAAA,GAAAA,mBAAAA,CAAAA,CAAAA;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { INVENTREE_PLUGIN_VERSION } from './types/Plugins';
|
|
2
2
|
export { ApiEndpoints } from './enums/ApiEndpoints';
|
|
3
3
|
export { ModelType } from './enums/ModelType';
|
|
4
|
+
export { UserRoles, UserPermissions } from './enums/Roles';
|
|
4
5
|
export type { InvenTreePluginContext } from './types/Plugins';
|
|
5
6
|
export { apiUrl } from './functions/Api';
|
|
6
7
|
export { getBaseUrl, getDetailUrl, navigateToLink } from './functions/Navigation';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { INVENTREE_PLUGIN_VERSION } from "./types/Plugins.js";
|
|
2
2
|
import { ApiEndpoints } from "./enums/ApiEndpoints.js";
|
|
3
3
|
import { ModelType } from "./enums/ModelType.js";
|
|
4
|
+
import { UserPermissions, UserRoles } from "./enums/Roles.js";
|
|
4
5
|
import { apiUrl } from "./functions/Api.js";
|
|
5
6
|
import { getBaseUrl, getDetailUrl, navigateToLink } from "./functions/Navigation.js";
|
|
6
7
|
import { checkPluginVersion } from "./functions/Plugins.js";
|
|
@@ -8,6 +9,8 @@ export {
|
|
|
8
9
|
ApiEndpoints,
|
|
9
10
|
INVENTREE_PLUGIN_VERSION,
|
|
10
11
|
ModelType,
|
|
12
|
+
UserPermissions,
|
|
13
|
+
UserRoles,
|
|
11
14
|
apiUrl,
|
|
12
15
|
checkPluginVersion,
|
|
13
16
|
getBaseUrl,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/dist/types/Plugins.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type InvenTreeFormsContext = {
|
|
|
35
35
|
* @param model - The model type associated with the rendered component (if applicable)
|
|
36
36
|
* @param id - The ID (primary key) of the model instance for the plugin (if applicable)
|
|
37
37
|
* @param instance - The model instance data (if available)
|
|
38
|
+
* @param reloadContent - A function which can be called to reload the plugin content
|
|
39
|
+
* @param reloadInstance - A function which can be called to reload the model instance
|
|
38
40
|
* @param context - Any additional context data which may be passed to the plugin
|
|
39
41
|
*/
|
|
40
42
|
export type InvenTreePluginContext = {
|
|
@@ -53,6 +55,8 @@ export type InvenTreePluginContext = {
|
|
|
53
55
|
model?: ModelType | string;
|
|
54
56
|
id?: string | number | null;
|
|
55
57
|
instance?: any;
|
|
58
|
+
reloadContent?: () => void;
|
|
59
|
+
reloadInstance?: () => void;
|
|
56
60
|
context?: any;
|
|
57
61
|
};
|
|
58
62
|
export declare const INVENTREE_PLUGIN_VERSION: string;
|
package/dist/types/Plugins.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugins.js","sources":["../../lib/types/Plugins.tsx"],"sourcesContent":["import type { MantineColorScheme, MantineTheme } from '@mantine/core';\nimport type { QueryClient } from '@tanstack/react-query';\nimport type { AxiosInstance } from 'axios';\nimport type { NavigateFunction } from 'react-router-dom';\nimport type { ModelType } from '../enums/ModelType';\nimport type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';\nimport type { UseModalReturn } from './Modals';\nimport type { SettingsStateProps } from './Settings';\nimport type { UserStateProps } from './User';\n\nexport interface PluginProps {\n name: string;\n slug: string;\n version: null | string;\n}\n\nexport type InvenTreeFormsContext = {\n bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;\n create: (props: ApiFormModalProps) => UseModalReturn;\n delete: (props: ApiFormModalProps) => UseModalReturn;\n edit: (props: ApiFormModalProps) => UseModalReturn;\n};\n\n/**\n * A set of properties which are passed to a plugin,\n * for rendering an element in the user interface.\n *\n * @param version - The version of the running InvenTree software stack\n * @param api - The Axios API instance (see ../states/ApiState.tsx)\n * @param user - The current user instance (see ../states/UserState.tsx)\n * @param userSettings - The current user settings (see ../states/SettingsState.tsx)\n * @param globalSettings - The global settings (see ../states/SettingsState.tsx)\n * @param navigate - The navigation function (see react-router-dom)\n * @param theme - The current Mantine theme\n * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')\n * @param host - The current host URL\n * @param locale - The current locale string (e.g. 'en' / 'de')\n * @param model - The model type associated with the rendered component (if applicable)\n * @param id - The ID (primary key) of the model instance for the plugin (if applicable)\n * @param instance - The model instance data (if available)\n * @param context - Any additional context data which may be passed to the plugin\n */\nexport type InvenTreePluginContext = {\n version: string;\n api: AxiosInstance;\n queryClient: QueryClient;\n user: UserStateProps;\n userSettings: SettingsStateProps;\n globalSettings: SettingsStateProps;\n host: string;\n locale: string;\n navigate: NavigateFunction;\n theme: MantineTheme;\n forms: InvenTreeFormsContext;\n colorScheme: MantineColorScheme;\n model?: ModelType | string;\n id?: string | number | null;\n instance?: any;\n context?: any;\n};\n\n/*\n * The version of the InvenTree plugin context interface.\n * This number should be incremented if the interface changes.\n */\n\n// @ts-ignore\nexport const INVENTREE_PLUGIN_VERSION: string = __INVENTREE_LIB_VERSION__;\n"],"names":["INVENTREE_PLUGIN_VERSION","__INVENTREE_LIB_VERSION__"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Plugins.js","sources":["../../lib/types/Plugins.tsx"],"sourcesContent":["import type { MantineColorScheme, MantineTheme } from '@mantine/core';\nimport type { QueryClient } from '@tanstack/react-query';\nimport type { AxiosInstance } from 'axios';\nimport type { NavigateFunction } from 'react-router-dom';\nimport type { ModelType } from '../enums/ModelType';\nimport type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';\nimport type { UseModalReturn } from './Modals';\nimport type { SettingsStateProps } from './Settings';\nimport type { UserStateProps } from './User';\n\nexport interface PluginProps {\n name: string;\n slug: string;\n version: null | string;\n}\n\nexport type InvenTreeFormsContext = {\n bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;\n create: (props: ApiFormModalProps) => UseModalReturn;\n delete: (props: ApiFormModalProps) => UseModalReturn;\n edit: (props: ApiFormModalProps) => UseModalReturn;\n};\n\n/**\n * A set of properties which are passed to a plugin,\n * for rendering an element in the user interface.\n *\n * @param version - The version of the running InvenTree software stack\n * @param api - The Axios API instance (see ../states/ApiState.tsx)\n * @param user - The current user instance (see ../states/UserState.tsx)\n * @param userSettings - The current user settings (see ../states/SettingsState.tsx)\n * @param globalSettings - The global settings (see ../states/SettingsState.tsx)\n * @param navigate - The navigation function (see react-router-dom)\n * @param theme - The current Mantine theme\n * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')\n * @param host - The current host URL\n * @param locale - The current locale string (e.g. 'en' / 'de')\n * @param model - The model type associated with the rendered component (if applicable)\n * @param id - The ID (primary key) of the model instance for the plugin (if applicable)\n * @param instance - The model instance data (if available)\n * @param reloadContent - A function which can be called to reload the plugin content\n * @param reloadInstance - A function which can be called to reload the model instance\n * @param context - Any additional context data which may be passed to the plugin\n */\nexport type InvenTreePluginContext = {\n version: string;\n api: AxiosInstance;\n queryClient: QueryClient;\n user: UserStateProps;\n userSettings: SettingsStateProps;\n globalSettings: SettingsStateProps;\n host: string;\n locale: string;\n navigate: NavigateFunction;\n theme: MantineTheme;\n forms: InvenTreeFormsContext;\n colorScheme: MantineColorScheme;\n model?: ModelType | string;\n id?: string | number | null;\n instance?: any;\n reloadContent?: () => void;\n reloadInstance?: () => void;\n context?: any;\n};\n\n/*\n * The version of the InvenTree plugin context interface.\n * This number should be incremented if the interface changes.\n */\n\n// @ts-ignore\nexport const INVENTREE_PLUGIN_VERSION: string = __INVENTREE_LIB_VERSION__;\n"],"names":["INVENTREE_PLUGIN_VERSION","__INVENTREE_LIB_VERSION__"],"mappings":"AAuEO,MAAMA,2BAAmCC;"}
|
package/lib/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { INVENTREE_PLUGIN_VERSION } from './types/Plugins';
|
|
|
4
4
|
// Common type definitions
|
|
5
5
|
export { ApiEndpoints } from './enums/ApiEndpoints';
|
|
6
6
|
export { ModelType } from './enums/ModelType';
|
|
7
|
+
export { UserRoles, UserPermissions } from './enums/Roles';
|
|
7
8
|
|
|
8
9
|
export type { InvenTreePluginContext } from './types/Plugins';
|
|
9
10
|
|
package/lib/types/Plugins.tsx
CHANGED
|
@@ -38,6 +38,8 @@ export type InvenTreeFormsContext = {
|
|
|
38
38
|
* @param model - The model type associated with the rendered component (if applicable)
|
|
39
39
|
* @param id - The ID (primary key) of the model instance for the plugin (if applicable)
|
|
40
40
|
* @param instance - The model instance data (if available)
|
|
41
|
+
* @param reloadContent - A function which can be called to reload the plugin content
|
|
42
|
+
* @param reloadInstance - A function which can be called to reload the model instance
|
|
41
43
|
* @param context - Any additional context data which may be passed to the plugin
|
|
42
44
|
*/
|
|
43
45
|
export type InvenTreePluginContext = {
|
|
@@ -56,6 +58,8 @@ export type InvenTreePluginContext = {
|
|
|
56
58
|
model?: ModelType | string;
|
|
57
59
|
id?: string | number | null;
|
|
58
60
|
instance?: any;
|
|
61
|
+
reloadContent?: () => void;
|
|
62
|
+
reloadInstance?: () => void;
|
|
59
63
|
context?: any;
|
|
60
64
|
};
|
|
61
65
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inventreedb/ui",
|
|
3
3
|
"description": "UI components for the InvenTree project",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"rollup": "^4.0.0",
|
|
129
129
|
"rollup-plugin-license": "^3.5.3",
|
|
130
130
|
"typescript": "^5.8.2",
|
|
131
|
-
"vite": "^6.2.
|
|
131
|
+
"vite": "^6.2.5",
|
|
132
132
|
"vite-plugin-babel-macros": "^1.0.6",
|
|
133
133
|
"vite-plugin-dts": "^4.5.3",
|
|
134
134
|
"vite-plugin-istanbul": "^6.0.2"
|