@gx-design-vue/pro-utils 0.2.0-beta.30 → 0.2.0-beta.31

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/pro-utils.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { isVNode as T } from "vue";
2
2
  const y = typeof window > "u";
3
3
  /**
4
- * @vue/shared v3.5.5
4
+ * @vue/shared v3.5.8
5
5
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
6
6
  * @license MIT
7
7
  **/
@@ -59,7 +59,7 @@ function O(e) {
59
59
  function Q(e) {
60
60
  return typeof e == "number";
61
61
  }
62
- function g(e) {
62
+ function d(e) {
63
63
  return typeof Array.isArray > "u" ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
64
64
  }
65
65
  function w(e) {
@@ -78,7 +78,7 @@ function P(...e) {
78
78
  if (n) {
79
79
  if (B(n))
80
80
  t.push(n);
81
- else if (g(n))
81
+ else if (d(n))
82
82
  for (let i = 0; i < n.length; i++) {
83
83
  const o = P(n[i]);
84
84
  o && t.push(o);
@@ -251,9 +251,9 @@ function z(e) {
251
251
  }
252
252
  const H = (e) => e.length === 1 && z(e == null ? void 0 : e[0]);
253
253
  function oe(e) {
254
- if (e && g(e)) {
255
- const t = H(e) ? g(e[0].children) ? e[0].children : [] : e;
256
- return g(t) ? t : [];
254
+ if (e && d(e)) {
255
+ const t = H(e) ? d(e[0].children) ? e[0].children : [] : e;
256
+ return d(t) ? t : [];
257
257
  }
258
258
  return e || [];
259
259
  }
@@ -392,7 +392,7 @@ function ye(e = []) {
392
392
  function q(e, t = "children") {
393
393
  let r = [];
394
394
  return e.forEach((n) => {
395
- r.push(n), n[t] && n[t].length > 0 && (r = r.concat(q(n[t])));
395
+ r.push(n), d(n[t]) && n[t].length > 0 && (r = r.concat(q(n[t])));
396
396
  }), r;
397
397
  }
398
398
  function xe(e, t, r, n, i) {
@@ -440,7 +440,7 @@ function A(e = "") {
440
440
  const t = e.lastIndexOf(".");
441
441
  return t > 0 ? `${e.substring(t).split("?")[0]}`.split(".")[1] : "";
442
442
  }
443
- function m(e, t) {
443
+ function g(e, t) {
444
444
  if (t)
445
445
  return t;
446
446
  if (!e || e === "data:")
@@ -476,7 +476,7 @@ function J(e) {
476
476
  async function Re(e) {
477
477
  const { url: t = "", currentTime: r, videoSuffix: n = "", vidoeAllowPlay: i = !1 } = e;
478
478
  let o = "", c = n, u = "1", f;
479
- return t instanceof File ? (o = URL.createObjectURL(t), c = A(t.name), u = m(t.name)) : t instanceof Blob ? (o = URL.createObjectURL(t), u = m(t)) : R(t) ? (o = t, u = m(t)) : (t.includes("https") || t.includes("http")) && (o = t, c = A(t), u = m(t)), (c ? p.videoAllowType.includes(c.toLowerCase()) : !1) ? i ? E(o, r) : (f = await J({
479
+ return t instanceof File ? (o = URL.createObjectURL(t), c = A(t.name), u = g(t.name)) : t instanceof Blob ? (o = URL.createObjectURL(t), u = g(t)) : R(t) ? (o = t, u = g(t)) : (t.includes("https") || t.includes("http")) && (o = t, c = A(t), u = g(t)), (c ? p.videoAllowType.includes(c.toLowerCase()) : !1) ? i ? E(o, r) : (f = await J({
480
480
  url: o,
481
481
  fileType: u
482
482
  }), f.play ? E(o, r) : new Promise((s) => {
@@ -496,8 +496,8 @@ async function E(e, t = 0) {
496
496
  const o = (n == null ? void 0 : n.duration) || 0;
497
497
  for (; t < o; ) {
498
498
  n && (n.currentTime = t), await new Promise((F) => i = F);
499
- const c = document.createElement("canvas"), u = 0.8, f = c.getContext("2d"), d = (n == null ? void 0 : n.videoWidth) || 0 * u, s = (n == null ? void 0 : n.videoHeight) || 0 * u, l = 0;
500
- c.width = (n == null ? void 0 : n.videoWidth) || 0 * u, c.height = (n == null ? void 0 : n.videoHeight) || 0 * u, f.drawImage(n, 0, 0, d + l, s + l), n = null, r(d === 0 || s === 0 ? "" : c.toDataURL("image/png", 1));
499
+ const c = document.createElement("canvas"), u = 0.8, f = c.getContext("2d"), m = (n == null ? void 0 : n.videoWidth) || 0 * u, s = (n == null ? void 0 : n.videoHeight) || 0 * u, l = 0;
500
+ c.width = (n == null ? void 0 : n.videoWidth) || 0 * u, c.height = (n == null ? void 0 : n.videoHeight) || 0 * u, f.drawImage(n, 0, 0, m + l, s + l), n = null, r(m === 0 || s === 0 ? "" : c.toDataURL("image/png", 1));
501
501
  }
502
502
  });
503
503
  });
@@ -521,7 +521,7 @@ function Fe() {
521
521
  export {
522
522
  pe as arrayRepeat,
523
523
  be as blobToDataURL,
524
- m as checkFileType,
524
+ g as checkFileType,
525
525
  P as classNames,
526
526
  ge as compareArray,
527
527
  Ae as dataURLtoBlob,
@@ -552,7 +552,7 @@ export {
552
552
  le as handleShowIndex,
553
553
  we as hanndleField,
554
554
  j as is,
555
- g as isArray,
555
+ d as isArray,
556
556
  R as isBase64,
557
557
  O as isBoolean,
558
558
  ne as isBrowser,
@@ -1,5 +1,5 @@
1
- (function(c,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(c=typeof globalThis<"u"?globalThis:c||self,g(c.PorUtils={},c.vue))})(this,function(c,g){"use strict";const m=typeof window>"u";/**
2
- * @vue/shared v3.5.5
1
+ (function(c,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(c=typeof globalThis<"u"?globalThis:c||self,m(c.PorUtils={},c.vue))})(this,function(c,m){"use strict";const h=typeof window>"u";/**
2
+ * @vue/shared v3.5.8
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
- **/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const z=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},k=/-(\w)/g,q=z(e=>e.replace(k,(n,i)=>i?i.toUpperCase():"")),T=function(e,n){var i;if(m||!e||!n)return"";n=q(n),n==="float"&&(n="cssFloat");try{const t=e.style[n];if(t)return t;const r=(i=document==null?void 0:document.defaultView)==null?void 0:i.getComputedStyle(e,"");return r?r[n]:""}catch{return e.style[n]}},U=(e,n)=>m?void 0:(n==null?T(e,"overflow"):n?T(e,"overflow-y"):T(e,"overflow-x")).match(/(scroll|auto|overlay)/),H=(e,n)=>{if(m)return;let i=e;for(;i;){if([window,document,document.documentElement].includes(i))return window;if(U(i,n))return i;i=i.parentNode}return i},W=(e,n)=>{if(m||!e||!n)return!1;const i=e.getBoundingClientRect();let t;return[window,document,document.documentElement,null,void 0].includes(n)?t={top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:t=n.getBoundingClientRect(),i.top<t.bottom&&i.bottom>t.top&&i.right>t.left&&i.left<t.right},_=Object.prototype.toString;function E(e,n){return _.call(e)===`[object ${n}]`}function p(e){return E(e,"Boolean")}function J(e){return typeof e=="number"}function h(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function w(e){return e!==null&&E(e,"Object")}function B(e){return typeof e=="string"||e instanceof String}function X(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function C(...e){const n=[];for(let i=0;i<e.length;i++){const t=e[i];if(t){if(B(t))n.push(t);else if(h(t))for(let r=0;r<t.length;r++){const o=C(t[r]);o&&n.push(o)}else if(w(t))for(const r in t)t[r]&&n.push(r)}}return n.filter(i=>i).join(" ")}let Y=0;const s={};function v(e,n=1){const i=Y++;let t=n;function r(){t-=1,t<=0?(e(),delete s[i]):s[i]=requestAnimationFrame(r)}return s[i]=requestAnimationFrame(r),i}v.cancel=function(n){n!==void 0&&(cancelAnimationFrame(s[n]),delete s[n])},v.ids=s;function j(e){return e!=null&&e===e.window}function D(e,n){var r;if(typeof window>"u")return 0;const i=n?"scrollTop":"scrollLeft";let t=0;return j(e)?t=e[n?"pageYOffset":"pageXOffset"]:e instanceof Document?t=e.documentElement[i]:e&&(t=e[i]),e&&!j(e)&&typeof t!="number"&&(t=(r=(e.ownerDocument||e).documentElement)==null?void 0:r[i]),t}function G(e,n,i,t){const r=i-n;return e/=t/2,e<1?r/2*e*e*e+n:r/2*((e-=2)*e*e+2)+n}function Q(e,n={}){const{getContainer:i=()=>window,callback:t,duration:r=450}=n,o=i(),u=D(o,!0),f=Date.now(),l=()=>{const a=Date.now()-f,d=G(a>r?r:a,u,e,r);j(o)?o.scrollTo(window.pageXOffset,d):o instanceof HTMLDocument||o.constructor.name==="HTMLDocument"?o.documentElement.scrollTop=d:o.scrollTop=d,a<r?v(l):typeof t=="function"&&t()};v(l)}function Z(e){let n;const i=r=>()=>{n=null,e(...r)},t=(...r)=>{n==null&&(n=requestAnimationFrame(i(r)))};return t.cancel=()=>cancelAnimationFrame(n),t}const y={videoAllowType:["mp4","webm","ogg"],audioAllowType:["mp3"],imageType:["bmp","png","gif","jpg","jpeg","psd","tif"],videoType:["mp4","swf","rmvb","avi","flv","mpg","rm","mov","asf","3gp","mkv","ts","f4v","webm","m4v","3g2","m3u8"],audioType:["mp3","mpeg","aac","wav","wma","mp2","flac","midi","ra","ape","aac","cda"]},K=(...e)=>{const n={},i=e.length;let t,r=0;for(;r<i;r+=1)for(t in e[r])e[r].hasOwnProperty(t)&&(typeof n[t]=="object"&&typeof e[r][t]=="object"&&n[t]!==void 0&&n[t]!==null&&!Array.isArray(n[t])&&!Array.isArray(e[r][t])?n[t]={...n[t],...e[r][t]}:n[t]=e[r][t]);return n};function A(e,n,i,t){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;let r,o,u;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!A(e[o],n[o],i,t))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!A(o[1],n.get(o[0]),i,t))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString&&e.toString)return e.toString()===n.toString();if(u=Object.keys(e),r=u.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,u[o]))return!1;for(o=r;o--!==0;){const f=u[o];if(!(i!=null&&i.includes(f))&&!(f==="_owner"&&e.$$typeof)&&!A(e[f],n[f],i,t))return t&&console.log(f),!1}return!0}return e!==e&&n!==n}const ee=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,ne=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!ee,te=e=>{if(e&&e!==!0)return e},ie=e=>{const n={};if(Object.keys(e||{}).forEach(i=>{e[i]!==void 0&&(n[i]=e[i])}),!(Object.keys(n).length<1))return n};function I(e){return g.isVNode(e)?String(e.type)==="template"||String(e.type)===String(Symbol("Comment"))||String(e.type)===String(Symbol("Fragment"))||String(e.type)===String(Symbol("v-fgt"))||String(e.type)===String(Symbol("v-cmt"))||String(e.type)===String(Symbol()):!0}const P=e=>e.length===1&&I(e==null?void 0:e[0]);function re(e){if(e&&h(e)){const n=P(e)?h(e[0].children)?e[0].children:[]:e;return h(n)?n:[]}return e||[]}function oe(e,n,i="default"){return n[i]===!1?!1:p(n[i])&&n[i]?(e==null?void 0:e[i])||n[i]:n[i]||e[i]}function x(e,n,i="default"){var t,r;return n[i]===!1?!1:p(n[i])&&n[i]?((t=e==null?void 0:e[i])==null?void 0:t.call(e))||n[i]:n[i]||((r=e[i])==null?void 0:r.call(e))}function ce(e,n,i){const t={};return e.forEach(r=>{const o=x(n,i,r);(p(o)||o)&&(t[r]=o)}),t}const ue=({suffixCls:e,customizePrefixCls:n,isPor:i,className:t})=>{const r=t||(i?"gx-pro":"gx");return n||(e?`${r}-${e}`:r)},fe=(e,n)=>e?Array.isArray(e)?e.join("-"):e.toString():`${n}`;function le(e,{align:n,showIndex:i}){const t=O(e);if(i&&e.length&&e.every(r=>r.dataIndex!=="sortIndex")){const r=e[0];t.unshift({title:"序号",align:n,fixed:r.fixed,width:60,uuid:N().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else t.filter(r=>r.dataIndex!=="sortIndex");return t}function ae(e,...n){return typeof e=="function"?e(...n):e}function O(e){return JSON.parse(JSON.stringify(e))}function se(e,n){if(w(e)){const{pageSize:i=10,total:t=0}=e;let{current:r=1}=e;return t-n<=i*(r-1)&&(r=r-1),r===0?1:r}return 1}function de(e=[],n,i="children"){function t(r,o){return o.map((u,f)=>{const l=`${r}-${f+1}`;return u[i]&&(u[i]=t(l,u[i])),u.sortIndex=l,u})}return O(e).map((r,o)=>{let u=o;const f=w(n)&&n.current||1,l=w(n)&&n.pageSize||10;return u=f?(f-1)*l+(o+1):o+1,r[i]&&(r[i]=t(`${u}`,r[i])),r.sortIndex=u,r})}function ge(e,n,i,t){const r=e[i],o=n[i];let u=0;return r<o?u=t===0?-1:0:r>o&&(u=t===0?0:-1),u}function me(e){let n=O(e);const i=new Set(n);return n=Array.from(i),n}function he(e,n){const i=["null","undefined"];let t=!0;return e===0?t=!0:i.includes(e)?t=!1:e||(t=!1),t?{value:e,success:t}:{value:n===""?n:n||"-",success:t}}function we(e){let n="";if(e>-1){const i=Math.floor(e/3600),t=Math.floor(e/60)%60,r=Number.parseInt(String(e%60));i<10?n="0"+i+":":n=i+":",t<10&&(n+="0"),n+=t+":",r<10&&(n+="0"),n+=r}return n.split(":")[0]==="00"?`${n.split(":")[1]}:${n.split(":")[2]}`:n}function N(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return{uuid(n,i){const t=e,r=[],o=i||t.length;let u,f;if(n)for(u=0;u<n;u+=1)r[u]=t[Number.parseInt(String(Math.random()*o))];else for(r[8]="-",r[13]="-",r[18]="-",r[23]="-",r[14]="4",u=0;u<36;u+=1)r[u]||(f=Math.random()*16,r[u]=t[u===19?f&&3||8:f]);return r.join("")},uuidFast(){const n=e,i=Array.from({length:36});let t=0,r,o;for(o=0;o<36;o+=1)o===8||o===13||o===18||o===23?i[o]="-":o===14?i[o]="4":(t<=2&&(t=33554432+Math.random()*16777216||0),r=t&&15,t=t>4,i[o]=n[o===19?r&&3||8:r]);return i.join("")},uuidString(){return this.uuidFast().replace(new RegExp("-","g"),"")},uuidCompact(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const i=Math.random()*16||0;return(n==="x"?i:i&&3||8).toString(16)})}}}function ye(e=[]){let n=0;function i(t=[],r){t.forEach(o=>{o.floor=r,r>n&&(n=r),o.children&&o.children.length>0&&i(o.children,r+1)})}return i(e,1),n}function M(e,n="children"){let i=[];return e.forEach(t=>{i.push(t),t[n]&&t[n].length>0&&(i=i.concat(M(t[n])))}),i}function Se(e,n,i,t,r){n=n||"id",i=i||"parentId",t=t||"children",r=r||0;const o=JSON.parse(JSON.stringify(e));return o.filter(u=>{const f=o.filter(l=>u[n]===l[i||"parentId"]);return f.length>0?u[t||"children"]=f:delete u[t||"children"],u[i||"parentId"]===r})}function pe(e){return URL.createObjectURL(e)}function ve(e){return new Promise((n,i)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>n(t.result),t.onerror=r=>i(r)})}function Ae(e){const n=e.split(","),i=n[0].match(/:(.*?);/)[1],t=atob(n[1]);let r=t.length;const o=new Uint8Array(r);for(;r--;)o[r]=t.charCodeAt(r);return new Blob([o],{type:i})}function Oe(e,n){const i=e.split(","),t=i[0].match(/:(.*?);/)[1],r=atob(i[1]);let o=r.length;const u=new Uint8Array(o);for(;o--;)u[o]=r.charCodeAt(o);return new File([u],n,{type:t})}function be(e,n,i){return new window.File([e],n,{type:i})}function V(e=""){const n=e.indexOf("?");return n>0?`${e.substring(0,n)}`:e}function b(e=""){e=V(e);const n=e.lastIndexOf(".");return n>0?`${e.substring(n).split("?")[0]}`.split(".")[1]:""}function S(e,n){if(n)return n;if(!e||e==="data:")return"4";let i="4";return R(e)?e.includes("data:image/")?i="png":e.includes("data:video/")?i="mp4":e.includes("data:audio/")&&(i="mp3"):e instanceof Blob?(e=String(e),e.includes("image")?i="png":e.includes("video")?i="mp4":e.includes("audio")&&(i="mp3")):i=b(e).toLowerCase(),y.imageType.includes(i)?"1":y.videoType.includes(i)?"3":y.audioType.includes(i)?"2":"4"}function $(e){const{url:n="",fileType:i="1"}=e;let t="";return n instanceof File?t=URL.createObjectURL(n):R(n)?t=n:n instanceof Blob?t=URL.createObjectURL(n):(n.includes("https")||n.includes("http"))&&(t=n),new Promise(r=>{let o;i==="1"?(o=document.createElement("img"),o.src=t):i==="2"?(o=document.createElement("audio"),o.src=t):i==="3"&&(o=document.createElement("video"),o.src=t),i==="1"?o.onload=function(){r({play:!0,width:o.width||0,height:o.height||0}),o=null}:o.oncanplay=function(){r({play:!0,duration:o.duration,width:(o==null?void 0:o.videoWidth)||0,height:(o==null?void 0:o.videoHeight)||0}),o=null},o.onerror=function(){r({play:!1}),o=null}})}async function Re(e){const{url:n="",currentTime:i,videoSuffix:t="",vidoeAllowPlay:r=!1}=e;let o="",u=t,f="1",l;return n instanceof File?(o=URL.createObjectURL(n),u=b(n.name),f=S(n.name)):n instanceof Blob?(o=URL.createObjectURL(n),f=S(n)):R(n)?(o=n,f=S(n)):(n.includes("https")||n.includes("http"))&&(o=n,u=b(n),f=S(n)),(u?y.videoAllowType.includes(u.toLowerCase()):!1)?r?L(o,i):(l=await $({url:o,fileType:f}),l.play?L(o,i):new Promise(a=>{a("")})):new Promise(a=>{a("")})}async function L(e,n=0){return new Promise(i=>{let t=document.createElement("video");t.controls=!0,t.muted=!0,t.setAttribute("src",e),t.setAttribute("muted",String(!0)),t.setAttribute("crossorigin","anonymous"),t.setAttribute("autoplay",String(!0)),t&&t.addEventListener("loadeddata",async function(){let r;t==null||t.addEventListener("seeked",async function(){r&&r()});const o=(t==null?void 0:t.duration)||0;for(;n<o;){t&&(t.currentTime=n),await new Promise(je=>r=je);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),F=(t==null?void 0:t.videoWidth)||0*f,a=(t==null?void 0:t.videoHeight)||0*f,d=0;u.width=(t==null?void 0:t.videoWidth)||0*f,u.height=(t==null?void 0:t.videoHeight)||0*f,l.drawImage(t,0,0,F+d,a+d),t=null,i(F===0||a===0?"":u.toDataURL("image/png",1))}})})}function R(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(i=>e.includes(i)))}function Fe(e,n,i,t=!1){e&&n&&i&&e.addEventListener(n,i,t)}function Te(e,n,i,t=!1){e&&n&&i&&e.removeEventListener(n,i,t)}function Ee(){return/windows|win32/i.test(navigator.userAgent)}c.arrayRepeat=me,c.blobToDataURL=be,c.checkFileType=S,c.classNames=C,c.compareArray=ge,c.dataURLtoBlob=Ae,c.dataURLtoFile=Oe,c.deepCopy=O,c.formatDuraton=we,c.genColumnKey=fe,c.generateVidoePicture=L,c.getBase64=ve,c.getBlobUrl=pe,c.getFileSuffix=b,c.getLevelData=M,c.getMaxFloor=ye,c.getMediaInfos=$,c.getPrefixCls=ue,c.getRandomNumber=N,c.getRealVNode=re,c.getScroll=D,c.getScrollContainer=H,c.getSlot=oe,c.getSlotVNode=x,c.getSlotsProps=ce,c.getSortIndex=de,c.getVideoCoverPicture=Re,c.getVideoFileUrl=V,c.globalConfig=y,c.handleCurrentPage=se,c.handleShowIndex=le,c.hanndleField=he,c.is=E,c.isArray=h,c.isBase64=R,c.isBoolean=p,c.isBrowser=ne,c.isDeepEqualReact=A,c.isEmptySlot=I,c.isFunction=X,c.isInContainer=W,c.isNumber=J,c.isObject=w,c.isScroll=U,c.isServer=m,c.isSlotFragment=P,c.isString=B,c.isWindowsOs=Ee,c.merge=K,c.off=Te,c.omitBoolean=te,c.omitUndefined=ie,c.on=Fe,c.runFunction=ae,c.scrollTo=Q,c.throttleByAnimationFrame=Z,c.treeData=Se,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
5
+ **/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const z=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},k=/-(\w)/g,q=z(e=>e.replace(k,(n,i)=>i?i.toUpperCase():"")),T=function(e,n){var i;if(h||!e||!n)return"";n=q(n),n==="float"&&(n="cssFloat");try{const t=e.style[n];if(t)return t;const r=(i=document==null?void 0:document.defaultView)==null?void 0:i.getComputedStyle(e,"");return r?r[n]:""}catch{return e.style[n]}},U=(e,n)=>h?void 0:(n==null?T(e,"overflow"):n?T(e,"overflow-y"):T(e,"overflow-x")).match(/(scroll|auto|overlay)/),H=(e,n)=>{if(h)return;let i=e;for(;i;){if([window,document,document.documentElement].includes(i))return window;if(U(i,n))return i;i=i.parentNode}return i},W=(e,n)=>{if(h||!e||!n)return!1;const i=e.getBoundingClientRect();let t;return[window,document,document.documentElement,null,void 0].includes(n)?t={top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:t=n.getBoundingClientRect(),i.top<t.bottom&&i.bottom>t.top&&i.right>t.left&&i.left<t.right},_=Object.prototype.toString;function E(e,n){return _.call(e)===`[object ${n}]`}function p(e){return E(e,"Boolean")}function J(e){return typeof e=="number"}function s(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function w(e){return e!==null&&E(e,"Object")}function B(e){return typeof e=="string"||e instanceof String}function X(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function C(...e){const n=[];for(let i=0;i<e.length;i++){const t=e[i];if(t){if(B(t))n.push(t);else if(s(t))for(let r=0;r<t.length;r++){const o=C(t[r]);o&&n.push(o)}else if(w(t))for(const r in t)t[r]&&n.push(r)}}return n.filter(i=>i).join(" ")}let Y=0;const d={};function v(e,n=1){const i=Y++;let t=n;function r(){t-=1,t<=0?(e(),delete d[i]):d[i]=requestAnimationFrame(r)}return d[i]=requestAnimationFrame(r),i}v.cancel=function(n){n!==void 0&&(cancelAnimationFrame(d[n]),delete d[n])},v.ids=d;function j(e){return e!=null&&e===e.window}function D(e,n){var r;if(typeof window>"u")return 0;const i=n?"scrollTop":"scrollLeft";let t=0;return j(e)?t=e[n?"pageYOffset":"pageXOffset"]:e instanceof Document?t=e.documentElement[i]:e&&(t=e[i]),e&&!j(e)&&typeof t!="number"&&(t=(r=(e.ownerDocument||e).documentElement)==null?void 0:r[i]),t}function G(e,n,i,t){const r=i-n;return e/=t/2,e<1?r/2*e*e*e+n:r/2*((e-=2)*e*e+2)+n}function Q(e,n={}){const{getContainer:i=()=>window,callback:t,duration:r=450}=n,o=i(),u=D(o,!0),f=Date.now(),l=()=>{const a=Date.now()-f,g=G(a>r?r:a,u,e,r);j(o)?o.scrollTo(window.pageXOffset,g):o instanceof HTMLDocument||o.constructor.name==="HTMLDocument"?o.documentElement.scrollTop=g:o.scrollTop=g,a<r?v(l):typeof t=="function"&&t()};v(l)}function Z(e){let n;const i=r=>()=>{n=null,e(...r)},t=(...r)=>{n==null&&(n=requestAnimationFrame(i(r)))};return t.cancel=()=>cancelAnimationFrame(n),t}const y={videoAllowType:["mp4","webm","ogg"],audioAllowType:["mp3"],imageType:["bmp","png","gif","jpg","jpeg","psd","tif"],videoType:["mp4","swf","rmvb","avi","flv","mpg","rm","mov","asf","3gp","mkv","ts","f4v","webm","m4v","3g2","m3u8"],audioType:["mp3","mpeg","aac","wav","wma","mp2","flac","midi","ra","ape","aac","cda"]},K=(...e)=>{const n={},i=e.length;let t,r=0;for(;r<i;r+=1)for(t in e[r])e[r].hasOwnProperty(t)&&(typeof n[t]=="object"&&typeof e[r][t]=="object"&&n[t]!==void 0&&n[t]!==null&&!Array.isArray(n[t])&&!Array.isArray(e[r][t])?n[t]={...n[t],...e[r][t]}:n[t]=e[r][t]);return n};function A(e,n,i,t){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;let r,o,u;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!A(e[o],n[o],i,t))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!A(o[1],n.get(o[0]),i,t))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString&&e.toString)return e.toString()===n.toString();if(u=Object.keys(e),r=u.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,u[o]))return!1;for(o=r;o--!==0;){const f=u[o];if(!(i!=null&&i.includes(f))&&!(f==="_owner"&&e.$$typeof)&&!A(e[f],n[f],i,t))return t&&console.log(f),!1}return!0}return e!==e&&n!==n}const ee=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,ne=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!ee,te=e=>{if(e&&e!==!0)return e},ie=e=>{const n={};if(Object.keys(e||{}).forEach(i=>{e[i]!==void 0&&(n[i]=e[i])}),!(Object.keys(n).length<1))return n};function I(e){return m.isVNode(e)?String(e.type)==="template"||String(e.type)===String(Symbol("Comment"))||String(e.type)===String(Symbol("Fragment"))||String(e.type)===String(Symbol("v-fgt"))||String(e.type)===String(Symbol("v-cmt"))||String(e.type)===String(Symbol()):!0}const P=e=>e.length===1&&I(e==null?void 0:e[0]);function re(e){if(e&&s(e)){const n=P(e)?s(e[0].children)?e[0].children:[]:e;return s(n)?n:[]}return e||[]}function oe(e,n,i="default"){return n[i]===!1?!1:p(n[i])&&n[i]?(e==null?void 0:e[i])||n[i]:n[i]||e[i]}function x(e,n,i="default"){var t,r;return n[i]===!1?!1:p(n[i])&&n[i]?((t=e==null?void 0:e[i])==null?void 0:t.call(e))||n[i]:n[i]||((r=e[i])==null?void 0:r.call(e))}function ce(e,n,i){const t={};return e.forEach(r=>{const o=x(n,i,r);(p(o)||o)&&(t[r]=o)}),t}const ue=({suffixCls:e,customizePrefixCls:n,isPor:i,className:t})=>{const r=t||(i?"gx-pro":"gx");return n||(e?`${r}-${e}`:r)},fe=(e,n)=>e?Array.isArray(e)?e.join("-"):e.toString():`${n}`;function le(e,{align:n,showIndex:i}){const t=O(e);if(i&&e.length&&e.every(r=>r.dataIndex!=="sortIndex")){const r=e[0];t.unshift({title:"序号",align:n,fixed:r.fixed,width:60,uuid:N().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else t.filter(r=>r.dataIndex!=="sortIndex");return t}function ae(e,...n){return typeof e=="function"?e(...n):e}function O(e){return JSON.parse(JSON.stringify(e))}function se(e,n){if(w(e)){const{pageSize:i=10,total:t=0}=e;let{current:r=1}=e;return t-n<=i*(r-1)&&(r=r-1),r===0?1:r}return 1}function de(e=[],n,i="children"){function t(r,o){return o.map((u,f)=>{const l=`${r}-${f+1}`;return u[i]&&(u[i]=t(l,u[i])),u.sortIndex=l,u})}return O(e).map((r,o)=>{let u=o;const f=w(n)&&n.current||1,l=w(n)&&n.pageSize||10;return u=f?(f-1)*l+(o+1):o+1,r[i]&&(r[i]=t(`${u}`,r[i])),r.sortIndex=u,r})}function ge(e,n,i,t){const r=e[i],o=n[i];let u=0;return r<o?u=t===0?-1:0:r>o&&(u=t===0?0:-1),u}function me(e){let n=O(e);const i=new Set(n);return n=Array.from(i),n}function he(e,n){const i=["null","undefined"];let t=!0;return e===0?t=!0:i.includes(e)?t=!1:e||(t=!1),t?{value:e,success:t}:{value:n===""?n:n||"-",success:t}}function we(e){let n="";if(e>-1){const i=Math.floor(e/3600),t=Math.floor(e/60)%60,r=Number.parseInt(String(e%60));i<10?n="0"+i+":":n=i+":",t<10&&(n+="0"),n+=t+":",r<10&&(n+="0"),n+=r}return n.split(":")[0]==="00"?`${n.split(":")[1]}:${n.split(":")[2]}`:n}function N(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return{uuid(n,i){const t=e,r=[],o=i||t.length;let u,f;if(n)for(u=0;u<n;u+=1)r[u]=t[Number.parseInt(String(Math.random()*o))];else for(r[8]="-",r[13]="-",r[18]="-",r[23]="-",r[14]="4",u=0;u<36;u+=1)r[u]||(f=Math.random()*16,r[u]=t[u===19?f&&3||8:f]);return r.join("")},uuidFast(){const n=e,i=Array.from({length:36});let t=0,r,o;for(o=0;o<36;o+=1)o===8||o===13||o===18||o===23?i[o]="-":o===14?i[o]="4":(t<=2&&(t=33554432+Math.random()*16777216||0),r=t&&15,t=t>4,i[o]=n[o===19?r&&3||8:r]);return i.join("")},uuidString(){return this.uuidFast().replace(new RegExp("-","g"),"")},uuidCompact(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const i=Math.random()*16||0;return(n==="x"?i:i&&3||8).toString(16)})}}}function ye(e=[]){let n=0;function i(t=[],r){t.forEach(o=>{o.floor=r,r>n&&(n=r),o.children&&o.children.length>0&&i(o.children,r+1)})}return i(e,1),n}function M(e,n="children"){let i=[];return e.forEach(t=>{i.push(t),s(t[n])&&t[n].length>0&&(i=i.concat(M(t[n])))}),i}function Se(e,n,i,t,r){n=n||"id",i=i||"parentId",t=t||"children",r=r||0;const o=JSON.parse(JSON.stringify(e));return o.filter(u=>{const f=o.filter(l=>u[n]===l[i||"parentId"]);return f.length>0?u[t||"children"]=f:delete u[t||"children"],u[i||"parentId"]===r})}function pe(e){return URL.createObjectURL(e)}function ve(e){return new Promise((n,i)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>n(t.result),t.onerror=r=>i(r)})}function Ae(e){const n=e.split(","),i=n[0].match(/:(.*?);/)[1],t=atob(n[1]);let r=t.length;const o=new Uint8Array(r);for(;r--;)o[r]=t.charCodeAt(r);return new Blob([o],{type:i})}function Oe(e,n){const i=e.split(","),t=i[0].match(/:(.*?);/)[1],r=atob(i[1]);let o=r.length;const u=new Uint8Array(o);for(;o--;)u[o]=r.charCodeAt(o);return new File([u],n,{type:t})}function be(e,n,i){return new window.File([e],n,{type:i})}function V(e=""){const n=e.indexOf("?");return n>0?`${e.substring(0,n)}`:e}function b(e=""){e=V(e);const n=e.lastIndexOf(".");return n>0?`${e.substring(n).split("?")[0]}`.split(".")[1]:""}function S(e,n){if(n)return n;if(!e||e==="data:")return"4";let i="4";return R(e)?e.includes("data:image/")?i="png":e.includes("data:video/")?i="mp4":e.includes("data:audio/")&&(i="mp3"):e instanceof Blob?(e=String(e),e.includes("image")?i="png":e.includes("video")?i="mp4":e.includes("audio")&&(i="mp3")):i=b(e).toLowerCase(),y.imageType.includes(i)?"1":y.videoType.includes(i)?"3":y.audioType.includes(i)?"2":"4"}function $(e){const{url:n="",fileType:i="1"}=e;let t="";return n instanceof File?t=URL.createObjectURL(n):R(n)?t=n:n instanceof Blob?t=URL.createObjectURL(n):(n.includes("https")||n.includes("http"))&&(t=n),new Promise(r=>{let o;i==="1"?(o=document.createElement("img"),o.src=t):i==="2"?(o=document.createElement("audio"),o.src=t):i==="3"&&(o=document.createElement("video"),o.src=t),i==="1"?o.onload=function(){r({play:!0,width:o.width||0,height:o.height||0}),o=null}:o.oncanplay=function(){r({play:!0,duration:o.duration,width:(o==null?void 0:o.videoWidth)||0,height:(o==null?void 0:o.videoHeight)||0}),o=null},o.onerror=function(){r({play:!1}),o=null}})}async function Re(e){const{url:n="",currentTime:i,videoSuffix:t="",vidoeAllowPlay:r=!1}=e;let o="",u=t,f="1",l;return n instanceof File?(o=URL.createObjectURL(n),u=b(n.name),f=S(n.name)):n instanceof Blob?(o=URL.createObjectURL(n),f=S(n)):R(n)?(o=n,f=S(n)):(n.includes("https")||n.includes("http"))&&(o=n,u=b(n),f=S(n)),(u?y.videoAllowType.includes(u.toLowerCase()):!1)?r?L(o,i):(l=await $({url:o,fileType:f}),l.play?L(o,i):new Promise(a=>{a("")})):new Promise(a=>{a("")})}async function L(e,n=0){return new Promise(i=>{let t=document.createElement("video");t.controls=!0,t.muted=!0,t.setAttribute("src",e),t.setAttribute("muted",String(!0)),t.setAttribute("crossorigin","anonymous"),t.setAttribute("autoplay",String(!0)),t&&t.addEventListener("loadeddata",async function(){let r;t==null||t.addEventListener("seeked",async function(){r&&r()});const o=(t==null?void 0:t.duration)||0;for(;n<o;){t&&(t.currentTime=n),await new Promise(je=>r=je);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),F=(t==null?void 0:t.videoWidth)||0*f,a=(t==null?void 0:t.videoHeight)||0*f,g=0;u.width=(t==null?void 0:t.videoWidth)||0*f,u.height=(t==null?void 0:t.videoHeight)||0*f,l.drawImage(t,0,0,F+g,a+g),t=null,i(F===0||a===0?"":u.toDataURL("image/png",1))}})})}function R(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(i=>e.includes(i)))}function Fe(e,n,i,t=!1){e&&n&&i&&e.addEventListener(n,i,t)}function Te(e,n,i,t=!1){e&&n&&i&&e.removeEventListener(n,i,t)}function Ee(){return/windows|win32/i.test(navigator.userAgent)}c.arrayRepeat=me,c.blobToDataURL=be,c.checkFileType=S,c.classNames=C,c.compareArray=ge,c.dataURLtoBlob=Ae,c.dataURLtoFile=Oe,c.deepCopy=O,c.formatDuraton=we,c.genColumnKey=fe,c.generateVidoePicture=L,c.getBase64=ve,c.getBlobUrl=pe,c.getFileSuffix=b,c.getLevelData=M,c.getMaxFloor=ye,c.getMediaInfos=$,c.getPrefixCls=ue,c.getRandomNumber=N,c.getRealVNode=re,c.getScroll=D,c.getScrollContainer=H,c.getSlot=oe,c.getSlotVNode=x,c.getSlotsProps=ce,c.getSortIndex=de,c.getVideoCoverPicture=Re,c.getVideoFileUrl=V,c.globalConfig=y,c.handleCurrentPage=se,c.handleShowIndex=le,c.hanndleField=he,c.is=E,c.isArray=s,c.isBase64=R,c.isBoolean=p,c.isBrowser=ne,c.isDeepEqualReact=A,c.isEmptySlot=I,c.isFunction=X,c.isInContainer=W,c.isNumber=J,c.isObject=w,c.isScroll=U,c.isServer=h,c.isSlotFragment=P,c.isString=B,c.isWindowsOs=Ee,c.merge=K,c.off=Te,c.omitBoolean=te,c.omitUndefined=ie,c.on=Fe,c.runFunction=ae,c.scrollTo=Q,c.throttleByAnimationFrame=Z,c.treeData=Se,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
@@ -102,7 +102,7 @@ export declare function getMaxFloor(treeData?: any[]): number;
102
102
  * @lastTime 2020/8/10
103
103
  * @description 树形转平级
104
104
  */
105
- export declare function getLevelData(data: any[], filed?: string): any[];
105
+ export declare function getLevelData<T = any>(data: T[], filed?: keyof T): any[];
106
106
  /**
107
107
  * 构造树型结构数据
108
108
  * @param {*} source 数据源
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-utils",
3
- "version": "0.2.0-beta.30",
3
+ "version": "0.2.0-beta.31",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",