@@ -2,7 +2,7 @@ import { ISPService, ILibsOptions, LibsOrderBy, IFieldsOptions, FieldsOrderBy }
2
2
import { ISPField , ISPList , ISPLists , IUploadImageResult } from "../common/SPEntities" ;
3
3
import { BaseComponentContext } from '@microsoft/sp-component-base' ;
4
4
import { SPHttpClient , ISPHttpClientOptions } from "@microsoft/sp-http" ;
5
- import { urlCombine } from "../common/utilities" ;
5
+ import { SPHelper , urlCombine } from "../common/utilities" ;
6
6
import filter from 'lodash/filter' ;
7
7
import find from 'lodash/find' ;
8
8
@@ -170,7 +170,7 @@ export default class SPService implements ISPService {
170
170
let isPost = false ;
171
171
let processItems : ( ( items : any [ ] ) => any [ ] ) | undefined ;
172
172
173
- if ( field && field . TypeAsString === 'Calculated' && this . _isTextFieldType ( field . ResultType ) ) { // for calculated fields we need to use CAML query
173
+ if ( field && field . TypeAsString === 'Calculated' && SPHelper . isTextFieldType ( field . ResultType ) ) { // for calculated fields we need to use CAML query
174
174
let orderByStr = '' ;
175
175
176
176
if ( orderBy ) {
@@ -187,7 +187,7 @@ export default class SPService implements ISPService {
187
187
apiUrl = `${ webAbsoluteUrl } /_api/web/lists('${ listId } ')/GetItems(query=@v1)?$select=${ keyInternalColumnName || 'Id' } ,${ internalColumnName } &@v1=${ JSON . stringify ( { ViewXml : camlQuery } ) } ` ;
188
188
isPost = true ;
189
189
}
190
- else if ( this . _isTextFieldType ( field . TypeAsString ) ) {
190
+ else if ( SPHelper . isTextFieldType ( field . TypeAsString ) ) {
191
191
const filterStr = substringSearch ? // JJ - 20200613 - find by substring as an option
192
192
`${ filterText ? `substringof('${ encodeURIComponent ( filterText . replace ( "'" , "''" ) ) } ',${ internalColumnName } )` : '' } ${ filterString ? ( filterText ? ' and ' : '' ) + filterString : '' } `
193
193
: `${ filterText ? `startswith(${ internalColumnName } ,'${ encodeURIComponent ( filterText . replace ( "'" , "''" ) ) } ')` : '' } ${ filterString ? ( filterText ? ' and ' : '' ) + filterString : '' } ` ; //string = filterList ? `and ${filterList}` : '';
@@ -201,8 +201,8 @@ export default class SPService implements ISPService {
201
201
return this . _filterListItemsFieldValuesAsText ( cachedItems . items , internalColumnName , filterText , substringSearch ) ;
202
202
}
203
203
204
- apiUrl = `${ webAbsoluteUrl } /_api/web/lists('${ listId } ')/GetItems ?$select=${ keyInternalColumnName || 'Id' } ,FieldValuesAsText/${ internalColumnName } &$expand=FieldValuesAsText&$orderby=${ orderBy } ${ filterString ? '&$filter=' + filterString : '' } ` ;
205
- isPost = true ;
204
+ apiUrl = `${ webAbsoluteUrl } /_api/web/lists('${ listId } ')/items ?$select=${ keyInternalColumnName || 'Id' } , ${ internalColumnName } ,FieldValuesAsText/${ internalColumnName } &$expand=FieldValuesAsText&$orderby=${ orderBy } ${ filterString ? '&$filter=' + filterString : '' } ` ;
205
+ isPost = false ;
206
206
207
207
processItems = ( items : any [ ] ) => {
208
208
@@ -638,14 +638,6 @@ export default class SPService implements ISPService {
638
638
return result ;
639
639
}
640
640
641
- private _isTextFieldType ( fieldType ?: string ) : boolean {
642
- if ( ! fieldType ) {
643
- return true ;
644
- }
645
- const lowercasedFieldType = fieldType . toLowerCase ( ) ;
646
- return lowercasedFieldType === 'text' || lowercasedFieldType === 'note' ;
647
- }
648
-
649
641
private _filterListItemsFieldValuesAsText ( items : any [ ] , internalColumnName : string , filterText : string | undefined , substringSearch : boolean ) : any [ ] {
650
642
const lowercasedFilterText = filterText . toLowerCase ( ) ;
651
643
0 commit comments