@inventreedb/ui 0.6.0 → 0.8.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/.vite/manifest.json +162 -1
  3. package/dist/components/ProgressBar.d.ts +1 -0
  4. package/dist/components/ProgressBar.js +12 -4
  5. package/dist/components/ProgressBar.js.map +1 -1
  6. package/dist/components/RowActions.js +1 -2
  7. package/dist/components/RowActions.js.map +1 -1
  8. package/dist/enums/ApiEndpoints.d.ts +11 -4
  9. package/dist/enums/ApiEndpoints.js +10 -3
  10. package/dist/enums/ApiEndpoints.js.map +1 -1
  11. package/dist/enums/ModelInformation.d.ts +1 -0
  12. package/dist/enums/ModelInformation.js +34 -8
  13. package/dist/enums/ModelInformation.js.map +1 -1
  14. package/dist/enums/ModelType.d.ts +2 -1
  15. package/dist/enums/ModelType.js +2 -1
  16. package/dist/enums/ModelType.js.map +1 -1
  17. package/dist/functions/Conversion.d.ts +1 -0
  18. package/dist/functions/Conversion.js.map +1 -1
  19. package/dist/functions/Events.js +3 -4
  20. package/dist/functions/Events.js.map +1 -1
  21. package/dist/functions/Navigation.d.ts +5 -0
  22. package/dist/functions/Navigation.js +2 -5
  23. package/dist/functions/Navigation.js.map +1 -1
  24. package/dist/functions/Plugins.js +2 -4
  25. package/dist/functions/Plugins.js.map +1 -1
  26. package/dist/hooks/MonitorDataOutput.d.ts +10 -0
  27. package/dist/hooks/MonitorDataOutput.js +112 -0
  28. package/dist/hooks/MonitorDataOutput.js.map +1 -0
  29. package/dist/index.d.ts +3 -1
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/node_modules/@mantine/hooks/esm/use-document-visibility/use-document-visibility.js +16 -0
  33. package/dist/node_modules/@mantine/hooks/esm/use-document-visibility/use-document-visibility.js.map +1 -0
  34. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +14 -0
  35. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -0
  36. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +14 -0
  37. package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -0
  38. package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js +67 -0
  39. package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  40. package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.js +84 -0
  41. package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  42. package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js +57 -0
  43. package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  44. package/dist/node_modules/@tanstack/query-core/build/modern/query.js +16 -0
  45. package/dist/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  46. package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js +456 -0
  47. package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  48. package/dist/node_modules/@tanstack/query-core/build/modern/retryer.js +8 -0
  49. package/dist/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  50. package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.js +25 -0
  51. package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  52. package/dist/node_modules/@tanstack/query-core/build/modern/thenable.js +35 -0
  53. package/dist/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  54. package/dist/node_modules/@tanstack/query-core/build/modern/utils.js +123 -0
  55. package/dist/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  56. package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +8 -0
  57. package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  58. package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +17 -0
  59. package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  60. package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +22 -0
  61. package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  62. package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +29 -0
  63. package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  64. package/dist/node_modules/@tanstack/react-query/build/modern/suspense.js +26 -0
  65. package/dist/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  66. package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +92 -0
  67. package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  68. package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
  69. package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  70. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +15 -19
  71. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
  72. package/dist/types/Auth.d.ts +13 -1
  73. package/dist/types/Core.d.ts +2 -2
  74. package/dist/types/Filters.d.ts +1 -1
  75. package/dist/types/Forms.d.ts +19 -0
  76. package/dist/types/Plugins.d.ts +13 -1
  77. package/dist/types/Plugins.js +3 -3
  78. package/dist/types/Plugins.js.map +1 -1
  79. package/dist/types/Settings.d.ts +2 -0
  80. package/dist/types/Tables.d.ts +6 -0
  81. package/lib/components/ProgressBar.tsx +8 -4
  82. package/lib/enums/ApiEndpoints.tsx +13 -4
  83. package/lib/enums/ModelInformation.tsx +25 -8
  84. package/lib/enums/ModelType.tsx +2 -1
  85. package/lib/functions/Conversion.tsx +38 -0
  86. package/lib/functions/Navigation.tsx +22 -0
  87. package/lib/hooks/MonitorDataOutput.tsx +122 -0
  88. package/lib/index.ts +14 -1
  89. package/lib/types/Auth.tsx +13 -1
  90. package/lib/types/Core.tsx +2 -2
  91. package/lib/types/Filters.tsx +1 -1
  92. package/lib/types/Forms.tsx +20 -0
  93. package/lib/types/Plugins.tsx +18 -1
  94. package/lib/types/Settings.tsx +2 -0
  95. package/lib/types/Tables.tsx +6 -0
  96. package/package.json +11 -9
