@gx-design-vue/pro-utils 0.2.0-beta.14 → 0.2.0-beta.16
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.mjs +128 -129
- package/dist/pro-utils.umd.js +1 -1
- package/package.json +2 -2
package/dist/pro-utils.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { cloneDeep as T } from "lodash-es";
|
|
2
1
|
const w = typeof window > "u";
|
|
3
2
|
process.env.NODE_ENV !== "production" && Object.freeze({});
|
|
4
3
|
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
5
|
-
const
|
|
4
|
+
const T = (e) => {
|
|
6
5
|
const t = /* @__PURE__ */ Object.create(null);
|
|
7
6
|
return (r) => t[r] || (t[r] = e(r));
|
|
8
|
-
},
|
|
7
|
+
}, L = /-(\w)/g, I = T((e) => e.replace(L, (t, r) => r ? r.toUpperCase() : "")), y = function(e, t) {
|
|
9
8
|
var r;
|
|
10
9
|
if (w || !e || !t)
|
|
11
10
|
return "";
|
|
@@ -19,7 +18,7 @@ const L = (e) => {
|
|
|
19
18
|
} catch {
|
|
20
19
|
return e.style[t];
|
|
21
20
|
}
|
|
22
|
-
}, U = (e, t) => w ? void 0 : (t == null ? y(e, "overflow") : t ? y(e, "overflow-y") : y(e, "overflow-x")).match(/(scroll|auto|overlay)/),
|
|
21
|
+
}, U = (e, t) => w ? void 0 : (t == null ? y(e, "overflow") : t ? y(e, "overflow-y") : y(e, "overflow-x")).match(/(scroll|auto|overlay)/), J = (e, t) => {
|
|
23
22
|
if (w)
|
|
24
23
|
return;
|
|
25
24
|
let r = e;
|
|
@@ -31,7 +30,7 @@ const L = (e) => {
|
|
|
31
30
|
r = r.parentNode;
|
|
32
31
|
}
|
|
33
32
|
return r;
|
|
34
|
-
},
|
|
33
|
+
}, _ = (e, t) => {
|
|
35
34
|
if (w || !e || !t)
|
|
36
35
|
return !1;
|
|
37
36
|
const r = e.getBoundingClientRect();
|
|
@@ -42,38 +41,38 @@ const L = (e) => {
|
|
|
42
41
|
bottom: window.innerHeight,
|
|
43
42
|
left: 0
|
|
44
43
|
} : n = t.getBoundingClientRect(), r.top < n.bottom && r.bottom > n.top && r.right > n.left && r.left < n.right;
|
|
45
|
-
},
|
|
46
|
-
function
|
|
47
|
-
return
|
|
44
|
+
}, D = Object.prototype.toString;
|
|
45
|
+
function R(e, t) {
|
|
46
|
+
return D.call(e) === `[object ${t}]`;
|
|
48
47
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
48
|
+
function E(e) {
|
|
49
|
+
return R(e, "Boolean");
|
|
51
50
|
}
|
|
52
|
-
function
|
|
51
|
+
function X(e) {
|
|
53
52
|
return typeof e == "number";
|
|
54
53
|
}
|
|
55
|
-
function
|
|
54
|
+
function j(e) {
|
|
56
55
|
return typeof Array.isArray > "u" ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
|
|
57
56
|
}
|
|
58
57
|
function p(e) {
|
|
59
|
-
return e !== null &&
|
|
58
|
+
return e !== null && R(e, "Object");
|
|
60
59
|
}
|
|
61
|
-
function
|
|
60
|
+
function B(e) {
|
|
62
61
|
return typeof e == "string" || e instanceof String;
|
|
63
62
|
}
|
|
64
|
-
function
|
|
63
|
+
function Y(e) {
|
|
65
64
|
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
66
65
|
}
|
|
67
|
-
function
|
|
66
|
+
function C(...e) {
|
|
68
67
|
const t = [];
|
|
69
68
|
for (let r = 0; r < e.length; r++) {
|
|
70
69
|
const n = e[r];
|
|
71
70
|
if (n) {
|
|
72
|
-
if (
|
|
71
|
+
if (B(n))
|
|
73
72
|
t.push(n);
|
|
74
|
-
else if (
|
|
73
|
+
else if (j(n))
|
|
75
74
|
for (let i = 0; i < n.length; i++) {
|
|
76
|
-
const o =
|
|
75
|
+
const o = C(n[i]);
|
|
77
76
|
o && t.push(o);
|
|
78
77
|
}
|
|
79
78
|
else if (p(n))
|
|
@@ -83,10 +82,10 @@ function P(...e) {
|
|
|
83
82
|
}
|
|
84
83
|
return t.filter((r) => r).join(" ");
|
|
85
84
|
}
|
|
86
|
-
let
|
|
85
|
+
let P = 0;
|
|
87
86
|
const a = {};
|
|
88
87
|
function h(e, t = 1) {
|
|
89
|
-
const r =
|
|
88
|
+
const r = P++;
|
|
90
89
|
let n = t;
|
|
91
90
|
function i() {
|
|
92
91
|
n -= 1, n <= 0 ? (e(), delete a[r]) : a[r] = requestAnimationFrame(i);
|
|
@@ -100,7 +99,7 @@ h.ids = a;
|
|
|
100
99
|
function S(e) {
|
|
101
100
|
return e != null && e === e.window;
|
|
102
101
|
}
|
|
103
|
-
function
|
|
102
|
+
function M(e, t) {
|
|
104
103
|
var i;
|
|
105
104
|
if (typeof window > "u")
|
|
106
105
|
return 0;
|
|
@@ -108,18 +107,18 @@ function $(e, t) {
|
|
|
108
107
|
let n = 0;
|
|
109
108
|
return S(e) ? n = e[t ? "pageYOffset" : "pageXOffset"] : e instanceof Document ? n = e.documentElement[r] : e && (n = e[r]), e && !S(e) && typeof n != "number" && (n = (i = (e.ownerDocument || e).documentElement) == null ? void 0 : i[r]), n;
|
|
110
109
|
}
|
|
111
|
-
function
|
|
110
|
+
function $(e, t, r, n) {
|
|
112
111
|
const i = r - t;
|
|
113
112
|
return e /= n / 2, e < 1 ? i / 2 * e * e * e + t : i / 2 * ((e -= 2) * e * e + 2) + t;
|
|
114
113
|
}
|
|
115
|
-
function
|
|
116
|
-
const { getContainer: r = () => window, callback: n, duration: i = 450 } = t, o = r(), c =
|
|
117
|
-
const l = Date.now() - u, s =
|
|
114
|
+
function G(e, t = {}) {
|
|
115
|
+
const { getContainer: r = () => window, callback: n, duration: i = 450 } = t, o = r(), c = M(o, !0), u = Date.now(), f = () => {
|
|
116
|
+
const l = Date.now() - u, s = $(l > i ? i : l, c, e, i);
|
|
118
117
|
S(o) ? o.scrollTo(window.pageXOffset, s) : o instanceof HTMLDocument || o.constructor.name === "HTMLDocument" ? o.documentElement.scrollTop = s : o.scrollTop = s, l < i ? h(f) : typeof n == "function" && n();
|
|
119
118
|
};
|
|
120
119
|
h(f);
|
|
121
120
|
}
|
|
122
|
-
function
|
|
121
|
+
function Q(e) {
|
|
123
122
|
let t;
|
|
124
123
|
const r = (i) => () => {
|
|
125
124
|
t = null, e(...i);
|
|
@@ -128,7 +127,7 @@ function K(e) {
|
|
|
128
127
|
};
|
|
129
128
|
return n.cancel = () => cancelAnimationFrame(t), n;
|
|
130
129
|
}
|
|
131
|
-
const
|
|
130
|
+
const m = {
|
|
132
131
|
videoAllowType: [
|
|
133
132
|
"mp4",
|
|
134
133
|
"webm",
|
|
@@ -156,7 +155,7 @@ const g = {
|
|
|
156
155
|
"m3u8"
|
|
157
156
|
],
|
|
158
157
|
audioType: ["mp3", "mpeg", "aac", "wav", "wma", "mp2", "flac", "midi", "ra", "ape", "aac", "cda"]
|
|
159
|
-
},
|
|
158
|
+
}, Z = (...e) => {
|
|
160
159
|
const t = {}, r = e.length;
|
|
161
160
|
let n, i = 0;
|
|
162
161
|
for (; i < r; i += 1)
|
|
@@ -229,41 +228,41 @@ function x(e, t, r, n) {
|
|
|
229
228
|
}
|
|
230
229
|
return e !== e && t !== t;
|
|
231
230
|
}
|
|
232
|
-
const
|
|
231
|
+
const N = (
|
|
233
232
|
// @ts-ignore
|
|
234
233
|
typeof process < "u" && process.versions != null && process.versions.node != null
|
|
235
|
-
),
|
|
234
|
+
), K = () => process.env.NODE_ENV === "TEST" ? !0 : typeof window < "u" && typeof window.document < "u" && typeof window.matchMedia < "u" && !N, ee = (e) => {
|
|
236
235
|
if (e && e !== !0)
|
|
237
236
|
return e;
|
|
238
|
-
},
|
|
237
|
+
}, te = (e) => {
|
|
239
238
|
const t = {};
|
|
240
239
|
if (Object.keys(e || {}).forEach((r) => {
|
|
241
240
|
e[r] !== void 0 && (t[r] = e[r]);
|
|
242
241
|
}), !(Object.keys(t).length < 1))
|
|
243
242
|
return t;
|
|
244
|
-
},
|
|
245
|
-
function
|
|
246
|
-
return e &&
|
|
243
|
+
}, V = (e) => e.length === 1 && (String(e[0].type) === "template" || String(e[0].type) === String(Symbol("Comment")) || String(e[0].type) === String(Symbol("Fragment")) || String(e[0].type) == String(Symbol("v-fgt")) || String(e[0].type) === String(Symbol()));
|
|
244
|
+
function ne(e) {
|
|
245
|
+
return e && j(e) ? V(e) ? e[0].children : e : e || [];
|
|
247
246
|
}
|
|
248
|
-
function
|
|
249
|
-
return t[r] === !1 ? !1 :
|
|
247
|
+
function re(e, t, r = "default") {
|
|
248
|
+
return t[r] === !1 ? !1 : E(t[r]) && t[r] ? (e == null ? void 0 : e[r]) || t[r] : t[r] || e[r];
|
|
250
249
|
}
|
|
251
|
-
function
|
|
250
|
+
function z(e, t, r = "default") {
|
|
252
251
|
var n, i;
|
|
253
|
-
return t[r] === !1 ? !1 :
|
|
252
|
+
return t[r] === !1 ? !1 : E(t[r]) && t[r] ? ((n = e == null ? void 0 : e[r]) == null ? void 0 : n.call(e)) || t[r] : t[r] || ((i = e[r]) == null ? void 0 : i.call(e));
|
|
254
253
|
}
|
|
255
|
-
function
|
|
254
|
+
function ie(e, t, r) {
|
|
256
255
|
const n = {};
|
|
257
256
|
return e.forEach((i) => {
|
|
258
|
-
n[i] =
|
|
257
|
+
n[i] = z(t, r, i);
|
|
259
258
|
}), n;
|
|
260
259
|
}
|
|
261
|
-
const
|
|
260
|
+
const oe = ({ suffixCls: e, customizePrefixCls: t, isPor: r, className: n }) => {
|
|
262
261
|
const i = n || (r ? "gx-pro" : "gx");
|
|
263
262
|
return t || (e ? `${i}-${e}` : i);
|
|
264
|
-
},
|
|
265
|
-
function
|
|
266
|
-
const n =
|
|
263
|
+
}, ce = (e, t) => e ? Array.isArray(e) ? e.join("-") : e.toString() : `${t}`;
|
|
264
|
+
function ue(e, { align: t, showIndex: r }) {
|
|
265
|
+
const n = A(e);
|
|
267
266
|
if (r && e.length && e.every((i) => i.dataIndex !== "sortIndex")) {
|
|
268
267
|
const i = e[0];
|
|
269
268
|
n.unshift({
|
|
@@ -271,7 +270,7 @@ function le(e, { align: t, showIndex: r }) {
|
|
|
271
270
|
align: t,
|
|
272
271
|
fixed: i.fixed,
|
|
273
272
|
width: 60,
|
|
274
|
-
uuid:
|
|
273
|
+
uuid: H().uuid(15),
|
|
275
274
|
dataIndex: "sortIndex",
|
|
276
275
|
key: "sortIndex"
|
|
277
276
|
});
|
|
@@ -279,13 +278,13 @@ function le(e, { align: t, showIndex: r }) {
|
|
|
279
278
|
n.filter((i) => i.dataIndex !== "sortIndex");
|
|
280
279
|
return n;
|
|
281
280
|
}
|
|
282
|
-
function
|
|
281
|
+
function fe(e, ...t) {
|
|
283
282
|
return typeof e == "function" ? e(...t) : e;
|
|
284
283
|
}
|
|
285
|
-
function
|
|
284
|
+
function A(e) {
|
|
286
285
|
return JSON.parse(JSON.stringify(e));
|
|
287
286
|
}
|
|
288
|
-
function
|
|
287
|
+
function le(e, t) {
|
|
289
288
|
if (p(e)) {
|
|
290
289
|
const { pageSize: r = 10, total: n = 0 } = e;
|
|
291
290
|
let { current: i = 1 } = e;
|
|
@@ -293,30 +292,30 @@ function ae(e, t) {
|
|
|
293
292
|
}
|
|
294
293
|
return 1;
|
|
295
294
|
}
|
|
296
|
-
function
|
|
295
|
+
function se(e = [], t, r = "children") {
|
|
297
296
|
function n(i, o) {
|
|
298
297
|
return o.map((c, u) => {
|
|
299
298
|
const f = `${i}-${u + 1}`;
|
|
300
299
|
return c[r] && (c[r] = n(f, c[r])), c.sortIndex = f, c;
|
|
301
300
|
});
|
|
302
301
|
}
|
|
303
|
-
return
|
|
302
|
+
return A(e).map((i, o) => {
|
|
304
303
|
let c = o;
|
|
305
304
|
const u = p(t) && t.current || 1, f = p(t) && t.pageSize || 10;
|
|
306
305
|
return c = u ? (u - 1) * f + (o + 1) : o + 1, i[r] && (i[r] = n(`${c}`, i[r])), i.sortIndex = c, i;
|
|
307
306
|
});
|
|
308
307
|
}
|
|
309
|
-
function
|
|
308
|
+
function ae(e, t, r, n) {
|
|
310
309
|
const i = e[r], o = t[r];
|
|
311
310
|
let c = 0;
|
|
312
311
|
return i < o ? c = n === 0 ? -1 : 0 : i > o && (c = n === 0 ? 0 : -1), c;
|
|
313
312
|
}
|
|
314
|
-
function
|
|
315
|
-
let t =
|
|
313
|
+
function de(e) {
|
|
314
|
+
let t = A(e);
|
|
316
315
|
const r = new Set(t);
|
|
317
316
|
return t = Array.from(r), t;
|
|
318
317
|
}
|
|
319
|
-
function
|
|
318
|
+
function ge(e, t) {
|
|
320
319
|
const r = ["null", "undefined"];
|
|
321
320
|
let n = !0;
|
|
322
321
|
return e === 0 ? n = !0 : r.includes(e) ? n = !1 : e || (n = !1), n ? {
|
|
@@ -327,7 +326,7 @@ function pe(e, t) {
|
|
|
327
326
|
success: n
|
|
328
327
|
};
|
|
329
328
|
}
|
|
330
|
-
function
|
|
329
|
+
function me(e) {
|
|
331
330
|
let t = "";
|
|
332
331
|
if (e > -1) {
|
|
333
332
|
const r = Math.floor(e / 3600), n = Math.floor(e / 60) % 60, i = parseInt(String(e % 60));
|
|
@@ -335,7 +334,7 @@ function he(e) {
|
|
|
335
334
|
}
|
|
336
335
|
return t.split(":")[0] === "00" ? `${t.split(":")[1]}:${t.split(":")[2]}` : t;
|
|
337
336
|
}
|
|
338
|
-
function
|
|
337
|
+
function H() {
|
|
339
338
|
const e = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
340
339
|
return {
|
|
341
340
|
uuid(t, r) {
|
|
@@ -367,7 +366,7 @@ function k() {
|
|
|
367
366
|
}
|
|
368
367
|
};
|
|
369
368
|
}
|
|
370
|
-
function
|
|
369
|
+
function pe(e = []) {
|
|
371
370
|
let t = 0;
|
|
372
371
|
function r(n = [], i) {
|
|
373
372
|
n.forEach((o) => {
|
|
@@ -376,13 +375,13 @@ function we(e = []) {
|
|
|
376
375
|
}
|
|
377
376
|
return r(e, 1), t;
|
|
378
377
|
}
|
|
379
|
-
function
|
|
378
|
+
function k(e, t = "children") {
|
|
380
379
|
let r = [];
|
|
381
380
|
return e.forEach((n) => {
|
|
382
|
-
r.push(n), n[t] && n[t].length > 0 && (r = r.concat(
|
|
381
|
+
r.push(n), n[t] && n[t].length > 0 && (r = r.concat(k(n[t])));
|
|
383
382
|
}), r;
|
|
384
383
|
}
|
|
385
|
-
function
|
|
384
|
+
function he(e, t, r, n, i) {
|
|
386
385
|
t = t || "id", r = r || "parentId", n = n || "children", i = i || 0;
|
|
387
386
|
const o = JSON.parse(JSON.stringify(e));
|
|
388
387
|
return o.filter((c) => {
|
|
@@ -390,16 +389,16 @@ function ye(e, t, r, n, i) {
|
|
|
390
389
|
return u.length > 0 ? c[n || "children"] = u : delete c[n || "children"], c[r || "parentId"] === i;
|
|
391
390
|
});
|
|
392
391
|
}
|
|
393
|
-
function
|
|
392
|
+
function we(e) {
|
|
394
393
|
return URL.createObjectURL(e);
|
|
395
394
|
}
|
|
396
|
-
function
|
|
395
|
+
function ye(e) {
|
|
397
396
|
return new Promise((t, r) => {
|
|
398
397
|
const n = new FileReader();
|
|
399
398
|
n.readAsDataURL(e), n.onload = () => t(n.result), n.onerror = (i) => r(i);
|
|
400
399
|
});
|
|
401
400
|
}
|
|
402
|
-
function
|
|
401
|
+
function xe(e) {
|
|
403
402
|
const t = e.split(","), r = t[0].match(/:(.*?);/)[1], n = atob(t[1]);
|
|
404
403
|
let i = n.length;
|
|
405
404
|
const o = new Uint8Array(i);
|
|
@@ -407,7 +406,7 @@ function ve(e) {
|
|
|
407
406
|
o[i] = n.charCodeAt(i);
|
|
408
407
|
return new Blob([o], { type: r });
|
|
409
408
|
}
|
|
410
|
-
function
|
|
409
|
+
function Se(e, t) {
|
|
411
410
|
const r = e.split(","), n = r[0].match(/:(.*?);/)[1], i = atob(r[1]);
|
|
412
411
|
let o = i.length;
|
|
413
412
|
const c = new Uint8Array(o);
|
|
@@ -415,30 +414,30 @@ function Ae(e, t) {
|
|
|
415
414
|
c[o] = i.charCodeAt(o);
|
|
416
415
|
return new File([c], t, { type: n });
|
|
417
416
|
}
|
|
418
|
-
function
|
|
417
|
+
function ve(e, t, r) {
|
|
419
418
|
return new window.File([e], t, { type: r });
|
|
420
419
|
}
|
|
421
|
-
function
|
|
420
|
+
function q(e = "") {
|
|
422
421
|
const t = e.indexOf("?");
|
|
423
422
|
return t > 0 ? `${e.substring(0, t)}` : e;
|
|
424
423
|
}
|
|
425
424
|
function v(e = "") {
|
|
426
|
-
e =
|
|
425
|
+
e = q(e);
|
|
427
426
|
const t = e.lastIndexOf(".");
|
|
428
427
|
return t > 0 ? `${e.substring(t).split("?")[0]}`.split(".")[1] : "";
|
|
429
428
|
}
|
|
430
|
-
function
|
|
429
|
+
function g(e, t) {
|
|
431
430
|
if (t)
|
|
432
431
|
return t;
|
|
433
432
|
if (!e || e === "data:")
|
|
434
433
|
return "4";
|
|
435
434
|
let r = "4";
|
|
436
|
-
return
|
|
435
|
+
return O(e) ? e.includes("data:image/") ? r = "png" : e.includes("data:video/") ? r = "mp4" : e.includes("data:audio/") && (r = "mp3") : e instanceof Blob ? (e = String(e), e.includes("image") ? r = "png" : e.includes("video") ? r = "mp4" : e.includes("audio") && (r = "mp3")) : r = v(e).toLowerCase(), m.imageType.includes(r) ? "1" : m.videoType.includes(r) ? "3" : m.audioType.includes(r) ? "2" : "4";
|
|
437
436
|
}
|
|
438
|
-
function
|
|
437
|
+
function W(e) {
|
|
439
438
|
const { url: t = "", fileType: r = "1" } = e;
|
|
440
439
|
let n = "";
|
|
441
|
-
return t instanceof File ? n = URL.createObjectURL(t) :
|
|
440
|
+
return t instanceof File ? n = URL.createObjectURL(t) : O(t) ? n = t : t instanceof Blob ? n = URL.createObjectURL(t) : (t.includes("https") || t.includes("http")) && (n = t), new Promise(function(i) {
|
|
442
441
|
let o;
|
|
443
442
|
r === "1" ? (o = document.createElement("img"), o.src = n) : r === "2" ? (o = document.createElement("audio"), o.src = n) : r === "3" && (o = document.createElement("video"), o.src = n), r === "1" ? o.onload = function() {
|
|
444
443
|
i({
|
|
@@ -460,19 +459,19 @@ function J(e) {
|
|
|
460
459
|
};
|
|
461
460
|
});
|
|
462
461
|
}
|
|
463
|
-
async function
|
|
462
|
+
async function Ae(e) {
|
|
464
463
|
const { url: t = "", currentTime: r, videoSuffix: n = "", vidoeAllowPlay: i = !1 } = e;
|
|
465
464
|
let o = "", c = n, u = "1", f;
|
|
466
|
-
return t instanceof File ? (o = URL.createObjectURL(t), c = v(t.name), u =
|
|
465
|
+
return t instanceof File ? (o = URL.createObjectURL(t), c = v(t.name), u = g(t.name)) : t instanceof Blob ? (o = URL.createObjectURL(t), u = g(t)) : O(t) ? (o = t, u = g(t)) : (t.includes("https") || t.includes("http")) && (o = t, c = v(t), u = g(t)), (c ? m.videoAllowType.includes(c.toLowerCase()) : !1) ? i ? b(o, r) : (f = await W({
|
|
467
466
|
url: o,
|
|
468
467
|
fileType: u
|
|
469
|
-
}), f.play ?
|
|
468
|
+
}), f.play ? b(o, r) : new Promise(function(l) {
|
|
470
469
|
l("");
|
|
471
470
|
})) : new Promise(function(l) {
|
|
472
471
|
l("");
|
|
473
472
|
});
|
|
474
473
|
}
|
|
475
|
-
async function
|
|
474
|
+
async function b(e, t = 0) {
|
|
476
475
|
return new Promise(function(r) {
|
|
477
476
|
let n = document.createElement("video");
|
|
478
477
|
n.controls = !0, n.muted = !0, n.setAttribute("src", e), n.setAttribute("muted", String(!0)), n.setAttribute("crossorigin", "anonymous"), n.setAttribute("autoplay", String(!0)), n && n.addEventListener("loadeddata", async function() {
|
|
@@ -489,73 +488,73 @@ async function O(e, t = 0) {
|
|
|
489
488
|
});
|
|
490
489
|
});
|
|
491
490
|
}
|
|
492
|
-
function
|
|
491
|
+
function O(e = "") {
|
|
493
492
|
return !!(e && [
|
|
494
493
|
"data:image/",
|
|
495
494
|
"data:video/",
|
|
496
495
|
"data:audio/"
|
|
497
496
|
].find((r) => e.includes(r)));
|
|
498
497
|
}
|
|
499
|
-
function
|
|
498
|
+
function Oe(e, t, r, n = !1) {
|
|
500
499
|
e && t && r && e.addEventListener(t, r, n);
|
|
501
500
|
}
|
|
502
|
-
function
|
|
501
|
+
function be(e, t, r, n = !1) {
|
|
503
502
|
e && t && r && e.removeEventListener(t, r, n);
|
|
504
503
|
}
|
|
505
504
|
export {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
505
|
+
de as arrayRepeat,
|
|
506
|
+
ve as blobToDataURL,
|
|
507
|
+
g as checkFileType,
|
|
508
|
+
C as classNames,
|
|
509
|
+
ae as compareArray,
|
|
510
|
+
xe as dataURLtoBlob,
|
|
511
|
+
Se as dataURLtoFile,
|
|
512
|
+
A as deepCopy,
|
|
513
|
+
me as formatDuraton,
|
|
514
|
+
ce as genColumnKey,
|
|
515
|
+
b as generateVidoePicture,
|
|
516
|
+
ye as getBase64,
|
|
517
|
+
we as getBlobUrl,
|
|
519
518
|
v as getFileSuffix,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
519
|
+
k as getLevelData,
|
|
520
|
+
pe as getMaxFloor,
|
|
521
|
+
W as getMediaInfos,
|
|
522
|
+
oe as getPrefixCls,
|
|
523
|
+
H as getRandomNumber,
|
|
524
|
+
ne as getRealVNode,
|
|
525
|
+
M as getScroll,
|
|
526
|
+
J as getScrollContainer,
|
|
527
|
+
re as getSlot,
|
|
528
|
+
z as getSlotVNode,
|
|
529
|
+
ie as getSlotsProps,
|
|
530
|
+
se as getSortIndex,
|
|
531
|
+
Ae as getVideoCoverPicture,
|
|
532
|
+
q as getVideoFileUrl,
|
|
533
|
+
m as globalConfig,
|
|
534
|
+
le as handleCurrentPage,
|
|
535
|
+
ue as handleShowIndex,
|
|
536
|
+
ge as hanndleField,
|
|
537
|
+
R as is,
|
|
538
|
+
j as isArray,
|
|
539
|
+
O as isBase64,
|
|
540
|
+
E as isBoolean,
|
|
541
|
+
K as isBrowser,
|
|
543
542
|
x as isDeepEqualReact,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
543
|
+
Y as isFunction,
|
|
544
|
+
_ as isInContainer,
|
|
545
|
+
X as isNumber,
|
|
547
546
|
p as isObject,
|
|
548
547
|
U as isScroll,
|
|
549
548
|
w as isServer,
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
549
|
+
V as isSlotFragment,
|
|
550
|
+
B as isString,
|
|
551
|
+
Z as merge,
|
|
552
|
+
be as off,
|
|
553
|
+
ee as omitBoolean,
|
|
554
|
+
te as omitUndefined,
|
|
555
|
+
Oe as on,
|
|
556
|
+
fe as runFunction,
|
|
557
|
+
G as scrollTo,
|
|
558
|
+
Q as throttleByAnimationFrame,
|
|
559
|
+
he as treeData
|
|
561
560
|
};
|
package/dist/pro-utils.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","lodash-es"],g):(c=typeof globalThis<"u"?globalThis:c||self,g(c.PorUtils={},c.lodashEs))})(this,function(c,g){"use strict";const m=typeof window>"u";process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const $=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},z=/-(\w)/g,k=$(e=>e.replace(z,(n,i)=>i?i.toUpperCase():"")),b=function(e,n){var i;if(m||!e||!n)return"";n=k(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?b(e,"overflow"):n?b(e,"overflow-y"):b(e,"overflow-x")).match(/(scroll|auto|overlay)/),q=(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},H=(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},W=Object.prototype.toString;function F(e,n){return W.call(e)===`[object ${n}]`}function R(e){return F(e,"Boolean")}function J(e){return typeof e=="number"}function T(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function h(e){return e!==null&&F(e,"Object")}function D(e){return typeof e=="string"||e instanceof String}function _(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function B(...e){const n=[];for(let i=0;i<e.length;i++){const t=e[i];if(t){if(D(t))n.push(t);else if(T(t))for(let r=0;r<t.length;r++){const o=B(t[r]);o&&n.push(o)}else if(h(t))for(const r in t)t[r]&&n.push(r)}}return n.filter(i=>i).join(" ")}let X=0;const s={};function S(e,n=1){const i=X++;let t=n;function r(){t-=1,t<=0?(e(),delete s[i]):s[i]=requestAnimationFrame(r)}return s[i]=requestAnimationFrame(r),i}S.cancel=function(n){n!==void 0&&(cancelAnimationFrame(s[n]),delete s[n])},S.ids=s;function j(e){return e!=null&&e===e.window}function I(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 Y(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 G(e,n={}){const{getContainer:i=()=>window,callback:t,duration:r=450}=n,o=i(),u=I(o,!0),f=Date.now(),l=()=>{const a=Date.now()-f,d=Y(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?S(l):typeof t=="function"&&t()};S(l)}function Q(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"]},Z=(...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 p(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(!p(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(!p(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)&&!p(e[f],n[f],i,t))return t&&console.log(f),!1}return!0}return e!==e&&n!==n}const K=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,ee=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!K,ne=e=>{if(e&&e!==!0)return e},te=e=>{const n={};if(Object.keys(e||{}).forEach(i=>{e[i]!==void 0&&(n[i]=e[i])}),!(Object.keys(n).length<1))return n},C=e=>e.length===1&&(String(e[0].type)==="template"||String(e[0].type)===String(Symbol("Comment"))||String(e[0].type)===String(Symbol("Fragment"))||String(e[0].type)==String(Symbol("v-fgt"))||String(e[0].type)===String(Symbol()));function ie(e){return e&&T(e)?C(e)?e[0].children:e:e||[]}function re(e,n,i="default"){return n[i]===!1?!1:R(n[i])&&n[i]?(e==null?void 0:e[i])||n[i]:n[i]||e[i]}function P(e,n,i="default"){var t,r;return n[i]===!1?!1:R(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 oe(e,n,i){const t={};return e.forEach(r=>{t[r]=P(n,i,r)}),t}const ce=({suffixCls:e,customizePrefixCls:n,isPor:i,className:t})=>{const r=t||(i?"gx-pro":"gx");return n||(e?`${r}-${e}`:r)},ue=(e,n)=>e?Array.isArray(e)?e.join("-"):e.toString():`${n}`;function fe(e,{align:n,showIndex:i}){const t=g.cloneDeep(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:x().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else t.filter(r=>r.dataIndex!=="sortIndex");return t}function le(e,...n){return typeof e=="function"?e(...n):e}function E(e){return JSON.parse(JSON.stringify(e))}function ae(e,n){if(h(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 se(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 E(e).map((r,o)=>{let u=o;const f=h(n)&&n.current||1,l=h(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 de(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 ge(e){let n=E(e);const i=new Set(n);return n=Array.from(i),n}function me(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 he(e){let n="";if(e>-1){const i=Math.floor(e/3600),t=Math.floor(e/60)%60,r=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 x(){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[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=new Array(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 we(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 Se(e){return URL.createObjectURL(e)}function pe(e){return new Promise((n,i)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>n(t.result),t.onerror=r=>i(r)})}function ve(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 Ae(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 Oe(e,n,i){return new window.File([e],n,{type:i})}function N(e=""){const n=e.indexOf("?");return n>0?`${e.substring(0,n)}`:e}function v(e=""){e=N(e);const n=e.lastIndexOf(".");return n>0?`${e.substring(n).split("?")[0]}`.split(".")[1]:""}function w(e,n){if(n)return n;if(!e||e==="data:")return"4";let i="4";return A(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=v(e).toLowerCase(),y.imageType.includes(i)?"1":y.videoType.includes(i)?"3":y.audioType.includes(i)?"2":"4"}function V(e){const{url:n="",fileType:i="1"}=e;let t="";return n instanceof File?t=URL.createObjectURL(n):A(n)?t=n:n instanceof Blob?t=URL.createObjectURL(n):(n.includes("https")||n.includes("http"))&&(t=n),new Promise(function(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 be(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=v(n.name),f=w(n.name)):n instanceof Blob?(o=URL.createObjectURL(n),f=w(n)):A(n)?(o=n,f=w(n)):(n.includes("https")||n.includes("http"))&&(o=n,u=v(n),f=w(n)),(u?y.videoAllowType.includes(u.toLowerCase()):!1)?r?L(o,i):(l=await V({url:o,fileType:f}),l.play?L(o,i):new Promise(function(a){a("")})):new Promise(function(a){a("")})}async function L(e,n=0){return new Promise(function(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(Te=>r=Te);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),O=(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,O+d,a+d),t=null,i(O===0||a===0?"":u.toDataURL("image/png",1))}})})}function A(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 Re(e,n,i,t=!1){e&&n&&i&&e.removeEventListener(n,i,t)}c.arrayRepeat=ge,c.blobToDataURL=Oe,c.checkFileType=w,c.classNames=B,c.compareArray=de,c.dataURLtoBlob=ve,c.dataURLtoFile=Ae,c.deepCopy=E,c.formatDuraton=he,c.genColumnKey=ue,c.generateVidoePicture=L,c.getBase64=pe,c.getBlobUrl=Se,c.getFileSuffix=v,c.getLevelData=M,c.getMaxFloor=ye,c.getMediaInfos=V,c.getPrefixCls=ce,c.getRandomNumber=x,c.getRealVNode=ie,c.getScroll=I,c.getScrollContainer=q,c.getSlot=re,c.getSlotVNode=P,c.getSlotsProps=oe,c.getSortIndex=se,c.getVideoCoverPicture=be,c.getVideoFileUrl=N,c.globalConfig=y,c.handleCurrentPage=ae,c.handleShowIndex=fe,c.hanndleField=me,c.is=F,c.isArray=T,c.isBase64=A,c.isBoolean=R,c.isBrowser=ee,c.isDeepEqualReact=p,c.isFunction=_,c.isInContainer=H,c.isNumber=J,c.isObject=h,c.isScroll=U,c.isServer=m,c.isSlotFragment=C,c.isString=D,c.merge=Z,c.off=Re,c.omitBoolean=ne,c.omitUndefined=te,c.on=Fe,c.runFunction=le,c.scrollTo=G,c.throttleByAnimationFrame=Q,c.treeData=we,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(c=typeof globalThis<"u"?globalThis:c||self,s(c.PorUtils={}))})(this,function(c){"use strict";const s=typeof window>"u";process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const V=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},$=/-(\w)/g,z=V(e=>e.replace($,(n,i)=>i?i.toUpperCase():"")),b=function(e,n){var i;if(s||!e||!n)return"";n=z(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]}},L=(e,n)=>s?void 0:(n==null?b(e,"overflow"):n?b(e,"overflow-y"):b(e,"overflow-x")).match(/(scroll|auto|overlay)/),k=(e,n)=>{if(s)return;let i=e;for(;i;){if([window,document,document.documentElement].includes(i))return window;if(L(i,n))return i;i=i.parentNode}return i},H=(e,n)=>{if(s||!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},q=Object.prototype.toString;function F(e,n){return q.call(e)===`[object ${n}]`}function R(e){return F(e,"Boolean")}function W(e){return typeof e=="number"}function T(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function m(e){return e!==null&&F(e,"Object")}function U(e){return typeof e=="string"||e instanceof String}function J(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function B(...e){const n=[];for(let i=0;i<e.length;i++){const t=e[i];if(t){if(U(t))n.push(t);else if(T(t))for(let r=0;r<t.length;r++){const o=B(t[r]);o&&n.push(o)}else if(m(t))for(const r in t)t[r]&&n.push(r)}}return n.filter(i=>i).join(" ")}let _=0;const d={};function w(e,n=1){const i=_++;let t=n;function r(){t-=1,t<=0?(e(),delete d[i]):d[i]=requestAnimationFrame(r)}return d[i]=requestAnimationFrame(r),i}w.cancel=function(n){n!==void 0&&(cancelAnimationFrame(d[n]),delete d[n])},w.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 X(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 Y(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=X(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?w(l):typeof t=="function"&&t()};w(l)}function G(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 h={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"]},Q=(...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 S(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(!S(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(!S(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)&&!S(e[f],n[f],i,t))return t&&console.log(f),!1}return!0}return e!==e&&n!==n}const Z=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,K=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!Z,ee=e=>{if(e&&e!==!0)return e},ne=e=>{const n={};if(Object.keys(e||{}).forEach(i=>{e[i]!==void 0&&(n[i]=e[i])}),!(Object.keys(n).length<1))return n},I=e=>e.length===1&&(String(e[0].type)==="template"||String(e[0].type)===String(Symbol("Comment"))||String(e[0].type)===String(Symbol("Fragment"))||String(e[0].type)==String(Symbol("v-fgt"))||String(e[0].type)===String(Symbol()));function te(e){return e&&T(e)?I(e)?e[0].children:e:e||[]}function ie(e,n,i="default"){return n[i]===!1?!1:R(n[i])&&n[i]?(e==null?void 0:e[i])||n[i]:n[i]||e[i]}function C(e,n,i="default"){var t,r;return n[i]===!1?!1:R(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 re(e,n,i){const t={};return e.forEach(r=>{t[r]=C(n,i,r)}),t}const oe=({suffixCls:e,customizePrefixCls:n,isPor:i,className:t})=>{const r=t||(i?"gx-pro":"gx");return n||(e?`${r}-${e}`:r)},ce=(e,n)=>e?Array.isArray(e)?e.join("-"):e.toString():`${n}`;function ue(e,{align:n,showIndex:i}){const t=p(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:P().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else t.filter(r=>r.dataIndex!=="sortIndex");return t}function fe(e,...n){return typeof e=="function"?e(...n):e}function p(e){return JSON.parse(JSON.stringify(e))}function le(e,n){if(m(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 ae(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 p(e).map((r,o)=>{let u=o;const f=m(n)&&n.current||1,l=m(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 se(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 de(e){let n=p(e);const i=new Set(n);return n=Array.from(i),n}function ge(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 me(e){let n="";if(e>-1){const i=Math.floor(e/3600),t=Math.floor(e/60)%60,r=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 P(){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[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=new Array(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 he(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 x(e,n="children"){let i=[];return e.forEach(t=>{i.push(t),t[n]&&t[n].length>0&&(i=i.concat(x(t[n])))}),i}function ye(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 we(e){return URL.createObjectURL(e)}function Se(e){return new Promise((n,i)=>{const t=new FileReader;t.readAsDataURL(e),t.onload=()=>n(t.result),t.onerror=r=>i(r)})}function pe(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 ve(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 Ae(e,n,i){return new window.File([e],n,{type:i})}function M(e=""){const n=e.indexOf("?");return n>0?`${e.substring(0,n)}`:e}function v(e=""){e=M(e);const n=e.lastIndexOf(".");return n>0?`${e.substring(n).split("?")[0]}`.split(".")[1]:""}function y(e,n){if(n)return n;if(!e||e==="data:")return"4";let i="4";return A(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=v(e).toLowerCase(),h.imageType.includes(i)?"1":h.videoType.includes(i)?"3":h.audioType.includes(i)?"2":"4"}function N(e){const{url:n="",fileType:i="1"}=e;let t="";return n instanceof File?t=URL.createObjectURL(n):A(n)?t=n:n instanceof Blob?t=URL.createObjectURL(n):(n.includes("https")||n.includes("http"))&&(t=n),new Promise(function(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 Oe(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=v(n.name),f=y(n.name)):n instanceof Blob?(o=URL.createObjectURL(n),f=y(n)):A(n)?(o=n,f=y(n)):(n.includes("https")||n.includes("http"))&&(o=n,u=v(n),f=y(n)),(u?h.videoAllowType.includes(u.toLowerCase()):!1)?r?E(o,i):(l=await N({url:o,fileType:f}),l.play?E(o,i):new Promise(function(a){a("")})):new Promise(function(a){a("")})}async function E(e,n=0){return new Promise(function(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(Re=>r=Re);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),O=(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,O+g,a+g),t=null,i(O===0||a===0?"":u.toDataURL("image/png",1))}})})}function A(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(i=>e.includes(i)))}function be(e,n,i,t=!1){e&&n&&i&&e.addEventListener(n,i,t)}function Fe(e,n,i,t=!1){e&&n&&i&&e.removeEventListener(n,i,t)}c.arrayRepeat=de,c.blobToDataURL=Ae,c.checkFileType=y,c.classNames=B,c.compareArray=se,c.dataURLtoBlob=pe,c.dataURLtoFile=ve,c.deepCopy=p,c.formatDuraton=me,c.genColumnKey=ce,c.generateVidoePicture=E,c.getBase64=Se,c.getBlobUrl=we,c.getFileSuffix=v,c.getLevelData=x,c.getMaxFloor=he,c.getMediaInfos=N,c.getPrefixCls=oe,c.getRandomNumber=P,c.getRealVNode=te,c.getScroll=D,c.getScrollContainer=k,c.getSlot=ie,c.getSlotVNode=C,c.getSlotsProps=re,c.getSortIndex=ae,c.getVideoCoverPicture=Oe,c.getVideoFileUrl=M,c.globalConfig=h,c.handleCurrentPage=le,c.handleShowIndex=ue,c.hanndleField=ge,c.is=F,c.isArray=T,c.isBase64=A,c.isBoolean=R,c.isBrowser=K,c.isDeepEqualReact=S,c.isFunction=J,c.isInContainer=H,c.isNumber=W,c.isObject=m,c.isScroll=L,c.isServer=s,c.isSlotFragment=I,c.isString=U,c.merge=Q,c.off=Fe,c.omitBoolean=ee,c.omitUndefined=ne,c.on=be,c.runFunction=fe,c.scrollTo=Y,c.throttleByAnimationFrame=G,c.treeData=ye,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/pro-utils",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.16",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite",
|
|
6
6
|
"build": "vite build",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"types": "./dist",
|
|
17
|
-
"main": "./dist/pro-utils.
|
|
17
|
+
"main": "./dist/pro-utils.umd.js",
|
|
18
18
|
"module": "./dist/pro-utils.mjs",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|