feat(org-chart): separate fixed and auto layout previews

This commit is contained in:
shkim4 committed 2026-10-12 18:02:39 +09:00
1 parent 80583eb4ca
commit a92913d6bc
18 files changed
+1211 -7

No files matched your search

@@ -0,0 +1,47 @@
import { createEmployeeCard } from './employee-card.js';
import { createHeading, type RenderContext } from './render.js';
import { representativeCardAsset } from './representative-card-asset.js';
/** P5-1A presenter boundary. The shared Core supplies the initial engine groups;
* this presenter never assigns coordinates or interprets parentId. A later
* layout adapter can replace group placement without duplicating card or data
* rendering in React and Vanilla consumers. */
export function createExpandedOrgChartContent(
document: Document, context: RenderContext, tree: HTMLElement, signal: AbortSignal,
): HTMLElement {
const content = document.createElement('div');
content.className = 'hm-orgchart-expanded';
content.dataset.component = 'ExpandedOrgChartContent';
content.dataset.layoutMode = 'auto';
content.dataset.layoutStatus = 'preview';
const heading = createHeading(document, context);
const status = document.createElement('p');
status.className = 'hm-orgchart-expanded-stage-note';
status.textContent = 'P5-1A · 확장형 준비 화면';
const description = document.createElement('p');
description.className = 'hm-orgchart-expanded-description';
description.textContent = '대표자와 1Depth 예시 그룹을 표시합니다. 하위 계층 자동 배치와 접기·펼치기, Zoom/Pan은 후속 단계에서 구현합니다.';
content.append(heading, status, description);
const leaders = document.createElement('section');
leaders.className = 'hm-orgchart-expanded-top-leaders';
leaders.setAttribute('aria-label', '최상위 조직 리더');
for (const id of context.topLeaderIds) {
const employee = context.data.employees.find(item => item.id === id);
if (!employee) continue;
leaders.append(createEmployeeCard(document, employee, {
kind: 'topLeader',
workdeskPresentation: true,
cardAsset: representativeCardAsset,
affiliationName: context.data.affiliations.find(item => item.id === employee.affiliationId)?.name,
}, signal));
}
if (leaders.childElementCount) content.append(leaders);
// Keep the stable Core viewport for keyboard access and ordinary scrolling.
// This is a flow preview, with no fixed-stage scale observer or artwork.
tree.setAttribute('aria-label', '확장형 조직도 초기 그룹 영역');
content.append(tree);
return content;
}