@gx-design-vue/pro-utils 0.2.0-beta.6 → 0.2.0-beta.61

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.
@@ -0,0 +1,2 @@
1
+ (function(u,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],d):(u=typeof globalThis<"u"?globalThis:u||self,d(u.PorUtils={},u.vue))})(this,function(u,d){"use strict";class he{constructor(){this._keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}_utf8_encode(t){t=t.replace(/\r\n/g,`
2
+ `);let n="";for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);i<128?n+=String.fromCharCode(i):i>127&&i<2048?(n+=String.fromCharCode(i>>6|192),n+=String.fromCharCode(i&63|128)):(n+=String.fromCharCode(i>>12|224),n+=String.fromCharCode(i>>6&63|128),n+=String.fromCharCode(i&63|128))}return n}_utf8_decode(t){let n="",r=0,i=0,o=0,c=0;for(;r<t.length;)i=t.charCodeAt(r),i<128?(n+=String.fromCharCode(i),r++):i>191&&i<224?(o=t.charCodeAt(r+1),n+=String.fromCharCode((i&31)<<6|o&63),r+=2):(o=t.charCodeAt(r+1),c=t.charCodeAt(r+2),n+=String.fromCharCode((i&15)<<12|(o&63)<<6|c&63),r+=3);return n}encode(t){let n="",r,i,o,c,f,l,a,s=0;for(t=this._utf8_encode(t);s<t.length;)r=t.charCodeAt(s++),i=t.charCodeAt(s++),o=t.charCodeAt(s++),c=r>>2,f=(r&3)<<4|i>>4,l=(i&15)<<2|o>>6,a=o&63,Number.isNaN(i)?l=a=64:Number.isNaN(o)&&(a=64),n=n+this._keyStr.charAt(c)+this._keyStr.charAt(f)+this._keyStr.charAt(l)+this._keyStr.charAt(a);return n}decode(t){let n="",r,i,o,c,f,l,a,s=0;for(t=t.replace(/[^A-Z0-9+/=]/gi,"");s<t.length;)c=this._keyStr.indexOf(t.charAt(s++)),f=this._keyStr.indexOf(t.charAt(s++)),l=this._keyStr.indexOf(t.charAt(s++)),a=this._keyStr.indexOf(t.charAt(s++)),r=c<<2|f>>4,i=(f&15)<<4|l>>2,o=(l&3)<<6|a,n=n+String.fromCharCode(r),l!==64&&(n=n+String.fromCharCode(i)),a!==64&&(n=n+String.fromCharCode(o));return n=this._utf8_decode(n),n}}function _(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function m(e){return typeof e=="boolean"}function y(e){return typeof e=="number"}function h(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function g(e){return e!==null&&_(e,"Object")}function W(e){return typeof e=="string"||e instanceof String}function ye(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function ge(e){if(typeof e!="string")return!1;try{const t=JSON.parse(e);return typeof t=="object"&&t!==null}catch{return!1}}function me(){const e=navigator.userAgent||navigator.vendor;return!!(/iPhone/.test(e)||/Android/.test(e)&&/Mobile/.test(e)||/Windows Phone/.test(e)||/Mobile/.test(e)&&!z())}function z(){const e=navigator.userAgent||navigator.vendor;return!!(/iPad/.test(e)||/Macintosh/.test(e)&&"ontouchend"in document||/Android/.test(e)&&!/Mobile/.test(e))}function q(...e){const t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r){if(W(r))t.push(r);else if(h(r))for(let i=0;i<r.length;i++){const o=q(r[i]);o&&t.push(o)}else if(g(r))for(const i in r)r[i]&&t.push(i)}}return t.filter(n=>n).join(" ")}function B(e,t){if(typeof t!="string"&&!Array.isArray(t))return;const n=Array.isArray(t)?t:t.split(":");let r=e;for(let i=0;i<n.length;i++)if(r&&Object.prototype.hasOwnProperty.call(r,n[i]))r=r[n[i]];else return;return r}const S=typeof window>"u";function we(e){return e.replace(/[-_](.)/g,(t,n)=>n.toUpperCase())}const U=function(e,t){var n;if(S||!e||!t)return"";t=we(t),t==="float"&&(t="cssFloat");try{const r=e.style[t];if(r)return r;const i=(n=document==null?void 0:document.defaultView)==null?void 0:n.getComputedStyle(e,"");return i?i[t]:""}catch{return e.style[t]}},x=(e,t)=>S?void 0:(t==null?U(e,"overflow"):t?U(e,"overflow-y"):U(e,"overflow-x")).match(/(scroll|auto|overlay)/),pe=(e,t)=>{if(S)return;let n=e;for(;n;){if([window,document,document.documentElement].includes(n))return window;if(x(n,t))return n;n=n.parentNode}return n},Se=(e,t)=>{if(S||!e||!t)return!1;const n=e.getBoundingClientRect();let r;return[window,document,document.documentElement,null,void 0].includes(t)?r={top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:r=t.getBoundingClientRect(),n.top<r.bottom&&n.bottom>r.top&&n.right>r.left&&n.left<r.right};function P(e){return e!=null&&e===e.window}function H(e,t){var i;if(typeof window>"u")return 0;const n=t?"scrollTop":"scrollLeft";let r=0;return P(e)?r=e[t?"pageYOffset":"pageXOffset"]:e instanceof Document?r=e.documentElement[n]:e&&(r=e[n]),e&&!P(e)&&typeof r!="number"&&(r=(i=(e.ownerDocument||e).documentElement)==null?void 0:i[n]),r}let J=e=>setTimeout(e,16),Z=e=>clearTimeout(e);typeof window<"u"&&"requestAnimationFrame"in window&&(J=e=>window.requestAnimationFrame(e),Z=e=>window.cancelAnimationFrame(e));let X=0;const F=new Map;function Y(e){F.delete(e)}function E(e,t=1){X+=1;const n=X;function r(i){if(i===0)Y(n),e();else{const o=J(()=>{r(i-1)});F.set(n,o)}}return r(t),n}E.cancel=e=>{const t=F.get(e);return Y(t),Z(t)};function Ae(e,t,n,r){const i=n-t;return e/=r/2,e<1?i/2*e*e*e+t:i/2*((e-=2)*e*e+2)+t}function ve(e,t={}){const{getContainer:n=()=>window,callback:r,duration:i=450}=t,o=n(),c=H(o,!0),f=Date.now(),l=()=>{const s=Date.now()-f,T=Ae(s>i?i:s,c,e,i);P(o)?o.scrollTo(window.pageXOffset,T):o instanceof HTMLDocument||o.constructor.name==="HTMLDocument"?o.documentElement.scrollTop=T:o.scrollTop=T,s<i?E(l):typeof r=="function"&&r()};o&&E(l)}function Oe(e){let t;const n=i=>()=>{t=null,e(...i)},r=(...i)=>{t==null&&(t=requestAnimationFrame(n(i)))};return r.cancel=()=>cancelAnimationFrame(t),r}function G(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function Q(e){return e==null||typeof e!="object"&&typeof e!="function"}function k(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function A(e){return w(e)}function w(e,t=new Map){if(Q(e))return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){const n=Array.from({length:e.length});t.set(e,n);for(let r=0;r<e.length;r++)n[r]=w(e[r],t);return Object.prototype.hasOwnProperty.call(e,"index")&&(n.index=e.index),Object.prototype.hasOwnProperty.call(e,"input")&&(n.input=e.input),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const n=new RegExp(e.source,e.flags);return n.lastIndex=e.lastIndex,n}if(e instanceof Map){const n=new Map;t.set(e,n);for(const[r,i]of e)n.set(r,w(i,t));return n}if(e instanceof Set){const n=new Set;t.set(e,n);for(const r of e)n.add(w(r,t));return n}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(k(e)){const n=new(Object.getPrototypeOf(e)).constructor(e.length);t.set(e,n);for(let r=0;r<e.length;r++)n[r]=w(e[r],t);return n}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const n=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return t.set(e,n),p(n,e,t),n}if(typeof File<"u"&&e instanceof File){const n=new File([e],e.name,{type:e.type});return t.set(e,n),p(n,e,t),n}if(e instanceof Blob){const n=new Blob([e],{type:e.type});return t.set(e,n),p(n,e,t),n}if(e instanceof Error){const n=new e.constructor;return t.set(e,n),n.message=e.message,n.name=e.name,n.stack=e.stack,n.cause=e.cause,p(n,e,t),n}if(typeof e=="object"&&e!==null){const n={};return t.set(e,n),p(n,e,t),n}return e}function p(e,t,n){const r=[...Object.keys(t),...G(t)];for(let i=0;i<r.length;i++){const o=r[i],c=Object.getOwnPropertyDescriptor(e,o);(c==null||c.writable)&&(e[o]=w(t[o],n))}}const Ce=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,Te=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!Ce;function R(e,t,n,r){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let i,o,c;if(Array.isArray(e)){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(!R(e[o],t[o],n,r))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o of e.entries())if(!t.has(o[0]))return!1;for(o of e.entries())if(!R(o[1],t.get(o[0]),n,r))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o of e.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(i=e.length,i!=t.length)return!1;for(o=i;o--!==0;)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString)return e.toString()===t.toString();if(c=Object.keys(e),i=c.length,i!==Object.keys(t).length)return!1;for(o=i;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,c[o]))return!1;for(o=i;o--!==0;){const f=c[o];if(!(n!=null&&n.includes(f))&&!(f==="_owner"&&e.$$typeof)&&!R(e[f],t[f],n,r))return r&&console.log(f),!1}return!0}return e!==e&&t!==t}function Ee(e){return/\w.(?:png|jpg|jpeg|svg|webp|gif|bmp)$/i.test(e)}const j=e=>e==null,Re=e=>{if(!e||!e.startsWith("http"))return!1;try{return!!new URL(e)}catch{return!1}};function D(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(e)==="[object Object]":!1}const Ie=(...e)=>{const t={},n=e.length;let r,i=0;for(;i<n;i+=1)for(r in e[i])Object.prototype.hasOwnProperty.call(e[i],r)&&(typeof t[r]=="object"&&typeof e[i][r]=="object"&&t[r]!==void 0&&t[r]!==null&&!Array.isArray(t[r])&&!Array.isArray(e[i][r])?t[r]={...t[r],...e[i][r]}:t[r]=e[i][r]);return t};function v(e,t,n){const r=m(n==null?void 0:n.omitNil)?n==null?void 0:n.omitNil:!0,i=m(n==null?void 0:n.omitEmpty)?n==null?void 0:n.omitEmpty:!0,o=Object.keys(t);for(let c=0;c<o.length;c++){const f=o[c],l=t[f],a=e[f];Array.isArray(l)?Array.isArray(a)?l.length===0&&!i?e[f]=l:e[f]=v(a,l,n):e[f]=v([],l,n):D(l)?D(a)?Object.keys(l).length===0&&!i?e[f]=l:e[f]=v(a,l,n):e[f]=v({},l,n):r?(a===void 0||!j(l))&&(e[f]=l):e[f]=l}return e}let K=0;const ee=(e=21)=>{if(typeof window>"u"||!window.crypto)return(K+=1).toFixed(0);let t="";const n=crypto.getRandomValues(new Uint8Array(e));for(;e--;){const r=63&n[e];t+=r<36?r.toString(36):r<62?(r-26).toString(36).toUpperCase():r<63?"_":"-"}return t},Ne=()=>typeof window>"u"?ee():window.crypto&&window.crypto.randomUUID&&typeof crypto.randomUUID=="function"?crypto.randomUUID():ee(),Be=e=>{if(e&&e!==!0)return e},Ue=e=>{const t={};if(Object.keys(e||{}).forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),!(Object.keys(t).length<1))return t},Pe=e=>{const t={};return Object.keys(e||{}).forEach(n=>{var r;Array.isArray(e[n])&&((r=e[n])==null?void 0:r.length)===0||e[n]!==void 0&&(t[n]=e[n])}),t};function L(e){var t;if(!(typeof e!="string"&&!Array.isArray(e)))return Array.isArray(e)?e[e.length-1]:(t=e.split(":"))==null?void 0:t.slice(-1)[0]}function te(e){return e&&(e.type===d.Comment||e.type===d.Fragment&&e.children.length===0||e.type===Text&&e.children.trim()==="")}function Fe(e,t){var n;return M((n=e[t])==null?void 0:n.call(e))}function M(e=[]){const t=[];return e.forEach(n=>{Array.isArray(n)?t.push(...n):(n==null?void 0:n.type)===d.Fragment?t.push(...M(n.children)):t.push(n)}),t.filter(n=>!te(n))}function V(e,...t){return typeof e=="function"?e==null?void 0:e(...t):e}function ne(e,t,n="default",r){const i=L(n);if(i){let o;const c=B(t,n);return c===!1?o=!1:c===!0?o=e==null?void 0:e[i]:g(c)&&r?d.isVNode(c)?o=c:o=e==null?void 0:e[i]:o=c||(e==null?void 0:e[i]),r?d.isVNode(o)?o:V(o):o}}function re(e,t,n="default",r){var o,c,f;const i=L(n);if(i){let l;const a=B(t,n);return a===!1?l=!1:a===!0?l=(o=e==null?void 0:e[i])==null?void 0:o.call(e,r):g(a)?d.isVNode(a)?l=a:l=(c=e==null?void 0:e[i])==null?void 0:c.call(e,r):l=a||((f=e==null?void 0:e[i])==null?void 0:f.call(e,r)),d.isVNode(l)?l:V(l,r)}}function De(e,t,n,r){const i={};return e.forEach(o=>{const c=L(o);if(c){const f=r!=null&&r.render?re(t,n,o,r==null?void 0:r.params):ne(t,n,o);(m(f)||f)&&(i[c]=f)}}),i}const O={videoAllowType:["mp4","webm","ogg"],audioAllowType:["mp3","ogg","wav","aac","m4a","webm"],imageType:["jpeg","jpg","png","gif","bmp","tiff","tif","webp","heic","heif","svg","ico","raw","cr2","nef","arw","dng","psd","eps"],videoType:["mp4","avi","mov","wmv","mkv","flv","webm","mpeg","mpg","3gp","ogv","mxf","vob","rm","rmvb","ts","mts","m2ts","divx","xvid"],audioType:["mp3","wav","aac","flac","ogg","wma","m4a","alac","opus","amr","aiff","au","pcm","ape"]};function Le(e){return e!=null}const Me=({suffixCls:e,customizePrefixCls:t,isPor:n,className:r})=>{const i=r||(n?"gx-pro":"gx");return t||(e?`${i}-${e}`:i)},Ve=(e,t)=>e?h(e)?e.join("-"):e.toString():`${t||0}`;function be(e,{align:t,showIndex:n}){const r=A(e);if(n&&e.length&&e.every(i=>i.dataIndex!=="sortIndex")){const i=e[0];r.unshift({title:"序号",align:t,fixed:i.fixed,width:60,uuid:fe().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else r.filter(i=>i.dataIndex!=="sortIndex");return r}function $e(e,...t){return typeof e=="function"?e(...t):e}function _e(e){return JSON.parse(JSON.stringify(e))}function We(e,t){if(g(e)){const{pageSize:n=10,total:r=0}=e;let{current:i=1}=e;return r-t<=n*(i-1)&&(i=i-1),i===0?1:i}return 1}function ze(e=[],t,n="children"){function r(i,o){return o.map((c,f)=>{const l=`${i}-${f+1}`;return c[n]&&(c[n]=r(l,c[n])),c.sortIndex=l,c})}return A(e).map((i,o)=>{const c=g(t)&&t.current||1,f=g(t)&&t.pageSize||10,l=`${c?(c-1)*f+(o+1):o+1}`;return i[n]&&(i[n]=r(`${l}`,i[n])),i.sortIndex=l,i})}function qe(e,t){return h(e)?e==null?void 0:e.filter((n,r)=>{if(y(t))return r<=t-1;if(h(t)&&t.length===2){const i=t[0]-1,o=t[1]?t[1]-1:e.length-1;return r<=o&&r>=i}else if(h(t)&&t.length===1){const i=t[0]-1,o=e.length-1;return r<=o&&r>=i}return!0}):[]}function ie(e,t,n,r=0){const i=y(r)&&(r===0||r===1)?r:0,o=e[n],c=t[n];let f=0;return o<c?f=i===0?-1:0:o>c&&(f=i===0?0:-1),f}function oe(e,t,n,r=0){const i=y(r)&&(r===0||r===1)?r:0,o=new Date(e[n]),c=new Date(t[n]);let f=0;return o<c?f=i===0?-1:0:o>c&&(f=i===0?0:-1),f}function xe(e,t,n=0){return e.sort((r,i)=>ie(r,i,t,n))}function He(e,t,n=0){return e.sort((r,i)=>oe(r,i,t,n))}function Je(e){let t=A(e);const n=new Set(t);return t=Array.from(n),t}function Ze(e,t){const n=["null","undefined"];let r=!0;return e===0?r=!0:n.includes(e)?r=!1:e||(r=!1),r?{value:e,success:r}:{value:t===""?t:t||"-",success:r}}function Xe(e){let t="";if(e>-1){const n=Math.floor(e/3600),r=Math.floor(e/60)%60,i=Number.parseInt(String(e%60));n<10?t="0"+n+":":t=n+":",r<10&&(t+="0"),t+=r+":",i<10&&(t+="0"),t+=i}return t.split(":")[0]==="00"?`${t.split(":")[1]}:${t.split(":")[2]}`:t}function fe(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return{uuid(t,n){const r=e,i=[],o=n||r.length;let c,f;if(t)for(c=0;c<t;c+=1)i[c]=r[Number.parseInt(String(Math.random()*o))];else for(i[8]="-",i[13]="-",i[18]="-",i[23]="-",i[14]="4",c=0;c<36;c+=1)i[c]||(f=Math.random()*16,i[c]=r[c===19?f&&3||8:f]);return i.join("")},uuidFast(){const t=e,n=Array.from({length:36});let r=0,i,o;for(o=0;o<36;o+=1)o===8||o===13||o===18||o===23?n[o]="-":o===14?n[o]="4":(r<=2&&(r=33554432+Math.random()*16777216||0),i=r&&15,r=r>4,n[o]=t[o===19?i&&3||8:i]);return n.join("")},uuidString(){return this.uuidFast().replace(new RegExp("-","g"),"")},uuidCompact(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16||0;return(t==="x"?n:n&&3||8).toString(16)})}}}function ce(e,t){if(!Array.isArray(e)||e.length===0)return 0;const n=t||"children";return Math.max(...e.map(r=>{const i=r[n];return 1+(i?ce(i,n):0)}))}function ue(e,t="children"){let n=[];return e.forEach(r=>{n.push(r),h(r[t])&&r[t].length>0&&(n=n.concat(ue(r[t],t)))}),n}function Ye(e,t){if(!e||!h(e)||(e==null?void 0:e.length)===0)return[];const{id:n="id",parentId:r="parentId",children:i="children",rootId:o=0,emptyChildren:c=!0}=t||{},f=A(e);return f.map(l=>{var a;return!c&&l[i]&&((a=l[i])==null?void 0:a.length)===0&&delete l[i],l}).filter(l=>{const a=f.filter(s=>l[n]===s[r]);return a.length>0?l[i]=a:c&&(l[i]=[]),l[r]===o})}function le(e,t){return e.map(n=>{const r={...n};return r.children&&(r.children=le(r.children,t)),t(r)||r.children&&r.children.length>0?r:null}).filter(Boolean)}function Ge(e,t,n){const{value:r,children:i}=n||{value:"value",children:"children"};let o=[];function c(f,l){if(f[r]===t)return o=[...l,f[r]],!0;if(f[i]){for(const a of f[i])if(c(a,[...l,f[r]]))return!0}return!1}for(const f of e)if(c(f,[]))break;return o}function Qe(e){return e&&h(e)?e[e.length-1]:null}function ae(e,t,n){const r=(n==null?void 0:n.value)||"id",i=(n==null?void 0:n.children)||"children";for(const o of e){if(o[r]===t)return o;const c=o[i];if(c){const f=ae(c,t,n);if(f)return f}}}function ke(e){return URL.createObjectURL(e)}function je(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=i=>n(i)})}function Ke(e){const t=e.split(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]);let i=r.length;const o=new Uint8Array(i);for(;i--;)o[i]=r.charCodeAt(i);return new Blob([o],{type:n})}function et(e,t){const n=e.split(","),r=n[0].match(/:(.*?);/)[1],i=atob(n[1]);let o=i.length;const c=new Uint8Array(o);for(;o--;)c[o]=i.charCodeAt(o);return new File([c],t,{type:r})}function tt(e,t,n){return new window.File([e],t,{type:n})}function se(e){if(!e||typeof e!="string")return"";const t=e.indexOf("?");return t>0?`${e.substring(0,t)}`:e}function I(e){var r,i,o,c,f;if(!e||typeof e!="string")return"";const t=se(e),n=t.lastIndexOf(".");return n>0&&((f=(c=`${(o=(i=(r=t==null?void 0:t.substring)==null?void 0:r.call(t,n))==null?void 0:i.split("?"))==null?void 0:o[0]}`)==null?void 0:c.split("."))==null?void 0:f[1])||""}function C(e,t){if(t)return t;if(!e||e==="data:")return"4";let n="4";return N(e)?e.includes("data:image/")?n="png":e.includes("data:video/")?n="mp4":e.includes("data:audio/")&&(n="mp3"):e instanceof Blob?(e=String(e),e.includes("image")?n="png":e.includes("video")?n="mp4":e.includes("audio")&&(n="mp3")):n=I(e).toLowerCase(),O.imageType.includes(n)?"1":O.videoType.includes(n)?"3":O.audioType.includes(n)?"2":"4"}function de(e){const{url:t="",fileType:n="1"}=e||{};let r="",i={play:!1,height:0,size:0,width:0,duration:0};function o(){i={play:!1,height:0,size:0,width:0,duration:0}}return t instanceof File?r=URL.createObjectURL(t):N(t)?r=t:t instanceof Blob?r=URL.createObjectURL(t):(t.includes("https")||t.includes("http"))&&(r=t),new Promise(c=>{let f;n==="1"?(f=document.createElement("img"),f.src=r):n==="2"?(f=document.createElement("audio"),f.src=r):n==="3"&&(f=document.createElement("video"),f.src=r),n==="1"?f.onload=function(){o(),i.play=!0,i.width=f.width||0,i.height=f.height||0,c(i),f=null}:f.oncanplay=function(){o(),i.play=!0,i.width=(f==null?void 0:f.videoWidth)||0,i.height=(f==null?void 0:f.videoHeight)||0,i.duration=(f==null?void 0:f.duration)||0,c(i),f=null},f.onerror=function(){o(),c(i),f=null}})}async function nt(e){const{url:t="",currentTime:n,videoSuffix:r="",vidoeAllowPlay:i=!1}=e;let o="",c=r,f="1",l;return t instanceof File?(o=URL.createObjectURL(t),c=I(t.name),f=C(t.name)):t instanceof Blob?(o=URL.createObjectURL(t),f=C(t)):N(t)?(o=t,f=C(t)):(t.includes("https")||t.includes("http"))&&(o=t,c=I(t),f=C(t)),(c?O.videoAllowType.includes(c.toLowerCase()):!1)?i?b(o,n):(l=await de({url:o,fileType:f}),l.play?b(o,n):new Promise(s=>{s("")})):new Promise(s=>{s("")})}async function b(e,t=0){return new Promise(n=>{let r=document.createElement("video");r&&(r.controls=!0,r.muted=!0,r.setAttribute("src",e),r.setAttribute("muted",String(!0)),r.setAttribute("crossorigin","anonymous"),r.setAttribute("autoplay",String(!0)),r.addEventListener("loadeddata",async()=>{let i;for(r==null||r.addEventListener("seeked",async()=>{i&&i()});t<((r==null?void 0:r.duration)||0);){r&&(r.currentTime=t),await new Promise(T=>i=T);const o=document.createElement("canvas"),c=.8,f=o.getContext("2d"),l=(r==null?void 0:r.videoWidth)||0*c,a=(r==null?void 0:r.videoHeight)||0*c,s=0;o.width=(r==null?void 0:r.videoWidth)||0*c,o.height=(r==null?void 0:r.videoHeight)||0*c,r&&f.drawImage(r,0,0,l+s,a+s),r=null,n(l===0||a===0?"":o.toDataURL("image/png",1))}}))})}function N(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(n=>e.includes(n)))}function rt(e){return typeof e=="string"&&/^data:(?:image|video|audio)\/[A-Za-z]+;base64,[A-Za-z0-9+/=]+$/.test(e)}function it(e,t,n,r=!1){e&&t&&n&&e.addEventListener(t,n,r)}function ot(e,t,n,r=!1){e&&t&&n&&e.removeEventListener(t,n,r)}function ft(){return/windows|win32/i.test(navigator.userAgent)}function ct(e){return m(e)?e:!!e}function $(e,t){const n=`^\\d+(?:\\.\\d{0,${e}})?`,r=new RegExp(n),i=t.toString().match(r);if(i){const o=i[0];if(o.includes(".")){const[c,f]=o.split(".");if(/^0*$/.test(f))return c}return o}return t.toString()}function ut(e,t){const{toChinese:n=!1,fixed:r=2,min:i=1e4}=t||{},o=y(i)?i:1e4,c=y(r)?r:2,f=n?e<o?"":e<1e8?"万":"亿":e<o?"":e<1e8?"w":"亿";if(!y(e))return{str:`${e}`,number:`${e}`};if(e<o)return{str:`${e}`,number:`${e}`};if(c===0){const a=(e/(e<1e8?1e4:1e8)).toFixed(1).split(".")[0];return{str:`${a}${f}`,number:a,unit:f}}let l;return e<1e8?(l=$(c,e/1e4),{str:l+f,number:l,unit:f}):(l=$(c,e/1e8),{str:l+f,number:l,unit:f})}function lt(e,t){let n=0;const r=m(t.removeAfter)?t.removeAfter:!0,i=t.id||"hiddenElement",o={opacity:0,visibility:"hidden",position:"fixed",zIndex:-1,top:0,left:0};let c=document.querySelector(`#${i}`);if(!c){const l=document.createElement("div");l.id=i,document.body.appendChild(l),c=document.querySelector(`#${i}`)}Object.assign(c.style,o);const f=document.createElement(t.createName||"span");return f.innerHTML=e,(t.cssObject||g(t.cssObject))&&Object.assign(f.style,t.cssObject),c.append(f),n=f.getBoundingClientRect()[t.type||"width"],r&&c.removeChild(f),n}function at(e){e=y(e)&&!Number.isNaN(e)?e:0;const t=["零","一","二","三","四","五","六","七","八","九"],n=["","十","百","千","万"];e=Number.parseInt(`${e}`);const r=c=>{const f=c.toString().split("").reverse();let l="";for(let a=0;a<f.length;a++)l=(a===0&&f[a]==="0"||a>0&&f[a]==="0"&&f[a-1]==="0"?"":(e<20&&a>0?"":t[f[a]])+(f[a]==="0"?n[0]:n[a]))+l;return l},i=Math.floor(e/1e4);let o=e%1e4;return o.toString().length<4&&(o="0"+o),i?r(i)+"万"+r(o):r(e)}function st(e,t){Object.keys(e).forEach(n=>{t(n,e[n])})}u.Base64=he,u.arrayRepeat=Je,u.arraySlice=qe,u.blobToDataURL=tt,u.checkFileType=C,u.classNames=q,u.cloneDeep=A,u.compareArray=ie,u.compareArraySort=xe,u.compareArrayTimeSort=He,u.compareTime=oe,u.convertValueBoolean=ct,u.copyProperties=p,u.dataURLtoBlob=Ke,u.dataURLtoFile=et,u.deepCopy=_e,u.deepMerge=v,u.fileTypes=O,u.filterEmpty=M,u.filterTree=le,u.findSourceByTree=ae,u.findValueAndAncestors=Ge,u.forInObject=st,u.formatDuraton=Xe,u.formatNumber=$,u.genColumnKey=Ve,u.generateVidoePicture=b,u.getArrayLast=Qe,u.getBase64=je,u.getBlobUrl=ke,u.getFileSuffix=I,u.getLevelData=ue,u.getMaxFloor=ce,u.getMediaInfos=de,u.getPrefixCls=Me,u.getRandomNumber=fe,u.getScroll=H,u.getScrollContainer=pe,u.getSlot=ne,u.getSlotVNode=re,u.getSlotsChildren=Fe,u.getSlotsProps=De,u.getSortIndex=ze,u.getSymbols=G,u.getTextWidth=lt,u.getValueFromObjectByKey=B,u.getVideoCoverPicture=nt,u.getVideoFileUrl=se,u.handleCurrentPage=We,u.handleShowIndex=be,u.hanndleEmptyField=Ze,u.is=_,u.isArray=h,u.isBase64=N,u.isBoolean=m,u.isBrowser=Te,u.isDataURLBase64=rt,u.isDeepEqualReact=R,u.isEmptyElement=te,u.isFunction=ye,u.isImg=Ee,u.isInContainer=Se,u.isJSONStr=ge,u.isMobile=me,u.isNil=j,u.isNotNil=Le,u.isNumber=y,u.isObject=g,u.isPlainObject=D,u.isPrimitive=Q,u.isScroll=x,u.isServer=S,u.isString=W,u.isTablet=z,u.isTypedArray=k,u.isUrl=Re,u.isWindowsOs=ft,u.merge=Ie,u.nanoid=Ne,u.off=ot,u.omitBoolean=Be,u.omitUndefined=Ue,u.omitUndefinedAndEmptyArr=Pe,u.on=it,u.raf=E,u.runFunction=$e,u.scrollTo=ve,u.slotRender=V,u.throttleByAnimationFrame=Oe,u.toChinesNum=at,u.toConvertNumberShow=ut,u.treeData=Ye,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
@@ -1,9 +1,5 @@
1
- interface RafMap {
2
- [id: number]: number;
3
- }
4
- declare function wrapperRaf(callback: () => void, delayFrames?: number): number;
1
+ declare function wrapperRaf(callback: () => void, times?: number): number;
5
2
  declare namespace wrapperRaf {
6
- var cancel: (pid?: number | undefined) => void;
7
- var ids: RafMap;
3
+ var cancel: (id: number) => void;
8
4
  }
