next-recomponents 1.3.2 → 1.3.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 +29 -21
- package/dist/index.mjs +30 -22
- package/package.json +1 -1
- package/src/table/td.tsx +29 -22
package/dist/index.js
CHANGED
|
@@ -11149,21 +11149,18 @@ function TD(_a) {
|
|
|
11149
11149
|
"mapedData",
|
|
11150
11150
|
"setMapedData"
|
|
11151
11151
|
]);
|
|
11152
|
+
var _a2, _b2, _c, _d;
|
|
11152
11153
|
const [isHidded, setIsHidded] = (0, import_react23.useState)(false);
|
|
11153
|
-
const
|
|
11154
|
-
var _a2;
|
|
11155
|
-
return symbols && typeof symbols[item == null ? void 0 : item.name] == "object" && ((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props);
|
|
11156
|
-
}, [symbols]);
|
|
11157
|
-
const newProps = symbols && isNode && Object.keys(symbols[item == null ? void 0 : item.name].props).reduce(
|
|
11154
|
+
const newProps = symbols && import_react23.default.isValidElement(symbols[item == null ? void 0 : item.name]) && ((_b2 = Object.keys((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props)) == null ? void 0 : _b2.reduce(
|
|
11158
11155
|
(acc, i) => {
|
|
11159
11156
|
try {
|
|
11160
11157
|
const newAcc = __spreadValues({}, acc);
|
|
11161
11158
|
const hasEvent = `${i}`.startsWith("on");
|
|
11162
11159
|
if (hasEvent) {
|
|
11163
11160
|
newAcc[i] = (e) => {
|
|
11164
|
-
var
|
|
11161
|
+
var _a3, _b3;
|
|
11165
11162
|
e.item = item;
|
|
11166
|
-
(
|
|
11163
|
+
(_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11167
11164
|
};
|
|
11168
11165
|
}
|
|
11169
11166
|
return newAcc;
|
|
@@ -11171,7 +11168,30 @@ function TD(_a) {
|
|
|
11171
11168
|
}
|
|
11172
11169
|
},
|
|
11173
11170
|
{ defaultValue: item == null ? void 0 : item.content }
|
|
11174
|
-
);
|
|
11171
|
+
));
|
|
11172
|
+
const newProps2 = handlers && import_react23.default.isValidElement(handlers[item == null ? void 0 : item.name]) && ((_d = Object.keys((_c = handlers[item == null ? void 0 : item.name]) == null ? void 0 : _c.props)) == null ? void 0 : _d.reduce(
|
|
11173
|
+
(acc, i) => {
|
|
11174
|
+
try {
|
|
11175
|
+
const newAcc = __spreadValues({}, acc);
|
|
11176
|
+
const hasEvent = `${i}`.startsWith("on");
|
|
11177
|
+
if (hasEvent) {
|
|
11178
|
+
newAcc[i] = (e) => {
|
|
11179
|
+
var _a3, _b3;
|
|
11180
|
+
e.item = item;
|
|
11181
|
+
(_b3 = (_a3 = handlers[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11182
|
+
if (i == "onChange") {
|
|
11183
|
+
const newData = [...mapedData];
|
|
11184
|
+
newData[index][item == null ? void 0 : item.name].content = e.target.value;
|
|
11185
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11186
|
+
}
|
|
11187
|
+
};
|
|
11188
|
+
}
|
|
11189
|
+
return newAcc;
|
|
11190
|
+
} catch (error) {
|
|
11191
|
+
}
|
|
11192
|
+
},
|
|
11193
|
+
{ value: item == null ? void 0 : item.content }
|
|
11194
|
+
));
|
|
11175
11195
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
11176
11196
|
"td",
|
|
11177
11197
|
{
|
|
@@ -11185,19 +11205,7 @@ function TD(_a) {
|
|
|
11185
11205
|
].join(" "),
|
|
11186
11206
|
children: handlers && handlers[item == null ? void 0 : item.name] ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: import_react23.default.Children.map(handlers[item == null ? void 0 : item.name], (child) => {
|
|
11187
11207
|
if (import_react23.default.isValidElement(child)) {
|
|
11188
|
-
|
|
11189
|
-
const alteredProps = __spreadProps(__spreadValues({}, oldProps), {
|
|
11190
|
-
value: item == null ? void 0 : item.content,
|
|
11191
|
-
onChange: (e) => {
|
|
11192
|
-
var _a2;
|
|
11193
|
-
const newData = [...mapedData];
|
|
11194
|
-
newData[index][item == null ? void 0 : item.name].content = e.target.value;
|
|
11195
|
-
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11196
|
-
e.item = item;
|
|
11197
|
-
(_a2 = oldProps == null ? void 0 : oldProps.onChange) == null ? void 0 : _a2.call(oldProps, e);
|
|
11198
|
-
}
|
|
11199
|
-
});
|
|
11200
|
-
return import_react23.default.cloneElement(child, __spreadValues({}, alteredProps));
|
|
11208
|
+
return import_react23.default.cloneElement(child, __spreadValues({}, newProps2));
|
|
11201
11209
|
}
|
|
11202
11210
|
}) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
11203
11211
|
"div",
|
package/dist/index.mjs
CHANGED
|
@@ -11117,7 +11117,7 @@ import { useState as useState7 } from "react";
|
|
|
11117
11117
|
import React4, { useEffect as useEffect7, useMemo as useMemo7, useRef as useRef4, useState as useState6 } from "react";
|
|
11118
11118
|
|
|
11119
11119
|
// src/table/td.tsx
|
|
11120
|
-
import React3, {
|
|
11120
|
+
import React3, { useState as useState4 } from "react";
|
|
11121
11121
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
11122
11122
|
function TD(_a) {
|
|
11123
11123
|
var _b = _a, {
|
|
@@ -11139,21 +11139,18 @@ function TD(_a) {
|
|
|
11139
11139
|
"mapedData",
|
|
11140
11140
|
"setMapedData"
|
|
11141
11141
|
]);
|
|
11142
|
+
var _a2, _b2, _c, _d;
|
|
11142
11143
|
const [isHidded, setIsHidded] = useState4(false);
|
|
11143
|
-
const
|
|
11144
|
-
var _a2;
|
|
11145
|
-
return symbols && typeof symbols[item == null ? void 0 : item.name] == "object" && ((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props);
|
|
11146
|
-
}, [symbols]);
|
|
11147
|
-
const newProps = symbols && isNode && Object.keys(symbols[item == null ? void 0 : item.name].props).reduce(
|
|
11144
|
+
const newProps = symbols && React3.isValidElement(symbols[item == null ? void 0 : item.name]) && ((_b2 = Object.keys((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props)) == null ? void 0 : _b2.reduce(
|
|
11148
11145
|
(acc, i) => {
|
|
11149
11146
|
try {
|
|
11150
11147
|
const newAcc = __spreadValues({}, acc);
|
|
11151
11148
|
const hasEvent = `${i}`.startsWith("on");
|
|
11152
11149
|
if (hasEvent) {
|
|
11153
11150
|
newAcc[i] = (e) => {
|
|
11154
|
-
var
|
|
11151
|
+
var _a3, _b3;
|
|
11155
11152
|
e.item = item;
|
|
11156
|
-
(
|
|
11153
|
+
(_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11157
11154
|
};
|
|
11158
11155
|
}
|
|
11159
11156
|
return newAcc;
|
|
@@ -11161,7 +11158,30 @@ function TD(_a) {
|
|
|
11161
11158
|
}
|
|
11162
11159
|
},
|
|
11163
11160
|
{ defaultValue: item == null ? void 0 : item.content }
|
|
11164
|
-
);
|
|
11161
|
+
));
|
|
11162
|
+
const newProps2 = handlers && React3.isValidElement(handlers[item == null ? void 0 : item.name]) && ((_d = Object.keys((_c = handlers[item == null ? void 0 : item.name]) == null ? void 0 : _c.props)) == null ? void 0 : _d.reduce(
|
|
11163
|
+
(acc, i) => {
|
|
11164
|
+
try {
|
|
11165
|
+
const newAcc = __spreadValues({}, acc);
|
|
11166
|
+
const hasEvent = `${i}`.startsWith("on");
|
|
11167
|
+
if (hasEvent) {
|
|
11168
|
+
newAcc[i] = (e) => {
|
|
11169
|
+
var _a3, _b3;
|
|
11170
|
+
e.item = item;
|
|
11171
|
+
(_b3 = (_a3 = handlers[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11172
|
+
if (i == "onChange") {
|
|
11173
|
+
const newData = [...mapedData];
|
|
11174
|
+
newData[index][item == null ? void 0 : item.name].content = e.target.value;
|
|
11175
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11176
|
+
}
|
|
11177
|
+
};
|
|
11178
|
+
}
|
|
11179
|
+
return newAcc;
|
|
11180
|
+
} catch (error) {
|
|
11181
|
+
}
|
|
11182
|
+
},
|
|
11183
|
+
{ value: item == null ? void 0 : item.content }
|
|
11184
|
+
));
|
|
11165
11185
|
return /* @__PURE__ */ jsx8(
|
|
11166
11186
|
"td",
|
|
11167
11187
|
{
|
|
@@ -11175,19 +11195,7 @@ function TD(_a) {
|
|
|
11175
11195
|
].join(" "),
|
|
11176
11196
|
children: handlers && handlers[item == null ? void 0 : item.name] ? /* @__PURE__ */ jsx8("div", { children: React3.Children.map(handlers[item == null ? void 0 : item.name], (child) => {
|
|
11177
11197
|
if (React3.isValidElement(child)) {
|
|
11178
|
-
|
|
11179
|
-
const alteredProps = __spreadProps(__spreadValues({}, oldProps), {
|
|
11180
|
-
value: item == null ? void 0 : item.content,
|
|
11181
|
-
onChange: (e) => {
|
|
11182
|
-
var _a2;
|
|
11183
|
-
const newData = [...mapedData];
|
|
11184
|
-
newData[index][item == null ? void 0 : item.name].content = e.target.value;
|
|
11185
|
-
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11186
|
-
e.item = item;
|
|
11187
|
-
(_a2 = oldProps == null ? void 0 : oldProps.onChange) == null ? void 0 : _a2.call(oldProps, e);
|
|
11188
|
-
}
|
|
11189
|
-
});
|
|
11190
|
-
return React3.cloneElement(child, __spreadValues({}, alteredProps));
|
|
11198
|
+
return React3.cloneElement(child, __spreadValues({}, newProps2));
|
|
11191
11199
|
}
|
|
11192
11200
|
}) }) : /* @__PURE__ */ jsxs6(
|
|
11193
11201
|
"div",
|
package/package.json
CHANGED
package/src/table/td.tsx
CHANGED
|
@@ -31,17 +31,11 @@ export default function TD({
|
|
|
31
31
|
...props
|
|
32
32
|
}: TDProps) {
|
|
33
33
|
const [isHidded, setIsHidded] = useState(false);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
symbols &&
|
|
37
|
-
typeof symbols[item?.name] == "object" &&
|
|
38
|
-
symbols[item?.name]?.props
|
|
39
|
-
);
|
|
40
|
-
}, [symbols]);
|
|
34
|
+
|
|
41
35
|
const newProps =
|
|
42
36
|
symbols &&
|
|
43
|
-
|
|
44
|
-
Object.keys(symbols[item?.name]
|
|
37
|
+
React.isValidElement(symbols[item?.name]) &&
|
|
38
|
+
Object.keys(symbols[item?.name]?.props)?.reduce(
|
|
45
39
|
(acc: any, i) => {
|
|
46
40
|
try {
|
|
47
41
|
const newAcc = { ...acc };
|
|
@@ -57,6 +51,31 @@ export default function TD({
|
|
|
57
51
|
},
|
|
58
52
|
{ defaultValue: item?.content }
|
|
59
53
|
);
|
|
54
|
+
|
|
55
|
+
const newProps2 =
|
|
56
|
+
handlers &&
|
|
57
|
+
React.isValidElement(handlers[item?.name]) &&
|
|
58
|
+
Object.keys(handlers[item?.name]?.props)?.reduce(
|
|
59
|
+
(acc: any, i) => {
|
|
60
|
+
try {
|
|
61
|
+
const newAcc = { ...acc };
|
|
62
|
+
const hasEvent = `${i}`.startsWith("on");
|
|
63
|
+
if (hasEvent) {
|
|
64
|
+
newAcc[i] = (e: any) => {
|
|
65
|
+
e.item = item;
|
|
66
|
+
handlers[item?.name].props[i]?.(e);
|
|
67
|
+
if (i == "onChange") {
|
|
68
|
+
const newData = [...mapedData];
|
|
69
|
+
newData[index][item?.name].content = e.target.value;
|
|
70
|
+
setMapedData?.(newData);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return newAcc;
|
|
75
|
+
} catch (error) {}
|
|
76
|
+
},
|
|
77
|
+
{ value: item?.content }
|
|
78
|
+
);
|
|
60
79
|
return (
|
|
61
80
|
<td
|
|
62
81
|
onDoubleClick={(e) => setIsHidded(!isHidded)}
|
|
@@ -72,20 +91,8 @@ export default function TD({
|
|
|
72
91
|
<div>
|
|
73
92
|
{React.Children.map(handlers[item?.name], (child) => {
|
|
74
93
|
if (React.isValidElement(child)) {
|
|
75
|
-
const oldProps: any = child?.props || {};
|
|
76
|
-
const alteredProps = {
|
|
77
|
-
...oldProps,
|
|
78
|
-
value: item?.content,
|
|
79
|
-
onChange: (e: any) => {
|
|
80
|
-
const newData = [...mapedData];
|
|
81
|
-
newData[index][item?.name].content = e.target.value;
|
|
82
|
-
setMapedData?.(newData);
|
|
83
|
-
e.item = item;
|
|
84
|
-
oldProps?.onChange?.(e);
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
94
|
return React.cloneElement(child as any, {
|
|
88
|
-
...
|
|
95
|
+
...newProps2,
|
|
89
96
|
});
|
|
90
97
|
}
|
|
91
98
|
})}
|