next-recomponents 2.0.49 → 2.0.51

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
@@ -39436,7 +39436,9 @@ function HTable({
39436
39436
  });
39437
39437
  }),
39438
39438
  Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.map((header) => {
39439
- var _a;
39439
+ var _a, _b, _c;
39440
+ if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, header)) return null;
39441
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
39440
39442
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39441
39443
  "div",
39442
39444
  {
@@ -39447,7 +39449,7 @@ function HTable({
39447
39449
  className: "border-b font-bold bg-white flex items-center justify-center",
39448
39450
  children: valueFormatter({
39449
39451
  currentCoin: context.currentCoin,
39450
- value: ((_a = context.footer) == null ? void 0 : _a[header]) ? context.footer[header] == "sum" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) : context.footer[header] == "count" ? context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : context.footer[header] == "avg" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) / context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : "" : ""
39452
+ value: ((_c = context.footer) == null ? void 0 : _c[header]) ? context.footer[header] == "sum" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) : context.footer[header] == "count" ? context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : context.footer[header] == "avg" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) / context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : "" : ""
39451
39453
  })
39452
39454
  },
39453
39455
  header
@@ -39470,33 +39472,15 @@ function HTable({
39470
39472
  }
39471
39473
  return true;
39472
39474
  },
39473
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
39474
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "fixed top-0 left-0 p-10 ", children: [
39475
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39476
- "button",
39477
- {
39478
- className: "p-2 border shadow rounded " + (currentIndex > 0 ? "bg-white " : "bg-gray-100"),
39479
- onClick: (e) => {
39480
- currentIndex > 0 && setCurrentIndex(currentIndex - 1);
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
- ] })
39475
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39476
+ ModalContent,
39477
+ {
39478
+ context,
39479
+ currentIndex,
39480
+ setCurrentIndex,
39481
+ searchedData
39482
+ }
39483
+ )
39500
39484
  }
39501
39485
  ),
39502
39486
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
@@ -39511,6 +39495,42 @@ function HTable({
39511
39495
  }
39512
39496
  );
39513
39497
  }
39498
+ function ModalContent({
39499
+ currentIndex,
39500
+ setCurrentIndex,
39501
+ searchedData,
39502
+ context,
39503
+ hide
39504
+ }) {
39505
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "relative", children: [
39506
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "fixed top-0 left-0 p-10 ", children: [
39507
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39508
+ "button",
39509
+ {
39510
+ className: "p-2 border shadow rounded " + (currentIndex > 0 ? "bg-white " : "bg-gray-100"),
39511
+ onClick: (e) => {
39512
+ currentIndex > 0 && setCurrentIndex(currentIndex - 1);
39513
+ },
39514
+ children: "Anterior"
39515
+ }
39516
+ ),
39517
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39518
+ "button",
39519
+ {
39520
+ className: "p-2 border shadow rounded " + (currentIndex < searchedData.length - 1 ? "bg-white " : "bg-gray-100"),
39521
+ onClick: (e) => {
39522
+ currentIndex < searchedData.length - 1 && setCurrentIndex(currentIndex + 1);
39523
+ },
39524
+ children: "Siguiente"
39525
+ }
39526
+ )
39527
+ ] }),
39528
+ import_react19.default.cloneElement(context.modal, {
39529
+ row: searchedData[currentIndex],
39530
+ hide
39531
+ })
39532
+ ] });
39533
+ }
39514
39534
 
39515
39535
  // src/table-advanced/context.ts
39516
39536
  var import_react20 = require("react");
package/dist/index.mjs CHANGED
@@ -39434,7 +39434,9 @@ function HTable({
39434
39434
  });
39435
39435
  }),
