New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bpui/popover

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bpui/popover - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

dist/index.common.min.js
/*!
* bpui popover v0.0.8
* bpui popover v0.0.9
* Copyright (c) 2020 Copyright bp All Rights Reserved.
* Released under the MIT License.
*/'use strict';function _interopDefault(a){return a&&"object"==typeof a&&"default"in a?a["default"]:a}var bpLibs=_interopDefault(require("@bpui/libs")),bpDialog=_interopDefault(require("@bpui/dialog")),script={components:{widget:bpDialog.bpWidget},props:{visible:Boolean,mask:{default:!1,type:Boolean},maskClose:{default:!0,type:Boolean},pageClass:String|Array,pageStyle:String|Array|Object,direction:{default:"auto",type:String},trigger:{type:String},bind:{}},data(){return{visibleReal:!1,directionData:"auto",offsetTop:0,offsetLeft:0,offsetArrowLeft:null,offsetArrowTop:null,offsetArrowBottom:null,offsetArrowRight:null}},watch:{visible(a,b){this.visibleReal!=a&&(this.visibleReal=a,a!=b&&a&&this._show(this.direction))},visibleReal(a){this.$emit("update:visible",a)},bind(a,b){this._removeEvent(b),this._bindEvent(a)}},beforeMount(){this.visibleReal=this.visible},beforeDestroy(){$("body").off("click",this._hide)},mounted(){$("body").off("click",this._hide).on("click",this._hide),this.$nextTick(()=>{this.$parent.$forceUpdate()})},methods:{show:function(){return this.$refs.widget.show()},hide:function(){return this.$refs.widget.hide()},_removeEvent(a){if(a){let b;b=bpLibs.dom.isVueObject(a)?a.$el:a,$(b).off("mouseover",this._onTrigger),$(b).off("mouseleave",this._onTriggerHide),$(b).off("click",this._onTrigger)}},_bindEvent(a){if(this._removeEvent(a),a){let b;if(b=bpLibs.dom.isVueObject(a)?a.$el:a,"hover"==this.trigger&&(bpLibs.device.browserIsMobile()?$(b).on("click",this._onTrigger):($(b).on("mouseover",this._onTrigger),$(b).on("mouseleave",this._onTriggerHide))),"click"==this.trigger){let a=bpLibs.device.browserIsMobile()?"click":"click";$(b).off(a,this._onTrigger).on(a,this._onTrigger)}}},_onTrigger(){this.visibleReal=!0,this._show(this.direction)},_onTriggerHide(){this.visibleReal=!1},_show:function(a){let b=this.bind;if(!this.bind)return;let c=bpLibs.dom.isVueObject(b)?b.$el:b;let d=bpLibs.dom.getElementOffset(c),e={};e.height=c.clientHeight,e.width=c.clientWidth;let f=bpLibs.dom.getViewPort(),g=bpLibs.dom.getDocumentOffset();this.offsetTop=d.top+g.top,"top"==a?(this.directionData="top",this.offsetTop-=e.height,this.offsetTop-=8):"bottom"==a?(this.directionData="bottom",this.offsetTop+=e.height):"left"==a?(this.directionData="left",this.offsetLeft=d.left+e.width):"right"==a?(this.directionData="right",this.offsetLeft=d.left+e.width):d.top+e.height/2>f.height/2?(this.directionData="top",this.offsetTop-=e.height,this.offsetTop-=8):(this.directionData="bottom",this.offsetTop+=e.height),this.offsetTop+="px";let h="left"==a||"right"==a?parseInt(d.top+e.height/2):parseInt(d.left+e.width/2);const i=10;let j=this.$refs.main;bpLibs.dom.probeDom(200,()=>0<j.clientWidth,()=>{if("left"==a||"right"==a){let b=parseInt(h-j.clientHeight/2);b<i&&(b=i),b+j.clientHeight>f.height-i&&(b=f.height-i-j.clientHeight),this.offsetTop=b+g.top+"px",this.offsetLeft="right"==a?d.left+e.width-6:d.left-j.clientWidth-6,this.offsetLeft+=g.left,this.offsetLeft+="px",this.offsetArrowLeft=null,this.offsetArrowBottom=null,this.offsetArrowTop=h-b-6,10>this.offsetArrowTop?this.offsetArrowTop=10:this.offsetArrowTop>j.clientHeight-22&&(this.offsetArrowTop=j.clientHeight-22),this.offsetArrowTop+="px",this.offsetArrowRight=null}else{let a=parseInt(h-j.clientWidth/2);a<i&&(a=i),a+j.clientWidth>f.width-i&&(a=f.width-i-j.clientWidth),this.offsetLeft=a+"px",this.offsetArrowLeft=h-a-6,10>this.offsetArrowLeft?this.offsetArrowLeft=10:this.offsetArrowLeft>j.clientWidth-22&&(this.offsetArrowLeft=j.clientWidth-22),this.offsetArrowLeft+="px",this.offsetArrowBottom=null,this.offsetArrowTop=null,this.offsetArrowRight=null}})},_hide(){this.hide().then(()=>{})}}};function normalizeComponent(a,b,c,d,e,f,g,h,i,j){"boolean"!=typeof g&&(i=h,h=g,g=!1);const k="function"==typeof c?c.options:c;a&&a.render&&(k.render=a.render,k.staticRenderFns=a.staticRenderFns,k._compiled=!0,e&&(k.functional=!0)),d&&(k._scopeId=d);let l;if(f?(l=function(a){a=a||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,a||"undefined"==typeof __VUE_SSR_CONTEXT__||(a=__VUE_SSR_CONTEXT__),b&&b.call(this,i(a)),a&&a._registeredComponents&&a._registeredComponents.add(f)},k._ssrRegister=l):b&&(l=g?function(a){b.call(this,j(a,this.$root.$options.shadowRoot))}:function(a){b.call(this,h(a))}),l)if(k.functional){const a=k.render;k.render=function(b,c){return l.call(c),a(b,c)}}else{const a=k.beforeCreate;k.beforeCreate=a?[].concat(a,l):[l]}return c}const __vue_script__=script;var __vue_render__=function(){var a=this,b=a.$createElement,c=a._self._c||b;return c("widget",{ref:"widget",staticClass:"bp-popover",attrs:{visible:a.visibleReal,maskClose:a.maskClose,mask:a.mask,pageClass:a.pageClass,pageStyle:a.pageStyle,preventEvent:!1},on:{"update:visible":function(b){a.visibleReal=b}}},[c("div",{ref:"main",staticClass:"bp-popover__main",style:{left:a.offsetLeft,top:a.offsetTop},attrs:{direction:a.directionData}},[a._t("default"),a._v(" "),c("div",{staticClass:"bp-popover__arrow",style:{left:a.offsetArrowLeft,top:a.offsetArrowTop,right:a.offsetArrowRight,bottom:a.offsetArrowBottom}})],2)])},__vue_staticRenderFns__=[];__vue_render__._withStripped=!0;const __vue_inject_styles__=void 0,__vue_scope_id__=void 0,__vue_module_identifier__=void 0,__vue_is_functional_template__=!1,__vue_component__=normalizeComponent({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},void 0,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,!1,void 0,void 0,void 0);var index={bpPopover:__vue_component__};module.exports=index;
/*!
* bpui popover v0.0.8
* bpui popover v0.0.9
* Copyright (c) 2020 Copyright bp All Rights Reserved.
* Released under the MIT License.
*/import bpLibs from"@bpui/libs";import bpDialog from"@bpui/dialog";var script={components:{widget:bpDialog.bpWidget},props:{visible:Boolean,mask:{default:!1,type:Boolean},maskClose:{default:!0,type:Boolean},pageClass:String|Array,pageStyle:String|Array|Object,direction:{default:"auto",type:String},trigger:{type:String},bind:{}},data(){return{visibleReal:!1,directionData:"auto",offsetTop:0,offsetLeft:0,offsetArrowLeft:null,offsetArrowTop:null,offsetArrowBottom:null,offsetArrowRight:null}},watch:{visible(a,b){this.visibleReal!=a&&(this.visibleReal=a,a!=b&&a&&this._show(this.direction))},visibleReal(a){this.$emit("update:visible",a)},bind(a,b){this._removeEvent(b),this._bindEvent(a)}},beforeMount(){this.visibleReal=this.visible},beforeDestroy(){$("body").off("click",this._hide)},mounted(){$("body").off("click",this._hide).on("click",this._hide),this.$nextTick(()=>{this.$parent.$forceUpdate()})},methods:{show:function(){return this.$refs.widget.show()},hide:function(){return this.$refs.widget.hide()},_removeEvent(a){if(a){let b;b=bpLibs.dom.isVueObject(a)?a.$el:a,$(b).off("mouseover",this._onTrigger),$(b).off("mouseleave",this._onTriggerHide),$(b).off("click",this._onTrigger)}},_bindEvent(a){if(this._removeEvent(a),a){let b;if(b=bpLibs.dom.isVueObject(a)?a.$el:a,"hover"==this.trigger&&(bpLibs.device.browserIsMobile()?$(b).on("click",this._onTrigger):($(b).on("mouseover",this._onTrigger),$(b).on("mouseleave",this._onTriggerHide))),"click"==this.trigger){let a=bpLibs.device.browserIsMobile()?"click":"click";$(b).off(a,this._onTrigger).on(a,this._onTrigger)}}},_onTrigger(){this.visibleReal=!0,this._show(this.direction)},_onTriggerHide(){this.visibleReal=!1},_show:function(a){let b=this.bind;if(!this.bind)return;let c=bpLibs.dom.isVueObject(b)?b.$el:b;let d=bpLibs.dom.getElementOffset(c),e={};e.height=c.clientHeight,e.width=c.clientWidth;let f=bpLibs.dom.getViewPort(),g=bpLibs.dom.getDocumentOffset();this.offsetTop=d.top+g.top,"top"==a?(this.directionData="top",this.offsetTop-=e.height,this.offsetTop-=8):"bottom"==a?(this.directionData="bottom",this.offsetTop+=e.height):"left"==a?(this.directionData="left",this.offsetLeft=d.left+e.width):"right"==a?(this.directionData="right",this.offsetLeft=d.left+e.width):d.top+e.height/2>f.height/2?(this.directionData="top",this.offsetTop-=e.height,this.offsetTop-=8):(this.directionData="bottom",this.offsetTop+=e.height),this.offsetTop+="px";let h="left"==a||"right"==a?parseInt(d.top+e.height/2):parseInt(d.left+e.width/2);const i=10;let j=this.$refs.main;bpLibs.dom.probeDom(200,()=>0<j.clientWidth,()=>{if("left"==a||"right"==a){let b=parseInt(h-j.clientHeight/2);b<i&&(b=i),b+j.clientHeight>f.height-i&&(b=f.height-i-j.clientHeight),this.offsetTop=b+g.top+"px",this.offsetLeft="right"==a?d.left+e.width-6:d.left-j.clientWidth-6,this.offsetLeft+=g.left,this.offsetLeft+="px",this.offsetArrowLeft=null,this.offsetArrowBottom=null,this.offsetArrowTop=h-b-6,10>this.offsetArrowTop?this.offsetArrowTop=10:this.offsetArrowTop>j.clientHeight-22&&(this.offsetArrowTop=j.clientHeight-22),this.offsetArrowTop+="px",this.offsetArrowRight=null}else{let a=parseInt(h-j.clientWidth/2);a<i&&(a=i),a+j.clientWidth>f.width-i&&(a=f.width-i-j.clientWidth),this.offsetLeft=a+"px",this.offsetArrowLeft=h-a-6,10>this.offsetArrowLeft?this.offsetArrowLeft=10:this.offsetArrowLeft>j.clientWidth-22&&(this.offsetArrowLeft=j.clientWidth-22),this.offsetArrowLeft+="px",this.offsetArrowBottom=null,this.offsetArrowTop=null,this.offsetArrowRight=null}})},_hide(){this.hide().then(()=>{})}}};function normalizeComponent(a,b,c,d,e,f,g,h,i,j){"boolean"!=typeof g&&(i=h,h=g,g=!1);const k="function"==typeof c?c.options:c;a&&a.render&&(k.render=a.render,k.staticRenderFns=a.staticRenderFns,k._compiled=!0,e&&(k.functional=!0)),d&&(k._scopeId=d);let l;if(f?(l=function(a){a=a||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,a||"undefined"==typeof __VUE_SSR_CONTEXT__||(a=__VUE_SSR_CONTEXT__),b&&b.call(this,i(a)),a&&a._registeredComponents&&a._registeredComponents.add(f)},k._ssrRegister=l):b&&(l=g?function(a){b.call(this,j(a,this.$root.$options.shadowRoot))}:function(a){b.call(this,h(a))}),l)if(k.functional){const a=k.render;k.render=function(b,c){return l.call(c),a(b,c)}}else{const a=k.beforeCreate;k.beforeCreate=a?[].concat(a,l):[l]}return c}const __vue_script__=script;var __vue_render__=function(){var a=this,b=a.$createElement,c=a._self._c||b;return c("widget",{ref:"widget",staticClass:"bp-popover",attrs:{visible:a.visibleReal,maskClose:a.maskClose,mask:a.mask,pageClass:a.pageClass,pageStyle:a.pageStyle,preventEvent:!1},on:{"update:visible":function(b){a.visibleReal=b}}},[c("div",{ref:"main",staticClass:"bp-popover__main",style:{left:a.offsetLeft,top:a.offsetTop},attrs:{direction:a.directionData}},[a._t("default"),a._v(" "),c("div",{staticClass:"bp-popover__arrow",style:{left:a.offsetArrowLeft,top:a.offsetArrowTop,right:a.offsetArrowRight,bottom:a.offsetArrowBottom}})],2)])},__vue_staticRenderFns__=[];__vue_render__._withStripped=!0;const __vue_inject_styles__=void 0,__vue_scope_id__=void 0,__vue_module_identifier__=void 0,__vue_is_functional_template__=!1,__vue_component__=normalizeComponent({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},void 0,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,!1,void 0,void 0,void 0);var index={bpPopover:__vue_component__};export default index;
/*!
* bpui popover v0.0.8
* bpui popover v0.0.9
* Copyright (c) 2020 Copyright bp All Rights Reserved.
* Released under the MIT License.
*/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b(require("@bpui/libs"),require("@bpui/dialog")):"function"==typeof define&&define.amd?define(["@bpui/libs","@bpui/dialog"],b):(a=a||self,a.bpPopover=b(a.bpLibs,a.bpDialog))})(this,function(a,b){'use strict';a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a["default"]:a,b=b&&Object.prototype.hasOwnProperty.call(b,"default")?b["default"]:b;var c={components:{widget:b.bpWidget},props:{visible:Boolean,mask:{default:!1,type:Boolean},maskClose:{default:!0,type:Boolean},pageClass:String|Array,pageStyle:String|Array|Object,direction:{default:"auto",type:String},trigger:{type:String},bind:{}},data(){return{visibleReal:!1,directionData:"auto",offsetTop:0,offsetLeft:0,offsetArrowLeft:null,offsetArrowTop:null,offsetArrowBottom:null,offsetArrowRight:null}},watch:{visible(a,b){this.visibleReal!=a&&(this.visibleReal=a,a!=b&&a&&this._show(this.direction))},visibleReal(a){this.$emit("update:visible",a)},bind(a,b){this._removeEvent(b),this._bindEvent(a)}},beforeMount(){this.visibleReal=this.visible},beforeDestroy(){$("body").off("click",this._hide)},mounted(){$("body").off("click",this._hide).on("click",this._hide),this.$nextTick(()=>{this.$parent.$forceUpdate()})},methods:{show:function(){return this.$refs.widget.show()},hide:function(){return this.$refs.widget.hide()},_removeEvent(b){if(b){let c;c=a.dom.isVueObject(b)?b.$el:b,$(c).off("mouseover",this._onTrigger),$(c).off("mouseleave",this._onTriggerHide),$(c).off("click",this._onTrigger)}},_bindEvent(b){if(this._removeEvent(b),b){let c;if(c=a.dom.isVueObject(b)?b.$el:b,"hover"==this.trigger&&(a.device.browserIsMobile()?$(c).on("click",this._onTrigger):($(c).on("mouseover",this._onTrigger),$(c).on("mouseleave",this._onTriggerHide))),"click"==this.trigger){let b=a.device.browserIsMobile()?"click":"click";$(c).off(b,this._onTrigger).on(b,this._onTrigger)}}},_onTrigger(){this.visibleReal=!0,this._show(this.direction)},_onTriggerHide(){this.visibleReal=!1},_show:function(b){let c=this.bind;if(!this.bind)return;let d=a.dom.isVueObject(c)?c.$el:c;let e=a.dom.getElementOffset(d),f={};f.height=d.clientHeight,f.width=d.clientWidth;let g=a.dom.getViewPort(),h=a.dom.getDocumentOffset();this.offsetTop=e.top+h.top,"top"==b?(this.directionData="top",this.offsetTop-=f.height,this.offsetTop-=8):"bottom"==b?(this.directionData="bottom",this.offsetTop+=f.height):"left"==b?(this.directionData="left",this.offsetLeft=e.left+f.width):"right"==b?(this.directionData="right",this.offsetLeft=e.left+f.width):e.top+f.height/2>g.height/2?(this.directionData="top",this.offsetTop-=f.height,this.offsetTop-=8):(this.directionData="bottom",this.offsetTop+=f.height),this.offsetTop+="px";let i="left"==b||"right"==b?parseInt(e.top+f.height/2):parseInt(e.left+f.width/2);const j=10;let k=this.$refs.main;a.dom.probeDom(200,()=>0<k.clientWidth,()=>{if("left"==b||"right"==b){let a=parseInt(i-k.clientHeight/2);a<j&&(a=j),a+k.clientHeight>g.height-j&&(a=g.height-j-k.clientHeight),this.offsetTop=a+h.top+"px",this.offsetLeft="right"==b?e.left+f.width-6:e.left-k.clientWidth-6,this.offsetLeft+=h.left,this.offsetLeft+="px",this.offsetArrowLeft=null,this.offsetArrowBottom=null,this.offsetArrowTop=i-a-6,10>this.offsetArrowTop?this.offsetArrowTop=10:this.offsetArrowTop>k.clientHeight-22&&(this.offsetArrowTop=k.clientHeight-22),this.offsetArrowTop+="px",this.offsetArrowRight=null}else{let a=parseInt(i-k.clientWidth/2);a<j&&(a=j),a+k.clientWidth>g.width-j&&(a=g.width-j-k.clientWidth),this.offsetLeft=a+"px",this.offsetArrowLeft=i-a-6,10>this.offsetArrowLeft?this.offsetArrowLeft=10:this.offsetArrowLeft>k.clientWidth-22&&(this.offsetArrowLeft=k.clientWidth-22),this.offsetArrowLeft+="px",this.offsetArrowBottom=null,this.offsetArrowTop=null,this.offsetArrowRight=null}})},_hide(){this.hide().then(()=>{})}}};var d=function(){var a=this,b=a.$createElement,c=a._self._c||b;return c("widget",{ref:"widget",staticClass:"bp-popover",attrs:{visible:a.visibleReal,maskClose:a.maskClose,mask:a.mask,pageClass:a.pageClass,pageStyle:a.pageStyle,preventEvent:!1},on:{"update:visible":function(b){a.visibleReal=b}}},[c("div",{ref:"main",staticClass:"bp-popover__main",style:{left:a.offsetLeft,top:a.offsetTop},attrs:{direction:a.directionData}},[a._t("default"),a._v(" "),c("div",{staticClass:"bp-popover__arrow",style:{left:a.offsetArrowLeft,top:a.offsetArrowTop,right:a.offsetArrowRight,bottom:a.offsetArrowBottom}})],2)])};d._withStripped=!0;const e=function(a,b,c,d,e,f,g,h,i,j){"boolean"!=typeof g&&(i=h,h=g,g=!1);const k="function"==typeof c?c.options:c;a&&a.render&&(k.render=a.render,k.staticRenderFns=a.staticRenderFns,k._compiled=!0,e&&(k.functional=!0)),d&&(k._scopeId=d);let l;if(f?(l=function(a){a=a||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,a||"undefined"==typeof __VUE_SSR_CONTEXT__||(a=__VUE_SSR_CONTEXT__),b&&b.call(this,i(a)),a&&a._registeredComponents&&a._registeredComponents.add(f)},k._ssrRegister=l):b&&(l=g?function(a){b.call(this,j(a,this.$root.$options.shadowRoot))}:function(a){b.call(this,h(a))}),l)if(k.functional){const a=k.render;k.render=function(b,c){return l.call(c),a(b,c)}}else{const a=k.beforeCreate;k.beforeCreate=a?[].concat(a,l):[l]}return c}({render:d,staticRenderFns:[]},void 0,c,void 0,!1,void 0,!1,void 0,void 0,void 0);return{bpPopover:e}});
{
"description": "popover",
"dependencies": {
"@bpui/dialog": "^0.1.5",
"@bpui/libs": "^0.2.2"
"@bpui/dialog": "^0.1.6",
"@bpui/libs": "^0.2.3"
},

@@ -38,3 +38,3 @@ "directories": {},

"name": "@bpui/popover",
"version": "0.0.8"
"version": "0.0.9"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc