diff --git a/index.html b/index.html index ab2d123..a28bbef 100644 --- a/index.html +++ b/index.html @@ -170,7 +170,6 @@
-

복사하지 않는 값: 좌표 · IP · 받침 EL · 코핑 상면 EL · 기초 하단 EL · 지반고 · 기둥 높이 · 말뚝 선단 EL · 계단 구간

diff --git a/src/core/copy-targets.ts b/src/core/copy-targets.ts index 25c8c3b..f787ef1 100644 --- a/src/core/copy-targets.ts +++ b/src/core/copy-targets.ts @@ -39,6 +39,11 @@ export const MEMBER_COPY_ITEMS: Record = { ground: ['ground-position'], }; +/** Whether the 속성 복사 panel is shown for the 부재: only when it has copy items. */ +export function hasCopyItems(member: MemberId): boolean { + return copyItemsFor(member).length > 0; +} + /** The copy items for the selected 부재. */ export function copyItemsFor(member: MemberId): CopyItem[] { return MEMBER_COPY_ITEMS[member]; diff --git a/src/main.ts b/src/main.ts index 3726670..55e4cdb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import { buildTemplateWorkbook } from './core/template'; import { EDITABLE_FIELDS, FIELD_LABELS, overrideKeys, pendingKeys, revertDraft, type EditableKey, type PierValues } from './core/changes'; import { adjustRow, layoutText, resolveRowCounts, rowLayout, totalPiles } from './core/piles'; import { applyCopy, COPY_ITEMS, planCopy, type CopyItem } from './core/copy'; -import { copyCandidates, copyItemsFor, copyItemsWithOverrides, selectedTargets, type CopyCandidate } from './core/copy-targets'; +import { copyCandidates, copyItemsFor, copyItemsWithOverrides, hasCopyItems, selectedTargets, type CopyCandidate } from './core/copy-targets'; import { pileGeometry } from './core/geometry'; import { rebarSummary, type RebarRow } from './core/rebar/summary'; import { shearSegments } from './core/rebar/coping'; @@ -678,7 +678,8 @@ function renderCopyItems(): void { label.append(check, document.createTextNode(COPY_ITEMS[item].label)); box.appendChild(label); } - $('cp-none').hidden = items.length > 0; + // The panel is hidden for a 부재 without copy items (교량받침·기둥 are 예정). + $('copy-panel').hidden = !hasCopyItems(state.member); } function renderCopyTargets(): void { diff --git a/tests/copy-targets.test.ts b/tests/copy-targets.test.ts index 6aeb8f9..aa7c749 100644 --- a/tests/copy-targets.test.ts +++ b/tests/copy-targets.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { copyCandidates, copyItemsFor, copyItemsWithOverrides, selectedTargets, type CopyCandidate } from '../src/core/copy-targets'; +import { copyCandidates, copyItemsFor, copyItemsWithOverrides, hasCopyItems, selectedTargets, type CopyCandidate } from '../src/core/copy-targets'; import { loadP1 } from './helpers'; const piers: CopyCandidate[] = [ @@ -88,3 +88,16 @@ describe('copyItemsWithOverrides (기준 교각에서 되돌리기가 표시된 expect(copyItemsWithOverrides(source({ groundEl: base.groundEl + 0.5 }))).toEqual([]); }); }); + +describe('hasCopyItems (속성 복사 패널을 보일지)', () => { + it('shows the panel for coping, 확대기초·말뚝 and 지반', () => { + expect(hasCopyItems('coping')).toBe(true); + expect(hasCopyItems('footing')).toBe(true); + expect(hasCopyItems('ground')).toBe(true); + }); + + it('hides the panel for 교량받침 and 기둥 (no copy items yet)', () => { + expect(hasCopyItems('bearing')).toBe(false); + expect(hasCopyItems('column')).toBe(false); + }); +});