Files
shkim4 d56d587fd2 feat(orgchart): integrate chart-only viewport and scoped guard fixes
Add initial fit and direct wheel zoom with preserved default presentation. Integrate five scoped GuardFix findings and AI generation preselection policy. Exclude Cell experiments and retain five historical guard failures.
2026-10-13 18:41:14 +09:00

24 lines
1.1 KiB
TypeScript

import { createOrgChart, JsonOrgChartDataSource } from '@hm-design/org-chart';
import engineUrl from '@hm-design/org-chart/engine.css?url';
import coreUrl from '@hm-design/org-chart/style.css?url';
import { datasets, readQuery } from './data';
import './chart-only.css';
const { data, layout, embed } = readQuery();
if (embed) document.body.classList.add('embed');
const chart = createOrgChart({
container: document.getElementById('chart')!,
dataSource: new JsonOrgChartDataSource(datasets[data]!()),
stylesheetUrls: { engine: engineUrl, core: coreUrl },
displayMode: 'readOnly',
layoutMode: 'auto',
autoLayout: { type: layout },
// Chart Only implies initialView "fit" and wheelZoom "direct".
presentationMode: 'chart-only',
// Regression fixture: Fit below the manual zoom floor, without huge data.
zoom: new URLSearchParams(location.search).has('verify-min') ? { min: 0.8 } : undefined,
});
void chart.mount();
// Verification seam only: replace the whole dataset through the public handle.
Object.assign(window, { orgChart: chart, replaceData: (key: string) => chart.update(datasets[key]!()) });