@gx-design-vue/pro-utils 0.2.0-beta.26 → 0.2.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/omitUndefined/index.d.ts +1 -4
- package/dist/pro-utils.js +78 -79
- package/dist/pro-utils.umd.cjs +1 -5
- package/dist/scroll/raf.d.ts +1 -1
- package/dist/typings/index.d.ts +4 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/validate.d.ts +4 -4
- package/package.json +9 -39
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import isServer from './isServer';
|
|
2
|
-
import {
|
|
2
|
+
import { getScrollContainer, isInContainer, isScroll } from './scroll';
|
|
3
3
|
import classNames from './classNames';
|
|
4
4
|
import scrollTo from './scroll/scrollTo';
|
|
5
5
|
import getScroll from './scroll/getScroll';
|
package/dist/pro-utils.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { isVNode as T } from "vue";
|
|
2
|
-
const
|
|
3
|
-
/**
|
|
4
|
-
* @vue/shared v3.4.19
|
|
5
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
6
|
-
* @license MIT
|
|
7
|
-
**/
|
|
2
|
+
const y = typeof window > "u";
|
|
8
3
|
process.env.NODE_ENV !== "production" && Object.freeze({});
|
|
9
4
|
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
10
5
|
const L = (e) => {
|
|
11
6
|
const t = /* @__PURE__ */ Object.create(null);
|
|
12
7
|
return (r) => t[r] || (t[r] = e(r));
|
|
13
|
-
}, I = /-(\w)/g, U = L((e) => e.replace(I, (t, r) => r ? r.toUpperCase() : "")),
|
|
8
|
+
}, I = /-(\w)/g, U = L((e) => e.replace(I, (t, r) => r ? r.toUpperCase() : "")), x = function(e, t) {
|
|
14
9
|
var r;
|
|
15
|
-
if (
|
|
10
|
+
if (y || !e || !t)
|
|
16
11
|
return "";
|
|
17
12
|
t = U(t), t === "float" && (t = "cssFloat");
|
|
18
13
|
try {
|
|
@@ -24,8 +19,8 @@ const L = (e) => {
|
|
|
24
19
|
} catch {
|
|
25
20
|
return e.style[t];
|
|
26
21
|
}
|
|
27
|
-
}, D = (e, t) =>
|
|
28
|
-
if (
|
|
22
|
+
}, D = (e, t) => y ? void 0 : (t == null ? x(e, "overflow") : t ? x(e, "overflow-y") : x(e, "overflow-x")).match(/(scroll|auto|overlay)/), Y = (e, t) => {
|
|
23
|
+
if (y)
|
|
29
24
|
return;
|
|
30
25
|
let r = e;
|
|
31
26
|
for (; r; ) {
|
|
@@ -37,7 +32,7 @@ const L = (e) => {
|
|
|
37
32
|
}
|
|
38
33
|
return r;
|
|
39
34
|
}, G = (e, t) => {
|
|
40
|
-
if (
|
|
35
|
+
if (y || !e || !t)
|
|
41
36
|
return !1;
|
|
42
37
|
const r = e.getBoundingClientRect();
|
|
43
38
|
let n;
|
|
@@ -48,20 +43,20 @@ const L = (e) => {
|
|
|
48
43
|
left: 0
|
|
49
44
|
} : n = t.getBoundingClientRect(), r.top < n.bottom && r.bottom > n.top && r.right > n.left && r.left < n.right;
|
|
50
45
|
}, C = Object.prototype.toString;
|
|
51
|
-
function
|
|
46
|
+
function j(e, t) {
|
|
52
47
|
return C.call(e) === `[object ${t}]`;
|
|
53
48
|
}
|
|
54
49
|
function A(e) {
|
|
55
|
-
return
|
|
50
|
+
return j(e, "Boolean");
|
|
56
51
|
}
|
|
57
52
|
function Q(e) {
|
|
58
53
|
return typeof e == "number";
|
|
59
54
|
}
|
|
60
|
-
function
|
|
55
|
+
function p(e) {
|
|
61
56
|
return typeof Array.isArray > "u" ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
|
|
62
57
|
}
|
|
63
|
-
function
|
|
64
|
-
return e !== null &&
|
|
58
|
+
function h(e) {
|
|
59
|
+
return e !== null && j(e, "Object");
|
|
65
60
|
}
|
|
66
61
|
function B(e) {
|
|
67
62
|
return typeof e == "string" || e instanceof String;
|
|
@@ -76,53 +71,53 @@ function P(...e) {
|
|
|
76
71
|
if (n) {
|
|
77
72
|
if (B(n))
|
|
78
73
|
t.push(n);
|
|
79
|
-
else if (
|
|
74
|
+
else if (p(n))
|
|
80
75
|
for (let i = 0; i < n.length; i++) {
|
|
81
76
|
const o = P(n[i]);
|
|
82
77
|
o && t.push(o);
|
|
83
78
|
}
|
|
84
|
-
else if (
|
|
79
|
+
else if (h(n))
|
|
85
80
|
for (const i in n)
|
|
86
81
|
n[i] && t.push(i);
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
84
|
return t.filter((r) => r).join(" ");
|
|
90
85
|
}
|
|
91
|
-
let
|
|
86
|
+
let N = 0;
|
|
92
87
|
const a = {};
|
|
93
|
-
function
|
|
94
|
-
const r =
|
|
88
|
+
function w(e, t = 1) {
|
|
89
|
+
const r = N++;
|
|
95
90
|
let n = t;
|
|
96
91
|
function i() {
|
|
97
92
|
n -= 1, n <= 0 ? (e(), delete a[r]) : a[r] = requestAnimationFrame(i);
|
|
98
93
|
}
|
|
99
94
|
return a[r] = requestAnimationFrame(i), r;
|
|
100
95
|
}
|
|
101
|
-
|
|
96
|
+
w.cancel = function(t) {
|
|
102
97
|
t !== void 0 && (cancelAnimationFrame(a[t]), delete a[t]);
|
|
103
98
|
};
|
|
104
|
-
|
|
105
|
-
function
|
|
99
|
+
w.ids = a;
|
|
100
|
+
function v(e) {
|
|
106
101
|
return e != null && e === e.window;
|
|
107
102
|
}
|
|
108
|
-
function
|
|
103
|
+
function M(e, t) {
|
|
109
104
|
var i;
|
|
110
105
|
if (typeof window > "u")
|
|
111
106
|
return 0;
|
|
112
107
|
const r = t ? "scrollTop" : "scrollLeft";
|
|
113
108
|
let n = 0;
|
|
114
|
-
return
|
|
109
|
+
return v(e) ? n = e[t ? "pageYOffset" : "pageXOffset"] : e instanceof Document ? n = e.documentElement[r] : e && (n = e[r]), e && !v(e) && typeof n != "number" && (n = (i = (e.ownerDocument || e).documentElement) == null ? void 0 : i[r]), n;
|
|
115
110
|
}
|
|
116
111
|
function $(e, t, r, n) {
|
|
117
112
|
const i = r - t;
|
|
118
113
|
return e /= n / 2, e < 1 ? i / 2 * e * e * e + t : i / 2 * ((e -= 2) * e * e + 2) + t;
|
|
119
114
|
}
|
|
120
115
|
function K(e, t = {}) {
|
|
121
|
-
const { getContainer: r = () => window, callback: n, duration: i = 450 } = t, o = r(), c =
|
|
116
|
+
const { getContainer: r = () => window, callback: n, duration: i = 450 } = t, o = r(), c = M(o, !0), u = Date.now(), f = () => {
|
|
122
117
|
const l = Date.now() - u, s = $(l > i ? i : l, c, e, i);
|
|
123
|
-
|
|
118
|
+
v(o) ? o.scrollTo(window.pageXOffset, s) : o instanceof HTMLDocument || o.constructor.name === "HTMLDocument" ? o.documentElement.scrollTop = s : o.scrollTop = s, l < i ? w(f) : typeof n == "function" && n();
|
|
124
119
|
};
|
|
125
|
-
|
|
120
|
+
w(f);
|
|
126
121
|
}
|
|
127
122
|
function ee(e) {
|
|
128
123
|
let t;
|
|
@@ -166,13 +161,13 @@ const g = {
|
|
|
166
161
|
let n, i = 0;
|
|
167
162
|
for (; i < r; i += 1)
|
|
168
163
|
for (n in e[i])
|
|
169
|
-
e[i]
|
|
164
|
+
Object.prototype.hasOwnProperty.call(e[i], n) && (typeof t[n] == "object" && typeof e[i][n] == "object" && t[n] !== void 0 && t[n] !== null && !Array.isArray(t[n]) && !Array.isArray(e[i][n]) ? t[n] = {
|
|
170
165
|
...t[n],
|
|
171
166
|
...e[i][n]
|
|
172
167
|
} : t[n] = e[i][n]);
|
|
173
168
|
return t;
|
|
174
169
|
};
|
|
175
|
-
function
|
|
170
|
+
function S(e, t, r, n) {
|
|
176
171
|
if (e === t)
|
|
177
172
|
return !0;
|
|
178
173
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
@@ -180,10 +175,10 @@ function x(e, t, r, n) {
|
|
|
180
175
|
return !1;
|
|
181
176
|
let i, o, c;
|
|
182
177
|
if (Array.isArray(e)) {
|
|
183
|
-
if (i = e.length, i
|
|
178
|
+
if (i = e.length, i !== t.length)
|
|
184
179
|
return !1;
|
|
185
180
|
for (o = i; o-- !== 0; )
|
|
186
|
-
if (!
|
|
181
|
+
if (!S(e[o], t[o], r, n))
|
|
187
182
|
return !1;
|
|
188
183
|
return !0;
|
|
189
184
|
}
|
|
@@ -194,7 +189,7 @@ function x(e, t, r, n) {
|
|
|
194
189
|
if (!t.has(o[0]))
|
|
195
190
|
return !1;
|
|
196
191
|
for (o of e.entries())
|
|
197
|
-
if (!
|
|
192
|
+
if (!S(o[1], t.get(o[0]), r, n))
|
|
198
193
|
return !1;
|
|
199
194
|
return !0;
|
|
200
195
|
}
|
|
@@ -207,7 +202,7 @@ function x(e, t, r, n) {
|
|
|
207
202
|
return !0;
|
|
208
203
|
}
|
|
209
204
|
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
210
|
-
if (i = e.length, i
|
|
205
|
+
if (i = e.length, i !== t.length)
|
|
211
206
|
return !1;
|
|
212
207
|
for (o = i; o-- !== 0; )
|
|
213
208
|
if (e[o] !== t[o])
|
|
@@ -227,7 +222,7 @@ function x(e, t, r, n) {
|
|
|
227
222
|
return !1;
|
|
228
223
|
for (o = i; o-- !== 0; ) {
|
|
229
224
|
const u = c[o];
|
|
230
|
-
if (!(r != null && r.includes(u)) && !(u === "_owner" && e.$$typeof) && !
|
|
225
|
+
if (!(r != null && r.includes(u)) && !(u === "_owner" && e.$$typeof) && !S(e[u], t[u], r, n))
|
|
231
226
|
return n && console.log(u), !1;
|
|
232
227
|
}
|
|
233
228
|
return !0;
|
|
@@ -245,11 +240,15 @@ const V = typeof process < "u" && process.versions != null && process.versions.n
|
|
|
245
240
|
return t;
|
|
246
241
|
};
|
|
247
242
|
function z(e) {
|
|
248
|
-
return T(e) ? String(e.type) === "template" || String(e.type) === String(Symbol("Comment")) || String(e.type) === String(Symbol("Fragment")) || String(e.type)
|
|
243
|
+
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;
|
|
249
244
|
}
|
|
250
245
|
const H = (e) => e.length === 1 && z(e == null ? void 0 : e[0]);
|
|
251
246
|
function oe(e) {
|
|
252
|
-
|
|
247
|
+
if (e && p(e)) {
|
|
248
|
+
const t = H(e) ? p(e[0].children) ? e[0].children : [] : e;
|
|
249
|
+
return p(t) ? t : [];
|
|
250
|
+
}
|
|
251
|
+
return e || [];
|
|
253
252
|
}
|
|
254
253
|
function ce(e, t, r = "default") {
|
|
255
254
|
return t[r] === !1 ? !1 : A(t[r]) && t[r] ? (e == null ? void 0 : e[r]) || t[r] : t[r] || e[r];
|
|
@@ -270,7 +269,7 @@ const fe = ({ suffixCls: e, customizePrefixCls: t, isPor: r, className: n }) =>
|
|
|
270
269
|
return t || (e ? `${i}-${e}` : i);
|
|
271
270
|
}, le = (e, t) => e ? Array.isArray(e) ? e.join("-") : e.toString() : `${t}`;
|
|
272
271
|
function se(e, { align: t, showIndex: r }) {
|
|
273
|
-
const n =
|
|
272
|
+
const n = b(e);
|
|
274
273
|
if (r && e.length && e.every((i) => i.dataIndex !== "sortIndex")) {
|
|
275
274
|
const i = e[0];
|
|
276
275
|
n.unshift({
|
|
@@ -289,11 +288,11 @@ function se(e, { align: t, showIndex: r }) {
|
|
|
289
288
|
function ae(e, ...t) {
|
|
290
289
|
return typeof e == "function" ? e(...t) : e;
|
|
291
290
|
}
|
|
292
|
-
function
|
|
291
|
+
function b(e) {
|
|
293
292
|
return JSON.parse(JSON.stringify(e));
|
|
294
293
|
}
|
|
295
294
|
function de(e, t) {
|
|
296
|
-
if (
|
|
295
|
+
if (h(e)) {
|
|
297
296
|
const { pageSize: r = 10, total: n = 0 } = e;
|
|
298
297
|
let { current: i = 1 } = e;
|
|
299
298
|
return n - t <= r * (i - 1) && (i = i - 1), i === 0 ? 1 : i;
|
|
@@ -307,19 +306,19 @@ function me(e = [], t, r = "children") {
|
|
|
307
306
|
return c[r] && (c[r] = n(f, c[r])), c.sortIndex = f, c;
|
|
308
307
|
});
|
|
309
308
|
}
|
|
310
|
-
return
|
|
309
|
+
return b(e).map((i, o) => {
|
|
311
310
|
let c = o;
|
|
312
|
-
const u =
|
|
311
|
+
const u = h(t) && t.current || 1, f = h(t) && t.pageSize || 10;
|
|
313
312
|
return c = u ? (u - 1) * f + (o + 1) : o + 1, i[r] && (i[r] = n(`${c}`, i[r])), i.sortIndex = c, i;
|
|
314
313
|
});
|
|
315
314
|
}
|
|
316
|
-
function
|
|
315
|
+
function pe(e, t, r, n) {
|
|
317
316
|
const i = e[r], o = t[r];
|
|
318
317
|
let c = 0;
|
|
319
318
|
return i < o ? c = n === 0 ? -1 : 0 : i > o && (c = n === 0 ? 0 : -1), c;
|
|
320
319
|
}
|
|
321
|
-
function
|
|
322
|
-
let t =
|
|
320
|
+
function ge(e) {
|
|
321
|
+
let t = b(e);
|
|
323
322
|
const r = new Set(t);
|
|
324
323
|
return t = Array.from(r), t;
|
|
325
324
|
}
|
|
@@ -337,7 +336,7 @@ function he(e, t) {
|
|
|
337
336
|
function we(e) {
|
|
338
337
|
let t = "";
|
|
339
338
|
if (e > -1) {
|
|
340
|
-
const r = Math.floor(e / 3600), n = Math.floor(e / 60) % 60, i = parseInt(String(e % 60));
|
|
339
|
+
const r = Math.floor(e / 3600), n = Math.floor(e / 60) % 60, i = Number.parseInt(String(e % 60));
|
|
341
340
|
r < 10 ? t = "0" + r + ":" : t = r + ":", n < 10 && (t += "0"), t += n + ":", i < 10 && (t += "0"), t += i;
|
|
342
341
|
}
|
|
343
342
|
return t.split(":")[0] === "00" ? `${t.split(":")[1]}:${t.split(":")[2]}` : t;
|
|
@@ -350,14 +349,14 @@ function q() {
|
|
|
350
349
|
let c, u;
|
|
351
350
|
if (t)
|
|
352
351
|
for (c = 0; c < t; c += 1)
|
|
353
|
-
i[c] = n[parseInt(String(Math.random() * o))];
|
|
352
|
+
i[c] = n[Number.parseInt(String(Math.random() * o))];
|
|
354
353
|
else
|
|
355
354
|
for (i[8] = "-", i[13] = "-", i[18] = "-", i[23] = "-", i[14] = "4", c = 0; c < 36; c += 1)
|
|
356
355
|
i[c] || (u = Math.random() * 16, i[c] = n[c === 19 ? u && 3 || 8 : u]);
|
|
357
356
|
return i.join("");
|
|
358
357
|
},
|
|
359
358
|
uuidFast() {
|
|
360
|
-
const t = e, r =
|
|
359
|
+
const t = e, r = Array.from({ length: 36 });
|
|
361
360
|
let n = 0, i, o;
|
|
362
361
|
for (o = 0; o < 36; o += 1)
|
|
363
362
|
o === 8 || o === 13 || o === 18 || o === 23 ? r[o] = "-" : o === 14 ? r[o] = "4" : (n <= 2 && (n = 33554432 + Math.random() * 16777216 || 0), i = n && 15, n = n > 4, r[o] = t[o === 19 ? i && 3 || 8 : i]);
|
|
@@ -406,7 +405,7 @@ function ve(e) {
|
|
|
406
405
|
n.readAsDataURL(e), n.onload = () => t(n.result), n.onerror = (i) => r(i);
|
|
407
406
|
});
|
|
408
407
|
}
|
|
409
|
-
function
|
|
408
|
+
function Oe(e) {
|
|
410
409
|
const t = e.split(","), r = t[0].match(/:(.*?);/)[1], n = atob(t[1]);
|
|
411
410
|
let i = n.length;
|
|
412
411
|
const o = new Uint8Array(i);
|
|
@@ -414,7 +413,7 @@ function Ae(e) {
|
|
|
414
413
|
o[i] = n.charCodeAt(i);
|
|
415
414
|
return new Blob([o], { type: r });
|
|
416
415
|
}
|
|
417
|
-
function
|
|
416
|
+
function Ae(e, t) {
|
|
418
417
|
const r = e.split(","), n = r[0].match(/:(.*?);/)[1], i = atob(r[1]);
|
|
419
418
|
let o = i.length;
|
|
420
419
|
const c = new Uint8Array(o);
|
|
@@ -425,12 +424,12 @@ function Oe(e, t) {
|
|
|
425
424
|
function be(e, t, r) {
|
|
426
425
|
return new window.File([e], t, { type: r });
|
|
427
426
|
}
|
|
428
|
-
function
|
|
427
|
+
function _(e = "") {
|
|
429
428
|
const t = e.indexOf("?");
|
|
430
429
|
return t > 0 ? `${e.substring(0, t)}` : e;
|
|
431
430
|
}
|
|
432
|
-
function
|
|
433
|
-
e =
|
|
431
|
+
function O(e = "") {
|
|
432
|
+
e = _(e);
|
|
434
433
|
const t = e.lastIndexOf(".");
|
|
435
434
|
return t > 0 ? `${e.substring(t).split("?")[0]}`.split(".")[1] : "";
|
|
436
435
|
}
|
|
@@ -440,12 +439,12 @@ function m(e, t) {
|
|
|
440
439
|
if (!e || e === "data:")
|
|
441
440
|
return "4";
|
|
442
441
|
let r = "4";
|
|
443
|
-
return
|
|
442
|
+
return E(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 = O(e).toLowerCase(), g.imageType.includes(r) ? "1" : g.videoType.includes(r) ? "3" : g.audioType.includes(r) ? "2" : "4";
|
|
444
443
|
}
|
|
445
|
-
function
|
|
444
|
+
function J(e) {
|
|
446
445
|
const { url: t = "", fileType: r = "1" } = e;
|
|
447
446
|
let n = "";
|
|
448
|
-
return t instanceof File ? n = URL.createObjectURL(t) :
|
|
447
|
+
return t instanceof File ? n = URL.createObjectURL(t) : E(t) ? n = t : t instanceof Blob ? n = URL.createObjectURL(t) : (t.includes("https") || t.includes("http")) && (n = t), new Promise((i) => {
|
|
449
448
|
let o;
|
|
450
449
|
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() {
|
|
451
450
|
i({
|
|
@@ -470,17 +469,17 @@ function _(e) {
|
|
|
470
469
|
async function Ee(e) {
|
|
471
470
|
const { url: t = "", currentTime: r, videoSuffix: n = "", vidoeAllowPlay: i = !1 } = e;
|
|
472
471
|
let o = "", c = n, u = "1", f;
|
|
473
|
-
return t instanceof File ? (o = URL.createObjectURL(t), c =
|
|
472
|
+
return t instanceof File ? (o = URL.createObjectURL(t), c = O(t.name), u = m(t.name)) : t instanceof Blob ? (o = URL.createObjectURL(t), u = m(t)) : E(t) ? (o = t, u = m(t)) : (t.includes("https") || t.includes("http")) && (o = t, c = O(t), u = m(t)), (c ? g.videoAllowType.includes(c.toLowerCase()) : !1) ? i ? R(o, r) : (f = await J({
|
|
474
473
|
url: o,
|
|
475
474
|
fileType: u
|
|
476
|
-
}), f.play ?
|
|
475
|
+
}), f.play ? R(o, r) : new Promise((l) => {
|
|
477
476
|
l("");
|
|
478
|
-
})) : new Promise(
|
|
477
|
+
})) : new Promise((l) => {
|
|
479
478
|
l("");
|
|
480
479
|
});
|
|
481
480
|
}
|
|
482
|
-
async function
|
|
483
|
-
return new Promise(
|
|
481
|
+
async function R(e, t = 0) {
|
|
482
|
+
return new Promise((r) => {
|
|
484
483
|
let n = document.createElement("video");
|
|
485
484
|
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() {
|
|
486
485
|
let i;
|
|
@@ -496,7 +495,7 @@ async function E(e, t = 0) {
|
|
|
496
495
|
});
|
|
497
496
|
});
|
|
498
497
|
}
|
|
499
|
-
function
|
|
498
|
+
function E(e = "") {
|
|
500
499
|
return !!(e && [
|
|
501
500
|
"data:image/",
|
|
502
501
|
"data:video/",
|
|
@@ -510,51 +509,51 @@ function je(e, t, r, n = !1) {
|
|
|
510
509
|
e && t && r && e.removeEventListener(t, r, n);
|
|
511
510
|
}
|
|
512
511
|
export {
|
|
513
|
-
|
|
512
|
+
ge as arrayRepeat,
|
|
514
513
|
be as blobToDataURL,
|
|
515
514
|
m as checkFileType,
|
|
516
515
|
P as classNames,
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
516
|
+
pe as compareArray,
|
|
517
|
+
Oe as dataURLtoBlob,
|
|
518
|
+
Ae as dataURLtoFile,
|
|
519
|
+
b as deepCopy,
|
|
521
520
|
we as formatDuraton,
|
|
522
521
|
le as genColumnKey,
|
|
523
|
-
|
|
522
|
+
R as generateVidoePicture,
|
|
524
523
|
ve as getBase64,
|
|
525
524
|
Se as getBlobUrl,
|
|
526
|
-
|
|
525
|
+
O as getFileSuffix,
|
|
527
526
|
W as getLevelData,
|
|
528
527
|
ye as getMaxFloor,
|
|
529
|
-
|
|
528
|
+
J as getMediaInfos,
|
|
530
529
|
fe as getPrefixCls,
|
|
531
530
|
q as getRandomNumber,
|
|
532
531
|
oe as getRealVNode,
|
|
533
|
-
|
|
532
|
+
M as getScroll,
|
|
534
533
|
Y as getScrollContainer,
|
|
535
534
|
ce as getSlot,
|
|
536
535
|
k as getSlotVNode,
|
|
537
536
|
ue as getSlotsProps,
|
|
538
537
|
me as getSortIndex,
|
|
539
538
|
Ee as getVideoCoverPicture,
|
|
540
|
-
|
|
539
|
+
_ as getVideoFileUrl,
|
|
541
540
|
g as globalConfig,
|
|
542
541
|
de as handleCurrentPage,
|
|
543
542
|
se as handleShowIndex,
|
|
544
543
|
he as hanndleField,
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
544
|
+
j as is,
|
|
545
|
+
p as isArray,
|
|
546
|
+
E as isBase64,
|
|
548
547
|
A as isBoolean,
|
|
549
548
|
ne as isBrowser,
|
|
550
|
-
|
|
549
|
+
S as isDeepEqualReact,
|
|
551
550
|
z as isEmptySlot,
|
|
552
551
|
Z as isFunction,
|
|
553
552
|
G as isInContainer,
|
|
554
553
|
Q as isNumber,
|
|
555
|
-
|
|
554
|
+
h as isObject,
|
|
556
555
|
D as isScroll,
|
|
557
|
-
|
|
556
|
+
y as isServer,
|
|
558
557
|
H as isSlotFragment,
|
|
559
558
|
B as isString,
|
|
560
559
|
te as merge,
|
package/dist/pro-utils.umd.cjs
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
(function(c,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(c=typeof globalThis<"u"?globalThis:c||self,g(c.PorUtils={},c.vue))})(this,function(c,g){"use strict";const m=typeof window>"u";/**
|
|
2
|
-
* @vue/shared v3.4.19
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const z=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},k=/-(\w)/g,q=z(e=>e.replace(k,(n,i)=>i?i.toUpperCase():"")),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"})});
|
|
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 t=Object.create(null);return i=>t[i]||(t[i]=e(i))},k=/-(\w)/g,q=z(e=>e.replace(k,(t,i)=>i?i.toUpperCase():"")),T=function(e,t){var i;if(m||!e||!t)return"";t=q(t),t==="float"&&(t="cssFloat");try{const n=e.style[t];if(n)return n;const r=(i=document==null?void 0:document.defaultView)==null?void 0:i.getComputedStyle(e,"");return r?r[t]:""}catch{return e.style[t]}},U=(e,t)=>m?void 0:(t==null?T(e,"overflow"):t?T(e,"overflow-y"):T(e,"overflow-x")).match(/(scroll|auto|overlay)/),H=(e,t)=>{if(m)return;let i=e;for(;i;){if([window,document,document.documentElement].includes(i))return window;if(U(i,t))return i;i=i.parentNode}return i},W=(e,t)=>{if(m||!e||!t)return!1;const i=e.getBoundingClientRect();let n;return[window,document,document.documentElement,null,void 0].includes(t)?n={top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:n=t.getBoundingClientRect(),i.top<n.bottom&&i.bottom>n.top&&i.right>n.left&&i.left<n.right},_=Object.prototype.toString;function j(e,t){return _.call(e)===`[object ${t}]`}function p(e){return j(e,"Boolean")}function J(e){return typeof e=="number"}function h(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function y(e){return e!==null&&j(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 t=[];for(let i=0;i<e.length;i++){const n=e[i];if(n){if(B(n))t.push(n);else if(h(n))for(let r=0;r<n.length;r++){const o=C(n[r]);o&&t.push(o)}else if(y(n))for(const r in n)n[r]&&t.push(r)}}return t.filter(i=>i).join(" ")}let Y=0;const s={};function v(e,t=1){const i=Y++;let n=t;function r(){n-=1,n<=0?(e(),delete s[i]):s[i]=requestAnimationFrame(r)}return s[i]=requestAnimationFrame(r),i}v.cancel=function(t){t!==void 0&&(cancelAnimationFrame(s[t]),delete s[t])},v.ids=s;function E(e){return e!=null&&e===e.window}function D(e,t){var r;if(typeof window>"u")return 0;const i=t?"scrollTop":"scrollLeft";let n=0;return E(e)?n=e[t?"pageYOffset":"pageXOffset"]:e instanceof Document?n=e.documentElement[i]:e&&(n=e[i]),e&&!E(e)&&typeof n!="number"&&(n=(r=(e.ownerDocument||e).documentElement)==null?void 0:r[i]),n}function G(e,t,i,n){const r=i-t;return e/=n/2,e<1?r/2*e*e*e+t:r/2*((e-=2)*e*e+2)+t}function Q(e,t={}){const{getContainer:i=()=>window,callback:n,duration:r=450}=t,o=i(),u=D(o,!0),f=Date.now(),l=()=>{const a=Date.now()-f,d=G(a>r?r:a,u,e,r);E(o)?o.scrollTo(window.pageXOffset,d):o instanceof HTMLDocument||o.constructor.name==="HTMLDocument"?o.documentElement.scrollTop=d:o.scrollTop=d,a<r?v(l):typeof n=="function"&&n()};v(l)}function Z(e){let t;const i=r=>()=>{t=null,e(...r)},n=(...r)=>{t==null&&(t=requestAnimationFrame(i(r)))};return n.cancel=()=>cancelAnimationFrame(t),n}const w={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 t={},i=e.length;let n,r=0;for(;r<i;r+=1)for(n in e[r])Object.prototype.hasOwnProperty.call(e[r],n)&&(typeof t[n]=="object"&&typeof e[r][n]=="object"&&t[n]!==void 0&&t[n]!==null&&!Array.isArray(t[n])&&!Array.isArray(e[r][n])?t[n]={...t[n],...e[r][n]}:t[n]=e[r][n]);return t};function b(e,t,i,n){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;let r,o,u;if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(!b(e[o],t[o],i,n))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o of e.entries())if(!t.has(o[0]))return!1;for(o of e.entries())if(!b(o[1],t.get(o[0]),i,n))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o of e.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(e[o]!==t[o])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString)return e.toString()===t.toString();if(u=Object.keys(e),r=u.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,u[o]))return!1;for(o=r;o--!==0;){const f=u[o];if(!(i!=null&&i.includes(f))&&!(f==="_owner"&&e.$$typeof)&&!b(e[f],t[f],i,n))return n&&console.log(f),!1}return!0}return e!==e&&t!==t}const ee=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,te=()=>process.env.NODE_ENV==="TEST"?!0:typeof window<"u"&&typeof window.document<"u"&&typeof window.matchMedia<"u"&&!ee,ne=e=>{if(e&&e!==!0)return e},ie=e=>{const t={};if(Object.keys(e||{}).forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),!(Object.keys(t).length<1))return t};function I(e){return g.isVNode(e)?String(e.type)==="template"||String(e.type)===String(Symbol("Comment"))||String(e.type)===String(Symbol("Fragment"))||String(e.type)===String(Symbol("v-fgt"))||String(e.type)===String(Symbol("v-cmt"))||String(e.type)===String(Symbol()):!0}const P=e=>e.length===1&&I(e==null?void 0:e[0]);function re(e){if(e&&h(e)){const t=P(e)?h(e[0].children)?e[0].children:[]:e;return h(t)?t:[]}return e||[]}function oe(e,t,i="default"){return t[i]===!1?!1:p(t[i])&&t[i]?(e==null?void 0:e[i])||t[i]:t[i]||e[i]}function x(e,t,i="default"){var n,r;return t[i]===!1?!1:p(t[i])&&t[i]?((n=e==null?void 0:e[i])==null?void 0:n.call(e))||t[i]:t[i]||((r=e[i])==null?void 0:r.call(e))}function ce(e,t,i){const n={};return e.forEach(r=>{const o=x(t,i,r);(p(o)||o)&&(n[r]=o)}),n}const ue=({suffixCls:e,customizePrefixCls:t,isPor:i,className:n})=>{const r=n||(i?"gx-pro":"gx");return t||(e?`${r}-${e}`:r)},fe=(e,t)=>e?Array.isArray(e)?e.join("-"):e.toString():`${t}`;function le(e,{align:t,showIndex:i}){const n=A(e);if(i&&e.length&&e.every(r=>r.dataIndex!=="sortIndex")){const r=e[0];n.unshift({title:"序号",align:t,fixed:r.fixed,width:60,uuid:N().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else n.filter(r=>r.dataIndex!=="sortIndex");return n}function ae(e,...t){return typeof e=="function"?e(...t):e}function A(e){return JSON.parse(JSON.stringify(e))}function se(e,t){if(y(e)){const{pageSize:i=10,total:n=0}=e;let{current:r=1}=e;return n-t<=i*(r-1)&&(r=r-1),r===0?1:r}return 1}function de(e=[],t,i="children"){function n(r,o){return o.map((u,f)=>{const l=`${r}-${f+1}`;return u[i]&&(u[i]=n(l,u[i])),u.sortIndex=l,u})}return A(e).map((r,o)=>{let u=o;const f=y(t)&&t.current||1,l=y(t)&&t.pageSize||10;return u=f?(f-1)*l+(o+1):o+1,r[i]&&(r[i]=n(`${u}`,r[i])),r.sortIndex=u,r})}function ge(e,t,i,n){const r=e[i],o=t[i];let u=0;return r<o?u=n===0?-1:0:r>o&&(u=n===0?0:-1),u}function me(e){let t=A(e);const i=new Set(t);return t=Array.from(i),t}function he(e,t){const i=["null","undefined"];let n=!0;return e===0?n=!0:i.includes(e)?n=!1:e||(n=!1),n?{value:e,success:n}:{value:t===""?t:t||"-",success:n}}function ye(e){let t="";if(e>-1){const i=Math.floor(e/3600),n=Math.floor(e/60)%60,r=Number.parseInt(String(e%60));i<10?t="0"+i+":":t=i+":",n<10&&(t+="0"),t+=n+":",r<10&&(t+="0"),t+=r}return t.split(":")[0]==="00"?`${t.split(":")[1]}:${t.split(":")[2]}`:t}function N(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return{uuid(t,i){const n=e,r=[],o=i||n.length;let u,f;if(t)for(u=0;u<t;u+=1)r[u]=n[Number.parseInt(String(Math.random()*o))];else for(r[8]="-",r[13]="-",r[18]="-",r[23]="-",r[14]="4",u=0;u<36;u+=1)r[u]||(f=Math.random()*16,r[u]=n[u===19?f&&3||8:f]);return r.join("")},uuidFast(){const t=e,i=Array.from({length:36});let n=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":(n<=2&&(n=33554432+Math.random()*16777216||0),r=n&&15,n=n>4,i[o]=t[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,t=>{const i=Math.random()*16||0;return(t==="x"?i:i&&3||8).toString(16)})}}}function we(e=[]){let t=0;function i(n=[],r){n.forEach(o=>{o.floor=r,r>t&&(t=r),o.children&&o.children.length>0&&i(o.children,r+1)})}return i(e,1),t}function M(e,t="children"){let i=[];return e.forEach(n=>{i.push(n),n[t]&&n[t].length>0&&(i=i.concat(M(n[t])))}),i}function Se(e,t,i,n,r){t=t||"id",i=i||"parentId",n=n||"children",r=r||0;const o=JSON.parse(JSON.stringify(e));return o.filter(u=>{const f=o.filter(l=>u[t]===l[i||"parentId"]);return f.length>0?u[n||"children"]=f:delete u[n||"children"],u[i||"parentId"]===r})}function pe(e){return URL.createObjectURL(e)}function ve(e){return new Promise((t,i)=>{const n=new FileReader;n.readAsDataURL(e),n.onload=()=>t(n.result),n.onerror=r=>i(r)})}function be(e){const t=e.split(","),i=t[0].match(/:(.*?);/)[1],n=atob(t[1]);let r=n.length;const o=new Uint8Array(r);for(;r--;)o[r]=n.charCodeAt(r);return new Blob([o],{type:i})}function Ae(e,t){const i=e.split(","),n=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],t,{type:n})}function Oe(e,t,i){return new window.File([e],t,{type:i})}function V(e=""){const t=e.indexOf("?");return t>0?`${e.substring(0,t)}`:e}function O(e=""){e=V(e);const t=e.lastIndexOf(".");return t>0?`${e.substring(t).split("?")[0]}`.split(".")[1]:""}function S(e,t){if(t)return t;if(!e||e==="data:")return"4";let i="4";return F(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(),w.imageType.includes(i)?"1":w.videoType.includes(i)?"3":w.audioType.includes(i)?"2":"4"}function $(e){const{url:t="",fileType:i="1"}=e;let n="";return t instanceof File?n=URL.createObjectURL(t):F(t)?n=t:t instanceof Blob?n=URL.createObjectURL(t):(t.includes("https")||t.includes("http"))&&(n=t),new Promise(r=>{let o;i==="1"?(o=document.createElement("img"),o.src=n):i==="2"?(o=document.createElement("audio"),o.src=n):i==="3"&&(o=document.createElement("video"),o.src=n),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:t="",currentTime:i,videoSuffix:n="",vidoeAllowPlay:r=!1}=e;let o="",u=n,f="1",l;return t instanceof File?(o=URL.createObjectURL(t),u=O(t.name),f=S(t.name)):t instanceof Blob?(o=URL.createObjectURL(t),f=S(t)):F(t)?(o=t,f=S(t)):(t.includes("https")||t.includes("http"))&&(o=t,u=O(t),f=S(t)),(u?w.videoAllowType.includes(u.toLowerCase()):!1)?r?L(o,i):(l=await $({url:o,fileType:f}),l.play?L(o,i):new Promise(a=>{a("")})):new Promise(a=>{a("")})}async function L(e,t=0){return new Promise(i=>{let n=document.createElement("video");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(){let r;n==null||n.addEventListener("seeked",async function(){r&&r()});const o=(n==null?void 0:n.duration)||0;for(;t<o;){n&&(n.currentTime=t),await new Promise(je=>r=je);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),R=(n==null?void 0:n.videoWidth)||0*f,a=(n==null?void 0:n.videoHeight)||0*f,d=0;u.width=(n==null?void 0:n.videoWidth)||0*f,u.height=(n==null?void 0:n.videoHeight)||0*f,l.drawImage(n,0,0,R+d,a+d),n=null,i(R===0||a===0?"":u.toDataURL("image/png",1))}})})}function F(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(i=>e.includes(i)))}function Re(e,t,i,n=!1){e&&t&&i&&e.addEventListener(t,i,n)}function Te(e,t,i,n=!1){e&&t&&i&&e.removeEventListener(t,i,n)}c.arrayRepeat=me,c.blobToDataURL=Oe,c.checkFileType=S,c.classNames=C,c.compareArray=ge,c.dataURLtoBlob=be,c.dataURLtoFile=Ae,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=w,c.handleCurrentPage=se,c.handleShowIndex=le,c.hanndleField=he,c.is=j,c.isArray=h,c.isBase64=F,c.isBoolean=p,c.isBrowser=te,c.isDeepEqualReact=b,c.isEmptySlot=I,c.isFunction=X,c.isInContainer=W,c.isNumber=J,c.isObject=y,c.isScroll=U,c.isServer=m,c.isSlotFragment=P,c.isString=B,c.merge=K,c.off=Te,c.omitBoolean=ne,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/scroll/raf.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface RafMap {
|
|
|
3
3
|
}
|
|
4
4
|
declare function wrapperRaf(callback: () => void, delayFrames?: number): number;
|
|
5
5
|
declare namespace wrapperRaf {
|
|
6
|
-
var cancel: (pid?: number
|
|
6
|
+
var cancel: (pid?: number) => void;
|
|
7
7
|
var ids: RafMap;
|
|
8
8
|
}
|
|
9
9
|
export default wrapperRaf;
|
package/dist/typings/index.d.ts
CHANGED
|
@@ -22,9 +22,12 @@ export type ProColumn<T = any> = {
|
|
|
22
22
|
dataIndex: string;
|
|
23
23
|
width?: number;
|
|
24
24
|
} & T;
|
|
25
|
-
export
|
|
25
|
+
export interface MaterialInfo {
|
|
26
26
|
play?: boolean;
|
|
27
27
|
width?: number;
|
|
28
28
|
height?: number;
|
|
29
29
|
duration?: number;
|
|
30
|
+
}
|
|
31
|
+
export type OmitUndefined<T> = {
|
|
32
|
+
[P in keyof T]: NonNullable<T[P]>;
|
|
30
33
|
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/validate.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare function is(val: unknown, type: string): boolean;
|
|
2
2
|
export declare function isBoolean(val: unknown): val is boolean;
|
|
3
|
-
export declare function isNumber(val: unknown):
|
|
3
|
+
export declare function isNumber(val: unknown): val is number;
|
|
4
4
|
/**
|
|
5
|
-
* @author gx12358
|
|
5
|
+
* @author gx12358 gx12358@gmail.com
|
|
6
6
|
* @description 判断是否是数组
|
|
7
7
|
* @param arg
|
|
8
8
|
* @returns {arg is any[]|boolean}
|
|
@@ -16,10 +16,10 @@ export declare function isArray(arg: unknown): boolean;
|
|
|
16
16
|
*/
|
|
17
17
|
export declare function isObject(val: any): val is Record<any, any>;
|
|
18
18
|
/**
|
|
19
|
-
* @author gx12358
|
|
19
|
+
* @author gx12358 gx12358@gmail.com
|
|
20
20
|
* @description 判断是否是字符串
|
|
21
21
|
* @param value
|
|
22
22
|
* @returns {boolean}
|
|
23
23
|
*/
|
|
24
|
-
export declare function isString(value: unknown):
|
|
24
|
+
export declare function isString(value: unknown): value is string | String;
|
|
25
25
|
export declare function isFunction(func: any): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/pro-utils",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.28",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite",
|
|
6
6
|
"build": "vite build",
|
|
@@ -23,44 +23,14 @@
|
|
|
23
23
|
"require": "./dist/pro-utils.umd.cjs"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"lodash-es": "^4.17.21",
|
|
28
|
-
"vue": "^3.3.7",
|
|
29
|
-
"vue-types": "^4.1.1"
|
|
30
|
-
},
|
|
31
26
|
"devDependencies": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"@types/node": "^20.11.19",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
38
|
-
"@typescript-eslint/parser": "^7.0.1",
|
|
39
|
-
"@vitejs/plugin-vue": "^5.0.4",
|
|
40
|
-
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
41
|
-
"eslint": "^8.56.0",
|
|
42
|
-
"eslint-config-prettier": "^9.1.0",
|
|
43
|
-
"eslint-plugin-import": "^2.29.1",
|
|
44
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
45
|
-
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
46
|
-
"eslint-plugin-vue": "^9.21.1",
|
|
47
|
-
"jsdom": "^19.0.0",
|
|
48
|
-
"less": "^4.1.2",
|
|
49
|
-
"rollup": "^2.70.2",
|
|
50
|
-
"postcss": "^8.4.35",
|
|
51
|
-
"postcss-html": "^1.6.0",
|
|
52
|
-
"postcss-less": "^6.0.0",
|
|
53
|
-
"prettier": "^3.2.5",
|
|
54
|
-
"stylelint": "^16.2.1",
|
|
55
|
-
"stylelint-config-recommended": "^14.0.0",
|
|
56
|
-
"stylelint-config-recommended-vue": "^1.5.0",
|
|
57
|
-
"stylelint-config-standard": "^25.0.0",
|
|
58
|
-
"stylelint-order": "^6.0.4",
|
|
59
|
-
"stylelint-prettier": "^5.0.0",
|
|
60
|
-
"typescript": "^5.3.3",
|
|
61
|
-
"vite": "^5.1.4",
|
|
62
|
-
"vue-eslint-parser": "^9.4.2",
|
|
63
|
-
"vue-tsc": "^1.8.27"
|
|
27
|
+
"typescript": "^5.3.3"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"vue": ">=3.0.0"
|
|
64
31
|
},
|
|
65
|
-
"description": "Gx Design Pro Utils"
|
|
32
|
+
"description": "Gx Design Pro Utils",
|
|
33
|
+
"authors": [
|
|
34
|
+
"gx12358 <gx12358@gmail.com> (https://github.com/gx12358)"
|
|
35
|
+
]
|
|
66
36
|
}
|