next-ui3 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.full.min.js +10 -10
- package/dist/index.full.min.mjs +6 -6
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/utils/index.min.js +1 -1
- package/dist/utils/index.min.mjs +1 -1
- package/es/components/search/src/index.vue.d.ts +9 -0
- package/es/hooks/use-upload-config/index.d.ts +1 -0
- package/es/version.d.ts +1 -1
- package/lib/components/search/src/index.vue.d.ts +9 -0
- package/lib/hooks/use-upload-config/index.d.ts +1 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/locale/zh-cn.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! Next UI v1.3.
|
|
1
|
+
/*! Next UI v1.3.3 */(function(e,n){typeof exports=="object"&&typeof module!="undefined"?module.exports=n():typeof define=="function"&&define.amd?define(n):(e=typeof globalThis!="undefined"?globalThis:e||self,e.NextUILocaleZhCn=n())})(this,function(){"use strict";var e={name:"zh-cn",nt:{input:{label:"\u786E\u8BA4"}}};return e});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! Next UI v1.3.
|
|
1
|
+
/*! Next UI v1.3.3 */var a={name:"zh-cn",nt:{input:{label:"\u786E\u8BA4"}}};export{a as default};
|
package/dist/utils/index.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Next UI utils v1.3.
|
|
1
|
+
/*! Next UI utils v1.3.3 */(function(c,U){typeof exports=="object"&&typeof module!="undefined"?U(exports,require("element-plus")):typeof define=="function"&&define.amd?define(["exports","element-plus"],U):(c=typeof globalThis!="undefined"?globalThis:c||self,U(c.NextUI={},c.ElementPlus))})(this,function(c,U){"use strict";const X=(e,t)=>{try{if(e.install=n=>{for(const r of[e,...Object.values(t!=null?t:{})])r.name&&n.component(r.name,r)},t)for(const[n,r]of Object.entries(t))e[n]=r;return e}catch(n){}};function Z(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function P(e){return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function B(e){if(typeof e=="boolean"||typeof e=="number")return!1;if(Array.isArray(e)){if(e.length===0)return!0}else if(e instanceof Object&&JSON.stringify(e)==="{}")return!0;return e==null||e==="null"||e==="undefined"||e===""}function Q(){return window.top!==window}function x(e){return toString.call(e)==="[object Blob]"}function ee(e){if(e.startsWith("data:image"))return!0;const t=e.lastIndexOf("."),n=t>=0?e.slice(t+1).toLowerCase():"";return["png","jpg","jpeg","gif","bmp","webp","svg"].includes(n)}function te(e,t){for(;e;){if(e===t)return!0;e=Object.getPrototypeOf(e)}return!1}const S=(e,t)=>{const n=P(e),r=P(t);return n&&r?JSON.stringify(e)===JSON.stringify(t):!n&&!r?String(e)===String(t):!1},$=(e,t)=>{if(e=e||[],t=t||[],e.length!==t.length)return!1;for(const[n,r]of e.entries())if(!S(r,t[n]))return!1;return!0},ne=(e,t)=>Array.isArray(e)&&Array.isArray(t)?$(e,t):S(e,t);function re(e,t,n){const r={};let i;typeof n=="function"?i=n:n?i=d=>d[n]:i=d=>d,(e||[]).forEach(d=>{const h=i(d);r[h]={item:d,count:-1}}),(t||[]).forEach(d=>{const h=i(d);r[h]?r[h].count=0:r[h]={item:d,count:1}});const a=[],f=[];for(const d in r)Object.prototype.hasOwnProperty.call(r,d)&&(r[d].count===1?f.push(r[d].item):r[d].count===-1&&a.push(r[d].item));return{changed:a.length+f.length>0,removed:a.length>0,added:f.length>0,removedItems:a,addedItems:f}}const ie=(e,...t)=>{const n=[];return e.forEach(r=>{t.includes(r)||n.push(r)}),n},oe=e=>B(e)?[]:Array.isArray(e)?e:[e],ae=(e,t)=>{if(typeof t!="function"){const n=t;t=r=>String(r[n])}return(e||[]).reduce((n,r)=>{const i=t(r);return n[i]||(n[i]=[]),n[i].push(r),n},{})};function ue(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function H(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase()}function se(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase()).replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}const q=(e,t,...n)=>{const r={};return t=(t?[].concat(t):[]).concat(n),e&&t.forEach(i=>{Object.hasOwnProperty.call(e,i)&&(r[i]=e[i])}),r},ce=(e,t,...n)=>{const r={};return t=(t?[].concat(t):[]).concat(n),e&&Object.keys(e).forEach(i=>{t.includes(i)||(r[i]=e[i])}),r},le=(e,...t)=>{for(const n of t)Object.assign(e,q(n,Object.keys(e)));return e};function W(e,...t){P(e)||(e={});for(const n of t)if(P(n))for(const r in n)r==="__proto__"||e===n[r]||(P(n[r])?e[r]=W(e[r],n[r]):e[r]=n[r]);return e}const fe=e=>{const t={};if(e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(B(e[n])||(t[n]=e[n]));return t};function de(e){const t=new WeakMap,n=r=>{if(typeof r=="object"&&r!==null){if(t.has(r))return t.get(r);const i=Array.isArray(r)?[]:{};t.set(r,i);for(const a in r)Object.prototype.hasOwnProperty.call(r,a)&&(i[a]=n(r[a]));return i}return r};return n(e)}function z(e,t){try{return JSON.parse(e)}catch(n){return console.error("parse json error:",e),t}}function he(e,t,n){if(!e||!t)return;const r=t.split(".");let i;for(;(i=r.shift())!==void 0&&r.length!==0;)e[i]||(e[i]={}),e=e[i];i&&(e[i]=n)}function L(e,t){if(!e||!t)return;const n=t.split(".");for(const r of n){if(!e)return;e=e[r]}return e}const Y=(e,t)=>{for(const n in e)Object.getOwnPropertyDescriptor(t,n)?P(e[n])&&Y(e[n],t[n]):t[n]=e[n];return t},me=(e,t)=>{var n;return(n=e[t])!=null?n:e[H(t)]};function ge(e,t){let{key:n,parentKey:r}=t||{};n=n||"id",r=r||"pid";const i=(e||[]).reduce((f,d)=>(f[L(d,n)]=d,f),{}),a=[];return(e||[]).forEach(f=>{const d=i[L(f,r)];d?(d.children||(d.children=[])).push(f):a.push(f)}),a}function J(e,t){return(e||[]).filter(n=>t(n)).map(n=>{let{children:r,...i}=n;return r&&r.length>0&&(r=J(r,t)),{...i,children:r}})}function pe(e,t){const n=e?[...e]:[];for(;n.length>0;){const r=n.shift();if(t(r))return r;r.children&&r.children.length>0&&n.push(...r.children)}return null}function ye(e,t){const n={children:e||[]},r=[n];let i,a=-1;for(;r.length>0;){i=r.shift();const{children:f}=i;if(f&&f.length>0){for(const[d,h]of f.entries())if(t(h)){a=d;break}if(a!==-1)break;r.push(...f)}}return{found:a!==-1,parent:i===n?null:i,index:a}}function we(e,t){const n=(e||[]).map(r=>({node:r,parent:null}));for(;n.length>0;){const r=n.shift(),{node:i,parent:a}=r;if(t(i,a)===!1)break;i.children&&i.children.length>0&&n.push(...i.children.map(d=>({node:d,parent:i})))}}function be(e){const t=[];if(e&&e.length>0){t.push(...e);let n=0;for(;n<t.length;){const{children:r}=t[n];r&&r.length>0&&t.push(...r),n++}}return t}function Ee(e,t,n){n||(n=t);const r=i=>(i||[]).reduce((a,f)=>(f[n]=f[t]+(f.children?r(f.children):0),a+f[n]),0);r(e)}function ve(e,t){if(!e)return"";const n=new Date(e);if(n.getTime()===0)return"";t=t||"yyyy-MM-dd";let r;const i={"Y+":n.getFullYear().toString(),"y+":n.getFullYear().toString(),"M+":(n.getMonth()+1).toString(),"D+":n.getDate().toString(),"d+":n.getDate().toString(),"h+":(n.getHours()%12||12).toString(),"H+":n.getHours().toString(),"m+":n.getMinutes().toString(),"s+":n.getSeconds().toString(),a:n.getHours()<12?"am":"pm",A:n.getHours()<12?"AM":"PM"};for(const a in i)r=new RegExp(`(${a})`).exec(t),r&&(t=t.replace(r[1],r[1].length===1?i[a]:i[a].padStart(r[1].length,"0")));return t}function Oe(e,t){if(B(e))return"";let{minPrecision:n,maxPrecision:r,decimalPoint:i,thousandSeparator:a,grouping:f}=t||{};n=n!=null?n:0,r=r!=null?r:2,i=i||".",a=a!=null?a:",",f=f!=null?f:3;let[d,h]=`${e}`.split(".");return d=d.replace(new RegExp(`(?<!^-?)(?=(\\d{${f}})+$)`,"g"),a),h=(h||"").slice(0,r).padEnd(n,"0"),h&&(h=i+h),d+h}function Fe(e,t){if(t){const i=B(e[0])||e[0]===Number.NEGATIVE_INFINITY?"-\u221E":e[0],a=B(e[1])||e[1]===+Number.POSITIVE_INFINITY?"+\u221E":e[1];return`${i+(i==="-\u221E"?" < ":" \u2264 ")+t} < ${a}`}const n=B(e[0])||e[0]==="-\u221E"||e[0]==="-Infinity"?"-\u221E":e[0],r=B(e[1])||e[1]==="+\u221E"||e[1]==="Infinity"?"+\u221E":e[1];return`${n==="-\u221E"?"(":"["} ${n}, ${r} )`}function Te(e){if(e=Number(e),Number.isNaN(e))return"";const t=["B","KB","MB","GB","TB","PB"];let n=0;for(;e>=1024&&n<t.length-1;)e/=1024,n++;return e=Math.round(e*100)/100,`${e} ${t[n]}`}function Ie(e){return Number.isNaN(Number(e))?e||"":`${Number(e)}px`}const _=e=>new Promise(t=>{setTimeout(t,e)}),De=(e,t)=>new Promise((n,r)=>{(async()=>{try{const a=Date.now(),f=await e(),d=Date.now()-a;d<t&&await _(t-d),n(f)}catch(a){r(a)}})()}),Ae=()=>{const e=Date.now();return{delayTo:async n=>{const r=Date.now()-e;r<n&&await _(n-r)}}},Pe=(e,t)=>{let n;const r=()=>{if(e()){n(void 0);return}requestAnimationFrame(r)};return new Promise(i=>{n=i,t?setTimeout(r,t):requestAnimationFrame(r)})},Be=(e,t)=>Math.floor(e+Math.random()*(t-e));function Ce(e){return new Promise((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=()=>{if(r.status===200){const i=new FileReader;i.readAsDataURL(r.response),i.onload=a=>{t(a.target.result)},i.onerror=a=>n(a)}else n(new Error("Failed to load file"))},r.onerror=()=>{n(new Error("Failed to load file"))},r.send()})}function Ue(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=i=>{t(i.target.result)},r.onerror=i=>n(i)})}function Me(e){return URL.createObjectURL(e)}function Se(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsArrayBuffer(e),r.onload=i=>{t(new Blob([i.target.result]))},r.onerror=i=>n(i)})}async function Le(e){if(!e)throw new Error("url is empty");return(await fetch(e)).blob()}async function _e(e){if(!e)throw new Error("url is empty");return new Promise((t,n)=>{const r=new Image;r.onload=()=>{const i=document.createElement("canvas");i.width=r.width,i.height=r.height;const a=i.getContext("2d");a==null||a.drawImage(r,0,0,r.width,r.height),i.toBlob(f=>{f?t(f):n(new Error("transform image to blob failed"))},"image/png")},r.onerror=n,r.src=e})}function ke(e,t){if(!e)return"";if(typeof e=="string"&&(e=new URL(e)),t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.searchParams.append(n,t[n]);return e.toString()}function Re(e){return e.replace(/[<>&]/g,t=>`&#${t.charCodeAt(0)};`)}function je(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText}async function*Ne(e,t){const n=new TextDecoder("utf-8"),{original:r}=t||{};let i="";for(;;){const{value:a,done:f}=await e.read();if(f)return;i+=n.decode(a);const d=i.split(`
|
|
2
2
|
`);i=d.pop()||"";for(let h of d)if(h=h.trim(),!!h)if(r)yield h;else{if(h==="event: ping")continue;const I=h.match(/^(?:(\w*):)?(.*)$/);if(!I){console.error("[BufferedReader] parse line failed:",h);continue}const O=I[1],D=z(I[2].trim());if(!D){console.error("[BufferedReader] parse json failed:",I[2].trim());continue}yield{event:O,data:D}}}}const $e=e=>{let{url:t,filename:n}=e;if(n=n||"\u672A\u547D\u540D",t||e.blob&&(t=URL.createObjectURL(e.blob),setTimeout(()=>{URL.revokeObjectURL(t)},1e4)),!t)throw new Error("No URL provided");const r=document.createElement("a");r.href=t,r.download=n,r.click()};function He(e,t,n){let r,i,a,f,d,h,I=0,O=!1,D=!1,M=!0;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,n&&P(n)&&(O=!!n.leading,D="maxWait"in n,a=D?Math.max(+n.maxWait||0,t):a,M="trailing"in n?!!n.trailing:M);function T(p){const v=r,F=i;return r=i=void 0,I=p,f=e.apply(F,v),f}function C(p,v){return setTimeout(p,v)}function o(p){clearTimeout(p)}function l(p){return I=p,d=C(g,t),O?T(p):f}function s(p){const v=p-h,F=p-I,A=t-v;return D?Math.min(A,a-F):A}function u(p){const v=p-h,F=p-I;return h===void 0||v>=t||v<0||D&&F>=a}function g(){const p=Date.now();if(u(p))return y(p);d=C(g,s(p))}function y(p){return d=void 0,M&&r?T(p):(r=i=void 0,f)}function E(){d!==void 0&&o(d),I=0,r=h=i=d=void 0}function m(){return d===void 0?f:y(Date.now())}function b(){return d!==void 0}function w(...p){const v=Date.now(),F=u(v);if(r=p,i=this,h=v,F){if(d===void 0)return l(h);if(D)return d=C(g,t),T(h)}return d===void 0&&(d=C(g,t)),f}return w.cancel=E,w.flush=m,w.pending=b,w}function qe(e){const{el:t,msg:n}=e||{},r=n===void 0?"\u8BF7\u5B8C\u5584\u8868\u5355\u5185\u5BB9":n;if(r&&U.ElMessage.error(r),!t)return;const i=t.querySelector(".is-error");i&&i.scrollIntoView({behavior:"smooth",inline:"nearest",block:"center"})}async function We(e,t={successText:"\u590D\u5236\u6210\u529F"}){const{successText:n}=t||{};try{if(navigator.clipboard){await navigator.clipboard.writeText(e),n&&U.ElMessage.success(n);return}}catch(i){}const r=document.createElement("textarea");document.body.appendChild(r),r.style.position="fixed",r.style.clip="rect(0 0 0 0)",r.style.top="10px",r.value=e,r.select(),document.execCommand("copy",!0),document.body.removeChild(r),n&&U.ElMessage.success(n)}function ze(e,...t){if(!e)return;const n=document.createElement("a");n.addEventListener("click",r=>{r.preventDefault(),window.open(e,...t)}),n.click()}function Ye(e){if(!e)return[];const t=[`${e.slice(0,2)}0000`,`${e.slice(0,4)}00`,e.slice(0,6),e.slice(0,9),e.slice(0,12)],n=0,r=t.indexOf(e)+1;return t.slice(n,r)}class k{constructor(t){this._enumItems={};var n;if(t)if(Array.isArray(t))for(const[r,i]of t.entries())this.add((n=i.key)!=null?n:`${r}`,i);else for(const r in t){const i=t[r];this.add(r,i)}}add(t,{value:n,label:r,props:i}){if(this[t])throw new Error(`\u679A\u4E3E\u9879 ${t} \u5DF2\u5B58\u5728`);return this[t]=n,this._enumItems[n]=i?{key:t,value:n,label:r,props:i}:{key:t,value:n,label:r},this}keys(){return Object.keys(this).filter(t=>t!=="_enumItems")}*[Symbol.iterator](){for(const t of this.keys())yield this.getItem(this[t])}getItem(t){return this._enumItems[t]}getLabel(t){var n;return(n=this.getItem(t))==null?void 0:n.label}getProps(t){var n;return(n=this.getItem(t))==null?void 0:n.props}filter(t){const n=new k;for(const r of this.keys()){const i=this.getItem(this[r]);t(i,r)&&n.add(r,i)}return n}clone(){return this.filter(()=>!0)}set(t,n){const r=this.getItem(this[t]);return r&&Object.assign(r,n),this}remove(t){const n=this[t];return n!==void 0&&(delete this[t],delete this._enumItems[n]),this}forEach(t){for(const n of this.keys())t(this.getItem(this[n]),n)}}const Je=(e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)};function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V={exports:{}},R={exports:{}},G;function Ge(){return G||(G=1,function(e,t){(function(n,r){e.exports=r()})(window,function(){return function(n){var r={};function i(a){if(r[a])return r[a].exports;var f=r[a]={i:a,l:!1,exports:{}};return n[a].call(f.exports,f,f.exports,i),f.l=!0,f.exports}return i.m=n,i.c=r,i.d=function(a,f,d){i.o(a,f)||Object.defineProperty(a,f,{enumerable:!0,get:d})},i.r=function(a){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})},i.t=function(a,f){if(1&f&&(a=i(a)),8&f||4&f&&typeof a=="object"&&a&&a.__esModule)return a;var d=Object.create(null);if(i.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:a}),2&f&&typeof a!="string")for(var h in a)i.d(d,h,function(I){return a[I]}.bind(null,h));return d},i.n=function(a){var f=a&&a.__esModule?function(){return a.default}:function(){return a};return i.d(f,"a",f),f},i.o=function(a,f){return Object.prototype.hasOwnProperty.call(a,f)},i.p="",i(i.s=0)}([function(n,r,i){i.r(r);var a=window,f=/^image\//,d=/\.\w+$/,h={},I={file:null,quality:.8,convertSize:2048e3,loose:!0,redressOrientation:!0},O=function(o){return typeof o=="function"},D=function(o){return f.test(o)};function M(o){o=Object.assign({},I,o),this.options=o,this.file=o.file,this.image=null,this.ParsedOrientationInfo=null,this.init()}var T=M.prototype;for(var C in r.default=M,T.init=function(){var o=this,l=this.file,s=this.options;l&&D(l.type)?(D(s.mimeType)||(s.mimeType=l.type),h.file2Image(l,function(u){O(o.beforeCompress)&&(o.image=u,l.width=u.naturalWidth,l.height=u.naturalHeight,o.beforeCompress(l)),l.type==="image/jpeg"&&s.redressOrientation?o.getParsedOrientationInfo(function(g){o.parsedOrientationInfo=g,o.rendCanvas()}):(o.parsedOrientationInfo={rotate:0,scaleX:1,scaleY:1},o.rendCanvas())},o.error)):o.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6!")},T.rendCanvas=function(){var o=this,l=this.options,s=this.image,u=this.getExpectedEdge(),g=u.dWidth,y=u.dHeight,E=u.width,m=u.height,b=h.image2Canvas(s,g,y,o.beforeDraw.bind(o),o.afterDraw.bind(o),E,m);h.canvas2Blob(b,function(w){w&&(w.width=b.width,w.height=b.height),o.success(w)},l.quality,l.mimeType)},T.beforeCompress=function(){O(this.options.beforeCompress)&&this.options.beforeCompress(this.file)},T.getExpectedEdge=function(){var o,l=this.image,s=this.parsedOrientationInfo.rotate,u=this.options,g=l.naturalWidth,y=l.naturalHeight,E=Math.abs(s)%180==90;E&&(o=y,y=g,g=o);var m=g/y,b=Math.max(u.maxWidth,0)||1/0,w=Math.max(u.maxHeight,0)||1/0,p=Math.max(u.minWidth,0)||0,v=Math.max(u.minHeight,0)||0,F=Math.max(u.width,0)||g,A=Math.max(u.height,0)||y;b<1/0&&w<1/0?w*m>b?w=b/m:b=w*m:b<1/0?w=b/m:w<1/0&&(b=w*m),p>0&&v>0?v*m>p?v=p/m:p=v*m:p>0?v=p/m:v>0&&(p=v*m),A*m>F?A=F/m:F=A*m;var j=F=Math.floor(Math.min(Math.max(F,p),b)),N=A=Math.floor(Math.min(Math.max(A,v),w));return E&&(o=N,N=j,j=o),{dWidth:j,dHeight:N,width:F,height:A}},T.getParsedOrientationInfo=function(o){var l=this;this.getOrientation(function(s){O(o)&&o(l.parseOrientation(s))})},T.getOrientation=function(o){var l=this;h.file2ArrayBuffer(this.file,function(s){O(o)&&o(l.resetAndGetOrientation(s))})},T.resetAndGetOrientation=function(o){var l,s=new DataView(o);try{var u,g,y;if(s.getUint8(0)===255&&s.getUint8(1)===216)for(var E=s.byteLength,m=2;m+1<E;){if(s.getUint8(m)===255&&s.getUint8(m+1)===225){g=m;break}m+=1}if(g){var b=g+4,w=g+10;if(h.getStringFromCharCode(s,b,4)==="Exif"){var p=s.getUint16(w);if(((u=p===18761)||p===19789)&&s.getUint16(w+2,u)===42){var v=s.getUint32(w+4,u);v>=8&&(y=w+v)}}}if(y){var F;for(E=s.getUint16(y,u),F=0;F<E;F+=1)if(m=y+12*F+2,s.getUint16(m,u)===274){m+=8,l=s.getUint16(m,u),s.setUint16(m,1,u);break}}}catch(A){console.error(A),l=1}return l},T.parseOrientation=function(o){var l=0,s=1,u=1;switch(o){case 2:s=-1;break;case 3:l=-180;break;case 4:u=-1;break;case 5:l=90,u=-1;break;case 6:l=90;break;case 7:l=90,s=-1;break;case 8:l=-90}return{rotate:l,scaleX:s,scaleY:u}},T.beforeDraw=function(o,l){var s=this.parsedOrientationInfo,u=s.rotate,g=s.scaleX,y=s.scaleY,E=this.file,m=this.options,b="transparent",w=l.width,p=l.height;switch(E.size>m.convertSize&&m.mimeType==="image/png"&&(b="#fff",m.mimeType="image/jpeg"),o.fillStyle=b,o.fillRect(0,0,w,p),O(m.beforeDraw)&&m.beforeDraw.call(this,o,l),o.save(),u){case 90:o.translate(w,0);break;case-90:o.translate(0,p);break;case-180:o.translate(w,p)}o.rotate(u*Math.PI/180),o.scale(g,y)},T.afterDraw=function(o,l){var s=this.options;O(s.afterDraw)&&s.afterDraw.call(this,o,l)},T.error=function(o){var l=this.options;if(!O(l.error))throw new Error(o);l.error.call(this,o)},T.success=function(o){var l,s,u=this.options,g=this.file,y=this.image,E=this.getExpectedEdge(),m=y.naturalHeight,b=y.naturalWidth;if(o&&o.size)if(!u.loose&&o.size>g.size&&!(E.width>b||E.height>m))console.warn("\u5F53\u524D\u8BBE\u7F6E\u7684\u662F\u975E\u5BBD\u677E\u6A21\u5F0F\uFF0C\u538B\u7F29\u7ED3\u679C\u5927\u4E8E\u6E90\u56FE\u7247\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"),o=g;else{var w=new Date;o.lastModified=w.getTime(),o.lastModifiedDate=w,o.name=g.name,o.name&&o.type!==g.type&&(o.name=o.name.replace(d,(l=o.type,(s=D(l)?l.substr(6):"")==="jpeg"&&(s="jpg"),"."+s)))}else console.warn("\u56FE\u7247\u538B\u7F29\u51FA\u4E86\u70B9\u610F\u5916\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"),o=g;O(u.success)&&u.success.call(this,o)},h.file2DataUrl=function(o,l,s){var u=new FileReader;u.onload=function(){l(u.result)},u.onerror=function(){O(s)&&s("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01")},u.readAsDataURL(o)},h.file2ArrayBuffer=function(o,l,s){var u=new FileReader;u.onload=function(g){l(g.target.result)},u.onerror=function(){O(s)&&s("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01")},u.readAsArrayBuffer(o)},h.getStringFromCharCode=function(o,l,s){var u,g="";for(s+=l,u=l;u<s;u+=1)g+=String.fromCharCode(o.getUint8(u));return g},h.file2Image=function(o,l,s){var u=new Image,g=a.URL||a.webkitURL;if(a.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(a.navigator.userAgent)&&(u.crossOrigin="anonymous"),u.alt=o.name,u.onerror=function(){O(s)&&s("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")},g){var y=g.createObjectURL(o);u.onload=function(){l(u),g.revokeObjectURL(y)},u.src=y}else this.file2DataUrl(o,function(E){u.onload=function(){l(u)},u.src=E},s)},h.url2Image=function(o,l,s){var u=new Image;u.src=o,u.onload=function(){l(u)},u.onerror=function(){O(s)&&s("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")}},h.image2Canvas=function(o,l,s,u,g,y,E){var m=document.createElement("canvas"),b=m.getContext("2d");return m.width=y||o.naturalWidth,m.height=E||o.naturalHeight,O(u)&&u(b,m),b.save(),b.drawImage(o,0,0,l,s),b.restore(),O(g)&&g(b,m),m},h.canvas2DataUrl=function(o,l,s){return o.toDataURL(s||"image/jpeg",l)},h.dataUrl2Image=function(o,l,s){var u=new Image;u.onload=function(){l(u)},u.error=function(){O(s)&&s("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")},u.src=o},h.dataUrl2Blob=function(o,l){for(var s=o.split(",")[1],u=o.match(/^data:(.*?)(;base64)?,/)[1],g=atob(s),y=s.length,E=new Uint8Array(y),m=0;m<y;m++)E[m]=g.charCodeAt(m);return new Blob([E],{type:l||u})},h.blob2DataUrl=function(o,l,s){this.file2DataUrl(o,l,s)},h.blob2Image=function(o,l,s){this.file2Image(o,l,s)},h.canvas2Blob=function(o,l,s,u){var g=this;HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(y,E,m){var b=this.toDataURL(E,m);y(g.dataUrl2Blob(b))}}),o.toBlob(function(y){l(y)},u||"image/jpeg",s||.8)},h.upload=function(o,l,s){var u=new XMLHttpRequest,g=new FormData;g.append("file",l),u.onreadystatechange=function(){if(u.readyState!==4||u.status!==200)throw new Error(u);s&&s(u.responseText)},u.open("POST",o,!0),u.send(g)},h)h.hasOwnProperty(C)&&(M[C]=h[C])}]).default})}(R)),R.exports}(function(e){e.exports=Ge()})(V);var Ke=Ve(V.exports);const Xe=e=>{if(!e.file)throw new Error("file is required");const t=e.file.size/1024;let n=e.quality;if(n===void 0){if(t<200)return e.file;t>200&&t<=512?n=.9:t>512&&t<=1024?n=.8:t>1024&&t<=2048?n=.85:t>2048&&t<=10240?n=.8:t>10240&&t<=20480&&(n=.75)}return new Promise((r,i)=>{var a;new Ke({...e,quality:n,convertSize:(a=e.convertSize)!=null?a:1024,success:f=>{r(f)},error:f=>{i(f)}})})},K=e=>e&&e.split("?")[0].split("/").pop()||"",Ze=e=>(e=K(e),e?(e.split(".").pop()||"").toLowerCase():"");c.Enum=k,c.arrayDiff=re,c.arrayEquals=$,c.assign=le,c.buildTree=ge,c.buildUrl=ke,c.combineByField=Ee,c.compressImage=Xe,c.copyText=We,c.createStreamIterator=Ne,c.createTimer=Ae,c.debounce=He,c.decodeHTMLEntities=je,c.deepAssign=W,c.deepClone=de,c.delayWhen=Pe,c.downloadFile=$e,c.encodeHTMLEntities=Re,c.fileToBlob=Se,c.fileToDataURL=Ue,c.fileToObjectURL=Me,c.filterTree=J,c.findNode=pe,c.findParentAndIndex=ye,c.flatTree=be,c.formatBytes=Te,c.formatDate=ve,c.formatInterval=Fe,c.formatNumber=Oe,c.formatPx=Ie,c.getFileExt=Ze,c.getFilename=K,c.getProp=me,c.getProperty=L,c.getRandInt=Be,c.groupBy=ae,c.handleFormValidateError=qe,c.hasClass=Je,c.isBlob=x,c.isChildClassOf=te,c.isEmpty=B,c.isEqual=ne,c.isIframe=Q,c.isImage=ee,c.isObject=Z,c.isPlainObject=P,c.looseEqual=S,c.mergeDefaultOptions=Y,c.omit=ce,c.omitEmpty=fe,c.openPage=ze,c.parseAreaCode=Ye,c.parseJson=z,c.pick=q,c.runAtLeastTime=De,c.setProperty=he,c.sleep=_,c.toArray=oe,c.toCamelCase=se,c.toKebabCase=H,c.toUnderscore=ue,c.urlToBlob=Le,c.urlToDataURL=Ce,c.urlToPngBlob=_e,c.walkTree=we,c.withInstall=X,c.without=ie,Object.defineProperty(c,"__esModule",{value:!0})});
|
package/dist/utils/index.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! Next UI utils v1.3.
|
|
1
|
+
/*! Next UI utils v1.3.3 */import{ElMessage as U}from"element-plus";const V=(e,t)=>{try{if(e.install=n=>{for(const r of[e,...Object.values(t!=null?t:{})])r.name&&n.component(r.name,r)},t)for(const[n,r]of Object.entries(t))e[n]=r;return e}catch(n){}};function X(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")}function A(e){return typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"}function P(e){if(typeof e=="boolean"||typeof e=="number")return!1;if(Array.isArray(e)){if(e.length===0)return!0}else if(e instanceof Object&&JSON.stringify(e)==="{}")return!0;return e==null||e==="null"||e==="undefined"||e===""}function K(){return window.top!==window}function Z(e){return toString.call(e)==="[object Blob]"}function Q(e){if(e.startsWith("data:image"))return!0;const t=e.lastIndexOf("."),n=t>=0?e.slice(t+1).toLowerCase():"";return["png","jpg","jpeg","gif","bmp","webp","svg"].includes(n)}function ee(e,t){for(;e;){if(e===t)return!0;e=Object.getPrototypeOf(e)}return!1}const M=(e,t)=>{const n=A(e),r=A(t);return n&&r?JSON.stringify(e)===JSON.stringify(t):!n&&!r?String(e)===String(t):!1},j=(e,t)=>{if(e=e||[],t=t||[],e.length!==t.length)return!1;for(const[n,r]of e.entries())if(!M(r,t[n]))return!1;return!0},te=(e,t)=>Array.isArray(e)&&Array.isArray(t)?j(e,t):M(e,t);function ne(e,t,n){const r={};let i;typeof n=="function"?i=n:n?i=l=>l[n]:i=l=>l,(e||[]).forEach(l=>{const d=i(l);r[d]={item:l,count:-1}}),(t||[]).forEach(l=>{const d=i(l);r[d]?r[d].count=0:r[d]={item:l,count:1}});const s=[],f=[];for(const l in r)Object.prototype.hasOwnProperty.call(r,l)&&(r[l].count===1?f.push(r[l].item):r[l].count===-1&&s.push(r[l].item));return{changed:s.length+f.length>0,removed:s.length>0,added:f.length>0,removedItems:s,addedItems:f}}const re=(e,...t)=>{const n=[];return e.forEach(r=>{t.includes(r)||n.push(r)}),n},ie=e=>P(e)?[]:Array.isArray(e)?e:[e],oe=(e,t)=>{if(typeof t!="function"){const n=t;t=r=>String(r[n])}return(e||[]).reduce((n,r)=>{const i=t(r);return n[i]||(n[i]=[]),n[i].push(r),n},{})};function se(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function N(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([A-Z])([A-Z][a-z])/g,"$1-$2").toLowerCase()}function ae(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase()).replace(/_([a-z])/g,(t,n)=>n.toUpperCase())}const $=(e,t,...n)=>{const r={};return t=(t?[].concat(t):[]).concat(n),e&&t.forEach(i=>{Object.hasOwnProperty.call(e,i)&&(r[i]=e[i])}),r},ue=(e,t,...n)=>{const r={};return t=(t?[].concat(t):[]).concat(n),e&&Object.keys(e).forEach(i=>{t.includes(i)||(r[i]=e[i])}),r},ce=(e,...t)=>{for(const n of t)Object.assign(e,$(n,Object.keys(e)));return e};function H(e,...t){A(e)||(e={});for(const n of t)if(A(n))for(const r in n)r==="__proto__"||e===n[r]||(A(n[r])?e[r]=H(e[r],n[r]):e[r]=n[r]);return e}const fe=e=>{const t={};if(e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(P(e[n])||(t[n]=e[n]));return t};function le(e){const t=new WeakMap,n=r=>{if(typeof r=="object"&&r!==null){if(t.has(r))return t.get(r);const i=Array.isArray(r)?[]:{};t.set(r,i);for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=n(r[s]));return i}return r};return n(e)}function W(e,t){try{return JSON.parse(e)}catch(n){return console.error("parse json error:",e),t}}function de(e,t,n){if(!e||!t)return;const r=t.split(".");let i;for(;(i=r.shift())!==void 0&&r.length!==0;)e[i]||(e[i]={}),e=e[i];i&&(e[i]=n)}function _(e,t){if(!e||!t)return;const n=t.split(".");for(const r of n){if(!e)return;e=e[r]}return e}const q=(e,t)=>{for(const n in e)Object.getOwnPropertyDescriptor(t,n)?A(e[n])&&q(e[n],t[n]):t[n]=e[n];return t},he=(e,t)=>{var n;return(n=e[t])!=null?n:e[N(t)]};function ge(e,t){let{key:n,parentKey:r}=t||{};n=n||"id",r=r||"pid";const i=(e||[]).reduce((f,l)=>(f[_(l,n)]=l,f),{}),s=[];return(e||[]).forEach(f=>{const l=i[_(f,r)];l?(l.children||(l.children=[])).push(f):s.push(f)}),s}function z(e,t){return(e||[]).filter(n=>t(n)).map(n=>{let{children:r,...i}=n;return r&&r.length>0&&(r=z(r,t)),{...i,children:r}})}function pe(e,t){const n=e?[...e]:[];for(;n.length>0;){const r=n.shift();if(t(r))return r;r.children&&r.children.length>0&&n.push(...r.children)}return null}function me(e,t){const n={children:e||[]},r=[n];let i,s=-1;for(;r.length>0;){i=r.shift();const{children:f}=i;if(f&&f.length>0){for(const[l,d]of f.entries())if(t(d)){s=l;break}if(s!==-1)break;r.push(...f)}}return{found:s!==-1,parent:i===n?null:i,index:s}}function we(e,t){const n=(e||[]).map(r=>({node:r,parent:null}));for(;n.length>0;){const r=n.shift(),{node:i,parent:s}=r;if(t(i,s)===!1)break;i.children&&i.children.length>0&&n.push(...i.children.map(l=>({node:l,parent:i})))}}function ye(e){const t=[];if(e&&e.length>0){t.push(...e);let n=0;for(;n<t.length;){const{children:r}=t[n];r&&r.length>0&&t.push(...r),n++}}return t}function be(e,t,n){n||(n=t);const r=i=>(i||[]).reduce((s,f)=>(f[n]=f[t]+(f.children?r(f.children):0),s+f[n]),0);r(e)}function ve(e,t){if(!e)return"";const n=new Date(e);if(n.getTime()===0)return"";t=t||"yyyy-MM-dd";let r;const i={"Y+":n.getFullYear().toString(),"y+":n.getFullYear().toString(),"M+":(n.getMonth()+1).toString(),"D+":n.getDate().toString(),"d+":n.getDate().toString(),"h+":(n.getHours()%12||12).toString(),"H+":n.getHours().toString(),"m+":n.getMinutes().toString(),"s+":n.getSeconds().toString(),a:n.getHours()<12?"am":"pm",A:n.getHours()<12?"AM":"PM"};for(const s in i)r=new RegExp(`(${s})`).exec(t),r&&(t=t.replace(r[1],r[1].length===1?i[s]:i[s].padStart(r[1].length,"0")));return t}function Ee(e,t){if(P(e))return"";let{minPrecision:n,maxPrecision:r,decimalPoint:i,thousandSeparator:s,grouping:f}=t||{};n=n!=null?n:0,r=r!=null?r:2,i=i||".",s=s!=null?s:",",f=f!=null?f:3;let[l,d]=`${e}`.split(".");return l=l.replace(new RegExp(`(?<!^-?)(?=(\\d{${f}})+$)`,"g"),s),d=(d||"").slice(0,r).padEnd(n,"0"),d&&(d=i+d),l+d}function Fe(e,t){if(t){const i=P(e[0])||e[0]===Number.NEGATIVE_INFINITY?"-\u221E":e[0],s=P(e[1])||e[1]===+Number.POSITIVE_INFINITY?"+\u221E":e[1];return`${i+(i==="-\u221E"?" < ":" \u2264 ")+t} < ${s}`}const n=P(e[0])||e[0]==="-\u221E"||e[0]==="-Infinity"?"-\u221E":e[0],r=P(e[1])||e[1]==="+\u221E"||e[1]==="Infinity"?"+\u221E":e[1];return`${n==="-\u221E"?"(":"["} ${n}, ${r} )`}function Oe(e){if(e=Number(e),Number.isNaN(e))return"";const t=["B","KB","MB","GB","TB","PB"];let n=0;for(;e>=1024&&n<t.length-1;)e/=1024,n++;return e=Math.round(e*100)/100,`${e} ${t[n]}`}function Ie(e){return Number.isNaN(Number(e))?e||"":`${Number(e)}px`}const L=e=>new Promise(t=>{setTimeout(t,e)}),xe=(e,t)=>new Promise((n,r)=>{(async()=>{try{const s=Date.now(),f=await e(),l=Date.now()-s;l<t&&await L(t-l),n(f)}catch(s){r(s)}})()}),Te=()=>{const e=Date.now();return{delayTo:async n=>{const r=Date.now()-e;r<n&&await L(n-r)}}},De=(e,t)=>{let n;const r=()=>{if(e()){n(void 0);return}requestAnimationFrame(r)};return new Promise(i=>{n=i,t?setTimeout(r,t):requestAnimationFrame(r)})},Ae=(e,t)=>Math.floor(e+Math.random()*(t-e));function Pe(e){return new Promise((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=()=>{if(r.status===200){const i=new FileReader;i.readAsDataURL(r.response),i.onload=s=>{t(s.target.result)},i.onerror=s=>n(s)}else n(new Error("Failed to load file"))},r.onerror=()=>{n(new Error("Failed to load file"))},r.send()})}function Be(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=i=>{t(i.target.result)},r.onerror=i=>n(i)})}function Ce(e){return URL.createObjectURL(e)}function Se(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsArrayBuffer(e),r.onload=i=>{t(new Blob([i.target.result]))},r.onerror=i=>n(i)})}async function Ue(e){if(!e)throw new Error("url is empty");return(await fetch(e)).blob()}async function Me(e){if(!e)throw new Error("url is empty");return new Promise((t,n)=>{const r=new Image;r.onload=()=>{const i=document.createElement("canvas");i.width=r.width,i.height=r.height;const s=i.getContext("2d");s==null||s.drawImage(r,0,0,r.width,r.height),i.toBlob(f=>{f?t(f):n(new Error("transform image to blob failed"))},"image/png")},r.onerror=n,r.src=e})}function _e(e,t){if(!e)return"";if(typeof e=="string"&&(e=new URL(e)),t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.searchParams.append(n,t[n]);return e.toString()}function Le(e){return e.replace(/[<>&]/g,t=>`&#${t.charCodeAt(0)};`)}function ke(e){const t=document.createElement("div");return t.innerHTML=e,t.textContent||t.innerText}async function*Re(e,t){const n=new TextDecoder("utf-8"),{original:r}=t||{};let i="";for(;;){const{value:s,done:f}=await e.read();if(f)return;i+=n.decode(s);const l=i.split(`
|
|
2
2
|
`);i=l.pop()||"";for(let d of l)if(d=d.trim(),!!d)if(r)yield d;else{if(d==="event: ping")continue;const I=d.match(/^(?:(\w*):)?(.*)$/);if(!I){console.error("[BufferedReader] parse line failed:",d);continue}const E=I[1],x=W(I[2].trim());if(!x){console.error("[BufferedReader] parse json failed:",I[2].trim());continue}yield{event:E,data:x}}}}const je=e=>{let{url:t,filename:n}=e;if(n=n||"\u672A\u547D\u540D",t||e.blob&&(t=URL.createObjectURL(e.blob),setTimeout(()=>{URL.revokeObjectURL(t)},1e4)),!t)throw new Error("No URL provided");const r=document.createElement("a");r.href=t,r.download=n,r.click()};function Ne(e,t,n){let r,i,s,f,l,d,I=0,E=!1,x=!1,B=!0;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0,n&&A(n)&&(E=!!n.leading,x="maxWait"in n,s=x?Math.max(+n.maxWait||0,t):s,B="trailing"in n?!!n.trailing:B);function O(p){const v=r,F=i;return r=i=void 0,I=p,f=e.apply(F,v),f}function D(p,v){return setTimeout(p,v)}function o(p){clearTimeout(p)}function c(p){return I=p,l=D(g,t),E?O(p):f}function u(p){const v=p-d,F=p-I,T=t-v;return x?Math.min(T,s-F):T}function a(p){const v=p-d,F=p-I;return d===void 0||v>=t||v<0||x&&F>=s}function g(){const p=Date.now();if(a(p))return m(p);l=D(g,u(p))}function m(p){return l=void 0,B&&r?O(p):(r=i=void 0,f)}function b(){l!==void 0&&o(l),I=0,r=d=i=l=void 0}function h(){return l===void 0?f:m(Date.now())}function y(){return l!==void 0}function w(...p){const v=Date.now(),F=a(v);if(r=p,i=this,d=v,F){if(l===void 0)return c(d);if(x)return l=D(g,t),O(d)}return l===void 0&&(l=D(g,t)),f}return w.cancel=b,w.flush=h,w.pending=y,w}function $e(e){const{el:t,msg:n}=e||{},r=n===void 0?"\u8BF7\u5B8C\u5584\u8868\u5355\u5185\u5BB9":n;if(r&&U.error(r),!t)return;const i=t.querySelector(".is-error");i&&i.scrollIntoView({behavior:"smooth",inline:"nearest",block:"center"})}async function He(e,t={successText:"\u590D\u5236\u6210\u529F"}){const{successText:n}=t||{};try{if(navigator.clipboard){await navigator.clipboard.writeText(e),n&&U.success(n);return}}catch(i){}const r=document.createElement("textarea");document.body.appendChild(r),r.style.position="fixed",r.style.clip="rect(0 0 0 0)",r.style.top="10px",r.value=e,r.select(),document.execCommand("copy",!0),document.body.removeChild(r),n&&U.success(n)}function We(e,...t){if(!e)return;const n=document.createElement("a");n.addEventListener("click",r=>{r.preventDefault(),window.open(e,...t)}),n.click()}function qe(e){if(!e)return[];const t=[`${e.slice(0,2)}0000`,`${e.slice(0,4)}00`,e.slice(0,6),e.slice(0,9),e.slice(0,12)],n=0,r=t.indexOf(e)+1;return t.slice(n,r)}class R{constructor(t){this._enumItems={};var n;if(t)if(Array.isArray(t))for(const[r,i]of t.entries())this.add((n=i.key)!=null?n:`${r}`,i);else for(const r in t){const i=t[r];this.add(r,i)}}add(t,{value:n,label:r,props:i}){if(this[t])throw new Error(`\u679A\u4E3E\u9879 ${t} \u5DF2\u5B58\u5728`);return this[t]=n,this._enumItems[n]=i?{key:t,value:n,label:r,props:i}:{key:t,value:n,label:r},this}keys(){return Object.keys(this).filter(t=>t!=="_enumItems")}*[Symbol.iterator](){for(const t of this.keys())yield this.getItem(this[t])}getItem(t){return this._enumItems[t]}getLabel(t){var n;return(n=this.getItem(t))==null?void 0:n.label}getProps(t){var n;return(n=this.getItem(t))==null?void 0:n.props}filter(t){const n=new R;for(const r of this.keys()){const i=this.getItem(this[r]);t(i,r)&&n.add(r,i)}return n}clone(){return this.filter(()=>!0)}set(t,n){const r=this.getItem(this[t]);return r&&Object.assign(r,n),this}remove(t){const n=this[t];return n!==void 0&&(delete this[t],delete this._enumItems[n]),this}forEach(t){for(const n of this.keys())t(this.getItem(this[n]),n)}}const ze=(e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)};function Ye(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y={exports:{}},k={exports:{}},G;function Ge(){return G||(G=1,function(e,t){(function(n,r){e.exports=r()})(window,function(){return function(n){var r={};function i(s){if(r[s])return r[s].exports;var f=r[s]={i:s,l:!1,exports:{}};return n[s].call(f.exports,f,f.exports,i),f.l=!0,f.exports}return i.m=n,i.c=r,i.d=function(s,f,l){i.o(s,f)||Object.defineProperty(s,f,{enumerable:!0,get:l})},i.r=function(s){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,f){if(1&f&&(s=i(s)),8&f||4&f&&typeof s=="object"&&s&&s.__esModule)return s;var l=Object.create(null);if(i.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:s}),2&f&&typeof s!="string")for(var d in s)i.d(l,d,function(I){return s[I]}.bind(null,d));return l},i.n=function(s){var f=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(f,"a",f),f},i.o=function(s,f){return Object.prototype.hasOwnProperty.call(s,f)},i.p="",i(i.s=0)}([function(n,r,i){i.r(r);var s=window,f=/^image\//,l=/\.\w+$/,d={},I={file:null,quality:.8,convertSize:2048e3,loose:!0,redressOrientation:!0},E=function(o){return typeof o=="function"},x=function(o){return f.test(o)};function B(o){o=Object.assign({},I,o),this.options=o,this.file=o.file,this.image=null,this.ParsedOrientationInfo=null,this.init()}var O=B.prototype;for(var D in r.default=B,O.init=function(){var o=this,c=this.file,u=this.options;c&&x(c.type)?(x(u.mimeType)||(u.mimeType=c.type),d.file2Image(c,function(a){E(o.beforeCompress)&&(o.image=a,c.width=a.naturalWidth,c.height=a.naturalHeight,o.beforeCompress(c)),c.type==="image/jpeg"&&u.redressOrientation?o.getParsedOrientationInfo(function(g){o.parsedOrientationInfo=g,o.rendCanvas()}):(o.parsedOrientationInfo={rotate:0,scaleX:1,scaleY:1},o.rendCanvas())},o.error)):o.error("\u8BF7\u4E0A\u4F20\u56FE\u7247\u6587\u4EF6!")},O.rendCanvas=function(){var o=this,c=this.options,u=this.image,a=this.getExpectedEdge(),g=a.dWidth,m=a.dHeight,b=a.width,h=a.height,y=d.image2Canvas(u,g,m,o.beforeDraw.bind(o),o.afterDraw.bind(o),b,h);d.canvas2Blob(y,function(w){w&&(w.width=y.width,w.height=y.height),o.success(w)},c.quality,c.mimeType)},O.beforeCompress=function(){E(this.options.beforeCompress)&&this.options.beforeCompress(this.file)},O.getExpectedEdge=function(){var o,c=this.image,u=this.parsedOrientationInfo.rotate,a=this.options,g=c.naturalWidth,m=c.naturalHeight,b=Math.abs(u)%180==90;b&&(o=m,m=g,g=o);var h=g/m,y=Math.max(a.maxWidth,0)||1/0,w=Math.max(a.maxHeight,0)||1/0,p=Math.max(a.minWidth,0)||0,v=Math.max(a.minHeight,0)||0,F=Math.max(a.width,0)||g,T=Math.max(a.height,0)||m;y<1/0&&w<1/0?w*h>y?w=y/h:y=w*h:y<1/0?w=y/h:w<1/0&&(y=w*h),p>0&&v>0?v*h>p?v=p/h:p=v*h:p>0?v=p/h:v>0&&(p=v*h),T*h>F?T=F/h:F=T*h;var C=F=Math.floor(Math.min(Math.max(F,p),y)),S=T=Math.floor(Math.min(Math.max(T,v),w));return b&&(o=S,S=C,C=o),{dWidth:C,dHeight:S,width:F,height:T}},O.getParsedOrientationInfo=function(o){var c=this;this.getOrientation(function(u){E(o)&&o(c.parseOrientation(u))})},O.getOrientation=function(o){var c=this;d.file2ArrayBuffer(this.file,function(u){E(o)&&o(c.resetAndGetOrientation(u))})},O.resetAndGetOrientation=function(o){var c,u=new DataView(o);try{var a,g,m;if(u.getUint8(0)===255&&u.getUint8(1)===216)for(var b=u.byteLength,h=2;h+1<b;){if(u.getUint8(h)===255&&u.getUint8(h+1)===225){g=h;break}h+=1}if(g){var y=g+4,w=g+10;if(d.getStringFromCharCode(u,y,4)==="Exif"){var p=u.getUint16(w);if(((a=p===18761)||p===19789)&&u.getUint16(w+2,a)===42){var v=u.getUint32(w+4,a);v>=8&&(m=w+v)}}}if(m){var F;for(b=u.getUint16(m,a),F=0;F<b;F+=1)if(h=m+12*F+2,u.getUint16(h,a)===274){h+=8,c=u.getUint16(h,a),u.setUint16(h,1,a);break}}}catch(T){console.error(T),c=1}return c},O.parseOrientation=function(o){var c=0,u=1,a=1;switch(o){case 2:u=-1;break;case 3:c=-180;break;case 4:a=-1;break;case 5:c=90,a=-1;break;case 6:c=90;break;case 7:c=90,u=-1;break;case 8:c=-90}return{rotate:c,scaleX:u,scaleY:a}},O.beforeDraw=function(o,c){var u=this.parsedOrientationInfo,a=u.rotate,g=u.scaleX,m=u.scaleY,b=this.file,h=this.options,y="transparent",w=c.width,p=c.height;switch(b.size>h.convertSize&&h.mimeType==="image/png"&&(y="#fff",h.mimeType="image/jpeg"),o.fillStyle=y,o.fillRect(0,0,w,p),E(h.beforeDraw)&&h.beforeDraw.call(this,o,c),o.save(),a){case 90:o.translate(w,0);break;case-90:o.translate(0,p);break;case-180:o.translate(w,p)}o.rotate(a*Math.PI/180),o.scale(g,m)},O.afterDraw=function(o,c){var u=this.options;E(u.afterDraw)&&u.afterDraw.call(this,o,c)},O.error=function(o){var c=this.options;if(!E(c.error))throw new Error(o);c.error.call(this,o)},O.success=function(o){var c,u,a=this.options,g=this.file,m=this.image,b=this.getExpectedEdge(),h=m.naturalHeight,y=m.naturalWidth;if(o&&o.size)if(!a.loose&&o.size>g.size&&!(b.width>y||b.height>h))console.warn("\u5F53\u524D\u8BBE\u7F6E\u7684\u662F\u975E\u5BBD\u677E\u6A21\u5F0F\uFF0C\u538B\u7F29\u7ED3\u679C\u5927\u4E8E\u6E90\u56FE\u7247\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"),o=g;else{var w=new Date;o.lastModified=w.getTime(),o.lastModifiedDate=w,o.name=g.name,o.name&&o.type!==g.type&&(o.name=o.name.replace(l,(c=o.type,(u=x(c)?c.substr(6):"")==="jpeg"&&(u="jpg"),"."+u)))}else console.warn("\u56FE\u7247\u538B\u7F29\u51FA\u4E86\u70B9\u610F\u5916\uFF0C\u8F93\u51FA\u6E90\u56FE\u7247"),o=g;E(a.success)&&a.success.call(this,o)},d.file2DataUrl=function(o,c,u){var a=new FileReader;a.onload=function(){c(a.result)},a.onerror=function(){E(u)&&u("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01")},a.readAsDataURL(o)},d.file2ArrayBuffer=function(o,c,u){var a=new FileReader;a.onload=function(g){c(g.target.result)},a.onerror=function(){E(u)&&u("\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF01")},a.readAsArrayBuffer(o)},d.getStringFromCharCode=function(o,c,u){var a,g="";for(u+=c,a=c;a<u;a+=1)g+=String.fromCharCode(o.getUint8(a));return g},d.file2Image=function(o,c,u){var a=new Image,g=s.URL||s.webkitURL;if(s.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(s.navigator.userAgent)&&(a.crossOrigin="anonymous"),a.alt=o.name,a.onerror=function(){E(u)&&u("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")},g){var m=g.createObjectURL(o);a.onload=function(){c(a),g.revokeObjectURL(m)},a.src=m}else this.file2DataUrl(o,function(b){a.onload=function(){c(a)},a.src=b},u)},d.url2Image=function(o,c,u){var a=new Image;a.src=o,a.onload=function(){c(a)},a.onerror=function(){E(u)&&u("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")}},d.image2Canvas=function(o,c,u,a,g,m,b){var h=document.createElement("canvas"),y=h.getContext("2d");return h.width=m||o.naturalWidth,h.height=b||o.naturalHeight,E(a)&&a(y,h),y.save(),y.drawImage(o,0,0,c,u),y.restore(),E(g)&&g(y,h),h},d.canvas2DataUrl=function(o,c,u){return o.toDataURL(u||"image/jpeg",c)},d.dataUrl2Image=function(o,c,u){var a=new Image;a.onload=function(){c(a)},a.error=function(){E(u)&&u("\u56FE\u7247\u52A0\u8F7D\u9519\u8BEF\uFF01")},a.src=o},d.dataUrl2Blob=function(o,c){for(var u=o.split(",")[1],a=o.match(/^data:(.*?)(;base64)?,/)[1],g=atob(u),m=u.length,b=new Uint8Array(m),h=0;h<m;h++)b[h]=g.charCodeAt(h);return new Blob([b],{type:c||a})},d.blob2DataUrl=function(o,c,u){this.file2DataUrl(o,c,u)},d.blob2Image=function(o,c,u){this.file2Image(o,c,u)},d.canvas2Blob=function(o,c,u,a){var g=this;HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(m,b,h){var y=this.toDataURL(b,h);m(g.dataUrl2Blob(y))}}),o.toBlob(function(m){c(m)},a||"image/jpeg",u||.8)},d.upload=function(o,c,u){var a=new XMLHttpRequest,g=new FormData;g.append("file",c),a.onreadystatechange=function(){if(a.readyState!==4||a.status!==200)throw new Error(a);u&&u(a.responseText)},a.open("POST",o,!0),a.send(g)},d)d.hasOwnProperty(D)&&(B[D]=d[D])}]).default})}(k)),k.exports}(function(e){e.exports=Ge()})(Y);var Je=Ye(Y.exports);const Ve=e=>{if(!e.file)throw new Error("file is required");const t=e.file.size/1024;let n=e.quality;if(n===void 0){if(t<200)return e.file;t>200&&t<=512?n=.9:t>512&&t<=1024?n=.8:t>1024&&t<=2048?n=.85:t>2048&&t<=10240?n=.8:t>10240&&t<=20480&&(n=.75)}return new Promise((r,i)=>{var s;new Je({...e,quality:n,convertSize:(s=e.convertSize)!=null?s:1024,success:f=>{r(f)},error:f=>{i(f)}})})},J=e=>e&&e.split("?")[0].split("/").pop()||"",Xe=e=>(e=J(e),e?(e.split(".").pop()||"").toLowerCase():"");export{R as Enum,ne as arrayDiff,j as arrayEquals,ce as assign,ge as buildTree,_e as buildUrl,be as combineByField,Ve as compressImage,He as copyText,Re as createStreamIterator,Te as createTimer,Ne as debounce,ke as decodeHTMLEntities,H as deepAssign,le as deepClone,De as delayWhen,je as downloadFile,Le as encodeHTMLEntities,Se as fileToBlob,Be as fileToDataURL,Ce as fileToObjectURL,z as filterTree,pe as findNode,me as findParentAndIndex,ye as flatTree,Oe as formatBytes,ve as formatDate,Fe as formatInterval,Ee as formatNumber,Ie as formatPx,Xe as getFileExt,J as getFilename,he as getProp,_ as getProperty,Ae as getRandInt,oe as groupBy,$e as handleFormValidateError,ze as hasClass,Z as isBlob,ee as isChildClassOf,P as isEmpty,te as isEqual,K as isIframe,Q as isImage,X as isObject,A as isPlainObject,M as looseEqual,q as mergeDefaultOptions,ue as omit,fe as omitEmpty,We as openPage,qe as parseAreaCode,W as parseJson,$ as pick,xe as runAtLeastTime,de as setProperty,L as sleep,ie as toArray,ae as toCamelCase,N as toKebabCase,se as toUnderscore,Ue as urlToBlob,Pe as urlToDataURL,Me as urlToPngBlob,we as walkTree,V as withInstall,re as without};
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
modelValue?: string;
|
|
3
3
|
buttonText?: string;
|
|
4
|
+
searchIconPosition?: 'prefix' | 'suffix' | '';
|
|
5
|
+
showSearchButton?: boolean;
|
|
6
|
+
showSearchButtonIcon?: boolean;
|
|
4
7
|
};
|
|
5
8
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
6
9
|
buttonText: string;
|
|
10
|
+
showSearchButton: boolean;
|
|
11
|
+
showSearchButtonIcon: boolean;
|
|
7
12
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
13
|
search: (...args: any[]) => void;
|
|
9
14
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
10
15
|
buttonText: string;
|
|
16
|
+
showSearchButton: boolean;
|
|
17
|
+
showSearchButtonIcon: boolean;
|
|
11
18
|
}>>> & {
|
|
12
19
|
onSearch?: ((...args: any[]) => any) | undefined;
|
|
13
20
|
}, {
|
|
14
21
|
buttonText: string;
|
|
22
|
+
showSearchButton: boolean;
|
|
23
|
+
showSearchButtonIcon: boolean;
|
|
15
24
|
}>;
|
|
16
25
|
export default _default;
|
|
17
26
|
type __VLS_WithDefaults<P, D> = {
|
package/es/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.3.
|
|
1
|
+
export declare const version = "1.3.3";
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
modelValue?: string;
|
|
3
3
|
buttonText?: string;
|
|
4
|
+
searchIconPosition?: 'prefix' | 'suffix' | '';
|
|
5
|
+
showSearchButton?: boolean;
|
|
6
|
+
showSearchButtonIcon?: boolean;
|
|
4
7
|
};
|
|
5
8
|
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
6
9
|
buttonText: string;
|
|
10
|
+
showSearchButton: boolean;
|
|
11
|
+
showSearchButtonIcon: boolean;
|
|
7
12
|
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
13
|
search: (...args: any[]) => void;
|
|
9
14
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
10
15
|
buttonText: string;
|
|
16
|
+
showSearchButton: boolean;
|
|
17
|
+
showSearchButtonIcon: boolean;
|
|
11
18
|
}>>> & {
|
|
12
19
|
onSearch?: ((...args: any[]) => any) | undefined;
|
|
13
20
|
}, {
|
|
14
21
|
buttonText: string;
|
|
22
|
+
showSearchButton: boolean;
|
|
23
|
+
showSearchButtonIcon: boolean;
|
|
15
24
|
}>;
|
|
16
25
|
export default _default;
|
|
17
26
|
type __VLS_WithDefaults<P, D> = {
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.3.
|
|
1
|
+
export declare const version = "1.3.3";
|