Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

[Hack] Set the PrincipalSelect placeholder width so that it’s at the full size even when no selection (placeholder is used)

天舟35a5b52975e4
diff --git a/frontend/src/bbkit/BBSelect.vue b/frontend/src/bbkit/BBSelect.vue
index b1ab7376e0..44b86317b5 100644
--- a/frontend/src/bbkit/BBSelect.vue
+++ b/frontend/src/bbkit/BBSelect.vue
@@ -21,7 +21,11 @@
<template v-if="state.selectedItem">
<slot name="menuItem" :item="state.selectedItem" />
</template>
- <div v-else>{{ placeholder }}</div>
+ <template v-else>
+ <slot name="placeholder" :placeholder="placeholder">{{
+ placeholder
+ }}</slot>
+ </template>
<span
class="ml-3 absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"
>
diff --git a/frontend/src/components/PrincipalSelect.vue b/frontend/src/components/PrincipalSelect.vue
index 025c6d57a8..1894dd3757 100644
--- a/frontend/src/components/PrincipalSelect.vue
+++ b/frontend/src/components/PrincipalSelect.vue
@@ -21,6 +21,15 @@
<span class="truncate">{{ item.name }}</span>
</span>
</template>
+ <template v-slot:placeholder="{ placeholder }">
+ <!--TODO: Have to set a fixed width, otherwise the width would change based on the selected text.
+ Likely, there is a better solution, while the author doesn't want to fight with CSS for now.
+ The specific value and breakpoint is to make it align with other select in the task sidebar.
+ -->
+ <span class="flex lg:40 xl:w-44">
+ <span class="truncate">{{ placeholder }}</span>
+ </span>
+ </template>
</BBSelect>
</template>