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