@dataloop-ai/components 0.19.92 → 0.19.94

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.92",
3
+ "version": "0.19.94",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -195,7 +195,10 @@ export default defineComponent({
195
195
  type: String,
196
196
  default: '28px'
197
197
  },
198
-
198
+ omitSuggestions: {
199
+ type: Array as PropType<string[]>,
200
+ default: () => [] as string[]
201
+ },
199
202
  strict: {
200
203
  type: Boolean,
201
204
  default: false
@@ -226,6 +229,7 @@ export default defineComponent({
226
229
  status,
227
230
  disabled,
228
231
  schema,
232
+ omitSuggestions,
229
233
  height,
230
234
  width
231
235
  } = toRefs(props)
@@ -252,7 +256,7 @@ export default defineComponent({
252
256
  const { suggestions, error, findSuggestions } = useSuggestions(
253
257
  schema,
254
258
  aliases,
255
- { strict }
259
+ { strict, omitSuggestions }
256
260
  )
257
261
  //#endregion
258
262
 
@@ -10,6 +10,7 @@ export function getCellValue(
10
10
  }
11
11
  const val =
12
12
  typeof col?.field === 'function' ? col.field(row) : getField(col.field)
13
+
13
14
  return col?.format !== void 0 ? col.format(val, row) : val
14
15
  }
15
16
 
@@ -22,7 +23,7 @@ function getNestedProperty(obj: Record<string, any>, propertyPath: string) {
22
23
  let value = obj
23
24
 
24
25
  for (const prop of pathArray) {
25
- if (value && value.hasOwnProperty(prop)) {
26
+ if (value && value[prop]) {
26
27
  value = value[prop]
27
28
  } else {
28
29
  return undefined
@@ -79,7 +79,7 @@
79
79
 
80
80
  <br>
81
81
  <br>
82
- With placeholder
82
+ With placeholder and [OR, true] suggestions omitted
83
83
  <dl-smart-search-input
84
84
  v-model="queryObject"
85
85
  :aliases="aliases"
@@ -87,6 +87,7 @@
87
87
  :color-schema="colorSchema"
88
88
  :strict="strictState"
89
89
  :disabled="switchState"
90
+ :omit-suggestions="['OR', 'true']"
90
91
  placeholder="I am a placeholder"
91
92
  />
92
93
  </div>
@@ -119,9 +119,9 @@ const mergeWords = (words: string[]) => {
119
119
  export const useSuggestions = (
120
120
  schema: Ref<Schema>,
121
121
  aliases: Ref<Alias[]>,
122
- options: { strict?: Ref<boolean> } = {}
122
+ options: { strict?: Ref<boolean>; omitSuggestions?: Ref<string[]> } = {}
123
123
  ) => {
124
- const { strict } = options
124
+ const { strict, omitSuggestions } = options
125
125
  const aliasesArray = aliases.value ?? []
126
126
  const schemaValue = schema.value ?? {}
127
127
 
@@ -286,7 +286,10 @@ export const useSuggestions = (
286
286
  ? getError(schemaValue, aliasesArray, expressions, { strict })
287
287
  : null
288
288
 
289
- suggestions.value = localSuggestions
289
+ suggestions.value = localSuggestions.filter(
290
+ (value) =>
291
+ !omitSuggestions || !omitSuggestions.value.includes(value)
292
+ )
290
293
  }
291
294
 
292
295
  return { suggestions, findSuggestions, error }