next-recomponents 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.js CHANGED
@@ -11238,7 +11238,10 @@ function FilterMenu({
11238
11238
  const [newMapedData, setNewMapedData] = (0, import_react24.useState)([]);
11239
11239
  (0, import_react24.useEffect)(() => {
11240
11240
  setNewMapedData(
11241
- [...new Set(mapedData.map((md) => md[h].content))].filter(
11241
+ [...new Set(mapedData.map((md) => {
11242
+ var _a;
11243
+ return (_a = md[h]) == null ? void 0 : _a.content;
11244
+ }))].filter(
11242
11245
  (item) => {
11243
11246
  return item && `${item}`.toLowerCase().includes(text.toLowerCase());
11244
11247
  }
@@ -11403,7 +11406,8 @@ function HTable(_a) {
11403
11406
  const mapedTotals = (0, import_react25.useMemo)(() => {
11404
11407
  return mapedData.reduce((acc, md) => {
11405
11408
  head.forEach((h) => {
11406
- const value = isNaN(+md[h].content) ? 0 : +md[h].content;
11409
+ var _a2, _b2;
11410
+ const value = isNaN(+((_a2 = md[h]) == null ? void 0 : _a2.content)) ? 0 : +((_b2 = md[h]) == null ? void 0 : _b2.content);
11407
11411
  if (acc[h]) {
11408
11412
  acc[h] += value;
11409
11413
  } else {
@@ -11417,7 +11421,10 @@ function HTable(_a) {
11417
11421
  setFilters(__spreadValues({}, head.reduce((acc, hh) => {
11418
11422
  const newAcc = __spreadValues({}, acc);
11419
11423
  newAcc[hh] = [
11420
- ...new Set(mapedData.map((md) => md[hh].content))
11424
+ ...new Set(mapedData.map((md) => {
11425
+ var _a2;
11426
+ return (_a2 = md[hh]) == null ? void 0 : _a2.content;
11427
+ }))
11421
11428
  ];
11422
11429
  return newAcc;
11423
11430
  }, {})));
@@ -11447,7 +11454,12 @@ function HTable(_a) {
11447
11454
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { children: head.map((h, key) => {
11448
11455
  var _a2;
11449
11456
  const items = [
11450
- ...new Set(mapedData.map((item) => item[h].content))
11457
+ ...new Set(
11458
+ mapedData.map((item) => {
11459
+ var _a3;
11460
+ return (_a3 = item[h]) == null ? void 0 : _a3.content;
11461
+ })
11462
+ )
11451
11463
  ];
11452
11464
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
11453
11465
  "th",
@@ -11487,8 +11499,9 @@ function HTable(_a) {
11487
11499
  );
11488
11500
  }) }) }),
11489
11501
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-gray-200", children: mapedData.filter((md) => {
11502
+ var _a2;
11490
11503
  for (let datum of Object.keys(md)) {
11491
- if (!filters[datum].map((d) => `${d}`.toLowerCase()).includes(`${md[datum].content}`.toLowerCase())) {
11504
+ if (!filters[datum].map((d) => `${d}`.toLowerCase()).includes(`${(_a2 = md[datum]) == null ? void 0 : _a2.content}`.toLowerCase())) {
11492
11505
  return false;
11493
11506
  }
11494
11507
  }
package/dist/index.mjs CHANGED
@@ -11229,7 +11229,10 @@ function FilterMenu({
11229
11229
  const [newMapedData, setNewMapedData] = useState5([]);
11230
11230
  useEffect6(() => {
11231
11231
  setNewMapedData(
11232
- [...new Set(mapedData.map((md) => md[h].content))].filter(
11232
+ [...new Set(mapedData.map((md) => {
11233
+ var _a;
11234
+ return (_a = md[h]) == null ? void 0 : _a.content;
11235
+ }))].filter(
11233
11236
  (item) => {
11234
11237
  return item && `${item}`.toLowerCase().includes(text.toLowerCase());
11235
11238
  }
@@ -11394,7 +11397,8 @@ function HTable(_a) {
11394
11397
  const mapedTotals = useMemo7(() => {
11395
11398
  return mapedData.reduce((acc, md) => {
11396
11399
  head.forEach((h) => {
11397
- const value = isNaN(+md[h].content) ? 0 : +md[h].content;
11400
+ var _a2, _b2;
11401
+ const value = isNaN(+((_a2 = md[h]) == null ? void 0 : _a2.content)) ? 0 : +((_b2 = md[h]) == null ? void 0 : _b2.content);
11398
11402
  if (acc[h]) {
11399
11403
  acc[h] += value;
11400
11404
  } else {
@@ -11408,7 +11412,10 @@ function HTable(_a) {
11408
11412
  setFilters(__spreadValues({}, head.reduce((acc, hh) => {
11409
11413
  const newAcc = __spreadValues({}, acc);
11410
11414
  newAcc[hh] = [
11411
- ...new Set(mapedData.map((md) => md[hh].content))
11415
+ ...new Set(mapedData.map((md) => {
11416
+ var _a2;
11417
+ return (_a2 = md[hh]) == null ? void 0 : _a2.content;
11418
+ }))
11412
11419
  ];
11413
11420
  return newAcc;
11414
11421
  }, {})));
@@ -11438,7 +11445,12 @@ function HTable(_a) {
11438
11445
  /* @__PURE__ */ jsx11("thead", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ jsx11("tr", { children: head.map((h, key) => {
11439
11446
  var _a2;
11440
11447
  const items = [
11441
- ...new Set(mapedData.map((item) => item[h].content))
11448
+ ...new Set(
11449
+ mapedData.map((item) => {
11450
+ var _a3;
11451
+ return (_a3 = item[h]) == null ? void 0 : _a3.content;
11452
+ })
11453
+ )
11442
11454
  ];
11443
11455
  return /* @__PURE__ */ jsxs8(
11444
11456
  "th",
@@ -11478,8 +11490,9 @@ function HTable(_a) {
11478
11490
  );
11479
11491
  }) }) }),
11480
11492
  /* @__PURE__ */ jsx11("tbody", { className: "divide-y divide-gray-200", children: mapedData.filter((md) => {
11493
+ var _a2;
11481
11494
  for (let datum of Object.keys(md)) {
11482
- if (!filters[datum].map((d) => `${d}`.toLowerCase()).includes(`${md[datum].content}`.toLowerCase())) {
11495
+ if (!filters[datum].map((d) => `${d}`.toLowerCase()).includes(`${(_a2 = md[datum]) == null ? void 0 : _a2.content}`.toLowerCase())) {
11483
11496
  return false;
11484
11497
  }
11485
11498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@ export default function FilterMenu({
27
27
 
28
28
  useEffect(() => {
29
29
  setNewMapedData(
30
- [...new Set<string>(mapedData.map((md: any) => md[h].content))].filter(
30
+ [...new Set<string>(mapedData.map((md: any) => md[h]?.content))].filter(
31
31
  (item) => {
32
32
  return item && `${item}`.toLowerCase().includes(text.toLowerCase());
33
33
  }
package/src/table/h.tsx CHANGED
@@ -24,7 +24,7 @@ export default function HTable({
24
24
  const mapedTotals = useMemo(() => {
25
25
  return mapedData.reduce((acc: any, md: any) => {
26
26
  head.forEach((h) => {
27
- const value = isNaN(+md[h].content) ? 0 : +md[h].content;
27
+ const value = isNaN(+md[h]?.content) ? 0 : +md[h]?.content;
28
28
  if (acc[h]) {
29
29
  acc[h] += value;
30
30
  } else {
@@ -40,7 +40,7 @@ export default function HTable({
40
40
  ...head.reduce((acc, hh) => {
41
41
  const newAcc: any = { ...acc };
42
42
  newAcc[hh] = [
43
- ...new Set<string>(mapedData.map((md: any) => md[hh].content)),
43
+ ...new Set<string>(mapedData.map((md: any) => md[hh]?.content)),
44
44
  ];
45
45
  return newAcc;
46
46
  }, {}),
@@ -80,7 +80,9 @@ export default function HTable({
80
80
  <tr>
81
81
  {head.map((h, key) => {
82
82
  const items = [
83
- ...new Set<string>(mapedData.map((item: any) => item[h].content)),
83
+ ...new Set<string>(
84
+ mapedData.map((item: any) => item[h]?.content)
85
+ ),
84
86
  ];
85
87
  return (
86
88
  <th
@@ -125,7 +127,7 @@ export default function HTable({
125
127
  if (
126
128
  !filters[datum]
127
129
  .map((d: any) => `${d}`.toLowerCase())
128
- .includes(`${md[datum].content}`.toLowerCase())
130
+ .includes(`${md[datum]?.content}`.toLowerCase())
129
131
  ) {
130
132
  return false;
131
133
  }