next-recomponents 1.7.37 → 1.7.39
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 +35 -39
- package/dist/index.mjs +35 -39
- package/package.json +1 -1
- package/src/table/td.tsx +40 -49
package/dist/index.js
CHANGED
|
@@ -11187,12 +11187,20 @@ function TD(_a) {
|
|
|
11187
11187
|
try {
|
|
11188
11188
|
const newAcc = __spreadValues({}, acc);
|
|
11189
11189
|
const hasEvent = `${i}`.startsWith("on");
|
|
11190
|
+
const name = item.name;
|
|
11191
|
+
newAcc["value"] = item.content;
|
|
11192
|
+
newAcc["onChange"] = (e) => __async(null, null, function* () {
|
|
11193
|
+
const value = e.target.value;
|
|
11194
|
+
const newData1 = [...mapedData];
|
|
11195
|
+
newData1[index][name].content = value;
|
|
11196
|
+
setMapedData == null ? void 0 : setMapedData(newData1);
|
|
11197
|
+
});
|
|
11190
11198
|
if (hasEvent) {
|
|
11191
11199
|
newAcc[i] = (e) => __async(null, null, function* () {
|
|
11192
11200
|
var _a3, _b3;
|
|
11193
11201
|
e.item = item;
|
|
11194
11202
|
e.row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
11195
|
-
acc2[i2] = mapedData[index][i2].content;
|
|
11203
|
+
acc2[i2] = name == i2 ? e.target.value : mapedData[index][i2].content;
|
|
11196
11204
|
return acc2;
|
|
11197
11205
|
}, {});
|
|
11198
11206
|
e.updateRow = (data) => {
|
|
@@ -11202,7 +11210,7 @@ function TD(_a) {
|
|
|
11202
11210
|
}
|
|
11203
11211
|
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11204
11212
|
};
|
|
11205
|
-
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11213
|
+
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props) == null ? void 0 : _a3[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11206
11214
|
});
|
|
11207
11215
|
} else if (i == "row") {
|
|
11208
11216
|
const row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
@@ -11210,6 +11218,16 @@ function TD(_a) {
|
|
|
11210
11218
|
return acc2;
|
|
11211
11219
|
}, {});
|
|
11212
11220
|
newAcc["row"] = row;
|
|
11221
|
+
newAcc["updateRow"] = (data) => {
|
|
11222
|
+
try {
|
|
11223
|
+
const newData = [...mapedData];
|
|
11224
|
+
for (const datum in data) {
|
|
11225
|
+
newData[index][datum].content = data[datum];
|
|
11226
|
+
}
|
|
11227
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11228
|
+
} catch (error) {
|
|
11229
|
+
}
|
|
11230
|
+
};
|
|
11213
11231
|
}
|
|
11214
11232
|
return newAcc;
|
|
11215
11233
|
} catch (error) {
|
|
@@ -11227,44 +11245,22 @@ function TD(_a) {
|
|
|
11227
11245
|
"border-b max-w-[200px] p-2 "
|
|
11228
11246
|
// ["number", "money"].includes(item?.cellTypeOf) && "text-right",
|
|
11229
11247
|
].join(" "),
|
|
11230
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
if (import_react23.default.isValidElement(handler)) {
|
|
11240
|
-
const { type, props: props2 } = handler;
|
|
11241
|
-
return import_react23.default.createElement(type, __spreadProps(__spreadValues({}, props2), {
|
|
11242
|
-
value: mapedData[index][item.name].content,
|
|
11243
|
-
onChange: (e) => {
|
|
11244
|
-
var _a3, _b3;
|
|
11245
|
-
const nmd = [...mapedData];
|
|
11246
|
-
nmd[index][item.name].content = e.target.value;
|
|
11247
|
-
e.item = Object.assign(
|
|
11248
|
-
{},
|
|
11249
|
-
...nmd.map(
|
|
11250
|
-
(d) => Object.keys(d).map((k) => ({ [k]: d[k].content }))
|
|
11251
|
-
)[index]
|
|
11252
|
-
);
|
|
11253
|
-
e.setData = (data) => {
|
|
11254
|
-
const nmd2 = [...mapedData];
|
|
11255
|
-
for (let datum in data) {
|
|
11256
|
-
nmd2[index][datum].content = data[datum];
|
|
11257
|
-
}
|
|
11258
|
-
setMapedData == null ? void 0 : setMapedData(nmd2);
|
|
11259
|
-
};
|
|
11260
|
-
setMapedData == null ? void 0 : setMapedData(nmd);
|
|
11261
|
-
(_b3 = (_a3 = handler == null ? void 0 : handler.props) == null ? void 0 : _a3.onChange) == null ? void 0 : _b3.call(_a3, e);
|
|
11248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
11249
|
+
"div",
|
|
11250
|
+
{
|
|
11251
|
+
className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between ",
|
|
11252
|
+
children: symbols ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between gap-1", children: [
|
|
11253
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: import_react23.default.Children.map(symbols[item == null ? void 0 : item.name], (child) => {
|
|
11254
|
+
if (import_react23.default.isValidElement(child)) {
|
|
11255
|
+
const { type, props: props2 } = child;
|
|
11256
|
+
return import_react23.default.createElement(type, __spreadValues({}, newProps));
|
|
11262
11257
|
}
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11258
|
+
return child;
|
|
11259
|
+
}) }),
|
|
11260
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: !(newProps == null ? void 0 : newProps["row"]) && item.content })
|
|
11261
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: item == null ? void 0 : item.content })
|
|
11262
|
+
}
|
|
11263
|
+
)
|
|
11268
11264
|
}
|
|
11269
11265
|
);
|
|
11270
11266
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -11169,12 +11169,20 @@ function TD(_a) {
|
|
|
11169
11169
|
try {
|
|
11170
11170
|
const newAcc = __spreadValues({}, acc);
|
|
11171
11171
|
const hasEvent = `${i}`.startsWith("on");
|
|
11172
|
+
const name = item.name;
|
|
11173
|
+
newAcc["value"] = item.content;
|
|
11174
|
+
newAcc["onChange"] = (e) => __async(null, null, function* () {
|
|
11175
|
+
const value = e.target.value;
|
|
11176
|
+
const newData1 = [...mapedData];
|
|
11177
|
+
newData1[index][name].content = value;
|
|
11178
|
+
setMapedData == null ? void 0 : setMapedData(newData1);
|
|
11179
|
+
});
|
|
11172
11180
|
if (hasEvent) {
|
|
11173
11181
|
newAcc[i] = (e) => __async(null, null, function* () {
|
|
11174
11182
|
var _a3, _b3;
|
|
11175
11183
|
e.item = item;
|
|
11176
11184
|
e.row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
11177
|
-
acc2[i2] = mapedData[index][i2].content;
|
|
11185
|
+
acc2[i2] = name == i2 ? e.target.value : mapedData[index][i2].content;
|
|
11178
11186
|
return acc2;
|
|
11179
11187
|
}, {});
|
|
11180
11188
|
e.updateRow = (data) => {
|
|
@@ -11184,7 +11192,7 @@ function TD(_a) {
|
|
|
11184
11192
|
}
|
|
11185
11193
|
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11186
11194
|
};
|
|
11187
|
-
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11195
|
+
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props) == null ? void 0 : _a3[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11188
11196
|
});
|
|
11189
11197
|
} else if (i == "row") {
|
|
11190
11198
|
const row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
@@ -11192,6 +11200,16 @@ function TD(_a) {
|
|
|
11192
11200
|
return acc2;
|
|
11193
11201
|
}, {});
|
|
11194
11202
|
newAcc["row"] = row;
|
|
11203
|
+
newAcc["updateRow"] = (data) => {
|
|
11204
|
+
try {
|
|
11205
|
+
const newData = [...mapedData];
|
|
11206
|
+
for (const datum in data) {
|
|
11207
|
+
newData[index][datum].content = data[datum];
|
|
11208
|
+
}
|
|
11209
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11210
|
+
} catch (error) {
|
|
11211
|
+
}
|
|
11212
|
+
};
|
|
11195
11213
|
}
|
|
11196
11214
|
return newAcc;
|
|
11197
11215
|
} catch (error) {
|
|
@@ -11209,44 +11227,22 @@ function TD(_a) {
|
|
|
11209
11227
|
"border-b max-w-[200px] p-2 "
|
|
11210
11228
|
// ["number", "money"].includes(item?.cellTypeOf) && "text-right",
|
|
11211
11229
|
].join(" "),
|
|
11212
|
-
children: /* @__PURE__ */
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
if (React3.isValidElement(handler)) {
|
|
11222
|
-
const { type, props: props2 } = handler;
|
|
11223
|
-
return React3.createElement(type, __spreadProps(__spreadValues({}, props2), {
|
|
11224
|
-
value: mapedData[index][item.name].content,
|
|
11225
|
-
onChange: (e) => {
|
|
11226
|
-
var _a3, _b3;
|
|
11227
|
-
const nmd = [...mapedData];
|
|
11228
|
-
nmd[index][item.name].content = e.target.value;
|
|
11229
|
-
e.item = Object.assign(
|
|
11230
|
-
{},
|
|
11231
|
-
...nmd.map(
|
|
11232
|
-
(d) => Object.keys(d).map((k) => ({ [k]: d[k].content }))
|
|
11233
|
-
)[index]
|
|
11234
|
-
);
|
|
11235
|
-
e.setData = (data) => {
|
|
11236
|
-
const nmd2 = [...mapedData];
|
|
11237
|
-
for (let datum in data) {
|
|
11238
|
-
nmd2[index][datum].content = data[datum];
|
|
11239
|
-
}
|
|
11240
|
-
setMapedData == null ? void 0 : setMapedData(nmd2);
|
|
11241
|
-
};
|
|
11242
|
-
setMapedData == null ? void 0 : setMapedData(nmd);
|
|
11243
|
-
(_b3 = (_a3 = handler == null ? void 0 : handler.props) == null ? void 0 : _a3.onChange) == null ? void 0 : _b3.call(_a3, e);
|
|
11230
|
+
children: /* @__PURE__ */ jsx8(
|
|
11231
|
+
"div",
|
|
11232
|
+
{
|
|
11233
|
+
className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between ",
|
|
11234
|
+
children: symbols ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between gap-1", children: [
|
|
11235
|
+
/* @__PURE__ */ jsx8("div", { children: React3.Children.map(symbols[item == null ? void 0 : item.name], (child) => {
|
|
11236
|
+
if (React3.isValidElement(child)) {
|
|
11237
|
+
const { type, props: props2 } = child;
|
|
11238
|
+
return React3.createElement(type, __spreadValues({}, newProps));
|
|
11244
11239
|
}
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11240
|
+
return child;
|
|
11241
|
+
}) }),
|
|
11242
|
+
/* @__PURE__ */ jsx8("div", { children: !(newProps == null ? void 0 : newProps["row"]) && item.content })
|
|
11243
|
+
] }) : /* @__PURE__ */ jsx8("div", { children: item == null ? void 0 : item.content })
|
|
11244
|
+
}
|
|
11245
|
+
)
|
|
11250
11246
|
}
|
|
11251
11247
|
);
|
|
11252
11248
|
}
|
package/package.json
CHANGED
package/src/table/td.tsx
CHANGED
|
@@ -36,11 +36,21 @@ export default function TD({
|
|
|
36
36
|
try {
|
|
37
37
|
const newAcc = { ...acc };
|
|
38
38
|
const hasEvent = `${i}`.startsWith("on");
|
|
39
|
+
const name = item.name;
|
|
40
|
+
|
|
41
|
+
newAcc["value"] = item.content;
|
|
42
|
+
newAcc["onChange"] = async (e: any) => {
|
|
43
|
+
const value = e.target.value;
|
|
44
|
+
const newData1 = [...mapedData];
|
|
45
|
+
newData1[index][name].content = value;
|
|
46
|
+
setMapedData?.(newData1);
|
|
47
|
+
};
|
|
39
48
|
if (hasEvent) {
|
|
40
49
|
newAcc[i] = async (e: any) => {
|
|
41
50
|
e.item = item;
|
|
42
51
|
e.row = Object.keys(mapedData[index]).reduce((acc, i) => {
|
|
43
|
-
acc[i] =
|
|
52
|
+
acc[i] =
|
|
53
|
+
name == i ? e.target.value : mapedData[index][i].content;
|
|
44
54
|
return acc;
|
|
45
55
|
}, {} as any);
|
|
46
56
|
e.updateRow = (data: Record<string, any>) => {
|
|
@@ -50,7 +60,8 @@ export default function TD({
|
|
|
50
60
|
}
|
|
51
61
|
setMapedData?.(newData);
|
|
52
62
|
};
|
|
53
|
-
|
|
63
|
+
|
|
64
|
+
await symbols[item?.name].props?.[i]?.(e);
|
|
54
65
|
};
|
|
55
66
|
} else if (i == "row") {
|
|
56
67
|
const row = Object.keys(mapedData[index]).reduce((acc, i) => {
|
|
@@ -58,6 +69,15 @@ export default function TD({
|
|
|
58
69
|
return acc;
|
|
59
70
|
}, {} as any);
|
|
60
71
|
newAcc["row"] = row;
|
|
72
|
+
newAcc["updateRow"] = (data: Record<string, any>) => {
|
|
73
|
+
try {
|
|
74
|
+
const newData = [...mapedData];
|
|
75
|
+
for (const datum in data) {
|
|
76
|
+
newData[index][datum].content = data[datum];
|
|
77
|
+
}
|
|
78
|
+
setMapedData?.(newData);
|
|
79
|
+
} catch (error) {}
|
|
80
|
+
};
|
|
61
81
|
}
|
|
62
82
|
return newAcc;
|
|
63
83
|
} catch (error) {}
|
|
@@ -76,56 +96,27 @@ export default function TD({
|
|
|
76
96
|
// ["number", "money"].includes(item?.cellTypeOf) && "text-right",
|
|
77
97
|
].join(" ")}
|
|
78
98
|
>
|
|
79
|
-
<div
|
|
80
|
-
{symbols &&
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
return child;
|
|
90
|
-
})}
|
|
91
|
-
</div>
|
|
92
|
-
)}
|
|
93
|
-
|
|
94
|
-
<div>
|
|
95
|
-
{item?.handler
|
|
96
|
-
? React.Children.map(item.handler, (handler) => {
|
|
97
|
-
if (React.isValidElement(handler)) {
|
|
98
|
-
const { type, props } = handler;
|
|
99
|
-
|
|
99
|
+
<div
|
|
100
|
+
className={symbols && symbols[item?.name] && "flex justify-between "}
|
|
101
|
+
>
|
|
102
|
+
{symbols ? (
|
|
103
|
+
<div className="flex items-center justify-between gap-1">
|
|
104
|
+
<div>
|
|
105
|
+
{React.Children.map(symbols[item?.name], (child) => {
|
|
106
|
+
if (React.isValidElement(child)) {
|
|
107
|
+
const { type, props } = child;
|
|
100
108
|
return React.createElement(type, {
|
|
101
|
-
...
|
|
102
|
-
value: mapedData[index][item.name].content,
|
|
103
|
-
onChange: (e: any) => {
|
|
104
|
-
const nmd = [...mapedData];
|
|
105
|
-
nmd[index][item.name].content = e.target.value;
|
|
106
|
-
e.item = Object.assign(
|
|
107
|
-
{},
|
|
108
|
-
...nmd.map((d: any) =>
|
|
109
|
-
Object.keys(d).map((k) => ({ [k]: d[k].content }))
|
|
110
|
-
)[index]
|
|
111
|
-
);
|
|
112
|
-
e.setData = (data: any) => {
|
|
113
|
-
const nmd = [...mapedData];
|
|
114
|
-
for (let datum in data) {
|
|
115
|
-
nmd[index][datum].content = data[datum];
|
|
116
|
-
}
|
|
117
|
-
setMapedData?.(nmd);
|
|
118
|
-
};
|
|
119
|
-
setMapedData?.(nmd);
|
|
120
|
-
handler?.props?.onChange?.(e);
|
|
121
|
-
// console.log("hola mundo", e.item);
|
|
122
|
-
},
|
|
109
|
+
...newProps,
|
|
123
110
|
});
|
|
124
111
|
}
|
|
125
|
-
return
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
|
|
112
|
+
return child;
|
|
113
|
+
})}
|
|
114
|
+
</div>
|
|
115
|
+
<div>{!newProps?.["row"] && item.content}</div>
|
|
116
|
+
</div>
|
|
117
|
+
) : (
|
|
118
|
+
<div>{item?.content}</div>
|
|
119
|
+
)}
|
|
129
120
|
</div>
|
|
130
121
|
</td>
|
|
131
122
|
);
|