mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-04 21:28:34 +08:00
refactor(Form): rename
This commit is contained in:
parent
77b7adb97c
commit
ff6f37c589
@ -65,7 +65,7 @@ const FormDecorator: React.FC<FormProps> = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const useRequestProps = (props: any) => {
|
||||
const getRequestParams = (props: any) => {
|
||||
const { request, initialValue } = props;
|
||||
if (request) {
|
||||
return request;
|
||||
@ -77,14 +77,14 @@ const useRequestProps = (props: any) => {
|
||||
};
|
||||
};
|
||||
|
||||
const useDef = (opts: any = {}, props: FormProps = {}) => {
|
||||
return useRequest(useRequestProps(props), opts);
|
||||
const useDefaultValues = (opts: any = {}, props: FormProps = {}) => {
|
||||
return useRequest(getRequestParams(props), opts);
|
||||
};
|
||||
|
||||
const FormBlockContext = createContext<any>(null);
|
||||
|
||||
export const Form: React.FC<FormProps> & { Designer?: any } = observer((props) => {
|
||||
const { request, effects, initialValue, useValues = useDef, ...others } = props;
|
||||
const { request, effects, initialValue, useValues = useDefaultValues, ...others } = props;
|
||||
const fieldSchema = useFieldSchema();
|
||||
const field = useField();
|
||||
const form = useMemo(() => createForm({ effects }), []);
|
||||
|
Loading…
Reference in New Issue
Block a user