@elastic/eui 76.0.2 → 76.2.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.
Files changed (107) hide show
  1. package/dist/eui_theme_dark.css +37 -6
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +37 -6
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  6. package/es/components/datagrid/body/data_grid_body.js +19 -395
  7. package/es/components/datagrid/body/data_grid_body_custom.js +908 -0
  8. package/es/components/datagrid/body/data_grid_body_virtualized.js +1031 -0
  9. package/es/components/datagrid/body/data_grid_cell.js +16 -12
  10. package/es/components/datagrid/body/data_grid_cell_popover.js +32 -12
  11. package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
  12. package/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
  13. package/es/components/datagrid/data_grid.js +21 -5
  14. package/es/components/datagrid/data_grid_types.js +18 -1
  15. package/es/components/datagrid/utils/row_heights.js +111 -31
  16. package/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  17. package/es/components/form/range/dual_range.js +14 -7
  18. package/es/components/form/range/range.js +10 -3
  19. package/es/components/form/super_select/super_select.js +21 -18
  20. package/es/components/form/super_select/super_select_control.js +7 -14
  21. package/es/components/selectable/selectable.js +59 -36
  22. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  23. package/es/components/suggest/suggest.js +3 -10
  24. package/eui.d.ts +253 -146
  25. package/i18ntokens.json +89 -57
  26. package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  27. package/lib/components/datagrid/body/data_grid_body.js +19 -416
  28. package/lib/components/datagrid/body/data_grid_body_custom.js +927 -0
  29. package/lib/components/datagrid/body/data_grid_body_virtualized.js +1059 -0
  30. package/lib/components/datagrid/body/data_grid_cell.js +16 -12
  31. package/lib/components/datagrid/body/data_grid_cell_popover.js +35 -12
  32. package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
  33. package/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
  34. package/lib/components/datagrid/data_grid.js +21 -4
  35. package/lib/components/datagrid/data_grid_types.js +22 -1
  36. package/lib/components/datagrid/utils/row_heights.js +116 -33
  37. package/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  38. package/lib/components/form/range/dual_range.js +14 -7
  39. package/lib/components/form/range/range.js +10 -3
  40. package/lib/components/form/super_select/super_select.js +21 -18
  41. package/lib/components/form/super_select/super_select_control.js +7 -16
  42. package/lib/components/selectable/selectable.js +59 -36
  43. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  44. package/lib/components/suggest/suggest.js +3 -12
  45. package/optimize/es/components/datagrid/body/data_grid_body.js +17 -387
  46. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +176 -0
  47. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +311 -0
  48. package/optimize/es/components/datagrid/body/data_grid_cell.js +12 -9
  49. package/optimize/es/components/datagrid/body/data_grid_cell_popover.js +30 -12
  50. package/optimize/es/components/datagrid/body/data_grid_cell_wrapper.js +127 -0
  51. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
  52. package/optimize/es/components/datagrid/data_grid.js +8 -5
  53. package/optimize/es/components/datagrid/data_grid_types.js +18 -1
  54. package/optimize/es/components/datagrid/utils/row_heights.js +100 -31
  55. package/optimize/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  56. package/optimize/es/components/form/range/dual_range.js +14 -7
  57. package/optimize/es/components/form/range/range.js +10 -3
  58. package/optimize/es/components/form/super_select/super_select.js +16 -12
  59. package/optimize/es/components/form/super_select/super_select_control.js +7 -14
  60. package/optimize/es/components/selectable/selectable.js +50 -34
  61. package/optimize/es/components/selectable/selectable_list/selectable_list.js +1 -1
  62. package/optimize/es/components/suggest/suggest.js +3 -10
  63. package/optimize/lib/components/datagrid/body/data_grid_body.js +16 -409
  64. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +198 -0
  65. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +342 -0
  66. package/optimize/lib/components/datagrid/body/data_grid_cell.js +12 -9
  67. package/optimize/lib/components/datagrid/body/data_grid_cell_popover.js +33 -19
  68. package/optimize/lib/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  69. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
  70. package/optimize/lib/components/datagrid/data_grid.js +8 -4
  71. package/optimize/lib/components/datagrid/data_grid_types.js +22 -1
  72. package/optimize/lib/components/datagrid/utils/row_heights.js +103 -37
  73. package/optimize/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  74. package/optimize/lib/components/form/range/dual_range.js +14 -7
  75. package/optimize/lib/components/form/range/range.js +10 -3
  76. package/optimize/lib/components/form/super_select/super_select.js +16 -11
  77. package/optimize/lib/components/form/super_select/super_select_control.js +7 -16
  78. package/optimize/lib/components/selectable/selectable.js +50 -35
  79. package/optimize/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  80. package/optimize/lib/components/suggest/suggest.js +3 -12
  81. package/package.json +1 -1
  82. package/src/components/datagrid/_data_grid.scss +7 -0
  83. package/src/components/datagrid/_data_grid_data_row.scss +1 -0
  84. package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +1 -0
  85. package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -0
  86. package/src/components/form/super_select/_super_select_control.scss +4 -0
  87. package/src/components/selectable/selectable_list/_selectable_list.scss +10 -3
  88. package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
  89. package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
  90. package/test-env/components/datagrid/body/data_grid_body.js +18 -415
  91. package/test-env/components/datagrid/body/data_grid_body_custom.js +908 -0
  92. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1057 -0
  93. package/test-env/components/datagrid/body/data_grid_cell.js +16 -12
  94. package/test-env/components/datagrid/body/data_grid_cell_popover.js +33 -19
  95. package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
  96. package/test-env/components/datagrid/body/header/data_grid_header_row.js +4 -2
  97. package/test-env/components/datagrid/data_grid.js +21 -4
  98. package/test-env/components/datagrid/data_grid_types.js +22 -1
  99. package/test-env/components/datagrid/utils/row_heights.js +103 -37
  100. package/test-env/components/date_picker/auto_refresh/auto_refresh.js +2 -1
  101. package/test-env/components/form/range/dual_range.js +14 -7
  102. package/test-env/components/form/range/range.js +10 -3
  103. package/test-env/components/form/super_select/super_select.js +21 -17
  104. package/test-env/components/form/super_select/super_select_control.js +7 -16
  105. package/test-env/components/selectable/selectable.js +58 -36
  106. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  107. package/test-env/components/suggest/suggest.js +3 -12
