Skip to content

Commit

Permalink
AmisLib export uuidv4 function
Browse files Browse the repository at this point in the history
window.BuilderAmisObject.AmisLib.uuidv4()
steedos/steedos-platform#6855
  • Loading branch information
baozhoutao committed May 20, 2024
1 parent 32bda6c commit 12c2666
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/@steedos-widgets/amis-lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* @Author: [email protected]
* @Date: 2022-09-01 09:09:12
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
* @LastEditTime: 2023-11-16 10:10:42
* @LastEditors: baozhoutao@steedos.com
* @LastEditTime: 2024-05-20 13:46:04
* @Description:
*/
export * from './lib/amis'
Expand Down Expand Up @@ -42,4 +42,6 @@ export * from './workflow';

export * from './lib/router'

export * from './i18n'
export * from './i18n'

export * from './utils/uuid';
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* @Author: 殷亮辉 [email protected]
* @Date: 2024-01-18 15:12:41
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
* @LastEditTime: 2024-01-18 15:12:49
* @LastEditors: baozhoutao@steedos.com
* @LastEditTime: 2024-05-20 13:46:41
*/
/**
* 生成符合标准uuid格式的36位满足唯一性的随机串
* @returns uuid
*/
export function uuidv4() {
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c: any) =>
(c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
}

0 comments on commit 12c2666

Please sign in to comment.