next-recomponents 2.0.42 → 2.0.43

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/index.js CHANGED
@@ -37192,6 +37192,8 @@ function usePopup() {
37192
37192
  (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
37193
37193
  } else if (prev == null ? void 0 : prev.onCancel) {
37194
37194
  visible = !Boolean(await ((_b = prev.onCancel) == null ? void 0 : _b.call(prev)));
37195
+ } else {
37196
+ visible = false;
37195
37197
  }
37196
37198
  const data = { ...prev, visible, inputValue: "" };
37197
37199
  setPopup(data);
@@ -37219,9 +37221,9 @@ function usePopup() {
37219
37221
  // onConfirm: () => {
37220
37222
  // resolve();
37221
37223
  // },
37222
- onCancel: async () => {
37224
+ onCancel: onClose ? async () => {
37223
37225
  return await (onClose == null ? void 0 : onClose());
37224
- },
37226
+ } : void 0,
37225
37227
  icons,
37226
37228
  full
37227
37229
  })
@@ -39019,6 +39021,30 @@ var regularExpresions2 = {
39019
39021
  };
39020
39022
  var types_default = regularExpresions2;
39021
39023
 
39024
+ // src/table-advanced/formatter.ts
39025
+ function valueFormatter({
39026
+ value,
39027
+ currentCoin = ""
39028
+ }) {
39029
+ if (value == null || value === "") return "";
39030
+ const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
39031
+ if (`${value}`.match(isDate)) {
39032
+ return value.toString().split("T")[0].split("-").reverse().join("/");
39033
+ }
39034
+ const splited = `${value}`.split(".");
39035
+ const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(types_default.number));
39036
+ if (hasDecimals) {
39037
+ return [
39038
+ currentCoin,
39039
+ (+`${value}`).toLocaleString("en-US", {
39040
+ minimumFractionDigits: 2,
39041
+ maximumFractionDigits: 2
39042
+ })
39043
+ ].join(" ");
39044
+ }
39045
+ return value;
39046
+ }
39047
+
39022
39048
  // src/table-advanced/h.table.tsx
39023
39049
  var import_jsx_runtime36 = require("react/jsx-runtime");