9
5
  export default wrapperRaf;
@@ -1,9 +1,37 @@
1
- import type { Slots, VNode } from 'vue';
2
1
  import type { CustomRender, WithFalse } from '../typings';
3
- export declare const isSlotFragment: (slots: VNode[]) => boolean;
4
- export declare function getRealVNode(vnode: VNode[]): VNode[];
5
- export declare function getSlot<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
6
- export declare function getSlotVNode<T>(slots: Slots, props: Record<string, unknown>, prop?: string): T | false;
7
- type KeyValue<T extends keyof any, K> = Record<T, K>;
8
- export declare function getSlotsProps<T extends keyof any, VNode = WithFalse<CustomRender>>(data: T[], slots: Slots, props: Record<string, unknown>): KeyValue<T, VNode | false>;
9
- export {};
2
+ import { VNode } from 'vue';
3
+ export declare function isEmptyElement(c: any): any;
4
+ export declare function getSlotsChildren<T extends Readonly<Record<string, any>>>(slots: T, key: keyof T): VNode[];
5
+ export declare function filterEmpty(children?: VNode[]): VNode<import("vue").RendererNode, import("vue").RendererElement, {
6
+ [key: string]: any;
7
+ }>[];
8
+ export declare function slotRender(slot: any, ...arg: any): any;
9
+ /**
10
+ * @Author gx12358
11
+ * @DateTime 2024/2/2
12
+ * @lastTime 2024/2/2
13
+ * @description () => CustomRender
14
+ */
15
+ export declare function getSlot<T = undefined>(slots: Readonly<Record<string, any>>, props: Record<string, unknown>, keys: string | string[], render?: false): T extends undefined ? WithFalse<CustomRender> : T;
16
+ export declare function getSlot<T = undefined>(slots: Readonly<Record<string, any>>, props: Record<string, unknown>, keys: string | string[], render?: true): VNode;
17
+ /**
18
+ * @Author gx12358
19
+ * @DateTime 2024/2/2
20
+ * @lastTime 2024/2/2
21
+ * @description () => WithFalse<VNode | VNode[]>
22
+ */
23
+ export declare function getSlotVNode<T = undefined>(slots: Readonly<Record<string, any>>, props: Record<string, unknown>, keys: string | string[], options?: any): T extends undefined ? WithFalse<VNode | VNode[]> : T;
24
+ /**
25
+ * @Author gx12358
26
+ * @DateTime 2024/10/13
27
+ * @lastTime 2024/10/13
28
+ * @description 获取names的slots或者props的VNode
29
+ */
30
+ export declare function getSlotsProps<T extends string, K = undefined>(names: T[], slots: Readonly<Record<string, any>>, props: Record<string, unknown>, options?: {
31
+ render?: false;
32
+ params?: any;
33
+ }): K extends undefined ? Record<T, any> : K;
34
+ export declare function getSlotsProps<T extends string, K = undefined>(names: T[], slots: Readonly<Record<string, any>>, props: Record<string, unknown>, options?: {
35
+ render?: true;
36
+ params?: any;
37
+ }): K extends undefined ? Record<T, WithFalse<VNode | VNode[]>> : K;
@@ -1,10 +1,15 @@
1
1
  import type { Slot, VNode, VNodeChild } from 'vue';
