next-recomponents 2.0.20 → 2.0.22
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +38 -13
- package/dist/index.mjs +38 -13
- package/package.json +1 -1
- package/src/pop/index.tsx +1 -1
- package/src/pop/overlay.tsx +5 -3
- package/src/table/index.tsx +30 -8
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -35845,13 +35845,21 @@ function useColumns(rows, currentCoin, options) {
|
|
|
35845
35845
|
if (`${value}`.match(isDate)) {
|
|
35846
35846
|
return value.toString().split("T")[0].split("-").reverse().join("/");
|
|
35847
35847
|
}
|
|
35848
|
+
const splited = `${value}`.split(".");
|
|
35849
|
+
const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
|
|
35850
|
+
if (hasDecimals) {
|
|
35851
|
+
return [
|
|
35852
|
+
currentCoin,
|
|
35853
|
+
(+`${value}`).toLocaleString("en-US", {
|
|
35854
|
+
minimumFractionDigits: 2,
|
|
35855
|
+
maximumFractionDigits: 2
|
|
35856
|
+
})
|
|
35857
|
+
].join(" ");
|
|
35858
|
+
}
|
|
35848
35859
|
const isNumber = typeof value === "number";
|
|
35849
35860
|
if (isNumber) {
|
|
35850
35861
|
if (isNaN(value)) return value;
|
|
35851
|
-
return
|
|
35852
|
-
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
35853
|
-
maximumFractionDigits: value % 1 !== 0 ? 2 : 0
|
|
35854
|
-
});
|
|
35862
|
+
return value;
|
|
35855
35863
|
}
|
|
35856
35864
|
return value;
|
|
35857
35865
|
},
|
|
@@ -35913,7 +35921,9 @@ function IHTable({
|
|
|
35913
35921
|
header,
|
|
35914
35922
|
hideColumns = [],
|
|
35915
35923
|
footer = {},
|
|
35916
|
-
currentCoin = "$"
|
|
35924
|
+
currentCoin = "$",
|
|
35925
|
+
fontSize = "1rem",
|
|
35926
|
+
className
|
|
35917
35927
|
}) {
|
|
35918
35928
|
var _a;
|
|
35919
35929
|
if (modal && onSelect)
|
|
@@ -35999,12 +36009,21 @@ function IHTable({
|
|
|
35999
36009
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36000
36010
|
import_x_data_grid.DataGrid,
|
|
36001
36011
|
{
|
|
36012
|
+
className,
|
|
36002
36013
|
rows,
|
|
36003
36014
|
columns,
|
|
36004
36015
|
checkboxSelection: Boolean(onSelect),
|
|
36005
36016
|
rowSelectionModel: selectedRows,
|
|
36006
36017
|
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
36007
36018
|
sx: {
|
|
36019
|
+
fontSize,
|
|
36020
|
+
// equivalente a text-xs
|
|
36021
|
+
"& .MuiDataGrid-cell": {
|
|
36022
|
+
fontSize
|
|
36023
|
+
},
|
|
36024
|
+
"& .MuiDataGrid-columnHeader": {
|
|
36025
|
+
fontSize
|
|
36026
|
+
},
|
|
36008
36027
|
"& .MuiDataGrid-cell--editable": {
|
|
36009
36028
|
backgroundColor: "#c6d8f0",
|
|
36010
36029
|
fontWeight: 500
|
|
@@ -36991,15 +37010,21 @@ function PopupOverlay({
|
|
|
36991
37010
|
iconText: c.iconText
|
|
36992
37011
|
}
|
|
36993
37012
|
),
|
|
36994
|
-
|
|
36995
|
-
|
|
37013
|
+
!(popup == null ? void 0 : popup.icons) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
37014
|
+
"div",
|
|
36996
37015
|
{
|
|
36997
|
-
|
|
36998
|
-
|
|
36999
|
-
|
|
37000
|
-
|
|
37016
|
+
className: `w-full h-12 rounded-full flex items-start justify-end`,
|
|
37017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
37018
|
+
Button,
|
|
37019
|
+
{
|
|
37020
|
+
color: "danger",
|
|
37021
|
+
className: "fixed text-xs font-bold",
|
|
37022
|
+
onClick: (e) => onClose(false),
|
|
37023
|
+
children: "x"
|
|
37024
|
+
}
|
|
37025
|
+
)
|
|
37001
37026
|
}
|
|
37002
|
-
)
|
|
37027
|
+
),
|
|
37003
37028
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
37004
37029
|
"div",
|
|
37005
37030
|
{
|
|
@@ -37079,7 +37104,7 @@ function usePopup() {
|
|
|
37079
37104
|
[open]
|
|
37080
37105
|
);
|
|
37081
37106
|
const modal = (0, import_react9.useCallback)(
|
|
37082
|
-
(message, color = "primary", icons =
|
|
37107
|
+
(message, color = "primary", icons = false, full = false) => new Promise(
|
|
37083
37108
|
(resolve) => open({
|
|
37084
37109
|
type: "modal",
|
|
37085
37110
|
message,
|
package/dist/index.mjs
CHANGED
|
@@ -35825,13 +35825,21 @@ function useColumns(rows, currentCoin, options) {
|
|
|
35825
35825
|
if (`${value}`.match(isDate)) {
|
|
35826
35826
|
return value.toString().split("T")[0].split("-").reverse().join("/");
|
|
35827
35827
|
}
|
|
35828
|
+
const splited = `${value}`.split(".");
|
|
35829
|
+
const hasDecimals = splited.length == 2 && splited.every((v) => `${v}`.match(regular_expresions_default.number));
|
|
35830
|
+
if (hasDecimals) {
|
|
35831
|
+
return [
|
|
35832
|
+
currentCoin,
|
|
35833
|
+
(+`${value}`).toLocaleString("en-US", {
|
|
35834
|
+
minimumFractionDigits: 2,
|
|
35835
|
+
maximumFractionDigits: 2
|
|
35836
|
+
})
|
|
35837
|
+
].join(" ");
|
|
35838
|
+
}
|
|
35828
35839
|
const isNumber = typeof value === "number";
|
|
35829
35840
|
if (isNumber) {
|
|
35830
35841
|
if (isNaN(value)) return value;
|
|
35831
|
-
return
|
|
35832
|
-
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
35833
|
-
maximumFractionDigits: value % 1 !== 0 ? 2 : 0
|
|
35834
|
-
});
|
|
35842
|
+
return value;
|
|
35835
35843
|
}
|
|
35836
35844
|
return value;
|
|
35837
35845
|
},
|
|
@@ -35893,7 +35901,9 @@ function IHTable({
|
|
|
35893
35901
|
header,
|
|
35894
35902
|
hideColumns = [],
|
|
35895
35903
|
footer = {},
|
|
35896
|
-
currentCoin = "$"
|
|
35904
|
+
currentCoin = "$",
|
|
35905
|
+
fontSize = "1rem",
|
|
35906
|
+
className
|
|
35897
35907
|
}) {
|
|
35898
35908
|
var _a;
|
|
35899
35909
|
if (modal && onSelect)
|
|
@@ -35979,12 +35989,21 @@ function IHTable({
|
|
|
35979
35989
|
/* @__PURE__ */ jsx6(
|
|
35980
35990
|
DataGrid,
|
|
35981
35991
|
{
|
|
35992
|
+
className,
|
|
35982
35993
|
rows,
|
|
35983
35994
|
columns,
|
|
35984
35995
|
checkboxSelection: Boolean(onSelect),
|
|
35985
35996
|
rowSelectionModel: selectedRows,
|
|
35986
35997
|
onRowSelectionModelChange: !modal ? setSelectedRows : void 0,
|
|
35987
35998
|
sx: {
|
|
35999
|
+
fontSize,
|
|
36000
|
+
// equivalente a text-xs
|
|
36001
|
+
"& .MuiDataGrid-cell": {
|
|
36002
|
+
fontSize
|
|
36003
|
+
},
|
|
36004
|
+
"& .MuiDataGrid-columnHeader": {
|
|
36005
|
+
fontSize
|
|
36006
|
+
},
|
|
35988
36007
|
"& .MuiDataGrid-cell--editable": {
|
|
35989
36008
|
backgroundColor: "#c6d8f0",
|
|
35990
36009
|
fontWeight: 500
|
|
@@ -36977,15 +36996,21 @@ function PopupOverlay({
|
|
|
36977
36996
|
iconText: c.iconText
|
|
36978
36997
|
}
|
|
36979
36998
|
),
|
|
36980
|
-
|
|
36981
|
-
|
|
36999
|
+
!(popup == null ? void 0 : popup.icons) && /* @__PURE__ */ jsx14(
|
|
37000
|
+
"div",
|
|
36982
37001
|
{
|
|
36983
|
-
|
|
36984
|
-
|
|
36985
|
-
|
|
36986
|
-
|
|
37002
|
+
className: `w-full h-12 rounded-full flex items-start justify-end`,
|
|
37003
|
+
children: /* @__PURE__ */ jsx14(
|
|
37004
|
+
Button,
|
|
37005
|
+
{
|
|
37006
|
+
color: "danger",
|
|
37007
|
+
className: "fixed text-xs font-bold",
|
|
37008
|
+
onClick: (e) => onClose(false),
|
|
37009
|
+
children: "x"
|
|
37010
|
+
}
|
|
37011
|
+
)
|
|
36987
37012
|
}
|
|
36988
|
-
)
|
|
37013
|
+
),
|
|
36989
37014
|
/* @__PURE__ */ jsx14(
|
|
36990
37015
|
"div",
|
|
36991
37016
|
{
|
|
@@ -37065,7 +37090,7 @@ function usePopup() {
|
|
|
37065
37090
|
[open]
|
|
37066
37091
|
);
|
|
37067
37092
|
const modal = useCallback(
|
|
37068
|
-
(message, color = "primary", icons =
|
|
37093
|
+
(message, color = "primary", icons = false, full = false) => new Promise(
|
|
37069
37094
|
(resolve) => open({
|
|
37070
37095
|
type: "modal",
|
|
37071
37096
|
message,
|
package/package.json
CHANGED
package/src/pop/index.tsx
CHANGED
package/src/pop/overlay.tsx
CHANGED
|
@@ -45,8 +45,10 @@ export function PopupOverlay({
|
|
|
45
45
|
iconText={c.iconText}
|
|
46
46
|
/>
|
|
47
47
|
)}
|
|
48
|
-
{
|
|
49
|
-
<div
|
|
48
|
+
{!popup?.icons && (
|
|
49
|
+
<div
|
|
50
|
+
className={`w-full h-12 rounded-full flex items-start justify-end`}
|
|
51
|
+
>
|
|
50
52
|
<Button
|
|
51
53
|
color="danger"
|
|
52
54
|
className="fixed text-xs font-bold"
|
|
@@ -55,7 +57,7 @@ export function PopupOverlay({
|
|
|
55
57
|
x
|
|
56
58
|
</Button>
|
|
57
59
|
</div>
|
|
58
|
-
}
|
|
60
|
+
)}
|
|
59
61
|
<div
|
|
60
62
|
className={"text-gray-800 text-[15px] font-medium leading-snug "}
|
|
61
63
|
>
|
package/src/table/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import { Box, Dialog } from "@mui/material";
|
|
|
5
5
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
6
6
|
import useExcel from "../use-excel";
|
|
7
7
|
import Button from "../button";
|
|
8
|
+
import regularExpresions from "../regular-expresions";
|
|
8
9
|
|
|
9
10
|
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
10
11
|
|
|
@@ -37,6 +38,8 @@ interface TableProps {
|
|
|
37
38
|
footer?: FooterType;
|
|
38
39
|
symbols?: any;
|
|
39
40
|
currentCoin?: string;
|
|
41
|
+
className?: string;
|
|
42
|
+
fontSize?: string;
|
|
40
43
|
[key: string]: any;
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -282,18 +285,27 @@ function useColumns(
|
|
|
282
285
|
.join("/");
|
|
283
286
|
}
|
|
284
287
|
|
|
288
|
+
const splited = `${value}`.split(".");
|
|
289
|
+
const hasDecimals =
|
|
290
|
+
splited.length == 2 &&
|
|
291
|
+
splited.every((v: any) => `${v}`.match(regularExpresions.number));
|
|
292
|
+
|
|
293
|
+
if (hasDecimals) {
|
|
294
|
+
return [
|
|
295
|
+
currentCoin,
|
|
296
|
+
(+`${value}`).toLocaleString("en-US", {
|
|
297
|
+
minimumFractionDigits: 2,
|
|
298
|
+
maximumFractionDigits: 2,
|
|
299
|
+
}),
|
|
300
|
+
].join(" ");
|
|
301
|
+
}
|
|
302
|
+
|
|
285
303
|
const isNumber = typeof value === "number";
|
|
286
304
|
|
|
287
305
|
if (isNumber) {
|
|
288
306
|
if (isNaN(value)) return value;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
" " +
|
|
292
|
-
value.toLocaleString("en-US", {
|
|
293
|
-
minimumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
294
|
-
maximumFractionDigits: value % 1 !== 0 ? 2 : 0,
|
|
295
|
-
})
|
|
296
|
-
);
|
|
307
|
+
|
|
308
|
+
return value;
|
|
297
309
|
}
|
|
298
310
|
|
|
299
311
|
return value;
|
|
@@ -359,6 +371,8 @@ function IHTable({
|
|
|
359
371
|
hideColumns = [],
|
|
360
372
|
footer = {},
|
|
361
373
|
currentCoin = "$",
|
|
374
|
+
fontSize = "1rem",
|
|
375
|
+
className,
|
|
362
376
|
}: TableProps) {
|
|
363
377
|
if (modal && onSelect)
|
|
364
378
|
throw new Error("Solo se puede usar modal o onSelect por separado");
|
|
@@ -448,12 +462,20 @@ function IHTable({
|
|
|
448
462
|
)}
|
|
449
463
|
|
|
450
464
|
<DataGrid
|
|
465
|
+
className={className}
|
|
451
466
|
rows={rows}
|
|
452
467
|
columns={columns as any}
|
|
453
468
|
checkboxSelection={Boolean(onSelect)}
|
|
454
469
|
rowSelectionModel={selectedRows}
|
|
455
470
|
onRowSelectionModelChange={!modal ? setSelectedRows : undefined}
|
|
456
471
|
sx={{
|
|
472
|
+
fontSize, // equivalente a text-xs
|
|
473
|
+
"& .MuiDataGrid-cell": {
|
|
474
|
+
fontSize,
|
|
475
|
+
},
|
|
476
|
+
"& .MuiDataGrid-columnHeader": {
|
|
477
|
+
fontSize,
|
|
478
|
+
},
|
|
457
479
|
"& .MuiDataGrid-cell--editable": {
|
|
458
480
|
backgroundColor: "#c6d8f0",
|
|
459
481
|
fontWeight: 500,
|