fix(capture-share): 이미지 캡쳐 시 input/select 외형 제거 + 발주번호 nowrap
Deploy momo-erp / deploy (push) Successful in 1m59s
Deploy momo-erp / deploy (push) Successful in 1m59s
문제: - 거래명세표 이미지 공유 시 input 박스(테두리/배경/그림자) 가 그대로 노출 - 발주번호 'O2605140012'/발주일자 텍스트가 좁은 폭에서 wrap 되어 깨짐 - 비고 빈 인풋이 영역만 차지 수정: - capture-share: 캡쳐 직전 모든 input/select/textarea 의 border/bg/ shadow/padding 제거. select 는 appearance:none 으로 화살표도 가림. 값 비어있는 input 은 display:none. 캡쳐 후 cssText 로 일괄 복원. - admin/orders: 발주번호/발주일자 영역 whitespace-nowrap + flex 로 변경.
This commit is contained in:
@@ -653,9 +653,9 @@ function StatementPreview({
|
||||
|
||||
{/* 좌: 발주 정보 / 우: 공급자 정보 박스 — 항상 가로 배치 */}
|
||||
<div className="flex justify-between items-start gap-3 mt-3 text-[11px]">
|
||||
<div className="space-y-0.5">
|
||||
<div className="space-y-0.5 whitespace-nowrap">
|
||||
<div><b>발주번호</b> · {order.ORDER_NO}</div>
|
||||
<div className="inline-flex items-center gap-1">
|
||||
<div className="flex items-center gap-1 whitespace-nowrap">
|
||||
<b>발주일자</b> ·{" "}
|
||||
{editable ? (
|
||||
<input
|
||||
|
||||
@@ -23,6 +23,35 @@ export async function captureAndShare({ node, filename, shareTitle, shareText, f
|
||||
const prev: { el: HTMLElement; display: string }[] = [];
|
||||
hideEls.forEach((el) => { prev.push({ el, display: el.style.display }); el.style.display = "none"; });
|
||||
|
||||
// input/select/textarea 의 외형(테두리/배경/padding) 제거 → 텍스트만 깔끔하게.
|
||||
// - select 의 화살표 아이콘도 appearance:none 으로 가림
|
||||
// - 비고 등 빈 인풋은 가리기 (값 없으면 영역만 차지)
|
||||
const fields = node.querySelectorAll<HTMLElement>("input, select, textarea");
|
||||
const fieldPrev: { el: HTMLElement; cssText: string; hidden: boolean }[] = [];
|
||||
fields.forEach((el) => {
|
||||
fieldPrev.push({ el, cssText: el.style.cssText, hidden: false });
|
||||
const tag = el.tagName.toLowerCase();
|
||||
const val = (el as HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement).value;
|
||||
// 빈 인풋은 숨김 (비고 등) — checkbox 류는 제외
|
||||
const type = (el as HTMLInputElement).type;
|
||||
if (tag !== "select" && type !== "checkbox" && type !== "radio" && (!val || !val.trim())) {
|
||||
el.style.display = "none";
|
||||
fieldPrev[fieldPrev.length - 1].hidden = true;
|
||||
return;
|
||||
}
|
||||
// 외형 제거 — 값만 텍스트처럼 보이게
|
||||
el.style.border = "none";
|
||||
el.style.background = "transparent";
|
||||
el.style.boxShadow = "none";
|
||||
el.style.padding = "0";
|
||||
el.style.outline = "none";
|
||||
if (tag === "select") {
|
||||
el.style.appearance = "none";
|
||||
(el.style as CSSStyleDeclaration & { webkitAppearance?: string }).webkitAppearance = "none";
|
||||
el.style.paddingRight = "0";
|
||||
}
|
||||
});
|
||||
|
||||
// forceWidth: 캡처 직전 임시로 node 의 width 를 강제하여 가로 layout 으로 펼친다.
|
||||
// 모바일 화면(좁은 viewport)에서 좁게 줄어든 표/품명을 한 줄로 펼치기 위함.
|
||||
const widthPrev: {
|
||||
@@ -80,6 +109,7 @@ export async function captureAndShare({ node, filename, shareTitle, shareText, f
|
||||
} finally {
|
||||
// 캡처 끝나면 (성공/실패 무관) 숨겼던 요소 복원
|
||||
prev.forEach((p) => { p.el.style.display = p.display; });
|
||||
fieldPrev.forEach((f) => { f.el.style.cssText = f.cssText; });
|
||||
if (widthPrev) {
|
||||
node.style.width = widthPrev.width;
|
||||
node.style.minWidth = widthPrev.minWidth;
|
||||
|
||||
Reference in New Issue
Block a user