@dataloop-ai/components 0.19.281 → 0.19.283

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.281",
3
+ "version": "0.19.283",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -75,14 +75,14 @@
75
75
  <dl-tooltip v-if="disabled && disabledTooltip">
76
76
  {{ disabledTooltip }}
77
77
  </dl-tooltip>
78
- <div v-if="hasSelectedSlot" style="width: 100%">
78
+ <div v-if="hasSelectedSlot && hasSelection" style="width: 100%">
79
79
  <slot
80
80
  v-if="searchable ? !isExpanded : true"
81
81
  :opt="selectedOption"
82
82
  name="selected"
83
83
  />
84
84
  </div>
85
- <template v-if="!hasSelectedSlot">
85
+ <template v-else>
86
86
  <span
87
87
  v-show="
88
88
  (multiselect && !searchable) ||
@@ -456,7 +456,7 @@ export default defineComponent({
456
456
  'selected',
457
457
  'deselected'
458
458
  ],
459
- setup(props, { emit }) {
459
+ setup(props, { emit, slots }) {
460
460
  const isExpanded = ref(false)
461
461
  const selectedIndex = ref(-1)
462
462
  const highlightedIndex = ref(-1)
@@ -474,6 +474,8 @@ export default defineComponent({
474
474
  emit('change', val)
475
475
  }
476
476
 
477
+ const hasSlotByName = (name: string) => !!slots[name]
478
+
477
479
  return {
478
480
  uuid: `dl-select-${v4()}`,
479
481
  MAX_ITEMS_PER_LIST,
@@ -484,7 +486,8 @@ export default defineComponent({
484
486
  setHighlightedIndex,
485
487
  handleModelValueUpdate,
486
488
  searchTerm, // todo: merge this sometime
487
- searchInputValue
489
+ searchInputValue,
490
+ hasSlotByName
488
491
  }
489
492
  },
490
493
  computed: {
@@ -637,13 +640,13 @@ export default defineComponent({
637
640
  return getIconSize(this.size)
638
641
  },
639
642
  hasOptionSlot(): boolean {
640
- return !!this.$slots.option
643
+ return !!this.hasSlotByName('option')
641
644
  },
642
645
  hasAllItemsSlot(): boolean {
643
- return !!this.$slots['all-items']
646
+ return !!this.hasSlotByName('all-items')
644
647
  },
645
648
  hasSelectedSlot(): boolean {
646
- return !!this.$slots.selected
649
+ return !!this.hasSlotByName('selected')
647
650
  },
648
651
  computedPlaceholder(): string {
649
652
  return this.placeholder || 'Select option'
@@ -212,7 +212,7 @@ export default defineComponent({
212
212
  key: 'id'
213
213
  },
214
214
  {
215
- alias: 'ItemHeight',
215
+ alias: 'Item.Height',
216
216
  key: 'metadata.system.height'
217
217
  },
218
218
  {
@@ -160,10 +160,11 @@ export const useSuggestions = (
160
160
  )
161
161
 
162
162
  for (const alias of aliasesArray) {
163
- if (aliasedSuggestions.includes(alias.alias)) {
163
+ const aliasBeforeDot = alias.alias.replace(/\..+$/, '')
164
+ if (aliasedSuggestions.includes(aliasBeforeDot)) {
164
165
  continue
165
166
  }
166
- aliasedSuggestions.push(alias.alias)
167
+ aliasedSuggestions.push(aliasBeforeDot)
167
168
  }
168
169
 
169
170
  const sortString = (a: string, b: string) =>
@@ -239,6 +240,16 @@ export const useSuggestions = (
239
240
  )
240
241
  if (!dataType) {
241
242
  localSuggestions = []
243
+ // 2nd half of key aliases with the dot: matchedField ~ 'Item.H' of 'Item.Height'
244
+ const matchedFieldWithDot =
245
+ matchedField.indexOf('.') > 0
246
+ ? matchedField
247
+ : matchedField + '.'
248
+ for (const a of aliasesArray) {
249
+ if (a.alias.startsWith(matchedFieldWithDot)) {
250
+ localSuggestions.push(a.alias.replace(/^.+\./, '.'))
251
+ }
252
+ }
242
253
  continue
243
254
  }
244
255
 
@@ -264,6 +275,8 @@ export const useSuggestions = (
264
275
  fieldOf = fieldOf[key] as Schema
265
276
  }
266
277
 
278
+ if (!fieldOf) continue
279
+
267
280
  const toAdd: string[] = []
268
281
 
269
282
  if (fieldOf[lastWord]) {