next-recomponents 1.6.98 → 1.7.0
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -0
- package/dist/index.mjs +12 -0
- package/package.json +1 -1
- package/src/index.tsx +1 -0
- package/src/table/index.tsx +15 -1
- package/src/table/td.tsx +11 -0
package/dist/index.d.mts
CHANGED
|
@@ -173,4 +173,4 @@ interface CalendarProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputE
|
|
|
173
173
|
}
|
|
174
174
|
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, ...otherProps }: CalendarProps): react_jsx_runtime.JSX.Element | null;
|
|
175
175
|
|
|
176
|
-
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, TextArea, regularExpresions, useDates, useExcel, useResources };
|
|
176
|
+
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, Table as TableEventProps, TextArea, regularExpresions, useDates, useExcel, useResources };
|
package/dist/index.d.ts
CHANGED
|
@@ -173,4 +173,4 @@ interface CalendarProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInputE
|
|
|
173
173
|
}
|
|
174
174
|
declare function MyCalendar({ enabledDates, onChange, defaultValue, className, ...otherProps }: CalendarProps): react_jsx_runtime.JSX.Element | null;
|
|
175
175
|
|
|
176
|
-
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, TextArea, regularExpresions, useDates, useExcel, useResources };
|
|
176
|
+
export { Alert, Button, Container, Form, Input, Modal, MyCalendar, Pre, Select, Table, Table as TableEventProps, TextArea, regularExpresions, useDates, useExcel, useResources };
|
package/dist/index.js
CHANGED
|
@@ -2978,6 +2978,7 @@ __export(index_exports, {
|
|
|
2978
2978
|
Pre: () => pre_default,
|
|
2979
2979
|
Select: () => Select,
|
|
2980
2980
|
Table: () => Table,
|
|
2981
|
+
TableEventProps: () => Table,
|
|
2981
2982
|
TextArea: () => TextArea,
|
|
2982
2983
|
regularExpresions: () => regular_expresions_default,
|
|
2983
2984
|
useDates: () => useDates,
|
|
@@ -11174,6 +11175,17 @@ function TD(_a) {
|
|
|
11174
11175
|
newAcc[i] = (e) => __async(null, null, function* () {
|
|
11175
11176
|
var _a3, _b3;
|
|
11176
11177
|
e.item = item;
|
|
11178
|
+
e.row = Object.keys(mapedData[index]).reduce((acc2, i2) => {
|
|
11179
|
+
acc2[i2] = mapedData[index][i2].content;
|
|
11180
|
+
return acc2;
|
|
11181
|
+
}, {});
|
|
11182
|
+
e.updateRow = (data) => {
|
|
11183
|
+
const newData = [...mapedData];
|
|
11184
|
+
for (const datum in data) {
|
|
11185
|
+
newData[index][datum].content = data[datum];
|
|
11186
|
+
}
|
|
11187
|
+
setMapedData == null ? void 0 : setMapedData(newData);
|
|
11188
|
+
};
|
|
11177
11189
|
yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
|
|
11178
11190
|
});
|
|
11179
11191
|
}
|
|
@@ -44551,6 +44563,7 @@ function MyCalendar(_a) {
|
|
|
44551
44563
|
Pre,
|
|
44552
44564
|
Select,
|
|
44553
44565
|
Table,
|
|
44566
|
+
TableEventProps,
|
|
44554
44567
|
TextArea,
|
|
44555
44568
|
regularExpresions,
|
|
44556
44569
|
useDates,
|
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
|
}
|
|
@@ -44544,6 +44555,7 @@ export {
|
|
|
44544
44555
|
pre_default as Pre,
|
|
44545
44556
|
Select,
|
|
44546
44557
|
Table,
|
|
44558
|
+
Table as TableEventProps,
|
|
44547
44559
|
TextArea,
|
|
44548
44560
|
regular_expresions_default as regularExpresions,
|
|
44549
44561
|
useDates,
|
package/package.json
CHANGED
package/src/index.tsx
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
|
}
|