mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 02:28:04 +08:00 
			
		
		
		
	feat(form): select before/after request函数配置中增加prop字段
This commit is contained in:
		
							parent
							
								
									687bf33eb2
								
							
						
					
					
						commit
						ed01cfca87
					
				@ -191,6 +191,9 @@ const getOptions = async () => {
 | 
			
		||||
    postOptions = option.beforeRequest(mForm, postOptions, {
 | 
			
		||||
      model: props.model,
 | 
			
		||||
      formValue: mForm?.values,
 | 
			
		||||
      formValues: mForm?.values,
 | 
			
		||||
      prop: props.prop,
 | 
			
		||||
      config: props.config,
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -206,6 +209,7 @@ const getOptions = async () => {
 | 
			
		||||
      formValue: mForm?.values,
 | 
			
		||||
      formValues: mForm?.values,
 | 
			
		||||
      config: props.config,
 | 
			
		||||
      prop: props.prop,
 | 
			
		||||
      postOptions,
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
@ -315,6 +319,9 @@ const getInitOption = async () => {
 | 
			
		||||
    postOptions = option.beforeInitRequest(mForm, postOptions, {
 | 
			
		||||
      model: props.model,
 | 
			
		||||
      formValue: mForm?.values,
 | 
			
		||||
      formValues: mForm?.values,
 | 
			
		||||
      config: props.config,
 | 
			
		||||
      prop: props.prop,
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -331,6 +338,7 @@ const getInitOption = async () => {
 | 
			
		||||
      formValue: mForm?.values,
 | 
			
		||||
      formValues: mForm?.values,
 | 
			
		||||
      config: props.config,
 | 
			
		||||
      prop: props.prop,
 | 
			
		||||
      postOptions,
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -279,7 +279,7 @@ type RemoteSelectOptionBodyFunction = (
 | 
			
		||||
  },
 | 
			
		||||
) => Record<string, any>;
 | 
			
		||||
 | 
			
		||||
type RemoteSelectOptionRequestFunction = (
 | 
			
		||||
type RemoteSelectOptionAfterRequestFunction = (
 | 
			
		||||
  mForm: FormState | undefined,
 | 
			
		||||
  res: any,
 | 
			
		||||
  data: {
 | 
			
		||||
@ -287,10 +287,23 @@ type RemoteSelectOptionRequestFunction = (
 | 
			
		||||
    formValue: any;
 | 
			
		||||
    formValues: any;
 | 
			
		||||
    config: any;
 | 
			
		||||
    prop: string;
 | 
			
		||||
    postOptions: Record<string, any>;
 | 
			
		||||
  },
 | 
			
		||||
) => any;
 | 
			
		||||
 | 
			
		||||
type RemoteSelectOptionBeforeRequestFunction = (
 | 
			
		||||
  mForm: FormState | undefined,
 | 
			
		||||
  postOptions: Record<string, any>,
 | 
			
		||||
  data: {
 | 
			
		||||
    model: any;
 | 
			
		||||
    formValue: any;
 | 
			
		||||
    formValues: any;
 | 
			
		||||
    config: any;
 | 
			
		||||
    prop: string;
 | 
			
		||||
  },
 | 
			
		||||
) => Record<string, any>;
 | 
			
		||||
 | 
			
		||||
type RemoteSelectOptionItemFunction = (optionsData: Record<string, any>) => SelectOption[] | SelectGroupOption[];
 | 
			
		||||
type SelectOptionValueFunction = (item: Record<string, any>) => any;
 | 
			
		||||
type SelectOptionTextFunction = (item: Record<string, any>) => string;
 | 
			
		||||
@ -496,14 +509,10 @@ export interface SelectConfig extends FormItem, Input {
 | 
			
		||||
    body?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
			
		||||
    initBody?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
			
		||||
    jsonpCallback?: 'callback' | string;
 | 
			
		||||
    afterRequest?: RemoteSelectOptionRequestFunction;
 | 
			
		||||
    afterInitRequest?: RemoteSelectOptionRequestFunction;
 | 
			
		||||
    beforeRequest?: (mForm: FormState | undefined, postOptions: Record<string, any>, data: any) => Record<string, any>;
 | 
			
		||||
    beforeInitRequest?: (
 | 
			
		||||
      mForm: FormState | undefined,
 | 
			
		||||
      postOptions: Record<string, any>,
 | 
			
		||||
      data: any,
 | 
			
		||||
    ) => Record<string, any>;
 | 
			
		||||
    afterRequest?: RemoteSelectOptionAfterRequestFunction;
 | 
			
		||||
    afterInitRequest?: RemoteSelectOptionAfterRequestFunction;
 | 
			
		||||
    beforeRequest?: RemoteSelectOptionBeforeRequestFunction;
 | 
			
		||||
    beforeInitRequest?: RemoteSelectOptionBeforeRequestFunction;
 | 
			
		||||
    root?: string;
 | 
			
		||||
    totalKey?: string;
 | 
			
		||||
    initRoot?: string;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user