@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 +1 -1
- package/src/hooks/use-suggestions.ts +20 -12
package/package.json
CHANGED
|
@@ -283,19 +283,25 @@ export const useSuggestions = (
|
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
if (Array.isArray(dataType)) {
|
|
286
|
-
|
|
287
|
-
.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
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(
|
|
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)
|