import {debounce} from 'lodash-es' import {assign} from './assign' /** * @deprecated 本行为组件, 是为了实现之前 "time picker 的点击移出面板时, 自动关闭面板" 的功能, * * - 目前已不再使用这个交互, 故可能会进入废弃阶段 @liang #220902 */ export class FeatureInitialClickAndMoveOut { shouldTriggerLeave = false debounceLeave = debounce(() => { const onLeave = this.onLeave onLeave && onLeave() }, 300) hooks = { click: () => { this.shouldTriggerLeave = true }, mouseEnter: () => { this.debounceLeave.cancel() }, mouseLeave: () => { // console.log('leave', this.shouldTriggerLeave); if (this.shouldTriggerLeave) { this.debounceLeave() } }, reset: () => { this.shouldTriggerLeave = false }, } onLeave?: () => void constructor(props: Partial) { // console.log('construct'); assign(this, props) } }