diff options
| author | joonhoekim <26rote@gmail.com> | 2025-11-13 18:16:05 +0900 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-11-13 18:16:05 +0900 |
| commit | 1b84707d2f7abba3349fc306b539ef661a22cd45 (patch) | |
| tree | a49d0f89acd99b09bec376708e1161b4aa16318f /components/common/selectors/currency/README.md | |
| parent | 517a3e91a899c54a70de76d380eda5f73e8133e9 (diff) | |
(김준회) 공통컴포넌트: 통화(Currency) 선택기 추가
Diffstat (limited to 'components/common/selectors/currency/README.md')
| -rw-r--r-- | components/common/selectors/currency/README.md | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/components/common/selectors/currency/README.md b/components/common/selectors/currency/README.md new file mode 100644 index 00000000..55fc969e --- /dev/null +++ b/components/common/selectors/currency/README.md @@ -0,0 +1,108 @@ +# 통화 선택기 컴포넌트 + +## 개요 + +Oracle 데이터베이스에서 통화 목록을 조회하고 선택할 수 있는 공통 컴포넌트입니다. + +## 데이터 조회 + +통화 목록을 조회하고, 코드와 설명을 함께 제공해 선택하게 만듭니다. + +```sql +SELECT CD.CD , NM.GRP_DSC + FROM CMCTB_CD CD , CMCTB_CDNM NM + WHERE CD.CD_CLF = NM.CD_CLF + AND CD.CD = NM.CD + AND CD.CD2 = NM.CD2 + AND CD.CD3 = NM.CD3 + AND CD.CD_CLF = 'SPB032' +ORDER BY USR_DF_CHAR_8 ASC, CD.CD ASC +``` + +## 소수점 자리수 + +각 통화별 입력가능 소수점 자리수를 자동으로 반환합니다. + +- 원화(KRW): 0자리 (정수) +- 엔화(JPY): 0자리 (정수) +- 기타 통화: 2자리 + +## 컴포넌트 구성 + +### 1. CurrencySelector + +기본 선택기 컴포넌트 (버튼 + 다이얼로그 통합형) + +```tsx +import { CurrencySelector } from '@/components/common/selectors/currency' + +<CurrencySelector + selectedCurrency={selectedCurrency} + onCurrencySelect={(currency) => { + console.log(currency.CURRENCY_CODE) + console.log(currency.CURRENCY_NAME) + console.log(currency.DECIMAL_PLACES) // 소수점 자리수 + }} + placeholder="통화를 선택하세요" + disabled={false} +/> +``` + +### 2. CurrencySelectorSingleDialog + +단일 선택 다이얼로그 (open 상태를 외부에서 제어) + +```tsx +import { CurrencySelectorSingleDialog } from '@/components/common/selectors/currency' + +<CurrencySelectorSingleDialog + open={isOpen} + onOpenChange={setIsOpen} + selectedCurrency={selectedCurrency} + onCurrencySelect={(currency) => console.log(currency)} + showConfirmButtons={true} + onConfirm={(currency) => console.log('확인:', currency)} + onCancel={() => console.log('취소')} +/> +``` + +### 3. CurrencySelectorMultiDialog + +다중 선택 다이얼로그 + +```tsx +import { CurrencySelectorMultiDialog } from '@/components/common/selectors/currency' + +<CurrencySelectorMultiDialog + open={isOpen} + onOpenChange={setIsOpen} + selectedCurrencies={selectedCurrencies} + onCurrenciesSelect={(currencies) => console.log(currencies)} + maxSelection={5} + onConfirm={(currencies) => console.log('확인:', currencies)} + onCancel={() => console.log('취소')} +/> +``` + +## Currency 타입 + +```typescript +interface Currency { + CURRENCY_CODE: string // 통화 코드 (예: KRW, USD, JPY) + CURRENCY_NAME: string // 통화 이름/설명 + DECIMAL_PLACES: number // 입력가능 소수점 자리수 +} +``` + +## 유틸리티 함수 + +### getDecimalPlaces + +통화 코드에 따른 소수점 자리수를 반환합니다. + +```tsx +import { getDecimalPlaces } from '@/components/common/selectors/currency' + +const places = getDecimalPlaces('KRW') // 0 +const places2 = getDecimalPlaces('USD') // 2 +``` |
