@dataloop-ai/components 0.19.281 → 0.19.282

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.282",
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'