@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.cjs CHANGED
@@ -1082,6 +1082,13 @@ var generateRandomColNum = (total) => {
1082
1082
  }
1083
1083
  return colNumArr;
1084
1084
  };
1085
+ var sumColNumByIdx = (colNums, idx) => {
1086
+ let sum = 0;
1087
+ for (let i = 0; i < idx; i++) {
1088
+ sum += colNums[i];
1089
+ }
1090
+ return sum;
1091
+ };
1085
1092
  var RandomRowsLayout = import_react20.default.memo(
1086
1093
  (props) => {
1087
1094
  const {
@@ -1091,10 +1098,6 @@ var RandomRowsLayout = import_react20.default.memo(
1091
1098
  cellWrapperClsGenerator = defaultCellClsGenerator
1092
1099
  } = props;
1093
1100
  const colNums = generateRandomColNum(cellsCount);
1094
- const indexRef = import_react20.default.useRef(0);
1095
- import_react20.default.useEffect(() => {
1096
- indexRef.current = 0;
1097
- }, []);
1098
1101
  return /* @__PURE__ */ import_react20.default.createElement("div", {
1099
1102
  className: classNames8
1100
1103
  }, colNums.map((colNum, row) => {
@@ -1106,11 +1109,12 @@ var RandomRowsLayout = import_react20.default.memo(
1106
1109
  className: "flex items-center flex-wrap",
1107
1110
  key: row
1108
1111
  }, new Array(colNum).fill(null).map((_, col) => {
1109
- indexRef.current += 1;
1110
1112
  const generatedCls = cellWrapperClsGenerator(
1111
1113
  colNum,
1112
1114
  generateRandomBoolean()
1113
1115
  );
1116
+ const currentIdx = sumColNumByIdx(colNums, row) + col;
1117
+ console.log("\u5F53\u524D\u4E0B\u6807" + currentIdx);
1114
1118
  const cls5 = (0, import_classnames11.default)(
1115
1119
  "flex items-center justify-center flex-shrink-0 flex-grow-0",
1116
1120
  "basis-full",
@@ -1119,7 +1123,7 @@ var RandomRowsLayout = import_react20.default.memo(
1119
1123
  return /* @__PURE__ */ import_react20.default.createElement("div", {
1120
1124
  className: cls5,
1121
1125
  key: col
1122
- }, cellRenderer(indexRef.current - 1, randBoolArr[col], col));
1126
+ }, cellRenderer(currentIdx, randBoolArr[col], col));
1123
1127
  }));
1124
1128
  }));
1125
1129
  },