Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/dialog/src/lib/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { filter, map, takeUntil } from 'rxjs/operators';

import { InternalDialogRef } from './dialog-ref';
import { DialogService } from './dialog.service';
import { coerceCssPixelValue } from './dialog.utils';
import { coerceCssPixelValue, generateUUID } from './dialog.utils';
import { DialogDraggableDirective, DragOffset } from './draggable.directive';
import { NODES_TO_INSERT } from './providers';

Expand Down Expand Up @@ -105,7 +105,7 @@ export class DialogComponent implements OnInit, OnDestroy {
}

if (!this.config.id) {
const id = `dialog-${crypto.randomUUID()}`;
const id = `dialog-${generateUUID()}`;
this.config.id = id;
this.dialogRef.updateConfig({ id });
if (isDevMode()) {
Expand Down
8 changes: 8 additions & 0 deletions libs/dialog/src/lib/dialog.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ export function coerceCssPixelValue(value: any): string {

return isString(value) ? value : `${value}px`;
}

export function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0,
v = c == 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}