FastUI
FastUI copied to clipboard
Support locked FormFields
Looks like BaseFormField
was designed to support "locking"/"disabling" an input field:
https://github.com/pydantic/FastUI/blob/cec25c61a7cc5a716d05d21039f95be3e8dac0e8/src/python-fastui/fastui/components/forms.py#L22
However, this is not working for me even after extending the json_schema_field_to_field()
method to also pass an extra locked=schema.get('locked', False)
param to the FormFieldInput
in:
https://github.com/pydantic/FastUI/blob/cec25c61a7cc5a716d05d21039f95be3e8dac0e8/src/python-fastui/fastui/json_schema.py#L182-L189
I'm not sure, but I think the problem may lie somewhere in the npm package around the below lines? https://github.com/pydantic/FastUI/blob/cec25c61a7cc5a716d05d21039f95be3e8dac0e8/src/npm-fastui/src/components/FormField.tsx#L37-L38
Anyone knows how to fix? Thanks in advance!
I would try creating a FormFieldInput
manually and seeing if you can get a field to lock. If so, it should be fairly easy to fix in JSON schema parsing.