UNPKG

@geoblink/design-system

Version:

Geoblink Design System for Vue.js

1 lines 13.9 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],e):"object"==typeof exports?exports["components/GeoTrimmedContent"]=e(require("lodash")):t["components/GeoTrimmedContent"]=e(t.lodash)}(window,function(t){return i={},e.m=n={107:function(t,e,n){t.exports=n("xp6Q")},"3Fcl":function(t,e,n){"use strict";var i=n("YLtl"),o=n.n(i);e.a=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10;return o.a.throttle(t,e,{leading:!0,trailing:!0})}},"3iwg":function(t,e,n){"use strict";function i(){var t=0;return function(){return t++}}n.d(e,"a",function(){return i})},"DI/g":function(t,e,n){"use strict";e.a=function(t){return t.componentInstance&&t.componentInstance.$isServer}},"H+ED":function(t,e,n){"use strict";var i=n("YLtl"),o=n.n(i),r=n("bdgK"),s=n("3Fcl"),c=n("DI/g"),a=n("3iwg"),u=Object(a.a)(),d={};e.a={bind:function(t,e,n){if(function(t){var e=o.a.get(t.value,"callback",t.value);return"function"==typeof e||(console.error("GeoOnResize [directive] :: provided callback ".concat(e," is not a function")),!1)}(e)&&!Object(c.a)(n)){t.__geoOnResizeCallbackId__=u();var i=o.a.get(e.value,"callback",e.value),a=o.a.get(e.value,"target",t),f=new r.a(Object(s.a)(function(t){i(t)}));f.observe(a),d[t.__geoOnResizeCallbackId__]=f}},unbind:function(t){d[t.__geoOnResizeCallbackId__].disconnect(),d=o.a.omit(d,t.__geoOnResizeCallbackId__)}}},"KHd+":function(t,e,n){"use strict";function i(t,e,n,i,o,r,s,c){var a,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),r&&(u._scopeId="data-v-"+r),s?(a=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=a):o&&(a=c?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(u.functional){u._injectStyles=a;var d=u.render;u.render=function(t,e){return a.call(e),d(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,a):[a]}return{exports:t,options:u}}n.d(e,"a",function(){return i})},YLtl:function(e,n){e.exports=t},bdgK:function(t,e,n){"use strict";(function(t){var n=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,i){return t[0]===e&&(n=i,!0)}),n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),i=this.__entries__[n];return i&&i[1]},e.prototype.set=function(e,n){var i=t(this.__entries__,e);~i?this.__entries__[i][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,i=t(n,e);~i&&n.splice(i,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,i=this.__entries__;n<i.length;n++){var o=i[n];t.call(e,o[1],o[0])}},e;function e(){this.__entries__=[]}}(),i="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,o=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),r="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(o):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},s=2,c=["top","right","bottom","left","width","height","size","weight"],a="undefined"!=typeof MutationObserver,u=(d.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},d.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},d.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},d.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),0<t.length},d.prototype.connect_=function(){i&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),a?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},d.prototype.disconnect_=function(){i&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},d.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;c.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},d.getInstance=function(){return this.instance_||(this.instance_=new d),this.instance_},d.instance_=null,d);function d(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,i=!1,o=0;function c(){n&&(n=!1,t()),i&&u()}function a(){r(c)}function u(){var t=Date.now();if(n){if(t-o<s)return;i=!0}else i=!(n=!0),setTimeout(a,e);o=t}return u}(this.refresh.bind(this),20)}var f=function(t,e){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];Object.defineProperty(t,o,{value:e[o],enumerable:!1,writable:!1,configurable:!0})}return t},l=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||o},h=b(0,0,0,0);function p(t){return parseFloat(t)||0}function v(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(e,n){return e+p(t["border-"+n+"-width"])},0)}var _="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof l(t).SVGGraphicsElement}:function(t){return t instanceof l(t).SVGElement&&"function"==typeof t.getBBox};function m(t){return i?_(t)?function(t){var e=t.getBBox();return b(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return h;var i=l(t).getComputedStyle(t),o=function(t){for(var e={},n=0,i=["top","right","bottom","left"];n<i.length;n++){var o=i[n],r=t["padding-"+o];e[o]=p(r)}return e}(i),r=o.left+o.right,s=o.top+o.bottom,c=p(i.width),a=p(i.height);if("border-box"===i.boxSizing&&(Math.round(c+r)!==e&&(c-=v(i,"left","right")+r),Math.round(a+s)!==n&&(a-=v(i,"top","bottom")+s)),!function(t){return t===l(t).document.documentElement}(t)){var u=Math.round(c+r)-e,d=Math.round(a+s)-n;1!==Math.abs(u)&&(c-=u),1!==Math.abs(d)&&(a-=d)}return b(o.left,o.top,c,a)}(t):h}function b(t,e,n,i){return{x:t,y:e,width:n,height:i}}var y=(g.prototype.isActive=function(){var t=m(this.target);return(this.contentRect_=t).width!==this.broadcastWidth||t.height!==this.broadcastHeight},g.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},g);function g(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=b(0,0,0,0),this.target=t}var w=function(t,e){var n=function(t){var e=t.x,n=t.y,i=t.width,o=t.height,r="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(r.prototype);return f(s,{x:e,y:n,width:i,height:o,top:n,right:e+i,bottom:o+n,left:e}),s}(e);f(this,{target:t,contentRect:n})},O=(E.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof l(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new y(t)),this.controller_.addObserver(this),this.controller_.refresh())}},E.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof l(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},E.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},E.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},E.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new w(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},E.prototype.clearActive=function(){this.activeObservations_.splice(0)},E.prototype.hasActive=function(){return 0<this.activeObservations_.length},E);function E(t,e,i){if(this.activeObservations_=[],this.observations_=new n,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=i}var T="undefined"!=typeof WeakMap?new WeakMap:new n,C=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=u.getInstance(),i=new O(e,n,this);T.set(this,i)};["observe","unobserve","disconnect"].forEach(function(t){C.prototype[t]=function(){var e;return(e=T.get(this))[t].apply(e,arguments)}});var x=void 0!==o.ResizeObserver?o.ResizeObserver:C;e.a=x}).call(this,n("yLpj"))},i4Qp:function(t,e,n){"use strict";function i(t){var e={type:String,validator:function(e){if(t.checkUndefined&&void 0===e)return!0;var n=Object.values(t.enumDictionary);if(n.includes(e))return!0;var i=n.map(function(t){return"«".concat(t,"»")}).join(", ");return console.warn("".concat(t.componentName," [component] :: Unsupported value («").concat(e,"») for «").concat(t.propertyName,"» property. Use one of ").concat(i)),!1}};return"defaultValue"in t&&(e.default=t.defaultValue),"required"in t&&(e.required=!!t.required),e}n.d(e,"a",function(){return i})},oEPP:function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return o});var i={bottom:"bottom",leading:"leading",top:"top",trailing:"trailing"},o={start:"start",end:"end",middle:"middle"}},xp6Q:function(t,e,n){"use strict";n.r(e);var i=n("i4Qp"),o=n("H+ED"),r=n("oEPP"),s={name:"GeoTrimmedContent",status:"ready",release:"10.1.0",directives:{OnResize:o.a},props:{tooltipPosition:Object(i.a)({componentName:"GeoTrimmedContent",propertyName:"tooltipPosition",enumDictionary:r.b,defaultValue:r.b.top}),tooltipAlignment:Object(i.a)({componentName:"GeoTrimmedContent",propertyName:"tooltipAlignment",enumDictionary:r.a,defaultValue:r.a.middle})},data:function(){return{isHovered:!1,contentWidthTrimmed:null,contentWidthNotTrimmed:null}},computed:{isTooltipVisible:function(){return this.isContentTrimmed&&this.isHovered},isContentTrimmed:function(){var t=this.contentWidthNotTrimmed||0;return(this.contentWidthTrimmed||0)<t}},watch:{isTooltipVisible:function(){this.reloadTooltipContent()}},mounted:function(){this.reloadRequiredWidth(),this.reloadTooltipContent()},updated:function(){this.reloadRequiredWidth(),this.reloadTooltipContent()},methods:{reloadRequiredWidth:function(){if(this.$el&&this.$refs.content){var t=this.$refs.content.style.overflow,e=this.$refs.content.style.textOverflow;this.$refs.content.style.overflow="visible",this.$refs.content.style.textOverflow="initial",this.contentWidthNotTrimmed=this.$refs.content.getBoundingClientRect().width,this.$refs.content.style.overflow=t,this.$refs.content.style.textOverflow=e,this.contentWidthTrimmed=this.$refs.content.getBoundingClientRect().width}},reloadTooltipContent:function(){this.isContentTrimmed&&this.$refs.content&&this.$refs.tooltipContent&&(this.$refs.tooltipContent.innerHTML=this.$refs.content.innerHTML)}}},c=n("KHd+"),a=Object(c.a)(s,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",{directives:[{name:"on-resize",rawName:"v-on-resize",value:t.reloadRequiredWidth,expression:"reloadRequiredWidth"}],staticClass:"geo-trimmed-content",on:{mouseenter:function(e){t.isHovered=!0},mouseleave:function(e){t.isHovered=!1}}},[n("geo-tooltip",{attrs:{visible:t.isTooltipVisible,position:t.tooltipPosition,alignment:t.tooltipAlignment}},[n("div",{ref:"tooltipContent"})]),t._v(" "),n("span",{ref:"content",staticClass:"geo-trimmed-content__content"},[t._t("default")],2)],1)},[],!1,null,null,null);e.default=a.exports},yLpj:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n}},e.c=i,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:i})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(e.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(i,o,function(e){return t[e]}.bind(null,o));return i},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=107);function e(t){if(i[t])return i[t].exports;var o=i[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n,i});