@mkt-loitd/react-table-grid-custom 1.2.2 → 1.2.3

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { Dispatch, SetStateAction, Key, ReactNode, JSX } from 'react';
2
+ import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject } from 'react';
3
3
  import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
4
4
  export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
5
5
  import { PaginationRootProps } from '@mantine/core';
@@ -59,10 +59,22 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
59
59
  fetching?: boolean;
60
60
  TableLogo?: string;
61
61
  }
62
+ interface refTablePaginationClient extends Required<IPaginationParams> {
63
+ setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination$1>>;
64
+ resetPagition: (conditional?: boolean) => void;
65
+ }
62
66
 
63
67
  type ReactTableGridCustomComponent = <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K>) => JSX.Element;
64
68
  declare const ReactTableGridCustom: ReactTableGridCustomComponent;
65
69
 
70
+ type ReactTableGridCustomPaginationClientComponent = <T, SR = unknown, K extends Key = Key>(props: ReactTableGridCustomPaginationClientProps<T, SR, K>) => JSX.Element;
71
+ interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K extends Key = Key> extends IReactTableGridCustom<T, SR, K> {
72
+ initPage?: number;
73
+ initPageSize?: number;
74
+ refTable?: MutableRefObject<refTablePaginationClient | undefined>;
75
+ }
76
+ declare const ReactTableGridCustomPaginationClient: ReactTableGridCustomPaginationClientComponent;
77
+
66
78
  interface ContextMenuProps {
67
79
  selector: string;
68
80
  children?: ReactNode;
@@ -216,4 +228,4 @@ interface UseShowHideColumnReturn<T, SR> {
216
228
  handleChangeLocation?: (arr: string[]) => void;
217
229
  }
218
230
 
219
- export { type ICalculatorTotalPage, type IPaginationParams, type IReactTableGridCustom, type ISTTParams, type Maybe, ReactTableGridCustom, type TColumnsTable, TableStyleContextWapper, type TableStyleWapperProps, type UseShowHideColumnParameter, type UseShowHideColumnReturn, useShowHideColumn };
231
+ export { type ICalculatorTotalPage, type IPaginationParams, type IReactTableGridCustom, type ISTTParams, type Maybe, ReactTableGridCustom, ReactTableGridCustomPaginationClient, type ReactTableGridCustomPaginationClientComponent, type ReactTableGridCustomPaginationClientProps, type TColumnsTable, TableStyleContextWapper, type TableStyleWapperProps, type UseShowHideColumnParameter, type UseShowHideColumnReturn, useShowHideColumn };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { Dispatch, SetStateAction, Key, ReactNode, JSX } from 'react';
2
+ import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject } from 'react';
3
3
  import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
4
4
  export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
5
5
  import { PaginationRootProps } from '@mantine/core';
@@ -59,10 +59,22 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
59
59
  fetching?: boolean;
60
60
  TableLogo?: string;
61
61
  }
62
+ interface refTablePaginationClient extends Required<IPaginationParams> {
63
+ setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination$1>>;
64
+ resetPagition: (conditional?: boolean) => void;
65
+ }
62
66
 
63
67
  type ReactTableGridCustomComponent = <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K>) => JSX.Element;
64
68
  declare const ReactTableGridCustom: ReactTableGridCustomComponent;
65
69
 
