@@ -43,6 +43,7 @@ import { default as AutoComplete } from "antd/es/auto-complete";
43
43
import { RefControl } from "comps/controls/refControl" ;
44
44
import {
45
45
booleanExposingStateControl ,
46
+ jsonValueExposingStateControl ,
46
47
} from "comps/controls/codeStateControl" ;
47
48
48
49
import { getDayJSLocale } from "i18n/dayjsLocale" ;
@@ -88,6 +89,7 @@ const childrenMap = {
88
89
autocompleteIconColor : dropdownControl ( autocompleteIconColor , "blue" ) ,
89
90
componentSize : dropdownControl ( componentSize , "small" ) ,
90
91
valueInItems : booleanExposingStateControl ( "valueInItems" ) ,
92
+ selectedOption : jsonValueExposingStateControl ( "selectedOption" , { } ) ,
91
93
style : styleControl ( InputFieldStyle , 'style' ) ,
92
94
labelStyle : styleControl ( LabelStyle , 'labelStyle' ) ,
93
95
inputFieldStyle : styleControl ( InputLikeStyle , 'inputFieldStyle' ) ,
@@ -247,14 +249,18 @@ let AutoCompleteCompBase = (function () {
247
249
setsearchtext ( value ) ;
248
250
props . value . onChange ( value ) ;
249
251
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 ] ) ;
251
256
252
257
const handleSelect = useCallback ( ( data : string , option : any ) => {
253
258
setsearchtext ( option [ valueOrLabel ] ) ;
254
259
props . valueInItems . onChange ( true ) ;
255
260
props . value . onChange ( option [ valueOrLabel ] ) ;
261
+ props . selectedOption . onChange ( option ) ;
256
262
props . onEvent ( "submit" ) ;
257
- } , [ valueOrLabel , props . valueInItems , props . value , props . onEvent ] ) ;
263
+ } , [ valueOrLabel , props . valueInItems , props . value , props . onEvent , props . selectedOption ] ) ;
258
264
259
265
const handleFocus = useCallback ( ( ) => {
260
266
setActivationFlag ( true ) ;
@@ -313,17 +319,7 @@ let AutoCompleteCompBase = (function () {
313
319
. setPropertyViewFn ( ( children ) => {
314
320
return (
315
321
< >
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 } />
327
323
< Section name = { trans ( 'autoComplete.SectionDataName' ) } >
328
324
{ children . items . propertyView ( {
329
325
label : trans ( 'autoComplete.value' ) ,
@@ -351,25 +347,35 @@ let AutoCompleteCompBase = (function () {
351
347
label : trans ( 'autoComplete.ignoreCase' ) ,
352
348
} )
353
349
) }
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
+ } ) }
360
354
</ Section >
361
- < TextInputBasicSection { ...children } />
362
355
363
356
< FormDataPropertyView { ...children } />
364
357
{ children . label . getPropertyView ( ) }
365
358
366
359
< TextInputInteractionSection { ...children } />
367
360
368
- { < TextInputValidationSection { ...children } /> }
369
361
370
362
< Section name = { sectionNames . layout } >
371
363
{ hiddenPropertyView ( children ) }
372
364
</ 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 } /> }
373
379
374
380
< Section name = { sectionNames . style } >
375
381
{ children . style . getPropertyView ( ) }
@@ -389,9 +395,6 @@ let AutoCompleteCompBase = (function () {
389
395
>
390
396
{ children . animationStyle . getPropertyView ( ) }
391
397
</ Section >
392
- < Section name = { sectionNames . advanced } >
393
- { children . tabIndex . propertyView ( { label : trans ( "prop.tabIndex" ) } ) }
394
- </ Section >
395
398
</ >
396
399
) ;
397
400
} )
@@ -415,6 +418,7 @@ AutoCompleteCompBase = class extends AutoCompleteCompBase {
415
418
export const AutoCompleteComp = withExposingConfigs ( AutoCompleteCompBase , [
416
419
new NameConfig ( "value" , trans ( "export.inputValueDesc" ) ) ,
417
420
new NameConfig ( "valueInItems" , trans ( "autoComplete.valueInItems" ) ) ,
421
+ new NameConfig ( "selectedOption" , trans ( "autoComplete.selectedOption" ) ) ,
418
422
NameConfigPlaceHolder ,
419
423
NameConfigRequired ,
420
424
...TextInputConfigs ,
0 commit comments