Files
Aislo/resources/tester/fixture_data_table_sample.js
T
eomsangdonandClaude Opus 5.5 184d79cbdf feat(ui_template): B08 · B09 공용 많은 자료 표 양식(70-1)
- createDataTable — 묶음 머리 여러 줄 · 머리 · 앞 열 · 합계 줄 고정 스크롤
- 숫자 오른쪽 맞춤 · 고정폭 숫자 · 천 단위 쉼표 · 열마다 소수 자리 · 빈 값 「—」
- 줄 번갈아 색 · 올린 줄 강조 · 테마 토큰만 · 보이는 줄 근처만 그림(1,000줄 64~118ms)
- 견본(머리 3줄 · 30열 · 66줄 · 합계) 시험

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MgChuAcyBqUkhHMTXomQC7
2026-10-06 23:06:23 +09:00

59 lines
2.2 KiB
JavaScript

/* 공용 표(`ui_template/ui_template_data_table.ts`) 견본 — 토적표 모양 · 머리 3줄 · 30열 · 합계.
* 그냥 글(스크립트)로 읽어 씀 — Node 헬퍼와 화면 eval 이 같은 견본을 씀.
* const s = sampleDataTable(66); // { columns, rows, total, frozen } */
function sampleDataTable(n) {
const num = (key, label, group, decimals) => ({ key, label, group, kind: "number", decimals });
const trio = (pre, group) => [
num(pre + "_area", "단면적", group, 2),
num(pre + "_vol", "입적", group, 1),
num(pre + "_adj", "보정량", group, 1),
];
const pair = (pre, group) => [
num(pre + "_len", "거리", group, 1),
num(pre + "_area", "면적", group, 1),
];
const columns = [
{ key: "sta", label: "측점", width: 80 },
num("dist", "거리", [], 0),
...trio("cs", ["절토", "토사"]),
...trio("cr", ["절토", "연암"]),
...trio("ds", ["절토", "측구파기 토사"]),
...trio("dr", ["절토", "측구파기 암"]),
num("adj_sum", "보정량계", ["절토"], 1),
num("fill_area", "단면적", ["성토"], 2),
num("fill_vol", "입적", ["성토"], 1),
num("reuse", "유용토", [], 1),
num("diff", "차인토량", [], 1),
num("cum", "누가토량", [], 1),
...pair("gf", ["면고르기", "성토면"]),
...pair("gc", ["면고르기", "절토면"]),
...pair("tf", ["지장목제거", "성토"]),
...pair("tc", ["지장목제거", "절토"]),
...pair("rd", ["노면정리"]),
];
const rows = [];
let cum = 0;
for (let i = 0; i < n; i++) {
const r = {
sta: i % 5 ? `${120 + Math.floor(i / 5)}+${(i % 5) * 4}` : String(120 + i / 5),
dist: i ? 4 : 0,
};
columns.slice(2).forEach((c, j) => {
// 빈 값 · 큰 값 · 음수가 섞이게
r[c.key] =
(i + j) % 7 === 0
? null
: Math.round(((i * 37 + j * 101) % 997) * (j % 4 === 0 ? 13.7 : 1.13) * 100) / 100;
});
r.diff = Math.round((r.fill_vol ?? 0) - (r.cs_vol ?? 0)) / 1;
cum += r.diff;
r.cum = cum;
rows.push(r);
}
const total = { sta: "합계" };
columns.slice(1).forEach((c) => {
if (c.key !== "cum") total[c.key] = rows.reduce((s, r) => s + (r[c.key] ?? 0), 0);
});
return { columns, rows, total, frozen: 1 };
}