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;
|
const { request, initialValue } = props;
|
||||||
if (request) {
|
if (request) {
|
||||||
return request;
|
return request;
|
||||||
@ -77,14 +77,14 @@ const useRequestProps = (props: any) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const useDef = (opts: any = {}, props: FormProps = {}) => {
|
const useDefaultValues = (opts: any = {}, props: FormProps = {}) => {
|
||||||
return useRequest(useRequestProps(props), opts);
|
return useRequest(getRequestParams(props), opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
const FormBlockContext = createContext<any>(null);
|
const FormBlockContext = createContext<any>(null);
|
||||||
|
|
||||||
export const Form: React.FC<FormProps> & { Designer?: any } = observer((props) => {
|
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 fieldSchema = useFieldSchema();
|
||||||
const field = useField();
|
const field = useField();
|
||||||
const form = useMemo(() => createForm({ effects }), []);
|
const form = useMemo(() => createForm({ effects }), []);
|
||||||
|
Loading…
Reference in New Issue
Block a user