From 278d19faa556d1967a933d7a1f38de29c49420f3 Mon Sep 17 00:00:00 2001 From: ypshim Date: Tue, 27 Oct 2026 17:03:45 +0900 Subject: [PATCH] =?UTF-8?q?feat(copy):=20=EB=B3=B5=EC=82=AC=20=ED=95=AD?= =?UTF-8?q?=EB=AA=A9=EC=9D=B4=20=EC=97=86=EB=8A=94=20=EB=B6=80=EC=9E=AC(?= =?UTF-8?q?=EA=B5=90=EB=9F=89=EB=B0=9B=EC=B9=A8=C2=B7=EA=B8=B0=EB=91=A5)?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=8A=94=20=EC=86=8D=EC=84=B1=20=EB=B3=B5?= =?UTF-8?q?=EC=82=AC=20=ED=8C=A8=EB=84=90=EC=9D=84=20=EC=88=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - hasCopyItems 추가, 테스트 2건 (코핑·확대기초·지반은 표시, 교량받침·기둥은 숨김) - "이 부재는 복사 항목이 없습니다" 문구 제거 - 대응표는 그대로 두어 항목이 생기면 자동으로 다시 표시 Co-Authored-By: Claude Haiku 5.5 --- index.html | 1 - src/core/copy-targets.ts | 5 +++++ src/main.ts | 5 +++-- tests/copy-targets.test.ts | 15 ++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) 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); + }); +});