next-recomponents 2.0.49 → 2.0.50
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 +46 -28
- package/dist/index.mjs +46 -28
- package/package.json +1 -1
- package/src/table-advanced/h.table.tsx +92 -65
package/dist/index.js
CHANGED
|
@@ -39435,7 +39435,7 @@ function HTable({
|
|
|
39435
39435
|
);
|
|
39436
39436
|
});
|
|
39437
39437
|
}),
|
|
39438
|
-
Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.map((header) => {
|
|
39438
|
+
Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.filter((h) => !h.startsWith("_") && !h.startsWith("__")).map((header) => {
|
|
39439
39439
|
var _a;
|
|
39440
39440
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
39441
39441
|
"div",
|
|
@@ -39470,33 +39470,15 @@ function HTable({
|
|
|
39470
39470
|
}
|
|
39471
39471
|
return true;
|
|
39472
39472
|
},
|
|
39473
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
|
|
39477
|
-
|
|
39478
|
-
|
|
39479
|
-
|
|
39480
|
-
|
|
39481
|
-
|
|
39482
|
-
children: "Anterior"
|
|
39483
|
-
}
|
|
39484
|
-
),
|
|
39485
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
39486
|
-
"button",
|
|
39487
|
-
{
|
|
39488
|
-
className: "p-2 border shadow rounded " + (currentIndex < searchedData.length - 1 ? "bg-white " : "bg-gray-100"),
|
|
39489
|
-
onClick: (e) => {
|
|
39490
|
-
currentIndex < searchedData.length - 1 && setCurrentIndex(currentIndex + 1);
|
|
39491
|
-
},
|
|
39492
|
-
children: "Siguiente"
|
|
39493
|
-
}
|
|
39494
|
-
)
|
|
39495
|
-
] }),
|
|
39496
|
-
import_react19.default.cloneElement(context.modal, {
|
|
39497
|
-
row: searchedData[currentIndex]
|
|
39498
|
-
})
|
|
39499
|
-
] })
|
|
39473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
39474
|
+
ModalContent,
|
|
39475
|
+
{
|
|
39476
|
+
context,
|
|
39477
|
+
currentIndex,
|
|
39478
|
+
setCurrentIndex,
|
|
39479
|
+
searchedData
|
|
39480
|
+
}
|
|
39481
|
+
)
|
|
39500
39482
|
}
|
|
39501
39483
|
),
|
|
39502
39484
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -39511,6 +39493,42 @@ function HTable({
|
|
|
39511
39493
|
}
|
|
39512
39494
|
);
|
|
39513
39495
|
}
|
|
39496
|
+
function ModalContent({
|
|
39497
|
+
currentIndex,
|
|
39498
|
+
setCurrentIndex,
|
|
39499
|
+
searchedData,
|
|
39500
|
+
context,
|
|
39501
|
+
hide
|
|
39502
|
+
}) {
|
|
39503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
|
|
39504
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "fixed top-0 left-0 p-10 ", children: [
|
|
39505
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
39506
|
+
"button",
|
|
39507
|
+
{
|
|
39508
|
+
className: "p-2 border shadow rounded " + (currentIndex > 0 ? "bg-white " : "bg-gray-100"),
|
|
39509
|
+
onClick: (e) => {
|
|
39510
|
+
currentIndex > 0 && setCurrentIndex(currentIndex - 1);
|
|
39511
|
+
},
|
|
39512
|
+
children: "Anterior"
|
|
39513
|
+
}
|
|
39514
|
+
),
|
|
39515
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
39516
|
+
"button",
|
|
39517
|
+
{
|
|
39518
|
+
className: "p-2 border shadow rounded " + (currentIndex < searchedData.length - 1 ? "bg-white " : "bg-gray-100"),
|
|
39519
|
+
onClick: (e) => {
|
|
39520
|
+
currentIndex < searchedData.length - 1 && setCurrentIndex(currentIndex + 1);
|
|
39521
|
+
},
|
|
39522
|
+
children: "Siguiente"
|
|
39523
|
+
}
|
|
39524
|
+
)
|
|
39525
|
+
] }),
|
|
39526
|
+
import_react19.default.cloneElement(context.modal, {
|
|
39527
|
+
row: searchedData[currentIndex],
|
|
39528
|
+
hide
|
|
39529
|
+
})
|
|
39530
|
+
] });
|
|
39531
|
+
}
|
|
39514
39532
|
|
|
39515
39533
|
// src/table-advanced/context.ts
|
|
39516
39534
|
var import_react20 = require("react");
|
package/dist/index.mjs
CHANGED
|
@@ -39433,7 +39433,7 @@ function HTable({
|
|
|
39433
39433
|
);
|
|
39434
39434
|
});
|
|
39435
39435
|
}),
|
|
39436
|
-
Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.map((header) => {
|
|
39436
|
+
Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.filter((h) => !h.startsWith("_") && !h.startsWith("__")).map((header) => {
|
|
39437
39437
|
var _a;
|
|
39438
39438
|
return /* @__PURE__ */ jsx33(
|
|
39439
39439
|
"div",
|
|
@@ -39468,33 +39468,15 @@ function HTable({
|
|
|
39468
39468
|
}
|
|
39469
39469
|
return true;
|
|
39470
39470
|
},
|
|
39471
|
-
children: /* @__PURE__ */
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
|
|
39477
|
-
|
|
39478
|
-
|
|
39479
|
-
|
|
39480
|
-
children: "Anterior"
|
|
39481
|
-
}
|
|
39482
|
-
),
|
|
39483
|
-
/* @__PURE__ */ jsx33(
|
|
39484
|
-
"button",
|
|
39485
|
-
{
|
|
39486
|
-
className: "p-2 border shadow rounded " + (currentIndex < searchedData.length - 1 ? "bg-white " : "bg-gray-100"),
|
|
39487
|
-
onClick: (e) => {
|
|
39488
|
-
currentIndex < searchedData.length - 1 && setCurrentIndex(currentIndex + 1);
|
|
39489
|
-
},
|
|
39490
|
-
children: "Siguiente"
|
|
39491
|
-
}
|
|
39492
|
-
)
|
|
39493
|
-
] }),
|
|
39494
|
-
React10.cloneElement(context.modal, {
|
|
39495
|
-
row: searchedData[currentIndex]
|
|
39496
|
-
})
|
|
39497
|
-
] })
|
|
39471
|
+
children: /* @__PURE__ */ jsx33(
|
|
39472
|
+
ModalContent,
|
|
39473
|
+
{
|
|
39474
|
+
context,
|
|
39475
|
+
currentIndex,
|
|
39476
|
+
setCurrentIndex,
|
|
39477
|
+
searchedData
|
|
39478
|
+
}
|
|
39479
|
+
)
|
|
39498
39480
|
}
|
|
39499
39481
|
),
|
|
39500
39482
|
isLoading && /* @__PURE__ */ jsx33(
|
|
@@ -39509,6 +39491,42 @@ function HTable({
|
|
|
39509
39491
|
}
|
|
39510
39492
|
);
|
|
39511
39493
|
}
|
|
39494
|
+
function ModalContent({
|
|
39495
|
+
currentIndex,
|
|
39496
|
+
setCurrentIndex,
|
|
39497
|
+
searchedData,
|
|
39498
|
+
context,
|
|
39499
|
+
hide
|
|
39500
|
+
}) {
|
|
39501
|
+
return /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
|
|
39502
|
+
/* @__PURE__ */ jsxs25("div", { className: "fixed top-0 left-0 p-10 ", children: [
|
|
39503
|
+
/* @__PURE__ */ jsx33(
|
|
39504
|
+
"button",
|
|
39505
|
+
{
|
|
39506
|
+
className: "p-2 border shadow rounded " + (currentIndex > 0 ? "bg-white " : "bg-gray-100"),
|
|
39507
|
+
onClick: (e) => {
|
|
39508
|
+
currentIndex > 0 && setCurrentIndex(currentIndex - 1);
|
|
39509
|
+
},
|
|
39510
|
+
children: "Anterior"
|
|
39511
|
+
}
|
|
39512
|
+
),
|
|
39513
|
+
/* @__PURE__ */ jsx33(
|
|
39514
|
+
"button",
|
|
39515
|
+
{
|
|
39516
|
+
className: "p-2 border shadow rounded " + (currentIndex < searchedData.length - 1 ? "bg-white " : "bg-gray-100"),
|
|
39517
|
+
onClick: (e) => {
|
|
39518
|
+
currentIndex < searchedData.length - 1 && setCurrentIndex(currentIndex + 1);
|
|
39519
|
+
},
|
|
39520
|
+
children: "Siguiente"
|
|
39521
|
+
}
|
|
39522
|
+
)
|
|
39523
|
+
] }),
|
|
39524
|
+
React10.cloneElement(context.modal, {
|
|
39525
|
+
row: searchedData[currentIndex],
|
|
39526
|
+
hide
|
|
39527
|
+
})
|
|
39528
|
+
] });
|
|
39529
|
+
}
|
|
39512
39530
|
|
|
39513
39531
|
// src/table-advanced/context.ts
|
|
39514
39532
|
import { useEffect as useEffect12, useMemo as useMemo9, useReducer as useReducer3, useState as useState16 } from "react";
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, {
|
|
2
|
+
Dispatch,
|
|
2
3
|
ReactNode,
|
|
3
4
|
useCallback,
|
|
4
5
|
useEffect,
|
|
@@ -462,43 +463,45 @@ export default function HTable({
|
|
|
462
463
|
});
|
|
463
464
|
})}
|
|
464
465
|
{Object.keys(context?.footer || {}).length > 0 &&
|
|
465
|
-
headers
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
.reduce((acc, h) => h + acc, 0)
|
|
485
|
-
: context.footer[header] == "count"
|
|
466
|
+
headers
|
|
467
|
+
.filter((h) => !h.startsWith("_") && !h.startsWith("__"))
|
|
468
|
+
.map((header) => {
|
|
469
|
+
return (
|
|
470
|
+
<div
|
|
471
|
+
key={header}
|
|
472
|
+
style={{
|
|
473
|
+
height: `${padding}px`,
|
|
474
|
+
maxHeight: "100px",
|
|
475
|
+
}}
|
|
476
|
+
className={
|
|
477
|
+
"border-b font-bold " +
|
|
478
|
+
" bg-white flex items-center justify-center"
|
|
479
|
+
}
|
|
480
|
+
>
|
|
481
|
+
{valueFormatter({
|
|
482
|
+
currentCoin: context.currentCoin,
|
|
483
|
+
value: context.footer?.[header]
|
|
484
|
+
? context.footer[header] == "sum"
|
|
486
485
|
? context.filteredData
|
|
487
|
-
.map((d) =>
|
|
488
|
-
.reduce((acc
|
|
489
|
-
: context.footer[header] == "
|
|
486
|
+
.map((d) => +d[header])
|
|
487
|
+
.reduce((acc, h) => h + acc, 0)
|
|
488
|
+
: context.footer[header] == "count"
|
|
490
489
|
? context.filteredData
|
|
491
|
-
.map((d) => +d[header])
|
|
492
|
-
.reduce((acc, h) => h + acc, 0) /
|
|
493
|
-
context.filteredData
|
|
494
490
|
.map((d) => (d[header] != "" ? 1 : 0))
|
|
495
491
|
.reduce((acc: number, h) => acc + h, 0)
|
|
496
|
-
: ""
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
492
|
+
: context.footer[header] == "avg"
|
|
493
|
+
? context.filteredData
|
|
494
|
+
.map((d) => +d[header])
|
|
495
|
+
.reduce((acc, h) => h + acc, 0) /
|
|
496
|
+
context.filteredData
|
|
497
|
+
.map((d) => (d[header] != "" ? 1 : 0))
|
|
498
|
+
.reduce((acc: number, h) => acc + h, 0)
|
|
499
|
+
: ""
|
|
500
|
+
: "",
|
|
501
|
+
})}
|
|
502
|
+
</div>
|
|
503
|
+
);
|
|
504
|
+
})}
|
|
502
505
|
</div>
|
|
503
506
|
|
|
504
507
|
{context.modal && (
|
|
@@ -517,38 +520,12 @@ export default function HTable({
|
|
|
517
520
|
return true;
|
|
518
521
|
}}
|
|
519
522
|
>
|
|
520
|
-
<
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
onClick={(e) => {
|
|
528
|
-
currentIndex > 0 && setCurrentIndex(currentIndex - 1);
|
|
529
|
-
}}
|
|
530
|
-
>
|
|
531
|
-
Anterior
|
|
532
|
-
</button>
|
|
533
|
-
<button
|
|
534
|
-
className={
|
|
535
|
-
"p-2 border shadow rounded " +
|
|
536
|
-
(currentIndex < searchedData.length - 1
|
|
537
|
-
? "bg-white "
|
|
538
|
-
: "bg-gray-100")
|
|
539
|
-
}
|
|
540
|
-
onClick={(e) => {
|
|
541
|
-
currentIndex < searchedData.length - 1 &&
|
|
542
|
-
setCurrentIndex(currentIndex + 1);
|
|
543
|
-
}}
|
|
544
|
-
>
|
|
545
|
-
Siguiente
|
|
546
|
-
</button>
|
|
547
|
-
</div>
|
|
548
|
-
{React.cloneElement(context.modal, {
|
|
549
|
-
row: searchedData[currentIndex],
|
|
550
|
-
})}
|
|
551
|
-
</div>
|
|
523
|
+
<ModalContent
|
|
524
|
+
context={context}
|
|
525
|
+
currentIndex={currentIndex}
|
|
526
|
+
setCurrentIndex={setCurrentIndex}
|
|
527
|
+
searchedData={searchedData}
|
|
528
|
+
/>
|
|
552
529
|
</Modal>
|
|
553
530
|
)}
|
|
554
531
|
{isLoading && (
|
|
@@ -562,3 +539,53 @@ export default function HTable({
|
|
|
562
539
|
</div>
|
|
563
540
|
);
|
|
564
541
|
}
|
|
542
|
+
|
|
543
|
+
function ModalContent({
|
|
544
|
+
currentIndex,
|
|
545
|
+
setCurrentIndex,
|
|
546
|
+
searchedData,
|
|
547
|
+
context,
|
|
548
|
+
hide,
|
|
549
|
+
}: {
|
|
550
|
+
hide?: () => void;
|
|
551
|
+
currentIndex: number;
|
|
552
|
+
setCurrentIndex: Dispatch<number>;
|
|
553
|
+
searchedData: any;
|
|
554
|
+
context: any;
|
|
555
|
+
}) {
|
|
556
|
+
return (
|
|
557
|
+
<div className="relative">
|
|
558
|
+
<div className="fixed top-0 left-0 p-10 ">
|
|
559
|
+
<button
|
|
560
|
+
className={
|
|
561
|
+
"p-2 border shadow rounded " +
|
|
562
|
+
(currentIndex > 0 ? "bg-white " : "bg-gray-100")
|
|
563
|
+
}
|
|
564
|
+
onClick={(e) => {
|
|
565
|
+
currentIndex > 0 && setCurrentIndex(currentIndex - 1);
|
|
566
|
+
}}
|
|
567
|
+
>
|
|
568
|
+
Anterior
|
|
569
|
+
</button>
|
|
570
|
+
<button
|
|
571
|
+
className={
|
|
572
|
+
"p-2 border shadow rounded " +
|
|
573
|
+
(currentIndex < searchedData.length - 1
|
|
574
|
+
? "bg-white "
|
|
575
|
+
: "bg-gray-100")
|
|
576
|
+
}
|
|
577
|
+
onClick={(e) => {
|
|
578
|
+
currentIndex < searchedData.length - 1 &&
|
|
579
|
+
setCurrentIndex(currentIndex + 1);
|
|
580
|
+
}}
|
|
581
|
+
>
|
|
582
|
+
Siguiente
|
|
583
|
+
</button>
|
|
584
|
+
</div>
|
|
585
|
+
{React.cloneElement(context.modal, {
|
|
586
|
+
row: searchedData[currentIndex],
|
|
587
|
+
hide,
|
|
588
|
+
})}
|
|
589
|
+
</div>
|
|
590
|
+
);
|
|
591
|
+
}
|