260225_01_ENH: 실제 Data 통계 API와 연결 및 일부 페이지 축소

This commit is contained in:
2026-02-25 16:48:12 +09:00
parent d0e1352739
commit 357d9f2946
38 changed files with 1593 additions and 1352 deletions

View File

@@ -1,34 +1,68 @@
import {BANNER_GROUP, BANNER_KEY_MAP, PRODUCT_KEY_MAP, PRODUCTS_FILTER_ITEM} from "@/const/lgConst";
import {CategoryTargetType} from "@/config/filter.types";
export type ProductKey = keyof typeof PRODUCT_KEY_MAP;
export type BannerKey = keyof typeof BANNER_KEY_MAP;
export type ProductsFilterItem = (typeof PRODUCTS_FILTER_ITEM)[number];
export type ServerBaseRow = {
export type BaseRow = {
year: string;
rowLabel: string;
total: string;
};
// { year, rowLabel, total, ...category }
export type ServerProductRow = ServerBaseRow & Partial<Record<ProductKey, string>>;
export type ProductRow = BaseRow & Partial<Record<ProductKey, string>>;
// { year, rowLabel, total, ...banner }
// (배너는 기본 41개 키 + 차트별 추가 키가 생길 수 있으니 확장 허용)
export type ServerBannerRow = ServerBaseRow &
Partial<Record<BannerKey, string>> & {
[k: string]: string;
export type BannerRow = BaseRow &
Partial<Record<BannerKey, string>> &
Record<Exclude<string, keyof BaseRow>, string>;
export type ProductResponse = {
statisticsDataMap : Record<string, Array<ProductRow>>;
};
export type BannerResponse = {
statisticsDataMap : Record<string, Array<BannerRow>>;
};
export type StatisticsRequestOption = {
// 캐시 사용 여부
useCache?: boolean; // default: true
// 마지막 연도만 조회
lastYear?: boolean; // default: false
// 소수점 자리수
decimalPoint?: number; // default: LgePenetrationConst.DECIMAL_POINT
};
export type StatisticsRequest = {
// 변수 ID 맵 (Key: 요청 Key, Value: 변수 ID)
variableIdMap: Record<string, string>;
// 배너 ID 배열 (1단 배너, 옆으로 붙이기)
bannerIdList?: string[];
// 필터 정보
// Key: 필터 키, Value: 필터 값 목록
filterCondition?: Record<string, number[]>;
// 요청 옵션
option?: StatisticsRequestOption; // default: { useCache: true, lastYear: false, decimalPoint: ... }
};
export type LifeStageRow = Record<string, unknown> & {
item: string;
total: string;
single: string;
noKids: string;
preschoolKids: string;
schoolKids: string;
adultKids: string;
independentSenior: string;
"KLIFEstAGE#1": string;
"KLIFEstAGE#2": string;
"KLIFEstAGE#3": string;
"KLIFEstAGE#4": string;
"KLIFEstAGE#5": string;
"KLIFEstAGE#6": string;
};
export type LifeStageGroup = {
@@ -38,12 +72,29 @@ export type LifeStageGroup = {
export type BannerGroupKey = keyof typeof BANNER_GROUP;
export type CategoryChartMode = "stack" | "reverseStack" | "horizontal";
export type CategoryChartMode = "none" | "stack" | "reverseStack" | "horizontal";
export type PageData<T> = {
title: string;
chartMode: CategoryChartMode;
data: T[];
chartHeight?: number;
chartHeight?: number | string;
chartWidth?: number;
};
export type CategoryFieldSpec = {
title: string | Record<CategoryTargetType, string>;
requestKey: string;
chartMode:CategoryChartMode;
qidByMode: Partial<Record<CategoryTargetType, string>>; // mode별 qid (없으면 숨김/요청 제외)
};
export type CategoryResolvedField = CategoryFieldSpec & {
requestKeyResolved: string;
qid: string;
};
export type BuildPageModeConfigResult = {
fields: CategoryResolvedField[];
variableIdMap: Record<string, string>;
};