This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-js/lib/src/native/popover.js

28 lines
749 B
JavaScript
Raw Normal View History

2020-01-03 14:44:51 +08:00
import { Panel } from "../ui/panel";
export function popover(context) {
const entity = context.entity;
let panel = undefined;
if (entity instanceof Panel) {
panel = entity;
}
return {
show: (view) => {
if (panel) {
panel.addHeadView(view);
}
return context.popover.show(view.toModel());
},
dismiss: (view = undefined) => {
if (panel) {
if (view) {
panel.removeHeadView(view);
}
else {
panel.clearHeadViews();
}
}
return context.popover.dismiss(view ? { id: view.viewId } : undefined);
},
};
}