pages-componentsC-tooltip-tooltip.b61df0a1.js 25 KB

1
  1. (self["webpackChunkuview2_0_cli"]=self["webpackChunkuview2_0_cli"]||[]).push([[5125],{92863:function(t,e,o){var i=o(54422);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var n=o(56).Z;n("04301087",i,!0,{sourceMap:!1,shadowMode:!1})},35397:function(t,e,o){var i=o(91340);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var n=o(56).Z;n("522838eb",i,!0,{sourceMap:!1,shadowMode:!1})},30182:function(t,e,o){var i=o(25909);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var n=o(56).Z;n("7fd3a05e",i,!0,{sourceMap:!1,shadowMode:!1})},41262:function(t,e,o){var i=o(34999);i.__esModule&&(i=i.default),"string"===typeof i&&(i=[[t.id,i,""]]),i.locals&&(t.exports=i.locals);var n=o(56).Z;n("edb58cb4",i,!0,{sourceMap:!1,shadowMode:!1})},36083:function(t,e,o){"use strict";var i;o.d(e,{Z:function(){return d}});var n,r=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-uni-view",{staticClass:"u-line",style:[t.lineStyle]})},a=[],s=(o(9653),{props:{color:{type:String,default:uni.$u.props.line.color},length:{type:[String,Number],default:uni.$u.props.line.length},direction:{type:String,default:uni.$u.props.line.direction},hairline:{type:Boolean,default:uni.$u.props.line.hairline},margin:{type:[String,Number],default:uni.$u.props.line.margin},dashed:{type:Boolean,default:uni.$u.props.line.dashed}}}),l={name:"u-line",mixins:[uni.$u.mpMixin,uni.$u.mixin,s],computed:{lineStyle:function(){var t={};return t.margin=this.margin,"row"===this.direction?(t.borderBottomWidth="1px",t.borderBottomStyle=this.dashed?"dashed":"solid",t.width=uni.$u.addUnit(this.length),this.hairline&&(t.transform="scaleY(0.5)")):(t.borderLeftWidth="1px",t.borderLeftStyle=this.dashed?"dashed":"solid",t.height=uni.$u.addUnit(this.length),this.hairline&&(t.transform="scaleX(0.5)")),t.borderColor=this.color,uni.$u.deepMerge(t,uni.$u.addStyle(this.customStyle))}}},u=l,c=(o(92863),o(69453)),p=(0,c.Z)(u,r,a,!1,null,"09e9487a",null,!1,i,n),d=p.exports},12682:function(t,e,o){"use strict";o.d(e,{Z:function(){return d}});var i,n={uTransition:o(46800).Z},r=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("u-transition",{attrs:{show:t.show,"custom-class":"u-overlay",duration:t.duration,"custom-style":t.overlayStyle},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.clickHandler.apply(void 0,arguments)}}},[t._t("default")],2)},a=[],s=(o(9653),{props:{show:{type:Boolean,default:uni.$u.props.overlay.show},zIndex:{type:[String,Number],default:uni.$u.props.overlay.zIndex},duration:{type:[String,Number],default:uni.$u.props.overlay.duration},opacity:{type:[String,Number],default:uni.$u.props.overlay.opacity}}}),l={name:"u-overlay",mixins:[uni.$u.mpMixin,uni.$u.mixin,s],computed:{overlayStyle:function(){var t={position:"fixed",top:0,left:0,right:0,zIndex:this.zIndex,bottom:0,"background-color":"rgba(0, 0, 0, ".concat(this.opacity,")")};return uni.$u.deepMerge(t,uni.$u.addStyle(this.customStyle))}},methods:{clickHandler:function(){this.$emit("click")}}},u=l,c=(o(35397),o(69453)),p=(0,c.Z)(u,r,a,!1,null,"ed62b646",null,!1,n,i),d=p.exports},63080:function(t,o,i){"use strict";i.d(o,{Z:function(){return _}});var n,r={uOverlay:i(12682).Z,uTransition:i(46800).Z,uLine:i(36083).Z},a=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-uni-view",{staticClass:"u-tooltip",style:[t.$u.addStyle(t.customStyle)]},[o("u-overlay",{attrs:{show:t.showTooltip&&-1e4!==t.tooltipTop&&t.overlay,customStyle:"backgroundColor: rgba(0, 0, 0, 0)"},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.overlayClickHandler.apply(void 0,arguments)}}}),o("v-uni-view",{staticClass:"u-tooltip__wrapper"},[o("v-uni-text",{ref:t.textId,staticClass:"u-tooltip__wrapper__text",style:{color:t.color,backgroundColor:t.bgColor&&t.showTooltip&&-1e4!==t.tooltipTop?t.bgColor:"transparent"},attrs:{id:t.textId,userSelect:!1,selectable:!1},on:{longpress:function(e){e.stopPropagation(),arguments[0]=e=t.$handleEvent(e),t.longpressHandler.apply(void 0,arguments)}}},[t._v(t._s(t.text))]),o("u-transition",{attrs:{mode:"fade",show:t.showTooltip,duration:"300",customStyle:Object.assign({},{position:"absolute",top:t.$u.addUnit(t.tooltipTop),zIndex:t.zIndex},t.tooltipStyle)}},[o("v-uni-view",{ref:t.tooltipId,staticClass:"u-tooltip__wrapper__popup",attrs:{id:t.tooltipId}},[t.showCopy||t.buttons.length?o("v-uni-view",{staticClass:"u-tooltip__wrapper__popup__indicator",style:[t.indicatorStyle,{width:t.$u.addUnit(t.indicatorWidth),height:t.$u.addUnit(t.indicatorWidth)}],attrs:{"hover-class":"u-tooltip__wrapper__popup__indicator--hover"}}):t._e(),o("v-uni-view",{staticClass:"u-tooltip__wrapper__popup__list"},[t.showCopy?o("v-uni-view",{staticClass:"u-tooltip__wrapper__popup__list__btn",attrs:{"hover-class":"u-tooltip__wrapper__popup__list__btn--hover"},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.setClipboardData.apply(void 0,arguments)}}},[o("v-uni-text",{staticClass:"u-tooltip__wrapper__popup__list__btn__text"},[t._v("复制")])],1):t._e(),t.showCopy&&t.buttons.length>0?o("u-line",{attrs:{direction:"column",color:"#8d8e90",length:"18"}}):t._e(),t._l(t.buttons,(function(e,i){return[o("v-uni-view",{key:i+"_0",staticClass:"u-tooltip__wrapper__popup__list__btn",attrs:{"hover-class":"u-tooltip__wrapper__popup__list__btn--hover"}},[o("v-uni-text",{staticClass:"u-tooltip__wrapper__popup__list__btn__text",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.btnClickHandler(i)}}},[t._v(t._s(e))])],1),i<t.buttons.length-1?o("u-line",{key:i+"_1",attrs:{direction:"column",color:"#8d8e90",length:"18"}}):t._e()]}))],2)],1)],1)],1)],1)},s=[],l=i(66407),u=i(4587),c=(i(41539),i(9653),{props:{text:{type:[String,Number],default:uni.$u.props.tooltip.text},copyText:{type:[String,Number],default:uni.$u.props.tooltip.copyText},size:{type:[String,Number],default:uni.$u.props.tooltip.size},color:{type:String,default:uni.$u.props.tooltip.color},bgColor:{type:String,default:uni.$u.props.tooltip.bgColor},direction:{type:String,default:uni.$u.props.tooltip.direction},zIndex:{type:[String,Number],default:uni.$u.props.tooltip.zIndex},showCopy:{type:Boolean,default:uni.$u.props.tooltip.showCopy},buttons:{type:Array,default:uni.$u.props.tooltip.buttons},overlay:{type:Boolean,default:uni.$u.props.tooltip.overlay},showToast:{type:Boolean,default:uni.$u.props.tooltip.showToast}}}),p=i(44668),d=i.n(p),f={name:"u-tooltip",mixins:[uni.$u.mpMixin,uni.$u.mixin,c],data:function(){return{showTooltip:!0,textId:uni.$u.guid(),tooltipId:uni.$u.guid(),tooltipTop:-1e4,tooltipInfo:{width:0,left:0},textInfo:{width:0,left:0},indicatorStyle:{},screenGap:12,indicatorWidth:14}},watch:{propsChange:function(){this.getElRect()}},computed:{propsChange:function(){return[this.text,this.buttons]},tooltipStyle:function(){var t={transform:"translateY(".concat("top"===this.direction?"-100%":"100%",")")},e=uni.$u.sys(),o=uni.$u.getPx,i=uni.$u.addUnit;if(this.tooltipInfo.width/2>this.textInfo.left+this.textInfo.width/2-this.screenGap)this.indicatorStyle={},t.left="-".concat(i(this.textInfo.left-this.screenGap)),this.indicatorStyle.left=i(this.textInfo.width/2-o(t.left)-this.indicatorWidth/2);else if(this.tooltipInfo.width/2>e.windowWidth-this.textInfo.right+this.textInfo.width/2-this.screenGap)this.indicatorStyle={},t.right="-".concat(i(e.windowWidth-this.textInfo.right-this.screenGap)),this.indicatorStyle.right=i(this.textInfo.width/2-o(t.right)-this.indicatorWidth/2);else{var n=Math.abs(this.textInfo.width/2-this.tooltipInfo.width/2);t.left=this.textInfo.width>this.tooltipInfo.width?i(n):-i(n),this.indicatorStyle={}}return"top"===this.direction?(t.marginTop="-10px",this.indicatorStyle.bottom="-4px"):(t.marginBottom="-10px",this.indicatorStyle.top="-4px"),t}},mounted:function(){this.init()},methods:{init:function(){this.getElRect()},longpressHandler:function(){var t=this;return(0,u.Z)((0,l.Z)().mark((function e(){return(0,l.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.tooltipTop=0,t.showTooltip=!0;case 2:case"end":return e.stop()}}),e)})))()},overlayClickHandler:function(){this.showTooltip=!1},btnClickHandler:function(t){this.showTooltip=!1,this.$emit("click",this.showCopy?t+1:t)},queryRect:function(t){var e=this;return new Promise((function(o){e.$uGetRect("#".concat(t)).then((function(t){o(t)}))}))},getElRect:function(){var t=this;this.showTooltip=!0,this.tooltipTop=-1e4,uni.$u.sleep(500).then((function(){t.queryRect(t.tooltipId).then((function(e){t.tooltipInfo=e,t.showTooltip=!1})),t.queryRect(t.textId).then((function(e){t.textInfo=e}))}))},setClipboardData:function(){var t=this;this.showTooltip=!1,this.$emit("click",0);var o=window.event||e||{},i=new(d())("",{text:function(){return t.copyText||t.text}});i.on("success",(function(e){t.showToast&&uni.$u.toast("复制成功"),i.off("success"),i.off("error"),i.destroy()})),i.on("error",(function(e){t.showToast&&uni.$u.toast("复制失败"),i.off("success"),i.off("error"),i.destroy()})),i.onClick(o)}}},h=f,v=(i(30182),i(69453)),y=(0,v.Z)(h,a,s,!1,null,"475d1c0c",null,!1,r,n),_=y.exports},13491:function(t,e,o){"use strict";o.r(e),o.d(e,{default:function(){return p}});var i,n={uTooltip:o(63080).Z},r=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-uni-view",{staticClass:"u-page"},[o("v-uni-view",{staticClass:"u-demo-block"},[o("v-uni-text",{staticClass:"u-demo-block__title"},[t._v("基础使用")]),o("v-uni-view",{staticClass:"u-demo-block__content"},[o("u-tooltip",{attrs:{text:t.text1,overlay:!0}})],1)],1),o("v-uni-view",{staticClass:"u-demo-block"},[o("v-uni-text",{staticClass:"u-demo-block__title"},[t._v("下方显示")]),o("v-uni-view",{staticClass:"u-demo-block__content",staticStyle:{"padding-bottom":"30px"}},[o("u-tooltip",{attrs:{text:t.text2,direction:"bottom"}})],1)],1),o("v-uni-view",{staticClass:"u-demo-block"},[o("v-uni-text",{staticClass:"u-demo-block__title"},[t._v("扩展按钮")]),o("v-uni-view",{staticClass:"u-demo-block__content"},[o("u-tooltip",{attrs:{text:t.text3,buttons:t.buttons1},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.click.apply(void 0,arguments)}}})],1)],1),o("v-uni-view",{staticClass:"u-demo-block"},[o("v-uni-text",{staticClass:"u-demo-block__title"},[t._v("自动调整位置")]),o("v-uni-view",{staticClass:"u-demo-block__content"},[o("u-tooltip",{attrs:{text:t.text4,buttons:t.buttons2}})],1)],1),o("v-uni-view",{staticClass:"u-demo-block"},[o("v-uni-text",{staticClass:"u-demo-block__title"},[t._v("高亮选中文本背景色")]),o("v-uni-view",{staticClass:"u-demo-block__content"},[o("u-tooltip",{attrs:{text:t.text5,buttons:t.buttons3,bgColor:"#e3e4e6"}})],1)],1)],1)},a=[],s={data:function(){return{text1:"长按文本,上方提示",text2:"长按文本,下方提示",text3:"显示多个扩展按钮",text4:"自动调整气泡位置",text5:"长按文本,显示背景色",buttons1:["扩展"],buttons2:["扩展","搜索","翻译"],buttons3:["扩展","搜索","翻译"]}},onLoad:function(){},methods:{click:function(t){console.log("index",t)}}},l=s,u=(o(41262),o(69453)),c=(0,u.Z)(l,r,a,!1,null,"49f8ef94",null,!1,n,i),p=c.exports},54422:function(t,e,o){"use strict";o.r(e);var i=o(43481),n=o.n(i),r=o(2400),a=o.n(r),s=a()(n());s.push([t.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */uni-view[data-v-09e9487a], uni-scroll-view[data-v-09e9487a], uni-swiper-item[data-v-09e9487a]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.u-line[data-v-09e9487a]{vertical-align:middle}',""]),e["default"]=s},91340:function(t,e,o){"use strict";o.r(e);var i=o(43481),n=o.n(i),r=o(2400),a=o.n(r),s=a()(n());s.push([t.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */uni-view[data-v-ed62b646], uni-scroll-view[data-v-ed62b646], uni-swiper-item[data-v-ed62b646]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.u-overlay[data-v-ed62b646]{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7)}',""]),e["default"]=s},25909:function(t,e,o){"use strict";o.r(e);var i=o(43481),n=o.n(i),r=o(2400),a=o.n(r),s=a()(n());s.push([t.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */uni-view[data-v-475d1c0c], uni-scroll-view[data-v-475d1c0c], uni-swiper-item[data-v-475d1c0c]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.u-tooltip[data-v-475d1c0c]{position:relative;\ndisplay:flex;\nflex-direction:row}.u-tooltip__wrapper[data-v-475d1c0c]{\ndisplay:flex;\nflex-direction:row;justify-content:center;white-space:nowrap}.u-tooltip__wrapper__text[data-v-475d1c0c]{font-size:14px}.u-tooltip__wrapper__popup[data-v-475d1c0c]{\ndisplay:flex;\nflex-direction:row;justify-content:center}.u-tooltip__wrapper__popup__list[data-v-475d1c0c]{background-color:#060607;position:relative;flex:1;border-radius:5px;padding:0 0;\ndisplay:flex;\nflex-direction:row;align-items:center;overflow:hidden}.u-tooltip__wrapper__popup__list__btn[data-v-475d1c0c]{padding:11px 13px}.u-tooltip__wrapper__popup__list__btn--hover[data-v-475d1c0c]{background-color:#58595b}.u-tooltip__wrapper__popup__list__btn__text[data-v-475d1c0c]{line-height:12px;font-size:13px;color:#fff}.u-tooltip__wrapper__popup__indicator[data-v-475d1c0c]{position:absolute;background-color:#060607;width:14px;height:14px;bottom:-4px;-webkit-transform:rotate(45deg);transform:rotate(45deg);border-radius:2px;z-index:-1}.u-tooltip__wrapper__popup__indicator--hover[data-v-475d1c0c]{background-color:#58595b}',""]),e["default"]=s},34999:function(t,e,o){"use strict";o.r(e);var i=o(43481),n=o.n(i),r=o(2400),a=o.n(r),s=a()(n());s.push([t.id,'@charset "UTF-8";\n/**\n * 下方引入的为uView UI的集成样式文件,为scss预处理器,其中包含了一些"u-"开头的自定义变量\n * 使用的时候,请将下面的一行复制到您的uniapp项目根目录的uni.scss中即可\n * uView自定义的css类名和scss变量,均以"u-"开头,不会造成冲突,请放心使用\n */.u-demo-block__content[data-v-49f8ef94]{padding-top:10px}',""]),e["default"]=s},44668:function(t,e,o){var i,n,r,a=o(86587)["default"];o(71550),o(21703),o(96647),o(41539),o(39714),o(57658),o(47042),o(82526),o(41817),o(32165),o(78783),o(33948),o(69070),o(68304),o(30489),o(54747),function(o){"object"===a(e)?t.exports=o():(n=[],i=o,r="function"===typeof i?i.apply(e,n):i,void 0===r||(t.exports=r))}((function(){var t;return function t(e,o,i){function n(a,s){if(!o[a]){if(!e[a]){var l=void 0;if(!s&&l)return require(a,!0);if(r)return r(a,!0);var u=new Error("Cannot find module '".concat(a,"'"));throw u.code="MODULE_NOT_FOUND",u}var c=o[a]={exports:{}};e[a][0].call(c.exports,(function(t){var o=e[a][1][t];return n(o||t)}),c,c.exports,t,e,o,i)}return o[a].exports}for(var r=void 0,a=0;a<i.length;a++)n(i[a]);return n}({1:[function(t,e,o){function i(t,e){for(;t&&t.nodeType!==n;){if(t.matches(e))return t;t=t.parentNode}}var n=9;if("undefined"!==typeof Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}e.exports=i},{}],2:[function(t,e,o){function i(t,e,o,i,r){var a=n.apply(this,arguments);return t.addEventListener(o,a,r),{destroy:function(){t.removeEventListener(o,a,r)}}}function n(t,e,o,i){return function(o){o.delegateTarget=r(o.target,e),o.delegateTarget&&i.call(t,o)}}var r=t("./closest");e.exports=i},{"./closest":1}],3:[function(t,e,o){o.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},o.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||o.node(t[0]))},o.string=function(t){return"string"===typeof t||t instanceof String},o.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],4:[function(t,e,o){function i(t,e,o){if(!t&&!e&&!o)throw new Error("Missing required arguments");if(!s.string(e))throw new TypeError("Second argument must be a String");if(!s.fn(o))throw new TypeError("Third argument must be a Function");if(s.node(t))return n(t,e,o);if(s.nodeList(t))return r(t,e,o);if(s.string(t))return a(t,e,o);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function n(t,e,o){return t.addEventListener(e,o),{destroy:function(){t.removeEventListener(e,o)}}}function r(t,e,o){return Array.prototype.forEach.call(t,(function(t){t.addEventListener(e,o)})),{destroy:function(){Array.prototype.forEach.call(t,(function(t){t.removeEventListener(e,o)}))}}}function a(t,e,o){return l(document.body,t,e,o)}var s=t("./is"),l=t("delegate");e.exports=i},{"./is":3,delegate:2}],5:[function(t,e,o){function i(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var o=t.hasAttribute("readonly");o||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),o||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var i=window.getSelection(),n=document.createRange();n.selectNodeContents(t),i.removeAllRanges(),i.addRange(n),e=i.toString()}return e}e.exports=i},{}],6:[function(t,e,o){function i(){}i.prototype={on:function(t,e,o){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:o}),this},once:function(t,e,o){function i(){n.off(t,i),e.apply(o,arguments)}var n=this;return i._=e,this.on(t,i,o)},emit:function(t){var e=[].slice.call(arguments,1),o=((this.e||(this.e={}))[t]||[]).slice(),i=0,n=o.length;for(i;i<n;i++)o[i].fn.apply(o[i].ctx,e);return this},off:function(t,e){var o=this.e||(this.e={}),i=o[t],n=[];if(i&&e)for(var r=0,a=i.length;r<a;r++)i[r].fn!==e&&i[r].fn._!==e&&n.push(i[r]);return n.length?o[t]=n:delete o[t],this}},e.exports=i},{}],7:[function(e,o,i){!function(n,r){if("function"===typeof t&&t.amd)t(["module","select"],r);else if("undefined"!==typeof i)r(o,e("select"));else{var a={exports:{}};r(a,n.select),n.clipboardAction=a.exports}}(this,(function(t,e){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=o(e),r="function"===typeof Symbol&&"symbol"===a(Symbol.iterator)?function(t){return a(t)}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":a(t)},s=function(){function t(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}(),l=function(){function t(e){i(this,t),this.resolveOptions(e),this.initSelection()}return s(t,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=document.body.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top="".concat(o,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=(0,n.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(document.body.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,n.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var e=void 0;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==("undefined"===typeof t?"undefined":r(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=l}))},{select:5}],8:[function(e,o,i){!function(n,r){if("function"===typeof t&&t.amd)t(["module","./clipboard-action","tiny-emitter","good-listener"],r);else if("undefined"!==typeof i)r(o,e("./clipboard-action"),e("tiny-emitter"),e("good-listener"));else{var a={exports:{}};r(a,n.clipboardAction,n.tinyEmitter,n.goodListener),n.clipboard=a.exports}}(this,(function(t,e,o,i){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==a(e)&&"function"!==typeof e?t:e}function l(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not ".concat(a(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var o="data-clipboard-".concat(t);if(e.hasAttribute(o))return e.getAttribute(o)}var c=n(e),p=n(o),d=n(i),f=function(){function t(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}(),h=function(t){function e(t,o){r(this,e);var i=s(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return i.resolveOptions(o),i.listenClick(t),i}return l(e,t),f(e,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"===typeof t.action?t.action:this.defaultAction,this.target="function"===typeof t.target?t.target:this.defaultTarget,this.text="function"===typeof t.text?t.text:this.defaultText}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,d.default)(t,"click",(function(t){return e.onClick(t)}))}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(e),target:this.target(e),text:this.text(e),trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"===typeof t?[t]:t,o=!!document.queryCommandSupported;return e.forEach((function(t){o=o&&!!document.queryCommandSupported(t)})),o}}]),e}(p.default);t.exports=h}))},{"./clipboard-action":7,"good-listener":4,"tiny-emitter":6}]},{},[8])(8)}))}}]);