@inventreedb/ui 0.7.0 → 0.8.1
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/CHANGELOG.md +4 -0
- package/dist/.vite/manifest.json +162 -1
- package/dist/components/ProgressBar.d.ts +1 -0
- package/dist/components/ProgressBar.js +12 -4
- package/dist/components/ProgressBar.js.map +1 -1
- package/dist/components/RowActions.js +1 -2
- package/dist/components/RowActions.js.map +1 -1
- package/dist/enums/ApiEndpoints.d.ts +11 -4
- package/dist/enums/ApiEndpoints.js +10 -3
- package/dist/enums/ApiEndpoints.js.map +1 -1
- package/dist/enums/ModelInformation.d.ts +1 -0
- package/dist/enums/ModelInformation.js +34 -8
- package/dist/enums/ModelInformation.js.map +1 -1
- package/dist/enums/ModelType.d.ts +2 -1
- package/dist/enums/ModelType.js +2 -1
- package/dist/enums/ModelType.js.map +1 -1
- package/dist/functions/Conversion.d.ts +1 -0
- package/dist/functions/Conversion.js.map +1 -1
- package/dist/functions/Events.js +3 -4
- package/dist/functions/Events.js.map +1 -1
- package/dist/functions/Navigation.d.ts +5 -0
- package/dist/functions/Navigation.js +2 -5
- package/dist/functions/Navigation.js.map +1 -1
- package/dist/functions/Plugins.js +2 -4
- package/dist/functions/Plugins.js.map +1 -1
- package/dist/hooks/MonitorDataOutput.d.ts +12 -0
- package/dist/hooks/MonitorDataOutput.js +113 -0
- package/dist/hooks/MonitorDataOutput.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@mantine/hooks/esm/use-document-visibility/use-document-visibility.js +16 -0
- package/dist/node_modules/@mantine/hooks/esm/use-document-visibility/use-document-visibility.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js +14 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleCheck.js.map +1 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js +14 -0
- package/dist/node_modules/@tabler/icons-react/dist/esm/icons/IconExclamationCircle.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js +67 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.js +84 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js +57 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/query.js +16 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js +456 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/retryer.js +8 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.js +25 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/thenable.js +35 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/utils.js +123 -0
- package/dist/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +8 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +20 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +22 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +29 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/suspense.js +26 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +92 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
- package/dist/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +13 -17
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -1
- package/dist/types/Auth.d.ts +2 -1
- package/dist/types/Filters.d.ts +1 -1
- package/dist/types/Forms.d.ts +12 -0
- package/dist/types/Plugins.js +3 -3
- package/dist/types/Settings.d.ts +2 -0
- package/dist/types/Tables.d.ts +6 -0
- package/lib/components/ProgressBar.tsx +8 -4
- package/lib/enums/ApiEndpoints.tsx +13 -4
- package/lib/enums/ModelInformation.tsx +25 -8
- package/lib/enums/ModelType.tsx +2 -1
- package/lib/functions/Conversion.tsx +38 -0
- package/lib/functions/Navigation.tsx +22 -0
- package/lib/hooks/MonitorDataOutput.tsx +127 -0
- package/lib/index.ts +3 -0
- package/lib/types/Auth.tsx +2 -1
- package/lib/types/Filters.tsx +1 -1
- package/lib/types/Forms.tsx +12 -0
- package/lib/types/Settings.tsx +2 -0
- package/lib/types/Tables.tsx +6 -0
- package/package.json +8 -6
package/dist/types/Forms.d.ts
CHANGED
|
@@ -41,14 +41,19 @@ export type ApiFormFieldHeader = {
|
|
|
41
41
|
* @param model : The model to use for related fields
|
|
42
42
|
* @param filters : Optional API filters to apply to related fields
|
|
43
43
|
* @param required : Whether the field is required
|
|
44
|
+
* @param allow_null: Whether the field allows null values
|
|
45
|
+
* @param allow_blank: Whether the field allows blank values
|
|
44
46
|
* @param hidden : Whether the field is hidden
|
|
45
47
|
* @param disabled : Whether the field is disabled
|
|
46
48
|
* @param error : Optional error message to display
|
|
47
49
|
* @param exclude : Whether to exclude the field from the submitted data
|
|
48
50
|
* @param placeholder : The placeholder text to display
|
|
51
|
+
* @param placeholderAutofill: Whether to allow auto-filling of the placeholder value
|
|
49
52
|
* @param description : The description to display for the field
|
|
50
53
|
* @param preFieldContent : Content to render before the field
|
|
51
54
|
* @param postFieldContent : Content to render after the field
|
|
55
|
+
* @param leftSection : Content to render in the left section of the field
|
|
56
|
+
* @param rightSection : Content to render in the right section of the field
|
|
52
57
|
* @param autoFill: Whether to automatically fill the field with data from the API
|
|
53
58
|
* @param autoFillFilters: Optional filters to apply when auto-filling the field
|
|
54
59
|
* @param onValueChange : Callback function to call when the field value changes
|
|
@@ -77,12 +82,19 @@ export type ApiFormFieldType = {
|
|
|
77
82
|
choices?: ApiFormFieldChoice[];
|
|
78
83
|
hidden?: boolean;
|
|
79
84
|
disabled?: boolean;
|
|
85
|
+
allow_null?: boolean;
|
|
86
|
+
allow_blank?: boolean;
|
|
80
87
|
exclude?: boolean;
|
|
81
88
|
read_only?: boolean;
|
|
82
89
|
placeholder?: string;
|
|
90
|
+
placeholderAutofill?: boolean;
|
|
91
|
+
placeholderWarningCompare?: string | number;
|
|
92
|
+
placeholderWarning?: string;
|
|
83
93
|
description?: string;
|
|
84
94
|
preFieldContent?: JSX.Element;
|
|
85
95
|
postFieldContent?: JSX.Element;
|
|
96
|
+
leftSection?: JSX.Element;
|
|
97
|
+
rightSection?: JSX.Element;
|
|
86
98
|
autoFill?: boolean;
|
|
87
99
|
autoFillFilters?: any;
|
|
88
100
|
adjustValue?: (value: any) => any;
|
package/dist/types/Plugins.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const INVENTREE_PLUGIN_VERSION = "0.
|
|
2
|
-
const INVENTREE_REACT_VERSION = "19.1.
|
|
1
|
+
const INVENTREE_PLUGIN_VERSION = "0.8.1";
|
|
2
|
+
const INVENTREE_REACT_VERSION = "19.1.2";
|
|
3
3
|
const INVENTREE_REACT_DOM_VERSION = (
|
|
4
4
|
// @ts-ignore
|
|
5
|
-
"19.1.
|
|
5
|
+
"19.1.2"
|
|
6
6
|
);
|
|
7
7
|
const INVENTREE_MANTINE_VERSION = "8.2.7";
|
|
8
8
|
export {
|
package/dist/types/Settings.d.ts
CHANGED
package/dist/types/Tables.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export type TableState = {
|
|
|
60
60
|
* @param cellsStyle - The style of the cells in the column
|
|
61
61
|
* @param extra - Extra data to pass to the render function
|
|
62
62
|
* @param noContext - Disable context menu for this column
|
|
63
|
+
* @param copyable - Enable copy button on hover (uses accessor to get value, or custom function)
|
|
64
|
+
* @param copyAccessor - Custom accessor path for copy value (defaults to column accessor)
|
|
63
65
|
*/
|
|
64
66
|
export type TableColumnProps<T = any> = {
|
|
65
67
|
accessor?: string;
|
|
@@ -84,6 +86,8 @@ export type TableColumnProps<T = any> = {
|
|
|
84
86
|
extra?: any;
|
|
85
87
|
noContext?: boolean;
|
|
86
88
|
style?: MantineStyleProp;
|
|
89
|
+
copyable?: boolean | ((record: T) => string);
|
|
90
|
+
copyAccessor?: string;
|
|
87
91
|
};
|
|
88
92
|
/**
|
|
89
93
|
* Interface for the table column definition
|
|
@@ -128,6 +132,7 @@ export type RowViewProps = RowAction & RowModelProps;
|
|
|
128
132
|
* @param barcodeActions : any[] - List of barcode actions
|
|
129
133
|
* @param tableFilters : TableFilter[] - List of custom filters
|
|
130
134
|
* @param tableActions : any[] - List of custom action groups
|
|
135
|
+
* @param detailAction: boolean - Enable detail action for each row (default = true)
|
|
131
136
|
* @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format)
|
|
132
137
|
* @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions
|
|
133
138
|
* @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked
|
|
@@ -159,6 +164,7 @@ export type InvenTreeTableProps<T = any> = {
|
|
|
159
164
|
rowExpansion?: DataTableRowExpansionProps<T>;
|
|
160
165
|
dataFormatter?: (data: any) => any;
|
|
161
166
|
rowActions?: (record: T) => RowAction[];
|
|
167
|
+
detailAction?: boolean;
|
|
162
168
|
onRowClick?: (record: T, index: number, event: any) => void;
|
|
163
169
|
onCellClick?: DataTableCellClickHandler<T>;
|
|
164
170
|
modelType?: ModelType;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Progress, Stack, Text } from '@mantine/core';
|
|
1
|
+
import { Group, Progress, Stack, Text } from '@mantine/core';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { formatDecimal } from '../functions/Formatting';
|
|
4
4
|
|
|
@@ -9,6 +9,7 @@ export type ProgressBarProps = {
|
|
|
9
9
|
progressLabel?: boolean;
|
|
10
10
|
animated?: boolean;
|
|
11
11
|
size?: string;
|
|
12
|
+
units?: string;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -30,9 +31,12 @@ export function ProgressBar(props: Readonly<ProgressBarProps>) {
|
|
|
30
31
|
return (
|
|
31
32
|
<Stack gap={2} style={{ flexGrow: 1, minWidth: '100px' }}>
|
|
32
33
|
{props.progressLabel && (
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
<Group gap='xs' justify='center'>
|
|
35
|
+
<Text ta='center' size='xs'>
|
|
36
|
+
{formatDecimal(props.value)} / {formatDecimal(props.maximum)}
|
|
37
|
+
</Text>
|
|
38
|
+
{props.units && <Text size='xs'>[{props.units}]</Text>}
|
|
39
|
+
</Group>
|
|
36
40
|
)}
|
|
37
41
|
<Progress
|
|
38
42
|
value={progress}
|
|
@@ -20,6 +20,7 @@ export enum ApiEndpoints {
|
|
|
20
20
|
user_simple_login = 'email/generate/',
|
|
21
21
|
|
|
22
22
|
// User auth endpoints
|
|
23
|
+
auth_base = '/auth/',
|
|
23
24
|
user_reset = 'auth/v1/auth/password/request',
|
|
24
25
|
user_reset_set = 'auth/v1/auth/password/reset',
|
|
25
26
|
auth_pwd_change = 'auth/v1/account/password/change',
|
|
@@ -32,6 +33,8 @@ export enum ApiEndpoints {
|
|
|
32
33
|
auth_mfa_reauthenticate = 'auth/v1/auth/2fa/reauthenticate',
|
|
33
34
|
auth_totp = 'auth/v1/account/authenticators/totp',
|
|
34
35
|
auth_trust = 'auth/v1/auth/2fa/trust',
|
|
36
|
+
auth_webauthn = 'auth/v1/account/authenticators/webauthn',
|
|
37
|
+
auth_webauthn_login = 'auth/v1/auth/webauthn/authenticate',
|
|
35
38
|
auth_reauthenticate = 'auth/v1/auth/reauthenticate',
|
|
36
39
|
auth_email = 'auth/v1/account/email',
|
|
37
40
|
auth_email_verify = 'auth/v1/auth/email/verify',
|
|
@@ -109,8 +112,6 @@ export enum ApiEndpoints {
|
|
|
109
112
|
|
|
110
113
|
// Part API endpoints
|
|
111
114
|
part_list = 'part/',
|
|
112
|
-
part_parameter_list = 'part/parameter/',
|
|
113
|
-
part_parameter_template_list = 'part/parameter/template/',
|
|
114
115
|
part_thumbs_list = 'part/thumbs/',
|
|
115
116
|
part_pricing = 'part/:id/pricing/',
|
|
116
117
|
part_requirements = 'part/:id/requirements/',
|
|
@@ -119,6 +120,7 @@ export enum ApiEndpoints {
|
|
|
119
120
|
part_pricing_internal = 'part/internal-price/',
|
|
120
121
|
part_pricing_sale = 'part/sale-price/',
|
|
121
122
|
part_stocktake_list = 'part/stocktake/',
|
|
123
|
+
part_stocktake_generate = 'part/stocktake/generate/',
|
|
122
124
|
category_list = 'part/category/',
|
|
123
125
|
category_tree = 'part/category/tree/',
|
|
124
126
|
category_parameter_list = 'part/category/parameters/',
|
|
@@ -132,7 +134,6 @@ export enum ApiEndpoints {
|
|
|
132
134
|
supplier_part_list = 'company/part/',
|
|
133
135
|
supplier_part_pricing_list = 'company/price-break/',
|
|
134
136
|
manufacturer_part_list = 'company/part/manufacturer/',
|
|
135
|
-
manufacturer_part_parameter_list = 'company/part/manufacturer/parameter/',
|
|
136
137
|
|
|
137
138
|
// Stock location endpoints
|
|
138
139
|
stock_location_list = 'stock/location/',
|
|
@@ -220,6 +221,9 @@ export enum ApiEndpoints {
|
|
|
220
221
|
|
|
221
222
|
// Special plugin endpoints
|
|
222
223
|
plugin_locate_item = 'locate/',
|
|
224
|
+
plugin_supplier_list = 'supplier/list/',
|
|
225
|
+
plugin_supplier_search = 'supplier/search/',
|
|
226
|
+
plugin_supplier_import = 'supplier/import/',
|
|
223
227
|
|
|
224
228
|
// Machine API endpoints
|
|
225
229
|
machine_types_list = 'machine/types/',
|
|
@@ -238,5 +242,10 @@ export enum ApiEndpoints {
|
|
|
238
242
|
notes_image_upload = 'notes-image-upload/',
|
|
239
243
|
email_list = 'admin/email/',
|
|
240
244
|
email_test = 'admin/email/test/',
|
|
241
|
-
config_list = 'admin/config/'
|
|
245
|
+
config_list = 'admin/config/',
|
|
246
|
+
parameter_list = 'parameter/',
|
|
247
|
+
parameter_template_list = 'parameter/template/',
|
|
248
|
+
|
|
249
|
+
// Internal system things
|
|
250
|
+
system_internal_trace_end = 'system-internal/observability/end'
|
|
242
251
|
}
|
|
@@ -10,6 +10,7 @@ export interface ModelInformationInterface {
|
|
|
10
10
|
url_detail?: string;
|
|
11
11
|
api_endpoint: ApiEndpoints;
|
|
12
12
|
admin_url?: string;
|
|
13
|
+
supports_barcode?: boolean;
|
|
13
14
|
icon: keyof InvenTreeIconType;
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -31,15 +32,21 @@ export const ModelInformationDict: ModelDict = {
|
|
|
31
32
|
url_detail: '/part/:pk/',
|
|
32
33
|
api_endpoint: ApiEndpoints.part_list,
|
|
33
34
|
admin_url: '/part/part/',
|
|
35
|
+
supports_barcode: true,
|
|
34
36
|
icon: 'part'
|
|
35
37
|
},
|
|
36
|
-
|
|
37
|
-
label: () => t`
|
|
38
|
-
label_multiple: () => t`
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
parameter: {
|
|
39
|
+
label: () => t`Parameter`,
|
|
40
|
+
label_multiple: () => t`Parameters`,
|
|
41
|
+
api_endpoint: ApiEndpoints.parameter_list,
|
|
42
|
+
icon: 'list_details'
|
|
43
|
+
},
|
|
44
|
+
parametertemplate: {
|
|
45
|
+
label: () => t`Parameter Template`,
|
|
46
|
+
label_multiple: () => t`Parameter Templates`,
|
|
47
|
+
api_endpoint: ApiEndpoints.parameter_template_list,
|
|
48
|
+
admin_url: '/common/parametertemplate/',
|
|
49
|
+
icon: 'list'
|
|
43
50
|
},
|
|
44
51
|
parttesttemplate: {
|
|
45
52
|
label: () => t`Part Test Template`,
|
|
@@ -55,6 +62,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
55
62
|
url_detail: '/purchasing/supplier-part/:pk/',
|
|
56
63
|
api_endpoint: ApiEndpoints.supplier_part_list,
|
|
57
64
|
admin_url: '/company/supplierpart/',
|
|
65
|
+
supports_barcode: true,
|
|
58
66
|
icon: 'supplier_part'
|
|
59
67
|
},
|
|
60
68
|
manufacturerpart: {
|
|
@@ -64,6 +72,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
64
72
|
url_detail: '/purchasing/manufacturer-part/:pk/',
|
|
65
73
|
api_endpoint: ApiEndpoints.manufacturer_part_list,
|
|
66
74
|
admin_url: '/company/manufacturerpart/',
|
|
75
|
+
supports_barcode: true,
|
|
67
76
|
icon: 'manufacturers'
|
|
68
77
|
},
|
|
69
78
|
partcategory: {
|
|
@@ -82,6 +91,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
82
91
|
url_detail: '/stock/item/:pk/',
|
|
83
92
|
api_endpoint: ApiEndpoints.stock_item_list,
|
|
84
93
|
admin_url: '/stock/stockitem/',
|
|
94
|
+
supports_barcode: true,
|
|
85
95
|
icon: 'stock'
|
|
86
96
|
},
|
|
87
97
|
stocklocation: {
|
|
@@ -91,6 +101,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
91
101
|
url_detail: '/stock/location/:pk/',
|
|
92
102
|
api_endpoint: ApiEndpoints.stock_location_list,
|
|
93
103
|
admin_url: '/stock/stocklocation/',
|
|
104
|
+
supports_barcode: true,
|
|
94
105
|
icon: 'location'
|
|
95
106
|
},
|
|
96
107
|
stocklocationtype: {
|
|
@@ -112,6 +123,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
112
123
|
url_detail: '/manufacturing/build-order/:pk/',
|
|
113
124
|
api_endpoint: ApiEndpoints.build_order_list,
|
|
114
125
|
admin_url: '/build/build/',
|
|
126
|
+
supports_barcode: true,
|
|
115
127
|
icon: 'build_order'
|
|
116
128
|
},
|
|
117
129
|
buildline: {
|
|
@@ -150,6 +162,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
150
162
|
url_detail: '/purchasing/purchase-order/:pk/',
|
|
151
163
|
api_endpoint: ApiEndpoints.purchase_order_list,
|
|
152
164
|
admin_url: '/order/purchaseorder/',
|
|
165
|
+
supports_barcode: true,
|
|
153
166
|
icon: 'purchase_orders'
|
|
154
167
|
},
|
|
155
168
|
purchaseorderlineitem: {
|
|
@@ -165,14 +178,17 @@ export const ModelInformationDict: ModelDict = {
|
|
|
165
178
|
url_detail: '/sales/sales-order/:pk/',
|
|
166
179
|
api_endpoint: ApiEndpoints.sales_order_list,
|
|
167
180
|
admin_url: '/order/salesorder/',
|
|
181
|
+
supports_barcode: true,
|
|
168
182
|
icon: 'sales_orders'
|
|
169
183
|
},
|
|
170
184
|
salesordershipment: {
|
|
171
185
|
label: () => t`Sales Order Shipment`,
|
|
172
186
|
label_multiple: () => t`Sales Order Shipments`,
|
|
187
|
+
url_overview: '/sales/index/shipments',
|
|
173
188
|
url_detail: '/sales/shipment/:pk/',
|
|
174
189
|
api_endpoint: ApiEndpoints.sales_order_shipment_list,
|
|
175
|
-
|
|
190
|
+
supports_barcode: true,
|
|
191
|
+
icon: 'shipment'
|
|
176
192
|
},
|
|
177
193
|
returnorder: {
|
|
178
194
|
label: () => t`Return Order`,
|
|
@@ -181,6 +197,7 @@ export const ModelInformationDict: ModelDict = {
|
|
|
181
197
|
url_detail: '/sales/return-order/:pk/',
|
|
182
198
|
api_endpoint: ApiEndpoints.return_order_list,
|
|
183
199
|
admin_url: '/order/returnorder/',
|
|
200
|
+
supports_barcode: true,
|
|
184
201
|
icon: 'return_orders'
|
|
185
202
|
},
|
|
186
203
|
returnorderlineitem: {
|
package/lib/enums/ModelType.tsx
CHANGED
|
@@ -6,7 +6,6 @@ export enum ModelType {
|
|
|
6
6
|
supplierpart = 'supplierpart',
|
|
7
7
|
manufacturerpart = 'manufacturerpart',
|
|
8
8
|
partcategory = 'partcategory',
|
|
9
|
-
partparametertemplate = 'partparametertemplate',
|
|
10
9
|
parttesttemplate = 'parttesttemplate',
|
|
11
10
|
projectcode = 'projectcode',
|
|
12
11
|
stockitem = 'stockitem',
|
|
@@ -17,6 +16,8 @@ export enum ModelType {
|
|
|
17
16
|
buildline = 'buildline',
|
|
18
17
|
builditem = 'builditem',
|
|
19
18
|
company = 'company',
|
|
19
|
+
parameter = 'parameter',
|
|
20
|
+
parametertemplate = 'parametertemplate',
|
|
20
21
|
purchaseorder = 'purchaseorder',
|
|
21
22
|
purchaseorderlineitem = 'purchaseorderlineitem',
|
|
22
23
|
salesorder = 'salesorder',
|
|
@@ -29,6 +29,11 @@ export function isTrue(value: any): boolean {
|
|
|
29
29
|
* Allows for retrieval of nested items in an object.
|
|
30
30
|
*/
|
|
31
31
|
export function resolveItem(obj: any, path: string): any {
|
|
32
|
+
// Return the top-level object if no path is provided
|
|
33
|
+
if (path == null || path === '') {
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
36
|
+
|
|
32
37
|
const properties = path.split('.');
|
|
33
38
|
return properties.reduce((prev, curr) => prev?.[curr], obj);
|
|
34
39
|
}
|
|
@@ -40,3 +45,36 @@ export function identifierString(value: string): string {
|
|
|
40
45
|
|
|
41
46
|
return value.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
|
42
47
|
}
|
|
48
|
+
|
|
49
|
+
export function toNumber(
|
|
50
|
+
value: any,
|
|
51
|
+
defaultValue: number | null = 0
|
|
52
|
+
): number | null {
|
|
53
|
+
// Convert the provided value into a number (if possible)
|
|
54
|
+
|
|
55
|
+
if (value == undefined || value == null || value === '') {
|
|
56
|
+
return defaultValue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Case 1: numeric already
|
|
60
|
+
if (typeof value === 'number') return value;
|
|
61
|
+
|
|
62
|
+
// Case 2: react-number-format object
|
|
63
|
+
if (typeof value === 'object') {
|
|
64
|
+
if ('floatValue' in value && typeof value.floatValue === 'number') {
|
|
65
|
+
return value.floatValue;
|
|
66
|
+
}
|
|
67
|
+
if ('value' in value) {
|
|
68
|
+
const parsed = Number(value.value);
|
|
69
|
+
return Number.isNaN(parsed) ? Number.NaN : parsed;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Case 3: string
|
|
74
|
+
if (typeof value === 'string') {
|
|
75
|
+
const parsed = Number(value);
|
|
76
|
+
return Number.isNaN(parsed) ? Number.NaN : parsed;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return Number.NaN;
|
|
80
|
+
}
|
|
@@ -7,6 +7,28 @@ import { cancelEvent } from './Events';
|
|
|
7
7
|
export const getBaseUrl = (): string =>
|
|
8
8
|
(window as any).INVENTREE_SETTINGS?.base_url || 'web';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Returns the overview URL for a given model type.
|
|
12
|
+
* This is the UI URL, not the API URL.
|
|
13
|
+
*/
|
|
14
|
+
export function getOverviewUrl(model: ModelType, absolute?: boolean): string {
|
|
15
|
+
const modelInfo = ModelInformationDict[model];
|
|
16
|
+
|
|
17
|
+
if (modelInfo?.url_overview) {
|
|
18
|
+
const url = modelInfo.url_overview;
|
|
19
|
+
const base = getBaseUrl();
|
|
20
|
+
|
|
21
|
+
if (absolute && base) {
|
|
22
|
+
return `/${base}${url}`;
|
|
23
|
+
} else {
|
|
24
|
+
return url;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.error(`No overview URL found for model ${model}`);
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
|
|
10
32
|
/**
|
|
11
33
|
* Returns the detail view URL for a given model type.
|
|
12
34
|
* This is the UI URL, not the API URL.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { t } from '@lingui/core/macro';
|
|
2
|
+
import { useDocumentVisibility } from '@mantine/hooks';
|
|
3
|
+
import { notifications, showNotification } from '@mantine/notifications';
|
|
4
|
+
import { IconCircleCheck, IconExclamationCircle } from '@tabler/icons-react';
|
|
5
|
+
import { type QueryClient, useQuery } from '@tanstack/react-query';
|
|
6
|
+
import type { AxiosInstance } from 'axios';
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import { ProgressBar } from '../components/ProgressBar';
|
|
9
|
+
import { ApiEndpoints } from '../enums/ApiEndpoints';
|
|
10
|
+
import { apiUrl } from '../functions/Api';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Hook for monitoring a data output process running on the server
|
|
14
|
+
*/
|
|
15
|
+
export default function monitorDataOutput({
|
|
16
|
+
api,
|
|
17
|
+
queryClient,
|
|
18
|
+
title,
|
|
19
|
+
hostname,
|
|
20
|
+
id
|
|
21
|
+
}: {
|
|
22
|
+
api: AxiosInstance;
|
|
23
|
+
queryClient?: QueryClient;
|
|
24
|
+
title: string;
|
|
25
|
+
hostname?: string;
|
|
26
|
+
id?: number;
|
|
27
|
+
}) {
|
|
28
|
+
const visibility = useDocumentVisibility();
|
|
29
|
+
|
|
30
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!!id) {
|
|
34
|
+
setLoading(true);
|
|
35
|
+
showNotification({
|
|
36
|
+
id: `data-output-${id}`,
|
|
37
|
+
title: title,
|
|
38
|
+
loading: true,
|
|
39
|
+
autoClose: false,
|
|
40
|
+
withCloseButton: false,
|
|
41
|
+
message: <ProgressBar size='lg' value={0} progressLabel />
|
|
42
|
+
});
|
|
43
|
+
} else setLoading(false);
|
|
44
|
+
}, [id, title]);
|
|
45
|
+
|
|
46
|
+
useQuery(
|
|
47
|
+
{
|
|
48
|
+
enabled: !!id && loading && visibility === 'visible',
|
|
49
|
+
refetchInterval: 500,
|
|
50
|
+
queryKey: ['data-output', id, title],
|
|
51
|
+
queryFn: () =>
|
|
52
|
+
api
|
|
53
|
+
.get(apiUrl(ApiEndpoints.data_output, id))
|
|
54
|
+
.then((response) => {
|
|
55
|
+
const data = response?.data ?? {};
|
|
56
|
+
|
|
57
|
+
if (!!data.errors || !!data.error) {
|
|
58
|
+
setLoading(false);
|
|
59
|
+
|
|
60
|
+
const error: string =
|
|
61
|
+
data?.error ?? data?.errors?.error ?? t`Process failed`;
|
|
62
|
+
|
|
63
|
+
notifications.update({
|
|
64
|
+
id: `data-output-${id}`,
|
|
65
|
+
loading: false,
|
|
66
|
+
icon: <IconExclamationCircle />,
|
|
67
|
+
autoClose: 2500,
|
|
68
|
+
title: title,
|
|
69
|
+
message: error,
|
|
70
|
+
color: 'red'
|
|
71
|
+
});
|
|
72
|
+
} else if (data.complete) {
|
|
73
|
+
setLoading(false);
|
|
74
|
+
notifications.update({
|
|
75
|
+
id: `data-output-${id}`,
|
|
76
|
+
loading: false,
|
|
77
|
+
autoClose: 2500,
|
|
78
|
+
title: title,
|
|
79
|
+
message: t`Process completed successfully`,
|
|
80
|
+
color: 'green',
|
|
81
|
+
icon: <IconCircleCheck />
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (data.output) {
|
|
85
|
+
const url = data.output;
|
|
86
|
+
const base = hostname ?? window.location.hostname;
|
|
87
|
+
|
|
88
|
+
const downloadUrl = new URL(url, base);
|
|
89
|
+
|
|
90
|
+
window.open(downloadUrl.toString(), '_blank');
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
notifications.update({
|
|
94
|
+
id: `data-output-${id}`,
|
|
95
|
+
loading: true,
|
|
96
|
+
autoClose: false,
|
|
97
|
+
withCloseButton: false,
|
|
98
|
+
message: (
|
|
99
|
+
<ProgressBar
|
|
100
|
+
size='lg'
|
|
101
|
+
maximum={data.total}
|
|
102
|
+
value={data.progress}
|
|
103
|
+
progressLabel={data.total > 0}
|
|
104
|
+
animated
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return data;
|
|
111
|
+
})
|
|
112
|
+
.catch(() => {
|
|
113
|
+
setLoading(false);
|
|
114
|
+
notifications.update({
|
|
115
|
+
id: `data-output-${id}`,
|
|
116
|
+
loading: false,
|
|
117
|
+
autoClose: 2500,
|
|
118
|
+
title: title,
|
|
119
|
+
message: t`Process failed`,
|
|
120
|
+
color: 'red'
|
|
121
|
+
});
|
|
122
|
+
return {};
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
queryClient
|
|
126
|
+
);
|
|
127
|
+
}
|
package/lib/index.ts
CHANGED
package/lib/types/Auth.tsx
CHANGED
|
@@ -25,7 +25,8 @@ export enum FlowEnum {
|
|
|
25
25
|
MfaAuthenticate = 'mfa_authenticate',
|
|
26
26
|
Reauthenticate = 'reauthenticate',
|
|
27
27
|
MfaReauthenticate = 'mfa_reauthenticate',
|
|
28
|
-
MfaTrust = 'mfa_trust'
|
|
28
|
+
MfaTrust = 'mfa_trust',
|
|
29
|
+
MfaRegister = 'mfa_register'
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface Flow {
|
package/lib/types/Filters.tsx
CHANGED
package/lib/types/Forms.tsx
CHANGED
|
@@ -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;
|
package/lib/types/Settings.tsx
CHANGED
package/lib/types/Tables.tsx
CHANGED
|
@@ -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;
|