add navbar custom left & right view api
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import { BridgeContext } from "../runtime/global"
|
||||
import { Panel } from "../ui/panel"
|
||||
import { Color } from "../util/color"
|
||||
import { View } from "../ui/view"
|
||||
|
||||
export function navbar(context: BridgeContext) {
|
||||
const entity = context.entity
|
||||
@@ -43,5 +44,19 @@ export function navbar(context: BridgeContext) {
|
||||
color: color.toModel(),
|
||||
})
|
||||
},
|
||||
setLeft: (view: View) => {
|
||||
if (panel) {
|
||||
panel.clearHeadViews("navbar_left")
|
||||
panel.addHeadView("navbar_left", view)
|
||||
}
|
||||
return context.navbar.setLeft(view.toModel())
|
||||
},
|
||||
setRight: (view: View) => {
|
||||
if (panel) {
|
||||
panel.clearHeadViews("navbar_right")
|
||||
panel.addHeadView("navbar_right", view)
|
||||
}
|
||||
return context.navbar.setRight(view.toModel())
|
||||
}
|
||||
}
|
||||
}
|
@@ -141,7 +141,12 @@ export abstract class Panel {
|
||||
if (cur === this.__root__.viewId) {
|
||||
return this.__root__
|
||||
}
|
||||
return this.headviews.get(cur)
|
||||
for (let map of this.headviews.values()) {
|
||||
if (map.has(cur)) {
|
||||
return map.get(cur)
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
} else {
|
||||
if (Reflect.has(acc, "subviewById")) {
|
||||
return Reflect.apply(Reflect.get(acc, "subviewById"), acc, [cur])
|
||||
|
Reference in New Issue
Block a user