2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-14 19:15:41 +00:00

Account for "read only" property

This commit is contained in:
Oliver Walters
2023-07-27 22:05:20 +10:00
parent 00cbac5f06
commit b5f8a9bc3c
3 changed files with 15 additions and 1 deletions

View File

@ -172,7 +172,8 @@ export function ApiForm(props: ApiFormProps) {
required: field.required, required: field.required,
placeholder: field.placeholder, placeholder: field.placeholder,
api_url: field.api_url, api_url: field.api_url,
model: field.model model: field.model,
read_only: field.read_only
}); });
} }
@ -184,6 +185,10 @@ export function ApiForm(props: ApiFormProps) {
size="xl" size="xl"
radius="sm" radius="sm"
opened={props.opened} opened={props.opened}
overlayProps={{
blur: 1,
opacity: 0.5
}}
onClose={() => { onClose={() => {
props.onClose ? props.onClose() : null; props.onClose ? props.onClose() : null;
}} }}

View File

@ -20,6 +20,7 @@ export type ApiFormFieldType = {
icon?: ReactNode; icon?: ReactNode;
fieldType?: string; fieldType?: string;
api_url?: string; api_url?: string;
read_only?: boolean;
model?: string; model?: string;
required?: boolean; required?: boolean;
hidden?: boolean; hidden?: boolean;
@ -58,6 +59,8 @@ function constructField({
def.error = null; def.error = null;
} }
def.disabled = def.disabled || def.read_only;
// Retrieve the latest value from the form // Retrieve the latest value from the form
let value = form.values[def.name]; let value = form.values[def.name];

View File

@ -84,6 +84,9 @@ export default function Home() {
}, },
{ {
name: 'target_date' name: 'target_date'
},
{
name: 'status'
} }
]; ];
@ -96,6 +99,9 @@ export default function Home() {
}, },
{ {
name: 'description' name: 'description'
},
{
name: 'status'
} }
]; ];