optimize js code
This commit is contained in:
1
doric-js/lib/src/ui/view.d.ts
vendored
1
doric-js/lib/src/ui/view.d.ts
vendored
@@ -131,6 +131,7 @@ export declare abstract class View implements Modeling {
|
||||
* Only affected when its superview or itself is FlexLayout.
|
||||
*/
|
||||
flexConfig?: FlexConfig;
|
||||
set props(props: Partial<this>);
|
||||
doAnimation(context: BridgeContext, animation: IAnimation): Promise<void>;
|
||||
clearAnimation(context: BridgeContext, animation: IAnimation): Promise<void>;
|
||||
cancelAnimation(context: BridgeContext, animation: IAnimation): Promise<void>;
|
||||
|
@@ -200,6 +200,9 @@ export class View {
|
||||
getLocationOnScreen(context) {
|
||||
return this.nativeChannel(context, "getLocationOnScreen")();
|
||||
}
|
||||
set props(props) {
|
||||
this.apply(props);
|
||||
}
|
||||
doAnimation(context, animation) {
|
||||
return this.nativeChannel(context, "doAnimation")(animation.toModel()).then((args) => {
|
||||
for (let key in args) {
|
||||
|
@@ -43,9 +43,7 @@ export function draggable(views, config) {
|
||||
});
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@@ -141,9 +141,7 @@ export function flowItem(item, config) {
|
||||
});
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(it, key, Reflect.get(config, key, config), it);
|
||||
}
|
||||
it.apply(config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -105,8 +105,6 @@ __decorate([
|
||||
export function image(config) {
|
||||
const ret = new Image;
|
||||
ret.layoutConfig = layoutConfig().fit();
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -146,8 +146,6 @@ export var InputType;
|
||||
export function input(config) {
|
||||
const ret = new Input;
|
||||
ret.layoutConfig = layoutConfig().just();
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -50,9 +50,7 @@ export function stack(views, config) {
|
||||
ret.addChild(v);
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -63,9 +61,7 @@ export function hlayout(views, config) {
|
||||
ret.addChild(v);
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -76,9 +72,7 @@ export function vlayout(views, config) {
|
||||
ret.addChild(v);
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -91,9 +85,7 @@ export function flexlayout(views, config) {
|
||||
ret.addChild(v);
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@@ -123,9 +123,7 @@ __decorate([
|
||||
], List.prototype, "bounces", void 0);
|
||||
export function list(config) {
|
||||
const ret = new List;
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
export function listItem(item, config) {
|
||||
@@ -140,9 +138,7 @@ export function listItem(item, config) {
|
||||
});
|
||||
}
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(it, key, Reflect.get(config, key, config), it);
|
||||
}
|
||||
it.apply(config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -42,9 +42,7 @@ __decorate([
|
||||
export function refreshable(config) {
|
||||
const ret = new Refreshable;
|
||||
ret.layoutConfig = layoutConfig().fit();
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
export function pullable(v, config) {
|
||||
|
@@ -28,9 +28,7 @@ export function scroller(content, config) {
|
||||
return (new Scroller).also(v => {
|
||||
v.layoutConfig = layoutConfig().fit();
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(v, key, Reflect.get(config, key, config), v);
|
||||
}
|
||||
v.apply(config);
|
||||
}
|
||||
v.content = content;
|
||||
});
|
||||
|
@@ -90,9 +90,7 @@ __decorate([
|
||||
], Slider.prototype, "bounces", void 0);
|
||||
export function slider(config) {
|
||||
const ret = new Slider;
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
export function slideItem(item, config) {
|
||||
|
@@ -52,8 +52,6 @@ export function switchView(config) {
|
||||
ret.layoutConfig = layoutConfig().just();
|
||||
ret.width = 50;
|
||||
ret.height = 30;
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -93,8 +93,6 @@ __decorate([
|
||||
export function text(config) {
|
||||
const ret = new Text;
|
||||
ret.layoutConfig = layoutConfig().fit();
|
||||
for (let key in config) {
|
||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
||||
}
|
||||
ret.apply(config);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user