@dataloop-ai/components 0.19.168 → 0.19.170
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
|
@@ -296,9 +296,11 @@ export default defineComponent({
|
|
|
296
296
|
|
|
297
297
|
showSuggestions.value = false
|
|
298
298
|
|
|
299
|
-
// to handle typing . after accepting a suggestion
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
// to handle typing . or , after accepting a suggestion
|
|
300
|
+
const dotOrCommaRegEx = /\s+([\.|\,]\s?)$/
|
|
301
|
+
const dotOrCommaMatch = value.match(dotOrCommaRegEx)
|
|
302
|
+
if (dotOrCommaMatch) {
|
|
303
|
+
value = value.replace(dotOrCommaRegEx, dotOrCommaMatch[1])
|
|
302
304
|
}
|
|
303
305
|
|
|
304
306
|
// to handle date suggestion modal to open automatically.
|
|
@@ -589,7 +591,7 @@ export default defineComponent({
|
|
|
589
591
|
|
|
590
592
|
const onInput = (e: Event) => {
|
|
591
593
|
const text = (e.target as HTMLElement).textContent
|
|
592
|
-
if (text.endsWith('.')) {
|
|
594
|
+
if (text.endsWith('.') || text.endsWith(',')) {
|
|
593
595
|
setInputValue(text)
|
|
594
596
|
} else {
|
|
595
597
|
debouncedSetInputValue.value(text)
|
|
@@ -96,8 +96,8 @@ const mergeWords = (words: string[]) => {
|
|
|
96
96
|
|
|
97
97
|
if (currentItem === 'IN' || currentItem === 'NOT-IN') {
|
|
98
98
|
merging = true
|
|
99
|
-
mergeIndex = i + 1
|
|
100
99
|
result.push(currentItem)
|
|
100
|
+
mergeIndex = result.length
|
|
101
101
|
continue
|
|
102
102
|
} else if (
|
|
103
103
|
Object.values(Logical).includes(currentItem as any) ||
|
|
@@ -108,9 +108,10 @@ const mergeWords = (words: string[]) => {
|
|
|
108
108
|
|
|
109
109
|
if (merging) {
|
|
110
110
|
if (!result[mergeIndex]) {
|
|
111
|
-
result[mergeIndex] =
|
|
111
|
+
result[mergeIndex] = currentItem
|
|
112
|
+
} else if (currentItem) {
|
|
113
|
+
result[mergeIndex] += ' ' + currentItem
|
|
112
114
|
}
|
|
113
|
-
result[mergeIndex] += ' ' + currentItem
|
|
114
115
|
continue
|
|
115
116
|
}
|
|
116
117
|
|
|
@@ -322,6 +323,10 @@ export const useSuggestions = (
|
|
|
322
323
|
|
|
323
324
|
localSuggestions = [Logical.AND, Logical.OR]
|
|
324
325
|
|
|
326
|
+
if (operator === operators.$in || operator === operators.$nin) {
|
|
327
|
+
localSuggestions.unshift(',')
|
|
328
|
+
}
|
|
329
|
+
|
|
325
330
|
if (!keyword) continue
|
|
326
331
|
|
|
327
332
|
localSuggestions = getMatches(localSuggestions, keyword)
|
|
@@ -559,10 +564,23 @@ const getOperatorByDataType = (dataType: string) => {
|
|
|
559
564
|
const getOperators = (op: string[]) => op.map((o) => operators[o])
|
|
560
565
|
|
|
561
566
|
const mapWordsToExpression = (words: string[]): Expression => {
|
|
567
|
+
let operator = words[1] ?? null
|
|
568
|
+
let value = words[2] ?? null
|
|
569
|
+
|
|
570
|
+
if (operator === operators.$in || operator === operators.$nin) {
|
|
571
|
+
if (value && /\,\s?$/.test(value)) {
|
|
572
|
+
value = ''
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
if (value === null) {
|
|
577
|
+
operator = null
|
|
578
|
+
}
|
|
579
|
+
|
|
562
580
|
return {
|
|
563
581
|
field: words[0] ?? null,
|
|
564
|
-
operator
|
|
565
|
-
value
|
|
582
|
+
operator,
|
|
583
|
+
value,
|
|
566
584
|
keyword: words[3] ?? null
|
|
567
585
|
}
|
|
568
586
|
}
|