@dataloop-ai/components 0.19.132 → 0.19.133
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/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +2 -1
- package/src/components/compound/DlSearches/DlSmartSearch/components/SuggestionsDropdown.vue +8 -1
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +1 -0
- package/src/hooks/use-suggestions.ts +10 -6
package/package.json
CHANGED
|
@@ -346,7 +346,8 @@ export default defineComponent({
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
const setInputFromSuggestion = (
|
|
349
|
+
const setInputFromSuggestion = (suggestion: any) => {
|
|
350
|
+
const value = '' + suggestion
|
|
350
351
|
let stringValue = ''
|
|
351
352
|
let caretPosition = 0
|
|
352
353
|
if (searchQuery.value.length) {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
:highlighted="suggestionIndex === highlightedIndex"
|
|
29
29
|
@click="handleOption(item)"
|
|
30
30
|
>
|
|
31
|
-
{{ item }}
|
|
31
|
+
{{ removeQuotes(item) }}
|
|
32
32
|
</dl-list-item>
|
|
33
33
|
</dl-list>
|
|
34
34
|
</dl-menu>
|
|
@@ -115,11 +115,18 @@ export default defineComponent({
|
|
|
115
115
|
emit('update:model-value', false)
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
const removeQuotes = (item: any) => {
|
|
119
|
+
const str = '' + item
|
|
120
|
+
const match = str.match(/^'(.*)'$/)
|
|
121
|
+
return match ? match[1] : str
|
|
122
|
+
}
|
|
123
|
+
|
|
118
124
|
return {
|
|
119
125
|
defaultTarget,
|
|
120
126
|
setHighlightedIndex,
|
|
121
127
|
handleSelectedItem,
|
|
122
128
|
highlightedIndex,
|
|
129
|
+
removeQuotes,
|
|
123
130
|
onShow,
|
|
124
131
|
onHide,
|
|
125
132
|
emitModelValue,
|
|
@@ -260,11 +260,15 @@ export const useSuggestions = (
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
if (Array.isArray(dataType)) {
|
|
263
|
-
localSuggestions = dataType
|
|
264
|
-
(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
localSuggestions = dataType
|
|
264
|
+
.filter(
|
|
265
|
+
(type) =>
|
|
266
|
+
!knownDataTypes.includes(type as string) &&
|
|
267
|
+
typeof type !== 'object'
|
|
268
|
+
)
|
|
269
|
+
.map((type) =>
|
|
270
|
+
typeof type === 'string' ? `'${type}'` : type
|
|
271
|
+
) as string[]
|
|
268
272
|
|
|
269
273
|
if (!value) continue
|
|
270
274
|
|
|
@@ -704,7 +708,7 @@ const getValueSuggestions = (
|
|
|
704
708
|
!knownDataTypes.includes(type as string) &&
|
|
705
709
|
typeof type !== 'object'
|
|
706
710
|
) {
|
|
707
|
-
suggestion.push(type)
|
|
711
|
+
suggestion.push(typeof type === 'string' ? `'${type}'` : type)
|
|
708
712
|
}
|
|
709
713
|
}
|
|
710
714
|
}
|