@dataloop-ai/components 0.20.8 → 0.20.9
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
|
@@ -77,10 +77,16 @@
|
|
|
77
77
|
</dl-tooltip>
|
|
78
78
|
<div v-if="hasSelectedSlot" style="width: 100%">
|
|
79
79
|
<slot
|
|
80
|
-
v-if="
|
|
80
|
+
v-if="shouldShowSelectedSlotContent"
|
|
81
81
|
:opt="selectedOption"
|
|
82
82
|
name="selected"
|
|
83
83
|
/>
|
|
84
|
+
<span
|
|
85
|
+
v-else-if="!isActiveSearchInput"
|
|
86
|
+
class="root-container--placeholder"
|
|
87
|
+
>
|
|
88
|
+
{{ filterSelectLabel }}
|
|
89
|
+
</span>
|
|
84
90
|
</div>
|
|
85
91
|
<template v-else>
|
|
86
92
|
<span
|
|
@@ -477,6 +483,14 @@ export default defineComponent({
|
|
|
477
483
|
}
|
|
478
484
|
|
|
479
485
|
const hasSlotByName = (name: string) => !!slots[name]
|
|
486
|
+
const hasSlotContent = (name: string) => {
|
|
487
|
+
const slot = slots[name]
|
|
488
|
+
if (slot) {
|
|
489
|
+
const newSlot = typeof slot === 'function' ? slot() : slot
|
|
490
|
+
return newSlot?.length > 0
|
|
491
|
+
}
|
|
492
|
+
return false
|
|
493
|
+
}
|
|
480
494
|
|
|
481
495
|
return {
|
|
482
496
|
uuid: `dl-select-${v4()}`,
|
|
@@ -489,7 +503,8 @@ export default defineComponent({
|
|
|
489
503
|
handleModelValueUpdate,
|
|
490
504
|
searchTerm, // todo: merge this sometime
|
|
491
505
|
searchInputValue,
|
|
492
|
-
hasSlotByName
|
|
506
|
+
hasSlotByName,
|
|
507
|
+
hasSlotContent
|
|
493
508
|
}
|
|
494
509
|
},
|
|
495
510
|
computed: {
|
|
@@ -650,6 +665,15 @@ export default defineComponent({
|
|
|
650
665
|
hasSelectedSlot(): boolean {
|
|
651
666
|
return !!this.hasSlotByName('selected')
|
|
652
667
|
},
|
|
668
|
+
hasSelectedSlotContent(): boolean {
|
|
669
|
+
return this.hasSlotContent('selected')
|
|
670
|
+
},
|
|
671
|
+
isActiveSearchInput(): boolean {
|
|
672
|
+
return this.searchable && this.isExpanded
|
|
673
|
+
},
|
|
674
|
+
shouldShowSelectedSlotContent(): boolean {
|
|
675
|
+
return this.hasSelectedSlotContent && !this.isActiveSearchInput
|
|
676
|
+
},
|
|
653
677
|
computedPlaceholder(): string {
|
|
654
678
|
return this.placeholder || 'Select option'
|
|
655
679
|
},
|