next-recomponents 1.2.2 → 1.2.4

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
@@ -11148,9 +11148,9 @@ function TD(_a) {
11148
11148
  const [isHidded, setIsHidded] = (0, import_react23.useState)(false);
11149
11149
  const isNode = (0, import_react23.useMemo)(() => {
11150
11150
  var _a2;
11151
- return symbols && typeof symbols[item.name] == "object" && ((_a2 = symbols[item.name]) == null ? void 0 : _a2.props);
11151
+ return symbols && typeof symbols[item == null ? void 0 : item.name] == "object" && ((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props);
11152
11152
  }, [symbols]);
11153
- const newProps = symbols && isNode && Object.keys(symbols[item.name].props).reduce(
11153
+ const newProps = symbols && isNode && Object.keys(symbols[item == null ? void 0 : item.name].props).reduce(
11154
11154
  (acc, i) => {
11155
11155
  try {
11156
11156
  const newAcc = __spreadValues({}, acc);
@@ -11159,29 +11159,29 @@ function TD(_a) {
11159
11159
  newAcc[i] = (e) => {
11160
11160
  var _a2, _b2;
11161
11161
  e.item = item;
11162
- (_b2 = (_a2 = symbols[item.name].props)[i]) == null ? void 0 : _b2.call(_a2, e);
11162
+ (_b2 = (_a2 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b2.call(_a2, e);
11163
11163
  };
11164
11164
  }
11165
11165
  return newAcc;
11166
11166
  } catch (error) {
11167
11167
  }
11168
11168
  },
11169
- { defaultValue: item.content }
11169
+ { defaultValue: item == null ? void 0 : item.content }
11170
11170
  );
11171
11171
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
11172
11172
  "td",
11173
11173
  {
11174
11174
  onDoubleClick: (e) => setIsHidded(!isHidded),
11175
- title: item.title,
11175
+ title: item == null ? void 0 : item.title,
11176
11176
  className: [
11177
11177
  isHidded && color2,
11178
11178
  !isHidded && "whitespace-nowrap overflow-hidden text-ellipsis ",
11179
11179
  "border-b max-w-[200px] p-5 ",
11180
- ["number", "money"].includes(item.cellTypeOf) && "text-right"
11180
+ ["number", "money"].includes(item == null ? void 0 : item.cellTypeOf) && "text-right"
11181
11181
  ].join(" "),
11182
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: symbols && symbols[item.name] && "flex justify-between", children: [
11183
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: symbols && symbols[item.name] && (isNode ? import_react23.default.cloneElement(symbols[item.name], __spreadValues({}, newProps)) : symbols[item.name]) }),
11184
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: item.content })
11182
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between", children: [
11183
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: symbols && symbols[item == null ? void 0 : item.name] && (isNode ? import_react23.default.cloneElement(symbols[item == null ? void 0 : item.name], __spreadValues({}, newProps)) : symbols[item == null ? void 0 : item.name]) }),
11184
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: item == null ? void 0 : item.content })
11185
11185
  ] })
11186
11186
  }
11187
11187
  );
