From bf844e60fed1f784944820595efe61823b22a03c Mon Sep 17 00:00:00 2001 From: Caaalabash Date: Sat, 14 Sep 2024 10:52:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=8A=82=E7=82=B9/=E8=BE=B9=E7=9A=84=E5=94=AF?= =?UTF-8?q?=E4=B8=80=E6=A0=87=E8=AF=86=20#4442?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/x6/src/model/cell.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/x6/src/model/cell.ts b/packages/x6/src/model/cell.ts index 87e94587a7d..c9b303af8ff 100644 --- a/packages/x6/src/model/cell.ts +++ b/packages/x6/src/model/cell.ts @@ -83,6 +83,11 @@ export class Cell< }, metadata) } + // eslint-disable-next-line + public static customId(metadata: Cell.Metadata = {}) { + return StringExt.uuid() + } + // #endregion protected get [Symbol.toStringTag]() { @@ -107,7 +112,7 @@ export class Cell< this.preprocess(metadata), ) - this.id = props.id || StringExt.uuid() + this.id = props.id || Cell.customId(metadata) this.store = new Store(props) this.animation = new Animation(this) this.setup() @@ -140,7 +145,7 @@ export class Cell< const props = ctor.applyPropHooks(this, metadata) if (id == null && ignoreIdCheck !== true) { - props.id = StringExt.uuid() + props.id = Cell.customId(metadata) } return props as Properties