@@ -123,6 +123,11 @@ EuiColorPalettePicker.propTypes = {
123
123
  readOnly: PropTypes.bool,
124
124
  name: PropTypes.string,
125
125
 
126
+ /**
127
+ * Placeholder to display when the current selected value is empty.
128
+ */
129
+ placeholder: PropTypes.node,
130
+
126
131
  /**
127
132
  * Creates an input group with element(s) coming before input.
128
133
  * `string` | `ReactElement` or an array of these
@@ -134,12 +139,6 @@ EuiColorPalettePicker.propTypes = {
134
139
  * `string` | `ReactElement` or an array of these
135
140
  */
136
141
  append: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.element.isRequired]).isRequired, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.element.isRequired]).isRequired).isRequired]),
137
-
138
- /**
139
- * Creates a semantic label ID for the `div[role="listbox"]` that's opened on click or keypress.
140
- * __Generated and passed down by `EuiSuperSelect`.__
141
- */
142
- screenReaderId: PropTypes.string,
143
142
  valueOfSelected: PropTypes.any,
144
143
 
145
144
  /**
@@ -1,18 +1,10 @@
1
- var _excluded = ["children", "style"];
2
-
3
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
-
5
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
1
+ var _excluded = ["renderCustomGridBody"];
6
2
 
7
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
8
4
 
9
- import PropTypes from "prop-types";
10
-
11
- 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; }
12
-
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
6
 
15
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
16
8
 
17
9
  /*
18
10
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -21,392 +13,23 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
21
13
  * in compliance with, at your election, the Elastic License 2.0 or the Server
22
14
  * Side Public License, v 1.
23
15
  */
