@dataloop-ai/components 0.19.133 → 0.19.135
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
|
@@ -281,6 +281,11 @@ export default defineComponent({
|
|
|
281
281
|
|
|
282
282
|
showSuggestions.value = false
|
|
283
283
|
|
|
284
|
+
// to handle typing . after accepting a suggestion
|
|
285
|
+
if (/\s+\.$/.test(value)) {
|
|
286
|
+
value = value.replace(/\s+\.$/, '.')
|
|
287
|
+
}
|
|
288
|
+
|
|
284
289
|
// to handle date suggestion modal to open automatically.
|
|
285
290
|
if (value.includes('(dd/mm/yyyy)')) {
|
|
286
291
|
value = value.trimEnd()
|
|
@@ -316,6 +321,7 @@ export default defineComponent({
|
|
|
316
321
|
}
|
|
317
322
|
|
|
318
323
|
updateEditor(input.value, editorStyle.value)
|
|
324
|
+
setSelectionOffset(input.value, caretAt.value, caretAt.value)
|
|
319
325
|
setMenuOffset(isEligibleToChange(input.value, expanded.value))
|
|
320
326
|
|
|
321
327
|
if (!expanded.value) {
|
|
@@ -365,7 +371,12 @@ export default defineComponent({
|
|
|
365
371
|
queryRightSide = leftover + queryRightSide
|
|
366
372
|
} else if (value.startsWith('.')) {
|
|
367
373
|
// dot notation case
|
|
368
|
-
|
|
374
|
+
const words = queryLeftSide.trimEnd().split('.')
|
|
375
|
+
const lastWord = words.pop()
|
|
376
|
+
if (!value.startsWith('.' + lastWord)) {
|
|
377
|
+
words.push(lastWord)
|
|
378
|
+
}
|
|
379
|
+
queryLeftSide = words.join('.')
|
|
369
380
|
} else if (queryLeftSide.endsWith(' ')) {
|
|
370
381
|
// caret after space: only replace multiple spaces on the left
|
|
371
382
|
queryLeftSide = queryLeftSide.trimEnd() + ' '
|
|
@@ -547,7 +558,11 @@ export default defineComponent({
|
|
|
547
558
|
|
|
548
559
|
const onInput = (e: Event) => {
|
|
549
560
|
const text = (e.target as HTMLElement).textContent
|
|
550
|
-
|
|
561
|
+
if (text.endsWith('.')) {
|
|
562
|
+
setInputValue(text)
|
|
563
|
+
} else {
|
|
564
|
+
debouncedSetInputValue(text)
|
|
565
|
+
}
|
|
551
566
|
}
|
|
552
567
|
|
|
553
568
|
const onDateSelection = (value: DateInterval) => {
|
|
@@ -8,6 +8,8 @@ export function useSizeObserver(elRef: Ref, ...refsToWatch: any[]) {
|
|
|
8
8
|
const heightRef = ref(0)
|
|
9
9
|
const hasEllipsis = ref(false)
|
|
10
10
|
const borderBoxSize = ref(null)
|
|
11
|
+
const disposing = ref(false)
|
|
12
|
+
|
|
11
13
|
const calcEllipsis = (el: HTMLElement) => {
|
|
12
14
|
hasEllipsis.value = isEllipsisActive(el)
|
|
13
15
|
}
|
|
@@ -22,16 +24,36 @@ export function useSizeObserver(elRef: Ref, ...refsToWatch: any[]) {
|
|
|
22
24
|
}
|
|
23
25
|
)
|
|
24
26
|
|
|
25
|
-
onMounted(() => elRef.value && resizeObserver.observe(elRef.value))
|
|
26
27
|
watch(elRef, () => {
|
|
27
|
-
|
|
28
|
+
if (disposing.value) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
if (elRef.value) {
|
|
32
|
+
calcEllipsis(elRef.value)
|
|
33
|
+
}
|
|
28
34
|
})
|
|
29
35
|
for (const ref of refsToWatch) {
|
|
30
36
|
watch(ref, () => {
|
|
31
|
-
|
|
37
|
+
if (disposing.value) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (elRef.value) {
|
|
41
|
+
calcEllipsis(elRef.value)
|
|
42
|
+
}
|
|
32
43
|
})
|
|
33
44
|
}
|
|
34
|
-
|
|
45
|
+
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
if (elRef.value) {
|
|
48
|
+
resizeObserver.observe(elRef.value)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
onBeforeUnmount(() => {
|
|
52
|
+
disposing.value = true
|
|
53
|
+
if (elRef.value) {
|
|
54
|
+
resizeObserver.unobserve(elRef.value)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
35
57
|
|
|
36
58
|
return {
|
|
37
59
|
widthRef,
|
|
@@ -178,7 +178,7 @@ export const useSuggestions = (
|
|
|
178
178
|
|
|
179
179
|
if (!field) continue
|
|
180
180
|
|
|
181
|
-
const fieldSeparated:
|
|
181
|
+
const fieldSeparated: string[] = field.split('.')
|
|
182
182
|
|
|
183
183
|
if (fieldSeparated.length > 1) {
|
|
184
184
|
localSuggestions = []
|
|
@@ -229,21 +229,35 @@ export const useSuggestions = (
|
|
|
229
229
|
localSuggestions = getOperators(ops)
|
|
230
230
|
|
|
231
231
|
if (!operator) {
|
|
232
|
-
const dotSeparated = matchedField.split('.')
|
|
232
|
+
const dotSeparated = matchedField.split('.')
|
|
233
|
+
const lastWord = dotSeparated.pop()
|
|
233
234
|
let fieldOf = schemaValue
|
|
234
235
|
for (const key of dotSeparated) {
|
|
235
236
|
fieldOf = fieldOf[key] as Schema
|
|
236
237
|
}
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
const toAdd: string[] = []
|
|
240
|
+
|
|
241
|
+
if (fieldOf[lastWord]) {
|
|
242
|
+
fieldOf = fieldOf[lastWord] as Schema
|
|
243
|
+
|
|
244
|
+
if (isObject(fieldOf) && !Array.isArray(fieldOf)) {
|
|
245
|
+
for (const key of Object.keys(fieldOf)) {
|
|
246
|
+
if (key === '*') continue
|
|
247
|
+
toAdd.push(`.${key}`)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
for (const key in fieldOf) {
|
|
241
252
|
if (key === '*') continue
|
|
242
|
-
|
|
253
|
+
if (key.startsWith(lastWord)) {
|
|
254
|
+
toAdd.push(`.${key}`)
|
|
255
|
+
}
|
|
243
256
|
}
|
|
244
|
-
localSuggestions = localSuggestions.concat(toConcat)
|
|
245
257
|
}
|
|
246
258
|
|
|
259
|
+
localSuggestions = toAdd.concat(localSuggestions)
|
|
260
|
+
|
|
247
261
|
continue
|
|
248
262
|
}
|
|
249
263
|
|