70
+ type ReactTableGridCustomPaginationClientComponent = <T, SR = unknown, K extends Key = Key>(props: ReactTableGridCustomPaginationClientProps<T, SR, K>) => JSX.Element;
71
+ interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K extends Key = Key> extends IReactTableGridCustom<T, SR, K> {
72
+ initPage?: number;
73
+ initPageSize?: number;
74
+ refTable?: MutableRefObject<refTablePaginationClient | undefined>;
75
+ }
76
+ declare const ReactTableGridCustomPaginationClient: ReactTableGridCustomPaginationClientComponent;
77
+
66
78
  interface ContextMenuProps {
67
79
  selector: string;
68
80
  children?: ReactNode;
@@ -216,4 +228,4 @@ interface UseShowHideColumnReturn<T, SR> {
216
228
  handleChangeLocation?: (arr: string[]) => void;
217
229
  }
218
230
 
219
- export { type ICalculatorTotalPage, type IPaginationParams, type IReactTableGridCustom, type ISTTParams, type Maybe, ReactTableGridCustom, type TColumnsTable, TableStyleContextWapper, type TableStyleWapperProps, type UseShowHideColumnParameter, type UseShowHideColumnReturn, useShowHideColumn };
231
+ export { type ICalculatorTotalPage, type IPaginationParams, type IReactTableGridCustom, type ISTTParams, type Maybe, ReactTableGridCustom, ReactTableGridCustomPaginationClient, type ReactTableGridCustomPaginationClientComponent, type ReactTableGridCustomPaginationClientProps, type TColumnsTable, TableStyleContextWapper, type TableStyleWapperProps, type UseShowHideColumnParameter, type UseShowHideColumnReturn, useShowHideColumn };
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  ReactTableGridCustom: () => ReactTableGridCustom,
34
+ ReactTableGridCustomPaginationClient: () => ReactTableGridCustomPaginationClient,
34
35
  TableStyleContextWapper: () => TableStyleContextWapper,
35
36
  useShowHideColumn: () => useShowHideColumn
36
37
  });
@@ -445,16 +446,99 @@ var ReactTableGridCustom = (0, import_react3.memo)(
445
446
  ReactTableGridCustomInner
446
447
  );
447
448
 
449
+ // src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
450
+ var import_react5 = require("react");
451
+
452
+ // src/hooks/useDataPagingClient.ts
453
+ var import_react4 = require("react");
454
+ var useDataPagingClient = ({ data = [], page, pageSize }) => {
455
+ const newData = (0, import_react4.useMemo)(() => {
456
+ if (page && pageSize) {
457
+ const startIndex = (page - 1) * pageSize;
458
+ return data.slice(startIndex, startIndex + pageSize);
459
+ }
460
+ return data;
461
+ }, [data, page, pageSize]);
462
+ return newData;
463
+ };
464
+ var useDataPagingClient_default = useDataPagingClient;
465
+
466
+ // src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
467
+ var import_jsx_runtime4 = require("react/jsx-runtime");
468
+ var ReactTableGridCustomPaginationClientInner = ({
469
+ data,
470
+ initPage = 1,
471
+ initPageSize = 200,
472
+ refTable,
473
+ ...spread
474
+ }) => {
475
+ const [configSearch, setConfigSearch] = (0, import_react5.useState)({
476
+ page: initPage,
477
+ pageSize: initPageSize
478
+ });
479
+ const newDataAccount = useDataPagingClient_default({
480
+ data,
481
+ page: configSearch == null ? void 0 : configSearch.page,
482
+ pageSize: configSearch == null ? void 0 : configSearch.pageSize
483
+ });
484
+ const resetPage = (0, import_react5.useCallback)(() => {
485
+ setConfigSearch((prev) => ({
486
+ ...prev,
487
+ page: 1
488
+ }));
489
+ }, []);
490
+ (0, import_react5.useImperativeHandle)(
491
+ refTable,
492
+ () => {
493
+ var _a, _b;
494
+ return {
495
+ setConfigSearch,
496
+ page: (_a = configSearch == null ? void 0 : configSearch.page) != null ? _a : initPage,
497
+ pageSize: (_b = configSearch == null ? void 0 : configSearch.pageSize) != null ? _b : initPageSize,
498
+ resetPagition: (conditional = true) => {
499
+ if (conditional && (configSearch == null ? void 0 : configSearch.page) !== 1) {
500
+ resetPage();
501
+ } else {
502
+ resetPage();
503
+ }
504
+ }
505
+ };
506
+ },
507
+ [
508
+ setConfigSearch,
509
+ configSearch == null ? void 0 : configSearch.page,
510
+ configSearch == null ? void 0 : configSearch.pageSize,
511
+ initPage,
512
+ initPageSize,
513
+ resetPage
514
+ ]
515
+ );
516
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
517
+ ReactTableGridCustom,
518
+ {
519
+ data: newDataAccount,
520
+ total: data == null ? void 0 : data.length,
521
+ page: configSearch == null ? void 0 : configSearch.page,
522
+ pageSize: configSearch == null ? void 0 : configSearch.pageSize,
523
+ setConfigPagination: setConfigSearch,
524
+ ...spread
525
+ }
526
+ );
527
+ };
528
+ var ReactTableGridCustomPaginationClient = (0, import_react5.memo)(
529
+ ReactTableGridCustomPaginationClientInner
530
+ );
531
+
448
532
  // src/component/ui/Table/TableStyleContextWapper.tsx
