feat:should receive multi onRenderFinishedCallbacks
This commit is contained in:
parent
f3f28c55f8
commit
1f5fd7de30
@ -127,6 +127,19 @@ class ImageDemo extends Panel {
|
|||||||
end: Color.RED,
|
end: Color.RED,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
coordinator(context).verticalScrolling({
|
||||||
|
scrollable: it,
|
||||||
|
scrollRange: {
|
||||||
|
start: 0,
|
||||||
|
end: 100,
|
||||||
|
},
|
||||||
|
target: imageView,
|
||||||
|
changing: {
|
||||||
|
name: "width",
|
||||||
|
start: 10,
|
||||||
|
end: 200,
|
||||||
|
}
|
||||||
|
})
|
||||||
}).in(rootView)
|
}).in(rootView)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -898,6 +898,7 @@ var Panel = /** @class */ (function () {
|
|||||||
function Panel() {
|
function Panel() {
|
||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
}
|
||||||
Panel.prototype.onCreate = function () { };
|
Panel.prototype.onCreate = function () { };
|
||||||
Panel.prototype.onDestroy = function () { };
|
Panel.prototype.onDestroy = function () { };
|
||||||
@ -1127,11 +1128,18 @@ var Panel = /** @class */ (function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(function (_) {
|
Promise.all(promises).then(function (_) {
|
||||||
if (_this.onRenderFinished) {
|
|
||||||
_this.onRenderFinished();
|
_this.onRenderFinished();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Panel.prototype.onRenderFinished = function () {
|
||||||
|
this.onRenderFinishedCallback.forEach(function (e) {
|
||||||
|
e();
|
||||||
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
};
|
||||||
|
Panel.prototype.addOnRenderFinishedCallback = function (cb) {
|
||||||
|
this.onRenderFinishedCallback.push(cb);
|
||||||
|
};
|
||||||
__decorate$2([
|
__decorate$2([
|
||||||
NativeCall,
|
NativeCall,
|
||||||
__metadata$2("design:type", Function),
|
__metadata$2("design:type", Function),
|
||||||
@ -2917,7 +2925,7 @@ function coordinator(context) {
|
|||||||
verticalScrolling: function (argument) {
|
verticalScrolling: function (argument) {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
var panel = context.entity;
|
var panel = context.entity;
|
||||||
panel.onRenderFinished = function () {
|
panel.addOnRenderFinishedCallback(function () {
|
||||||
argument.scrollable = viewIdChains(argument.scrollable);
|
argument.scrollable = viewIdChains(argument.scrollable);
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
argument.target = viewIdChains(argument.target);
|
argument.target = viewIdChains(argument.target);
|
||||||
@ -2928,8 +2936,8 @@ function coordinator(context) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel();
|
argument.changing.end = argument.changing.end.toModel();
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
context.callNative("coordinator", "verticalScrolling", argument);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -669,6 +669,7 @@ class Panel {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -820,11 +821,18 @@ class Panel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
Promise.all(promises).then(_ => {
|
||||||
if (this.onRenderFinished) {
|
|
||||||
this.onRenderFinished();
|
this.onRenderFinished();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onRenderFinished() {
|
||||||
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
e();
|
||||||
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
}
|
||||||
|
addOnRenderFinishedCallback(cb) {
|
||||||
|
this.onRenderFinishedCallback.push(cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__decorate$2([
|
__decorate$2([
|
||||||
NativeCall,
|
NativeCall,
|
||||||
@ -2209,7 +2217,7 @@ function coordinator(context) {
|
|||||||
verticalScrolling: (argument) => {
|
verticalScrolling: (argument) => {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
const panel = context.entity;
|
const panel = context.entity;
|
||||||
panel.onRenderFinished = () => {
|
panel.addOnRenderFinishedCallback(() => {
|
||||||
argument.scrollable = viewIdChains(argument.scrollable);
|
argument.scrollable = viewIdChains(argument.scrollable);
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
argument.target = viewIdChains(argument.target);
|
argument.target = viewIdChains(argument.target);
|
||||||
@ -2220,8 +2228,8 @@ function coordinator(context) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel();
|
argument.changing.end = argument.changing.end.toModel();
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
context.callNative("coordinator", "verticalScrolling", argument);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2128,6 +2128,7 @@ class Panel {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -2279,11 +2280,18 @@ class Panel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
Promise.all(promises).then(_ => {
|
||||||
if (this.onRenderFinished) {
|
|
||||||
this.onRenderFinished();
|
this.onRenderFinished();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onRenderFinished() {
|
||||||
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
e();
|
||||||
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
}
|
||||||
|
addOnRenderFinishedCallback(cb) {
|
||||||
|
this.onRenderFinishedCallback.push(cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__decorate$2([
|
__decorate$2([
|
||||||
NativeCall,
|
NativeCall,
|
||||||
@ -3668,7 +3676,7 @@ function coordinator(context) {
|
|||||||
verticalScrolling: (argument) => {
|
verticalScrolling: (argument) => {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
const panel = context.entity;
|
const panel = context.entity;
|
||||||
panel.onRenderFinished = () => {
|
panel.addOnRenderFinishedCallback(() => {
|
||||||
argument.scrollable = viewIdChains(argument.scrollable);
|
argument.scrollable = viewIdChains(argument.scrollable);
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
argument.target = viewIdChains(argument.target);
|
argument.target = viewIdChains(argument.target);
|
||||||
@ -3679,8 +3687,8 @@ function coordinator(context) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel();
|
argument.changing.end = argument.changing.end.toModel();
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
context.callNative("coordinator", "verticalScrolling", argument);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
3
doric-js/index.d.ts
vendored
3
doric-js/index.d.ts
vendored
@ -284,13 +284,14 @@ declare module 'doric/lib/src/ui/panel' {
|
|||||||
onShow(): void;
|
onShow(): void;
|
||||||
onHidden(): void;
|
onHidden(): void;
|
||||||
abstract build(rootView: Group): void;
|
abstract build(rootView: Group): void;
|
||||||
onRenderFinished?: () => void;
|
|
||||||
addHeadView(type: string, v: View): void;
|
addHeadView(type: string, v: View): void;
|
||||||
allHeadViews(): IterableIterator<Map<string, View>>;
|
allHeadViews(): IterableIterator<Map<string, View>>;
|
||||||
removeHeadView(type: string, v: View | string): void;
|
removeHeadView(type: string, v: View | string): void;
|
||||||
clearHeadViews(type: string): void;
|
clearHeadViews(type: string): void;
|
||||||
getRootView(): Root;
|
getRootView(): Root;
|
||||||
getInitData(): object | undefined;
|
getInitData(): object | undefined;
|
||||||
|
onRenderFinished(): void;
|
||||||
|
addOnRenderFinishedCallback(cb: () => void): void;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export function coordinator(context) {
|
|||||||
verticalScrolling: (argument) => {
|
verticalScrolling: (argument) => {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
const panel = context.entity;
|
const panel = context.entity;
|
||||||
panel.onRenderFinished = () => {
|
panel.addOnRenderFinishedCallback(() => {
|
||||||
argument.scrollable = viewIdChains(argument.scrollable);
|
argument.scrollable = viewIdChains(argument.scrollable);
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
argument.target = viewIdChains(argument.target);
|
argument.target = viewIdChains(argument.target);
|
||||||
@ -26,8 +26,8 @@ export function coordinator(context) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel();
|
argument.changing.end = argument.changing.end.toModel();
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
context.callNative("coordinator", "verticalScrolling", argument);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
4
doric-js/lib/src/ui/panel.d.ts
vendored
4
doric-js/lib/src/ui/panel.d.ts
vendored
@ -12,7 +12,7 @@ export declare abstract class Panel {
|
|||||||
private __data__?;
|
private __data__?;
|
||||||
private __root__;
|
private __root__;
|
||||||
private headviews;
|
private headviews;
|
||||||
onRenderFinished?: () => void;
|
private onRenderFinishedCallback;
|
||||||
addHeadView(type: string, v: View): void;
|
addHeadView(type: string, v: View): void;
|
||||||
allHeadViews(): IterableIterator<Map<string, View>>;
|
allHeadViews(): IterableIterator<Map<string, View>>;
|
||||||
removeHeadView(type: string, v: View | string): void;
|
removeHeadView(type: string, v: View | string): void;
|
||||||
@ -30,4 +30,6 @@ export declare abstract class Panel {
|
|||||||
private nativeRender;
|
private nativeRender;
|
||||||
private hookBeforeNativeCall;
|
private hookBeforeNativeCall;
|
||||||
private hookAfterNativeCall;
|
private hookAfterNativeCall;
|
||||||
|
onRenderFinished(): void;
|
||||||
|
addOnRenderFinishedCallback(cb: () => void): void;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ export class Panel {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -188,11 +189,18 @@ export class Panel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
Promise.all(promises).then(_ => {
|
||||||
if (this.onRenderFinished) {
|
|
||||||
this.onRenderFinished();
|
this.onRenderFinished();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onRenderFinished() {
|
||||||
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
e();
|
||||||
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
}
|
||||||
|
addOnRenderFinishedCallback(cb) {
|
||||||
|
this.onRenderFinishedCallback.push(cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__decorate([
|
__decorate([
|
||||||
NativeCall,
|
NativeCall,
|
||||||
|
@ -49,7 +49,7 @@ export function coordinator(context: BridgeContext) {
|
|||||||
}) => {
|
}) => {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
const panel = context.entity
|
const panel = context.entity
|
||||||
panel.onRenderFinished = () => {
|
panel.addOnRenderFinishedCallback(() => {
|
||||||
(argument as any).scrollable = viewIdChains(argument.scrollable)
|
(argument as any).scrollable = viewIdChains(argument.scrollable)
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
(argument as any).target = viewIdChains(argument.target)
|
(argument as any).target = viewIdChains(argument.target)
|
||||||
@ -60,8 +60,8 @@ export function coordinator(context: BridgeContext) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel()
|
argument.changing.end = argument.changing.end.toModel()
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument)
|
context.callNative("coordinator", "verticalScrolling", argument)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export abstract class Panel {
|
|||||||
private __root__ = new Root
|
private __root__ = new Root
|
||||||
private headviews: Map<string, Map<string, View>> = new Map
|
private headviews: Map<string, Map<string, View>> = new Map
|
||||||
|
|
||||||
onRenderFinished?: () => void
|
private onRenderFinishedCallback: Array<() => void> = []
|
||||||
|
|
||||||
addHeadView(type: string, v: View) {
|
addHeadView(type: string, v: View) {
|
||||||
let map = this.headviews.get(type)
|
let map = this.headviews.get(type)
|
||||||
@ -209,9 +209,17 @@ export abstract class Panel {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
Promise.all(promises).then(_ => {
|
||||||
if (this.onRenderFinished) {
|
|
||||||
this.onRenderFinished()
|
this.onRenderFinished()
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onRenderFinished() {
|
||||||
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
e()
|
||||||
|
})
|
||||||
|
this.onRenderFinishedCallback.length = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
addOnRenderFinishedCallback(cb: () => void) {
|
||||||
|
this.onRenderFinishedCallback.push(cb)
|
||||||
|
}
|
||||||
}
|
}
|
18
doric-web/dist/index.js
vendored
18
doric-web/dist/index.js
vendored
@ -2186,6 +2186,7 @@ class Panel {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.__root__ = new Root;
|
this.__root__ = new Root;
|
||||||
this.headviews = new Map;
|
this.headviews = new Map;
|
||||||
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
}
|
||||||
onCreate() { }
|
onCreate() { }
|
||||||
onDestroy() { }
|
onDestroy() { }
|
||||||
@ -2337,11 +2338,18 @@ class Panel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Promise.all(promises).then(_ => {
|
Promise.all(promises).then(_ => {
|
||||||
if (this.onRenderFinished) {
|
|
||||||
this.onRenderFinished();
|
this.onRenderFinished();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onRenderFinished() {
|
||||||
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
|
e();
|
||||||
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
|
}
|
||||||
|
addOnRenderFinishedCallback(cb) {
|
||||||
|
this.onRenderFinishedCallback.push(cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
__decorate$2([
|
__decorate$2([
|
||||||
NativeCall,
|
NativeCall,
|
||||||
@ -3726,7 +3734,7 @@ function coordinator(context) {
|
|||||||
verticalScrolling: (argument) => {
|
verticalScrolling: (argument) => {
|
||||||
if (context.entity instanceof Panel) {
|
if (context.entity instanceof Panel) {
|
||||||
const panel = context.entity;
|
const panel = context.entity;
|
||||||
panel.onRenderFinished = () => {
|
panel.addOnRenderFinishedCallback(() => {
|
||||||
argument.scrollable = viewIdChains(argument.scrollable);
|
argument.scrollable = viewIdChains(argument.scrollable);
|
||||||
if (argument.target instanceof View) {
|
if (argument.target instanceof View) {
|
||||||
argument.target = viewIdChains(argument.target);
|
argument.target = viewIdChains(argument.target);
|
||||||
@ -3737,8 +3745,8 @@ function coordinator(context) {
|
|||||||
if (argument.changing.end instanceof Color) {
|
if (argument.changing.end instanceof Color) {
|
||||||
argument.changing.end = argument.changing.end.toModel();
|
argument.changing.end = argument.changing.end.toModel();
|
||||||
}
|
}
|
||||||
return context.callNative("coordinator", "verticalScrolling", argument);
|
context.callNative("coordinator", "verticalScrolling", argument);
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user