39436
39436
  Object.keys((context == null ? void 0 : context.footer) || {}).length > 0 && headers.map((header) => {
39437
- var _a;
39437
+ var _a, _b, _c;
39438
+ if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, header)) return null;
39439
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
39438
39440
  return /* @__PURE__ */ jsx33(
39439
39441
  "div",
39440
39442
  {
@@ -39445,7 +39447,7 @@ function HTable({
39445
39447
  className: "border-b font-bold bg-white flex items-center justify-center",
39446
39448
  children: valueFormatter({
39447
39449
  currentCoin: context.currentCoin,
39448
- value: ((_a = context.footer) == null ? void 0 : _a[header]) ? context.footer[header] == "sum" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) : context.footer[header] == "count" ? context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : context.footer[header] == "avg" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) / context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : "" : ""
39450
+ value: ((_c = context.footer) == null ? void 0 : _c[header]) ? context.footer[header] == "sum" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) : context.footer[header] == "count" ? context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : context.footer[header] == "avg" ? context.filteredData.map((d) => +d[header]).reduce((acc, h) => h + acc, 0) / context.filteredData.map((d) => d[header] != "" ? 1 : 0).reduce((acc, h) => acc + h, 0) : "" : ""
39449
39451
  })
39450
39452
  },
39451
39453
  header
@@ -39468,33 +39470,15 @@ function HTable({
39468
39470
  }
39469
39471
  return true;
39470
39472
  },
39471
- children: /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
39472
- /* @__PURE__ */ jsxs25("div", { className: "fixed top-0 left-0 p-10 ", children: [
39473
- /* @__PURE__ */ jsx33(
39474
- "button",
39475
- {
39476
- className: "p-2 border shadow rounded " + (currentIndex > 0 ? "bg-white " : "bg-gray-100"),
39477
- onClick: (e) => {
39478
- currentIndex > 0 && setCurrentIndex(currentIndex - 1);
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
- ] })
39473
+ children: /* @__PURE__ */ jsx33(
39474
+ ModalContent,
39475
+ {
39476
+ context,
39477
+ currentIndex,
39478
+ setCurrentIndex,
39479
+ searchedData
39480
+ }
39481
+ )
39498
39482
  }
39499
39483
  ),
39500
39484
  isLoading && /* @__PURE__ */ jsx33(
@@ -39509,6 +39493,42 @@ function HTable({
39509
39493
  }
39510
39494
  );
39511
39495
  }
39496
+ function ModalContent({
39497
+ currentIndex,
39498
+ setCurrentIndex,
39499
+ searchedData,
39500
+ context,
39501
+ hide
39502
+ }) {
39503
+ return /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
39504
+ /* @__PURE__ */ jsxs25("div", { className: "fixed top-0 left-0 p-10 ", children: [
39505
+ /* @__PURE__ */ jsx33(
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__ */ jsx33(
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
+ React10.cloneElement(context.modal, {
39527
+ row: searchedData[currentIndex],
39528
+ hide
39529
+ })
39530
+ ] });
39531
+ }
39512
39532
 
39513
39533
  // src/table-advanced/context.ts
39514
39534
  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.49",
3
+ "version": "2.0.51",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import React, {
2
+ Dispatch,
2
3
  ReactNode,
3
4
  useCallback,
4
5
  useEffect,
@@ -463,6 +464,8 @@ export default function HTable({
463
464
  })}
464
465
  {Object.keys(context?.footer || {}).length > 0 &&
465
466
  headers.map((header) => {
467
+ if (context?.hideColumns?.includes?.(header)) return null;
468
+ if (header.startsWith("_") && !header.startsWith("__")) return null;
466
469
  return (
467
470
  <div
468
471
  key={header}
@@ -517,38 +520,12 @@ export default function HTable({
517
520
  return true;
518
521
  }}
519
522
  >
520
- <div className="relative">
521
- <div className="fixed top-0 left-0 p-10 ">
522
- <button
523
- className={
524
- "p-2 border shadow rounded " +
525
- (currentIndex > 0 ? "bg-white " : "bg-gray-100")
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
+ }