@@ -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
@@ -11139,9 +11139,9 @@ function TD(_a) {
11139
11139
  const [isHidded, setIsHidded] = useState4(false);
11140
11140
  const isNode = useMemo6(() => {
11141
11141
  var _a2;
11142
- return symbols && typeof symbols[item.name] == "object" && ((_a2 = symbols[item.name]) == null ? void 0 : _a2.props);
11142
+ return symbols && typeof symbols[item == null ? void 0 : item.name] == "object" && ((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props);
11143
11143
  }, [symbols]);
11144
- const newProps = symbols && isNode && Object.keys(symbols[item.name].props).reduce(
11144
+ const newProps = symbols && isNode && Object.keys(symbols[item == null ? void 0 : item.name].props).reduce(
11145
11145
  (acc, i) => {
11146
11146
  try {
11147
11147
  const newAcc = __spreadValues({}, acc);
@@ -11150,29 +11150,29 @@ function TD(_a) {
11150
11150
  newAcc[i] = (e) => {
11151
11151
  var _a2, _b2;
11152
11152
  e.item = item;
11153
- (_b2 = (_a2 = symbols[item.name].props)[i]) == null ? void 0 : _b2.call(_a2, e);
11153
+ (_b2 = (_a2 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b2.call(_a2, e);
11154
11154
  };
11155
11155
  }
11156
11156
  return newAcc;
11157
11157
  } catch (error) {
11158
11158
  }
11159
11159
  },
11160
- { defaultValue: item.content }
11160
+ { defaultValue: item == null ? void 0 : item.content }
11161
11161
  );
11162
11162
  return /* @__PURE__ */ jsx8(
11163
11163
  "td",
11164
11164
  {
11165
11165
  onDoubleClick: (e) => setIsHidded(!isHidded),
11166
- title: item.title,
11166
+ title: item == null ? void 0 : item.title,
11167
11167
  className: [
11168
11168
  isHidded && color2,
11169
11169
  !isHidded && "whitespace-nowrap overflow-hidden text-ellipsis ",
11170
11170
  "border-b max-w-[200px] p-5 ",
11171
- ["number", "money"].includes(item.cellTypeOf) && "text-right"
11171
+ ["number", "money"].includes(item == null ? void 0 : item.cellTypeOf) && "text-right"
11172
11172
  ].join(" "),
11173
- children: /* @__PURE__ */ jsxs6("div", { className: symbols && symbols[item.name] && "flex justify-between", children: [
11174
- /* @__PURE__ */ jsx8("div", { children: symbols && symbols[item.name] && (isNode ? React3.cloneElement(symbols[item.name], __spreadValues({}, newProps)) : symbols[item.name]) }),
11175
- /* @__PURE__ */ jsx8("div", { children: item.content })
11173
+ children: /* @__PURE__ */ jsxs6("div", { className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between", children: [
11174
+ /* @__PURE__ */ jsx8("div", { children: symbols && symbols[item == null ? void 0 : item.name] && (isNode ? React3.cloneElement(symbols[item == null ? void 0 : item.name], __spreadValues({}, newProps)) : symbols[item == null ? void 0 : item.name]) }),
11175
+ /* @__PURE__ */ jsx8("div", { children: item == null ? void 0 : item.content })
11176
11176
  ] })
11177
11177
  }
11178
11178
  );
@@ -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.4",
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
  }
package/src/table/td.tsx CHANGED
@@ -23,14 +23,14 @@ export default function TD({
23
23
  const isNode = useMemo(() => {
24
24
  return (
25
25
  symbols &&
26
- typeof symbols[item.name] == "object" &&
27
- symbols[item.name]?.props
26
+ typeof symbols[item?.name] == "object" &&
27
+ symbols[item?.name]?.props
28
28
  );
29
29
  }, [symbols]);
30
30
  const newProps =
31
31
  symbols &&
32
32
  isNode &&
33
- Object.keys(symbols[item.name].props).reduce(
33
+ Object.keys(symbols[item?.name].props).reduce(
34
34
  (acc: any, i) => {
35
35
  try {
36
36
  const newAcc = { ...acc };
@@ -38,36 +38,36 @@ export default function TD({
38
38
  if (hasEvent) {
39
39
  newAcc[i] = (e: any) => {
40
40
  e.item = item;
41
- symbols[item.name].props[i]?.(e);
41
+ symbols[item?.name].props[i]?.(e);
42
42
  };
43
43
  }
44
44
  return newAcc;
45
45
  } catch (error) {}
46
46
  },
47
- { defaultValue: item.content }
47
+ { defaultValue: item?.content }
48
48
  );
49
49
  return (
50
50
  <td
51
51
  onDoubleClick={(e) => setIsHidded(!isHidded)}
52
- title={item.title}
52
+ title={item?.title}
53
53
  className={[
54
54
  isHidded && color,
55
55
  !isHidded && "whitespace-nowrap overflow-hidden text-ellipsis ",
56
56
  "border-b max-w-[200px] p-5 ",
57
- ["number", "money"].includes(item.cellTypeOf) && "text-right",
57
+ ["number", "money"].includes(item?.cellTypeOf) && "text-right",
58
58
  ].join(" ")}
59
59
  >
60
- <div className={symbols && symbols[item.name] && "flex justify-between"}>
60
+ <div className={symbols && symbols[item?.name] && "flex justify-between"}>
61
61
  <div>
62
62
  {symbols &&
63
- symbols[item.name] &&
63
+ symbols[item?.name] &&
64
64
  (isNode
65
- ? React.cloneElement(symbols[item.name], {
65
+ ? React.cloneElement(symbols[item?.name], {
66
66
  ...newProps,
67
67
  })
68
- : symbols[item.name])}
68
+ : symbols[item?.name])}
69
69
  </div>
70
- <div>{item.content}</div>
70
+ <div>{item?.content}</div>
71
71
  </div>
72
72
  </td>
73
73
  );