2
- export type EmitType = (event: string, ...args: any[]) => void;
2
+ export type DeepPartial<T> = T extends object ? {
3
+ [P in keyof T]?: DeepPartial<T[P]>;
4
+ } : T;
5
+ export interface Fn<T = any, R = T> {
6
+ (...arg: T[]): R;
7
+ }
3
8
  export type Nullable<T> = T | null;
4
9
  export type WithFalse<T> = T | false;
5
10
  export type RecordType = Record<string, any>;
6
11
  export type VueNode = VNodeChild | JSX.Element;
7
- export type CustomRender = Slot | VNodeChild | VNode | ((...props: any[]) => Slot) | ((...props: any[]) => VNode) | ((...args: any[]) => VNode) | VNode[] | JSX.Element | string | null | undefined;
12
+ export type CustomRender = Slot | VNodeChild | VNode | ((...props: any[]) => VNode) | ((...props: any[]) => VNode[]) | VNode[] | JSX.Element | string | null | undefined;
8
13
  export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
9
14
  export type SizeType = 'small' | 'middle' | 'large' | undefined;
10
15
  export type AlignType = 'left' | 'center' | 'right';
@@ -13,18 +18,13 @@ export type BasicTablePageConfig = {
13
18
  pageSize: number;
14
19
  total?: number;
15
20
  } | boolean;
