next-recomponents 1.8.6 → 1.8.8

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
@@ -44148,8 +44148,8 @@ function HTable(_a) {
44148
44148
  })).flat().some((e) => e === true);
44149
44149
  }, [mapedData]);
44150
44150
  (0, import_react25.useEffect)(() => {
44151
- const newData = data.map((d, trkey) => {
44152
- var _a2, _b2, _c;
44151
+ const newData = data.length > 0 && data.map((d, trkey) => {
44152
+ var _a2, _b2, _c, _d;
44153
44153
  const obj = {};
44154
44154
  for (let key in d) {
44155
44155
  const item = {};
@@ -44161,8 +44161,8 @@ function HTable(_a) {
44161
44161
  const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
44162
44162
  const isDate = !isObject2 && regex.test(`${d[key]}`);
44163
44163
  const cellTypeOf = isDate ? "date" : isObject2 ? "object" : typeOf;
44164
- const mapedContent = (_b2 = mapedData[trkey][key]) == null ? void 0 : _b2.content;
44165
- const content = mapedContent || (cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? import_react25.default.isValidElement(d[key]) ? ((_c = d[key]) == null ? void 0 : _c.props).value : JSON.stringify(d[key]) : d[key]);
44164
+ const mapedContent = (_c = (_b2 = mapedData == null ? void 0 : mapedData[trkey]) == null ? void 0 : _b2[key]) == null ? void 0 : _c.content;
44165
+ const content = mapedContent || (cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? import_react25.default.isValidElement(d[key]) ? ((_d = d[key]) == null ? void 0 : _d.props).value : JSON.stringify(d[key]) : d[key]);
44166
44166
  const handler = import_react25.default.isValidElement(d[key]) ? d[key] : null;
44167
44167
  obj[key] = {
44168
44168
  index: trkey,
@@ -44177,7 +44177,7 @@ function HTable(_a) {
44177
44177
  }
44178
44178
  return obj;
44179
44179
  });
44180
- setMapedData(newData);
44180
+ newData && setMapedData(newData);
44181
44181
  }, [data]);
44182
44182
  const values = (0, import_react25.useMemo)(() => {
44183
44183
  return mapedData.length > 0 ? mapedData.map((d) => Object.keys(d).map((k) => {
package/dist/index.mjs CHANGED
@@ -44129,8 +44129,8 @@ function HTable(_a) {
44129
44129
  })).flat().some((e) => e === true);
44130
44130
  }, [mapedData]);
44131
44131
  useEffect6(() => {
44132
- const newData = data.map((d, trkey) => {
44133
- var _a2, _b2, _c;
44132
+ const newData = data.length > 0 && data.map((d, trkey) => {
44133
+ var _a2, _b2, _c, _d;
44134
44134
  const obj = {};
44135
44135
  for (let key in d) {
44136
44136
  const item = {};
@@ -44142,8 +44142,8 @@ function HTable(_a) {
44142
44142
  const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
44143
44143
  const isDate = !isObject2 && regex.test(`${d[key]}`);
44144
44144
  const cellTypeOf = isDate ? "date" : isObject2 ? "object" : typeOf;
44145
- const mapedContent = (_b2 = mapedData[trkey][key]) == null ? void 0 : _b2.content;
44146
- const content = mapedContent || (cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? React4.isValidElement(d[key]) ? ((_c = d[key]) == null ? void 0 : _c.props).value : JSON.stringify(d[key]) : d[key]);
44145
+ const mapedContent = (_c = (_b2 = mapedData == null ? void 0 : mapedData[trkey]) == null ? void 0 : _b2[key]) == null ? void 0 : _c.content;
44146
+ const content = mapedContent || (cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? React4.isValidElement(d[key]) ? ((_d = d[key]) == null ? void 0 : _d.props).value : JSON.stringify(d[key]) : d[key]);
44147
44147
  const handler = React4.isValidElement(d[key]) ? d[key] : null;
44148
44148
  obj[key] = {
44149
44149
  index: trkey,
@@ -44158,7 +44158,7 @@ function HTable(_a) {
44158
44158
  }
44159
44159
  return obj;
44160
44160
  });
44161
- setMapedData(newData);
44161
+ newData && setMapedData(newData);
44162
44162
  }, [data]);
44163
44163
  const values = useMemo6(() => {
44164
44164
  return mapedData.length > 0 ? mapedData.map((d) => Object.keys(d).map((k) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.8.6",
3
+ "version": "1.8.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, useEffect, useState } from "react";
2
- import Input from "../input";
3
2
  import { FilterOffIcon } from "./filters";
3
+ import Input from "src/input";
4
4
 
5
5
  export default function FilterMenu({
6
6
  h,
package/src/table/h.tsx CHANGED
@@ -53,46 +53,48 @@ export default function HTable({
53
53
  }, [mapedData]);
54
54
 
55
55
  useEffect(() => {
56
- const newData = data.map((d: any, trkey: number) => {
57
- const obj: any = {};
58
- for (let key in d) {
59
- const item: any = {};
60
-
56
+ const newData =
57
+ data.length > 0 &&
58
+ data.map((d: any, trkey: number) => {
59
+ const obj: any = {};
61
60
  for (let key in d) {
62
- item[key] = d[key]?.content || d[key];
63
- }
64
- const typeOf = typeof d[key];
65
- const isObject = typeOf == "object";
66
- const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
61
+ const item: any = {};
62
+
63
+ for (let key in d) {
64
+ item[key] = d[key]?.content || d[key];
65
+ }
66
+ const typeOf = typeof d[key];
67
+ const isObject = typeOf == "object";
68
+ const regex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
67
69
 
68
- const isDate = !isObject && regex.test(`${d[key]}`);
69
- const cellTypeOf = isDate ? "date" : isObject ? "object" : typeOf;
70
- const mapedContent = (mapedData[trkey][key] as any)?.content;
70
+ const isDate = !isObject && regex.test(`${d[key]}`);
71
+ const cellTypeOf = isDate ? "date" : isObject ? "object" : typeOf;
72
+ const mapedContent = (mapedData?.[trkey]?.[key] as any)?.content;
71
73
 
72
- const content =
73
- mapedContent ||
74
- (cellTypeOf == "date"
75
- ? d[key].split("T").join(" ").split(".")[0]
76
- : cellTypeOf == "object"
77
- ? React.isValidElement(d[key])
78
- ? (d[key]?.props as any).value
79
- : JSON.stringify(d[key])
80
- : d[key]);
81
- const handler = React.isValidElement(d[key]) ? d[key] : null;
82
- obj[key] = {
83
- index: trkey,
84
- originalData: content,
85
- cellTypeOf: cellTypeOf,
86
- title: content,
87
- content,
88
- name: key,
89
- exclude: false,
90
- handler,
91
- };
92
- }
93
- return obj;
94
- });
95
- setMapedData(newData);
74
+ const content =
75
+ mapedContent ||
76
+ (cellTypeOf == "date"
77
+ ? d[key].split("T").join(" ").split(".")[0]
78
+ : cellTypeOf == "object"
79
+ ? React.isValidElement(d[key])
80
+ ? (d[key]?.props as any).value
81
+ : JSON.stringify(d[key])
82
+ : d[key]);
83
+ const handler = React.isValidElement(d[key]) ? d[key] : null;
84
+ obj[key] = {
85
+ index: trkey,
86
+ originalData: content,
87
+ cellTypeOf: cellTypeOf,
88
+ title: content,
89
+ content,
90
+ name: key,
91
+ exclude: false,
92
+ handler,
93
+ };
94
+ }
95
+ return obj;
96
+ });
97
+ newData && setMapedData(newData);
96
98
  }, [data]);
97
99
 
98
100
  const values = useMemo(() => {