@dataloop-ai/components 0.19.162 → 0.19.163

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.162",
3
+ "version": "0.19.163",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -283,19 +283,25 @@ export const useSuggestions = (
283
283
  }
284
284
 
285
285
  if (Array.isArray(dataType)) {
286
- localSuggestions = dataType
287
- .filter(
288
- (type) =>
289
- !knownDataTypes.includes(type as string) &&
290
- typeof type !== 'object'
291
- )
292
- .map((type) =>
293
- typeof type === 'string' ? `'${type}'` : type
294
- ) as string[]
286
+ const filteredTypes = dataType.filter(
287
+ (type) => !knownDataTypes.includes(type as string)
288
+ )
289
+ const mappedTypes: string[] = []
290
+ for (const type of filteredTypes) {
291
+ if (typeof type === 'string') {
292
+ mappedTypes.push(`'${type}'`)
293
+ } else if (typeof type === 'object') {
294
+ mappedTypes.push(
295
+ ...Object.keys(type).map((key) => `'${key}'`)
296
+ )
297
+ } else {
298
+ mappedTypes.push(type)
299
+ }
300
+ }
295
301
 
296
302
  if (!value) continue
297
303
 
298
- localSuggestions = getMatches(localSuggestions, value)
304
+ localSuggestions = getMatches(mappedTypes, value)
299
305
  } else if (
300
306
  dataType === 'datetime' ||
301
307
  dataType === 'date' ||
@@ -637,10 +643,12 @@ const getValueMatch = (
637
643
  }
638
644
  return null
639
645
  }
640
- const getMatches = (strArr: string[], str: string | number | boolean) =>
641
- strArr.filter((val) =>
646
+ const getMatches = (strArr: string[], str: string | number | boolean) => {
647
+ const filtered = strArr.filter((val) =>
642
648
  insensitive(val.toString()).includes(insensitive(str.toString()))
643
649
  )
650
+ return filtered
651
+ }
644
652
 
645
653
  const isNextCharSpace = (input: string, str: string) => {
646
654
  const insensitiveInput = insensitive(input)