@gx-design-vue/pro-utils 0.2.0-beta.8 → 0.2.0-beta.81
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/base64/index.d.ts +20 -0
- package/dist/cloneDeep/cloneDeepWith.d.ts +43 -0
- package/dist/cloneDeep/index.d.ts +47 -0
- package/dist/getValueFromObjectByKey/index.d.ts +3 -0
- package/dist/index.d.ts +18 -9
- package/dist/isImg/index.d.ts +2 -0
- package/dist/isNil/index.d.ts +1 -0
- package/dist/isUrl/index.d.ts +6 -0
- package/dist/merge/index.d.ts +45 -2
- package/dist/merge/mergeWith.d.ts +49 -0
- package/dist/merge/useDeepMege.d.ts +43 -0
- package/dist/nanoid/index.d.ts +6 -0
- package/dist/omitUndefined/index.d.ts +2 -5
- package/dist/omitUndefinedAndEmptyArr/index.d.ts +1 -0
- package/dist/pro-utils.js +1134 -0
- package/dist/pro-utils.umd.cjs +13 -0
- package/dist/slots/index.d.ts +67 -8
- package/dist/typings/index.d.ts +17 -16
- package/dist/utils/config.d.ts +1 -2
- package/dist/utils/getSymbols.d.ts +1 -0
- package/dist/utils/getTag.d.ts +8 -0
- package/dist/utils/index.d.ts +145 -22
- package/dist/utils/isNotNil.d.ts +1 -0
- package/dist/utils/isPlainObject.d.ts +43 -0
- package/dist/utils/isPrimitive.d.ts +29 -0
- package/dist/utils/isTypedArray.d.ts +27 -0
- package/dist/utils/isUnsafeProperty.d.ts +11 -0
- package/dist/utils/isValid.d.ts +2 -0
- package/dist/utils/raf.d.ts +5 -0
- package/dist/utils/tags.d.ts +26 -0
- package/dist/utils/validate.d.ts +11 -8
- package/package.json +26 -49
- package/dist/pro-utils.mjs +0 -562
- package/dist/pro-utils.umd.js +0 -1
- package/dist/scroll/raf.d.ts +0 -9
package/dist/pro-utils.mjs
DELETED
|
@@ -1,562 +0,0 @@
|
|
|
1
|
-
import { isVNode as F } from "vue";
|
|
2
|
-
import { cloneDeep as T } from "lodash-es";
|
|
3
|
-
const w = typeof window > "u";
|
|
4
|
-
process.env.NODE_ENV !== "production" && Object.freeze({});
|
|
5
|
-
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
6
|
-
const L = (e) => {
|
|
7
|
-
const t = /* @__PURE__ */ Object.create(null);
|
|
8
|
-
return (r) => t[r] || (t[r] = e(r));
|
|
9
|
-
}, D = /-(\w)/g, I = L((e) => e.replace(D, (t, r) => r ? r.toUpperCase() : "")), y = function(e, t) {
|
|
10
|
-
var r;
|
|
11
|
-
if (w || !e || !t)
|
|
12
|
-
return "";
|
|
13
|
-
t = I(t), t === "float" && (t = "cssFloat");
|
|
14
|
-
try {
|
|
15
|
-
const n = e.style[t];
|
|
16
|
-
if (n)
|
|
17
|
-
return n;
|
|
18
|
-
const i = (r = document == null ? void 0 : document.defaultView) == null ? void 0 : r.getComputedStyle(e, "");
|
|
19
|
-
return i ? i[t] : "";
|
|
20
|
-
} catch {
|
|
21
|
-
return e.style[t];
|
|
22
|
-
}
|
|
23
|
-
}, U = (e, t) => w ? void 0 : (t == null ? y(e, "overflow") : t ? y(e, "overflow-y") : y(e, "overflow-x")).match(/(scroll|auto|overlay)/), G = (e, t) => {
|
|
24
|
-
if (w)
|
|
25
|
-
return;
|
|
26
|
-
let r = e;
|
|
27
|
-
for (; r; ) {
|
|
28
|
-
if ([window, document, document.documentElement].includes(r))
|
|
29
|
-
return window;
|
|
30
|
-
if (U(r, t))
|
|
31
|
-
return r;
|
|
32
|
-
r = r.parentNode;
|
|
33
|
-
}
|
|
34
|
-
return r;
|
|
35
|
-
}, Q = (e, t) => {
|
|
36
|
-
if (w || !e || !t)
|
|
37
|
-
return !1;
|
|
38
|
-
const r = e.getBoundingClientRect();
|
|
39
|
-
let n;
|
|
40
|
-
return [window, document, document.documentElement, null, void 0].includes(t) ? n = {
|
|
41
|
-
top: 0,
|
|
42
|
-
right: window.innerWidth,
|
|
43
|
-
bottom: window.innerHeight,
|
|
44
|
-
left: 0
|
|
45
|
-
} : n = t.getBoundingClientRect(), r.top < n.bottom && r.bottom > n.top && r.right > n.left && r.left < n.right;
|
|
46
|
-
}, B = Object.prototype.toString;
|
|
47
|
-
function b(e, t) {
|
|
48
|
-
return B.call(e) === `[object ${t}]`;
|
|
49
|
-
}
|
|
50
|
-
function R(e) {
|
|
51
|
-
return b(e, "Boolean");
|
|
52
|
-
}
|
|
53
|
-
function Z(e) {
|
|
54
|
-
return typeof e == "number";
|
|
55
|
-
}
|
|
56
|
-
function C(e) {
|
|
57
|
-
return typeof Array.isArray > "u" ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
|
|
58
|
-
}
|
|
59
|
-
function g(e) {
|
|
60
|
-
return e !== null && b(e, "Object");
|
|
61
|
-
}
|
|
62
|
-
function P(e) {
|
|
63
|
-
return typeof e == "string" || e instanceof String;
|
|
64
|
-
}
|
|
65
|
-
function K(e) {
|
|
66
|
-
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Function]";
|
|
67
|
-
}
|
|
68
|
-
function M(...e) {
|
|
69
|
-
const t = [];
|
|
70
|
-
for (let r = 0; r < e.length; r++) {
|
|
71
|
-
const n = e[r];
|
|
72
|
-
if (n) {
|
|
73
|
-
if (P(n))
|
|
74
|
-
t.push(n);
|
|
75
|
-
else if (C(n))
|
|
76
|
-
for (let i = 0; i < n.length; i++) {
|
|
77
|
-
const o = M(n[i]);
|
|
78
|
-
o && t.push(o);
|
|
79
|
-
}
|
|
80
|
-
else if (g(n))
|
|
81
|
-
for (const i in n)
|
|
82
|
-
n[i] && t.push(i);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return t.filter((r) => r).join(" ");
|
|
86
|
-
}
|
|
87
|
-
let N = 0;
|
|
88
|
-
const a = {};
|
|
89
|
-
function h(e, t = 1) {
|
|
90
|
-
const r = N++;
|
|
91
|
-
let n = t;
|
|
92
|
-
function i() {
|
|
93
|
-
n -= 1, n <= 0 ? (e(), delete a[r]) : a[r] = requestAnimationFrame(i);
|
|
94
|
-
}
|
|
95
|
-
return a[r] = requestAnimationFrame(i), r;
|
|
96
|
-
}
|
|
97
|
-
h.cancel = function(t) {
|
|
98
|
-
t !== void 0 && (cancelAnimationFrame(a[t]), delete a[t]);
|
|
99
|
-
};
|
|
100
|
-
h.ids = a;
|
|
101
|
-
function S(e) {
|
|
102
|
-
return e != null && e === e.window;
|
|
103
|
-
}
|
|
104
|
-
function $(e, t) {
|
|
105
|
-
var i;
|
|
106
|
-
if (typeof window > "u")
|
|
107
|
-
return 0;
|
|
108
|
-
const r = t ? "scrollTop" : "scrollLeft";
|
|
109
|
-
let n = 0;
|
|
110
|
-
return S(e) ? n = e[t ? "pageYOffset" : "pageXOffset"] : e instanceof Document ? n = e.documentElement[r] : e && (n = e[r]), e && !S(e) && typeof n != "number" && (n = (i = (e.ownerDocument || e).documentElement) == null ? void 0 : i[r]), n;
|
|
111
|
-
}
|
|
112
|
-
function V(e, t, r, n) {
|
|
113
|
-
const i = r - t;
|
|
114
|
-
return e /= n / 2, e < 1 ? i / 2 * e * e * e + t : i / 2 * ((e -= 2) * e * e + 2) + t;
|
|
115
|
-
}
|
|
116
|
-
function ee(e, t = {}) {
|
|
117
|
-
const { getContainer: r = () => window, callback: n, duration: i = 450 } = t, o = r(), c = $(o, !0), u = Date.now(), f = () => {
|
|
118
|
-
const s = Date.now() - u, l = V(s > i ? i : s, c, e, i);
|
|
119
|
-
S(o) ? o.scrollTo(window.pageXOffset, l) : o instanceof HTMLDocument || o.constructor.name === "HTMLDocument" ? o.documentElement.scrollTop = l : o.scrollTop = l, s < i ? h(f) : typeof n == "function" && n();
|
|
120
|
-
};
|
|
121
|
-
h(f);
|
|
122
|
-
}
|
|
123
|
-
function te(e) {
|
|
124
|
-
let t;
|
|
125
|
-
const r = (i) => () => {
|
|
126
|
-
t = null, e(...i);
|
|
127
|
-
}, n = (...i) => {
|
|
128
|
-
t == null && (t = requestAnimationFrame(r(i)));
|
|
129
|
-
};
|
|
130
|
-
return n.cancel = () => cancelAnimationFrame(t), n;
|
|
131
|
-
}
|
|
132
|
-
const p = {
|
|
133
|
-
videoAllowType: [
|
|
134
|
-
"mp4",
|
|
135
|
-
"webm",
|
|
136
|
-
"ogg"
|
|
137
|
-
],
|
|
138
|
-
audioAllowType: ["mp3"],
|
|
139
|
-
imageType: ["bmp", "png", "gif", "jpg", "jpeg", "psd", "tif"],
|
|
140
|
-
videoType: [
|
|
141
|
-
"mp4",
|
|
142
|
-
"swf",
|
|
143
|
-
"rmvb",
|
|
144
|
-
"avi",
|
|
145
|
-
"flv",
|
|
146
|
-
"mpg",
|
|
147
|
-
"rm",
|
|
148
|
-
"mov",
|
|
149
|
-
"asf",
|
|
150
|
-
"3gp",
|
|
151
|
-
"mkv",
|
|
152
|
-
"ts",
|
|
153
|
-
"f4v",
|
|
154
|
-
"webm",
|
|
155
|
-
"m4v",
|
|
156
|
-
"3g2",
|
|
157
|
-
"m3u8"
|
|
158
|
-
],
|
|
159
|
-
audioType: ["mp3", "mpeg", "aac", "wav", "wma", "mp2", "flac", "midi", "ra", "ape", "aac", "cda"]
|
|
160
|
-
}, ne = (...e) => {
|
|
161
|
-
const t = {}, r = e.length;
|
|
162
|
-
let n, i = 0;
|
|
163
|
-
for (; i < r; i += 1)
|
|
164
|
-
for (n in e[i])
|
|
165
|
-
e[i].hasOwnProperty(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] = {
|
|
166
|
-
...t[n],
|
|
167
|
-
...e[i][n]
|
|
168
|
-
} : t[n] = e[i][n]);
|
|
169
|
-
return t;
|
|
170
|
-
};
|
|
171
|
-
function x(e, t, r, n) {
|
|
172
|
-
if (e === t)
|
|
173
|
-
return !0;
|
|
174
|
-
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
175
|
-
if (e.constructor !== t.constructor)
|
|
176
|
-
return !1;
|
|
177
|
-
let i, o, c;
|
|
178
|
-
if (Array.isArray(e)) {
|
|
179
|
-
if (i = e.length, i != t.length)
|
|
180
|
-
return !1;
|
|
181
|
-
for (o = i; o-- !== 0; )
|
|
182
|
-
if (!x(e[o], t[o], r, n))
|
|
183
|
-
return !1;
|
|
184
|
-
return !0;
|
|
185
|
-
}
|
|
186
|
-
if (e instanceof Map && t instanceof Map) {
|
|
187
|
-
if (e.size !== t.size)
|
|
188
|
-
return !1;
|
|
189
|
-
for (o of e.entries())
|
|
190
|
-
if (!t.has(o[0]))
|
|
191
|
-
return !1;
|
|
192
|
-
for (o of e.entries())
|
|
193
|
-
if (!x(o[1], t.get(o[0]), r, n))
|
|
194
|
-
return !1;
|
|
195
|
-
return !0;
|
|
196
|
-
}
|
|
197
|
-
if (e instanceof Set && t instanceof Set) {
|
|
198
|
-
if (e.size !== t.size)
|
|
199
|
-
return !1;
|
|
200
|
-
for (o of e.entries())
|
|
201
|
-
if (!t.has(o[0]))
|
|
202
|
-
return !1;
|
|
203
|
-
return !0;
|
|
204
|
-
}
|
|
205
|
-
if (ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
|
|
206
|
-
if (i = e.length, i != t.length)
|
|
207
|
-
return !1;
|
|
208
|
-
for (o = i; o-- !== 0; )
|
|
209
|
-
if (e[o] !== t[o])
|
|
210
|
-
return !1;
|
|
211
|
-
return !0;
|
|
212
|
-
}
|
|
213
|
-
if (e.constructor === RegExp)
|
|
214
|
-
return e.source === t.source && e.flags === t.flags;
|
|
215
|
-
if (e.valueOf !== Object.prototype.valueOf && e.valueOf)
|
|
216
|
-
return e.valueOf() === t.valueOf();
|
|
217
|
-
if (e.toString !== Object.prototype.toString && e.toString)
|
|
218
|
-
return e.toString() === t.toString();
|
|
219
|
-
if (c = Object.keys(e), i = c.length, i !== Object.keys(t).length)
|
|
220
|
-
return !1;
|
|
221
|
-
for (o = i; o-- !== 0; )
|
|
222
|
-
if (!Object.prototype.hasOwnProperty.call(t, c[o]))
|
|
223
|
-
return !1;
|
|
224
|
-
for (o = i; o-- !== 0; ) {
|
|
225
|
-
const u = c[o];
|
|
226
|
-
if (!(r != null && r.includes(u)) && !(u === "_owner" && e.$$typeof) && !x(e[u], t[u], r, n))
|
|
227
|
-
return n && console.log(u), !1;
|
|
228
|
-
}
|
|
229
|
-
return !0;
|
|
230
|
-
}
|
|
231
|
-
return e !== e && t !== t;
|
|
232
|
-
}
|
|
233
|
-
const z = (
|
|
234
|
-
// @ts-ignore
|
|
235
|
-
typeof process < "u" && process.versions != null && process.versions.node != null
|
|
236
|
-
), re = () => process.env.NODE_ENV === "TEST" ? !0 : typeof window < "u" && typeof window.document < "u" && typeof window.matchMedia < "u" && !z, ie = (e) => {
|
|
237
|
-
if (e && e !== !0)
|
|
238
|
-
return e;
|
|
239
|
-
}, oe = (e) => {
|
|
240
|
-
const t = {};
|
|
241
|
-
if (Object.keys(e || {}).forEach((r) => {
|
|
242
|
-
e[r] !== void 0 && (t[r] = e[r]);
|
|
243
|
-
}), !(Object.keys(t).length < 1))
|
|
244
|
-
return t;
|
|
245
|
-
}, H = (e) => e.length === 1 && (String(e[0].type) === String(Symbol("Comment")) || String(e[0].type) === String(Symbol("Fragment")) || String(e[0].type) === String(Symbol()));
|
|
246
|
-
function ce(e) {
|
|
247
|
-
return H(e) && F(e[0].children) ? e[0].children : e;
|
|
248
|
-
}
|
|
249
|
-
function ue(e, t, r = "default") {
|
|
250
|
-
return t[r] === !1 ? !1 : R(t[r]) && t[r] ? (e == null ? void 0 : e[r]) || t[r] : t[r] || e[r];
|
|
251
|
-
}
|
|
252
|
-
function k(e, t, r = "default") {
|
|
253
|
-
var n, i;
|
|
254
|
-
return t[r] === !1 ? !1 : R(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));
|
|
255
|
-
}
|
|
256
|
-
function fe(e, t, r) {
|
|
257
|
-
const n = {};
|
|
258
|
-
return e.forEach((i) => {
|
|
259
|
-
n[i] = k(t, r, i);
|
|
260
|
-
}), n;
|
|
261
|
-
}
|
|
262
|
-
const se = ({ suffixCls: e, customizePrefixCls: t, isPor: r, className: n }) => {
|
|
263
|
-
const i = n || (r ? "gx-pro" : "gx");
|
|
264
|
-
return t || (e ? `${i}-${e}` : i);
|
|
265
|
-
}, le = (e, t) => e ? Array.isArray(e) ? e.join("-") : e.toString() : `${t}`;
|
|
266
|
-
function ae(e, { align: t, showIndex: r }) {
|
|
267
|
-
const n = T(e);
|
|
268
|
-
if (r && e.length && e.every((i) => i.dataIndex !== "sortIndex")) {
|
|
269
|
-
const i = e[0];
|
|
270
|
-
n.unshift({
|
|
271
|
-
title: "序号",
|
|
272
|
-
align: t,
|
|
273
|
-
fixed: i.fixed,
|
|
274
|
-
width: 60,
|
|
275
|
-
uuid: q().uuid(15),
|
|
276
|
-
dataIndex: "sortIndex",
|
|
277
|
-
key: "sortIndex"
|
|
278
|
-
});
|
|
279
|
-
} else
|
|
280
|
-
n.filter((i) => i.dataIndex !== "sortIndex");
|
|
281
|
-
return n;
|
|
282
|
-
}
|
|
283
|
-
function de(e, ...t) {
|
|
284
|
-
return typeof e == "function" ? e(...t) : e;
|
|
285
|
-
}
|
|
286
|
-
function E(e) {
|
|
287
|
-
return JSON.parse(JSON.stringify(e));
|
|
288
|
-
}
|
|
289
|
-
function me(e, t) {
|
|
290
|
-
if (g(e)) {
|
|
291
|
-
const { pageSize: r = 10, total: n = 0 } = e;
|
|
292
|
-
let { current: i = 1 } = e;
|
|
293
|
-
return n - t <= r * (i - 1) && (i = i - 1), i === 0 ? 1 : i;
|
|
294
|
-
}
|
|
295
|
-
return 1;
|
|
296
|
-
}
|
|
297
|
-
function pe(e = [], t, r = "children") {
|
|
298
|
-
function n(i, o) {
|
|
299
|
-
return o.map((c, u) => {
|
|
300
|
-
const f = `${i}-${u + 1}`;
|
|
301
|
-
return c[r] && (c[r] = n(f, c[r])), c.sortIndex = f, c;
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
return E(e).map((i, o) => {
|
|
305
|
-
let c = o;
|
|
306
|
-
const u = g(t) && t.current || 1, f = g(t) && t.pageSize || 10;
|
|
307
|
-
return c = u ? (u - 1) * f + (o + 1) : o + 1, i[r] && (i[r] = n(`${c}`, i[r])), i.sortIndex = c, i;
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
function ge(e, t, r, n) {
|
|
311
|
-
const i = e[r], o = t[r];
|
|
312
|
-
let c = 0;
|
|
313
|
-
return i < o ? c = n === 0 ? -1 : 0 : i > o && (c = n === 0 ? 0 : -1), c;
|
|
314
|
-
}
|
|
315
|
-
function he(e) {
|
|
316
|
-
let t = E(e);
|
|
317
|
-
const r = new Set(t);
|
|
318
|
-
return t = Array.from(r), t;
|
|
319
|
-
}
|
|
320
|
-
function we(e, t) {
|
|
321
|
-
const r = ["null", "undefined"];
|
|
322
|
-
let n = !0;
|
|
323
|
-
return e === 0 ? n = !0 : r.includes(e) ? n = !1 : e || (n = !1), n ? {
|
|
324
|
-
value: e,
|
|
325
|
-
success: n
|
|
326
|
-
} : {
|
|
327
|
-
value: t === "" ? t : t || "-",
|
|
328
|
-
success: n
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
function ye(e) {
|
|
332
|
-
let t = "";
|
|
333
|
-
if (e > -1) {
|
|
334
|
-
const r = Math.floor(e / 3600), n = Math.floor(e / 60) % 60, i = parseInt(String(e % 60));
|
|
335
|
-
r < 10 ? t = "0" + r + ":" : t = r + ":", n < 10 && (t += "0"), t += n + ":", i < 10 && (t += "0"), t += i;
|
|
336
|
-
}
|
|
337
|
-
return t.split(":")[0] === "00" ? `${t.split(":")[1]}:${t.split(":")[2]}` : t;
|
|
338
|
-
}
|
|
339
|
-
function q() {
|
|
340
|
-
const e = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
|
|
341
|
-
return {
|
|
342
|
-
uuid(t, r) {
|
|
343
|
-
const n = e, i = [], o = r || n.length;
|
|
344
|
-
let c, u;
|
|
345
|
-
if (t)
|
|
346
|
-
for (c = 0; c < t; c += 1)
|
|
347
|
-
i[c] = n[parseInt(String(Math.random() * o))];
|
|
348
|
-
else
|
|
349
|
-
for (i[8] = "-", i[13] = "-", i[18] = "-", i[23] = "-", i[14] = "4", c = 0; c < 36; c += 1)
|
|
350
|
-
i[c] || (u = Math.random() * 16, i[c] = n[c === 19 ? u && 3 || 8 : u]);
|
|
351
|
-
return i.join("");
|
|
352
|
-
},
|
|
353
|
-
uuidFast() {
|
|
354
|
-
const t = e, r = new Array(36);
|
|
355
|
-
let n = 0, i, o;
|
|
356
|
-
for (o = 0; o < 36; o += 1)
|
|
357
|
-
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]);
|
|
358
|
-
return r.join("");
|
|
359
|
-
},
|
|
360
|
-
uuidString() {
|
|
361
|
-
return this.uuidFast().replace(new RegExp("-", "g"), "");
|
|
362
|
-
},
|
|
363
|
-
uuidCompact() {
|
|
364
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
|
|
365
|
-
const r = Math.random() * 16 || 0;
|
|
366
|
-
return (t === "x" ? r : r && 3 || 8).toString(16);
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
function xe(e = []) {
|
|
372
|
-
let t = 0;
|
|
373
|
-
function r(n = [], i) {
|
|
374
|
-
n.forEach((o) => {
|
|
375
|
-
o.floor = i, i > t && (t = i), o.children && o.children.length > 0 && r(o.children, i + 1);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
return r(e, 1), t;
|
|
379
|
-
}
|
|
380
|
-
function W(e, t = "children") {
|
|
381
|
-
let r = [];
|
|
382
|
-
return e.forEach((n) => {
|
|
383
|
-
r.push(n), n[t] && n[t].length > 0 && (r = r.concat(W(n[t])));
|
|
384
|
-
}), r;
|
|
385
|
-
}
|
|
386
|
-
function Se(e, t, r, n, i) {
|
|
387
|
-
t = t || "id", r = r || "parentId", n = n || "children", i = i || 0;
|
|
388
|
-
const o = JSON.parse(JSON.stringify(e));
|
|
389
|
-
return o.filter((c) => {
|
|
390
|
-
const u = o.filter((f) => c[t] === f[r || "parentId"]);
|
|
391
|
-
return u.length > 0 ? c[n || "children"] = u : delete c[n || "children"], c[r || "parentId"] === i;
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
function ve(e) {
|
|
395
|
-
return URL.createObjectURL(e);
|
|
396
|
-
}
|
|
397
|
-
function Ae(e) {
|
|
398
|
-
return new Promise((t, r) => {
|
|
399
|
-
const n = new FileReader();
|
|
400
|
-
n.readAsDataURL(e), n.onload = () => t(n.result), n.onerror = (i) => r(i);
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
function Oe(e) {
|
|
404
|
-
const t = e.split(","), r = t[0].match(/:(.*?);/)[1], n = atob(t[1]);
|
|
405
|
-
let i = n.length;
|
|
406
|
-
const o = new Uint8Array(i);
|
|
407
|
-
for (; i--; )
|
|
408
|
-
o[i] = n.charCodeAt(i);
|
|
409
|
-
return new Blob([o], { type: r });
|
|
410
|
-
}
|
|
411
|
-
function be(e, t) {
|
|
412
|
-
const r = e.split(","), n = r[0].match(/:(.*?);/)[1], i = atob(r[1]);
|
|
413
|
-
let o = i.length;
|
|
414
|
-
const c = new Uint8Array(o);
|
|
415
|
-
for (; o--; )
|
|
416
|
-
c[o] = i.charCodeAt(o);
|
|
417
|
-
return new File([c], t, { type: n });
|
|
418
|
-
}
|
|
419
|
-
function Re(e, t, r) {
|
|
420
|
-
return new window.File([e], t, { type: r });
|
|
421
|
-
}
|
|
422
|
-
function J(e = "") {
|
|
423
|
-
const t = e.indexOf("?");
|
|
424
|
-
return t > 0 ? `${e.substring(0, t)}` : e;
|
|
425
|
-
}
|
|
426
|
-
function v(e = "") {
|
|
427
|
-
e = J(e);
|
|
428
|
-
const t = e.lastIndexOf(".");
|
|
429
|
-
return t > 0 ? `${e.substring(t).split("?")[0]}`.split(".")[1] : "";
|
|
430
|
-
}
|
|
431
|
-
function m(e, t) {
|
|
432
|
-
if (t)
|
|
433
|
-
return t;
|
|
434
|
-
if (!e || e === "data:")
|
|
435
|
-
return "4";
|
|
436
|
-
let r = "4";
|
|
437
|
-
return A(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(), p.imageType.includes(r) ? "1" : p.videoType.includes(r) ? "3" : p.audioType.includes(r) ? "2" : "4";
|
|
438
|
-
}
|
|
439
|
-
function _(e) {
|
|
440
|
-
const { url: t = "", fileType: r = "1" } = e;
|
|
441
|
-
let n = "";
|
|
442
|
-
return t instanceof File ? n = URL.createObjectURL(t) : A(t) ? n = t : t instanceof Blob ? n = URL.createObjectURL(t) : (t.includes("https") || t.includes("http")) && (n = t), new Promise(function(i) {
|
|
443
|
-
let o;
|
|
444
|
-
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() {
|
|
445
|
-
i({
|
|
446
|
-
play: !0,
|
|
447
|
-
width: o.width || 0,
|
|
448
|
-
height: o.height || 0
|
|
449
|
-
}), o = null;
|
|
450
|
-
} : o.oncanplay = function() {
|
|
451
|
-
i({
|
|
452
|
-
play: !0,
|
|
453
|
-
duration: o.duration,
|
|
454
|
-
width: (o == null ? void 0 : o.videoWidth) || 0,
|
|
455
|
-
height: (o == null ? void 0 : o.videoHeight) || 0
|
|
456
|
-
}), o = null;
|
|
457
|
-
}, o.onerror = function() {
|
|
458
|
-
i({
|
|
459
|
-
play: !1
|
|
460
|
-
}), o = null;
|
|
461
|
-
};
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
async function Ee(e) {
|
|
465
|
-
const { url: t = "", currentTime: r, videoSuffix: n = "", vidoeAllowPlay: i = !1 } = e;
|
|
466
|
-
let o = "", c = n, u = "1", f;
|
|
467
|
-
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)) : A(t) ? (o = t, u = m(t)) : (t.includes("https") || t.includes("http")) && (o = t, c = v(t), u = m(t)), (c ? p.videoAllowType.includes(c.toLowerCase()) : !1) ? i ? O(o, r) : (f = await _({
|
|
468
|
-
url: o,
|
|
469
|
-
fileType: u
|
|
470
|
-
}), f.play ? O(o, r) : new Promise(function(s) {
|
|
471
|
-
s("");
|
|
472
|
-
})) : new Promise(function(s) {
|
|
473
|
-
s("");
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
async function O(e, t = 0) {
|
|
477
|
-
return new Promise(function(r) {
|
|
478
|
-
let n = document.createElement("video");
|
|
479
|
-
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() {
|
|
480
|
-
let i;
|
|
481
|
-
n == null || n.addEventListener("seeked", async function() {
|
|
482
|
-
i && i();
|
|
483
|
-
});
|
|
484
|
-
const o = (n == null ? void 0 : n.duration) || 0;
|
|
485
|
-
for (; t < o; ) {
|
|
486
|
-
n && (n.currentTime = t), await new Promise((j) => i = j);
|
|
487
|
-
const c = document.createElement("canvas"), u = 0.8, f = c.getContext("2d"), d = (n == null ? void 0 : n.videoWidth) || 0 * u, s = (n == null ? void 0 : n.videoHeight) || 0 * u, l = 0;
|
|
488
|
-
c.width = (n == null ? void 0 : n.videoWidth) || 0 * u, c.height = (n == null ? void 0 : n.videoHeight) || 0 * u, f.drawImage(n, 0, 0, d + l, s + l), n = null, r(d === 0 || s === 0 ? "" : c.toDataURL("image/png", 1));
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
function A(e = "") {
|
|
494
|
-
return !!(e && [
|
|
495
|
-
"data:image/",
|
|
496
|
-
"data:video/",
|
|
497
|
-
"data:audio/"
|
|
498
|
-
].find((r) => e.includes(r)));
|
|
499
|
-
}
|
|
500
|
-
function je(e, t, r, n = !1) {
|
|
501
|
-
e && t && r && e.addEventListener(t, r, n);
|
|
502
|
-
}
|
|
503
|
-
function Fe(e, t, r, n = !1) {
|
|
504
|
-
e && t && r && e.removeEventListener(t, r, n);
|
|
505
|
-
}
|
|
506
|
-
export {
|
|
507
|
-
he as arrayRepeat,
|
|
508
|
-
Re as blobToDataURL,
|
|
509
|
-
m as checkFileType,
|
|
510
|
-
M as classNames,
|
|
511
|
-
ge as compareArray,
|
|
512
|
-
Oe as dataURLtoBlob,
|
|
513
|
-
be as dataURLtoFile,
|
|
514
|
-
E as deepCopy,
|
|
515
|
-
ye as formatDuraton,
|
|
516
|
-
le as genColumnKey,
|
|
517
|
-
O as generateVidoePicture,
|
|
518
|
-
Ae as getBase64,
|
|
519
|
-
ve as getBlobUrl,
|
|
520
|
-
v as getFileSuffix,
|
|
521
|
-
W as getLevelData,
|
|
522
|
-
xe as getMaxFloor,
|
|
523
|
-
_ as getMediaInfos,
|
|
524
|
-
se as getPrefixCls,
|
|
525
|
-
q as getRandomNumber,
|
|
526
|
-
ce as getRealVNode,
|
|
527
|
-
$ as getScroll,
|
|
528
|
-
G as getScrollContainer,
|
|
529
|
-
ue as getSlot,
|
|
530
|
-
k as getSlotVNode,
|
|
531
|
-
fe as getSlotsProps,
|
|
532
|
-
pe as getSortIndex,
|
|
533
|
-
Ee as getVideoCoverPicture,
|
|
534
|
-
J as getVideoFileUrl,
|
|
535
|
-
p as globalConfig,
|
|
536
|
-
me as handleCurrentPage,
|
|
537
|
-
ae as handleShowIndex,
|
|
538
|
-
we as hanndleField,
|
|
539
|
-
b as is,
|
|
540
|
-
C as isArray,
|
|
541
|
-
A as isBase64,
|
|
542
|
-
R as isBoolean,
|
|
543
|
-
re as isBrowser,
|
|
544
|
-
x as isDeepEqualReact,
|
|
545
|
-
K as isFunction,
|
|
546
|
-
Q as isInContainer,
|
|
547
|
-
Z as isNumber,
|
|
548
|
-
g as isObject,
|
|
549
|
-
U as isScroll,
|
|
550
|
-
w as isServer,
|
|
551
|
-
H as isSlotFragment,
|
|
552
|
-
P as isString,
|
|
553
|
-
ne as merge,
|
|
554
|
-
Fe as off,
|
|
555
|
-
ie as omitBoolean,
|
|
556
|
-
oe as omitUndefined,
|
|
557
|
-
je as on,
|
|
558
|
-
de as runFunction,
|
|
559
|
-
ee as scrollTo,
|
|
560
|
-
te as throttleByAnimationFrame,
|
|
561
|
-
Se as treeData
|
|
562
|
-
};
|
package/dist/pro-utils.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(c,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","vue","lodash-es"],g):(c=typeof globalThis<"u"?globalThis:c||self,g(c.PorUtils={},c.vue,c.lodashEs))})(this,function(c,g,$){"use strict";const m=typeof window>"u";process.env.NODE_ENV!=="production"&&Object.freeze({}),process.env.NODE_ENV!=="production"&&Object.freeze([]);const q=e=>{const n=Object.create(null);return i=>n[i]||(n[i]=e(i))},z=/-(\w)/g,k=q(e=>e.replace(z,(n,i)=>i?i.toUpperCase():"")),b=function(e,n){var i;if(m||!e||!n)return"";n=k(n),n==="float"&&(n="cssFloat");try{const t=e.style[n];if(t)return t;const r=(i=document==null?void 0:document.defaultView)==null?void 0:i.getComputedStyle(e,"");return r?r[n]:""}catch{return e.style[n]}},L=(e,n)=>m?void 0:(n==null?b(e,"overflow"):n?b(e,"overflow-y"):b(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(L(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 F(e,n){return J.call(e)===`[object ${n}]`}function R(e){return F(e,"Boolean")}function _(e){return typeof e=="number"}function U(e){return typeof Array.isArray>"u"?Object.prototype.toString.call(e)==="[object Array]":Array.isArray(e)}function h(e){return e!==null&&F(e,"Object")}function D(e){return typeof e=="string"||e instanceof String}function X(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function B(...e){const n=[];for(let i=0;i<e.length;i++){const t=e[i];if(t){if(D(t))n.push(t);else if(U(t))for(let r=0;r<t.length;r++){const o=B(t[r]);o&&n.push(o)}else if(h(t))for(const r in t)t[r]&&n.push(r)}}return n.filter(i=>i).join(" ")}let Y=0;const s={};function S(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}S.cancel=function(n){n!==void 0&&(cancelAnimationFrame(s[n]),delete s[n])},S.ids=s;function T(e){return e!=null&&e===e.window}function I(e,n){var r;if(typeof window>"u")return 0;const i=n?"scrollTop":"scrollLeft";let t=0;return T(e)?t=e[n?"pageYOffset":"pageXOffset"]:e instanceof Document?t=e.documentElement[i]:e&&(t=e[i]),e&&!T(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=I(o,!0),f=Date.now(),l=()=>{const a=Date.now()-f,d=G(a>r?r:a,u,e,r);T(o)?o.scrollTo(window.pageXOffset,d):o instanceof HTMLDocument||o.constructor.name==="HTMLDocument"?o.documentElement.scrollTop=d:o.scrollTop=d,a<r?S(l):typeof t=="function"&&t()};S(l)}function 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 p(e,n,i,t){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;let r,o,u;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!p(e[o],n[o],i,t))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;for(o of e.entries())if(!p(o[1],n.get(o[0]),i,t))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(o of e.entries())if(!n.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(e[o]!==n[o])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString&&e.toString)return e.toString()===n.toString();if(u=Object.keys(e),r=u.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,u[o]))return!1;for(o=r;o--!==0;){const f=u[o];if(!(i!=null&&i.includes(f))&&!(f==="_owner"&&e.$$typeof)&&!p(e[f],n[f],i,t))return t&&console.log(f),!1}return!0}return e!==e&&n!==n}const 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},C=e=>e.length===1&&(String(e[0].type)===String(Symbol("Comment"))||String(e[0].type)===String(Symbol("Fragment"))||String(e[0].type)===String(Symbol()));function re(e){return C(e)&&g.isVNode(e[0].children)?e[0].children:e}function oe(e,n,i="default"){return n[i]===!1?!1:R(n[i])&&n[i]?(e==null?void 0:e[i])||n[i]:n[i]||e[i]}function P(e,n,i="default"){var t,r;return n[i]===!1?!1:R(n[i])&&n[i]?((t=e==null?void 0:e[i])==null?void 0:t.call(e))||n[i]:n[i]||((r=e[i])==null?void 0:r.call(e))}function ce(e,n,i){const t={};return e.forEach(r=>{t[r]=P(n,i,r)}),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=$.cloneDeep(e);if(i&&e.length&&e.every(r=>r.dataIndex!=="sortIndex")){const r=e[0];t.unshift({title:"序号",align:n,fixed:r.fixed,width:60,uuid:x().uuid(15),dataIndex:"sortIndex",key:"sortIndex"})}else t.filter(r=>r.dataIndex!=="sortIndex");return t}function ae(e,...n){return typeof e=="function"?e(...n):e}function j(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 j(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=j(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 x(){const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return{uuid(n,i){const t=e,r=[],o=i||t.length;let u,f;if(n)for(u=0;u<n;u+=1)r[u]=t[parseInt(String(Math.random()*o))];else for(r[8]="-",r[13]="-",r[18]="-",r[23]="-",r[14]="4",u=0;u<36;u+=1)r[u]||(f=Math.random()*16,r[u]=t[u===19?f&&3||8:f]);return r.join("")},uuidFast(){const n=e,i=new Array(36);let t=0,r,o;for(o=0;o<36;o+=1)o===8||o===13||o===18||o===23?i[o]="-":o===14?i[o]="4":(t<=2&&(t=33554432+Math.random()*16777216||0),r=t&&15,t=t>4,i[o]=n[o===19?r&&3||8:r]);return i.join("")},uuidString(){return this.uuidFast().replace(new RegExp("-","g"),"")},uuidCompact(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const i=Math.random()*16||0;return(n==="x"?i:i&&3||8).toString(16)})}}}function 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 N(e,n="children"){let i=[];return e.forEach(t=>{i.push(t),t[n]&&t[n].length>0&&(i=i.concat(N(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 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 w(e,n){if(n)return n;if(!e||e==="data:")return"4";let i="4";return A(e)?e.includes("data:image/")?i="png":e.includes("data:video/")?i="mp4":e.includes("data:audio/")&&(i="mp3"):e instanceof Blob?(e=String(e),e.includes("image")?i="png":e.includes("video")?i="mp4":e.includes("audio")&&(i="mp3")):i=v(e).toLowerCase(),y.imageType.includes(i)?"1":y.videoType.includes(i)?"3":y.audioType.includes(i)?"2":"4"}function V(e){const{url:n="",fileType:i="1"}=e;let t="";return n instanceof File?t=URL.createObjectURL(n):A(n)?t=n:n instanceof Blob?t=URL.createObjectURL(n):(n.includes("https")||n.includes("http"))&&(t=n),new Promise(function(r){let o;i==="1"?(o=document.createElement("img"),o.src=t):i==="2"?(o=document.createElement("audio"),o.src=t):i==="3"&&(o=document.createElement("video"),o.src=t),i==="1"?o.onload=function(){r({play:!0,width:o.width||0,height:o.height||0}),o=null}:o.oncanplay=function(){r({play:!0,duration:o.duration,width:(o==null?void 0:o.videoWidth)||0,height:(o==null?void 0:o.videoHeight)||0}),o=null},o.onerror=function(){r({play:!1}),o=null}})}async function 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=v(n.name),f=w(n.name)):n instanceof Blob?(o=URL.createObjectURL(n),f=w(n)):A(n)?(o=n,f=w(n)):(n.includes("https")||n.includes("http"))&&(o=n,u=v(n),f=w(n)),(u?y.videoAllowType.includes(u.toLowerCase()):!1)?r?E(o,i):(l=await V({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(je=>r=je);const u=document.createElement("canvas"),f=.8,l=u.getContext("2d"),O=(t==null?void 0:t.videoWidth)||0*f,a=(t==null?void 0:t.videoHeight)||0*f,d=0;u.width=(t==null?void 0:t.videoWidth)||0*f,u.height=(t==null?void 0:t.videoHeight)||0*f,l.drawImage(t,0,0,O+d,a+d),t=null,i(O===0||a===0?"":u.toDataURL("image/png",1))}})})}function A(e=""){return!!(e&&["data:image/","data:video/","data:audio/"].find(i=>e.includes(i)))}function 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=B,c.compareArray=ge,c.dataURLtoBlob=Ae,c.dataURLtoFile=Oe,c.deepCopy=j,c.formatDuraton=ye,c.genColumnKey=fe,c.generateVidoePicture=E,c.getBase64=ve,c.getBlobUrl=pe,c.getFileSuffix=v,c.getLevelData=N,c.getMaxFloor=we,c.getMediaInfos=V,c.getPrefixCls=ue,c.getRandomNumber=x,c.getRealVNode=re,c.getScroll=I,c.getScrollContainer=H,c.getSlot=oe,c.getSlotVNode=P,c.getSlotsProps=ce,c.getSortIndex=de,c.getVideoCoverPicture=Fe,c.getVideoFileUrl=M,c.globalConfig=y,c.handleCurrentPage=se,c.handleShowIndex=le,c.hanndleField=he,c.is=F,c.isArray=U,c.isBase64=A,c.isBoolean=R,c.isBrowser=ne,c.isDeepEqualReact=p,c.isFunction=X,c.isInContainer=W,c.isNumber=_,c.isObject=h,c.isScroll=L,c.isServer=m,c.isSlotFragment=C,c.isString=D,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/scroll/raf.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface RafMap {
|
|
2
|
-
[id: number]: number;
|
|
3
|
-
}
|
|
4
|
-
declare function wrapperRaf(callback: () => void, delayFrames?: number): number;
|
|
5
|
-
declare namespace wrapperRaf {
|
|
6
|
-
var cancel: (pid?: number | undefined) => void;
|
|
7
|
-
var ids: RafMap;
|
|
8
|
-
}
|
|
9
|
-
export default wrapperRaf;
|