UNPKG

eslink-ui-plus

Version:

vue3 component library, css framework

9 lines (8 loc) 12.9 kB
import{defineComponent as W,resolveComponent as R,openBlock as P,createBlock as N,mergeProps as Z,withCtx as j,createElementBlock as q,Fragment as ee,renderList as te,renderSlot as ne}from"vue";import{ElSelect as re,ElOption as ie}from"element-plus";const F={labelKey:"label",valueKey:"value",disabledKey:"disabled",childrenKey:"children"},oe={type:Object,default:()=>F};var ae=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},le={exports:{}};/*! * clipboard.js v2.0.8 * https://clipboardjs.com/ * * Licensed MIT © Zeno Rocha */(function(d,g){(function(E,h){d.exports=h()})(ae,function(){return function(){var m={134:function(c,a,e){e.d(a,{default:function(){return J}});var i=e(279),l=e.n(i),s=e(370),b=e.n(s),y=e(817),k=e.n(y);function f(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?f=function(t){return typeof t}:f=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(r)}function v(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function p(r,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,o.key,o)}}function S(r,n,t){return n&&p(r.prototype,n),t&&p(r,t),r}var I=function(){function r(n){v(this,r),this.resolveOptions(n),this.initSelection()}return S(r,[{key:"resolveOptions",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=t.action,this.container=t.container,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:"createFakeElement",value:function(){var t=document.documentElement.getAttribute("dir")==="rtl";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[t?"right":"left"]="-9999px";var o=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(o,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var t=this,o=this.createFakeElement();this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(o),this.selectedText=k()(o),this.copyText(),this.removeFake()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=k()(this.target),this.copyText()}},{key:"copyText",value:function(){var t;try{t=document.execCommand(this.action)}catch(o){t=!1}this.handleResult(t)}},{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.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"copy";if(this._action=t,this._action!=="copy"&&this._action!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(t!==void 0)if(t&&f(t)==="object"&&t.nodeType===1){if(this.action==="copy"&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(this.action==="cut"&&(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}else throw new Error('Invalid "target" value, use a valid Element')},get:function(){return this._target}}]),r}(),$=I;function w(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(t){return typeof t}:w=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w(r)}function B(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function L(r,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(r,o.key,o)}}function D(r,n,t){return n&&L(r.prototype,n),t&&L(r,t),r}function z(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(n&&n.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),n&&A(r,n)}function A(r,n){return A=Object.setPrototypeOf||function(o,u){return o.__proto__=u,o},A(r,n)}function U(r){var n=G();return function(){var o=O(r),u;if(n){var _=O(this).constructor;u=Reflect.construct(o,arguments,_)}else u=o.apply(this,arguments);return Y(this,u)}}function Y(r,n){return n&&(w(n)==="object"||typeof n=="function")?n:V(r)}function V(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function G(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(r){return!1}}function O(r){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},O(r)}function C(r,n){var t="data-clipboard-".concat(r);if(!!n.hasAttribute(t))return n.getAttribute(t)}var X=function(r){z(t,r);var n=U(t);function t(o,u){var _;return B(this,t),_=n.call(this),_.resolveOptions(u),_.listenClick(o),_}return D(t,[{key:"resolveOptions",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof u.action=="function"?u.action:this.defaultAction,this.target=typeof u.target=="function"?u.target:this.defaultTarget,this.text=typeof u.text=="function"?u.text:this.defaultText,this.container=w(u.container)==="object"?u.container:document.body}},{key:"listenClick",value:function(u){var _=this;this.listener=b()(u,"click",function(x){return _.onClick(x)})}},{key:"onClick",value:function(u){var _=u.delegateTarget||u.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new $({action:this.action(_),target:this.target(_),text:this.text(_),container:this.container,trigger:_,emitter:this})}},{key:"defaultAction",value:function(u){return C("action",u)}},{key:"defaultTarget",value:function(u){var _=C("target",u);if(_)return document.querySelector(_)}},{key:"defaultText",value:function(u){return C("text",u)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],_=typeof u=="string"?[u]:u,x=!!document.queryCommandSupported;return _.forEach(function(Q){x=x&&!!document.queryCommandSupported(Q)}),x}}]),t}(l()),J=X},828:function(c){var a=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var e=Element.prototype;e.matches=e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector}function i(l,s){for(;l&&l.nodeType!==a;){if(typeof l.matches=="function"&&l.matches(s))return l;l=l.parentNode}}c.exports=i},438:function(c,a,e){var i=e(828);function l(y,k,f,v,p){var S=b.apply(this,arguments);return y.addEventListener(f,S,p),{destroy:function(){y.removeEventListener(f,S,p)}}}function s(y,k,f,v,p){return typeof y.addEventListener=="function"?l.apply(null,arguments):typeof f=="function"?l.bind(null,document).apply(null,arguments):(typeof y=="string"&&(y=document.querySelectorAll(y)),Array.prototype.map.call(y,function(S){return l(S,k,f,v,p)}))}function b(y,k,f,v){return function(p){p.delegateTarget=i(p.target,k),p.delegateTarget&&v.call(y,p)}}c.exports=s},879:function(c,a){a.node=function(e){return e!==void 0&&e instanceof HTMLElement&&e.nodeType===1},a.nodeList=function(e){var i=Object.prototype.toString.call(e);return e!==void 0&&(i==="[object NodeList]"||i==="[object HTMLCollection]")&&"length"in e&&(e.length===0||a.node(e[0]))},a.string=function(e){return typeof e=="string"||e instanceof String},a.fn=function(e){var i=Object.prototype.toString.call(e);return i==="[object Function]"}},370:function(c,a,e){var i=e(879),l=e(438);function s(f,v,p){if(!f&&!v&&!p)throw new Error("Missing required arguments");if(!i.string(v))throw new TypeError("Second argument must be a String");if(!i.fn(p))throw new TypeError("Third argument must be a Function");if(i.node(f))return b(f,v,p);if(i.nodeList(f))return y(f,v,p);if(i.string(f))return k(f,v,p);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function b(f,v,p){return f.addEventListener(v,p),{destroy:function(){f.removeEventListener(v,p)}}}function y(f,v,p){return Array.prototype.forEach.call(f,function(S){S.addEventListener(v,p)}),{destroy:function(){Array.prototype.forEach.call(f,function(S){S.removeEventListener(v,p)})}}}function k(f,v,p){return l(document.body,f,v,p)}c.exports=s},817:function(c){function a(e){var i;if(e.nodeName==="SELECT")e.focus(),i=e.value;else if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){var l=e.hasAttribute("readonly");l||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),l||e.removeAttribute("readonly"),i=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var s=window.getSelection(),b=document.createRange();b.selectNodeContents(e),s.removeAllRanges(),s.addRange(b),i=s.toString()}return i}c.exports=a},279:function(c){function a(){}a.prototype={on:function(e,i,l){var s=this.e||(this.e={});return(s[e]||(s[e]=[])).push({fn:i,ctx:l}),this},once:function(e,i,l){var s=this;function b(){s.off(e,b),i.apply(l,arguments)}return b._=i,this.on(e,b,l)},emit:function(e){var i=[].slice.call(arguments,1),l=((this.e||(this.e={}))[e]||[]).slice(),s=0,b=l.length;for(s;s<b;s++)l[s].fn.apply(l[s].ctx,i);return this},off:function(e,i){var l=this.e||(this.e={}),s=l[e],b=[];if(s&&i)for(var y=0,k=s.length;y<k;y++)s[y].fn!==i&&s[y].fn._!==i&&b.push(s[y]);return b.length?l[e]=b:delete l[e],this}},c.exports=a,c.exports.TinyEmitter=a}},E={};function h(c){if(E[c])return E[c].exports;var a=E[c]={exports:{}};return m[c](a,a.exports,h),a.exports}return function(){h.n=function(c){var a=c&&c.__esModule?function(){return c.default}:function(){return c};return h.d(a,{a}),a}}(),function(){h.d=function(c,a){for(var e in a)h.o(a,e)&&!h.o(c,e)&&Object.defineProperty(c,e,{enumerable:!0,get:a[e]})}}(),function(){h.o=function(c,a){return Object.prototype.hasOwnProperty.call(c,a)}}(),h(134)}().default})})(le);var ue=Object.defineProperty,K=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,M=(d,g,m)=>g in d?ue(d,g,{enumerable:!0,configurable:!0,writable:!0,value:m}):d[g]=m,H=(d,g)=>{for(var m in g||(g={}))ce.call(g,m)&&M(d,m,g[m]);if(K)for(var m of K(g))se.call(g,m)&&M(d,m,g[m]);return d},T=W({props:{keyConfig:oe,source:{type:Array,default:()=>[]}},components:{ElSelect:re,ElOption:ie},setup(d,g){var m;const{valueKey:E,labelKey:h,disabledKey:c}=H(H({},F),(m=d==null?void 0:d.keyConfig)!=null?m:{});return{valueKey:E,labelKey:h,disabledKey:c}}});function fe(d,g,m,E,h,c){const a=R("el-option"),e=R("el-select");return P(),N(e,Z(d.$attrs,{class:"es-form-select"}),{default:j(()=>[(P(!0),q(ee,null,te(d.source,i=>(P(),N(a,{key:i[d.valueKey],label:i[d.labelKey],value:i[d.valueKey],disabled:i[d.disabledKey]},{default:j(()=>[ne(d.$slots,"default")]),_:2},1032,["label","value","disabled"]))),128))]),_:3},16)}function de(d,g){g===void 0&&(g={});var m=g.insertAt;if(!(!d||typeof document=="undefined")){var E=document.head||document.getElementsByTagName("head")[0],h=document.createElement("style");h.type="text/css",m==="top"&&E.firstChild?E.insertBefore(h,E.firstChild):E.appendChild(h),h.styleSheet?h.styleSheet.cssText=d:h.appendChild(document.createTextNode(d))}}var pe=`.es-form-select[data-v-72f0de86] { display: inline-block; }`;de(pe),T.render=fe,T.__scopeId="data-v-72f0de86",T.__file="components/form-select/index.vue",T.install=d=>{d.component("es-form-select",T)};export{T as default};