diff --git a/packages/common/business_components/src/ui/chart/LineBarChart.tsx b/packages/common/business_components/src/ui/chart/LineBarChart.tsx index 17deacd73..2e83458d8 100644 --- a/packages/common/business_components/src/ui/chart/LineBarChart.tsx +++ b/packages/common/business_components/src/ui/chart/LineBarChart.tsx @@ -130,7 +130,7 @@ export default function LineBarchart({ className="text-[12px] font-bold" tickCount={6} orientation="left" - domain={[0, Math.ceil(lineMaxValue * 1.1)]} + domain={[0, Math.ceil(lineMaxValue * 1)]} label={{ value: yFieldText, angle: -90, position: 'insideLeft' }} />} {/* 오른쪽 Y축: barVal */} @@ -139,7 +139,7 @@ export default function LineBarchart({ className="text-[12px] font-bold" tickCount={6} orientation="right" - domain={[0, Math.ceil(barMaxValue * 1.1)]} + domain={[0, Math.ceil(barMaxValue * 1)]} label={{ value: yFieldText2, angle: -90, position: 'insideRight' }} reversed={true} />} diff --git a/packages/common/business_components/src/ui/excel/excelStyle.tsx b/packages/common/business_components/src/ui/excel/excelStyle.tsx index adc21880b..6674720dc 100644 --- a/packages/common/business_components/src/ui/excel/excelStyle.tsx +++ b/packages/common/business_components/src/ui/excel/excelStyle.tsx @@ -47,7 +47,17 @@ export const excelArrayStyle = async (data: ArrayBuffer, range: [typeof sheetPar rangeCells?.style((styleQ)=>{ makeCellStyle(styleQ) }); - } ) + + // 모든 데이터 셀에 세로 가운데 정렬 적용 + if (item.data && item.data.length > 0) { + const numCols = item.data[0]?.length || 0; + const numRows = item.data.length; + const dataRange = workbook.activeSheet(index)?.sheet(index)?.range(`A1:${String.fromCharCode(65 + numCols - 1)}${numRows}`); + dataRange?.style((styleQ) => { + styleQ.verticalAlignment("center"); + }); + } + }); } makeExcelFile(workbook, fileNm) diff --git a/packages/common/business_components/src/ui/excel/index.tsx b/packages/common/business_components/src/ui/excel/index.tsx index e33b0c88d..76b4ba2f9 100644 --- a/packages/common/business_components/src/ui/excel/index.tsx +++ b/packages/common/business_components/src/ui/excel/index.tsx @@ -15,9 +15,30 @@ export const downloadExcel = ({ data, fileName = new Date().getTime().toString() excelStyle(XLSX.write(workbook, { bookType: "xlsx", type: "buffer" }), headerRange, fileName); }; +export const sheetParameter ={ + data:[[]], headerNum:0, headerRange:'A1:V3', sheetName:'Sheet1', startCol:0 +} + +export const downloadMultipleExcel = (fileName = new Date().getTime().toString() + '.xlsx', sheetArray: Array): Promise => { + const workbook = XLSX.utils.book_new(); + for (let i = 0; i < sheetArray.length; i++) { + // Create a new worksheet for each sheet + const worksheet = XLSX.utils.aoa_to_sheet(sheetArray[i]?.data || [[]]); + // Add data to the worksheet starting from the specified header number + if (sheetArray&&sheetArray[i]?.headerNum) { + XLSX.utils.sheet_add_aoa(worksheet, sheetArray[i]?.data || [[]], { origin: `A${sheetArray[i]?.headerNum}` }); + } + // Append the worksheet to the workbook with the specified sheet name + XLSX.utils.book_append_sheet(workbook, worksheet, sheetArray[i]?.sheetName); + } + if (sheetArray.length > 0) { + excelArrayStyle(XLSX.write(workbook, { bookType: "xlsx", type: "buffer" }), sheetArray, fileName); + } + return Promise.resolve(undefined); +}; -export const filePicked=(oFile: File, headerNum:number=0):Promise =>{ +export const filePicked=(oFile: File, headerNum:number=0, dateType="yyyymmdd"):Promise =>{ // Create A File Reader HTML5 const reader = new FileReader(); return new Promise((resolve, reject) => { @@ -30,7 +51,7 @@ export const filePicked=(oFile: File, headerNum:number=0):Promise =>{ // Create A File Reader HTML5 +export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, headerNum:number=0, headerRange='A1:V3', startCol?:number):Promise =>{ // Create A File Reader HTML5 return new Promise(() => { // Ready The Event For When A File Gets Selected const wb = XLSX.read(oFile, { type: 'binary' }); @@ -116,7 +137,8 @@ export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, header if (sheet) { //오리진 확인 test 필요 // const sheet = XLSX.utils.json_to_sheet(data); - XLSX.utils.sheet_add_aoa(sheet, data, { origin: 'A'+headerNum }); + const excelStartCol = startCol?startCol.toString():'A'; + XLSX.utils.sheet_add_aoa(sheet, data, { origin: excelStartCol+headerNum }); // XLSX.utils.book_append_sheet(wb, sheet, 'test'); await excelStyle(XLSX.write(wb, { bookType: "xlsx", type: "buffer" }), headerRange, fileNm) } else { @@ -127,9 +149,6 @@ export const filePickedBlob=(oFile: ArrayBuffer, data:[][],fileNm:string, header }); } -export const sheetParameter ={ - data:[[]], headerNum:0, headerRange:'A1:V3' - } export const filePickedBlobArray= (oFile: ArrayBuffer,fileNm:string, sheetArray: [typeof sheetParameter]):Promise =>{ // Create A File Reader HTML5 return new Promise (async () => { // Ready The Event For When A File Gets Selected @@ -142,7 +161,8 @@ export const sheetParameter ={ if (sheet) { //오리진 확인 test 필요 // const sheet = XLSX.utils.json_to_sheet(data); - XLSX.utils.sheet_add_aoa(sheet, sheetArray[index].data, { origin: 'A'+sheetArray[index].headerNum }); + const startCol = sheetArray[index].startCol?sheetArray[index].startCol.toString():'A'; + XLSX.utils.sheet_add_aoa(sheet, sheetArray[index].data, { origin: startCol+sheetArray[index].headerNum }); // XLSX.utils.book_append_sheet(wb, sheet, 'test'); } else { console.error(`Sheet "${sheetName}" is undefined.`); diff --git a/packages/common/business_components/src/ui/search_form_right/index.tsx b/packages/common/business_components/src/ui/search_form_right/index.tsx index fda7eefd6..f5a92dde7 100644 --- a/packages/common/business_components/src/ui/search_form_right/index.tsx +++ b/packages/common/business_components/src/ui/search_form_right/index.tsx @@ -1,8 +1,8 @@ import React from 'react'; -function SearchFormRight(props: {children: React.ReactNode}) { +function SearchFormRight(props: {children: React.ReactNode, className?: string}) { return ( -
+
{props.children}
) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index c9d0bf251..791eddffe 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -72,7 +72,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} > - {String(el[head.id]).includes('.') + {typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.') ? String(el[head.id]).split('.').map((part, index) => index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part ).join('.') @@ -86,7 +86,7 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr onClick={() => handleCellClick(index, head.id)} key={`cell-${head.id}-${index}`} > - {String(el[head.id]).includes('.') + {typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.') ? String(el[head.id]).split('.').map((part, index) => index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part ).join('.')