Browse Source
fix: add triggerClass binding to PopoverTrigger and update icon-picker styles (#6095)
* Popover支持设置trigger的样式
* 修正icon-picker的input值更新
pull/6096/head
Netfan
9 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
10 additions and
2 deletions
-
packages/@core/ui-kit/shadcn-ui/src/components/popover/popover.vue
-
packages/effects/common-ui/src/components/icon-picker/icon-picker.vue
|
|
|
@ -21,6 +21,7 @@ interface Props extends PopoverRootProps { |
|
|
|
class?: ClassType; |
|
|
|
contentClass?: ClassType; |
|
|
|
contentProps?: PopoverContentProps; |
|
|
|
triggerClass?: ClassType; |
|
|
|
} |
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {}); |
|
|
|
@ -32,6 +33,7 @@ const delegatedProps = computed(() => { |
|
|
|
class: _cls, |
|
|
|
contentClass: _, |
|
|
|
contentProps: _cProps, |
|
|
|
triggerClass: _tClass, |
|
|
|
...delegated |
|
|
|
} = props; |
|
|
|
|
|
|
|
@ -43,7 +45,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits); |
|
|
|
|
|
|
|
<template> |
|
|
|
<PopoverRoot v-bind="forwarded"> |
|
|
|
<PopoverTrigger> |
|
|
|
<PopoverTrigger :class="triggerClass"> |
|
|
|
<slot name="trigger"></slot> |
|
|
|
|
|
|
|
<PopoverContent |
|
|
|
|
|
|
|
@ -165,13 +165,18 @@ const searchInputProps = computed(() => { |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
function updateCurrentSelect(v: string) { |
|
|
|
currentSelect.value = v; |
|
|
|
} |
|
|
|
|
|
|
|
defineExpose({ toggleOpenState, open, close }); |
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<VbenPopover |
|
|
|
v-model:open="visible" |
|
|
|
:content-props="{ align: 'end', alignOffset: -11, sideOffset: 8 }" |
|
|
|
content-class="p-0 pt-3" |
|
|
|
content-class="p-0 pt-3 w-full" |
|
|
|
trigger-class="w-full" |
|
|
|
> |
|
|
|
<template #trigger> |
|
|
|
<template v-if="props.type === 'input'"> |
|
|
|
@ -183,6 +188,7 @@ defineExpose({ toggleOpenState, open, close }); |
|
|
|
role="combobox" |
|
|
|
:aria-label="$t('ui.iconPicker.placeholder')" |
|
|
|
aria-expanded="visible" |
|
|
|
:[`onUpdate:${modelValueProp}`]="updateCurrentSelect" |
|
|
|
v-bind="$attrs" |
|
|
|
> |
|
|
|
<template #[iconSlot]> |
|
|
|
|