@dataloop-ai/components 0.19.161 → 0.19.162
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 +14 -5
package/package.json
CHANGED
|
@@ -123,7 +123,11 @@ const mergeWords = (words: string[]) => {
|
|
|
123
123
|
export const useSuggestions = (
|
|
124
124
|
schema: Ref<Schema>,
|
|
125
125
|
aliases: Ref<Alias[]>,
|
|
126
|
-
options: {
|
|
126
|
+
options: {
|
|
127
|
+
strict?: Ref<boolean>
|
|
128
|
+
forbiddenKeys?: Ref<string[]>
|
|
129
|
+
omitSuggestions?: Ref<string[]>
|
|
130
|
+
} = {}
|
|
127
131
|
) => {
|
|
128
132
|
const { strict, forbiddenKeys, omitSuggestions } = options
|
|
129
133
|
const aliasesArray = aliases.value ?? []
|
|
@@ -159,7 +163,10 @@ export const useSuggestions = (
|
|
|
159
163
|
const expressions = mapWordsToExpressions(mergedWords)
|
|
160
164
|
|
|
161
165
|
error.value = input.length
|
|
162
|
-
? getError(schemaValue, aliasesArray, expressions, {
|
|
166
|
+
? getError(schemaValue, aliasesArray, expressions, {
|
|
167
|
+
strict,
|
|
168
|
+
forbiddenKeys
|
|
169
|
+
})
|
|
163
170
|
: null
|
|
164
171
|
}
|
|
165
172
|
|
|
@@ -191,7 +198,9 @@ export const useSuggestions = (
|
|
|
191
198
|
if (!matchedField && isNextCharSpace(input, field)) {
|
|
192
199
|
localSuggestions =
|
|
193
200
|
value && input.endsWith(space)
|
|
194
|
-
?
|
|
201
|
+
? keyword
|
|
202
|
+
? sortedSuggestions
|
|
203
|
+
: [Logical.AND, Logical.OR]
|
|
195
204
|
: []
|
|
196
205
|
continue
|
|
197
206
|
}
|
|
@@ -362,7 +371,7 @@ const getError = (
|
|
|
362
371
|
schema: Schema,
|
|
363
372
|
aliases: Alias[],
|
|
364
373
|
expressions: Expression[],
|
|
365
|
-
options: { strict?: Ref<boolean>; forbiddenKeys?: Ref<string[]
|
|
374
|
+
options: { strict?: Ref<boolean>; forbiddenKeys?: Ref<string[]> } = {}
|
|
366
375
|
): string | null => {
|
|
367
376
|
const { strict, forbiddenKeys } = options
|
|
368
377
|
const hasErrorInStructure = expressions
|
|
@@ -438,7 +447,7 @@ const getError = (
|
|
|
438
447
|
return (acc = errors.INVALID_VALUE(field))
|
|
439
448
|
}
|
|
440
449
|
|
|
441
|
-
return
|
|
450
|
+
return acc === 'warning' ? acc : (acc = null)
|
|
442
451
|
}, null)
|
|
443
452
|
}
|
|
444
453
|
|