Activity tracking and event system for monitoring changes and coordinating between components in the editor.
Enumeration of activity types for tracking editor operations.
/**
* Activity type enumeration for tracking editor changes
*/
enum ActivityType {
/** Node/element addition */
ADDED = 'added',
/** Node/element deletion */
DELETED = 'deleted',
/** Node/element modification */
MODIFIED = 'modified',
/** Composite operations */
COMPOSITE = 'composite'
}
/**
* Activity data structure (deprecated)
*/
type ActivityData = {
/** Activity type */
type: ActivityType;
/** Activity payload */
payload: IActivityPayload;
};Event system configuration and types.
/**
* Event configuration mapping
*/
interface EventConfig {
/** Node property change events */
[Node.Prop.Change]: (options: Node.Prop.ChangeOptions) => any;
[Node.Prop.InnerChange]: (options: Node.Prop.ChangeOptions) => any;
/** Node rerender events */
[Node.Rerender]: (options: Node.RerenderOptions) => void;
/** Generic event mapping */
[eventName: string]: any;
}Usage Examples:
import { ActivityType, EventConfig } from "@alilc/lowcode-types";
// Track activity
const activity = {
type: ActivityType.ADDED,
payload: {
schema: nodeSchema,
location: {
parent: { nodeId: "container-1", index: 2 }
}
}
};
// Event handling
const eventHandlers: EventConfig = {
'node.prop.change': (options) => {
console.log('Property changed:', options);
},
'node.rerender': (options) => {
console.log('Node rerendered:', options);
}
};