@@ -1,5 +1,16 @@
1
1
  export interface AuthContext {
2
2
  status: number;
3
+ user?: {
4
+ id: number;
5
+ display: string;
6
+ has_usable_password: boolean;
7
+ username: string;
8
+ };
9
+ methods?: {
10
+ method: string;
11
+ at: number;
12
+ username: string;
13
+ }[];
3
14
  data: { flows: Flow[] };
4
15
  meta: { is_authenticated: boolean };
5
16
  }
@@ -14,7 +25,8 @@ export enum FlowEnum {
14
25
  MfaAuthenticate = 'mfa_authenticate',
15
26
  Reauthenticate = 'reauthenticate',
16
27
  MfaReauthenticate = 'mfa_reauthenticate',
17
- MfaTrust = 'mfa_trust'
28
+ MfaTrust = 'mfa_trust',
29
+ MfaRegister = 'mfa_register'
18
30
  }
19
31
 
20
32
  export interface Flow {
@@ -1,4 +1,4 @@
1
- import type { MantineSize } from '@mantine/core';
1
+ import type { MantineRadius, MantineSize } from '@mantine/core';
2
2
 
3
3
  export type UiSizeType = MantineSize | string | number;
4
4
 
@@ -6,7 +6,7 @@ export interface UserTheme {
6
6
  primaryColor: string;
7
7
  whiteColor: string;
8
8
  blackColor: string;
9
- radius: UiSizeType;
9
+ radius: MantineRadius;
10
10
  loader: string;
11
11
  }
12
12
 
@@ -39,7 +39,7 @@ export type TableFilterType = 'boolean' | 'choice' | 'date' | 'text' | 'api';
39
39
  */
40
40
  export type TableFilter = {
41
41
  name: string;
42
- label: string;
42
+ label?: string;
43
43
  description?: string;
44
44
  type?: TableFilterType;
45
45
  choices?: TableFilterChoice[];
@@ -48,14 +48,19 @@ export type ApiFormFieldHeader = {
48
48
  * @param model : The model to use for related fields
49
49
  * @param filters : Optional API filters to apply to related fields
50
50
  * @param required : Whether the field is required
51
+ * @param allow_null: Whether the field allows null values
52
+ * @param allow_blank: Whether the field allows blank values
51
53
  * @param hidden : Whether the field is hidden
52
54
  * @param disabled : Whether the field is disabled
53
55
  * @param error : Optional error message to display
54
56
  * @param exclude : Whether to exclude the field from the submitted data
55
57
  * @param placeholder : The placeholder text to display
58
+ * @param placeholderAutofill: Whether to allow auto-filling of the placeholder value
56
59
  * @param description : The description to display for the field
57
60
  * @param preFieldContent : Content to render before the field
58
61
  * @param postFieldContent : Content to render after the field
62
+ * @param leftSection : Content to render in the left section of the field
63
+ * @param rightSection : Content to render in the right section of the field
59
64
  * @param autoFill: Whether to automatically fill the field with data from the API
60
65
  * @param autoFillFilters: Optional filters to apply when auto-filling the field
61
66
  * @param onValueChange : Callback function to call when the field value changes
@@ -100,12 +105,19 @@ export type ApiFormFieldType = {
100
105
  choices?: ApiFormFieldChoice[];
101
106
  hidden?: boolean;
102
107
  disabled?: boolean;
108
+ allow_null?: boolean;
109
+ allow_blank?: boolean;
103
110
  exclude?: boolean;
104
111
  read_only?: boolean;
105
112
  placeholder?: string;
113
+ placeholderAutofill?: boolean;
114
+ placeholderWarningCompare?: string | number;
115
+ placeholderWarning?: string;
106
116
  description?: string;
107
117
  preFieldContent?: JSX.Element;
108
118
  postFieldContent?: JSX.Element;
119
+ leftSection?: JSX.Element;
120
+ rightSection?: JSX.Element;
109
121
  autoFill?: boolean;
110
122
  autoFillFilters?: any;
111
123
  adjustValue?: (value: any) => any;
@@ -191,3 +203,11 @@ export interface ApiFormModalProps extends ApiFormProps {
191
203
  export interface BulkEditApiFormModalProps extends ApiFormModalProps {
192
204
  items: number[];
193
205
  }
206
+
207
+ export type StockOperationProps = {
208
+ items?: any[];
209
+ pk?: number;
210
+ filters?: any;
211
+ model: ModelType.stockitem | 'location' | ModelType.part;
212
+ refresh: () => void;
213
+ };
@@ -5,7 +5,11 @@ import type { AxiosInstance } from 'axios';
5
5
  import type { NavigateFunction } from 'react-router-dom';
6
6
  import type { ModelDict } from '../enums/ModelInformation';
7
7
  import type { ModelType } from '../enums/ModelType';
8
- import type { ApiFormModalProps, BulkEditApiFormModalProps } from './Forms';
8
+ import type {
9
+ ApiFormModalProps,
10
+ BulkEditApiFormModalProps,
11
+ StockOperationProps
12
+ } from './Forms';
9
13
  import type { UseModalReturn } from './Modals';
10
14
  import type { RenderInstanceProps } from './Rendering';
11
15
  import type { SettingsStateProps } from './Settings';
@@ -24,11 +28,24 @@ export interface PluginVersion {
24
28
  mantine: string;
25
29
  }
26
30
 
31
+ export type StockAdjustmentFormsContext = {
32
+ addStock: (props: StockOperationProps) => UseModalReturn;
33
+ assignStock: (props: StockOperationProps) => UseModalReturn;
34
+ changeStatus: (props: StockOperationProps) => UseModalReturn;
35
+ countStock: (props: StockOperationProps) => UseModalReturn;
36
+ deleteStock: (props: StockOperationProps) => UseModalReturn;
37
+ mergeStock: (props: StockOperationProps) => UseModalReturn;
38
+ removeStock: (props: StockOperationProps) => UseModalReturn;
39
+ transferStock: (props: StockOperationProps) => UseModalReturn;
40
+ returnStock: (props: StockOperationProps) => UseModalReturn;
41
+ };
42
+
27
43
  export type InvenTreeFormsContext = {
28
44
  bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;
29
45
  create: (props: ApiFormModalProps) => UseModalReturn;
30
46
  delete: (props: ApiFormModalProps) => UseModalReturn;
31
47
  edit: (props: ApiFormModalProps) => UseModalReturn;
48
+ stockActions: StockAdjustmentFormsContext;
32
49
  };
33
50
 
34
51
  /**
@@ -34,6 +34,8 @@ export interface Setting {
34
34
  method?: string;
35
35
  required?: boolean;
36
36
  read_only?: boolean;
37
+ confirm?: boolean;
38
+ confirm_text?: string;
37
39
  }
38
40
 
39
41
  export interface SettingChoice {
@@ -99,6 +99,8 @@ export type TableState = {
99
99
  * @param cellsStyle - The style of the cells in the column
100
100
  * @param extra - Extra data to pass to the render function
101
101
  * @param noContext - Disable context menu for this column
102
+ * @param copyable - Enable copy button on hover (uses accessor to get value, or custom function)
103
+ * @param copyAccessor - Custom accessor path for copy value (defaults to column accessor)
102
104
  */
103
105
  export type TableColumnProps<T = any> = {
104
106
  accessor?: string;
@@ -123,6 +125,8 @@ export type TableColumnProps<T = any> = {
123
125
  extra?: any;
124
126
  noContext?: boolean;
125
127
  style?: MantineStyleProp;
128
+ copyable?: boolean | ((record: T) => string);
129
+ copyAccessor?: string;
126
130
  };
127
131
 
128
132
  /**
@@ -173,6 +177,7 @@ export type RowViewProps = RowAction & RowModelProps;
173
177
  * @param barcodeActions : any[] - List of barcode actions
174
178
  * @param tableFilters : TableFilter[] - List of custom filters
175
179
  * @param tableActions : any[] - List of custom action groups
180
+ * @param detailAction: boolean - Enable detail action for each row (default = true)
176
181
  * @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format)
177
182
  * @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions
178
183
  * @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked
@@ -204,6 +209,7 @@ export type InvenTreeTableProps<T = any> = {
204
209
  rowExpansion?: DataTableRowExpansionProps<T>;
205
210
  dataFormatter?: (data: any) => any;
206
211
  rowActions?: (record: T) => RowAction[];
212
+ detailAction?: boolean;
207
213
  onRowClick?: (record: T, index: number, event: any) => void;
208
214
  onCellClick?: DataTableCellClickHandler<T>;
209
215
  modelType?: ModelType;
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.6.0",
4
+ "version": "0.8.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -40,14 +40,14 @@
40
40
  "compile": "lingui compile --typescript"
41
41
  },
42
42
  "dependencies": {
43
- "@codemirror/autocomplete": "6.18.6",
43
+ "@codemirror/autocomplete": "6.18.7",
44
44
  "@codemirror/lang-liquid": "6.3.0",
45
45
  "@codemirror/language": "6.11.3",
46
46
  "@codemirror/lint": "6.8.5",
47
47
  "@codemirror/search": "6.5.11",
48
48
  "@codemirror/state": "6.5.2",
49
49
  "@codemirror/theme-one-dark": "6.1.3",
50
- "@codemirror/view": "6.38.1",
50
+ "@codemirror/view": "6.38.2",
51
51
  "@emotion/react": "^11.13.3",
52
52
  "@fortawesome/fontawesome-svg-core": "^7.0.0",
53
53
  "@fortawesome/free-regular-svg-icons": "^7.0.0",
@@ -57,6 +57,7 @@
57
57
  "@fullcalendar/daygrid": "^6.1.15",
58
58
  "@fullcalendar/interaction": "^6.1.15",
59
59
  "@fullcalendar/react": "^6.1.15",
60
+ "@github/webauthn-json": "^2.1.1",
60
61
  "@lingui/core": "^5.3.1",
61
62
  "@lingui/react": "^5.3.1",
62
63
  "@mantine/carousel": "^8.2.7",
@@ -90,11 +91,11 @@
90
91
  "mantine-contextmenu": "^8.2.0",
91
92
  "mantine-datatable": "^8.2.0",
92
93
  "qrcode": "^1.5.4",
93
- "react": "^19.1.1",
94
- "react-dom": "^19.1.1",
94
+ "react": "^19.1.2",
95
+ "react-dom": "^19.1.2",
95
96
  "react-grid-layout": "1.4.4",
96
97
  "react-hook-form": "^7.62.0",
97
- "react-is": "^19.1.1",
98
+ "react-is": "^19.1.2",
98
99
  "react-router-dom": "^6.26.2",
99
100
  "react-select": "^5.9.0",
100
101
  "react-simplemde-editor": "^5.2.0",
@@ -112,7 +113,7 @@
112
113
  "@lingui/babel-plugin-lingui-macro": "^5.3.1",
113
114
  "@lingui/cli": "^5.3.1",
114
115
  "@lingui/macro": "^5.3.1",
115
- "@playwright/test": "^1.52.0",
116
+ "@playwright/test": "1.56.0",
116
117
  "@types/node": "^24.3.0",
117
118
  "@types/qrcode": "^1.5.5",
118
119
  "@types/react": "^19.1.10",
@@ -120,15 +121,16 @@
120
121
  "@types/react-grid-layout": "^1.3.5",
121
122
  "@types/react-router-dom": "^5.3.3",
122
123
  "@types/react-window": "^1.8.8",
123
- "@vanilla-extract/vite-plugin": "^5.0.1",
124
+ "@vanilla-extract/vite-plugin": "^5.1.1",
124
125
  "@vitejs/plugin-react": "^5.0.2",
125
126
  "babel-plugin-macros": "^3.1.0",
126
127
  "nyc": "^17.1.0",
128
+ "otpauth": "^9.4.1",
127
129
  "path": "^0.12.7",
128
130
  "rollup": "^4.0.0",
129
131
  "rollup-plugin-license": "^3.5.3",
130
132
  "typescript": "^5.8.2",
131
- "vite": "^6.2.6",
133
+ "vite": "7.1.11",
132
134
  "vite-plugin-babel-macros": "^1.0.6",
133
135
  "vite-plugin-dts": "^4.5.3",
134
136
  "vite-plugin-externals": "^0.6.2",