- 서버 `M02_Precombo_Folders` — 종류 인자(precombo · sangeun · 자리 파일 `{종류}_폴더.json`) · 폴더 지우기 = 안의 문서 파일째(모두 검사 뒤 한 번에 · 바깥에서 쓰면 409 + 그 이름 · 지우는 것끼리 참조는 됨) · 문서 지우기 · `대상` 여럿 옮기기 · 지우기 · 붙여넣기(새 키 · 본뜬 = 원본 · 같은 폴더 이름 「(1)」)
- 길 `M02_Labor_Router` — `/layers/{층}/{종류}-tree` GET · POST · `/paste`(옛 precombo-tree 주소 그대로)
- 화면 새 `UI_Side_Library.ts` — 일위대가 · 단가산출 두 칸이 같이 쓰는 서고 칸(Ctrl · Shift 고름 · 오른쪽 클릭 · Ctrl+C · Ctrl+V · Delete · 지우기 확인 창 · 끌어 옮기기 여럿) · `UI_Side_Precombo.ts` = 일위대가 몫만 넘김
- `Api_Fetch` — 나무 부르기 종류 인자 · `pasteLibraryTree` · `newLibrary` 종류 sangeun
- 시험 — 새 `test_716_4_library_folders.py`(임시 storage) · 낡은 것 고침: `test_m02_precombo_folders`(빈 폴더만 지움 → 안에 든 것째 · 「없는 사전조합」 → 「없는 문서」 · FILE → file_of) · `test_m02_precombo_scope` + helper(나무 짜기 · 서고 길 글이 Library.ts 로 옮김)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
3.4 KiB
TypeScript
75 lines
3.4 KiB
TypeScript
/* =============================================================================
|
|
* M02_MasterTemplete_UI_Side_Precombo.ts
|
|
* 좌측 「일위대가」 칸(50-3 ③ · 51-4 · 134-3) — 서고 칸(`UI_Side_Library` · 716-4)에 일위대가 몫만 줌:
|
|
* 종류 precombo · 그 층 목록표 고름 · 새 문서 몸 · 글. 층 단추는 페이지가 만듦(페이지 층과 따로).
|
|
* 구분 · 상세구분은 문서 칸(상세 머리 · 고르기 창 거름 · `precomboClasses`) — 나무 폴더와 무관.
|
|
* 문서 누름 = 편집 칸(UI_Main 종류 precombo = 일위대가 상세 모드) · 켜진 층 단추 다시 누름 = 목록표
|
|
* (`Library_List` · 생성 · 복사 · 삭제는 거기) · 그 층 주인(`owner`) · 고칠 권한(`canWrite`)은 고름에 실어 보냄.
|
|
* ========================================================================== */
|
|
|
|
import type { TreeMenuItem } from "@ui/ui_template_tree";
|
|
import type { Kind } from "./M02_MasterTemplete_Api_Fetch";
|
|
import type { StructDef } from "./StructOptions/M02_SO_Def_Model";
|
|
import { tc } from "./M02_MasterTemplete_Labor_Text";
|
|
import type { Selection } from "./M02_MasterTemplete_UI_Main";
|
|
import {
|
|
buildLibrarySection,
|
|
type LibraryHandle,
|
|
type LibraryScope,
|
|
} from "./M02_MasterTemplete_UI_Side_Library";
|
|
|
|
export type PrecomboKind = Extract<Kind, "precombo">;
|
|
|
|
export const isPrecombo = (kind: Kind): kind is PrecomboKind => kind === "precombo";
|
|
|
|
/** 여러 구조물에 쓰는 묶음(콘크리트 · 거푸집 등) — 군마다 첫 상세구분(134-5) */
|
|
export const COMMON = "공통";
|
|
|
|
/** 사전조합 구분 · 상세구분(134-5) — 구조물군 A~G › 그 군 구조물 종류 + 「공통」(원천 `구조물정의.json` ·
|
|
* B05 구조물 배치와 같은 갈래 · 꺼진 종류도 넣음) */
|
|
export const precomboClasses = (
|
|
def: Pick<StructDef, "구조물군" | "types">,
|
|
): { name: string; details: string[] }[] =>
|
|
Object.entries(def.구조물군)
|
|
.filter(([key]) => /^[A-G]$/.test(key))
|
|
.map(([key, name]) => ({
|
|
name,
|
|
details: [COMMON, ...new Set(def.types.filter((t) => t.group === key).map((t) => t.name))],
|
|
}));
|
|
|
|
/** 사전조합 층(134-3) — 페이지 층과 따로 · `owner` null = 자기 층 */
|
|
export type PrecomboScope = LibraryScope;
|
|
|
|
/** 그 층 목록표 고름(켜진 층 단추 다시 누름) */
|
|
export const precomboList = (scope: PrecomboScope): Selection => ({
|
|
layer: scope.layer,
|
|
owner: scope.owner,
|
|
canWrite: scope.canWrite,
|
|
projectId: null,
|
|
kind: "precombo",
|
|
name: "",
|
|
label: tc("Lib_PrecomboAll"),
|
|
});
|
|
|
|
export interface PrecomboOptions {
|
|
scope: () => PrecomboScope;
|
|
/** 층 단추 줄(페이지가 만듦 · 그릴 때마다 새로 — 켜진 단추가 바뀜) */
|
|
bar: () => HTMLElement;
|
|
confirmLeave: () => Promise<boolean>;
|
|
onOpen: (sel: Selection | null) => void;
|
|
getOpen: () => Selection | null;
|
|
/** 문서 줄 덧메뉴(706-1 회사에 올리기 요청) — 없거나 빈 목록이면 메뉴 없음 */
|
|
more?: (key: string, name: string) => TreeMenuItem[];
|
|
}
|
|
|
|
export type PrecomboHandle = LibraryHandle;
|
|
|
|
export const buildPrecomboSection = (opt: PrecomboOptions): PrecomboHandle =>
|
|
buildLibrarySection({
|
|
...opt,
|
|
kind: "precombo",
|
|
list: precomboList,
|
|
blank: (name) => ({ 이름: name, 구분: "", 상세구분: "", 단위: null, 담은로직: [] }),
|
|
text: { none: tc("Lib_None"), newHere: tc("Lib_NewHere") },
|
|
});
|