449
- var import_react8 = require("react");
533
+ var import_react10 = require("react");
450
534
 
451
535
  // src/component/ui/ContextMenu/ContextMenu.tsx
452
- var import_react4 = require("react");
536
+ var import_react6 = require("react");
453
537
  var import_react_dom = require("react-dom");
454
- var import_jsx_runtime4 = require("react/jsx-runtime");
538
+ var import_jsx_runtime5 = require("react/jsx-runtime");
455
539
  var ContextMenu = ({ selector, children, zIndex = 40 }) => {
456
- const menuRef = (0, import_react4.useRef)(null);
457
- const closeMenu = (0, import_react4.useCallback)(() => {
540
+ const menuRef = (0, import_react6.useRef)(null);
541
+ const closeMenu = (0, import_react6.useCallback)(() => {
458
542
  const contextMenuElem = menuRef.current;
459
543
  const elementParent = document.querySelector(selector);
460
544
  if (contextMenuElem && contextMenuElem.classList.contains("shadow-menu")) {
@@ -466,7 +550,7 @@ var ContextMenu = ({ selector, children, zIndex = 40 }) => {
466
550
  elementParent.style.removeProperty("overflow");
467
551
  }
468
552
  }, [menuRef.current]);
469
- (0, import_react4.useEffect)(() => {
553
+ (0, import_react6.useEffect)(() => {
470
554
  const elementParent = document.querySelector(selector);
471
555
  if (elementParent) {
472
556
  const clickMenu = (e) => {
@@ -534,7 +618,7 @@ var ContextMenu = ({ selector, children, zIndex = 40 }) => {
534
618
  };
535
619
  }, []);
536
620
  return (0, import_react_dom.createPortal)(
537
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
621
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
538
622
  "div",
539
623
  {
540
624
  className: "fixed z-40 w-fit",
@@ -549,12 +633,12 @@ var ContextMenu = ({ selector, children, zIndex = 40 }) => {
549
633
  var ContextMenu_default = ContextMenu;
550
634
 
551
635
  // src/component/ui/ContextMenu/RenderContextMenu.tsx
552
- var import_react7 = require("react");
636
+ var import_react9 = require("react");
553
637
 
554
638
  // src/component/ui/ContextMenu/ContextMenuItem.tsx
555
639
  var import_react_i18next3 = require("react-i18next");
556
640
  var import_md = require("react-icons/md");
557
- var import_jsx_runtime5 = require("react/jsx-runtime");
641
+ var import_jsx_runtime6 = require("react/jsx-runtime");
558
642
  var ContextMenuItem = ({
559
643
  currentValue,
560
644
  expandValue,
@@ -564,7 +648,7 @@ var ContextMenuItem = ({
564
648
  }) => {
565
649
  const { t } = (0, import_react_i18next3.useTranslation)();
566
650
  const Icon = currentValue.Icon;
567
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
651
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
568
652
  "div",
569
653
  {
570
654
  className: `cursor-pointer p-2 flex items-center space-x-2 relative ${show ? "bg-[#555] text-white" : "hover:bg-[#555] hover:text-white"}`,
@@ -573,9 +657,9 @@ var ContextMenuItem = ({
573
657
  expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
574
658
  },
575
659
  children: [
576
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { size: 20 }),
577
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
578
- isArrow && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_md.MdKeyboardArrowRight, { size: 20 })
660
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 20 }),
661
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
662
+ isArrow && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_md.MdKeyboardArrowRight, { size: 20 })
579
663
  ]
580
664
  }
581
665
  );
@@ -583,14 +667,14 @@ var ContextMenuItem = ({
583
667
  var ContextMenuItem_default = ContextMenuItem;
584
668
 
585
669
  // src/component/ui/ContextMenu/DropdownContextChild.tsx
586
- var import_react5 = __toESM(require("@tippyjs/react"));
587
- var import_react6 = require("react");
588
- var import_jsx_runtime6 = require("react/jsx-runtime");
670
+ var import_react7 = __toESM(require("@tippyjs/react"));
671
+ var import_react8 = require("react");
672
+ var import_jsx_runtime7 = require("react/jsx-runtime");
589
673
  var DropdownContextChild = ({ button, children, ...rest }) => {
590
- const id = (0, import_react6.useId)();
591
- const instanceRef = (0, import_react6.useRef)(null);
592
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
593
- import_react5.default,
674
+ const id = (0, import_react8.useId)();
675
+ const instanceRef = (0, import_react8.useRef)(null);
676
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
677
+ import_react7.default,
594
678
  {
595
679
  theme: "drop-down",
596
680
  className: "!bg-transparent !text-inherit !border-r-0 [&>*]:!p-0",
@@ -601,7 +685,7 @@ var DropdownContextChild = ({ button, children, ...rest }) => {
601
685
  allowHTML: true,
602
686
  content: children,
603
687
  ...rest,
604
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
688
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
605
689
  "div",
606
690
  {
607
691
  id: `div-${id}`,
@@ -618,16 +702,16 @@ var DropdownContextChild = ({ button, children, ...rest }) => {
618
702
  var DropdownContextChild_default = DropdownContextChild;
619
703
 
620
704
  // src/component/ui/ContextMenu/RenderContextMenu.tsx
621
- var import_jsx_runtime7 = require("react/jsx-runtime");
705
+ var import_jsx_runtime8 = require("react/jsx-runtime");
622
706
  var RenderContextMenu = ({
623
707
  renderData,
624
708
  valueClickItem,
625
709
  expandValue = {}
626
710
  }) => {
627
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
628
- const [isShow, setIsShow] = (0, import_react7.useState)(false);
629
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react7.Fragment, { children: [
630
- !(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
711
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
712
+ const [isShow, setIsShow] = (0, import_react9.useState)(false);
713
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react9.Fragment, { children: [
714
+ !(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
631
715
  ContextMenuItem_default,
632
716
  {
633
717
  currentValue: menuAction,
@@ -635,7 +719,7 @@ var RenderContextMenu = ({
635
719
  valueClickItem
636
720
  }
637
721
  ),
638
- (menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
722
+ (menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
639
723
  DropdownContextChild_default,
640
724
  {
641
725
  appendTo: "parent",
@@ -643,7 +727,7 @@ var RenderContextMenu = ({
643
727
  offset: [0, 5],
644
728
  onShow: () => setIsShow(true),
645
729
  onHide: () => setIsShow(false),
646
- button: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
730
+ button: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
647
731
  ContextMenuItem_default,
648
732
  {
649
733
  currentValue: menuAction,
@@ -653,7 +737,7 @@ var RenderContextMenu = ({
653
737
  isArrow: true
654
738
  }
655
739
  ),
656
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
740
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
657
741
  RenderContextMenu,
658
742
  {
659
743
  renderData: menuAction == null ? void 0 : menuAction.children,
@@ -669,26 +753,26 @@ var RenderContextMenu = ({
669
753
  var RenderContextMenu_default = RenderContextMenu;
670
754
 
671
755
  // src/component/ui/Table/TableStyleContextWapper.tsx
672
- var import_jsx_runtime8 = require("react/jsx-runtime");
756
+ var import_jsx_runtime9 = require("react/jsx-runtime");
673
757
  var TableStyleContextMenuWapper = ({
674
758
  children,
675
759
  contextMenuProps,
676
760
  clsTablecustom,
677
761
  renderContext
678
762
  }) => {
679
- const idWapper = (0, import_react8.useId)();
680
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
763
+ const idWapper = (0, import_react10.useId)();
764
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
681
765
  "div",
682
766
  {
683
767
  id: `wapper_menu_context-${idWapper}`,
684
768
  className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
685
769
  children: [
686
- (renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
770
+ (renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
687
771
  ContextMenu_default,
688
772
  {
689
773
  selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
690
774
  ...contextMenuProps,
691
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RenderContextMenu_default, { ...renderContext })
775
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RenderContextMenu_default, { ...renderContext })
692
776
  }
693
777
  ),
694
778
  children
@@ -696,12 +780,13 @@ var TableStyleContextMenuWapper = ({
696
780
  }
697
781
  );
698
782
  };
699
- var TableStyleContextWapper = (0, import_react8.memo)(
783
+ var TableStyleContextWapper = (0, import_react10.memo)(
700
784
  TableStyleContextMenuWapper
701
785
  );
702
786
  // Annotate the CommonJS export names for ESM import in node:
703
787
  0 && (module.exports = {
704
788
  ReactTableGridCustom,
789
+ ReactTableGridCustomPaginationClient,
705
790
  TableStyleContextWapper,
706
791
  useShowHideColumn
707
792
  });
package/dist/index.mjs CHANGED
@@ -417,16 +417,104 @@ var ReactTableGridCustom = memo(
417
417
  ReactTableGridCustomInner
418
418
  );
419
419
 
420
+ // src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
421
+ import {
422
+ memo as memo2,
423
+ useCallback as useCallback3,
424
+ useImperativeHandle,
425
+ useState as useState3
426
+ } from "react";
427
+
428
+ // src/hooks/useDataPagingClient.ts
429
+ import { useMemo as useMemo4 } from "react";
430
+ var useDataPagingClient = ({ data = [], page, pageSize }) => {
431
+ const newData = useMemo4(() => {
432
+ if (page && pageSize) {
433
+ const startIndex = (page - 1) * pageSize;
434
+ return data.slice(startIndex, startIndex + pageSize);
435
+ }
436
+ return data;
437
+ }, [data, page, pageSize]);
438
+ return newData;
439
+ };
440
+ var useDataPagingClient_default = useDataPagingClient;
441
+
442
+ // src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
443
+ import { jsx as jsx4 } from "react/jsx-runtime";
444
+ var ReactTableGridCustomPaginationClientInner = ({
445
+ data,
446
+ initPage = 1,
447
+ initPageSize = 200,
448
+ refTable,
449
+ ...spread
450
+ }) => {
451
+ const [configSearch, setConfigSearch] = useState3({
452
+ page: initPage,
453
+ pageSize: initPageSize
454
+ });
455
+ const newDataAccount = useDataPagingClient_default({
456
+ data,
457
+ page: configSearch == null ? void 0 : configSearch.page,
458
+ pageSize: configSearch == null ? void 0 : configSearch.pageSize
459
+ });
460
+ const resetPage = useCallback3(() => {
461
+ setConfigSearch((prev) => ({
462
+ ...prev,
463
+ page: 1
464
+ }));
465
+ }, []);
466
+ useImperativeHandle(
467
+ refTable,
468
+ () => {
469
+ var _a, _b;
470
+ return {
471
+ setConfigSearch,
472
+ page: (_a = configSearch == null ? void 0 : configSearch.page) != null ? _a : initPage,
473
+ pageSize: (_b = configSearch == null ? void 0 : configSearch.pageSize) != null ? _b : initPageSize,
474
+ resetPagition: (conditional = true) => {
475
+ if (conditional && (configSearch == null ? void 0 : configSearch.page) !== 1) {
476
+ resetPage();
477
+ } else {
478
+ resetPage();
479
+ }
480
+ }
481
+ };
482
+ },
483
+ [
484
+ setConfigSearch,
485
+ configSearch == null ? void 0 : configSearch.page,
486
+ configSearch == null ? void 0 : configSearch.pageSize,
487
+ initPage,
488
+ initPageSize,
489
+ resetPage
490
+ ]
491
+ );
492
+ return /* @__PURE__ */ jsx4(
493
+ ReactTableGridCustom,
494
+ {
495
+ data: newDataAccount,
496
+ total: data == null ? void 0 : data.length,
497
+ page: configSearch == null ? void 0 : configSearch.page,
498
+ pageSize: configSearch == null ? void 0 : configSearch.pageSize,
499
+ setConfigPagination: setConfigSearch,
500
+ ...spread
501
+ }
502
+ );
503
+ };
504
+ var ReactTableGridCustomPaginationClient = memo2(
505
+ ReactTableGridCustomPaginationClientInner
506
+ );
507
+
420
508
  // src/component/ui/Table/TableStyleContextWapper.tsx
421
- import { memo as memo2, useId as useId2 } from "react";
509
+ import { memo as memo3, useId as useId2 } from "react";
422
510
 
423
511
  // src/component/ui/ContextMenu/ContextMenu.tsx
424
- import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2 } from "react";
512
+ import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef2 } from "react";
425
513
  import { createPortal } from "react-dom";
426
- import { jsx as jsx4 } from "react/jsx-runtime";
514
+ import { jsx as jsx5 } from "react/jsx-runtime";
427
515
  var ContextMenu = ({ selector, children, zIndex = 40 }) => {
428
516
  const menuRef = useRef2(null);
429
- const closeMenu = useCallback3(() => {
517
+ const closeMenu = useCallback4(() => {
430
518
  const contextMenuElem = menuRef.current;
431
519
  const elementParent = document.querySelector(selector);
432
520
  if (contextMenuElem && contextMenuElem.classList.contains("shadow-menu")) {
@@ -506,7 +594,7 @@ var ContextMenu = ({ selector, children, zIndex = 40 }) => {
506
594
  };
507
595
  }, []);
508
596
  return createPortal(
509
- /* @__PURE__ */ jsx4(
597
+ /* @__PURE__ */ jsx5(
510
598
  "div",
511
599
  {
512
600
  className: "fixed z-40 w-fit",
@@ -521,12 +609,12 @@ var ContextMenu = ({ selector, children, zIndex = 40 }) => {
521
609
  var ContextMenu_default = ContextMenu;
522
610
 
523
611
  // src/component/ui/ContextMenu/RenderContextMenu.tsx
524
- import { Fragment as Fragment2, useState as useState3 } from "react";
612
+ import { Fragment as Fragment2, useState as useState4 } from "react";
525
613
 
526
614
  // src/component/ui/ContextMenu/ContextMenuItem.tsx
527
615
  import { useTranslation as useTranslation3 } from "react-i18next";
528
616
  import { MdKeyboardArrowRight } from "react-icons/md";
529
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
617
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
530
618
  var ContextMenuItem = ({
531
619
  currentValue,
532
620
  expandValue,
@@ -545,9 +633,9 @@ var ContextMenuItem = ({
545
633
  expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
546
634
  },
547
635
  children: [
548
- /* @__PURE__ */ jsx5(Icon, { size: 20 }),
549
- /* @__PURE__ */ jsx5("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
550
- isArrow && /* @__PURE__ */ jsx5(MdKeyboardArrowRight, { size: 20 })
636
+ /* @__PURE__ */ jsx6(Icon, { size: 20 }),
637
+ /* @__PURE__ */ jsx6("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
638
+ isArrow && /* @__PURE__ */ jsx6(MdKeyboardArrowRight, { size: 20 })
551
639
  ]
552
640
  }
553
641
  );
@@ -557,11 +645,11 @@ var ContextMenuItem_default = ContextMenuItem;
557
645
  // src/component/ui/ContextMenu/DropdownContextChild.tsx
558
646
  import Tippy from "@tippyjs/react";
559
647
  import { useId, useRef as useRef3 } from "react";
560
- import { jsx as jsx6 } from "react/jsx-runtime";
648
+ import { jsx as jsx7 } from "react/jsx-runtime";
561
649
  var DropdownContextChild = ({ button, children, ...rest }) => {
562
650
  const id = useId();
563
651
  const instanceRef = useRef3(null);
564
- return /* @__PURE__ */ jsx6(
652
+ return /* @__PURE__ */ jsx7(
565
653
  Tippy,
566
654
  {
567
655
  theme: "drop-down",
@@ -573,7 +661,7 @@ var DropdownContextChild = ({ button, children, ...rest }) => {
573
661
  allowHTML: true,
574
662
  content: children,
575
663
  ...rest,
576
- children: /* @__PURE__ */ jsx6(
664
+ children: /* @__PURE__ */ jsx7(
577
665
  "div",
578
666
  {
579
667
  id: `div-${id}`,
@@ -590,16 +678,16 @@ var DropdownContextChild = ({ button, children, ...rest }) => {
590
678
  var DropdownContextChild_default = DropdownContextChild;
591
679
 
592
680
  // src/component/ui/ContextMenu/RenderContextMenu.tsx
593
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
681
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
594
682
  var RenderContextMenu = ({
595
683
  renderData,
596
684
  valueClickItem,
597
685
  expandValue = {}
598
686
  }) => {
599
- return /* @__PURE__ */ jsx7("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
600
- const [isShow, setIsShow] = useState3(false);
687
+ return /* @__PURE__ */ jsx8("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => {
688
+ const [isShow, setIsShow] = useState4(false);
601
689
  return /* @__PURE__ */ jsxs4(Fragment2, { children: [
602
- !(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx7(
690
+ !(menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx8(
603
691
  ContextMenuItem_default,
604
692
  {
605
693
  currentValue: menuAction,
@@ -607,7 +695,7 @@ var RenderContextMenu = ({
607
695
  valueClickItem
608
696
  }
609
697
  ),
610
- (menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx7(
698
+ (menuAction == null ? void 0 : menuAction.children) && /* @__PURE__ */ jsx8(
611
699
  DropdownContextChild_default,
612
700
  {
613
701
  appendTo: "parent",
@@ -615,7 +703,7 @@ var RenderContextMenu = ({
615
703
  offset: [0, 5],
616
704
  onShow: () => setIsShow(true),
617
705
  onHide: () => setIsShow(false),
618
- button: /* @__PURE__ */ jsx7(
706
+ button: /* @__PURE__ */ jsx8(
619
707
  ContextMenuItem_default,
620
708
  {
621
709
  currentValue: menuAction,
@@ -625,7 +713,7 @@ var RenderContextMenu = ({
625
713
  isArrow: true
626
714
  }
627
715
  ),
628
- children: /* @__PURE__ */ jsx7("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ jsx7(
716
+ children: /* @__PURE__ */ jsx8("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ jsx8(
629
717
  RenderContextMenu,
630
718
  {
631
719
  renderData: menuAction == null ? void 0 : menuAction.children,
@@ -641,7 +729,7 @@ var RenderContextMenu = ({
641
729
  var RenderContextMenu_default = RenderContextMenu;
642
730
 
643
731
  // src/component/ui/Table/TableStyleContextWapper.tsx
644
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
732
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
645
733
  var TableStyleContextMenuWapper = ({
646
734
  children,
647
735
  contextMenuProps,
@@ -655,12 +743,12 @@ var TableStyleContextMenuWapper = ({
655
743
  id: `wapper_menu_context-${idWapper}`,
656
744
  className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
657
745
  children: [
658
- (renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ jsx8(
746
+ (renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ jsx9(
659
747
  ContextMenu_default,
660
748
  {
661
749
  selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
662
750
  ...contextMenuProps,
663
- children: /* @__PURE__ */ jsx8(RenderContextMenu_default, { ...renderContext })
751
+ children: /* @__PURE__ */ jsx9(RenderContextMenu_default, { ...renderContext })
664
752
  }
665
753
  ),
666
754
  children
@@ -668,11 +756,12 @@ var TableStyleContextMenuWapper = ({
668
756
  }
669
757
  );
670
758
  };
671
- var TableStyleContextWapper = memo2(
759
+ var TableStyleContextWapper = memo3(
672
760
  TableStyleContextMenuWapper
673
761
  );
674
762
  export {
675
763
  ReactTableGridCustom,
764
+ ReactTableGridCustomPaginationClient,
676
765
  TableStyleContextWapper,
677
766
  useShowHideColumn
678
767
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkt-loitd/react-table-grid-custom",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "React Table Grid Custom component",
5
5
  "license": "ISC",
6
6
  "private": false,