eslink-ui-plus
Version:
vue3 component library, css framework
84 lines (83 loc) • 16.5 kB
JavaScript
import{defineComponent as H,useCssVars as ae,pushScopeId as z,popScopeId as I,openBlock as T,createElementBlock as w,normalizeStyle as P,Fragment as L,renderList as V,createElementVNode as N,createTextVNode as B,toDisplayString as j,renderSlot as D,resolveComponent as se,createBlock as le,withCtx as ue}from"vue";import{ElMessage as ce}from"element-plus";var fe=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function de(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var U={exports:{}};/*!
* clipboard.js v2.0.8
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
*/(function(i,_){(function(m,f){i.exports=f()})(fe,function(){return function(){var E={134:function(a,n,e){e.d(n,{default:function(){return ie}});var s=e(279),u=e.n(s),d=e(370),b=e.n(d),h=e(817),k=e.n(h);function p(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?p=function(t){return typeof t}:p=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(r)}function v(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}function y(r,o){for(var t=0;t<o.length;t++){var l=o[t];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}function S(r,o,t){return o&&y(r.prototype,o),t&&y(r,t),r}var J=function(){function r(o){v(this,r),this.resolveOptions(o),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 l=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(l,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var t=this,l=this.createFakeElement();this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(l),this.selectedText=k()(l),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(l){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&&p(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}(),X=J;function C(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?C=function(t){return typeof t}:C=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(r)}function q(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")}function M(r,o){for(var t=0;t<o.length;t++){var l=o[t];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,l.key,l)}}function K(r,o,t){return o&&M(r.prototype,o),t&&M(r,t),r}function Q(r,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(o&&o.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),o&&F(r,o)}function F(r,o){return F=Object.setPrototypeOf||function(l,c){return l.__proto__=c,l},F(r,o)}function Z(r){var o=ne();return function(){var l=$(r),c;if(o){var g=$(this).constructor;c=Reflect.construct(l,arguments,g)}else c=l.apply(this,arguments);return ee(this,c)}}function ee(r,o){return o&&(C(o)==="object"||typeof o=="function")?o:te(r)}function te(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function ne(){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 $(r){return $=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$(r)}function R(r,o){var t="data-clipboard-".concat(r);if(!!o.hasAttribute(t))return o.getAttribute(t)}var oe=function(r){Q(t,r);var o=Z(t);function t(l,c){var g;return q(this,t),g=o.call(this),g.resolveOptions(c),g.listenClick(l),g}return K(t,[{key:"resolveOptions",value:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof c.action=="function"?c.action:this.defaultAction,this.target=typeof c.target=="function"?c.target:this.defaultTarget,this.text=typeof c.text=="function"?c.text:this.defaultText,this.container=C(c.container)==="object"?c.container:document.body}},{key:"listenClick",value:function(c){var g=this;this.listener=b()(c,"click",function(O){return g.onClick(O)})}},{key:"onClick",value:function(c){var g=c.delegateTarget||c.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new X({action:this.action(g),target:this.target(g),text:this.text(g),container:this.container,trigger:g,emitter:this})}},{key:"defaultAction",value:function(c){return R("action",c)}},{key:"defaultTarget",value:function(c){var g=R("target",c);if(g)return document.querySelector(g)}},{key:"defaultText",value:function(c){return R("text",c)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],g=typeof c=="string"?[c]:c,O=!!document.queryCommandSupported;return g.forEach(function(re){O=O&&!!document.queryCommandSupported(re)}),O}}]),t}(u()),ie=oe},828:function(a){var n=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 s(u,d){for(;u&&u.nodeType!==n;){if(typeof u.matches=="function"&&u.matches(d))return u;u=u.parentNode}}a.exports=s},438:function(a,n,e){var s=e(828);function u(h,k,p,v,y){var S=b.apply(this,arguments);return h.addEventListener(p,S,y),{destroy:function(){h.removeEventListener(p,S,y)}}}function d(h,k,p,v,y){return typeof h.addEventListener=="function"?u.apply(null,arguments):typeof p=="function"?u.bind(null,document).apply(null,arguments):(typeof h=="string"&&(h=document.querySelectorAll(h)),Array.prototype.map.call(h,function(S){return u(S,k,p,v,y)}))}function b(h,k,p,v){return function(y){y.delegateTarget=s(y.target,k),y.delegateTarget&&v.call(h,y)}}a.exports=d},879:function(a,n){n.node=function(e){return e!==void 0&&e instanceof HTMLElement&&e.nodeType===1},n.nodeList=function(e){var s=Object.prototype.toString.call(e);return e!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in e&&(e.length===0||n.node(e[0]))},n.string=function(e){return typeof e=="string"||e instanceof String},n.fn=function(e){var s=Object.prototype.toString.call(e);return s==="[object Function]"}},370:function(a,n,e){var s=e(879),u=e(438);function d(p,v,y){if(!p&&!v&&!y)throw new Error("Missing required arguments");if(!s.string(v))throw new TypeError("Second argument must be a String");if(!s.fn(y))throw new TypeError("Third argument must be a Function");if(s.node(p))return b(p,v,y);if(s.nodeList(p))return h(p,v,y);if(s.string(p))return k(p,v,y);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function b(p,v,y){return p.addEventListener(v,y),{destroy:function(){p.removeEventListener(v,y)}}}function h(p,v,y){return Array.prototype.forEach.call(p,function(S){S.addEventListener(v,y)}),{destroy:function(){Array.prototype.forEach.call(p,function(S){S.removeEventListener(v,y)})}}}function k(p,v,y){return u(document.body,p,v,y)}a.exports=d},817:function(a){function n(e){var s;if(e.nodeName==="SELECT")e.focus(),s=e.value;else if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){var u=e.hasAttribute("readonly");u||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),u||e.removeAttribute("readonly"),s=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var d=window.getSelection(),b=document.createRange();b.selectNodeContents(e),d.removeAllRanges(),d.addRange(b),s=d.toString()}return s}a.exports=n},279:function(a){function n(){}n.prototype={on:function(e,s,u){var d=this.e||(this.e={});return(d[e]||(d[e]=[])).push({fn:s,ctx:u}),this},once:function(e,s,u){var d=this;function b(){d.off(e,b),s.apply(u,arguments)}return b._=s,this.on(e,b,u)},emit:function(e){var s=[].slice.call(arguments,1),u=((this.e||(this.e={}))[e]||[]).slice(),d=0,b=u.length;for(d;d<b;d++)u[d].fn.apply(u[d].ctx,s);return this},off:function(e,s){var u=this.e||(this.e={}),d=u[e],b=[];if(d&&s)for(var h=0,k=d.length;h<k;h++)d[h].fn!==s&&d[h].fn._!==s&&b.push(d[h]);return b.length?u[e]=b:delete u[e],this}},a.exports=n,a.exports.TinyEmitter=n}},m={};function f(a){if(m[a])return m[a].exports;var n=m[a]={exports:{}};return E[a](n,n.exports,f),n.exports}return function(){f.n=function(a){var n=a&&a.__esModule?function(){return a.default}:function(){return a};return f.d(n,{a:n}),n}}(),function(){f.d=function(a,n){for(var e in n)f.o(n,e)&&!f.o(a,e)&&Object.defineProperty(a,e,{enumerable:!0,get:n[e]})}}(),function(){f.o=function(a,n){return Object.prototype.hasOwnProperty.call(a,n)}}(),f(134)}().default})})(U);var pe=de(U.exports);const ye=(i,_,E)=>{var m;let f=null;const a=document.querySelector(".copy-virtual-btn");a?f=a:(f=document.createElement("button"),f.setAttribute("class","copy-virtual-btn"),f.setAttribute("style","display: none"),(m=document.body)==null||m.appendChild(f));const n=new pe(".copy-virtual-btn");f.setAttribute("data-clipboard-text",i),n.on("success",function(e){typeof _=="function"&&_(e),n.destroy()}),n.on("error",function(e){typeof E=="function"&&E(e),n.destroy()}),f.click()},x=H({props:{styles:{type:Object,default:()=>({})},labelWidth:{type:Number,default:56},config:{type:Array,default:()=>[]},source:{type:Object,default:()=>({})},align:{type:String,default:"right"}},setup(i,{slots:_}){return{slots:_,hasSlot:(a,n)=>{const e=`${n==null?void 0:n.key}-slot-${a}`;return!!_[e]},slotName:(a,n)=>`${n==null?void 0:n.key}-slot-${a}`,copyValue:a=>{ye(a,()=>{ce.success("\u590D\u5236\u6210\u529F")})}}}}),Y=()=>{ae(i=>({"2f0e9b96-align":i.align}))},W=x.setup;x.setup=W?(i,_)=>(Y(),W(i,_)):Y,z("data-v-2f0e9b96");const he=["title"],ve=["title"],be=["onClick"],ge=["onClick"];I();function me(i,_,E,m,f,a){return T(),w("div",{class:"es-info-list",style:P(i.styles)},[(T(!0),w(L,null,V(i.config,n=>(T(),w("div",{class:"es-info-list__item",key:n.key},[N("span",{class:"es-info-list__item__label",style:P({width:`${i.labelWidth}px`}),title:n.label},[n.labelDisplay?(T(),w(L,{key:0},[B(j(n.labelDisplay(n,i.source)),1)],2112)):i.hasSlot("label",n)?D(i.$slots,i.slotName("label",n),{key:1,item:n,source:i.source}):(T(),w(L,{key:2},[B(j(n.label||""),1)],2112))],12,he),N("span",{class:"es-info-list__item__value",title:i.source&&i.source[n.key]||""},[n.valueDisplay?(T(),w("span",{key:0,onClick:e=>{var s,u;return i.copyValue((u=(s=n==null?void 0:n.valueDisplay)==null?void 0:s.call(n,n,i.source))!=null?u:"")}},j(n.valueDisplay(n,i.source)),9,be)):i.hasSlot("value",n)?D(i.$slots,i.slotName("value",n),{key:1,item:n,source:i.source}):(T(),w("span",{key:2,onClick:e=>i.copyValue(i.source&&i.source[n.key]||"")},j(i.source&&i.source[n.key]||""),9,ge))],8,ve)]))),128)),D(i.$slots,"decoration")],4)}function G(i,_){_===void 0&&(_={});var E=_.insertAt;if(!(!i||typeof document=="undefined")){var m=document.head||document.getElementsByTagName("head")[0],f=document.createElement("style");f.type="text/css",E==="top"&&m.firstChild?m.insertBefore(f,m.firstChild):m.appendChild(f),f.styleSheet?f.styleSheet.cssText=i:f.appendChild(document.createTextNode(i))}}var _e=`.es-info-list[data-v-2f0e9b96] {
display: inline-block;
line-height: 21px;
}
.es-info-list__item[data-v-2f0e9b96] {
display: flex;
}
.es-info-list__item__label[data-v-2f0e9b96], .es-info-list__item__value[data-v-2f0e9b96] {
display: inline-block;
}
.es-info-list__item__label[data-v-2f0e9b96] {
color: #7a7c90;
text-align: var(--2f0e9b96-align);
font-size: 14px;
margin-right: 20px;
}
.es-info-list__item__value[data-v-2f0e9b96] {
cursor: pointer;
text-align: left;
color: #282934;
font-size: 14px;
flex: 1;
}`;G(_e),x.render=me,x.__scopeId="data-v-2f0e9b96",x.__file="components/info-list/index.vue",x.install=i=>{i.component("es-info-list",x)};var A=H({components:{EsInfoList:x},props:{styles:{type:Object,default:()=>({})},config:{type:Array,default:()=>[]},source:{type:Array,default:()=>[]}},setup(){return{}}});z("data-v-8f068d8a");const ke={class:"es-order-list__info-list"},Ee=N("div",{class:"es-info-list__decoration"},null,-1),Se=N("div",{class:"es-order-list__line"},null,-1);I();function Te(i,_,E,m,f,a){const n=se("es-info-list");return T(),w("div",{class:"es-order-list",style:P(i.styles)},[N("div",ke,[(T(!0),w(L,null,V(i.config,(e,s)=>(T(),le(n,{styles:{position:"relative"},key:e,config:e,source:i.source[s]},{decoration:ue(()=>[Ee]),_:2},1032,["config","source"]))),128))]),Se],4)}var we=`.es-order-list[data-v-8f068d8a] {
display: inline-block;
position: relative;
}
.es-order-list__info-list[data-v-8f068d8a] {
display: flex;
flex-direction: column;
margin-left: 24px;
}
.es-order-list__line[data-v-8f068d8a] {
width: 16px;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
}
.es-order-list__line[data-v-8f068d8a]::after {
content: "";
position: absolute;
top: 16px;
bottom: 0;
margin: auto 0;
left: 50%;
margin-left: -1px;
border-left: 1px dashed #dbe2f9;
}
[data-v-8f068d8a] .es-info-list {
margin-top: 16px;
}
[data-v-8f068d8a] .es-info-list:nth-of-type(1) {
margin-top: 0;
}
[data-v-8f068d8a] .es-info-list__decoration {
position: absolute;
width: 16px;
height: 16px;
background: #eaf1ff;
border-radius: 50%;
left: -24px;
top: 3px;
z-index: 1;
}
[data-v-8f068d8a] .es-info-list__decoration::after {
position: absolute;
content: "";
width: 6px;
height: 6px;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
background: #a7baf1;
border-radius: 50%;
z-index: 2;
}`;G(we),A.render=Te,A.__scopeId="data-v-8f068d8a",A.__file="components/order-list/index.vue",A.install=i=>{i.component("es-order-list",A)};export{A as default};