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