@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.
@@ -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;AAanD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC,WAG9C,IAAI,SAAS,MAAM,YAiBnD,CAAC;AAwBF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,EAAE,OAAO,wBAAwB,CAAC,IAAI,CAAC;;;qCA7C3B,MAAM;;CAiEnD,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 { useFormatter as d } from "@m4l/graphics";
6
- import { getValidDate as f } from "../../../../utils/getValidDate.js";
7
- import { useState as D, useRef as y, useEffect as C, useMemo as V, useCallback as F } from "react";
8
- import { deepEqual as S } from "fast-equals";
9
- import { getColumnKey as s } from "../../helpers/shared/getColumnKey/getColumnKey.js";
10
- const T = (e) => {
11
- const { dateFormatter: t } = d();
12
- return F((a, n) => {
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 : l(e.presentationType, r, t, e.format).includes(n);
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, m) => {
18
- const a = s(e.fieldValue), n = i(t, a), u = i(m, a), o = f(n), r = f(u);
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
- }, E = (e) => {
21
- const [t, m] = D(e), a = T(t), n = y({ ...e });
22
- return C(() => {
23
- S(n.current, e) || (n.current = e, m(e));
24
- }, [e]), V(() => ({
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
- E as useColumnDate,
33
- T as useCustomDateFilter
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":"AAMA,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
+ {"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 s, useRef as a, useCallback as d, useEffect as P, useMemo as g } from "react";
2
- import { useFormatter as p } from "@m4l/graphics";
3
- import { getPropertyByString as l } from "@m4l/core";
4
- import { deepEqual as y } from "fast-equals";
5
- import { getFormatPrice as C } from "../../../formatters/PriceFormatter/PriceFormatter.js";
6
- import { ColumnPriceGroupFormatter as S } from "./ColumnPriceGroupFormatter.js";
7
- import { getColumnKey as c } from "../../helpers/shared/getColumnKey/getColumnKey.js";
8
- import { ColumnPriceFormatter as F } from "./formatter.js";
9
- const V = (e) => (u, t) => {
10
- const n = c(e.fieldValue), m = l(u, n), i = l(t, n);
11
- let r, o;
12
- return typeof m == "number" ? r = m : r = 0, typeof i == "number" ? o = i : o = 0, r > o ? 1 : r < o ? -1 : 0;
13
- }, k = (e) => {
14
- const { currencyFormatter: u } = p(), [t, n] = s(e), m = a({ ...e }), i = d(
15
- (r, o) => {
16
- const f = c(t.fieldValue);
17
- return C(
18
- r,
19
- f,
20
- u.code,
21
- u.decimalDigits
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
- [t, u]
23
+ [e, n, i]
25
24
  );
26
- return P(() => {
27
- y(m.current, e) || (m.current = e, n(e));
28
- }, [e]), g(() => ({
29
- formatter: F(t),
30
- renderGroupCell: S(t),
31
- customFilter: i,
32
- customSort: V(t)
33
- }), [t, i]);
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
- k as useColumnPrice
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,EAAgB,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACjF,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
+ {"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 c, Fragment as d } from "@emotion/react/jsx-runtime";
2
- import F, { useMemo as u } from "react";
3
- import { useFormatter as D } from "@m4l/graphics";
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 h(n, t, e, r) {
11
- let o = r || e.datetimeFormat, m, a;
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
- o = r || e.datetimeFormat;
16
+ r = o || e.datetimeFormat;
17
17
  break;
18
18
  case "date":
19
- o = r || e.dateFormat;
19
+ r = o || e.dateFormat;
20
20
  break;
21
21
  case "time":
22
- o = r || e.timeFormat;
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, o), m;
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: r,
36
- Component: o = T,
35
+ format: o,
36
+ Component: r = T,
37
37
  dataTestId: m,
38
38
  className: a,
39
- componentProps: i
40
- } = n, { dateFormatter: l } = D(), s = h(t, e, l, r), p = u(() => s, [s]);
41
- return o === F.Fragment ? /* @__PURE__ */ c(d, { children: p }) : /* @__PURE__ */ c(
42
- o,
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
- ...i,
48
- children: p
47
+ ...s,
48
+ children: c
49
49
  }
50
50
  );
51
51
  }
52
52
  export {
53
53
  S as DateFormatter,
54
- h as getFormatDate
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;AAOvC,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
+ {"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 u, Fragment as g } from "@emotion/react/jsx-runtime";
2
- import y, { useMemo as f } from "react";
3
- import { clsx as F } from "clsx";
4
- import { getPropertyByString as d } from "@m4l/core";
5
- import { useFormatter as S } from "@m4l/graphics";
6
- import { getComponentSlotRoot as N } from "../../../utils/getComponentSlotRoot.js";
7
- import { getPropDataTestId as P } from "../../../test/getNameDataTestId.js";
8
- import { useComponentSize as b } from "../../../hooks/useComponentSize/index.js";
9
- import { PriceFormatterRootStyled as D } from "./slots/PriceFormatterSlots.js";
10
- import { PRICE_FORMATTER_KEY_COMPONENT as s } from "./constants.js";
11
- import { PriceFormatterSlots as x } from "./slots/PriceFormatterEnum.js";
12
- function R(n, i, t, r) {
13
- let e = "";
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: t,
17
+ currency: e,
19
18
  style: "currency",
20
19
  currencyDisplay: "symbol",
21
20
  useGrouping: !0,
22
21
  maximumFractionDigits: r
23
22
  });
24
- e = Number(o).toLocaleString(navigator.language, {
25
- currency: t,
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
- e = Number(o).toLocaleString("en-US", {
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 e;
39
+ return t;
41
40
  }
42
- function I(n) {
43
- const { obProps: i, fieldValue: t, Component: r = D, size: e = "medium", color: o, dataTestid: a, className: l } = n, { currentSize: p } = b(e), { currencyFormatter: m } = S(), c = f(
44
- () => R(i, t, m.code, m.decimalDigits),
45
- [i, t, m.code, m.decimalDigits]
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 === y.Fragment ? /* @__PURE__ */ u(g, { children: c }) : /* @__PURE__ */ u(
46
+ return r === f.Fragment ? /* @__PURE__ */ s(g, { children: u }) : /* @__PURE__ */ s(
48
47
  r,
49
48
  {
50
49
  variant: "body",
51
- size: p,
50
+ size: y,
52
51
  color: o,
53
- className: F(N(s), l),
54
- ...P(s, x.root, a),
55
- children: c
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
- I as PriceFormatter,
61
- R as getFormatPrice
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.30.2",
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
- "simplebar-react": "3.2.6",
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",