16
- export type ProColumn<T = any> = {
17
- title?: string;
18
- align?: AlignType;
19
- fixed?: boolean;
20
- uuid?: string;
21
- key: string;
22
- dataIndex: string;
23
- width?: number;
24
- } & T;
25
- export type MaterialInfo = {
26
- play?: boolean;
27
- width?: number;
28
- height?: number;
29
- duration?: number;
21
+ export interface MaterialOptions {
22
+ play: boolean;
23
+ width: number;
24
+ height: number;
25
+ duration: number;
26
+ size?: number | string;
27
+ }
28
+ export type OmitUndefined<T> = {
29
+ [P in keyof T]: NonNullable<T[P]>;
30
30
  };
@@ -1,8 +1,7 @@
1
- declare const _default: {
1
+ export declare const fileTypes: {
2
2
  videoAllowType: string[];
3
3
  audioAllowType: string[];
4
4
  imageType: string[];
5
5
  videoType: string[];
6
6
  audioType: string[];
7
7
  };
8
- export default _default;
@@ -0,0 +1 @@
1
+ export declare function getSymbols(object: any): symbol[];
@@ -1,4 +1,12 @@
1
- import type { AlignType, ProColumn, BasicTablePageConfig, MaterialInfo } from '../typings';
1
+ import type { CSSProperties } from 'vue';
2
+ import type { AlignType, BasicTablePageConfig, MaterialOptions, RecordType } from '../typings';
3
+ export * from './config';
4
+ export * from './getSymbols';
5
+ export * from './isNotNil';
6
+ export * from './isPlainObject';
7
+ export * from './isPrimitive';
8
+ export * from './isTypedArray';
9
+ export * from './validate';
2
10
  export interface PrefixCls {
3
11
  suffixCls?: string;
4
12
  customizePrefixCls?: string;
@@ -13,11 +21,17 @@ export declare const getPrefixCls: ({ suffixCls, customizePrefixCls, isPor, clas
13
21
  * @param dataIndex 在对象中的数据
14
22
  * @param index 序列号,理论上唯一
15
23
  */
16
- export declare const genColumnKey: (key?: string | number | undefined, index?: number) => string;
17
- export declare function handleShowIndex(columns: ProColumn[], { align, showIndex }: {
24
+ export declare const genColumnKey: (key: string[] | number | string | undefined, index?: number) => string;
25
+ /**
26
+ * @Author gx12358
27
+ * @DateTime 2025/2/5
28
+ * @lastTime 2025/2/5
29
+ * @description 这里是结合ant的数据结构给到的分页数据
30
+ */
31
+ export declare function handleShowIndex<T extends object>(columns: T[], { align, showIndex }: {
18
32
  align: AlignType;
19
33
  showIndex: boolean;
20
- }): any[];
34
+ }): T[];
21
35
  /**
22
36
  * @Author gx12358
23
37
  * @DateTime 2021/11/3
@@ -31,7 +45,7 @@ export declare function runFunction<T extends any[]>(valueEnum: any, ...rest: T)
31
45
  * @lastTime 2022/10/11
32
46
  * @description 简单深拷贝下
33
47
  */
34
- export declare function deepCopy(data: object | any[]): any;
48
+ export declare function deepCopy<T = RecordType>(data: any): T;
35
49
  /**
36
50
  * @Author gx12358
37
51
  * @DateTime 2021/1/28
@@ -45,30 +59,54 @@ export declare function handleCurrentPage(pageConfig: BasicTablePageConfig, curr
45
59
  * @lastTime 2020/7/24
46
60
  * @description 数组(树形)添加序号
47
61
  */
48
- export declare function getSortIndex<T = any>(data: T[] | undefined, pageConfig: BasicTablePageConfig, childrenKey?: string): any;
62
+ export declare function getSortIndex<T = RecordType>(data: T[] | undefined, pageConfig: BasicTablePageConfig, childrenKey?: keyof T): any[];
63
+ export declare function arraySlice<T = RecordType>(data: T[], range: number | number[]): T[];
49
64
  /**
50
65
  * @Author gaoxiang
51
66
  * @DateTime 2019/11/29
52
67
  * @lastTime 2019/11/29
68
+ * @description 这里是给到数组的sort的方法
53
69
  * @description 排序 sort 0 从小到大 1 从大到小
54
70
  */
55
- export declare function compareArray(obj1: any, obj2: any, key: string, sort?: 0 | 1): number;
71
+ export declare function compareArray<T = RecordType>(obj1: T, obj2: T, key: keyof T, sort?: 0 | 1): number;
72
+ /**
73
+ * @Author gx12358
74
+ * @DateTime 2023/10/17
75
+ * @lastTime 2023/10/17
76
+ * @description 这里是给到数组的sort的方法
77
+ * @description type 0 从小到大 1 从大到小
78
+ */
79
+ export declare function compareTime<T = RecordType>(obj1: T, obj2: T, key: keyof T, sort?: 0 | 1): number;
80
+ /**
81
+ * @Author gx12358
82
+ * @DateTime 2024/10/27
83
+ * @lastTime 2024/10/27
84
+ * @description type 0 从小到大 1 从大到小
85
+ */
86
+ export declare function compareArraySort<T = RecordType>(dataSource: T[], key: keyof T, sort?: 0 | 1): T[];
87
+ /**
88
+ * @Author gx12358
89
+ * @DateTime 2024/10/27
90
+ * @lastTime 2024/10/27
91
+ * @description 比较时间 type 0 从小到大 1 从大到小
92
+ */
93
+ export declare function compareArrayTimeSort<T = RecordType>(dataSource: T[], key: keyof T, sort?: 0 | 1): T[];
56
94
  /**
57
95
  * @Author gaoxiang
58
96
  * @DateTime 2019/12/11
59
97
  * @lastTime 2019/12/11
60
98
  * @description 数组去重
61
99
  */
62
- export declare function arrayRepeat<T = any>(data: T[]): any;
100
+ export declare function arrayRepeat<T = RecordType>(data: T[]): T[];
63
101
  /**
64
102
  * @Author gaoxiang
65
103
  * @DateTime 2020/8/26
66
104
  * @lastTime 2020/8/26
67
- * @description 处理表格字段为空
105
+ * @description 处理字段为空
68
106
  */
69
- export declare function hanndleField(str: any, customize: any): {
70
- value: any;
107
+ export declare function hanndleEmptyField(str: any, customize: any): {
71
108
  success: boolean;
109
+ value: any;
72
110
  };
73
111
  /**
74
112
  * @Author gaoxiang
@@ -95,14 +133,14 @@ export declare function getRandomNumber(): {
95
133
  * @lastTime 2022/10/11
96
134
  * @description 获取树形结构最深的层级数
97
135
  */
98
- export declare function getMaxFloor(treeData?: any[]): number;
136
+ export declare function getMaxFloor<T>(data: T[], childrenKey?: keyof T): number;
99
137
  /**
100
138
  * @Author gaoxiang
101
139
  * @DateTime 2020/8/10
102
140
  * @lastTime 2020/8/10
103
141
  * @description 树形转平级
104
142
  */
105
- export declare function getLevelData(data: any[], filed?: string): any[];
143
+ export declare function getLevelData<T extends RecordType = RecordType>(data: T[], filed?: keyof T): T[];
106
144
  /**
107
145
  * 构造树型结构数据
108
146
  * @param {*} source 数据源
@@ -111,7 +149,41 @@ export declare function getLevelData(data: any[], filed?: string): any[];
111
149
  * @param {*} children 孩子节点字段 默认 'children'
112
150
  * @param {*} rootId 根Id 默认 0
113
151
  */
114
- export declare function treeData(source: any[], id: string, parentId?: string, children?: string, rootId?: number): any;
152
+ export declare function treeData<T extends RecordType = RecordType>(source: T[], options?: {
153
+ id: keyof T;
154
+ parentId?: keyof T;
155
+ children?: keyof T;
156
+ rootId?: number;
157
+ emptyChildren?: boolean;
158
+ }): T[];
159
+ /**
160
+ * @Author gx12358
161
+ * @DateTime 2024/12/21
162
+ * @lastTime 2024/12/21
163
+ * @description 树形数组 按照条件 过滤
164
+ */
165
+ export declare function filterTree<T = any>(tree: T[], predicate: (val: T) => boolean): any[];
166
+ /**
167
+ * @Author gx12358
168
+ * @DateTime 2024/12/21
169
+ * @lastTime 2024/12/21
170
+ * @description 给定指定的value值,找到其所有的祖先节点
171
+ */
172
+ export declare function findValueAndAncestors<T = any>(tree: T[], targetValue: any, fieldNames?: {
173
+ value: 'value';
174
+ children: 'children';
175
+ }): any[];
176
+ export declare function getArrayLast<T = any>(data: any): T;
177
+ /**
178
+ * @Author gx12358
179
+ * @DateTime 2024/12/6
180
+ * @lastTime 2024/12/6
181
+ * @description 树形数组递归查找指定对象
182
+ */
183
+ export declare function findSourceByTree<T>(tree: T[], value: any, options?: {
184
+ value: keyof T;
185
+ children: keyof T;
186
+ }): T | undefined;
115
187
  /**
116
188
  * @Author gx12358
117
189
  * @DateTime 2021/11/5
@@ -153,14 +225,14 @@ export declare function blobToDataURL(blob: Blob, fileName: string, fileType: st
153
225
  * @lastTime 2020/11/13
154
226
  * @description 截取视频时间戳
155
227
  */
156
- export declare function getVideoFileUrl(url?: string): string;
228
+ export declare function getVideoFileUrl(url: string): string;
157
229
  /**
158
230
  * @Author gaoxiang
159
231
  * @DateTime 2020/11/13
160
232
  * @lastTime 2020/11/13
161
233
  * @description 获取文件后缀名
162
234
  */
163
- export declare function getFileSuffix(url?: string): string;
235
+ export declare function getFileSuffix(url: string): string;
164
236
  /**
165
237
  * @Author gaoxiang
166
238
  * @DateTime 2020/10/5
@@ -177,7 +249,7 @@ export declare function checkFileType(url: any, type?: '1' | '2' | '3' | '4'): "
177
249
  export declare function getMediaInfos(mediaInfo: {
178
250
  url: any;
179
251
  fileType?: string;
180
- }): Promise<MaterialInfo>;
252
+ }): Promise<MaterialOptions>;
181
253
  /**
182
254
  * @Author gaoxiang
183
255
  * @DateTime 2020/11/13
@@ -204,5 +276,53 @@ export declare function generateVidoePicture(videoUrl: string, currentTime?: num
204
276
  * @description 判断是否是base64码
205
277
  */
206
278
  export declare function isBase64(str?: string): boolean;
279
+ export declare function isDataURLBase64(str: string): boolean;
207
280
  export declare function on(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
208
281
  export declare function off(element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean): void;
282
+ /**
283
+ * 检查当前运行环境是否为Windows OS。
284
+ *
285
+ * 这个函数通过检查navigator.userAgent字符串来判断当前运行环境。
286
+ * 如果userAgent字符串中包含"windows"或"win32"(不区分大小写),则认为当前环境是Windows OS。
287
+ *
288
+ * @returns {boolean} 如果当前环境是Windows OS,返回true,否则返回false。
289
+ */
290
+ export declare function isWindowsOs(): boolean;
291
+ export declare function convertValueBoolean(value: any): boolean;
292
+ export declare function formatNumber(fixedNum: number, value: number): string;
293
+ /**
294
+ * @Author gx12358
295
+ * @DateTime 2022/6/20
296
+ * @lastTime 2022/6/20
297
+ * @description 转换数字
298
+ */
299
+ export declare function toConvertNumberShow(number: number, options?: {
300
+ toChinese?: boolean;
301
+ fixed?: number;
302
+ min?: number;
303
+ }): {
304
+ str: string;
305
+ number: string;
306
+ unit?: string;
307
+ };
308
+ /**
309
+ * @Author gx12358
310
+ * @DateTime 2022/9/13
311
+ * @lastTime 2022/9/13
312
+ * @description 获取字符宽度或高度
313
+ */
314
+ export declare function getTextWidth(str: string, options: {
315
+ id?: string;
316
+ type?: 'width' | 'height';
317
+ createName?: string;
318
+ removeAfter?: boolean;
319
+ cssObject?: CSSProperties;
320
+ }): number;
321
+ /**
322
+ * @Author gx12358
323
+ * @DateTime 2022/8/4
324
+ * @lastTime 2022/8/4
325
+ * @description 数字转中文
326
+ */
327
+ export declare function toChinesNum(num: number): string;
328
+ export declare function forInObject<T extends object>(obj: T, callback: (key: keyof T, value: T[keyof T]) => void): void;
@@ -0,0 +1 @@
1
+ export declare function isNotNil<T>(x: T | null | undefined): x is T;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Checks if a given value is a plain object.
3
+ *
4
+ * @param {object} value - The value to check.
5
+ * @returns {value is Record<PropertyKey, any>} - True if the value is a plain object, otherwise false.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // ✅👇 True
10
+ *
11
+ * isPlainObject({ }); // ✅
12
+ * isPlainObject({ key: 'value' }); // ✅
13
+ * isPlainObject({ key: new Date() }); // ✅
14
+ * isPlainObject(new Object()); // ✅
15
+ * isPlainObject(Object.create(null)); // ✅
16
+ * isPlainObject({ nested: { key: true} }); // ✅
17
+ * isPlainObject(new Proxy({}, {})); // ✅
18
+ * isPlainObject({ [Symbol('tag')]: 'A' }); // ✅
19
+ *
20
+ * // ✅👇 (cross-realms, node context, workers, ...)
21
+ * const runInNewContext = await import('node:vm').then(
22
+ * (mod) => mod.runInNewContext
23
+ * );
24
+ * isPlainObject(runInNewContext('({})')); // ✅
25
+ *
26
+ * // ❌👇 False
27
+ *
28
+ * class Test { };
29
+ * isPlainObject(new Test()) // ❌
30
+ * isPlainObject(10); // ❌
31
+ * isPlainObject(null); // ❌
32
+ * isPlainObject('hello'); // ❌
33
+ * isPlainObject([]); // ❌
34
+ * isPlainObject(new Date()); // ❌
35
+ * isPlainObject(new Uint8Array([1])); // ❌
36
+ * isPlainObject(Buffer.from('ABC')); // ❌
37
+ * isPlainObject(Promise.resolve({})); // ❌
38
+ * isPlainObject(Object.create({})); // ❌
39
+ * isPlainObject(new (class Cls {})); // ❌
40
+ * isPlainObject(globalThis); // ❌,
41
+ * ```
42
+ */
43
+ export declare function isPlainObject(value: unknown): value is Record<PropertyKey, any>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Checks whether a value is a JavaScript primitive.
3
+ * JavaScript primitives include null, undefined, strings, numbers, booleans, symbols, and bigints.
4
+ *
5
+ * @param {unknown} value The value to check.
6
+ * @returns {value is
7
+ * null
8
+ * | undefined
9
+ * | string
10
+ * | number
11
+ * | boolean
12
+ * | symbol
13
+ * | bigint} Returns true if `value` is a primitive, false otherwise.
14
+ *
15
+ * @example
16
+ * isPrimitive(null); // true
17
+ * isPrimitive(undefined); // true
18
+ * isPrimitive('123'); // true
19
+ * isPrimitive(false); // true
20
+ * isPrimitive(true); // true
21
+ * isPrimitive(Symbol('a')); // true
22
+ * isPrimitive(123n); // true
23
+ * isPrimitive({}); // false
24
+ * isPrimitive(new Date()); // false
25
+ * isPrimitive(new Map()); // false
26
+ * isPrimitive(new Set()); // false
27
+ * isPrimitive([1, 2, 3]); // false
28
+ */
29
+ export declare function isPrimitive(value: unknown): value is null | undefined | string | number | boolean | symbol | bigint;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Checks if a value is a TypedArray.
3
+ * @param {unknown} x The value to check.
4
+ * @returns {x is
5
+ * Uint8Array
6
+ * | Uint8ClampedArray
7
+ * | Uint16Array
8
+ * | Uint32Array
9
+ * | BigUint64Array
10
+ * | Int8Array
11
+ * | Int16Array
12
+ * | Int32Array
13
+ * | BigInt64Array
14
+ * | Float32Array
15
+ * | Float64Array} Returns true if `x` is a TypedArray, false otherwise.
16
+ *
17
+ * @example
18
+ * const arr = new Uint8Array([1, 2, 3]);
19
+ * isTypedArray(arr); // true
20
+ *
21
+ * const regularArray = [1, 2, 3];
22
+ * isTypedArray(regularArray); // false
23
+ *
24
+ * const buffer = new ArrayBuffer(16);
25
+ * isTypedArray(buffer); // false
26
+ */
27
+ export declare function isTypedArray(x: unknown): x is Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array;
@@ -1,13 +1,13 @@
1
1
  export declare function is(val: unknown, type: string): boolean;
2
2
  export declare function isBoolean(val: unknown): val is boolean;
3
- export declare function isNumber(val: unknown): boolean;
3
+ export declare function isNumber(val: unknown): val is number;
4
4
  /**
5
- * @author gx12358 2539306317@qq.com
5
+ * @author gx12358 gx12358@gmail.com
6
6
  * @description 判断是否是数组
7
- * @param arg
8
- * @returns {arg is any[]|boolean}
7
+ * @param val
8
+ * @returns {val is any[]|boolean}
9
9
  */
10
- export declare function isArray(arg: unknown): boolean;
10
+ export declare function isArray(val: any): val is Array<any>;
11
11
  /**
12
12
  * @Author gaoxiang
13
13
  * @DateTime 2019/11/29
@@ -16,10 +16,13 @@ export declare function isArray(arg: unknown): boolean;
16
16
  */
17
17
  export declare function isObject(val: any): val is Record<any, any>;
18
18
  /**
19
- * @author gx12358 2539306317@qq.com
19
+ * @author gx12358 gx12358@gmail.com
20
20
  * @description 判断是否是字符串
21
21
  * @param value
22
22
  * @returns {boolean}
23
23
  */
24
- export declare function isString(value: unknown): boolean;
25
- export declare function isFunction(func: any): boolean;
24
+ export declare function isString(value: unknown): value is string;
25
+ export declare function isFunction(func: unknown): func is (...args: any[]) => any;
26
+ export declare function isJSONStr(str: any): boolean;
27
+ export declare function isMobile(): boolean;
28
+ export declare function isTablet(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-utils",
3
- "version": "0.2.0-beta.6",
3
+ "version": "0.2.0-beta.61",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",
@@ -13,52 +13,24 @@
13
13
  "files": [
14
14
  "dist"
15
15
  ],
16
+ "type": "module",
16
17
  "types": "./dist",
17
- "main": "./dist/pro-utils.umd.js",
18
- "module": "./dist/pro-utils.mjs",
18
+ "main": "./dist/pro-utils.umd.cjs",
19
+ "module": "./dist/pro-utils.js",
19
20
  "exports": {
20
21
  ".": {
21
- "import": "./dist/pro-utils.mjs",
22
- "require": "./dist/pro-utils.umd.js"
22
+ "import": "./dist/pro-utils.js",
23
+ "require": "./dist/pro-utils.umd.cjs"
23
24
  }
24
25
  },
25
- "dependencies": {
26
- "lodash-es": "^4.17.21",
27
- "vue": "^3.2.45",
28
- "vue-types": "^4.1.1"
29
- },
30
26
  "devDependencies": {
31
- "@shared/vite-plugin-less-copy": "workspace:^0.0.0",
32
- "@rollup/plugin-typescript": "^8.3.0",
33
- "@rushstack/eslint-patch": "^1.1.0",
34
- "@types/lodash-es": "^4.17.6",
35
- "@types/jsdom": "^16.2.14",
36
- "@types/node": "^16.11.26",
37
- "@vitejs/plugin-vue": "^4.2.3",
38
- "@vitejs/plugin-vue-jsx": "^3.0.1",
39
- "@vue/eslint-config-prettier": "^7.0.0",
40
- "@vue/eslint-config-typescript": "^10.0.0",
41
- "@vue/tsconfig": "^0.1.3",
42
- "eslint": "^8.13.0",
43
- "eslint-plugin-prettier": "^4.0.0",
44
- "eslint-plugin-vue": "^8.6.0",
45
- "jsdom": "^19.0.0",
46
- "less": "^4.1.2",
47
- "postcss": "^8.4.12",
48
- "postcss-html": "^1.4.1",
49
- "postcss-less": "^6.0.0",
50
- "prettier": "^2.6.2",
51
- "rollup": "^2.70.2",
52
- "stylelint": "^14.7.1",
53
- "stylelint-config-prettier": "^9.0.3",
54
- "stylelint-config-recommended": "^7.0.0",
55
- "stylelint-config-recommended-vue": "^1.4.0",
56
- "stylelint-config-standard": "^25.0.0",
57
- "stylelint-order": "^5.0.0",
58
- "typescript": "^4.6.4",
59
- "vite": "^4.3.8",
60
- "vue-eslint-parser": "^9.0.3",
61
- "vue-tsc": "^1.0.24"
27
+ "typescript": "^5.3.3"
28
+ },
29
+ "peerDependencies": {
30
+ "vue": ">=3.0.0"
62
31
  },
63
- "description": "Gx Design"
32
+ "description": "Gx Design Pro Utils",
33
+ "authors": [
34
+ "gx12358 <gx12358@gmail.com> (https://github.com/gx12358)"
35
+ ]
64
36
  }