UNPKG

eslink-ui-plus

Version:

vue3 component library, css framework

65 lines (64 loc) 14.4 kB
(function(p,T){typeof exports=="object"&&typeof module!="undefined"?module.exports=T(require("vue")):typeof define=="function"&&define.amd?define(["vue"],T):(p=typeof globalThis!="undefined"?globalThis:p||self,p["es-process-line"]=T(p.Vue))})(this,function(p){"use strict";const T={labelKey:"label",valueKey:"value",disabledKey:"disabled",childrenKey:"children"},M={type:Object,default:()=>T};var H=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},I={exports:{}};/*! * clipboard.js v2.0.8 * https://clipboardjs.com/ * * Licensed MIT © Zeno Rocha */(function(h,v){(function(k,g){h.exports=g()})(H,function(){return function(){var b={134:function(c,o,e){e.d(o,{default:function(){return oe}});var a=e(279),s=e.n(a),u=e(370),_=e.n(u),y=e(817),x=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 m(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function d(r,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function S(r,n,t){return n&&d(r.prototype,n),t&&d(r,t),r}var q=function(){function r(n){m(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 i=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(i,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var t=this,i=this.createFakeElement();this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(i),this.selectedText=x()(i),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=x()(this.target),this.copyText()}},{key:"copyText",value:function(){var t;try{t=document.execCommand(this.action)}catch(i){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}(),J=q;function O(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(t){return typeof t}:O=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(r)}function Q(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}function F(r,n){for(var t=0;t<n.length;t++){var i=n[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function W(r,n,t){return n&&F(r.prototype,n),t&&F(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&&P(r,n)}function P(r,n){return P=Object.setPrototypeOf||function(i,l){return i.__proto__=l,i},P(r,n)}function ee(r){var n=re();return function(){var i=C(r),l;if(n){var E=C(this).constructor;l=Reflect.construct(i,arguments,E)}else l=i.apply(this,arguments);return te(this,l)}}function te(r,n){return n&&(O(n)==="object"||typeof n=="function")?n:ne(r)}function ne(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function re(){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 C(r){return C=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},C(r)}function N(r,n){var t="data-clipboard-".concat(r);if(!!n.hasAttribute(t))return n.getAttribute(t)}var ie=function(r){Z(t,r);var n=ee(t);function t(i,l){var E;return Q(this,t),E=n.call(this),E.resolveOptions(l),E.listenClick(i),E}return W(t,[{key:"resolveOptions",value:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof l.action=="function"?l.action:this.defaultAction,this.target=typeof l.target=="function"?l.target:this.defaultTarget,this.text=typeof l.text=="function"?l.text:this.defaultText,this.container=O(l.container)==="object"?l.container:document.body}},{key:"listenClick",value:function(l){var E=this;this.listener=_()(l,"click",function(A){return E.onClick(A)})}},{key:"onClick",value:function(l){var E=l.delegateTarget||l.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new J({action:this.action(E),target:this.target(E),text:this.text(E),container:this.container,trigger:E,emitter:this})}},{key:"defaultAction",value:function(l){return N("action",l)}},{key:"defaultTarget",value:function(l){var E=N("target",l);if(E)return document.querySelector(E)}},{key:"defaultText",value:function(l){return N("text",l)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],E=typeof l=="string"?[l]:l,A=!!document.queryCommandSupported;return E.forEach(function(ae){A=A&&!!document.queryCommandSupported(ae)}),A}}]),t}(s()),oe=ie},828:function(c){var o=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 a(s,u){for(;s&&s.nodeType!==o;){if(typeof s.matches=="function"&&s.matches(u))return s;s=s.parentNode}}c.exports=a},438:function(c,o,e){var a=e(828);function s(y,x,f,m,d){var S=_.apply(this,arguments);return y.addEventListener(f,S,d),{destroy:function(){y.removeEventListener(f,S,d)}}}function u(y,x,f,m,d){return typeof y.addEventListener=="function"?s.apply(null,arguments):typeof f=="function"?s.bind(null,document).apply(null,arguments):(typeof y=="string"&&(y=document.querySelectorAll(y)),Array.prototype.map.call(y,function(S){return s(S,x,f,m,d)}))}function _(y,x,f,m){return function(d){d.delegateTarget=a(d.target,x),d.delegateTarget&&m.call(y,d)}}c.exports=u},879:function(c,o){o.node=function(e){return e!==void 0&&e instanceof HTMLElement&&e.nodeType===1},o.nodeList=function(e){var a=Object.prototype.toString.call(e);return e!==void 0&&(a==="[object NodeList]"||a==="[object HTMLCollection]")&&"length"in e&&(e.length===0||o.node(e[0]))},o.string=function(e){return typeof e=="string"||e instanceof String},o.fn=function(e){var a=Object.prototype.toString.call(e);return a==="[object Function]"}},370:function(c,o,e){var a=e(879),s=e(438);function u(f,m,d){if(!f&&!m&&!d)throw new Error("Missing required arguments");if(!a.string(m))throw new TypeError("Second argument must be a String");if(!a.fn(d))throw new TypeError("Third argument must be a Function");if(a.node(f))return _(f,m,d);if(a.nodeList(f))return y(f,m,d);if(a.string(f))return x(f,m,d);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function _(f,m,d){return f.addEventListener(m,d),{destroy:function(){f.removeEventListener(m,d)}}}function y(f,m,d){return Array.prototype.forEach.call(f,function(S){S.addEventListener(m,d)}),{destroy:function(){Array.prototype.forEach.call(f,function(S){S.removeEventListener(m,d)})}}}function x(f,m,d){return s(document.body,f,m,d)}c.exports=u},817:function(c){function o(e){var a;if(e.nodeName==="SELECT")e.focus(),a=e.value;else if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){var s=e.hasAttribute("readonly");s||e.setAttribute("readonly",""),e.select(),e.setSelectionRange(0,e.value.length),s||e.removeAttribute("readonly"),a=e.value}else{e.hasAttribute("contenteditable")&&e.focus();var u=window.getSelection(),_=document.createRange();_.selectNodeContents(e),u.removeAllRanges(),u.addRange(_),a=u.toString()}return a}c.exports=o},279:function(c){function o(){}o.prototype={on:function(e,a,s){var u=this.e||(this.e={});return(u[e]||(u[e]=[])).push({fn:a,ctx:s}),this},once:function(e,a,s){var u=this;function _(){u.off(e,_),a.apply(s,arguments)}return _._=a,this.on(e,_,s)},emit:function(e){var a=[].slice.call(arguments,1),s=((this.e||(this.e={}))[e]||[]).slice(),u=0,_=s.length;for(u;u<_;u++)s[u].fn.apply(s[u].ctx,a);return this},off:function(e,a){var s=this.e||(this.e={}),u=s[e],_=[];if(u&&a)for(var y=0,x=u.length;y<x;y++)u[y].fn!==a&&u[y].fn._!==a&&_.push(u[y]);return _.length?s[e]=_:delete s[e],this}},c.exports=o,c.exports.TinyEmitter=o}},k={};function g(c){if(k[c])return k[c].exports;var o=k[c]={exports:{}};return b[c](o,o.exports,g),o.exports}return function(){g.n=function(c){var o=c&&c.__esModule?function(){return c.default}:function(){return c};return g.d(o,{a:o}),o}}(),function(){g.d=function(c,o){for(var e in o)g.o(o,e)&&!g.o(c,e)&&Object.defineProperty(c,e,{enumerable:!0,get:o[e]})}}(),function(){g.o=function(c,o){return Object.prototype.hasOwnProperty.call(c,o)}}(),g(134)}().default})})(I);var K=Object.defineProperty,L=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,j=(h,v,b)=>v in h?K(h,v,{enumerable:!0,configurable:!0,writable:!0,value:b}):h[v]=b,R=(h,v)=>{for(var b in v||(v={}))z.call(v,b)&&j(h,b,v[b]);if(L)for(var b of L(v))B.call(v,b)&&j(h,b,v[b]);return h},w=p.defineComponent({props:{styles:{type:Object,default:()=>({})},source:Array,keyConfig:M},setup(h){const{labelKey:v,valueKey:b}=R(R({},T),h.keyConfig);return{labelKey:v,valueKey:b}}});p.pushScopeId("data-v-686e0b10");const D={class:"es-process-line__item__label"},V={class:"es-process-line__item__value"},$=p.createElementVNode("div",{class:"es-process-line__item__decoration"},null,-1),U=p.createElementVNode("div",{class:"es-process-line__item__line"},null,-1);p.popScopeId();function Y(h,v,b,k,g,c){return p.openBlock(),p.createElementBlock("div",{class:"es-process-line",style:p.normalizeStyle(h.styles)},[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(h.source,(o,e)=>(p.openBlock(),p.createElementBlock("div",{class:"es-process-line__item",key:e},[p.renderSlot(h.$slots,"label",{item:o},()=>[p.createElementVNode("div",D,p.toDisplayString(o[h.labelKey]),1)]),p.renderSlot(h.$slots,"value",{item:o},()=>[p.createElementVNode("div",V,p.toDisplayString(o[h.valueKey]),1)]),$,U]))),128))],4)}function G(h,v){v===void 0&&(v={});var b=v.insertAt;if(!(!h||typeof document=="undefined")){var k=document.head||document.getElementsByTagName("head")[0],g=document.createElement("style");g.type="text/css",b==="top"&&k.firstChild?k.insertBefore(g,k.firstChild):k.appendChild(g),g.styleSheet?g.styleSheet.cssText=h:g.appendChild(document.createTextNode(h))}}var X=`.es-process-line[data-v-686e0b10] { display: flex; flex-direction: column; } .es-process-line__item[data-v-686e0b10] { flex: 1; font-size: 14px; line-height: 21px; position: relative; margin-left: 24px; } .es-process-line__item__label[data-v-686e0b10] { color: #7a7c90; } .es-process-line__item__value[data-v-686e0b10] { color: #282934; } .es-process-line__item__decoration[data-v-686e0b10] { position: absolute; width: 16px; height: 16px; background: #eaf1ff; border-radius: 50%; left: -24px; top: 0; z-index: 1; } .es-process-line__item__decoration[data-v-686e0b10]::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; } .es-process-line__item__line[data-v-686e0b10] { width: 16px; position: absolute; top: 0; bottom: 0; left: -23px; margin: auto 0; } .es-process-line__item__line[data-v-686e0b10]::after { content: ""; position: absolute; top: 16px; bottom: 0; margin: auto 0; left: 50%; margin-left: -1px; border-left: 1px dashed #dbe2f9; }`;return G(X),w.render=Y,w.__scopeId="data-v-686e0b10",w.__file="components/process-line/index.vue",w.install=h=>{h.component("es-process-line",w)},w});