@g1cloud/entity-modeler-next 5.0.0-alpha.19 → 5.0.0-alpha.20

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.
@@ -1,6 +1,12 @@
1
- import { Association, AssociationEnd, AssociationLayout, Attribute, Entity, EntityIndex, Geo, LogicalGroup, ModelId, Note, Operation, Point } from '../core/types';
1
+ import { Association, AssociationEnd, AssociationLayout, Attribute, Entity, EntityIndex, EntityLayout, Geo, GroupLayout, LogicalGroup, ModelId, Note, Operation, Point } from '../core/types';
2
2
  import { Command } from './types';
3
- export declare function addEntity(entity: Entity, geo: Geo): Command;
3
+ /**
4
+ * geo 외 EntityLayout 부가 필드(collapsed·displayMode·style·attributeStyles 등).
5
+ * import 등 레이아웃 스타일까지 복제하는 경로에서 전달. entityRef·geo는 별도 인자라 제외.
6
+ * locked는 뷰 어포던스라 호출자가 필요 시만 포함(import는 드롭).
7
+ */
8
+ export type EntityLayoutExtras = Partial<Omit<EntityLayout, 'entityRef' | 'geo'>>;
9
+ export declare function addEntity(entity: Entity, geo: Geo, extras?: EntityLayoutExtras): Command;
4
10
  /** 엔티티 삭제 — 참조 관계·레이아웃·그룹 멤버십까지 cascade. memento로 위치 보존 복원. */
5
11
  export declare function removeEntity(entityId: ModelId): Command;
6
12
  /** 엔티티 필드 부분 수정 (name·stereotype·package·table·jpaAttrs·description 등). 얕은 patch. */
@@ -30,7 +36,9 @@ export declare function setEntityLocked(entityId: ModelId, locked: boolean): Com
30
36
  export declare function setAllEntitiesCollapsed(collapsed: boolean): Command;
31
37
  /** 속성 강조 색상 변경 (레이아웃 attributeStyles[attrId]) */
32
38
  export declare function setAttributeSwatch(entityId: ModelId, attributeId: ModelId, token: string | null): Command;
33
- export declare function addGroup(group: LogicalGroup, geo: Geo): Command;
39
+ /** geo GroupLayout 부가 필드(style ). entityLayout의 EntityLayoutExtras 거울. */
40
+ export type GroupLayoutExtras = Partial<Omit<GroupLayout, 'groupRef' | 'geo' | 'memberNoteRefs'>>;
41
+ export declare function addGroup(group: LogicalGroup, geo: Geo, extras?: GroupLayoutExtras): Command;
34
42
  /** 그룹 필드 부분 수정 (name·description·packageName·excludeDDLGeneration). 얕은 patch. */
35
43
  export declare function updateGroup(groupId: ModelId, patch: Partial<LogicalGroup>): Command;
36
44
  /** 그룹 해제(삭제) — 멤버 엔티티는 남고 그룹/박스만 제거 */
