@m4l/components 9.30.2 → 9.31.0
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/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.d.ts.map +1 -1
- package/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.js +23 -21
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.d.ts.map +1 -1
- package/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.js +31 -32
- package/components/formatters/DateFormatter/DateFormatter.d.ts.map +1 -1
- package/components/formatters/DateFormatter/DateFormatter.js +18 -18
- package/components/formatters/PriceFormatter/PriceFormatter.d.ts.map +1 -1
- package/components/formatters/PriceFormatter/PriceFormatter.js +29 -30
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnDate.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"useColumnDate.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnDateFormatter/useColumnDate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAWnD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC,WAG9C,IAAI,SAAS,MAAM,YAqBnD,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC;;;qCAjD3B,MAAM;;CAqEnD,CAAC"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { getPropertyByString as i } from "@m4l/core";
|
|
2
|
-
import { getFormatDate as l } from "../../../formatters/DateFormatter/DateFormatter.js";
|
|
1
|
+
import { useUserPreferences as l, getPropertyByString as i } from "@m4l/core";
|
|
3
2
|
import { ColumnDateFormatter as c } from "./formatter.js";
|
|
4
3
|
import { ColumnDateGroupFormatter as g } from "./ColumnDateGroupFormatter.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const u = s(e.fieldValue), o = i(a, u);
|
|
4
|
+
import { getValidDate as s } from "../../../../utils/getValidDate.js";
|
|
5
|
+
import { useState as D, useRef as d, useEffect as y, useMemo as C, useCallback as T } from "react";
|
|
6
|
+
import { deepEqual as V } from "fast-equals";
|
|
7
|
+
import { getColumnKey as f } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
8
|
+
const S = (e) => {
|
|
9
|
+
const { formatDate: t } = l();
|
|
10
|
+
return T((a, n) => {
|
|
11
|
+
const m = f(e.fieldValue), o = i(a, m);
|
|
14
12
|
let r = null;
|
|
15
|
-
return typeof o == "string" ? r = new Date(o) : o instanceof Date && (r = o), !r || isNaN(r.getTime()) ? !1 :
|
|
13
|
+
return typeof o == "string" ? r = new Date(o) : o instanceof Date && (r = o), !r || isNaN(r.getTime()) ? !1 : t({
|
|
14
|
+
presentationType: e.presentationType,
|
|
15
|
+
value: r,
|
|
16
|
+
format: e.format
|
|
17
|
+
}).includes(n);
|
|
16
18
|
}, [e.presentationType, e.format, t]);
|
|
17
|
-
}, b = (e) => (t,
|
|
18
|
-
const a =
|
|
19
|
+
}, b = (e) => (t, u) => {
|
|
20
|
+
const a = f(e.fieldValue), n = i(t, a), m = i(u, a), o = s(n), r = s(m);
|
|
19
21
|
return !o || !r ? 0 : o.getTime() > r.getTime() ? 1 : o.getTime() < r.getTime() ? -1 : 0;
|
|
20
|
-
},
|
|
21
|
-
const [t,
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
}, [e]),
|
|
22
|
+
}, k = (e) => {
|
|
23
|
+
const [t, u] = D(e), a = S(t), n = d({ ...e });
|
|
24
|
+
return y(() => {
|
|
25
|
+
V(n.current, e) || (n.current = e, u(e));
|
|
26
|
+
}, [e]), C(() => ({
|
|
25
27
|
formatter: c(t),
|
|
26
28
|
renderGroupCell: g(t),
|
|
27
29
|
customFilter: a,
|
|
@@ -29,6 +31,6 @@ const T = (e) => {
|
|
|
29
31
|
}), [t, a]);
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
k as useColumnDate,
|
|
35
|
+
S as useCustomDateFilter
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnPrice.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useColumnPrice.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/datagrids/formatters/ColumnPriceFormatter/useColumnPrice.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAiCpD;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,EAAE,OAAO,yBAAyB,CAAC,IAAI,CAAC;;;wBAKjE,IAAI,SAAS,MAAM;;CAyB5B,CAAC"}
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
).includes(o);
|
|
1
|
+
import { useState as a, useRef as P, useCallback as d, useEffect as y, useMemo as g } from "react";
|
|
2
|
+
import { useUserPreferences as p, getPropertyByString as c } from "@m4l/core";
|
|
3
|
+
import { deepEqual as C } from "fast-equals";
|
|
4
|
+
import { getFormatPrice as S } from "../../../formatters/PriceFormatter/PriceFormatter.js";
|
|
5
|
+
import { ColumnPriceGroupFormatter as V } from "./ColumnPriceGroupFormatter.js";
|
|
6
|
+
import { getColumnKey as l } from "../../helpers/shared/getColumnKey/getColumnKey.js";
|
|
7
|
+
import { ColumnPriceFormatter as b } from "./formatter.js";
|
|
8
|
+
const F = (r) => (n, i) => {
|
|
9
|
+
const e = l(r.fieldValue), m = c(n, e), u = c(i, e);
|
|
10
|
+
let t, o;
|
|
11
|
+
return typeof m == "number" ? t = m : t = 0, typeof u == "number" ? o = u : o = 0, t > o ? 1 : t < o ? -1 : 0;
|
|
12
|
+
}, G = (r) => {
|
|
13
|
+
const { currency: n, currencyDecimalDigits: i } = p(), [e, m] = a(r), u = P({ ...r }), t = d(
|
|
14
|
+
(o, f) => {
|
|
15
|
+
const s = l(e.fieldValue);
|
|
16
|
+
return S(
|
|
17
|
+
o,
|
|
18
|
+
s,
|
|
19
|
+
n,
|
|
20
|
+
i
|
|
21
|
+
).includes(f);
|
|
23
22
|
},
|
|
24
|
-
[
|
|
23
|
+
[e, n, i]
|
|
25
24
|
);
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
formatter:
|
|
30
|
-
renderGroupCell:
|
|
31
|
-
customFilter:
|
|
32
|
-
customSort:
|
|
33
|
-
}), [
|
|
25
|
+
return y(() => {
|
|
26
|
+
C(u.current, r) || (u.current = r, m(r));
|
|
27
|
+
}, [r]), g(() => ({
|
|
28
|
+
formatter: b(e),
|
|
29
|
+
renderGroupCell: V(e),
|
|
30
|
+
customFilter: t,
|
|
31
|
+
customSort: F(e)
|
|
32
|
+
}), [e, t]);
|
|
34
33
|
};
|
|
35
34
|
export {
|
|
36
|
-
|
|
35
|
+
G as useColumnPrice
|
|
37
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateFormatter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/formatters/DateFormatter/DateFormatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"DateFormatter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/formatters/DateFormatter/DateFormatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAO/D,OAAO,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;AAC7C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,EACpC,aAAa,EAAE,iBAAiB,EAChC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAgCR;AACD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,oDA6BtF"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as p, Fragment as D } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import d, { useMemo as u } from "react";
|
|
3
|
+
import { useUserPreferences as F } from "@m4l/core";
|
|
4
4
|
import { DateFormatterRootStyled as T } from "./slots/DateFormatterSlots.js";
|
|
5
5
|
import { DateFormatterSlots as g } from "./slots/DateFormatterEnum.js";
|
|
6
6
|
import y from "clsx";
|
|
7
7
|
import { getComponentSlotRoot as R } from "../../../utils/getComponentSlotRoot.js";
|
|
8
8
|
import { getPropDataTestId as b } from "../../../test/getNameDataTestId.js";
|
|
9
9
|
import { DATE_FORMATTER_KEY_COMPONENT as f } from "./constants.js";
|
|
10
|
-
function
|
|
11
|
-
let
|
|
10
|
+
function O(n, t, e, o) {
|
|
11
|
+
let r = o || e.datetimeFormat, m, a;
|
|
12
12
|
if (t == null)
|
|
13
13
|
return "-";
|
|
14
14
|
switch (n) {
|
|
15
15
|
case "datetime":
|
|
16
|
-
|
|
16
|
+
r = o || e.datetimeFormat;
|
|
17
17
|
break;
|
|
18
18
|
case "date":
|
|
19
|
-
|
|
19
|
+
r = o || e.dateFormat;
|
|
20
20
|
break;
|
|
21
21
|
case "time":
|
|
22
|
-
|
|
22
|
+
r = o || e.timeFormat;
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
try {
|
|
26
|
-
return typeof t == "number" || typeof t == "string" ? a = new Date(t) : a = t, m = e.formatDate(a,
|
|
26
|
+
return typeof t == "number" || typeof t == "string" ? a = new Date(t) : a = t, m = e.formatDate(a, r), m;
|
|
27
27
|
} catch {
|
|
28
28
|
return m = "-", m;
|
|
29
29
|
}
|
|
@@ -32,24 +32,24 @@ function S(n) {
|
|
|
32
32
|
const {
|
|
33
33
|
presentationType: t,
|
|
34
34
|
value: e,
|
|
35
|
-
format:
|
|
36
|
-
Component:
|
|
35
|
+
format: o,
|
|
36
|
+
Component: r = T,
|
|
37
37
|
dataTestId: m,
|
|
38
38
|
className: a,
|
|
39
|
-
componentProps:
|
|
40
|
-
} = n, {
|
|
41
|
-
return
|
|
42
|
-
|
|
39
|
+
componentProps: s
|
|
40
|
+
} = n, { formatDate: l } = F(), i = l({ presentationType: t, value: e, format: o }), c = u(() => i, [i]);
|
|
41
|
+
return r === d.Fragment ? /* @__PURE__ */ p(D, { children: c }) : /* @__PURE__ */ p(
|
|
42
|
+
r,
|
|
43
43
|
{
|
|
44
44
|
className: y(R(f), a),
|
|
45
45
|
...b(f, g.root, m),
|
|
46
46
|
role: "dateFormatter-role",
|
|
47
|
-
...
|
|
48
|
-
children:
|
|
47
|
+
...s,
|
|
48
|
+
children: c
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
export {
|
|
53
53
|
S as DateFormatter,
|
|
54
|
-
|
|
54
|
+
O as getFormatDate
|
|
55
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceFormatter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/formatters/PriceFormatter/PriceFormatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PriceFormatter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/formatters/PriceFormatter/PriceFormatter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAGvE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,MAAM,CAgCR;AACD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,OAAO,wBAAwB,EAC1F,KAAK,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAuBzC"}
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { clsx as
|
|
4
|
-
import { getPropertyByString as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const o = d(n, i);
|
|
1
|
+
import { jsx as s, Fragment as g } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import f, { useMemo as P } from "react";
|
|
3
|
+
import { clsx as S } from "clsx";
|
|
4
|
+
import { useUserPreferences as F, getPropertyByString as N } from "@m4l/core";
|
|
5
|
+
import { getComponentSlotRoot as b } from "../../../utils/getComponentSlotRoot.js";
|
|
6
|
+
import { getPropDataTestId as D } from "../../../test/getNameDataTestId.js";
|
|
7
|
+
import { useComponentSize as d } from "../../../hooks/useComponentSize/index.js";
|
|
8
|
+
import { PriceFormatterRootStyled as x } from "./slots/PriceFormatterSlots.js";
|
|
9
|
+
import { PRICE_FORMATTER_KEY_COMPONENT as l } from "./constants.js";
|
|
10
|
+
import { PriceFormatterSlots as R } from "./slots/PriceFormatterEnum.js";
|
|
11
|
+
function C(m, i, e, r) {
|
|
12
|
+
let t = "";
|
|
13
|
+
const o = N(m, i);
|
|
15
14
|
try {
|
|
16
15
|
if (isNaN(Number(o)))
|
|
17
16
|
return 0 .toLocaleString(navigator.language, {
|
|
18
|
-
currency:
|
|
17
|
+
currency: e,
|
|
19
18
|
style: "currency",
|
|
20
19
|
currencyDisplay: "symbol",
|
|
21
20
|
useGrouping: !0,
|
|
22
21
|
maximumFractionDigits: r
|
|
23
22
|
});
|
|
24
|
-
|
|
25
|
-
currency:
|
|
23
|
+
t = Number(o).toLocaleString(navigator.language, {
|
|
24
|
+
currency: e,
|
|
26
25
|
style: "currency",
|
|
27
26
|
currencyDisplay: "symbol",
|
|
28
27
|
useGrouping: !0,
|
|
29
28
|
maximumFractionDigits: r
|
|
30
29
|
}) || "";
|
|
31
30
|
} catch {
|
|
32
|
-
|
|
31
|
+
t = Number(o).toLocaleString("en-US", {
|
|
33
32
|
style: "currency",
|
|
34
33
|
currency: "USD",
|
|
35
34
|
currencyDisplay: "symbol",
|
|
@@ -37,26 +36,26 @@ function R(n, i, t, r) {
|
|
|
37
36
|
maximumFractionDigits: r
|
|
38
37
|
}) || "";
|
|
39
38
|
}
|
|
40
|
-
return
|
|
39
|
+
return t;
|
|
41
40
|
}
|
|
42
|
-
function
|
|
43
|
-
const { obProps: i, fieldValue:
|
|
44
|
-
() =>
|
|
45
|
-
[i,
|
|
41
|
+
function U(m) {
|
|
42
|
+
const { obProps: i, fieldValue: e, Component: r = x, size: t = "medium", color: o, dataTestid: n, className: p } = m, { currentSize: y } = d(t), { currency: c, currencyDecimalDigits: a } = F(), u = P(
|
|
43
|
+
() => C(i, e, c, a),
|
|
44
|
+
[i, e, c, a]
|
|
46
45
|
);
|
|
47
|
-
return r ===
|
|
46
|
+
return r === f.Fragment ? /* @__PURE__ */ s(g, { children: u }) : /* @__PURE__ */ s(
|
|
48
47
|
r,
|
|
49
48
|
{
|
|
50
49
|
variant: "body",
|
|
51
|
-
size:
|
|
50
|
+
size: y,
|
|
52
51
|
color: o,
|
|
53
|
-
className:
|
|
54
|
-
...
|
|
55
|
-
children:
|
|
52
|
+
className: S(b(l), p),
|
|
53
|
+
...D(l, R.root, n),
|
|
54
|
+
children: u
|
|
56
55
|
}
|
|
57
56
|
);
|
|
58
57
|
}
|
|
59
58
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
U as PriceFormatter,
|
|
60
|
+
C as getFormatPrice
|
|
62
61
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.31.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,20 +50,20 @@
|
|
|
50
50
|
"@hookform/resolvers": "2.9.11",
|
|
51
51
|
"nprogress": "0.2.0",
|
|
52
52
|
"react-transition-group": "4.4.5",
|
|
53
|
-
"@mui/x-date-pickers": "6.20.2",
|
|
54
|
-
"react-rnd": "10.5.2",
|
|
55
53
|
"react-color": "2.19.3",
|
|
56
54
|
"react-draggable": "4.5.0",
|
|
57
|
-
"react-spinners": "0.13.8",
|
|
58
55
|
"react-dropzone": "14.4.1",
|
|
56
|
+
"react-spinners": "0.13.8",
|
|
57
|
+
"@mui/x-date-pickers": "6.20.2",
|
|
58
|
+
"react-rnd": "10.5.2",
|
|
59
|
+
"simplebar-react": "3.2.6",
|
|
59
60
|
"chart.js": "4.5.1",
|
|
60
61
|
"chartjs-chart-error-bars": "4.4.5",
|
|
61
62
|
"qrcode.react": "3.2.0",
|
|
62
|
-
"
|
|
63
|
+
"react-resizable-panels": "2.1.9",
|
|
63
64
|
"react-data-grid": "7.0.0-beta.47",
|
|
64
65
|
"react-dnd": "16.0.1",
|
|
65
66
|
"react-dnd-html5-backend": "16.0.1",
|
|
66
|
-
"react-resizable-panels": "2.1.9",
|
|
67
67
|
"date-fns": "2.30.0",
|
|
68
68
|
"react-resizable": "3.1.3",
|
|
69
69
|
"react-window": "1.8.11",
|