mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
* feat(types): [utils] add ExtractPublicPropTypes type * feat(types): [components] add props public type * chore(types): use type-only import for Prop from 'vue' Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com> --------- Co-authored-by: Noblet Ouways <91417411+Dsaquel@users.noreply.github.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { buildProps, definePropType } from '@element-plus/utils'
|
|
import { popperTriggerProps } from '@element-plus/components/popper'
|
|
import { EVENT_CODE } from '@element-plus/constants'
|
|
|
|
import type { Arrayable } from '@element-plus/utils'
|
|
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'
|
|
|
|
export type TooltipTriggerType = 'hover' | 'focus' | 'click' | 'contextmenu'
|
|
|
|
export const useTooltipTriggerProps = buildProps({
|
|
...popperTriggerProps,
|
|
/**
|
|
* @description whether Tooltip is disabled
|
|
*/
|
|
disabled: Boolean,
|
|
/**
|
|
* @description How should the tooltip be triggered (to show)
|
|
*/
|
|
trigger: {
|
|
type: definePropType<Arrayable<TooltipTriggerType>>([String, Array]),
|
|
default: 'hover',
|
|
},
|
|
/**
|
|
* @description When you click the mouse to focus on the trigger element, you can define a set of keyboard codes to control the display of tooltip through the keyboard
|
|
*/
|
|
triggerKeys: {
|
|
type: definePropType<string[]>(Array),
|
|
default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space],
|
|
},
|
|
} as const)
|
|
|
|
export type ElTooltipTriggerProps = ExtractPropTypes<
|
|
typeof useTooltipTriggerProps
|
|
>
|
|
|
|
export type ElTooltipTriggerPropsPublic = __ExtractPublicPropTypes<
|
|
typeof useTooltipTriggerProps
|
|
>
|