39024
39050
  function HTable({
@@ -39067,7 +39093,10 @@ function HTable({
39067
39093
  );
39068
39094
  const gridTemplateColumns2 = headers2.filter((h) => {
39069
39095
  var _a, _b;
39070
- return !((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h));
39096
+ if (["__modal__", "__select__"].includes(h)) {
39097
+ return true;
39098
+ }
39099
+ return !((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h)) && !h.startsWith("_");
39071
39100
  }).map((h) => {
39072
39101
  var _a;
39073
39102
  return `${(_a = widths2[h]) != null ? _a : defaultWidth}px`;
@@ -39078,28 +39107,27 @@ function HTable({
39078
39107
  (0, import_react19.useEffect)(() => {
39079
39108
  if (!tableRef.current) return;
39080
39109
  const observer = new ResizeObserver(([entry]) => {
39081
- const sizeados = headers.filter(
39082
- (h) => [
39083
- "__select__",
39084
- "__modal__"
39085
- // ...(context?.hideColumns || []),
39086
- // ...(context?.colSize ? Object.keys(context.colSize) : []),
39087
- ].includes(h)
39110
+ const ocultos = headers.filter(
39111
+ (h) => {
39112
+ var _a, _b;
39113
+ return !h.startsWith("__") && (h.startsWith("_") || ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h)));
39114
+ }
39088
39115
  );
39116
+ const sizeados = headers.filter((h) => h.startsWith("__"));
39089
39117
  const personalizados = (context == null ? void 0 : context.colSize) ? Object.values(context.colSize) : [];
39090
39118
  const personalizadosSum = personalizados.length > 0 ? personalizados.reduce((acc, i) => acc + i, 0) : 0;
39091
39119
  const ancho = +entry.contentRect.width;
39092
39120
  const sizeadosLength = sizeados.length;
39093
39121
  const sizeadosWidth = sizeadosLength * 60;
39094
- const w = (ancho - sizeadosWidth - personalizadosSum) / (headers.length - sizeadosLength - personalizados.length);
39122
+ const w = (ancho - sizeadosWidth - personalizadosSum) / (headers.length - sizeadosLength - personalizados.length - ocultos.length);
39095
39123
  console.log({
39096
39124
  w,
39097
39125
  ancho,
39098
39126
  sizeadosWidth,
39099
- sizeadosLength,
39100
39127
  personalizadosSum,
39101
- headers: headers.length,
39102
- personalizados: personalizados.length
39128
+ headers,
39129
+ sizeadosLength,
39130
+ personalizados
39103
39131
  });
39104
39132
  setWidths(
39105
39133
  Object.fromEntries(
@@ -39188,6 +39216,7 @@ function HTable({
39188
39216
  headers.map((header, i) => {
39189
39217
  var _a, _b;
39190
39218
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, header)) return null;
39219
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
39191
39220
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
39192
39221
  "div",
39193
39222
  {
@@ -39230,6 +39259,7 @@ function HTable({
39230
39259
  return items.map(([key, item], i) => {
39231
39260
  var _a, _b, _c, _d, _e, _f, _g;
39232
39261
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, key)) return null;
39262
+ if (key.startsWith("_") && !key.startsWith("__")) return null;
39233
39263
  if (key == "__modal__") {
39234
39264
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39235
39265
  "div",
@@ -39349,7 +39379,7 @@ function HTable({
39349
39379
  }) : ["number", "string"].includes(typeof item) ? valueFormatter({
39350
39380
  value: item,
39351
39381
  currentCoin: context.currentCoin
39352
- }) : JSON.stringify(item)
39382
+ }) : import_react19.default.isValidElement(item) ? item : JSON.stringify(item)
39353
39383
  },
39354
39384
  row.id + i
39355
39385
  );
@@ -39381,8 +39411,14 @@ function HTable({
39381
39411
  color: "white",
39382
39412
  onClose: async () => {
39383
39413
  var _a;
39384
- const c = await ((_a = context == null ? void 0 : context.onCloseModal) == null ? void 0 : _a.call(context, searchedData[currentIndex]));
39385
- return c;
39414
+ if (context == null ? void 0 : context.onCloseModal) {
39415
+ const c = await ((_a = context == null ? void 0 : context.onCloseModal) == null ? void 0 : _a.call(
39416
+ context,
39417
+ searchedData[currentIndex]
39418
+ ));
39419
+ return c;
39420
+ }
39421
+ return true;
39386
39422
  },
39387
39423
  children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
39388
39424
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "fixed top-0 left-0 p-10 ", children: [
@@ -39425,28 +39461,6 @@ function HTable({
39425
39461
  }
39426
39462
  );
39427
39463
  }
39428
- function valueFormatter({
39429
- value,
39430
- currentCoin = ""
39431
- }) {
39432
- if (value == null || value === "") return "";
39433
- const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
39434
- if (`${value}`.match(isDate)) {
39435
- return value.toString().split("T")[0].split("-").reverse().join("/");
39436
- }
39437
- const splited = `${value}`.split(".");
39438
- const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(types_default.number));
39439
- if (hasDecimals) {
39440
- return [
39441
- currentCoin,
39442
- (+`${value}`).toLocaleString("en-US", {
39443
- minimumFractionDigits: 2,
39444
- maximumFractionDigits: 2
39445
- })
39446
- ].join(" ");
39447
- }
39448
- return value;
39449
- }
39450
39464
 
39451
39465
  // src/table-advanced/context.ts
39452
39466
  var import_react20 = require("react");
package/dist/index.mjs CHANGED
@@ -37177,6 +37177,8 @@ function usePopup() {
37177
37177
  (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
37178
37178
  } else if (prev == null ? void 0 : prev.onCancel) {
37179
37179
  visible = !Boolean(await ((_b = prev.onCancel) == null ? void 0 : _b.call(prev)));
37180
+ } else {
37181
+ visible = false;
37180
37182
  }
37181
37183
  const data = { ...prev, visible, inputValue: "" };
37182
37184
  setPopup(data);
@@ -37204,9 +37206,9 @@ function usePopup() {
37204
37206
  // onConfirm: () => {
37205
37207
  // resolve();
37206
37208
  // },
37207
- onCancel: async () => {
37209
+ onCancel: onClose ? async () => {
37208
37210
  return await (onClose == null ? void 0 : onClose());
37209
- },
37211
+ } : void 0,
37210
37212
  icons,
37211
37213
  full
37212
37214
  })
@@ -39017,6 +39019,30 @@ var regularExpresions2 = {
39017
39019
  };
39018
39020
  var types_default = regularExpresions2;
39019
39021
 
39022
+ // src/table-advanced/formatter.ts
39023
+ function valueFormatter({
39024
+ value,
39025
+ currentCoin = ""
39026
+ }) {
39027
+ if (value == null || value === "") return "";
39028
+ const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
39029
+ if (`${value}`.match(isDate)) {
39030
+ return value.toString().split("T")[0].split("-").reverse().join("/");
39031
+ }
39032
+ const splited = `${value}`.split(".");
39033
+ const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(types_default.number));
39034
+ if (hasDecimals) {
39035
+ return [
39036
+ currentCoin,
39037
+ (+`${value}`).toLocaleString("en-US", {
39038
+ minimumFractionDigits: 2,
39039
+ maximumFractionDigits: 2
39040
+ })
39041
+ ].join(" ");
39042
+ }
39043
+ return value;
39044
+ }
39045
+
39020
39046
  // src/table-advanced/h.table.tsx
39021
39047
  import { jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
39022
39048
  function HTable({
@@ -39065,7 +39091,10 @@ function HTable({
39065
39091
  );
39066
39092
  const gridTemplateColumns2 = headers2.filter((h) => {
39067
39093
  var _a, _b;
39068
- return !((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h));
39094
+ if (["__modal__", "__select__"].includes(h)) {
39095
+ return true;
39096
+ }
39097
+ return !((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h)) && !h.startsWith("_");
39069
39098
  }).map((h) => {
39070
39099
  var _a;
39071
39100
  return `${(_a = widths2[h]) != null ? _a : defaultWidth}px`;
@@ -39076,28 +39105,27 @@ function HTable({
39076
39105
  useEffect11(() => {
39077
39106
  if (!tableRef.current) return;
39078
39107
  const observer = new ResizeObserver(([entry]) => {
39079
- const sizeados = headers.filter(
39080
- (h) => [
39081
- "__select__",
39082
- "__modal__"
39083
- // ...(context?.hideColumns || []),
39084
- // ...(context?.colSize ? Object.keys(context.colSize) : []),
39085
- ].includes(h)
39108
+ const ocultos = headers.filter(
39109
+ (h) => {
39110
+ var _a, _b;
39111
+ return !h.startsWith("__") && (h.startsWith("_") || ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, h)));
39112
+ }
39086
39113
  );
39114
+ const sizeados = headers.filter((h) => h.startsWith("__"));
39087
39115
  const personalizados = (context == null ? void 0 : context.colSize) ? Object.values(context.colSize) : [];
39088
39116
  const personalizadosSum = personalizados.length > 0 ? personalizados.reduce((acc, i) => acc + i, 0) : 0;
39089
39117
  const ancho = +entry.contentRect.width;
39090
39118
  const sizeadosLength = sizeados.length;
39091
39119
  const sizeadosWidth = sizeadosLength * 60;
39092
- const w = (ancho - sizeadosWidth - personalizadosSum) / (headers.length - sizeadosLength - personalizados.length);
39120
+ const w = (ancho - sizeadosWidth - personalizadosSum) / (headers.length - sizeadosLength - personalizados.length - ocultos.length);
39093
39121
  console.log({
39094
39122
  w,
39095
39123
  ancho,
39096
39124
  sizeadosWidth,
39097
- sizeadosLength,
39098
39125
  personalizadosSum,
39099
- headers: headers.length,
39100
- personalizados: personalizados.length
39126
+ headers,
39127
+ sizeadosLength,
39128
+ personalizados
39101
39129
  });
39102
39130
  setWidths(
39103
39131
  Object.fromEntries(
@@ -39186,6 +39214,7 @@ function HTable({
39186
39214
  headers.map((header, i) => {
39187
39215
  var _a, _b;
39188
39216
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, header)) return null;
39217
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
39189
39218
  return /* @__PURE__ */ jsxs25(
39190
39219
  "div",
39191
39220
  {
@@ -39228,6 +39257,7 @@ function HTable({
39228
39257
  return items.map(([key, item], i) => {
39229
39258
  var _a, _b, _c, _d, _e, _f, _g;
39230
39259
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, key)) return null;
39260
+ if (key.startsWith("_") && !key.startsWith("__")) return null;
39231
39261
  if (key == "__modal__") {
39232
39262
  return /* @__PURE__ */ jsx33(
39233
39263
  "div",
@@ -39347,7 +39377,7 @@ function HTable({
39347
39377
  }) : ["number", "string"].includes(typeof item) ? valueFormatter({
39348
39378
  value: item,
39349
39379
  currentCoin: context.currentCoin
39350
- }) : JSON.stringify(item)
39380
+ }) : React10.isValidElement(item) ? item : JSON.stringify(item)
39351
39381
  },
39352
39382
  row.id + i
39353
39383
  );
@@ -39379,8 +39409,14 @@ function HTable({
39379
39409
  color: "white",
39380
39410
  onClose: async () => {
39381
39411
  var _a;
39382
- const c = await ((_a = context == null ? void 0 : context.onCloseModal) == null ? void 0 : _a.call(context, searchedData[currentIndex]));
39383
- return c;
39412
+ if (context == null ? void 0 : context.onCloseModal) {
39413
+ const c = await ((_a = context == null ? void 0 : context.onCloseModal) == null ? void 0 : _a.call(
39414
+ context,
39415
+ searchedData[currentIndex]
39416
+ ));
39417
+ return c;
39418
+ }
39419
+ return true;
39384
39420
  },
39385
39421
  children: /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
39386
39422
  /* @__PURE__ */ jsxs25("div", { className: "fixed top-0 left-0 p-10 ", children: [
@@ -39423,28 +39459,6 @@ function HTable({
39423
39459
  }
39424
39460
  );
39425
39461
  }
39426
- function valueFormatter({
39427
- value,
39428
- currentCoin = ""
39429
- }) {
39430
- if (value == null || value === "") return "";
39431
- const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
39432
- if (`${value}`.match(isDate)) {
39433
- return value.toString().split("T")[0].split("-").reverse().join("/");
39434
- }
39435
- const splited = `${value}`.split(".");
39436
- const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(types_default.number));
39437
- if (hasDecimals) {
39438
- return [
39439
- currentCoin,
39440
- (+`${value}`).toLocaleString("en-US", {
39441
- minimumFractionDigits: 2,
39442
- maximumFractionDigits: 2
39443
- })
39444
- ].join(" ");
39445
- }
39446
- return value;
39447
- }
39448
39462
 
39449
39463
  // src/table-advanced/context.ts
39450
39464
  import { useEffect as useEffect12, useMemo as useMemo9, useReducer as useReducer3, useState as useState16 } from "react";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.42",
3
+ "version": "2.0.43",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/pop/index.tsx CHANGED
@@ -38,9 +38,12 @@ export default function usePopup() {
38
38
  prev.onConfirm?.(value);
39
39
  } else if (prev?.onCancel) {
40
40
  visible = !Boolean(await prev.onCancel?.());
41
+ } else {
42
+ visible = false;
41
43
  }
42
44
 
43
45
  const data = { ...prev, visible, inputValue: "" };
46
+
44
47
  setPopup(data);
45
48
  },
46
49
  [popup],
@@ -76,9 +79,11 @@ export default function usePopup() {
76
79
  // onConfirm: () => {
77
80
  // resolve();
78
81
  // },
79
- onCancel: async () => {
80
- return await onClose?.();
81
- },
82
+ onCancel: onClose
83
+ ? async () => {
84
+ return await onClose?.();
85
+ }
86
+ : undefined,
82
87
  icons,
83
88
  full,
84
89
  }),
@@ -0,0 +1,36 @@
1
+ import { ReactNode } from "react";
2
+ import regularExpresions from "./types";
3
+
4
+ export function valueFormatter({
5
+ value,
6
+ currentCoin = "",
7
+ }: {
8
+ value: any;
9
+ currentCoin?: ReactNode;
10
+ }) {
11
+ if (value == null || value === "") return "";
12
+
13
+ const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
14
+
15
+ if (`${value}`.match(isDate)) {
16
+ return value.toString().split("T")[0].split("-").reverse().join("/");
17
+ }
18
+
19
+ const splited = `${value}`.split(".");
20
+
21
+ const hasDecimals =
22
+ splited.length == 2 &&
23
+ splited.every((v: any) => `${v}`.match(regularExpresions.number));
24
+
25
+ if (hasDecimals) {
26
+ return [
27
+ currentCoin,
28
+ (+`${value}`).toLocaleString("en-US", {
29
+ minimumFractionDigits: 2,
30
+ maximumFractionDigits: 2,
31
+ }),
32
+ ].join(" ");
33
+ }
34
+
35
+ return value;
36
+ }
@@ -14,6 +14,7 @@ import Searchable from "./searchable";
14
14
  import Modal from "../modal";
15
15
  import { EditIcon } from "./icons";
16
16
  import regularExpresions, { TableProps } from "./types";
17
+ import { valueFormatter } from "./formatter";
17
18
  type Widths = Record<string, number>;
18
19
  export default function HTable({
19
20
  context,
@@ -51,18 +52,6 @@ export default function HTable({
51
52
  }
52
53
  const [widths, setWidths] = useState<Widths>({});
53
54
 
54
- // si headers cambia dinámicamente, hay que rellenar los que falten
55
- // useEffect(() => {
56
- // setWidths((prev) => {
57
- // const missing = headers.filter((h) => !(h in prev));
58
- // if (missing.length === 0) return prev;
59
- // return {
60
- // ...prev,
61
- // ...Object.fromEntries(missing.map((h) => [h, getWidth(h)])),
62
- // };
63
- // });
64
- // }, [headers, defaultWidth]);
65
-
66
55
  const startDrag = useCallback(
67
56
  (e: React.MouseEvent, headerKey: string) => {
68
57
  e.preventDefault();
@@ -87,7 +76,13 @@ export default function HTable({
87
76
  );
88
77
 
89
78
  const gridTemplateColumns = headers
90
- .filter((h) => !context?.hideColumns?.includes?.(h))
79
+ .filter((h) => {
80
+ if (["__modal__", "__select__"].includes(h)) {
81
+ return true;
82
+ }
83
+
84
+ return !context?.hideColumns?.includes?.(h) && !h.startsWith("_");
85
+ })
91
86
  .map((h) => `${widths[h] ?? defaultWidth}px`)
92
87
  .join(" ");
93
88
 
@@ -99,14 +94,12 @@ export default function HTable({
99
94
  useEffect(() => {
100
95
  if (!tableRef.current) return;
101
96
  const observer = new ResizeObserver(([entry]) => {
102
- const sizeados = headers.filter((h) =>
103
- [
104
- "__select__",
105
- "__modal__",
106
- // ...(context?.hideColumns || []),
107
- // ...(context?.colSize ? Object.keys(context.colSize) : []),
108
- ].includes(h),
97
+ const ocultos = headers.filter(
98
+ (h) =>
99
+ !h.startsWith("__") &&
100
+ (h.startsWith("_") || context?.hideColumns?.includes?.(h)),
109
101
  );
102
+ const sizeados = headers.filter((h) => h.startsWith("__"));
110
103
 
111
104
  const personalizados = context?.colSize
112
105
  ? (Object.values(context.colSize) as number[])
@@ -122,15 +115,18 @@ export default function HTable({
122
115
 
123
116
  const w =
124
117
  (ancho - sizeadosWidth - personalizadosSum) /
125
- (headers.length - sizeadosLength - personalizados.length);
118
+ (headers.length -
119
+ sizeadosLength -
120
+ personalizados.length -
121
+ ocultos.length);
126
122
  console.log({
127
123
  w,
128
124
  ancho,
129
125
  sizeadosWidth,
130
- sizeadosLength,
131
126
  personalizadosSum,
132
- headers: headers.length,
133
- personalizados: personalizados.length,
127
+ headers,
128
+ sizeadosLength,
129
+ personalizados,
134
130
  });
135
131
  setWidths(
136
132
  Object.fromEntries(
@@ -228,6 +224,7 @@ export default function HTable({
228
224
  <div className="grid " style={{ gridTemplateColumns }}>
229
225
  {headers.map((header, i) => {
230
226
  if (context?.hideColumns?.includes?.(header)) return null;
227
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
231
228
  return (
232
229
  <div
233
230
  key={header}
@@ -269,6 +266,7 @@ export default function HTable({
269
266
 
270
267
  return items.map(([key, item], i) => {
271
268
  if (context?.hideColumns?.includes?.(key)) return null;
269
+ if (key.startsWith("_") && !key.startsWith("__")) return null;
272
270
 
273
271
  if (key == "__modal__") {
274
272
  return (
@@ -441,6 +439,8 @@ export default function HTable({
441
439
  value: item,
442
440
  currentCoin: context.currentCoin,
443
441
  })
442
+ ) : React.isValidElement(item) ? (
443
+ item
444
444
  ) : (
445
445
  JSON.stringify(item)
446
446
  )}
@@ -493,9 +493,15 @@ export default function HTable({
493
493
  button={<button ref={modalRef}></button>}
494
494
  color={"white"}
495
495
  onClose={async () => {
496
- const c = await context?.onCloseModal?.(searchedData[currentIndex]);
496
+ if (context?.onCloseModal) {
497
+ const c = await context?.onCloseModal?.(
498
+ searchedData[currentIndex],
499
+ );
497
500
 
498
- return c;
501
+ return c;
502
+ }
503
+
504
+ return true;
499
505
  }}
500
506
  >
501
507
  <div className="relative">
@@ -543,37 +549,3 @@ export default function HTable({
543
549
  </div>
544
550
  );
545
551
  }
546
-
547
- function valueFormatter({
548
- value,
549
- currentCoin = "",
550
- }: {
551
- value: any;
552
- currentCoin?: ReactNode;
553
- }) {
554
- if (value == null || value === "") return "";
555
-
556
- const isDate = /(\d{4}-\d{2}-\d{2})(T[\d:,.+-]*(Z)?)?/;
557
-
558
- if (`${value}`.match(isDate)) {
559
- return value.toString().split("T")[0].split("-").reverse().join("/");
560
- }
561
-
562
- const splited = `${value}`.split(".");
563
-
564
- const hasDecimals =
565
- splited.length == 2 &&
566
- splited.every((v: any) => `${v}`.match(regularExpresions.number));
567
-
568
- if (hasDecimals) {
569
- return [
570
- currentCoin,
571
- (+`${value}`).toLocaleString("en-US", {
572
- minimumFractionDigits: 2,
573
- maximumFractionDigits: 2,
574
- }),
575
- ].join(" ");
576
- }
577
-
578
- return value;
579
- }