24
- import classNames from 'classnames';
25
- import React, { forwardRef, createContext, useContext, useEffect, useRef } from 'react';
26
- import { VariableSizeGrid as Grid } from 'react-window';
27
- import { useResizeObserver } from '../../observer/resize_observer';
28
- import { EuiDataGridCell } from './data_grid_cell';
29
- import { useDataGridHeader } from './header';
30
- import { useDataGridFooter } from './footer';
31
- import { DataGridCellPopoverContext } from './data_grid_cell_popover';
32
- import { useRowManager } from './data_grid_row_manager';
33
- import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
34
- import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
35
- import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
36
- import { useScrollBars, useScroll } from '../utils/scrolling';
37
- import { DataGridSortingContext } from '../utils/sorting';
38
- import { IS_JEST_ENVIRONMENT } from '../../../utils';
16
+ import React from 'react';
17
+ import PropTypes from "prop-types";
18
+ import { EuiDataGridBodyVirtualized } from './data_grid_body_virtualized';
19
+ import { EuiDataGridBodyCustomRender } from './data_grid_body_custom';
39
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
40
- export var Cell = function Cell(_ref) {
41
- var columnIndex = _ref.columnIndex,
42
- visibleRowIndex = _ref.rowIndex,
43
- style = _ref.style,
44
- data = _ref.data;
45
- var leadingControlColumns = data.leadingControlColumns,
46
- trailingControlColumns = data.trailingControlColumns,
47
- columns = data.columns,
48
- visibleColCount = data.visibleColCount,
49
- schema = data.schema,
50
- columnWidths = data.columnWidths,
51
- defaultColumnWidth = data.defaultColumnWidth,
52
- renderCellValue = data.renderCellValue,
53
- renderCellPopover = data.renderCellPopover,
54
- interactiveCellId = data.interactiveCellId,
55
- setRowHeight = data.setRowHeight,
56
- schemaDetectors = data.schemaDetectors,
57
- rowHeightsOptions = data.rowHeightsOptions,
58
- rowHeightUtils = data.rowHeightUtils,
59
- rowManager = data.rowManager,
60
- pagination = data.pagination;
61
- var popoverContext = useContext(DataGridCellPopoverContext);
62
-
63
- var _useContext = useContext(DataGridWrapperRowsContext),
64
- headerRowHeight = _useContext.headerRowHeight;
65
-
66
- var _useContext2 = useContext(DataGridSortingContext),
67
- getCorrectRowIndex = _useContext2.getCorrectRowIndex;
68
-
69
- var cellContent;
70
- var isFirstColumn = columnIndex === 0;
71
- var isLastColumn = columnIndex === visibleColCount - 1;
72
- var isLeadingControlColumn = columnIndex < leadingControlColumns.length;
73
- var isTrailingControlColumn = columnIndex >= leadingControlColumns.length + columns.length;
74
- var dataColumnIndex = columnIndex - leadingControlColumns.length;
75
- var column = columns[dataColumnIndex];
76
- var columnId = column === null || column === void 0 ? void 0 : column.id;
77
- var transformClass = schemaDetectors.filter(function (row) {
78
- return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
79
- })[0];
80
- var textTransform = transformClass === null || transformClass === void 0 ? void 0 : transformClass.textTransform;
81
- var classes = classNames(_defineProperty({
82
- 'euiDataGridRowCell--firstColumn': isFirstColumn,
83
- 'euiDataGridRowCell--lastColumn': isLastColumn,
84
- 'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
85
- }, "euiDataGridRowCell--".concat(textTransform), textTransform));
86
- var sharedCellProps = {
87
- rowIndex: getCorrectRowIndex(visibleRowIndex),
88
- visibleRowIndex: visibleRowIndex,
89
- colIndex: columnIndex,
90
- interactiveCellId: interactiveCellId,
91
- className: classes,
92
- style: _objectSpread(_objectSpread({}, style), {}, {
93
- top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
94
- }),
95
- rowHeightsOptions: rowHeightsOptions,
96
- rowHeightUtils: rowHeightUtils,
97
- setRowHeight: isFirstColumn ? setRowHeight : undefined,
98
- rowManager: rowManager,
99
- popoverContext: popoverContext,
100
- pagination: pagination
101
- };
102
-
103
- if (isLeadingControlColumn) {
104
- var leadingColumn = leadingControlColumns[columnIndex];
105
- var id = leadingColumn.id,
106
- rowCellRender = leadingColumn.rowCellRender;
107
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
108
- columnId: id,
109
- width: leadingColumn.width,
110
- renderCellValue: rowCellRender,
111
- isExpandable: false
112
- }));
113
- } else if (isTrailingControlColumn) {
114
- var columnOffset = columns.length + leadingControlColumns.length;
115
- var trailingColumnIndex = columnIndex - columnOffset;
116
- var trailingColumn = trailingControlColumns[trailingColumnIndex];
117
- var _id = trailingColumn.id,
118
- _rowCellRender = trailingColumn.rowCellRender;
119
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
120
- columnId: _id,
121
- width: trailingColumn.width,
122
- renderCellValue: _rowCellRender,
123
- isExpandable: false
124
- }));
125
- } else {
126
- // this is a normal data cell
127
- var columnType = schema[columnId] ? schema[columnId].columnType : null;
128
- var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
129
- var width = columnWidths[columnId] || defaultColumnWidth;
130
- cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
131
- columnId: columnId,
132
- column: column,
133
- columnType: columnType,
134
- width: width || undefined,
135
- renderCellValue: renderCellValue,
136
- renderCellPopover: renderCellPopover,
137
- interactiveCellId: interactiveCellId,
138
- isExpandable: isExpandable
139
- }));
140
- }
141
-
142
- return cellContent;
143
- }; // Context is required to pass props to react-window's innerElementType
144
- // @see https://github.com/bvaughn/react-window/issues/404
145
-
146
- export var DataGridWrapperRowsContext = /*#__PURE__*/createContext({
147
- headerRow: ___EmotionJSX("div", null),
148
- headerRowHeight: 0,
149
- footerRow: null
150
- });
151
- var InnerElement = /*#__PURE__*/forwardRef(function (_ref2, ref) {
152
- var children = _ref2.children,
153
- style = _ref2.style,
154
- rest = _objectWithoutProperties(_ref2, _excluded);
155
-
156
- var _useContext3 = useContext(DataGridWrapperRowsContext),
157
- headerRowHeight = _useContext3.headerRowHeight,
158
- headerRow = _useContext3.headerRow,
159
- footerRow = _useContext3.footerRow;
160
-
161
- return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({
162
- ref: ref,
163
- style: _objectSpread(_objectSpread({}, style), {}, {
164
- height: style.height + headerRowHeight
165
- })
166
- }, rest), headerRow, children), footerRow);
167
- });
168
- InnerElement.propTypes = {
169
- style: PropTypes.shape({
170
- height: PropTypes.number.isRequired
171
- }).isRequired
172
- };
173
- InnerElement.displayName = 'EuiDataGridInnerElement';
174
- export var EuiDataGridBody = function EuiDataGridBody(props) {
175
- var leadingControlColumns = props.leadingControlColumns,
176
- trailingControlColumns = props.trailingControlColumns,
177
- columns = props.columns,
178
- visibleColCount = props.visibleColCount,
179
- schema = props.schema,
180
- schemaDetectors = props.schemaDetectors,
181
- rowCount = props.rowCount,
182
- _props$visibleRows = props.visibleRows,
183
- startRow = _props$visibleRows.startRow,
184
- endRow = _props$visibleRows.endRow,
185
- visibleRowCount = _props$visibleRows.visibleRowCount,
186
- renderCellValue = props.renderCellValue,
187
- renderCellPopover = props.renderCellPopover,
188
- renderFooterCellValue = props.renderFooterCellValue,
189
- interactiveCellId = props.interactiveCellId,
190
- pagination = props.pagination,
191
- headerIsInteractive = props.headerIsInteractive,
192
- handleHeaderMutation = props.handleHeaderMutation,
193
- setVisibleColumns = props.setVisibleColumns,
194
- switchColumnPos = props.switchColumnPos,
195
- onColumnResize = props.onColumnResize,
196
- rowHeightsOptions = props.rowHeightsOptions,
197
- virtualizationOptions = props.virtualizationOptions,
198
- isFullScreen = props.isFullScreen,
199
- gridStyles = props.gridStyles,
200
- gridWidth = props.gridWidth,
201
- gridRef = props.gridRef,
202
- gridItemsRendered = props.gridItemsRendered,
203
- wrapperRef = props.wrapperRef;
204
- /**
205
- * Grid refs & observers
21
+ export var EuiDataGridBody = function EuiDataGridBody(_ref) {
22
+ var renderCustomGridBody = _ref.renderCustomGridBody,
23
+ props = _objectWithoutProperties(_ref, _excluded);
24
+
25
+ /*
26
+ * Determine whether we should use the default EuiDataGridBody
27
+ * + virtualization library for rendering content, or if consumers have
28
+ * passed their own custom renderer
206
29
  */
207
-
208
- var wrapperDimensions = useResizeObserver(wrapperRef.current);
209
- var outerGridRef = useRef(null); // container that becomes scrollable
210
-
211
- var innerGridRef = useRef(null); // container sized to fit all content
212
-
213
- /**
214
- * Scroll bars
215
- */
216
-
217
- var _useScrollBars = useScrollBars(outerGridRef, gridStyles.border),
218
- scrollBarHeight = _useScrollBars.scrollBarHeight,
219
- hasVerticalScroll = _useScrollBars.hasVerticalScroll,
220
- hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
221
- scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
222
- /**
223
- * Widths
224
- */
225
-
226
-
227
- var virtualizeContainerWidth = useVirtualizeContainerWidth(outerGridRef.current, gridWidth, pagination === null || pagination === void 0 ? void 0 : pagination.pageSize); // compute the default column width from the container's width and count of visible columns
228
-
229
- var defaultColumnWidth = useDefaultColumnWidth(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
230
-
231
- var _useColumnWidths = useColumnWidths({
232
- columns: columns,
233
- leadingControlColumns: leadingControlColumns,
234
- trailingControlColumns: trailingControlColumns,
235
- defaultColumnWidth: defaultColumnWidth,
236
- onColumnResize: onColumnResize
237
- }),
238
- columnWidths = _useColumnWidths.columnWidths,
239
- setColumnWidth = _useColumnWidths.setColumnWidth,
240
- getColumnWidth = _useColumnWidths.getColumnWidth;
241
- /**
242
- * Header & footer
243
- */
244
-
245
-
246
- var _useDataGridHeader = useDataGridHeader({
247
- headerIsInteractive: headerIsInteractive,
248
- handleHeaderMutation: handleHeaderMutation,
249
- switchColumnPos: switchColumnPos,
250
- setVisibleColumns: setVisibleColumns,
251
- leadingControlColumns: leadingControlColumns,
252
- trailingControlColumns: trailingControlColumns,
253
- columns: columns,
254
- columnWidths: columnWidths,
255
- defaultColumnWidth: defaultColumnWidth,
256
- setColumnWidth: setColumnWidth,
257
- schema: schema,
258
- schemaDetectors: schemaDetectors
259
- }),
260
- headerRow = _useDataGridHeader.headerRow,
261
- headerRowHeight = _useDataGridHeader.headerRowHeight;
262
-
263
- var _useDataGridFooter = useDataGridFooter({
264
- renderFooterCellValue: renderFooterCellValue,
265
- renderCellPopover: renderCellPopover,
266
- rowIndex: visibleRowCount,
267
- visibleRowIndex: visibleRowCount,
268
- interactiveCellId: interactiveCellId,
269
- leadingControlColumns: leadingControlColumns,
270
- trailingControlColumns: trailingControlColumns,
271
- columns: columns,
272
- columnWidths: columnWidths,
273
- defaultColumnWidth: defaultColumnWidth,
274
- schema: schema
275
- }),
276
- footerRow = _useDataGridFooter.footerRow,
277
- footerRowHeight = _useDataGridFooter.footerRowHeight;
278
- /**
279
- * Handle scrolling cells fully into view
280
- */
281
-
282
-
283
- useScroll({
284
- gridRef: gridRef,
285
- outerGridRef: outerGridRef,
286
- hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
287
- headerRowHeight: headerRowHeight,
288
- footerRowHeight: footerRowHeight,
289
- visibleRowCount: visibleRowCount,
290
- hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
291
- });
292
- /**
293
- * Row manager
294
- */
295
-
296
- var rowManager = useRowManager({
297
- innerGridRef: innerGridRef,
298
- rowClasses: gridStyles.rowClasses
299
- });
300
- /**
301
- * Heights
302
- */
303
-
304
- var rowHeightUtils = useRowHeightUtils({
305
- gridRef: gridRef,
306
- outerGridElementRef: outerGridRef,
307
- gridItemsRenderedRef: gridItemsRendered,
308
- gridStyles: gridStyles,
309
- columns: columns,
310
- rowHeightsOptions: rowHeightsOptions
311
- });
312
-
313
- var _useDefaultRowHeight = useDefaultRowHeight({
314
- rowHeightsOptions: rowHeightsOptions,
315
- rowHeightUtils: rowHeightUtils
316
- }),
317
- defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
318
- setRowHeight = _useDefaultRowHeight.setRowHeight,
319
- getRowHeight = _useDefaultRowHeight.getRowHeight;
320
-
321
- var unconstrainedHeight = useUnconstrainedHeight({
322
- rowHeightUtils: rowHeightUtils,
323
- startRow: startRow,
324
- endRow: endRow,
325
- rowHeightsOptions: rowHeightsOptions,
326
- defaultRowHeight: defaultRowHeight,
327
- headerRowHeight: headerRowHeight,
328
- footerRowHeight: footerRowHeight,
329
- scrollBarHeight: scrollBarHeight,
330
- innerGridRef: innerGridRef
331
- });
332
- /**
333
- * Final grid height & width
334
- */
335
-
336
- var _useFinalGridDimensio = useFinalGridDimensions({
337
- unconstrainedHeight: unconstrainedHeight,
338
- unconstrainedWidth: 0,
339
- // unable to determine this until the container's size is known
340
- wrapperDimensions: wrapperDimensions,
341
- wrapperRef: wrapperRef,
342
- isFullScreen: isFullScreen,
343
- rowCount: rowCount
344
- }),
345
- finalWidth = _useFinalGridDimensio.finalWidth,
346
- finalHeight = _useFinalGridDimensio.finalHeight;
347
- /**
348
- * Grid resets
349
- */
350
-
351
-
352
- useEffect(function () {
353
- if (gridRef.current) {
354
- gridRef.current.resetAfterColumnIndex(0);
355
- }
356
- }, [gridRef, columns, columnWidths, defaultColumnWidth]);
357
- useEffect(function () {
358
- if (gridRef.current && rowHeightsOptions) {
359
- gridRef.current.resetAfterRowIndex(0);
360
- }
361
- }, [gridRef, pagination === null || pagination === void 0 ? void 0 : pagination.pageIndex, rowHeightsOptions, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.cellPadding, gridStyles === null || gridStyles === void 0 ? void 0 : gridStyles.fontSize]);
362
- useEffect(function () {
363
- if (gridRef.current) {
364
- gridRef.current.resetAfterRowIndex(0);
365
- }
366
- }, [gridRef, getRowHeight]);
367
- return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
368
- value: {
369
- headerRowHeight: headerRowHeight,
370
- headerRow: headerRow,
371
- footerRow: footerRow
372
- }
373
- }, ___EmotionJSX(Grid, _extends({}, virtualizationOptions ? virtualizationOptions : {}, {
374
- ref: gridRef,
375
- className: classNames('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
376
- onItemsRendered: function onItemsRendered(itemsRendered) {
377
- var _virtualizationOption;
378
-
379
- gridItemsRendered.current = itemsRendered;
380
- virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
381
- },
382
- innerElementType: InnerElement,
383
- outerRef: outerGridRef,
384
- innerRef: innerGridRef,
385
- columnCount: visibleColCount,
386
- width: finalWidth,
387
- columnWidth: getColumnWidth,
388
- height: finalHeight,
389
- rowHeight: getRowHeight,
390
- itemData: {
391
- schemaDetectors: schemaDetectors,
392
- setRowHeight: setRowHeight,
393
- leadingControlColumns: leadingControlColumns,
394
- trailingControlColumns: trailingControlColumns,
395
- columns: columns,
396
- visibleColCount: visibleColCount,
397
- schema: schema,
398
- columnWidths: columnWidths,
399
- defaultColumnWidth: defaultColumnWidth,
400
- renderCellValue: renderCellValue,
401
- renderCellPopover: renderCellPopover,
402
- interactiveCellId: interactiveCellId,
403
- rowHeightsOptions: rowHeightsOptions,
404
- rowHeightUtils: rowHeightUtils,
405
- rowManager: rowManager,
406
- pagination: pagination
407
- },
408
- rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
409
- }), Cell), scrollBorderOverlay) : null;
30
+ return renderCustomGridBody ? ___EmotionJSX(EuiDataGridBodyCustomRender, _extends({
31
+ renderCustomGridBody: renderCustomGridBody
32
+ }, props)) : ___EmotionJSX(EuiDataGridBodyVirtualized, props);
410
33
  };
411
34
  EuiDataGridBody.propTypes = {
412
35
  leadingControlColumns: PropTypes.arrayOf(PropTypes.shape({
@@ -985,6 +608,7 @@ EuiDataGridBody.propTypes = {
985
608
  renderCellValue: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.func.isRequired]).isRequired,
986
609
  renderCellPopover: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.func.isRequired]),
987
610
  renderFooterCellValue: PropTypes.oneOfType([PropTypes.func.isRequired, PropTypes.func.isRequired]),
611
+ renderCustomGridBody: PropTypes.func,
988
612
  interactiveCellId: PropTypes.string.isRequired,
989
613
  pagination: PropTypes.shape({
990
614
  /**