ddei-editor/plugins/core/lifecycles/core-lifecycle.ts
2024-11-18 17:52:02 +08:00

57 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { DDeiLifeCycle, DDeiFuncData, DDeiEditorUtil, DDeiUtil, DDeiFuncCallResult, DDeiEditorState } from "ddei-framework";
import { debounce } from "lodash";
class DDeiCoreLifeCycle extends DDeiLifeCycle {
name:string = "ddei-core-lifecycle"
/**
* 缺省实例
*/
static defaultIns: DDeiCoreLifeCycle = new DDeiCoreLifeCycle(null);
EVENT_MOUSE_MOVE_IN_LAYER: DDeiFuncData | null = new DDeiFuncData("mouse-operating", 1, this.mouseOperating);
/**
* 正在进行鼠标操作
*/
mouseOperating(operateType, data, ddInstance, evt): DDeiFuncCallResult {
let editor = DDeiEditorUtil.getEditorInsByDDei(ddInstance);
DDeiEditorUtil.closeDialog(editor, 'ddei-core-dialog-choosecontrol')
}
static configuration(options, fullConfig: boolean = false) {
//解析options只使用自己相关的
if (options) {
let newOptions = {}
if (fullConfig) {
if (fullConfig) {
if (options[DDeiCoreLifeCycle.name]) {
for (let i in options[DDeiCoreLifeCycle.name]) {
newOptions[i] = options[DDeiCoreLifeCycle.name][i]
}
}
}
} else {
newOptions = options
}
if (newOptions && Object.keys(newOptions).length !== 0) {
let panels = new DDeiCoreLifeCycle();
if (newOptions.name) {
panels.name = newOptions.name
}
if (newOptions.sort) {
panels.sort = newOptions.sort
}
return panels;
}
}
return DDeiCoreLifeCycle;
}
static modify(fn) {
return DDeiCoreLifeCycle.defaultIns.modify(fn)
}
}
export default DDeiCoreLifeCycle