@@ -13,9 +13,67 @@ autocomplete.filter = undefined;
1313autocomplete . filter = "start" ;
1414autocomplete . filter = "contain" ;
1515autocomplete . filter = input => true ;
16+ autocomplete . filter = ( query , match , config ) => true ;
1617
1718autocomplete . getOptions = undefined ;
1819autocomplete . getOptions = ( text , path , type , editor ) => [ ] ;
20+ autocomplete . getOptions = ( text , path , type , editor ) => [ "string1" , "string2" ] ;
21+ autocomplete . getOptions = ( text , path , type , editor ) => [ { text : "Display Text" , value : "actual_value" } ] ;
22+ autocomplete . getOptions = ( text , path , type , editor ) => [
23+ "string_option" ,
24+ { text : "Object Option" , value : "object_value" } ,
25+ { text : "Object with text only" , value : "object_text_only" } ,
26+ ] ;
27+ autocomplete . getOptions = ( text , path , type , editor ) => ( { startFrom : 0 , options : [ "option1" , "option2" ] } ) ;
28+ autocomplete . getOptions = ( text , path , type , editor ) => ( {
29+ startFrom : 0 ,
30+ options : [ { text : "Display" , value : "val" } ] ,
31+ } ) ;
32+ autocomplete . getOptions = ( text , path , type , editor ) => new Promise ( ( ) => [ "async1" , "async2" ] ) ;
33+ autocomplete . getOptions = ( text , path , type , editor ) =>
34+ new Promise ( ( ) => [ { text : "Async Option" , value : "async_val" } ] ) ;
35+
36+ // Test getOptions with extended AutoCompleteOption properties
37+ autocomplete . getOptions = ( text , path , type , editor ) => [
38+ "simple_string" ,
39+ {
40+ text : "Premium Feature" ,
41+ value : "premium_val" ,
42+ category : "premium" ,
43+ icon : "star" ,
44+ description : "This is a premium feature" ,
45+ } ,
46+ {
47+ text : "Advanced Option" ,
48+ value : "advanced_val" ,
49+ metadata : { id : 123 , priority : "high" } ,
50+ customData : { anything : "custom" } ,
51+ } ,
52+ ] ;
53+
54+ autocomplete . getOptions = ( text , path , type , editor ) => ( {
55+ startFrom : 0 ,
56+ options : [
57+ "basic_option" ,
58+ {
59+ text : "Extended Option" ,
60+ value : "ext_val" ,
61+ tooltip : "Additional information" ,
62+ disabled : false ,
63+ group : "category1" ,
64+ } ,
65+ ] ,
66+ } ) ;
67+
68+ autocomplete . getOptions = ( text , path , type , editor ) =>
69+ Promise . resolve ( [
70+ {
71+ text : "Async Extended" ,
72+ value : "async_ext" ,
73+ category : "async" ,
74+ metadata : { loadTime : Date . now ( ) } ,
75+ } ,
76+ ] ) ;
1977
2078autocomplete . trigger = undefined ;
2179autocomplete . trigger = "keydown" ;
0 commit comments