@@ -0,0 +1,17 @@
1
+ import { Attribute, Entity } from './types';
2
+ /** 물리 FK 컬럼을 가진 FK 여부 — derivedFrom(관계 파생) + dbAttrs(물리 컬럼) 보유. */
3
+ export declare function isPhysicalFk(a: Attribute): boolean;
4
+ /**
5
+ * 물리 FK 컬럼을 가진 FK를 순수 PK 바로 뒤로 당긴다. `순수 PK → 물리 FK → 나머지` 순으로 재배열하되,
6
+ * FK끼리·나머지끼리의 상대 순서는 원본 order를 보존한다(순서를 새로 추정하지 않음). 순수 PK가 없으면
7
+ * FK를 맨 앞으로. 물리 컬럼 없는 nav 참조(dbAttrs=0)는 추정이라 제외 — 실제로 그런 참조는 어느 엔티티
8
+ * attributes에도 물질화되지 않으므로(유령 앵커 참조) 대상이 되는 일도 없다.
9
+ *
10
+ * ★ order 필드뿐 아니라 **배열 물리 순서 자체**를 재정렬한다. 캔버스 노드(EntityNode)는 attributes를
11
+ * 배열 순서 그대로 렌더하고(order 정렬 미적용), 코드젠·탐색기는 order로 정렬하므로, 둘을 일치시켜야
12
+ * 모든 표시 경로에서 순서가 같다. [[attribute-display-order-array-vs-order-field]]
13
+ *
14
+ * 경계 강등(mergeDiagram)으로 derivedFrom이 제거된 FK는 `isPhysicalFk`가 false라 일반 컬럼으로 제자리에
15
+ * 남는다 — 강등 이후에 호출해야 한다.
16
+ */
17
+ export declare function reorderForeignAttributes(entities: Entity[]): void;
@@ -0,0 +1,38 @@
1
+ import { Association, AssociationLayout, DiagramLayout, Entity, EntityLayout, GroupLayout, LogicalGroup, LogicalModel, ModelId, Point } from './types';
2
+ export interface MergeDiagramSource {
3
+ logical: LogicalModel;
4
+ /** 소스 다이어그램 레이아웃 — 임포트 서브그래프의 좌표/스타일을 함께 옮긴다. */
5
+ layout: DiagramLayout;
6
+ }
7
+ export interface MergeDiagramOptions {
8
+ /** depth-1 관련 엔티티(경계 관계의 반대편)를 선택집합에 함께 끌어와 관계를 유지(D3 옵션 토글). */
9
+ includeRelated?: boolean;
10
+ /** 병합 대상(타깃) 논리 모델 — 이름/테이블 물리명 충돌 감지에 사용(D7). */
11
+ existing: LogicalModel;
12
+ /** 임포트 서브그래프 좌표에 더할 오프셋(D8 — 빈 영역 배치는 호출자가 계산해 전달). */
13
+ offset?: Point;
14
+ /** 결정적 테스트를 위한 id 생성기 주입(기본 newId). */
15
+ idFactory?: () => ModelId;
16
+ }
17
+ export interface MergeDiagramResult {
18
+ logical: {
19
+ entities: Entity[];
20
+ associations: Association[];
21
+ groups: LogicalGroup[];
22
+ };
23
+ layout: {
24
+ entityLayouts: EntityLayout[];
25
+ associationLayouts: AssociationLayout[];
26
+ groupLayouts: GroupLayout[];
27
+ };
28
+ /** 소스 modelId → 임포트 modelId 매핑(컨트롤러 진입점·후속 배선용). */
29
+ idMap: Map<ModelId, ModelId>;
30
+ }
31
+ /**
32
+ * 소스 다이어그램의 선택 서브그래프를 새 id 체계로 재매핑해 반환한다.
33
+ *
34
+ * @param source 소스 다이어그램(로드된 논리 + 레이아웃)
35
+ * @param selectedIds 임포트할 엔티티 modelId 목록(부분 선택 — 전량은 전 엔티티 id 전달)
36
+ * @param opts 경계/충돌/오프셋 정책
37
+ */
38
+ export declare function mergeDiagram(source: MergeDiagramSource, selectedIds: ModelId[], opts: MergeDiagramOptions): MergeDiagramResult;
@@ -6,6 +6,7 @@ import { OpSyncTransport } from '../command/opSync';
6
6
  import { FieldAuditRecord } from '../core/projectFieldAudit';
7
7
  import { ResolvedDiagram } from '../core/resolve';
8
8
  import { RoutingMode } from '../core/routing';
9
+ import { MergeDiagramSource } from '../core/mergeDiagram';
9
10
  import { ValidationIssue } from '../core/validation';
10
11
  import { AssociationEnd, Attribute, DisplayMode, EmbeddableCatalog, Entity, EntityIndex, Geo, GroupCodeCatalog, LangCode, LogicalGroup, ModelId, Operation, Point, PredefinedCustomTypeCatalog } from '../core/types';
11
12
  /**
@@ -408,6 +409,14 @@ export interface EditorController {
408
409
  clipboard: Ref<ClipboardContent | null>;
409
410
  copy(): void;
410
411
  paste(): void;
412
+ /**
413
+ * 타 다이어그램(비즈모듈)의 선택 서브그래프를 현재 다이어그램에 병합 임포트(G1).
414
+ * 깊은 복사(새 id) + 경계 강등 + 물리명 충돌 suffix는 순수 `mergeDiagram`이 수행하고,
415
+ * 여기서는 결과를 기존 다이어그램 우측 빈 영역에 배치해 단일 composite로 실행한다(재전파 없음 — D6).
416
+ */
417
+ importEntities(source: MergeDiagramSource, selectedIds: ModelId[], opts?: {
418
+ includeRelated?: boolean;
419
+ }): void;
411
420
  }
412
421
  export declare const EDITOR: InjectionKey<EditorController>;
413
422
  export declare function emptyState(modelId?: string, diagramId?: string): EditorState;