@carbon/ibm-products 2.43.1-canary.4 → 2.43.1-canary.5
Sign up to get free protection for your applications and to get access to all the features.
- package/es/components/Datagrid/types/index.d.ts +3 -0
- package/es/components/Datagrid/useExpandedRow.d.ts +8 -1
- package/es/components/Datagrid/useExpandedRow.js +6 -5
- package/lib/components/Datagrid/types/index.d.ts +3 -0
- package/lib/components/Datagrid/useExpandedRow.d.ts +8 -1
- package/lib/components/Datagrid/useExpandedRow.js +6 -5
- package/package.json +2 -2
@@ -195,6 +195,9 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
195
195
|
expandedRowIds?: object;
|
196
196
|
onRowClick?: (row: any, event: any) => void;
|
197
197
|
onSort?: boolean;
|
198
|
+
expandedContentHeight?: number;
|
199
|
+
onRowExpand?: (row: DatagridRow, event: React.MouseEvent<HTMLElement>) => void;
|
200
|
+
ExpandedRowContentComponent?: JSXElementConstructor<any>;
|
198
201
|
}
|
199
202
|
export interface ResizeHeaderProps {
|
200
203
|
resizerProps?: ResizerProps;
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { Hooks } from 'react-table';
|
8
|
+
declare const useExpandedRow: (hooks: Hooks) => void;
|
1
9
|
export default useExpandedRow;
|
2
|
-
declare function useExpandedRow(hooks: any): void;
|
@@ -13,10 +13,11 @@ import useRowExpander from './useRowExpander.js';
|
|
13
13
|
var useExpandedRow = function useExpandedRow(hooks) {
|
14
14
|
useRowExpander(hooks);
|
15
15
|
var useInstance = function useInstance(instance) {
|
16
|
-
var
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
var _ref = instance,
|
17
|
+
rows = _ref.rows,
|
18
|
+
expandedContentHeight = _ref.expandedContentHeight,
|
19
|
+
ExpandedRowContentComponent = _ref.ExpandedRowContentComponent,
|
20
|
+
onRowExpand = _ref.onRowExpand;
|
20
21
|
var _useState = useState({}),
|
21
22
|
_useState2 = _slicedToArray(_useState, 2),
|
22
23
|
expandedRowsHeight = _useState2[0],
|
@@ -28,7 +29,7 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
28
29
|
return _objectSpread2(_objectSpread2({}, row), {}, {
|
29
30
|
canExpand: row.original && !row.original.notExpandable,
|
30
31
|
expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
|
31
|
-
RowExpansionRenderer: DatagridExpandedRow(ExpandedRowContentComponent),
|
32
|
+
RowExpansionRenderer: ExpandedRowContentComponent && DatagridExpandedRow(ExpandedRowContentComponent),
|
32
33
|
onClick: function onClick(row, event) {
|
33
34
|
return onRowExpand === null || onRowExpand === void 0 ? void 0 : onRowExpand(row, event);
|
34
35
|
}
|
@@ -195,6 +195,9 @@ export interface DataGridState<T extends object = any> extends TableCommonProps,
|
|
195
195
|
expandedRowIds?: object;
|
196
196
|
onRowClick?: (row: any, event: any) => void;
|
197
197
|
onSort?: boolean;
|
198
|
+
expandedContentHeight?: number;
|
199
|
+
onRowExpand?: (row: DatagridRow, event: React.MouseEvent<HTMLElement>) => void;
|
200
|
+
ExpandedRowContentComponent?: JSXElementConstructor<any>;
|
198
201
|
}
|
199
202
|
export interface ResizeHeaderProps {
|
200
203
|
resizerProps?: ResizerProps;
|
@@ -1,2 +1,9 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { Hooks } from 'react-table';
|
8
|
+
declare const useExpandedRow: (hooks: Hooks) => void;
|
1
9
|
export default useExpandedRow;
|
2
|
-
declare function useExpandedRow(hooks: any): void;
|
@@ -17,10 +17,11 @@ var useRowExpander = require('./useRowExpander.js');
|
|
17
17
|
var useExpandedRow = function useExpandedRow(hooks) {
|
18
18
|
useRowExpander["default"](hooks);
|
19
19
|
var useInstance = function useInstance(instance) {
|
20
|
-
var
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
var _ref = instance,
|
21
|
+
rows = _ref.rows,
|
22
|
+
expandedContentHeight = _ref.expandedContentHeight,
|
23
|
+
ExpandedRowContentComponent = _ref.ExpandedRowContentComponent,
|
24
|
+
onRowExpand = _ref.onRowExpand;
|
24
25
|
var _useState = React.useState({}),
|
25
26
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
26
27
|
expandedRowsHeight = _useState2[0],
|
@@ -32,7 +33,7 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
32
33
|
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, row), {}, {
|
33
34
|
canExpand: row.original && !row.original.notExpandable,
|
34
35
|
expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
|
35
|
-
RowExpansionRenderer: DatagridExpandedRow["default"](ExpandedRowContentComponent),
|
36
|
+
RowExpansionRenderer: ExpandedRowContentComponent && DatagridExpandedRow["default"](ExpandedRowContentComponent),
|
36
37
|
onClick: function onClick(row, event) {
|
37
38
|
return onRowExpand === null || onRowExpand === void 0 ? void 0 : onRowExpand(row, event);
|
38
39
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.43.1-canary.
|
4
|
+
"version": "2.43.1-canary.5+2e7a930f9",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -121,5 +121,5 @@
|
|
121
121
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
122
122
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
123
123
|
},
|
124
|
-
"gitHead": "
|
124
|
+
"gitHead": "2e7a930f99fd6dcadd47a328793ce6a259dc144e"
|
125
125
|
}
|