@elastic/eui 60.2.0 → 60.3.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/es/components/accordion/accordion.js +10 -5
- package/es/components/context_menu/context_menu.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +6 -3
- package/es/components/datagrid/body/data_grid_cell.js +78 -10
- package/es/components/datagrid/data_grid.js +2 -0
- package/es/components/datagrid/utils/ref.js +24 -3
- package/es/components/selectable/selectable.js +2 -0
- package/eui.d.ts +19 -5
- package/i18ntokens.json +27 -27
- package/lib/components/accordion/accordion.js +10 -5
- package/lib/components/context_menu/context_menu.js +1 -1
- package/lib/components/datagrid/body/data_grid_body.js +6 -3
- package/lib/components/datagrid/body/data_grid_cell.js +77 -9
- package/lib/components/datagrid/data_grid.js +2 -0
- package/lib/components/datagrid/utils/ref.js +24 -3
- package/lib/components/selectable/selectable.js +2 -0
- package/optimize/es/components/accordion/accordion.js +10 -5
- package/optimize/es/components/datagrid/body/data_grid_body.js +6 -3
- package/optimize/es/components/datagrid/body/data_grid_cell.js +18 -9
- package/optimize/es/components/datagrid/data_grid.js +2 -0
- package/optimize/es/components/datagrid/utils/ref.js +24 -3
- package/optimize/es/components/selectable/selectable.js +2 -0
- package/optimize/lib/components/accordion/accordion.js +8 -5
- package/optimize/lib/components/datagrid/body/data_grid_body.js +6 -3
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +17 -8
- package/optimize/lib/components/datagrid/data_grid.js +2 -0
- package/optimize/lib/components/datagrid/utils/ref.js +24 -3
- package/optimize/lib/components/selectable/selectable.js +2 -0
- package/package.json +3 -3
- package/test-env/components/accordion/accordion.js +8 -5
- package/test-env/components/context_menu/context_menu.js +1 -1
- package/test-env/components/datagrid/body/data_grid_body.js +6 -3
- package/test-env/components/datagrid/body/data_grid_cell.js +77 -9
- package/test-env/components/datagrid/data_grid.js +2 -0
- package/test-env/components/datagrid/utils/ref.js +24 -3
- package/test-env/components/selectable/selectable.js +2 -0
|
@@ -37,8 +37,8 @@ var _utils = require("../../../utils");
|
|
|
37
37
|
|
|
38
38
|
var _react2 = require("@emotion/react");
|
|
39
39
|
|
|
40
|
-
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
41
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager"],
|
|
40
|
+
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "ariaRowIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
41
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
42
42
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"];
|
|
43
43
|
|
|
44
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -86,16 +86,13 @@ var EuiDataGridCellContent = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
86
86
|
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
87
87
|
rowIndex = _ref.rowIndex,
|
|
88
88
|
colIndex = _ref.colIndex,
|
|
89
|
+
ariaRowIndex = _ref.ariaRowIndex,
|
|
89
90
|
rowHeightUtils = _ref.rowHeightUtils,
|
|
90
91
|
isDefinedHeight = _ref.isDefinedHeight,
|
|
91
92
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
92
93
|
|
|
93
94
|
// React is more permissible than the TS types indicate
|
|
94
95
|
var CellElement = renderCellValue;
|
|
95
|
-
var positionText = (0, _i18n.useEuiI18n)('euiDataGridCell.position', 'Row: {row}; Column: {col}', {
|
|
96
|
-
row: rowIndex + 1,
|
|
97
|
-
col: colIndex + 1
|
|
98
|
-
});
|
|
99
96
|
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
100
97
|
ref: setCellContentsRef,
|
|
101
98
|
"data-datagrid-cellcontent": true,
|
|
@@ -107,7 +104,15 @@ var EuiDataGridCellContent = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
107
104
|
rowIndex: rowIndex,
|
|
108
105
|
colIndex: colIndex,
|
|
109
106
|
schema: (column === null || column === void 0 ? void 0 : column.schema) || rest.columnType
|
|
110
|
-
}, rest))), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null,
|
|
107
|
+
}, rest))), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, '- ', (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
108
|
+
token: "euiDataGridCell.position",
|
|
109
|
+
default: "{columnId}, column {col}, row {row}",
|
|
110
|
+
values: {
|
|
111
|
+
columnId: (column === null || column === void 0 ? void 0 : column.displayAsText) || rest.columnId,
|
|
112
|
+
col: colIndex + 1,
|
|
113
|
+
row: ariaRowIndex
|
|
114
|
+
}
|
|
115
|
+
}))));
|
|
111
116
|
});
|
|
112
117
|
EuiDataGridCellContent.propTypes = {
|
|
113
118
|
rowIndex: _propTypes.default.number.isRequired,
|
|
@@ -563,10 +568,40 @@ EuiDataGridCellContent.propTypes = {
|
|
|
563
568
|
onChange: _propTypes.default.func
|
|
564
569
|
}),
|
|
565
570
|
rowHeightUtils: _propTypes.default.any,
|
|
571
|
+
pagination: _propTypes.default.shape({
|
|
572
|
+
/**
|
|
573
|
+
* The index of the current page, starts at 0 for the first page
|
|
574
|
+
*/
|
|
575
|
+
pageIndex: _propTypes.default.number.isRequired,
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* How many rows should initially be shown per page.
|
|
579
|
+
* Pass `0` to display the selected "Show all" option and hide the pagination.
|
|
580
|
+
*/
|
|
581
|
+
pageSize: _propTypes.default.number.isRequired,
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* An array of page sizes the user can select from.
|
|
585
|
+
* Pass `0` as one of the options to create a "Show all" option.
|
|
586
|
+
* Leave this prop undefined or use an empty array to hide "Rows per page" select button.
|
|
587
|
+
*/
|
|
588
|
+
pageSizeOptions: _propTypes.default.arrayOf(_propTypes.default.number.isRequired),
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* A callback for when the user changes the page size selection
|
|
592
|
+
*/
|
|
593
|
+
onChangeItemsPerPage: _propTypes.default.func.isRequired,
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* A callback for when the current page index changes
|
|
597
|
+
*/
|
|
598
|
+
onChangePage: _propTypes.default.func.isRequired
|
|
599
|
+
}),
|
|
566
600
|
setCellProps: _propTypes.default.func.isRequired,
|
|
567
601
|
setCellContentsRef: _propTypes.default.any.isRequired,
|
|
568
602
|
isExpanded: _propTypes.default.bool.isRequired,
|
|
569
|
-
isDefinedHeight: _propTypes.default.bool.isRequired
|
|
603
|
+
isDefinedHeight: _propTypes.default.bool.isRequired,
|
|
604
|
+
ariaRowIndex: _propTypes.default.number.isRequired
|
|
570
605
|
};
|
|
571
606
|
|
|
572
607
|
var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
@@ -970,6 +1005,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
970
1005
|
rowHeightUtils = _this$props8.rowHeightUtils,
|
|
971
1006
|
rowHeightsOptions = _this$props8.rowHeightsOptions,
|
|
972
1007
|
rowManager = _this$props8.rowManager,
|
|
1008
|
+
pagination = _this$props8.pagination,
|
|
973
1009
|
rest = _objectWithoutProperties(_this$props8, _excluded2);
|
|
974
1010
|
|
|
975
1011
|
var rowIndex = rest.rowIndex,
|
|
@@ -979,6 +1015,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
979
1015
|
var popoverIsOpen = this.isPopoverOpen();
|
|
980
1016
|
var showCellActions = this.state.isFocused || this.state.isEntered || this.state.enableInteractions || popoverIsOpen;
|
|
981
1017
|
var cellClasses = (0, _classnames.default)('euiDataGridRowCell', (_classNames = {}, _defineProperty(_classNames, "euiDataGridRowCell--".concat(columnType), columnType), _defineProperty(_classNames, 'euiDataGridRowCell--open', popoverIsOpen), _classNames), className);
|
|
1018
|
+
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
982
1019
|
|
|
983
1020
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
984
1021
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -1087,7 +1124,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
1087
1124
|
setCellContentsRef: this.setCellContentsRef,
|
|
1088
1125
|
rowHeightsOptions: rowHeightsOptions,
|
|
1089
1126
|
rowHeightUtils: rowHeightUtils,
|
|
1090
|
-
isDefinedHeight: isDefinedHeight
|
|
1127
|
+
isDefinedHeight: isDefinedHeight,
|
|
1128
|
+
ariaRowIndex: ariaRowIndex
|
|
1091
1129
|
});
|
|
1092
1130
|
|
|
1093
1131
|
var anchorClass = 'euiDataGridRowCell__expandFlex';
|
|
@@ -1133,6 +1171,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
1133
1171
|
|
|
1134
1172
|
var content = (0, _react2.jsx)("div", _extends({
|
|
1135
1173
|
role: "gridcell",
|
|
1174
|
+
"aria-rowindex": ariaRowIndex,
|
|
1136
1175
|
tabIndex: this.state.isFocused && !this.state.disableCellTabIndex ? 0 : -1,
|
|
1137
1176
|
ref: this.cellRef
|
|
1138
1177
|
}, cellProps, {
|
|
@@ -1558,5 +1597,34 @@ EuiDataGridCell.propTypes = {
|
|
|
1558
1597
|
rowHeightUtils: _propTypes.default.any,
|
|
1559
1598
|
rowManager: _propTypes.default.shape({
|
|
1560
1599
|
getRow: _propTypes.default.func.isRequired
|
|
1600
|
+
}),
|
|
1601
|
+
pagination: _propTypes.default.shape({
|
|
1602
|
+
/**
|
|
1603
|
+
* The index of the current page, starts at 0 for the first page
|
|
1604
|
+
*/
|
|
1605
|
+
pageIndex: _propTypes.default.number.isRequired,
|
|
1606
|
+
|
|
1607
|
+
/**
|
|
1608
|
+
* How many rows should initially be shown per page.
|
|
1609
|
+
* Pass `0` to display the selected "Show all" option and hide the pagination.
|
|
1610
|
+
*/
|
|
1611
|
+
pageSize: _propTypes.default.number.isRequired,
|
|
1612
|
+
|
|
1613
|
+
/**
|
|
1614
|
+
* An array of page sizes the user can select from.
|
|
1615
|
+
* Pass `0` as one of the options to create a "Show all" option.
|
|
1616
|
+
* Leave this prop undefined or use an empty array to hide "Rows per page" select button.
|
|
1617
|
+
*/
|
|
1618
|
+
pageSizeOptions: _propTypes.default.arrayOf(_propTypes.default.number.isRequired),
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* A callback for when the user changes the page size selection
|
|
1622
|
+
*/
|
|
1623
|
+
onChangeItemsPerPage: _propTypes.default.func.isRequired,
|
|
1624
|
+
|
|
1625
|
+
/**
|
|
1626
|
+
* A callback for when the current page index changes
|
|
1627
|
+
*/
|
|
1628
|
+
onChangePage: _propTypes.default.func.isRequired
|
|
1561
1629
|
})
|
|
1562
1630
|
};
|
|
@@ -285,6 +285,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
285
285
|
|
|
286
286
|
(0, _ref.useImperativeGridRef)({
|
|
287
287
|
ref: ref,
|
|
288
|
+
gridRef: gridRef,
|
|
288
289
|
setIsFullScreen: setIsFullScreen,
|
|
289
290
|
focusContext: focusContext,
|
|
290
291
|
cellPopoverContext: cellPopoverContext,
|
|
@@ -388,6 +389,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
388
389
|
"data-test-subj": "euiDataGridBody",
|
|
389
390
|
className: "euiDataGrid__content",
|
|
390
391
|
role: "grid",
|
|
392
|
+
"aria-rowcount": rowCount,
|
|
391
393
|
id: gridId
|
|
392
394
|
}, wrappingDivFocusProps, gridAriaProps), (0, _react2.jsx)(_body.EuiDataGridBody, {
|
|
393
395
|
columns: orderedVisibleColumns,
|
|
@@ -16,6 +16,7 @@ var _react = require("react");
|
|
|
16
16
|
*/
|
|
17
17
|
var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
18
18
|
var ref = _ref.ref,
|
|
19
|
+
gridRef = _ref.gridRef,
|
|
19
20
|
setIsFullScreen = _ref.setIsFullScreen,
|
|
20
21
|
focusContext = _ref.focusContext,
|
|
21
22
|
cellPopoverContext = _ref.cellPopoverContext,
|
|
@@ -70,16 +71,36 @@ var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
|
70
71
|
rowIndex: visibleRowIndex,
|
|
71
72
|
colIndex: colIndex
|
|
72
73
|
});
|
|
73
|
-
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
74
|
+
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
75
|
+
var scrollTo = (0, _react.useCallback)(function () {
|
|
76
|
+
var _gridRef$current;
|
|
77
|
+
|
|
78
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
|
+
args[_key] = arguments[_key];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.scrollTo.apply(_gridRef$current, args);
|
|
83
|
+
}, [gridRef]);
|
|
84
|
+
var scrollToItem = (0, _react.useCallback)(function () {
|
|
85
|
+
var _gridRef$current2;
|
|
86
|
+
|
|
87
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
88
|
+
args[_key2] = arguments[_key2];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.scrollToItem.apply(_gridRef$current2, args);
|
|
92
|
+
}, [gridRef]); // Set the ref APIs
|
|
74
93
|
|
|
75
94
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
76
95
|
return {
|
|
77
96
|
setIsFullScreen: setIsFullScreen,
|
|
78
97
|
setFocusedCell: setFocusedCell,
|
|
79
98
|
openCellPopover: openCellPopover,
|
|
80
|
-
closeCellPopover: closeCellPopover
|
|
99
|
+
closeCellPopover: closeCellPopover,
|
|
100
|
+
scrollTo: scrollTo,
|
|
101
|
+
scrollToItem: scrollToItem
|
|
81
102
|
};
|
|
82
|
-
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover]);
|
|
103
|
+
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover, scrollTo, scrollToItem]);
|
|
83
104
|
};
|
|
84
105
|
/**
|
|
85
106
|
* Throw a digestible error if the consumer attempts to focus into an invalid
|
|
@@ -200,6 +200,8 @@ var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
200
200
|
event.stopPropagation();
|
|
201
201
|
|
|
202
202
|
if (_this.state.activeOptionIndex != null && optionsList) {
|
|
203
|
+
event.persist(); // NOTE: This is needed for React v16 backwards compatibility
|
|
204
|
+
|
|
203
205
|
optionsList.onAddOrRemoveOption(_this.state.visibleOptions[_this.state.activeOptionIndex], event);
|
|
204
206
|
}
|
|
205
207
|
|
|
@@ -98,6 +98,14 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
98
98
|
|
|
99
99
|
_defineProperty(_assertThisInitialized(_this), "generatedId", htmlIdGenerator()());
|
|
100
100
|
|
|
101
|
+
_defineProperty(_assertThisInitialized(_this), "resizeRef", function () {});
|
|
102
|
+
|
|
103
|
+
_defineProperty(_assertThisInitialized(_this), "observerRef", function (ref) {
|
|
104
|
+
_this.setChildContentRef(ref);
|
|
105
|
+
|
|
106
|
+
_this.resizeRef(ref);
|
|
107
|
+
});
|
|
108
|
+
|
|
101
109
|
return _this;
|
|
102
110
|
}
|
|
103
111
|
|
|
@@ -248,12 +256,9 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
248
256
|
}, ___EmotionJSX(EuiResizeObserver, {
|
|
249
257
|
onResize: this.setChildContentHeight
|
|
250
258
|
}, function (resizeRef) {
|
|
259
|
+
_this2.resizeRef = resizeRef;
|
|
251
260
|
return ___EmotionJSX("div", {
|
|
252
|
-
ref:
|
|
253
|
-
_this2.setChildContentRef(_ref);
|
|
254
|
-
|
|
255
|
-
resizeRef(_ref);
|
|
256
|
-
}
|
|
261
|
+
ref: _this2.observerRef
|
|
257
262
|
}, ___EmotionJSX("div", {
|
|
258
263
|
className: childrenClasses,
|
|
259
264
|
css: cssChildrenStyles
|
|
@@ -52,7 +52,8 @@ export var Cell = function Cell(_ref) {
|
|
|
52
52
|
schemaDetectors = data.schemaDetectors,
|
|
53
53
|
rowHeightsOptions = data.rowHeightsOptions,
|
|
54
54
|
rowHeightUtils = data.rowHeightUtils,
|
|
55
|
-
rowManager = data.rowManager
|
|
55
|
+
rowManager = data.rowManager,
|
|
56
|
+
pagination = data.pagination;
|
|
56
57
|
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
57
58
|
|
|
58
59
|
var _useContext = useContext(DataGridWrapperRowsContext),
|
|
@@ -91,7 +92,8 @@ export var Cell = function Cell(_ref) {
|
|
|
91
92
|
rowHeightUtils: rowHeightUtils,
|
|
92
93
|
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
93
94
|
rowManager: rowManager,
|
|
94
|
-
popoverContext: popoverContext
|
|
95
|
+
popoverContext: popoverContext,
|
|
96
|
+
pagination: pagination
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
if (isLeadingControlColumn) {
|
|
@@ -415,7 +417,8 @@ export var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
415
417
|
interactiveCellId: interactiveCellId,
|
|
416
418
|
rowHeightsOptions: rowHeightsOptions,
|
|
417
419
|
rowHeightUtils: rowHeightUtils,
|
|
418
|
-
rowManager: rowManager
|
|
420
|
+
rowManager: rowManager,
|
|
421
|
+
pagination: pagination
|
|
419
422
|
},
|
|
420
423
|
rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
421
424
|
}), Cell), scrollBorderOverlay) : null;
|
|
@@ -7,8 +7,8 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
8
|
import _extends from "@babel/runtime/helpers/extends";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
10
|
-
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
11
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager"],
|
|
10
|
+
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "ariaRowIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
11
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
12
12
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"];
|
|
13
13
|
|
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -33,7 +33,7 @@ import { tabbable } from 'tabbable';
|
|
|
33
33
|
import { keys } from '../../../services';
|
|
34
34
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
35
35
|
import { EuiFocusTrap } from '../../focus_trap';
|
|
36
|
-
import {
|
|
36
|
+
import { EuiI18n } from '../../i18n';
|
|
37
37
|
import { hasResizeObserver } from '../../observer/resize_observer/resize_observer';
|
|
38
38
|
import { DataGridFocusContext } from '../utils/focus';
|
|
39
39
|
import { EuiDataGridCellActions, EuiDataGridCellPopoverActions } from './data_grid_cell_actions';
|
|
@@ -47,16 +47,13 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
47
|
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
48
48
|
rowIndex = _ref.rowIndex,
|
|
49
49
|
colIndex = _ref.colIndex,
|
|
50
|
+
ariaRowIndex = _ref.ariaRowIndex,
|
|
50
51
|
rowHeightUtils = _ref.rowHeightUtils,
|
|
51
52
|
isDefinedHeight = _ref.isDefinedHeight,
|
|
52
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
54
|
|
|
54
55
|
// React is more permissible than the TS types indicate
|
|
55
56
|
var CellElement = renderCellValue;
|
|
56
|
-
var positionText = useEuiI18n('euiDataGridCell.position', 'Row: {row}; Column: {col}', {
|
|
57
|
-
row: rowIndex + 1,
|
|
58
|
-
col: colIndex + 1
|
|
59
|
-
});
|
|
60
57
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", {
|
|
61
58
|
ref: setCellContentsRef,
|
|
62
59
|
"data-datagrid-cellcontent": true,
|
|
@@ -68,7 +65,15 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
65
|
rowIndex: rowIndex,
|
|
69
66
|
colIndex: colIndex,
|
|
70
67
|
schema: (column === null || column === void 0 ? void 0 : column.schema) || rest.columnType
|
|
71
|
-
}, rest))), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null,
|
|
68
|
+
}, rest))), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, '- ', ___EmotionJSX(EuiI18n, {
|
|
69
|
+
token: "euiDataGridCell.position",
|
|
70
|
+
default: "{columnId}, column {col}, row {row}",
|
|
71
|
+
values: {
|
|
72
|
+
columnId: (column === null || column === void 0 ? void 0 : column.displayAsText) || rest.columnId,
|
|
73
|
+
col: colIndex + 1,
|
|
74
|
+
row: ariaRowIndex
|
|
75
|
+
}
|
|
76
|
+
}))));
|
|
72
77
|
});
|
|
73
78
|
export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
74
79
|
_inherits(EuiDataGridCell, _Component);
|
|
@@ -473,6 +478,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
473
478
|
rowHeightUtils = _this$props8.rowHeightUtils,
|
|
474
479
|
rowHeightsOptions = _this$props8.rowHeightsOptions,
|
|
475
480
|
rowManager = _this$props8.rowManager,
|
|
481
|
+
pagination = _this$props8.pagination,
|
|
476
482
|
rest = _objectWithoutProperties(_this$props8, _excluded2);
|
|
477
483
|
|
|
478
484
|
var rowIndex = rest.rowIndex,
|
|
@@ -482,6 +488,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
482
488
|
var popoverIsOpen = this.isPopoverOpen();
|
|
483
489
|
var showCellActions = this.state.isFocused || this.state.isEntered || this.state.enableInteractions || popoverIsOpen;
|
|
484
490
|
var cellClasses = classNames('euiDataGridRowCell', (_classNames = {}, _defineProperty(_classNames, "euiDataGridRowCell--".concat(columnType), columnType), _defineProperty(_classNames, 'euiDataGridRowCell--open', popoverIsOpen), _classNames), className);
|
|
491
|
+
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
485
492
|
|
|
486
493
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
487
494
|
_ = _this$state$cellProps2.isExpandable,
|
|
@@ -590,7 +597,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
590
597
|
setCellContentsRef: this.setCellContentsRef,
|
|
591
598
|
rowHeightsOptions: rowHeightsOptions,
|
|
592
599
|
rowHeightUtils: rowHeightUtils,
|
|
593
|
-
isDefinedHeight: isDefinedHeight
|
|
600
|
+
isDefinedHeight: isDefinedHeight,
|
|
601
|
+
ariaRowIndex: ariaRowIndex
|
|
594
602
|
});
|
|
595
603
|
|
|
596
604
|
var anchorClass = 'euiDataGridRowCell__expandFlex';
|
|
@@ -637,6 +645,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
637
645
|
|
|
638
646
|
var content = ___EmotionJSX("div", _extends({
|
|
639
647
|
role: "gridcell",
|
|
648
|
+
"aria-rowindex": ariaRowIndex,
|
|
640
649
|
tabIndex: this.state.isFocused && !this.state.disableCellTabIndex ? 0 : -1,
|
|
641
650
|
ref: this.cellRef
|
|
642
651
|
}, cellProps, {
|
|
@@ -233,6 +233,7 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
233
233
|
|
|
234
234
|
useImperativeGridRef({
|
|
235
235
|
ref: ref,
|
|
236
|
+
gridRef: gridRef,
|
|
236
237
|
setIsFullScreen: setIsFullScreen,
|
|
237
238
|
focusContext: focusContext,
|
|
238
239
|
cellPopoverContext: cellPopoverContext,
|
|
@@ -336,6 +337,7 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
336
337
|
"data-test-subj": "euiDataGridBody",
|
|
337
338
|
className: "euiDataGrid__content",
|
|
338
339
|
role: "grid",
|
|
340
|
+
"aria-rowcount": rowCount,
|
|
339
341
|
id: gridId
|
|
340
342
|
}, wrappingDivFocusProps, gridAriaProps), ___EmotionJSX(EuiDataGridBody, {
|
|
341
343
|
columns: orderedVisibleColumns,
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { useImperativeHandle, useCallback } from 'react';
|
|
9
9
|
export var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
10
10
|
var ref = _ref.ref,
|
|
11
|
+
gridRef = _ref.gridRef,
|
|
11
12
|
setIsFullScreen = _ref.setIsFullScreen,
|
|
12
13
|
focusContext = _ref.focusContext,
|
|
13
14
|
cellPopoverContext = _ref.cellPopoverContext,
|
|
@@ -62,16 +63,36 @@ export var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
|
62
63
|
rowIndex: visibleRowIndex,
|
|
63
64
|
colIndex: colIndex
|
|
64
65
|
});
|
|
65
|
-
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
66
|
+
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
67
|
+
var scrollTo = useCallback(function () {
|
|
68
|
+
var _gridRef$current;
|
|
69
|
+
|
|
70
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
71
|
+
args[_key] = arguments[_key];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.scrollTo.apply(_gridRef$current, args);
|
|
75
|
+
}, [gridRef]);
|
|
76
|
+
var scrollToItem = useCallback(function () {
|
|
77
|
+
var _gridRef$current2;
|
|
78
|
+
|
|
79
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
80
|
+
args[_key2] = arguments[_key2];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.scrollToItem.apply(_gridRef$current2, args);
|
|
84
|
+
}, [gridRef]); // Set the ref APIs
|
|
66
85
|
|
|
67
86
|
useImperativeHandle(ref, function () {
|
|
68
87
|
return {
|
|
69
88
|
setIsFullScreen: setIsFullScreen,
|
|
70
89
|
setFocusedCell: setFocusedCell,
|
|
71
90
|
openCellPopover: openCellPopover,
|
|
72
|
-
closeCellPopover: closeCellPopover
|
|
91
|
+
closeCellPopover: closeCellPopover,
|
|
92
|
+
scrollTo: scrollTo,
|
|
93
|
+
scrollToItem: scrollToItem
|
|
73
94
|
};
|
|
74
|
-
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover]);
|
|
95
|
+
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover, scrollTo, scrollToItem]);
|
|
75
96
|
};
|
|
76
97
|
/**
|
|
77
98
|
* Throw a digestible error if the consumer attempts to focus into an invalid
|
|
@@ -152,6 +152,8 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
|
|
|
152
152
|
event.stopPropagation();
|
|
153
153
|
|
|
154
154
|
if (_this.state.activeOptionIndex != null && optionsList) {
|
|
155
|
+
event.persist(); // NOTE: This is needed for React v16 backwards compatibility
|
|
156
|
+
|
|
155
157
|
optionsList.onAddOrRemoveOption(_this.state.visibleOptions[_this.state.activeOptionIndex], event);
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -120,6 +120,12 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
120
120
|
_this.childContent = node;
|
|
121
121
|
});
|
|
122
122
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "generatedId", (0, _services.htmlIdGenerator)()());
|
|
123
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resizeRef", function () {});
|
|
124
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "observerRef", function (ref) {
|
|
125
|
+
_this.setChildContentRef(ref);
|
|
126
|
+
|
|
127
|
+
_this.resizeRef(ref);
|
|
128
|
+
});
|
|
123
129
|
return _this;
|
|
124
130
|
}
|
|
125
131
|
|
|
@@ -269,12 +275,9 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
269
275
|
}, (0, _react2.jsx)(_resize_observer.EuiResizeObserver, {
|
|
270
276
|
onResize: this.setChildContentHeight
|
|
271
277
|
}, function (resizeRef) {
|
|
278
|
+
_this2.resizeRef = resizeRef;
|
|
272
279
|
return (0, _react2.jsx)("div", {
|
|
273
|
-
ref:
|
|
274
|
-
_this2.setChildContentRef(_ref);
|
|
275
|
-
|
|
276
|
-
resizeRef(_ref);
|
|
277
|
-
}
|
|
280
|
+
ref: _this2.observerRef
|
|
278
281
|
}, (0, _react2.jsx)("div", {
|
|
279
282
|
className: childrenClasses,
|
|
280
283
|
css: cssChildrenStyles
|
|
@@ -82,7 +82,8 @@ var Cell = function Cell(_ref) {
|
|
|
82
82
|
schemaDetectors = data.schemaDetectors,
|
|
83
83
|
rowHeightsOptions = data.rowHeightsOptions,
|
|
84
84
|
rowHeightUtils = data.rowHeightUtils,
|
|
85
|
-
rowManager = data.rowManager
|
|
85
|
+
rowManager = data.rowManager,
|
|
86
|
+
pagination = data.pagination;
|
|
86
87
|
var popoverContext = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext);
|
|
87
88
|
|
|
88
89
|
var _useContext = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
@@ -121,7 +122,8 @@ var Cell = function Cell(_ref) {
|
|
|
121
122
|
rowHeightUtils: rowHeightUtils,
|
|
122
123
|
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
123
124
|
rowManager: rowManager,
|
|
124
|
-
popoverContext: popoverContext
|
|
125
|
+
popoverContext: popoverContext,
|
|
126
|
+
pagination: pagination
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
if (isLeadingControlColumn) {
|
|
@@ -449,7 +451,8 @@ var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
|
449
451
|
interactiveCellId: interactiveCellId,
|
|
450
452
|
rowHeightsOptions: rowHeightsOptions,
|
|
451
453
|
rowHeightUtils: rowHeightUtils,
|
|
452
|
-
rowManager: rowManager
|
|
454
|
+
rowManager: rowManager,
|
|
455
|
+
pagination: pagination
|
|
453
456
|
},
|
|
454
457
|
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
455
458
|
}), Cell), scrollBorderOverlay) : null;
|
|
@@ -55,8 +55,8 @@ var _utils = require("../../../utils");
|
|
|
55
55
|
|
|
56
56
|
var _react2 = require("@emotion/react");
|
|
57
57
|
|
|
58
|
-
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
59
|
-
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager"],
|
|
58
|
+
var _excluded = ["renderCellValue", "column", "setCellContentsRef", "rowHeightsOptions", "rowIndex", "colIndex", "ariaRowIndex", "rowHeightUtils", "isDefinedHeight"],
|
|
59
|
+
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
60
60
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"];
|
|
61
61
|
|
|
62
62
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -78,15 +78,12 @@ var EuiDataGridCellContent = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
78
78
|
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
79
79
|
rowIndex = _ref.rowIndex,
|
|
80
80
|
colIndex = _ref.colIndex,
|
|
81
|
+
ariaRowIndex = _ref.ariaRowIndex,
|
|
81
82
|
rowHeightUtils = _ref.rowHeightUtils,
|
|
82
83
|
isDefinedHeight = _ref.isDefinedHeight,
|
|
83
84
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
84
85
|
// React is more permissible than the TS types indicate
|
|
85
86
|
var CellElement = renderCellValue;
|
|
86
|
-
var positionText = (0, _i18n.useEuiI18n)('euiDataGridCell.position', 'Row: {row}; Column: {col}', {
|
|
87
|
-
row: rowIndex + 1,
|
|
88
|
-
col: colIndex + 1
|
|
89
|
-
});
|
|
90
87
|
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", {
|
|
91
88
|
ref: setCellContentsRef,
|
|
92
89
|
"data-datagrid-cellcontent": true,
|
|
@@ -98,7 +95,15 @@ var EuiDataGridCellContent = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
98
95
|
rowIndex: rowIndex,
|
|
99
96
|
colIndex: colIndex,
|
|
100
97
|
schema: (column === null || column === void 0 ? void 0 : column.schema) || rest.columnType
|
|
101
|
-
}, rest))), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null,
|
|
98
|
+
}, rest))), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", null, '- ', (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
99
|
+
token: "euiDataGridCell.position",
|
|
100
|
+
default: "{columnId}, column {col}, row {row}",
|
|
101
|
+
values: {
|
|
102
|
+
columnId: (column === null || column === void 0 ? void 0 : column.displayAsText) || rest.columnId,
|
|
103
|
+
col: colIndex + 1,
|
|
104
|
+
row: ariaRowIndex
|
|
105
|
+
}
|
|
106
|
+
}))));
|
|
102
107
|
});
|
|
103
108
|
|
|
104
109
|
var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
@@ -478,6 +483,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
478
483
|
rowHeightUtils = _this$props8.rowHeightUtils,
|
|
479
484
|
rowHeightsOptions = _this$props8.rowHeightsOptions,
|
|
480
485
|
rowManager = _this$props8.rowManager,
|
|
486
|
+
pagination = _this$props8.pagination,
|
|
481
487
|
rest = (0, _objectWithoutProperties2.default)(_this$props8, _excluded2);
|
|
482
488
|
var rowIndex = rest.rowIndex,
|
|
483
489
|
visibleRowIndex = rest.visibleRowIndex,
|
|
@@ -486,6 +492,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
486
492
|
var popoverIsOpen = this.isPopoverOpen();
|
|
487
493
|
var showCellActions = this.state.isFocused || this.state.isEntered || this.state.enableInteractions || popoverIsOpen;
|
|
488
494
|
var cellClasses = (0, _classnames.default)('euiDataGridRowCell', (_classNames = {}, (0, _defineProperty2.default)(_classNames, "euiDataGridRowCell--".concat(columnType), columnType), (0, _defineProperty2.default)(_classNames, 'euiDataGridRowCell--open', popoverIsOpen), _classNames), className);
|
|
495
|
+
var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
|
|
489
496
|
var _this$state$cellProps2 = this.state.cellProps,
|
|
490
497
|
_ = _this$state$cellProps2.isExpandable,
|
|
491
498
|
cellPropsStyle = _this$state$cellProps2.style,
|
|
@@ -593,7 +600,8 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
593
600
|
setCellContentsRef: this.setCellContentsRef,
|
|
594
601
|
rowHeightsOptions: rowHeightsOptions,
|
|
595
602
|
rowHeightUtils: rowHeightUtils,
|
|
596
|
-
isDefinedHeight: isDefinedHeight
|
|
603
|
+
isDefinedHeight: isDefinedHeight,
|
|
604
|
+
ariaRowIndex: ariaRowIndex
|
|
597
605
|
});
|
|
598
606
|
|
|
599
607
|
var anchorClass = 'euiDataGridRowCell__expandFlex';
|
|
@@ -639,6 +647,7 @@ var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
639
647
|
|
|
640
648
|
var content = (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
641
649
|
role: "gridcell",
|
|
650
|
+
"aria-rowindex": ariaRowIndex,
|
|
642
651
|
tabIndex: this.state.isFocused && !this.state.disableCellTabIndex ? 0 : -1,
|
|
643
652
|
ref: this.cellRef
|
|
644
653
|
}, cellProps, {
|
|
@@ -264,6 +264,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
264
264
|
|
|
265
265
|
(0, _ref.useImperativeGridRef)({
|
|
266
266
|
ref: ref,
|
|
267
|
+
gridRef: gridRef,
|
|
267
268
|
setIsFullScreen: setIsFullScreen,
|
|
268
269
|
focusContext: focusContext,
|
|
269
270
|
cellPopoverContext: cellPopoverContext,
|
|
@@ -367,6 +368,7 @@ var EuiDataGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
367
368
|
"data-test-subj": "euiDataGridBody",
|
|
368
369
|
className: "euiDataGrid__content",
|
|
369
370
|
role: "grid",
|
|
371
|
+
"aria-rowcount": rowCount,
|
|
370
372
|
id: gridId
|
|
371
373
|
}, wrappingDivFocusProps, gridAriaProps), (0, _react2.jsx)(_body.EuiDataGridBody, {
|
|
372
374
|
columns: orderedVisibleColumns,
|
|
@@ -16,6 +16,7 @@ var _react = require("react");
|
|
|
16
16
|
*/
|
|
17
17
|
var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
18
18
|
var ref = _ref.ref,
|
|
19
|
+
gridRef = _ref.gridRef,
|
|
19
20
|
setIsFullScreen = _ref.setIsFullScreen,
|
|
20
21
|
focusContext = _ref.focusContext,
|
|
21
22
|
cellPopoverContext = _ref.cellPopoverContext,
|
|
@@ -70,16 +71,36 @@ var useImperativeGridRef = function useImperativeGridRef(_ref) {
|
|
|
70
71
|
rowIndex: visibleRowIndex,
|
|
71
72
|
colIndex: colIndex
|
|
72
73
|
});
|
|
73
|
-
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
74
|
+
}, [_openCellPopover, checkCellExists, findVisibleRowIndex]);
|
|
75
|
+
var scrollTo = (0, _react.useCallback)(function () {
|
|
76
|
+
var _gridRef$current;
|
|
77
|
+
|
|
78
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
79
|
+
args[_key] = arguments[_key];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return (_gridRef$current = gridRef.current) === null || _gridRef$current === void 0 ? void 0 : _gridRef$current.scrollTo.apply(_gridRef$current, args);
|
|
83
|
+
}, [gridRef]);
|
|
84
|
+
var scrollToItem = (0, _react.useCallback)(function () {
|
|
85
|
+
var _gridRef$current2;
|
|
86
|
+
|
|
87
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
88
|
+
args[_key2] = arguments[_key2];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (_gridRef$current2 = gridRef.current) === null || _gridRef$current2 === void 0 ? void 0 : _gridRef$current2.scrollToItem.apply(_gridRef$current2, args);
|
|
92
|
+
}, [gridRef]); // Set the ref APIs
|
|
74
93
|
|
|
75
94
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
76
95
|
return {
|
|
77
96
|
setIsFullScreen: setIsFullScreen,
|
|
78
97
|
setFocusedCell: setFocusedCell,
|
|
79
98
|
openCellPopover: openCellPopover,
|
|
80
|
-
closeCellPopover: closeCellPopover
|
|
99
|
+
closeCellPopover: closeCellPopover,
|
|
100
|
+
scrollTo: scrollTo,
|
|
101
|
+
scrollToItem: scrollToItem
|
|
81
102
|
};
|
|
82
|
-
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover]);
|
|
103
|
+
}, [setIsFullScreen, setFocusedCell, openCellPopover, closeCellPopover, scrollTo, scrollToItem]);
|
|
83
104
|
};
|
|
84
105
|
/**
|
|
85
106
|
* Throw a digestible error if the consumer attempts to focus into an invalid
|