Merge remote-tracking branch 'origin/sub_laptop_1' into main_laptop_1
This commit is contained in:
@@ -88,18 +88,22 @@ export function outdatedBanner(sources?: TableSource[]): string[] {
|
||||
/** 서버가 주는 표 한 벌 — 갈래·kind·한글 이름·줄 수. 화면은 제 목록을 안 가짐(늘면 저절로 섬). */
|
||||
export interface ServedKind {
|
||||
group: string;
|
||||
/** 갈래 한글 이름(이름표 `base_price_groups`) — 안 오면 group 키가 그대로 떠 빠진 것이 드러남 */
|
||||
group_label?: string;
|
||||
kind: string;
|
||||
label: string;
|
||||
rows: number;
|
||||
}
|
||||
|
||||
type KindBox = { group: string; label: string; items: ServedKind[] };
|
||||
|
||||
/** 받은 차례 그대로 갈래별로 묶음 — 갈래 차례도 서버가 낸 순서를 따름. */
|
||||
export function groupKinds(kinds: ServedKind[]): { group: string; items: ServedKind[] }[] {
|
||||
const boxes: { group: string; items: ServedKind[] }[] = [];
|
||||
export function groupKinds(kinds: ServedKind[]): KindBox[] {
|
||||
const boxes: KindBox[] = [];
|
||||
for (const kind of kinds) {
|
||||
const box = boxes.find((each) => each.group === kind.group);
|
||||
if (box) box.items.push(kind);
|
||||
else boxes.push({ group: kind.group, items: [kind] });
|
||||
else boxes.push({ group: kind.group, label: kind.group_label ?? kind.group, items: [kind] });
|
||||
}
|
||||
return boxes;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export function buildSidePanel(
|
||||
button.addEventListener("click", () => {
|
||||
activate(button);
|
||||
view.show({
|
||||
title: `${box.group} › ${served.label}`,
|
||||
title: `${box.label} › ${served.label}`,
|
||||
key: `base-prices/${served.kind}`,
|
||||
load: (query) => fetchBasePrices(served.kind, query),
|
||||
save: (rowId, values) => saveBasePrice(served.kind, rowId, values),
|
||||
@@ -64,7 +64,7 @@ export function buildSidePanel(
|
||||
});
|
||||
grid.append(button);
|
||||
}
|
||||
return { group: box.group, grid };
|
||||
return { label: box.label, grid };
|
||||
});
|
||||
const overridesButton = el("button", {
|
||||
className: "z01-master__base z01-master__base--wide",
|
||||
@@ -131,7 +131,7 @@ export function buildSidePanel(
|
||||
}
|
||||
|
||||
panel.append(
|
||||
...boxes.map((box) => section(box.group, box.grid)),
|
||||
...boxes.map((box) => section(box.label, box.grid)),
|
||||
section(L("Z01_MasterData_Tree"), tree),
|
||||
);
|
||||
attachCollapsible(panel);
|
||||
|
||||
@@ -30,14 +30,16 @@ import {
|
||||
|
||||
// kind 목록은 서버가 줌 — 화면이 제 목록을 들면 kind 가 늘 때마다 빠짐(2026-09-16 브레인)
|
||||
const served = [
|
||||
{ group: "base_price", kind: "labor", label: "노임", rows: 261 },
|
||||
{ group: "base_price", kind: "oil", label: "유가", rows: 36 },
|
||||
{ group: "pumsem_basis", kind: "coef", label: "토량환산계수", rows: 32 },
|
||||
{ group: "base_price", group_label: "기초단가", kind: "labor", label: "노임", rows: 261 },
|
||||
{ group: "base_price", group_label: "기초단가", kind: "oil", label: "유가", rows: 36 },
|
||||
{ group: "pumsem_basis", group_label: "품셈 기준", kind: "coef", label: "토량환산계수", rows: 32 },
|
||||
// 서버가 새 kind·새 갈래를 더해도 화면이 그대로 세움
|
||||
{ group: "pumsem_basis", kind: "machine_productivity", label: "기계 작업량", rows: 47 },
|
||||
{ group: "pumsem_basis", group_label: "품셈 기준", kind: "machine_productivity", label: "기계 작업량", rows: 47 },
|
||||
{ group: "work_axis", group_label: "공종 축", kind: "forest", label: "산림품셈 기준", rows: 358 },
|
||||
// 갈래 이름이 안 오면 키가 그대로 떠 빠진 것이 드러남(때우지 않음)
|
||||
{ group: "later_group", kind: "brand_new", label: "새 갈래 것", rows: 3 },
|
||||
];
|
||||
const grouped = groupKinds(served).map((g) => [g.group, g.items.map((i) => i.kind)]);
|
||||
const grouped = groupKinds(served).map((g) => [g.label, g.items.map((i) => i.kind)]);
|
||||
|
||||
// 열 제목 누르기 — 없음 → 오름 → 내림 → 없음(원본 차례) · 다른 열을 누르면 그 열 오름부터
|
||||
const sorts = [
|
||||
@@ -323,9 +325,10 @@ def test_칸_글자와_숨김_열(tmp_path: Path) -> None:
|
||||
None,
|
||||
{"key": "item_code", "desc": False},
|
||||
]
|
||||
# 서버 차례 그대로 갈래별로 묶임 · 새 kind·새 갈래도 저절로 섬(화면 목록이 없음)
|
||||
# 서버 차례 그대로 갈래별로 묶임 · 상자 이름은 서버 group_label · 새 kind·새 갈래도 저절로 섬
|
||||
assert got["grouped"] == [
|
||||
["base_price", ["labor", "oil"]],
|
||||
["pumsem_basis", ["coef", "machine_productivity"]],
|
||||
["기초단가", ["labor", "oil"]],
|
||||
["품셈 기준", ["coef", "machine_productivity"]],
|
||||
["공종 축", ["forest"]],
|
||||
["later_group", ["brand_new"]],
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user