@kopexa/data-grid 13.0.3 → 14.0.1
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.
|
@@ -35,6 +35,7 @@ function DataGrid(props) {
|
|
|
35
35
|
isLoading = false,
|
|
36
36
|
pageSize = 20,
|
|
37
37
|
cellBorder,
|
|
38
|
+
onRowClick,
|
|
38
39
|
...rest
|
|
39
40
|
} = props;
|
|
40
41
|
const styles = datagrid({
|
|
@@ -68,7 +69,8 @@ function DataGrid(props) {
|
|
|
68
69
|
loadingMode,
|
|
69
70
|
emptyMessage,
|
|
70
71
|
isLoading,
|
|
71
|
-
pageSize
|
|
72
|
+
pageSize,
|
|
73
|
+
onRowClick
|
|
72
74
|
},
|
|
73
75
|
...rest,
|
|
74
76
|
children
|
|
@@ -187,13 +189,13 @@ function DataGridTableEmpty() {
|
|
|
187
189
|
return /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: totalColumns, className: styles.empty(), children: emptyMessage || "No data available." }) });
|
|
188
190
|
}
|
|
189
191
|
function DataGridTableBodyRowSkeleton({ children }) {
|
|
190
|
-
const { table, styles } = useDataGridContext();
|
|
192
|
+
const { table, styles, onRowClick } = useDataGridContext();
|
|
191
193
|
return /* @__PURE__ */ jsx(
|
|
192
194
|
"tr",
|
|
193
195
|
{
|
|
194
196
|
className: cn(
|
|
195
197
|
styles.bodyRowSkeleton,
|
|
196
|
-
|
|
198
|
+
onRowClick && "cursor-pointer",
|
|
197
199
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
198
200
|
),
|
|
199
201
|
children
|
|
@@ -265,16 +267,17 @@ function DataGridTableBodyRow({
|
|
|
265
267
|
dndRef,
|
|
266
268
|
dndStyle
|
|
267
269
|
}) {
|
|
268
|
-
const { styles, table } = useDataGridContext();
|
|
270
|
+
const { styles, table, onRowClick } = useDataGridContext();
|
|
269
271
|
return /* @__PURE__ */ jsx(
|
|
270
272
|
"tr",
|
|
271
273
|
{
|
|
272
274
|
ref: dndRef,
|
|
273
275
|
style: { ...dndStyle ? dndStyle : null },
|
|
274
276
|
"data-state": table.options.enableRowSelection && row.getIsSelected() ? "selected" : void 0,
|
|
277
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row.original),
|
|
275
278
|
className: cn(
|
|
276
279
|
styles.bodyRow(),
|
|
277
|
-
|
|
280
|
+
onRowClick && "cursor-pointer",
|
|
278
281
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
279
282
|
),
|
|
280
283
|
children
|
package/dist/data-grid.d.mts
CHANGED
|
@@ -17,6 +17,7 @@ type BaseProps<TData extends object> = {
|
|
|
17
17
|
emptyMessage?: string;
|
|
18
18
|
isLoading?: boolean;
|
|
19
19
|
pageSize?: number;
|
|
20
|
+
onRowClick?: (row: TData) => void;
|
|
20
21
|
};
|
|
21
22
|
type DataGridProps<TData extends object> = BaseProps<TData> & DataGridVariants & {
|
|
22
23
|
children?: ReactNode;
|
package/dist/data-grid.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type BaseProps<TData extends object> = {
|
|
|
17
17
|
emptyMessage?: string;
|
|
18
18
|
isLoading?: boolean;
|
|
19
19
|
pageSize?: number;
|
|
20
|
+
onRowClick?: (row: TData) => void;
|
|
20
21
|
};
|
|
21
22
|
type DataGridProps<TData extends object> = BaseProps<TData> & DataGridVariants & {
|
|
22
23
|
children?: ReactNode;
|
package/dist/data-grid.js
CHANGED
|
@@ -59,6 +59,7 @@ function DataGrid(props) {
|
|
|
59
59
|
isLoading = false,
|
|
60
60
|
pageSize = 20,
|
|
61
61
|
cellBorder,
|
|
62
|
+
onRowClick,
|
|
62
63
|
...rest
|
|
63
64
|
} = props;
|
|
64
65
|
const styles = (0, import_theme.datagrid)({
|
|
@@ -92,7 +93,8 @@ function DataGrid(props) {
|
|
|
92
93
|
loadingMode,
|
|
93
94
|
emptyMessage,
|
|
94
95
|
isLoading,
|
|
95
|
-
pageSize
|
|
96
|
+
pageSize,
|
|
97
|
+
onRowClick
|
|
96
98
|
},
|
|
97
99
|
...rest,
|
|
98
100
|
children
|
|
@@ -211,13 +213,13 @@ function DataGridTableEmpty() {
|
|
|
211
213
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: totalColumns, className: styles.empty(), children: emptyMessage || "No data available." }) });
|
|
212
214
|
}
|
|
213
215
|
function DataGridTableBodyRowSkeleton({ children }) {
|
|
214
|
-
const { table, styles } = useDataGridContext();
|
|
216
|
+
const { table, styles, onRowClick } = useDataGridContext();
|
|
215
217
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
216
218
|
"tr",
|
|
217
219
|
{
|
|
218
220
|
className: (0, import_shared_utils.cn)(
|
|
219
221
|
styles.bodyRowSkeleton,
|
|
220
|
-
|
|
222
|
+
onRowClick && "cursor-pointer",
|
|
221
223
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
222
224
|
),
|
|
223
225
|
children
|
|
@@ -289,16 +291,17 @@ function DataGridTableBodyRow({
|
|
|
289
291
|
dndRef,
|
|
290
292
|
dndStyle
|
|
291
293
|
}) {
|
|
292
|
-
const { styles, table } = useDataGridContext();
|
|
294
|
+
const { styles, table, onRowClick } = useDataGridContext();
|
|
293
295
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
294
296
|
"tr",
|
|
295
297
|
{
|
|
296
298
|
ref: dndRef,
|
|
297
299
|
style: { ...dndStyle ? dndStyle : null },
|
|
298
300
|
"data-state": table.options.enableRowSelection && row.getIsSelected() ? "selected" : void 0,
|
|
301
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row.original),
|
|
299
302
|
className: (0, import_shared_utils.cn)(
|
|
300
303
|
styles.bodyRow(),
|
|
301
|
-
|
|
304
|
+
onRowClick && "cursor-pointer",
|
|
302
305
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
303
306
|
),
|
|
304
307
|
children
|
package/dist/data-grid.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ function DataGrid(props) {
|
|
|
56
56
|
isLoading = false,
|
|
57
57
|
pageSize = 20,
|
|
58
58
|
cellBorder,
|
|
59
|
+
onRowClick,
|
|
59
60
|
...rest
|
|
60
61
|
} = props;
|
|
61
62
|
const styles = (0, import_theme.datagrid)({
|
|
@@ -89,7 +90,8 @@ function DataGrid(props) {
|
|
|
89
90
|
loadingMode,
|
|
90
91
|
emptyMessage,
|
|
91
92
|
isLoading,
|
|
92
|
-
pageSize
|
|
93
|
+
pageSize,
|
|
94
|
+
onRowClick
|
|
93
95
|
},
|
|
94
96
|
...rest,
|
|
95
97
|
children
|
|
@@ -208,13 +210,13 @@ function DataGridTableEmpty() {
|
|
|
208
210
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: totalColumns, className: styles.empty(), children: emptyMessage || "No data available." }) });
|
|
209
211
|
}
|
|
210
212
|
function DataGridTableBodyRowSkeleton({ children }) {
|
|
211
|
-
const { table, styles } = useDataGridContext();
|
|
213
|
+
const { table, styles, onRowClick } = useDataGridContext();
|
|
212
214
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
215
|
"tr",
|
|
214
216
|
{
|
|
215
217
|
className: (0, import_shared_utils.cn)(
|
|
216
218
|
styles.bodyRowSkeleton,
|
|
217
|
-
|
|
219
|
+
onRowClick && "cursor-pointer",
|
|
218
220
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
219
221
|
),
|
|
220
222
|
children
|
|
@@ -286,16 +288,17 @@ function DataGridTableBodyRow({
|
|
|
286
288
|
dndRef,
|
|
287
289
|
dndStyle
|
|
288
290
|
}) {
|
|
289
|
-
const { styles, table } = useDataGridContext();
|
|
291
|
+
const { styles, table, onRowClick } = useDataGridContext();
|
|
290
292
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
291
293
|
"tr",
|
|
292
294
|
{
|
|
293
295
|
ref: dndRef,
|
|
294
296
|
style: { ...dndStyle ? dndStyle : null },
|
|
295
297
|
"data-state": table.options.enableRowSelection && row.getIsSelected() ? "selected" : void 0,
|
|
298
|
+
onClick: () => onRowClick == null ? void 0 : onRowClick(row.original),
|
|
296
299
|
className: (0, import_shared_utils.cn)(
|
|
297
300
|
styles.bodyRow(),
|
|
298
|
-
|
|
301
|
+
onRowClick && "cursor-pointer",
|
|
299
302
|
table.options.enableRowSelection && "[&_>:first-child]:relative"
|
|
300
303
|
),
|
|
301
304
|
children
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopexa/data-grid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "A DataGrid Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-grid"
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"motion": ">=12.23.6",
|
|
29
29
|
"react": ">=19.0.0-rc.0",
|
|
30
30
|
"react-dom": ">=19.0.0-rc.0",
|
|
31
|
-
"@kopexa/theme": "
|
|
31
|
+
"@kopexa/theme": "14.0.1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@tanstack/react-table": "^8.21.3",
|
|
35
|
-
"@kopexa/react-utils": "
|
|
36
|
-
"@kopexa/shared-utils": "
|
|
37
|
-
"@kopexa/checkbox": "
|
|
35
|
+
"@kopexa/react-utils": "14.0.1",
|
|
36
|
+
"@kopexa/shared-utils": "14.0.1",
|
|
37
|
+
"@kopexa/checkbox": "14.0.1"
|
|
38
38
|
},
|
|
39
39
|
"clean-package": "../../../clean-package.config.json",
|
|
40
40
|
"module": "dist/index.mjs",
|