Files
lg-cxdash-front/src/types/lg.ts

49 lines
1.3 KiB
TypeScript

import {BANNER_GROUP, BANNER_KEY_MAP, PRODUCT_KEY_MAP, PRODUCTS_FILTER_ITEM} from "@/const/lgConst";
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 = {
year: string;
rowLabel: string;
total: string;
};
// { year, rowLabel, total, ...category }
export type ServerProductRow = ServerBaseRow & Partial<Record<ProductKey, string>>;
// { year, rowLabel, total, ...banner }
// (배너는 기본 41개 키 + 차트별 추가 키가 생길 수 있으니 확장 허용)
export type ServerBannerRow = ServerBaseRow &
Partial<Record<BannerKey, string>> & {
[k: string]: string;
};
export type LifeStageRow = Record<string, unknown> & {
item: string;
total: string;
single: string;
noKids: string;
preschoolKids: string;
schoolKids: string;
adultKids: string;
independentSenior: string;
};
export type LifeStageGroup = {
title: string;
rows: LifeStageRow[]
}
export type BannerGroupKey = keyof typeof BANNER_GROUP;
export type CategoryChartMode = "stack" | "reverseStack" | "horizontal";
export type PageData<T> = {
title: string;
chartMode: CategoryChartMode;
data: T[];
chartHeight?: number;
chartWidth?: number;
};