namirasoft-site-react 1.4.266 → 1.4.268
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/dist/components/NSDownTimer.js +7 -2
- package/dist/components/NSDownTimer.js.map +1 -1
- package/dist/formatter/MoneyFormatter.d.ts +4 -1
- package/dist/formatter/MoneyFormatter.js +8 -4
- package/dist/formatter/MoneyFormatter.js.map +1 -1
- package/package.json +4 -4
- package/src/components/NSDownTimer.tsx +22 -8
- package/src/formatter/MoneyFormatter.ts +11 -4
|
@@ -13,7 +13,12 @@ export function NSDownTimer(props) {
|
|
|
13
13
|
function calculateTimeLeft(date) {
|
|
14
14
|
const now = new Date();
|
|
15
15
|
const difference = date.getTime() - now.getTime();
|
|
16
|
-
let timeLeft = {
|
|
16
|
+
let timeLeft = {
|
|
17
|
+
days: 0,
|
|
18
|
+
hours: 0,
|
|
19
|
+
minutes: 0,
|
|
20
|
+
seconds: 0,
|
|
21
|
+
};
|
|
17
22
|
if (difference > 0) {
|
|
18
23
|
timeLeft = {
|
|
19
24
|
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
|
|
@@ -24,7 +29,7 @@ export function NSDownTimer(props) {
|
|
|
24
29
|
}
|
|
25
30
|
return timeLeft;
|
|
26
31
|
}
|
|
27
|
-
return (_jsxs("div", { id: props.id, className: `${Styles.ns_down_timer_container} ${(_b = (_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: props.style, children: [_jsxs("figure", { className: Styles.ns_figure, children: [_jsx("img", { src: 'https://static.namirasoft.com/image/concept/countdown/grey.svg', alt: 'CountDown', width: 48, height: 48 }), _jsx("figcaption", { children: props.text })] }), _jsxs("div", { className: Styles.ns_down_timer_time_container, children: [_jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.days}
|
|
32
|
+
return (_jsxs("div", { id: props.id, className: `${Styles.ns_down_timer_container} ${(_b = (_a = props.classList) === null || _a === void 0 ? void 0 : _a.join(" ")) !== null && _b !== void 0 ? _b : ""}`, style: props.style, children: [_jsxs("figure", { className: Styles.ns_figure, children: [_jsx("img", { src: 'https://static.namirasoft.com/image/concept/countdown/grey.svg', alt: 'CountDown', width: 48, height: 48 }), _jsx("figcaption", { children: props.text })] }), _jsxs("div", { className: Styles.ns_down_timer_time_container, children: [_jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.days}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "DAY" })] }), _jsx("span", { className: `${Styles.ns_semi_colon}`, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.hours}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "HOUR" })] }), _jsx("span", { className: `${Styles.ns_semi_colon}`, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.minutes}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "MIN" })] }), _jsx("span", { className: `${Styles.ns_semi_colon}`, children: ":" }), _jsxs("div", { className: 'd-flex flex-column justify-content-center align-items-center', children: [_jsx("span", { className: Styles.ns_down_timer_time_left, children: `${timeLeft.seconds}` }), _jsx("span", { className: Styles.ns_down_timer_time_left_unit, children: "SEC" })] })] })] }));
|
|
28
33
|
}
|
|
29
34
|
;
|
|
30
35
|
//# sourceMappingURL=NSDownTimer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NSDownTimer.js","sourceRoot":"","sources":["../../src/components/NSDownTimer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,MAAM,MAAM,0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E,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,qBAAa,IAC5D,EACN,eAAM,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,kBAAU,EACpD,eAAK,SAAS,EAAC,8DAA8D,aAC5E,eAAM,SAAS,EAAE,MAAM,CAAC,uBAAuB,YAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAQ,EAC/E,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,oBAAY,IAC3D,EACN,eAAM,SAAS,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,kBAAU,EACpD,eAAK,SAAS,EAAC,8DAA8D,aAC5E,eAAM,SAAS,EAAE,MAAM,CAAC,uBAAuB,YAAG,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAQ,EAC/E,eAAM,SAAS,EAAE,MAAM,CAAC,4BAA4B,oBAAY,IAC3D,IACD,IACD,CACN,CAAC;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
2
2
|
export declare class MoneyFormatter extends BaseColumnFormatter {
|
|
3
|
-
|
|
3
|
+
private dollor_sigh;
|
|
4
|
+
private minimumFractionDigits;
|
|
5
|
+
private maximumFractionDigits;
|
|
6
|
+
constructor(width?: string, dollor_sigh?: string, minimumFractionDigits?: number, maximumFractionDigits?: number);
|
|
4
7
|
format(value: any): any;
|
|
5
8
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import { PriceOperation } from "namirasoft-core";
|
|
1
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
2
3
|
export class MoneyFormatter extends BaseColumnFormatter {
|
|
3
|
-
constructor(width = "160px") {
|
|
4
|
+
constructor(width = "160px", dollor_sigh = "$", minimumFractionDigits = 0, maximumFractionDigits = 2) {
|
|
4
5
|
super();
|
|
5
6
|
this.width = width;
|
|
7
|
+
this.dollor_sigh = dollor_sigh;
|
|
8
|
+
this.minimumFractionDigits = minimumFractionDigits;
|
|
9
|
+
this.maximumFractionDigits = maximumFractionDigits;
|
|
6
10
|
}
|
|
7
11
|
format(value) {
|
|
8
12
|
try {
|
|
9
13
|
if (value != null)
|
|
10
|
-
return
|
|
11
|
-
minimumFractionDigits:
|
|
12
|
-
maximumFractionDigits:
|
|
14
|
+
return this.dollor_sigh + PriceOperation.toNormal(value).toLocaleString(undefined, {
|
|
15
|
+
minimumFractionDigits: this.minimumFractionDigits,
|
|
16
|
+
maximumFractionDigits: this.maximumFractionDigits
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
19
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoneyFormatter.js","sourceRoot":"","sources":["../../src/formatter/MoneyFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,OAAO,cAAe,SAAQ,mBAAmB;
|
|
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,cAAsB,GAAG,EAAE,wBAAgC,CAAC,EAAE,wBAAgC,CAAC;QAEhI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,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;gBACb,OAAO,IAAI,CAAC,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,KAAe,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE;oBACzF,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;oBACjD,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;iBACpD,CAAC,CAAC;QACX,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.268",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/main.js",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ant-design/charts": "^2.2.6",
|
|
25
25
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
26
|
-
"@types/node": "^22.13.
|
|
26
|
+
"@types/node": "^22.13.9",
|
|
27
27
|
"@types/react": "^18.3.12",
|
|
28
28
|
"@types/react-bootstrap": "^0.32.37",
|
|
29
29
|
"@types/react-dom": "^18.3.1",
|
|
30
|
-
"antd": "^5.24.
|
|
30
|
+
"antd": "^5.24.3",
|
|
31
31
|
"bootstrap": "^5.3.3",
|
|
32
32
|
"chart.js": "^4.4.8",
|
|
33
33
|
"copyfiles": "^2.4.1",
|
|
34
34
|
"link-react": "^3.0.0",
|
|
35
35
|
"namirasoft-api-link": "^1.4.11",
|
|
36
|
-
"namirasoft-api-product": "^1.4.
|
|
36
|
+
"namirasoft-api-product": "^1.4.17",
|
|
37
37
|
"namirasoft-core": "^1.4.51",
|
|
38
38
|
"namirasoft-schema": "^1.4.25",
|
|
39
39
|
"namirasoft-site-map": "^1.4.14",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { IBaseComponentProps } from '../props/IBaseComponentProps';
|
|
3
3
|
import Styles from './NSDownTimer.module.css';
|
|
4
|
+
|
|
4
5
|
export interface NSDownTimerProps extends IBaseComponentProps
|
|
5
6
|
{
|
|
6
7
|
date: Date;
|
|
@@ -8,9 +9,17 @@ export interface NSDownTimerProps extends IBaseComponentProps
|
|
|
8
9
|
expire_text?: string
|
|
9
10
|
}
|
|
10
11
|
|
|
12
|
+
interface NSDownTimerState
|
|
13
|
+
{
|
|
14
|
+
days: number;
|
|
15
|
+
hours: number;
|
|
16
|
+
minutes: number;
|
|
17
|
+
seconds: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
export function NSDownTimer(props: NSDownTimerProps)
|
|
12
21
|
{
|
|
13
|
-
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft(props.date));
|
|
22
|
+
const [timeLeft, setTimeLeft] = useState<NSDownTimerState>(calculateTimeLeft(props.date));
|
|
14
23
|
|
|
15
24
|
useEffect(() =>
|
|
16
25
|
{
|
|
@@ -21,12 +30,17 @@ export function NSDownTimer(props: NSDownTimerProps)
|
|
|
21
30
|
return () => clearInterval(timer);
|
|
22
31
|
}, [props.date]);
|
|
23
32
|
|
|
24
|
-
function calculateTimeLeft(date: Date)
|
|
33
|
+
function calculateTimeLeft(date: Date): NSDownTimerState
|
|
25
34
|
{
|
|
26
35
|
const now = new Date();
|
|
27
36
|
const difference = date.getTime() - now.getTime();
|
|
28
37
|
|
|
29
|
-
let timeLeft:
|
|
38
|
+
let timeLeft: NSDownTimerState = {
|
|
39
|
+
days: 0,
|
|
40
|
+
hours: 0,
|
|
41
|
+
minutes: 0,
|
|
42
|
+
seconds: 0,
|
|
43
|
+
};
|
|
30
44
|
if (difference > 0)
|
|
31
45
|
{
|
|
32
46
|
timeLeft = {
|
|
@@ -54,22 +68,22 @@ export function NSDownTimer(props: NSDownTimerProps)
|
|
|
54
68
|
</figure>
|
|
55
69
|
<div className={Styles.ns_down_timer_time_container}>
|
|
56
70
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
57
|
-
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.days}
|
|
71
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.days}`}</span>
|
|
58
72
|
<span className={Styles.ns_down_timer_time_left_unit}>DAY</span>
|
|
59
73
|
</div>
|
|
60
|
-
<span className={`${Styles.ns_semi_colon}
|
|
74
|
+
<span className={`${Styles.ns_semi_colon}`}>:</span>
|
|
61
75
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
62
76
|
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.hours}`}</span>
|
|
63
77
|
<span className={Styles.ns_down_timer_time_left_unit}>HOUR</span>
|
|
64
78
|
</div>
|
|
65
|
-
<span className={`${Styles.ns_semi_colon}
|
|
79
|
+
<span className={`${Styles.ns_semi_colon}`}>:</span>
|
|
66
80
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
67
81
|
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.minutes}`}</span>
|
|
68
82
|
<span className={Styles.ns_down_timer_time_left_unit}>MIN</span>
|
|
69
83
|
</div>
|
|
70
|
-
<span className={`${Styles.ns_semi_colon}
|
|
84
|
+
<span className={`${Styles.ns_semi_colon}`}>:</span>
|
|
71
85
|
<div className='d-flex flex-column justify-content-center align-items-center'>
|
|
72
|
-
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.seconds}
|
|
86
|
+
<span className={Styles.ns_down_timer_time_left}>{`${timeLeft.seconds}`}</span>
|
|
73
87
|
<span className={Styles.ns_down_timer_time_left_unit}>SEC</span>
|
|
74
88
|
</div>
|
|
75
89
|
</div>
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
import { PriceOperation } from "namirasoft-core";
|
|
1
2
|
import { BaseColumnFormatter } from "./BaseColumnFormatter";
|
|
2
3
|
|
|
3
4
|
export class MoneyFormatter extends BaseColumnFormatter
|
|
4
5
|
{
|
|
5
|
-
|
|
6
|
+
private dollor_sigh: string;
|
|
7
|
+
private minimumFractionDigits: number;
|
|
8
|
+
private maximumFractionDigits: number;
|
|
9
|
+
constructor(width: string = "160px", dollor_sigh: string = "$", minimumFractionDigits: number = 0, maximumFractionDigits: number = 2)
|
|
6
10
|
{
|
|
7
11
|
super();
|
|
8
12
|
this.width = width;
|
|
13
|
+
this.dollor_sigh = dollor_sigh;
|
|
14
|
+
this.minimumFractionDigits = minimumFractionDigits;
|
|
15
|
+
this.maximumFractionDigits = maximumFractionDigits;
|
|
9
16
|
}
|
|
10
17
|
override format(value: any): any
|
|
11
18
|
{
|
|
12
19
|
try
|
|
13
20
|
{
|
|
14
21
|
if (value != null)
|
|
15
|
-
return
|
|
16
|
-
minimumFractionDigits:
|
|
17
|
-
maximumFractionDigits:
|
|
22
|
+
return this.dollor_sigh + PriceOperation.toNormal(value as number).toLocaleString(undefined, {
|
|
23
|
+
minimumFractionDigits: this.minimumFractionDigits,
|
|
24
|
+
maximumFractionDigits: this.maximumFractionDigits
|
|
18
25
|
});
|
|
19
26
|
} catch (e)
|
|
20
27
|
{
|