jjb-lc-designable
Version:
基于alibaba-designable源码二次封装的表单设计器。
36 lines • 833 B
JavaScript
import { getKeyCodeFromEvent } from 'jjb-lc-designable/shared';
export class AbstractKeyboardEvent {
constructor(e) {
this.data = getKeyCodeFromEvent(e);
this.originEvent = e;
}
get eventType() {
return this.originEvent.type;
}
get ctrlKey() {
return this.originEvent.ctrlKey;
}
get shiftKey() {
return this.originEvent.shiftKey;
}
get metaKey() {
return this.originEvent.metaKey;
}
get altkey() {
return this.originEvent.altKey;
}
preventDefault() {
if (this.originEvent.preventDefault) {
this.originEvent.preventDefault();
} else {
this.originEvent.returnValue = false;
}
}
stopPropagation() {
if (this.originEvent?.stopPropagation) {
this.originEvent.stopPropagation();
} else {
this.originEvent.cancelBubble = true;
}
}
}