namirasoft-site-react 1.4.395 → 1.4.396
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
2
2
|
export declare class MoneyFormatter extends BaseColumnFormatter {
|
|
3
|
-
private
|
|
3
|
+
private currency;
|
|
4
4
|
private minimumFractionDigits;
|
|
5
5
|
private maximumFractionDigits;
|
|
6
|
-
constructor(width?: string,
|
|
6
|
+
constructor(width?: string, currency?: string, minimumFractionDigits?: number, maximumFractionDigits?: number);
|
|
7
7
|
format(value: any): any;
|
|
8
8
|
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import { PriceOperation } from "namirasoft-core";
|
|
2
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
3
3
|
export class MoneyFormatter extends BaseColumnFormatter {
|
|
4
|
-
constructor(width = "160px",
|
|
4
|
+
constructor(width = "160px", currency = "$", minimumFractionDigits = 0, maximumFractionDigits = 2) {
|
|
5
5
|
super();
|
|
6
6
|
this.width = width;
|
|
7
|
-
this.
|
|
7
|
+
this.currency = currency;
|
|
8
8
|
this.minimumFractionDigits = minimumFractionDigits;
|
|
9
9
|
this.maximumFractionDigits = maximumFractionDigits;
|
|
10
10
|
}
|
|
11
11
|
format(value) {
|
|
12
|
+
var _a, _b;
|
|
12
13
|
try {
|
|
13
|
-
if (value != null)
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (value != null) {
|
|
15
|
+
return [
|
|
16
|
+
(_b = (_a = this.currency) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : "",
|
|
17
|
+
PriceOperation.millicent_to_fiat(value, this.maximumFractionDigits).toLocaleString(undefined, {
|
|
18
|
+
minimumFractionDigits: this.minimumFractionDigits,
|
|
19
|
+
maximumFractionDigits: this.maximumFractionDigits
|
|
20
|
+
})
|
|
21
|
+
].join(" ");
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
catch (e) {
|
|
20
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyFormatter.js","sourceRoot":"","sources":["../../src/formatter/MoneyFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,cAAe,SAAQ,mBAAmB;IAKnD,YAAY,QAAgB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"MoneyFormatter.js","sourceRoot":"","sources":["../../src/formatter/MoneyFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,cAAe,SAAQ,mBAAmB;IAKnD,YAAY,QAAgB,OAAO,EAAE,WAAmB,GAAG,EAAE,wBAAgC,CAAC,EAAE,wBAAgC,CAAC;QAE7H,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACvD,CAAC;IACQ,MAAM,CAAC,KAAU;;QAEtB,IACA,CAAC;YACG,IAAI,KAAK,IAAI,IAAI,EACjB,CAAC;gBACG,OAAO;oBACH,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,IAAI,EAAE,mCAAI,EAAE;oBAC3B,cAAc,CAAC,iBAAiB,CAAC,KAAe,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;wBACpG,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;wBACjD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;qBACpD,CAAC;iBACL,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChB,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EACV,CAAC;QACD,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.396",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ant-design/charts": "^2.3.0",
|
|
25
25
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
26
|
-
"@types/node": "^22.15.
|
|
26
|
+
"@types/node": "^22.15.24",
|
|
27
27
|
"@types/react": "^18.3.12",
|
|
28
28
|
"@types/react-bootstrap": "^1.1.0",
|
|
29
29
|
"@types/react-dom": "^18.3.1",
|
|
@@ -3,14 +3,14 @@ import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
|
3
3
|
|
|
4
4
|
export class MoneyFormatter extends BaseColumnFormatter
|
|
5
5
|
{
|
|
6
|
-
private
|
|
6
|
+
private currency: string;
|
|
7
7
|
private minimumFractionDigits: number;
|
|
8
8
|
private maximumFractionDigits: number;
|
|
9
|
-
constructor(width: string = "160px",
|
|
9
|
+
constructor(width: string = "160px", currency: string = "$", minimumFractionDigits: number = 0, maximumFractionDigits: number = 2)
|
|
10
10
|
{
|
|
11
11
|
super();
|
|
12
12
|
this.width = width;
|
|
13
|
-
this.
|
|
13
|
+
this.currency = currency;
|
|
14
14
|
this.minimumFractionDigits = minimumFractionDigits;
|
|
15
15
|
this.maximumFractionDigits = maximumFractionDigits;
|
|
16
16
|
}
|
|
@@ -19,10 +19,15 @@ export class MoneyFormatter extends BaseColumnFormatter
|
|
|
19
19
|
try
|
|
20
20
|
{
|
|
21
21
|
if (value != null)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
{
|
|
23
|
+
return [
|
|
24
|
+
this.currency?.trim() ?? "",
|
|
25
|
+
PriceOperation.millicent_to_fiat(value as number, this.maximumFractionDigits).toLocaleString(undefined, {
|
|
26
|
+
minimumFractionDigits: this.minimumFractionDigits,
|
|
27
|
+
maximumFractionDigits: this.maximumFractionDigits
|
|
28
|
+
})
|
|
29
|
+
].join(" ");
|
|
30
|
+
}
|
|
26
31
|
} catch (e)
|
|
27
32
|
{
|
|
28
33
|
}
|