next-recomponents 1.9.55 → 1.9.57

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
@@ -45988,12 +45988,23 @@ function TR({
45988
45988
  return null;
45989
45989
  } else if (handlers == null ? void 0 : handlers[h]) {
45990
45990
  const original = handlers[h];
45991
- const cloned = import_react34.default.cloneElement(original, __spreadValues({
45991
+ const cloned = import_react34.default.cloneElement(original, __spreadValues(__spreadValues({
45992
45992
  // si es controlado por value → actualiza con row[h]
45993
45993
  value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
45994
45994
  // si usa children → actualiza con row[h] también
45995
45995
  children: ((_b = original.props) == null ? void 0 : _b.children) ? typeof original.props.children == "object" ? (_c = original.props) == null ? void 0 : _c.children : row == null ? void 0 : row[h] : null
45996
- }, Object.keys(__spreadProps(__spreadValues({}, original.props), {
45996
+ }, original.props.hasOwnProperty("row") ? {
45997
+ row,
45998
+ updateRow: (finalResponse) => setObjectData(__spreadValues(__spreadValues({}, (row == null ? void 0 : row._id) ? {
45999
+ _id: row == null ? void 0 : row._id,
46000
+ _updated: true,
46001
+ _visible: true
46002
+ } : {
46003
+ id: (row == null ? void 0 : row.id) || null,
46004
+ _updated: true,
46005
+ _visible: true
46006
+ }), finalResponse))
46007
+ } : {}), Object.keys(__spreadProps(__spreadValues({}, original.props), {
45997
46008
  onChange: (_d = original.props) == null ? void 0 : _d.onChange
45998
46009
  })).filter((action) => action.startsWith("on")).reduce((acc, action) => {
45999
46010
  acc[action] = (e) => {
@@ -46061,8 +46072,12 @@ function TableBody({
46061
46072
  for (const [key, order] of Object.entries(
46062
46073
  sort || { id: "desc", _id: "desc" }
46063
46074
  )) {
46064
- const valA = a[key];
46065
- const valB = b[key];
46075
+ let valA = a[key];
46076
+ let valB = b[key];
46077
+ if (!isNaN(Number(valA)) && !isNaN(Number(valB))) {
46078
+ valA = Number(valA);
46079
+ valB = Number(valB);
46080
+ }
46066
46081
  if (valA === valB) continue;
46067
46082
  const comparison = valA > valB ? 1 : valA < valB ? -1 : 0;
46068
46083
  return order === "desc" ? -comparison : comparison;
package/dist/index.mjs CHANGED
@@ -45985,12 +45985,23 @@ function TR({
45985
45985
  return null;
45986
45986
  } else if (handlers == null ? void 0 : handlers[h]) {
45987
45987
  const original = handlers[h];
45988
- const cloned = React9.cloneElement(original, __spreadValues({
45988
+ const cloned = React9.cloneElement(original, __spreadValues(__spreadValues({
45989
45989
  // si es controlado por value → actualiza con row[h]
45990
45990
  value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
45991
45991
  // si usa children → actualiza con row[h] también
45992
45992
  children: ((_b = original.props) == null ? void 0 : _b.children) ? typeof original.props.children == "object" ? (_c = original.props) == null ? void 0 : _c.children : row == null ? void 0 : row[h] : null
45993
- }, Object.keys(__spreadProps(__spreadValues({}, original.props), {
45993
+ }, original.props.hasOwnProperty("row") ? {
45994
+ row,
45995
+ updateRow: (finalResponse) => setObjectData(__spreadValues(__spreadValues({}, (row == null ? void 0 : row._id) ? {
45996
+ _id: row == null ? void 0 : row._id,
45997
+ _updated: true,
45998
+ _visible: true
45999
+ } : {
46000
+ id: (row == null ? void 0 : row.id) || null,
46001
+ _updated: true,
46002
+ _visible: true
46003
+ }), finalResponse))
46004
+ } : {}), Object.keys(__spreadProps(__spreadValues({}, original.props), {
45994
46005
  onChange: (_d = original.props) == null ? void 0 : _d.onChange
45995
46006
  })).filter((action) => action.startsWith("on")).reduce((acc, action) => {
45996
46007
  acc[action] = (e) => {
@@ -46058,8 +46069,12 @@ function TableBody({
46058
46069
  for (const [key, order] of Object.entries(
46059
46070
  sort || { id: "desc", _id: "desc" }
46060
46071
  )) {
46061
- const valA = a[key];
46062
- const valB = b[key];
46072
+ let valA = a[key];
46073
+ let valB = b[key];
46074
+ if (!isNaN(Number(valA)) && !isNaN(Number(valB))) {
46075
+ valA = Number(valA);
46076
+ valB = Number(valB);
46077
+ }
46063
46078
  if (valA === valB) continue;
46064
46079
  const comparison = valA > valB ? 1 : valA < valB ? -1 : 0;
46065
46080
  return order === "desc" ? -comparison : comparison;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.9.55",
3
+ "version": "1.9.57",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,8 +40,14 @@ export default function TableBody({
40
40
  for (const [key, order] of Object.entries(
41
41
  sort || { id: "desc", _id: "desc" }
42
42
  )) {
43
- const valA = a[key];
44
- const valB = b[key];
43
+ let valA = a[key];
44
+ let valB = b[key];
45
+
46
+ // convertir a número si ambos son numéricos
47
+ if (!isNaN(Number(valA)) && !isNaN(Number(valB))) {
48
+ valA = Number(valA);
49
+ valB = Number(valB);
50
+ }
45
51
 
46
52
  if (valA === valB) continue; // pasa al siguiente criterio
47
53
 
package/src/table3/tr.tsx CHANGED
@@ -96,6 +96,27 @@ export default function TR({
96
96
  : row?.[h]
97
97
  : null,
98
98
 
99
+ ...(original.props.hasOwnProperty("row")
100
+ ? {
101
+ row,
102
+ updateRow: (finalResponse: any) =>
103
+ setObjectData({
104
+ ...(row?._id
105
+ ? {
106
+ _id: row?._id,
107
+ _updated: true,
108
+ _visible: true,
109
+ }
110
+ : {
111
+ id: row?.id || null,
112
+ _updated: true,
113
+ _visible: true,
114
+ }),
115
+ ...finalResponse,
116
+ }),
117
+ }
118
+ : {}),
119
+
99
120
  ...Object.keys({
100
121
  ...original.props,
101
122
  onChange: original.props?.onChange,