@dataloop-ai/components 0.18.119 → 0.18.120

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.18.119",
3
+ "version": "0.18.120",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -349,7 +349,7 @@ export default defineComponent({
349
349
  stringValue = value + ' '
350
350
  }
351
351
 
352
- setInputValue(
352
+ debouncedSetInputValue(
353
353
  clearPartlyTypedSuggestion(input.value.innerText, stringValue)
354
354
  )
355
355
  setCaret(input.value)
@@ -452,10 +452,38 @@ export default defineComponent({
452
452
  }
453
453
  }
454
454
 
455
+ const endsWithOperator = computed(() => {
456
+ const operators = ['>=', '<=', '!=', '=', '>', '<', 'IN', 'NOT-IN']
457
+
458
+ for (const op of operators) {
459
+ if (
460
+ searchQuery.value.endsWith(op) ||
461
+ searchQuery.value.endsWith(`${op} `)
462
+ ) {
463
+ return true
464
+ }
465
+ }
466
+
467
+ return false
468
+ })
469
+
455
470
  const onKeyPress = (e: KeyboardEvent) => {
456
- if (e.key === 'Enter') {
471
+ if (e.code === 'Enter' || e.key === 'Enter') {
457
472
  e.preventDefault()
458
473
  e.stopPropagation()
474
+
475
+ if (showSuggestions.value || showDatePicker.value) {
476
+ return
477
+ }
478
+
479
+ if (endsWithOperator.value) {
480
+ return
481
+ }
482
+
483
+ if (!input.value.innerHTML.length) {
484
+ return
485
+ }
486
+
459
487
  emit('search', updateJSONQuery())
460
488
  showSuggestions.value = false
461
489
  return
@@ -467,10 +495,6 @@ export default defineComponent({
467
495
  }
468
496
 
469
497
  const onInput = (e: Event) => {
470
- if ((e as KeyboardEvent).key === 'Enter') {
471
- return
472
- }
473
-
474
498
  const text = (e.target as HTMLElement).textContent
475
499
  debouncedSetInputValue(text)
476
500
  }
@@ -36,6 +36,16 @@ export type SyntaxColorSchema = {
36
36
  }
37
37
  }
38
38
 
39
+ export type DLSmartSearchOperators =
40
+ | '>='
41
+ | '<='
42
+ | '!='
43
+ | '='
44
+ | '>'
45
+ | '<'
46
+ | 'IN'
47
+ | 'NOT-IN'
48
+
39
49
  import {
40
50
  Alias as DlSmartSearchAlias,
41
51
  Schema as DlSmartSearchSchema