gist-angular-popovers
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

EI-Popover

Overview

The Gist-popover is a structural angular 2 directive that turns an HTML element into a popover. Structural directives have the limitation of being allowed only one input that is a string. Due to this, all inputs will be specified in the following way *gistPopover="'inputstring'". Not the single quotes wrapping inputstring, they are required. Optionally, you can data bind the input string via *gistPopover="myVar". Where myVar is defined in the views component. All Inputs are optional, and if omitted will be set to their defaults. If an invalid input string is given, an error will be thrown.

Inputs

Target - Where to anchor the mouse

  • Ele -- default value
    • Popover will be anchored to side of element
  • Mouse
    • Popover will follow the mouse when the mouse is over the trigger element
  • X,Y - page coordinates
    • Popover will display at the X,Y coordinates given.
    • X and Y are relative from the top left visible corner
    • Useful if you need to click on the popover. Or don't have an element to anchor to ( map / canvas elements )

Position - what side of the target to show on

  • bottom -- default value
    • Popover will display below the target
  • top
    • Popover will display above the target
  • left
    • Popover will display to the left of the target
  • right
    • Popover will display to thr right of the target

isInteractive - Will the popover receive pointer events

  • false -- default
    • Mouse events will pass through the popover
  • true
    • Popover will capture mouse events

isVisible - control the popover display programically

  • undefined
    • Popover will display the mouse enters the trigger element, and hide when the mouse leaves it. If the popover is interactive, it will not hide while the mouse is over it
  • true
    • Popover will be visible
  • false
    • Popover will be hidden

Example Usage

<div *gistPopover="'target:ele; position:bottom; isVisible:true'">
    I will always display below my parent element
</div>
<div *gistPopover="isVisible:false'">
    I will never display
</div>
<div *gistPopover="componentBoundString">
    My inputs will be what ever the views component has set componentBoundString to
</div>
<div *gistPopover="'target:ele; position:left;'">
    I will display to the left of my parent element when you mouse over it
</div>
<div *gistPopover="'target:mouse; position:top;'">
    I will display above the mouse when you mouse over my parent element
</div>

Notes

  • Popovers are rendered as children of the gist-Popover-target instead of where you placed them ( look there in the dom inspector ). This takes care overflow issues. Nothing else about them is different though.
  • The popover will auto adjust its position to ensure that it does not go off of the page
  • The popover has hits height and width hard set when it toggles to being display. This ensures that it will not grow and shrink as it makes sure its on the page. This has the the side affect of meaning that 2 identical popovers can be different sizes. you can prevent this from applying your own styles to you popover

Demo Application

To see a working demo application run npm run start

Readme

Keywords

none

Package Sidebar

Install

npm i gist-angular-popovers

Weekly Downloads

1

Version

1.0.14

License

MIT

Last publish

Collaborators

  • robert.moncrief
  • david.anderson