@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
|
@@ -16,8 +16,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
16
16
|
*/
|
|
17
17
|
import React, { useState, useCallback } from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
-
import { useGeneratedHtmlId } from '../../services';
|
|
20
|
-
import { EuiScreenReaderOnly } from '../accessibility';
|
|
21
19
|
import { EuiIcon } from '../icon';
|
|
22
20
|
import { useEuiI18n } from '../i18n';
|
|
23
21
|
import { EuiInputPopover } from '../popover';
|
|
@@ -112,14 +110,11 @@ export var EuiSuggest = function EuiSuggest(_ref) {
|
|
|
112
110
|
var searchOnChange = function searchOnChange(value) {
|
|
113
111
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
|
|
114
112
|
};
|
|
115
|
-
|
|
116
|
-
var inputDescribedbyId = useGeneratedHtmlId({
|
|
117
|
-
prefix: id
|
|
118
|
-
});
|
|
119
113
|
/**
|
|
120
114
|
* Status
|
|
121
115
|
*/
|
|
122
116
|
|
|
117
|
+
|
|
123
118
|
var icon = '';
|
|
124
119
|
var color = '';
|
|
125
120
|
|
|
@@ -210,6 +205,7 @@ export var EuiSuggest = function EuiSuggest(_ref) {
|
|
|
210
205
|
}
|
|
211
206
|
}, [onItemClick, suggestions]);
|
|
212
207
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiSelectable, {
|
|
208
|
+
selectableScreenReaderText: stateMessage,
|
|
213
209
|
singleSelection: true,
|
|
214
210
|
height: isVirtualized ? undefined : 'full',
|
|
215
211
|
options: suggestionList,
|
|
@@ -234,7 +230,6 @@ export var EuiSuggest = function EuiSuggest(_ref) {
|
|
|
234
230
|
onBlur: searchOnBlur,
|
|
235
231
|
onInput: searchOnInput,
|
|
236
232
|
onChange: searchOnChange,
|
|
237
|
-
'aria-describedby': inputDescribedbyId,
|
|
238
233
|
'aria-label': ariaLabel,
|
|
239
234
|
'aria-labelledby': labelId
|
|
240
235
|
}, rest)
|
|
@@ -258,7 +253,5 @@ export var EuiSuggest = function EuiSuggest(_ref) {
|
|
|
258
253
|
},
|
|
259
254
|
className: "eui-yScroll"
|
|
260
255
|
}, list));
|
|
261
|
-
})
|
|
262
|
-
id: inputDescribedbyId
|
|
263
|
-
}, stateMessage)));
|
|
256
|
+
}));
|
|
264
257
|
};
|
|
@@ -2,430 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
exports.EuiDataGridBody =
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
8
|
+
exports.EuiDataGridBody = void 0;
|
|
13
9
|
|
|
14
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
11
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _reactWindow = require("react-window");
|
|
23
|
-
|
|
24
|
-
var _resize_observer = require("../../observer/resize_observer");
|
|
25
|
-
|
|
26
|
-
var _data_grid_cell = require("./data_grid_cell");
|
|
27
|
-
|
|
28
|
-
var _header = require("./header");
|
|
29
|
-
|
|
30
|
-
var _footer = require("./footer");
|
|
31
|
-
|
|
32
|
-
var _data_grid_cell_popover = require("./data_grid_cell_popover");
|
|
33
|
-
|
|
34
|
-
var _data_grid_row_manager = require("./data_grid_row_manager");
|
|
35
|
-
|
|
36
|
-
var _grid_height_width = require("../utils/grid_height_width");
|
|
37
|
-
|
|
38
|
-
var _col_widths = require("../utils/col_widths");
|
|
39
|
-
|
|
40
|
-
var _row_heights = require("../utils/row_heights");
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
41
13
|
|
|
42
|
-
var
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
43
15
|
|
|
44
|
-
var
|
|
16
|
+
var _data_grid_body_virtualized = require("./data_grid_body_virtualized");
|
|
45
17
|
|
|
46
|
-
var
|
|
18
|
+
var _data_grid_body_custom = require("./data_grid_body_custom");
|
|
47
19
|
|
|
48
20
|
var _react2 = require("@emotion/react");
|
|
49
21
|
|
|
50
|
-
var _excluded = ["
|
|
51
|
-
|
|
52
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
-
|
|
54
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
55
|
-
|
|
56
|
-
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; }
|
|
57
|
-
|
|
58
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
59
|
-
|
|
60
|
-
var Cell = function Cell(_ref) {
|
|
61
|
-
var columnIndex = _ref.columnIndex,
|
|
62
|
-
visibleRowIndex = _ref.rowIndex,
|
|
63
|
-
style = _ref.style,
|
|
64
|
-
data = _ref.data;
|
|
65
|
-
var leadingControlColumns = data.leadingControlColumns,
|
|
66
|
-
trailingControlColumns = data.trailingControlColumns,
|
|
67
|
-
columns = data.columns,
|
|
68
|
-
visibleColCount = data.visibleColCount,
|
|
69
|
-
schema = data.schema,
|
|
70
|
-
columnWidths = data.columnWidths,
|
|
71
|
-
defaultColumnWidth = data.defaultColumnWidth,
|
|
72
|
-
renderCellValue = data.renderCellValue,
|
|
73
|
-
renderCellPopover = data.renderCellPopover,
|
|
74
|
-
interactiveCellId = data.interactiveCellId,
|
|
75
|
-
setRowHeight = data.setRowHeight,
|
|
76
|
-
schemaDetectors = data.schemaDetectors,
|
|
77
|
-
rowHeightsOptions = data.rowHeightsOptions,
|
|
78
|
-
rowHeightUtils = data.rowHeightUtils,
|
|
79
|
-
rowManager = data.rowManager,
|
|
80
|
-
pagination = data.pagination;
|
|
81
|
-
var popoverContext = (0, _react.useContext)(_data_grid_cell_popover.DataGridCellPopoverContext);
|
|
82
|
-
|
|
83
|
-
var _useContext = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
84
|
-
headerRowHeight = _useContext.headerRowHeight;
|
|
85
|
-
|
|
86
|
-
var _useContext2 = (0, _react.useContext)(_sorting.DataGridSortingContext),
|
|
87
|
-
getCorrectRowIndex = _useContext2.getCorrectRowIndex;
|
|
88
|
-
|
|
89
|
-
var cellContent;
|
|
90
|
-
var isFirstColumn = columnIndex === 0;
|
|
91
|
-
var isLastColumn = columnIndex === visibleColCount - 1;
|
|
92
|
-
var isLeadingControlColumn = columnIndex < leadingControlColumns.length;
|
|
93
|
-
var isTrailingControlColumn = columnIndex >= leadingControlColumns.length + columns.length;
|
|
94
|
-
var dataColumnIndex = columnIndex - leadingControlColumns.length;
|
|
95
|
-
var column = columns[dataColumnIndex];
|
|
96
|
-
var columnId = column === null || column === void 0 ? void 0 : column.id;
|
|
97
|
-
var transformClass = schemaDetectors.filter(function (row) {
|
|
98
|
-
return column !== null && column !== void 0 && column.schema ? (column === null || column === void 0 ? void 0 : column.schema) === row.type : columnId === row.type;
|
|
99
|
-
})[0];
|
|
100
|
-
var textTransform = transformClass === null || transformClass === void 0 ? void 0 : transformClass.textTransform;
|
|
101
|
-
var classes = (0, _classnames.default)((0, _defineProperty2.default)({
|
|
102
|
-
'euiDataGridRowCell--firstColumn': isFirstColumn,
|
|
103
|
-
'euiDataGridRowCell--lastColumn': isLastColumn,
|
|
104
|
-
'euiDataGridRowCell--controlColumn': isLeadingControlColumn || isTrailingControlColumn
|
|
105
|
-
}, "euiDataGridRowCell--".concat(textTransform), textTransform));
|
|
106
|
-
var sharedCellProps = {
|
|
107
|
-
rowIndex: getCorrectRowIndex(visibleRowIndex),
|
|
108
|
-
visibleRowIndex: visibleRowIndex,
|
|
109
|
-
colIndex: columnIndex,
|
|
110
|
-
interactiveCellId: interactiveCellId,
|
|
111
|
-
className: classes,
|
|
112
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
113
|
-
top: "".concat(parseFloat(style.top) + headerRowHeight, "px")
|
|
114
|
-
}),
|
|
115
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
116
|
-
rowHeightUtils: rowHeightUtils,
|
|
117
|
-
setRowHeight: isFirstColumn ? setRowHeight : undefined,
|
|
118
|
-
rowManager: rowManager,
|
|
119
|
-
popoverContext: popoverContext,
|
|
120
|
-
pagination: pagination
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
if (isLeadingControlColumn) {
|
|
124
|
-
var leadingColumn = leadingControlColumns[columnIndex];
|
|
125
|
-
var id = leadingColumn.id,
|
|
126
|
-
rowCellRender = leadingColumn.rowCellRender;
|
|
127
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
128
|
-
columnId: id,
|
|
129
|
-
width: leadingColumn.width,
|
|
130
|
-
renderCellValue: rowCellRender,
|
|
131
|
-
isExpandable: false
|
|
132
|
-
}));
|
|
133
|
-
} else if (isTrailingControlColumn) {
|
|
134
|
-
var columnOffset = columns.length + leadingControlColumns.length;
|
|
135
|
-
var trailingColumnIndex = columnIndex - columnOffset;
|
|
136
|
-
var trailingColumn = trailingControlColumns[trailingColumnIndex];
|
|
137
|
-
var _id = trailingColumn.id,
|
|
138
|
-
_rowCellRender = trailingColumn.rowCellRender;
|
|
139
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
140
|
-
columnId: _id,
|
|
141
|
-
width: trailingColumn.width,
|
|
142
|
-
renderCellValue: _rowCellRender,
|
|
143
|
-
isExpandable: false
|
|
144
|
-
}));
|
|
145
|
-
} else {
|
|
146
|
-
// this is a normal data cell
|
|
147
|
-
var columnType = schema[columnId] ? schema[columnId].columnType : null;
|
|
148
|
-
var isExpandable = column.isExpandable !== undefined ? column.isExpandable : true;
|
|
149
|
-
var width = columnWidths[columnId] || defaultColumnWidth;
|
|
150
|
-
cellContent = (0, _react2.jsx)(_data_grid_cell.EuiDataGridCell, (0, _extends2.default)({}, sharedCellProps, {
|
|
151
|
-
columnId: columnId,
|
|
152
|
-
column: column,
|
|
153
|
-
columnType: columnType,
|
|
154
|
-
width: width || undefined,
|
|
155
|
-
renderCellValue: renderCellValue,
|
|
156
|
-
renderCellPopover: renderCellPopover,
|
|
157
|
-
interactiveCellId: interactiveCellId,
|
|
158
|
-
isExpandable: isExpandable
|
|
159
|
-
}));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return cellContent;
|
|
163
|
-
}; // Context is required to pass props to react-window's innerElementType
|
|
164
|
-
// @see https://github.com/bvaughn/react-window/issues/404
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
exports.Cell = Cell;
|
|
168
|
-
var DataGridWrapperRowsContext = /*#__PURE__*/(0, _react.createContext)({
|
|
169
|
-
headerRow: (0, _react2.jsx)("div", null),
|
|
170
|
-
headerRowHeight: 0,
|
|
171
|
-
footerRow: null
|
|
172
|
-
});
|
|
173
|
-
exports.DataGridWrapperRowsContext = DataGridWrapperRowsContext;
|
|
174
|
-
var InnerElement = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
175
|
-
var children = _ref2.children,
|
|
176
|
-
style = _ref2.style,
|
|
177
|
-
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
178
|
-
|
|
179
|
-
var _useContext3 = (0, _react.useContext)(DataGridWrapperRowsContext),
|
|
180
|
-
headerRowHeight = _useContext3.headerRowHeight,
|
|
181
|
-
headerRow = _useContext3.headerRow,
|
|
182
|
-
footerRow = _useContext3.footerRow;
|
|
183
|
-
|
|
184
|
-
return (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
185
|
-
ref: ref,
|
|
186
|
-
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
187
|
-
height: style.height + headerRowHeight
|
|
188
|
-
})
|
|
189
|
-
}, rest), headerRow, children), footerRow);
|
|
190
|
-
});
|
|
191
|
-
InnerElement.displayName = 'EuiDataGridInnerElement';
|
|
192
|
-
|
|
193
|
-
var EuiDataGridBody = function EuiDataGridBody(props) {
|
|
194
|
-
var leadingControlColumns = props.leadingControlColumns,
|
|
195
|
-
trailingControlColumns = props.trailingControlColumns,
|
|
196
|
-
columns = props.columns,
|
|
197
|
-
visibleColCount = props.visibleColCount,
|
|
198
|
-
schema = props.schema,
|
|
199
|
-
schemaDetectors = props.schemaDetectors,
|
|
200
|
-
rowCount = props.rowCount,
|
|
201
|
-
_props$visibleRows = props.visibleRows,
|
|
202
|
-
startRow = _props$visibleRows.startRow,
|
|
203
|
-
endRow = _props$visibleRows.endRow,
|
|
204
|
-
visibleRowCount = _props$visibleRows.visibleRowCount,
|
|
205
|
-
renderCellValue = props.renderCellValue,
|
|
206
|
-
renderCellPopover = props.renderCellPopover,
|
|
207
|
-
renderFooterCellValue = props.renderFooterCellValue,
|
|
208
|
-
interactiveCellId = props.interactiveCellId,
|
|
209
|
-
pagination = props.pagination,
|
|
210
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
211
|
-
handleHeaderMutation = props.handleHeaderMutation,
|
|
212
|
-
setVisibleColumns = props.setVisibleColumns,
|
|
213
|
-
switchColumnPos = props.switchColumnPos,
|
|
214
|
-
onColumnResize = props.onColumnResize,
|
|
215
|
-
rowHeightsOptions = props.rowHeightsOptions,
|
|
216
|
-
virtualizationOptions = props.virtualizationOptions,
|
|
217
|
-
isFullScreen = props.isFullScreen,
|
|
218
|
-
gridStyles = props.gridStyles,
|
|
219
|
-
gridWidth = props.gridWidth,
|
|
220
|
-
gridRef = props.gridRef,
|
|
221
|
-
gridItemsRendered = props.gridItemsRendered,
|
|
222
|
-
wrapperRef = props.wrapperRef;
|
|
223
|
-
/**
|
|
224
|
-
* Grid refs & observers
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
var wrapperDimensions = (0, _resize_observer.useResizeObserver)(wrapperRef.current);
|
|
228
|
-
var outerGridRef = (0, _react.useRef)(null); // container that becomes scrollable
|
|
229
|
-
|
|
230
|
-
var innerGridRef = (0, _react.useRef)(null); // container sized to fit all content
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Scroll bars
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
var _useScrollBars = (0, _scrolling.useScrollBars)(outerGridRef, gridStyles.border),
|
|
237
|
-
scrollBarHeight = _useScrollBars.scrollBarHeight,
|
|
238
|
-
hasVerticalScroll = _useScrollBars.hasVerticalScroll,
|
|
239
|
-
hasHorizontalScroll = _useScrollBars.hasHorizontalScroll,
|
|
240
|
-
scrollBorderOverlay = _useScrollBars.scrollBorderOverlay;
|
|
241
|
-
/**
|
|
242
|
-
* Widths
|
|
243
|
-
*/
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var virtualizeContainerWidth = (0, _grid_height_width.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
|
|
247
|
-
|
|
248
|
-
var defaultColumnWidth = (0, _col_widths.useDefaultColumnWidth)(virtualizeContainerWidth, leadingControlColumns, trailingControlColumns, columns);
|
|
249
|
-
|
|
250
|
-
var _useColumnWidths = (0, _col_widths.useColumnWidths)({
|
|
251
|
-
columns: columns,
|
|
252
|
-
leadingControlColumns: leadingControlColumns,
|
|
253
|
-
trailingControlColumns: trailingControlColumns,
|
|
254
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
255
|
-
onColumnResize: onColumnResize
|
|
256
|
-
}),
|
|
257
|
-
columnWidths = _useColumnWidths.columnWidths,
|
|
258
|
-
setColumnWidth = _useColumnWidths.setColumnWidth,
|
|
259
|
-
getColumnWidth = _useColumnWidths.getColumnWidth;
|
|
260
|
-
/**
|
|
261
|
-
* Header & footer
|
|
262
|
-
*/
|
|
22
|
+
var _excluded = ["renderCustomGridBody"];
|
|
263
23
|
|
|
24
|
+
var EuiDataGridBody = function EuiDataGridBody(_ref) {
|
|
25
|
+
var renderCustomGridBody = _ref.renderCustomGridBody,
|
|
26
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
264
27
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
setVisibleColumns: setVisibleColumns,
|
|
270
|
-
leadingControlColumns: leadingControlColumns,
|
|
271
|
-
trailingControlColumns: trailingControlColumns,
|
|
272
|
-
columns: columns,
|
|
273
|
-
columnWidths: columnWidths,
|
|
274
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
275
|
-
setColumnWidth: setColumnWidth,
|
|
276
|
-
schema: schema,
|
|
277
|
-
schemaDetectors: schemaDetectors
|
|
278
|
-
}),
|
|
279
|
-
headerRow = _useDataGridHeader.headerRow,
|
|
280
|
-
headerRowHeight = _useDataGridHeader.headerRowHeight;
|
|
281
|
-
|
|
282
|
-
var _useDataGridFooter = (0, _footer.useDataGridFooter)({
|
|
283
|
-
renderFooterCellValue: renderFooterCellValue,
|
|
284
|
-
renderCellPopover: renderCellPopover,
|
|
285
|
-
rowIndex: visibleRowCount,
|
|
286
|
-
visibleRowIndex: visibleRowCount,
|
|
287
|
-
interactiveCellId: interactiveCellId,
|
|
288
|
-
leadingControlColumns: leadingControlColumns,
|
|
289
|
-
trailingControlColumns: trailingControlColumns,
|
|
290
|
-
columns: columns,
|
|
291
|
-
columnWidths: columnWidths,
|
|
292
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
293
|
-
schema: schema
|
|
294
|
-
}),
|
|
295
|
-
footerRow = _useDataGridFooter.footerRow,
|
|
296
|
-
footerRowHeight = _useDataGridFooter.footerRowHeight;
|
|
297
|
-
/**
|
|
298
|
-
* Handle scrolling cells fully into view
|
|
299
|
-
*/
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
(0, _scrolling.useScroll)({
|
|
303
|
-
gridRef: gridRef,
|
|
304
|
-
outerGridRef: outerGridRef,
|
|
305
|
-
hasGridScrolling: hasVerticalScroll || hasHorizontalScroll,
|
|
306
|
-
headerRowHeight: headerRowHeight,
|
|
307
|
-
footerRowHeight: footerRowHeight,
|
|
308
|
-
visibleRowCount: visibleRowCount,
|
|
309
|
-
hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
|
|
310
|
-
});
|
|
311
|
-
/**
|
|
312
|
-
* Row manager
|
|
28
|
+
/*
|
|
29
|
+
* Determine whether we should use the default EuiDataGridBody
|
|
30
|
+
* + virtualization library for rendering content, or if consumers have
|
|
31
|
+
* passed their own custom renderer
|
|
313
32
|
*/
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
rowClasses: gridStyles.rowClasses
|
|
318
|
-
});
|
|
319
|
-
/**
|
|
320
|
-
* Heights
|
|
321
|
-
*/
|
|
322
|
-
|
|
323
|
-
var rowHeightUtils = (0, _row_heights.useRowHeightUtils)({
|
|
324
|
-
gridRef: gridRef,
|
|
325
|
-
outerGridElementRef: outerGridRef,
|
|
326
|
-
gridItemsRenderedRef: gridItemsRendered,
|
|
327
|
-
gridStyles: gridStyles,
|
|
328
|
-
columns: columns,
|
|
329
|
-
rowHeightsOptions: rowHeightsOptions
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
var _useDefaultRowHeight = (0, _row_heights.useDefaultRowHeight)({
|
|
333
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
334
|
-
rowHeightUtils: rowHeightUtils
|
|
335
|
-
}),
|
|
336
|
-
defaultRowHeight = _useDefaultRowHeight.defaultRowHeight,
|
|
337
|
-
setRowHeight = _useDefaultRowHeight.setRowHeight,
|
|
338
|
-
getRowHeight = _useDefaultRowHeight.getRowHeight;
|
|
339
|
-
|
|
340
|
-
var unconstrainedHeight = (0, _grid_height_width.useUnconstrainedHeight)({
|
|
341
|
-
rowHeightUtils: rowHeightUtils,
|
|
342
|
-
startRow: startRow,
|
|
343
|
-
endRow: endRow,
|
|
344
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
345
|
-
defaultRowHeight: defaultRowHeight,
|
|
346
|
-
headerRowHeight: headerRowHeight,
|
|
347
|
-
footerRowHeight: footerRowHeight,
|
|
348
|
-
scrollBarHeight: scrollBarHeight,
|
|
349
|
-
innerGridRef: innerGridRef
|
|
350
|
-
});
|
|
351
|
-
/**
|
|
352
|
-
* Final grid height & width
|
|
353
|
-
*/
|
|
354
|
-
|
|
355
|
-
var _useFinalGridDimensio = (0, _grid_height_width.useFinalGridDimensions)({
|
|
356
|
-
unconstrainedHeight: unconstrainedHeight,
|
|
357
|
-
unconstrainedWidth: 0,
|
|
358
|
-
// unable to determine this until the container's size is known
|
|
359
|
-
wrapperDimensions: wrapperDimensions,
|
|
360
|
-
wrapperRef: wrapperRef,
|
|
361
|
-
isFullScreen: isFullScreen,
|
|
362
|
-
rowCount: rowCount
|
|
363
|
-
}),
|
|
364
|
-
finalWidth = _useFinalGridDimensio.finalWidth,
|
|
365
|
-
finalHeight = _useFinalGridDimensio.finalHeight;
|
|
366
|
-
/**
|
|
367
|
-
* Grid resets
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
(0, _react.useEffect)(function () {
|
|
372
|
-
if (gridRef.current) {
|
|
373
|
-
gridRef.current.resetAfterColumnIndex(0);
|
|
374
|
-
}
|
|
375
|
-
}, [gridRef, columns, columnWidths, defaultColumnWidth]);
|
|
376
|
-
(0, _react.useEffect)(function () {
|
|
377
|
-
if (gridRef.current && rowHeightsOptions) {
|
|
378
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
379
|
-
}
|
|
380
|
-
}, [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]);
|
|
381
|
-
(0, _react.useEffect)(function () {
|
|
382
|
-
if (gridRef.current) {
|
|
383
|
-
gridRef.current.resetAfterRowIndex(0);
|
|
384
|
-
}
|
|
385
|
-
}, [gridRef, getRowHeight]);
|
|
386
|
-
return _utils.IS_JEST_ENVIRONMENT || finalWidth > 0 ? (0, _react2.jsx)(DataGridWrapperRowsContext.Provider, {
|
|
387
|
-
value: {
|
|
388
|
-
headerRowHeight: headerRowHeight,
|
|
389
|
-
headerRow: headerRow,
|
|
390
|
-
footerRow: footerRow
|
|
391
|
-
}
|
|
392
|
-
}, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, (0, _extends2.default)({}, virtualizationOptions ? virtualizationOptions : {}, {
|
|
393
|
-
ref: gridRef,
|
|
394
|
-
className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
|
|
395
|
-
onItemsRendered: function onItemsRendered(itemsRendered) {
|
|
396
|
-
var _virtualizationOption;
|
|
397
|
-
|
|
398
|
-
gridItemsRendered.current = itemsRendered;
|
|
399
|
-
virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
|
|
400
|
-
},
|
|
401
|
-
innerElementType: InnerElement,
|
|
402
|
-
outerRef: outerGridRef,
|
|
403
|
-
innerRef: innerGridRef,
|
|
404
|
-
columnCount: visibleColCount,
|
|
405
|
-
width: finalWidth,
|
|
406
|
-
columnWidth: getColumnWidth,
|
|
407
|
-
height: finalHeight,
|
|
408
|
-
rowHeight: getRowHeight,
|
|
409
|
-
itemData: {
|
|
410
|
-
schemaDetectors: schemaDetectors,
|
|
411
|
-
setRowHeight: setRowHeight,
|
|
412
|
-
leadingControlColumns: leadingControlColumns,
|
|
413
|
-
trailingControlColumns: trailingControlColumns,
|
|
414
|
-
columns: columns,
|
|
415
|
-
visibleColCount: visibleColCount,
|
|
416
|
-
schema: schema,
|
|
417
|
-
columnWidths: columnWidths,
|
|
418
|
-
defaultColumnWidth: defaultColumnWidth,
|
|
419
|
-
renderCellValue: renderCellValue,
|
|
420
|
-
renderCellPopover: renderCellPopover,
|
|
421
|
-
interactiveCellId: interactiveCellId,
|
|
422
|
-
rowHeightsOptions: rowHeightsOptions,
|
|
423
|
-
rowHeightUtils: rowHeightUtils,
|
|
424
|
-
rowManager: rowManager,
|
|
425
|
-
pagination: pagination
|
|
426
|
-
},
|
|
427
|
-
rowCount: _utils.IS_JEST_ENVIRONMENT || headerRowHeight > 0 ? visibleRowCount : 0
|
|
428
|
-
}), Cell), scrollBorderOverlay) : null;
|
|
33
|
+
return renderCustomGridBody ? (0, _react2.jsx)(_data_grid_body_custom.EuiDataGridBodyCustomRender, (0, _extends2.default)({
|
|
34
|
+
renderCustomGridBody: renderCustomGridBody
|
|
35
|
+
}, props)) : (0, _react2.jsx)(_data_grid_body_virtualized.EuiDataGridBodyVirtualized, props);
|
|
429
36
|
};
|
|
430
37
|
|
|
431
38
|
exports.EuiDataGridBody = EuiDataGridBody;
|