Adding foreign key to auto forms

This commit is contained in:
2025-01-20 11:31:57 +01:00
parent fe84d6de2f
commit 35448385c5
4 changed files with 94 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
import TextWidget from "@rjsf/core/lib/components/widgets/TextWidget";
import {FormContextType, getTemplate, RJSFSchema, StrictRJSFSchema, WidgetProps} from "@rjsf/utils";
import {ForeignKeyWidget} from "./foreign-key";
export default function CrudTextWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
props: WidgetProps<T, S, F>
) {
if (props.schema.hasOwnProperty("foreign_key")) {
return (<ForeignKeyWidget {...props} />);
}else {
return (<CrudTextWidget {...props} />);
}
}