mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 10:49:51 +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, {
 | 
					    postOptions = option.beforeRequest(mForm, postOptions, {
 | 
				
			||||||
      model: props.model,
 | 
					      model: props.model,
 | 
				
			||||||
      formValue: mForm?.values,
 | 
					      formValue: mForm?.values,
 | 
				
			||||||
 | 
					      formValues: mForm?.values,
 | 
				
			||||||
 | 
					      prop: props.prop,
 | 
				
			||||||
 | 
					      config: props.config,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -206,6 +209,7 @@ const getOptions = async () => {
 | 
				
			|||||||
      formValue: mForm?.values,
 | 
					      formValue: mForm?.values,
 | 
				
			||||||
      formValues: mForm?.values,
 | 
					      formValues: mForm?.values,
 | 
				
			||||||
      config: props.config,
 | 
					      config: props.config,
 | 
				
			||||||
 | 
					      prop: props.prop,
 | 
				
			||||||
      postOptions,
 | 
					      postOptions,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -315,6 +319,9 @@ const getInitOption = async () => {
 | 
				
			|||||||
    postOptions = option.beforeInitRequest(mForm, postOptions, {
 | 
					    postOptions = option.beforeInitRequest(mForm, postOptions, {
 | 
				
			||||||
      model: props.model,
 | 
					      model: props.model,
 | 
				
			||||||
      formValue: mForm?.values,
 | 
					      formValue: mForm?.values,
 | 
				
			||||||
 | 
					      formValues: mForm?.values,
 | 
				
			||||||
 | 
					      config: props.config,
 | 
				
			||||||
 | 
					      prop: props.prop,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -331,6 +338,7 @@ const getInitOption = async () => {
 | 
				
			|||||||
      formValue: mForm?.values,
 | 
					      formValue: mForm?.values,
 | 
				
			||||||
      formValues: mForm?.values,
 | 
					      formValues: mForm?.values,
 | 
				
			||||||
      config: props.config,
 | 
					      config: props.config,
 | 
				
			||||||
 | 
					      prop: props.prop,
 | 
				
			||||||
      postOptions,
 | 
					      postOptions,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -279,7 +279,7 @@ type RemoteSelectOptionBodyFunction = (
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
) => Record<string, any>;
 | 
					) => Record<string, any>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RemoteSelectOptionRequestFunction = (
 | 
					type RemoteSelectOptionAfterRequestFunction = (
 | 
				
			||||||
  mForm: FormState | undefined,
 | 
					  mForm: FormState | undefined,
 | 
				
			||||||
  res: any,
 | 
					  res: any,
 | 
				
			||||||
  data: {
 | 
					  data: {
 | 
				
			||||||
@ -287,10 +287,23 @@ type RemoteSelectOptionRequestFunction = (
 | 
				
			|||||||
    formValue: any;
 | 
					    formValue: any;
 | 
				
			||||||
    formValues: any;
 | 
					    formValues: any;
 | 
				
			||||||
    config: any;
 | 
					    config: any;
 | 
				
			||||||
 | 
					    prop: string;
 | 
				
			||||||
    postOptions: Record<string, any>;
 | 
					    postOptions: Record<string, any>;
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
) => 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 RemoteSelectOptionItemFunction = (optionsData: Record<string, any>) => SelectOption[] | SelectGroupOption[];
 | 
				
			||||||
type SelectOptionValueFunction = (item: Record<string, any>) => any;
 | 
					type SelectOptionValueFunction = (item: Record<string, any>) => any;
 | 
				
			||||||
type SelectOptionTextFunction = (item: Record<string, any>) => string;
 | 
					type SelectOptionTextFunction = (item: Record<string, any>) => string;
 | 
				
			||||||
@ -496,14 +509,10 @@ export interface SelectConfig extends FormItem, Input {
 | 
				
			|||||||
    body?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
					    body?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
				
			||||||
    initBody?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
					    initBody?: Record<string, any> | RemoteSelectOptionBodyFunction;
 | 
				
			||||||
    jsonpCallback?: 'callback' | string;
 | 
					    jsonpCallback?: 'callback' | string;
 | 
				
			||||||
    afterRequest?: RemoteSelectOptionRequestFunction;
 | 
					    afterRequest?: RemoteSelectOptionAfterRequestFunction;
 | 
				
			||||||
    afterInitRequest?: RemoteSelectOptionRequestFunction;
 | 
					    afterInitRequest?: RemoteSelectOptionAfterRequestFunction;
 | 
				
			||||||
    beforeRequest?: (mForm: FormState | undefined, postOptions: Record<string, any>, data: any) => Record<string, any>;
 | 
					    beforeRequest?: RemoteSelectOptionBeforeRequestFunction;
 | 
				
			||||||
    beforeInitRequest?: (
 | 
					    beforeInitRequest?: RemoteSelectOptionBeforeRequestFunction;
 | 
				
			||||||
      mForm: FormState | undefined,
 | 
					 | 
				
			||||||
      postOptions: Record<string, any>,
 | 
					 | 
				
			||||||
      data: any,
 | 
					 | 
				
			||||||
    ) => Record<string, any>;
 | 
					 | 
				
			||||||
    root?: string;
 | 
					    root?: string;
 | 
				
			||||||
    totalKey?: string;
 | 
					    totalKey?: string;
 | 
				
			||||||
    initRoot?: string;
 | 
					    initRoot?: string;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user