@@ -142,10 +142,10 @@ export function getFilterProps(object) {
142142 * @param {?string } inputValue
143143 * @param {?Set } excludeSelected
144144 * @param {ComponentConfig } config
145- * @param {SearchProps|null } searchProps
145+ * @param {SearchProps } searchProps
146146 * @returns {object[] }
147147 */
148- export function filterList ( options , inputValue , excludeSelected , config , searchProps ) {
148+ export function filterList ( options , inputValue , excludeSelected , config , searchProps = { } ) {
149149 if ( ! searchProps . keepSelectionInList && excludeSelected ) {
150150 options = options
151151 . filter ( opt => ! excludeSelected . has ( opt [ config . valueField ] ) )
@@ -219,12 +219,14 @@ export function fieldInit(type, options, groupItemsField) {
219219 const isValue = type === 'value' ;
220220 let val = isValue ? 'value' : 'text' ; // selectize style defaults
221221 if ( options && options . length ) {
222+ // @ts -ignore
222223 const firstItem = options [ 0 ] [ groupItemsField ] ? options [ 0 ] [ groupItemsField ] [ 0 ] : options [ 0 ] ;
223224 if ( ! firstItem || typeof firstItem === 'string' ) return val ;
224225 const autoAddItem = isValue ? 0 : 1 ;
225226 const guessList = isValue
226227 ? [ 'id' , 'value' , 'ID' ]
227228 : [ 'name' , 'title' , 'label' ] ;
229+ // @ts -ignore
228230 val = Object . keys ( firstItem ) . filter ( prop => guessList . includes ( prop ) )
229231 . concat ( [ Object . keys ( firstItem ) [ autoAddItem ] ] ) // auto add field (used as fallback) if empty list is returned
230232 . shift ( ) ;
0 commit comments