jjb-lc-designable
Version:
基于alibaba-designable源码二次封装的表单设计器。
71 lines • 1.65 kB
JavaScript
import { action, define, observable } from 'jjb-lc-formily/reactive';
export let ScreenType = /*#__PURE__*/function (ScreenType) {
ScreenType["PC"] = "PC";
ScreenType["Responsive"] = "Responsive";
ScreenType["Mobile"] = "Mobile";
ScreenType["Sketch"] = "Sketch";
return ScreenType;
}({});
export let ScreenStatus = /*#__PURE__*/function (ScreenStatus) {
ScreenStatus["Normal"] = "Normal";
ScreenStatus["Resizing"] = "Resizing";
ScreenStatus["Zooming"] = "Zooming";
return ScreenStatus;
}({});
export class Screen {
scale = 1;
width = '100%';
height = '100%';
background = '';
flip = false;
status = ScreenStatus.Normal;
constructor(engine) {
this.engine = engine;
this.type = engine.props.defaultScreenType;
this.makeObservable();
}
makeObservable() {
define(this, {
type: observable.ref,
scale: observable.ref,
width: observable.ref,
height: observable.ref,
status: observable.ref,
flip: observable.ref,
background: observable.ref,
setType: action,
setScale: action,
setSize: action,
resetSize: action,
setBackground: action,
setFlip: action
});
}
setStatus(status) {
this.status = status;
}
setType(type) {
this.type = type;
}
setScale(scale) {
this.scale = scale;
}
setSize(width, height) {
if (width) {
this.width = width;
}
if (height) {
this.height = height;
}
}
resetSize() {
this.width = '100%';
this.height = '100%';
}
setBackground(background) {
this.background = background;
}
setFlip(flip) {
this.flip = flip;
}
}