Skip to content

Commit 5443957

Browse files
committed
feat: add teleportToTop prop to the select
1 parent 083cb20 commit 5443957

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

adminforth/spa/src/afcl/Select.vue

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,9 @@
3636
/>
3737
</div>
3838
</div>
39-
<teleport to="body" v-if="teleportToBody && showDropdown">
40-
<div ref="dropdownEl" :style="getDropdownPosition" :class="{'shadow-none': isTop}"
41-
class="fixed z-[5] w-full bg-white shadow-lg dark:shadow-black dark:bg-gray-700
42-
dark:border-gray-600 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm max-h-48"
43-
@scroll="handleDropdownScroll">
44-
<div
45-
v-for="item in filteredItems"
46-
:key="item.value"
47-
class="px-4 py-2 cursor-pointer hover:bg-lightDropdownOptionsHoverBackground dark:hover:bg-darkDropdownOptionsHoverBackground text-lightDropdownOptionsText dark:text-darkDropdownOptionsText"
48-
:class="{ 'bg-lightDropdownPicked dark:bg-darkDropdownPicked': selectedItems.includes(item) }"
49-
@click="toogleItem(item)"
50-
>
51-
<slot name="item" :option="item"></slot>
52-
<label v-if="!$slots.item" :for="item.value">{{ item.label }}</label>
53-
</div>
54-
<div v-if="!filteredItems.length" class="px-4 py-2 cursor-pointer text-lightDropdownOptionsText dark:text-darkDropdownOptionsText">
55-
{{ options.length ? $t('No results found') : $t('No items here') }}
56-
</div>
57-
58-
<div v-if="$slots['extra-item']" class="px-4 py-2 dark:text-gray-400">
59-
<slot name="extra-item"></slot>
60-
</div>
61-
</div>
62-
</teleport>
63-
64-
<teleport to="body" v-if="teleportToTop && showDropdown">
65-
<div ref="dropdownEl" :style="getDropdownPosition" :class="{'shadow-none': isTop}"
66-
class="fixed z-[50] w-full bg-white shadow-lg dark:shadow-black dark:bg-gray-700
39+
<teleport to="body" v-if="(teleportToBody || teleportToTop) && showDropdown">
40+
<div ref="dropdownEl" :style="getDropdownPosition" :class="{'shadow-none': isTop, 'z-[5]': teleportToBody, 'z-[1000]': teleportToTop}"
41+
class="fixed w-full bg-white shadow-lg dark:shadow-black dark:bg-gray-700
6742
dark:border-gray-600 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm max-h-48"
6843
@scroll="handleDropdownScroll">
6944
<div

0 commit comments

Comments
 (0)