UNPKG

vue-d3-sunburst

Version:

[![GitHub open issues](https://img.shields.io/github/issues/David-Desmaisons/Vue.D3.sunburst.svg?maxAge=30)](https://github.com/David-Desmaisons/Vue.D3.sunburst/issues) [![Npm version](https://img.shields.io/npm/v/vue-d3-sunburst.svg?maxAge=2)](https://w

45 lines (40 loc) 918 B
/** * Renderless component providing pop-up display on mouse over behavior. * Can be used as a default slot of sunburst component. */ export default { name: "popUpOnHover", props: { /** * Sunburst event listener. Same as component $on method. */ on: { required: true, type: Function }, /** * Sunburst nodes. Typically provided by sunburst default slot. */ actions: { required: true, type: Object } }, render: () => null, created() { const { on, actions } = this; on("mouseOverNode", ({ node, center }) => { if (center) { actions.closeContextMenu(); return; } actions.setContextMenu(node); }); on("mouseLeave", () => { actions.closeContextMenu(); }); on("clickNode", () => { actions.closeContextMenu(); }); } };