@iyulab/enterprise 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/helpers/CurrencyHelper.d.ts +14 -18
- package/dist/index.js +17 -23
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.2
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- **`CurrencyHelper` now delegates to `@iyulab/components`' `formatCurrency`** instead of
|
|
8
|
+
duplicating `Intl.NumberFormat` logic. Output is unchanged for all existing methods
|
|
9
|
+
(`formatCurrency`/`formatKRW`/`formatUSD`/`formatEUR`/`formatJPY`/`formatCNY`/
|
|
10
|
+
`parseCurrency`) — this is a behavior-preserving internal change. The class is now marked
|
|
11
|
+
`@deprecated`; new code should call `formatCurrency`/`formatNumber`/`formatDate` from
|
|
12
|
+
`@iyulab/components` directly.
|
|
13
|
+
- **`@iyulab/components` peer floor raised to `>=1.27.0`** (the delegation above needs
|
|
14
|
+
`formatCurrency`, added in that release).
|
|
15
|
+
|
|
3
16
|
## 0.8.1
|
|
4
17
|
|
|
5
18
|
### Fixed
|
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Currency formatting utility class
|
|
2
|
+
* Currency formatting utility class.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated The formatting logic now lives in `@iyulab/components`' `formatCurrency`
|
|
5
|
+
* (framework-neutral, lower in the dependency stack so `@iyulab/modern-app` can consume it
|
|
6
|
+
* too). This class is kept as a thin, behavior-preserving wrapper for existing callers —
|
|
7
|
+
* new code should import `formatCurrency`/`formatNumber`/`formatDate` from
|
|
8
|
+
* `@iyulab/components` directly.
|
|
3
9
|
*/
|
|
4
10
|
export declare class CurrencyHelper {
|
|
5
11
|
/**
|
|
6
|
-
* Format amount as currency string
|
|
12
|
+
* Format amount as currency string.
|
|
7
13
|
* @param amount - Amount to format
|
|
8
14
|
* @param currency - Currency code (default: 'KRW')
|
|
9
15
|
* @param locale - Locale for formatting (default: 'ko-KR')
|
|
10
16
|
*/
|
|
11
17
|
static formatCurrency(amount: number | null | undefined, currency?: string, locale?: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Format amount as Korean Won (KRW)
|
|
14
|
-
*/
|
|
18
|
+
/** Format amount as Korean Won (KRW) */
|
|
15
19
|
static formatKRW(amount: number | null | undefined): string;
|
|
16
|
-
/**
|
|
17
|
-
* Format amount as US Dollar (USD)
|
|
18
|
-
*/
|
|
20
|
+
/** Format amount as US Dollar (USD) */
|
|
19
21
|
static formatUSD(amount: number | null | undefined): string;
|
|
20
|
-
/**
|
|
21
|
-
* Format amount as Euro (EUR)
|
|
22
|
-
*/
|
|
22
|
+
/** Format amount as Euro (EUR) */
|
|
23
23
|
static formatEUR(amount: number | null | undefined): string;
|
|
24
|
-
/**
|
|
25
|
-
* Format amount as Japanese Yen (JPY)
|
|
26
|
-
*/
|
|
24
|
+
/** Format amount as Japanese Yen (JPY) */
|
|
27
25
|
static formatJPY(amount: number | null | undefined): string;
|
|
28
|
-
/**
|
|
29
|
-
* Format amount as Chinese Yuan (CNY)
|
|
30
|
-
*/
|
|
26
|
+
/** Format amount as Chinese Yuan (CNY) */
|
|
31
27
|
static formatCNY(amount: number | null | undefined): string;
|
|
32
28
|
/**
|
|
33
|
-
* Parse currency string to number
|
|
29
|
+
* Parse currency string to number.
|
|
34
30
|
* @param value - Currency string to parse
|
|
35
31
|
*/
|
|
36
32
|
static parseCurrency(value: string): number;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Locale } from "@iyulab/components";
|
|
2
|
+
import { Locale, formatCurrency } from "@iyulab/components";
|
|
3
3
|
import { HttpClient } from "@iyulab/http-client";
|
|
4
4
|
import buildQuery from "odata-query";
|
|
5
5
|
//#region src/FormSection.tsx
|
|
@@ -118,56 +118,50 @@ messages.register("ko", {
|
|
|
118
118
|
//#endregion
|
|
119
119
|
//#region src/helpers/CurrencyHelper.ts
|
|
120
120
|
/**
|
|
121
|
-
* Currency formatting utility class
|
|
121
|
+
* Currency formatting utility class.
|
|
122
|
+
*
|
|
123
|
+
* @deprecated The formatting logic now lives in `@iyulab/components`' `formatCurrency`
|
|
124
|
+
* (framework-neutral, lower in the dependency stack so `@iyulab/modern-app` can consume it
|
|
125
|
+
* too). This class is kept as a thin, behavior-preserving wrapper for existing callers —
|
|
126
|
+
* new code should import `formatCurrency`/`formatNumber`/`formatDate` from
|
|
127
|
+
* `@iyulab/components` directly.
|
|
122
128
|
*/
|
|
123
129
|
var CurrencyHelper = class {
|
|
124
130
|
/**
|
|
125
|
-
* Format amount as currency string
|
|
131
|
+
* Format amount as currency string.
|
|
126
132
|
* @param amount - Amount to format
|
|
127
133
|
* @param currency - Currency code (default: 'KRW')
|
|
128
134
|
* @param locale - Locale for formatting (default: 'ko-KR')
|
|
129
135
|
*/
|
|
130
136
|
static formatCurrency(amount, currency = "KRW", locale = "ko-KR") {
|
|
131
137
|
if (amount === null || amount === void 0) return "-";
|
|
132
|
-
return
|
|
133
|
-
style: "currency",
|
|
134
|
-
currency,
|
|
138
|
+
return formatCurrency(amount, currency, {
|
|
135
139
|
minimumFractionDigits: 0,
|
|
136
140
|
maximumFractionDigits: currency === "KRW" ? 0 : 2
|
|
137
|
-
})
|
|
141
|
+
}, locale);
|
|
138
142
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Format amount as Korean Won (KRW)
|
|
141
|
-
*/
|
|
143
|
+
/** Format amount as Korean Won (KRW) */
|
|
142
144
|
static formatKRW(amount) {
|
|
143
145
|
return this.formatCurrency(amount, "KRW", "ko-KR");
|
|
144
146
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Format amount as US Dollar (USD)
|
|
147
|
-
*/
|
|
147
|
+
/** Format amount as US Dollar (USD) */
|
|
148
148
|
static formatUSD(amount) {
|
|
149
149
|
return this.formatCurrency(amount, "USD", "en-US");
|
|
150
150
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Format amount as Euro (EUR)
|
|
153
|
-
*/
|
|
151
|
+
/** Format amount as Euro (EUR) */
|
|
154
152
|
static formatEUR(amount) {
|
|
155
153
|
return this.formatCurrency(amount, "EUR", "de-DE");
|
|
156
154
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Format amount as Japanese Yen (JPY)
|
|
159
|
-
*/
|
|
155
|
+
/** Format amount as Japanese Yen (JPY) */
|
|
160
156
|
static formatJPY(amount) {
|
|
161
157
|
return this.formatCurrency(amount, "JPY", "ja-JP");
|
|
162
158
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Format amount as Chinese Yuan (CNY)
|
|
165
|
-
*/
|
|
159
|
+
/** Format amount as Chinese Yuan (CNY) */
|
|
166
160
|
static formatCNY(amount) {
|
|
167
161
|
return this.formatCurrency(amount, "CNY", "zh-CN");
|
|
168
162
|
}
|
|
169
163
|
/**
|
|
170
|
-
* Parse currency string to number
|
|
164
|
+
* Parse currency string to number.
|
|
171
165
|
* @param value - Currency string to parse
|
|
172
166
|
*/
|
|
173
167
|
static parseCurrency(value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/enterprise",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Enterprise utilities and components for iyulab framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"enterprise",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"odata-query": "^8.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@iyulab/components": "^1.
|
|
46
|
+
"@iyulab/components": "^1.27.0",
|
|
47
47
|
"@types/node": "^26.1.1",
|
|
48
48
|
"@types/react": "^19.2.14",
|
|
49
49
|
"typescript": "^5.9.3",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"react": ">=18",
|
|
56
|
-
"@iyulab/components": ">=1.
|
|
56
|
+
"@iyulab/components": ">=1.27.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@iyulab/components": {
|