@canlooks/can-ui 0.0.149 → 0.0.150
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/cjs/utils/utils.js
CHANGED
|
@@ -28,7 +28,11 @@ exports.mergeComponentProps = mergeComponentProps;
|
|
|
28
28
|
* 获取UUID
|
|
29
29
|
*/
|
|
30
30
|
function getRandomId() {
|
|
31
|
-
|
|
31
|
+
if (typeof crypto.randomUUID === 'function') {
|
|
32
|
+
return crypto.randomUUID();
|
|
33
|
+
}
|
|
34
|
+
// polyfill for uuid v4
|
|
35
|
+
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16));
|
|
32
36
|
}
|
|
33
37
|
/**
|
|
34
38
|
* 拼接元素的类名
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* 获取UUID
|
|
3
3
|
*/
|
|
4
4
|
export function getRandomId() {
|
|
5
|
-
|
|
5
|
+
if (typeof crypto.randomUUID === 'function') {
|
|
6
|
+
return crypto.randomUUID();
|
|
7
|
+
}
|
|
8
|
+
// polyfill for uuid v4
|
|
9
|
+
return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, c => (+c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +c / 4).toString(16));
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
12
|
* 拼接元素的类名
|