UNPKG

jjb-lc-designable

Version:

基于alibaba-designable源码二次封装的表单设计器。

35 lines 714 B
import { observable, define, action } from 'jjb-lc-formily/reactive'; import { HoverNodeEvent } from '../events'; export class Hover { node = null; constructor(props) { this.operation = props?.operation; this.makeObservable(); } setHover(node) { if (node) { this.node = node; } else { this.node = null; } this.trigger(); } clear() { this.node = null; } trigger() { if (this.operation) { return this.operation.dispatch(new HoverNodeEvent({ target: this.operation.tree, source: this.node })); } } makeObservable() { define(this, { node: observable.ref, setHover: action, clear: action }); } }