feat:popover can dismiss all poped views
This commit is contained in:
@@ -31,10 +31,14 @@ export function popover(context: BridgeContext) {
|
||||
return context.popover.show(view.toModel())
|
||||
},
|
||||
dismiss: (view: View | undefined = undefined) => {
|
||||
if (panel && view) {
|
||||
panel.removeHeadView(view)
|
||||
if (panel) {
|
||||
if (view) {
|
||||
panel.removeHeadView(view)
|
||||
} else {
|
||||
panel.clearHeadViews()
|
||||
}
|
||||
}
|
||||
return context.popover.dismiss()
|
||||
return context.popover.dismiss(view ? { id: view.viewId } : undefined)
|
||||
},
|
||||
}
|
||||
}
|
@@ -58,6 +58,10 @@ export abstract class Panel {
|
||||
}
|
||||
}
|
||||
|
||||
clearHeadViews() {
|
||||
this.headviews.clear()
|
||||
}
|
||||
|
||||
getRootView() {
|
||||
return this.__root__
|
||||
}
|
||||
@@ -65,9 +69,6 @@ export abstract class Panel {
|
||||
getInitData() {
|
||||
return this.__data__
|
||||
}
|
||||
constructor() {
|
||||
this.addHeadView(this.__root__)
|
||||
}
|
||||
|
||||
@NativeCall
|
||||
private __init__(frame: Frame, data: any) {
|
||||
@@ -137,6 +138,7 @@ export abstract class Panel {
|
||||
}
|
||||
|
||||
private hookBeforeNativeCall() {
|
||||
this.__root__.clean()
|
||||
for (let v of this.headviews.values()) {
|
||||
v.clean()
|
||||
}
|
||||
@@ -145,6 +147,10 @@ export abstract class Panel {
|
||||
private hookAfterNativeCall() {
|
||||
//Here insert a native call to ensure the promise is resolved done.
|
||||
nativeEmpty()
|
||||
if (this.__root__.isDirty()) {
|
||||
const model = this.__root__.toModel()
|
||||
this.nativeRender(model)
|
||||
}
|
||||
for (let v of this.headviews.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model = v.toModel()
|
||||
|
Reference in New Issue
Block a user