feat(components): [color-picker] add teleported prop (#16634)

* feat(components): [color-picker] add `teleported` prop

closed #15357

* refactor: use tooltip hooks
This commit is contained in:
知晓同丶 2024-04-24 12:07:20 +08:00 committed by GitHub
parent 245c7d9486
commit 53b6e16080
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View File

@ -63,6 +63,8 @@ color-picker/sizes
| label ^(a11y) ^(deprecated) | ColorPicker aria-label | ^[string] | — |
| aria-label ^(a11y) ^(2.7.2) | ColorPicker aria-label | ^[string] | — |
| id | ColorPicker id | ^[string] | — |
| teleported ^(2.7.2) | whether color-picker popper is teleported to the body | ^[boolean] | true |
### Events

View File

@ -1,6 +1,7 @@
import { isNil } from 'lodash-unified'
import { buildProps, definePropType, isString } from '@element-plus/utils'
import { useAriaProps, useSizeProp } from '@element-plus/hooks'
import { useTooltipContentProps } from '@element-plus/components/tooltip'
import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'
import type { ComputedRef, ExtractPropTypes, InjectionKey } from 'vue'
@ -52,6 +53,10 @@ export const colorPickerProps = buildProps({
type: [String, Number],
default: 0,
},
/**
* @description whether color-picker popper is teleported to the body
*/
teleported: useTooltipContentProps.teleported,
/**
* @description predefined color options
*/

View File

@ -10,6 +10,7 @@
:stop-popper-mouse-event="false"
effect="light"
trigger="click"
:teleported="teleported"
:transition="`${ns.namespace.value}-zoom-in-top`"
persistent
@hide="setShowPicker(false)"