@dataloop-ai/components 0.19.171 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.171",
3
+ "version": "0.19.172",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -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 isValidString(str)
508
+ return (
509
+ isValidString(str) ||
510
+ (str && isValidString(`'${str.trim?.()}'`))
511
+ )
509
512
  case 'date':
510
513
  case 'datetime':
511
514
  case 'time':