@itwin/itwinui-react 3.15.3 → 3.15.5
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/CHANGELOG.md +17 -0
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +85 -65
- package/DEV-cjs/core/ButtonGroup/ButtonGroup.js +32 -27
- package/DEV-cjs/core/ComboBox/ComboBox.js +9 -6
- package/DEV-cjs/core/DatePicker/DatePicker.js +14 -4
- package/DEV-cjs/core/Popover/Popover.js +44 -16
- package/DEV-cjs/core/Select/SelectTagContainer.js +27 -13
- package/DEV-cjs/core/Table/ColumnHeader.js +21 -28
- package/DEV-cjs/core/Table/Table.js +78 -53
- package/DEV-cjs/core/Table/TablePaginator.js +111 -88
- package/DEV-cjs/core/Table/cells/DefaultCell.js +3 -3
- package/DEV-cjs/core/Table/utils.js +3 -3
- package/DEV-cjs/styles.js +1 -1
- package/DEV-cjs/utils/components/MiddleTextTruncation.js +19 -14
- package/DEV-cjs/utils/components/OverflowContainer.js +63 -0
- package/DEV-cjs/utils/components/index.js +1 -0
- package/DEV-cjs/utils/hooks/useOverflow.js +12 -8
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +86 -67
- package/DEV-esm/core/ButtonGroup/ButtonGroup.js +33 -28
- package/DEV-esm/core/ComboBox/ComboBox.js +9 -6
- package/DEV-esm/core/DatePicker/DatePicker.js +12 -4
- package/DEV-esm/core/Popover/Popover.js +45 -17
- package/DEV-esm/core/Select/SelectTagContainer.js +24 -13
- package/DEV-esm/core/Table/ColumnHeader.js +28 -29
- package/DEV-esm/core/Table/Table.js +79 -54
- package/DEV-esm/core/Table/TablePaginator.js +112 -89
- package/DEV-esm/core/Table/cells/DefaultCell.js +4 -4
- package/DEV-esm/core/Table/utils.js +1 -1
- package/DEV-esm/styles.js +1 -1
- package/DEV-esm/utils/components/MiddleTextTruncation.js +19 -14
- package/DEV-esm/utils/components/OverflowContainer.js +50 -0
- package/DEV-esm/utils/components/index.js +1 -0
- package/DEV-esm/utils/hooks/useOverflow.js +8 -8
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +84 -64
- package/cjs/core/ButtonGroup/ButtonGroup.js +32 -27
- package/cjs/core/ComboBox/ComboBox.js +9 -6
- package/cjs/core/DatePicker/DatePicker.js +14 -4
- package/cjs/core/NonIdealState/NonIdealState.d.ts +15 -11
- package/cjs/core/Popover/Popover.d.ts +10 -0
- package/cjs/core/Popover/Popover.js +44 -16
- package/cjs/core/Select/SelectTagContainer.js +27 -13
- package/cjs/core/Table/ColumnHeader.d.ts +8 -12
- package/cjs/core/Table/ColumnHeader.js +21 -28
- package/cjs/core/Table/Table.js +74 -53
- package/cjs/core/Table/TablePaginator.js +111 -88
- package/cjs/core/Table/cells/DefaultCell.js +3 -3
- package/cjs/core/Table/utils.d.ts +2 -2
- package/cjs/core/Table/utils.js +3 -3
- package/cjs/styles.js +1 -1
- package/cjs/utils/components/MiddleTextTruncation.js +19 -14
- package/cjs/utils/components/OverflowContainer.d.ts +37 -0
- package/cjs/utils/components/OverflowContainer.js +62 -0
- package/cjs/utils/components/index.d.ts +1 -0
- package/cjs/utils/components/index.js +1 -0
- package/cjs/utils/hooks/useOverflow.d.ts +2 -3
- package/cjs/utils/hooks/useOverflow.js +12 -8
- package/esm/core/Breadcrumbs/Breadcrumbs.js +85 -66
- package/esm/core/ButtonGroup/ButtonGroup.js +33 -28
- package/esm/core/ComboBox/ComboBox.js +9 -6
- package/esm/core/DatePicker/DatePicker.js +12 -4
- package/esm/core/NonIdealState/NonIdealState.d.ts +15 -11
- package/esm/core/Popover/Popover.d.ts +10 -0
- package/esm/core/Popover/Popover.js +45 -17
- package/esm/core/Select/SelectTagContainer.js +24 -13
- package/esm/core/Table/ColumnHeader.d.ts +8 -12
- package/esm/core/Table/ColumnHeader.js +28 -29
- package/esm/core/Table/Table.js +75 -54
- package/esm/core/Table/TablePaginator.js +112 -89
- package/esm/core/Table/cells/DefaultCell.js +4 -4
- package/esm/core/Table/utils.d.ts +2 -2
- package/esm/core/Table/utils.js +1 -1
- package/esm/styles.js +1 -1
- package/esm/utils/components/MiddleTextTruncation.js +19 -14
- package/esm/utils/components/OverflowContainer.d.ts +37 -0
- package/esm/utils/components/OverflowContainer.js +49 -0
- package/esm/utils/components/index.d.ts +1 -0
- package/esm/utils/components/index.js +1 -0
- package/esm/utils/hooks/useOverflow.d.ts +2 -3
- package/esm/utils/hooks/useOverflow.js +8 -8
- package/package.json +1 -1
- package/styles.css +8 -8
|
@@ -33,7 +33,9 @@ import {
|
|
|
33
33
|
useMergedRefs,
|
|
34
34
|
} from '../../utils/index.js';
|
|
35
35
|
import { usePortalTo } from '../../utils/components/Portal.js';
|
|
36
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider.js';
|
|
36
37
|
export const PopoverOpenContext = React.createContext(void 0);
|
|
38
|
+
export const PopoverInitialFocusContext = React.createContext(void 0);
|
|
37
39
|
export const usePopover = (options) => {
|
|
38
40
|
let {
|
|
39
41
|
placement = 'bottom-start',
|
|
@@ -231,7 +233,12 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
231
233
|
role: 'dialog',
|
|
232
234
|
middleware,
|
|
233
235
|
});
|
|
234
|
-
let
|
|
236
|
+
let [popoverElement, setPopoverElement] = React.useState();
|
|
237
|
+
let popoverRef = useMergedRefs(
|
|
238
|
+
popover.refs.setFloating,
|
|
239
|
+
forwardedRef,
|
|
240
|
+
setPopoverElement,
|
|
241
|
+
);
|
|
235
242
|
let triggerId = `${useId()}-trigger`;
|
|
236
243
|
let hasAriaLabel = !!props['aria-labelledby'] || !!props['aria-label'];
|
|
237
244
|
useLayoutEffect(() => {
|
|
@@ -239,6 +246,13 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
239
246
|
popover.refs.setPositionReference(positionReference);
|
|
240
247
|
return () => void popover.refs.setPositionReference(null);
|
|
241
248
|
}, [popover.refs, positionReference]);
|
|
249
|
+
let [initialFocus, setInitialFocus] = React.useState();
|
|
250
|
+
let initialFocusContextValue = React.useMemo(
|
|
251
|
+
() => ({
|
|
252
|
+
setInitialFocus,
|
|
253
|
+
}),
|
|
254
|
+
[],
|
|
255
|
+
);
|
|
242
256
|
return React.createElement(
|
|
243
257
|
React.Fragment,
|
|
244
258
|
null,
|
|
@@ -255,32 +269,46 @@ export const Popover = React.forwardRef((props, forwardedRef) => {
|
|
|
255
269
|
),
|
|
256
270
|
popover.open
|
|
257
271
|
? React.createElement(
|
|
258
|
-
|
|
272
|
+
PopoverInitialFocusContext.Provider,
|
|
259
273
|
{
|
|
260
|
-
|
|
274
|
+
value: initialFocusContextValue,
|
|
261
275
|
},
|
|
262
276
|
React.createElement(
|
|
263
|
-
|
|
277
|
+
PopoverPortal,
|
|
264
278
|
{
|
|
265
|
-
|
|
266
|
-
modal: false,
|
|
279
|
+
portal: portal,
|
|
267
280
|
},
|
|
268
281
|
React.createElement(
|
|
269
|
-
|
|
282
|
+
ThemeProvider,
|
|
270
283
|
{
|
|
271
|
-
|
|
284
|
+
portalContainer: popoverElement,
|
|
285
|
+
},
|
|
286
|
+
React.createElement(DisplayContents, null),
|
|
287
|
+
React.createElement(
|
|
288
|
+
FloatingFocusManager,
|
|
289
|
+
{
|
|
290
|
+
context: popover.context,
|
|
291
|
+
modal: false,
|
|
292
|
+
initialFocus: initialFocus,
|
|
293
|
+
},
|
|
294
|
+
React.createElement(
|
|
295
|
+
Box,
|
|
272
296
|
{
|
|
273
|
-
|
|
297
|
+
className: cx(
|
|
298
|
+
{
|
|
299
|
+
'iui-popover-surface': applyBackground,
|
|
300
|
+
},
|
|
301
|
+
className,
|
|
302
|
+
),
|
|
303
|
+
'aria-labelledby': hasAriaLabel
|
|
304
|
+
? void 0
|
|
305
|
+
: popover.refs.domReference.current?.id,
|
|
306
|
+
...popover.getFloatingProps(rest),
|
|
307
|
+
ref: popoverRef,
|
|
274
308
|
},
|
|
275
|
-
|
|
309
|
+
content,
|
|
276
310
|
),
|
|
277
|
-
|
|
278
|
-
? void 0
|
|
279
|
-
: popover.refs.domReference.current?.id,
|
|
280
|
-
...popover.getFloatingProps(rest),
|
|
281
|
-
ref: popoverRef,
|
|
282
|
-
},
|
|
283
|
-
content,
|
|
311
|
+
),
|
|
284
312
|
),
|
|
285
313
|
),
|
|
286
314
|
)
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import { useOverflow, useMergedRefs, Box } from '../../utils/index.js';
|
|
4
3
|
import { SelectTag } from './SelectTag.js';
|
|
4
|
+
import { OverflowContainer } from '../../utils/index.js';
|
|
5
5
|
export const SelectTagContainer = React.forwardRef((props, ref) => {
|
|
6
|
-
let { tags, className, ...rest } = props;
|
|
7
|
-
let
|
|
8
|
-
let refs = useMergedRefs(ref, containerRef);
|
|
6
|
+
let { tags: tagsProp, className, ...rest } = props;
|
|
7
|
+
let tags = React.useMemo(() => React.Children.toArray(tagsProp), [tagsProp]);
|
|
9
8
|
return React.createElement(
|
|
10
|
-
|
|
9
|
+
OverflowContainer,
|
|
11
10
|
{
|
|
11
|
+
itemsCount: tags.length,
|
|
12
12
|
className: cx('iui-select-tag-container', className),
|
|
13
|
-
ref:
|
|
13
|
+
ref: ref,
|
|
14
14
|
...rest,
|
|
15
15
|
},
|
|
16
|
+
React.createElement(SelectTagContainerContent, {
|
|
17
|
+
...props,
|
|
18
|
+
tags: tags,
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
let SelectTagContainerContent = (props) => {
|
|
23
|
+
let { tags } = props;
|
|
24
|
+
let { visibleCount } = OverflowContainer.useContext();
|
|
25
|
+
return React.createElement(
|
|
26
|
+
React.Fragment,
|
|
27
|
+
null,
|
|
28
|
+
visibleCount < tags.length ? tags.slice(0, visibleCount - 1) : tags,
|
|
16
29
|
React.createElement(
|
|
17
|
-
|
|
30
|
+
OverflowContainer.OverflowNode,
|
|
18
31
|
null,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label: `+${tags.length - visibleCount + 1} item(s)`,
|
|
23
|
-
}),
|
|
32
|
+
React.createElement(SelectTag, {
|
|
33
|
+
label: `+${tags.length - visibleCount + 1} item(s)`,
|
|
34
|
+
}),
|
|
24
35
|
),
|
|
25
36
|
);
|
|
26
|
-
}
|
|
37
|
+
};
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
type ColumnHeaderProps
|
|
4
|
-
|
|
5
|
-
column: HeaderGroup<T>;
|
|
6
|
-
index: number;
|
|
1
|
+
import { type PolymorphicForwardRefComponent } from '../../utils/index.js';
|
|
2
|
+
import type { HeaderGroup, TableKeyedProps } from '../../react-table/react-table.js';
|
|
3
|
+
type ColumnHeaderProps = TableKeyedProps & {
|
|
4
|
+
column: HeaderGroup<Record<string, unknown>>;
|
|
7
5
|
areFiltersSet: boolean;
|
|
8
|
-
hasAnySubRows: boolean;
|
|
9
|
-
headers: HeaderGroup<T>[];
|
|
10
|
-
state: TableState<T>;
|
|
11
|
-
data: T[];
|
|
12
6
|
isResizable: boolean;
|
|
13
7
|
columnResizeMode: 'fit' | 'expand';
|
|
14
8
|
enableColumnReordering: boolean;
|
|
15
9
|
density: string | undefined;
|
|
16
|
-
|
|
10
|
+
columnHasExpanders: boolean;
|
|
11
|
+
isLast: boolean;
|
|
12
|
+
isTableEmpty: boolean;
|
|
17
13
|
};
|
|
18
|
-
export declare const ColumnHeader: <
|
|
14
|
+
export declare const ColumnHeader: PolymorphicForwardRefComponent<"div", ColumnHeaderProps>;
|
|
19
15
|
export {};
|
|
@@ -5,40 +5,39 @@ import {
|
|
|
5
5
|
LineClamp,
|
|
6
6
|
SvgSortDown,
|
|
7
7
|
SvgSortUp,
|
|
8
|
+
useMergedRefs,
|
|
8
9
|
} from '../../utils/index.js';
|
|
9
|
-
import { SELECTION_CELL_ID } from './columns/index.js';
|
|
10
10
|
import { FilterToggle } from './filters/FilterToggle.js';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getCellStyle,
|
|
13
|
+
getSubRowStyle,
|
|
14
|
+
getStickyStyle,
|
|
15
|
+
TableInstanceContext,
|
|
16
|
+
} from './utils.js';
|
|
12
17
|
import cx from 'classnames';
|
|
13
|
-
export const ColumnHeader = (props) => {
|
|
18
|
+
export const ColumnHeader = React.forwardRef((props, forwardedRef) => {
|
|
14
19
|
let {
|
|
15
|
-
columnRefs,
|
|
16
20
|
column,
|
|
17
|
-
index,
|
|
18
21
|
areFiltersSet,
|
|
19
|
-
hasAnySubRows,
|
|
20
|
-
headers,
|
|
21
|
-
state,
|
|
22
|
-
data,
|
|
23
22
|
isResizable,
|
|
24
23
|
columnResizeMode,
|
|
25
24
|
enableColumnReordering,
|
|
26
25
|
density,
|
|
27
|
-
|
|
26
|
+
columnHasExpanders,
|
|
27
|
+
isLast,
|
|
28
|
+
isTableEmpty,
|
|
28
29
|
...rest
|
|
29
30
|
} = props;
|
|
30
31
|
let isHeaderDirectClick = React.useRef(false);
|
|
32
|
+
let instance = React.useContext(TableInstanceContext);
|
|
31
33
|
let COLUMN_MIN_WIDTHS = {
|
|
32
34
|
default: 72,
|
|
33
35
|
withExpander: 108,
|
|
34
36
|
};
|
|
35
37
|
let showFilterButton = (column) =>
|
|
36
|
-
(
|
|
37
|
-
let showSortButton = (column) =>
|
|
38
|
+
(!isTableEmpty || areFiltersSet) && column.canFilter && !!column.Filter;
|
|
39
|
+
let showSortButton = (column) => !isTableEmpty && column.canSort;
|
|
38
40
|
let { onClick, ...restSortProps } = column.getSortByToggleProps();
|
|
39
|
-
let columnHasExpanders =
|
|
40
|
-
hasAnySubRows &&
|
|
41
|
-
index === headers.findIndex((c) => c.id !== SELECTION_CELL_ID);
|
|
42
41
|
if ([void 0, 0].includes(column.minWidth)) {
|
|
43
42
|
column.minWidth = columnHasExpanders
|
|
44
43
|
? COLUMN_MIN_WIDTHS.withExpander
|
|
@@ -58,12 +57,12 @@ export const ColumnHeader = (props) => {
|
|
|
58
57
|
column.columnClassName,
|
|
59
58
|
),
|
|
60
59
|
style: {
|
|
61
|
-
...getCellStyle(column, !!state.isTableResizing),
|
|
60
|
+
...getCellStyle(column, !!instance?.state.isTableResizing),
|
|
62
61
|
...(columnHasExpanders &&
|
|
63
62
|
getSubRowStyle({
|
|
64
63
|
density,
|
|
65
64
|
})),
|
|
66
|
-
...getStickyStyle(column, visibleColumns),
|
|
65
|
+
...getStickyStyle(column, instance?.visibleColumns ?? []),
|
|
67
66
|
flexWrap: 'wrap',
|
|
68
67
|
columnGap: 'var(--iui-size-xs)',
|
|
69
68
|
},
|
|
@@ -75,14 +74,14 @@ export const ColumnHeader = (props) => {
|
|
|
75
74
|
...rest,
|
|
76
75
|
key: columnProps.key,
|
|
77
76
|
title: void 0,
|
|
78
|
-
ref:
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
ref: useMergedRefs(
|
|
78
|
+
React.useCallback(
|
|
79
|
+
(el) => {
|
|
80
|
+
if (el) column.resizeWidth = el.getBoundingClientRect().width;
|
|
81
|
+
},
|
|
82
|
+
[column],
|
|
83
|
+
),
|
|
84
|
+
forwardedRef,
|
|
86
85
|
),
|
|
87
86
|
onMouseDown: () => {
|
|
88
87
|
isHeaderDirectClick.current = true;
|
|
@@ -153,7 +152,7 @@ export const ColumnHeader = (props) => {
|
|
|
153
152
|
),
|
|
154
153
|
isResizable &&
|
|
155
154
|
column.isResizerVisible &&
|
|
156
|
-
(
|
|
155
|
+
(!isLast || 'expand' === columnResizeMode) &&
|
|
157
156
|
React.createElement(
|
|
158
157
|
Box,
|
|
159
158
|
{
|
|
@@ -172,17 +171,17 @@ export const ColumnHeader = (props) => {
|
|
|
172
171
|
slot: 'resizers',
|
|
173
172
|
}),
|
|
174
173
|
'left' === column.sticky &&
|
|
175
|
-
state.sticky.isScrolledToRight &&
|
|
174
|
+
instance?.state.sticky.isScrolledToRight &&
|
|
176
175
|
React.createElement(Box, {
|
|
177
176
|
className: 'iui-table-cell-shadow-right',
|
|
178
177
|
slot: 'shadows',
|
|
179
178
|
}),
|
|
180
179
|
'right' === column.sticky &&
|
|
181
|
-
state.sticky.isScrolledToLeft &&
|
|
180
|
+
instance?.state.sticky.isScrolledToLeft &&
|
|
182
181
|
React.createElement(Box, {
|
|
183
182
|
className: 'iui-table-cell-shadow-left',
|
|
184
183
|
slot: 'shadows',
|
|
185
184
|
}),
|
|
186
185
|
),
|
|
187
186
|
);
|
|
188
|
-
};
|
|
187
|
+
});
|
package/esm/core/Table/Table.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
useLatestRef,
|
|
25
25
|
useVirtualScroll,
|
|
26
26
|
} from '../../utils/index.js';
|
|
27
|
-
import {
|
|
27
|
+
import { TableInstanceContext } from './utils.js';
|
|
28
28
|
import { TableRowMemoized } from './TableRowMemoized.js';
|
|
29
29
|
import { customFilterFunctions } from './filters/customFilterFunctions.js';
|
|
30
30
|
import {
|
|
@@ -53,6 +53,7 @@ let singleRowSelectedAction = 'singleRowSelected';
|
|
|
53
53
|
let shiftRowSelectedAction = 'shiftRowSelected';
|
|
54
54
|
export const tableResizeStartAction = 'tableResizeStart';
|
|
55
55
|
let tableResizeEndAction = 'tableResizeEnd';
|
|
56
|
+
let iuiId = Symbol('iui-id');
|
|
56
57
|
let flattenColumns = (columns) => {
|
|
57
58
|
let flatColumns = [];
|
|
58
59
|
columns.forEach((column) => {
|
|
@@ -105,6 +106,7 @@ export const Table = (props) => {
|
|
|
105
106
|
headerProps,
|
|
106
107
|
bodyProps,
|
|
107
108
|
emptyTableContentProps,
|
|
109
|
+
getRowId,
|
|
108
110
|
...rest
|
|
109
111
|
} = props;
|
|
110
112
|
useGlobals();
|
|
@@ -240,16 +242,30 @@ export const Table = (props) => {
|
|
|
240
242
|
),
|
|
241
243
|
[data, getSubRows],
|
|
242
244
|
);
|
|
243
|
-
let [rowHasParent] = React.useState(() => new WeakSet());
|
|
244
245
|
let getSubRowsWithSubComponents = React.useCallback(
|
|
245
|
-
(originalRow) => {
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
246
|
+
(originalRow, relativeIndex) => {
|
|
247
|
+
if (originalRow[iuiId]) return [];
|
|
248
|
+
if (originalRow.subRows) return originalRow.subRows;
|
|
249
|
+
return [
|
|
250
|
+
{
|
|
251
|
+
[iuiId]: `subcomponent-${relativeIndex}`,
|
|
252
|
+
...originalRow,
|
|
253
|
+
},
|
|
254
|
+
];
|
|
251
255
|
},
|
|
252
|
-
[
|
|
256
|
+
[],
|
|
257
|
+
);
|
|
258
|
+
let getRowIdWithSubComponents = React.useCallback(
|
|
259
|
+
(originalRow, relativeIndex, parent) => {
|
|
260
|
+
let defaultRowId = parent
|
|
261
|
+
? `${parent.id}.${relativeIndex}`
|
|
262
|
+
: `${relativeIndex}`;
|
|
263
|
+
let rowIdFromUser = getRowId?.(originalRow, relativeIndex, parent);
|
|
264
|
+
if (void 0 !== rowIdFromUser && originalRow[iuiId])
|
|
265
|
+
return `${rowIdFromUser}-${defaultRowId}`;
|
|
266
|
+
return rowIdFromUser ?? defaultRowId;
|
|
267
|
+
},
|
|
268
|
+
[getRowId],
|
|
253
269
|
);
|
|
254
270
|
let instance = useTable(
|
|
255
271
|
{
|
|
@@ -269,6 +285,7 @@ export const Table = (props) => {
|
|
|
269
285
|
...props.initialState,
|
|
270
286
|
},
|
|
271
287
|
columnResizeMode,
|
|
288
|
+
getRowId: subComponent ? getRowIdWithSubComponents : getRowId,
|
|
272
289
|
},
|
|
273
290
|
useFlexLayout,
|
|
274
291
|
useResizeColumns(ownerDocument),
|
|
@@ -299,7 +316,6 @@ export const Table = (props) => {
|
|
|
299
316
|
gotoPage,
|
|
300
317
|
setPageSize,
|
|
301
318
|
flatHeaders,
|
|
302
|
-
visibleColumns,
|
|
303
319
|
setGlobalFilter,
|
|
304
320
|
} = instance;
|
|
305
321
|
let headerGroups = _headerGroups;
|
|
@@ -462,51 +478,52 @@ export const Table = (props) => {
|
|
|
462
478
|
(index, virtualItem, virtualizer) => {
|
|
463
479
|
let row = page[index];
|
|
464
480
|
prepareRow(row);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
481
|
+
let isRowASubComponent = !!row.original[iuiId] && !!subComponent;
|
|
482
|
+
if (isRowASubComponent)
|
|
483
|
+
return React.createElement(
|
|
484
|
+
TableExpandableContentMemoized,
|
|
485
|
+
{
|
|
486
|
+
key: row.getRowProps().key,
|
|
487
|
+
virtualItem: virtualItem,
|
|
488
|
+
ref: enableVirtualization
|
|
489
|
+
? virtualizer?.measureElement
|
|
490
|
+
: tableRowRef(row),
|
|
491
|
+
isDisabled: !!isRowDisabled?.(row.original),
|
|
492
|
+
},
|
|
493
|
+
subComponent(row),
|
|
494
|
+
);
|
|
495
|
+
return React.createElement(TableRowMemoized, {
|
|
496
|
+
row: row,
|
|
497
|
+
rowProps: rowProps,
|
|
498
|
+
isLast: index === page.length - 1,
|
|
499
|
+
onRowInViewport: onRowInViewportRef,
|
|
500
|
+
onBottomReached: onBottomReachedRef,
|
|
501
|
+
intersectionMargin: intersectionMargin,
|
|
502
|
+
state: state,
|
|
503
|
+
key: row.getRowProps().key,
|
|
504
|
+
onClick: onRowClickHandler,
|
|
505
|
+
subComponent: subComponent,
|
|
506
|
+
isDisabled: !!isRowDisabled?.(row.original),
|
|
507
|
+
tableHasSubRows: hasAnySubRows,
|
|
508
|
+
tableInstance: instance,
|
|
509
|
+
expanderCell: expanderCell,
|
|
510
|
+
scrollContainerRef: tableRef.current,
|
|
511
|
+
tableRowRef: enableVirtualization ? void 0 : tableRowRef(row),
|
|
512
|
+
density: density,
|
|
513
|
+
virtualItem: virtualItem,
|
|
514
|
+
virtualizer: virtualizer,
|
|
515
|
+
});
|
|
499
516
|
},
|
|
500
517
|
[
|
|
501
518
|
page,
|
|
502
519
|
prepareRow,
|
|
520
|
+
subComponent,
|
|
503
521
|
rowProps,
|
|
504
522
|
onRowInViewportRef,
|
|
505
523
|
onBottomReachedRef,
|
|
506
524
|
intersectionMargin,
|
|
507
525
|
state,
|
|
508
526
|
onRowClickHandler,
|
|
509
|
-
subComponent,
|
|
510
527
|
isRowDisabled,
|
|
511
528
|
hasAnySubRows,
|
|
512
529
|
instance,
|
|
@@ -543,9 +560,9 @@ export const Table = (props) => {
|
|
|
543
560
|
updateStickyState();
|
|
544
561
|
}, []);
|
|
545
562
|
return React.createElement(
|
|
546
|
-
|
|
563
|
+
TableInstanceContext.Provider,
|
|
547
564
|
{
|
|
548
|
-
value: instance
|
|
565
|
+
value: instance,
|
|
549
566
|
},
|
|
550
567
|
React.createElement(
|
|
551
568
|
Box,
|
|
@@ -604,19 +621,23 @@ export const Table = (props) => {
|
|
|
604
621
|
return React.createElement(ColumnHeader, {
|
|
605
622
|
...dragAndDropProps,
|
|
606
623
|
key: dragAndDropProps.key || column.id || index,
|
|
607
|
-
columnRefs: columnRefs,
|
|
608
624
|
column: column,
|
|
609
|
-
index: index,
|
|
610
625
|
areFiltersSet: areFiltersSet,
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
626
|
+
columnHasExpanders:
|
|
627
|
+
hasAnySubRows &&
|
|
628
|
+
index ===
|
|
629
|
+
headerGroup.headers.findIndex(
|
|
630
|
+
(c) => c.id !== SELECTION_CELL_ID,
|
|
631
|
+
),
|
|
632
|
+
isLast: index === headerGroup.headers.length - 1,
|
|
633
|
+
isTableEmpty: 0 === data.length,
|
|
615
634
|
isResizable: isResizable,
|
|
616
635
|
columnResizeMode: columnResizeMode,
|
|
617
636
|
enableColumnReordering: enableColumnReordering,
|
|
618
637
|
density: density,
|
|
619
|
-
|
|
638
|
+
ref: (el) => {
|
|
639
|
+
if (el) columnRefs.current[column.id] = el;
|
|
640
|
+
},
|
|
620
641
|
});
|
|
621
642
|
}),
|
|
622
643
|
),
|