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