@@ -43,6 +43,7 @@ import { default as AutoComplete } from "antd/es/auto-complete";
4343import { RefControl } from "comps/controls/refControl" ;
4444import {
4545 booleanExposingStateControl ,
46+ jsonValueExposingStateControl ,
4647} from "comps/controls/codeStateControl" ;
4748
4849import { getDayJSLocale } from "i18n/dayjsLocale" ;
@@ -88,6 +89,7 @@ const childrenMap = {
8889 autocompleteIconColor : dropdownControl ( autocompleteIconColor , "blue" ) ,
8990 componentSize : dropdownControl ( componentSize , "small" ) ,
9091 valueInItems : booleanExposingStateControl ( "valueInItems" ) ,
92+ selectedOption : jsonValueExposingStateControl ( "selectedOption" , { } ) ,
9193 style : styleControl ( InputFieldStyle , 'style' ) ,
9294 labelStyle : styleControl ( LabelStyle , 'labelStyle' ) ,
9395 inputFieldStyle : styleControl ( InputLikeStyle , 'inputFieldStyle' ) ,
@@ -247,14 +249,18 @@ let AutoCompleteCompBase = (function () {
247249 setsearchtext ( value ) ;
248250 props . value . onChange ( value ) ;
249251 props . onEvent ( "change" ) ;
250- } , [ props . valueInItems , getTextInputValidate , props . value , props . onEvent ] ) ;
252+ if ( ! Boolean ( value ) ) {
253+ props . selectedOption . onChange ( { } ) ;
254+ }
255+ } , [ props . valueInItems , getTextInputValidate , props . value , props . onEvent , props . selectedOption ] ) ;
251256
252257 const handleSelect = useCallback ( ( data : string , option : any ) => {
253258 setsearchtext ( option [ valueOrLabel ] ) ;
254259 props . valueInItems . onChange ( true ) ;
255260 props . value . onChange ( option [ valueOrLabel ] ) ;
261+ props . selectedOption . onChange ( option ) ;
256262 props . onEvent ( "submit" ) ;
257- } , [ valueOrLabel , props . valueInItems , props . value , props . onEvent ] ) ;
263+ } , [ valueOrLabel , props . valueInItems , props . value , props . onEvent , props . selectedOption ] ) ;
258264
259265 const handleFocus = useCallback ( ( ) => {
260266 setActivationFlag ( true ) ;
@@ -313,17 +319,7 @@ let AutoCompleteCompBase = (function () {
313319 . setPropertyViewFn ( ( children ) => {
314320 return (
315321 < >
316- < Section >
317- { children . autoCompleteType . getView ( ) === 'normal' &&
318- children . prefixIcon . propertyView ( {
319- label : trans ( 'button.prefixIcon' ) ,
320- } ) }
321- { children . autoCompleteType . getView ( ) === 'normal' &&
322- children . suffixIcon . propertyView ( {
323- label : trans ( 'button.suffixIcon' ) ,
324- } ) }
325- { allowClearPropertyView ( children ) }
326- </ Section >
322+ < TextInputBasicSection { ...children } />
327323 < Section name = { trans ( 'autoComplete.SectionDataName' ) } >
328324 { children . items . propertyView ( {
329325 label : trans ( 'autoComplete.value' ) ,
@@ -351,25 +347,35 @@ let AutoCompleteCompBase = (function () {
351347 label : trans ( 'autoComplete.ignoreCase' ) ,
352348 } )
353349 ) }
354- { children . filterOptionsByInput . getView ( ) && (
355- children . valueOrLabel . propertyView ( {
356- label : trans ( 'autoComplete.checkedValueFrom' ) ,
357- radioButton : true ,
358- } )
359- ) }
350+ { children . valueOrLabel . propertyView ( {
351+ label : trans ( 'autoComplete.checkedValueFrom' ) ,
352+ radioButton : true ,
353+ } ) }
360354 </ Section >
361- < TextInputBasicSection { ...children } />
362355
363356 < FormDataPropertyView { ...children } />
364357 { children . label . getPropertyView ( ) }
365358
366359 < TextInputInteractionSection { ...children } />
367360
368- { < TextInputValidationSection { ...children } /> }
369361
370362 < Section name = { sectionNames . layout } >
371363 { hiddenPropertyView ( children ) }
372364 </ Section >
365+
366+ < Section name = { sectionNames . advanced } >
367+ { children . autoCompleteType . getView ( ) === 'normal' &&
368+ children . prefixIcon . propertyView ( {
369+ label : trans ( 'button.prefixIcon' ) ,
370+ } ) }
371+ { children . autoCompleteType . getView ( ) === 'normal' &&
372+ children . suffixIcon . propertyView ( {
373+ label : trans ( 'button.suffixIcon' ) ,
374+ } ) }
375+ { allowClearPropertyView ( children ) }
376+ </ Section >
377+
378+ { < TextInputValidationSection { ...children } /> }
373379
374380 < Section name = { sectionNames . style } >
375381 { children . style . getPropertyView ( ) }
@@ -389,9 +395,6 @@ let AutoCompleteCompBase = (function () {
389395 >
390396 { children . animationStyle . getPropertyView ( ) }
391397 </ Section >
392- < Section name = { sectionNames . advanced } >
393- { children . tabIndex . propertyView ( { label : trans ( "prop.tabIndex" ) } ) }
394- </ Section >
395398 </ >
396399 ) ;
397400 } )
@@ -415,6 +418,7 @@ AutoCompleteCompBase = class extends AutoCompleteCompBase {
415418export const AutoCompleteComp = withExposingConfigs ( AutoCompleteCompBase , [
416419 new NameConfig ( "value" , trans ( "export.inputValueDesc" ) ) ,
417420 new NameConfig ( "valueInItems" , trans ( "autoComplete.valueInItems" ) ) ,
421+ new NameConfig ( "selectedOption" , trans ( "autoComplete.selectedOption" ) ) ,
418422 NameConfigPlaceHolder ,
419423 NameConfigRequired ,
420424 ...TextInputConfigs ,
0 commit comments