import React, { useState } from 'react';
import * as wjcCore from '@mescius/wijmo';
import * as wjcGrid from '@mescius/wijmo.react.grid';
import '@mescius/wijmo.styles/wijmo.css';
import '@mescius/wijmo.cultures/wijmo.culture.ko';
wjcCore.setLicenseKey('YOUR_LICENSE_KEY');
function getData() {
const regions = ['서울', '부산', '대구', '인천', '광주'];
const categories = ['전자제품', '의류', '식품', '가구', '스포츠'];
return Array.from({ length: 15 }, (_, i) => ({
id: i + 1,
region: regions[i % regions.length],
category: categories[i % categories.length],
revenue: Math.round(Math.random() * 10000 + 1000),
cost: Math.round(Math.random() * 5000 + 500),
date: new Date(2026, i % 12, (i % 28) + 1),
isApproved: i % 2 === 0,
}));
}
export default function App() {
const [data] = useState(getData());
const [selectedItem, setSelectedItem] = useState(null);
return (
<div style={{ padding: '16px', fontFamily: 'sans-serif' }}>
<h3>지역별 매출 현황</h3>
{
}
<wjcGrid.FlexGrid
autoGenerateColumns={false}
itemsSource={data}
style={{ height: '320px' }}
>
{}
<wjcGrid.FlexGridColumn binding="id" header="번호" width={60} isReadOnly={true} />
<wjcGrid.FlexGridColumn binding="region" header="지역" width={80} />
<wjcGrid.FlexGridColumn binding="category" header="카테고리" width={100} />
{}
<wjcGrid.FlexGridColumn binding="revenue" header="매출액" width={110} format="n0" />
<wjcGrid.FlexGridColumn binding="cost" header="비용" width={100} format="n0" />
{}
<wjcGrid.FlexGridColumn binding="date" header="날짜" width={120} format="yyyy-MM-dd" />
<wjcGrid.FlexGridColumn binding="isApproved" header="승인 여부" width={90} />
</wjcGrid.FlexGrid>
</div>
);
}