@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.
- package/dist/eui_theme_dark.css +37 -6
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +37 -6
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/es/components/datagrid/body/data_grid_body.js +19 -395
- package/es/components/datagrid/body/data_grid_body_custom.js +908 -0
- package/es/components/datagrid/body/data_grid_body_virtualized.js +1031 -0
- package/es/components/datagrid/body/data_grid_cell.js +16 -12
- package/es/components/datagrid/body/data_grid_cell_popover.js +32 -12
- package/es/components/datagrid/body/data_grid_cell_wrapper.js +132 -0
- package/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
- package/es/components/datagrid/data_grid.js +21 -5
- package/es/components/datagrid/data_grid_types.js +18 -1
- package/es/components/datagrid/utils/row_heights.js +111 -31
- package/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/es/components/form/range/dual_range.js +14 -7
- package/es/components/form/range/range.js +10 -3
- package/es/components/form/super_select/super_select.js +21 -18
- package/es/components/form/super_select/super_select_control.js +7 -14
- package/es/components/selectable/selectable.js +59 -36
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/suggest/suggest.js +3 -10
- package/eui.d.ts +253 -146
- package/i18ntokens.json +89 -57
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/lib/components/datagrid/body/data_grid_body.js +19 -416
- package/lib/components/datagrid/body/data_grid_body_custom.js +927 -0
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +1059 -0
- package/lib/components/datagrid/body/data_grid_cell.js +16 -12
- package/lib/components/datagrid/body/data_grid_cell_popover.js +35 -12
- package/lib/components/datagrid/body/data_grid_cell_wrapper.js +147 -0
- package/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/lib/components/datagrid/data_grid.js +21 -4
- package/lib/components/datagrid/data_grid_types.js +22 -1
- package/lib/components/datagrid/utils/row_heights.js +116 -33
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/lib/components/form/range/dual_range.js +14 -7
- package/lib/components/form/range/range.js +10 -3
- package/lib/components/form/super_select/super_select.js +21 -18
- package/lib/components/form/super_select/super_select_control.js +7 -16
- package/lib/components/selectable/selectable.js +59 -36
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/suggest/suggest.js +3 -12
- package/optimize/es/components/datagrid/body/data_grid_body.js +17 -387
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +176 -0
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +311 -0
- package/optimize/es/components/datagrid/body/data_grid_cell.js +12 -9
- package/optimize/es/components/datagrid/body/data_grid_cell_popover.js +30 -12
- package/optimize/es/components/datagrid/body/data_grid_cell_wrapper.js +127 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +3 -2
- package/optimize/es/components/datagrid/data_grid.js +8 -5
- package/optimize/es/components/datagrid/data_grid_types.js +18 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +100 -31
- package/optimize/es/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/optimize/es/components/form/range/dual_range.js +14 -7
- package/optimize/es/components/form/range/range.js +10 -3
- package/optimize/es/components/form/super_select/super_select.js +16 -12
- package/optimize/es/components/form/super_select/super_select_control.js +7 -14
- package/optimize/es/components/selectable/selectable.js +50 -34
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/es/components/suggest/suggest.js +3 -10
- package/optimize/lib/components/datagrid/body/data_grid_body.js +16 -409
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +198 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +342 -0
- package/optimize/lib/components/datagrid/body/data_grid_cell.js +12 -9
- package/optimize/lib/components/datagrid/body/data_grid_cell_popover.js +33 -19
- package/optimize/lib/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/optimize/lib/components/datagrid/data_grid.js +8 -4
- package/optimize/lib/components/datagrid/data_grid_types.js +22 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +103 -37
- package/optimize/lib/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/optimize/lib/components/form/range/dual_range.js +14 -7
- package/optimize/lib/components/form/range/range.js +10 -3
- package/optimize/lib/components/form/super_select/super_select.js +16 -11
- package/optimize/lib/components/form/super_select/super_select_control.js +7 -16
- package/optimize/lib/components/selectable/selectable.js +50 -35
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/lib/components/suggest/suggest.js +3 -12
- package/package.json +1 -1
- package/src/components/datagrid/_data_grid.scss +7 -0
- package/src/components/datagrid/_data_grid_data_row.scss +1 -0
- package/src/components/datagrid/body/footer/_data_grid_footer_row.scss +1 -0
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +1 -0
- package/src/components/form/super_select/_super_select_control.scss +4 -0
- package/src/components/selectable/selectable_list/_selectable_list.scss +10 -3
- package/src/themes/amsterdam/global_styling/mixins/_states.scss +17 -8
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +5 -6
- package/test-env/components/datagrid/body/data_grid_body.js +18 -415
- package/test-env/components/datagrid/body/data_grid_body_custom.js +908 -0
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +1057 -0
- package/test-env/components/datagrid/body/data_grid_cell.js +16 -12
- package/test-env/components/datagrid/body/data_grid_cell_popover.js +33 -19
- package/test-env/components/datagrid/body/data_grid_cell_wrapper.js +144 -0
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +4 -2
- package/test-env/components/datagrid/data_grid.js +21 -4
- package/test-env/components/datagrid/data_grid_types.js +22 -1
- package/test-env/components/datagrid/utils/row_heights.js +103 -37
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +2 -1
- package/test-env/components/form/range/dual_range.js +14 -7
- package/test-env/components/form/range/range.js +10 -3
- package/test-env/components/form/super_select/super_select.js +21 -17
- package/test-env/components/form/super_select/super_select_control.js +7 -16
- package/test-env/components/selectable/selectable.js +58 -36
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/suggest/suggest.js +3 -12
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["children", "style"];
|
|
5
|
+
|
|
6
|
+
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; }
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import React, { forwardRef, createContext, useContext, useEffect, useRef } from 'react';
|
|
19
|
+
import { VariableSizeGrid as Grid } from 'react-window';
|
|
20
|
+
import { useResizeObserver } from '../../observer/resize_observer';
|
|
21
|
+
import { useDataGridHeader } from './header';
|
|
22
|
+
import { useDataGridFooter } from './footer';
|
|
23
|
+
import { Cell } from './data_grid_cell_wrapper';
|
|
24
|
+
import { useRowManager } from './data_grid_row_manager';
|
|
25
|
+
import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
|
|
26
|
+
import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
|
|
27
|
+
import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
|
|
28
|
+
import { useScrollBars, useScroll } from '../utils/scrolling';
|
|
29
|
+
import { IS_JEST_ENVIRONMENT } from '../../../utils';
|
|
30
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
|
+
export var _Cell = function _Cell(_ref) {
|
|
32
|
+
var columnIndex = _ref.columnIndex,
|
|
33
|
+
rowIndex = _ref.rowIndex,
|
|
34
|
+
style = _ref.style,
|
|
35
|
+
data = _ref.data;
|
|
36
|
+
|
|
37
|
+
var _useContext = useContext(DataGridWrapperRowsContext),
|
|
38
|
+
headerRowHeight = _useContext.headerRowHeight;
|
|
39
|
+
|
|
40
|
+
return ___EmotionJSX(Cell, _extends({
|
|
41
|
+
colIndex: columnIndex,
|
|
42
|
+
visibleRowIndex: rowIndex,
|
|
43
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
44
|
+
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
45
|
+
})
|
|
46
|
+
}, data));
|
|
47
|
+
}; // Context is required to pass props to react-window's innerElementType
|
|
48
|
+
// @see https://github.com/bvaughn/react-window/issues/404
|
|
49
|
+
|
|
50
|
+
export var DataGridWrapperRowsContext = /*#__PURE__*/createContext({
|
|
51
|
+
headerRow: ___EmotionJSX("div", null),
|
|
52
|
+
headerRowHeight: 0,
|
|
53
|
+
footerRow: null
|
|
54
|
+
});
|
|
55
|
+
var InnerElement = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
56
|
+
var children = _ref2.children,
|
|
57
|
+
style = _ref2.style,
|
|
58
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
59
|
+
|
|
60
|
+
var _useContext2 = useContext(DataGridWrapperRowsContext),
|
|
61
|
+
headerRowHeight = _useContext2.headerRowHeight,
|
|
62
|
+
headerRow = _useContext2.headerRow,
|
|
63
|
+
footerRow = _useContext2.footerRow;
|
|
64
|
+
|
|
65
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({
|
|
66
|
+
ref: ref,
|
|
67
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
68
|
+
height: style.height + headerRowHeight
|
|
69
|
+
})
|
|
70
|
+
}, rest), headerRow, children), footerRow);
|
|
71
|
+
});
|
|
72
|
+
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
73
|
+
export var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref3) {
|
|
74
|
+
var leadingControlColumns = _ref3.leadingControlColumns,
|
|
75
|
+
trailingControlColumns = _ref3.trailingControlColumns,
|
|
76
|
+
columns = _ref3.columns,
|
|
77
|
+
visibleColCount = _ref3.visibleColCount,
|
|
78
|
+
schema = _ref3.schema,
|
|
79
|
+
schemaDetectors = _ref3.schemaDetectors,
|
|
80
|
+
rowCount = _ref3.rowCount,
|
|
81
|
+
_ref3$visibleRows = _ref3.visibleRows,
|
|
82
|
+
startRow = _ref3$visibleRows.startRow,
|
|
83
|
+
endRow = _ref3$visibleRows.endRow,
|
|
84
|
+
visibleRowCount = _ref3$visibleRows.visibleRowCount,
|
|
85
|
+
renderCellValue = _ref3.renderCellValue,
|
|
86
|
+
renderCellPopover = _ref3.renderCellPopover,
|
|
87
|
+
renderFooterCellValue = _ref3.renderFooterCellValue,
|
|
88
|
+
interactiveCellId = _ref3.interactiveCellId,
|
|
89
|
+
pagination = _ref3.pagination,
|
|
90
|
+
headerIsInteractive = _ref3.headerIsInteractive,
|
|
91
|
+
handleHeaderMutation = _ref3.handleHeaderMutation,
|
|
92
|
+
setVisibleColumns = _ref3.setVisibleColumns,
|
|
93
|
+
switchColumnPos = _ref3.switchColumnPos,
|
|
94
|
+
onColumnResize = _ref3.onColumnResize,
|
|
95
|
+
rowHeightsOptions = _ref3.rowHeightsOptions,
|
|
96
|
+
virtualizationOptions = _ref3.virtualizationOptions,
|
|
97
|
+
isFullScreen = _ref3.isFullScreen,
|
|
98
|
+
gridStyles = _ref3.gridStyles,
|
|
99
|
+
gridWidth = _ref3.gridWidth,
|
|
100
|
+
gridRef = _ref3.gridRef,
|
|
101
|
+
gridItemsRendered = _ref3.gridItemsRendered,
|
|
102
|
+
wrapperRef = _ref3.wrapperRef;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Grid refs & observers
|
|
106
|
+
*/
|
|
107
|
+
var wrapperDimensions = useResizeObserver(wrapperRef.current);
|
|
108
|
+
var outerGridRef = useRef(null); // container that becomes scrollable
|
|
109
|
+
|
|
110
|
+
var innerGridRef = useRef(null); // container sized to fit all content
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Scroll bars
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
var _useScrollBars = useScrollBars(outerGridRef, gridStyles.border),
|
|
117
|
+
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
118
|
+
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
119
|
+
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
120
|
+
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
121
|
+
/**
|
|
122
|
+
* Widths
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
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
|
|
127
|
+
|
|
128
|
+
var defaultColumnWidth = useDefaultColumnWidth(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
129
|
+
|
|
130
|
+
var _useColumnWidths = useColumnWidths({
|
|
131
|
+
columns: columns,
|
|
132
|
+
leadingControlColumns: leadingControlColumns,
|
|
133
|
+
trailingControlColumns: trailingControlColumns,
|
|
134
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
135
|
+
onColumnResize: onColumnResize
|
|
136
|
+
}),
|
|
137
|
+
columnWidths = _useColumnWidths.columnWidths,
|
|
138
|
+
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
139
|
+
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
140
|
+
/**
|
|
141
|
+
* Header & footer
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
var _useDataGridHeader = useDataGridHeader({
|
|
146
|
+
headerIsInteractive: headerIsInteractive,
|
|
147
|
+
handleHeaderMutation: handleHeaderMutation,
|
|
148
|
+
switchColumnPos: switchColumnPos,
|
|
149
|
+
setVisibleColumns: setVisibleColumns,
|
|
150
|
+
leadingControlColumns: leadingControlColumns,
|
|
151
|
+
trailingControlColumns: trailingControlColumns,
|
|
152
|
+
columns: columns,
|
|
153
|
+
columnWidths: columnWidths,
|
|
154
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
155
|
+
setColumnWidth: setColumnWidth,
|
|
156
|
+
schema: schema,
|
|
157
|
+
schemaDetectors: schemaDetectors
|
|
158
|
+
}),
|
|
159
|
+
headerRow = _useDataGridHeader.headerRow,
|
|
160
|
+
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
161
|
+
|
|
162
|
+
var _useDataGridFooter = useDataGridFooter({
|
|
163
|
+
renderFooterCellValue: renderFooterCellValue,
|
|
164
|
+
renderCellPopover: renderCellPopover,
|
|
165
|
+
rowIndex: visibleRowCount,
|
|
166
|
+
visibleRowIndex: visibleRowCount,
|
|
167
|
+
interactiveCellId: interactiveCellId,
|
|
168
|
+
leadingControlColumns: leadingControlColumns,
|
|
169
|
+
trailingControlColumns: trailingControlColumns,
|
|
170
|
+
columns: columns,
|
|
171
|
+
columnWidths: columnWidths,
|
|
172
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
173
|
+
schema: schema
|
|
174
|
+
}),
|
|
175
|
+
footerRow = _useDataGridFooter.footerRow,
|
|
176
|
+
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
177
|
+
/**
|
|
178
|
+
* Handle scrolling cells fully into view
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
useScroll({
|
|
183
|
+
gridRef: gridRef,
|
|
184
|
+
outerGridRef: outerGridRef,
|
|
185
|
+
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
186
|
+
headerRowHeight: headerRowHeight,
|
|
187
|
+
footerRowHeight: footerRowHeight,
|
|
188
|
+
visibleRowCount: visibleRowCount,
|
|
189
|
+
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
190
|
+
});
|
|
191
|
+
/**
|
|
192
|
+
* Row manager
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
var rowManager = useRowManager({
|
|
196
|
+
innerGridRef: innerGridRef,
|
|
197
|
+
rowClasses: gridStyles.rowClasses
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* Heights
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
var rowHeightUtils = useRowHeightUtils({
|
|
204
|
+
virtualization: {
|
|
205
|
+
gridRef: gridRef,
|
|
206
|
+
outerGridElementRef: outerGridRef,
|
|
207
|
+
gridItemsRenderedRef: gridItemsRendered
|
|
208
|
+
},
|
|
209
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
210
|
+
gridStyles: gridStyles,
|
|
211
|
+
columns: columns
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
215
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
216
|
+
rowHeightUtils: rowHeightUtils
|
|
217
|
+
}),
|
|
218
|
+
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
219
|
+
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
220
|
+
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
221
|
+
|
|
222
|
+
var unconstrainedHeight = useUnconstrainedHeight({
|
|
223
|
+
rowHeightUtils: rowHeightUtils,
|
|
224
|
+
startRow: startRow,
|
|
225
|
+
endRow: endRow,
|
|
226
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
227
|
+
defaultRowHeight: defaultRowHeight,
|
|
228
|
+
headerRowHeight: headerRowHeight,
|
|
229
|
+
footerRowHeight: footerRowHeight,
|
|
230
|
+
scrollBarHeight: scrollBarHeight,
|
|
231
|
+
innerGridRef: innerGridRef
|
|
232
|
+
});
|
|
233
|
+
/**
|
|
234
|
+
* Final grid height & width
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
var _useFinalGridDimensio = useFinalGridDimensions({
|
|
238
|
+
unconstrainedHeight: unconstrainedHeight,
|
|
239
|
+
unconstrainedWidth: 0,
|
|
240
|
+
// unable to determine this until the container's size is known
|
|
241
|
+
wrapperDimensions: wrapperDimensions,
|
|
242
|
+
wrapperRef: wrapperRef,
|
|
243
|
+
isFullScreen: isFullScreen,
|
|
244
|
+
rowCount: rowCount
|
|
245
|
+
}),
|
|
246
|
+
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
247
|
+
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
248
|
+
/**
|
|
249
|
+
* Grid resets
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
useEffect(function () {
|
|
254
|
+
if (gridRef.current) {
|
|
255
|
+
gridRef.current.resetAfterColumnIndex(0);
|
|
256
|
+
}
|
|
257
|
+
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
258
|
+
useEffect(function () {
|
|
259
|
+
if (gridRef.current && rowHeightsOptions) {
|
|
260
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
261
|
+
}
|
|
262
|
+
}, [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]);
|
|
263
|
+
useEffect(function () {
|
|
264
|
+
if (gridRef.current) {
|
|
265
|
+
gridRef.current.resetAfterRowIndex(0);
|
|
266
|
+
}
|
|
267
|
+
}, [gridRef, getRowHeight]);
|
|
268
|
+
return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
|
|
269
|
+
value: {
|
|
270
|
+
headerRowHeight: headerRowHeight,
|
|
271
|
+
headerRow: headerRow,
|
|
272
|
+
footerRow: footerRow
|
|
273
|
+
}
|
|
274
|
+
}, ___EmotionJSX(Grid, _extends({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
275
|
+
ref: gridRef,
|
|
276
|
+
className: classNames('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
277
|
+
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
278
|
+
var _virtualizationOption;
|
|
279
|
+
|
|
280
|
+
gridItemsRendered.current = itemsRendered;
|
|
281
|
+
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
282
|
+
},
|
|
283
|
+
innerElementType: InnerElement,
|
|
284
|
+
outerRef: outerGridRef,
|
|
285
|
+
innerRef: innerGridRef,
|
|
286
|
+
columnCount: visibleColCount,
|
|
287
|
+
width: finalWidth,
|
|
288
|
+
columnWidth: getColumnWidth,
|
|
289
|
+
height: finalHeight,
|
|
290
|
+
rowHeight: getRowHeight,
|
|
291
|
+
itemData: {
|
|
292
|
+
schemaDetectors: schemaDetectors,
|
|
293
|
+
setRowHeight: setRowHeight,
|
|
294
|
+
leadingControlColumns: leadingControlColumns,
|
|
295
|
+
trailingControlColumns: trailingControlColumns,
|
|
296
|
+
columns: columns,
|
|
297
|
+
visibleColCount: visibleColCount,
|
|
298
|
+
schema: schema,
|
|
299
|
+
columnWidths: columnWidths,
|
|
300
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
301
|
+
renderCellValue: renderCellValue,
|
|
302
|
+
renderCellPopover: renderCellPopover,
|
|
303
|
+
interactiveCellId: interactiveCellId,
|
|
304
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
305
|
+
rowHeightUtils: rowHeightUtils,
|
|
306
|
+
rowManager: rowManager,
|
|
307
|
+
pagination: pagination
|
|
308
|
+
},
|
|
309
|
+
rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
310
|
+
}), _Cell), scrollBorderOverlay) : null;
|
|
311
|
+
};
|
|
@@ -326,7 +326,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
326
326
|
if (_this.isPopoverOpen()) {
|
|
327
327
|
var _this$props$popoverCo2 = _this.props.popoverContext,
|
|
328
328
|
setPopoverAnchor = _this$props$popoverCo2.setPopoverAnchor,
|
|
329
|
-
setPopoverContent = _this$props$popoverCo2.setPopoverContent
|
|
329
|
+
setPopoverContent = _this$props$popoverCo2.setPopoverContent,
|
|
330
|
+
setCellPopoverProps = _this$props$popoverCo2.setCellPopoverProps; // Set popover anchor
|
|
330
331
|
|
|
331
332
|
var cellAnchorEl = _this.popoverAnchorRef.current;
|
|
332
333
|
setPopoverAnchor(cellAnchorEl); // Set popover contents with cell content
|
|
@@ -353,7 +354,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
353
354
|
cellActions: ___EmotionJSX(EuiDataGridCellPopoverActions, _extends({}, sharedProps, {
|
|
354
355
|
column: column
|
|
355
356
|
})),
|
|
356
|
-
DefaultCellPopover: DefaultCellPopover
|
|
357
|
+
DefaultCellPopover: DefaultCellPopover,
|
|
358
|
+
setCellPopoverProps: setCellPopoverProps
|
|
357
359
|
}), ___EmotionJSX(CellElement, _extends({}, sharedProps, {
|
|
358
360
|
setCellProps: _this.setCellProps,
|
|
359
361
|
isExpandable: true,
|
|
@@ -408,7 +410,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
408
410
|
}, {
|
|
409
411
|
key: "componentDidUpdate",
|
|
410
412
|
value: function componentDidUpdate(prevProps) {
|
|
411
|
-
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$style, _prevProps$style;
|
|
413
|
+
var _this$props$rowHeight, _prevProps$rowHeights, _this$props$rowHeight2, _this$props$rowHeight3, _this$props$style, _prevProps$style;
|
|
412
414
|
|
|
413
415
|
this.recalculateAutoHeight();
|
|
414
416
|
|
|
@@ -416,16 +418,17 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
416
418
|
this.recalculateLineHeight();
|
|
417
419
|
}
|
|
418
420
|
|
|
419
|
-
if ((_this$props$rowHeight2 = this.props.
|
|
421
|
+
if ((_this$props$rowHeight2 = this.props.rowHeightUtils) !== null && _this$props$rowHeight2 !== void 0 && _this$props$rowHeight2.compensateForLayoutShift && (_this$props$rowHeight3 = this.props.rowHeightsOptions) !== null && _this$props$rowHeight3 !== void 0 && _this$props$rowHeight3.scrollAnchorRow && this.props.colIndex === 0 && // once per row
|
|
420
422
|
this.props.columnId === prevProps.columnId && // if this is still the same column
|
|
421
423
|
this.props.rowIndex === prevProps.rowIndex && // if this is still the same row
|
|
422
424
|
((_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.top) !== ((_prevProps$style = prevProps.style) === null || _prevProps$style === void 0 ? void 0 : _prevProps$style.top) // if the top position has changed
|
|
423
425
|
) {
|
|
424
|
-
var _prevProps$style2, _this$props$style2, _this$props$
|
|
426
|
+
var _prevProps$style2, _this$props$style2, _this$props$rowHeight4;
|
|
425
427
|
|
|
426
428
|
var previousTop = parseFloat((_prevProps$style2 = prevProps.style) === null || _prevProps$style2 === void 0 ? void 0 : _prevProps$style2.top);
|
|
427
|
-
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top);
|
|
428
|
-
|
|
429
|
+
var currentTop = parseFloat((_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.top); // @ts-ignore We've already checked that this virtualization util is available above
|
|
430
|
+
|
|
431
|
+
this.props.rowHeightUtils.compensateForLayoutShift(this.props.rowIndex, currentTop - previousTop, (_this$props$rowHeight4 = this.props.rowHeightsOptions) === null || _this$props$rowHeight4 === void 0 ? void 0 : _this$props$rowHeight4.scrollAnchorRow);
|
|
429
432
|
}
|
|
430
433
|
|
|
431
434
|
if (this.props.popoverContext.popoverIsOpen !== prevProps.popoverContext.popoverIsOpen || this.props.popoverContext.cellLocation !== prevProps.popoverContext.cellLocation || this.props.renderCellPopover !== prevProps.renderCellPopover) {
|
|
@@ -515,8 +518,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
515
518
|
});
|
|
516
519
|
|
|
517
520
|
cellProps.style = _objectSpread(_objectSpread({}, style), {}, {
|
|
518
|
-
//
|
|
519
|
-
top: 0,
|
|
521
|
+
// set by react-window or the custom renderer
|
|
522
|
+
top: style !== null && style !== void 0 && style.top ? 0 : undefined,
|
|
520
523
|
// The cell's row will handle top positioning
|
|
521
524
|
width: width,
|
|
522
525
|
// column width, can be undefined
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
4
|
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
3
9
|
/*
|
|
4
10
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
11
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -8,6 +14,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
14
|
* Side Public License, v 1.
|
|
9
15
|
*/
|
|
10
16
|
import React, { createContext, useState, useCallback } from 'react';
|
|
17
|
+
import classNames from 'classnames';
|
|
11
18
|
import { keys } from '../../../services';
|
|
12
19
|
import { EuiWrappingPopover } from '../../popover';
|
|
13
20
|
export var DataGridCellPopoverContext = /*#__PURE__*/createContext({
|
|
@@ -19,9 +26,12 @@ export var DataGridCellPopoverContext = /*#__PURE__*/createContext({
|
|
|
19
26
|
openCellPopover: function openCellPopover() {},
|
|
20
27
|
closeCellPopover: function closeCellPopover() {},
|
|
21
28
|
setPopoverAnchor: function setPopoverAnchor() {},
|
|
22
|
-
setPopoverContent: function setPopoverContent() {}
|
|
29
|
+
setPopoverContent: function setPopoverContent() {},
|
|
30
|
+
setCellPopoverProps: function setCellPopoverProps() {}
|
|
23
31
|
});
|
|
24
32
|
export var useCellPopover = function useCellPopover() {
|
|
33
|
+
var _cellPopoverProps$pan;
|
|
34
|
+
|
|
25
35
|
// Current open state & cell location are handled here
|
|
26
36
|
var _useState = useState(false),
|
|
27
37
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -45,7 +55,13 @@ export var useCellPopover = function useCellPopover() {
|
|
|
45
55
|
var _useState7 = useState(),
|
|
46
56
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
47
57
|
popoverContent = _useState8[0],
|
|
48
|
-
setPopoverContent = _useState8[1];
|
|
58
|
+
setPopoverContent = _useState8[1]; // Allow customization of most (not all) popover props by consumers
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var _useState9 = useState({}),
|
|
62
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
63
|
+
cellPopoverProps = _useState10[0],
|
|
64
|
+
setCellPopoverProps = _useState10[1];
|
|
49
65
|
|
|
50
66
|
var closeCellPopover = useCallback(function () {
|
|
51
67
|
return setPopoverIsOpen(false);
|
|
@@ -75,20 +91,20 @@ export var useCellPopover = function useCellPopover() {
|
|
|
75
91
|
openCellPopover: openCellPopover,
|
|
76
92
|
cellLocation: cellLocation,
|
|
77
93
|
setPopoverAnchor: setPopoverAnchor,
|
|
78
|
-
setPopoverContent: setPopoverContent
|
|
94
|
+
setPopoverContent: setPopoverContent,
|
|
95
|
+
setCellPopoverProps: setCellPopoverProps
|
|
79
96
|
}; // Note that this popover is rendered once at the top grid level, rather than one popover per cell
|
|
80
97
|
|
|
81
|
-
var cellPopover = popoverIsOpen && popoverAnchor && ___EmotionJSX(EuiWrappingPopover, {
|
|
98
|
+
var cellPopover = popoverIsOpen && popoverAnchor && ___EmotionJSX(EuiWrappingPopover, _extends({
|
|
82
99
|
isOpen: popoverIsOpen,
|
|
83
|
-
button: popoverAnchor,
|
|
84
100
|
display: "block",
|
|
85
101
|
hasArrow: false,
|
|
86
|
-
panelPaddingSize: "s"
|
|
87
|
-
|
|
88
|
-
panelProps: {
|
|
102
|
+
panelPaddingSize: "s"
|
|
103
|
+
}, cellPopoverProps, {
|
|
104
|
+
panelProps: _objectSpread({
|
|
89
105
|
'data-test-subj': 'euiDataGridExpansionPopover'
|
|
90
|
-
},
|
|
91
|
-
|
|
106
|
+
}, cellPopoverProps.panelProps || {}),
|
|
107
|
+
panelClassName: classNames('euiDataGridRowCell__popover', cellPopoverProps.panelClassName, (_cellPopoverProps$pan = cellPopoverProps.panelProps) === null || _cellPopoverProps$pan === void 0 ? void 0 : _cellPopoverProps$pan.className),
|
|
92
108
|
onKeyDown: function onKeyDown(event) {
|
|
93
109
|
if (event.key === keys.F2 || event.key === keys.ESCAPE) {
|
|
94
110
|
event.preventDefault();
|
|
@@ -99,8 +115,10 @@ export var useCellPopover = function useCellPopover() {
|
|
|
99
115
|
return popoverAnchor.parentElement.focus();
|
|
100
116
|
});
|
|
101
117
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
118
|
+
},
|
|
119
|
+
button: popoverAnchor,
|
|
120
|
+
closePopover: closeCellPopover
|
|
121
|
+
}), popoverContent);
|
|
104
122
|
|
|
105
123
|
return {
|
|
106
124
|
cellPopoverContext: cellPopoverContext,
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["colIndex", "visibleRowIndex", "style", "schema", "schemaDetectors", "pagination", "columns", "leadingControlColumns", "trailingControlColumns", "visibleColCount", "columnWidths", "defaultColumnWidth", "renderCellValue", "renderCellPopover", "interactiveCellId", "setRowHeight", "rowHeightsOptions", "rowHeightUtils", "rowManager"];
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
8
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
9
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
10
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
11
|
+
* Side Public License, v 1.
|
|
12
|
+
*/
|
|
13
|
+
import React, { useContext, useMemo } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { DataGridSortingContext } from '../utils/sorting';
|
|
16
|
+
import { DataGridCellPopoverContext } from './data_grid_cell_popover';
|
|
17
|
+
import { EuiDataGridCell } from './data_grid_cell';
|
|
18
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A DRY wrapper used by both custom and virtualized grid cells.
|
|
22
|
+
* It grabs context, determines the type of cell being rendered
|
|
23
|
+
* (e.g. control vs data cell), & sets shared props between all cells
|
|
24
|
+
*/
|
|
25
|
+
export var Cell = function Cell(_ref) {
|
|
26
|
+
var colIndex = _ref.colIndex,
|
|
27
|
+
visibleRowIndex = _ref.visibleRowIndex,
|
|
28
|
+
style = _ref.style,
|
|
29
|
+
schema = _ref.schema,
|
|
30
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
31
|
+
pagination = _ref.pagination,
|
|
32
|
+
columns = _ref.columns,
|
|
33
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
34
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
35
|
+
visibleColCount = _ref.visibleColCount,
|
|
36
|
+
columnWidths = _ref.columnWidths,
|
|
37
|
+
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
38
|
+
renderCellValue = _ref.renderCellValue,
|
|
39
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
40
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
41
|
+
setRowHeight = _ref.setRowHeight,
|
|
42
|
+
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
43
|
+
rowHeightUtils = _ref.rowHeightUtils,
|
|
44
|
+
rowManager = _ref.rowManager,
|
|
45
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
|
|
47
|
+
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
48
|
+
|
|
49
|
+
var _useContext = useContext(DataGridSortingContext),
|
|
50
|
+
getCorrectRowIndex = _useContext.getCorrectRowIndex;
|
|
51
|
+
|
|
52
|
+
var cellContent;
|
|
53
|
+
var isFirstColumn = colIndex === 0;
|
|
54
|
+
var isLastColumn = colIndex === visibleColCount - 1;
|
|
55
|
+
var isLeadingControlColumn = colIndex < leadingControlColumns.length;
|
|
56
|
+
var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
|
|
57
|
+
var datacolIndex = colIndex - leadingControlColumns.length;
|
|
58
|
+
var column = columns[datacolIndex];
|
|
59
|
+
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
60
|
+
var textTransform = useMemo(function () {
|
|
61
|
+
var _schemaDetectors$filt;
|
|
62
|
+
|
|
63
|
+
return (_schemaDetectors$filt = schemaDetectors.filter(function (row) {
|
|
64
|
+
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
65
|
+
})[0]) === null || _schemaDetectors$filt === void 0 ? void 0 : _schemaDetectors$filt.textTransform;
|
|
66
|
+
}, [columnId, column === null || column === void 0 ? void 0 : column.schema, schemaDetectors]);
|
|
67
|
+
var classes = classNames(_defineProperty({
|
|
68
|
+
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
69
|
+
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
70
|
+
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
71
|
+
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
72
|
+
var sharedCellProps = {
|
|
73
|
+
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
74
|
+
visibleRowIndex: visibleRowIndex,
|
|
75
|
+
colIndex: colIndex,
|
|
76
|
+
interactiveCellId: interactiveCellId,
|
|
77
|
+
className: classes,
|
|
78
|
+
style: style,
|
|
79
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
80
|
+
rowHeightUtils: rowHeightUtils,
|
|
81
|
+
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
82
|
+
rowManager: rowManager,
|
|
83
|
+
popoverContext: popoverContext,
|
|
84
|
+
pagination: pagination
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (isLeadingControlColumn) {
|
|
88
|
+
var leadingColumn = leadingControlColumns[colIndex];
|
|
89
|
+
var id = leadingColumn.id,
|
|
90
|
+
rowCellRender = leadingColumn.rowCellRender;
|
|
91
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
92
|
+
columnId: id,
|
|
93
|
+
width: leadingColumn.width,
|
|
94
|
+
renderCellValue: rowCellRender,
|
|
95
|
+
isExpandable: false
|
|
96
|
+
}, rest));
|
|
97
|
+
} else if (isTrailingControlColumn) {
|
|
98
|
+
var columnOffset = columns.length + leadingControlColumns.length;
|
|
99
|
+
var trailingcolIndex = colIndex - columnOffset;
|
|
100
|
+
var trailingColumn = trailingControlColumns[trailingcolIndex];
|
|
101
|
+
var _id = trailingColumn.id,
|
|
102
|
+
_rowCellRender = trailingColumn.rowCellRender;
|
|
103
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
104
|
+
columnId: _id,
|
|
105
|
+
width: trailingColumn.width,
|
|
106
|
+
renderCellValue: _rowCellRender,
|
|
107
|
+
isExpandable: false
|
|
108
|
+
}, rest));
|
|
109
|
+
} else {
|
|
110
|
+
// this is a normal data cell
|
|
111
|
+
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
112
|
+
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
113
|
+
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
114
|
+
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
115
|
+
columnId: columnId,
|
|
116
|
+
column: column,
|
|
117
|
+
columnType: columnType,
|
|
118
|
+
width: width || undefined,
|
|
119
|
+
renderCellValue: renderCellValue,
|
|
120
|
+
renderCellPopover: renderCellPopover,
|
|
121
|
+
interactiveCellId: interactiveCellId,
|
|
122
|
+
isExpandable: isExpandable
|
|
123
|
+
}, rest));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return cellContent;
|
|
127
|
+
};
|
|
@@ -13,12 +13,13 @@ import classnames from 'classnames';
|
|
|
13
13
|
import React, { forwardRef } from 'react';
|
|
14
14
|
import { EuiDataGridControlHeaderCell } from './data_grid_control_header_cell';
|
|
15
15
|
import { EuiDataGridHeaderCell } from './data_grid_header_cell';
|
|
16
|
+
import { emptyControlColumns } from '../../data_grid_types';
|
|
16
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
18
|
var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
18
19
|
var _props$leadingControl = props.leadingControlColumns,
|
|
19
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
20
|
+
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
20
21
|
_props$trailingContro = props.trailingControlColumns,
|
|
21
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
22
|
+
trailingControlColumns = _props$trailingContro === void 0 ? emptyControlColumns : _props$trailingContro,
|
|
22
23
|
columns = props.columns,
|
|
23
24
|
schema = props.schema,
|
|
24
25
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions"],
|
|
6
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody"],
|
|
7
7
|
_excluded2 = ["focusProps"];
|
|
8
8
|
|
|
9
9
|
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; }
|
|
@@ -35,8 +35,9 @@ import { computeVisibleRows } from './utils/row_count';
|
|
|
35
35
|
import { EuiDataGridPaginationRenderer } from './utils/data_grid_pagination';
|
|
36
36
|
import { schemaDetectors as providedSchemaDetectors, useMergedSchema } from './utils/data_grid_schema';
|
|
37
37
|
import { useImperativeGridRef } from './utils/ref';
|
|
38
|
+
import { emptyControlColumns } from './data_grid_types'; // Each gridStyle object above sets a specific CSS select to .euiGrid
|
|
39
|
+
|
|
38
40
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
39
|
-
// Each gridStyle object above sets a specific CSS select to .euiGrid
|
|
40
41
|
var fontSizesToClassMap = {
|
|
41
42
|
s: 'euiDataGrid--fontSizeSmall',
|
|
42
43
|
m: '',
|
|
@@ -69,9 +70,9 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
69
70
|
var _gridItemsRendered$cu;
|
|
70
71
|
|
|
71
72
|
var _props$leadingControl = props.leadingControlColumns,
|
|
72
|
-
leadingControlColumns = _props$leadingControl === void 0 ?
|
|
73
|
+
leadingControlColumns = _props$leadingControl === void 0 ? emptyControlColumns : _props$leadingControl,
|
|
73
74
|
_props$trailingContro = props.trailingControlColumns,
|
|
74
|
-
trailingControlColumns = _props$trailingContro === void 0 ?
|
|
75
|
+
trailingControlColumns = _props$trailingContro === void 0 ? emptyControlColumns : _props$trailingContro,
|
|
75
76
|
columns = props.columns,
|
|
76
77
|
columnVisibility = props.columnVisibility,
|
|
77
78
|
schemaDetectors = props.schemaDetectors,
|
|
@@ -92,6 +93,7 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
92
93
|
width = props.width,
|
|
93
94
|
_rowHeightsOptions = props.rowHeightsOptions,
|
|
94
95
|
virtualizationOptions = props.virtualizationOptions,
|
|
96
|
+
renderCustomGridBody = props.renderCustomGridBody,
|
|
95
97
|
rest = _objectWithoutProperties(props, _excluded);
|
|
96
98
|
/**
|
|
97
99
|
* Merge consumer settings with defaults
|
|
@@ -369,7 +371,8 @@ export var EuiDataGrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
369
371
|
gridWidth: gridWidth,
|
|
370
372
|
gridRef: gridRef,
|
|
371
373
|
gridItemsRendered: gridItemsRendered,
|
|
372
|
-
wrapperRef: contentRef
|
|
374
|
+
wrapperRef: contentRef,
|
|
375
|
+
renderCustomGridBody: renderCustomGridBody
|
|
373
376
|
})), pagination && props['aria-labelledby'] && ___EmotionJSX("p", {
|
|
374
377
|
id: ariaLabelledById,
|
|
375
378
|
hidden: true
|