只调整默认折叠深度;保留手动逐级展开、原统计值及另外两个分析维度。 验证:默认不显示二级节点的回归先红后绿,11项相关测试及类型检查通过。完整门禁、候选和上线验收待执行。
This commit is contained in:
@@ -76,6 +76,12 @@
|
|||||||
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
|
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
|
||||||
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
|
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
|
||||||
|
|
||||||
|
## 开发快照 snapshot/v0.1.47 - 2026-10-24
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 区域统计按部门视图默认只展开到一级部门,二级及以下初始收起;保留手动逐级展开、直属人员、既有统计口径及按区域/按人视图。
|
||||||
|
|
||||||
## 开发快照 snapshot/v0.1.46 - 2026-10-21
|
## 开发快照 snapshot/v0.1.46 - 2026-10-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -41,14 +41,21 @@ it('hides direct people together with collapsed departments without changing bra
|
|||||||
expect(html).not.toContain('data-person-key=')
|
expect(html).not.toContain('data-person-key=')
|
||||||
expect(html).toContain('data-total-people="3"')
|
expect(html).toContain('data-total-people="3"')
|
||||||
})
|
})
|
||||||
it('makes a deep leaf with direct people expandable but initially collapsed', () => {
|
it('defaults to first-level departments and keeps deeper leaves manually expandable without changing metrics', () => {
|
||||||
const data = parseDepartmentStatistics(departmentStatisticsFixture, { period: 'all' }).snapshot!
|
const data = parseDepartmentStatistics(departmentStatisticsFixture, { period: 'all' }).snapshot!
|
||||||
const child = data.rows.find((d) => d.id === 'child')!
|
const child = data.rows.find((d) => d.id === 'child')!
|
||||||
data.rows.push({ ...child, id: 'deep', parent_id: 'child', name: 'Deep Fixture' })
|
data.rows.push({ ...child, id: 'deep', parent_id: 'child', name: 'Deep Fixture' })
|
||||||
for (const p of data.people) p.department_ids = p.department_ids.map((id) => (id === 'child' ? 'deep' : id))
|
for (const p of data.people) p.department_ids = p.department_ids.map((id) => (id === 'child' ? 'deep' : id))
|
||||||
const initial = renderToStaticMarkup(<DepartmentStatisticsView data={data} />)
|
const initial = renderToStaticMarkup(<DepartmentStatisticsView data={data} />)
|
||||||
expect(initial).toContain('展开部门 Deep Fixture')
|
expect(initial).toContain('data-department-id="root"')
|
||||||
|
expect(initial).toContain('data-department-id="child"')
|
||||||
|
expect(initial).not.toContain('data-department-id="deep"')
|
||||||
expect(initial).not.toContain('data-parent-department="deep"')
|
expect(initial).not.toContain('data-parent-department="deep"')
|
||||||
|
const parentOpened = renderToStaticMarkup(<DepartmentStatisticsView data={data} collapsed={new Set(['deep'])} />)
|
||||||
|
expect(parentOpened).toContain('展开部门 Deep Fixture')
|
||||||
|
expect(parentOpened).not.toContain('data-parent-department="deep"')
|
||||||
|
expect(initial).toContain('data-total-people="3"')
|
||||||
|
expect(parentOpened).toContain('data-total-people="3"')
|
||||||
const expanded = renderToStaticMarkup(<DepartmentStatisticsView data={data} collapsed={new Set()} />)
|
const expanded = renderToStaticMarkup(<DepartmentStatisticsView data={data} collapsed={new Set()} />)
|
||||||
expect(expanded).toContain('data-parent-department="deep"')
|
expect(expanded).toContain('data-parent-department="deep"')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export function defaultStatisticsCollapsed(data: DepartmentStatisticsSnapshot):
|
|||||||
const direct = new Set(data.people.flatMap((p) => p.department_ids))
|
const direct = new Set(data.people.flatMap((p) => p.department_ids))
|
||||||
return new Set(
|
return new Set(
|
||||||
departmentTree(data.rows, new Set())
|
departmentTree(data.rows, new Set())
|
||||||
.filter((r) => r.depth >= 2 && (r.hasChildren || direct.has(r.department.id)))
|
.filter((r) => r.depth >= 1 && (r.hasChildren || direct.has(r.department.id)))
|
||||||
.map((r) => r.department.id)
|
.map((r) => r.department.id)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user