From 848b7005b72f48a1ba9261858d43c217472c76b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Fri, 10 Jan 2020 15:55:47 +0800 Subject: [PATCH] add navbar custom left & right view api --- doric-demo/src/NavbarDemo.ts | 56 ++++++++++++++++++++++++++++- doric-js/bundle/doric-lib.js | 25 ++++++++++++- doric-js/bundle/doric-vm.js | 25 ++++++++++++- doric-js/index.d.ts | 3 ++ doric-js/lib/src/native/navbar.d.ts | 3 ++ doric-js/lib/src/native/navbar.js | 14 ++++++++ doric-js/lib/src/ui/panel.js | 7 +++- doric-js/src/native/navbar.ts | 15 ++++++++ doric-js/src/ui/panel.ts | 7 +++- 9 files changed, 150 insertions(+), 5 deletions(-) diff --git a/doric-demo/src/NavbarDemo.ts b/doric-demo/src/NavbarDemo.ts index b88fdc7e..33376e5c 100644 --- a/doric-demo/src/NavbarDemo.ts +++ b/doric-demo/src/NavbarDemo.ts @@ -1,6 +1,8 @@ -import { Group, Panel, navbar, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network, navigator } from "doric"; +import { Group, Panel, navbar, text, gravity, Color, LayoutSpec, vlayout, Gravity, hlayout, scroller, layoutConfig, image, IVLayout, modal, IText, navigator } from "doric"; import { title, label, colors } from "./utils"; +const shareIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAACZFBMVEUAAABEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBEREBDQ0NDQ0JCQkJCQkJDQ0JCQkJDQ0NBQUBBQUBAQEBAQEBBQUFCQkFCQkFBQUFCQkI8PDxDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NBQUE7OztDQ0NDQ0NDQ0NDQ0NERERDQ0NDQ0NCQkJCQkJCQkJDQ0NBQUFCQkJDQ0NAQD5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LY3dyYwOkUNdnPKwWcRPZrA6BA12M0hJ59F9fj51T56sJp9eeg/epAirObBPPQfPTRDEzYz81Ae+o+icaqwmfF89B89TBU283A++o+ik3RhMScd9F9y0X90gjIs5kTP/bswgU9nv6SN7Odw7/27MIFPZ786Th9Zz/H7eu7fiQmcy35NIVnPvT3378YEzmW/maSRbGdyU6//FsGRCXwmO3aUTrKco8d67d+VCWxmd1NKlnN3r/07M4HN7MhhWsnwJ4AjPfbvzgTOZ488Si9ZzaOP9PpvEd2ZwIXsMXBYRnPmsZ7/Lao7ExjL1ozSTRYzuqb3f4vs0ATGkl2raMf/rNrl4N+iOzSB8fntnfTje+7Y7/j7CXo1gS3Z735PQ37n9kPuv5/C5fdc/OGPdORzDt6W7/6Xj/xp8wFq8jUHNk/lvf9Gth8m7Gn27Y8K0H8U7X38CcpyP088vrcY/TfmyfNIYcczc/7JqDD9N+bsU3x7lMOZfuqsl++nc2QCO2Z//stfKc7N3LDnRj8dOTOBnbOb/3bVbtrrdXZfe931nv4/6s4EXjSb2rljO1io65ncvmPnlLf/Rrs0gYtmf7/0H//81/kt/x4fGxsbn1gfnwmyTtnW/1z236uvWfE/r99P69QEkhUvc2sCyYqWuTaBZMXKnJtAskJlHkwgWZEyHyaQrECZFxNIVpzMjwkkK0zmyQSSFTBzagLJiphxP+if+0H/c+cDI42fEMtkQlnr+eBw44SoTCaUtX4+UKvV2s+EyYLO4lOqDg4OVktkQln8Z8DSsmq12nYmTBZ4FjOBpcrAwEDbmTBZ4FnMBJb6K5VKf/vvkwWeLSxA3+y0vSkgCz9rrkSpXC6X2t8Ukglk/weJWCcLFzLySAAAAABJRU5ErkJggg==" + @Entry class NavbarDemo extends Panel { build(rootView: Group): void { @@ -62,6 +64,58 @@ class NavbarDemo extends Panel { }) } } as IText), + label('setLeft').apply({ + width: 200, + height: 50, + backgroundColor: colors[0], + textSize: 30, + textColor: Color.WHITE, + layoutConfig: layoutConfig().just(), + onClick: () => { + navbar(context).setLeft(text({ + width: 70, + height: 44, + textColor: Color.BLACK, + layoutConfig: layoutConfig().just().configAlignment(Gravity.Center), + text: "Left", + })) + .catch(e => { + modal(context).alert(e) + }) + } + } as IText), + label('setRight').apply({ + width: 200, + height: 50, + backgroundColor: colors[0], + textSize: 30, + textColor: Color.WHITE, + layoutConfig: layoutConfig().just(), + onClick: () => { + navbar(context).setRight(hlayout([ + text({ + width: 70, + height: 44, + textColor: Color.BLACK, + layoutConfig: layoutConfig().just().configAlignment(Gravity.Center), + text: "Right", + }), + image({ + imageBase64: shareIcon + }).apply({ + layoutConfig: layoutConfig().just().configAlignment(gravity().centerY()), + width: 33, + height: 33, + onClick: () => { + modal(context).toast('Right Clicked', Gravity.Bottom) + } + }) + ])) + .catch(e => { + modal(context).alert(e) + }) + } + } as IText), label('Pop').apply({ width: 200, height: 50, diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index c44254fd..a6274638 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -752,7 +752,12 @@ 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")) { @@ -1837,6 +1842,10 @@ function modal(context) { function navbar(context) { const entity = context.entity; + let panel = undefined; + if (entity instanceof Panel) { + panel = entity; + } return { isHidden: () => { return context.navbar.isHidden(); @@ -1856,6 +1865,20 @@ function navbar(context) { color: color.toModel(), }); }, + setLeft: (view) => { + if (panel) { + panel.clearHeadViews("navbar_left"); + panel.addHeadView("navbar_left", view); + } + return context.navbar.setLeft(view.toModel()); + }, + setRight: (view) => { + if (panel) { + panel.clearHeadViews("navbar_right"); + panel.addHeadView("navbar_right", view); + } + return context.navbar.setRight(view.toModel()); + } }; } diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index b7c04d3d..86557468 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -2211,7 +2211,12 @@ 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")) { @@ -3296,6 +3301,10 @@ function modal(context) { function navbar(context) { const entity = context.entity; + let panel = undefined; + if (entity instanceof Panel) { + panel = entity; + } return { isHidden: () => { return context.navbar.isHidden(); @@ -3315,6 +3324,20 @@ function navbar(context) { color: color.toModel(), }); }, + setLeft: (view) => { + if (panel) { + panel.clearHeadViews("navbar_left"); + panel.addHeadView("navbar_left", view); + } + return context.navbar.setLeft(view.toModel()); + }, + setRight: (view) => { + if (panel) { + panel.clearHeadViews("navbar_right"); + panel.addHeadView("navbar_right", view); + } + return context.navbar.setRight(view.toModel()); + } }; } diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 08dbfd16..ba026d10 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -713,11 +713,14 @@ declare module 'doric/lib/src/native/modal' { declare module 'doric/lib/src/native/navbar' { import { BridgeContext } from "doric/lib/src/runtime/global"; import { Color } from "doric/lib/src/util/color"; + import { View } from "doric/lib/src/ui/view"; export function navbar(context: BridgeContext): { isHidden: () => Promise; setHidden: (hidden: boolean) => Promise; setTitle: (title: string) => Promise; setBgColor: (color: Color) => Promise; + setLeft: (view: View) => Promise; + setRight: (view: View) => Promise; }; } diff --git a/doric-js/lib/src/native/navbar.d.ts b/doric-js/lib/src/native/navbar.d.ts index 98271847..7f7b9f27 100644 --- a/doric-js/lib/src/native/navbar.d.ts +++ b/doric-js/lib/src/native/navbar.d.ts @@ -1,8 +1,11 @@ import { BridgeContext } from "../runtime/global"; import { Color } from "../util/color"; +import { View } from "../ui/view"; export declare function navbar(context: BridgeContext): { isHidden: () => Promise; setHidden: (hidden: boolean) => Promise; setTitle: (title: string) => Promise; setBgColor: (color: Color) => Promise; + setLeft: (view: View) => Promise; + setRight: (view: View) => Promise; }; diff --git a/doric-js/lib/src/native/navbar.js b/doric-js/lib/src/native/navbar.js index 3a153433..95085d24 100644 --- a/doric-js/lib/src/native/navbar.js +++ b/doric-js/lib/src/native/navbar.js @@ -24,5 +24,19 @@ export function navbar(context) { color: color.toModel(), }); }, + setLeft: (view) => { + if (panel) { + panel.clearHeadViews("navbar_left"); + panel.addHeadView("navbar_left", view); + } + return context.navbar.setLeft(view.toModel()); + }, + setRight: (view) => { + if (panel) { + panel.clearHeadViews("navbar_right"); + panel.addHeadView("navbar_right", view); + } + return context.navbar.setRight(view.toModel()); + } }; } diff --git a/doric-js/lib/src/ui/panel.js b/doric-js/lib/src/ui/panel.js index db4b0dee..acce9cf4 100644 --- a/doric-js/lib/src/ui/panel.js +++ b/doric-js/lib/src/ui/panel.js @@ -123,7 +123,12 @@ export 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")) { diff --git a/doric-js/src/native/navbar.ts b/doric-js/src/native/navbar.ts index bb6890a6..1f3bb9c4 100644 --- a/doric-js/src/native/navbar.ts +++ b/doric-js/src/native/navbar.ts @@ -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()) + } } } \ No newline at end of file diff --git a/doric-js/src/ui/panel.ts b/doric-js/src/ui/panel.ts index 0941b432..31db583c 100644 --- a/doric-js/src/ui/panel.ts +++ b/doric-js/src/ui/panel.ts @@ -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])