@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
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import
|
|
4
|
-
var _excluded = ["
|
|
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; }
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["renderCustomGridBody"];
|
|
9
4
|
|
|
10
5
|
/*
|
|
11
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -14,385 +9,20 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
9
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
10
|
* Side Public License, v 1.
|
|
16
11
|
*/
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import { useResizeObserver } from '../../observer/resize_observer';
|
|
21
|
-
import { EuiDataGridCell } from './data_grid_cell';
|
|
22
|
-
import { useDataGridHeader } from './header';
|
|
23
|
-
import { useDataGridFooter } from './footer';
|
|
24
|
-
import { DataGridCellPopoverContext } from './data_grid_cell_popover';
|
|
25
|
-
import { useRowManager } from './data_grid_row_manager';
|
|
26
|
-
import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
|
|
27
|
-
import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
|
|
28
|
-
import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
|
|
29
|
-
import { useScrollBars, useScroll } from '../utils/scrolling';
|
|
30
|
-
import { DataGridSortingContext } from '../utils/sorting';
|
|
31
|
-
import { IS_JEST_ENVIRONMENT } from '../../../utils';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { EuiDataGridBodyVirtualized } from './data_grid_body_virtualized';
|
|
14
|
+
import { EuiDataGridBodyCustomRender } from './data_grid_body_custom';
|
|
32
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
33
|
-
export var
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
renderCellValue = data.renderCellValue,
|
|
46
|
-
renderCellPopover = data.renderCellPopover,
|
|
47
|
-
interactiveCellId = data.interactiveCellId,
|
|
48
|
-
setRowHeight = data.setRowHeight,
|
|
49
|
-
schemaDetectors = data.schemaDetectors,
|
|
50
|
-
rowHeightsOptions = data.rowHeightsOptions,
|
|
51
|
-
rowHeightUtils = data.rowHeightUtils,
|
|
52
|
-
rowManager = data.rowManager,
|
|
53
|
-
pagination = data.pagination;
|
|
54
|
-
var popoverContext = useContext(DataGridCellPopoverContext);
|
|
55
|
-
|
|
56
|
-
var _useContext = useContext(DataGridWrapperRowsContext),
|
|
57
|
-
headerRowHeight = _useContext.headerRowHeight;
|
|
58
|
-
|
|
59
|
-
var _useContext2 = useContext(DataGridSortingContext),
|
|
60
|
-
getCorrectRowIndex = _useContext2.getCorrectRowIndex;
|
|
61
|
-
|
|
62
|
-
var cellContent;
|
|
63
|
-
var isFirstColumn = columnIndex === 0;
|
|
64
|
-
var isLastColumn = columnIndex === visibleColCount - 1;
|
|
65
|
-
var isLeadingControlColumn = columnIndex < leadingControlColumns.length;
|
|
66
|
-
var isTrailingControlColumn = columnIndex >= leadingControlColumns.length + columns.length;
|
|
67
|
-
var dataColumnIndex = columnIndex - leadingControlColumns.length;
|
|
68
|
-
var column = columns[dataColumnIndex];
|
|
69
|
-
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
70
|
-
var transformClass = schemaDetectors.filter(function (row) {
|
|
71
|
-
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
72
|
-
})[0];
|
|
73
|
-
var textTransform = transformClass === null || transformClass === void 0 ? void 0 : transformClass.textTransform;
|
|
74
|
-
var classes = classNames(_defineProperty({
|
|
75
|
-
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
76
|
-
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
77
|
-
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
78
|
-
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
79
|
-
var sharedCellProps = {
|
|
80
|
-
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
81
|
-
visibleRowIndex: visibleRowIndex,
|
|
82
|
-
colIndex: columnIndex,
|
|
83
|
-
interactiveCellId: interactiveCellId,
|
|
84
|
-
className: classes,
|
|
85
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
86
|
-
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
87
|
-
}),
|
|
88
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
89
|
-
rowHeightUtils: rowHeightUtils,
|
|
90
|
-
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
91
|
-
rowManager: rowManager,
|
|
92
|
-
popoverContext: popoverContext,
|
|
93
|
-
pagination: pagination
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (isLeadingControlColumn) {
|
|
97
|
-
var leadingColumn = leadingControlColumns[columnIndex];
|
|
98
|
-
var id = leadingColumn.id,
|
|
99
|
-
rowCellRender = leadingColumn.rowCellRender;
|
|
100
|
-
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
101
|
-
columnId: id,
|
|
102
|
-
width: leadingColumn.width,
|
|
103
|
-
renderCellValue: rowCellRender,
|
|
104
|
-
isExpandable: false
|
|
105
|
-
}));
|
|
106
|
-
} else if (isTrailingControlColumn) {
|
|
107
|
-
var columnOffset = columns.length + leadingControlColumns.length;
|
|
108
|
-
var trailingColumnIndex = columnIndex - columnOffset;
|
|
109
|
-
var trailingColumn = trailingControlColumns[trailingColumnIndex];
|
|
110
|
-
var _id = trailingColumn.id,
|
|
111
|
-
_rowCellRender = trailingColumn.rowCellRender;
|
|
112
|
-
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
113
|
-
columnId: _id,
|
|
114
|
-
width: trailingColumn.width,
|
|
115
|
-
renderCellValue: _rowCellRender,
|
|
116
|
-
isExpandable: false
|
|
117
|
-
}));
|
|
118
|
-
} else {
|
|
119
|
-
// this is a normal data cell
|
|
120
|
-
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
121
|
-
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
122
|
-
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
123
|
-
cellContent = ___EmotionJSX(EuiDataGridCell, _extends({}, sharedCellProps, {
|
|
124
|
-
columnId: columnId,
|
|
125
|
-
column: column,
|
|
126
|
-
columnType: columnType,
|
|
127
|
-
width: width || undefined,
|
|
128
|
-
renderCellValue: renderCellValue,
|
|
129
|
-
renderCellPopover: renderCellPopover,
|
|
130
|
-
interactiveCellId: interactiveCellId,
|
|
131
|
-
isExpandable: isExpandable
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return cellContent;
|
|
136
|
-
}; // Context is required to pass props to react-window's innerElementType
|
|
137
|
-
// @see https://github.com/bvaughn/react-window/issues/404
|
|
138
|
-
|
|
139
|
-
export var DataGridWrapperRowsContext = /*#__PURE__*/createContext({
|
|
140
|
-
headerRow: ___EmotionJSX("div", null),
|
|
141
|
-
headerRowHeight: 0,
|
|
142
|
-
footerRow: null
|
|
143
|
-
});
|
|
144
|
-
var InnerElement = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
145
|
-
var children = _ref2.children,
|
|
146
|
-
style = _ref2.style,
|
|
147
|
-
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
148
|
-
|
|
149
|
-
var _useContext3 = useContext(DataGridWrapperRowsContext),
|
|
150
|
-
headerRowHeight = _useContext3.headerRowHeight,
|
|
151
|
-
headerRow = _useContext3.headerRow,
|
|
152
|
-
footerRow = _useContext3.footerRow;
|
|
153
|
-
|
|
154
|
-
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX("div", _extends({
|
|
155
|
-
ref: ref,
|
|
156
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
157
|
-
height: style.height + headerRowHeight
|
|
158
|
-
})
|
|
159
|
-
}, rest), headerRow, children), footerRow);
|
|
160
|
-
});
|
|
161
|
-
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
162
|
-
export var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
163
|
-
var leadingControlColumns = props.leadingControlColumns,
|
|
164
|
-
trailingControlColumns = props.trailingControlColumns,
|
|
165
|
-
columns = props.columns,
|
|
166
|
-
visibleColCount = props.visibleColCount,
|
|
167
|
-
schema = props.schema,
|
|
168
|
-
schemaDetectors = props.schemaDetectors,
|
|
169
|
-
rowCount = props.rowCount,
|
|
170
|
-
_props$visibleRows = props.visibleRows,
|
|
171
|
-
startRow = _props$visibleRows.startRow,
|
|
172
|
-
endRow = _props$visibleRows.endRow,
|
|
173
|
-
visibleRowCount = _props$visibleRows.visibleRowCount,
|
|
174
|
-
renderCellValue = props.renderCellValue,
|
|
175
|
-
renderCellPopover = props.renderCellPopover,
|
|
176
|
-
renderFooterCellValue = props.renderFooterCellValue,
|
|
177
|
-
interactiveCellId = props.interactiveCellId,
|
|
178
|
-
pagination = props.pagination,
|
|
179
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
180
|
-
handleHeaderMutation = props.handleHeaderMutation,
|
|
181
|
-
setVisibleColumns = props.setVisibleColumns,
|
|
182
|
-
switchColumnPos = props.switchColumnPos,
|
|
183
|
-
onColumnResize = props.onColumnResize,
|
|
184
|
-
rowHeightsOptions = props.rowHeightsOptions,
|
|
185
|
-
virtualizationOptions = props.virtualizationOptions,
|
|
186
|
-
isFullScreen = props.isFullScreen,
|
|
187
|
-
gridStyles = props.gridStyles,
|
|
188
|
-
gridWidth = props.gridWidth,
|
|
189
|
-
gridRef = props.gridRef,
|
|
190
|
-
gridItemsRendered = props.gridItemsRendered,
|
|
191
|
-
wrapperRef = props.wrapperRef;
|
|
192
|
-
/**
|
|
193
|
-
* Grid refs & observers
|
|
194
|
-
*/
|
|
195
|
-
|
|
196
|
-
var wrapperDimensions = useResizeObserver(wrapperRef.current);
|
|
197
|
-
var outerGridRef = useRef(null); // container that becomes scrollable
|
|
198
|
-
|
|
199
|
-
var innerGridRef = useRef(null); // container sized to fit all content
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Scroll bars
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
var _useScrollBars = useScrollBars(outerGridRef, gridStyles.border),
|
|
206
|
-
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
207
|
-
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
208
|
-
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
209
|
-
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
210
|
-
/**
|
|
211
|
-
* Widths
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
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
|
|
216
|
-
|
|
217
|
-
var defaultColumnWidth = useDefaultColumnWidth(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
218
|
-
|
|
219
|
-
var _useColumnWidths = useColumnWidths({
|
|
220
|
-
columns: columns,
|
|
221
|
-
leadingControlColumns: leadingControlColumns,
|
|
222
|
-
trailingControlColumns: trailingControlColumns,
|
|
223
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
224
|
-
onColumnResize: onColumnResize
|
|
225
|
-
}),
|
|
226
|
-
columnWidths = _useColumnWidths.columnWidths,
|
|
227
|
-
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
228
|
-
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
229
|
-
/**
|
|
230
|
-
* Header & footer
|
|
231
|
-
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var _useDataGridHeader = useDataGridHeader({
|
|
235
|
-
headerIsInteractive: headerIsInteractive,
|
|
236
|
-
handleHeaderMutation: handleHeaderMutation,
|
|
237
|
-
switchColumnPos: switchColumnPos,
|
|
238
|
-
setVisibleColumns: setVisibleColumns,
|
|
239
|
-
leadingControlColumns: leadingControlColumns,
|
|
240
|
-
trailingControlColumns: trailingControlColumns,
|
|
241
|
-
columns: columns,
|
|
242
|
-
columnWidths: columnWidths,
|
|
243
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
244
|
-
setColumnWidth: setColumnWidth,
|
|
245
|
-
schema: schema,
|
|
246
|
-
schemaDetectors: schemaDetectors
|
|
247
|
-
}),
|
|
248
|
-
headerRow = _useDataGridHeader.headerRow,
|
|
249
|
-
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
250
|
-
|
|
251
|
-
var _useDataGridFooter = useDataGridFooter({
|
|
252
|
-
renderFooterCellValue: renderFooterCellValue,
|
|
253
|
-
renderCellPopover: renderCellPopover,
|
|
254
|
-
rowIndex: visibleRowCount,
|
|
255
|
-
visibleRowIndex: visibleRowCount,
|
|
256
|
-
interactiveCellId: interactiveCellId,
|
|
257
|
-
leadingControlColumns: leadingControlColumns,
|
|
258
|
-
trailingControlColumns: trailingControlColumns,
|
|
259
|
-
columns: columns,
|
|
260
|
-
columnWidths: columnWidths,
|
|
261
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
262
|
-
schema: schema
|
|
263
|
-
}),
|
|
264
|
-
footerRow = _useDataGridFooter.footerRow,
|
|
265
|
-
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
266
|
-
/**
|
|
267
|
-
* Handle scrolling cells fully into view
|
|
268
|
-
*/
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
useScroll({
|
|
272
|
-
gridRef: gridRef,
|
|
273
|
-
outerGridRef: outerGridRef,
|
|
274
|
-
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
275
|
-
headerRowHeight: headerRowHeight,
|
|
276
|
-
footerRowHeight: footerRowHeight,
|
|
277
|
-
visibleRowCount: visibleRowCount,
|
|
278
|
-
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
279
|
-
});
|
|
280
|
-
/**
|
|
281
|
-
* Row manager
|
|
282
|
-
*/
|
|
283
|
-
|
|
284
|
-
var rowManager = useRowManager({
|
|
285
|
-
innerGridRef: innerGridRef,
|
|
286
|
-
rowClasses: gridStyles.rowClasses
|
|
287
|
-
});
|
|
288
|
-
/**
|
|
289
|
-
* Heights
|
|
290
|
-
*/
|
|
291
|
-
|
|
292
|
-
var rowHeightUtils = useRowHeightUtils({
|
|
293
|
-
gridRef: gridRef,
|
|
294
|
-
outerGridElementRef: outerGridRef,
|
|
295
|
-
gridItemsRenderedRef: gridItemsRendered,
|
|
296
|
-
gridStyles: gridStyles,
|
|
297
|
-
columns: columns,
|
|
298
|
-
rowHeightsOptions: rowHeightsOptions
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
302
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
303
|
-
rowHeightUtils: rowHeightUtils
|
|
304
|
-
}),
|
|
305
|
-
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
306
|
-
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
307
|
-
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
308
|
-
|
|
309
|
-
var unconstrainedHeight = useUnconstrainedHeight({
|
|
310
|
-
rowHeightUtils: rowHeightUtils,
|
|
311
|
-
startRow: startRow,
|
|
312
|
-
endRow: endRow,
|
|
313
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
314
|
-
defaultRowHeight: defaultRowHeight,
|
|
315
|
-
headerRowHeight: headerRowHeight,
|
|
316
|
-
footerRowHeight: footerRowHeight,
|
|
317
|
-
scrollBarHeight: scrollBarHeight,
|
|
318
|
-
innerGridRef: innerGridRef
|
|
319
|
-
});
|
|
320
|
-
/**
|
|
321
|
-
* Final grid height & width
|
|
322
|
-
*/
|
|
323
|
-
|
|
324
|
-
var _useFinalGridDimensio = useFinalGridDimensions({
|
|
325
|
-
unconstrainedHeight: unconstrainedHeight,
|
|
326
|
-
unconstrainedWidth: 0,
|
|
327
|
-
// unable to determine this until the container's size is known
|
|
328
|
-
wrapperDimensions: wrapperDimensions,
|
|
329
|
-
wrapperRef: wrapperRef,
|
|
330
|
-
isFullScreen: isFullScreen,
|
|
331
|
-
rowCount: rowCount
|
|
332
|
-
}),
|
|
333
|
-
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
334
|
-
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
335
|
-
/**
|
|
336
|
-
* Grid resets
|
|
337
|
-
*/
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
useEffect(function () {
|
|
341
|
-
if (gridRef.current) {
|
|
342
|
-
gridRef.current.resetAfterColumnIndex(0);
|
|
343
|
-
}
|
|
344
|
-
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
345
|
-
useEffect(function () {
|
|
346
|
-
if (gridRef.current && rowHeightsOptions) {
|
|
347
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
348
|
-
}
|
|
349
|
-
}, [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]);
|
|
350
|
-
useEffect(function () {
|
|
351
|
-
if (gridRef.current) {
|
|
352
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
353
|
-
}
|
|
354
|
-
}, [gridRef, getRowHeight]);
|
|
355
|
-
return IS_JEST_ENVIRONMENT || finalWidth > 0 ? ___EmotionJSX(DataGridWrapperRowsContext.Provider, {
|
|
356
|
-
value: {
|
|
357
|
-
headerRowHeight: headerRowHeight,
|
|
358
|
-
headerRow: headerRow,
|
|
359
|
-
footerRow: footerRow
|
|
360
|
-
}
|
|
361
|
-
}, ___EmotionJSX(Grid, _extends({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
362
|
-
ref: gridRef,
|
|
363
|
-
className: classNames('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
364
|
-
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
365
|
-
var _virtualizationOption;
|
|
366
|
-
|
|
367
|
-
gridItemsRendered.current = itemsRendered;
|
|
368
|
-
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
369
|
-
},
|
|
370
|
-
innerElementType: InnerElement,
|
|
371
|
-
outerRef: outerGridRef,
|
|
372
|
-
innerRef: innerGridRef,
|
|
373
|
-
columnCount: visibleColCount,
|
|
374
|
-
width: finalWidth,
|
|
375
|
-
columnWidth: getColumnWidth,
|
|
376
|
-
height: finalHeight,
|
|
377
|
-
rowHeight: getRowHeight,
|
|
378
|
-
itemData: {
|
|
379
|
-
schemaDetectors: schemaDetectors,
|
|
380
|
-
setRowHeight: setRowHeight,
|
|
381
|
-
leadingControlColumns: leadingControlColumns,
|
|
382
|
-
trailingControlColumns: trailingControlColumns,
|
|
383
|
-
columns: columns,
|
|
384
|
-
visibleColCount: visibleColCount,
|
|
385
|
-
schema: schema,
|
|
386
|
-
columnWidths: columnWidths,
|
|
387
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
388
|
-
renderCellValue: renderCellValue,
|
|
389
|
-
renderCellPopover: renderCellPopover,
|
|
390
|
-
interactiveCellId: interactiveCellId,
|
|
391
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
392
|
-
rowHeightUtils: rowHeightUtils,
|
|
393
|
-
rowManager: rowManager,
|
|
394
|
-
pagination: pagination
|
|
395
|
-
},
|
|
396
|
-
rowCount: IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
397
|
-
}), Cell), scrollBorderOverlay) : null;
|
|
16
|
+
export var EuiDataGridBody = function EuiDataGridBody(_ref) {
|
|
17
|
+
var renderCustomGridBody = _ref.renderCustomGridBody,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* Determine whether we should use the default EuiDataGridBody
|
|
22
|
+
* + virtualization library for rendering content, or if consumers have
|
|
23
|
+
* passed their own custom renderer
|
|
24
|
+
*/
|
|
25
|
+
return renderCustomGridBody ? ___EmotionJSX(EuiDataGridBodyCustomRender, _extends({
|
|
26
|
+
renderCustomGridBody: renderCustomGridBody
|
|
27
|
+
}, props)) : ___EmotionJSX(EuiDataGridBodyVirtualized, props);
|
|
398
28
|
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
6
|
+
var _excluded = ["colIndex", "visibleRowIndex"];
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
19
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
20
|
+
import classNames from 'classnames';
|
|
21
|
+
import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
|
|
22
|
+
import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
|
|
23
|
+
import { useDataGridHeader } from './header';
|
|
24
|
+
import { useDataGridFooter } from './footer';
|
|
25
|
+
import { Cell } from './data_grid_cell_wrapper';
|
|
26
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
27
|
+
export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_ref) {
|
|
28
|
+
var renderCustomGridBody = _ref.renderCustomGridBody,
|
|
29
|
+
leadingControlColumns = _ref.leadingControlColumns,
|
|
30
|
+
trailingControlColumns = _ref.trailingControlColumns,
|
|
31
|
+
columns = _ref.columns,
|
|
32
|
+
visibleColCount = _ref.visibleColCount,
|
|
33
|
+
schema = _ref.schema,
|
|
34
|
+
schemaDetectors = _ref.schemaDetectors,
|
|
35
|
+
visibleRows = _ref.visibleRows,
|
|
36
|
+
renderCellValue = _ref.renderCellValue,
|
|
37
|
+
renderCellPopover = _ref.renderCellPopover,
|
|
38
|
+
renderFooterCellValue = _ref.renderFooterCellValue,
|
|
39
|
+
interactiveCellId = _ref.interactiveCellId,
|
|
40
|
+
headerIsInteractive = _ref.headerIsInteractive,
|
|
41
|
+
handleHeaderMutation = _ref.handleHeaderMutation,
|
|
42
|
+
setVisibleColumns = _ref.setVisibleColumns,
|
|
43
|
+
switchColumnPos = _ref.switchColumnPos,
|
|
44
|
+
onColumnResize = _ref.onColumnResize,
|
|
45
|
+
gridWidth = _ref.gridWidth,
|
|
46
|
+
gridStyles = _ref.gridStyles,
|
|
47
|
+
pagination = _ref.pagination,
|
|
48
|
+
rowHeightsOptions = _ref.rowHeightsOptions;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Columns & widths
|
|
52
|
+
*/
|
|
53
|
+
var visibleColumns = useMemo(function () {
|
|
54
|
+
return [].concat(_toConsumableArray(leadingControlColumns), _toConsumableArray(columns), _toConsumableArray(trailingControlColumns));
|
|
55
|
+
}, [columns, leadingControlColumns, trailingControlColumns]); // compute the default column width from the container's width and count of visible columns
|
|
56
|
+
|
|
57
|
+
var defaultColumnWidth = useDefaultColumnWidth(gridWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
58
|
+
|
|
59
|
+
var _useColumnWidths = useColumnWidths({
|
|
60
|
+
columns: columns,
|
|
61
|
+
leadingControlColumns: leadingControlColumns,
|
|
62
|
+
trailingControlColumns: trailingControlColumns,
|
|
63
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
64
|
+
onColumnResize: onColumnResize
|
|
65
|
+
}),
|
|
66
|
+
columnWidths = _useColumnWidths.columnWidths,
|
|
67
|
+
setColumnWidth = _useColumnWidths.setColumnWidth;
|
|
68
|
+
/**
|
|
69
|
+
* Row heights
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
var rowHeightUtils = useRowHeightUtils({
|
|
74
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
75
|
+
gridStyles: gridStyles,
|
|
76
|
+
columns: columns
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
80
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
81
|
+
rowHeightUtils: rowHeightUtils
|
|
82
|
+
}),
|
|
83
|
+
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
84
|
+
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
85
|
+
/**
|
|
86
|
+
* Header & footer
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
var _useDataGridHeader = useDataGridHeader({
|
|
91
|
+
headerIsInteractive: headerIsInteractive,
|
|
92
|
+
handleHeaderMutation: handleHeaderMutation,
|
|
93
|
+
switchColumnPos: switchColumnPos,
|
|
94
|
+
setVisibleColumns: setVisibleColumns,
|
|
95
|
+
leadingControlColumns: leadingControlColumns,
|
|
96
|
+
trailingControlColumns: trailingControlColumns,
|
|
97
|
+
columns: columns,
|
|
98
|
+
columnWidths: columnWidths,
|
|
99
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
100
|
+
setColumnWidth: setColumnWidth,
|
|
101
|
+
schema: schema,
|
|
102
|
+
schemaDetectors: schemaDetectors
|
|
103
|
+
}),
|
|
104
|
+
headerRow = _useDataGridHeader.headerRow;
|
|
105
|
+
|
|
106
|
+
var _useDataGridFooter = useDataGridFooter({
|
|
107
|
+
renderFooterCellValue: renderFooterCellValue,
|
|
108
|
+
renderCellPopover: renderCellPopover,
|
|
109
|
+
rowIndex: visibleRows.visibleRowCount,
|
|
110
|
+
visibleRowIndex: visibleRows.visibleRowCount,
|
|
111
|
+
interactiveCellId: interactiveCellId,
|
|
112
|
+
leadingControlColumns: leadingControlColumns,
|
|
113
|
+
trailingControlColumns: trailingControlColumns,
|
|
114
|
+
columns: columns,
|
|
115
|
+
columnWidths: columnWidths,
|
|
116
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
117
|
+
schema: schema
|
|
118
|
+
}),
|
|
119
|
+
footerRow = _useDataGridFooter.footerRow;
|
|
120
|
+
/**
|
|
121
|
+
* Cell render fn
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
var cellProps = {
|
|
126
|
+
schema: schema,
|
|
127
|
+
schemaDetectors: schemaDetectors,
|
|
128
|
+
pagination: pagination,
|
|
129
|
+
columns: columns,
|
|
130
|
+
leadingControlColumns: leadingControlColumns,
|
|
131
|
+
trailingControlColumns: trailingControlColumns,
|
|
132
|
+
visibleColCount: visibleColCount,
|
|
133
|
+
columnWidths: columnWidths,
|
|
134
|
+
defaultColumnWidth: defaultColumnWidth,
|
|
135
|
+
renderCellValue: renderCellValue,
|
|
136
|
+
renderCellPopover: renderCellPopover,
|
|
137
|
+
interactiveCellId: interactiveCellId,
|
|
138
|
+
setRowHeight: setRowHeight,
|
|
139
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
140
|
+
rowHeightUtils: rowHeightUtils
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var _Cell = useCallback(function (_ref2) {
|
|
144
|
+
var colIndex = _ref2.colIndex,
|
|
145
|
+
visibleRowIndex = _ref2.visibleRowIndex,
|
|
146
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
147
|
+
|
|
148
|
+
var style = {
|
|
149
|
+
height: rowHeightUtils.isAutoHeight(visibleRowIndex, rowHeightsOptions) ? 'auto' : getRowHeight(visibleRowIndex)
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
var props = _objectSpread({
|
|
153
|
+
colIndex: colIndex,
|
|
154
|
+
visibleRowIndex: visibleRowIndex,
|
|
155
|
+
style: style
|
|
156
|
+
}, cellProps);
|
|
157
|
+
|
|
158
|
+
return ___EmotionJSX(Cell, _extends({}, props, rest));
|
|
159
|
+
}, [].concat(_toConsumableArray(Object.values(cellProps)), [getRowHeight]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
160
|
+
); // Allow consumers to pass custom props/attributes/listeners etc. to the wrapping div
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
var _useState = useState({}),
|
|
164
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
165
|
+
customGridBodyProps = _useState2[0],
|
|
166
|
+
setCustomGridBodyProps = _useState2[1];
|
|
167
|
+
|
|
168
|
+
return ___EmotionJSX("div", _extends({}, customGridBodyProps, {
|
|
169
|
+
className: classNames('euiDataGrid__customRenderBody', customGridBodyProps === null || customGridBodyProps === void 0 ? void 0 : customGridBodyProps.className)
|
|
170
|
+
}), headerRow, renderCustomGridBody({
|
|
171
|
+
visibleColumns: visibleColumns,
|
|
172
|
+
visibleRowData: visibleRows,
|
|
173
|
+
Cell: _Cell,
|
|
174
|
+
setCustomGridBodyProps: setCustomGridBodyProps
|
|
175
|
+
}), footerRow);
|
|
176
|
+
};
|