@bbki.ng/components 2.4.5 → 2.4.7

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
@@ -1010,6 +1010,13 @@ var generateRandomColNum = (total) => {
1010
1010
  }
1011
1011
  return colNumArr;
1012
1012
  };
1013
+ var sumColNumByIdx = (colNums, idx) => {
1014
+ let sum = 0;
1015
+ for (let i = 0; i < idx; i++) {
1016
+ sum += colNums[i];
1017
+ }
1018
+ return sum;
1019
+ };
1013
1020
  var RandomRowsLayout = React19.memo(
1014
1021
  (props) => {
1015
1022
  const {
@@ -1019,10 +1026,6 @@ var RandomRowsLayout = React19.memo(
1019
1026
  cellWrapperClsGenerator = defaultCellClsGenerator
1020
1027
  } = props;
1021
1028
  const colNums = generateRandomColNum(cellsCount);
1022
- const indexRef = React19.useRef(0);
1023
- React19.useEffect(() => {
1024
- indexRef.current = 0;
1025
- }, []);
1026
1029
  return /* @__PURE__ */ React19.createElement("div", {
1027
1030
  className: classNames8
1028
1031
  }, colNums.map((colNum, row) => {
@@ -1034,11 +1037,12 @@ var RandomRowsLayout = React19.memo(
1034
1037
  className: "flex items-center flex-wrap",
1035
1038
  key: row
1036
1039
  }, new Array(colNum).fill(null).map((_, col) => {
1037
- indexRef.current += 1;
1038
1040
  const generatedCls = cellWrapperClsGenerator(
1039
1041
  colNum,
1040
1042
  generateRandomBoolean()
1041
1043
  );
1044
+ const currentIdx = sumColNumByIdx(colNums, row) + col;
1045
+ console.log("\u5F53\u524D\u4E0B\u6807" + currentIdx);
1042
1046
  const cls5 = classnames2(
1043
1047
  "flex items-center justify-center flex-shrink-0 flex-grow-0",
1044
1048
  "basis-full",
@@ -1047,7 +1051,7 @@ var RandomRowsLayout = React19.memo(
1047
1051
  return /* @__PURE__ */ React19.createElement("div", {
1048
1052
  className: cls5,
1049
1053
  key: col
1050
- }, cellRenderer(indexRef.current - 1, randBoolArr[col], col));
1054
+ }, cellRenderer(currentIdx, randBoolArr[col], col));
1051
1055
  }));
1052
1056
  }));
1053
1057
  },