next-recomponents 1.6.97 → 1.6.99
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 +11 -0
- package/dist/index.mjs +11 -0
- package/package.json +1 -1
- package/src/table/index.tsx +15 -1
- package/src/table/td.tsx +11 -0
package/dist/index.js
CHANGED
|
@@ -11174,6 +11174,17 @@ function TD(_a) {
|
|
|
11174
11174
|
newAcc[i] = (e) => __async(null, null, function* () {
|
|
11175
11175
|
var _a3, _b3;
|
|
11176
11176
|
e.item = item;
|
|
11177
|
+
e.row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
11178
|
+
acc2[i2] = mapedData[index][i2].content;
|
|
11179
|
+
return acc2;
|
|
11180
|
+
}, {});
|
|
11181
|
+
e.updateRow = (data) => {
|
|
11182
|
+
const newData = [...mapedData];
|
|
11183
|
+
for (const datum in data) {
|
|
11184
|
+
newData[index][datum].content = data[datum];
|
|
11185
|
+
}
|
|
11186
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11187
|
+
};
|
|
11177
11188
|
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11178
11189
|
});
|
|
11179
11190
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -11158,6 +11158,17 @@ function TD(_a) {
|
|
|
11158
11158
|
newAcc[i] = (e) => __async(null, null, function* () {
|
|
11159
11159
|
var _a3, _b3;
|
|
11160
11160
|
e.item = item;
|
|
11161
|
+
e.row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
11162
|
+
acc2[i2] = mapedData[index][i2].content;
|
|
11163
|
+
return acc2;
|
|
11164
|
+
}, {});
|
|
11165
|
+
e.updateRow = (data) => {
|
|
11166
|
+
const newData = [...mapedData];
|
|
11167
|
+
for (const datum in data) {
|
|
11168
|
+
newData[index][datum].content = data[datum];
|
|
11169
|
+
}
|
|
11170
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11171
|
+
};
|
|
11161
11172
|
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11162
11173
|
});
|
|
11163
11174
|
}
|
package/package.json
CHANGED
package/src/table/index.tsx
CHANGED
|
@@ -3,7 +3,21 @@ import HTable from "./h";
|
|
|
3
3
|
type DataType = string | number | Date | object | undefined | null;
|
|
4
4
|
type Item = { content: DataType; handler: ReactNode };
|
|
5
5
|
export type DataTypeOrItem = DataType | Item;
|
|
6
|
-
|
|
6
|
+
type TableEventPropsItem = {
|
|
7
|
+
index: number;
|
|
8
|
+
originalData: number;
|
|
9
|
+
cellTypeOf: any;
|
|
10
|
+
title: number;
|
|
11
|
+
content: number;
|
|
12
|
+
name: string;
|
|
13
|
+
exclude: boolean;
|
|
14
|
+
handler: any;
|
|
15
|
+
};
|
|
16
|
+
export type TableEventProps = {
|
|
17
|
+
item: Record<string, TableEventPropsItem>;
|
|
18
|
+
row: Record<string, any>;
|
|
19
|
+
updateRow: (data: Record<string, any>) => void;
|
|
20
|
+
};
|
|
7
21
|
export interface TableProps
|
|
8
22
|
extends React.DetailedHTMLProps<
|
|
9
23
|
React.TableHTMLAttributes<HTMLTableElement>,
|
package/src/table/td.tsx
CHANGED
|
@@ -39,6 +39,17 @@ export default function TD({
|
|
|
39
39
|
if (hasEvent) {
|
|
40
40
|
newAcc[i] = async (e: any) => {
|
|
41
41
|
e.item = item;
|
|
42
|
+
e.row = Object.keys(mapedData[index]).reduce((acc, i) => {
|
|
43
|
+
acc[i] = mapedData[index][i].content;
|
|
44
|
+
return acc;
|
|
45
|
+
}, {} as any);
|
|
46
|
+
e.updateRow = (data: Record<string, any>) => {
|
|
47
|
+
const newData = [...mapedData];
|
|
48
|
+
for (const datum in data) {
|
|
49
|
+
newData[index][datum].content = data[datum];
|
|
50
|
+
}
|
|
51
|
+
setMapedData?.(newData);
|
|
52
|
+
};
|
|
42
53
|
await symbols[item?.name].props[i]?.(e);
|
|
43
54
|
};
|
|
44
55
|
}
|