@dataloop-ai/components 0.19.170 → 0.19.172
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
|
@@ -142,6 +142,7 @@ import { v4 } from 'uuid'
|
|
|
142
142
|
import {
|
|
143
143
|
Schema,
|
|
144
144
|
Alias,
|
|
145
|
+
Data,
|
|
145
146
|
useSuggestions,
|
|
146
147
|
removeBrackets,
|
|
147
148
|
removeLeadingExpression
|
|
@@ -437,11 +438,47 @@ export default defineComponent({
|
|
|
437
438
|
|
|
438
439
|
let lastSearchQuery: string
|
|
439
440
|
|
|
441
|
+
const forceStringsType = (data: string | Data): string | Data => {
|
|
442
|
+
const convertNode = (node: Data) => {
|
|
443
|
+
for (const key in node) {
|
|
444
|
+
const value = node[key]
|
|
445
|
+
if (Array.isArray(value)) {
|
|
446
|
+
for (let i = 0; i < value.length; i++) {
|
|
447
|
+
value[i] = '' + value[i]
|
|
448
|
+
}
|
|
449
|
+
} else {
|
|
450
|
+
node[key] = '' + value
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (typeof data !== 'string' && schema.value) {
|
|
455
|
+
for (const key in data) {
|
|
456
|
+
const type = schema.value[key]
|
|
457
|
+
if (Array.isArray(type)) {
|
|
458
|
+
if (type.includes('string')) {
|
|
459
|
+
if (typeof data[key] === 'object') {
|
|
460
|
+
convertNode(data[key])
|
|
461
|
+
} else {
|
|
462
|
+
data[key] = '' + data[key]
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
} else if (type === 'string') {
|
|
466
|
+
if (typeof data[key] === 'object') {
|
|
467
|
+
convertNode(data[key])
|
|
468
|
+
} else {
|
|
469
|
+
data[key] = '' + data[key]
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return data
|
|
475
|
+
}
|
|
476
|
+
|
|
440
477
|
const updateJSONQuery = () => {
|
|
441
478
|
try {
|
|
442
479
|
const bracketless = removeBrackets(searchQuery.value)
|
|
443
480
|
const cleanedAliases = revertAliases(bracketless, aliases.value)
|
|
444
|
-
const json = toJSON(cleanedAliases)
|
|
481
|
+
const json = forceStringsType(toJSON(cleanedAliases))
|
|
445
482
|
if (isValid.value && !isEqual(json, modelValue.value)) {
|
|
446
483
|
emit('update:model-value', json)
|
|
447
484
|
}
|
|
@@ -505,7 +505,10 @@ const isValidByDataType = (
|
|
|
505
505
|
case 'boolean':
|
|
506
506
|
return isValidBoolean(str)
|
|
507
507
|
case 'string':
|
|
508
|
-
return
|
|
508
|
+
return (
|
|
509
|
+
isValidString(str) ||
|
|
510
|
+
(str && isValidString(`'${str.trim?.()}'`))
|
|
511
|
+
)
|
|
509
512
|
case 'date':
|
|
510
513
|
case 'datetime':
|
|
511
514
|
case 'time':
|
|
@@ -41,7 +41,7 @@ const horizontalPos = {
|
|
|
41
41
|
const positions = ['left', 'middle', 'right']
|
|
42
42
|
|
|
43
43
|
positions.forEach((pos) => {
|
|
44
|
-
(horizontalPos as { [key: string]: string })[`${pos}#ltr`] = pos
|
|
44
|
+
;(horizontalPos as { [key: string]: string })[`${pos}#ltr`] = pos
|
|
45
45
|
})
|
|
46
46
|
|
|
47
47
|
interface AnchorProps {
|
|
@@ -81,7 +81,7 @@ export function parsePosition(pos: string): ParsedPosition {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export function getAnchorProps(el: HTMLElement, offset
|
|
84
|
+
export function getAnchorProps(el: HTMLElement, offset?: number[]) {
|
|
85
85
|
let { top, left, right, bottom, width, height } = el.getBoundingClientRect()
|
|
86
86
|
|
|
87
87
|
if (offset) {
|
|
@@ -101,8 +101,8 @@ export function getAnchorProps(el: HTMLElement, offset: number[]) {
|
|
|
101
101
|
bottom,
|
|
102
102
|
width,
|
|
103
103
|
height,
|
|
104
|
-
middle: left + (right - left) / 2 + offset[0] ?? 0,
|
|
105
|
-
center: top + (bottom - top) / 2 + offset[1] ?? 0
|
|
104
|
+
middle: left + (right - left) / 2 + offset?.[0] ?? 0,
|
|
105
|
+
center: top + (bottom - top) / 2 + offset?.[1] ?? 0
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|