- ag-grid 기반 - 컬럼 사용자 정의 기능 제공 - 컬럼 재정렬, 고정, 정렬 기능 - 컬럼 상태 저장, 불러오기 - 마지막 컬럼 재 사용 - 아이콘, 장수명 클릭 시 특수 기능 제공 - 기본 세력 장수/암행부에서는 '감찰부' - 추가 컬럼 - 최근 전투 - 전투 수 - 승리 수 - 살상률 - API/Nation/GeneralList 추가 Co-authored-by: hide_d <hided62@gmail.com> Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/213
20 lines
658 B
TypeScript
20 lines
658 B
TypeScript
|
|
import type { ValuesOf } from "@/defs";
|
|
import { zip } from "lodash";
|
|
|
|
export function merge2DArrToObjectArr<T extends Record<string, unknown>>(column: (keyof T)[], list: ValuesOf<T>[][]): T[]{
|
|
const result: T[] = [];
|
|
for(const rawItem of list){
|
|
const item: Record<string, unknown> = {};
|
|
|
|
if(column.length != rawItem.length){
|
|
throw `column과 item의 길이가 같지 않습니다: ${column.length} != ${list.length}, ${JSON.stringify(item)}`;
|
|
}
|
|
|
|
for(const [key, value] of zip(column, rawItem)){
|
|
item[key as string] = value;
|
|
}
|
|
result.push(item as T);
|
|
}
|
|
return result;
|
|
} |