import {BANNER_GROUP} from "@/const/lg-banner.const"; import {BANNER_KEY_MAP, PRODUCT_KEY_MAP} from "@/const/lg-schema.const"; import {PRODUCTS_FILTER_ITEM} from "@/const/lg-product.const"; import {CategoryTargetType} from "@/types/filter.types"; import {EChartsOption} from "echarts"; 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 BaseRow = { year: string; rowLabel: string; total: string; }; // { year, rowLabel, total, ...category } export type ProductRow = BaseRow & Partial<{sample: string;}> & Partial>; // { year, rowLabel, total, ...banner } // (배너는 기본 41개 키 + 차트별 추가 키가 생길 수 있으니 확장 허용) export type BannerRow = BaseRow & Partial> & Record, string>; export type ProductResponse = { statisticsDataMap : Record>; }; export type BannerResponse = { statisticsDataMap : Record>; }; 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; // 배너 ID 배열 (1단 배너, 옆으로 붙이기) bannerIdList?: string[]; // 필터 정보 // Key: 필터 키, Value: 필터 값 목록 filterCondition?: Record; // 요청 옵션 option?: StatisticsRequestOption; // default: { useCache: true, lastYear: false, decimalPoint: ... } }; export type LifeStageRow = Record & { item: string; total: string; "KLIFEstAGE#1": string; "KLIFEstAGE#2": string; "KLIFEstAGE#3": string; "KLIFEstAGE#4": string; "KLIFEstAGE#5": string; "KLIFEstAGE#6": string; "KLIFEstAGE#7": string; "KLIFEstAGE#8": string; }; export type LifeStageGroup = { title: string; rows: LifeStageRow[] } export type BannerGroupKey = keyof typeof BANNER_GROUP; export type CategoryChartMode = "none" | "stack" | "reverseStack" | "horizontal"; export type PageData = { title: string; surveyTitle: string; chartMode: CategoryChartMode; chartLegend?: LegendOption; chartTopMargin?:number; chartHeight?: number | string; chartWidth?: number; data: T[]; }; export type LegendOption = EChartsOption["legend"]; export type CategoryFieldSpec = { title: string | Record; requestKey: string; chartMode:CategoryChartMode; chartLegend?: LegendOption; chartTopMargin?:number; qidByMode: Partial>; // mode별 qid (없으면 숨김/요청 제외) }; export type CategoryResolvedField = CategoryFieldSpec & { requestKeyResolved: string; qid: string; }; export type BuildPageModeConfigResult = { fields: CategoryResolvedField[]; variableIdMap: Record; };