@megha-ui/react 1.2.685 → 1.2.687

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.
@@ -47,8 +47,10 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
47
47
  const [isOpen, setIsOpen] = useState(false);
48
48
  const [filterColumns, setFilterColumn] = useState([]);
49
49
  const modalContent = useRef(null);
50
- const [startIndex, setStartIndex] = useState(0);
50
+ const [startIndex, _setStartIndex] = useState(0);
51
51
  const [endIndex, setEndIndex] = useState(defaultRowsPerPage);
52
+ const [startHoriIndex, _setStartHoriIndex] = useState(0);
53
+ const [endHoriIndex, setEndHoriIndex] = useState(0);
52
54
  const [gridGroupBy, setGridGroupBy] = useState("");
53
55
  const [rowIndex, setRowIndex] = useState(-1);
54
56
  const [columnIndex, setColumnIndex] = useState(-1);
@@ -88,6 +90,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
88
90
  return gridColumns.filter((col) => col.fixedFilter && col.fixedFilter !== "");
89
91
  }, [gridColumns]);
90
92
  const [fixedFilterValues, setFixedFilterValues] = useState({});
93
+ const [columnsPerView, setColumnsPerView] = useState(5);
91
94
  useEffect(() => {
92
95
  setSummariseAvailable(isSummarise);
93
96
  }, [isSummarise]);
@@ -123,7 +126,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
123
126
  acc[item.key] = type;
124
127
  return acc;
125
128
  }, {});
126
- _columns = _columns.map((col) => {
129
+ _columns = _columns.filter((_, index) => index >= startHoriIndex && index < endHoriIndex).map((col) => {
127
130
  var _a, _b;
128
131
  let isArrayString = false;
129
132
  if (typeof col.isArrayString !== "undefined") {
@@ -144,7 +147,7 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
144
147
  });
145
148
  }
146
149
  setGridColumns(_columns);
147
- }, [columns, data, isMultipleChips]);
150
+ }, [columns, data, isMultipleChips, endHoriIndex, startHoriIndex]);
148
151
  useEffect(() => {
149
152
  if (globalSearchOpen) {
150
153
  setExpandedGI(true);
@@ -700,6 +703,10 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
700
703
  }
701
704
  return typeof column.width === "string" && column.width === "";
702
705
  });
706
+ const gridWidth = entrieGridRef.current
707
+ ? entrieGridRef.current.getBoundingClientRect().width
708
+ : 0;
709
+ console.log("Grid Width:", gridWidth);
703
710
  if (gridGroupBy === "" &&
704
711
  entrieGridRef.current &&
705
712
  widthMode === "custom" &&
@@ -819,6 +826,16 @@ withCard = false, cardClassName, cardHeader, title, headerLeft, headerRight, sub
819
826
  const isPaginate = gridGroupBy === "" && paginate;
820
827
  if (headerRef.current) {
821
828
  headerRef.current.scrollLeft = e.currentTarget.scrollLeft;
829
+ let atmostIndex = -1;
830
+ if (gridColumns.length > 0) {
831
+ atmostIndex = gridColumns.length - 1;
832
+ }
833
+ if (atmostIndex >= endHoriIndex + columnsPerView) {
834
+ setEndHoriIndex((prev) => prev + columnsPerView);
835
+ }
836
+ else {
837
+ setEndHoriIndex(atmostIndex);
838
+ }
822
839
  }
823
840
  if (e.currentTarget &&
824
841
  isScrollAlmostAtEnd(e.currentTarget) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megha-ui/react",
3
- "version": "1.2.685",
3
+ "version": "1.2.687",
4
4
  "description": "A collection of reusable UI components for React applications, built with TypeScript.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",